@zuke/cli

← API reference

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

Symbols

# 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): Promise<number>

The CLI entry point. Returns a process exit code; host/prompter/docRunner are injectable for testing.

# 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.
# 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).
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 truncating it.
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.