Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
fix(map): report a broken config.yaml as config_parse_error, not invalid_map_path
KageBinarya5e88940e3dd
diff --git a/ix-cli/src/cli/__tests__/config-integrity.test.ts b/ix-cli/src/cli/__tests__/config-integrity.test.tsindex a6ce3cda..0f97e521 100644--- a/ix-cli/src/cli/__tests__/config-integrity.test.ts+++ b/ix-cli/src/cli/__tests__/config-integrity.test.ts@@ -93,6 +93,26 @@ describe("a config that does not parse", () => {expect(lines.join("\n")).toMatch(/not valid YAML/);});+ it("ix map, which finds its root through the config, names it too, not invalid_map_path", async () => {+ writeFileSync(configPath(), "endpoint: [unclosed\n");+ const repo = mkdtempSync(join(tmpdir(), "ix-cfg-repo-"));+ try {+ const main = join(CLI_ROOT, "src", "cli", "main.ts");+ const env: NodeJS.ProcessEnv = { ...process.env, IX_HOME: home, IX_ENDPOINT: "http://127.0.0.1:1" };+ delete env.FORCE_COLOR;+ for (const format of ["json", "llm"]) {+ const out = await execFileAsync(TSX, [main, "map", "--format", format], { cwd: repo, env })+ .then(() => { throw new Error("ix map exited 0 on a broken config"); },+ (e: { code?: number; stdout?: string }) => e);+ expect(out.code).toBe(1);+ expect(out.stdout).toMatch(/config_parse_error/);+ expect(out.stdout).not.toMatch(/invalid_map_path/);+ }+ } finally {+ rmSync(repo, { recursive: true, force: true });+ }+ }, 60_000);+it("saveConfig still refuses to overwrite it", async () => {writeFileSync(configPath(), "endpoint: [unclosed\n");const { saveConfig } = await import("../config.js");diff --git a/ix-cli/src/cli/commands/map.ts b/ix-cli/src/cli/commands/map.tsindex bd2914b6..677df6d5 100644--- a/ix-cli/src/cli/commands/map.ts+++ b/ix-cli/src/cli/commands/map.ts@@ -7,7 +7,7 @@ import { clearMapBaseline, clearMapResultCache } from "../config.js";import { roundFloat, printJson } from "../format.js";import { llmLine, llmError, llmShortId } from "../llm.js";import { bootstrap, resolveWorkspaceId } from "../bootstrap.js";-import { formatFetchError } from "../errors.js";+import { configParseError, formatFetchError, renderStructuredError } from "../errors.js";import { ingestFiles, type IngestFilesSummary } from "./ingest.js";import { detectSystem } from "../system.js";import { getRemoteRunner, isCloudReady } from "../remote.js";@@ -827,6 +827,16 @@ async function runMapCommand(pathArg: string | undefined, opts: { format: stringtry {cwd = resolveMapRoot(pathArg);} catch (err: any) {+ // Finding the root reads config.yaml. A config that does not parse is not a+ // bad path: say what it is, as every other command does.+ if (err?.name === "ConfigParseError") {+ const broken = configParseError(err.path, err.detail);+ if (opts.format === "json") printJson(broken);+ else if (opts.format === "llm") console.log(llmError(broken.error, broken.message, [["hint", broken.next ?? ""]]));+ else renderStructuredError(broken);+ process.exitCode = 1;+ return;+ }const message = err?.message ?? "Invalid map path";if (opts.format === "json") {printJson({ error: "invalid_map_path", message });