Skip to content

armgit / Ix

Public Imported from GitHub
0

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

feat: final polish for ix overview — breadcrumb completion and formatting

Tanner Kocher34b4c6e97958
diff --git a/ix-cli/src/cli/__tests__/overview-structure.test.ts b/ix-cli/src/cli/__tests__/overview-structure.test.ts
index ff4dee6f..e7bd584f 100644
--- a/ix-cli/src/cli/__tests__/overview-structure.test.ts
+++ b/ix-cli/src/cli/__tests__/overview-structure.test.ts
@@ -296,6 +296,44 @@ describe("overview: leaf target in class", () => {
});
});
+// ── Container breadcrumb completion ──────────────────────────────────────────
+
+describe("overview: container breadcrumb completion", () => {
+ it("class target system path ends with the class name", () => {
+ const output = makeClassOutput();
+ const last = output.systemPath[output.systemPath.length - 1];
+ expect(last.name).toBe("IxClient");
+ expect(last.kind).toBe("class");
+ });
+
+ it("file target system path ends at the file, no extra segment", () => {
+ const output = makeFileOutput();
+ const last = output.systemPath[output.systemPath.length - 1];
+ expect(last.name).toBe("Node.scala");
+ expect(last.kind).toBe("file");
+ });
+
+ it("region target system path ends at the region", () => {
+ const output = makeRegionOutput();
+ const last = output.systemPath[output.systemPath.length - 1];
+ expect(last.kind).toBe("subsystem");
+ });
+
+ it("interface container appends symbol to breadcrumb", () => {
+ const output = {
+ resolvedTarget: { id: "if-1", kind: "interface", name: "NodeKind" },
+ systemPath: [
+ { name: "API", kind: "system" },
+ { name: "Model / Db", kind: "subsystem" },
+ { name: "Node.scala", kind: "file" },
+ { name: "NodeKind", kind: "interface" },
+ ],
+ };
+ const last = output.systemPath[output.systemPath.length - 1];
+ expect(last.name).toBe("NodeKind");
+ });
+});
+
// ── Humanized system path ───────────────────────────────────────────────────
describe("overview: humanized system path labels", () => {
diff --git a/ix-cli/src/cli/commands/overview.ts b/ix-cli/src/cli/commands/overview.ts
index f09d3337..f364df9e 100644
--- a/ix-cli/src/cli/commands/overview.ts
+++ b/ix-cli/src/cli/commands/overview.ts
@@ -170,7 +170,14 @@ async function overviewContainer(
diagnostics.push("No system map. Run `ix map` to see hierarchy.");
}
- const systemPathMapped = systemPath.map((n) => ({ name: n.name, kind: n.kind }));
+ // Append container symbol to system path for non-file, non-region containers
+ let systemPathMapped = systemPath.map((n) => ({ name: n.name, kind: n.kind }));
+ if (!FILE_KINDS.has(target.kind) && !isRegion) {
+ const lastInPath = systemPathMapped[systemPathMapped.length - 1];
+ if (!lastInPath || lastInPath.name !== target.name) {
+ systemPathMapped = [...systemPathMapped, { name: target.name, kind: target.kind }];
+ }
+ }
const result: OverviewResult = {
resolvedTarget: { id: target.id, kind: target.kind, name: target.name },
@@ -197,7 +204,7 @@ async function overviewContainer(
console.log(chalk.bold("\nContains"));
const sorted = Object.entries(childrenByKind).sort((a, b) => b[1] - a[1]);
for (const [kind, count] of sorted) {
- console.log(` ${chalk.dim(kindLabel(kind).padEnd(16))}${count}`);
+ console.log(` ${chalk.dim((kindLabel(kind) + ":").padEnd(22))}${count}`);
}
}
@@ -327,7 +334,7 @@ async function overviewLeaf(
console.log(chalk.bold("\nNearby structure"));
const sorted = Object.entries(siblingsByKind).sort((a, b) => b[1] - a[1]);
for (const [kind, count] of sorted) {
- console.log(` ${chalk.dim(siblingKindLabel(kind).padEnd(24))}${count}`);
+ console.log(` ${chalk.dim((siblingKindLabel(kind) + ":").padEnd(24))}${count}`);
}
}