Skip to content

docs(cli): add a CLI docs section generated from the command tree - #6762

Merged
waleedlatif1 merged 3 commits into
stagingfrom
docs/cli-section
Aug 16, 2026
Merged

docs(cli): add a CLI docs section generated from the command tree#6762
waleedlatif1 merged 3 commits into
stagingfrom
docs/cli-section

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a CLI tab to the docs, and moves Academy last. The sim CLI shipped with no coverage in the docs site.
  • The command reference is generated from the CLI's own command tree — 147 leaf commands across 33 groups, most derived at runtime from the v2 route contracts, so a hand-written reference would rot immediately. check:cli-docs is a zero-arg check:* script, so the existing audit runner picks it up and stale pages fail CI.
  • Plumbs the contracts' existing .describe() prose into the CLI. 223 of 377 flags previously rendered as Set sort by: the contracts carry 931 .describe() calls and the OpenAPI specs publish all of them, but the generated operation table dropped every one. Now --help and the docs explain a flag the same way the API reference does. Placeholder descriptions are zero; 147/147 commands, 377/377 flags and 130/130 arguments are documented.
  • Fixes a command collision the generator surfaced: bulkUpdateKnowledgeDocuments and updateKnowledgeDocument both derived to sim knowledge documents update. Commander resolves duplicates to the first match, so the bulk form shadowed the single-document one and its flags were unreachable while still appearing in --help. The bulk form is now batch-update, matching how tables rows batch-delete/batch-update already handle the same REST overload.
  • Six hand-written guides: install, authentication, configuration, output formats, scripting, troubleshooting. Plus a single-page Complete reference carrying every command, for in-page search and for agents fetching /cli/reference.mdx.
  • Corrects two commands in the package README that do not exist as documented (tables columns <tableId>, and --sort score:desc, which is JSON), and drops the prerelease install channels from the docs and README.

Three guards keep this honest in CI: stale pages fail, duplicate command paths fail, and a request field with no .describe() fails rather than rendering as documentation that says nothing. Each was verified to actually fail.

Important

npm's latest for sim still points at the previous owner's unrelated 1.0.18 package. The publish workflow only moves latest on a push to main, so npm install --global sim — the first command on the landing page — installs the wrong package until the CLI lands there. Worth sequencing the merges.

Type of Change

  • Documentation
  • Bug fix (unreachable knowledge documents update)

Testing

  • 147/147 commands, 377/377 flags, 130/130 arguments documented; 0 placeholder descriptions; 0 broken internal links
  • Extracted every command and flag claimed in the hand-written guides and executed all of them against the built binary — 28 commands and their flags verified
  • Each of the three CI guards verified to fail when its condition is broken
  • bun run check:audits (28/28), 242 CLI tests, type-checks clean on packages/sim-cli and apps/docs, full docs site builds and all CLI routes render

Not verified against a live API: response shapes come from the route contracts, and no command was run against a real deployment.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@waleedlatif1
waleedlatif1 requested a review from a team as a code owner August 16, 2026 02:09
@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 16, 2026 2:27am

Request Review

@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are primarily documentation and docs-site navigation; no production API or auth paths in the shown diff. CLI command-path rename is a user-facing fix with low blast radius if the generator and checks land together.

Overview
Adds a CLI section to the docs site with a new navbar tab (Documentation → API Reference → CLI → Academy) and fixes section matching so paths like integrations pages do not falsely activate the CLI tab.

Navigation and layout: CLI pages keep prev/next links inside /cli (same pattern as API Reference and Academy). Generated reference pages use a new CommandTable wrapper for fixed column widths and top-aligned flag/description rows.

Content: A full CLI tree under content/docs/en/cli/ — landing, guides (authentication, configuration, output, scripting, troubleshooting), per-resource command pages, a commands overview, and a single-page complete reference. Command tables are meant to stay in sync with the real CLI via generate:cli-docs / check:cli-docs (per PR description).

CLI behavior (outside the MDX-only hunks): Bulk knowledge document updates are exposed as sim knowledge documents batch-update so they no longer collide with single-document update; contract .describe() text is wired into --help and generated docs.

Reviewed by Cursor Bugbot for commit a5ac9e9. Configure here.

Comment thread scripts/generate-cli-docs.ts Outdated
Comment thread scripts/generate-cli-docs.ts Outdated
Comment thread scripts/generate-cli-docs.ts Outdated
@greptile-apps

greptile-apps Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds generated CLI documentation, surfaces route-contract descriptions in CLI help, and resolves a duplicate command path.

  • Adds a dedicated CLI documentation section and navigation tab.
  • Generates command references from the CLI command tree and checks them for staleness.
  • Renames the bulk knowledge-document update command to avoid shadowing the single-document update command.
  • Corrects CLI README examples and installation guidance.

Confidence Score: 5/5

The PR appears safe to merge because the previously reported navigation failure is fixed and no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/docs/components/navbar/navbar.tsx Uses whole path-segment matching for navigation sections, resolving the previously reported false CLI match on ClickUp and ClickHouse integration routes.
scripts/generate-cli-docs.ts Generates CLI reference pages and validates command-path uniqueness, documentation coverage, and generated-page freshness.
packages/sim-cli/src/runtime/options.ts Propagates contract descriptions into Commander option help while preserving generated flag behavior.
packages/sim-cli/src/contract/commands.ts Adjusts CLI command metadata, including the non-colliding batch-update path for bulk knowledge-document updates.
apps/docs/app/[lang]/[[...slug]]/page.tsx Treats CLI pages as a self-contained section when calculating previous and next navigation links.

Reviews (2): Last reviewed commit: "fix(docs): match the CLI tab by path seg..." | Re-trigger Greptile

Comment thread apps/docs/components/navbar/navbar.tsx Outdated
The `sim` CLI shipped with no coverage in the docs site. Adds a fourth
top-level tab for it, and moves Academy last.

The command reference is generated. `sim` exposes 147 leaf commands across
33 groups, most of them derived at runtime from the v2 route contracts, so a
hand-written reference would be wrong the week after it was written. The
generator walks the command tree `buildProgram()` hands to commander — the
same tree the terminal parses — rather than re-deriving it from the contract,
which would be a second implementation free to describe commands nobody can
invoke. `check:cli-docs` is a zero-arg `check:*` script, so the existing audit
runner picks it up and stale pages fail CI.

Generating against the real tree surfaced a collision it had been hiding:
`bulkUpdateKnowledgeDocuments` and `updateKnowledgeDocument` both derived to
`sim knowledge documents update`. Commander resolves a duplicate to the first
match, so the bulk form shadowed the single-document one and its flags were
unreachable while still appearing in `--help`. The bulk form is now
`batch-update`, matching how `tables rows batch-delete`/`batch-update` already
handle the same REST overload, and the generator fails on any duplicate path
so the next one cannot land silently.

Five hand-written guides cover install, auth, configuration, output formats,
and scripting. Also corrects two commands in the package README that do not
exist as documented (`tables columns <tableId>`, and `--sort score:desc`,
which is JSON).
…g and a single-page reference

The command reference was structurally complete but said almost nothing: 223 of
377 flags rendered as "Set sort by" because the CLI only ever read flag help
from its own contract overrides, and fell back to restating the flag name.

The prose already existed. The v2 route contracts carry 931 `.describe()` calls
and the OpenAPI specs publish all of them — 327 parameters and 282 body
properties, 100% coverage — but the generated operation table dropped every one,
carrying only a per-operation summary. It now carries the field descriptions,
the path-parameter descriptions, and positional help, so `--help` and the docs
explain a flag the same way the API reference does. Placeholder descriptions are
now zero, and 147/147 commands, 377/377 flags and 130/130 arguments are
documented.

`check:cli-docs` fails on a request field with no `.describe()` rather than
letting it render as documentation that says nothing.

Also in this pass:

- Commands are root-level sidebar entries under a Commands heading rather than
  a folder, and headings are the command's description, so the table of
  contents distinguishes entries at the first word instead of repeating
  "sim knowledge documents …" fourteen times. A guard fails the build if two
  descriptions on a page collide, since they would share an anchor.
- A single-page `Complete reference` carrying all 147 commands, for in-page
  search and for agents fetching `/cli/reference.mdx`. It keys on exact command
  paths because descriptions are only unique within a group.
- A troubleshooting page, with every message copied from the source.
- Table columns are sized by a local component; the flag column was starved
  while descriptions kept most of the row empty.
- The prerelease install channels are dropped from the docs and the package
  README, which is what npm renders.
…before pipes

`pathname.includes('/cli')` also matches `/integrations/clickup` and
`/integrations/clickhouse`, so both existing integration pages lit the CLI tab
and unlit Documentation. Matching is now per path segment. Anchoring to the
start would not work either — a non-default locale prefixes the path, as in
`/ja/cli` — so the segment is matched wherever it sits.

Table cells now double a backslash before escaping pipes. A value ending in one
turned `a\` + `|` into `a\\|`, which the table parser reads as an escaped
backslash followed by an unescaped pipe, splitting the cell early. Nothing in
the command surface contains a backslash today, so this was latent rather than
visible.

The reference page's global options table is two-column and was being wrapped in
`CommandTable`, which sizes the second column for the `Required` cell of the
three-column tables and crushed the description into 5.5rem. It now matches the
overview page, which leaves that table unsized.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a5ac9e9. Configure here.

@waleedlatif1
waleedlatif1 merged commit fed891f into staging Aug 16, 2026
29 of 30 checks passed
@waleedlatif1
waleedlatif1 deleted the docs/cli-section branch August 16, 2026 02:25
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