Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

fix(cli): emit crosscut in map --format llm (parity with json) (#236)

Joseph Mikhailb378e9e7b56a
diff --git a/ix-cli/src/cli/__tests__/llm-renderers.test.ts b/ix-cli/src/cli/__tests__/llm-renderers.test.ts
index ce538b9e..46a4d957 100644
--- a/ix-cli/src/cli/__tests__/llm-renderers.test.ts
+++ b/ix-cli/src/cli/__tests__/llm-renderers.test.ts
@@ -54,6 +54,15 @@ describe("renderMapLlm", () => {
expect(lines[1]).not.toContain("children=");
expect(lines[1]).not.toContain("signals=");
expect(lines[1]).not.toContain("parent=");
+ expect(lines[1]).not.toContain("crosscut=");
+ });
+
+ it("emits crosscut only when above the 0.01 threshold (parity with json)", () => {
+ const result: MapResult = { file_count: 1, region_count: 1, levels: 1, map_rev: 1, regions: [], hierarchy: [] };
+ const cross = captureLog(() => renderMapLlm(result, [region({ id: "x", label: "X", crosscut_score: 0.153 })]));
+ expect(cross[1]).toContain("crosscut=0.15");
+ const noCross = captureLog(() => renderMapLlm(result, [region({ id: "y", label: "Y", crosscut_score: 0.005 })]));
+ expect(noCross[1]).not.toContain("crosscut=");
});
});
diff --git a/ix-cli/src/cli/commands/map.ts b/ix-cli/src/cli/commands/map.ts
index 97476d1a..9172dfff 100644
--- a/ix-cli/src/cli/commands/map.ts
+++ b/ix-cli/src/cli/commands/map.ts
@@ -297,6 +297,9 @@ export function renderMapLlm(result: MapResult, regions: MapRegion[]): void {
["children", r.child_region_count > 0 ? r.child_region_count : undefined],
["cohesion", roundFloat(r.cohesion)],
["coupling", roundFloat(r.external_coupling)],
+ // crosscut_score is emitted only when meaningful (>0.01), matching the
+ // compact JSON; consumers (e.g. the ix-architecture skill) gate on it.
+ ["crosscut", r.crosscut_score > 0.01 ? roundFloat(r.crosscut_score) : undefined],
["confidence", roundFloat(r.confidence)],
["signals", r.dominant_signals.length > 0 ? r.dominant_signals.join(",") : undefined],
]));