@zuke/cli

← API reference

`@zuke/cli` — the `zuke` command. Install it globally with

Symbols

#

BuildLocation

interface
interface BuildLocation

Where a forwarded command runs, and how.

MemberSignatureDoc
root root: string The absolute repository root: the directory holding zuke.json.
frozen frozen: boolean Whether a deno.lock sits at the root, so the run passes --frozen.
#

BuildProbe

interface
interface BuildProbe

The filesystem questions discovery asks, injectable so the walk and its trust gate are testable without a filesystem or a second user.

MemberSignatureDoc
exists exists(path: string): Promise<boolean> Whether a path exists (the link itself, not its target).
ownership ownership(path: string): Promise<Ownership | null> The owner and mode of what a path resolves to, or null when nothing is there.
uid uid(): number | null The current user's numeric id, or null where the platform has none.
#

BuildRunner

type
type BuildRunner = unknown

Runs deno <denoArgs> from root and resolves to its exit code — the injectable subprocess seam, so the forwarding is testable without a build.

#

defaultPrompter

const
const defaultPrompter: Prompter

The real Prompter, backed by Deno's prompt/confirm.

#

DocRunner

type
type DocRunner = unknown

Runs deno doc <args> — the injectable subprocess seam for commandDoc, so the command is testable without spawning deno.

#

ImportFlags

interface
interface ImportFlags

Flags accepted by zuke import — the setup flags plus --from.

MemberSignatureDoc
from? from?: ImportSource Force a source (package.json or makefile); auto-detected when unset.
#

ImportSource

type
type ImportSource = package.json | Makefile

The kinds of project zuke import can read.

#

main

function
async function main(args: string[], host?: SetupHost, prompter?: Prompter, docRunner?: DocRunner, starActions?: StarActions, buildRunner?: BuildRunner, buildProbe?: BuildProbe): Promise<number>

The CLI entry point. Returns a process exit code; host, prompter, docRunner, starActions, buildRunner, and buildProbe are injectable for testing.

#

Ownership

interface
interface Ownership

What the trust gate needs to know about a filesystem entry.

MemberSignatureDoc
uid uid: number | null The numeric owner, or null where the platform reports none (Windows).
mode mode: number | null The permission bits, or null where the platform reports none.
#

parseImportFlags

function
function parseImportFlags(args: string[]): ImportFlags

Parse the argument list following zuke import.

#

parseSetupFlags

function
function parseSetupFlags(args: string[]): SetupFlags

Parse the argument list following zuke setup.

#

Prompter

interface
interface Prompter

The interactive surface, injectable so the wizard is testable without a TTY.

MemberSignatureDoc
interactive interactive(): boolean Whether prompts should be shown (i.e. stdin is a terminal).
ask ask(question: string, fallback: string): string Ask a free-text question, returning fallback if unanswered.
confirm confirm(question: string): boolean Ask a yes/no question.
#

resolveDocSpec

function
function resolveDocSpec(pkg: string | undefined): string | undefined

Resolve a zuke doc argument to a deno doc specifier: a bare package name (core) becomes jsr:@zuke/core, a scoped name (@scope/pkg) becomes jsr:@scope/pkg, and an explicit jsr:/npm:/https:/file:/path specifier is passed through unchanged. Returns undefined for no argument.

#

SetupFlags

interface
interface SetupFlags

Flags accepted by zuke setup.

MemberSignatureDoc
force force: boolean Overwrite existing files.
yes yes: boolean Skip prompts and accept defaults.
name? name?: string Build class name for the starter zuke.ts.
dir? dir?: string Directory to scaffold into (defaults to the current directory).
launcherName? launcherName?: string Base name for the launcher scripts, when zuke is taken by a directory.
mcp mcp: boolean Also write .mcp.json, registering the build's MCP server for agent clients.
allowRun allowRun: boolean Register that server with --allow-run, so the agent may execute targets. Implies mcp.
bootstrapDeno? bootstrapDeno?: boolean Which launchers to scaffold: true (--bootstrap-deno) for ones that install a pinned, checksum-verified Deno when none is on PATH, false (--no-bootstrap-deno) for ones that require it and fail closed. Unset: ask when interactive, else take the default (bootstrap).
#

SetupHost

interface
interface SetupHost

Injected side effects, so runSetup is unit-testable.

MemberSignatureDoc
exists exists(path: string): Promise<boolean> Whether a path exists.
isDirectory isDirectory(path: string): Promise<boolean> Whether a path exists and is a directory (a reserved-name collision).
isSymlink isSymlink(path: string): Promise<boolean> Whether a path is a symbolic link, without following it. Scaffolding refuses to write through one: the writes below follow links, so a link planted at a scaffold name by the very repository being set up would redirect them outside the target directory. The guard covers the names scaffolding chooses, which is where the hazard is — the caller never asked for .gitignore to be written, so a repository redirecting it is a decision nobody made. It reports what is there when it runs, and a link planted after it would escape it; that is why SetupHost.writeText does not write through a link either, so the refusal is the friendly answer rather than the only defence. Two things stay out of scope. The directory the caller names with --dir is the caller's to name, symlink or not. And a hard link is indistinguishable from the file it shares, so no probe can see one; git cannot check one out either, which is what keeps it out of the threat this guards.
readText readText(path: string): Promise<string> Read a file as UTF-8 text.
writeText writeText(path: string, content: string): Promise<void> Write UTF-8 text to a file, creating or replacing it. An implementation must not write *through* a symbolic link standing at path: the scaffolder's confinement to its target directory rests on this, and the pre-write SetupHost.isSymlink check alone cannot carry it, since a link can appear after the check.
chmod chmod(path: string, mode: number): Promise<void> Set a file's permission bits (may be unsupported on some platforms).
log log(message: string): void Emit a line of progress output.
#

StarActions

interface
interface StarActions

The side effects behind promptStar, injectable so tests never spawn gh or a browser.

MemberSignatureDoc
ghAuthenticated ghAuthenticated(): Promise<boolean> Whether the gh CLI is installed and holds a login.
starWithGh starWithGh(): Promise<void> Star the Zuke repository through gh api.
openBrowser openBrowser(url: string): Promise<boolean> Open url in the default browser; false when it could not launch.