import test from "node:test"; import assert from "node:assert/strict"; import { buildCommand, toolById } from "./registry.js"; test("DeepSeek Harness requires a headless task", () => { const tool = toolById("dsh"); assert.throws(() => buildCommand(tool, { profile: "headless", initialInput: "" }), /requires a task/); assert.deepEqual( buildCommand(tool, { profile: "headless", initialInput: "run tests" }), { command: "dsh", args: ["--profile", "headless", "run tests"], interactive: true }, ); }); test("DeepSeek Harness rejects unavailable profiles", () => { assert.throws(() => buildCommand(toolById("dsh"), { profile: "tui", initialInput: "run tests" }), /must be headless/); }); test("task commands use non-interactive CLI modes", () => { const task = { purpose: "task", initialInput: "review this", model: "test-model" }; assert.deepEqual(buildCommand(toolById("codex"), task), { command: "codex", args: ["exec", "--color", "never", "--skip-git-repo-check", "--model", "test-model", "review this"], interactive: false, }); assert.deepEqual(buildCommand(toolById("claude"), task), { command: "claude", args: ["--print", "--output-format", "text", "--model", "test-model", "review this"], interactive: false, }); assert.deepEqual(buildCommand(toolById("kimi"), task), { command: "kimi", args: ["--prompt", "review this", "--output-format", "text", "--model", "test-model"], interactive: false, }); assert.deepEqual(buildCommand(toolById("opencode"), task), { command: "opencode", args: ["run", "--format", "default", "--model", "test-model", "review this"], interactive: false, }); assert.deepEqual(buildCommand(toolById("qwen"), task), { command: "qwen", args: ["--prompt", "review this", "--output-format", "text", "--model", "test-model"], interactive: false, }); assert.deepEqual(buildCommand(toolById("dsh"), task), { command: "dsh", args: ["--profile", "headless", "review this"], interactive: false, }); }); test("task commands require a message", () => { assert.throws( () => buildCommand(toolById("codex"), { purpose: "task", initialInput: "" }), /task message is required/i, ); }); test("Multica setup accepts only HTTP URLs and stays interactive", () => { const built = buildCommand(toolById("multica"), { purpose: "authorization", serverUrl: "https://api.example.test/", appUrl: "https://app.example.test/", }); assert.deepEqual(built, { command: "multica-setup", args: ["--server-url", "https://api.example.test", "--app-url", "https://app.example.test"], interactive: true, }); assert.throws(() => buildCommand(toolById("multica"), { purpose: "authorization", serverUrl: "file:///etc/passwd", }), /HTTP\(S\)/); });