Skip to content

Add right-sidebar CLI command parity - #3810

Merged
austinywang merged 15 commits into
mainfrom
issue-3808-right-sidebar-cli
May 12, 2026
Merged

austinywang merged 15 commits into
mainfrom
issue-3808-right-sidebar-cli

Conversation

@austinywang

@austinywang austinywang commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3808

Design notes

  • Adds one V1 IPC command family, right_sidebar, parsed into RightSidebarRemoteCommand before dispatch.
  • Adds one app-level helper that applies remote commands through the existing right-sidebar handlers and FileExplorerState instead of duplicating keyboard shortcut behavior.
  • Adds one CLI forwarding branch, cmux right-sidebar, with quiet default output and JSON output only for mode.
  • Normalizes mode names in one shared RightSidebarMode.from(cliArgument:) helper; vault and sessions both map to .sessions.
  • Supports --workspace / --window targeting by resolving refs or indexes to UUIDs before forwarding. set --no-focus switches modes without requesting sidebar focus.

CLI surface

cmux right-sidebar toggle
cmux right-sidebar show
cmux right-sidebar hide
cmux right-sidebar focus
cmux right-sidebar set <files|find|vault|sessions|feed|dock>
cmux right-sidebar mode
cmux right-sidebar files
cmux right-sidebar find
cmux right-sidebar vault
cmux right-sidebar sessions
cmux right-sidebar feed
cmux right-sidebar dock
cmux right-sidebar set vault --no-focus
cmux right-sidebar set find --workspace workspace:2
cmux right-sidebar show --window window:1

cmux right-sidebar mode prints JSON, for example:

{"visible":true,"mode":"find"}

Test plan output

  • python3 -m json.tool Resources/Localizable.xcstrings passed.
  • git diff --check passed.
  • CI/checks for HEAD 99e0d0c5cd7cadac591776c7bbb12471931622de are green: CircleCI macOS debug build, release build, unit tests, GitHub remote-daemon-tests, workflow-guard-tests, web typecheck, web DB migrations, Cursor Bugbot, Greptile, CodeRabbit, Socket Security, Vercel deployments.
  • Local unit, UI, and xcodebuild runs were not run, per repository/task policy.

Manual verification output

Tagged build launched with:

./scripts/reload.sh --tag issue-3808-right-sidebar-cli --launch

The tagged dev app has isolated defaults, so I enabled the existing Feed/Dock beta flags for com.cmuxterm.app.debug.issue.3808.right.sidebar.cli before verifying those two keyboard-reachable modes.

Manual CLI dogfood used the tagged CLI and socket:

CLI="/Users/austinwang/Library/Developer/Xcode/DerivedData/cmux-issue-3808-right-sidebar-cli/Build/Products/Debug/cmux DEV issue-3808-right-sidebar-cli.app/Contents/Resources/bin/cmux"
SOCKET="/tmp/cmux-debug-issue-3808-right-sidebar-cli.sock"

Observed results:

  • right-sidebar hide exited 0; mode returned {"mode":"feed","visible":false}.
  • right-sidebar show exited 0; mode returned visible true.
  • right-sidebar toggle flipped false, then true on the second toggle.
  • right-sidebar set find exited 0; mode returned find.
  • right-sidebar set vault and right-sidebar set sessions both exited 0; mode returned sessions.
  • right-sidebar focus exited 0.
  • right-sidebar files, find, vault, feed, and dock all exited 0 and landed on files, find, sessions, feed, and dock respectively.
  • right-sidebar set find --no-focus exited 0 and left state at {"mode":"find","visible":true}.
  • right-sidebar mode --window E8D4A759-9725-400F-9A9C-8A15FF38D561 exited 0.
  • right-sidebar set files --workspace 83E4A1DD-277C-4369-8B33-85CDCD16BC31 --no-focus exited 0; targeted mode returned files.

Note

Medium Risk
Adds a new V1 IPC command (right_sidebar) that can mutate UI focus and sidebar state, plus handle-resolution logic that depends on window/workspace listing; mistakes could affect targeting or focus behavior but changes are well-scoped and covered by new tests.

Overview
Adds cmux right-sidebar CLI support (toggle/show/hide/focus/set/mode plus mode aliases) that forwards a new V1 socket command family right_sidebar, stays quiet on success, and prints JSON only for mode.

