Skip to content

feat(vscode): Architects tree — Add Architect UI, Cmd+K A picker, label casing #841

@amrmelsayed

Description

@amrmelsayed

Context

Spec 786 landed an Architects tree under the Workspace view that shows every registered architect for the current workspace (main plus any siblings added via afx workspace add-architect --name <name>), with right-click Remove on siblings and live-refresh on the architects-updated SSE event. Three follow-up gaps remain.

Gap 1 — No "Add Architect" UI affordance

Today, registering a sibling architect can only be done from the CLI:

afx workspace add-architect --name ob-refine

There is no codev.addArchitect command, no "+" button on the Architects tree title bar or row, no QuickPick name prompt anywhere in the extension. A code comment at packages/vscode/src/views/workspace.ts:57 explicitly acknowledges the gap ("codev.removeArchitect (and any future codev.addArchitect UI) can call .refresh() after mutating Tower").

Suggested fix. Add a codev.addArchitect command + a Workspace view affordance to trigger it:

  • A title-bar + action on the Architects parent row, or an inline "+ Add Architect" row underneath the architect children
  • QuickPick (or vscode.window.showInputBox) to prompt for the architect name; validate via the same rule Tower uses (validateArchitectName rejects main and other reserved names)
  • On success, call client.addArchitect(workspacePath, name) and let the existing architects-updated SSE refresh re-render the tree

Gap 2 — Cmd/Ctrl+K A always defaults to main

codev.openArchitectTerminal accepts an optional architectName argument (extension.ts:405), and Architects tree rows correctly pass the name on click. But no-arg invocations (keyboard shortcut Cmd/Ctrl+K A and Command Palette → "Codev: Open Architect Terminal") always default to main (extension.ts:415). When the workspace has siblings registered, there's no keyboard-driven way to pick a non-main architect — you must click the row in the sidebar.

Suggested fix. When codev.openArchitectTerminal is invoked with no argument and the workspace has N > 1 architects, show a QuickPick listing all of them (alphabetical, main first) and open the picked one. When N == 1, preserve today's behavior (open main directly, no picker). The QuickPick can reuse the same client.getWorkspaceState(workspacePath) call already made at line 417.

Gap 3 — Lowercase main breaks the Workspace view label convention

Every other row in the Workspace view uses Title Case for the visible label:

  • Open Architect / Open Web Interface / Spawn Builder / New Shell / Start Dev Server / Stop Dev Server
  • Parent: Architects, Open Dev URL rows (user-defined labels, also typically Title Case)

But the architect child rows render the raw architect name verbatim — for the default architect, that's main (all lowercase). It visually stands out as the only lowercase row in the entire Workspace tree, breaking the convention.

Suggested fix. Render the display label in Title Case while keeping the internal architect name (the identifier passed to openArchitectTerminal / removeArchitect) unchanged. Decide:

  • Option A — Display-only capitalization. Main (capitalize first letter); siblings render as the user typed them (e.g. ob-refine stays ob-refine). Minimum-change, but mixed casing across rows.
  • Option B — Display name field. Tower exposes a displayName alongside name; the extension renders displayName ?? capitalize(name). Requires a Tower API addition; gives users control over how their architects appear in the sidebar.

In either case, the internal identifier (main etc.) must stay lowercase because it's referenced everywhere (validateArchitectName, the architect:<name> send-message form, builder spawn affinity).

File to change. packages/vscode/src/views/workspace.ts:269 (new vscode.TreeItem(name) → wrap name in a display-name helper).

Out of scope (track separately if needed)

Acceptance

  • A user can register a new sibling architect entirely from the VS Code extension UI, without dropping to the CLI.
  • Cmd/Ctrl+K A correctly handles single-architect (opens main directly) and multi-architect (picker) workspaces.
  • The Architects tree rows visually match the casing convention of the rest of the Workspace view.

Related

Discovered while

Inventorying the multi-architect surface in the extension during the README revision pass (see docs/vscode-readme-revision branch).

Metadata

Metadata

Assignees

Labels

area/vscodeArea: VS Code extension

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions