Skip to content

fix: Open-List Locus Registry - #56

Merged
sahil-noon merged 2 commits into
mainfrom
260902-ps3l-open-list-locus-registry
Sep 2, 2026
Merged

sahil-noon merged 2 commits into
mainfrom
260902-ps3l-open-list-locus-registry

Conversation

@sahil-noon

Copy link
Copy Markdown
Collaborator

Meta

Change ID Type Confidence Plan Review
ps3l fix 4.2/5.0 7/7 tasks, 16/16 acceptance ✓ ✓ 1 cycle
Impact +/− Net
raw +1051 / −340 +711
true +303 / −146 +157
└ impl +76 / −58 +18
└ tests +227 / −88 +139

excludes fab/, docs/ · generated by fab-kit v2.23.11

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

Summary

wt open --list baked run-kit's browser-dropdown policy into the registry itself: on a headless host inside tmux, --list --json printed [] even though wt open <wt> -a tmux_window works — so an agent following the skill bundle's discovery path concluded nothing was openable (system-backlog [i2ap]). Launchability is consumer-relative, so --list --json now emits the complete catalog with an explicit locus field (gui/session/caller/host) and pushes filtering to consumers, while plain --list keeps today's simple host-app table.

Changes

  • AppInfo gains Locus; Kind covers every catalog row — new Locus constants and multiplexer/shell/clipboard kinds; ListableApps predicate becomes Locus == LocusGUI (behavior-identical host-app set)
  • wt open --list --json becomes the complete registry — full BuildAvailableApps() catalog with always-present id/label/kind/locus, optional default: true marker, and a round-trip invariant with -a
  • Plain --list (human) stays simple — same host-app table; only the zero-host-apps copy improves to point at --list --json and the interactive menu
  • Skill bundle teaches the id vocabulary — the open capability line names valid -a ids and the kind/locus semantics (canonical + embedded copy synced)
  • Spec + doc updates — docs/specs/launcher-contract.md §2 record shape and invariant; docs/specs/cli-surface.md human/machine split

Coordination

run-kit's GET /api/open-apps must filter registry records to locus == "gui" before this wt release is deployed — the filter is compatible with both old and new wt open --list --json output. Tracked as run-kit backlog item [k2pm]. This change fixes wt system-backlog item [i2ap].

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.
@sahil-noon
sahil-noon marked this pull request as ready for review September 2, 2026 18:10
@sahil-noon
sahil-noon requested a lite review from Copilot September 2, 2026 18:10

Copilot AI 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.

🟡 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 Locus and new Kind values so every catalog row is fully classified.
  • Change wt open --list --json to emit the full catalog as {id,label,kind,locus} plus an optional "default": true marker aligned with DetectDefaultApp().
  • 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.

Comment thread src/cmd/wt/open_test.go
Comment on lines +403 to +424
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)
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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)

Comment thread docs/site/skill.md
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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — the open capability line now reads "launch a worktree (or any directory path, no git repo needed) in a detected target". (12f3730)

Comment thread src/cmd/wt/skill.md
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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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)

@sahil-noon
sahil-noon merged commit 37a63c0 into main Sep 2, 2026
3 checks passed
@sahil-noon
sahil-noon deleted the 260902-ps3l-open-list-locus-registry branch September 2, 2026 18:16
sahil-noon added a commit that referenced this pull request Sep 2, 2026
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