Implements a shared RightSidebarRemoteRequest parser + RightSidebarRemoteCommand model, wires TerminalController to dispatch right_sidebar (including a command-specific focus-mutation policy), and adds AppDelegate.applyRightSidebarRemoteCommand to apply remote commands to the existing right-sidebar FileExplorerState, including optional targeting by --window/--workspace.

Updates localized usage/error strings, CLI contract docs, Xcode project sources, and adds regression/security tests covering CLI validation, target resolution, command parsing, and state application.

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

Summary by CodeRabbit

  • New Features

    • Adds a cmux right-sidebar CLI (toggle/show/hide/focus/set + mode aliases) with --workspace, --window, and --no-focus; forwards to the app and returns JSON for mode queries.
  • Bug Fixes / Reliability

    • Validates arguments, resolves window/workspace handles before forwarding, and improves error messages.
  • Documentation

    • Updated CLI docs and help text.
  • Localization

    • Added localized CLI/help/error strings.
  • Tests

    • New integration and unit tests for CLI, parser, resolution, and remote commands.

Review Change Stack

The CLI had no tests proving keyboard-only right-sidebar actions were reachable through the socket surface, so add regression coverage before wiring the implementation.

Constraint: Do not run local tests for this repo; CI owns verification.
Confidence: medium
Scope-risk: narrow
Tested: Not run locally per repository policy.
Not-tested: Expected to fail before the right_sidebar command family exists.
Keyboard shortcuts could already drive every right-sidebar action, but automation had no matching socket command family. Add a single right_sidebar IPC path, one app-level dispatcher over the existing sidebar handlers, and one CLI branch that forwards the full quiet command surface with optional targeting.

Constraint: Preserve the hand-rolled CLI and V1 socket style already used by sidebar commands.

Constraint: Do not run local tests or direct xcodebuild in this repo; CI and tagged reload own verification.

Rejected: Add ArgumentParser for this command family | inconsistent with the existing CLI dispatcher.

Confidence: medium

Scope-risk: moderate

Directive: Keep future right-sidebar CLI actions routed through RightSidebarRemoteCommand instead of adding one-off socket branches.

Tested: python3 -m json.tool Resources/Localizable.xcstrings

Tested: git diff --check

Not-tested: Local unit/UI tests and local xcodebuild, per repository and task policy.
@vercel

vercel Bot commented May 10, 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 12, 2026 4:00am
cmux-staging Building Building Preview, Comment May 12, 2026 4:00am

@coderabbitai

coderabbitai Bot commented May 10, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds a complete cmux right-sidebar CLI and socket remote-control surface: domain types and parser, AppDelegate apply handler and context resolution, TerminalController socket wiring and focus-policy checks, CLI dispatcher with argument parsing and handle resolution, Xcode/localization wiring, a minor UI declaration change, tests, and docs.

Changes

Right Sidebar CLI and Remote Control

Layer / File(s) Summary
Remote Command Data Types
Sources/RightSidebarRemoteCommand.swift, Sources/RightSidebarMode+Availability.swift
Adds remote models (RightSidebarRemoteTarget, RightSidebarRemoteCommand, RightSidebarRemoteRequest, parse/state/result types) and RightSidebarMode.from(cliArgument:) to normalize CLI mode strings including aliases (vault → sessions).
AppDelegate Remote Handler
Sources/AppDelegate.swift
Implements applyRightSidebarRemoteCommand(_:target:) to resolve a MainWindowContext, validate focus/state prerequisites, apply toggle/show/hide/focus/setMode/getState to FileExplorerState, and return .ok, .state(...), or .failure(...). Adds rightSidebarRemoteContext(_:) and updates DEBUG registerMainWindowContextForTesting signature.
Socket Command Dispatch
Sources/TerminalController.swift
Adds right_sidebar to v1 allow-list. Implements rightSidebar(_:) handler that parses tokens into RightSidebarRemoteRequest, calls AppDelegate.applyRightSidebarRemoteCommand, and returns "OK", JSON {visible,mode}, or error. Adds DEBUG-only parser helper and updates helpText().
CLI Parsing & Forwarder
CLI/cmux.swift
Adds right-sidebar branch and help text; implements parseRightSidebarCLIArguments (space and --key=value forms), rightSidebarSocketArguments (alias mapping and --no-focus rules), resolveRightSidebarWindowId/resolveRightSidebarWorkspaceId and resolvedRightSidebarHandleID, and forwardRightSidebarCommand which resolves targets then forwards right_sidebar v1 socket commands.
Build Graph / Xcode Project
GhosttyTabs.xcodeproj/project.pbxproj
Adds RightSidebarRemoteCommand.swift to PBXBuildFile, PBXFileReference, PBXGroup Sources children, and PBXSourcesBuildPhase so it is compiled and visible in the project navigator.
Localization
Resources/Localizable.xcstrings
Adds cli.rightSidebar.usage (EN/JA) and cli.rightSidebar.error.* plus rightSidebar.remote.error.* keys for CLI parsing, validation, and remote execution error messages.
UI Declaration
Sources/RightSidebarPanelView.swift
Updates RightSidebarMode declaration to nonisolated enum ... Sendable.
Unit Tests
cmuxTests/FileExplorerStateModePersistenceTests.swift
Adds test verifying RightSidebarMode.from(cliArgument:) normalization, aliasing, and trimming behavior.
Socket Command Tests
cmuxTests/TerminalControllerSocketSecurityTests.swift
Adds tests exercising v1 socket commands driving FileExplorerState, debug-only parser correctness, and remote command targeting behaviors across registered windows/workspaces without forcing focus.
CLI Integration Tests
cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift
Adds integration tests asserting CLI forwards expected right_sidebar v1 socket commands quietly, validates early failure on unknown commands/modes, verifies handle resolution before forwarding, and rejects unresolved targets before forwarding.
Documentation
docs/cli-contract.md
Adds right-sidebar top-level entry and a "Right sidebar commands" section documenting subcommands, mode aliases, flags (--workspace,--window,--no-focus), and a no-socket help probe.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • manaflow-ai/cmux#2464: Related changes to TerminalController/AppDelegate focus-policy logic used by remote CLI commands.
  • manaflow-ai/cmux#3150: Overlapping edits to window/workspace resolution and command routing used by CLI/socket forwarding.
  • manaflow-ai/cmux#3766: Other AppDelegate right-sidebar handling changes with related command application logic.

"🐰 I hop and I parse, tokens neat in a row,
Toggle, show, hide, set — let the right sidebar glow.
Modes mapped and resolved, across windows they go,
Quietly forwarding, with tests in a row. ✨"

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.76% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add right-sidebar CLI command parity' clearly and concisely summarizes the main change: adding CLI commands for right-sidebar control to match keyboard shortcut functionality.
Linked Issues check ✅ Passed The PR fully implements all required objectives from issue #3808: complete CLI surface (toggle/show/hide/focus/set/mode), mode normalization with vault↔sessions mapping, --workspace/--window targeting with handle resolution, --no-focus flag, shared helper pattern, socket command family, JSON output for mode, and comprehensive test coverage.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing right-sidebar CLI support. Updates to RightSidebarMode (adding Sendable conformance), help text, localization, tests, and documentation are all tightly coupled to the core feature.
Cmux Swift Actor Isolation ✅ Passed Data models marked nonisolated Sendable. AppDelegate.applyRightSidebarRemoteCommand is @MainActor. TerminalController uses v2MainSync. No actor isolation violations.
Cmux Swift Blocking Runtime ✅ Passed No blocking primitives found: 0 of 597 added lines contain semaphores, locks, sleeps, waits, asyncAfter, or main.sync calls.
Cmux No Hacky Sleeps ✅ Passed Rule excludes Swift code. PR modifies only Swift files, configuration, localization, and documentation—no non-Swift runtime code changes.
Cmux Swift Concurrency ✅ Passed All new cmux Swift code follows modern concurrency patterns without legacy async patterns (no DispatchQueue.global, Combine, completion handlers, or fire-and-forget Tasks).
Cmux Swift @Concurrent ✅ Passed No concurrent annotation violations. Nonisolated models are Sendable; sync methods MainActor-bound; no async without annotation; no heavy work unhopped.
Cmux Swift File And Package Boundaries ✅ Passed 164-line focused new file. All oversized file additions under 250-line threshold. No mixed responsibilities. Correct app-target scoping.
Cmux Swift Logging ✅ Passed The PR adds right-sidebar CLI code with one print statement for legitimate CLI output. No logging rule violations: no inappropriate logging, no improper Logger declarations, no secrets logged.
Cmux Swiftui State Layout ✅ Passed PR does not violate SwiftUI state layout rules. Only RightSidebarPanelView enum change (adding Sendable/nonisolated) is not new @Published/@observable. Rest is CLI/IPC with data models.
Cmux Architecture Rethink ✅ Passed Single entry point per layer, no timing/blocking patterns, FileExplorerState is single source of truth, no new mutable state or side channels introduced.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PR adds right-sidebar CLI/socket commands via handlers and data models with no new production windows/panels. Only test fixture window found (allowed per rule).
Description check ✅ Passed PR description is comprehensive, covering design, CLI surface, test plan, and manual verification with specific outcomes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-3808-right-sidebar-cli

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.

The PR branch needs the latest mainline changes before CI can provide useful signal, so merge origin/main after opening the PR and preserve the existing right-sidebar commits on top of that sync.

Constraint: origin/main advanced substantially after the branch point.

Constraint: Do not run local tests or direct xcodebuild in this repo; CI owns executable verification.

Confidence: medium

Scope-risk: broad

Directive: Treat this merge as baseline synchronization; behavioral intent remains in the two right-sidebar commits below it.

Tested: git status --short after submodule checkout update.

Not-tested: Local unit/UI tests and local xcodebuild, per repository and task policy.
Comment thread CLI/cmux.swift Outdated
@greptile-apps

greptile-apps Bot commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a cmux right-sidebar CLI surface (toggle/show/hide/focus/set/mode plus per-mode aliases) backed by a new V1 IPC command right_sidebar, using a clean separation between the CLI argument layer and the app-side dispatcher (applyRightSidebarRemoteCommand).

  • New RightSidebarRemoteCommand.swift holds all IPC types as nonisolated Sendable value types, correctly separated from the pre-existing availability logic.
  • AppDelegate.applyRightSidebarRemoteCommand dispatches each command through existing toggle/focus handlers, with per-command guards that fail cleanly on stale targeted refs.
  • Focus allowance policy is parsed per-command before the V1 body runs, making right_sidebar-specific focus decisions without widening the blanket V1 focus policy.

Confidence Score: 5/5

Safe to merge. All changed paths are well-bounded: new IPC types are nonisolated Sendable value types, visibility-increasing paths route through existing window-activation helpers, and targeted commands fail cleanly on stale refs rather than mutating state silently.

The three focus/visibility correctness issues surfaced in prior review rounds have each been explicitly closed out in earlier commits. The new applyRightSidebarRemoteCommand dispatcher is consistent across all six command variants, the focus allowance policy is parsed per-command before the V1 body executes, and the CLI validates subcommands before attempting handle resolution. Integration tests exercise the full CLI→socket→app round-trip including ref/index resolution, quiet output, and stale-target failure paths.

No files require special attention.

Important Files Changed

Filename Overview
Sources/RightSidebarRemoteCommand.swift New file holding all IPC value types and the token-based parser for right_sidebar; correctly marked nonisolated Sendable for cross-actor use.
Sources/AppDelegate.swift Adds applyRightSidebarRemoteCommand dispatcher. All visibility-increasing paths route through toggleRightSidebarInActiveMainWindow; targeted commands fail cleanly when the window ref is stale.
Sources/TerminalController.swift Routes right_sidebar V1 command to new handler; focus allowance policy is now command-specific via pre-parse of args.
CLI/cmux.swift Adds forwardRightSidebarCommand with argument validation, workspace/window handle resolution, and quiet output except for mode.
Sources/RightSidebarMode+Availability.swift Adds RightSidebarMode.from(cliArgument:) normalizer mapping vault→.sessions for backward compat.
Sources/RightSidebarPanelView.swift Promotes RightSidebarMode to nonisolated enum Sendable so it can cross actor boundaries in the new IPC types.
cmuxTests/TerminalControllerSocketSecurityTests.swift Comprehensive tests for the V1 dispatcher, token parser, per-command focus policy, and multi-window/workspace targeting.
cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift End-to-end integration tests covering CLI→socket forwarding, pre-socket validation, and ref/index resolution.
cmuxTests/FileExplorerStateModePersistenceTests.swift Unit test for RightSidebarMode.from(cliArgument:) covering all modes including vault→.sessions normalization.
docs/cli-contract.md Documents the new right-sidebar command family, all subcommands, flags, and help-text contract assertion.
Resources/Localizable.xcstrings Adds English and Japanese localizations for all new CLI error strings and remote error strings.

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

Comment thread Sources/AppDelegate.swift
Comment thread Sources/RightSidebarMode+Availability.swift Outdated
Remote review caught two edge-path divergences: invalid subcommands could trigger target resolution first, and show used a different hidden-to-visible path than toggle. Validate the subcommand before socket lookups and route show through the existing toggle handler when it actually reveals the sidebar.

Constraint: Keep the CLI quiet and preserve the existing V1 forwarding style.

Constraint: Do not run local tests or direct xcodebuild in this repo; CI owns executable verification.

Rejected: Add a separate show-specific app handler | it would duplicate the toggle path the feature is meant to mirror.

Confidence: medium

Scope-risk: narrow

Directive: Keep target resolution after subcommand validation so invalid commands report command errors before socket lookup errors.

Tested: python3 -m json.tool Resources/Localizable.xcstrings

Tested: git diff --check

Not-tested: Local unit/UI tests and local xcodebuild, per repository and task policy.
The previous follow-up still left a stale-target fallback that made show visible by mutating FileExplorerState directly. Fail stale targeted show requests instead, and keep every hidden-to-visible show path on the existing toggle handler.

Constraint: Preserve keyboard-shortcut parity for the visible-sidebar transition.

Rejected: Keep a stale-context direct mutation fallback | it preserves the split behavior review flagged.

Confidence: medium

Scope-risk: narrow

Directive: Do not add direct show-only visibility mutation unless there is a documented target-without-window use case.

Tested: git diff --check

Not-tested: Local unit/UI tests and local xcodebuild, per repository and task policy.
The right-sidebar CLI was a small command surface, but it crosses CLI parsing, socket forwarding, AppDelegate targeting, and persisted sidebar state. Add behavior-level coverage for handle resolution, forwarding failure, parser validation, target scoping, and the no-socket help contract while keeping the IPC parser in its own file.

Constraint: Local test execution is routed through CI/VM by repo policy; tagged reload build is queued behind an existing shared Xcode build lock.

Rejected: Source-text or project-grep tests | repo test policy requires observable runtime behavior instead.

Confidence: medium

Scope-risk: narrow

Directive: Keep right-sidebar CLI tests at the socket/behavior boundary so future parser rewrites preserve command contracts.

Tested: git diff --check; plutil -lint GhosttyTabs.xcodeproj/project.pbxproj; existing PR CI was green before this commit

Not-tested: Local unit tests and local tagged build completion; ./scripts/reload.sh --tag issue-3808-right-sidebar-cli remains queued behind another Xcode build
Comment thread Sources/TerminalController.swift Outdated
Comment thread CLI/cmux.swift
The right-sidebar socket parser now has its protocol types in a dedicated file, and CI review asked that these pure values follow the repo's explicit concurrency boundary convention. Marking the request, target, state, result, and mode values as nonisolated/Sendable keeps the IPC surface safe to pass across the socket-to-main-actor boundary without relying on implicit defaults.

Constraint: Local tests run in CI for this repo; keep local verification to static checks and tagged builds.

Rejected: Leave Sendable implicit | this would diverge from the existing SocketLineProcessingResult pattern.

Confidence: medium

Scope-risk: narrow

Directive: Keep right-sidebar IPC values pure and explicitly sendable if the command family grows.

Tested: git diff --check

Not-tested: Local unit tests, per repository testing policy
coderabbitai[bot]
coderabbitai Bot previously requested changes May 11, 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: 5

🤖 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 `@cmuxTests/TerminalControllerSocketSecurityTests.swift`:
- Around line 311-340: The test creates a new AppDelegate instance but doesn't
restore the global singleton, which can leak state; in
testRightSidebarRemoteCommandsCanTargetRegisteredWindowOrWorkspaceWithoutFocus
capture the current AppDelegate.shared before creating AppDelegate(), set the
new instance for the test, and ensure you restore the original
AppDelegate.shared in a defer block (alongside the existing
unregisterMainWindowContextForTesting calls) so the singleton is returned to its
prior value after the test; update references around
registerMainWindowContextForTesting/unregisterMainWindowContextForTesting to use
the temporary shared value during the test.

