Files
OmniRoute/tests/unit/cli-tools-schema.test.ts
Diego Rodrigues de Sa e Souza 1bd4b02110 feat(cli-tools): add CodeWhale CLI tool (#5996)
CodeWhale (https://github.com/Hmbown/CodeWhale) is the actively-maintained
successor to DeepSeek TUI — same author, renamed project. Added as a dual
entry alongside the existing "deepseek-tui" catalog entry (rather than a
hard rename) so users who still run the old DeepSeek TUI binary keep a
working dashboard card, while new users are steered to "codewhale".

New /api/cli-tools/codewhale-settings route writes the primary
~/.codewhale/config.toml and keeps an existing legacy
~/.deepseek/config.toml in sync (read fallback + best-effort write sync),
mirroring deepseek-tui-settings/route.ts. CLI_TOOLS and cliRuntime catalogs
updated; catalog cardinality tests/constants bumped accordingly (18→19
visible code tools, 28→29 total).


Inspired-by: https://github.com/decolua/9router/pull/1761

Co-authored-by: aristorinjuang <aristorinjuang@gmail.com>
2026-07-03 00:57:06 -03:00

90 lines
3.1 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
test("CLI_TOOLS registry contains all expected tools (plan 14 — 30 total + crush + codewhale)", async () => {
const { CLI_TOOLS } = await import("../../src/shared/constants/cliTools.ts");
// windsurf and amp removed per plan 14 D17 (MITM backlog plan 11)
// New entries added: roo, jcode, deepseek-tui, smelt, pi, aider, forge,
// cursor-cli, goose, interpreter, warp, agent-deck (+ hermes-agent already existed)
// crush added — ported from upstream decolua/9router#1233
// codewhale added 2026-07-02 as a dual entry alongside deepseek-tui
// (CodeWhale is the actively-maintained successor to DeepSeek TUI).
const expected = [
"claude",
"codex",
"droid",
"openclaw",
"cursor",
"cline",
"kilo",
"continue",
"antigravity",
"copilot",
"opencode",
"hermes",
"hermes-agent",
"kiro",
"qwen",
"custom",
"aider",
"forge",
"cursor-cli",
"roo",
"jcode",
"deepseek-tui",
"codewhale",
"smelt",
"pi",
"goose",
"interpreter",
"warp",
"agent-deck",
"crush",
];
for (const id of expected) {
assert.ok(id in CLI_TOOLS, `Missing tool: ${id}`);
}
assert.equal(Object.keys(CLI_TOOLS).length, expected.length);
// Confirm removed entries are gone
assert.equal((CLI_TOOLS as Record<string, unknown>)["windsurf"], undefined);
assert.equal((CLI_TOOLS as Record<string, unknown>)["amp"], undefined);
});
test("Every tool has required fields: id, name, description, configType", async () => {
const { CLI_TOOLS } = await import("../../src/shared/constants/cliTools.ts");
for (const [key, tool] of Object.entries(CLI_TOOLS)) {
assert.equal(typeof tool.id, "string", `${key}.id must be string`);
assert.equal(tool.id, key, `${key}.id must match its registry key`);
assert.equal(typeof tool.name, "string", `${key}.name must be string`);
assert.ok(tool.name.length > 0, `${key}.name must be non-empty`);
assert.equal(typeof tool.description, "string", `${key}.description must be string`);
assert.equal(typeof tool.configType, "string", `${key}.configType must be string`);
}
});
test("listCliTools returns all tools as an array", async () => {
const { listCliTools, CLI_TOOLS } = await import("../../src/shared/constants/cliTools.ts");
const tools = listCliTools();
assert.ok(Array.isArray(tools));
assert.equal(tools.length, Object.keys(CLI_TOOLS).length);
for (const tool of tools) {
assert.equal(typeof tool.id, "string");
}
});
test("getCliTool returns correct tool by id", async () => {
const { getCliTool } = await import("../../src/shared/constants/cliTools.ts");
const claude = getCliTool("claude");
assert.ok(claude);
assert.equal(claude.id, "claude");
assert.equal(claude.name, "Claude Code");
const missing = getCliTool("nonexistent");
assert.equal(missing, undefined);
});
test("CLI tools registry does not export provider model mapping helper", async () => {
const registry = await import("../../src/shared/constants/cliTools.ts");
assert.equal("getProviderModelsForMapping" in registry, false);
});