The Commands settings list shows user and plugin commands without exposing storage details or repeating plugin-management guidance in each group or row.
text-ui-sm text-foreground-subtle as secondary copy.commandsService.list: that path is only the service anchor (the home directory of a remote device, or any local project). If the anchor is passed, the user directory is first discovered as project commands and the name de-duplication keeps the project entry, so the User view hides the command. An anchor project command with the same name also hides the user command.Installed 分组统一使用内容区显式的 mt-6(24px);共享 Tabs 根节点不再额外提供 gap-2,避免搜索框到 New 按钮叠加成 32px。Terminal icon as the Commands settings entry. Plugin artwork takes
precedence when available; a missing or failed plugin image falls back to Terminal, not Cable.rounded-full border-border bg-surface text-ui-sm Badge with a 14px Folder or Cable icon.The Command editor uses the same concrete scope menu as Plugin MCP settings.
workspaceIdentity?.trim() || workspacePath; the actual command file path continues to use workspacePath.If a selected Workspace closes while creating, the draft falls back to User. If the owner Workspace closes while editing, the editor exits instead of changing the locked target.
Command form scope
|
+-- User ----------------------> current list Host -> user commands directory
|
+-- Workspace key
|
+-- resolve open tab metadata
| workspaceIdentity / remoteSessionId / remoteTarget
|
+-- resolve target Host service
|
+-- write workspacePath/.zcode/commands
| Field | Decision |
|---|---|
| Change layers | Presentation, option source, draft default, commit effect, persistence |
| UI surface | CommandsSection and CommandForm |
| Shared UI | PluginScopeMenu |
| Draft owner | Command form scope key |
| Commit sink | The selected Workspace Host's commandsService |
| Persistence | User or Workspace command directory; no format migration |
| Mode boundary | Local and remote Workspace tabs share scope semantics, but resolve different Host services |
| Out of scope | Command discovery order, slash-command runtime behavior, plugin command management, cross-window Workspace selection |
| Case | Setup | Action | Assertions |
|---|---|---|---|
| CMD-SCOPE-01 | Two open local Workspaces | Create and select Workspace B | B is shown by name; save writes B's path through the resolved target service; A's list is not polluted |
| CMD-SCOPE-02 | Two remote Workspaces with the same path and different identities | Open the scope menu | Both identities remain distinct scope keys and route to their own remote sessions |
| CMD-SCOPE-03 | New editor with a selected Workspace | Close the selected tab | Scope falls back to User without writing |
| CMD-SCOPE-04 | Existing Workspace Command | Open edit form | Actual owner is displayed, Scope is disabled, and save cannot migrate storage |
| CMD-SCOPE-05 | Existing Workspace Command owner closes | Close the owner tab | Editor exits and performs no write |
| CMD-SCOPE-06 | User scope | Save a new Command | Save omits project workspacePath and refreshes the current list |
| CMD-SCOPE-07 | Remote device User (anchor is its home) | Open the Commands list | The list request omits project workspacePath; every command in the device's user directory shows in the User view (E2E: DSYNC-15-06) |
| CMD-SCOPE-08 | Local User whose anchor project has a command with the same name as a user command | Open the Commands list | The list request omits project workspacePath; the user command shows in the User view (E2E: not covered yet; DSYNC-15-06 covers only two remote devices) |