Skip to content

feat: add kilo help --all command and auto-generated CLI reference docs#6104

Closed
maphew wants to merge 5 commits intoKilo-Org:mainfrom
maphew:feat/help-all-command
Closed

feat: add kilo help --all command and auto-generated CLI reference docs#6104
maphew wants to merge 5 commits intoKilo-Org:mainfrom
maphew:feat/help-all-command

Conversation

@maphew
Copy link
Copy Markdown
Contributor

@maphew maphew commented Feb 22, 2026

Note: Re-created from Kilo-Org/kilo#571 per @markijbema's request, since the repo has moved to kilocode.

Summary

  • Add kilo help --all command that outputs full CLI reference in markdown or plain text format (Investigate switching to bun or deno #560)
  • Add generateCommandTable() function that produces a markdown command table from the command barrel
  • Auto-generate two docs artifacts via script/generate.ts: a Markdoc partial for the command table and a full CLI Command Reference page
  • Replace the hand-written (stale) command table in cli.md with the generated partial
  • Add CLI Command Reference nav entry in the docs site

Closes #560, closes #572

Credit

The quick-reference table format was inspired by @Githubguy132010's contribution in #560 — thanks for the idea!

Changes

kilo help command

  • src/kilocode/help.ts — Core generateHelp() + new generateCommandTable() functions
  • src/kilocode/help-command.tsHelpCommand yargs CommandModule
  • src/cli/commands.ts — Barrel file exporting all CommandModule objects
  • src/index.ts — Replaced 19 individual .command() calls with barrel import + loop

Auto-generated docs

  • script/generate-cli-docs.ts — Generation script (runs with --conditions=browser)
  • src/kilocode/generate-cli-docs.ts — Entrypoint that writes both generated files
  • script/generate.ts — Added CLI docs generation step before format
  • packages/kilo-docs/markdoc/partials/cli-commands-table.md — Generated command table partial
  • packages/kilo-docs/pages/code-with-ai/platforms/cli-reference.md — Generated full reference page

Docs site updates

  • packages/kilo-docs/pages/code-with-ai/platforms/cli.md — Replaced hand-written table with {% partial %}
  • packages/kilo-docs/lib/nav/code-with-ai.ts — Added "Command Reference" subLink under CLI

Usage

kilo help --all                    # Full CLI reference in Markdown
kilo help auth                     # Scoped to auth command + subcommands
kilo help --all --format text      # Plain text format
kilo help --all > REFERENCE.md     # Pipeable to file

Testing

  • 15 tests in test/kilocode/help.test.ts (no mocks) — markdown/text output, subcommands, filtering, ANSI stripping, table generation, edge cases
  • Typecheck clean (bun turbo typecheck)
  • Docs build succeeds with new cli-reference page

…or text

Add a 'kilo help' command that outputs the full CLI reference as Markdown
or plain text, with support for scoping to a single command.

- Extract command registrations into src/cli/commands.ts barrel
- Implement generateHelp() in src/kilocode/help.ts using yargs internals
- Add HelpCommand with --all, --format, and [command] positional
- 8 tests covering markdown/text output, scoping, ANSI stripping, errors
Add generateCommandTable() to help.ts and a generation script that
produces two artifacts: a Markdoc partial for the command table and
a full CLI reference page. Both are generated by script/generate.ts
and auto-committed by the generate.yml workflow on push to dev.

Replace hand-written command table in cli.md with the generated
partial and add a nav entry for the new CLI Command Reference page.

Closes #572
…add AttachStub

- Add missing await on .rejects.toThrow() assertion (false-positive risk)
- Gate generateHelp on options.all so callers get empty output when
  neither all nor command is set
- Sanitize process.cwd() paths in generated CLI reference (was leaking
  developer's local path into published docs)
- Add AttachCommand stub to test commands array for full coverage
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 22, 2026

⚠️ No Changeset found

Latest commit: 81b1904

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Feb 22, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (14 files)
  • packages/kilo-docs/lib/nav/code-with-ai.ts - Nav update for CLI reference sublink
  • packages/kilo-docs/markdoc/partials/cli-commands-table.md - Auto-generated command table (new)
  • packages/kilo-docs/pages/code-with-ai/platforms/cli-reference.md - Auto-generated full reference (new)
  • packages/kilo-docs/pages/code-with-ai/platforms/cli.md - Replaced hand-written table with partial
  • packages/opencode/src/cli/commands.ts - New commands barrel (new)
  • packages/opencode/src/index.ts - Refactored to use commands barrel
  • packages/opencode/src/kilocode/generate-cli-docs.ts - Doc generation script (new)
  • packages/opencode/src/kilocode/help-command.ts - Help command implementation (new)
  • packages/opencode/src/kilocode/help.ts - Core help generation logic (new)
  • packages/opencode/test/kilocode/help.test.ts - Tests (new)
  • script/generate-cli-docs.ts - Root-level generation script (new)
  • script/generate.ts - Updated to include CLI docs generation
  • specs/cli-docs-generation.md - Spec document (new)
  • specs/help-all-command.md - Spec document (new)
Notes (click to expand)
  • Clean implementation that makes CLI code the single source of truth for documentation.
  • The yargs internal API usage in help.ts (getInternalMethods().getCommandInstance().getCommandHandlers()) is properly guarded with try/catch and a warning log — good defensive coding for an unstable API.
  • Tests use real command definitions (no mocks) and cover markdown/text formats, scoped help, edge cases, and the command table generator.
  • The commands.ts barrel extraction is a nice refactor that benefits both the help system and index.ts readability.
  • kilocode_change markers are correctly applied on shared files (commands.ts, index.ts) and omitted in kilocode/ directory files.

@maphew maphew closed this by deleting the head repository Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant