Skip to content

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

Merged
alex-alecu merged 30 commits into
mainfrom
feat/help-all-command
Apr 8, 2026
Merged

feat: add kilo help --all command and auto-generated CLI reference docs#8504
alex-alecu merged 30 commits into
mainfrom
feat/help-all-command

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Re-opens #6116 (from maphew/kilocode) with main merged in and conflict resolved.

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

Closes #6114

Summary

  • Add kilo help --all command that outputs full CLI reference in markdown or plain text format
  • 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

Credit

The quick-reference table format was inspired by @Githubguy132010's contribution in #6294 — 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

maphew and others added 14 commits February 21, 2026 00:20
…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
- Restore JSON→SQLite migration code accidentally removed from middleware
- Replace console.warn with Log.Default.warn in help.ts
- Fix Windows path: use path.resolve(import.meta.dir) instead of new URL().pathname
- Revert unrelated process.stderr.write→console.error change
- Require --all flag explicitly; kilo help with no args shows usage hint

Amp-Thread-ID: https://ampcode.com/threads/T-019ca5c0-c077-76ab-9e52-4a2a7e8ed1a7
Co-authored-by: Amp <amp@ampcode.com>
Comment thread packages/opencode/src/cli/commands.ts Outdated
Comment thread packages/opencode/src/kilocode/help.ts Outdated
Comment thread packages/opencode/src/kilocode/help.ts
@kilo-code-bot

kilo-code-bot Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

The incremental packages/opencode/src/kilocode/commands.ts and packages/opencode/test/kilocode/help.test.ts changes do not introduce new defects.

Previously reported issue for the sync-test robustness at packages/opencode/test/kilocode/help.test.ts:168 is resolved in the current diff. Previously reported issues for global --help, kilo remote, nested subcommands, and the default kilo entrypoint remain resolved.

Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
packages/kilo-docs/pages/code-with-ai/platforms/cli-reference.md 803 The generated CLI reference artifact is still stale and still omits a kilo completion section even though the command barrel exports that command
packages/opencode/test/kilocode/help.test.ts 39 The local command fixture still diverges from the real command registry, so the generated help/table assertions still do not validate the actual exported command list or the synthetic completion entry
Files Reviewed (2 files)
  • packages/opencode/src/kilocode/commands.ts - 0 issues
  • packages/opencode/test/kilocode/help.test.ts - 0 new issues

Reviewed by gpt-5.4-20260305 · 667,585 tokens

Comment thread packages/opencode/src/kilocode/commands.ts Outdated
@markijbema markijbema force-pushed the feat/help-all-command branch 2 times, most recently from 207e81c to 7901bb6 Compare April 7, 2026 16:58
… cli-reference

The shell-completion entrypoint was registered via .completion() in index.ts
but missing from the commands array used by generateHelp(). This meant
kilo help --all and cli-reference.md never included it.

Add a synthetic CommandModule entry for completion to commands.ts and remove
the now-redundant manual row in generateCommandTable().
… typecheck

UpgradeCommand and UninstallCommand are plain object literals (no cmd()
wrapper) whose handler param types don't satisfy CommandModule<any, any>.
Remove the annotation and let TypeScript infer the union type — consumers
already cast via loadCommands().
Comment thread packages/opencode/test/kilocode/help.test.ts
Comment thread packages/opencode/src/kilocode/commands.ts
The .help('help', ...) method registers yargs' built-in help command
which shadows the custom HelpCommand registered on the same 'help' path.
This means 'kilo help --all' never reaches the custom handler.

Fix by:
- Replacing .help('help', ...) with .help(false) + .option('help', ...)
  to disable the built-in command while keeping --help/-h flags
- Adding early-exit handlers in middleware for --help and --version
  to skip expensive initialization (telemetry, DB migration)
Comment thread packages/opencode/src/index.ts Outdated
Comment thread packages/opencode/test/kilocode/help.test.ts
@alex-alecu

Copy link
Copy Markdown
Contributor
Screenshot 2026-04-08 at 14 45 59

@alex-alecu alex-alecu merged commit 242c167 into main Apr 8, 2026
16 checks passed
@alex-alecu alex-alecu deleted the feat/help-all-command branch April 8, 2026 11:46
jliounis pushed a commit to jliounis/kilocode that referenced this pull request May 18, 2026
feat: add kilo help --all command and auto-generated CLI reference docs
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.

[FEATURE]: add kilo help --all command and auto-generated CLI reference docs

3 participants