feat: add kilo help --all command and auto-generated CLI reference docs#571
feat: add kilo help --all command and auto-generated CLI reference docs#571maphew wants to merge 6 commits intoKilo-Org:devfrom
Conversation
…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
Code Review SummaryStatus: No Issues Found | Recommendation: Merge All previously flagged issues (empty catch block, missing Highlights
Files Reviewed (10 files)
|
Note on duplicate PRThere's also #570 targeting this issue. Both are valid approaches — here's a quick comparison for reviewers: #570 uses a static registry — a hand-written data structure (~250 lines) describing every command, option, and subcommand. The output is nicely formatted with Markdown tables for options and a version banner. The downside is that the registry must be manually updated whenever commands change, and nothing enforces that. A few descriptions have already drifted from the actual command definitions (e.g. This PR (#571) uses dynamic introspection — it walks the real
Either approach works — the core question is whether the team prefers polished static output that needs maintenance, or auto-generated output that stays correct on its own. |
| }): Promise<string> { | ||
| const format = options.format ?? "md" | ||
|
|
||
| const all = options.commands ?? (await loadCommands()) |
There was a problem hiding this comment.
[WARNING]: options.all is accepted but never read
The all boolean in the function signature (line 159) is never checked. When no command is specified, generateHelp always returns help for every command regardless of options.all. This means generateHelp({ all: false }) still dumps the full reference.
Either use the flag to gate the behavior (e.g., return early or show a usage hint when all is falsy and no command is set), or remove it from the signature to avoid confusing future callers.
There was a problem hiding this comment.
Fixed in 81b1904 — options.all now gates the filtering via an IIFE. When neither all nor command is set, relevant is empty and the function returns an empty string.
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
packages/kilo-docs/pages/code-with-ai/platforms/cli-reference.md
Outdated
Show resolved
Hide resolved
…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
|
Hi! Thank you for taking the time to contribute to this project—we really appreciate it. 🙏 We are currently working on re-platforming the core of our VS Code and JetBrains extensions to be based on our new Kilo CLI, with a complete rebuild based on OpenCode as our new foundation, and the moment has come to promote this repository to become the main repository. To do that, we moved the code from this repository to the kilocode repository. This unfortunately means we cannot merge this branch here anymore. Please add https://github.com/Kilo-Org/kilocode.git as a remote, and push your branch there and create a new PR in https://github.com/Kilo-Org/kilocode . We unfortunately cannot do this for you as then the PR would not be in your name anymore. If you need any help, feel free to ask on our Discord in #kilo-dev-contributors Sorry for the inconvenience and thank you for contributing to Kilo! |
Summary
kilo help --allcommand that outputs full CLI reference in markdown or plain text format (#560)generateCommandTable()function that produces a markdown command table from the command barrelscript/generate.ts: a Markdoc partial for the command table and a full CLI Command Reference pagecli.mdwith the generated partialCloses Kilo-Org/kilocode#6294, closes Kilo-Org/kilocode#6291
Credit
The quick-reference table format was inspired by @Githubguy132010's contribution in Kilo-Org/kilocode#6294 — thanks for the idea!
Changes
kilo helpcommandsrc/kilocode/help.ts— CoregenerateHelp()+ newgenerateCommandTable()functionssrc/kilocode/help-command.ts—HelpCommandyargs CommandModulesrc/cli/commands.ts— Barrel file exporting all CommandModule objectssrc/index.ts— Replaced 19 individual.command()calls with barrel import + loopAuto-generated docs
script/generate-cli-docs.ts— Generation script (runs with--conditions=browser)src/kilocode/generate-cli-docs.ts— Entrypoint that writes both generated filesscript/generate.ts— Added CLI docs generation step before formatpackages/kilo-docs/markdoc/partials/cli-commands-table.md— Generated command table partialpackages/kilo-docs/pages/code-with-ai/platforms/cli-reference.md— Generated full reference pageDocs 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 CLIUsage
Testing
test/kilocode/help.test.ts(no mocks) — markdown/text output, subcommands, filtering, ANSI stripping, table generation, edge casesbun turbo typecheck)cli-referencepage