Skip to content

Expose right-sidebar built-in actions - #4113

Closed
austinywang wants to merge 14 commits into
mainfrom
issue-4109-rightsidebar-action-ids
Closed

austinywang wants to merge 14 commits into
mainfrom
issue-4109-rightsidebar-action-ids

Conversation

@austinywang

@austinywang austinywang commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add ten cmux.rightSidebar.* built-in action IDs that mirror cmux right-sidebar CLI subcommands.
  • Route those built-ins through the in-process right-sidebar command path instead of shelling out.
  • Update config docs/schema/localization and add behavior-level unit coverage for registry resolution and CLI-equivalent effects.

Tests

  • Not run locally per repo policy; CI will run the test suite.

Follow-up

  • ui.titleBar.buttons is not currently plumbed in this codebase, so this PR limits wiring to the existing surface tab bar action system.

Closes #4109


Note

Medium Risk
Moderate risk because it adds new built-in action IDs and refactors built-in action dispatch/window targeting, which could affect right-sidebar focus/visibility behavior across windows and surface tab bar buttons.

Overview
Adds ten new cmux.rightSidebar.* built-in actions (toggle/show/hide/focus plus mode switches) so the surface tab bar and Command Palette can control the right sidebar via the in-process remote-command path.

Refactors built-in action execution into a shared executeBuiltInAction dispatcher with explicit scope handling, updates right-sidebar command application to accept a preferredWindow, and maps Command Palette right-sidebar mode commands to these built-in action IDs.

Updates localizations and web docs/schema to list the new built-ins, and adds tests asserting action-registry resolution and parity with CLI/keyboard right-sidebar behavior.

Reviewed by Cursor Bugbot for commit eca4250. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Adds ten cmux.rightSidebar.* built-in actions and runs them in-process so the surface tab bar, Command Palette, and shortcuts can control the right sidebar without shelling out. Centralizes built‑in action routing with window targeting, updates docs/schema/localization, and adds CLI/keyboard parity tests; closes #4109.

  • New Features

    • Built-ins: toggle/show/hide/focus and files/find/vault/sessions/feed/dock, with default titles, keywords, and icons on CmuxSurfaceTabBarBuiltInAction; CmuxConfig now uses defaultTitle/defaultKeywords.
    • Centralized routing: executeBuiltInAction with scoped execution plus executeBuiltInRightSidebarAction(...) and executeSurfaceTabBarBuiltInAction(...); configured actions and the surface tab bar now route through these; applyRightSidebarRemoteCommand accepts preferredWindow.
    • Command Palette: mode commands map to built-in IDs via RightSidebarMode.builtInAction; docs/schema/localization enumerate right‑sidebar built-ins and examples; tests cover registry resolution, metadata completeness, CLI parity, and keyboard toggle behavior.
  • Bug Fixes

    • Correct Command Palette titles for right‑sidebar actions and the vault label key.
    • Exhaustive handling of right‑sidebar built‑ins in dispatch switches to avoid missed routes.

Written for commit eca4250. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • New Features

    • Added and integrated right‑sidebar actions (toggle, show, hide, focus, files, find, vault, sessions, feed, dock) with localized strings and a new shortcut label (en/ja); actions are callable from UI and tab bar controls.
  • Documentation

    • Updated custom-commands docs, schema examples, and registry descriptions to include right‑sidebar built‑ins.
  • Tests

    • Added unit and security tests validating right‑sidebar action metadata, resolution, execution, and remote-command parity.

Review Change Stack

@vercel

vercel Bot commented May 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment May 22, 2026 9:09pm
cmux-staging Building Building Preview, Comment May 22, 2026 9:09pm

@coderabbitai

coderabbitai Bot commented May 13, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Failed to post review comments

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds ten right‑sidebar built‑in actions, maps them to RightSidebarRemoteCommand, wires execution through AppDelegate/Workspace/ContentView, updates config resolution, expands tests, and updates docs and localization to expose these actions for UI wiring.

Changes

Right-Sidebar Built‑In Actions

