Repository navigation
Add editable workspace descriptions #2475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cae0e5b
e6fa908
8c91480
62f19d2
f712e26
c93b4f8
fe2d93d
5efa357
7c8f6cb
4de1f7c
efd3d7b
c088de7
6ab9b92
bb31128
631f9ce
b3eb253
b9a3786
6d74daa
fe3d8a0
3ae3a72
ee7580f
0e9b87d
6f8350c
df64310
e32af42
f875203
2255003
558333b
8e7fc4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 { | ||
|
|
@@ -1706,6 +1707,9 @@ struct CMUXCLI { | |
| if let nameOpt { | ||
| params["title"] = nameOpt | ||
| } | ||
| if let descriptionOpt { | ||
| params["description"] = descriptionOpt | ||
| } | ||
| 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)") | ||
|
|
@@ -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": | ||
|
|
@@ -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 | ||
|
|
@@ -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) { | ||
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 | ||
|
|
@@ -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)"] | ||
|
|
@@ -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 | ||
|
|
@@ -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, | ||
|
|
@@ -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": | ||
|
|
@@ -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" | ||
| """ | ||
|
|
@@ -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>] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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." | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: This localization value no longer matches the key’s Prompt for AI agents |
||
| } | ||
| }, | ||
| "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": "ワークスペースの説明を消去" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normalize/validate
new-workspace --descriptioninput for parityworkspace-action set_descriptiontrims and rejects empty descriptions, butnew-workspace --descriptioncurrently forwards raw input (including whitespace-only values). This creates inconsistent behavior for the same field.Suggested fix
🤖 Prompt for AI Agents
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lawrencecchenThanks 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
🧠 Learnings used