Skip to content

CLI Tools

The padrone CLI provides developer tools for scaffolding, linting, linking, and generating documentation for Padrone projects.

Terminal window
npx padrone --help

Scaffold a new Padrone CLI project with a ready-to-run template:

Terminal window
# Create in current directory
padrone init
# Create in a new directory
padrone init my-cli
# With options
padrone init my-cli --name my-tool --description "My awesome CLI" --version 1.0.0

This generates:

  • package.json — dependencies, scripts, and bin field
  • tsconfig.json — TypeScript configuration
  • src/index.ts — starter program with a hello command

After scaffolding:

Terminal window
cd my-cli
bun install
bun run dev # Start with --watch

Options:

OptionDescription
dir (positional)Target directory (defaults to .)
--nameProject name (defaults to directory name)
--descriptionProject description
--versionInitial version (default: 0.1.0)

Lint and validate your CLI program definition. Catches common issues before users encounter them:

Terminal window
# Auto-detect entry from package.json bin field
padrone doctor
# Specify entry file
padrone doctor src/cli.ts

Diagnostics checked:

CheckSeverityDescription
Circular referenceserrorCircular parent refs in command tree
Duplicate aliaseserrorTwo sibling commands share the same name/alias
Duplicate flags/aliaseserrorTwo options in the same command share a flag or alias
Positional not in schemaerrorPositional argument name doesn’t exist in the schema
Multiple variadicserrorMore than one variadic positional argument
Shadowed builtinswarningOptions or commands named help/version
Missing actionwarningLeaf command with no action handler
Missing descriptionwarningSchema property without a description
Variadic not lastwarningVariadic positional not in the last position
Unused interceptorswarningInterceptor with no phase handlers
Unreachable commandswarningNon-hidden command under a hidden parent
Missing command descriptionwarningNon-hidden, non-root command without title or description
Empty command groupswarningBranch command with no reachable leaf descendants
Deprecated without hintwarningdeprecated: true without a replacement message

Exits with code 1 if any errors are found. Warnings don’t affect the exit code.

Link your CLI program for global use during development, without publishing:

Terminal window
# Link the current project (auto-detects from package.json)
padrone link
# Link a specific entry file
padrone link src/cli.ts --name my-tool
# List all linked programs
padrone link --list
# Set up PATH (adds ~/.padrone/bin to your shell config)
padrone link --setup
# Unlink
padrone unlink my-tool

This creates a shim in ~/.padrone/bin/ that runs your entry file with bun. After --setup, the linked CLI is available globally.

Generate shell completion install instructions for a Padrone CLI:

Terminal window
# Show instructions for the current shell
padrone completions
# For a specific CLI program
padrone completions my-tool
# For a specific shell
padrone completions my-tool --for zsh
# Write completions to shell config
padrone completions my-tool --setup

Supports bash, zsh, fish, and powershell.

Generate documentation from your CLI program definition:

Terminal window
# Generate markdown docs
padrone docs src/cli.ts
# Custom output directory and format
padrone docs src/cli.ts --output ./docs/reference --format markdown
# Include hidden commands
padrone docs src/cli.ts --include-hidden
# Preview without writing
padrone docs src/cli.ts --dry-run

Options:

OptionDescription
entry (positional)Entry file exporting a Padrone program
--outputOutput directory (default: ./docs/cli)
--formatOutput format: markdown, html, man (experimental), json
--include-hiddenInclude hidden commands and options
--dry-runPrint what would be generated without writing

Experimental: This command is experimental and may change in future releases.

Generate a type-safe Padrone wrapper for an existing CLI tool by parsing its help output:

Terminal window
# Wrap a CLI tool
padrone wrap docker
# Specify parsing source and output
padrone wrap kubectl --source help --output ./src/kubectl
# Limit subcommand depth
padrone wrap git --depth 2
# Preview without writing
padrone wrap gh --dry-run

Options:

OptionDescription
command (positional)CLI command to wrap (e.g., gh, docker, kubectl)
--sourceParsing source: help, fish, zsh (default: help)
--outputOutput directory (default: ./src/<command>)
--depthMax subcommand depth (default: 4)
--dry-runPrint what would be generated without writing
--overwriteOverwrite existing files
-y, --yesSkip confirmation prompt