Skip to content

feat: Implement wt help-dump for shll.ai pull integration#21

Merged
sahil-noon merged 3 commits into
mainfrom
260603-qqkj-help-dump-command
Jun 4, 2026
Merged

feat: Implement wt help-dump for shll.ai pull integration#21
sahil-noon merged 3 commits into
mainfrom
260603-qqkj-help-dump-command

Conversation

@sahil87
Copy link
Copy Markdown
Owner

@sahil87 sahil87 commented Jun 3, 2026

Meta

ID Type Confidence Plan Review
qqkj feat 5.0/5.0 7/7 tasks, 0/15 acceptance ✓ 1 cycle

Pipeline: intake ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr

Impact: +571/−0 code (excluding fab/, docs/) · +1155/−2 total

Summary

shll.ai's command-reference page for wt is now refreshed by a scheduled puller that runs wt help-dump, brew installs the tool, and commits the captured JSON — inverting the prior push model. wt had no help-dump command, so that pull would fail and the wt command reference would silently freeze. This change implements the producer-side command per shll.ai's frozen help-dump-contract.md; everything downstream (capture, captured_at timestamping, validation, commit) remains shll.ai's responsibility.

Changes

  • New wt help-dump Cobra subcommand — registered on root in src/cmd/wt/main.go, implemented in src/cmd/wt/help_dump.go (thin Cobra wiring) with the tree-walk and envelope-building logic in src/internal/worktree/helpdump.go per Constitution V. The command is Hidden, walks rootCmd.Commands() recursively to full depth, filters completion/help/Hidden nodes, and emits {tool, version, schema_version: 1, root} to stdout — deliberately omitting captured_at (shll.ai stamps it post-capture). Conforms to the contract §1–§8 and the HelpDocSchema/NodeSchema anchor in shll.ai's schemas.ts.
  • Tests — builder unit test (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, no captured_at key, completion/help/help-dump absent from the tree, help-dump absent from wt -h.
  • Backlog hygiene[pc47] marked superseded in fab/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.
  • Memory — adds docs/memory/wt-cli/help-dump-contract.md (+ index entry) recording the command's behavior contract.

Scope

No push transport or SHLLAI_TOKEN wiring was added. wt is 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

@sahil87 sahil87 marked this pull request as ready for review June 3, 2026 14:43
@sahil-noon sahil-noon requested a review from Copilot June 4, 2026 08:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 -h text, and produces the contract envelope.
  • Wired a new hidden Cobra subcommand wt help-dump to 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.

Comment thread src/internal/worktree/helpdump.go Outdated
Comment on lines +10 to +13
// 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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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)

Comment thread src/internal/worktree/helpdump.go Outdated
Comment on lines +16 to +18
// 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"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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)

@sahil-noon sahil-noon merged commit 398192a into main Jun 4, 2026
2 checks passed
@sahil-noon sahil-noon deleted the 260603-qqkj-help-dump-command branch June 4, 2026 09:23
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.

3 participants