Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cae0e5b
Add editable workspace descriptions
lawrencecchen Apr 1, 2026
e6fa908
Add workspace description focus UI tests
lawrencecchen Apr 1, 2026
8c91480
Include workspace description UI tests in project
lawrencecchen Apr 1, 2026
62f19d2
Fix workspace description palette focus
lawrencecchen Apr 1, 2026
f712e26
Stabilize workspace description UI tests
lawrencecchen Apr 1, 2026
c93b4f8
Force socket mode in description UI tests
lawrencecchen Apr 1, 2026
fe2d93d
Use tagged socket path in description UI tests
lawrencecchen Apr 1, 2026
5efa357
Fix workspace description UI test socket setup
lawrencecchen Apr 1, 2026
7c8f6cb
Start control socket for UI test launches
lawrencecchen Apr 1, 2026
4de1f7c
Use socket env overrides in description UI tests
lawrencecchen Apr 1, 2026
efd3d7b
Rewrite description UI tests without socket access
lawrencecchen Apr 1, 2026
c088de7
Verify saved description by reopening editor
lawrencecchen Apr 1, 2026
6ab9b92
Add workspace description focus debug logs
lawrencecchen Apr 2, 2026
bb31128
Prevent terminal focus restore during command palette
lawrencecchen Apr 2, 2026
631f9ce
Trace workspace description shift-enter handling
lawrencecchen Apr 2, 2026
b3eb253
Add failing Shift-Enter description UI test
lawrencecchen Apr 2, 2026
b9a3786
Fix Shift-Enter in workspace description editor
lawrencecchen Apr 2, 2026
6d74daa
Use live multiline editor state for description submit
lawrencecchen Apr 2, 2026
fe3d8a0
Log submitted and normalized workspace descriptions
lawrencecchen Apr 2, 2026
3ae3a72
Trace lower-level Shift-Enter editor routing
lawrencecchen Apr 2, 2026
ee7580f
Add failing sidebar markdown line-break regression test
lawrencecchen Apr 2, 2026
0e9b87d
Preserve workspace description line breaks in sidebar
lawrencecchen Apr 2, 2026
6f8350c
Add sidebar multiline description UI smoke test
lawrencecchen Apr 2, 2026
df64310
Expose multiline sidebar descriptions to accessibility
lawrencecchen Apr 2, 2026
e32af42
Fix sidebar description refresh lag
lawrencecchen Apr 2, 2026
f875203
Add failing workspace description whitespace test
lawrencecchen Apr 3, 2026
2255003
Preserve workspace description whitespace
lawrencecchen Apr 3, 2026
558333b
fix: keep multiline palette navigation in editor
lawrencecchen Apr 3, 2026
8e7fc4c
fix: cap workspace description editor growth
lawrencecchen Apr 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 37 additions & 12 deletions CLI/cmux.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1694,9 +1694,10 @@ struct CMUXCLI {
case "new-workspace":
let (commandOpt, rem0) = parseOption(commandArgs, name: "--command")
let (cwdOpt, rem1) = parseOption(rem0, name: "--cwd")
let (nameOpt, remaining) = parseOption(rem1, name: "--name")
let (nameOpt, rem2) = parseOption(rem1, name: "--name")
let (descriptionOpt, remaining) = parseOption(rem2, name: "--description")
if let unknown = remaining.first(where: { $0.hasPrefix("--") }) {
throw CLIError(message: "new-workspace: unknown flag '\(unknown)'. Known flags: --name <title>, --command <text>, --cwd <path>")
throw CLIError(message: "new-workspace: unknown flag '\(unknown)'. Known flags: --name <title>, --description <text>, --command <text>, --cwd <path>")
}
var params: [String: Any] = [:]
if let cwdOpt {
Expand All @@ -1706,6 +1707,9 @@ struct CMUXCLI {
if let nameOpt {
params["title"] = nameOpt
}
if let descriptionOpt {
params["description"] = descriptionOpt
}
Comment on lines +1710 to +1712

@coderabbitai coderabbitai Bot Apr 1, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Normalize/validate new-workspace --description input for parity

workspace-action set_description trims and rejects empty descriptions, but new-workspace --description currently forwards raw input (including whitespace-only values). This creates inconsistent behavior for the same field.

Suggested fix
-            if let descriptionOpt {
-                params["description"] = descriptionOpt
-            }
+            if let descriptionOpt {
+                let description = descriptionOpt.trimmingCharacters(in: .whitespacesAndNewlines)
+                guard !description.isEmpty else {
+                    throw CLIError(message: "new-workspace --description requires non-empty text")
+                }
+                params["description"] = description
+            }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLI/cmux.swift` around lines 1710 - 1712, Trim and validate the incoming
--description before adding it to params to match workspace-action
set_description: replace the current conditional that does if let descriptionOpt
{ params["description"] = descriptionOpt } with logic that trims descriptionOpt
using descriptionOpt.trimmingCharacters(in: .whitespacesAndNewlines), then only
set params["description"] = trimmed if trimmed is not empty; if trimmed is
empty, reject/handle it the same way set_description does (e.g., return an error
or omit the param) so whitespace-only descriptions are not accepted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the create path. new-workspace forwards the raw value, but workspace.create immediately normalizes through Workspace.setCustomDescription, so whitespace-only descriptions do not persist as state.

— Claude Code

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lawrencecchen Thanks for confirming. Agreed — since workspace.create calls Workspace.setCustomDescription(...) which normalizes and treats whitespace-only as nil, there’s no risk of persisting empty descriptions. I’ll withdraw the CLI-side validation request.

If you want a small tidy-up later: we could trim client-side and simply omit the param when empty (no error), but it’s not necessary for correctness. Just say the word if you’d like that.


✏️ Learnings added
Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2475
File: CLI/cmux.swift:1710-1712
Timestamp: 2026-04-03T07:19:48.846Z
Learning: Repo manaflow-ai/cmux — Server path: TerminalController workspace.create applies Workspace.setCustomDescription(_:) which trims/normalizes and treats whitespace-only descriptions as nil. Therefore, CLI new-workspace can safely forward raw --description; whitespace-only input will not persist. No client-side error is required for this case.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: thunter009
Repo: manaflow-ai/cmux PR: 1825
File: CLI/cmux.swift:1948-1978
Timestamp: 2026-03-25T00:33:26.452Z
Learning: Repo: manaflow-ai/cmux — In CLI/cmux.swift, the set-workspace-color command requires exactly one trailing <hex> argument and enforces a strict 6-digit hex format (`#RRGGBB`, optional leading '#'); clear-workspace-color rejects any unexpected positional args beyond --workspace. This matches server-side normalization and prevents malformed inputs.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2398
File: CLI/cmux.swift:0-0
Timestamp: 2026-04-01T09:50:14.886Z
Learning: Repo manaflow-ai/cmux — CLI/cmux.swift: The cmux rpc subcommand prints the raw v2 JSON response by default and only applies formatIDs when the caller passes an explicit --id-format override. This preserves *_id fields for scripting unless formatting is opt-in.

Learnt from: thunter009
Repo: manaflow-ai/cmux PR: 1825
File: CLI/cmux.swift:1958-1960
Timestamp: 2026-03-25T00:33:00.675Z
Learning: Repo: manaflow-ai/cmux — CLI/cmux.swift set-workspace-color intentionally accepts both "#RRGGBB" and "RRGGBB" for ergonomics, matching server-side WorkspaceTabColorSettings.normalizedHex/TabManager normalization. Do not suggest enforcing a mandatory leading '#'; at most, suggest clarifying help/usage text.

Learnt from: apollow
Repo: manaflow-ai/cmux PR: 1089
File: Sources/TerminalController.swift:3180-3193
Timestamp: 2026-03-09T02:08:14.574Z
Learning: Repo: manaflow-ai/cmux — In Sources/TerminalController.swift, v2WorkspaceClearTags(params:) must only clear all tags when the "source" key is absent. If "source" is present but blank or non-string (v2String(...) returns nil), the API should return invalid_params. Current implementation uses hasSourceKey = params.keys.contains("source") and guards with if hasSourceKey && source == nil { return .err(...)}.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2398
File: CLI/cmux.swift:4036-4038
Timestamp: 2026-04-01T09:50:41.471Z
Learning: Repo: manaflow-ai/cmux — In CLI/cmux.swift (buildInteractiveRemoteShellScript), remote shells intentionally export CMUX_SOCKET_PATH and CMUX_SOCKET as "127.0.0.1:<relayPort>" and prepend PATH with "$HOME/.cmux/bin"; CMUX_BUNDLED_CLI_PATH points to that wrapper. WorkspaceRemoteSessionController.remoteCLIWrapperScript() detects host:port, reads "~/.cmux/relay/<port>.daemon_path", and delegates to cmuxd-remote. Do not flag the non-UNIX value of CMUX_SOCKET_PATH/CMUX_SOCKET as a bug; it is the relay contract for remote sessions.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2514
File: CLI/cmux.swift:9698-9706
Timestamp: 2026-04-01T23:08:15.505Z
Learning: When loading/using a user-provided “custom executable” path in the CLI (e.g., from environment/config/UserDefaults), treat it as an executable file path only if it is NOT a directory and is executable. Concretely, check `isDirectory == false` before checking `isExecutableFile`; this avoids accepting directory-valued paths and should allow safe fallback to PATH or bundled/default executables when the candidate is invalid.

Learnt from: MaTriXy
Repo: manaflow-ai/cmux PR: 1460
File: Sources/TerminalController.swift:4012-4023
Timestamp: 2026-03-16T08:05:21.899Z
Learning: Repo: manaflow-ai/cmux — In Sources/TerminalController.swift, v2SurfaceSplitSized(params:) must validate "ratio" as follows: if the "ratio" key is present, it must be numeric (NSNumber/Double-coercible) and strictly 0 < ratio < 1, otherwise return invalid_params; when "ratio" is absent, use default 0.6. This mirrors the general pattern that a present-but-invalid param should yield invalid_params rather than falling back.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2514
File: Sources/GhosttyTerminalView.swift:3759-3761
Timestamp: 2026-04-01T22:57:41.165Z
Learning: Repo: manaflow-ai/cmux — In Sources/cmuxApp.swift, ClaudeCodeIntegrationSettings.customClaudePath(defaults:) trims surrounding whitespace and returns nil for empty/whitespace-only values; callers (e.g., TerminalSurface.createSurface(for:)) can safely set CMUX_CUSTOM_CLAUDE_PATH without additional trimming.

Learnt from: thunter009
Repo: manaflow-ai/cmux PR: 1825
File: Sources/TerminalController.swift:3607-3645
Timestamp: 2026-03-25T00:32:48.115Z
Learning: Repo: manaflow-ai/cmux — In Sources/TerminalController.swift, v2WorkspaceSetColor(params:) must validate the provided color with WorkspaceTabColorSettings.normalizedHex. If the color parameter is present but invalid, return invalid_params (no fallback). On success, apply the color and return the normalized (uppercase) `#RRGGBB` in the response payload.

Learnt from: ariel-wiz
Repo: manaflow-ai/cmux PR: 543
File: CLI/cmux.swift:2006-2007
Timestamp: 2026-03-11T09:27:14.201Z
Learning: In manaflow-ai/cmux (CLI/cmux.swift), all CLI error messages and help text use plain Swift string literals — there is no `String(localized:...)` usage anywhere in the repository, and no `Localizable.xcstrings` file exists. Do not flag CLI error/help strings as missing localization for this project.

Learnt from: arieltobiana
Repo: manaflow-ai/cmux PR: 1873
File: Sources/TerminalController.swift:4071-4087
Timestamp: 2026-03-20T17:18:30.333Z
Learning: Repo: manaflow-ai/cmux — In Sources/TerminalController.swift, v2WorkspaceAction(params:) -> case "set_color": palette names are resolved via WorkspaceTabColorSettings.defaultPaletteWithOverrides(), whose entries are always valid hex (validated by the UI). Therefore, additional normalization of entry.hex is unnecessary.

Learnt from: homanp
Repo: manaflow-ai/cmux PR: 883
File: CLI/cmux.swift:1569-1586
Timestamp: 2026-03-04T22:05:07.913Z
Learning: In manaflow-ai/cmux CLI (CLI/cmux.swift), for parity with existing browser commands, markdown.open intentionally normalizes --surface before resolving --workspace/--window, relying on server-side resolution to disambiguate final routing. Avoid one-off reordering in markdown; consider any change only as a coordinated, cross-command refactor.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2514
File: CLI/cmux.swift:9691-9711
Timestamp: 2026-04-01T22:58:26.254Z
Learning: Repo: manaflow-ai/cmux — In CLI/cmux.swift (runClaudeTeams), custom Claude path resolution now trims whitespace and rejects paths that point to the cmux wrapper using isCmuxClaudeWrapper(), before falling back to PATH/bundled. The Resources/bin/claude wrapper also resolves the real path and compares against itself, requiring -f/-x to avoid recursion/self-reference.

Learnt from: thunter009
Repo: manaflow-ai/cmux PR: 1825
File: Sources/TerminalController.swift:3620-3622
Timestamp: 2026-03-25T00:32:54.735Z
Learning: When validating or reporting workspace/tab colors in this repo, only accept and use 6-digit hex colors in the form `#RRGGBB` (no alpha, i.e., do not allow `#RRGGBBAA`). Ensure validation logic matches the existing behavior (e.g., WorkspaceTabColorSettings.normalizedHex(...) and TabManager.setTabColor(tabId:color:) as well as CLI/cmux.swift). Update any error/help text for workspace color to reference only `#RRGGBB` (not `#RRGGBBAA`).

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2398
File: CLI/cmux.swift:0-0
Timestamp: 2026-04-01T09:50:23.728Z
Learning: Repo: manaflow-ai/cmux — In CLI/cmux.swift within CMUXCLI.buildInteractiveRemoteShellScript(...), never export CMUX_TAB_ID from the workspace UUID. CMUX_TAB_ID must be surface-scoped: only set it when a surface ID is available (map CMUX_TAB_ID to CMUX_SURFACE_ID). Rationale: tab-action/rename-tab resolve CMUX_TAB_ID before CMUX_SURFACE_ID; workspace-scoped values misroute or fail.

Learnt from: atani
Repo: manaflow-ai/cmux PR: 819
File: Sources/AppDelegate.swift:3491-3493
Timestamp: 2026-03-04T14:06:16.241Z
Learning: For manaflow-ai/cmux PR `#819` (Japanese i18n), keep scope limited to localization changes; UX enhancements like preferring workspace.customTitle in workspaceDisplayName() or altering move-target labels should be handled in a separate follow-up issue.

Learnt from: gaelic-ghost
Repo: manaflow-ai/cmux PR: 1926
File: scripts/build-sign-upload.sh:8-10
Timestamp: 2026-03-22T00:14:23.473Z
Learning: Repo: manaflow-ai/cmux — `scripts/lib/cmux-paths.sh` `cmux_paths_init()` intentionally preserves any pre-set `CMUX_*` environment variable overrides verbatim (does not canonicalize relative paths to absolute). This is a deliberate Stage 1 design choice; do not flag relative-override canonicalization as a bug unless a concrete reproducer is provided or a later stage explicitly tightens the override-semantics contract.

Learnt from: mrosnerr
Repo: manaflow-ai/cmux PR: 2545
File: Sources/Workspace.swift:0-0
Timestamp: 2026-04-02T21:40:59.098Z
Learning: Repo: manaflow-ai/cmux — In Sources/Workspace.swift session snapshot logic, detected foreground command lines are only recorded if they pass SessionRestoreCommandSettings.isCommandAllowed(...). Commit f887189 moved gating to the SessionForegroundProcessCache so unallowed (potentially sensitive) commands are never written to the session JSON.

Learnt from: tayl0r
Repo: manaflow-ai/cmux PR: 1909
File: Sources/ContentView.swift:2156-2171
Timestamp: 2026-03-23T06:08:14.740Z
Learning: Repo: manaflow-ai/cmux — In Sources/ContentView.swift, openFileInTextEditor(_:) must attempt workspace.newTextEditorSplit(from:orientation:filePath:focus:) and, if that returns nil, fall back to workspace.newTextEditorSurface(inPane:filePath:focus:) using bonsplitController.focusedPaneId. Rationale: avoid dropping file-open requests when the focused panel is not pane-backed.

Learnt from: qkrwpdlr
Repo: manaflow-ai/cmux PR: 0
File: :0-0
Timestamp: 2026-03-23T07:12:42.553Z
Learning: Repo: manaflow-ai/cmux — In Sources/Panels/BrowserPanel.swift, BrowserPanel.updateWorkspaceId(_:) is a dedicated method (var workspaceId) that updates both BrowserPanel.workspaceId and pickerMessageHandler?.updateWorkspaceId(_:) atomically. It is called from BrowserPanel.reattachToWorkspace(_:) when a panel moves between workspaces. This ensures BrowserPickerMessageHandler always posts notifications with the current workspaceId, not a stale one from panel initialization.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2528
File: Sources/cmuxApp.swift:776-777
Timestamp: 2026-04-03T03:35:40.100Z
Learning: Repo: manaflow-ai/cmux — As of PR `#2528`, workspace digit mapping (Cmd+1–9 and sidebar digits) intentionally uses TabManager.tabs as the canonical ordering for both sidebar rendering and app shortcut handling. Do not suggest switching to orderedSidebarWorkspaceIds() unless the model changes to a sidebar-ordered, group/collapse-aware source of truth.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2525
File: Sources/GhosttyTerminalView.swift:481-513
Timestamp: 2026-04-02T10:13:39.235Z
Learning: Repo: manaflow-ai/cmux — In Sources/GhosttyTerminalView.swift, terminal file-link resolution trims trailing unmatched closing delimiters “) ] } >” only when they are dangling (more closers than openers), preserving wrapped tokens like “(file:///tmp/a.png)”. Implemented via terminalFileLinkTrailingClosingDelimiters and count comparison inside trimTrailingTerminalFileLinkPunctuation(_:) and exercised by a regression test (PR `#2525`, commit 3f5c5b6d).

Learnt from: qkrwpdlr
Repo: manaflow-ai/cmux PR: 0
File: :0-0
Timestamp: 2026-03-23T07:01:33.134Z
Learning: Repo: manaflow-ai/cmux — In Sources/TerminalController.swift, sendPickedElementToTerminal(workspaceId:summary:) resolves the target workspace via AppDelegate.shared?.workspaceFor(tabId: workspaceId), which searches across all mainWindowContexts (not self.tabManager which is active-window only). It first injects text into the focused terminal panel if it's a terminal, then falls back to iterating all panels in the workspace.

Learnt from: atani
Repo: manaflow-ai/cmux PR: 819
File: Sources/AppDelegate.swift:0-0
Timestamp: 2026-03-04T14:05:42.574Z
Learning: Guideline: In Swift files (cmux project), when handling pluralized strings, prefer using localization keys with the ICU-style plural forms .one and .other. For example, use keys like statusMenu.unreadCount.one for the singular case (1) and statusMenu.unreadCount.other for all other counts, and similarly for statusMenu.tooltip.unread.one/other. Rationale: ensures correct pluralization across locales and makes localization keys explicit. Review code to ensure any unread count strings and related tooltips follow this .one/.other key pattern and verify the correct value is chosen based on the count.

Learnt from: austinywang
Repo: manaflow-ai/cmux PR: 954
File: Sources/TerminalController.swift:0-0
Timestamp: 2026-03-05T22:04:34.712Z
Learning: Adopt the convention: for health/telemetry tri-state values in Swift, prefer Optionals (Bool?) over sentinel booleans. In TerminalController.swift, socketConnectable is Bool? and only set when socketProbePerformed is true; downstream logic must treat nil as 'not probed'. Ensure downstream code checks for nil before using a value and uses explicit non-nil checks to determine state, improving clarity and avoiding misinterpretation of default false.

Learnt from: apollow
Repo: manaflow-ai/cmux PR: 1089
File: CLI/cmux.swift:462-499
Timestamp: 2026-03-09T02:08:51.778Z
Learning: For Claude Code session tag extraction in CLI/cmux.swift, in ClaudeHookTagExtractor.extractTags(subtitle:body:), pre-redact sensitive spans (UUIDs, emails, access tokens, filesystem paths, ENV_VAR=..., long numerics) across the combined body+subtitle using unanchored sensitiveSpanPatterns before tokenization. Then tokenize and still filter each token with anchored sensitivePatterns. Rationale: prevents PII/path fragments from slipping into searchable tags after delimiter splitting.

Learnt from: pratikpakhale
Repo: manaflow-ai/cmux PR: 2011
File: Resources/Localizable.xcstrings:15256-15368
Timestamp: 2026-03-23T21:39:50.795Z
Learning: When reviewing this repo’s Swift localization usage, do not flag missing `String.localizedStringWithFormat` for calls that use the modern overload `String(localized: "key", defaultValue: "...\(variable)")` (where `defaultValue` is a `String.LocalizationValue` built with `\(…)`). That overload natively supports interpolation and the xcstrings/runtime substitution handles the resulting placeholders automatically. Only require `String.localizedStringWithFormat` when using the older `String(localized:)` overload that takes a plain `String` (i.e., where format arguments must be passed separately), such as for keys like `clipboard.sshError.single`.

let response = try client.sendV2(method: "workspace.create", params: params)
let wsId = (response["workspace_ref"] as? String) ?? (response["workspace_id"] as? String) ?? ""
print("OK \(wsId)")
Expand Down Expand Up @@ -2016,11 +2020,14 @@ struct CMUXCLI {
printV2Payload(payload, jsonOutput: jsonOutput, idFormat: idFormat, fallbackText: v2OKSummary(payload, idFormat: idFormat, kinds: ["workspace"]))

case "current-workspace":
let response = try sendV1Command("current_workspace", client: client)
let response = try client.sendV2(method: "workspace.current")
if jsonOutput {
print(jsonString(["workspace_id": response]))
print(jsonString(formatIDs(response, mode: idFormat)))
} else {
print(response)
let handle = formatHandle(response, kind: "workspace", idFormat: idFormat)
?? (response["workspace_id"] as? String)
?? ""
print(handle)
}

case "read-screen":
Expand Down Expand Up @@ -3383,8 +3390,9 @@ struct CMUXCLI {
let (actionOpt, rem1) = parseOption(rem0, name: "--action")
let (titleOpt, rem2) = parseOption(rem1, name: "--title")
let (colorOpt, rem3) = parseOption(rem2, name: "--color")
let (descriptionOpt, rem4) = parseOption(rem3, name: "--description")

var positional = rem3
var positional = rem4
let actionRaw: String
if let actionOpt {
actionRaw = actionOpt
Expand All @@ -3403,7 +3411,8 @@ struct CMUXCLI {
let workspaceArg = workspaceOpt ?? (windowOverride == nil ? ProcessInfo.processInfo.environment["CMUX_WORKSPACE_ID"] : nil)
let workspaceId = try normalizeWorkspaceHandle(workspaceArg, client: client, allowCurrent: true)

let inferredPositional = positional.joined(separator: " ").trimmingCharacters(in: .whitespacesAndNewlines)
let inferredPositionalRaw = positional.joined(separator: " ")
let inferredPositional = inferredPositionalRaw.trimmingCharacters(in: .whitespacesAndNewlines)
let title = (titleOpt ?? (action == "rename" && !inferredPositional.isEmpty ? inferredPositional : nil))?.trimmingCharacters(in: .whitespacesAndNewlines)

if action == "rename", (title?.isEmpty ?? true) {
Expand All @@ -3417,6 +3426,13 @@ struct CMUXCLI {
throw CLIError(message: "workspace-action set-color requires --color <name|#hex> (or a trailing color)")
}

let description = (
descriptionOpt ?? (action == "set_description" && !inferredPositional.isEmpty ? inferredPositionalRaw : nil)
)?.trimmingCharacters(in: .whitespacesAndNewlines)
Comment on lines +3429 to +3431

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop trimming workspace descriptions in CLI set-description

workspace-action set-description currently applies .trimmingCharacters(in: .whitespacesAndNewlines) before sending the value, so leading/trailing spaces and trailing newlines are silently dropped on the CLI path. This makes description updates lossy (e.g., intentional markdown indentation or terminal newline formatting cannot round-trip), while the underlying workspace model explicitly preserves meaningful edge whitespace. Validate emptiness with a trimmed copy, but pass the original text through unchanged.

Useful? React with 👍 / 👎.

if action == "set_description", (description?.isEmpty ?? true) {
throw CLIError(message: "workspace-action set-description requires --description <text> (or trailing text)")
}

var params: [String: Any] = ["action": action]
if let workspaceId {
params["workspace_id"] = workspaceId
Expand All @@ -3427,6 +3443,9 @@ struct CMUXCLI {
if let color, !color.isEmpty {
params["color"] = color
}
if let description, !description.isEmpty {
params["description"] = description
}

let payload = try client.sendV2(method: "workspace.action", params: params)
var summaryParts = ["OK", "action=\(action)"]
Expand Down Expand Up @@ -6326,6 +6345,7 @@ struct CMUXCLI {
Actions:
pin | unpin
rename | clear-name
set-description | clear-description
move-up | move-down | move-top
close-others | close-above | close-below
mark-read | mark-unread
Expand All @@ -6336,6 +6356,7 @@ struct CMUXCLI {
--workspace <id|ref|index> Target workspace (default: current/$CMUX_WORKSPACE_ID)
--title <text> Title for rename
--color <name|#hex> Color for set-color (name or #RRGGBB hex)
--description <text> Description for set-description

Named colors:
Red, Crimson, Orange, Amber, Olive, Green, Teal, Aqua,
Expand All @@ -6348,6 +6369,8 @@ struct CMUXCLI {
cmux workspace-action --action set-color --color blue
cmux workspace-action --action set-color --color "#C0392B"
cmux workspace-action set-color Amber
cmux workspace-action --action set-description --description "Ship checklist"
cmux workspace-action --action set-description $'Ship checklist\n- verify build\n- post notes'
cmux workspace-action clear-color
"""
case "tab-action":
Expand Down Expand Up @@ -6402,18 +6425,20 @@ struct CMUXCLI {
"""
case "new-workspace":
return """
Usage: cmux new-workspace [--name <title>] [--cwd <path>] [--command <text>]
Usage: cmux new-workspace [--name <title>] [--description <text>] [--cwd <path>] [--command <text>]

Create a new workspace in the current window.

Flags:
--name <title> Set a custom name for the new workspace
--cwd <path> Set the working directory for the new workspace
--name <title> Set a custom name for the new workspace
--description <text> Set a custom description for the new workspace
--cwd <path> Set the working directory for the new workspace
--command <text> Send text+Enter to the new workspace after creation

Example:
cmux new-workspace
cmux new-workspace --name "Build Server"
cmux new-workspace --name "Launch" --description "Ship checklist"
cmux new-workspace --cwd ~/projects/myapp
cmux new-workspace --cwd . --command "npm test"
"""
Expand Down Expand Up @@ -13270,9 +13295,9 @@ struct CMUXCLI {
close-window --window <id>
move-workspace-to-window --workspace <id|ref> --window <id|ref>
reorder-workspace --workspace <id|ref|index> (--index <n> | --before <id|ref|index> | --after <id|ref|index>) [--window <id|ref|index>]
workspace-action --action <name> [--workspace <id|ref|index>] [--title <text>] [--color <name|#hex>]
workspace-action --action <name> [--workspace <id|ref|index>] [--title <text>] [--color <name|#hex>] [--description <text>]
list-workspaces
new-workspace [--name <title>] [--cwd <path>] [--command <text>]
new-workspace [--name <title>] [--description <text>] [--cwd <path>] [--command <text>]
ssh <destination> [--name <title>] [--port <n>] [--identity <path>] [--ssh-option <opt>] [--no-focus] [-- <remote-command-args>]
remote-daemon-status [--os <darwin|linux>] [--arch <arm64|amd64>]
new-split <left|right|up|down> [--workspace <id|ref>] [--surface <id|ref>] [--panel <id|ref>]
Expand Down
4 changes: 4 additions & 0 deletions GhosttyTabs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
B8F266246A1A3D9A45BD840F /* SidebarHelpMenuUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8F266256A1A3D9A45BD840F /* SidebarHelpMenuUITests.swift */; };
B8F266266A1A3D9A45BD840F /* DisplayResolutionRegressionUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8F266276A1A3D9A45BD840F /* DisplayResolutionRegressionUITests.swift */; };
C0B4D9B0A1B2C3D4E5F60718 /* UpdatePillUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0B4D9B1A1B2C3D4E5F60718 /* UpdatePillUITests.swift */; };
E6FA9084A1B2C3D4E5F60718 /* WorkspaceDescriptionUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6FA9085A1B2C3D4E5F60718 /* WorkspaceDescriptionUITests.swift */; };
B9000014A1B2C3D4E5F60719 /* JumpToUnreadUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9000013A1B2C3D4E5F60719 /* JumpToUnreadUITests.swift */; };
B9000015A1B2C3D4E5F60719 /* MultiWindowNotificationsUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9000016A1B2C3D4E5F60719 /* MultiWindowNotificationsUITests.swift */; };
B900001AA1B2C3D4E5F60719 /* CloseWorkspaceConfirmDialogUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9000019A1B2C3D4E5F60719 /* CloseWorkspaceConfirmDialogUITests.swift */; };
Expand Down Expand Up @@ -273,6 +274,7 @@
B8F266256A1A3D9A45BD840F /* SidebarHelpMenuUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarHelpMenuUITests.swift; sourceTree = "<group>"; };
B8F266276A1A3D9A45BD840F /* DisplayResolutionRegressionUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayResolutionRegressionUITests.swift; sourceTree = "<group>"; };
C0B4D9B1A1B2C3D4E5F60718 /* UpdatePillUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdatePillUITests.swift; sourceTree = "<group>"; };
E6FA9085A1B2C3D4E5F60718 /* WorkspaceDescriptionUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkspaceDescriptionUITests.swift; sourceTree = "<group>"; };
A5001101 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
IC000002 /* AppIcon.icon */ = {isa = PBXFileReference; lastKnownFileType = folder; path = AppIcon.icon; sourceTree = "<group>"; };
B2E7294509CC42FE9191870E /* xterm-ghostty */ = {isa = PBXFileReference; lastKnownFileType = file; path = "ghostty/terminfo/78/xterm-ghostty"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -560,6 +562,7 @@
818DBCD4AB69EB72573E8138 /* SidebarResizeUITests.swift */,
B8F266256A1A3D9A45BD840F /* SidebarHelpMenuUITests.swift */,
B8F266276A1A3D9A45BD840F /* DisplayResolutionRegressionUITests.swift */,
E6FA9085A1B2C3D4E5F60718 /* WorkspaceDescriptionUITests.swift */,
D0E0F0B1A1B2C3D4E5F60718 /* BrowserPaneNavigationKeybindUITests.swift */,
D0E0F0B3A1B2C3D4E5F60718 /* BrowserOmnibarSuggestionsUITests.swift */,
FB100001A1B2C3D4E5F60718 /* BrowserImportProfilesUITests.swift */,
Expand Down Expand Up @@ -857,6 +860,7 @@
B8F266236A1A3D9A45BD840F /* SidebarResizeUITests.swift in Sources */,
B8F266246A1A3D9A45BD840F /* SidebarHelpMenuUITests.swift in Sources */,
B8F266266A1A3D9A45BD840F /* DisplayResolutionRegressionUITests.swift in Sources */,
E6FA9084A1B2C3D4E5F60718 /* WorkspaceDescriptionUITests.swift in Sources */,
D0E0F0B0A1B2C3D4E5F60718 /* BrowserPaneNavigationKeybindUITests.swift in Sources */,
D0E0F0B2A1B2C3D4E5F60718 /* BrowserOmnibarSuggestionsUITests.swift in Sources */,
FB100000A1B2C3D4E5F60718 /* BrowserImportProfilesUITests.swift in Sources */,
Expand Down
136 changes: 136 additions & 0 deletions Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -86660,6 +86660,142 @@
}
}
}
},
"shortcut.editWorkspaceDescription.label": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Edit Workspace Description"
}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "ワークスペースの説明を編集"
}
}
}
},
"menu.view.editWorkspaceDescription": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Edit Workspace Description…"
}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "ワークスペースの説明を編集…"
}
}
}
},
"command.editWorkspaceDescription.title": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Edit Workspace Description…"
}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "ワークスペースの説明を編集…"
}
}
}
},
"command.clearWorkspaceDescription.title": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Clear Workspace Description"
}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "ワークスペースの説明を消去"
}
}
}
},
"commandPalette.description.workspacePlaceholder": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Workspace description"
}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "ワークスペースの説明"
}
}
}
},
"commandPalette.description.workspaceInputHint": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Press Enter to save. Press Shift-Enter for a new line, or Escape to cancel."

@cubic-dev-ai cubic-dev-ai Bot Apr 1, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: This localization value no longer matches the key’s defaultValue in code. If the catalog entry is missing (or in fallback scenarios), users will see outdated key instructions.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Resources/Localizable.xcstrings, line 86789:

<comment>This localization value no longer matches the key’s `defaultValue` in code. If the catalog entry is missing (or in fallback scenarios), users will see outdated key instructions.</comment>

<file context>
@@ -86786,13 +86786,13 @@
           "stringUnit": {
             "state": "translated",
-            "value": "Press Command-Return to save. Press Return for a new line, or Escape to cancel."
+            "value": "Press Enter to save. Press Shift-Enter for a new line, or Escape to cancel."
           }
         },
</file context>
Fix with Cubic

}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "Enter で保存します。Shift-Enter で改行、Escape でキャンセルします。"
}
}
}
},
"contextMenu.editWorkspaceDescription": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Edit Workspace Description…"
}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "ワークスペースの説明を編集…"
}
}
}
},
"contextMenu.clearWorkspaceDescription": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Clear Workspace Description"
}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "ワークスペースの説明を消去"
}
}
}
}
}
}
Loading
Loading