summaryrefslogtreecommitdiffhomepage
path: root/packages/cli/src/args.test.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-25 18:36:08 +0900
committerAdam Malczewski <[email protected]>2026-06-25 18:36:08 +0900
commitde022cee7ac66c95d7ed6a35d4e00f8e2d92cbbc (patch)
tree041dcb1017e544a405526443cb578baa974bec0e /packages/cli/src/args.test.ts
parentfc1c3a54c3075990ec0dd0f97901bd46fe142923 (diff)
parent649fc4f66f40f7743683546f81d3320e7394e597 (diff)
downloaddispatch-de022cee7ac66c95d7ed6a35d4e00f8e2d92cbbc.tar.gz
dispatch-de022cee7ac66c95d7ed6a35d4e00f8e2d92cbbc.zip
Merge branch 'dev' into feature/ssh-support
Brings dev's retry-with-backoff (the transient `provider-retry` AgentEvent the web frontend consumes) + the LSP-dead-server per-edit-hang fix into the SSH feature branch, alongside the SSH waves 0-5c. All code files auto-merged cleanly (run-turn.ts, orchestrator.ts, runtime.ts, wire/index.ts, tool-edit-file/extension.ts, run-turn.test.ts — both computerId threading and retry-with-backoff coexist). Only tasks.md conflicted (status section — orchestrator-resolved; both feature sections kept). Verified post-merge: tsc -b EXIT 0, biome clean (391 files), 1730 vitest pass +6 sshd-integration skipped (was 1690; +40 from dev's retry/LSP tests). Wire dist rebuilt so the FE can re-sync the pinned @dispatch/wire dep and pick up BOTH provider-retry AND the SSH Computer/defaultComputerId types. No merge or push (into dev or otherwise).
Diffstat (limited to 'packages/cli/src/args.test.ts')
-rw-r--r--packages/cli/src/args.test.ts68
1 files changed, 66 insertions, 2 deletions
diff --git a/packages/cli/src/args.test.ts b/packages/cli/src/args.test.ts
index 3d07c96..e613f31 100644
--- a/packages/cli/src/args.test.ts
+++ b/packages/cli/src/args.test.ts
@@ -254,6 +254,41 @@ describe("parseArgs", () => {
});
});
+ it("parses 'list' with --workspace", () => {
+ expect(parseArgs(["list", "--workspace", "proj"], { defaultServer })).toEqual({
+ kind: "list",
+ server: "http://localhost:24203",
+ workspaceId: "proj",
+ all: false,
+ });
+ });
+
+ it("parses 'list' with -w shorthand", () => {
+ const result = parseArgs(["list", "-w", "ws"], { defaultServer });
+ expect(result.kind).toBe("list");
+ if (result.kind === "list") expect(result.workspaceId).toBe("ws");
+ });
+
+ it("parses 'list' with --workspace, --status, and a prefix together", () => {
+ const result = parseArgs(["list", "abc", "--status", "active", "--workspace", "proj"], {
+ defaultServer,
+ });
+ expect(result).toEqual({
+ kind: "list",
+ server: "http://localhost:24203",
+ query: "abc",
+ status: "active",
+ workspaceId: "proj",
+ all: false,
+ });
+ });
+
+ it("errors when --workspace has no value (list)", () => {
+ const result = parseArgs(["list", "--workspace"], { defaultServer });
+ expect(result.kind).toBe("error");
+ if (result.kind === "error") expect(result.message).toContain("--workspace requires a value");
+ });
+
it("parses 'list' with --all", () => {
expect(parseArgs(["list", "--all"], { defaultServer })).toEqual({
kind: "list",
@@ -320,11 +355,31 @@ describe("parseArgs", () => {
server: "http://localhost:24203",
conversationId: "deadbeef",
text: "hi",
+ file: undefined,
+ queue: false,
+ open: false,
+ });
+ });
+
+ it("parses 'send' with --file", () => {
+ expect(parseArgs(["send", "deadbeef", "--file", "foo.txt"], { defaultServer })).toEqual({
+ kind: "send",
+ server: "http://localhost:24203",
+ conversationId: "deadbeef",
+ text: undefined,
+ file: "foo.txt",
queue: false,
open: false,
});
});
+ it("parses 'send' with both --text and --file", () => {
+ const result = parseArgs(["send", "deadbeef", "--text", "hi", "--file", "f.txt"], {
+ defaultServer,
+ });
+ expect(result).toMatchObject({ kind: "send", text: "hi", file: "f.txt" });
+ });
+
it("parses 'send' with --queue", () => {
const result = parseArgs(["send", "deadbeef", "--text", "hi", "--queue"], {
defaultServer,
@@ -334,6 +389,7 @@ describe("parseArgs", () => {
server: "http://localhost:24203",
conversationId: "deadbeef",
text: "hi",
+ file: undefined,
queue: true,
open: false,
});
@@ -348,6 +404,7 @@ describe("parseArgs", () => {
server: "http://localhost:24203",
conversationId: "deadbeef",
text: "hi",
+ file: undefined,
queue: false,
open: true,
});
@@ -363,6 +420,7 @@ describe("parseArgs", () => {
server: "http://localhost:24203",
conversationId: "deadbeef",
text: "hi",
+ file: undefined,
queue: false,
open: false,
cwd: "/tmp",
@@ -370,10 +428,10 @@ describe("parseArgs", () => {
});
});
- it("requires --text", () => {
+ it("errors when --text and --file are both missing", () => {
const result = parseArgs(["send", "deadbeef"], { defaultServer });
expect(result.kind).toBe("error");
- if (result.kind === "error") expect(result.message).toContain("--text");
+ if (result.kind === "error") expect(result.message).toContain("--text or --file");
});
it("requires a conversation id", () => {
@@ -386,6 +444,12 @@ describe("parseArgs", () => {
const result = parseArgs(["send", "deadbeef", "--text"], { defaultServer });
expect(result.kind).toBe("error");
});
+
+ it("errors when --file has no value", () => {
+ const result = parseArgs(["send", "deadbeef", "--file"], { defaultServer });
+ expect(result.kind).toBe("error");
+ if (result.kind === "error") expect(result.message).toContain("--file requires a value");
+ });
});
describe("open", () => {