In `@Resources/Localizable.xcstrings`:
- Around line 111074-111093: Usage strings for rightSidebar remote commands
reference only --tab even though RightSidebarRemoteCommand accepts --workspace
as an alias; update the localized values for the keys
rightSidebar.remote.error.usage, rightSidebar.remote.error.usage.toggle,
rightSidebar.remote.error.usage.show, rightSidebar.remote.error.usage.hide,
rightSidebar.remote.error.usage.focus, rightSidebar.remote.error.usage.mode, and
rightSidebar.remote.error.usage.set to show both flag names (e.g.
"[--workspace/--tab=<workspace-id>]") or replace --tab with --workspace for
consistency with the CLI parsing in RightSidebarRemoteCommand (the alias
handling around the --workspace/--tab option).

In `@Sources/AppDelegate.swift`:
- Around line 5530-5536: The current guard uses context?.fileExplorerState ??
fileExplorerState which lets explicit non-active targets fall back to the global
active-window state; instead, ensure non-active targets cannot use that
fallback: in the rightSidebarRemoteContext/handling logic, if
target.isActiveTarget is true allow the fallback to fileExplorerState, but if
target.isActiveTarget is false require context?.fileExplorerState to be non-nil
and return the "stateUnavailable" failure otherwise; update the guard around
state (the state variable and its resolution) to implement that conditional
behavior.

In `@Sources/RightSidebarRemoteCommand.swift`:
- Around line 3-164: This file contains lifecycle-independent models and parsing
logic (RightSidebarRemoteTarget, RightSidebarRemoteCommand,
RightSidebarRemoteRequest, RightSidebarRemoteState, RightSidebarRemoteParseError
and parseTargetOption/parse(tokens:)) and should be moved out of the app root
into the shared/core module: move the file to the shared/core target, update the
Swift package target or Xcode target membership to that core module, remove any
app-only imports if present, and ensure any symbols that need cross-target
visibility have appropriate access levels (make types/functions internal/public
as needed). After moving, run build/tests and update any import paths where
RightSidebarRemoteRequest.parse(...) and related types are referenced from the
app target so they import the new core module.
- Around line 98-129: The usage/error messages in RightSidebarRemoteCommand (the
localized strings like "rightSidebar.remote.error.usage",
"rightSidebar.remote.error.usage.toggle",
"rightSidebar.remote.error.usage.show", "rightSidebar.remote.error.usage.hide",
"rightSidebar.remote.error.usage.focus", "rightSidebar.remote.error.usage.mode",
and "rightSidebar.remote.error.usage.set") list only "--tab=<workspace-id>"
while the CLI parser also accepts "--workspace"; update each defaultValue usage
string to include "--workspace=<workspace-id>" (e.g., "[--tab=<workspace-id> |
--workspace=<workspace-id>]" or include both flags) so the printed usage matches
the accepted flags for actions toggle, show, hide, focus, mode/state, set, and
the general usage message.
🪄 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: f28dd790-d1ca-494e-81de-9efe1c11325e

📥 Commits

Reviewing files that changed from the base of the PR and between 6c37266 and a42b408.

📒 Files selected for processing (11)
  • CLI/cmux.swift
  • GhosttyTabs.xcodeproj/project.pbxproj
  • Resources/Localizable.xcstrings
  • Sources/AppDelegate.swift
  • Sources/RightSidebarMode+Availability.swift
  • Sources/RightSidebarRemoteCommand.swift
  • Sources/TerminalController.swift
  • cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift
  • cmuxTests/FileExplorerStateModePersistenceTests.swift
  • cmuxTests/TerminalControllerSocketSecurityTests.swift
  • docs/cli-contract.md

Comment thread cmuxTests/TerminalControllerSocketSecurityTests.swift
Comment thread Resources/Localizable.xcstrings
Comment thread Sources/AppDelegate.swift
Comment thread Sources/RightSidebarRemoteCommand.swift Outdated
Comment thread Sources/RightSidebarRemoteCommand.swift Outdated
The right-sidebar CLI needs UUIDs for the remote command, but it does not need its own copy of window/workspace index resolution. Compose the existing handle normalizers with one small UUID extraction helper so right-sidebar targeting follows the same handle rules as the rest of the CLI while still forwarding concrete UUIDs over the V1 socket command.

Constraint: right_sidebar remote parser only accepts UUID target IDs, while public CLI flags accept UUIDs, refs, and indexes.

Rejected: Keep bespoke right-sidebar index helpers | duplicates the established CLI normalization path and drew review feedback.

Confidence: medium

Scope-risk: narrow

Directive: Add future target syntaxes to the shared normalizers first, then compose them here.

Tested: git diff --check

