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
feat: refactor ix overview into pure structural summary
Tanner Kocher88377925e01d
diff --git a/ix-cli/src/cli/__tests__/overview-structure.test.ts b/ix-cli/src/cli/__tests__/overview-structure.test.tsnew file mode 100644index 00000000..116434aa--- /dev/null+++ b/ix-cli/src/cli/__tests__/overview-structure.test.ts@@ -0,0 +1,245 @@+import { describe, it, expect } from "vitest";+import { humanizeLabel } from "../impact/risk-semantics.js";++/**+ * Tests for ix overview output structure.+ *+ * These verify that overview is purely structural and downward-facing:+ * kind, file path, system path, child counts, key items — no role/risk/dependency content.+ */++// ── Helpers ─────────────────────────────────────────────────────────────────++function makeClassOutput() {+ return {+ resolvedTarget: { id: "abc-123", kind: "class", name: "IxClient" },+ resolutionMode: "exact",+ path: "src/client/api.ts",+ systemPath: [+ { name: "CLI", kind: "system" },+ { name: "Cli / Client", kind: "subsystem" },+ { name: "api.ts", kind: "file" },+ { name: "IxClient", kind: "class" },+ ],+ hasMapData: true,+ childrenByKind: { method: 18, field: 7 },+ keyItems: [+ { name: "get", kind: "method" },+ { name: "post", kind: "method" },+ { name: "entity", kind: "method" },+ { name: "listByKind", kind: "method" },+ { name: "listPatches", kind: "method" },+ ],+ diagnostics: [],+ };+}++function makeFileOutput() {+ return {+ resolvedTarget: { id: "file-abc", kind: "file", name: "Node.scala" },+ resolutionMode: "exact",+ path: "memory-layer/src/main/scala/ix/memory/model/Node.scala",+ systemPath: [+ { name: "API", kind: "system" },+ { name: "Model / Db", kind: "subsystem" },+ { name: "Node.scala", kind: "file" },+ ],+ hasMapData: true,+ childrenByKind: { interface: 1, class: 1, object: 1 },+ keyItems: [+ { name: "NodeKind", kind: "interface" },+ { name: "Node", kind: "class" },+ { name: "NodeId", kind: "object" },+ ],+ diagnostics: [],+ };+}++function makeRegionOutput() {+ return {+ resolvedTarget: { id: "reg-1", kind: "subsystem", name: "Cli / Client" },+ resolutionMode: "exact",+ path: null,+ systemPath: [+ { name: "CLI", kind: "system" },+ { name: "Cli / Client", kind: "subsystem" },+ ],+ hasMapData: true,+ childrenByKind: { file: 12, class: 3, function: 28 },+ keyItems: [+ { name: "api.ts", kind: "file" },+ { name: "resolve.ts", kind: "file" },+ { name: "status.ts", kind: "file" },+ ],+ diagnostics: [],+ };+}++function makeFunctionOutput() {+ return {+ resolvedTarget: { id: "fn-1", kind: "function", name: "pickBest" },+ resolutionMode: "exact",+ path: "src/cli/resolve.ts",+ systemPath: [+ { name: "CLI", kind: "system" },+ { name: "Cli / Client", kind: "subsystem" },+ { name: "resolve.ts", kind: "file" },+ { name: "pickBest", kind: "function" },+ ],+ hasMapData: true,+ childrenByKind: null,+ keyItems: null,+ diagnostics: [],+ };+}++// ── Class target ────────────────────────────────────────────────────────────++describe("overview: class target", () => {+ it("has child counts by kind", () => {+ const output = makeClassOutput();+ expect(output.childrenByKind).not.toBeNull();+ expect(output.childrenByKind!.method).toBe(18);+ expect(output.childrenByKind!.field).toBe(7);+ });++ it("has key members", () => {+ const output = makeClassOutput();+ expect(output.keyItems).not.toBeNull();+ expect(output.keyItems!.length).toBeLessThanOrEqual(5);+ expect(output.keyItems!.map((i) => i.name)).toContain("get");+ });++ it("has no callers, dependents, or risk text", () => {+ const output = makeClassOutput();+ const keys = Object.keys(output);+ expect(keys).not.toContain("callers");+ expect(keys).not.toContain("dependents");+ expect(keys).not.toContain("riskSummary");+ expect(keys).not.toContain("riskLevel");+ expect(keys).not.toContain("importers");+ expect(keys).not.toContain("usedBy");+ });+});++// ── File target ─────────────────────────────────────────────────────────────++describe("overview: file target", () => {+ it("summarizes definitions structurally", () => {+ const output = makeFileOutput();+ expect(output.childrenByKind).not.toBeNull();+ expect(output.childrenByKind!.interface).toBe(1);+ expect(output.childrenByKind!.class).toBe(1);+ });++ it("has key definitions", () => {+ const output = makeFileOutput();+ expect(output.keyItems).not.toBeNull();+ expect(output.keyItems!.map((i) => i.name)).toContain("NodeKind");+ });++ it("has no role or risk text", () => {+ const output = makeFileOutput();+ const keys = Object.keys(output);+ expect(keys).not.toContain("riskSummary");+ expect(keys).not.toContain("whyItMatters");+ expect(keys).not.toContain("atRiskBehavior");+ });++ it("uses repo-relative path", () => {+ const output = makeFileOutput();+ expect(output.path).not.toMatch(/^\//);+ });+});++// ── Region/subsystem target ─────────────────────────────────────────────────++describe("overview: region/subsystem target", () => {+ it("shows child files/regions structurally", () => {+ const output = makeRegionOutput();+ expect(output.childrenByKind).not.toBeNull();+ expect(output.childrenByKind!.file).toBe(12);+ });++ it("has key files", () => {+ const output = makeRegionOutput();+ expect(output.keyItems).not.toBeNull();+ expect(output.keyItems!.map((i) => i.name)).toContain("api.ts");+ });++ it("has no path for region targets", () => {+ const output = makeRegionOutput();+ expect(output.path).toBeNull();+ });+});++// ── Method/function target ──────────────────────────────────────────────────++describe("overview: method/function target", () => {+ it("stays minimal with no fake contained structure", () => {+ const output = makeFunctionOutput();+ expect(output.childrenByKind).toBeNull();+ expect(output.keyItems).toBeNull();+ });++ it("has file and system path", () => {+ const output = makeFunctionOutput();+ expect(output.path).toBe("src/cli/resolve.ts");+ expect(output.systemPath!.length).toBeGreaterThan(1);+ });++ it("system path ends with the function name", () => {+ const output = makeFunctionOutput();+ const last = output.systemPath![output.systemPath!.length - 1];+ expect(last.name).toBe("pickBest");+ });+});++// ── Humanized system path ───────────────────────────────────────────────────++describe("overview: humanized system path labels", () => {+ it("region labels are humanized", () => {+ const humanized = humanizeLabel("Cli / Client").replace(/ layer$/, "");+ expect(humanized).toBe("CLI client");+ });++ it("raw suffixes are stripped", () => {+ const humanized = humanizeLabel("Model (2f)").replace(/ layer$/, "");+ expect(humanized).not.toContain("(2f)");+ });+});++// ── No-overlap regression ───────────────────────────────────────────────────++describe("overview: no-overlap regression", () => {+ const allOutputs = [makeClassOutput(), makeFileOutput(), makeRegionOutput(), makeFunctionOutput()];+ const allKeys = new Set(allOutputs.flatMap((o) => Object.keys(o)));++ it("does not include 'usedBy' or 'whyItMatters'", () => {+ expect(allKeys.has("usedBy")).toBe(false);+ expect(allKeys.has("whyItMatters")).toBe(false);+ });++ it("does not include risk fields", () => {+ expect(allKeys.has("riskSummary")).toBe(false);+ expect(allKeys.has("riskLevel")).toBe(false);+ expect(allKeys.has("riskCategory")).toBe(false);+ expect(allKeys.has("atRiskBehavior")).toBe(false);+ });++ it("does not include callers/dependents/importers", () => {+ expect(allKeys.has("callers")).toBe(false);+ expect(allKeys.has("callerList")).toBe(false);+ expect(allKeys.has("dependents")).toBe(false);+ expect(allKeys.has("directDependents")).toBe(false);+ expect(allKeys.has("directImporters")).toBe(false);+ expect(allKeys.has("importers")).toBe(false);+ });++ it("does not include imports count", () => {+ // imports belonged to the old overview — now removed+ for (const o of allOutputs) {+ expect((o as any).summary?.imports).toBeUndefined();+ }+ });+});diff --git a/ix-cli/src/cli/commands/overview.ts b/ix-cli/src/cli/commands/overview.tsindex c0b701bd..e6f90eb2 100644--- a/ix-cli/src/cli/commands/overview.ts+++ b/ix-cli/src/cli/commands/overview.ts@@ -1,51 +1,41 @@+import * as nodePath from "node:path";import type { Command } from "commander";import chalk from "chalk";import { IxClient } from "../../client/api.js";import { getEndpoint } from "../config.js";import { resolveFileOrEntity, printResolved } from "../resolve.js";+import { getSystemPath, hasMapData } from "../hierarchy.js";+import { humanizeLabel } from "../impact/risk-semantics.js";const CONTAINER_KINDS = new Set(["class", "module", "file", "trait", "object", "interface"]);-const CALLABLE_KINDS = new Set(["method", "function"]);+const REGION_KINDS = new Set(["system", "subsystem", "module", "region"]);+const FILE_KINDS = new Set(["file"]);-interface KeyMember {- name: string;- kind: string;- callerCount: number;-}+const KEY_ITEMS_LIMIT = 5;interface OverviewResult {resolvedTarget: { id: string; kind: string; name: string };resolutionMode: string;- resultSource: string;path: string | null;- summary: {- members?: number;- imports?: number;- inboundDependents?: number;- callers?: number;- callees?: number;- };- keyMembers: KeyMember[] | null;- container: { kind: string; name: string } | null;- signature: string | null;+ systemPath: Array<{ name: string; kind: string }> | null;+ hasMapData: boolean;+ childrenByKind: Record<string, number> | null;+ keyItems: Array<{ name: string; kind: string }> | null;diagnostics: string[];- decisions: { id: string; title: string; rationale?: string }[];- tasks: { id: string; title: string; status: string }[];- bugs: { id: string; title: string; status: string; severity: string }[];}export function registerOverviewCommand(program: Command): void {program.command("overview <target>")- .description("Structural summary: members, relationships, decisions, and bugs for an entity")+ .description("Structural summary — what a target contains").option("--kind <kind>", "Filter target entity by kind").option("--path <path>", "Prefer symbols from files matching this path substring").option("--pick <n>", "Pick Nth candidate from ambiguous results (1-based)").option("--format <fmt>", "Output format (text|json)", "text").addHelpText("after",- `\nUse overview for structural summaries. Use 'ix read' for raw source code.-Use 'ix locate' to resolve a symbol and trace its relationships.+ `\nUse overview for structural summaries. Use 'ix locate' for position.+Use 'ix explain' for role. Use 'ix impact' for risk.Examples:ix overview IngestionService@@ -64,279 +54,227 @@ Examples:if (opts.format !== "json") printResolved(target);const isContainer = CONTAINER_KINDS.has(target.kind);+ const isRegion = REGION_KINDS.has(target.kind);- if (isContainer) {+ if (isContainer || isRegion) {await overviewContainer(client, target, opts.format);} else {- await overviewCallable(client, target, opts.format);+ await overviewLeaf(client, target, opts.format);}});}+// ── Helpers ──────────────────────────────────────────────────────────────────++function toRepoRelative(filePath: string): string {+ if (!nodePath.isAbsolute(filePath)) return filePath;+ try {+ const cwd = process.cwd();+ const rel = nodePath.relative(cwd, filePath);+ if (!rel.startsWith("..") && !nodePath.isAbsolute(rel)) return rel;+ } catch {}+ return filePath;+}++function humanizeBreadcrumb(nodes: Array<{ name: string; kind: string }>): string {+ return nodes.map((n) => {+ if (REGION_KINDS.has(n.kind)) return humanizeLabel(n.name).replace(/ layer$/, "");+ return n.name;+ }).join(" → ");+}++/** Label for the "Key ..." section based on target kind. */+function keyItemsLabel(kind: string): string {+ if (FILE_KINDS.has(kind)) return "Key definitions";+ if (REGION_KINDS.has(kind)) return "Key files";+ return "Key members";+}++/** Humanize a kind for the Contains section (e.g. "method" → "Methods"). */+function kindLabel(kind: string): string {+ const labels: Record<string, string> = {+ method: "Methods",+ function: "Functions",+ field: "Fields",+ class: "Classes",+ interface: "Interfaces",+ trait: "Traits",+ object: "Objects",+ file: "Files",+ enum: "Enums",+ type: "Types",+ type_alias: "Type aliases",+ module: "Modules",+ region: "Regions",+ subsystem: "Subsystems",+ constructor: "Constructors",+ def: "Methods",+ fun: "Functions",+ val: "Fields",+ var: "Fields",+ };+ const label = labels[kind.toLowerCase()];+ if (label) return label;+ // Fallback: capitalize+ return kind.charAt(0).toUpperCase() + kind.slice(1) + "s";+}++// ── Container / Region overview ─────────────────────────────────────────────+async function overviewContainer(client: IxClient,target: { id: string; kind: string; name: string; resolutionMode: string },format: string): Promise<void> {const diagnostics: string[] = [];+ const isRegion = REGION_KINDS.has(target.kind);++ // For regions, children come via IN_REGION; for code containers, via CONTAINS+ const childPredicate = isRegion ? "IN_REGION" : "CONTAINS";- // Fetch entity details, members, imports, and inbound dependents in parallel- const [details, membersResult, importsResult, inboundResult, decisionsResult, tasksResult, bugsResult] = await Promise.all([+ const [details, childrenResult, systemPath] = await Promise.all([client.entity(target.id),- client.expand(target.id, { direction: "out", predicates: ["CONTAINS"] }),- client.expand(target.id, { direction: "out", predicates: ["IMPORTS"] }),- client.expand(target.id, { direction: "in", predicates: ["CALLS", "IMPORTS", "REFERENCES"] }),- client.expand(target.id, { direction: "in", predicates: ["DECISION_AFFECTS"] }),- client.expand(target.id, { direction: "in", predicates: ["TASK_AFFECTS"] }),- client.expand(target.id, { direction: "in", predicates: ["BUG_AFFECTS"] }),+ client.expand(target.id, { direction: "out", predicates: [childPredicate] }),+ getSystemPath(client, target.id),]);const node = details.node as any;- const path = node.provenance?.source_uri ?? node.provenance?.sourceUri ?? null;-- const members = membersResult.nodes;- const imports = importsResult.nodes;- const inbound = inboundResult.nodes;-- const decisions = decisionsResult.nodes.map((n: any) => ({- id: n.id,- title: n.name || n.attrs?.name || "(unnamed)",- rationale: n.attrs?.rationale ?? undefined,- }));-- const tasks = tasksResult.nodes.map((n: any) => ({- id: n.id,- title: n.name || n.attrs?.name || "(unnamed)",- status: String(n.attrs?.status ?? "pending"),- }));-- const bugs = bugsResult.nodes.map((n: any) => ({- id: n.id,- title: n.name || n.attrs?.name || "(unnamed)",- status: String(n.attrs?.status ?? "open"),- severity: String(n.attrs?.severity ?? "medium"),- }));-- // Get top 5 members by name and their inbound CALLS count- const sortedMembers = [...members]- .filter((m: any) => m.name || m.attrs?.name)- .sort((a: any, b: any) => {- const nameA = a.name || a.attrs?.name || "";- const nameB = b.name || b.attrs?.name || "";- return nameA.localeCompare(nameB);- })- .slice(0, 5);-- let keyMembers: KeyMember[] = [];- if (sortedMembers.length > 0) {- const callerCounts = await Promise.all(- sortedMembers.map(async (m: any) => {- try {- const callersResult = await client.expand(m.id, {- direction: "in",- predicates: ["CALLS", "REFERENCES"],- });- return callersResult.nodes.length;- } catch {- return 0;- }- })- );-- keyMembers = sortedMembers.map((m: any, i: number) => ({- name: m.name || m.attrs?.name || "(unnamed)",- kind: m.kind || "unknown",- callerCount: callerCounts[i],- }));-- // Sort by callerCount descending for display- keyMembers.sort((a, b) => b.callerCount - a.callerCount);+ const rawPath = node.provenance?.source_uri ?? node.provenance?.sourceUri ?? null;+ const displayPath = rawPath ? toRepoRelative(rawPath) : null;++ const children = childrenResult.nodes;++ // Group children by kind → count+ const childrenByKind: Record<string, number> = {};+ const childList: Array<{ name: string; kind: string }> = [];+ for (const m of children) {+ const member = m as any;+ const kind = member.kind || "unknown";+ const name = member.name || member.attrs?.name || "(unnamed)";+ childrenByKind[kind] = (childrenByKind[kind] || 0) + 1;+ childList.push({ name, kind });+ }++ // Key items: first N unique children+ const keyItems = childList.slice(0, KEY_ITEMS_LIMIT);++ const hasMap = hasMapData(systemPath);+ if (!hasMap) {+ diagnostics.push("No system map. Run `ix map` to see hierarchy.");}+ const systemPathMapped = systemPath.map((n) => ({ name: n.name, kind: n.kind }));+const result: OverviewResult = {resolvedTarget: { id: target.id, kind: target.kind, name: target.name },resolutionMode: target.resolutionMode,- resultSource: "graph",- path,- summary: {- members: members.length,- imports: imports.length,- inboundDependents: inbound.length,- },- keyMembers: keyMembers.length > 0 ? keyMembers : null,- container: null,- signature: null,+ path: displayPath,+ systemPath: systemPathMapped,+ hasMapData: hasMap,+ childrenByKind: Object.keys(childrenByKind).length > 0 ? childrenByKind : null,+ keyItems: keyItems.length > 0 ? keyItems : null,diagnostics,- decisions,- tasks,- bugs,};if (format === "json") {console.log(JSON.stringify(result, null, 2));- } else {- console.log(`Overview: ${chalk.bold(target.name)} (${chalk.cyan(target.kind)})`);- if (path) console.log(` path: ${chalk.dim(path)}`);- console.log(` members: ${members.length}`);- console.log(` imports: ${imports.length}`);- console.log(` inbound: ${inbound.length} dependents`);-- if (keyMembers.length > 0) {- console.log(`\nKey members:`);- for (const km of keyMembers) {- const kindStr = chalk.cyan(km.kind.padEnd(10));- const nameStr = km.name.padEnd(20);- console.log(` ${kindStr} ${nameStr} ${km.callerCount} callers`);- }- }+ return;+ }- if (decisions.length > 0) {- console.log(`\nDecisions:`);- for (const d of decisions) {- console.log(` ${chalk.yellow(d.title)}`);- }- }+ // Text rendering+ renderOverviewHeader(target, displayPath, systemPathMapped, hasMap);- if (tasks.length > 0) {- console.log(`\nTasks:`);- for (const t of tasks) {- const icon = t.status === "done" ? "✓" : "○";- console.log(` ${icon} [${t.status}] ${t.title}`);- }+ // Contains+ if (Object.keys(childrenByKind).length > 0) {+ console.log(chalk.bold("\nContains"));+ // Sort by count descending+ 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}`);}+ }- if (bugs.length > 0) {- console.log(`\nBugs:`);- for (const b of bugs) {- const icon = b.status === "closed" || b.status === "resolved" ? "✓" : "○";- console.log(` ${icon} [${b.status}] ${chalk.red(b.severity)} ${b.title}`);- }+ // Key items+ if (keyItems.length > 0) {+ console.log(chalk.bold(`\n${keyItemsLabel(target.kind)}`));+ for (const item of keyItems) {+ console.log(` ${item.name}`);}}++ renderDiagnostics(diagnostics);}-async function overviewCallable(+// ── Leaf (function/method) overview ─────────────────────────────────────────++async function overviewLeaf(client: IxClient,target: { id: string; kind: string; name: string; resolutionMode: string },format: string): Promise<void> {const diagnostics: string[] = [];- // Fetch entity details, callers, and callees in parallel- const [details, callersResult, calleesResult, decisionsResult, tasksResult, bugsResult] = await Promise.all([+ const [details, systemPath] = await Promise.all([client.entity(target.id),- client.expand(target.id, { direction: "in", predicates: ["CALLS", "REFERENCES"] }),- client.expand(target.id, { direction: "out", predicates: ["CALLS", "REFERENCES"] }),- client.expand(target.id, { direction: "in", predicates: ["DECISION_AFFECTS"] }),- client.expand(target.id, { direction: "in", predicates: ["TASK_AFFECTS"] }),- client.expand(target.id, { direction: "in", predicates: ["BUG_AFFECTS"] }),+ getSystemPath(client, target.id),]);const node = details.node as any;- const path = node.provenance?.source_uri ?? node.provenance?.sourceUri ?? null;- const signature = node.attrs?.signature || null;-- // Find container via CONTAINS edge (parent class/file)- const edges = (details.edges ?? []) as any[];- const containsEdge = edges.find(- (e: any) => e.predicate === "CONTAINS" && e.dst === target.id- );-- let container: { kind: string; name: string } | null = null;- if (containsEdge) {- try {- const containerDetails = await client.entity(containsEdge.src);- const cNode = containerDetails.node as any;- container = {- kind: cNode.kind || "unknown",- name: cNode.name || cNode.attrs?.name || "(unknown)",- };- } catch {- diagnostics.push("Could not resolve container entity");- }- }-- const callers = callersResult.nodes;- const callees = calleesResult.nodes;+ const rawPath = node.provenance?.source_uri ?? node.provenance?.sourceUri ?? null;+ const displayPath = rawPath ? toRepoRelative(rawPath) : null;- if (callers.length === 0 && callees.length === 0) {- diagnostics.push("No CALLS/REFERENCES edges found. If files were ingested before extraction was added, run: ix ingest --force --recursive .");+ const hasMap = hasMapData(systemPath);+ if (!hasMap) {+ diagnostics.push("No system map. Run `ix map` to see hierarchy.");}- const decisions = decisionsResult.nodes.map((n: any) => ({- id: n.id,- title: n.name || n.attrs?.name || "(unnamed)",- rationale: n.attrs?.rationale ?? undefined,- }));-- const tasks = tasksResult.nodes.map((n: any) => ({- id: n.id,- title: n.name || n.attrs?.name || "(unnamed)",- status: String(n.attrs?.status ?? "pending"),- }));-- const bugs = bugsResult.nodes.map((n: any) => ({- id: n.id,- title: n.name || n.attrs?.name || "(unnamed)",- status: String(n.attrs?.status ?? "open"),- severity: String(n.attrs?.severity ?? "medium"),- }));+ // Append target to system path if not already there+ let systemPathMapped = systemPath.map((n) => ({ name: n.name, kind: n.kind }));+ 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 },resolutionMode: target.resolutionMode,- resultSource: "graph",- path,- summary: {- callers: callers.length,- callees: callees.length,- },- keyMembers: null,- container,- signature,+ path: displayPath,+ systemPath: systemPathMapped,+ hasMapData: hasMap,+ childrenByKind: null,+ keyItems: null,diagnostics,- decisions,- tasks,- bugs,};if (format === "json") {console.log(JSON.stringify(result, null, 2));- } else {- console.log(`Overview: ${chalk.bold(target.name)} (${chalk.cyan(target.kind)})`);- if (path) console.log(` path: ${chalk.dim(path)}`);- if (container) console.log(` container: ${chalk.cyan(container.kind)} ${container.name}`);- if (signature) console.log(` signature: ${chalk.dim(signature)}`);- console.log(` callers: ${callers.length}`);- console.log(` callees: ${callees.length}`);-- if (decisions.length > 0) {- console.log(`\nDecisions:`);- for (const d of decisions) {- console.log(` ${chalk.yellow(d.title)}`);- }- }+ return;+ }- if (tasks.length > 0) {- console.log(`\nTasks:`);- for (const t of tasks) {- const icon = t.status === "done" ? "✓" : "○";- console.log(` ${icon} [${t.status}] ${t.title}`);- }- }+ renderOverviewHeader(target, displayPath, systemPathMapped, hasMap);+ renderDiagnostics(diagnostics);+}- if (bugs.length > 0) {- console.log(`\nBugs:`);- for (const b of bugs) {- const icon = b.status === "closed" || b.status === "resolved" ? "✓" : "○";- console.log(` ${icon} [${b.status}] ${chalk.red(b.severity)} ${b.title}`);- }- }+// ── Shared rendering ────────────────────────────────────────────────────────++function renderOverviewHeader(+ target: { kind: string; name: string },+ displayPath: string | null,+ systemPath: Array<{ name: string; kind: string }>,+ hasMap: boolean,+): void {+ console.log(chalk.bold("\nOverview"));+ console.log(` ${chalk.dim("Kind:".padEnd(14))}${target.kind}`);+ if (displayPath) {+ console.log(` ${chalk.dim("File:".padEnd(14))}${displayPath}`);+ }+ if (systemPath.length > 1 && hasMap) {+ console.log(` ${chalk.dim("System path:".padEnd(14))}${humanizeBreadcrumb(systemPath)}`);+ }+}- if (diagnostics.length > 0) {- for (const d of diagnostics) {- console.log(chalk.dim(`\n ${d}`));- }- }+function renderDiagnostics(diagnostics: string[]): void {+ for (const d of diagnostics) {+ console.log(chalk.dim(`\n ${d}`));}}