Repository navigation
fix: Open-List Locus Registry - #56
Conversation
Add Locus to AppInfo (gui/session/caller/host) and classify every catalog row with a Kind; --list --json now emits the full BuildAvailableApps() catalog with id/label/kind/locus (+optional default marker) and a round-trip invariant with -a. Plain --list keeps the simple host-app table (ListableApps predicate: Locus == gui) with honest empty-case copy. Skill bundle teaches the -a id vocabulary; specs and memory updated.
There was a problem hiding this comment.
🟡 Changes recommended
There are a couple of correctness/robustness issues in newly added test/doc changes (notably stdout capture cleanup) that should be fixed to avoid flaky tests and misleading usage guidance.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes wt open --list --json being an incomplete/consumer-biased “registry” by making it emit the full detected target catalog (including tmux/byobu, shell, and clipboard targets) and adding a locus field so consumers can filter appropriately; the human --list output remains the same GUI-host-app table.
Changes:
- Extend the app catalog model with
Locusand newKindvalues so every catalog row is fully classified. - Change
wt open --list --jsonto emit the full catalog as{id,label,kind,locus}plus an optional"default": truemarker aligned withDetectDefaultApp(). - Update tests and documentation/specs/skill bundle to reflect the human-vs-machine split and the expanded registry contract.
File summaries
| File | Description |
|---|---|
| src/internal/worktree/apps.go | Adds Locus + new Kind constants; populates classification for all catalog rows; updates ListableApps to filter on LocusGUI. |
| src/internal/worktree/apps_test.go | Updates classification test to assert both Kind and Locus; adapts ListableApps tests to the new predicate. |
| src/cmd/wt/open.go | Switches JSON output to full catalog with locus + optional default; keeps human table on GUI subset and improves the zero-host-app message. |
| src/cmd/wt/open_test.go | Expands JSON contract tests (shape/order/round-trip/default marker) and adds coverage for new human empty-case copy. |
| docs/site/skill.md | Updates canonical skill bundle open capability line to teach IDs and kind/locus semantics. |
| src/cmd/wt/skill.md | Updates embedded skill bundle copy to match canonical docs. |
| docs/specs/launcher-contract.md | Updates launcher contract to document the full registry semantics and new record shape. |
| docs/specs/cli-surface.md | Updates CLI surface docs for --list/--json human vs machine behavior. |
| docs/memory/wt-cli/open-list-contract.md | Updates long-form behavioral contract/memory to the new locus-aware registry model and invariants. |
| docs/memory/wt-cli/index.md | Updates index entry text for the revised open-list contract. |
| fab/changes/260902-ps3l-open-list-locus-registry/plan.md | Adds the change plan and acceptance criteria for the new contract. |
| fab/changes/260902-ps3l-open-list-locus-registry/intake.md | Adds intake rationale and requirements for the locus-aware registry change. |
| fab/changes/260902-ps3l-open-list-locus-registry/.status.yaml | Adds change status metadata. |
| fab/changes/260902-ps3l-open-list-locus-registry/.history.jsonl | Adds the change history log. |
Review details
- Files reviewed: 14/14 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| func captureOpenListStdout(t *testing.T, emit func() error) string { | ||
| t.Helper() | ||
| old := os.Stdout | ||
| rp, wp, err := os.Pipe() | ||
| if err != nil { | ||
| t.Fatalf("os.Pipe: %v", err) | ||
| } | ||
| os.Stdout = wp | ||
| emitErr := emit() | ||
| _ = wp.Close() | ||
| os.Stdout = old | ||
|
|
||
| out, err := io.ReadAll(rp) | ||
| _ = rp.Close() | ||
| if err != nil { | ||
| t.Fatalf("io.ReadAll: %v", err) | ||
| } | ||
| if emitErr != nil { | ||
| t.Fatalf("open-list emitter returned error: %v", emitErr) | ||
| } | ||
| return string(out) | ||
| } |
There was a problem hiding this comment.
Fixed — added a defer-based os.Stdout restore in captureOpenListStdout so a panic or mid-helper failure can no longer leave stdout redirected for subsequent tests. (12f3730)
| file manager) via the app menu. No arg opens the current context (worktree root / | ||
| repo root / cwd). `-a/--app <name>` skips the menu; `default` picks the | ||
| auto-detected app. `--list [--json]` prints the app registry instead. | ||
| - `open [name|path]` — launch a worktree in a detected target. `--list` prints |
There was a problem hiding this comment.
Fixed — the open capability line now reads "launch a worktree (or any directory path, no git repo needed) in a detected target". (12f3730)
| file manager) via the app menu. No arg opens the current context (worktree root / | ||
| repo root / cwd). `-a/--app <name>` skips the menu; `default` picks the | ||
| auto-detected app. `--list [--json]` prints the app registry instead. | ||
| - `open [name|path]` — launch a worktree in a detected target. `--list` prints |
There was a problem hiding this comment.
Fixed — embed copy refreshed from the canonical bundle via scripts/sync-skill.sh with the corrected wording; drift guard and line budget stay green. (12f3730)
Co-authored-by: Sahil Ahuja <[email protected]>
Meta
ps3lexcludes
fab/,docs/· generated by fab-kit v2.23.11Pipeline: intake ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr
Summary
wt open --listbaked run-kit's browser-dropdown policy into the registry itself: on a headless host inside tmux,--list --jsonprinted[]even thoughwt open <wt> -a tmux_windowworks — so an agent following the skill bundle's discovery path concluded nothing was openable (system-backlog[i2ap]). Launchability is consumer-relative, so--list --jsonnow emits the complete catalog with an explicitlocusfield (gui/session/caller/host) and pushes filtering to consumers, while plain--listkeeps today's simple host-app table.Changes
AppInfogainsLocus;Kindcovers every catalog row — newLocusconstants andmultiplexer/shell/clipboardkinds;ListableAppspredicate becomesLocus == LocusGUI(behavior-identical host-app set)wt open --list --jsonbecomes the complete registry — fullBuildAvailableApps()catalog with always-presentid/label/kind/locus, optionaldefault: truemarker, and a round-trip invariant with-a--list(human) stays simple — same host-app table; only the zero-host-apps copy improves to point at--list --jsonand the interactive menuopencapability line names valid-aids and the kind/locus semantics (canonical + embedded copy synced)docs/specs/launcher-contract.md§2 record shape and invariant;docs/specs/cli-surface.mdhuman/machine splitCoordination
run-kit's
GET /api/open-appsmust filter registry records tolocus == "gui"before this wt release is deployed — the filter is compatible with both old and newwt open --list --jsonoutput. Tracked as run-kit backlog item[k2pm]. This change fixes wt system-backlog item[i2ap].