@titan-design/code-read 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/query/contract.ts","../src/query/schemas.ts","../src/query/contract-findings.ts","../src/query/contract-hotspots.ts","../src/query/contract-nodes.ts","../src/query/contract-node-lenses.ts","../src/query/contract-overview.ts","../src/query/contract-changes.ts","../src/query/contract-paths-impact.ts","../src/query/contract-packages.ts","../src/query/model.ts","../src/query/source.ts","../src/query/snapshot-ref.ts","../src/query/changes.ts","../src/query/tree.ts","../src/query/finding-rows.ts","../src/query/hotspots.ts","../src/query/rollup.ts","../src/query/baseline.ts","../src/query/excerpt.ts","../src/query/neighbors.ts","../src/query/stats.ts","../src/query/finding-get.ts","../src/query/findings-list.ts","../src/query/hierarchy.ts","../src/query/node-lenses.ts","../src/query/node-get.ts","../src/query/overview.ts","../src/query/packages-stats.ts","../src/query/paths-impact.ts","../src/query/resolve.ts","../src/query/commands.ts","../src/query/resolver.ts"],"sourcesContent":["import { toJSONSchema, z, type ZodType } from \"zod\";\nimport { Capabilities, MetricDescriptor, RuleSummary, SnapshotInfo } from \"./schemas.js\";\nimport { FINDING_GET, FINDINGS_LIST, NODE_NEIGHBORS } from \"./contract-findings.js\";\nimport { HOTSPOTS_LIST } from \"./contract-hotspots.js\";\nimport { HIERARCHY_GET, NODE_GET, NODE_RESOLVE } from \"./contract-nodes.js\";\nimport { OVERVIEW_GET } from \"./contract-overview.js\";\nimport { CHANGES_GET } from \"./contract-changes.js\";\nimport { PATHS_IMPACT } from \"./contract-paths-impact.js\";\nimport { PACKAGES_STATS } from \"./contract-packages.js\";\n\n/** The read API's semver. Bump it whenever `CONTRACT` changes; `contract.lock.json` records the last one. */\nexport const CODE_READ_API_VERSION = \"0.1.8\";\n\nexport interface CommandContract<Args extends ZodType = ZodType, Result extends ZodType = ZodType> {\n description: string;\n args: Args;\n result: Result;\n}\n\nconst describeArgs = z.object({});\nconst describeResult = z.object({\n api: z.string(),\n dataset: z.enum([\"live\", \"static\"]),\n commands: z.array(z.string()),\n newest: SnapshotInfo.nullable(),\n indexVersions: z.array(z.string()),\n capabilities: Capabilities,\n metrics: z.array(MetricDescriptor),\n rules: z.array(RuleSummary),\n});\n\nconst snapshotListArgs = z.object({\n ref: z.string().min(1).optional(),\n limit: z.number().int().min(1).max(500).default(50),\n});\nconst snapshotListResult = z.object({ snapshots: z.array(SnapshotInfo) });\n\n// The lock sees JSON Schema only: a .refine(), .superRefine(), or .transform() here changes behaviour without a lock diff.\n/** The single source of command names, argument schemas, and result schemas for every surface. */\nexport const CONTRACT = {\n \"api.describe\": {\n description:\n \"Contract version, commands served, capabilities, the newest snapshot, and the metric and rule catalogues. Call first to pin compatibility.\",\n args: describeArgs,\n result: describeResult,\n },\n \"snapshot.list\": {\n description: \"Indexed snapshots, newest first, with ref, commit, time, and index version. Optionally one ref only.\",\n args: snapshotListArgs,\n result: snapshotListResult,\n },\n \"hierarchy.get\": HIERARCHY_GET,\n \"node.get\": NODE_GET,\n \"node.resolve\": NODE_RESOLVE,\n \"findings.list\": FINDINGS_LIST,\n \"finding.get\": FINDING_GET,\n \"node.neighbors\": NODE_NEIGHBORS,\n \"hotspots.list\": HOTSPOTS_LIST,\n \"overview.get\": OVERVIEW_GET,\n \"changes.get\": CHANGES_GET,\n \"paths.impact\": PATHS_IMPACT,\n \"packages.stats\": PACKAGES_STATS,\n} as const satisfies Record<string, CommandContract>;\n\nexport type CommandName = keyof typeof CONTRACT;\nexport type CommandArgs<N extends CommandName> = z.output<(typeof CONTRACT)[N][\"args\"]>;\nexport type CommandInput<N extends CommandName> = z.input<(typeof CONTRACT)[N][\"args\"]>;\nexport type CommandResult<N extends CommandName> = z.output<(typeof CONTRACT)[N][\"result\"]>;\n\n/** Name to input args and result: the shape a typed client (`rpc-protocol`'s `CommandMap`) needs. */\nexport type CodeReadCommandMap = { [N in CommandName]: { args: CommandInput<N>; result: CommandResult<N> } };\n\nexport const COMMAND_NAMES = Object.keys(CONTRACT).sort() as CommandName[];\n\n/** The agent-shaped commands the design puts on MCP; `hierarchy.get` is UI-shaped. A product filters with this until the registry can (P3). */\nexport const AGENT_COMMANDS: readonly CommandName[] = [\n \"api.describe\",\n \"finding.get\",\n \"findings.list\",\n \"node.get\",\n \"node.neighbors\",\n \"node.resolve\",\n];\n\nexport interface SerializedContract {\n api: string;\n commands: Record<string, { args: unknown; result: unknown }>;\n}\n\n/** Args and results as JSON Schema in a stable key order; descriptions are docs, not contract, so they are left out. */\nexport function serializeContract(): SerializedContract {\n const commands: SerializedContract[\"commands\"] = {};\n for (const name of COMMAND_NAMES) {\n const { args, result } = CONTRACT[name];\n commands[name] = { args: toJSONSchema(args, { io: \"input\" }), result: toJSONSchema(result) };\n }\n return { api: CODE_READ_API_VERSION, commands };\n}\n","import { z } from \"zod\";\n\n/** Open string: \"repo\" | \"package\" | \"directory\" | \"file\" | \"symbol\" today; consumers tolerate unknown kinds. */\nexport const NodeKind = z.string();\n\n/** Open string: \"error\" | \"warning\" | \"info\" today. */\nexport const Severity = z.string();\n\nexport const ProvenanceKind = z.enum([\"measured\", \"derived\", \"model\"]);\n\nexport const Provenance = z.object({\n kind: ProvenanceKind,\n source: z.string(),\n at: z.string().optional(),\n});\n\nexport const SnapshotInfo = z.object({\n id: z.number().int(),\n ref: z.string(),\n commit: z.string().nullable(),\n takenAt: z.string(),\n indexVersion: z.string(),\n});\n\nexport const MetricDescriptor = z.object({\n name: z.string(),\n unit: z.string().nullable(),\n appliesTo: z.array(NodeKind),\n rollup: z.enum([\"sum\", \"max\", \"mean\", \"none\"]),\n direction: z.enum([\"higher-worse\", \"lower-worse\", \"neutral\"]),\n absent: z.enum([\"zero\", \"exclude\"]),\n window: z.string().optional(),\n description: z.string(),\n provenance: Provenance,\n});\n\nexport const RuleSummary = z.object({ id: z.string(), type: z.string(), severity: Severity });\n\n/** A snapshot id, a digit string, or a ref name meaning that ref's newest snapshot. Omitted means the newest overall. */\nexport const SnapshotRef = z.union([z.number().int().positive(), z.string().min(1)]);\n\nexport const Span = z.object({ startLine: z.number().int(), endLine: z.number().int() });\n\n/** How a node is addressed everywhere in the API; consumers treat `id` as opaque and read the other fields. */\nexport const NodeRef = z.object({\n id: z.string(),\n kind: NodeKind,\n name: z.string(),\n /** The declaring file for a symbol, the directory path for a directory, \"\" for the repo. */\n path: z.string(),\n span: Span.optional(),\n});\n\n/** Open string: \"no-rollup\" | \"not-measured\" | \"not-in-snapshot\" today; why a value is null. */\nexport const MissingReason = z.string();\n\nexport const Capabilities = z.object({\n findings: z.enum([\"none\", \"check-rules\", \"store\"]),\n verdicts: z.boolean(),\n themes: z.boolean(),\n feedback: z.boolean(),\n embeddings: z.object({ model: z.string(), embedded: z.number(), symbols: z.number() }).nullable(),\n cochange: z.boolean(),\n sourceAtCommit: z.boolean(),\n excerpts: z.enum([\"any\", \"flagged\", \"none\"]),\n});\n\nexport type ProvenanceKind = z.infer<typeof ProvenanceKind>;\nexport type Provenance = z.infer<typeof Provenance>;\nexport type SnapshotInfo = z.infer<typeof SnapshotInfo>;\nexport type MetricDescriptor = z.infer<typeof MetricDescriptor>;\nexport type RuleSummary = z.infer<typeof RuleSummary>;\nexport type Capabilities = z.infer<typeof Capabilities>;\nexport type SnapshotRef = z.infer<typeof SnapshotRef>;\nexport type Span = z.infer<typeof Span>;\nexport type NodeRef = z.infer<typeof NodeRef>;\n","import { z } from \"zod\";\nimport { NodeRef, Provenance, ProvenanceKind, Severity, SnapshotRef, Span } from \"./schemas.js\";\n\n/** Most rows one `findings.list` page returns; a table pages with `offset`. */\nexport const FINDINGS_PAGE_MAX = 500;\n\n/** Most lines one excerpt carries, whatever the flagged range and context ask for. */\nexport const EXCERPT_LINE_CAP = 80;\n\nexport const FindingStatus = z.enum([\"new\", \"carryover\", \"resolved\", \"worsened\", \"improved\"]);\n\nexport const BaselineFields = {\n baselineSnapshotId: z.number().int().optional(),\n comparable: z.boolean().optional(),\n};\n\nexport const Finding = z.object({\n /** Opaque and stable across snapshots while the rule, node, and destination are unchanged. */\n id: z.string(),\n snapshotId: z.number().int(),\n rule: z.string(),\n /** Open string: \"check\" for check-rule findings today. */\n tool: z.string(),\n severity: Severity,\n node: NodeRef,\n destination: NodeRef.optional(),\n /** The first flagged line range; absent when the finding is about the whole node. */\n range: Span.optional(),\n metric: z.string().optional(),\n value: z.number().optional(),\n threshold: z.number().optional(),\n /** How far past the threshold, as a ratio where larger is worse; null when the rule has no threshold. */\n excess: z.number().nullable(),\n /** Present only when a baseline was given. */\n status: FindingStatus.optional(),\n message: z.string(),\n provenance: Provenance,\n});\n\nconst findingsListArgs = z.object({\n snapshot: SnapshotRef.optional(),\n baseline: SnapshotRef.optional(),\n scope: z.string().optional(),\n rule: z.array(z.string()).default([]),\n severity: z.array(Severity).default([]),\n tool: z.array(z.string()).default([]),\n provenance: z.array(ProvenanceKind).default([]),\n kind: z.array(z.string()).default([]),\n status: z.array(FindingStatus).default([]),\n sort: z.enum([\"severity\", \"excess\", \"value\", \"path\", \"rule\"]).default(\"severity\"),\n order: z.enum([\"asc\", \"desc\"]).default(\"desc\"),\n offset: z.number().int().min(0).default(0),\n limit: z.number().int().min(0).max(FINDINGS_PAGE_MAX).default(20),\n facets: z.boolean().default(false),\n});\n\nconst findingsListResult = z.object({\n snapshotId: z.number().int(),\n ...BaselineFields,\n rows: z.array(Finding),\n total: z.number().int(),\n /** Facet name to value to count, over every row that passed the filters; each facet's counts sum to `total`. */\n facets: z.record(z.string(), z.record(z.string(), z.number().int())).optional(),\n});\n\nexport const FINDINGS_LIST = {\n description:\n \"Findings in a snapshot, filtered, sorted, and offset-paginated, with optional facet counts. Check-rule findings are \" +\n \"derived on read (provenance 'derived'), so one disappears when its rule or threshold changes. `scope` limits to a node \" +\n \"and everything under it. With `baseline`, each row gets a status and resolved findings come back from the baseline.\",\n args: findingsListArgs,\n result: findingsListResult,\n} as const;\n\nexport const SourceExcerpt = z.object({\n path: z.string(),\n startLine: z.number().int(),\n endLine: z.number().int(),\n text: z.string(),\n /** Of the whole file at the snapshot. */\n contentHash: z.string(),\n origin: z.enum([\"commit\", \"worktree\", \"export\"]),\n highlights: z.array(Span),\n /** True when the cap cut the requested window short. */\n truncated: z.boolean(),\n});\n\nconst findingGetArgs = z.object({\n snapshot: SnapshotRef.optional(),\n id: z.string(),\n baseline: SnapshotRef.optional(),\n context_lines: z.number().int().min(0).max(20).default(5),\n});\n\nconst findingGetResult = z.object({\n snapshotId: z.number().int(),\n ...BaselineFields,\n finding: Finding,\n rule: z.object({ id: z.string(), type: z.string(), severity: Severity, text: z.string() }),\n measured: z.object({\n value: z.number().nullable(),\n threshold: z.number().nullable(),\n percentile: z.number().nullable(),\n siblingMedian: z.number().nullable(),\n baselineValue: z.number().nullable().optional(),\n }),\n why: z.string(),\n excerpt: SourceExcerpt.nullable(),\n /** Open string: why `excerpt` is null, such as \"no-source\" or \"changed-since-snapshot\". */\n excerptMissing: z.string().optional(),\n related: z.array(Finding),\n});\n\nexport const FINDING_GET = {\n description:\n \"One finding by id with its rule, the measured value in context, a source excerpt of the flagged lines plus \" +\n \"`context_lines` either side, and up to 10 related findings on the same node or on graph neighbours.\",\n args: findingGetArgs,\n result: findingGetResult,\n} as const;\n\nconst nodeNeighborsArgs = z.object({\n snapshot: SnapshotRef.optional(),\n id: z.string(),\n direction: z.enum([\"in\", \"out\", \"both\"]).default(\"both\"),\n edge_kinds: z.array(z.string()).default([]),\n metrics: z.array(z.string().min(1)).max(10).default([\"loc\", \"utilization\"]),\n offset: z.number().int().min(0).default(0),\n limit: z.number().int().min(1).max(100).default(20),\n});\n\nconst Neighbor = z.object({\n node: NodeRef,\n kind: z.string(),\n weight: z.number().nullable(),\n specifier: z.string().optional(),\n values: z.record(z.string(), z.number().nullable()),\n});\n\nconst nodeNeighborsResult = z.object({\n snapshotId: z.number().int(),\n node: NodeRef,\n inbound: z.array(Neighbor),\n outbound: z.array(Neighbor),\n /** Edges in each direction before `offset` and `limit`; zero for a direction not asked for. */\n total: z.object({ inbound: z.number().int(), outbound: z.number().int() }),\n});\n\nexport const NODE_NEIGHBORS = {\n description:\n \"Edges into and out of one stored node (file, symbol, module, or external), heaviest first, each with the neighbour's \" +\n \"metric values. Empty `edge_kinds` means every kind except 'references' unless the node is a symbol.\",\n args: nodeNeighborsArgs,\n result: nodeNeighborsResult,\n} as const;\n\nexport type Finding = z.infer<typeof Finding>;\nexport type FindingStatus = z.infer<typeof FindingStatus>;\nexport type SourceExcerpt = z.infer<typeof SourceExcerpt>;\n","import { z } from \"zod\";\nimport { BaselineFields } from \"./contract-findings.js\";\nimport { NodeRef, SnapshotRef } from \"./schemas.js\";\n\n/** Most rows one `hotspots.list` page returns; a table pages with `offset`. */\nexport const HOTSPOTS_PAGE_MAX = 500;\n\n/** A window as metric descriptors name it: \"30d\", or \"lifetime\" for all of git history. code-graph stores 30d, 90d, and 180d by default. */\nexport const ChurnWindow = z.string().regex(/^(?:[1-9]\\d*d|lifetime)$/);\n\nexport const HotspotMark = z.enum([\"new\", \"worsened\"]);\n\nexport const Hotspot = z.object({\n node: NodeRef,\n /** Commits touching the file in the window; a symbol reads its declaring file's churn. */\n churn: z.number(),\n /** File: max cognitive complexity over its functions (cyclomatic when cognitive is absent). Symbol: its own, else its file's. */\n complexity: z.number(),\n /** The age discount applied to the score, 1 for none; the symbol grain applies none. */\n recency: z.number(),\n /** File: round(churn × complexity × recency). Symbol: utilization × complexity × churn (blast radius). */\n score: z.number(),\n /** Symbol grain only. */\n utilization: z.number().optional(),\n /** Present only with a baseline; null when the node was no hotspot there. */\n baselineScore: z.number().nullable().optional(),\n /** Present only with a baseline, and only for a row that is new or scores higher than at the baseline. */\n mark: HotspotMark.optional(),\n});\n\nconst hotspotsListArgs = z.object({\n snapshot: SnapshotRef.optional(),\n baseline: SnapshotRef.optional(),\n grain: z.enum([\"file\", \"symbol\"]).default(\"file\"),\n window: ChurnWindow.default(\"30d\"),\n /** Keep rows scoring at least this; the threshold is the caller's policy. */\n cutoff: z.number().min(0).optional(),\n offset: z.number().int().min(0).default(0),\n limit: z.number().int().min(0).max(HOTSPOTS_PAGE_MAX).default(20),\n});\n\nconst hotspotsListResult = z.object({\n snapshotId: z.number().int(),\n ...BaselineFields,\n rows: z.array(Hotspot),\n /** Rows at or above the cutoff, before `offset` and `limit`. */\n total: z.number().int(),\n});\n\nexport const HOTSPOTS_LIST = {\n description:\n \"Files or symbols ranked by hotspot score, highest first, offset-paginated. File grain scores churn × complexity × \" +\n \"recency over the churn `window`; symbol grain scores blast radius, utilization × complexity × file churn. \" +\n \"Generated files and their symbols are left out. `cutoff` keeps rows scoring at least that. With `baseline`, each row gets its \" +\n \"baseline score and is marked new or worsened.\",\n args: hotspotsListArgs,\n result: hotspotsListResult,\n} as const;\n\nexport type Hotspot = z.infer<typeof Hotspot>;\nexport type HotspotMark = z.infer<typeof HotspotMark>;\n","import { z } from \"zod\";\nimport { ChurnWindow } from \"./contract-hotspots.js\";\nimport { NodeLens, NodeLenses } from \"./contract-node-lenses.js\";\nimport { MetricDescriptor, MissingReason, NodeRef, SnapshotRef } from \"./schemas.js\";\n\n/** The row cap on `hierarchy.get`; past it the result says `truncated` and the shallowest rows are kept. */\nexport const HIERARCHY_ROW_CAP = 5_000;\n\nconst MetricNames = z.array(z.string().min(1)).max(40);\n\n/** Present only with a baseline: the baseline's id, and false when its index version differs, so deltas may compare unlike measures. */\nconst BaselineFields = {\n baselineSnapshotId: z.number().int().optional(),\n comparable: z.boolean().optional(),\n};\n\nconst hierarchyArgs = z.object({\n snapshot: SnapshotRef.optional(),\n root: z.string().optional(),\n depth: z.number().int().min(1).max(8).default(2),\n metrics: MetricNames.default([\"loc\"]),\n baseline: SnapshotRef.optional(),\n include_symbols: z.boolean().default(false),\n exclude_roles: z.array(z.string()).default([]),\n});\n\nconst HierarchyRow = NodeRef.extend({\n parentId: z.string().nullable(),\n /** Relative to the requested root, which is 0. */\n depth: z.number().int(),\n /** Children in the full tree, symbols included, whatever `depth` and `include_symbols` returned. */\n childCount: z.number().int(),\n role: z.string().optional(),\n values: z.record(z.string(), z.number().nullable()),\n missing: z.record(z.string(), MissingReason).optional(),\n deltas: z.record(z.string(), z.number().nullable()).optional(),\n});\n\nconst hierarchyResult = z.object({\n snapshotId: z.number().int(),\n ...BaselineFields,\n nodes: z.array(HierarchyRow),\n truncated: z.boolean(),\n});\n\nexport const HIERARCHY_GET = {\n description:\n \"A subtree of the synthesized repo, directory, file, and symbol hierarchy as a flat list with parent ids, \" +\n \"shallowest first. Directory values roll up per the metric catalogue; a null value says why in `missing`.\",\n args: hierarchyArgs,\n result: hierarchyResult,\n} as const;\n\nconst nodeGetArgs = z.object({\n snapshot: SnapshotRef.optional(),\n id: z.string(),\n baseline: SnapshotRef.optional(),\n metrics: MetricNames.default([]),\n /** Extra readings of the node; with none the result carries no `lenses` field. */\n lenses: z.array(NodeLens).max(NodeLens.options.length).default([]),\n /** The churn window the `score` lens reads. */\n window: ChurnWindow.default(\"30d\"),\n});\n\nconst NodeMetric = z.object({\n name: z.string(),\n unit: z.string().nullable(),\n direction: MetricDescriptor.shape.direction,\n rollup: MetricDescriptor.shape.rollup,\n value: z.number().nullable(),\n missing: MissingReason.optional(),\n percentile: z.number().nullable(),\n siblingMedian: z.number().nullable(),\n siblingRank: z.number().int().nullable(),\n siblingCount: z.number().int(),\n baseline: z.number().nullable().optional(),\n delta: z.number().nullable().optional(),\n});\n\nconst nodeGetResult = z.object({\n snapshotId: z.number().int(),\n ...BaselineFields,\n node: NodeRef.extend({\n language: z.string().optional(),\n role: z.string().optional(),\n exported: z.boolean().optional(),\n signature: z.string().optional(),\n purpose: z.string().optional(),\n }),\n ancestors: z.array(NodeRef),\n childCounts: z.record(z.string(), z.number().int()),\n metrics: z.array(NodeMetric),\n /** Present only when `lenses` asked for any. */\n lenses: NodeLenses.optional(),\n});\n\nexport const NODE_GET = {\n description:\n \"One node by id (a directory id ends in '/', the repo is ''): its containing chain, child counts, and each metric \" +\n \"with direction, percentile among same-kind nodes, sibling median and rank, and a delta against an optional baseline. \" +\n \"Optional `lenses` add a file's exports, its hotspot score breakdown, its centrality rank, co-changed partners \" +\n \"(unmeasured until pairs are stored), and its linked tests.\",\n args: nodeGetArgs,\n result: nodeGetResult,\n} as const;\n\nconst nodeResolveArgs = z.object({\n snapshot: SnapshotRef.optional(),\n query: z.string().min(1).optional(),\n path: z.string().min(1).optional(),\n line: z.number().int().min(1).optional(),\n limit: z.number().int().min(1).max(50).default(10),\n});\n\nconst nodeResolveResult = z.object({\n candidates: z.array(\n z.object({\n node: NodeRef,\n score: z.number(),\n /** Open string: \"exact\" | \"span\" | \"suffix\" | \"prefix\" | \"substring\" today. */\n match: z.string(),\n }),\n ),\n});\n\nexport const NODE_RESOLVE = {\n description:\n \"Turn a loose reference into ranked candidate node ids. Pass exactly one of `query` (a path, path:line, symbol name, \" +\n \"or file#Scope.name) or `path` with an optional `line`; a line resolves to the innermost symbol whose span contains it.\",\n args: nodeResolveArgs,\n result: nodeResolveResult,\n} as const;\n","import { z } from \"zod\";\nimport { NodeRef } from \"./schemas.js\";\n\nexport const NodeLens = z.enum([\"exports\", \"score\", \"centrality\", \"coupling\", \"tests\"]);\n\n/** A declared symbol of the file; code-graph's dossier keeps the top 8 exported and the top 8 internal. */\nexport const ExportRow = z.object({\n name: z.string(),\n utilization: z.number(),\n /** The symbol's own cognitive complexity; null for a class, a type, or a re-export. */\n cognitive: z.number().nullable(),\n /** Distinct files that reference the symbol. */\n consumers: z.number().int(),\n exported: z.boolean(),\n});\n\n/** The hotspot score at the node's grain, with the factors it multiplies; the factors are absent at a score of 0. */\nexport const ScoreBreakdown = z.object({\n grain: z.enum([\"file\", \"symbol\"]),\n window: z.string(),\n score: z.number(),\n churn: z.number().optional(),\n complexity: z.number().optional(),\n recency: z.number().optional(),\n /** Symbol grain only. */\n utilization: z.number().optional(),\n /** 1 is the highest score; null at a score of 0. */\n rank: z.number().int().nullable(),\n /** Nodes of the grain with a non-zero score. */\n ranked: z.number().int(),\n});\n\n/** PageRank over files and structural edges, as the reading order ranks them; null for generated code, which it leaves out. */\nexport const Centrality = z.object({\n score: z.number().nullable(),\n rank: z.number().int().nullable(),\n /** Files in the reading order; every one of them has a rank. */\n of: z.number().int(),\n});\n\nexport const CoupledPartners = z.object({\n /** False until co-change pairs are stored in the index; `partners` is then empty. */\n measured: z.boolean(),\n partners: z.array(z.object({ node: NodeRef, count: z.number().int() })),\n});\n\nexport const LinkedTests = z.object({\n /** Test files linked by path convention, such as `a.test.ts` beside `a.ts`. */\n tests: z.array(NodeRef),\n /** The indexer's `linked_test_count`, which also counts tests linked by co-editing; null when the index holds no such metric. */\n indexedCount: z.number().int().nullable(),\n /** False until co-change pairs are stored, so `tests` holds path-linked tests only. */\n coEditMeasured: z.boolean(),\n});\n\n/** Each requested lens; null when it does not describe the node's kind. Only `score` describes symbols; none describes directories. */\nexport const NodeLenses = z.object({\n exports: z.array(ExportRow).nullable().optional(),\n score: ScoreBreakdown.nullable().optional(),\n centrality: Centrality.nullable().optional(),\n coupling: CoupledPartners.nullable().optional(),\n tests: LinkedTests.nullable().optional(),\n});\n\nexport type NodeLens = z.infer<typeof NodeLens>;\nexport type NodeLenses = z.infer<typeof NodeLenses>;\n","import { DEFAULT_HEALTH_WEIGHTS, type PenaltyWeight } from \"@titan-design/code-graph/analysis\";\nimport { z } from \"zod\";\nimport { BaselineFields } from \"./contract-findings.js\";\nimport { ChurnWindow } from \"./contract-hotspots.js\";\nimport { NodeRef, SnapshotRef } from \"./schemas.js\";\n\n/** Most rows the reading order or the look-first list returns. */\nexport const OVERVIEW_ROWS_MAX = 50;\n\nexport const AttentionSignalKey = z.enum([\"hotspots\", \"findings\", \"complexity\", \"hidden-coupling\"]);\n\n/** One named signal of where attention is due, with the points the caller's weights give it. */\nexport const AttentionSignal = z.object({\n key: AttentionSignalKey,\n label: z.string(),\n penalty: z.number(),\n cap: z.number(),\n /** False when the index does not hold the signal's input yet; its penalty is then 0. */\n measured: z.boolean(),\n detail: z.string(),\n});\n\nexport const LookFirstReason = z.enum([\"over-cutoff\", \"findings\", \"churn-complexity\"]);\n\nexport const LookFirstRow = z.object({\n node: NodeRef,\n score: z.number(),\n churn: z.number(),\n complexity: z.number(),\n recency: z.number(),\n /** Why the row is here; `churn-complexity` only when no other reason applies. */\n reasons: z.array(LookFirstReason),\n});\n\nexport const ReadingOrderRow = z.object({ node: NodeRef, centrality: z.number() });\n\nconst weightShape = (w: PenaltyWeight) => ({ each: z.number().min(0).default(w.each), cap: z.number().min(0).default(w.cap) });\nconst weight = (w: PenaltyWeight) => z.object(weightShape(w)).prefault({});\n\nconst { findings, complexity } = DEFAULT_HEALTH_WEIGHTS;\n\nconst signalWeights = z\n .object({\n hotspots: weight(DEFAULT_HEALTH_WEIGHTS.hotspots),\n findings: z\n .object({\n each_new: z.number().min(0).default(findings.eachNew),\n each_carry: z.number().min(0).default(findings.eachCarry),\n cap: z.number().min(0).default(findings.cap),\n })\n .prefault({}),\n complexity: z.object({ ...weightShape(complexity), budget: z.number().min(0).default(complexity.budget) }).prefault({}),\n hidden_coupling: weight(DEFAULT_HEALTH_WEIGHTS.hiddenCoupling),\n })\n .prefault({});\n\nconst overviewGetArgs = z.object({\n snapshot: SnapshotRef.optional(),\n baseline: SnapshotRef.optional(),\n window: ChurnWindow.default(\"30d\"),\n /** A file scoring at least this is over the cutoff; the threshold is the caller's policy. */\n cutoff: z.number().min(0).default(3000),\n weights: signalWeights,\n /** Rules left out of the findings signal, such as one already counted as a hotspot over the cutoff. */\n exclude_rules: z.array(z.string()).default([]),\n /** Also return `combined`, 100 minus every signal's penalty. */\n combined: z.boolean().default(false),\n reading_limit: z.number().int().min(0).max(OVERVIEW_ROWS_MAX).default(6),\n look_limit: z.number().int().min(0).max(OVERVIEW_ROWS_MAX).default(8),\n});\n\nconst FindingCounts = z.object({\n open: z.number().int(),\n /** Status counts against the baseline; present only with one. */\n new: z.number().int().optional(),\n carryover: z.number().int().optional(),\n resolved: z.number().int().optional(),\n});\n\nconst overviewGetResult = z.object({\n snapshotId: z.number().int(),\n ...BaselineFields,\n kpis: z.object({\n hotspotsOverCutoff: z.number().int(),\n /** Highest file complexity among files with churn in the window. */\n maxComplexity: z.number(),\n /** Files with a bus factor of 1 in the window. */\n knowledgeSilos: z.number().int(),\n findings: FindingCounts,\n }),\n signals: z.array(AttentionSignal),\n /** Present only when asked for: one number hides which signal moved, so read `signals` first. */\n combined: z.number().optional(),\n readingOrder: z.array(ReadingOrderRow),\n lookFirst: z.array(LookFirstRow),\n});\n\nexport const OVERVIEW_GET = {\n description:\n \"Where to look first in a snapshot: KPIs, named attention signals (hotspots over `cutoff`, findings, complexity over budget, \" +\n \"hidden coupling) each weighted and capped by the caller's `weights`, a reading order of files by PageRank centrality, and \" +\n \"the top hotspots with the reasons each is listed. With `baseline`, findings count as new, carried over, or resolved. \" +\n \"`combined` optionally adds 100 minus the penalties; it is a secondary summary, not a verdict.\",\n args: overviewGetArgs,\n result: overviewGetResult,\n} as const;\n\nexport type AttentionSignal = z.infer<typeof AttentionSignal>;\nexport type LookFirstRow = z.infer<typeof LookFirstRow>;\nexport type ReadingOrderRow = z.infer<typeof ReadingOrderRow>;\n","import { z } from \"zod\";\nimport { Finding } from \"./contract-findings.js\";\nimport { ChurnWindow } from \"./contract-hotspots.js\";\nimport { NodeRef, SnapshotRef } from \"./schemas.js\";\n\n/** Most rows each list of a `changes.get` result returns; `counts` always holds the full sizes. */\nexport const CHANGES_ROWS_MAX = 500;\n\n/** A file present at both snapshots whose hotspot score moved; a file with no score counts as 0. */\nexport const ScoreChange = z.object({\n node: NodeRef,\n before: z.number(),\n after: z.number(),\n delta: z.number(),\n});\n\nexport const NewFile = z.object({ node: NodeRef, score: z.number() });\n\n/** A finding open at both snapshots whose measured value moved; `delta` is current value minus baseline value. */\nexport const FindingChange = z.object({ finding: Finding, before: z.number(), delta: z.number() });\n\n/** A file whose hotspot score rose since the baseline and that carries an open finding now. */\nexport const Regression = ScoreChange.extend({ findings: z.array(z.string()) });\n\nexport const CoChangePair = z.object({ a: NodeRef, b: NodeRef, count: z.number().int() });\n\nconst changesGetArgs = z.object({\n snapshot: SnapshotRef.optional(),\n baseline: SnapshotRef,\n window: ChurnWindow.default(\"30d\"),\n /** A file scoring at least this is over the cutoff; the threshold is the caller's policy. */\n cutoff: z.number().min(0).default(3000),\n limit: z.number().int().min(0).max(CHANGES_ROWS_MAX).default(20),\n});\n\nconst changesGetResult = z.object({\n snapshotId: z.number().int(),\n baselineSnapshotId: z.number().int(),\n /** False across index versions; every list is then empty, because the two indexes measure differently. */\n comparable: z.boolean(),\n files: z.object({\n /** Below the cutoff at the baseline, at or above it now; highest delta first. */\n crossedCutoff: z.array(ScoreChange),\n /** Files the baseline does not hold; highest score first. */\n added: z.array(NewFile),\n }),\n findings: z.object({\n new: z.array(Finding),\n worsened: z.array(FindingChange),\n improved: z.array(FindingChange),\n resolved: z.array(Finding),\n }),\n coupling: z.object({\n /** False until co-change pairs are stored in the index; `added` is then empty. */\n measured: z.boolean(),\n added: z.array(CoChangePair),\n }),\n regressions: z.array(Regression),\n counts: z.object({\n crossedCutoff: z.number().int(),\n newFiles: z.number().int(),\n newFindings: z.number().int(),\n worsened: z.number().int(),\n improved: z.number().int(),\n resolved: z.number().int(),\n newCoupling: z.number().int(),\n regressions: z.number().int(),\n }),\n});\n\nexport const CHANGES_GET = {\n description:\n \"What changed between a `baseline` snapshot and this one: files that crossed the hotspot `cutoff`, files the baseline \" +\n \"does not hold, findings new, worsened, improved, or resolved, new co-change coupling (unmeasured until pairs are \" +\n \"stored), and regressions: files whose hotspot score rose and that carry an open finding. Each list holds at most \" +\n \"`limit` rows; `counts` holds the full sizes. Across index versions `comparable` is false and every list is empty.\",\n args: changesGetArgs,\n result: changesGetResult,\n} as const;\n\nexport type ScoreChange = z.infer<typeof ScoreChange>;\nexport type NewFile = z.infer<typeof NewFile>;\nexport type FindingChange = z.infer<typeof FindingChange>;\nexport type Regression = z.infer<typeof Regression>;\nexport type CoChangePair = z.infer<typeof CoChangePair>;\n","import { z } from \"zod\";\nimport { BaselineFields, Finding } from \"./contract-findings.js\";\nimport { ChurnWindow } from \"./contract-hotspots.js\";\nimport { NodeRef, SnapshotRef } from \"./schemas.js\";\n\n/** Most paths one `paths.impact` call takes. */\nexport const PATHS_IMPACT_MAX = 500;\n\n/** A file's findings against the baseline, bucketed as `changes.get` buckets them; counts only. */\nexport const FindingDelta = z.object({\n new: z.number().int(),\n worsened: z.number().int(),\n improved: z.number().int(),\n resolved: z.number().int(),\n});\n\n/** An indexed file against the baseline. Every `before` is null when the baseline does not hold the file. */\nexport const PathDelta = z.object({\n inBaseline: z.boolean(),\n /** A file with no score at the baseline counts as 0, as in `changes.get`; null when the baseline does not hold it. */\n scoreBefore: z.number().nullable(),\n /** Current score minus `scoreBefore`; null when `scoreBefore` is. */\n score: z.number().nullable(),\n complexityBefore: z.number().nullable(),\n /** Current complexity minus `complexityBefore`; null when either is unmeasured. */\n complexity: z.number().nullable(),\n findings: FindingDelta,\n});\n\nexport const PathHotspot = z.object({\n /** The file grain's score over the window, as `hotspots.list` scores it; 0 when the file has no churn or no complexity. */\n score: z.number(),\n /** The file's position in `hotspots.list` at the same window, 1 the highest; null at a score of 0. */\n rank: z.number().int().nullable(),\n});\n\nconst IndexedPath = z.object({\n status: z.literal(\"indexed\"),\n /** The path as given. */\n input: z.string(),\n /** Repo-relative, the file's node id. */\n path: z.string(),\n node: NodeRef,\n /** The complexity factor of the hotspot score (max cognitive, else max cyclomatic); null when unmeasured. */\n complexity: z.number().nullable(),\n hotspot: PathHotspot,\n /** Open findings on the file or a symbol in it, worst first. With a baseline each carries a status. */\n findings: z.array(Finding),\n /** Absent without a baseline; null when the baseline is not comparable (another index version). */\n delta: PathDelta.nullable().optional(),\n});\n\n/** A repo-relative path the snapshot holds no file for, such as a new, deleted, ignored, or directory path. */\nconst NotIndexedPath = z.object({ status: z.literal(\"not-indexed\"), input: z.string(), path: z.string() });\n\n/** An absolute path outside `root` (or any absolute path when `root` is not given), or a relative one that climbs out with `..`. */\nconst OutsideRepoPath = z.object({ status: z.literal(\"outside-repo\"), input: z.string() });\n\nexport const PathImpact = z.discriminatedUnion(\"status\", [IndexedPath, NotIndexedPath, OutsideRepoPath]);\n\nexport const ImpactRollup = z.object({\n indexed: z.number().int(),\n notIndexed: z.number().int(),\n outsideRepo: z.number().int(),\n /** Sum of the indexed files' hotspot scores. */\n score: z.number(),\n /** Highest complexity over the indexed files; null when none is measured. */\n maxComplexity: z.number().nullable(),\n /** Best (lowest) hotspot rank over the indexed files; null when none ranks. */\n topRank: z.number().int().nullable(),\n openFindings: z.number().int(),\n /** The rows' deltas summed, plus the resolved findings of not-indexed (deleted) files that the baseline held; present and null exactly when every row's `delta` is. */\n delta: z.object({ score: z.number(), findings: FindingDelta }).nullable().optional(),\n});\n\nconst pathsImpactArgs = z.object({\n snapshot: SnapshotRef.optional(),\n baseline: SnapshotRef.optional(),\n /** Repo-relative paths; a leading `./` is dropped. An absolute path counts only when it lies under `root`. */\n paths: z.array(z.string()).max(PATHS_IMPACT_MAX),\n /** The absolute directory the repo is checked out at, such as a worktree, so absolute paths under it can be read. A root above the index's repo root is rejected as invalid arguments. */\n root: z.string().optional(),\n window: ChurnWindow.default(\"30d\"),\n});\n\nconst pathsImpactResult = z.object({\n snapshotId: z.number().int(),\n ...BaselineFields,\n /** One row per distinct path, in the order first given. */\n rows: z.array(PathImpact),\n /** Files with a non-zero hotspot score at the window; the denominator for `hotspot.rank`. */\n ranked: z.number().int(),\n rollup: ImpactRollup,\n});\n\nexport const PATHS_IMPACT = {\n description:\n \"What a set of files weighs in the code graph, such as the files a change touches: per file its complexity, its \" +\n \"hotspot score and rank as `hotspots.list` ranks them at `window`, and its open findings, plus a rollup. A path the \" +\n \"snapshot does not hold answers status 'not-indexed', and one outside the repo 'outside-repo'; neither is an error. \" +\n \"With `baseline`, each indexed row gets a score, complexity, and findings delta, and the rollup delta also counts the \" +\n \"resolved findings of a not-indexed path the baseline held (a deleted file); without one, `delta` is absent.\",\n args: pathsImpactArgs,\n result: pathsImpactResult,\n} as const;\n\nexport type PathImpact = z.infer<typeof PathImpact>;\nexport type PathDelta = z.infer<typeof PathDelta>;\nexport type PathHotspot = z.infer<typeof PathHotspot>;\nexport type FindingDelta = z.infer<typeof FindingDelta>;\nexport type ImpactRollup = z.infer<typeof ImpactRollup>;\n","import { z } from \"zod\";\nimport { SnapshotRef } from \"./schemas.js\";\n\n/** Most package roots one `packages.stats` call takes. */\nexport const PACKAGES_MAX = 500;\n\n/** The package's tier in a `layered-deps` rule, 0 the lowest; a package no such rule names is `undeclared`. */\nexport const PackageLayer = z.discriminatedUnion(\"status\", [\n z.object({ status: z.literal(\"declared\"), tier: z.number().int(), rule: z.string() }),\n z.object({ status: z.literal(\"undeclared\") }),\n]);\n\nexport const PackageStatsRow = z.object({\n /** The package root, a repo-relative path prefix such as `packages/cli`. */\n id: z.string(),\n /** The root's last path segment; the index holds no package manifests. */\n name: z.string(),\n fileCount: z.number().int(),\n internalEdges: z.number().int(),\n outgoingEdges: z.number().int(),\n incomingEdges: z.number().int(),\n /** internal / (internal + outgoing); 0 with neither. */\n cohesion: z.number(),\n /** outgoing / (outgoing + incoming), Martin's I; 0 with neither. */\n instability: z.number(),\n /** Share of the package's files with role \"types\", a stand-in for Martin's A. */\n abstractness: z.number(),\n /** code-graph's instability band: at most 0.3 foundation, at least 0.9 top. Measured, unlike `layer`. */\n band: z.enum([\"foundation\", \"middle\", \"top\"]),\n /** Open string: \"weak-boundary\" today. */\n flags: z.array(z.string()),\n layer: PackageLayer,\n});\n\n/** Edges from one package into another, with their share of the source package's files. */\nexport const CrossEdge = z.object({\n from: z.string(),\n to: z.string(),\n edges: z.number().int(),\n /** edges / files(from). */\n intensity: z.number(),\n /** At least 0.6 tight, at least 0.3 moderate. */\n flag: z.enum([\"tight\", \"moderate\", \"none\"]),\n});\n\nconst packagesStatsArgs = z.object({\n snapshot: SnapshotRef.optional(),\n /** Package roots as repo-relative path prefixes; omitted means every package the tier config declares. */\n packages: z.array(z.string().min(1)).max(PACKAGES_MAX).optional(),\n});\n\nconst packagesStatsResult = z.object({\n snapshotId: z.number().int(),\n /** Where the package roots came from: the `packages` argument, or the `layered-deps` rules; `none` when neither names one. */\n packagesFrom: z.enum([\"args\", \"tiers\", \"none\"]),\n /** Newman-Girvan modularity Q of the package partition; 0 with no edges. */\n modularity: z.number(),\n /** File-to-file edges with both ends in a package, internal and cross. */\n totalEdges: z.number().int(),\n /** Files counted under no package root. */\n unassignedFiles: z.number().int(),\n /** One row per package root, by id. */\n packages: z.array(PackageStatsRow),\n /** By `from`, then `to`. */\n crossEdges: z.array(CrossEdge),\n});\n\nexport const PACKAGES_STATS = {\n description:\n \"Package structure for a snapshot: per package its file count, internal, outgoing, and incoming edges, cohesion, \" +\n \"instability, abstractness, and its tier in the repo's layered-deps rules, plus the package-to-package edges and the \" +\n \"snapshot's modularity. Test and fixture files are left out, as code-graph's arch view leaves them out. A package no \" +\n \"tier names has layer status 'undeclared'.\",\n args: packagesStatsArgs,\n result: packagesStatsResult,\n} as const;\n\nexport type PackageLayer = z.infer<typeof PackageLayer>;\nexport type PackageStatsRow = z.infer<typeof PackageStatsRow>;\nexport type CrossEdge = z.infer<typeof CrossEdge>;\n","import type { MetricDescriptor, SnapshotInfo, Span } from \"./schemas.js\";\n\n/** A graph node as the read API holds it; mirrors code-graph's `GraphNode` without importing it. */\nexport interface ModelNode {\n id: string;\n kind: string;\n name: string;\n parentId: string | null;\n language?: string;\n role?: string;\n attrs: Record<string, unknown>;\n}\n\nexport interface ModelEdge {\n srcId: string;\n dstId: string;\n kind: string;\n attrs: Record<string, unknown>;\n}\n\nexport interface ModelAlias {\n oldId: string;\n newId: string;\n reason: string;\n}\n\nexport interface ModelMetric {\n nodeId: string;\n name: string;\n value: number | null;\n unit?: string;\n}\n\n/** A rule as findings cite it: `text` is a plain-language statement of what the rule demands. */\nexport interface ModelRule {\n id: string;\n type: string;\n severity: string;\n text: string;\n /** A `layered-deps` rule's tiers of package roots, lowest first; the repo's tier config. */\n layers?: readonly (readonly string[])[];\n}\n\n/** One check-rule violation, keyed by the ratchet's `violationKey`; `ranges` are the flagged lines, absent for a whole-node finding. */\nexport interface ModelFinding {\n id: string;\n rule: string;\n severity: string;\n nodeId: string;\n destinationId?: string;\n metric?: string;\n value?: number;\n threshold?: number;\n message: string;\n ranges?: readonly Span[];\n}\n\n/** A catalogue entry as code-graph's `describeMetric` returns it; provenance is added here. */\nexport interface CatalogueEntry {\n name: string;\n unit: string;\n appliesTo: readonly string[];\n rollup: MetricDescriptor[\"rollup\"];\n direction: MetricDescriptor[\"direction\"];\n absent: MetricDescriptor[\"absent\"];\n source: string;\n description: string;\n window?: string;\n}\n\n/** Everything one snapshot holds, indexed for reads. Snapshots are immutable, so a model never goes stale. */\nexport interface ReadModel {\n snapshot: SnapshotInfo;\n nodes: readonly ModelNode[];\n nodeById: ReadonlyMap<string, ModelNode>;\n edges: readonly ModelEdge[];\n aliases: readonly ModelAlias[];\n /** Metric name to node id to value. */\n metrics: ReadonlyMap<string, ReadonlyMap<string, number | null>>;\n /** One descriptor per metric name present in the snapshot, sorted by name. */\n metricCatalogue: readonly MetricDescriptor[];\n /** Derived on load from the product's rules; a changed rule set means a different model. */\n findings: readonly ModelFinding[];\n rules: readonly ModelRule[];\n}\n\nexport interface ReadModelParts {\n snapshot: SnapshotInfo;\n nodes: readonly ModelNode[];\n edges: readonly ModelEdge[];\n aliases: readonly ModelAlias[];\n metrics: readonly ModelMetric[];\n /** The catalogue lookup, injected so this module never imports code-graph's Node-only root. */\n describe: (name: string) => CatalogueEntry | null;\n findings?: readonly ModelFinding[];\n rules?: readonly ModelRule[];\n}\n\nexport function buildReadModel(parts: ReadModelParts): ReadModel {\n const nodeById = new Map(parts.nodes.map((n) => [n.id, n]));\n return {\n snapshot: parts.snapshot,\n nodes: parts.nodes,\n nodeById,\n edges: parts.edges,\n aliases: parts.aliases,\n metrics: indexMetrics(parts.metrics),\n metricCatalogue: buildCatalogue(parts, nodeById),\n findings: parts.findings ?? [],\n rules: parts.rules ?? [],\n };\n}\n\nfunction indexMetrics(metrics: readonly ModelMetric[]): Map<string, Map<string, number | null>> {\n const byName = new Map<string, Map<string, number | null>>();\n for (const m of metrics) {\n let values = byName.get(m.name);\n if (!values) byName.set(m.name, (values = new Map()));\n values.set(m.nodeId, m.value);\n }\n return byName;\n}\n\ninterface ObservedMetric {\n unit: string | null;\n kinds: Set<string>;\n}\n\nfunction observeMetrics(metrics: readonly ModelMetric[], nodeById: ReadonlyMap<string, ModelNode>): Map<string, ObservedMetric> {\n const observed = new Map<string, ObservedMetric>();\n for (const m of metrics) {\n let entry = observed.get(m.name);\n if (!entry) observed.set(m.name, (entry = { unit: m.unit ?? null, kinds: new Set() }));\n const kind = nodeById.get(m.nodeId)?.kind;\n if (kind) entry.kinds.add(kind);\n }\n return observed;\n}\n\nfunction buildCatalogue(parts: ReadModelParts, nodeById: ReadonlyMap<string, ModelNode>): MetricDescriptor[] {\n const observed = observeMetrics(parts.metrics, nodeById);\n const engine = `code-graph@${parts.snapshot.indexVersion}`;\n return [...observed.keys()].sort().map((name) => {\n const entry = parts.describe(name);\n return entry ? fromCatalogue(entry, engine) : uncatalogued(name, observed.get(name)!, engine);\n });\n}\n\nfunction fromCatalogue(entry: CatalogueEntry, engine: string): MetricDescriptor {\n const descriptor: MetricDescriptor = {\n name: entry.name,\n unit: entry.unit,\n appliesTo: [...entry.appliesTo],\n rollup: entry.rollup,\n direction: entry.direction,\n absent: entry.absent,\n description: entry.description,\n provenance: { kind: \"measured\", source: `${engine}/${entry.source}` },\n };\n if (entry.window !== undefined) descriptor.window = entry.window;\n return descriptor;\n}\n\n// A stored name the catalogue does not know: served with no judgement rather than dropped.\nfunction uncatalogued(name: string, seen: ObservedMetric, engine: string): MetricDescriptor {\n return {\n name,\n unit: seen.unit,\n appliesTo: [...seen.kinds].sort(),\n rollup: \"none\",\n direction: \"neutral\",\n absent: \"exclude\",\n description: \"Not in code-graph's metric catalogue.\",\n provenance: { kind: \"measured\", source: `${engine}/uncatalogued` },\n };\n}\n","import { EXIT } from \"@titan-design/rpc-protocol\";\nimport type { CommandName } from \"./contract.js\";\nimport type { ReadModel } from \"./model.js\";\nimport type { Capabilities, RuleSummary, SnapshotInfo } from \"./schemas.js\";\n\n/** What a source can serve, independent of any one snapshot. */\nexport interface SourceFacts {\n dataset: \"live\" | \"static\";\n commands: readonly CommandName[];\n capabilities: Capabilities;\n rules: readonly RuleSummary[];\n}\n\n/** Where excerpt text came from: the snapshot's commit, a working tree proven to match it, or a static export. */\nexport type SourceOrigin = \"commit\" | \"worktree\" | \"export\";\n\n/** Some or all of one file's lines as they were at the snapshot; `startLine` is the first line held. */\nexport interface SourceWindow {\n path: string;\n contentHash: string;\n origin: SourceOrigin;\n startLine: number;\n lines: readonly string[];\n /** Lines in the whole file, so a window can be clipped at the file's end. */\n lineCount: number;\n}\n\n/** Open string: \"no-source\" | \"changed-since-snapshot\" | \"not-in-export\" | \"unreadable\" today. */\nexport type SourceRead = SourceWindow | { unavailable: string };\n\n/**\n * The seam every query function reads through. The daemon implements it over SQLite with an\n * LRU of models; a static export implements it over a decoded dataset. Same queries, same answers.\n */\nexport interface ReadSource {\n facts(): SourceFacts;\n /** Every snapshot, newest first. */\n snapshots(): readonly SnapshotInfo[];\n /** Throws a `ReadError` with `EXIT.NOINPUT` when the snapshot does not exist. */\n model(snapshotId: number): ReadModel;\n /** A file's text at the snapshot; absent when the source holds no source text at all. */\n readSource?(snapshotId: number, path: string): SourceRead;\n /** The directory the snapshots were indexed from; absent or null when the source does not know it (a static export). */\n repoRoot?: string | null;\n}\n\n/** A failure carrying the sysexits code every surface reports, so the registry's `describeError` maps it as is. */\nexport class ReadError extends Error {\n constructor(\n message: string,\n readonly code: number,\n ) {\n super(message);\n this.name = \"ReadError\";\n }\n}\n\nexport function snapshotNotFound(snapshotId: number): ReadError {\n return new ReadError(`No snapshot with id ${snapshotId}`, EXIT.NOINPUT);\n}\n\nexport function nodeNotFound(id: string, snapshotId: number): ReadError {\n return new ReadError(`No node \"${id}\" in snapshot ${snapshotId}`, EXIT.NOINPUT);\n}\n\nexport function findingNotFound(id: string, snapshotId: number): ReadError {\n return new ReadError(`No finding \"${id}\" in snapshot ${snapshotId}`, EXIT.NOINPUT);\n}\n\n/** Bad arguments the schema cannot express, such as \"exactly one of\"; same code as a schema failure. */\nexport function invalidArgs(message: string): ReadError {\n return new ReadError(`Invalid arguments: ${message}`, EXIT.DATAERR);\n}\n","import { EXIT } from \"@titan-design/rpc-protocol\";\nimport type { ReadModel } from \"./model.js\";\nimport type { SnapshotInfo, SnapshotRef } from \"./schemas.js\";\nimport { ReadError, snapshotNotFound, type ReadSource } from \"./source.js\";\n\nconst DIGITS = /^\\d+$/;\n\n/** An id, a digit string, or a ref name (its newest snapshot); omitted means the newest overall. */\nexport function resolveSnapshot(source: ReadSource, ref: SnapshotRef | undefined): SnapshotInfo {\n const snapshots = source.snapshots();\n if (ref === undefined) {\n const newest = snapshots[0];\n if (!newest) throw new ReadError(\"No snapshots have been indexed\", EXIT.NOINPUT);\n return newest;\n }\n if (typeof ref === \"number\" || DIGITS.test(ref)) {\n const id = Number(ref);\n const found = snapshots.find((s) => s.id === id);\n if (!found) throw snapshotNotFound(id);\n return found;\n }\n const newestOfRef = snapshots.find((s) => s.ref === ref);\n if (!newestOfRef) throw new ReadError(`No snapshot of ref \"${ref}\"`, EXIT.NOINPUT);\n return newestOfRef;\n}\n\nexport function modelFor(source: ReadSource, ref: SnapshotRef | undefined): ReadModel {\n return source.model(resolveSnapshot(source, ref).id);\n}\n","import {\n bucketViolations,\n computeReportDrift,\n hotspotScoreOf,\n keepNode,\n type BucketableViolation,\n type ReportContext,\n type UnchangedViolation,\n type ViolationBuckets,\n} from \"@titan-design/code-graph/analysis\";\nimport type { CommandArgs, CommandResult } from \"./contract.js\";\nimport type { FindingChange, NewFile, Regression, ScoreChange } from \"./contract-changes.js\";\nimport type { Finding } from \"./contract-findings.js\";\nimport { findingsFor } from \"./finding-rows.js\";\nimport { driftBaseline, reportContext, scoredRows } from \"./hotspots.js\";\nimport type { ReadModel } from \"./model.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport type { ReadSource } from \"./source.js\";\nimport { toRef } from \"./tree.js\";\n\ntype ChangesArgs = CommandArgs<\"changes.get\">;\ntype ChangesResult = CommandResult<\"changes.get\">;\ntype Lists = Omit<ChangesResult, \"snapshotId\" | \"baselineSnapshotId\" | \"comparable\" | \"counts\">;\n\ninterface Side {\n model: ReadModel;\n ctx: ReportContext;\n}\n\n/** A finding as code-graph's bucketing reads it, carrying its contract row along. */\nexport interface Keyed extends BucketableViolation {\n row: Finding;\n}\n\nconst byDeltaThenId = (a: ScoreChange, b: ScoreChange): number => b.delta - a.delta || compareIds(a.node.id, b.node.id);\nconst compareIds = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);\n\n/** Files present at both snapshots whose hotspot score rose, as code-graph's report drift finds them over every row. */\nfunction risingFiles(current: Side, baseline: Side, args: ChangesArgs): ScoreChange[] {\n const scored = (model: ReadModel) => scoredRows(model, { grain: \"file\", window: args.window });\n const drift = computeReportDrift({\n baselineSnapshot: driftBaseline(baseline.model.snapshot),\n currentHotspots: scored(current.model),\n baselineHotspots: scored(baseline.model),\n currentHotspotScore: (id) => hotspotScoreOf(current.ctx, id),\n baselineHotspotScore: (id) => (baseline.model.nodeById.has(id) ? hotspotScoreOf(baseline.ctx, id) : undefined),\n currentSilos: [],\n baselineSilos: [],\n currentBusFactor: () => undefined,\n currentCoupling: [],\n baselineCoupling: [],\n });\n const climbed = drift.newHotspots.flatMap((r) => (r.before === undefined ? [] : [{ ...r, after: r.score, before: r.before, delta: r.score - r.before }]));\n const node = (id: string) => toRef(current.model.nodeById.get(id)!);\n return [...drift.worsenedHotspots, ...climbed].map((r) => ({ node: node(r.nodeId), before: r.before, after: r.after, delta: r.delta }));\n}\n\nfunction addedFiles(current: Side, baseline: Side): NewFile[] {\n return current.model.nodes\n .filter((n) => n.kind === \"file\" && !baseline.model.nodeById.has(n.id) && keepNode(current.ctx, n.id))\n .map((n) => ({ node: toRef(n), score: hotspotScoreOf(current.ctx, n.id) }))\n .sort((a, b) => b.score - a.score || compareIds(a.node.id, b.node.id));\n}\n\nfunction keyed(model: ReadModel): Keyed[] {\n return findingsFor(model).map((row) => {\n const k: Keyed = { ruleId: row.rule, nodeId: row.node.id, row };\n if (row.destination) k.destinationId = row.destination.id;\n if (row.value !== undefined) k.value = row.value;\n return k;\n });\n}\n\n// Matched by id only, as findings.list matches: following renames through the alias chain is TP-187's identity work.\n/** Two snapshots' findings as code-graph buckets them: new, resolved, and unchanged, worsened or improved by value. */\nexport function bucketFindings(baseline: ReadModel, current: ReadModel): ViolationBuckets<Keyed> {\n return bucketViolations(keyed(baseline), keyed(current));\n}\n\nfunction findingChanges(current: ReadModel, baseline: ReadModel): Lists[\"findings\"] {\n const buckets = bucketFindings(baseline, current);\n const change = (u: UnchangedViolation<Keyed>): FindingChange => ({ finding: u.to.row, before: u.from.value!, delta: u.delta! });\n return {\n new: buckets.newViolations.map((v) => v.row),\n worsened: buckets.worsened.map(change).sort((a, b) => b.delta - a.delta),\n improved: buckets.improved.map(change).sort((a, b) => a.delta - b.delta),\n resolved: buckets.resolvedViolations.map((v) => v.row),\n };\n}\n\n/** Rising files that carry an open finding now, on the file or on a symbol in it. */\nfunction regressions(rising: readonly ScoreChange[], current: ReadModel): Regression[] {\n const open = new Map<string, string[]>();\n for (const f of findingsFor(current)) open.set(f.node.path, [...(open.get(f.node.path) ?? []), f.id]);\n return rising.flatMap((r) => {\n const ids = open.get(r.node.id);\n return ids ? [{ ...r, findings: [...ids].sort(compareIds) }] : [];\n });\n}\n\nfunction diff(current: Side, baseline: Side, args: ChangesArgs): Lists {\n const rising = risingFiles(current, baseline, args).sort(byDeltaThenId);\n return {\n files: {\n crossedCutoff: rising.filter((r) => r.after >= args.cutoff && r.before < args.cutoff),\n added: addedFiles(current, baseline),\n },\n findings: findingChanges(current.model, baseline.model),\n // Co-change pairs are not stored in the index yet, so new coupling cannot be measured here.\n coupling: { measured: false, added: [] },\n regressions: regressions(rising, current.model),\n };\n}\n\nconst EMPTY: Lists = {\n files: { crossedCutoff: [], added: [] },\n findings: { new: [], worsened: [], improved: [], resolved: [] },\n coupling: { measured: false, added: [] },\n regressions: [],\n};\n\nfunction counts(lists: Lists): ChangesResult[\"counts\"] {\n const { files, findings } = lists;\n return {\n crossedCutoff: files.crossedCutoff.length,\n newFiles: files.added.length,\n newFindings: findings.new.length,\n worsened: findings.worsened.length,\n improved: findings.improved.length,\n resolved: findings.resolved.length,\n newCoupling: lists.coupling.added.length,\n regressions: lists.regressions.length,\n };\n}\n\nfunction capped(lists: Lists, limit: number): Lists {\n const cap = <T>(rows: readonly T[]): T[] => rows.slice(0, limit);\n const { files, findings, coupling } = lists;\n return {\n files: { crossedCutoff: cap(files.crossedCutoff), added: cap(files.added) },\n findings: { new: cap(findings.new), worsened: cap(findings.worsened), improved: cap(findings.improved), resolved: cap(findings.resolved) },\n coupling: { measured: coupling.measured, added: cap(coupling.added) },\n regressions: cap(lists.regressions),\n };\n}\n\n/** `changes.get`: what moved between a baseline snapshot and this one, or `comparable: false` across index versions. */\nexport function getChanges(source: ReadSource, args: ChangesArgs): ChangesResult {\n const side = (model: ReadModel): Side => ({ model, ctx: reportContext(model, args.window) });\n const current = side(modelFor(source, args.snapshot));\n const baseline = side(modelFor(source, args.baseline));\n const comparable = baseline.model.snapshot.indexVersion === current.model.snapshot.indexVersion;\n const lists = comparable ? diff(current, baseline, args) : EMPTY;\n return {\n snapshotId: current.model.snapshot.id,\n baselineSnapshotId: baseline.model.snapshot.id,\n comparable,\n ...capped(lists, args.limit),\n counts: counts(lists),\n };\n}\n","import type { ModelNode, ReadModel } from \"./model.js\";\nimport type { NodeRef, Span } from \"./schemas.js\";\n\n/** One row of the synthesized hierarchy: repo, directory, file, or symbol. */\nexport interface TreeNode {\n ref: NodeRef;\n parentId: string | null;\n /** Absolute depth: the repo is 0. */\n depth: number;\n /** The stored node; absent for the synthesized repo and directories. */\n stored?: ModelNode;\n children: TreeNode[];\n}\n\n/** code-graph stores no repo, directory, or class level, so this tree is derived from file paths and symbol scopes. */\nexport interface Tree {\n root: TreeNode;\n byId: ReadonlyMap<string, TreeNode>;\n}\n\nexport const REPO_ID = \"\";\nconst SYMBOL_SEP = \"#\";\n\n/** A directory's id carries a trailing slash, which no file id has, so the two id spaces never collide. */\nexport function directoryId(path: string): string {\n return path === \"\" ? REPO_ID : `${path}/`;\n}\n\nexport function spanOf(node: ModelNode): Span | undefined {\n const { startLine, endLine } = node.attrs;\n return typeof startLine === \"number\" && typeof endLine === \"number\" ? { startLine, endLine } : undefined;\n}\n\nexport function toRef(node: ModelNode): NodeRef {\n const sep = node.kind === \"symbol\" ? node.id.indexOf(SYMBOL_SEP) : -1;\n const ref: NodeRef = { id: node.id, kind: node.kind, name: node.name, path: sep < 0 ? node.id : node.id.slice(0, sep) };\n const span = spanOf(node);\n if (span) ref.span = span;\n return ref;\n}\n\nfunction treeNode(ref: NodeRef, parentId: string | null, stored?: ModelNode): TreeNode {\n return stored ? { ref, parentId, depth: 0, stored, children: [] } : { ref, parentId, depth: 0, children: [] };\n}\n\nfunction dirPath(fileId: string): string {\n const slash = fileId.lastIndexOf(\"/\");\n return slash < 0 ? \"\" : fileId.slice(0, slash);\n}\n\nfunction ensureDirectory(byId: Map<string, TreeNode>, path: string): TreeNode {\n const id = directoryId(path);\n const existing = byId.get(id);\n if (existing) return existing;\n const parent = ensureDirectory(byId, dirPath(path));\n const name = path.slice(path.lastIndexOf(\"/\") + 1);\n const dir = treeNode({ id, kind: \"directory\", name, path }, parent.ref.id);\n parent.children.push(dir);\n byId.set(id, dir);\n return dir;\n}\n\nfunction attach(byId: Map<string, TreeNode>, parent: TreeNode, stored: ModelNode): void {\n const node = treeNode(toRef(stored), parent.ref.id, stored);\n parent.children.push(node);\n byId.set(stored.id, node);\n}\n\nfunction containsStrictly(outer: Span, inner: Span): boolean {\n const wider = outer.endLine - outer.startLine > inner.endLine - inner.startLine;\n return wider && outer.startLine <= inner.startLine && inner.endLine <= outer.endLine;\n}\n\n/** The smallest sibling symbol whose span strictly contains this one: the class level for pre-0.14 bare-name ids. */\nfunction innermostEnclosing(symbol: ModelNode, siblings: readonly ModelNode[]): ModelNode | undefined {\n const span = spanOf(symbol);\n if (!span) return undefined;\n let best: ModelNode | undefined;\n let bestSpan: Span | undefined;\n for (const other of siblings) {\n const outer = spanOf(other);\n if (other === symbol || !outer || !containsStrictly(outer, span)) continue;\n if (!bestSpan || outer.endLine - outer.startLine < bestSpan.endLine - bestSpan.startLine) [best, bestSpan] = [other, outer];\n }\n return best;\n}\n\n/** A qualified name `A.b.c` hangs under `A.b`, else `A`, else the symbol whose span encloses it, else its file. */\nfunction symbolParentId(symbol: ModelNode, fileId: string, bySymbolId: ReadonlyMap<string, ModelNode>, siblings: readonly ModelNode[]): string {\n const segments = symbol.name.split(\".\");\n for (let n = segments.length - 1; n > 0; n--) {\n const scopeId = `${fileId}${SYMBOL_SEP}${segments.slice(0, n).join(\".\")}`;\n if (bySymbolId.has(scopeId)) return scopeId;\n }\n return innermostEnclosing(symbol, siblings)?.id ?? fileId;\n}\n\nfunction symbolsByFile(model: ReadModel, byId: ReadonlyMap<string, TreeNode>): Map<string, ModelNode[]> {\n const out = new Map<string, ModelNode[]>();\n for (const node of model.nodes) {\n if (node.kind !== \"symbol\" || node.parentId === null || !byId.has(node.parentId)) continue;\n const list = out.get(node.parentId);\n if (list) list.push(node);\n else out.set(node.parentId, [node]);\n }\n return out;\n}\n\nfunction attachSymbols(model: ReadModel, byId: Map<string, TreeNode>): void {\n for (const [fileId, symbols] of symbolsByFile(model, byId)) {\n const bySymbolId = new Map(symbols.map((s) => [s.id, s]));\n const parentOf = new Map(symbols.map((s) => [s.id, symbolParentId(s, fileId, bySymbolId, symbols)]));\n const pending = [...symbols];\n // Parents attach before children, so repeat passes until every symbol has found its parent in the tree.\n while (pending.length > 0) {\n const ready = pending.filter((s) => byId.has(parentOf.get(s.id)!));\n // Only malformed spans can make a parent cycle; those symbols hang under the file rather than vanish.\n if (ready.length === 0) for (const s of pending) parentOf.set(s.id, fileId);\n for (const s of ready) attach(byId, byId.get(parentOf.get(s.id)!)!, s);\n for (const s of ready) pending.splice(pending.indexOf(s), 1);\n }\n }\n}\n\nconst KIND_ORDER: Record<string, number> = { directory: 0, file: 1, symbol: 2 };\n\nfunction compareSiblings(a: TreeNode, b: TreeNode): number {\n const byKind = (KIND_ORDER[a.ref.kind] ?? 3) - (KIND_ORDER[b.ref.kind] ?? 3);\n if (byKind !== 0) return byKind;\n const byLine = (a.ref.span?.startLine ?? Infinity) - (b.ref.span?.startLine ?? Infinity);\n if (byLine !== 0 && !Number.isNaN(byLine)) return byLine;\n return a.ref.id < b.ref.id ? -1 : a.ref.id > b.ref.id ? 1 : 0;\n}\n\nfunction finish(node: TreeNode, depth: number): void {\n node.depth = depth;\n node.children.sort(compareSiblings);\n for (const child of node.children) finish(child, depth + 1);\n}\n\nfunction buildTree(model: ReadModel, excludeRoles: ReadonlySet<string>): Tree {\n const root = treeNode({ id: REPO_ID, kind: \"repo\", name: \".\", path: \"\" }, null);\n const byId = new Map<string, TreeNode>([[REPO_ID, root]]);\n for (const node of model.nodes) {\n if (node.kind !== \"file\" || (node.role !== undefined && excludeRoles.has(node.role))) continue;\n attach(byId, ensureDirectory(byId, dirPath(node.id)), node);\n }\n attachSymbols(model, byId);\n finish(root, 0);\n return { root, byId };\n}\n\nconst trees = new WeakMap<ReadModel, Map<string, Tree>>();\n\n/** The hierarchy for a snapshot without files of the given roles; built once per model and role set. */\nexport function treeFor(model: ReadModel, excludeRoles: readonly string[] = []): Tree {\n const roles = [...new Set(excludeRoles)].sort();\n const key = roles.join(\"\\n\");\n let byKey = trees.get(model);\n if (!byKey) trees.set(model, (byKey = new Map()));\n let tree = byKey.get(key);\n if (!tree) byKey.set(key, (tree = buildTree(model, new Set(roles))));\n return tree;\n}\n","import type { Finding } from \"./contract-findings.js\";\nimport type { ModelFinding, ModelRule, ReadModel } from \"./model.js\";\nimport type { NodeRef } from \"./schemas.js\";\nimport { toRef } from \"./tree.js\";\n\nexport type FindingSort = \"severity\" | \"excess\" | \"value\" | \"path\" | \"rule\";\nexport type SortOrder = \"asc\" | \"desc\";\n\nconst SEVERITY_RANK: Record<string, number> = { error: 2, warning: 1, info: 0 };\nconst CHECK_TOOL = \"check\";\n\n/** A stored node's reference, or a bare one for an id the snapshot does not hold, so a finding never drops its node. */\nexport function refFor(model: ReadModel, id: string): NodeRef {\n const node = model.nodeById.get(id);\n return node ? toRef(node) : { id, kind: \"unknown\", name: id, path: id };\n}\n\n/** Larger is worse for every rule: value over threshold for a maximum, threshold over value for a minimum. */\nexport function excessOf(ruleType: string | undefined, value?: number, threshold?: number): number | null {\n if (value === undefined || threshold === undefined) return null;\n if (ruleType === \"metric-min\") return value > 0 ? threshold / value : null;\n return threshold > 0 ? value / threshold : null;\n}\n\nfunction toFinding(model: ReadModel, f: ModelFinding, rules: ReadonlyMap<string, ModelRule>): Finding {\n const out: Finding = {\n id: f.id,\n snapshotId: model.snapshot.id,\n rule: f.rule,\n tool: CHECK_TOOL,\n severity: f.severity,\n node: refFor(model, f.nodeId),\n excess: excessOf(rules.get(f.rule)?.type, f.value, f.threshold),\n message: f.message,\n provenance: { kind: \"derived\", source: `${CHECK_TOOL}/${f.rule}` },\n };\n if (f.destinationId !== undefined) out.destination = refFor(model, f.destinationId);\n if (f.ranges?.[0]) out.range = f.ranges[0];\n if (f.metric !== undefined) out.metric = f.metric;\n if (f.value !== undefined) out.value = f.value;\n if (f.threshold !== undefined) out.threshold = f.threshold;\n return out;\n}\n\nconst rowsByModel = new WeakMap<ReadModel, readonly Finding[]>();\n\n/** Every finding of a snapshot as a contract row, built once per model. */\nexport function findingsFor(model: ReadModel): readonly Finding[] {\n let rows = rowsByModel.get(model);\n if (!rows) {\n const rules = new Map(model.rules.map((r) => [r.id, r]));\n rowsByModel.set(model, (rows = model.findings.map((f) => toFinding(model, f, rules))));\n }\n return rows;\n}\n\nfunction statusAgainst(current: Finding, before: Finding | undefined): Finding[\"status\"] {\n if (!before) return \"new\";\n if (current.excess === null || before.excess === null || current.excess === before.excess) return \"carryover\";\n return current.excess > before.excess ? \"worsened\" : \"improved\";\n}\n\n// Matched by id only: following renames through the alias chain is TP-187's identity work.\n/** The current rows with a status against the baseline, then the baseline's rows that no longer occur, as \"resolved\". */\nexport function withStatus(current: readonly Finding[], baseline: readonly Finding[]): Finding[] {\n const before = new Map(baseline.map((f) => [f.id, f]));\n const now = new Set(current.map((f) => f.id));\n const rows = current.map((f) => ({ ...f, status: statusAgainst(f, before.get(f.id)) }));\n for (const f of baseline) if (!now.has(f.id)) rows.push({ ...f, status: \"resolved\" });\n return rows;\n}\n\nconst severityRank = (f: Finding): number => SEVERITY_RANK[f.severity] ?? -1;\nconst byText = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);\n\n/** Nulls sort last whatever the direction, so an unmeasured row never heads a page. */\nfunction byNullable(a: number | null | undefined, b: number | null | undefined, sign: number): number {\n const [x, y] = [a ?? null, b ?? null];\n if (x === null || y === null) return x === y ? 0 : x === null ? 1 : -1;\n return sign * (x - y);\n}\n\ntype Compare = (a: Finding, b: Finding) => number;\n\nconst PRIMARY: Record<FindingSort, (sign: number) => Compare> = {\n severity: (sign) => (a, b) => sign * (severityRank(a) - severityRank(b)),\n excess: (sign) => (a, b) => byNullable(a.excess, b.excess, sign),\n value: (sign) => (a, b) => byNullable(a.value, b.value, sign),\n path: (sign) => (a, b) => sign * byText(a.node.path, b.node.path),\n rule: (sign) => (a, b) => sign * byText(a.rule, b.rule),\n};\n\n// Fixed whatever the sort: worst first, then by place, ending on the unique id so every page boundary is stable.\nconst TIES: readonly Compare[] = [\n PRIMARY.severity(-1),\n PRIMARY.excess(-1),\n PRIMARY.path(1),\n PRIMARY.rule(1),\n (a, b) => byText(a.id, b.id),\n];\n\n/** A total order: `order` flips the primary key only; ties always break the same way. */\nexport function compareFindings(sort: FindingSort, order: SortOrder): Compare {\n const chain = [PRIMARY[sort](order === \"asc\" ? 1 : -1), ...TIES];\n return (a, b) => {\n for (const compare of chain) {\n const c = compare(a, b);\n if (c !== 0) return c;\n }\n return 0;\n };\n}\n","import {\n buildBlastRadius,\n buildReportContext,\n collectNodeMetrics,\n collectSymbolUtil,\n computeReportDrift,\n keepNode,\n topHotspots,\n type ComputeDriftInput,\n type HotspotRow,\n type ReportContext,\n type ReportContextInput,\n} from \"@titan-design/code-graph/analysis\";\nimport { baselineFields, openBaseline } from \"./baseline.js\";\nimport type { CommandArgs, CommandResult } from \"./contract.js\";\nimport type { Hotspot, HotspotMark } from \"./contract-hotspots.js\";\nimport type { ModelNode, ReadModel } from \"./model.js\";\nimport type { SnapshotInfo } from \"./schemas.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport type { ReadSource } from \"./source.js\";\nimport { toRef } from \"./tree.js\";\n\ntype ListArgs = CommandArgs<\"hotspots.list\">;\ntype ListResult = CommandResult<\"hotspots.list\">;\ntype GraphNodeLike = ReportContextInput[\"nodes\"][number];\n\n/** A derivation row; `utilization` is set at the symbol grain only. */\ninterface Scored extends HotspotRow {\n utilization?: number;\n}\n\ninterface Comparison {\n scores: ReadonlyMap<string, number>;\n marks: ReadonlyMap<string, HotspotMark>;\n}\n\nconst NO_ROLES: ReadonlySet<string> = new Set();\n\nfunction toGraphNode(node: ModelNode): GraphNodeLike {\n const out: GraphNodeLike = { id: node.id, kind: node.kind as GraphNodeLike[\"kind\"], name: node.name, attrs: node.attrs };\n if (node.parentId !== null) out.parentId = node.parentId;\n if (node.role !== undefined) out.role = node.role as GraphNodeLike[\"role\"];\n return out;\n}\n\nfunction metricRows(model: ReadModel): ReportContextInput[\"metrics\"][number][] {\n const rows: ReportContextInput[\"metrics\"][number][] = [];\n for (const [name, byNode] of model.metrics) for (const [nodeId, value] of byNode) rows.push({ nodeId, name, value });\n return rows;\n}\n\nconst inputs = new WeakMap<ReadModel, Pick<ReportContextInput, \"nodes\" | \"metrics\">>();\n\n/** The model in the derivations' row shapes; converted once per model. */\nexport function inputsFor(model: ReadModel): Pick<ReportContextInput, \"nodes\" | \"metrics\"> {\n let found = inputs.get(model);\n if (!found) inputs.set(model, (found = { nodes: model.nodes.map(toGraphNode), metrics: metricRows(model) }));\n return found;\n}\n\nfunction symbolRows(rows: Pick<ReportContextInput, \"nodes\" | \"metrics\">, ctx: ReportContext): Scored[] {\n const metrics = collectNodeMetrics([...rows.metrics]);\n const symbols = collectSymbolUtil(rows.nodes, metrics).filter((s) => keepNode(ctx, s.fileId));\n const churn = ctx.metricsByName.get(`churn_${ctx.windowSuffix}`) ?? new Map<string, number>();\n return buildBlastRadius(symbols, metrics, churn, Infinity).map((b) => ({\n nodeId: b.symbolId,\n churn: b.churn,\n complexity: b.complexity,\n recency: 1,\n score: b.score,\n utilization: b.utilization,\n }));\n}\n\nfunction windowDays(window: string): ReportContextInput[\"windowDays\"] {\n return window === \"lifetime\" ? \"lifetime\" : Number.parseInt(window, 10);\n}\n\nconst byScoreThenId = (a: Scored, b: Scored): number => b.score - a.score || (a.nodeId < b.nodeId ? -1 : a.nodeId > b.nodeId ? 1 : 0);\n\nexport function reportContext(model: ReadModel, window: string): ReportContext {\n return buildReportContext({ ...inputsFor(model), excluders: [], excludedRoles: NO_ROLES, windowDays: windowDays(window) });\n}\n\n/** Every file with non-zero churn and complexity, or symbol with a positive blast score (a rounded file score can still be 0), highest first, ties by id. */\nexport function scoredRows(model: ReadModel, args: Pick<ListArgs, \"grain\" | \"window\">): Scored[] {\n const ctx = reportContext(model, args.window);\n const scored: Scored[] = args.grain === \"file\" ? topHotspots(ctx, Infinity) : symbolRows(inputsFor(model), ctx);\n return scored.sort(byScoreThenId);\n}\n\n/** A snapshot in the row shape code-graph's report drift records as its baseline. */\nexport function driftBaseline(info: SnapshotInfo): ComputeDriftInput[\"baselineSnapshot\"] {\n const { commit, ...rest } = info;\n return { ...rest, commitHash: commit, attrs: {} };\n}\n\n/** New and worsened as code-graph's report drift defines them, over every row rather than a top N. */\nfunction compare(current: readonly Scored[], before: readonly Scored[], baseline: SnapshotInfo): Comparison {\n const drift = computeReportDrift({\n baselineSnapshot: driftBaseline(baseline),\n currentHotspots: current,\n baselineHotspots: before,\n currentHotspotScore: () => 0,\n currentSilos: [],\n baselineSilos: [],\n currentBusFactor: () => undefined,\n currentCoupling: [],\n baselineCoupling: [],\n });\n const marks = new Map<string, HotspotMark>();\n for (const r of drift.newHotspots) marks.set(r.nodeId, \"new\");\n for (const r of drift.worsenedHotspots) marks.set(r.nodeId, \"worsened\");\n return { scores: new Map(before.map((r) => [r.nodeId, r.score])), marks };\n}\n\nfunction toHotspot(model: ReadModel, r: Scored, comparison: Comparison | undefined): Hotspot {\n const row: Hotspot = { node: toRef(model.nodeById.get(r.nodeId)!), churn: r.churn, complexity: r.complexity, recency: r.recency, score: r.score };\n if (r.utilization !== undefined) row.utilization = r.utilization;\n if (!comparison) return row;\n row.baselineScore = comparison.scores.get(r.nodeId) ?? null;\n const mark = comparison.marks.get(r.nodeId);\n if (mark) row.mark = mark;\n return row;\n}\n\n/** `hotspots.list`: a snapshot's hotspots at one grain, cut at `cutoff`, optionally marked against a baseline, and paged. */\nexport function listHotspots(source: ReadSource, args: ListArgs): ListResult {\n const model = modelFor(source, args.snapshot);\n const baseline = openBaseline(source, args.baseline);\n const rows = scoredRows(model, args);\n const comparison = baseline ? compare(rows, scoredRows(baseline.model, args), baseline.model.snapshot) : undefined;\n const { cutoff } = args;\n const kept = cutoff === undefined ? rows : rows.filter((r) => r.score >= cutoff);\n return {\n snapshotId: model.snapshot.id,\n ...baselineFields(model, baseline),\n rows: kept.slice(args.offset, args.offset + args.limit).map((r) => toHotspot(model, r, comparison)),\n total: kept.length,\n };\n}\n","import type { ReadModel } from \"./model.js\";\nimport type { MetricDescriptor } from \"./schemas.js\";\nimport type { Tree, TreeNode } from \"./tree.js\";\n\n/** Why a value is null: the rollup rule forbids one, the node has no measurement, the metric does not describe the node, or the snapshot lacks the metric. */\nexport type Missing = \"no-rollup\" | \"not-measured\" | \"not-applicable\" | \"not-in-snapshot\";\n\nexport interface MetricValue {\n value: number | null;\n missing?: Missing;\n}\n\ninterface Aggregate {\n sum: number;\n count: number;\n max: number;\n}\n\nconst KIND_RANK: Record<string, number> = { repo: 0, directory: 1, file: 2, symbol: 3 };\nconst EMPTY: Aggregate = { sum: 0, count: 0, max: -Infinity };\n\n/** One metric over one tree: stored values where the catalogue says the metric applies, rollups above them. */\nexport interface Column {\n descriptor: MetricDescriptor | undefined;\n valueOf(node: TreeNode): MetricValue;\n}\n\n// Files before symbols: a metric stored on both rolls up from files only, so no value counts twice.\nfunction leafKind(descriptor: MetricDescriptor): string | null {\n if (descriptor.appliesTo.includes(\"file\")) return \"file\";\n return descriptor.appliesTo.includes(\"symbol\") ? \"symbol\" : null;\n}\n\nfunction rank(kind: string): number {\n return KIND_RANK[kind] ?? Infinity;\n}\n\nfunction storedValue(descriptor: MetricDescriptor, values: ReadonlyMap<string, number | null> | undefined, id: string): MetricValue {\n const value = values?.get(id);\n if (value !== undefined && value !== null) return { value };\n if (value === undefined && descriptor.absent === \"zero\") return { value: 0 };\n return { value: null, missing: \"not-measured\" };\n}\n\nfunction merge(a: Aggregate, b: Aggregate): Aggregate {\n return { sum: a.sum + b.sum, count: a.count + b.count, max: Math.max(a.max, b.max) };\n}\n\nfunction finalValue(rule: MetricDescriptor[\"rollup\"], agg: Aggregate): MetricValue {\n if (agg.count === 0) return { value: null, missing: \"not-measured\" };\n if (rule === \"max\") return { value: agg.max };\n if (rule === \"mean\") return { value: agg.sum / agg.count };\n return { value: agg.sum };\n}\n\nfunction buildColumn(model: ReadModel, name: string): Column {\n const descriptor = model.metricCatalogue.find((m) => m.name === name);\n if (!descriptor) return { descriptor, valueOf: () => ({ value: null, missing: \"not-in-snapshot\" }) };\n const values = model.metrics.get(name);\n const leaf = leafKind(descriptor);\n const aggregates = new Map<TreeNode, Aggregate>();\n const own = (node: TreeNode): MetricValue => storedValue(descriptor, values, node.ref.id);\n const aggregate = (node: TreeNode): Aggregate => {\n const cached = aggregates.get(node);\n if (cached) return cached;\n let agg = EMPTY;\n if (node.ref.kind === leaf) {\n const v = own(node).value;\n if (v !== null) agg = { sum: v, count: 1, max: v };\n }\n for (const child of node.children) if (rank(child.ref.kind) <= rank(leaf ?? \"\")) agg = merge(agg, aggregate(child));\n aggregates.set(node, agg);\n return agg;\n };\n const valueOf = (node: TreeNode): MetricValue => {\n if (node.stored && descriptor.appliesTo.includes(node.ref.kind)) return own(node);\n if (leaf === null || rank(node.ref.kind) >= rank(leaf)) return { value: null, missing: \"not-applicable\" };\n if (descriptor.rollup === \"none\") return { value: null, missing: \"no-rollup\" };\n return finalValue(descriptor.rollup, aggregate(node));\n };\n return { descriptor, valueOf };\n}\n\nconst columns = new WeakMap<Tree, Map<string, Column>>();\n\n/** The column for a metric over a tree, built once per tree and metric name. */\nexport function columnFor(model: ReadModel, tree: Tree, name: string): Column {\n let byName = columns.get(tree);\n if (!byName) columns.set(tree, (byName = new Map()));\n let column = byName.get(name);\n if (!column) byName.set(name, (column = buildColumn(model, name)));\n return column;\n}\n\n/** Whether a metric says anything about a node of this kind: stored on it, or rolled up into it. */\nexport function describesKind(descriptor: MetricDescriptor, kind: string): boolean {\n if (descriptor.appliesTo.includes(kind)) return true;\n const leaf = leafKind(descriptor);\n return leaf !== null && rank(kind) < rank(leaf);\n}\n","import type { ReadModel } from \"./model.js\";\nimport { columnFor } from \"./rollup.js\";\nimport type { SnapshotRef } from \"./schemas.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport type { ReadSource } from \"./source.js\";\nimport { treeFor, type Tree } from \"./tree.js\";\n\n/** A prior snapshot to measure deltas against, with the same role exclusions as the current one. */\nexport interface Baseline {\n model: ReadModel;\n tree: Tree;\n}\n\nexport function openBaseline(source: ReadSource, ref: SnapshotRef | undefined, excludeRoles: readonly string[] = []): Baseline | undefined {\n if (ref === undefined) return undefined;\n const model = modelFor(source, ref);\n return { model, tree: treeFor(model, excludeRoles) };\n}\n\n// Matched by id only: following renames through the alias chain is TP-187's identity work.\nexport function baselineValue(baseline: Baseline, id: string, name: string): number | null {\n const node = baseline.tree.byId.get(id);\n return node ? columnFor(baseline.model, baseline.tree, name).valueOf(node).value : null;\n}\n\n/** The result fields every baseline-aware command reports; `comparable` is false across index versions. */\nexport function baselineFields(current: ReadModel, baseline: Baseline | undefined): { baselineSnapshotId?: number; comparable?: boolean } {\n if (!baseline) return {};\n return {\n baselineSnapshotId: baseline.model.snapshot.id,\n comparable: baseline.model.snapshot.indexVersion === current.snapshot.indexVersion,\n };\n}\n\nexport function delta(value: number | null, before: number | null): number | null {\n return value !== null && before !== null ? value - before : null;\n}\n","import { EXCERPT_LINE_CAP, type SourceExcerpt } from \"./contract-findings.js\";\nimport type { Span } from \"./schemas.js\";\nimport type { SourceRead, SourceWindow } from \"./source.js\";\n\nexport interface ExcerptResult {\n excerpt: SourceExcerpt | null;\n missing?: string;\n}\n\ninterface Window {\n from: number;\n to: number;\n truncated: boolean;\n}\n\n/** The flagged lines plus `context` either side, clipped to the file; a whole-node finding starts at line 1. */\nexport function excerptWindow(ranges: readonly Span[], context: number, lineCount: number): Window {\n const from = ranges.length === 0 ? 1 : Math.max(1, Math.min(...ranges.map((r) => r.startLine)) - context);\n const wanted = ranges.length === 0 ? lineCount : Math.min(lineCount, Math.max(...ranges.map((r) => r.endLine)) + context);\n const to = Math.min(wanted, from + EXCERPT_LINE_CAP - 1);\n return { from, to, truncated: to < wanted };\n}\n\nfunction clipped(ranges: readonly Span[], from: number, to: number): Span[] {\n return ranges\n .filter((r) => r.endLine >= from && r.startLine <= to)\n .map((r) => ({ startLine: Math.max(r.startLine, from), endLine: Math.min(r.endLine, to) }));\n}\n\nfunction holds(window: SourceWindow, from: number, to: number): boolean {\n return from >= window.startLine && to <= window.startLine + window.lines.length - 1;\n}\n\n/** Cut an excerpt from what the source returned; a static window that misses the range says \"not-in-export\". */\nexport function buildExcerpt(read: SourceRead, ranges: readonly Span[], context: number): ExcerptResult {\n if (\"unavailable\" in read) return { excerpt: null, missing: read.unavailable };\n const { from, to, truncated } = excerptWindow(ranges, context, read.lineCount);\n if (to >= from && !holds(read, from, to)) return { excerpt: null, missing: \"not-in-export\" };\n const text = read.lines.slice(from - read.startLine, to - read.startLine + 1).join(\"\\n\");\n const excerpt: SourceExcerpt = {\n path: read.path,\n startLine: from,\n endLine: to,\n text,\n contentHash: read.contentHash,\n origin: read.origin,\n highlights: clipped(ranges, from, to),\n truncated,\n };\n return { excerpt };\n}\n","import type { CommandArgs, CommandResult } from \"./contract.js\";\nimport { refFor } from \"./finding-rows.js\";\nimport type { ModelEdge, ReadModel } from \"./model.js\";\nimport { columnFor } from \"./rollup.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport { invalidArgs, nodeNotFound, type ReadSource } from \"./source.js\";\nimport { treeFor, type Tree } from \"./tree.js\";\n\ntype NeighborsResult = CommandResult<\"node.neighbors\">;\ntype Neighbor = NeighborsResult[\"inbound\"][number];\n\ninterface Adjacency {\n inbound: ReadonlyMap<string, readonly ModelEdge[]>;\n outbound: ReadonlyMap<string, readonly ModelEdge[]>;\n}\n\nconst adjacencies = new WeakMap<ReadModel, Adjacency>();\n\nfunction push(map: Map<string, ModelEdge[]>, key: string, edge: ModelEdge): void {\n const list = map.get(key);\n if (list) list.push(edge);\n else map.set(key, [edge]);\n}\n\n/** Edges by destination and by source, built once per model. */\nexport function adjacencyOf(model: ReadModel): Adjacency {\n let adjacency = adjacencies.get(model);\n if (!adjacency) {\n const inbound = new Map<string, ModelEdge[]>();\n const outbound = new Map<string, ModelEdge[]>();\n for (const edge of model.edges) {\n push(inbound, edge.dstId, edge);\n push(outbound, edge.srcId, edge);\n }\n adjacencies.set(model, (adjacency = { inbound, outbound }));\n }\n return adjacency;\n}\n\nexport const weightOf = (edge: ModelEdge): number | null => (typeof edge.attrs.weight === \"number\" ? edge.attrs.weight : null);\n\nfunction valueOf(model: ReadModel, tree: Tree, id: string, name: string): number | null {\n const node = tree.byId.get(id);\n if (node) return columnFor(model, tree, name).valueOf(node).value;\n return model.metrics.get(name)?.get(id) ?? null;\n}\n\nfunction toNeighbor(model: ReadModel, tree: Tree, edge: ModelEdge, otherId: string, metrics: readonly string[]): Neighbor {\n const neighbor: Neighbor = { node: refFor(model, otherId), kind: edge.kind, weight: weightOf(edge), values: {} };\n if (typeof edge.attrs.specifier === \"string\") neighbor.specifier = edge.attrs.specifier;\n for (const name of metrics) neighbor.values[name] = valueOf(model, tree, otherId, name);\n return neighbor;\n}\n\n// Heaviest first, unweighted last, then by neighbour id and kind, so equal weights page the same way every time.\nfunction compareNeighbors(a: Neighbor, b: Neighbor): number {\n const [x, y] = [a.weight ?? -Infinity, b.weight ?? -Infinity];\n if (x !== y) return y - x;\n if (a.node.id !== b.node.id) return a.node.id < b.node.id ? -1 : 1;\n return a.kind < b.kind ? -1 : a.kind > b.kind ? 1 : 0;\n}\n\ntype EdgeFilter = (edge: ModelEdge) => boolean;\n\n// The design's default: `references` is the symbol layer, noise on a file's list but a symbol's only edges.\nfunction edgeFilter(kinds: readonly string[], nodeKind: string): EdgeFilter {\n if (kinds.length > 0) return (edge) => kinds.includes(edge.kind);\n return nodeKind === \"symbol\" ? () => true : (edge) => edge.kind !== \"references\";\n}\n\ninterface Side {\n rows: Neighbor[];\n total: number;\n}\n\ninterface Paging {\n keep: EdgeFilter;\n build: (edge: ModelEdge, otherId: string) => Neighbor;\n offset: number;\n limit: number;\n}\n\nfunction side(edges: readonly ModelEdge[] | undefined, other: (edge: ModelEdge) => string, p: Paging): Side {\n const all = (edges ?? []).filter(p.keep).map((e) => p.build(e, other(e))).sort(compareNeighbors);\n return { rows: all.slice(p.offset, p.offset + p.limit), total: all.length };\n}\n\n/** `node.neighbors`: a stored node's inbound and outbound edges, each side paged on its own. */\nexport function getNeighbors(source: ReadSource, args: CommandArgs<\"node.neighbors\">): NeighborsResult {\n const model = modelFor(source, args.snapshot);\n const tree = treeFor(model);\n const node = model.nodeById.get(args.id);\n if (!node && tree.byId.has(args.id)) throw invalidArgs(`${args.id} is synthesized; node.neighbors needs a stored node`);\n if (!node) throw nodeNotFound(args.id, model.snapshot.id);\n const { inbound, outbound } = adjacencyOf(model);\n const metrics = [...new Set(args.metrics)];\n const paging: Paging = {\n keep: edgeFilter(args.edge_kinds, node.kind),\n build: (e, id) => toNeighbor(model, tree, e, id, metrics),\n offset: args.offset,\n limit: args.limit,\n };\n const none: Side = { rows: [], total: 0 };\n const ins = args.direction === \"out\" ? none : side(inbound.get(node.id), (e) => e.srcId, paging);\n const outs = args.direction === \"in\" ? none : side(outbound.get(node.id), (e) => e.dstId, paging);\n return {\n snapshotId: model.snapshot.id,\n node: refFor(model, node.id),\n inbound: ins.rows,\n outbound: outs.rows,\n total: { inbound: ins.total, outbound: outs.total },\n };\n}\n","import type { Column } from \"./rollup.js\";\nimport type { Tree, TreeNode } from \"./tree.js\";\n\nexport interface PeerStats {\n /** Share of same-kind nodes in the snapshot whose value is at most this one, 0 to 100. */\n percentile: number | null;\n siblingMedian: number | null;\n /** 1 is the largest value among the siblings; ties share a rank. */\n siblingRank: number | null;\n /** Same-kind siblings with a value, the node included. */\n siblingCount: number;\n}\n\nconst sortedByKind = new WeakMap<Column, Map<string, number[]>>();\n\nfunction valuesOf(column: Column, nodes: Iterable<TreeNode>, kind: string): number[] {\n const out: number[] = [];\n for (const node of nodes) {\n if (node.ref.kind !== kind) continue;\n const { value } = column.valueOf(node);\n if (value !== null) out.push(value);\n }\n return out;\n}\n\nfunction sortedPeers(column: Column, tree: Tree, kind: string): number[] {\n let byKind = sortedByKind.get(column);\n if (!byKind) sortedByKind.set(column, (byKind = new Map()));\n let sorted = byKind.get(kind);\n if (!sorted) byKind.set(kind, (sorted = valuesOf(column, tree.byId.values(), kind).sort((a, b) => a - b)));\n return sorted;\n}\n\n/** Count of sorted values at most `value`, by binary search. */\nfunction countAtMost(sorted: readonly number[], value: number): number {\n let lo = 0;\n let hi = sorted.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (sorted[mid]! <= value) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n}\n\nfunction median(values: readonly number[]): number | null {\n if (values.length === 0) return null;\n const sorted = [...values].sort((a, b) => a - b);\n const mid = sorted.length >>> 1;\n return sorted.length % 2 === 1 ? sorted[mid]! : (sorted[mid - 1]! + sorted[mid]!) / 2;\n}\n\nconst round1 = (n: number): number => Math.round(n * 10) / 10;\n\n/** Where a node's value sits among every same-kind node and among its same-kind siblings. */\nexport function peerStats(column: Column, tree: Tree, node: TreeNode, value: number | null): PeerStats {\n const parent = node.parentId === null ? undefined : tree.byId.get(node.parentId);\n const siblings = valuesOf(column, parent ? parent.children : [node], node.ref.kind);\n if (value === null) return { percentile: null, siblingMedian: median(siblings), siblingRank: null, siblingCount: siblings.length };\n const peers = sortedPeers(column, tree, node.ref.kind);\n return {\n percentile: peers.length === 0 ? null : round1((100 * countAtMost(peers, value)) / peers.length),\n siblingMedian: median(siblings),\n siblingRank: 1 + siblings.filter((v) => v > value).length,\n siblingCount: siblings.length,\n };\n}\n","import { baselineFields, baselineValue, openBaseline, type Baseline } from \"./baseline.js\";\nimport type { Finding } from \"./contract-findings.js\";\nimport type { CommandArgs, CommandResult } from \"./contract.js\";\nimport { buildExcerpt, type ExcerptResult } from \"./excerpt.js\";\nimport { compareFindings, findingsFor, withStatus } from \"./finding-rows.js\";\nimport type { ModelRule, ReadModel } from \"./model.js\";\nimport { adjacencyOf } from \"./neighbors.js\";\nimport { columnFor } from \"./rollup.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport { findingNotFound, type ReadSource } from \"./source.js\";\nimport { peerStats } from \"./stats.js\";\nimport { treeFor } from \"./tree.js\";\n\ntype GetResult = CommandResult<\"finding.get\">;\n\n/** Findings shown beside the one asked for: the same node's, then the same rule's on graph neighbours. */\nexport const RELATED_CAP = 10;\n\nfunction measure(model: ReadModel, finding: Finding, baseline?: Baseline): GetResult[\"measured\"] {\n const measured: GetResult[\"measured\"] = {\n value: finding.value ?? null,\n threshold: finding.threshold ?? null,\n percentile: null,\n siblingMedian: null,\n };\n const tree = treeFor(model);\n const node = tree.byId.get(finding.node.id);\n const metric = finding.metric;\n if (node && metric !== undefined && model.metrics.has(metric)) {\n const column = columnFor(model, tree, metric);\n const stats = peerStats(column, tree, node, column.valueOf(node).value);\n measured.percentile = stats.percentile;\n measured.siblingMedian = stats.siblingMedian;\n }\n if (baseline && metric !== undefined) measured.baselineValue = baselineValue(baseline, finding.node.id, metric);\n return measured;\n}\n\nfunction neighbourIds(model: ReadModel, id: string): Set<string> {\n const { inbound, outbound } = adjacencyOf(model);\n const ids = new Set<string>();\n for (const e of inbound.get(id) ?? []) if (e.kind !== \"references\") ids.add(e.srcId);\n for (const e of outbound.get(id) ?? []) if (e.kind !== \"references\") ids.add(e.dstId);\n return ids;\n}\n\nfunction relatedTo(model: ReadModel, rows: readonly Finding[], finding: Finding): Finding[] {\n const near = neighbourIds(model, finding.node.id);\n const order = compareFindings(\"severity\", \"desc\");\n const sameNode = rows.filter((f) => f.id !== finding.id && f.node.id === finding.node.id).sort(order);\n const sameRule = rows.filter((f) => f.rule === finding.rule && f.node.id !== finding.node.id && near.has(f.node.id)).sort(order);\n return [...sameNode, ...sameRule].slice(0, RELATED_CAP);\n}\n\n// Picked field by field, so a rule's tier config never rides along into the finding.\nfunction ruleOf(model: ReadModel, finding: Finding): ModelRule {\n const rule = model.rules.find((r) => r.id === finding.rule);\n if (!rule) return { id: finding.rule, type: \"unknown\", severity: finding.severity, text: \"\" };\n return { id: rule.id, type: rule.type, severity: rule.severity, text: rule.text };\n}\n\nfunction excerptOf(source: ReadSource, model: ReadModel, finding: Finding, context: number): ExcerptResult {\n if (!source.readSource) return { excerpt: null, missing: \"no-source\" };\n const stored = model.findings.find((f) => f.id === finding.id);\n return buildExcerpt(source.readSource(model.snapshot.id, finding.node.path), stored?.ranges ?? [], context);\n}\n\n/** `finding.get`: one finding with its rule, numbers in context, the flagged source, and related findings. */\nexport function getFinding(source: ReadSource, args: CommandArgs<\"finding.get\">): GetResult {\n const model = modelFor(source, args.snapshot);\n const baseline = openBaseline(source, args.baseline);\n const current = findingsFor(model);\n const rows = baseline ? withStatus(current, findingsFor(baseline.model)).filter((f) => f.status !== \"resolved\") : current;\n const finding = rows.find((f) => f.id === args.id);\n if (!finding) throw findingNotFound(args.id, model.snapshot.id);\n const rule = ruleOf(model, finding);\n const { excerpt, missing } = excerptOf(source, model, finding, args.context_lines);\n const result: GetResult = {\n snapshotId: model.snapshot.id,\n ...baselineFields(model, baseline),\n finding,\n rule,\n measured: measure(model, finding, baseline),\n why: rule.text ? `${rule.text} Here: ${finding.message}.` : finding.message,\n excerpt,\n related: relatedTo(model, rows, finding),\n };\n if (missing !== undefined) result.excerptMissing = missing;\n return result;\n}\n","import { baselineFields, openBaseline } from \"./baseline.js\";\nimport type { Finding } from \"./contract-findings.js\";\nimport type { CommandArgs, CommandResult } from \"./contract.js\";\nimport { compareFindings, findingsFor, withStatus } from \"./finding-rows.js\";\nimport type { NodeRef } from \"./schemas.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport { invalidArgs, nodeNotFound, type ReadSource } from \"./source.js\";\nimport { REPO_ID, directoryId, treeFor, type TreeNode } from \"./tree.js\";\n\ntype ListArgs = CommandArgs<\"findings.list\">;\ntype ListResult = CommandResult<\"findings.list\">;\n\n/** What a scope holds and how its findings split among its children. */\ninterface Scope {\n contains(ref: NodeRef): boolean;\n childOf(ref: NodeRef): string;\n}\n\nfunction childUnder(prefix: string, ref: NodeRef): string {\n if (ref.kind === \"external\" || !ref.path.startsWith(prefix)) return ref.id;\n const rest = ref.path.slice(prefix.length);\n const slash = rest.indexOf(\"/\");\n return slash < 0 ? ref.path : directoryId(prefix + rest.slice(0, slash));\n}\n\n// A symbol's path is its declaring file, so a file scope holds its symbols' findings too.\nfunction scopeOf(node: TreeNode): Scope {\n const { kind, id, path } = node.ref;\n if (kind === \"repo\") return { contains: () => true, childOf: (ref) => childUnder(\"\", ref) };\n if (kind === \"directory\") {\n const prefix = `${path}/`;\n return { contains: (ref) => ref.path.startsWith(prefix), childOf: (ref) => childUnder(prefix, ref) };\n }\n if (kind === \"file\") return { contains: (ref) => ref.path === id, childOf: (ref) => ref.id };\n return { contains: (ref) => ref.id === id || ref.id.startsWith(`${id}.`), childOf: (ref) => ref.id };\n}\n\ntype Filter = (f: Finding) => boolean;\n\nfunction oneOf<T>(allowed: readonly T[], pick: (f: Finding) => T | undefined): Filter {\n if (allowed.length === 0) return () => true;\n const set = new Set(allowed);\n return (f) => {\n const value = pick(f);\n return value !== undefined && set.has(value);\n };\n}\n\nfunction filtersFor(args: ListArgs, scope: Scope): Filter[] {\n return [\n (f) => scope.contains(f.node),\n oneOf(args.rule, (f) => f.rule),\n oneOf(args.severity, (f) => f.severity),\n oneOf(args.tool, (f) => f.tool),\n oneOf(args.provenance, (f) => f.provenance.kind),\n oneOf(args.kind, (f) => f.node.kind),\n oneOf(args.status, (f) => f.status),\n ];\n}\n\nconst FACETS: Record<string, (f: Finding, scope: Scope) => string | undefined> = {\n rule: (f) => f.rule,\n severity: (f) => f.severity,\n tool: (f) => f.tool,\n provenance: (f) => f.provenance.kind,\n kind: (f) => f.node.kind,\n child: (f, scope) => scope.childOf(f.node),\n status: (f) => f.status,\n};\n\nfunction sortedCounts(counts: Map<string, number>): Record<string, number> {\n return Object.fromEntries([...counts].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)));\n}\n\n/** Counts per facet over every kept row, so each facet's counts sum to `total`; `status` only with a baseline. */\nfunction facetCounts(rows: readonly Finding[], scope: Scope, withBaseline: boolean): Record<string, Record<string, number>> {\n const out: Record<string, Record<string, number>> = {};\n for (const [name, pick] of Object.entries(FACETS)) {\n if (name === \"status\" && !withBaseline) continue;\n const counts = new Map<string, number>();\n for (const f of rows) {\n const value = pick(f, scope) ?? \"\";\n counts.set(value, (counts.get(value) ?? 0) + 1);\n }\n out[name] = sortedCounts(counts);\n }\n return out;\n}\n\n/** `findings.list`: a snapshot's findings, filtered, ordered by a total order, and cut to one page. */\nexport function listFindings(source: ReadSource, args: ListArgs): ListResult {\n const model = modelFor(source, args.snapshot);\n const baseline = openBaseline(source, args.baseline);\n if (args.status.length > 0 && !baseline) throw invalidArgs(\"status needs a baseline\");\n const root = treeFor(model).byId.get(args.scope ?? REPO_ID);\n if (!root) throw nodeNotFound(args.scope ?? REPO_ID, model.snapshot.id);\n const scope = scopeOf(root);\n const all = baseline ? withStatus(findingsFor(model), findingsFor(baseline.model)) : findingsFor(model);\n const filters = filtersFor(args, scope);\n const kept = all.filter((f) => filters.every((keep) => keep(f))).sort(compareFindings(args.sort, args.order));\n const result: ListResult = {\n snapshotId: model.snapshot.id,\n ...baselineFields(model, baseline),\n rows: kept.slice(args.offset, args.offset + args.limit),\n total: kept.length,\n };\n if (args.facets) result.facets = facetCounts(kept, scope, baseline !== undefined);\n return result;\n}\n","import { HIERARCHY_ROW_CAP } from \"./contract-nodes.js\";\nimport type { CommandArgs, CommandResult } from \"./contract.js\";\nimport { baselineFields, baselineValue, delta, openBaseline, type Baseline } from \"./baseline.js\";\nimport { columnFor, type Column } from \"./rollup.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport { nodeNotFound, type ReadSource } from \"./source.js\";\nimport { REPO_ID, treeFor, type TreeNode } from \"./tree.js\";\n\ntype HierarchyResult = CommandResult<\"hierarchy.get\">;\ntype HierarchyRow = HierarchyResult[\"nodes\"][number];\n\n/** Breadth-first to `depth`, so a truncated answer keeps the levels a treemap draws first. */\nfunction collectRows(root: TreeNode, depth: number, includeSymbols: boolean): { rows: TreeNode[]; truncated: boolean } {\n const rows: TreeNode[] = [];\n const queue: TreeNode[] = [root];\n for (let i = 0; i < queue.length; i++) {\n const node = queue[i]!;\n if (rows.length === HIERARCHY_ROW_CAP) return { rows, truncated: true };\n rows.push(node);\n if (node.depth - root.depth >= depth) continue;\n for (const child of node.children) if (includeSymbols || child.ref.kind !== \"symbol\") queue.push(child);\n }\n return { rows, truncated: false };\n}\n\nfunction toRow(node: TreeNode, rootDepth: number, columns: readonly Column[], names: readonly string[], baseline?: Baseline): HierarchyRow {\n const row: HierarchyRow = { ...node.ref, parentId: node.parentId, depth: node.depth - rootDepth, childCount: node.children.length, values: {} };\n if (node.stored?.role !== undefined) row.role = node.stored.role;\n const missing: Record<string, string> = {};\n const deltas: Record<string, number | null> = {};\n names.forEach((name, i) => {\n const { value, missing: reason } = columns[i]!.valueOf(node);\n row.values[name] = value;\n if (reason) missing[name] = reason;\n if (!baseline) return;\n deltas[name] = delta(value, baselineValue(baseline, node.ref.id, name));\n });\n if (Object.keys(missing).length > 0) row.missing = missing;\n if (baseline) row.deltas = deltas;\n return row;\n}\n\n/** `hierarchy.get`: a flat, shallowest-first slice of the synthesized tree with per-row metric values. */\nexport function getHierarchy(source: ReadSource, args: CommandArgs<\"hierarchy.get\">): HierarchyResult {\n const model = modelFor(source, args.snapshot);\n const tree = treeFor(model, args.exclude_roles);\n const root = tree.byId.get(args.root ?? REPO_ID);\n if (!root) throw nodeNotFound(args.root ?? REPO_ID, model.snapshot.id);\n const baseline = openBaseline(source, args.baseline, args.exclude_roles);\n const names = [...new Set(args.metrics)];\n const columns = names.map((name) => columnFor(model, tree, name));\n const { rows, truncated } = collectRows(root, args.depth, args.include_symbols);\n const nodes = rows.map((node) => toRow(node, root.depth, columns, names, baseline));\n return { snapshotId: model.snapshot.id, ...baselineFields(model, baseline), nodes, truncated };\n}\n","import {\n buildHotExports,\n collectNodeMetrics,\n collectSymbolUtil,\n computeSymbolConsumers,\n linkTestsToSources,\n topCentralFiles,\n type CentralRow,\n type NodeMetrics,\n type SymbolUtil,\n type TestSourceLink,\n} from \"@titan-design/code-graph/analysis\";\nimport type { CommandArgs } from \"./contract.js\";\nimport type { NodeLens, NodeLenses } from \"./contract-node-lenses.js\";\nimport { inputsFor, reportContext, scoredRows } from \"./hotspots.js\";\nimport type { ReadModel } from \"./model.js\";\nimport { toRef, type TreeNode } from \"./tree.js\";\n\ntype LensArgs = Pick<CommandArgs<\"node.get\">, \"lenses\" | \"window\">;\ntype CentralInput = Parameters<typeof topCentralFiles>;\n\ninterface SymbolFacts {\n metrics: ReadonlyMap<string, NodeMetrics>;\n symbols: readonly SymbolUtil[];\n consumers: ReadonlyMap<string, number>;\n}\n\n/** One derivation per snapshot model: snapshots are immutable, so the whole-graph work is done once. */\nfunction perModel<T>(derive: (model: ReadModel) => T): (model: ReadModel) => T {\n const cache = new WeakMap<ReadModel, T>();\n return (model) => {\n if (!cache.has(model)) cache.set(model, derive(model));\n return cache.get(model)!;\n };\n}\n\n/** Every file code-graph's reading order keeps, most central first; files and structural edges only. */\nexport const centralFiles = perModel((model): CentralRow[] => {\n const nodes = inputsFor(model).nodes.filter((n) => n.kind !== \"symbol\");\n const edges = model.edges.filter((e) => e.kind !== \"references\" && e.kind !== \"calls\") as CentralInput[1];\n // keepNode reads no churn, so any window gives the same ranking.\n return topCentralFiles(nodes, edges, reportContext(model, \"lifetime\"), Infinity);\n});\n\nconst symbolFacts = perModel((model): SymbolFacts => {\n const { nodes, metrics: rows } = inputsFor(model);\n const metrics = collectNodeMetrics([...rows]);\n const references = model.edges.filter((e) => e.kind === \"references\");\n const consumers = new Map(computeSymbolConsumers(references).map((s) => [s.symbolId, s.consumers.length]));\n return { metrics, symbols: collectSymbolUtil(nodes, metrics), consumers };\n});\n\n// Without stored co-change pairs only the path-convention pass can link a test.\nconst testLinks = perModel((model): TestSourceLink[] => linkTestsToSources(inputsFor(model).nodes, []));\n\nfunction exportsOf(model: ReadModel, fileId: string): NodeLenses[\"exports\"] {\n const { metrics, symbols, consumers } = symbolFacts(model);\n const declared = symbols.filter((s) => s.fileId === fileId);\n const rows = buildHotExports(declared, new Set([fileId]), metrics, consumers)[fileId] ?? [];\n return rows.map((r) => ({ name: r.name, utilization: r.utilization, cognitive: r.cognitive ?? null, consumers: r.consumers, exported: r.exported }));\n}\n\nfunction scoreOf(model: ReadModel, node: TreeNode, window: string): NodeLenses[\"score\"] {\n const grain = node.ref.kind;\n if (grain !== \"file\" && grain !== \"symbol\") return null;\n const rows = scoredRows(model, { grain, window });\n const at = rows.findIndex((r) => r.nodeId === node.ref.id);\n if (at < 0) return { grain, window, score: 0, rank: null, ranked: rows.length };\n const { score, churn, complexity, recency, utilization } = rows[at]!;\n const factors = utilization === undefined ? { churn, complexity, recency } : { churn, complexity, recency, utilization };\n return { grain, window, score, ...factors, rank: at + 1, ranked: rows.length };\n}\n\nfunction centralityOf(model: ReadModel, fileId: string): NodeLenses[\"centrality\"] {\n const rows = centralFiles(model);\n const at = rows.findIndex((r) => r.nodeId === fileId);\n return { score: at < 0 ? null : rows[at]!.score, rank: at < 0 ? null : at + 1, of: rows.length };\n}\n\nfunction testsOf(model: ReadModel, fileId: string): NodeLenses[\"tests\"] {\n const tests = testLinks(model)\n .filter((l) => l.sourceId === fileId)\n .map((l) => toRef(model.nodeById.get(l.testId)!));\n const counts = model.metrics.get(\"linked_test_count\");\n const indexedCount = counts ? (counts.get(fileId) ?? 0) : null;\n return { tests, indexedCount, coEditMeasured: false };\n}\n\nfunction lensOf(model: ReadModel, node: TreeNode, lens: NodeLens, window: string): NodeLenses[NodeLens] {\n if (lens === \"score\") return scoreOf(model, node, window);\n if (node.ref.kind !== \"file\") return null;\n const id = node.ref.id;\n if (lens === \"exports\") return exportsOf(model, id);\n if (lens === \"centrality\") return centralityOf(model, id);\n if (lens === \"tests\") return testsOf(model, id);\n // Co-change pairs are not stored in the index yet, so coupled partners cannot be measured here.\n return { measured: false, partners: [] };\n}\n\n/** The requested lenses on one node, keyed by lens. */\nexport function lensesFor(model: ReadModel, node: TreeNode, args: LensArgs): NodeLenses {\n return Object.fromEntries(args.lenses.map((lens) => [lens, lensOf(model, node, lens, args.window)]));\n}\n","import type { CommandArgs, CommandResult } from \"./contract.js\";\nimport { baselineFields, baselineValue, delta, openBaseline, type Baseline } from \"./baseline.js\";\nimport type { ReadModel } from \"./model.js\";\nimport { lensesFor } from \"./node-lenses.js\";\nimport { columnFor, describesKind } from \"./rollup.js\";\nimport type { NodeRef } from \"./schemas.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport { nodeNotFound, type ReadSource } from \"./source.js\";\nimport { peerStats } from \"./stats.js\";\nimport { treeFor, type Tree, type TreeNode } from \"./tree.js\";\n\ntype NodeGetResult = CommandResult<\"node.get\">;\ntype NodeMetric = NodeGetResult[\"metrics\"][number];\n\nfunction ancestorsOf(tree: Tree, node: TreeNode): NodeRef[] {\n const chain: NodeRef[] = [];\n for (let id = node.parentId; id !== null; ) {\n const parent = tree.byId.get(id)!;\n chain.push(parent.ref);\n id = parent.parentId;\n }\n return chain.reverse();\n}\n\nfunction childCounts(node: TreeNode): Record<string, number> {\n const counts: Record<string, number> = {};\n for (const child of node.children) counts[child.ref.kind] = (counts[child.ref.kind] ?? 0) + 1;\n return counts;\n}\n\nfunction describeNode(node: TreeNode): NodeGetResult[\"node\"] {\n const out: NodeGetResult[\"node\"] = { ...node.ref };\n const stored = node.stored;\n if (!stored) return out;\n if (stored.language !== undefined) out.language = stored.language;\n if (stored.role !== undefined) out.role = stored.role;\n const { exported, signature, purpose } = stored.attrs;\n if (typeof exported === \"boolean\") out.exported = exported;\n if (typeof signature === \"string\") out.signature = signature;\n if (typeof purpose === \"string\") out.purpose = purpose;\n return out;\n}\n\nfunction metricNames(model: ReadModel, kind: string, requested: readonly string[]): string[] {\n if (requested.length > 0) return [...new Set(requested)];\n return model.metricCatalogue.filter((d) => describesKind(d, kind)).map((d) => d.name);\n}\n\nfunction measure(model: ReadModel, tree: Tree, node: TreeNode, name: string, baseline?: Baseline): NodeMetric {\n const column = columnFor(model, tree, name);\n const { value, missing } = column.valueOf(node);\n const d = column.descriptor;\n const metric: NodeMetric = {\n name,\n unit: d?.unit ?? null,\n direction: d?.direction ?? \"neutral\",\n rollup: d?.rollup ?? \"none\",\n value,\n ...(missing ? { missing } : {}),\n ...peerStats(column, tree, node, value),\n };\n if (!baseline) return metric;\n metric.baseline = baselineValue(baseline, node.ref.id, name);\n metric.delta = delta(value, metric.baseline);\n return metric;\n}\n\n/** `node.get`: one node of the synthesized hierarchy with its numbers in context. */\nexport function getNode(source: ReadSource, args: CommandArgs<\"node.get\">): NodeGetResult {\n const model = modelFor(source, args.snapshot);\n const tree = treeFor(model);\n const node = tree.byId.get(args.id);\n if (!node) throw nodeNotFound(args.id, model.snapshot.id);\n const baseline = openBaseline(source, args.baseline);\n return {\n snapshotId: model.snapshot.id,\n ...baselineFields(model, baseline),\n node: describeNode(node),\n ancestors: ancestorsOf(tree, node),\n childCounts: childCounts(node),\n metrics: metricNames(model, node.ref.kind, args.metrics).map((name) => measure(model, tree, node, name, baseline)),\n ...(args.lenses.length > 0 ? { lenses: lensesFor(model, node, args) } : {}),\n };\n}\n","import {\n computeHealth,\n topBusFactorRisks,\n type HealthWeights,\n type HotspotRow,\n} from \"@titan-design/code-graph/analysis\";\nimport { baselineFields, openBaseline, type Baseline } from \"./baseline.js\";\nimport type { CommandArgs, CommandResult } from \"./contract.js\";\nimport type { AttentionSignal, LookFirstRow, ReadingOrderRow } from \"./contract-overview.js\";\nimport type { Finding } from \"./contract-findings.js\";\nimport { findingsFor, withStatus } from \"./finding-rows.js\";\nimport { reportContext, scoredRows } from \"./hotspots.js\";\nimport type { ReadModel } from \"./model.js\";\nimport { centralFiles } from \"./node-lenses.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport type { ReadSource } from \"./source.js\";\nimport { toRef } from \"./tree.js\";\n\ntype OverviewArgs = CommandArgs<\"overview.get\">;\ntype OverviewResult = CommandResult<\"overview.get\">;\ntype Kpis = OverviewResult[\"kpis\"];\n\n// Co-change pairs are not stored in the index yet, so hidden coupling cannot be measured here.\nconst UNMEASURED = new Set<AttentionSignal[\"key\"]>([\"hidden-coupling\"]);\n\n/** Findings with a status when there is a baseline; without one every open finding counts as carried over. */\nfunction findingRows(model: ReadModel, baseline: Baseline | undefined): Finding[] {\n const current = findingsFor(model);\n return baseline ? withStatus(current, findingsFor(baseline.model)) : current.map((f) => ({ ...f, status: \"carryover\" }));\n}\n\nfunction findingCounts(rows: readonly Finding[], withBaseline: boolean): Kpis[\"findings\"] {\n const count = (status: Finding[\"status\"]): number => rows.filter((f) => f.status === status).length;\n const open = rows.length - count(\"resolved\");\n if (!withBaseline) return { open };\n return { open, new: count(\"new\"), carryover: open - count(\"new\"), resolved: count(\"resolved\") };\n}\n\nfunction toWeights(w: OverviewArgs[\"weights\"]): HealthWeights {\n return {\n hotspots: w.hotspots,\n findings: { eachNew: w.findings.each_new, eachCarry: w.findings.each_carry, cap: w.findings.cap },\n complexity: w.complexity,\n hiddenCoupling: w.hidden_coupling,\n };\n}\n\nfunction signals(args: OverviewArgs, kpis: Kpis, findings: readonly Finding[]): { signals: AttentionSignal[]; combined: number } {\n const excluded = new Set(args.exclude_rules);\n const counted = findings.filter((f) => f.status !== \"resolved\" && !excluded.has(f.rule));\n const newCount = counted.filter((f) => f.status === \"new\").length;\n const input = {\n scary: kpis.hotspotsOverCutoff,\n newViolations: newCount,\n carryViolations: counted.length - newCount,\n maxComplexity: kpis.maxComplexity,\n hiddenCoupling: 0,\n scaryCutoff: args.cutoff,\n };\n const { health, healthBreakdown } = computeHealth(input, toWeights(args.weights));\n return { signals: healthBreakdown.map((c) => ({ ...c, measured: !UNMEASURED.has(c.key) })), combined: health };\n}\n\nfunction readingOrder(model: ReadModel, limit: number): ReadingOrderRow[] {\n return centralFiles(model)\n .slice(0, limit)\n .map((r) => ({ node: toRef(model.nodeById.get(r.nodeId)!), centrality: r.score }));\n}\n\nfunction lookFirst(model: ReadModel, hotspots: readonly HotspotRow[], findings: readonly Finding[], args: OverviewArgs): LookFirstRow[] {\n const flagged = new Set(findings.filter((f) => f.status !== \"resolved\").map((f) => f.node.path));\n return hotspots.slice(0, args.look_limit).map((h) => {\n const reasons: LookFirstRow[\"reasons\"] = [];\n if (h.score >= args.cutoff) reasons.push(\"over-cutoff\");\n if (flagged.has(h.nodeId)) reasons.push(\"findings\");\n const { score, churn, complexity, recency } = h;\n const node = toRef(model.nodeById.get(h.nodeId)!);\n return { node, score, churn, complexity, recency, reasons: reasons.length > 0 ? reasons : [\"churn-complexity\"] };\n });\n}\n\n/** `overview.get`: KPIs, weighted attention signals, the reading order, and where to look first, for one snapshot. */\nexport function getOverview(source: ReadSource, args: OverviewArgs): OverviewResult {\n const model = modelFor(source, args.snapshot);\n const baseline = openBaseline(source, args.baseline);\n const ctx = reportContext(model, args.window);\n const hotspots = scoredRows(model, { grain: \"file\", window: args.window });\n const findings = findingRows(model, baseline);\n const kpis: Kpis = {\n hotspotsOverCutoff: hotspots.filter((h) => h.score >= args.cutoff).length,\n maxComplexity: hotspots.reduce((max, h) => Math.max(max, h.complexity), 0),\n knowledgeSilos: topBusFactorRisks(ctx, Infinity).length,\n findings: findingCounts(findings, baseline !== undefined),\n };\n const { signals: attention, combined } = signals(args, kpis, findings);\n return {\n snapshotId: model.snapshot.id,\n ...baselineFields(model, baseline),\n kpis,\n signals: attention,\n ...(args.combined ? { combined } : {}),\n readingOrder: readingOrder(model, args.reading_limit),\n lookFirst: lookFirst(model, hotspots, findings, args),\n };\n}\n","import {\n bucketFilesByPackage,\n computePartitionQuality,\n filteredFileIds,\n type PackageRoot,\n type PackageStats,\n type PartitionQualityInput,\n} from \"@titan-design/code-graph/analysis\";\nimport type { CommandArgs, CommandResult } from \"./contract.js\";\nimport type { PackageLayer, PackageStatsRow } from \"./contract-packages.js\";\nimport { inputsFor } from \"./hotspots.js\";\nimport type { ModelRule, ReadModel } from \"./model.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport type { ReadSource } from \"./source.js\";\n\ntype StatsArgs = CommandArgs<\"packages.stats\">;\ntype StatsResult = CommandResult<\"packages.stats\">;\ntype Declared = Extract<PackageLayer, { status: \"declared\" }>;\ntype GraphEdgeLike = PartitionQualityInput[\"edges\"][number];\n\n// codewatch's arch view reads the store's default edge layer, which leaves these kinds out.\nconst NON_STRUCTURAL = new Set([\"references\", \"calls\"]);\nconst UNDECLARED: PackageLayer = { status: \"undeclared\" };\n\nconst trimRoot = (id: string): string => id.replace(/\\/+$/, \"\");\n\n/** Package root to its tier; a root two rules name keeps the first rule's tier. */\nexport function declaredTiers(rules: readonly ModelRule[]): Map<string, Declared> {\n const out = new Map<string, Declared>();\n for (const rule of rules) {\n rule.layers?.forEach((tier, i) => {\n for (const id of tier.map(trimRoot)) if (!out.has(id)) out.set(id, { status: \"declared\", tier: i, rule: rule.id });\n });\n }\n return out;\n}\n\nfunction packageRoots(args: StatsArgs, tiers: ReadonlyMap<string, Declared>): Pick<StatsResult, \"packagesFrom\"> & { roots: PackageRoot[] } {\n const ids = [...new Set((args.packages ?? [...tiers.keys()]).map(trimRoot))].filter((id) => id !== \"\").sort();\n const packagesFrom = args.packages ? \"args\" : ids.length > 0 ? \"tiers\" : \"none\";\n return { packagesFrom, roots: ids.map((id) => ({ id, name: id.slice(id.lastIndexOf(\"/\") + 1) })) };\n}\n\nfunction structuralEdges(model: ReadModel): GraphEdgeLike[] {\n return model.edges\n .filter((e) => !NON_STRUCTURAL.has(e.kind))\n .map((e) => ({ srcId: e.srcId, dstId: e.dstId, kind: e.kind as GraphEdgeLike[\"kind\"], attrs: e.attrs }));\n}\n\nfunction toRow(stats: PackageStats, name: string, layer: PackageLayer): PackageStatsRow {\n const { pkgId, layer: band, flags, ...measures } = stats;\n return { id: pkgId, name, ...measures, band, flags: [...flags], layer };\n}\n\n/** `packages.stats`: code-graph's partition quality over the package roots, each with its declared tier. */\nexport function packagesStats(source: ReadSource, args: StatsArgs): StatsResult {\n const model = modelFor(source, args.snapshot);\n const tiers = declaredTiers(model.rules);\n const { packagesFrom, roots } = packageRoots(args, tiers);\n const { nodes } = inputsFor(model);\n const fileByPackage = bucketFilesByPackage(filteredFileIds(nodes, {}), roots);\n const quality = computePartitionQuality({ packages: roots, fileByPackage, nodes, edges: structuralEdges(model) });\n const names = new Map(roots.map((r) => [r.id, r.name]));\n return {\n snapshotId: model.snapshot.id,\n packagesFrom,\n modularity: quality.modularityQ,\n totalEdges: quality.totalEdges,\n unassignedFiles: fileByPackage.get(\"\")?.length ?? 0,\n packages: quality.perPackage.map((p) => toRow(p, names.get(p.pkgId)!, tiers.get(p.pkgId) ?? UNDECLARED)),\n crossEdges: quality.pairCoupling.map((c) => ({ ...c })),\n };\n}\n","import { hotspotComplexityOf, hotspotScoreOf, type ReportContext, type ViolationBuckets } from \"@titan-design/code-graph/analysis\";\nimport { baselineFields, delta, openBaseline } from \"./baseline.js\";\nimport { bucketFindings, type Keyed } from \"./changes.js\";\nimport type { CommandArgs, CommandResult } from \"./contract.js\";\nimport type { Finding, FindingStatus } from \"./contract-findings.js\";\nimport type { FindingDelta, ImpactRollup, PathDelta, PathHotspot, PathImpact } from \"./contract-paths-impact.js\";\nimport { compareFindings, findingsFor } from \"./finding-rows.js\";\nimport { reportContext, scoredRows } from \"./hotspots.js\";\nimport type { ReadModel } from \"./model.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport { invalidArgs, type ReadSource } from \"./source.js\";\nimport { toRef } from \"./tree.js\";\n\ntype ImpactArgs = CommandArgs<\"paths.impact\">;\ntype ImpactResult = CommandResult<\"paths.impact\">;\ntype Indexed = Extract<PathImpact, { status: \"indexed\" }>;\n\ninterface Side {\n model: ReadModel;\n ctx: ReportContext;\n hotspots: ReadonlyMap<string, PathHotspot>;\n}\n\ninterface Comparison {\n baseline: Side;\n status: ReadonlyMap<string, FindingStatus>;\n findings: ReadonlyMap<string, FindingDelta>;\n}\n\ninterface Reading {\n current: Side;\n open: ReadonlyMap<string, Finding[]>;\n /** Undefined without a baseline; null when the baseline is not comparable. */\n comparison: Comparison | null | undefined;\n}\n\nconst WORST_FIRST = compareFindings(\"severity\", \"desc\");\n\n/** Repo-relative form of a path, or null when it lies outside the repo. Absolute paths count only under `root`. */\nexport function repoRelative(input: string, root: string | undefined): string | null {\n const rel = underRoot(input, root);\n if (rel === null) return null;\n const parts: string[] = [];\n for (const segment of rel.split(\"/\")) {\n if (segment === \"\" || segment === \".\") continue;\n if (segment !== \"..\") parts.push(segment);\n else if (parts.pop() === undefined) return null;\n }\n return parts.join(\"/\");\n}\n\nfunction underRoot(input: string, root: string | undefined): string | null {\n if (!input.startsWith(\"/\")) return input;\n if (root === undefined) return null;\n const base = root.replace(/\\/+$/, \"\");\n if (input === base) return \"\";\n return input.startsWith(`${base}/`) ? input.slice(base.length + 1) : null;\n}\n\nconst trimmed = (dir: string): string => dir.replace(/\\/+$/, \"\");\n\n/** A root above the index's repo root would read every path as a different repo's file, so it is refused. */\nfunction checkRoot(root: string | undefined, repoRoot: string | null | undefined): void {\n if (root === undefined || !repoRoot) return;\n const base = trimmed(repoRoot);\n const given = trimmed(root);\n if (given !== base && `${base}/`.startsWith(`${given}/`)) {\n throw invalidArgs(`root \"${root}\" is above the index's repo root; give the repo, or a checkout of it, as root`);\n }\n}\n\nconst isFile = (model: ReadModel, id: string): boolean => model.nodeById.get(id)?.kind === \"file\";\n\n/** The ranking `hotspots.list` returns at the file grain, so a rank here is a row number there. */\nfunction sideOf(model: ReadModel, window: string): Side {\n const rows = scoredRows(model, { grain: \"file\", window });\n const hotspots = new Map(rows.map((r, i) => [r.nodeId, { score: r.score, rank: i + 1 }]));\n return { model, ctx: reportContext(model, window), hotspots };\n}\n\nfunction openByFile(model: ReadModel): Map<string, Finding[]> {\n const out = new Map<string, Finding[]>();\n for (const f of findingsFor(model)) {\n const rows = out.get(f.node.path);\n if (rows) rows.push(f);\n else out.set(f.node.path, [f]);\n }\n for (const rows of out.values()) rows.sort(WORST_FIRST);\n return out;\n}\n\nfunction statuses(buckets: ViolationBuckets<Keyed>): Map<string, FindingStatus> {\n const status = new Map<string, FindingStatus>();\n for (const u of buckets.unchanged) status.set(u.to.row.id, \"carryover\");\n for (const u of buckets.worsened) status.set(u.to.row.id, \"worsened\");\n for (const u of buckets.improved) status.set(u.to.row.id, \"improved\");\n for (const v of buckets.newViolations) status.set(v.row.id, \"new\");\n return status;\n}\n\nfunction findingDeltas(buckets: ViolationBuckets<Keyed>): Map<string, FindingDelta> {\n const out = new Map<string, FindingDelta>();\n const count = (v: Keyed, key: keyof FindingDelta): void => {\n const d = out.get(v.row.node.path) ?? { new: 0, worsened: 0, improved: 0, resolved: 0 };\n d[key] += 1;\n out.set(v.row.node.path, d);\n };\n for (const v of buckets.newViolations) count(v, \"new\");\n for (const u of buckets.worsened) count(u.to, \"worsened\");\n for (const u of buckets.improved) count(u.to, \"improved\");\n for (const v of buckets.resolvedViolations) count(v, \"resolved\");\n return out;\n}\n\nfunction compareTo(current: Side, baseline: Side): Comparison {\n const buckets = bucketFindings(baseline.model, current.model);\n return { baseline, status: statuses(buckets), findings: findingDeltas(buckets) };\n}\n\nfunction deltaOf(row: Indexed, comparison: Comparison): PathDelta {\n const { model, ctx } = comparison.baseline;\n const inBaseline = isFile(model, row.path);\n const scoreBefore = inBaseline ? hotspotScoreOf(ctx, row.path) : null;\n const complexityBefore = inBaseline ? (hotspotComplexityOf(ctx, row.path) ?? null) : null;\n return {\n inBaseline,\n scoreBefore,\n score: delta(row.hotspot.score, scoreBefore),\n complexityBefore,\n complexity: delta(row.complexity, complexityBefore),\n findings: comparison.findings.get(row.path) ?? { new: 0, worsened: 0, improved: 0, resolved: 0 },\n };\n}\n\nfunction indexedRow(input: string, path: string, reading: Reading): Indexed {\n const { current, comparison } = reading;\n const open = reading.open.get(path) ?? [];\n const row: Indexed = {\n status: \"indexed\",\n input,\n path,\n node: toRef(current.model.nodeById.get(path)!),\n complexity: hotspotComplexityOf(current.ctx, path) ?? null,\n hotspot: current.hotspots.get(path) ?? { score: 0, rank: null },\n findings: comparison ? open.map((f) => ({ ...f, status: comparison.status.get(f.id) ?? \"carryover\" })) : open,\n };\n if (comparison !== undefined) row.delta = comparison && deltaOf(row, comparison);\n return row;\n}\n\nfunction rowFor(input: string, path: string | null, reading: Reading): PathImpact {\n if (path === null) return { status: \"outside-repo\", input };\n if (!isFile(reading.current.model, path)) return { status: \"not-indexed\", input, path };\n return indexedRow(input, path, reading);\n}\n\nfunction rowsFor(args: ImpactArgs, reading: Reading): PathImpact[] {\n const seen = new Set<string>();\n const rows: PathImpact[] = [];\n for (const input of args.paths) {\n const path = repoRelative(input, args.root);\n const key = path ?? `outside:${input}`;\n if (seen.has(key)) continue;\n seen.add(key);\n rows.push(rowFor(input, path, reading));\n }\n return rows;\n}\n\nconst best = (values: (number | null)[], pick: (...n: number[]) => number): number | null => {\n const measured = values.filter((v): v is number => v !== null);\n return measured.length > 0 ? pick(...measured) : null;\n};\n\n/** A file the snapshot no longer holds has no row delta, but the findings it resolved still count. */\nfunction deletedResolved(rows: readonly PathImpact[], comparison: Comparison): number {\n return rows.reduce((sum, r) => sum + (r.status === \"not-indexed\" ? (comparison.findings.get(r.path)?.resolved ?? 0) : 0), 0);\n}\n\nfunction rollupDelta(indexed: readonly Indexed[], deleted: number): NonNullable<ImpactRollup[\"delta\"]> {\n const findings: FindingDelta = { new: 0, worsened: 0, improved: 0, resolved: 0 };\n let score = 0;\n for (const { delta: d, hotspot } of indexed) {\n score += d!.score ?? hotspot.score;\n for (const key of Object.keys(findings) as (keyof FindingDelta)[]) findings[key] += d!.findings[key];\n }\n findings.resolved += deleted;\n return { score, findings };\n}\n\nfunction rollupOf(rows: readonly PathImpact[], comparison: Reading[\"comparison\"]): ImpactRollup {\n const indexed = rows.filter((r): r is Indexed => r.status === \"indexed\");\n const rollup: ImpactRollup = {\n indexed: indexed.length,\n notIndexed: rows.filter((r) => r.status === \"not-indexed\").length,\n outsideRepo: rows.filter((r) => r.status === \"outside-repo\").length,\n score: indexed.reduce((sum, r) => sum + r.hotspot.score, 0),\n maxComplexity: best(indexed.map((r) => r.complexity), Math.max),\n topRank: best(indexed.map((r) => r.hotspot.rank), Math.min),\n openFindings: indexed.reduce((sum, r) => sum + r.findings.length, 0),\n };\n if (comparison !== undefined) rollup.delta = comparison && rollupDelta(indexed, deletedResolved(rows, comparison));\n return rollup;\n}\n\n/** `paths.impact`: complexity, hotspot rank, and open findings for each given file, optionally against a baseline. */\nexport function pathsImpact(source: ReadSource, args: ImpactArgs): ImpactResult {\n checkRoot(args.root, source.repoRoot);\n const model = modelFor(source, args.snapshot);\n const baseline = openBaseline(source, args.baseline);\n const fields = baselineFields(model, baseline);\n const current = sideOf(model, args.window);\n const comparison = baseline && (fields.comparable ? compareTo(current, sideOf(baseline.model, args.window)) : null);\n const reading: Reading = { current, open: openByFile(model), comparison };\n const rows = rowsFor(args, reading);\n return { snapshotId: model.snapshot.id, ...fields, rows, ranked: current.hotspots.size, rollup: rollupOf(rows, comparison) };\n}\n","import type { CommandArgs, CommandResult } from \"./contract.js\";\nimport { modelFor } from \"./snapshot-ref.js\";\nimport { invalidArgs, type ReadSource } from \"./source.js\";\nimport { treeFor, type Tree, type TreeNode } from \"./tree.js\";\n\ntype Candidate = CommandResult<\"node.resolve\">[\"candidates\"][number];\ntype Scored = { score: number; match: string };\n\nconst SEARCHED_KINDS = new Set([\"directory\", \"file\", \"symbol\"]);\nconst PATH_LINE = /^([^#]+):(\\d+)$/;\n\n// Ported from codewatch packages/cli/src/read-api/search.ts (rankSearch): exact, suffix, prefix, then substring.\nfunction scoreNode(node: TreeNode, q: string): Scored | null {\n const id = (node.ref.kind === \"directory\" ? node.ref.path : node.ref.id).toLowerCase();\n const name = node.ref.name.toLowerCase();\n if (id === q || name === q) return { score: 100, match: \"exact\" };\n if (id.endsWith(`/${q}`) || id.endsWith(`#${q}`)) return { score: 80, match: \"suffix\" };\n // Since TP-182 a method's name is `Class.method`, so its bare name is a suffix of the qualified one.\n if (node.ref.kind === \"symbol\" && name.endsWith(`.${q}`)) return { score: 80, match: \"suffix\" };\n if (name.startsWith(q)) return { score: 60, match: \"prefix\" };\n if (id.includes(q)) return { score: 40, match: \"substring\" };\n if (name.includes(q)) return { score: 30, match: \"substring\" };\n return null;\n}\n\nfunction normalize(query: string): string {\n const q = query.toLowerCase();\n return q.length > 1 && q.endsWith(\"/\") ? q.slice(0, -1) : q;\n}\n\nfunction rank(tree: Tree, query: string, kinds: ReadonlySet<string>): Candidate[] {\n const q = normalize(query);\n const hits: Candidate[] = [];\n for (const node of tree.byId.values()) {\n if (!kinds.has(node.ref.kind)) continue;\n const scored = scoreNode(node, q);\n if (scored) hits.push({ node: node.ref, ...scored });\n }\n return hits.sort((a, b) => b.score - a.score || (a.node.id < b.node.id ? -1 : a.node.id > b.node.id ? 1 : 0));\n}\n\n// Ported from codewatch packages/graph/src/coverage.ts (innermostContaining): the smallest span holding the line.\nfunction innermostContaining(file: TreeNode, line: number): TreeNode | null {\n let best: TreeNode | null = null;\n const visit = (node: TreeNode): void => {\n for (const child of node.children) {\n const span = child.ref.span;\n if (span && span.startLine <= line && line <= span.endLine) {\n const bestSpan = best?.ref.span;\n if (!bestSpan || span.endLine - span.startLine < bestSpan.endLine - bestSpan.startLine) best = child;\n }\n visit(child);\n }\n };\n visit(file);\n return best;\n}\n\nfunction resolvePath(tree: Tree, path: string, line: number | undefined): Candidate[] {\n const files = rank(tree, path, new Set([\"file\"]));\n if (line === undefined) return files;\n return files.map((hit) => {\n const symbol = innermostContaining(tree.byId.get(hit.node.id)!, line);\n return symbol ? { node: symbol.ref, score: hit.score, match: \"span\" } : hit;\n });\n}\n\nfunction pathAndLine(args: CommandArgs<\"node.resolve\">): { path: string; line: number | undefined } | null {\n if (args.path !== undefined) return { path: args.path, line: args.line };\n const m = PATH_LINE.exec(args.query!);\n return m ? { path: m[1]!, line: Number(m[2]) } : null;\n}\n\n/** `node.resolve`: a path, path:line, symbol name, or qualified id to ranked candidate nodes. */\nexport function resolveNode(source: ReadSource, args: CommandArgs<\"node.resolve\">): CommandResult<\"node.resolve\"> {\n if ((args.query === undefined) === (args.path === undefined)) throw invalidArgs(\"pass exactly one of query or path\");\n if (args.line !== undefined && args.path === undefined) throw invalidArgs(\"line needs path\");\n const tree = treeFor(modelFor(source, args.snapshot));\n const located = pathAndLine(args);\n const candidates = located ? resolvePath(tree, located.path, located.line) : rank(tree, args.query!, SEARCHED_KINDS);\n return { candidates: candidates.slice(0, args.limit) };\n}\n","import { getChanges } from \"./changes.js\";\nimport { CODE_READ_API_VERSION, type CommandArgs, type CommandName, type CommandResult } from \"./contract.js\";\nimport { getFinding } from \"./finding-get.js\";\nimport { listFindings } from \"./findings-list.js\";\nimport { getHierarchy } from \"./hierarchy.js\";\nimport { listHotspots } from \"./hotspots.js\";\nimport { getNeighbors } from \"./neighbors.js\";\nimport { getNode } from \"./node-get.js\";\nimport { getOverview } from \"./overview.js\";\nimport { packagesStats } from \"./packages-stats.js\";\nimport { pathsImpact } from \"./paths-impact.js\";\nimport { resolveNode } from \"./resolve.js\";\nimport type { ReadSource } from \"./source.js\";\n\nexport type QueryFn<N extends CommandName> = (source: ReadSource, args: CommandArgs<N>) => CommandResult<N>;\n\nexport function describeApi(source: ReadSource): CommandResult<\"api.describe\"> {\n const facts = source.facts();\n const snapshots = source.snapshots();\n const newest = snapshots[0] ?? null;\n return {\n api: CODE_READ_API_VERSION,\n dataset: facts.dataset,\n commands: [...facts.commands],\n newest,\n indexVersions: [...new Set(snapshots.map((s) => s.indexVersion))],\n capabilities: facts.capabilities,\n metrics: newest ? [...source.model(newest.id).metricCatalogue] : [],\n rules: [...facts.rules],\n };\n}\n\nexport function listSnapshots(source: ReadSource, args: CommandArgs<\"snapshot.list\">): CommandResult<\"snapshot.list\"> {\n const matching = source.snapshots().filter((s) => args.ref === undefined || s.ref === args.ref);\n return { snapshots: matching.slice(0, args.limit) };\n}\n\n/** One pure function per command; the registry commands and the static resolver both dispatch here. */\nexport const QUERIES: { [N in CommandName]: QueryFn<N> } = {\n \"api.describe\": describeApi,\n \"snapshot.list\": listSnapshots,\n \"hierarchy.get\": getHierarchy,\n \"node.get\": getNode,\n \"node.resolve\": resolveNode,\n \"findings.list\": listFindings,\n \"finding.get\": getFinding,\n \"node.neighbors\": getNeighbors,\n \"hotspots.list\": listHotspots,\n \"overview.get\": getOverview,\n \"changes.get\": getChanges,\n \"paths.impact\": pathsImpact,\n \"packages.stats\": packagesStats,\n};\n","import { EXIT, errorEnvelope, successEnvelope, type JsonEnvelope } from \"@titan-design/rpc-protocol\";\nimport type { z } from \"zod\";\nimport { QUERIES, type QueryFn } from \"./commands.js\";\nimport { CONTRACT, type CommandName } from \"./contract.js\";\nimport type { ReadSource } from \"./source.js\";\n\n/** rpc-client's static `resolve` option: raw args in, an envelope out, never a throw. */\nexport type QueryResolver = (name: string, args: unknown) => JsonEnvelope<unknown>;\n\nfunction isCommandName(name: string): name is CommandName {\n return Object.hasOwn(CONTRACT, name);\n}\n\n// Same wording as the registry's invokeCommand, so a static answer reads like a live one.\nfunction formatIssues(error: z.ZodError): string {\n return error.issues.map((issue) => `${issue.path.join(\".\") || \"(root)\"}: ${issue.message}`).join(\"; \");\n}\n\nfunction describeFailure(err: unknown): { message: string; code: number } {\n const code = (err as { code?: unknown } | null)?.code;\n const message = err instanceof Error ? err.message : String(err);\n return { message, code: typeof code === \"number\" ? code : EXIT.GENERIC };\n}\n\n/** Validate, run, and envelope one command against a source, exactly as the daemon's registry does. */\nexport function createQueryResolver(source: ReadSource): QueryResolver {\n return (name, rawArgs) => {\n if (!isCommandName(name)) return errorEnvelope(`Unknown command: ${name}`, EXIT.USAGE);\n if (!source.facts().commands.includes(name)) {\n return errorEnvelope(`${name} is not available from a ${source.facts().dataset} dataset`, EXIT.UNAVAILABLE);\n }\n const parsed = CONTRACT[name].args.safeParse(rawArgs ?? {});\n if (!parsed.success) return errorEnvelope(`Invalid arguments: ${formatIssues(parsed.error)}`, EXIT.DATAERR);\n try {\n const query = QUERIES[name] as QueryFn<CommandName>;\n return successEnvelope(query(source, parsed.data as never));\n } catch (err) {\n const { message, code } = describeFailure(err);\n return errorEnvelope(message, code);\n }\n };\n}\n"],"mappings":";AAAA,SAAS,cAAc,KAAAA,WAAuB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ACxD,SAAO,OAAO,OAAO,UAAU,IAAI;AACrC;AAGA,SAAS,aAAa,OAA2B;AAC/C,SAAO,MAAM,OAAO,IAAI,CAAC,UAAU,GAAG,MAAM,KAAK,KAAK,GAAG,KAAK,QAAQ,KAAK,MAAM,OAAO,EAAE,EAAE,KAAK,IAAI;AACvG;AAEA,SAAS,gBAAgB,KAAiD;AACxE,QAAM,OAAQ,KAAmC;AACjD,QAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,SAAO,EAAE,SAAS,MAAM,OAAO,SAAS,WAAW,OAAOC,MAAK,QAAQ;AACzE;AAGO,SAAS,oBAAoB,QAAmC;AACrE,SAAO,CAAC,MAAM,YAAY;AACxB,QAAI,CAAC,cAAc,IAAI,EAAG,QAAO,cAAc,oBAAoB,IAAI,IAAIA,MAAK,KAAK;AACrF,QAAI,CAAC,OAAO,MAAM,EAAE,SAAS,SAAS,IAAI,GAAG;AAC3C,aAAO,cAAc,GAAG,IAAI,4BAA4B,OAAO,MAAM,EAAE,OAAO,YAAYA,MAAK,WAAW;AAAA,IAC5G;AACA,UAAM,SAAS,SAAS,IAAI,EAAE,KAAK,UAAU,WAAW,CAAC,CAAC;AAC1D,QAAI,CAAC,OAAO,QAAS,QAAO,cAAc,sBAAsB,aAAa,OAAO,KAAK,CAAC,IAAIA,MAAK,OAAO;AAC1G,QAAI;AACF,YAAM,QAAQ,QAAQ,IAAI;AAC1B,aAAO,gBAAgB,MAAM,QAAQ,OAAO,IAAa,CAAC;AAAA,IAC5D,SAAS,KAAK;AACZ,YAAM,EAAE,SAAS,KAAK,IAAI,gBAAgB,GAAG;AAC7C,aAAO,cAAc,SAAS,IAAI;AAAA,IACpC;AAAA,EACF;AACF;","names":["z","z","z","z","z","z","z","z","z","BaselineFields","z","z","z","z","z","z","z","z","z","EXIT","EXIT","computeReportDrift","keepNode","best","compare","valueOf","computeReportDrift","keepNode","EMPTY","findings","side","counts","columns","collectNodeMetrics","collectSymbolUtil","collectNodeMetrics","collectSymbolUtil","complexity","counts","counts","measure","findings","complexity","toRow","hotspotScoreOf","hotspotScoreOf","findings","rank","best","EXIT","EXIT"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SourceRead, ReadSource, ReadModel, SnapshotInfo } from './query/index.js';
2
- export { AGENT_COMMANDS, CODE_READ_API_VERSION, COMMAND_NAMES, CONTRACT, Capabilities, CatalogueEntry, CodeReadCommandMap, CommandArgs, CommandContract, CommandInput, CommandName, CommandResult, EXCERPT_LINE_CAP, FINDINGS_PAGE_MAX, Finding, FindingStatus, HIERARCHY_ROW_CAP, MetricDescriptor, MetricValue, Missing, MissingReason, ModelAlias, ModelEdge, ModelFinding, ModelMetric, ModelNode, ModelRule, NodeKind, NodeRef, Provenance, ProvenanceKind, QUERIES, QueryFn, QueryResolver, RELATED_CAP, ReadError, ReadModelParts, RuleSummary, SerializedContract, Severity, SnapshotRef, SourceExcerpt, SourceFacts, SourceOrigin, SourceWindow, Span, buildReadModel, createQueryResolver, describeApi, excessOf, findingNotFound, getFinding, getHierarchy, getNeighbors, getNode, invalidArgs, listFindings, listSnapshots, nodeNotFound, resolveNode, resolveSnapshot, serializeContract, snapshotNotFound } from './query/index.js';
2
+ export { AGENT_COMMANDS, AttentionSignal, CHANGES_ROWS_MAX, CODE_READ_API_VERSION, COMMAND_NAMES, CONTRACT, Capabilities, CatalogueEntry, Centrality, ChurnWindow, CoChangePair, CodeReadCommandMap, CommandArgs, CommandContract, CommandInput, CommandName, CommandResult, CoupledPartners, CrossEdge, EXCERPT_LINE_CAP, ExportRow, FINDINGS_PAGE_MAX, Finding, FindingChange, FindingDelta, FindingStatus, HIERARCHY_ROW_CAP, HOTSPOTS_PAGE_MAX, Hotspot, HotspotMark, ImpactRollup, LinkedTests, LookFirstRow, MetricDescriptor, MetricValue, Missing, MissingReason, ModelAlias, ModelEdge, ModelFinding, ModelMetric, ModelNode, ModelRule, NewFile, NodeKind, NodeLens, NodeLenses, NodeRef, OVERVIEW_ROWS_MAX, PACKAGES_MAX, PATHS_IMPACT_MAX, PackageLayer, PackageStatsRow, PathDelta, PathHotspot, PathImpact, Provenance, ProvenanceKind, QUERIES, QueryFn, QueryResolver, RELATED_CAP, ReadError, ReadModelParts, ReadingOrderRow, Regression, RuleSummary, ScoreBreakdown, ScoreChange, SerializedContract, Severity, SnapshotRef, SourceExcerpt, SourceFacts, SourceOrigin, SourceWindow, Span, buildReadModel, createQueryResolver, declaredTiers, describeApi, excessOf, findingNotFound, getChanges, getFinding, getHierarchy, getNeighbors, getNode, getOverview, invalidArgs, listFindings, listHotspots, listSnapshots, nodeNotFound, packagesStats, pathsImpact, repoRelative, resolveNode, resolveSnapshot, serializeContract, snapshotNotFound } from './query/index.js';
3
3
  import { CodeGraphStore, CheckRule, SnapshotRow } from '@titan-design/code-graph';
4
4
  import { BaseContext, AnyCommand, CommandRegistry } from '@titan-design/registry';
5
5
  import 'zod';