feat(cli-tools): add settings handlers for new "custom" configType tools (plan 14 F3)

Adds 5 new settings route handlers for CLIs introduced by plan 14 that
declare configType:"custom" and need automated config file persistence:
forge (~/.forge/config.toml), jcode (~/.jcode/config.json),
deepseek-tui (~/.config/deepseek-tui/config.toml),
smelt (~/.smelt/config.json), pi (~/.pi/config.json).

Also registers the 5 tools in cliRuntime.ts path table so
getCliPrimaryConfigPath() resolves their config paths correctly.

Each handler follows the established pattern: requireCliToolsAuth guard on
every exported method, Zod body validation on POST, buildErrorBody/
sanitizeErrorMessage on all error paths (Hard Rule #12), fs/promises only
(no exec/spawn — Hard Rule #13), saveCliToolLastConfigured on success.

Integration tests: 7 subtests per handler (401 without auth, 200 GET,
400 missing-baseUrl, 400 missing-model, 200 POST writes file, 200 DELETE,
error sanitization + no exec/spawn static audit).
This commit is contained in:
diegosouzapw
2026-05-27 22:13:59 -03:00
parent 193bf1a766
commit 3a711d1c0d
11 changed files with 2125 additions and 0 deletions

View File

@@ -188,6 +188,52 @@ const CLI_TOOLS: Record<string, any> = {
settings: ".gemini/settings.json",
},
},
// ── Plan 14 — new "custom" configType tools ───────────────────────────────
forge: {
defaultCommand: "forge",
envBinKey: "CLI_FORGE_BIN",
requiresBinary: true,
healthcheckTimeoutMs: 8000,
paths: {
config: ".forge/config.toml",
},
},
jcode: {
defaultCommand: "jcode",
envBinKey: "CLI_JCODE_BIN",
requiresBinary: true,
healthcheckTimeoutMs: 8000,
paths: {
config: ".jcode/config.json",
},
},
"deepseek-tui": {
defaultCommand: "deepseek-tui",
envBinKey: "CLI_DEEPSEEK_TUI_BIN",
requiresBinary: true,
healthcheckTimeoutMs: 8000,
paths: {
config: ".config/deepseek-tui/config.toml",
},
},
smelt: {
defaultCommand: "smelt",
envBinKey: "CLI_SMELT_BIN",
requiresBinary: true,
healthcheckTimeoutMs: 8000,
paths: {
config: ".smelt/config.json",
},
},
pi: {
defaultCommand: "pi",
envBinKey: "CLI_PI_BIN",
requiresBinary: true,
healthcheckTimeoutMs: 8000,
paths: {
config: ".pi/config.json",
},
},
};
const isWindows = () => process.platform === "win32";