cli-creation

Original🇺🇸 English
Translated
3 scriptsChecked / no sensitive code detected

Build consumer-facing DreamCLI CLIs from scratch with Bun-first workflows and typed patterns. Use when asked to scaffold or implement a new @kjanat/dreamcli command-line app, add commands/flags/args/prompts/output/testing, or create starter files/tests for DreamCLI users.

17installs
Added on

NPX Install

npx skill4agent add kjanat/dreamcli cli-creation

Tags

Translated version includes tags in frontmatter

CLI Creation

Overview

Create runnable DreamCLI starter CLIs and extend them with typed command patterns. Use this skill for user-facing app code, not DreamCLI framework internals.

Quick Start

  1. Choose a starter mode:
    • single
      : one root command (
      cli(name).default(command)
      ).
    • multi
      : grouped command surface (
      group('...').command(...)
      ).
  2. Generate starter files:
    • python scripts/scaffold_cli.py --name mycli --mode single --out .
    • Tests are generated by default; add
      --no-test
      only when explicitly requested.
    • Test template is auto-detected: Bun without Vitest uses
      bun:test
      ; otherwise a Vitest template is generated.
  3. Run and validate generated files:
    • Use the printed path from the scaffolder output, for example
      bun ./mycli.ts --help
      .
    • Run the generated test unless
      --no-test
      was used.
  4. Extend behavior with references:
    • references/consumer-workflow.md
    • references/pattern-cookbook.md
    • references/runtime-notes.md

Grounding Sources

  • Use
    examples/standalone/basic.ts
    for single-command defaults.
  • Use
    examples/standalone/multi-command.ts
    for grouped-command defaults.
  • Use
    examples/standalone/testing.ts
    for
    runCommand()
    patterns.
  • Use
    apps/docs/guide/getting-started.md
    for baseline consumer narrative.
  • Use
    apps/docs/guide/walkthrough.md
    for richer end-to-end CLI composition.

Workflow Decision Tree

  • User asks for a simple one-command utility:
    • Use
      --mode single
      .
  • User asks for nested command groups (git/gh style):
    • Use
      --mode multi
      .
  • User asks for tests from the start:
    • Do nothing; tests are scaffolded by default.
  • User explicitly asks for no tests:
    • Add
      --no-test
      .
  • User asks for npm/tsx or Deno instructions:
    • Keep generated code unchanged and provide runtime command alternatives from
      references/runtime-notes.md
      .

Extend the Starter

  • Add typed args with
    arg.string()
    ,
    arg.number()
    ,
    arg.enum(...)
    , and
    arg.custom(...)
    .
  • For repeated positionals, use
    .variadic()
    on an arg definition.
  • Add typed flags with defaults and aliases via
    flag.*()
    .
  • Add env/config/prompt sources on each flag before action logic.
  • Branch on
    out.jsonMode
    for machine-readable responses.
  • Use
    runCommand()
    from
    @kjanat/dreamcli/testkit
    for in-process tests.
  • Keep output assertions explicit, including trailing newlines.

Resource Map

  • scripts/scaffold_cli.py
    • Generate Bun-first starter files and optional tests.
  • assets/templates/*.tpl
    • Source templates used by the scaffold script.
  • references/consumer-workflow.md
    • End-to-end flow from request to validated CLI.
  • references/pattern-cookbook.md
    • Copy-ready snippets for common DreamCLI features.
  • references/runtime-notes.md
    • Runtime and package-manager execution guidance.

Guardrails

  • Do not modify DreamCLI core internals for consumer-app requests.
  • Keep generated imports on
    @kjanat/dreamcli
    and
    @kjanat/dreamcli/testkit
    .
  • Preserve typed resolution flow: argv -> env -> config -> prompt -> default.
  • Prefer Bun commands first; include npm/tsx and Deno alternatives when requested.