summaryrefslogtreecommitdiffhomepage
path: root/packages/cli/src/args.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-23 03:27:01 +0900
committerAdam Malczewski <[email protected]>2026-06-23 03:27:01 +0900
commitb346a50c3757b3df6086f11b995847144a5e07e8 (patch)
tree0119ff2a63e3ef9e9efb0190daeb20707e1c5f7a /packages/cli/src/args.ts
parent6d7b3923b40eb4baf3cefadfde236de646990713 (diff)
downloaddispatch-b346a50c3757b3df6086f11b995847144a5e07e8.tar.gz
dispatch-b346a50c3757b3df6086f11b995847144a5e07e8.zip
feat: workspaces — session-orchestrator + transport-http + transport-ws + cli (Wave 2+3)
session-orchestrator: workspaceId on StartTurnInput/EnqueueInput; effective cwd resolution (getCwd → getEffectiveCwd); auto-create workspace on turn start; warm parity (same effective cwd). 93 tests (+8). transport-http: workspace routes (GET/PUT/DELETE /workspaces, title, default-cwd); workspaceId threading on POST /chat + queue; ?workspaceId= filter on GET /conversations; DELETE /conversations/:id/cwd (clears explicit cwd); GET /conversations/:id/lsp uses effective cwd; slug validation. 166 tests. transport-ws: workspaceId threading on chat.send + chat.queue. 32 tests. cli: --workspace/-w flag; ConversationMeta test fakes fixed. 123 tests. Full typecheck EXIT 0, biome clean. 1283 vitest + 199 transport bun pass (1 pre-existing tool-shell failure unrelated to workspaces).
Diffstat (limited to 'packages/cli/src/args.ts')
-rw-r--r--packages/cli/src/args.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/cli/src/args.ts b/packages/cli/src/args.ts
index ac5dd4a..8a63777 100644
--- a/packages/cli/src/args.ts
+++ b/packages/cli/src/args.ts
@@ -26,6 +26,7 @@ export type ParsedCommand =
readonly reasoningEffort?: ReasoningEffort | undefined;
readonly showReasoning: boolean;
readonly open: boolean;
+ readonly workspaceId?: string | undefined;
}
| {
readonly kind: "list";
@@ -46,6 +47,7 @@ export type ParsedCommand =
readonly open: boolean;
readonly cwd?: string;
readonly reasoningEffort?: ReasoningEffort;
+ readonly workspaceId?: string;
}
| { readonly kind: "stop"; readonly server: string; readonly conversationId: string }
| { readonly kind: "help" }
@@ -206,6 +208,7 @@ export function parseArgs(argv: readonly string[], opts: ParseOpts): ParsedComma
let open = false;
let cwd: string | undefined;
let reasoningEffort: ReasoningEffort | undefined;
+ let workspaceId: string | undefined;
for (let i = 1; i < argv.length; i++) {
const arg = argv[i] as string;
@@ -243,6 +246,12 @@ export function parseArgs(argv: readonly string[], opts: ParseOpts): ParsedComma
reasoningEffort = val;
break;
}
+ case "--workspace":
+ case "-w":
+ if (i + 1 >= argv.length)
+ return { kind: "error", message: "--workspace requires a value" };
+ workspaceId = argv[++i];
+ break;
default:
if (arg.startsWith("--")) return { kind: "error", message: `Unknown flag: ${arg}` };
if (conversationId !== undefined)
@@ -267,6 +276,7 @@ export function parseArgs(argv: readonly string[], opts: ParseOpts): ParsedComma
open,
...(cwd !== undefined && { cwd }),
...(reasoningEffort !== undefined && { reasoningEffort }),
+ ...(workspaceId !== undefined && { workspaceId }),
};
}
@@ -280,6 +290,7 @@ export function parseArgs(argv: readonly string[], opts: ParseOpts): ParsedComma
let showReasoning = false;
let open = false;
let server = opts.defaultServer;
+ let workspaceId: string | undefined;
for (let i = 1; i < argv.length; i++) {
const arg = argv[i] as string;
@@ -327,6 +338,11 @@ export function parseArgs(argv: readonly string[], opts: ParseOpts): ParsedComma
reasoningEffort = val;
}
break;
+ case "--workspace":
+ case "-w":
+ if (i + 1 >= argv.length) return { kind: "error", message: "--workspace requires a value" };
+ workspaceId = argv[++i];
+ break;
default:
return { kind: "error", message: `Unknown flag: ${arg}` };
}
@@ -350,5 +366,6 @@ export function parseArgs(argv: readonly string[], opts: ParseOpts): ParsedComma
reasoningEffort,
showReasoning,
open,
+ ...(workspaceId !== undefined && { workspaceId }),
};
}