Problem
Today the click-row → focus-terminal direction is wired (see views/builders.ts:127), but the inverse isn't: activating a builder PTY tab (via Cmd+` cycle, terminal tab click, or any other path) does not update the Builders tree. The user is looking at a terminal and can't tell at a glance which row in the sidebar it corresponds to — especially with 3+ builders running, similar names, or after the accordion auto-collapsed something.
Current state
terminalManager.terminals (terminal-manager.ts:342) keys PTYs by a label/key that can be reversed to a builder id.
terminalManager.isCodevTerminalActive() already exists (extension.ts:127) — knows whether the active terminal is one of ours.
BuildersProvider exposes TreeView.reveal(...) (views/builders.ts:62–63); the accordion path uses it. The infrastructure is in place.
- No
window.onDidChangeActiveTerminal subscription currently drives the tree.
Proposed behavior
On extension activation, subscribe to vscode.window.onDidChangeActiveTerminal. Each fire:
- If
terminal is null → no-op.
- Resolve the terminal to a
builderId via terminalManager.terminals (matching by terminal reference; only entries with type === 'builder' count).
- If no builder match → no-op. Dev/architect/shell terminals do not move the tree.
- Find the corresponding builder TreeItem in
BuildersProvider.
- Call
buildersView.reveal(item, { select: true, focus: false, expand: true }). Silent select — selection and expansion update, but focus stays where it is (so swapping to a builder terminal doesn't yank you out of the terminal pane).
Acceptance criteria
Out of scope
- Architect / shell / dev terminal scoping (intentionally — builder only).
- Focus-stealing variant (intentionally rejected).
- Changing the existing click-row → focus-terminal direction.
Problem
Today the click-row → focus-terminal direction is wired (see
views/builders.ts:127), but the inverse isn't: activating a builder PTY tab (via Cmd+` cycle, terminal tab click, or any other path) does not update the Builders tree. The user is looking at a terminal and can't tell at a glance which row in the sidebar it corresponds to — especially with 3+ builders running, similar names, or after the accordion auto-collapsed something.Current state
terminalManager.terminals(terminal-manager.ts:342) keys PTYs by a label/key that can be reversed to a builder id.terminalManager.isCodevTerminalActive()already exists (extension.ts:127) — knows whether the active terminal is one of ours.BuildersProviderexposesTreeView.reveal(...)(views/builders.ts:62–63); the accordion path uses it. The infrastructure is in place.window.onDidChangeActiveTerminalsubscription currently drives the tree.Proposed behavior
On extension activation, subscribe to
vscode.window.onDidChangeActiveTerminal. Each fire:terminalis null → no-op.builderIdviaterminalManager.terminals(matching byterminalreference; only entries withtype === 'builder'count).BuildersProvider.buildersView.reveal(item, { select: true, focus: false, expand: true }). Silent select — selection and expansion update, but focus stays where it is (so swapping to a builder terminal doesn't yank you out of the terminal pane).Acceptance criteria
Out of scope