feat: Implement wt help-dump for shll.ai pull integration#21
Conversation
There was a problem hiding this comment.
Pull request overview
Implements the producer-side wt help-dump command required by shll.ai’s scheduled pull integration, emitting a contract-shaped JSON representation of the Cobra command tree to stdout (and keeping the command hidden from normal help output).
Changes:
- Added an internal builder (
BuildHelpDump) that walks the Cobra tree, filters hidden/help/completion nodes, renders per-command-htext, and produces the contract envelope. - Wired a new hidden Cobra subcommand
wt help-dumpto emit the JSON envelope to stdout. - Added unit + command-level tests, plus repo “memory”/backlog documentation updates capturing the contract and superseding the old push-model backlog item.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/internal/worktree/helpdump.go | Core help-dump envelope + Cobra tree walk/render implementation. |
| src/internal/worktree/helpdump_test.go | Unit tests for envelope shape, filtering, recursion, and render behavior. |
| src/cmd/wt/main.go | Registers the new help-dump subcommand on the root command. |
| src/cmd/wt/help_dump.go | Hidden Cobra subcommand that calls the internal builder and prints JSON. |
| src/cmd/wt/help_dump_test.go | Command-level tests validating runtime behavior and output contract basics. |
| fab/changes/260603-qqkj-help-dump-command/plan.md | Change plan/requirements capturing the intended contract behavior. |
| fab/changes/260603-qqkj-help-dump-command/intake.md | Intake notes and scope rationale for implementing the pull-model producer command. |
| fab/changes/260603-qqkj-help-dump-command/.status.yaml | Change tracking metadata updates. |
| fab/changes/260603-qqkj-help-dump-command/.history.jsonl | Change history log. |
| fab/backlog.md | Marks prior push-model backlog item as superseded by this change. |
| docs/memory/wt-cli/help-dump-contract.md | New memory doc describing the help-dump contract/invariants. |
| docs/memory/index.md | Adds the new memory file to the docs index. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // helpDumpSchemaVersion is the contract revision emitted in the help-dump | ||
| // envelope. It is frozen at 1 for this revision of the shll.ai help-dump | ||
| // contract (see docs/specs / shll.ai help-dump-contract.md §8); new fields and | ||
| // version bumps are a separate, deliberate change. |
There was a problem hiding this comment.
Fixed — the doc comment now points to the upstream spec (sahil87/shll.ai docs/specs/help-dump-contract.md §8) and the in-repo behavior contract (docs/memory/wt-cli/help-dump-contract.md), and the stray space is gone. (5076af6)
| // toolName is the binary name reported in the help-dump envelope's `tool` | ||
| // field. It is the invoked binary name, not the file slug. | ||
| const toolName = "wt" |
There was a problem hiding this comment.
Fixed — clarified the comment: the contract requires the invoked binary name (not the file slug), which for this repo is the fixed constant "wt" and is not derived from argv. (5076af6)
Meta
Pipeline: intake ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr
Impact: +571/−0 code (excluding
fab/,docs/) · +1155/−2 totalSummary
shll.ai's command-reference page for
wtis now refreshed by a scheduled puller that runswt help-dump,brew installs the tool, and commits the captured JSON — inverting the prior push model.wthad nohelp-dumpcommand, so that pull would fail and thewtcommand reference would silently freeze. This change implements the producer-side command per shll.ai's frozenhelp-dump-contract.md; everything downstream (capture,captured_attimestamping, validation, commit) remains shll.ai's responsibility.Changes
wt help-dumpCobra subcommand — registered on root insrc/cmd/wt/main.go, implemented insrc/cmd/wt/help_dump.go(thin Cobra wiring) with the tree-walk and envelope-building logic insrc/internal/worktree/helpdump.goper Constitution V. The command isHidden, walksrootCmd.Commands()recursively to full depth, filterscompletion/help/Hidden nodes, and emits{tool, version, schema_version: 1, root}to stdout — deliberately omittingcaptured_at(shll.ai stamps it post-capture). Conforms to the contract §1–§8 and theHelpDocSchema/NodeSchemaanchor in shll.ai'sschemas.ts.src/internal/worktree/helpdump_test.go) and command test (src/cmd/wt/help_dump_test.go): exit 0, valid JSON,tool == "wt",schema_version == 1, nocaptured_atkey,completion/help/help-dumpabsent from the tree,help-dumpabsent fromwt -h.[pc47]marked superseded infab/backlog.md: its producer half is realized here; its push half (build-time CI step, PR-opening into sahil87/shll.ai, auto-merge,SHLLAI_TOKEN) is intentionally dropped per the pull-model inversion.docs/memory/wt-cli/help-dump-contract.md(+ index entry) recording the command's behavior contract.Scope
No push transport or
SHLLAI_TOKENwiring was added.wtis a producer/reference tool only — the retired push model (producer CI, PR-opening, auto-merge, cross-repo write token) is explicitly not built.🤖 Generated with Claude Code