Layer / File(s) Summary
Built-in action enum cases and properties
Sources/CmuxSurfaceTabBarBuiltInAction.swift
Ten new right‑sidebar enum cases and a rightSidebarActions subset; initializer, defaultIcon, defaultTitle, defaultKeywords, rightSidebarRemoteCommand, and bonsplitAction extended to handle them.
RightSidebarMode to built‑in action mapping
Sources/RightSidebarPanelView.swift
Added RightSidebarMode.builtInAction mapping modes (files/find/sessions/feed/dock) to CmuxSurfaceTabBarBuiltInAction.
AppDelegate execution helpers and context resolution
Sources/AppDelegate.swift
Added centralized built‑in dispatcher and executeBuiltInRightSidebarAction; applyRightSidebarRemoteCommand and rightSidebarRemoteContext accept preferredWindow to resolve target window context.
Workspace tab bar dispatch
Sources/Workspace.swift
executeSurfaceTabBarCommandButton forwards built‑in actions to AppDelegate.executeSurfaceTabBarBuiltInAction(...) with tabManager and preferredWindow and returns early.
Command palette & ContentView integration
Sources/ContentView+RightSidebarCommandPalette.swift, Sources/ContentView.swift
Extracted commandPaletteRightSidebarMode(forCommandID:), palette ID mapping now resolves right‑sidebar mode commands to built‑in config IDs and returns them early.
Built-in config action resolution refactor
Sources/CmuxConfig.swift
CmuxResolvedConfigAction.builtIn(_:) now sources title/keywords from builtIn.defaultTitle/builtIn.defaultKeywords.
Tests for registry and state effects
cmuxTests/CmuxConfigTests.swift, cmuxTests/TerminalControllerSocketSecurityTests.swift
New tests assert registry resolution and metadata for right‑sidebar built‑ins and validate built‑in actions produce the same state effects as CLI and keyboard shortcut paths; includes test helpers for temporary AppDelegate/window contexts and UserDefaults toggling.
Web docs, JSON schema, and message strings
web/app/[locale]/docs/custom-commands/page.tsx, web/data/cmux.schema.json, web/messages/en.json, web/messages/ja.json
Examples and schema include cmux.rightSidebar.toggle; nightly registry rendering extended to format right‑sidebar toggle; en/ja strings updated to list right‑sidebar built‑ins.
Localized string resources
Resources/Localizable.xcstrings
Added English and Japanese localized titles for right‑sidebar commands and a shortcut label entry (shortcut.switchRightSidebarToVault.label) with manual extraction state.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

