diff options
| author | Adam Malczewski <[email protected]> | 2026-06-23 03:27:01 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-23 03:27:01 +0900 |
| commit | b346a50c3757b3df6086f11b995847144a5e07e8 (patch) | |
| tree | 0119ff2a63e3ef9e9efb0190daeb20707e1c5f7a /packages/cli/src/message.test.ts | |
| parent | 6d7b3923b40eb4baf3cefadfde236de646990713 (diff) | |
| download | dispatch-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/message.test.ts')
| -rw-r--r-- | packages/cli/src/message.test.ts | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/packages/cli/src/message.test.ts b/packages/cli/src/message.test.ts index a3f1e0b..440ec85 100644 --- a/packages/cli/src/message.test.ts +++ b/packages/cli/src/message.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from "vitest"; +import { parseArgs } from "./args.js"; import { buildChatRequest, composeMessage } from "./message.js"; describe("composeMessage", () => { @@ -94,4 +95,53 @@ describe("buildChatRequest", () => { ); expect(req).not.toHaveProperty("reasoningEffort"); }); + + it("includes workspaceId when provided", () => { + const req = buildChatRequest( + { modelName: "m", text: "x", workspaceId: "my-work", showReasoning: false }, + { cwd: "/work", message: "x" }, + ); + expect(req.workspaceId).toBe("my-work"); + }); + + it("omits workspaceId when not provided", () => { + const req = buildChatRequest( + { modelName: "m", text: "x", showReasoning: false }, + { cwd: "/work", message: "x" }, + ); + expect(req).not.toHaveProperty("workspaceId"); + }); +}); + +describe("workspace flag → ChatRequest", () => { + const defaultServer = "http://localhost:24203"; + + it("--workspace flag sets workspaceId on request", () => { + const parsed = parseArgs(["my-model", "--text", "hi", "--workspace", "my-work"], { + defaultServer, + }); + expect(parsed.kind).toBe("chat"); + if (parsed.kind !== "chat") return; + const req = buildChatRequest(parsed, { cwd: "/work", message: "hi" }); + expect(req.workspaceId).toBe("my-work"); + }); + + it("--workspace flag omitted sends no workspaceId", () => { + const parsed = parseArgs(["my-model", "--text", "hi"], { defaultServer }); + expect(parsed.kind).toBe("chat"); + if (parsed.kind !== "chat") return; + const req = buildChatRequest(parsed, { cwd: "/work", message: "hi" }); + expect(req.workspaceId).toBeUndefined(); + expect(req).not.toHaveProperty("workspaceId"); + }); + + it("-w shorthand sets workspaceId on request", () => { + const parsed = parseArgs(["my-model", "--text", "hi", "-w", "shorthand"], { + defaultServer, + }); + expect(parsed.kind).toBe("chat"); + if (parsed.kind !== "chat") return; + const req = buildChatRequest(parsed, { cwd: "/work", message: "hi" }); + expect(req.workspaceId).toBe("shorthand"); + }); }); |
