@zuke/cli
`@zuke/cli` — the `zuke` command. Install it globally with
@zuke/cli on JSR ↗ 18 symbols
Symbols
interface BuildLocation Where a forwarded command runs, and how.
| Member | Signature | Doc |
|---|---|---|
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. |
launcher | launcher: string | null | The absolute path of the executable zuke launcher at the root, run in place of deno run — or null when there is none, or the platform reports no file mode to tell (Windows). |
engine | engine: string | null | The @zuke/engine release that runs the build when the root has no zuke.ts: the engine field of its zuke.json, which then describes a build another SDK hosts. null when the root has its own build file. |
interface BuildProbe The filesystem questions discovery asks, injectable so the walk and its trust gate are testable without a filesystem or a second user.
| Member | Signature | Doc |
|---|---|---|
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. |
realPath | realPath(path: string): Promise<string> | The path with every link resolved. |
readLink | readLink(path: string): Promise<string | null> | The target a symlink names, exactly as written in the link (possibly relative to the link's directory), or null when path is not a link. |
uid | uid(): number | null | The current user's numeric id, or null where the platform has none. |
readText | readText(path: string): Promise<string> | The text of a file. |
type BuildRunner = unknown Runs program <args> from root — Deno when program is omitted, else the project's launcher at that path — and resolves to its exit code: the injectable subprocess seam, so the forwarding is testable without a build. env adds variables to the environment the child inherits.
const defaultPrompter: Prompter The real Prompter, backed by Deno's prompt/confirm.
type DocRunner = unknown Runs deno doc <args> — the injectable subprocess seam for commandDoc, so the command is testable without spawning deno.
interface ImportFlags Flags accepted by zuke import — the setup flags plus --from.
| Member | Signature | Doc |
|---|---|---|
from? | from?: ImportSource | Force a source (package.json or makefile); auto-detected when unset. |
type ImportSource = package.json | Makefile The kinds of project zuke import can read.
interface InstallHost The process facts installSource reads, injectable so each install kind is testable from a single process.
| Member | Signature | Doc |
|---|---|---|
standalone | standalone(): boolean | Whether this process is a deno compile binary (Deno.build.standalone). |
mainModule | mainModule(): string | The running CLI's main module (Deno.mainModule). Deno reports a JSR program by its specifier, jsr:@zuke/cli or jsr:@zuke/cli@<version>. |
execPath | execPath(): string | The running executable's path (Deno.execPath()). |
realPath | realPath(path: string): Promise<string> | path with every symbolic link resolved (Deno.realPath). |
async function main(args: string[], host?: SetupHost, prompter?: Prompter, docRunner?: DocRunner, starActions?: StarActions, buildRunner?: BuildRunner, buildProbe?: BuildProbe, upgradeHost?: UpgradeHost, projectHost?: ProjectHost): Promise<number> The CLI entry point. Returns a process exit code; host, prompter, docRunner, starActions, buildRunner, buildProbe, upgradeHost and projectHost are injectable for testing.
interface Ownership What the trust gate needs to know about a filesystem entry.
| Member | Signature | Doc |
|---|---|---|
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. |
function parseImportFlags(args: string[]): ImportFlags Parse the argument list following zuke import.
function parseSetupFlags(args: string[]): SetupFlags Parse the argument list following zuke setup.
interface ProjectHost What the project commands reach outside the process, injectable so they are testable without a real deno.
| Member | Signature | Doc |
|---|---|---|
readText | readText(path: string): Promise<string> | Read a text file, rejecting when it cannot be read. |
writeText | writeText(path: string, text: string): Promise<void> | Write a text file, replacing what is there. |
remove | remove(path: string): Promise<void> | Remove a file. |
deno | deno(denoArgs: string[], cwd: string): Promise<number> | Run deno <denoArgs> in cwd, returning its exit code. |
denoVersion | denoVersion(): string | The version of the Deno that runs the command. |
interface Prompter The interactive surface, injectable so the wizard is testable without a TTY.
| Member | Signature | Doc |
|---|---|---|
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. |
interface SetupFlags Flags accepted by zuke setup.
| Member | Signature | Doc |
|---|---|---|
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). |
interface SetupHost Injected side effects, so runSetup is unit-testable.
| Member | Signature | Doc |
|---|---|---|
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. |
isTerminal? | isTerminal?(): boolean | Whether stdout is an interactive terminal, which decides whether the CLI's own output is rich. Optional: an implementation without it is asked through Deno, the way every other process decides. |
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. |
interface StarActions The side effects behind promptStar, injectable so tests never spawn gh or a browser.
| Member | Signature | Doc |
|---|---|---|
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. |
interface UpgradeHost What zuke upgrade reaches outside the process, injectable so the command is testable without the network or a real reinstall.
| Member | Signature | Doc |
|---|---|---|
binDir | binDir(): string | undefined | The directory deno install -g installs into (<root>/bin): DENO_INSTALL_ROOT, else ~/.deno, as Deno resolves it. undefined when the environment names neither as an absolute path. |
exists | exists(path: string): Promise<boolean> | Whether path exists. |
windows | windows(): boolean | Whether this is Windows, where the running shim is a .cmd file. |
meta | meta(): Promise<unknown> | Fetch and parse @zuke/cli's JSR meta.json. |
install | install(denoArgs: string[]): Promise<number> | Run deno <denoArgs> to reinstall, returning its exit code. |
denoVersion | denoVersion(): string | The version of the Deno that runs the reinstall: the one running this CLI, since zuke upgrade only ever runs from a JSR install under Deno. |
readText | readText(path: string): Promise<string> | Read a text file, rejecting when it cannot be read. |