I hop to press the sidebar key,
Ten tiny actions set free,
Buttons, docs, and tests in view—
Modes and vaults, a feed anew,
🐰✨


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Cmux Full Internationalization ❌ Error New Swift strings only translated for en/ja, missing 18 locales. Web message keys only updated in en/ja, missing 18 locales in web/messages/. Complete translations in Localizable.xcstrings for all 20 locales; update all 20 web/messages/*.json files with rightSidebar content.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: exposing right-sidebar built-in actions as requested in the linked issue.
Description check ✅ Passed The PR description covers all required template sections: Summary explains what/why; Testing notes tests will run in CI; follow-up mentions limitations; Closes #4109 links the issue.
Linked Issues check ✅ Passed Code changes fully satisfy #4109: adds all ten cmux.rightSidebar.* built-in IDs, routes them in-process without spawning shell commands, updates config/docs/localization, and provides test coverage.
Out of Scope Changes check ✅ Passed All changes directly support the objective of exposing right-sidebar built-in actions; no unrelated modifications detected (tests, localization, docs, and refactoring are all necessary to fulfill the scope).
Cmux Swift Actor Isolation ✅ Passed AppDelegate/Workspace properly @MainActor, new methods inherit isolation, enums are Sendable, test methods @MainActor-marked. No actor isolation violations introduced.
Cmux Swift Blocking Runtime ✅ Passed No blocking/timing-based synchronization introduced. New executeBuiltInAction methods are synchronous dispatch with state queries and updates only.
Cmux No Hacky Sleeps ✅ Passed PR contains no hacky sleeps or timing-based workarounds. Only TypeScript change is simple renderer additions with no timing patterns.
Cmux Swift Concurrency ✅ Passed New methods with optional completion handlers follow pre-existing executeConfiguredCmuxAction pattern for synchronous work, matching codebase conventions.
Cmux Swift @Concurrent ✅ Passed New synchronous functions have proper @MainActor isolation. Test methods correctly annotated with @MainActor. No async/await or @concurrent violations found.
Cmux Swift File And Package Boundaries ✅ Passed All Swift changes comply with package boundaries: no oversized new files, AppDelegate +160 lines under 250-line threshold, cohesive additions, and appropriate delegation patterns.
Cmux Swift Logging ✅ Passed No print, debugPrint, dump, or NSLog violations in production code. Zero logging statements added across all modified Sources files; no file logging, Logger declarations, or sensitive data detected.
Cmux User-Facing Error Privacy ✅ Passed All user-facing strings (UI titles, error messages, docs) use generic product terms without exposing vendor names, credentials, tokens, or sensitive implementation details required by privacy rules.
Cmux Swiftui State Layout ✅ Passed No violations found. Adds computed property on enum and AppDelegate methods without introducing new @Published/@StateObject state.
Cmux Architecture Rethink ✅ Passed Consolidates right-sidebar actions through one unified executeBuiltInAction→applyRightSidebarRemoteCommand path; eliminates duplication; no timing patterns, observers, or split ownership issues.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PR adds no new NSWindow, NSPanel, NSWindowController, or SwiftUI Window/WindowGroup. New methods accept NSWindow? parameters for routing but don't create windows. Only existing test fixture found.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-4109-rightsidebar-action-ids

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai Bot previously requested changes May 13, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/messages/ja.json`:
- Line 331: The localized string for nightlyActionRegistryDesc contains
unqualified right-sidebar action IDs (show, hide, focus, files, find, vault,
sessions, feed, dock); update that text so each of those tokens is written as
fully-qualified IDs (cmux.rightSidebar.show, cmux.rightSidebar.hide,
cmux.rightSidebar.focus, cmux.rightSidebar.files, cmux.rightSidebar.find,
cmux.rightSidebar.vault, cmux.rightSidebar.sessions, cmux.rightSidebar.feed,
cmux.rightSidebar.dock) to make copy-paste safe and preserve the explicit ID
contract—modify the value for the nightlyActionRegistryDesc key accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 09775360-e8fe-4b30-acfe-89e3cde1bfc7

📥 Commits

Reviewing files that changed from the base of the PR and between 278b312 and 4e53996.

📒 Files selected for processing (14)
  • Resources/Localizable.xcstrings
  • Sources/AppDelegate.swift
  • Sources/CmuxConfig.swift
  • Sources/CmuxSurfaceTabBarBuiltInAction.swift
  • Sources/ContentView+RightSidebarCommandPalette.swift
  • Sources/ContentView.swift
  • Sources/RightSidebarPanelView.swift
  • Sources/Workspace.swift
  • cmuxTests/CmuxConfigTests.swift
  • cmuxTests/TerminalControllerSocketSecurityTests.swift
  • web/app/[locale]/docs/custom-commands/page.tsx
  • web/data/cmux.schema.json
  • web/messages/en.json
  • web/messages/ja.json

Comment thread web/messages/ja.json Outdated
@greptile-apps

greptile-apps Bot commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR exposes ten cmux.rightSidebar.* built-in action IDs (toggle/show/hide/focus plus mode switches for files/find/vault/sessions/feed/dock), routing them in-process through a new centralised AppDelegate.executeBuiltInAction helper instead of shelling out. The previous duplicate dispatch tables in Workspace and executeConfiguredCmuxAction are removed; applyRightSidebarRemoteCommand gains an optional preferredWindow parameter to support window-targeted invocations.

  • New built-ins: CmuxSurfaceTabBarBuiltInAction gains 10 right-sidebar cases; rightSidebarActions is derived from allCases (no manual sync risk); defaultTitle, defaultKeywords, defaultIcon, and rightSidebarRemoteCommand are co-located on the enum.
  • Centralised routing: executeBuiltInAction owns the full dispatch table with a BuiltInActionExecutionScope discriminator; Workspace and configured-action dispatch both delegate to it; RightSidebarMode.builtInAction and commandPaletteConfigActionID translate palette mode commands to built-in IDs.
  • Localization: Localizable.xcstrings adds 5 new keys with complete en+ja coverage (only two app locales exist); en.json and ja.json are updated, but 18 of the 20 web locales in web/i18n/routing.ts are not, leaving stale documentation text for the majority of supported languages.

Confidence Score: 4/5

Swift routing changes are well-structured and exhaustive; the one gap is incomplete web documentation localisation across 18 of 20 supported locales.

The Swift side of this PR — new enum cases, centralised dispatch, window-targeting, CLI parity tests — is carefully constructed and replaces two duplicate routing tables without introducing new logic branches. The web documentation update skips 18 locale files that already contain translated versions of the changed keys, so users in those locales will see stale docs that don't mention the new right-sidebar built-ins. The fix is mechanical but it's a real gap in a PR that explicitly sets out to update documentation.

web/messages/en.json and web/messages/ja.json — the 18 other locale files need the same nightlyActionRegistryDesc and actionTypeBuiltin updates.

Important Files Changed

Filename Overview
Sources/CmuxSurfaceTabBarBuiltInAction.swift Adds 10 new right-sidebar cases to the enum; derives rightSidebarActions from allCases (no drift risk); moves defaultTitle/defaultKeywords/defaultIcon onto the type; adds rightSidebarRemoteCommand computed property.
Sources/AppDelegate.swift Centralises built-in action dispatch into executeBuiltInAction; removes duplicate routing blocks; extends applyRightSidebarRemoteCommand with optional preferredWindow param.
Sources/Workspace.swift Replaces inline switch with AppDelegate.shared?.executeSurfaceTabBarBuiltInAction call.
web/messages/en.json Updates nightlyActionRegistryDesc and actionTypeBuiltin; 18 of 20 supported locales not updated.
Resources/Localizable.xcstrings Adds 5 new string keys with en+ja translations; coverage complete for the 2-locale app catalog.
cmuxTests/TerminalControllerSocketSecurityTests.swift Adds CLI-parity and keyboard-shortcut-parity tests for all 10 right-sidebar built-in actions; self-contained test scaffolding.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User triggers action] --> B{Source}
    B -->|cmux config shortcut| C[executeConfiguredCmuxAction]
    B -->|Surface tab bar tap| D[Workspace.executeBonsplitButton]
    B -->|CLI remote command| E[applyRightSidebarRemoteCommand]

    C --> F[executeBuiltInAction scope: .configured]
    D --> G[AppDelegate.executeSurfaceTabBarBuiltInAction scope: .surfaceTabBar]
    G --> F

    F --> H{action.rightSidebarRemoteCommand?}
    H -->|nil| I[Scope-specific handler]
    H -->|non-nil — all rightSidebar.*| J[applyRightSidebarRemoteCommand preferredWindow]

    J --> K[rightSidebarRemoteContext preferredWindow]
    K --> L[MainWindowContext]
    L --> M[RightSidebarRemoteCommand]
    M --> N[FileExplorerState mutation]
Loading

Reviews (10): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Comment thread Sources/CmuxSurfaceTabBarBuiltInAction.swift Outdated
Comment thread Sources/CmuxSurfaceTabBarBuiltInAction.swift Outdated
coderabbitai[bot]
coderabbitai Bot previously requested changes May 18, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Sources/CmuxSurfaceTabBarBuiltInAction.swift`:
- Line 129: The localization call currently uses key
"shortcut.switchRightSidebarToSessions.label" but supplies the defaultValue
"Show Sidebar Vault", causing a mismatch; fix by either (A) changing the
defaultValue in the String(localized:) call to "Show Sidebar Sessions" to match
the key (look for the return in CmuxSurfaceTabBarBuiltInAction where the
localization is returned) or (B) if the intent is to use the Vault wording, add
a new key "shortcut.switchRightSidebarToVault.label" to
Resources/Localizable.xcstrings with the appropriate translations and update any
related enum cases (.rightSidebarVault / .rightSidebarSessions) or callers so
the key and defaultValue are consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 008ca989-4670-47d4-b90b-fc0e591fc517

📥 Commits

Reviewing files that changed from the base of the PR and between 3112ee8 and 3c82c58.

📒 Files selected for processing (5)
  • Resources/Localizable.xcstrings
  • Sources/CmuxSurfaceTabBarBuiltInAction.swift
  • Sources/Workspace.swift
  • cmuxTests/CmuxConfigTests.swift
  • web/messages/en.json

Comment thread Sources/CmuxSurfaceTabBarBuiltInAction.swift Outdated

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 14 files

Re-trigger cubic

Comment thread Sources/AppDelegate.swift Outdated
@austinywang
austinywang dismissed stale reviews from coderabbitai[bot] and coderabbitai[bot] May 19, 2026 04:44

Stale bot change request; inline thread is resolved/outdated and later CI/review checks pass on current head.

This branch was successfully deployed

1 active deployment
Preview – cmux — eca42507 Deployed May 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale-revisit Closed after 30+ days without activity; preserved for possible revisit or reopening.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose right-sidebar actions as built-in action IDs for surface tab bar / title bar (follow-up to #3552, #3808)

3 participants