Repository navigation
Show local and remote Quick Commands by host - #13094
Conversation
c226285 to
8b903c7
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughTerminal quick commands now support local and runtime execution hosts. Host-specific commands load through a new store slice with runtime capability checks, caching, connection-generation validation, serialized mutations, and local settings persistence. Settings, terminal panes, context menus, and tab-bar menus now select hosts, filter repositories, display host labels, and route add, edit, delete, and run actions by host. Recent-command history accepts host-qualified identifiers. Tests and localization cover host ownership, loading states, runtime behavior, and host-specific actions. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (4)
src/renderer/src/hooks/use-terminal-quick-command-hosts.ts (1)
113-113: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse the parsed host id instead of a type assertion.
parsedExecutionHost.idis already narrowed toruntime:${string}whenremoteEnvironmentIdis non-null. Using it removes the cast.♻️ Proposed refactor
- const remoteHostId = executionHostId as `runtime:${string}` + const remoteHostId = parsedExecutionHost.idAdd
parsedExecutionHostto the memo dependency list, or derive the id inside the memo fromremoteEnvironmentId.src/renderer/src/hooks/use-terminal-quick-command-hosts.test.ts (1)
8-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the hook's host-gating logic.
The tests cover the two pure helpers.
useTerminalQuickCommandHostscontains the capability gate and the connection-generation match at lines 106-112 ofuse-terminal-quick-command-hosts.ts. That logic decides whether the remote host appears at all. Add a rendered-hook test for these cases:supported === false,supported === truewith a staleconnectionGeneration, and the matching-generation case.src/renderer/src/store/slices/terminal-quick-command-hosts.ts (1)
62-76: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueLocalize the quick-command save-error toast.
User-facing toast titles should come from
translate; pass a catalog key instead of hardcoding'Failed to save quick command'.src/renderer/src/components/settings/QuickCommandsPane.tsx (1)
230-230: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueKeep the new QuickCommandsPane locale keys consistent with this namespace.
s8 savedOn,unsupportedHost,loadFailed,retry, andloadingexist inen.json, but they use semantic keys while the surrounding QuickCommandsPane keys use generated 10-character hashes. Replace these with the generated hash form or document the intentional mix.Source: Learnings
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e27e8f22-1000-42f1-bc57-f98dcd7d957d
📥 Commits
Reviewing files that changed from the base of the PR and between 360c496 and c226285268fbc95da6d311515956ae3dcdf64e21.
📒 Files selected for processing (24)
src/renderer/src/components/settings/QuickCommandsPane.tsxsrc/renderer/src/components/settings/Settings.tsxsrc/renderer/src/components/settings/setting-ownership.test.tssrc/renderer/src/components/settings/setting-ownership.tssrc/renderer/src/components/tab-bar/TabBarQuickCommandAddActions.tsxsrc/renderer/src/components/tab-bar/TabBarQuickCommandItem.tsxsrc/renderer/src/components/tab-bar/TabBarQuickCommandsButton.tsxsrc/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.keyboard.test.tssrc/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.tsxsrc/renderer/src/components/terminal-pane/TerminalContextMenu.test.tsxsrc/renderer/src/components/terminal-pane/TerminalContextMenu.tsxsrc/renderer/src/components/terminal-pane/TerminalPane.tsxsrc/renderer/src/hooks/use-terminal-quick-command-hosts.test.tssrc/renderer/src/hooks/use-terminal-quick-command-hosts.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/run-quick-command-in-new-tab.test.tssrc/renderer/src/lib/run-quick-command-in-new-tab.tssrc/renderer/src/store/index.tssrc/renderer/src/store/slices/diffComments.test.tssrc/renderer/src/store/slices/runtime-status.tssrc/renderer/src/store/slices/store-test-helpers.tssrc/renderer/src/store/slices/terminal-quick-command-hosts.test.tssrc/renderer/src/store/slices/terminal-quick-command-hosts.tssrc/renderer/src/store/types.ts
💤 Files with no reviewable changes (1)
- src/renderer/src/components/settings/Settings.tsx
…-server # Conflicts: # src/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.tsx # src/renderer/src/components/terminal-pane/TerminalPane.tsx
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/renderer/src/components/settings/QuickCommandsPane.tsx (1)
124-124: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueMemoize
hostOptions.
getTerminalQuickCommandHostOptionsbuilds the execution-host registry on every render of the pane. Wrap it inuseMemokeyed bysettingsandruntimeEnvironments. The value is consumed during render only, so memoization does not change behavior.♻️ Proposed refactor
- const hostOptions = getTerminalQuickCommandHostOptions(settings, runtimeEnvironments) + const hostOptions = useMemo( + () => getTerminalQuickCommandHostOptions(settings, runtimeEnvironments), + [runtimeEnvironments, settings] + )src/renderer/src/components/tab-bar/hosted-terminal-quick-command-search.ts (1)
8-12: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueMap results by index instead of object identity.
entryByCommandkeys entries by the command object reference. If two hosts ever expose the same object instance, one entry is dropped from the results. An index-based mapping removes that coupling.♻️ Proposed refactor
- const entryByCommand = new Map(entries.map((entry) => [entry.command, entry])) - return searchTerminalQuickCommands( - entries.map((entry) => entry.command), - query - ).flatMap((command) => entryByCommand.get(command) ?? []) + const commands = entries.map((entry) => entry.command) + return searchTerminalQuickCommands(commands, query).flatMap((command) => { + const index = commands.indexOf(command) + return index === -1 ? [] : entries[index] + })
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1245ccea-9477-48eb-85db-ca96e6ffa81f
📒 Files selected for processing (32)
src/renderer/src/components/settings/QuickCommandsPane.test.tssrc/renderer/src/components/settings/QuickCommandsPane.tsxsrc/renderer/src/components/settings/Settings.tsxsrc/renderer/src/components/settings/setting-ownership.test.tssrc/renderer/src/components/settings/setting-ownership.tssrc/renderer/src/components/tab-bar/TabBarQuickCommandAddActions.tsxsrc/renderer/src/components/tab-bar/TabBarQuickCommandHostLoadStatus.tsxsrc/renderer/src/components/tab-bar/TabBarQuickCommandItem.tsxsrc/renderer/src/components/tab-bar/TabBarQuickCommandsButton.tsxsrc/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.keyboard.test.tssrc/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.tsxsrc/renderer/src/components/tab-bar/hosted-terminal-quick-command-search.tssrc/renderer/src/components/tab-bar/use-tab-bar-quick-command-search-input.test.tssrc/renderer/src/components/tab-bar/use-tab-bar-quick-command-search-input.tssrc/renderer/src/components/terminal-pane/TerminalContextMenu.test.tsxsrc/renderer/src/components/terminal-pane/TerminalContextMenu.tsxsrc/renderer/src/components/terminal-pane/TerminalPane.tsxsrc/renderer/src/components/terminal-pane/TerminalQuickCommandsSubmenu.tsxsrc/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.tssrc/renderer/src/hooks/use-terminal-quick-command-hosts.test.tssrc/renderer/src/hooks/use-terminal-quick-command-hosts.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/run-quick-command-in-new-tab.test.tssrc/renderer/src/lib/run-quick-command-in-new-tab.tssrc/renderer/src/store/index.tssrc/renderer/src/store/slices/diffComments.test.tssrc/renderer/src/store/slices/runtime-status.test.tssrc/renderer/src/store/slices/runtime-status.tssrc/renderer/src/store/slices/store-test-helpers.tssrc/renderer/src/store/slices/terminal-quick-command-hosts.test.tssrc/renderer/src/store/slices/terminal-quick-command-hosts.tssrc/renderer/src/store/types.ts
💤 Files with no reviewable changes (1)
- src/renderer/src/components/settings/Settings.tsx
🚧 Files skipped from review as they are similar to previous changes (22)
- src/renderer/src/components/settings/QuickCommandsPane.test.ts
- src/renderer/src/lib/run-quick-command-in-new-tab.test.ts
- src/renderer/src/components/settings/setting-ownership.test.ts
- src/renderer/src/lib/run-quick-command-in-new-tab.ts
- src/renderer/src/store/slices/terminal-quick-command-hosts.test.ts
- src/renderer/src/store/slices/diffComments.test.ts
- src/renderer/src/components/tab-bar/TabBarQuickCommandAddActions.tsx
- src/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.keyboard.test.ts
- src/renderer/src/store/index.ts
- src/renderer/src/hooks/use-terminal-quick-command-hosts.test.ts
- src/renderer/src/components/settings/setting-ownership.ts
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/store/slices/runtime-status.ts
- src/renderer/src/store/slices/store-test-helpers.ts
- src/renderer/src/components/terminal-pane/TerminalPane.tsx
- src/renderer/src/components/tab-bar/TabBarQuickCommandItem.tsx
- src/renderer/src/store/types.ts
- src/renderer/src/store/slices/terminal-quick-command-hosts.ts
- src/renderer/src/components/terminal-pane/TerminalQuickCommandsSubmenu.tsx
- src/renderer/src/components/terminal-pane/TerminalContextMenu.tsx
- src/renderer/src/components/terminal-pane/TerminalContextMenu.test.tsx
- src/renderer/src/components/tab-bar/TabBarQuickCommandsButton.tsx
Summary
Local MacandOrca ServerProduct behavior
Quick Command storage ownership is independent from command scope. A command can still be Global or project-scoped, while
Saved onidentifies the Orca host that owns the collection. Storage ownership also does not change execution context: choosing any saved command runs it in the terminal or workspace where it was invoked. This is what allows a client-owned command to run in a remote workspace.No new wire protocol is introduced; this reuses the capability-gated
settings.getTerminalQuickCommandsandsettings.updateTerminalQuickCommandsRPCs.Screenshots
Settings and tab-bar picker showing client- and server-owned command collections:
Terminal right-click menu showing both host collections and host-specific add actions:
Testing
pnpm lintpnpm typecheckgit diff --checkAI Review Report
Reviewed the host-selection lifecycle, stale-cache error handling, storage-host mutation routing, terminal execution semantics, runtime capability and connection-generation gates, localization keys, and add-action callback coverage. Fixed stale selection after a runtime is removed, added a persistent retryable refresh error while cached commands remain visible, replaced renderer keys with generated hashes, removed an unnecessary host-id assertion, and expanded regression tests.
The review explicitly checked macOS, Linux, and Windows compatibility. This follow-up changes no shortcuts, labels for modifiers, paths, shells, or Electron platform APIs; host IDs and runtime gates remain platform-neutral. SSH and folder workspaces continue to use the active terminal/workspace for execution and the selected Orca host only for command storage.
Security Audit
No new dependency, authentication, secret, path, shell-construction, IPC method, or wire payload was added. Remote reads and mutations remain behind the existing negotiated capability and parsed execution-host ID. Stale runtime generations are rejected before remote collections become visible, and unsupported servers degrade to the local collection without silently sending a mutation to another host.
Notes
Saved ondescribes collection ownership, not where a command executes. It only appears when multiple hosts are available.