Skip to content

refactor(cli): colocate --help examples in command files - #202

Merged
jrusso1020 merged 1 commit into
mainfrom
refactor/colocate-cli-examples
Apr 2, 2026
Merged

refactor(cli): colocate --help examples in command files#202
jrusso1020 merged 1 commit into
mainfrom
refactor/colocate-cli-examples

Conversation

@jrusso1020

Copy link
Copy Markdown
Collaborator

What

Move per-command --help examples from the centralized help.ts record into each command file as export const examples: Example[].

Why

Previously, adding a CLI command required editing two files: the command definition (commands/<name>.ts) and the examples record (help.ts). This made it easy to forget examples for new commands. Now examples live next to the command they document — one file to add, one file to review.

How

  • Created commands/_examples.ts with the shared Example type
  • Each command file now exports examples: Example[] alongside its export default defineCommand(...)
  • help.ts dynamically imports examples via import(\./commands/${name}.js`)at--help` time
  • STATIC_EXAMPLES in help.ts handles commands without their own file (e.g. skills)
  • Updated CLAUDE.md checklist to reference the new pattern

Test plan

  • Verified --help output for tts, transcribe, render, and root — all show examples correctly
  • Lint, format, and typecheck all pass
  • Pre-commit hooks pass

Base automatically changed from feat/tts-command to main April 2, 2026 21:09
Move per-command examples from the centralized `help.ts` record into
each command file as `export const examples: Example[]`. help.ts now
dynamically imports them at --help time.

This means adding a new command and its examples happens in one file
instead of two, reducing the chance of forgetting examples.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jrusso1020
jrusso1020 force-pushed the refactor/colocate-cli-examples branch from 133894e to a96784d Compare April 2, 2026 21:10
@jrusso1020
jrusso1020 merged commit 5e8ff36 into main Apr 2, 2026
14 checks passed
@jrusso1020
jrusso1020 deleted the refactor/colocate-cli-examples branch April 2, 2026 21:11
miguel-heygen pushed a commit that referenced this pull request Apr 3, 2026
Move per-command examples from the centralized `help.ts` record into
each command file as `export const examples: Example[]`. help.ts now
dynamically imports them at --help time.

This means adding a new command and its examples happens in one file
instead of two, reducing the chance of forgetting examples.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dahans-msft2 pushed a commit to dahans-msft2/hyperframes that referenced this pull request Aug 6, 2026
)

Move per-command examples from the centralized `help.ts` record into
each command file as `export const examples: Example[]`. help.ts now
dynamically imports them at --help time.

This means adding a new command and its examples happens in one file
instead of two, reducing the chance of forgetting examples.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants