feat(help): structured help for daemon/plugin/adapter/profile namespaces#1407
Open
feat(help): structured help for daemon/plugin/adapter/profile namespaces#1407
Conversation
Extends A0 (PR #1404) by dogfooding `installCommanderNamespaceStructuredHelp` on the four remaining built-in Commander namespaces: - `opencli daemon --help -f yaml|json` - `opencli plugin --help -f yaml|json` - `opencli adapter --help -f yaml|json` - `opencli profile --help -f yaml|json` Each emits the same payload shape as `browser`: namespace metadata, every leaf command's positionals + command_options + description + usage, namespace_options (empty for these), and program-level global_options. Agents can fetch every leaf's contract in a single call — no per-leaf `--help` follow-ups. Each namespace snapshots its original description at declaration time because `applyRootSubcommandSummaries(program)` later overwrites `.description()` with a child-name listing; without the snapshot, structured help would surface `"restart, status, stop"` instead of `"Manage the opencli daemon"`. Tests lock the snapshot semantics for `adapter` explicitly. Tests: 138/138 (4 new — one per namespace, covering description preservation, leaf names, positionals, command_options). Typecheck + build clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends A0 (PR #1404) by dogfooding
installCommanderNamespaceStructuredHelpon the four remaining built-in Commander namespaces:opencli daemon --help -f yaml|json(3 leaves)opencli plugin --help -f yaml|json(5 leaves)opencli adapter --help -f yaml|json(3 leaves)opencli profile --help -f yaml|json(3 leaves)Each emits the same payload shape as
browser: namespace metadata, every leaf's positionals +command_options+ description + usage,namespace_options(empty for these), and program-levelglobal_options.Agents can fetch every leaf's contract in a single call — no per-leaf
--helpfollow-ups. Same call-count reduction as A0, applied to the remaining built-in namespaces.external(passthrough binaries — gh / vercel / docker) is correctly out of scope; their help is owned by the foreign tool.Why the description snapshot
Each namespace snapshots its original
.description()at declaration time becauseapplyRootSubcommandSummaries(program)later overwrites it with a child-name listing ("restart, status, stop"). Without the snapshot, structured help would surface that listing instead of the product description ("Manage the opencli daemon"). Theadaptertest asserts this explicitly.Test plan
npm test src/cli.test.ts src/help→ 138/138 pass (4 new tests, one per namespace)npm run buildclean (799 manifest entries unchanged)npm run typecheckcleanopencli daemon --help -f yaml/plugin/adapter/profile— each returns structured YAML, descriptions preserveddaemon status,plugin update,adapter reset,profile rename— single-leaf structured shape with positionals/options correctly extractedbrowser --help -f yaml(still 35 leaves, description preserved)cc @codex-coder per A0 thread #OpenCLI:968cb389