Not-tested: Local unit tests, per repository testing policy
Comment thread CLI/cmux.swift
Comment thread Resources/Localizable.xcstrings Outdated
Review found two edge cases in the right-sidebar CLI/socket path: invalid set modes could still proceed to target resolution, and explicit remote targets could fall back to active sidebar state when their registered context lacked one. Validate set modes before resolution, require explicit targets to own sidebar state, and keep usage strings aligned with the public --workspace flag.

Constraint: right_sidebar IPC still accepts --tab as an internal alias, but user-facing usage should prefer --workspace.

Rejected: Move the parser to a core module in this PR | the thread is already outdated and the type still depends on app-target RightSidebarMode; doing that cleanly would require a broader module-boundary change.

Confidence: medium

Scope-risk: narrow

Directive: Keep validation before socket/target work for every right-sidebar CLI branch.

Tested: git diff --check; jq empty Resources/Localizable.xcstrings

Not-tested: Local unit tests, per repository testing policy
Comment thread Sources/AppDelegate.swift
coderabbitai[bot]
coderabbitai Bot previously requested changes May 11, 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/AppDelegate.swift`:
- Around line 5573-5583: The .show branch is rejecting targets that already own
fileExplorerState but lack a live NSWindow; replace the strict guard that checks
target.isActiveTarget || preferredWindow != nil with a check that allows a
resolved file-explorer state (e.g., target.fileExplorerState != nil) or a
preferredWindow; in other words, in the case .show block update the second guard
to permit targets that have an existing fileExplorerState (or equivalent
resolved state) even when isActiveTarget is false and preferredWindow is nil,
then let toggleRightSidebarInActiveMainWindow(preferredWindow:) run as before
and return failures only if neither a resolved fileExplorerState nor a
preferredWindow exists.
🪄 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: c7bc8a86-3b09-4928-921c-8f6e6f96b1e6

📥 Commits

Reviewing files that changed from the base of the PR and between a42b408 and 5155e1f.

📒 Files selected for processing (7)
  • CLI/cmux.swift
  • Resources/Localizable.xcstrings
  • Sources/AppDelegate.swift
  • Sources/RightSidebarPanelView.swift
  • Sources/RightSidebarRemoteCommand.swift
  • cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift
  • cmuxTests/TerminalControllerSocketSecurityTests.swift

Comment thread Sources/AppDelegate.swift
A targeted remote toggle should not bypass the same window-selection path used by show/focus when the target sidebar is hidden. Return target-not-found when a non-active target has no concrete window instead of mutating FileExplorerState directly, and lock the no-window workspace case with a regression assertion.

Constraint: Right-sidebar visibility commands must preserve the socket focus policy and avoid silently acting on a different window.

Rejected: Keep direct toggle mutation for no-window targets | it recreates the split-path behavior already rejected for show.

Confidence: medium

Scope-risk: narrow

Directive: Visibility commands that can reveal UI should go through the shared window-aware path for explicit targets.

Tested: git diff --check; jq empty Resources/Localizable.xcstrings

Not-tested: Local unit tests, per repository testing policy
The V1 socket policy was still treating every right_sidebar command as focus-capable, even though mode, hide, invalid requests, and set --no-focus should preserve focus. Parse the right_sidebar request before installing the socket policy so only show, toggle, focus, and focused mode switches can mutate in-app focus, and add debug-level coverage for the command matrix.

Constraint: V1 socket policy normally only sees the command key, so right_sidebar passes its raw args into the policy params for granular classification.

Rejected: Keep right_sidebar in the broad focus-intent set | it violates the socket focus policy for state reads and no-focus writes.

Confidence: medium

Scope-risk: narrow

Directive: New right_sidebar subcommands must update the command-specific focus policy test.

Tested: git diff --check; jq empty Resources/Localizable.xcstrings

Not-tested: Local unit tests, per repository testing policy

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a1ce268. Configure here.

Comment thread CLI/cmux.swift
@lawrencecchen
lawrencecchen dismissed stale reviews from coderabbitai[bot] and coderabbitai[bot] May 12, 2026 04:31

Superseded by later commits and a later CodeRabbit approval; the referenced inline threads are resolved or outdated.

@austinywang
austinywang merged commit d56a546 into main May 12, 2026
26 checks passed

This branch was successfully deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CLI commands to toggle right sidebar visibility and switch its mode (Files/Find/Vault/Feed/Dock)

1 participant