@codesentinel/codesentinel 1.1.0 → 1.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.
- package/README.md +44 -0
- package/dist/index.js +830 -16
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/application/run-analyze-command.ts","../../code-graph/src/domain/graph-model.ts","../../code-graph/src/domain/tarjan.ts","../../code-graph/src/domain/graph-metrics.ts","../../code-graph/src/infrastructure/typescript-project.ts","../../code-graph/src/application/build-project-graph-summary.ts","../../git-analyzer/src/domain/evolution-metrics.ts","../../git-analyzer/src/domain/evolution-types.ts","../../git-analyzer/src/application/analyze-repository-evolution.ts","../../git-analyzer/src/infrastructure/git-command-client.ts","../../git-analyzer/src/domain/git-log-format.ts","../../git-analyzer/src/parsing/git-log-parser.ts","../../git-analyzer/src/infrastructure/git-history-provider.ts","../../git-analyzer/src/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { runAnalyzeCommand } from \"./application/run-analyze-command.js\";\n\nconst program = new Command();\nconst packageJsonPath = resolve(dirname(fileURLToPath(import.meta.url)), \"../package.json\");\nconst { version } = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as { version: string };\n\nprogram\n .name(\"codesentinel\")\n .description(\"Structural and evolutionary risk analysis for TypeScript/JavaScript codebases\")\n .version(version);\n\nprogram\n .command(\"analyze\")\n .argument(\"[path]\", \"path to the project to analyze\")\n .action((path?: string) => {\n const output = runAnalyzeCommand(path);\n process.stdout.write(`${output}\\n`);\n });\n\nif (process.argv.length <= 2) {\n program.outputHelp();\n process.exit(0);\n}\n\nprogram.parse(process.argv);\n","import { resolve } from \"node:path\";\nimport { buildProjectGraphSummary } from \"@codesentinel/code-graph\";\nimport { analyzeRepositoryEvolutionFromGit } from \"@codesentinel/git-analyzer\";\nimport type { AnalyzeSummary } from \"@codesentinel/core\";\n\nconst resolveTargetPath = (inputPath: string | undefined, cwd: string): string =>\n resolve(cwd, inputPath ?? \".\");\n\nexport const runAnalyzeCommand = (inputPath: string | undefined): string => {\n const invocationCwd = process.env[\"INIT_CWD\"] ?? process.cwd();\n const targetPath = resolveTargetPath(inputPath, invocationCwd);\n\n const structural = buildProjectGraphSummary({ projectPath: targetPath });\n const evolution = analyzeRepositoryEvolutionFromGit({ repositoryPath: targetPath });\n\n const summary: AnalyzeSummary = {\n structural,\n evolution,\n };\n\n return JSON.stringify(summary, null, 2);\n};\n","export type NodeRecord = {\n id: string;\n absolutePath: string;\n relativePath: string;\n};\n\nexport type EdgeRecord = {\n from: string;\n to: string;\n};\n\nexport type GraphData = {\n nodes: readonly NodeRecord[];\n edges: readonly EdgeRecord[];\n adjacencyById: ReadonlyMap<string, readonly string[]>;\n};\n\nconst edgeKey = (from: string, to: string): string => `${from}\\u0000${to}`;\n\nexport const createGraphData = (\n nodes: readonly NodeRecord[],\n rawEdges: readonly EdgeRecord[],\n): GraphData => {\n const sortedNodes = [...nodes].sort((a, b) => a.id.localeCompare(b.id));\n const knownNodeIds = new Set(sortedNodes.map((node) => node.id));\n\n const uniqueEdgeMap = new Map<string, EdgeRecord>();\n for (const edge of rawEdges) {\n if (edge.from === edge.to) {\n continue;\n }\n\n if (!knownNodeIds.has(edge.from) || !knownNodeIds.has(edge.to)) {\n continue;\n }\n\n uniqueEdgeMap.set(edgeKey(edge.from, edge.to), edge);\n }\n\n const sortedEdges = [...uniqueEdgeMap.values()].sort((a, b) => {\n const fromCompare = a.from.localeCompare(b.from);\n if (fromCompare !== 0) {\n return fromCompare;\n }\n\n return a.to.localeCompare(b.to);\n });\n\n const adjacency = new Map<string, string[]>();\n for (const node of sortedNodes) {\n adjacency.set(node.id, []);\n }\n\n for (const edge of sortedEdges) {\n adjacency.get(edge.from)?.push(edge.to);\n }\n\n const adjacencyById = new Map<string, readonly string[]>();\n for (const [nodeId, targets] of adjacency.entries()) {\n adjacencyById.set(nodeId, [...targets]);\n }\n\n return {\n nodes: sortedNodes,\n edges: sortedEdges,\n adjacencyById,\n };\n};\n","type TarjanResult = {\n components: readonly (readonly string[])[];\n};\n\nexport const runTarjanScc = (adjacencyById: ReadonlyMap<string, readonly string[]>): TarjanResult => {\n let index = 0;\n const indices = new Map<string, number>();\n const lowLink = new Map<string, number>();\n const stack: string[] = [];\n const onStack = new Set<string>();\n const components: string[][] = [];\n\n const strongConnect = (nodeId: string): void => {\n indices.set(nodeId, index);\n lowLink.set(nodeId, index);\n index += 1;\n\n stack.push(nodeId);\n onStack.add(nodeId);\n\n const neighbors = adjacencyById.get(nodeId) ?? [];\n for (const nextId of neighbors) {\n if (!indices.has(nextId)) {\n strongConnect(nextId);\n const nodeLowLink = lowLink.get(nodeId);\n const nextLowLink = lowLink.get(nextId);\n if (nodeLowLink !== undefined && nextLowLink !== undefined && nextLowLink < nodeLowLink) {\n lowLink.set(nodeId, nextLowLink);\n }\n continue;\n }\n\n if (onStack.has(nextId)) {\n const nodeLowLink = lowLink.get(nodeId);\n const nextIndex = indices.get(nextId);\n if (nodeLowLink !== undefined && nextIndex !== undefined && nextIndex < nodeLowLink) {\n lowLink.set(nodeId, nextIndex);\n }\n }\n }\n\n const nodeLowLink = lowLink.get(nodeId);\n const nodeIndex = indices.get(nodeId);\n if (nodeLowLink === undefined || nodeIndex === undefined || nodeLowLink !== nodeIndex) {\n return;\n }\n\n const component: string[] = [];\n for (;;) {\n const popped = stack.pop();\n if (popped === undefined) {\n break;\n }\n\n onStack.delete(popped);\n component.push(popped);\n if (popped === nodeId) {\n break;\n }\n }\n\n component.sort((a, b) => a.localeCompare(b));\n components.push(component);\n };\n\n const nodeIds = [...adjacencyById.keys()].sort((a, b) => a.localeCompare(b));\n for (const nodeId of nodeIds) {\n if (!indices.has(nodeId)) {\n strongConnect(nodeId);\n }\n }\n\n components.sort((a, b) => {\n const firstA = a[0] ?? \"\";\n const firstB = b[0] ?? \"\";\n return firstA.localeCompare(firstB);\n });\n\n return { components };\n};\n","import type { FileDependency, GraphAnalysisSummary, GraphCycle, GraphMetrics } from \"@codesentinel/core\";\nimport type { GraphData } from \"./graph-model.js\";\nimport { runTarjanScc } from \"./tarjan.js\";\n\ntype DepthComputation = {\n depthByNodeId: ReadonlyMap<string, number>;\n graphDepth: number;\n cycles: readonly GraphCycle[];\n};\n\nconst hasSelfLoop = (nodeId: string, adjacencyById: ReadonlyMap<string, readonly string[]>): boolean => {\n const targets = adjacencyById.get(nodeId) ?? [];\n return targets.includes(nodeId);\n};\n\nconst computeCyclesAndDepth = (graph: GraphData): DepthComputation => {\n const { components } = runTarjanScc(graph.adjacencyById);\n\n const cycles: GraphCycle[] = [];\n const componentByNodeId = new Map<string, number>();\n components.forEach((component, index) => {\n for (const nodeId of component) {\n componentByNodeId.set(nodeId, index);\n }\n\n if (component.length > 1) {\n cycles.push({ nodes: [...component] });\n return;\n }\n\n const onlyNode = component[0];\n if (onlyNode !== undefined && hasSelfLoop(onlyNode, graph.adjacencyById)) {\n cycles.push({ nodes: [...component] });\n }\n });\n\n const dagOutgoing = new Map<number, Set<number>>();\n const inDegree = new Map<number, number>();\n\n for (let i = 0; i < components.length; i += 1) {\n dagOutgoing.set(i, new Set());\n inDegree.set(i, 0);\n }\n\n for (const edge of graph.edges) {\n const fromComponent = componentByNodeId.get(edge.from);\n const toComponent = componentByNodeId.get(edge.to);\n\n if (fromComponent === undefined || toComponent === undefined || fromComponent === toComponent) {\n continue;\n }\n\n const outgoing = dagOutgoing.get(fromComponent);\n if (outgoing?.has(toComponent) === true) {\n continue;\n }\n\n outgoing?.add(toComponent);\n inDegree.set(toComponent, (inDegree.get(toComponent) ?? 0) + 1);\n }\n\n const queue: number[] = [];\n const depthByComponent = new Map<number, number>();\n\n for (let i = 0; i < components.length; i += 1) {\n if ((inDegree.get(i) ?? 0) === 0) {\n queue.push(i);\n depthByComponent.set(i, 0);\n }\n }\n\n let cursor = 0;\n while (cursor < queue.length) {\n const componentId = queue[cursor];\n cursor += 1;\n\n if (componentId === undefined) {\n continue;\n }\n\n const currentDepth = depthByComponent.get(componentId) ?? 0;\n const outgoing = dagOutgoing.get(componentId) ?? new Set<number>();\n\n for (const nextComponent of outgoing) {\n const nextDepth = depthByComponent.get(nextComponent) ?? 0;\n if (currentDepth + 1 > nextDepth) {\n depthByComponent.set(nextComponent, currentDepth + 1);\n }\n\n const remainingIncoming = (inDegree.get(nextComponent) ?? 0) - 1;\n inDegree.set(nextComponent, remainingIncoming);\n if (remainingIncoming === 0) {\n queue.push(nextComponent);\n }\n }\n }\n\n const depthByNodeId = new Map<string, number>();\n let graphDepth = 0;\n\n components.forEach((component, componentId) => {\n const componentDepth = depthByComponent.get(componentId) ?? 0;\n if (componentDepth > graphDepth) {\n graphDepth = componentDepth;\n }\n\n for (const nodeId of component) {\n depthByNodeId.set(nodeId, componentDepth);\n }\n });\n\n cycles.sort((a, b) => {\n const firstA = a.nodes[0] ?? \"\";\n const firstB = b.nodes[0] ?? \"\";\n return firstA.localeCompare(firstB);\n });\n\n return {\n depthByNodeId,\n graphDepth,\n cycles,\n };\n};\n\nexport const createGraphAnalysisSummary = (\n targetPath: string,\n graph: GraphData,\n): GraphAnalysisSummary => {\n const fanInById = new Map<string, number>();\n const fanOutById = new Map<string, number>();\n\n for (const node of graph.nodes) {\n fanInById.set(node.id, 0);\n fanOutById.set(node.id, graph.adjacencyById.get(node.id)?.length ?? 0);\n }\n\n for (const edge of graph.edges) {\n fanInById.set(edge.to, (fanInById.get(edge.to) ?? 0) + 1);\n }\n\n const { cycles, depthByNodeId, graphDepth } = computeCyclesAndDepth(graph);\n\n let maxFanIn = 0;\n let maxFanOut = 0;\n\n const files: FileDependency[] = graph.nodes.map((node) => {\n const fanIn = fanInById.get(node.id) ?? 0;\n const fanOut = fanOutById.get(node.id) ?? 0;\n\n if (fanIn > maxFanIn) {\n maxFanIn = fanIn;\n }\n\n if (fanOut > maxFanOut) {\n maxFanOut = fanOut;\n }\n\n return {\n id: node.id,\n relativePath: node.relativePath,\n directDependencies: graph.adjacencyById.get(node.id) ?? [],\n fanIn,\n fanOut,\n depth: depthByNodeId.get(node.id) ?? 0,\n };\n });\n\n const metrics: GraphMetrics = {\n nodeCount: graph.nodes.length,\n edgeCount: graph.edges.length,\n cycleCount: cycles.length,\n graphDepth,\n maxFanIn,\n maxFanOut,\n };\n\n return {\n targetPath,\n nodes: graph.nodes,\n edges: graph.edges,\n cycles,\n files,\n metrics,\n };\n};\n","import { extname, isAbsolute, relative, resolve } from \"node:path\";\nimport * as ts from \"typescript\";\nimport type { EdgeRecord, NodeRecord } from \"../domain/graph-model.js\";\n\ntype ParsedProject = {\n nodes: readonly NodeRecord[];\n edges: readonly EdgeRecord[];\n};\n\nconst SOURCE_EXTENSIONS = new Set([\".ts\", \".tsx\", \".mts\", \".cts\", \".js\", \".jsx\", \".mjs\", \".cjs\"]);\n\nconst normalizePath = (pathValue: string): string => pathValue.replaceAll(\"\\\\\", \"/\");\n\nconst isProjectSourceFile = (filePath: string, projectRoot: string): boolean => {\n const extension = extname(filePath);\n if (!SOURCE_EXTENSIONS.has(extension)) {\n return false;\n }\n\n const relativePath = relative(projectRoot, filePath);\n if (relativePath.startsWith(\"..\")) {\n return false;\n }\n\n return !relativePath.includes(\"node_modules\");\n};\n\nconst findProjectFiles = (projectRoot: string): readonly string[] => {\n const files = ts.sys.readDirectory(projectRoot, [...SOURCE_EXTENSIONS], undefined, undefined);\n return files.map((filePath) => resolve(filePath));\n};\n\nconst parseTsConfig = (projectRoot: string): { fileNames: readonly string[]; options: ts.CompilerOptions } => {\n const configPath = ts.findConfigFile(projectRoot, ts.sys.fileExists, \"tsconfig.json\");\n if (configPath === undefined) {\n return {\n fileNames: findProjectFiles(projectRoot),\n options: {\n allowJs: true,\n moduleResolution: ts.ModuleResolutionKind.NodeNext,\n },\n };\n }\n\n const parsedCommandLine = ts.getParsedCommandLineOfConfigFile(\n configPath,\n {},\n {\n ...ts.sys,\n onUnRecoverableConfigFileDiagnostic: () => {\n throw new Error(`Failed to parse TypeScript configuration at ${configPath}`);\n },\n },\n );\n\n if (parsedCommandLine === undefined) {\n throw new Error(`Failed to parse TypeScript configuration at ${configPath}`);\n }\n\n const fileNames = parsedCommandLine.fileNames.map((filePath) => resolve(filePath));\n if (fileNames.length === 0) {\n return {\n fileNames: findProjectFiles(projectRoot),\n options: parsedCommandLine.options,\n };\n }\n\n return {\n fileNames,\n options: parsedCommandLine.options,\n };\n};\n\nconst getSpecifierFromExpression = (expression: ts.Expression): string | undefined => {\n if (ts.isStringLiteral(expression)) {\n return expression.text;\n }\n\n if (ts.isNoSubstitutionTemplateLiteral(expression)) {\n return expression.text;\n }\n\n return undefined;\n};\n\nconst hasRuntimeImport = (importDeclaration: ts.ImportDeclaration): boolean => {\n const importClause = importDeclaration.importClause;\n if (importClause === undefined) {\n return true;\n }\n\n if (importClause.isTypeOnly) {\n return false;\n }\n\n if (importClause.name !== undefined) {\n return true;\n }\n\n const namedBindings = importClause.namedBindings;\n if (namedBindings === undefined) {\n return false;\n }\n\n if (ts.isNamespaceImport(namedBindings)) {\n return true;\n }\n\n if (namedBindings.elements.length === 0) {\n return true;\n }\n\n return namedBindings.elements.some((element) => !element.isTypeOnly);\n};\n\nconst extractModuleSpecifiers = (sourceFile: ts.SourceFile): readonly string[] => {\n const specifiers = new Set<string>();\n\n const visit = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) {\n if (hasRuntimeImport(node) && node.moduleSpecifier !== undefined) {\n const specifier = getSpecifierFromExpression(node.moduleSpecifier);\n if (specifier !== undefined) {\n specifiers.add(specifier);\n }\n }\n return;\n }\n\n if (ts.isExportDeclaration(node)) {\n if (!node.isTypeOnly && node.moduleSpecifier !== undefined) {\n const specifier = getSpecifierFromExpression(node.moduleSpecifier);\n if (specifier !== undefined) {\n specifiers.add(specifier);\n }\n }\n return;\n }\n\n if (ts.isCallExpression(node)) {\n if (node.expression.kind === ts.SyntaxKind.ImportKeyword && node.arguments.length > 0) {\n const firstArgument = node.arguments[0];\n if (firstArgument !== undefined) {\n const specifier = getSpecifierFromExpression(firstArgument);\n if (specifier !== undefined) {\n specifiers.add(specifier);\n }\n }\n }\n\n if (ts.isIdentifier(node.expression) && node.expression.text === \"require\" && node.arguments.length > 0) {\n const firstArgument = node.arguments[0];\n if (firstArgument !== undefined) {\n const specifier = getSpecifierFromExpression(firstArgument);\n if (specifier !== undefined) {\n specifiers.add(specifier);\n }\n }\n }\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n return [...specifiers];\n};\n\nexport const parseTypescriptProject = (projectPath: string): ParsedProject => {\n const projectRoot = isAbsolute(projectPath) ? projectPath : resolve(projectPath);\n const { fileNames, options } = parseTsConfig(projectRoot);\n\n const sourceFilePaths = fileNames\n .filter((filePath) => isProjectSourceFile(filePath, projectRoot))\n .map((filePath) => normalizePath(resolve(filePath)));\n\n const uniqueSourceFilePaths = [...new Set(sourceFilePaths)].sort((a, b) => a.localeCompare(b));\n const sourceFilePathSet = new Set(uniqueSourceFilePaths);\n\n const program = ts.createProgram({\n rootNames: uniqueSourceFilePaths,\n options,\n });\n\n const nodeByAbsolutePath = new Map<string, NodeRecord>();\n for (const sourcePath of uniqueSourceFilePaths) {\n const relativePath = normalizePath(relative(projectRoot, sourcePath));\n const nodeId = relativePath;\n nodeByAbsolutePath.set(sourcePath, {\n id: nodeId,\n absolutePath: sourcePath,\n relativePath,\n });\n }\n\n const resolverCache = new Map<string, string | undefined>();\n const edges: EdgeRecord[] = [];\n\n for (const sourcePath of uniqueSourceFilePaths) {\n const sourceFile = program.getSourceFile(sourcePath);\n if (sourceFile === undefined) {\n continue;\n }\n\n const fromNode = nodeByAbsolutePath.get(sourcePath);\n if (fromNode === undefined) {\n continue;\n }\n\n const moduleSpecifiers = extractModuleSpecifiers(sourceFile);\n for (const specifier of moduleSpecifiers) {\n const cacheKey = `${sourcePath}\\u0000${specifier}`;\n let resolvedPath = resolverCache.get(cacheKey);\n\n if (resolvedPath === undefined && !resolverCache.has(cacheKey)) {\n const resolved = ts.resolveModuleName(specifier, sourcePath, options, ts.sys).resolvedModule;\n if (resolved !== undefined) {\n resolvedPath = normalizePath(resolve(resolved.resolvedFileName));\n }\n resolverCache.set(cacheKey, resolvedPath);\n }\n\n if (resolvedPath === undefined || !sourceFilePathSet.has(resolvedPath)) {\n continue;\n }\n\n const toNode = nodeByAbsolutePath.get(resolvedPath);\n if (toNode === undefined) {\n continue;\n }\n\n edges.push({ from: fromNode.id, to: toNode.id });\n }\n }\n\n return {\n nodes: [...nodeByAbsolutePath.values()],\n edges,\n };\n};\n","import type { GraphAnalysisSummary } from \"@codesentinel/core\";\nimport { createGraphData } from \"../domain/graph-model.js\";\nimport { createGraphAnalysisSummary } from \"../domain/graph-metrics.js\";\nimport { parseTypescriptProject } from \"../infrastructure/typescript-project.js\";\n\nexport type BuildProjectGraphSummaryInput = {\n projectPath: string;\n};\n\nexport const buildProjectGraphSummary = (\n input: BuildProjectGraphSummaryInput,\n): GraphAnalysisSummary => {\n const parsedProject = parseTypescriptProject(input.projectPath);\n const graphData = createGraphData(parsedProject.nodes, parsedProject.edges);\n return createGraphAnalysisSummary(input.projectPath, graphData);\n};\n","import type {\n CouplingMatrix,\n FileAuthorShare,\n FileCoupling,\n FileEvolutionMetrics,\n Hotspot,\n RepositoryEvolutionSummary,\n} from \"@codesentinel/core\";\nimport type { EvolutionComputationConfig, GitCommitRecord } from \"./evolution-types.js\";\n\ntype FileAccumulator = {\n commitCount: number;\n recentCommitCount: number;\n churnAdded: number;\n churnDeleted: number;\n authors: Map<string, number>;\n};\n\nconst pairKey = (a: string, b: string): string => `${a}\\u0000${b}`;\n\nconst round4 = (value: number): number => Number(value.toFixed(4));\n\nconst computeBusFactor = (\n authorDistribution: readonly FileAuthorShare[],\n threshold: number,\n): number => {\n if (authorDistribution.length === 0) {\n return 0;\n }\n\n let coveredShare = 0;\n for (let i = 0; i < authorDistribution.length; i += 1) {\n const entry = authorDistribution[i];\n if (entry === undefined) {\n continue;\n }\n\n coveredShare += entry.share;\n if (coveredShare >= threshold) {\n return i + 1;\n }\n }\n\n return authorDistribution.length;\n};\n\nconst finalizeAuthorDistribution = (authorCommits: ReadonlyMap<string, number>): readonly FileAuthorShare[] => {\n const totalCommits = [...authorCommits.values()].reduce((sum, value) => sum + value, 0);\n if (totalCommits === 0) {\n return [];\n }\n\n return [...authorCommits.entries()]\n .map(([authorId, commits]) => ({\n authorId,\n commits,\n share: round4(commits / totalCommits),\n }))\n .sort((a, b) => b.commits - a.commits || a.authorId.localeCompare(b.authorId));\n};\n\nconst buildCouplingMatrix = (\n coChangeByPair: ReadonlyMap<string, number>,\n fileCommitCount: ReadonlyMap<string, number>,\n consideredCommits: number,\n skippedLargeCommits: number,\n maxCouplingPairs: number,\n): CouplingMatrix => {\n const allPairs: FileCoupling[] = [];\n\n for (const [key, coChangeCommits] of coChangeByPair.entries()) {\n const [fileA, fileB] = key.split(\"\\u0000\");\n if (fileA === undefined || fileB === undefined) {\n continue;\n }\n\n const fileACommits = fileCommitCount.get(fileA) ?? 0;\n const fileBCommits = fileCommitCount.get(fileB) ?? 0;\n const denominator = fileACommits + fileBCommits - coChangeCommits;\n const couplingScore = denominator === 0 ? 0 : round4(coChangeCommits / denominator);\n\n allPairs.push({\n fileA,\n fileB,\n coChangeCommits,\n couplingScore,\n });\n }\n\n allPairs.sort(\n (a, b) =>\n b.coChangeCommits - a.coChangeCommits ||\n b.couplingScore - a.couplingScore ||\n a.fileA.localeCompare(b.fileA) ||\n a.fileB.localeCompare(b.fileB),\n );\n\n const truncated = allPairs.length > maxCouplingPairs;\n\n return {\n pairs: truncated ? allPairs.slice(0, maxCouplingPairs) : allPairs,\n totalPairCount: allPairs.length,\n consideredCommits,\n skippedLargeCommits,\n truncated,\n };\n};\n\nconst selectHotspots = (\n files: readonly FileEvolutionMetrics[],\n config: EvolutionComputationConfig,\n): { hotspots: readonly Hotspot[]; threshold: number } => {\n if (files.length === 0) {\n return { hotspots: [], threshold: 0 };\n }\n\n const sorted = [...files].sort(\n (a, b) =>\n b.commitCount - a.commitCount || b.churnTotal - a.churnTotal || a.filePath.localeCompare(b.filePath),\n );\n\n const hotspotCount = Math.max(config.hotspotMinFiles, Math.ceil(sorted.length * config.hotspotTopPercent));\n const selected = sorted.slice(0, hotspotCount);\n\n const hotspots = selected.map((file, index) => ({\n filePath: file.filePath,\n rank: index + 1,\n commitCount: file.commitCount,\n churnTotal: file.churnTotal,\n }));\n\n const threshold = selected[selected.length - 1]?.commitCount ?? 0;\n return { hotspots, threshold };\n};\n\nexport const computeRepositoryEvolutionSummary = (\n targetPath: string,\n commits: readonly GitCommitRecord[],\n config: EvolutionComputationConfig,\n): RepositoryEvolutionSummary => {\n const fileStats = new Map<string, FileAccumulator>();\n const coChangeByPair = new Map<string, number>();\n\n const headCommitTimestamp = commits.length === 0 ? null : commits[commits.length - 1]?.authoredAtUnix ?? null;\n const recentWindowStart =\n headCommitTimestamp === null\n ? Number.NEGATIVE_INFINITY\n : headCommitTimestamp - config.recentWindowDays * 24 * 60 * 60;\n\n let consideredCommits = 0;\n let skippedLargeCommits = 0;\n\n for (const commit of commits) {\n const uniqueFiles = new Set<string>();\n\n for (const fileChange of commit.fileChanges) {\n uniqueFiles.add(fileChange.filePath);\n const current = fileStats.get(fileChange.filePath) ?? {\n commitCount: 0,\n recentCommitCount: 0,\n churnAdded: 0,\n churnDeleted: 0,\n authors: new Map<string, number>(),\n };\n\n current.churnAdded += fileChange.additions;\n current.churnDeleted += fileChange.deletions;\n fileStats.set(fileChange.filePath, current);\n }\n\n for (const filePath of uniqueFiles) {\n const current = fileStats.get(filePath);\n if (current === undefined) {\n continue;\n }\n\n current.commitCount += 1;\n if (commit.authoredAtUnix >= recentWindowStart) {\n current.recentCommitCount += 1;\n }\n\n current.authors.set(commit.authorId, (current.authors.get(commit.authorId) ?? 0) + 1);\n }\n\n const orderedFiles = [...uniqueFiles].sort((a, b) => a.localeCompare(b));\n if (orderedFiles.length > 1) {\n if (orderedFiles.length <= config.maxFilesPerCommitForCoupling) {\n consideredCommits += 1;\n for (let i = 0; i < orderedFiles.length - 1; i += 1) {\n for (let j = i + 1; j < orderedFiles.length; j += 1) {\n const fileA = orderedFiles[i];\n const fileB = orderedFiles[j];\n if (fileA === undefined || fileB === undefined) {\n continue;\n }\n\n const key = pairKey(fileA, fileB);\n coChangeByPair.set(key, (coChangeByPair.get(key) ?? 0) + 1);\n }\n }\n } else {\n skippedLargeCommits += 1;\n }\n }\n }\n\n const files: FileEvolutionMetrics[] = [...fileStats.entries()]\n .map(([filePath, stats]) => {\n const authorDistribution = finalizeAuthorDistribution(stats.authors);\n const topAuthorShare = authorDistribution[0]?.share ?? 0;\n return {\n filePath,\n commitCount: stats.commitCount,\n frequencyPer100Commits: commits.length === 0 ? 0 : round4((stats.commitCount / commits.length) * 100),\n churnAdded: stats.churnAdded,\n churnDeleted: stats.churnDeleted,\n churnTotal: stats.churnAdded + stats.churnDeleted,\n recentCommitCount: stats.recentCommitCount,\n recentVolatility: stats.commitCount === 0 ? 0 : round4(stats.recentCommitCount / stats.commitCount),\n topAuthorShare,\n busFactor: computeBusFactor(authorDistribution, config.busFactorCoverageThreshold),\n authorDistribution,\n };\n })\n .sort((a, b) => a.filePath.localeCompare(b.filePath));\n\n const fileCommitCount = new Map(files.map((file) => [file.filePath, file.commitCount]));\n const coupling = buildCouplingMatrix(\n coChangeByPair,\n fileCommitCount,\n consideredCommits,\n skippedLargeCommits,\n config.maxCouplingPairs,\n );\n\n const { hotspots, threshold } = selectHotspots(files, config);\n\n return {\n targetPath,\n available: true,\n files,\n hotspots,\n coupling,\n metrics: {\n totalCommits: commits.length,\n totalFiles: files.length,\n headCommitTimestamp,\n recentWindowDays: config.recentWindowDays,\n hotspotTopPercent: config.hotspotTopPercent,\n hotspotThresholdCommitCount: threshold,\n },\n };\n};\n","export type GitFileChange = {\n filePath: string;\n additions: number;\n deletions: number;\n};\n\nexport type GitCommitRecord = {\n hash: string;\n authorId: string;\n authorName: string;\n authoredAtUnix: number;\n fileChanges: readonly GitFileChange[];\n};\n\nexport type EvolutionComputationConfig = {\n recentWindowDays: number;\n hotspotTopPercent: number;\n hotspotMinFiles: number;\n maxFilesPerCommitForCoupling: number;\n maxCouplingPairs: number;\n busFactorCoverageThreshold: number;\n};\n\nexport const DEFAULT_EVOLUTION_CONFIG: EvolutionComputationConfig = {\n recentWindowDays: 30,\n hotspotTopPercent: 0.1,\n hotspotMinFiles: 1,\n maxFilesPerCommitForCoupling: 200,\n maxCouplingPairs: 500,\n busFactorCoverageThreshold: 0.6,\n};\n","import type { RepositoryEvolutionSummary } from \"@codesentinel/core\";\nimport { computeRepositoryEvolutionSummary } from \"../domain/evolution-metrics.js\";\nimport {\n DEFAULT_EVOLUTION_CONFIG,\n type EvolutionComputationConfig,\n} from \"../domain/evolution-types.js\";\nimport type { GitHistoryProvider } from \"./git-history-provider.js\";\n\nexport type AnalyzeRepositoryEvolutionInput = {\n repositoryPath: string;\n config?: Partial<EvolutionComputationConfig>;\n};\n\nconst createEffectiveConfig = (\n overrides: Partial<EvolutionComputationConfig> | undefined,\n): EvolutionComputationConfig => ({\n ...DEFAULT_EVOLUTION_CONFIG,\n ...overrides,\n});\n\nexport const analyzeRepositoryEvolution = (\n input: AnalyzeRepositoryEvolutionInput,\n historyProvider: GitHistoryProvider,\n): RepositoryEvolutionSummary => {\n if (!historyProvider.isGitRepository(input.repositoryPath)) {\n return {\n targetPath: input.repositoryPath,\n available: false,\n reason: \"not_git_repository\",\n };\n }\n\n const commits = historyProvider.getCommitHistory(input.repositoryPath);\n const config = createEffectiveConfig(input.config);\n\n return computeRepositoryEvolutionSummary(input.repositoryPath, commits, config);\n};\n","import { execFileSync } from \"node:child_process\";\n\nexport class GitCommandError extends Error {\n readonly args: readonly string[];\n\n constructor(message: string, args: readonly string[]) {\n super(message);\n this.name = \"GitCommandError\";\n this.args = args;\n }\n}\n\nexport interface GitCommandClient {\n run(repositoryPath: string, args: readonly string[]): string;\n}\n\nexport class ExecGitCommandClient implements GitCommandClient {\n run(repositoryPath: string, args: readonly string[]): string {\n try {\n return execFileSync(\"git\", [\"-C\", repositoryPath, ...args], {\n encoding: \"utf8\",\n maxBuffer: 1024 * 1024 * 64,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : \"Unknown git execution error\";\n throw new GitCommandError(message, args);\n }\n }\n}\n","export const COMMIT_RECORD_SEPARATOR = \"\\u001e\";\nexport const COMMIT_FIELD_SEPARATOR = \"\\u001f\";\n\nexport const GIT_LOG_FORMAT =\n `%x1e%H%x1f%at%x1f%an%x1f%ae`;\n","import { COMMIT_FIELD_SEPARATOR, COMMIT_RECORD_SEPARATOR } from \"../domain/git-log-format.js\";\nimport type { GitCommitRecord, GitFileChange } from \"../domain/evolution-types.js\";\n\nconst parseInteger = (value: string): number | null => {\n if (value.length === 0) {\n return null;\n }\n\n const parsed = Number.parseInt(value, 10);\n if (Number.isNaN(parsed)) {\n return null;\n }\n\n return parsed;\n};\n\nconst parseRenamedPath = (pathSpec: string): string => {\n if (!pathSpec.includes(\" => \")) {\n return pathSpec;\n }\n\n const braceRenameMatch = pathSpec.match(/^(.*)\\{(.+) => (.+)\\}(.*)$/);\n if (braceRenameMatch !== null) {\n const [, prefix, , renamedTo, suffix] = braceRenameMatch;\n return `${prefix}${renamedTo}${suffix}`;\n }\n\n const parts = pathSpec.split(\" => \");\n const finalPart = parts[parts.length - 1];\n return finalPart ?? pathSpec;\n};\n\nconst parseNumstatLine = (line: string): GitFileChange | null => {\n const parts = line.split(\"\\t\");\n if (parts.length < 3) {\n return null;\n }\n\n const additionsRaw = parts[0];\n const deletionsRaw = parts[1];\n const pathRaw = parts.slice(2).join(\"\\t\");\n\n if (additionsRaw === undefined || deletionsRaw === undefined) {\n return null;\n }\n\n const additions = additionsRaw === \"-\" ? 0 : parseInteger(additionsRaw);\n const deletions = deletionsRaw === \"-\" ? 0 : parseInteger(deletionsRaw);\n\n if (additions === null || deletions === null) {\n return null;\n }\n\n const filePath = parseRenamedPath(pathRaw);\n return {\n filePath,\n additions,\n deletions,\n };\n};\n\nexport const parseGitLog = (rawLog: string): readonly GitCommitRecord[] => {\n const records = rawLog\n .split(COMMIT_RECORD_SEPARATOR)\n .map((record) => record.trim())\n .filter((record) => record.length > 0);\n\n const commits: GitCommitRecord[] = [];\n\n for (const record of records) {\n const lines = record\n .split(\"\\n\")\n .map((line) => line.trimEnd())\n .filter((line) => line.length > 0);\n\n if (lines.length === 0) {\n continue;\n }\n\n const headerParts = lines[0]?.split(COMMIT_FIELD_SEPARATOR) ?? [];\n if (headerParts.length !== 4) {\n continue;\n }\n\n const [hash, authoredAtRaw, authorName, authorEmail] = headerParts;\n if (hash === undefined || authoredAtRaw === undefined || authorName === undefined || authorEmail === undefined) {\n continue;\n }\n\n const authoredAtUnix = parseInteger(authoredAtRaw);\n if (authoredAtUnix === null) {\n continue;\n }\n\n const fileChanges: GitFileChange[] = [];\n for (const line of lines.slice(1)) {\n const parsedLine = parseNumstatLine(line);\n if (parsedLine !== null) {\n fileChanges.push(parsedLine);\n }\n }\n\n commits.push({\n hash,\n authorId: authorEmail.toLowerCase(),\n authorName,\n authoredAtUnix,\n fileChanges,\n });\n }\n\n commits.sort((a, b) => a.authoredAtUnix - b.authoredAtUnix || a.hash.localeCompare(b.hash));\n return commits;\n};\n","import { GIT_LOG_FORMAT } from \"../domain/git-log-format.js\";\nimport type { GitCommitRecord } from \"../domain/evolution-types.js\";\nimport type { GitHistoryProvider } from \"../application/git-history-provider.js\";\nimport { GitCommandError, type GitCommandClient } from \"./git-command-client.js\";\nimport { parseGitLog } from \"../parsing/git-log-parser.js\";\n\nconst NON_GIT_CODES = [\"not a git repository\", \"not in a git directory\"];\n\nconst isNotGitError = (error: GitCommandError): boolean => {\n const lower = error.message.toLowerCase();\n return NON_GIT_CODES.some((code) => lower.includes(code));\n};\n\nexport class GitCliHistoryProvider implements GitHistoryProvider {\n constructor(private readonly gitClient: GitCommandClient) {}\n\n isGitRepository(repositoryPath: string): boolean {\n try {\n const output = this.gitClient.run(repositoryPath, [\"rev-parse\", \"--is-inside-work-tree\"]);\n return output.trim() === \"true\";\n } catch (error) {\n if (error instanceof GitCommandError && isNotGitError(error)) {\n return false;\n }\n\n throw error;\n }\n }\n\n getCommitHistory(repositoryPath: string): readonly GitCommitRecord[] {\n const output = this.gitClient.run(repositoryPath, [\n \"-c\",\n \"core.quotepath=false\",\n \"log\",\n \"--no-merges\",\n \"--date=unix\",\n `--pretty=format:${GIT_LOG_FORMAT}`,\n \"--numstat\",\n \"--find-renames\",\n ]);\n\n return parseGitLog(output);\n }\n}\n","import type { RepositoryEvolutionSummary } from \"@codesentinel/core\";\nimport {\n analyzeRepositoryEvolution,\n type AnalyzeRepositoryEvolutionInput,\n} from \"./application/analyze-repository-evolution.js\";\nimport { ExecGitCommandClient } from \"./infrastructure/git-command-client.js\";\nimport { GitCliHistoryProvider } from \"./infrastructure/git-history-provider.js\";\n\nexport type { AnalyzeRepositoryEvolutionInput } from \"./application/analyze-repository-evolution.js\";\n\nexport const analyzeRepositoryEvolutionFromGit = (\n input: AnalyzeRepositoryEvolutionInput,\n): RepositoryEvolutionSummary => {\n const historyProvider = new GitCliHistoryProvider(new ExecGitCommandClient());\n return analyzeRepositoryEvolution(input, historyProvider);\n};\n"],"mappings":";;;AAAA,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAC7B,SAAS,SAAS,WAAAA,gBAAe;AACjC,SAAS,qBAAqB;;;ACH9B,SAAS,WAAAC,gBAAe;;;AIAxB,SAAS,SAAS,YAAY,UAAU,eAAe;AACvD,YAAY,QAAQ;AHgBpB,IAAM,UAAU,CAAC,MAAc,OAAuB,GAAG,IAAI,KAAS,EAAE;AAEjE,IAAM,kBAAkB,CAC7B,OACA,aACc;AACd,QAAM,cAAc,CAAC,GAAG,KAAK,EAAE,KAAK,CA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AExB,IAAM,oBAAoB,CAAC,cAA0C;AAC1E,QAAM,gBAAgB,QAAQ,IAAI,UAAU,KAAK,QAAQ,IAAI;AAC7D,QAAM,aAAa,kBAAkB,WAAW,aAAa;AAE7D,QAAM,aAAa,yBAAyB,EAAE,aAAa,WAAW,CAAC;AACvE,QAAM,YAAY,kCAAkC,EAAE,gBAAgB,WAAW,CAAC;AAElF,QAAM,UAA0B;AAAA,IAC9B;AAAA,IACA;AAAA,EACF;AAEA,SAAO,KAAK,UAAU,SAAS,MAAM,CAAC;AACxC;;;ADfA,IAAM,UAAU,IAAI,QAAQ;AAC5B,IAAM,kBAAkBC,SAAQ,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,iBAAiB;AAC1F,IAAM,EAAE,QAAQ,IAAI,KAAK,MAAM,aAAa,iBAAiB,MAAM,CAAC;AAEpE,QACG,KAAK,cAAc,EACnB,YAAY,+EAA+E,EAC3F,QAAQ,OAAO;AAElB,QACG,QAAQ,SAAS,EACjB,SAAS,UAAU,gCAAgC,EACnD,OAAO,CAAC,SAAkB;AACzB,QAAM,SAAS,kBAAkB,IAAI;AACrC,UAAQ,OAAO,MAAM,GAAG,MAAM;AAAA,CAAI;AACpC,CAAC;AAEH,IAAI,QAAQ,KAAK,UAAU,GAAG;AAC5B,UAAQ,WAAW;AACnB,UAAQ,KAAK,CAAC;AAChB;AAEA,QAAQ,MAAM,QAAQ,IAAI;","names":["resolve","resolve","nodeLowLink","program","resolve","resolve"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/application/run-analyze-command.ts","../../code-graph/src/domain/graph-model.ts","../../code-graph/src/domain/tarjan.ts","../../code-graph/src/domain/graph-metrics.ts","../../code-graph/src/infrastructure/typescript-project.ts","../../code-graph/src/application/build-project-graph-summary.ts","../../dependency-firewall/src/domain/external-analysis.ts","../../dependency-firewall/src/domain/types.ts","../../dependency-firewall/src/infrastructure/fs-loader.ts","../../dependency-firewall/src/parsing/package-json-loader.ts","../../dependency-firewall/src/parsing/package-lock-parser.ts","../../dependency-firewall/src/parsing/pnpm-lock-parser.ts","../../dependency-firewall/src/parsing/yarn-lock-parser.ts","../../dependency-firewall/src/parsing/bun-lock-parser.ts","../../dependency-firewall/src/application/analyze-dependency-exposure.ts","../../dependency-firewall/src/infrastructure/npm-registry-metadata-provider.ts","../../dependency-firewall/src/infrastructure/noop-metadata-provider.ts","../../dependency-firewall/src/index.ts","../../git-analyzer/src/domain/evolution-metrics.ts","../../git-analyzer/src/domain/evolution-types.ts","../../git-analyzer/src/application/analyze-repository-evolution.ts","../../git-analyzer/src/infrastructure/git-command-client.ts","../../git-analyzer/src/domain/git-log-format.ts","../../git-analyzer/src/parsing/git-log-parser.ts","../../git-analyzer/src/infrastructure/git-history-provider.ts","../../git-analyzer/src/index.ts"],"sourcesContent":["import { Command, Option } from \"commander\";\nimport { readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { runAnalyzeCommand, type AuthorIdentityCliMode } from \"./application/run-analyze-command.js\";\n\nconst program = new Command();\nconst packageJsonPath = resolve(dirname(fileURLToPath(import.meta.url)), \"../package.json\");\nconst { version } = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as { version: string };\n\nprogram\n .name(\"codesentinel\")\n .description(\"Structural and evolutionary risk analysis for TypeScript/JavaScript codebases\")\n .version(version);\n\nprogram\n .command(\"analyze\")\n .argument(\"[path]\", \"path to the project to analyze\")\n .addOption(\n new Option(\n \"--author-identity <mode>\",\n \"author identity mode: likely_merge (heuristic) or strict_email (deterministic)\",\n )\n .choices([\"likely_merge\", \"strict_email\"])\n .default(\"likely_merge\"),\n )\n .action(async (path: string | undefined, options: { authorIdentity: AuthorIdentityCliMode }) => {\n const output = await runAnalyzeCommand(path, options.authorIdentity);\n process.stdout.write(`${output}\\n`);\n });\n\nif (process.argv.length <= 2) {\n program.outputHelp();\n process.exit(0);\n}\n\nawait program.parseAsync(process.argv);\n","import { resolve } from \"node:path\";\nimport { buildProjectGraphSummary } from \"@codesentinel/code-graph\";\nimport { analyzeDependencyExposureFromProject } from \"@codesentinel/dependency-firewall\";\nimport { analyzeRepositoryEvolutionFromGit } from \"@codesentinel/git-analyzer\";\nimport type { AnalyzeSummary } from \"@codesentinel/core\";\n\nexport type AuthorIdentityCliMode = \"likely_merge\" | \"strict_email\";\n\nconst resolveTargetPath = (inputPath: string | undefined, cwd: string): string =>\n resolve(cwd, inputPath ?? \".\");\n\nexport const runAnalyzeCommand = async (\n inputPath: string | undefined,\n authorIdentityMode: AuthorIdentityCliMode,\n): Promise<string> => {\n const invocationCwd = process.env[\"INIT_CWD\"] ?? process.cwd();\n const targetPath = resolveTargetPath(inputPath, invocationCwd);\n\n const structural = buildProjectGraphSummary({ projectPath: targetPath });\n const evolution = analyzeRepositoryEvolutionFromGit({\n repositoryPath: targetPath,\n config: { authorIdentityMode },\n });\n const external = await analyzeDependencyExposureFromProject({ repositoryPath: targetPath });\n\n const summary: AnalyzeSummary = {\n structural,\n evolution,\n external,\n };\n\n return JSON.stringify(summary, null, 2);\n};\n","export type NodeRecord = {\n id: string;\n absolutePath: string;\n relativePath: string;\n};\n\nexport type EdgeRecord = {\n from: string;\n to: string;\n};\n\nexport type GraphData = {\n nodes: readonly NodeRecord[];\n edges: readonly EdgeRecord[];\n adjacencyById: ReadonlyMap<string, readonly string[]>;\n};\n\nconst edgeKey = (from: string, to: string): string => `${from}\\u0000${to}`;\n\nexport const createGraphData = (\n nodes: readonly NodeRecord[],\n rawEdges: readonly EdgeRecord[],\n): GraphData => {\n const sortedNodes = [...nodes].sort((a, b) => a.id.localeCompare(b.id));\n const knownNodeIds = new Set(sortedNodes.map((node) => node.id));\n\n const uniqueEdgeMap = new Map<string, EdgeRecord>();\n for (const edge of rawEdges) {\n if (edge.from === edge.to) {\n continue;\n }\n\n if (!knownNodeIds.has(edge.from) || !knownNodeIds.has(edge.to)) {\n continue;\n }\n\n uniqueEdgeMap.set(edgeKey(edge.from, edge.to), edge);\n }\n\n const sortedEdges = [...uniqueEdgeMap.values()].sort((a, b) => {\n const fromCompare = a.from.localeCompare(b.from);\n if (fromCompare !== 0) {\n return fromCompare;\n }\n\n return a.to.localeCompare(b.to);\n });\n\n const adjacency = new Map<string, string[]>();\n for (const node of sortedNodes) {\n adjacency.set(node.id, []);\n }\n\n for (const edge of sortedEdges) {\n adjacency.get(edge.from)?.push(edge.to);\n }\n\n const adjacencyById = new Map<string, readonly string[]>();\n for (const [nodeId, targets] of adjacency.entries()) {\n adjacencyById.set(nodeId, [...targets]);\n }\n\n return {\n nodes: sortedNodes,\n edges: sortedEdges,\n adjacencyById,\n };\n};\n","type TarjanResult = {\n components: readonly (readonly string[])[];\n};\n\nexport const runTarjanScc = (adjacencyById: ReadonlyMap<string, readonly string[]>): TarjanResult => {\n let index = 0;\n const indices = new Map<string, number>();\n const lowLink = new Map<string, number>();\n const stack: string[] = [];\n const onStack = new Set<string>();\n const components: string[][] = [];\n\n const strongConnect = (nodeId: string): void => {\n indices.set(nodeId, index);\n lowLink.set(nodeId, index);\n index += 1;\n\n stack.push(nodeId);\n onStack.add(nodeId);\n\n const neighbors = adjacencyById.get(nodeId) ?? [];\n for (const nextId of neighbors) {\n if (!indices.has(nextId)) {\n strongConnect(nextId);\n const nodeLowLink = lowLink.get(nodeId);\n const nextLowLink = lowLink.get(nextId);\n if (nodeLowLink !== undefined && nextLowLink !== undefined && nextLowLink < nodeLowLink) {\n lowLink.set(nodeId, nextLowLink);\n }\n continue;\n }\n\n if (onStack.has(nextId)) {\n const nodeLowLink = lowLink.get(nodeId);\n const nextIndex = indices.get(nextId);\n if (nodeLowLink !== undefined && nextIndex !== undefined && nextIndex < nodeLowLink) {\n lowLink.set(nodeId, nextIndex);\n }\n }\n }\n\n const nodeLowLink = lowLink.get(nodeId);\n const nodeIndex = indices.get(nodeId);\n if (nodeLowLink === undefined || nodeIndex === undefined || nodeLowLink !== nodeIndex) {\n return;\n }\n\n const component: string[] = [];\n for (;;) {\n const popped = stack.pop();\n if (popped === undefined) {\n break;\n }\n\n onStack.delete(popped);\n component.push(popped);\n if (popped === nodeId) {\n break;\n }\n }\n\n component.sort((a, b) => a.localeCompare(b));\n components.push(component);\n };\n\n const nodeIds = [...adjacencyById.keys()].sort((a, b) => a.localeCompare(b));\n for (const nodeId of nodeIds) {\n if (!indices.has(nodeId)) {\n strongConnect(nodeId);\n }\n }\n\n components.sort((a, b) => {\n const firstA = a[0] ?? \"\";\n const firstB = b[0] ?? \"\";\n return firstA.localeCompare(firstB);\n });\n\n return { components };\n};\n","import type { FileDependency, GraphAnalysisSummary, GraphCycle, GraphMetrics } from \"@codesentinel/core\";\nimport type { GraphData } from \"./graph-model.js\";\nimport { runTarjanScc } from \"./tarjan.js\";\n\ntype DepthComputation = {\n depthByNodeId: ReadonlyMap<string, number>;\n graphDepth: number;\n cycles: readonly GraphCycle[];\n};\n\nconst hasSelfLoop = (nodeId: string, adjacencyById: ReadonlyMap<string, readonly string[]>): boolean => {\n const targets = adjacencyById.get(nodeId) ?? [];\n return targets.includes(nodeId);\n};\n\nconst computeCyclesAndDepth = (graph: GraphData): DepthComputation => {\n const { components } = runTarjanScc(graph.adjacencyById);\n\n const cycles: GraphCycle[] = [];\n const componentByNodeId = new Map<string, number>();\n components.forEach((component, index) => {\n for (const nodeId of component) {\n componentByNodeId.set(nodeId, index);\n }\n\n if (component.length > 1) {\n cycles.push({ nodes: [...component] });\n return;\n }\n\n const onlyNode = component[0];\n if (onlyNode !== undefined && hasSelfLoop(onlyNode, graph.adjacencyById)) {\n cycles.push({ nodes: [...component] });\n }\n });\n\n const dagOutgoing = new Map<number, Set<number>>();\n const inDegree = new Map<number, number>();\n\n for (let i = 0; i < components.length; i += 1) {\n dagOutgoing.set(i, new Set());\n inDegree.set(i, 0);\n }\n\n for (const edge of graph.edges) {\n const fromComponent = componentByNodeId.get(edge.from);\n const toComponent = componentByNodeId.get(edge.to);\n\n if (fromComponent === undefined || toComponent === undefined || fromComponent === toComponent) {\n continue;\n }\n\n const outgoing = dagOutgoing.get(fromComponent);\n if (outgoing?.has(toComponent) === true) {\n continue;\n }\n\n outgoing?.add(toComponent);\n inDegree.set(toComponent, (inDegree.get(toComponent) ?? 0) + 1);\n }\n\n const queue: number[] = [];\n const depthByComponent = new Map<number, number>();\n\n for (let i = 0; i < components.length; i += 1) {\n if ((inDegree.get(i) ?? 0) === 0) {\n queue.push(i);\n depthByComponent.set(i, 0);\n }\n }\n\n let cursor = 0;\n while (cursor < queue.length) {\n const componentId = queue[cursor];\n cursor += 1;\n\n if (componentId === undefined) {\n continue;\n }\n\n const currentDepth = depthByComponent.get(componentId) ?? 0;\n const outgoing = dagOutgoing.get(componentId) ?? new Set<number>();\n\n for (const nextComponent of outgoing) {\n const nextDepth = depthByComponent.get(nextComponent) ?? 0;\n if (currentDepth + 1 > nextDepth) {\n depthByComponent.set(nextComponent, currentDepth + 1);\n }\n\n const remainingIncoming = (inDegree.get(nextComponent) ?? 0) - 1;\n inDegree.set(nextComponent, remainingIncoming);\n if (remainingIncoming === 0) {\n queue.push(nextComponent);\n }\n }\n }\n\n const depthByNodeId = new Map<string, number>();\n let graphDepth = 0;\n\n components.forEach((component, componentId) => {\n const componentDepth = depthByComponent.get(componentId) ?? 0;\n if (componentDepth > graphDepth) {\n graphDepth = componentDepth;\n }\n\n for (const nodeId of component) {\n depthByNodeId.set(nodeId, componentDepth);\n }\n });\n\n cycles.sort((a, b) => {\n const firstA = a.nodes[0] ?? \"\";\n const firstB = b.nodes[0] ?? \"\";\n return firstA.localeCompare(firstB);\n });\n\n return {\n depthByNodeId,\n graphDepth,\n cycles,\n };\n};\n\nexport const createGraphAnalysisSummary = (\n targetPath: string,\n graph: GraphData,\n): GraphAnalysisSummary => {\n const fanInById = new Map<string, number>();\n const fanOutById = new Map<string, number>();\n\n for (const node of graph.nodes) {\n fanInById.set(node.id, 0);\n fanOutById.set(node.id, graph.adjacencyById.get(node.id)?.length ?? 0);\n }\n\n for (const edge of graph.edges) {\n fanInById.set(edge.to, (fanInById.get(edge.to) ?? 0) + 1);\n }\n\n const { cycles, depthByNodeId, graphDepth } = computeCyclesAndDepth(graph);\n\n let maxFanIn = 0;\n let maxFanOut = 0;\n\n const files: FileDependency[] = graph.nodes.map((node) => {\n const fanIn = fanInById.get(node.id) ?? 0;\n const fanOut = fanOutById.get(node.id) ?? 0;\n\n if (fanIn > maxFanIn) {\n maxFanIn = fanIn;\n }\n\n if (fanOut > maxFanOut) {\n maxFanOut = fanOut;\n }\n\n return {\n id: node.id,\n relativePath: node.relativePath,\n directDependencies: graph.adjacencyById.get(node.id) ?? [],\n fanIn,\n fanOut,\n depth: depthByNodeId.get(node.id) ?? 0,\n };\n });\n\n const metrics: GraphMetrics = {\n nodeCount: graph.nodes.length,\n edgeCount: graph.edges.length,\n cycleCount: cycles.length,\n graphDepth,\n maxFanIn,\n maxFanOut,\n };\n\n return {\n targetPath,\n nodes: graph.nodes,\n edges: graph.edges,\n cycles,\n files,\n metrics,\n };\n};\n","import { extname, isAbsolute, relative, resolve } from \"node:path\";\nimport * as ts from \"typescript\";\nimport type { EdgeRecord, NodeRecord } from \"../domain/graph-model.js\";\n\ntype ParsedProject = {\n nodes: readonly NodeRecord[];\n edges: readonly EdgeRecord[];\n};\n\nconst SOURCE_EXTENSIONS = new Set([\".ts\", \".tsx\", \".mts\", \".cts\", \".js\", \".jsx\", \".mjs\", \".cjs\"]);\n\nconst normalizePath = (pathValue: string): string => pathValue.replaceAll(\"\\\\\", \"/\");\n\nconst isProjectSourceFile = (filePath: string, projectRoot: string): boolean => {\n const extension = extname(filePath);\n if (!SOURCE_EXTENSIONS.has(extension)) {\n return false;\n }\n\n const relativePath = relative(projectRoot, filePath);\n if (relativePath.startsWith(\"..\")) {\n return false;\n }\n\n return !relativePath.includes(\"node_modules\");\n};\n\nconst findProjectFiles = (projectRoot: string): readonly string[] => {\n const files = ts.sys.readDirectory(projectRoot, [...SOURCE_EXTENSIONS], undefined, undefined);\n return files.map((filePath) => resolve(filePath));\n};\n\nconst parseTsConfig = (projectRoot: string): { fileNames: readonly string[]; options: ts.CompilerOptions } => {\n const configPath = ts.findConfigFile(projectRoot, ts.sys.fileExists, \"tsconfig.json\");\n if (configPath === undefined) {\n return {\n fileNames: findProjectFiles(projectRoot),\n options: {\n allowJs: true,\n moduleResolution: ts.ModuleResolutionKind.NodeNext,\n },\n };\n }\n\n const parsedCommandLine = ts.getParsedCommandLineOfConfigFile(\n configPath,\n {},\n {\n ...ts.sys,\n onUnRecoverableConfigFileDiagnostic: () => {\n throw new Error(`Failed to parse TypeScript configuration at ${configPath}`);\n },\n },\n );\n\n if (parsedCommandLine === undefined) {\n throw new Error(`Failed to parse TypeScript configuration at ${configPath}`);\n }\n\n const fileNames = parsedCommandLine.fileNames.map((filePath) => resolve(filePath));\n if (fileNames.length === 0) {\n return {\n fileNames: findProjectFiles(projectRoot),\n options: parsedCommandLine.options,\n };\n }\n\n return {\n fileNames,\n options: parsedCommandLine.options,\n };\n};\n\nconst getSpecifierFromExpression = (expression: ts.Expression): string | undefined => {\n if (ts.isStringLiteral(expression)) {\n return expression.text;\n }\n\n if (ts.isNoSubstitutionTemplateLiteral(expression)) {\n return expression.text;\n }\n\n return undefined;\n};\n\nconst hasRuntimeImport = (importDeclaration: ts.ImportDeclaration): boolean => {\n const importClause = importDeclaration.importClause;\n if (importClause === undefined) {\n return true;\n }\n\n if (importClause.isTypeOnly) {\n return false;\n }\n\n if (importClause.name !== undefined) {\n return true;\n }\n\n const namedBindings = importClause.namedBindings;\n if (namedBindings === undefined) {\n return false;\n }\n\n if (ts.isNamespaceImport(namedBindings)) {\n return true;\n }\n\n if (namedBindings.elements.length === 0) {\n return true;\n }\n\n return namedBindings.elements.some((element) => !element.isTypeOnly);\n};\n\nconst extractModuleSpecifiers = (sourceFile: ts.SourceFile): readonly string[] => {\n const specifiers = new Set<string>();\n\n const visit = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) {\n if (hasRuntimeImport(node) && node.moduleSpecifier !== undefined) {\n const specifier = getSpecifierFromExpression(node.moduleSpecifier);\n if (specifier !== undefined) {\n specifiers.add(specifier);\n }\n }\n return;\n }\n\n if (ts.isExportDeclaration(node)) {\n if (!node.isTypeOnly && node.moduleSpecifier !== undefined) {\n const specifier = getSpecifierFromExpression(node.moduleSpecifier);\n if (specifier !== undefined) {\n specifiers.add(specifier);\n }\n }\n return;\n }\n\n if (ts.isCallExpression(node)) {\n if (node.expression.kind === ts.SyntaxKind.ImportKeyword && node.arguments.length > 0) {\n const firstArgument = node.arguments[0];\n if (firstArgument !== undefined) {\n const specifier = getSpecifierFromExpression(firstArgument);\n if (specifier !== undefined) {\n specifiers.add(specifier);\n }\n }\n }\n\n if (ts.isIdentifier(node.expression) && node.expression.text === \"require\" && node.arguments.length > 0) {\n const firstArgument = node.arguments[0];\n if (firstArgument !== undefined) {\n const specifier = getSpecifierFromExpression(firstArgument);\n if (specifier !== undefined) {\n specifiers.add(specifier);\n }\n }\n }\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n return [...specifiers];\n};\n\nexport const parseTypescriptProject = (projectPath: string): ParsedProject => {\n const projectRoot = isAbsolute(projectPath) ? projectPath : resolve(projectPath);\n const { fileNames, options } = parseTsConfig(projectRoot);\n\n const sourceFilePaths = fileNames\n .filter((filePath) => isProjectSourceFile(filePath, projectRoot))\n .map((filePath) => normalizePath(resolve(filePath)));\n\n const uniqueSourceFilePaths = [...new Set(sourceFilePaths)].sort((a, b) => a.localeCompare(b));\n const sourceFilePathSet = new Set(uniqueSourceFilePaths);\n\n const program = ts.createProgram({\n rootNames: uniqueSourceFilePaths,\n options,\n });\n\n const nodeByAbsolutePath = new Map<string, NodeRecord>();\n for (const sourcePath of uniqueSourceFilePaths) {\n const relativePath = normalizePath(relative(projectRoot, sourcePath));\n const nodeId = relativePath;\n nodeByAbsolutePath.set(sourcePath, {\n id: nodeId,\n absolutePath: sourcePath,\n relativePath,\n });\n }\n\n const resolverCache = new Map<string, string | undefined>();\n const edges: EdgeRecord[] = [];\n\n for (const sourcePath of uniqueSourceFilePaths) {\n const sourceFile = program.getSourceFile(sourcePath);\n if (sourceFile === undefined) {\n continue;\n }\n\n const fromNode = nodeByAbsolutePath.get(sourcePath);\n if (fromNode === undefined) {\n continue;\n }\n\n const moduleSpecifiers = extractModuleSpecifiers(sourceFile);\n for (const specifier of moduleSpecifiers) {\n const cacheKey = `${sourcePath}\\u0000${specifier}`;\n let resolvedPath = resolverCache.get(cacheKey);\n\n if (resolvedPath === undefined && !resolverCache.has(cacheKey)) {\n const resolved = ts.resolveModuleName(specifier, sourcePath, options, ts.sys).resolvedModule;\n if (resolved !== undefined) {\n resolvedPath = normalizePath(resolve(resolved.resolvedFileName));\n }\n resolverCache.set(cacheKey, resolvedPath);\n }\n\n if (resolvedPath === undefined || !sourceFilePathSet.has(resolvedPath)) {\n continue;\n }\n\n const toNode = nodeByAbsolutePath.get(resolvedPath);\n if (toNode === undefined) {\n continue;\n }\n\n edges.push({ from: fromNode.id, to: toNode.id });\n }\n }\n\n return {\n nodes: [...nodeByAbsolutePath.values()],\n edges,\n };\n};\n","import type { GraphAnalysisSummary } from \"@codesentinel/core\";\nimport { createGraphData } from \"../domain/graph-model.js\";\nimport { createGraphAnalysisSummary } from \"../domain/graph-metrics.js\";\nimport { parseTypescriptProject } from \"../infrastructure/typescript-project.js\";\n\nexport type BuildProjectGraphSummaryInput = {\n projectPath: string;\n};\n\nexport const buildProjectGraphSummary = (\n input: BuildProjectGraphSummaryInput,\n): GraphAnalysisSummary => {\n const parsedProject = parseTypescriptProject(input.projectPath);\n const graphData = createGraphData(parsedProject.nodes, parsedProject.edges);\n return createGraphAnalysisSummary(input.projectPath, graphData);\n};\n","import type {\n CentralDependency,\n DependencyExposureRecord,\n DependencyRiskSignal,\n ExternalAnalysisSummary,\n} from \"@codesentinel/core\";\nimport type {\n DependencyMetadata,\n ExternalAnalysisConfig,\n LockfileExtraction,\n LockedDependencyNode,\n} from \"./types.js\";\n\nconst round4 = (value: number): number => Number(value.toFixed(4));\n\ntype NormalizedNode = {\n key: string;\n name: string;\n version: string;\n dependencies: readonly string[];\n};\n\nconst normalizeNodes = (nodes: readonly LockedDependencyNode[]): readonly NormalizedNode[] => {\n const byName = new Map<string, LockedDependencyNode[]>();\n\n for (const node of nodes) {\n const bucket = byName.get(node.name) ?? [];\n bucket.push(node);\n byName.set(node.name, bucket);\n }\n\n const normalized: NormalizedNode[] = [];\n\n for (const [name, candidates] of byName.entries()) {\n if (candidates.length === 0) {\n continue;\n }\n\n candidates.sort((a, b) => b.version.localeCompare(a.version));\n const selected = candidates[0];\n if (selected === undefined) {\n continue;\n }\n\n const deps = selected.dependencies\n .map((dep) => {\n const at = dep.lastIndexOf(\"@\");\n return at <= 0 ? dep : dep.slice(0, at);\n })\n .filter((depName) => depName.length > 0)\n .sort((a, b) => a.localeCompare(b));\n\n normalized.push({\n key: `${name}@${selected.version}`,\n name,\n version: selected.version,\n dependencies: deps,\n });\n }\n\n return normalized.sort((a, b) => a.name.localeCompare(b.name));\n};\n\nconst computeDepths = (\n nodeByName: ReadonlyMap<string, NormalizedNode>,\n directNames: ReadonlySet<string>,\n): { depthByName: ReadonlyMap<string, number>; maxDepth: number } => {\n const visiting = new Set<string>();\n const depthByName = new Map<string, number>();\n\n const compute = (name: string): number => {\n const known = depthByName.get(name);\n if (known !== undefined) {\n return known;\n }\n\n if (visiting.has(name)) {\n return 0;\n }\n\n visiting.add(name);\n\n const node = nodeByName.get(name);\n if (node === undefined) {\n visiting.delete(name);\n depthByName.set(name, 0);\n return 0;\n }\n\n let maxChildDepth = 0;\n for (const dependencyName of node.dependencies) {\n const childDepth = compute(dependencyName);\n if (childDepth > maxChildDepth) {\n maxChildDepth = childDepth;\n }\n }\n\n visiting.delete(name);\n const ownDepth = directNames.has(name) ? 0 : maxChildDepth + 1;\n depthByName.set(name, ownDepth);\n return ownDepth;\n };\n\n for (const name of nodeByName.keys()) {\n compute(name);\n }\n\n let maxDepth = 0;\n for (const depth of depthByName.values()) {\n if (depth > maxDepth) {\n maxDepth = depth;\n }\n }\n\n return { depthByName, maxDepth };\n};\n\nconst rankCentrality = (\n nodes: readonly NormalizedNode[],\n dependentsByName: ReadonlyMap<string, number>,\n directNames: ReadonlySet<string>,\n topN: number,\n): readonly CentralDependency[] =>\n [...nodes]\n .map((node) => ({\n name: node.name,\n dependents: dependentsByName.get(node.name) ?? 0,\n fanOut: node.dependencies.length,\n direct: directNames.has(node.name),\n }))\n .sort(\n (a, b) =>\n b.dependents - a.dependents ||\n b.fanOut - a.fanOut ||\n a.name.localeCompare(b.name),\n )\n .slice(0, topN);\n\nconst canPropagateSignal = (signal: DependencyRiskSignal): boolean =>\n signal === \"abandoned\" ||\n signal === \"high_centrality\" ||\n signal === \"deep_chain\" ||\n signal === \"high_fanout\";\n\nconst collectTransitiveDependencies = (\n rootName: string,\n nodeByName: ReadonlyMap<string, NormalizedNode>,\n): readonly string[] => {\n const seen = new Set<string>();\n const stack = [...(nodeByName.get(rootName)?.dependencies ?? [])];\n\n while (stack.length > 0) {\n const current = stack.pop();\n if (current === undefined || seen.has(current) || current === rootName) {\n continue;\n }\n\n seen.add(current);\n const currentNode = nodeByName.get(current);\n if (currentNode === undefined) {\n continue;\n }\n\n for (const next of currentNode.dependencies) {\n if (!seen.has(next)) {\n stack.push(next);\n }\n }\n }\n\n return [...seen].sort((a, b) => a.localeCompare(b));\n};\n\nexport const buildExternalAnalysisSummary = (\n targetPath: string,\n extraction: LockfileExtraction,\n metadataByKey: ReadonlyMap<string, DependencyMetadata | null>,\n config: ExternalAnalysisConfig,\n): ExternalAnalysisSummary => {\n const nodes = normalizeNodes(extraction.nodes);\n const directNames = new Set(extraction.directDependencies.map((dep) => dep.name));\n const directSpecByName = new Map(extraction.directDependencies.map((dep) => [dep.name, dep.requestedRange]));\n\n const nodeByName = new Map(nodes.map((node) => [node.name, node]));\n const dependentsByName = new Map<string, number>();\n\n for (const node of nodes) {\n dependentsByName.set(node.name, dependentsByName.get(node.name) ?? 0);\n }\n\n for (const node of nodes) {\n for (const dependencyName of node.dependencies) {\n if (!nodeByName.has(dependencyName)) {\n continue;\n }\n\n dependentsByName.set(dependencyName, (dependentsByName.get(dependencyName) ?? 0) + 1);\n }\n }\n\n const { depthByName, maxDepth } = computeDepths(nodeByName, directNames);\n const centralityRanking = rankCentrality(nodes, dependentsByName, directNames, config.centralityTopN);\n\n const topCentralNames = new Set(\n centralityRanking\n .slice(0, Math.max(1, Math.ceil(centralityRanking.length * 0.25)))\n .map((entry) => entry.name),\n );\n\n const allDependencies: DependencyExposureRecord[] = [];\n let metadataAvailableCount = 0;\n\n for (const node of nodes) {\n const metadata = metadataByKey.get(node.key) ?? null;\n if (metadata !== null) {\n metadataAvailableCount += 1;\n }\n\n const dependencyDepth = depthByName.get(node.name) ?? 0;\n const dependents = dependentsByName.get(node.name) ?? 0;\n\n const riskSignals: DependencyRiskSignal[] = [];\n\n if ((metadata?.maintainerCount ?? 0) === 1) {\n riskSignals.push(\"single_maintainer\");\n }\n\n if ((metadata?.daysSinceLastRelease ?? 0) >= config.abandonedDaysThreshold) {\n riskSignals.push(\"abandoned\");\n }\n\n if (topCentralNames.has(node.name) && dependents > 0) {\n riskSignals.push(\"high_centrality\");\n }\n\n if (dependencyDepth >= config.deepChainThreshold) {\n riskSignals.push(\"deep_chain\");\n }\n\n if (node.dependencies.length >= config.fanOutHighThreshold) {\n riskSignals.push(\"high_fanout\");\n }\n\n if (metadata === null) {\n riskSignals.push(\"metadata_unavailable\");\n }\n\n allDependencies.push({\n name: node.name,\n direct: directNames.has(node.name),\n requestedRange: directSpecByName.get(node.name) ?? null,\n resolvedVersion: node.version,\n transitiveDependencies: [],\n dependencyDepth,\n fanOut: node.dependencies.length,\n dependents,\n maintainerCount: metadata?.maintainerCount ?? null,\n releaseFrequencyDays: metadata?.releaseFrequencyDays ?? null,\n daysSinceLastRelease: metadata?.daysSinceLastRelease ?? null,\n repositoryActivity30d: metadata?.repositoryActivity30d ?? null,\n busFactor: metadata?.busFactor ?? null,\n ownRiskSignals: [...riskSignals].sort((a, b) => a.localeCompare(b)),\n inheritedRiskSignals: [],\n riskSignals,\n });\n }\n\n allDependencies.sort((a, b) => a.name.localeCompare(b.name));\n\n const allByName = new Map(allDependencies.map((dep) => [dep.name, dep]));\n\n const dependencies: DependencyExposureRecord[] = allDependencies\n .filter((dep) => dep.direct)\n .map((dep) => {\n const transitiveDependencies = collectTransitiveDependencies(dep.name, nodeByName);\n const inheritedSignals = new Set<DependencyRiskSignal>();\n const allSignals = new Set(dep.ownRiskSignals);\n\n for (const transitiveName of transitiveDependencies) {\n const transitive = allByName.get(transitiveName);\n if (transitive === undefined) {\n continue;\n }\n\n for (const signal of transitive.riskSignals) {\n if (canPropagateSignal(signal)) {\n inheritedSignals.add(signal);\n allSignals.add(signal);\n }\n }\n }\n\n return {\n ...dep,\n transitiveDependencies,\n inheritedRiskSignals: [...inheritedSignals].sort((a, b) => a.localeCompare(b)),\n riskSignals: [...allSignals].sort((a, b) => a.localeCompare(b)),\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name));\n\n const highRiskDependencies = dependencies\n .filter((dep) => dep.riskSignals.length > 1)\n .sort((a, b) => b.riskSignals.length - a.riskSignals.length || a.name.localeCompare(b.name))\n .slice(0, config.maxHighRiskDependencies)\n .map((dep) => dep.name);\n\n const singleMaintainerDependencies = dependencies\n .filter((dep) => dep.ownRiskSignals.includes(\"single_maintainer\"))\n .map((dep) => dep.name)\n .sort((a, b) => a.localeCompare(b));\n\n const abandonedDependencies = dependencies\n .filter((dep) => dep.ownRiskSignals.includes(\"abandoned\"))\n .map((dep) => dep.name)\n .sort((a, b) => a.localeCompare(b));\n\n return {\n targetPath,\n available: true,\n metrics: {\n totalDependencies: allDependencies.length,\n directDependencies: dependencies.length,\n transitiveDependencies: allDependencies.length - dependencies.length,\n dependencyDepth: maxDepth,\n lockfileKind: extraction.kind,\n metadataCoverage: allDependencies.length === 0 ? 0 : round4(metadataAvailableCount / allDependencies.length),\n },\n dependencies,\n highRiskDependencies,\n singleMaintainerDependencies,\n abandonedDependencies,\n centralityRanking,\n };\n};\n","export type LockfileKind = \"pnpm\" | \"npm\" | \"npm-shrinkwrap\" | \"yarn\" | \"bun\";\n\nexport type DirectDependencySpec = {\n name: string;\n requestedRange: string;\n};\n\nexport type LockedDependencyNode = {\n name: string;\n version: string;\n dependencies: readonly string[];\n};\n\nexport type LockfileExtraction = {\n kind: LockfileKind;\n directDependencies: readonly DirectDependencySpec[];\n nodes: readonly LockedDependencyNode[];\n};\n\nexport type DependencyMetadata = {\n name: string;\n version: string;\n maintainerCount: number | null;\n releaseFrequencyDays: number | null;\n daysSinceLastRelease: number | null;\n repositoryActivity30d: number | null;\n busFactor: number | null;\n};\n\nexport interface DependencyMetadataProvider {\n getMetadata(name: string, version: string): Promise<DependencyMetadata | null>;\n}\n\nexport type ExternalAnalysisConfig = {\n abandonedDaysThreshold: number;\n deepChainThreshold: number;\n fanOutHighThreshold: number;\n centralityTopN: number;\n maxHighRiskDependencies: number;\n metadataRequestConcurrency: number;\n};\n\nexport const DEFAULT_EXTERNAL_ANALYSIS_CONFIG: ExternalAnalysisConfig = {\n abandonedDaysThreshold: 540,\n deepChainThreshold: 6,\n fanOutHighThreshold: 25,\n centralityTopN: 20,\n maxHighRiskDependencies: 100,\n metadataRequestConcurrency: 8,\n};\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport type RepositoryFiles = {\n packageJsonPath: string;\n packageJsonRaw: string;\n lockfilePath: string;\n lockfileRaw: string;\n};\n\nconst LOCKFILE_CANDIDATES: readonly { fileName: string; kind: \"pnpm\" | \"npm\" | \"npm-shrinkwrap\" | \"yarn\" | \"bun\" }[] = [\n { fileName: \"pnpm-lock.yaml\", kind: \"pnpm\" },\n { fileName: \"package-lock.json\", kind: \"npm\" },\n { fileName: \"npm-shrinkwrap.json\", kind: \"npm-shrinkwrap\" },\n { fileName: \"yarn.lock\", kind: \"yarn\" },\n { fileName: \"bun.lock\", kind: \"bun\" },\n { fileName: \"bun.lockb\", kind: \"bun\" },\n];\n\nexport type LockfileSelection = {\n path: string;\n kind: \"pnpm\" | \"npm\" | \"npm-shrinkwrap\" | \"yarn\" | \"bun\";\n raw: string;\n};\n\nexport const loadPackageJson = (repositoryPath: string): { path: string; raw: string } | null => {\n const packageJsonPath = join(repositoryPath, \"package.json\");\n if (!existsSync(packageJsonPath)) {\n return null;\n }\n\n return {\n path: packageJsonPath,\n raw: readFileSync(packageJsonPath, \"utf8\"),\n };\n};\n\nexport const selectLockfile = (repositoryPath: string): LockfileSelection | null => {\n for (const candidate of LOCKFILE_CANDIDATES) {\n const absolutePath = join(repositoryPath, candidate.fileName);\n if (!existsSync(absolutePath)) {\n continue;\n }\n\n return {\n path: absolutePath,\n kind: candidate.kind,\n raw: readFileSync(absolutePath, \"utf8\"),\n };\n }\n\n return null;\n};\n","import type { DirectDependencySpec } from \"../domain/types.js\";\n\ntype ParsedPackageJson = {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n};\n\nexport const parsePackageJson = (raw: string): readonly DirectDependencySpec[] => {\n const parsed = JSON.parse(raw) as ParsedPackageJson;\n const merged = new Map<string, string>();\n\n for (const block of [\n parsed.dependencies,\n parsed.devDependencies,\n parsed.optionalDependencies,\n parsed.peerDependencies,\n ]) {\n if (block === undefined) {\n continue;\n }\n\n for (const [name, versionRange] of Object.entries(block)) {\n merged.set(name, versionRange);\n }\n }\n\n return [...merged.entries()]\n .map(([name, requestedRange]) => ({ name, requestedRange }))\n .sort((a, b) => a.name.localeCompare(b.name));\n};\n","import type { DirectDependencySpec, LockfileExtraction, LockedDependencyNode } from \"../domain/types.js\";\n\ntype PackageLockNode = {\n version?: string;\n dependencies?: Record<string, string>;\n};\n\ntype PackageLockShape = {\n lockfileVersion?: number;\n packages?: Record<string, PackageLockNode>;\n dependencies?: Record<string, { version?: string; dependencies?: Record<string, unknown> }>;\n};\n\nexport const parsePackageLock = (raw: string, directSpecs: readonly DirectDependencySpec[]): LockfileExtraction => {\n const parsed = JSON.parse(raw) as PackageLockShape;\n const nodes: LockedDependencyNode[] = [];\n\n if (parsed.packages !== undefined) {\n for (const [packagePath, packageData] of Object.entries(parsed.packages)) {\n if (packagePath.length === 0 || packageData.version === undefined) {\n continue;\n }\n\n const segments = packagePath.split(\"node_modules/\");\n const name = segments[segments.length - 1] ?? \"\";\n if (name.length === 0) {\n continue;\n }\n\n const dependencies = Object.entries(packageData.dependencies ?? {})\n .map(([depName, depRange]) => `${depName}@${String(depRange)}`)\n .sort((a, b) => a.localeCompare(b));\n\n nodes.push({\n name,\n version: packageData.version,\n dependencies,\n });\n }\n } else if (parsed.dependencies !== undefined) {\n for (const [name, dep] of Object.entries(parsed.dependencies)) {\n if (dep.version === undefined) {\n continue;\n }\n\n const dependencies = Object.entries(dep.dependencies ?? {})\n .map(([depName, depVersion]) => `${depName}@${String(depVersion)}`)\n .sort((a, b) => a.localeCompare(b));\n\n nodes.push({\n name,\n version: dep.version,\n dependencies,\n });\n }\n }\n\n nodes.sort((a, b) => a.name.localeCompare(b.name) || a.version.localeCompare(b.version));\n\n return {\n kind: \"npm\",\n directDependencies: directSpecs,\n nodes,\n };\n};\n","import type { DirectDependencySpec, LockfileExtraction, LockedDependencyNode } from \"../domain/types.js\";\n\ntype ParserState = \"root\" | \"importers\" | \"packages\" | \"packageDeps\";\n\nconst sanitizeValue = (value: string): string => value.replace(/^['\"]|['\"]$/g, \"\").trim();\n\nconst parsePackageKey = (rawKey: string): { name: string; version: string } | null => {\n const key = sanitizeValue(rawKey.replace(/:$/, \"\"));\n const withoutSlash = key.startsWith(\"/\") ? key.slice(1) : key;\n\n const lastAt = withoutSlash.lastIndexOf(\"@\");\n if (lastAt <= 0) {\n return null;\n }\n\n const name = withoutSlash.slice(0, lastAt);\n const versionWithPeers = withoutSlash.slice(lastAt + 1);\n const version = versionWithPeers.split(\"(\")[0] ?? versionWithPeers;\n\n if (name.length === 0 || version.length === 0) {\n return null;\n }\n\n return { name, version };\n};\n\nexport const parsePnpmLockfile = (raw: string, directSpecs: readonly DirectDependencySpec[]): LockfileExtraction => {\n const lines = raw.split(\"\\n\");\n let state: ParserState = \"root\";\n let currentPackage: string | null = null;\n let currentDependencyName: string | null = null;\n const dependenciesByNode = new Map<string, Set<string>>();\n\n for (const line of lines) {\n if (line.trim().length === 0 || line.trimStart().startsWith(\"#\")) {\n continue;\n }\n\n if (line.startsWith(\"importers:\")) {\n state = \"importers\";\n continue;\n }\n\n if (line.startsWith(\"packages:\")) {\n state = \"packages\";\n continue;\n }\n\n if (state === \"packages\" || state === \"packageDeps\") {\n const packageMatch = line.match(/^\\s{2}([^\\s].+):\\s*$/);\n if (packageMatch !== null) {\n const parsedKey = parsePackageKey(packageMatch[1] ?? \"\");\n if (parsedKey !== null) {\n currentPackage = `${parsedKey.name}@${parsedKey.version}`;\n dependenciesByNode.set(currentPackage, new Set());\n state = \"packageDeps\";\n currentDependencyName = null;\n }\n continue;\n }\n }\n\n if (state === \"packageDeps\" && currentPackage !== null) {\n const depLine = line.match(/^\\s{6}([^:\\s]+):\\s*(.+)$/);\n if (depLine !== null) {\n const depName = sanitizeValue(depLine[1] ?? \"\");\n const depRef = sanitizeValue(depLine[2] ?? \"\");\n const depVersion = depRef.split(\"(\")[0] ?? depRef;\n\n if (depName.length > 0 && depVersion.length > 0) {\n dependenciesByNode.get(currentPackage)?.add(`${depName}@${depVersion}`);\n }\n currentDependencyName = null;\n continue;\n }\n\n const depBlockLine = line.match(/^\\s{6}([^:\\s]+):\\s*$/);\n if (depBlockLine !== null) {\n currentDependencyName = sanitizeValue(depBlockLine[1] ?? \"\");\n continue;\n }\n\n const depVersionLine = line.match(/^\\s{8}version:\\s*(.+)$/);\n if (depVersionLine !== null && currentDependencyName !== null) {\n const depRef = sanitizeValue(depVersionLine[1] ?? \"\");\n const depVersion = depRef.split(\"(\")[0] ?? depRef;\n if (depVersion.length > 0) {\n dependenciesByNode.get(currentPackage)?.add(`${currentDependencyName}@${depVersion}`);\n }\n currentDependencyName = null;\n continue;\n }\n\n if (line.match(/^\\s{4}(dependencies|optionalDependencies):\\s*$/) !== null) {\n continue;\n }\n }\n }\n\n const nodes: LockedDependencyNode[] = [...dependenciesByNode.entries()]\n .map(([nodeId, deps]) => {\n const at = nodeId.lastIndexOf(\"@\");\n return {\n name: nodeId.slice(0, at),\n version: nodeId.slice(at + 1),\n dependencies: [...deps].sort((a, b) => a.localeCompare(b)),\n };\n })\n .sort((a, b) =>\n a.name.localeCompare(b.name) || a.version.localeCompare(b.version),\n );\n\n return {\n kind: \"pnpm\",\n directDependencies: directSpecs,\n nodes,\n };\n};\n","import type { DirectDependencySpec, LockfileExtraction, LockedDependencyNode } from \"../domain/types.js\";\n\nconst stripQuotes = (value: string): string => value.replace(/^['\"]|['\"]$/g, \"\");\n\nconst parseVersionSelector = (selector: string): string | null => {\n const npmIndex = selector.lastIndexOf(\"@npm:\");\n if (npmIndex >= 0) {\n return selector.slice(npmIndex + 5);\n }\n\n const lastAt = selector.lastIndexOf(\"@\");\n if (lastAt <= 0) {\n return null;\n }\n\n return selector.slice(lastAt + 1);\n};\n\nexport const parseYarnLock = (raw: string, directSpecs: readonly DirectDependencySpec[]): LockfileExtraction => {\n const lines = raw.split(\"\\n\");\n const nodes: LockedDependencyNode[] = [];\n\n let selectors: string[] = [];\n let version: string | null = null;\n let readingDependencies = false;\n let dependencies: string[] = [];\n\n const flushEntry = (): void => {\n if (selectors.length === 0 || version === null) {\n selectors = [];\n version = null;\n dependencies = [];\n readingDependencies = false;\n return;\n }\n\n for (const selector of selectors) {\n const parsedVersion = parseVersionSelector(selector);\n const at = selector.lastIndexOf(\"@\");\n const name = at <= 0 ? selector : selector.slice(0, at);\n if (name.length === 0) {\n continue;\n }\n\n nodes.push({\n name,\n version,\n dependencies: [...dependencies].sort((a, b) => a.localeCompare(b)),\n });\n\n if (parsedVersion !== null) {\n nodes.push({\n name,\n version: parsedVersion,\n dependencies: [...dependencies].sort((a, b) => a.localeCompare(b)),\n });\n }\n }\n\n selectors = [];\n version = null;\n dependencies = [];\n readingDependencies = false;\n };\n\n for (const line of lines) {\n if (line.trim().length === 0) {\n continue;\n }\n\n if (!line.startsWith(\" \") && line.endsWith(\":\")) {\n flushEntry();\n const keyText = line.slice(0, -1);\n selectors = keyText\n .split(\",\")\n .map((part) => stripQuotes(part.trim()))\n .filter((part) => part.length > 0);\n continue;\n }\n\n if (line.match(/^\\s{2}version\\s+/) !== null) {\n const value = line.replace(/^\\s{2}version\\s+/, \"\").trim();\n version = stripQuotes(value);\n readingDependencies = false;\n continue;\n }\n\n if (line.match(/^\\s{2}dependencies:\\s*$/) !== null) {\n readingDependencies = true;\n continue;\n }\n\n if (readingDependencies && line.match(/^\\s{4}[^\\s].+$/) !== null) {\n const depLine = line.trim();\n const firstSpace = depLine.indexOf(\" \");\n if (firstSpace <= 0) {\n continue;\n }\n\n const depName = stripQuotes(depLine.slice(0, firstSpace));\n const depRef = stripQuotes(depLine.slice(firstSpace + 1).trim());\n const depVersion = parseVersionSelector(depRef) ?? depRef;\n dependencies.push(`${depName}@${depVersion}`);\n continue;\n }\n\n readingDependencies = false;\n }\n\n flushEntry();\n\n const deduped = new Map<string, LockedDependencyNode>();\n for (const node of nodes) {\n const key = `${node.name}@${node.version}`;\n if (!deduped.has(key)) {\n deduped.set(key, node);\n }\n }\n\n return {\n kind: \"yarn\",\n directDependencies: directSpecs,\n nodes: [...deduped.values()].sort((a, b) => a.name.localeCompare(b.name) || a.version.localeCompare(b.version)),\n };\n};\n","import type { DirectDependencySpec, LockfileExtraction } from \"../domain/types.js\";\n\nexport const parseBunLock = (_raw: string, _directSpecs: readonly DirectDependencySpec[]): LockfileExtraction => {\n throw new Error(\"unsupported_lockfile_format\");\n};\n","import type { ExternalAnalysisSummary } from \"@codesentinel/core\";\nimport { buildExternalAnalysisSummary } from \"../domain/external-analysis.js\";\nimport {\n DEFAULT_EXTERNAL_ANALYSIS_CONFIG,\n type DependencyMetadataProvider,\n type ExternalAnalysisConfig,\n type LockfileExtraction,\n} from \"../domain/types.js\";\nimport { loadPackageJson, selectLockfile } from \"../infrastructure/fs-loader.js\";\nimport { parsePackageJson } from \"../parsing/package-json-loader.js\";\nimport { parsePackageLock } from \"../parsing/package-lock-parser.js\";\nimport { parsePnpmLockfile } from \"../parsing/pnpm-lock-parser.js\";\nimport { parseYarnLock } from \"../parsing/yarn-lock-parser.js\";\nimport { parseBunLock } from \"../parsing/bun-lock-parser.js\";\n\nexport type AnalyzeDependencyExposureInput = {\n repositoryPath: string;\n config?: Partial<ExternalAnalysisConfig>;\n};\n\nconst withDefaults = (overrides: Partial<ExternalAnalysisConfig> | undefined): ExternalAnalysisConfig => ({\n ...DEFAULT_EXTERNAL_ANALYSIS_CONFIG,\n ...overrides,\n});\n\nconst parseExtraction = (\n lockfileKind: \"pnpm\" | \"npm\" | \"npm-shrinkwrap\" | \"yarn\" | \"bun\",\n lockfileRaw: string,\n directSpecs: ReturnType<typeof parsePackageJson>,\n): LockfileExtraction => {\n switch (lockfileKind) {\n case \"pnpm\":\n return parsePnpmLockfile(lockfileRaw, directSpecs);\n case \"npm\":\n case \"npm-shrinkwrap\":\n return {\n ...parsePackageLock(lockfileRaw, directSpecs),\n kind: lockfileKind,\n };\n case \"yarn\":\n return parseYarnLock(lockfileRaw, directSpecs);\n case \"bun\":\n return parseBunLock(lockfileRaw, directSpecs);\n default:\n throw new Error(\"unsupported_lockfile_format\");\n }\n};\n\nconst mapWithConcurrency = async <T, R>(\n values: readonly T[],\n limit: number,\n handler: (value: T) => Promise<R>,\n): Promise<readonly R[]> => {\n const effectiveLimit = Math.max(1, limit);\n const results: R[] = new Array(values.length);\n let index = 0;\n\n const workers = Array.from({ length: Math.min(effectiveLimit, values.length) }, async () => {\n for (;;) {\n const current = index;\n index += 1;\n if (current >= values.length) {\n return;\n }\n\n const value = values[current];\n if (value === undefined) {\n return;\n }\n\n results[current] = await handler(value);\n }\n });\n\n await Promise.all(workers);\n return results;\n};\n\nexport const analyzeDependencyExposure = async (\n input: AnalyzeDependencyExposureInput,\n metadataProvider: DependencyMetadataProvider,\n): Promise<ExternalAnalysisSummary> => {\n const packageJson = loadPackageJson(input.repositoryPath);\n if (packageJson === null) {\n return {\n targetPath: input.repositoryPath,\n available: false,\n reason: \"package_json_not_found\",\n };\n }\n\n const lockfile = selectLockfile(input.repositoryPath);\n if (lockfile === null) {\n return {\n targetPath: input.repositoryPath,\n available: false,\n reason: \"lockfile_not_found\",\n };\n }\n\n try {\n const directSpecs = parsePackageJson(packageJson.raw);\n const extraction = parseExtraction(lockfile.kind, lockfile.raw, directSpecs);\n const config = withDefaults(input.config);\n\n const metadataEntries = await mapWithConcurrency(\n extraction.nodes,\n config.metadataRequestConcurrency,\n async (node) => ({\n key: `${node.name}@${node.version}`,\n metadata: await metadataProvider.getMetadata(node.name, node.version),\n }),\n );\n\n const metadataByKey = new Map<string, Awaited<(typeof metadataEntries)[number]>[\"metadata\"]>();\n for (const entry of metadataEntries) {\n metadataByKey.set(entry.key, entry.metadata);\n }\n\n return buildExternalAnalysisSummary(input.repositoryPath, extraction, metadataByKey, config);\n } catch (error) {\n const message = error instanceof Error ? error.message : \"unknown\";\n if (message.includes(\"unsupported_lockfile_format\")) {\n return {\n targetPath: input.repositoryPath,\n available: false,\n reason: \"unsupported_lockfile_format\",\n };\n }\n\n return {\n targetPath: input.repositoryPath,\n available: false,\n reason: \"invalid_lockfile\",\n };\n }\n};\n","import type { DependencyMetadata, DependencyMetadataProvider } from \"../domain/types.js\";\n\ntype NpmPackagePayload = {\n time?: Record<string, string>;\n maintainers?: Array<{ name?: string; email?: string }>;\n};\n\nconst ONE_DAY_MS = 24 * 60 * 60 * 1000;\n\nconst round4 = (value: number): number => Number(value.toFixed(4));\n\nconst parseDate = (iso: string | undefined): number | null => {\n if (iso === undefined) {\n return null;\n }\n\n const value = Date.parse(iso);\n return Number.isNaN(value) ? null : value;\n};\n\nexport class NpmRegistryMetadataProvider implements DependencyMetadataProvider {\n private readonly cache = new Map<string, DependencyMetadata | null>();\n\n async getMetadata(name: string, version: string): Promise<DependencyMetadata | null> {\n const key = `${name}@${version}`;\n if (this.cache.has(key)) {\n return this.cache.get(key) ?? null;\n }\n\n try {\n const encodedName = encodeURIComponent(name);\n const response = await fetch(`https://registry.npmjs.org/${encodedName}`);\n if (!response.ok) {\n this.cache.set(key, null);\n return null;\n }\n\n const payload = (await response.json()) as NpmPackagePayload;\n const timeEntries = payload.time ?? {};\n\n const publishDates = Object.entries(timeEntries)\n .filter(([tag]) => tag !== \"created\" && tag !== \"modified\")\n .map(([, date]) => parseDate(date))\n .filter((value): value is number => value !== null)\n .sort((a, b) => a - b);\n\n const modifiedAt = parseDate(timeEntries[\"modified\"]);\n const now = Date.now();\n const daysSinceLastRelease = modifiedAt === null ? null : Math.max(0, round4((now - modifiedAt) / ONE_DAY_MS));\n\n let releaseFrequencyDays: number | null = null;\n if (publishDates.length >= 2) {\n const totalIntervals = publishDates.length - 1;\n let sum = 0;\n for (let i = 1; i < publishDates.length; i += 1) {\n const current = publishDates[i];\n const previous = publishDates[i - 1];\n if (current !== undefined && previous !== undefined) {\n sum += current - previous;\n }\n }\n\n releaseFrequencyDays = round4(sum / totalIntervals / ONE_DAY_MS);\n }\n\n const maintainers = payload.maintainers ?? [];\n const maintainerCount = maintainers.length > 0 ? maintainers.length : null;\n\n const metadata: DependencyMetadata = {\n name,\n version,\n maintainerCount,\n releaseFrequencyDays,\n daysSinceLastRelease,\n repositoryActivity30d: null,\n busFactor: null,\n };\n\n this.cache.set(key, metadata);\n return metadata;\n } catch {\n this.cache.set(key, null);\n return null;\n }\n }\n}\n","import type { DependencyMetadata, DependencyMetadataProvider } from \"../domain/types.js\";\n\nexport class NoopMetadataProvider implements DependencyMetadataProvider {\n async getMetadata(_name: string, _version: string): Promise<DependencyMetadata | null> {\n return null;\n }\n}\n","import type { ExternalAnalysisSummary } from \"@codesentinel/core\";\nimport {\n analyzeDependencyExposure,\n type AnalyzeDependencyExposureInput,\n} from \"./application/analyze-dependency-exposure.js\";\nimport { NpmRegistryMetadataProvider } from \"./infrastructure/npm-registry-metadata-provider.js\";\nimport { NoopMetadataProvider } from \"./infrastructure/noop-metadata-provider.js\";\n\nexport type { AnalyzeDependencyExposureInput } from \"./application/analyze-dependency-exposure.js\";\n\nexport const analyzeDependencyExposureFromProject = async (\n input: AnalyzeDependencyExposureInput,\n): Promise<ExternalAnalysisSummary> => {\n const metadataProvider =\n process.env[\"CODESENTINEL_EXTERNAL_METADATA\"] === \"none\"\n ? new NoopMetadataProvider()\n : new NpmRegistryMetadataProvider();\n\n return analyzeDependencyExposure(input, metadataProvider);\n};\n","import type {\n CouplingMatrix,\n FileAuthorShare,\n FileCoupling,\n FileEvolutionMetrics,\n Hotspot,\n RepositoryEvolutionSummary,\n} from \"@codesentinel/core\";\nimport type { EvolutionComputationConfig, GitCommitRecord } from \"./evolution-types.js\";\n\ntype FileAccumulator = {\n commitCount: number;\n recentCommitCount: number;\n churnAdded: number;\n churnDeleted: number;\n authors: Map<string, number>;\n};\n\ntype AuthorProfile = {\n authorId: string;\n commitCount: number;\n primaryName: string;\n emailStem: string | null;\n isBot: boolean;\n};\n\nconst pairKey = (a: string, b: string): string => `${a}\\u0000${b}`;\n\nconst round4 = (value: number): number => Number(value.toFixed(4));\n\nconst normalizeName = (value: string): string =>\n value\n .toLowerCase()\n .replace(/[^a-z0-9\\s]/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n\nconst extractEmailStem = (authorId: string): string | null => {\n const normalized = authorId.trim().toLowerCase();\n const githubNoReplyMatch = normalized.match(/^\\d+\\+([^@]+)@users\\.noreply\\.github\\.com$/);\n if (githubNoReplyMatch?.[1] !== undefined) {\n return githubNoReplyMatch[1].replace(/[._+-]/g, \"\");\n }\n\n const atIndex = normalized.indexOf(\"@\");\n if (atIndex <= 0) {\n return null;\n }\n\n return normalized.slice(0, atIndex).replace(/[._+-]/g, \"\");\n};\n\nconst areNamesCompatible = (left: string, right: string): boolean => {\n if (left.length === 0 || right.length === 0) {\n return false;\n }\n\n if (left === right) {\n return true;\n }\n\n if (left.startsWith(`${right} `) || right.startsWith(`${left} `)) {\n return true;\n }\n\n return false;\n};\n\nconst chooseCanonicalAuthorId = (profiles: readonly AuthorProfile[]): string => {\n const ordered = [...profiles].sort((a, b) => {\n const aIsNoReply = a.authorId.includes(\"@users.noreply.github.com\");\n const bIsNoReply = b.authorId.includes(\"@users.noreply.github.com\");\n if (aIsNoReply !== bIsNoReply) {\n return aIsNoReply ? 1 : -1;\n }\n\n if (a.commitCount !== b.commitCount) {\n return b.commitCount - a.commitCount;\n }\n\n return a.authorId.localeCompare(b.authorId);\n });\n\n return ordered[0]?.authorId ?? \"\";\n};\n\nconst buildAuthorAliasMap = (commits: readonly GitCommitRecord[]): ReadonlyMap<string, string> => {\n const nameCountsByAuthorId = new Map<string, Map<string, number>>();\n const commitCountByAuthorId = new Map<string, number>();\n\n for (const commit of commits) {\n commitCountByAuthorId.set(commit.authorId, (commitCountByAuthorId.get(commit.authorId) ?? 0) + 1);\n\n const normalizedName = normalizeName(commit.authorName);\n const names = nameCountsByAuthorId.get(commit.authorId) ?? new Map<string, number>();\n if (normalizedName.length > 0) {\n names.set(normalizedName, (names.get(normalizedName) ?? 0) + 1);\n }\n nameCountsByAuthorId.set(commit.authorId, names);\n }\n\n const profiles: AuthorProfile[] = [...commitCountByAuthorId.entries()].map(([authorId, commitCount]) => {\n const names = nameCountsByAuthorId.get(authorId);\n const primaryName =\n names === undefined\n ? \"\"\n : [...names.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))[0]?.[0] ?? \"\";\n const normalizedAuthorId = authorId.toLowerCase();\n const isBot = normalizedAuthorId.includes(\"[bot]\");\n\n return {\n authorId,\n commitCount,\n primaryName,\n emailStem: isBot ? null : extractEmailStem(authorId),\n isBot,\n };\n });\n\n const groupsByStem = new Map<string, AuthorProfile[]>();\n for (const profile of profiles) {\n if (profile.emailStem === null || profile.emailStem.length < 4) {\n continue;\n }\n\n const current = groupsByStem.get(profile.emailStem) ?? [];\n current.push(profile);\n groupsByStem.set(profile.emailStem, current);\n }\n\n const aliasMap = new Map<string, string>();\n for (const profile of profiles) {\n aliasMap.set(profile.authorId, profile.authorId);\n }\n\n for (const group of groupsByStem.values()) {\n if (group.length < 2) {\n continue;\n }\n\n const compatible: AuthorProfile[] = [];\n for (const profile of group) {\n if (profile.isBot || profile.primaryName.length === 0) {\n continue;\n }\n\n compatible.push(profile);\n }\n\n if (compatible.length < 2) {\n continue;\n }\n\n const canonical = chooseCanonicalAuthorId(compatible);\n const canonicalProfile = compatible.find((candidate) => candidate.authorId === canonical);\n if (canonicalProfile === undefined) {\n continue;\n }\n\n for (const profile of compatible) {\n if (areNamesCompatible(profile.primaryName, canonicalProfile.primaryName)) {\n aliasMap.set(profile.authorId, canonical);\n }\n }\n }\n\n return aliasMap;\n};\n\nconst computeBusFactor = (\n authorDistribution: readonly FileAuthorShare[],\n threshold: number,\n): number => {\n if (authorDistribution.length === 0) {\n return 0;\n }\n\n let coveredShare = 0;\n for (let i = 0; i < authorDistribution.length; i += 1) {\n const entry = authorDistribution[i];\n if (entry === undefined) {\n continue;\n }\n\n coveredShare += entry.share;\n if (coveredShare >= threshold) {\n return i + 1;\n }\n }\n\n return authorDistribution.length;\n};\n\nconst finalizeAuthorDistribution = (authorCommits: ReadonlyMap<string, number>): readonly FileAuthorShare[] => {\n const totalCommits = [...authorCommits.values()].reduce((sum, value) => sum + value, 0);\n if (totalCommits === 0) {\n return [];\n }\n\n return [...authorCommits.entries()]\n .map(([authorId, commits]) => ({\n authorId,\n commits,\n share: round4(commits / totalCommits),\n }))\n .sort((a, b) => b.commits - a.commits || a.authorId.localeCompare(b.authorId));\n};\n\nconst buildCouplingMatrix = (\n coChangeByPair: ReadonlyMap<string, number>,\n fileCommitCount: ReadonlyMap<string, number>,\n consideredCommits: number,\n skippedLargeCommits: number,\n maxCouplingPairs: number,\n): CouplingMatrix => {\n const allPairs: FileCoupling[] = [];\n\n for (const [key, coChangeCommits] of coChangeByPair.entries()) {\n const [fileA, fileB] = key.split(\"\\u0000\");\n if (fileA === undefined || fileB === undefined) {\n continue;\n }\n\n const fileACommits = fileCommitCount.get(fileA) ?? 0;\n const fileBCommits = fileCommitCount.get(fileB) ?? 0;\n const denominator = fileACommits + fileBCommits - coChangeCommits;\n const couplingScore = denominator === 0 ? 0 : round4(coChangeCommits / denominator);\n\n allPairs.push({\n fileA,\n fileB,\n coChangeCommits,\n couplingScore,\n });\n }\n\n allPairs.sort(\n (a, b) =>\n b.coChangeCommits - a.coChangeCommits ||\n b.couplingScore - a.couplingScore ||\n a.fileA.localeCompare(b.fileA) ||\n a.fileB.localeCompare(b.fileB),\n );\n\n const truncated = allPairs.length > maxCouplingPairs;\n\n return {\n pairs: truncated ? allPairs.slice(0, maxCouplingPairs) : allPairs,\n totalPairCount: allPairs.length,\n consideredCommits,\n skippedLargeCommits,\n truncated,\n };\n};\n\nconst selectHotspots = (\n files: readonly FileEvolutionMetrics[],\n config: EvolutionComputationConfig,\n): { hotspots: readonly Hotspot[]; threshold: number } => {\n if (files.length === 0) {\n return { hotspots: [], threshold: 0 };\n }\n\n const sorted = [...files].sort(\n (a, b) =>\n b.commitCount - a.commitCount || b.churnTotal - a.churnTotal || a.filePath.localeCompare(b.filePath),\n );\n\n const hotspotCount = Math.max(config.hotspotMinFiles, Math.ceil(sorted.length * config.hotspotTopPercent));\n const selected = sorted.slice(0, hotspotCount);\n\n const hotspots = selected.map((file, index) => ({\n filePath: file.filePath,\n rank: index + 1,\n commitCount: file.commitCount,\n churnTotal: file.churnTotal,\n }));\n\n const threshold = selected[selected.length - 1]?.commitCount ?? 0;\n return { hotspots, threshold };\n};\n\nexport const computeRepositoryEvolutionSummary = (\n targetPath: string,\n commits: readonly GitCommitRecord[],\n config: EvolutionComputationConfig,\n): RepositoryEvolutionSummary => {\n const authorAliasById =\n config.authorIdentityMode === \"likely_merge\" ? buildAuthorAliasMap(commits) : new Map<string, string>();\n const fileStats = new Map<string, FileAccumulator>();\n const coChangeByPair = new Map<string, number>();\n\n const headCommitTimestamp = commits.length === 0 ? null : commits[commits.length - 1]?.authoredAtUnix ?? null;\n const recentWindowStart =\n headCommitTimestamp === null\n ? Number.NEGATIVE_INFINITY\n : headCommitTimestamp - config.recentWindowDays * 24 * 60 * 60;\n\n let consideredCommits = 0;\n let skippedLargeCommits = 0;\n\n for (const commit of commits) {\n const uniqueFiles = new Set<string>();\n\n for (const fileChange of commit.fileChanges) {\n uniqueFiles.add(fileChange.filePath);\n const current = fileStats.get(fileChange.filePath) ?? {\n commitCount: 0,\n recentCommitCount: 0,\n churnAdded: 0,\n churnDeleted: 0,\n authors: new Map<string, number>(),\n };\n\n current.churnAdded += fileChange.additions;\n current.churnDeleted += fileChange.deletions;\n fileStats.set(fileChange.filePath, current);\n }\n\n for (const filePath of uniqueFiles) {\n const current = fileStats.get(filePath);\n if (current === undefined) {\n continue;\n }\n\n current.commitCount += 1;\n if (commit.authoredAtUnix >= recentWindowStart) {\n current.recentCommitCount += 1;\n }\n\n const effectiveAuthorId = authorAliasById.get(commit.authorId) ?? commit.authorId;\n current.authors.set(effectiveAuthorId, (current.authors.get(effectiveAuthorId) ?? 0) + 1);\n }\n\n const orderedFiles = [...uniqueFiles].sort((a, b) => a.localeCompare(b));\n if (orderedFiles.length > 1) {\n if (orderedFiles.length <= config.maxFilesPerCommitForCoupling) {\n consideredCommits += 1;\n for (let i = 0; i < orderedFiles.length - 1; i += 1) {\n for (let j = i + 1; j < orderedFiles.length; j += 1) {\n const fileA = orderedFiles[i];\n const fileB = orderedFiles[j];\n if (fileA === undefined || fileB === undefined) {\n continue;\n }\n\n const key = pairKey(fileA, fileB);\n coChangeByPair.set(key, (coChangeByPair.get(key) ?? 0) + 1);\n }\n }\n } else {\n skippedLargeCommits += 1;\n }\n }\n }\n\n const files: FileEvolutionMetrics[] = [...fileStats.entries()]\n .map(([filePath, stats]) => {\n const authorDistribution = finalizeAuthorDistribution(stats.authors);\n const topAuthorShare = authorDistribution[0]?.share ?? 0;\n return {\n filePath,\n commitCount: stats.commitCount,\n frequencyPer100Commits: commits.length === 0 ? 0 : round4((stats.commitCount / commits.length) * 100),\n churnAdded: stats.churnAdded,\n churnDeleted: stats.churnDeleted,\n churnTotal: stats.churnAdded + stats.churnDeleted,\n recentCommitCount: stats.recentCommitCount,\n recentVolatility: stats.commitCount === 0 ? 0 : round4(stats.recentCommitCount / stats.commitCount),\n topAuthorShare,\n busFactor: computeBusFactor(authorDistribution, config.busFactorCoverageThreshold),\n authorDistribution,\n };\n })\n .sort((a, b) => a.filePath.localeCompare(b.filePath));\n\n const fileCommitCount = new Map(files.map((file) => [file.filePath, file.commitCount]));\n const coupling = buildCouplingMatrix(\n coChangeByPair,\n fileCommitCount,\n consideredCommits,\n skippedLargeCommits,\n config.maxCouplingPairs,\n );\n\n const { hotspots, threshold } = selectHotspots(files, config);\n\n return {\n targetPath,\n available: true,\n files,\n hotspots,\n coupling,\n metrics: {\n totalCommits: commits.length,\n totalFiles: files.length,\n headCommitTimestamp,\n recentWindowDays: config.recentWindowDays,\n hotspotTopPercent: config.hotspotTopPercent,\n hotspotThresholdCommitCount: threshold,\n },\n };\n};\n","export type GitFileChange = {\n filePath: string;\n additions: number;\n deletions: number;\n};\n\nexport type GitCommitRecord = {\n hash: string;\n authorId: string;\n authorName: string;\n authoredAtUnix: number;\n fileChanges: readonly GitFileChange[];\n};\n\nexport type EvolutionComputationConfig = {\n authorIdentityMode: \"likely_merge\" | \"strict_email\";\n recentWindowDays: number;\n hotspotTopPercent: number;\n hotspotMinFiles: number;\n maxFilesPerCommitForCoupling: number;\n maxCouplingPairs: number;\n busFactorCoverageThreshold: number;\n};\n\nexport const DEFAULT_EVOLUTION_CONFIG: EvolutionComputationConfig = {\n authorIdentityMode: \"likely_merge\",\n recentWindowDays: 30,\n hotspotTopPercent: 0.1,\n hotspotMinFiles: 1,\n maxFilesPerCommitForCoupling: 200,\n maxCouplingPairs: 500,\n busFactorCoverageThreshold: 0.6,\n};\n","import type { RepositoryEvolutionSummary } from \"@codesentinel/core\";\nimport { computeRepositoryEvolutionSummary } from \"../domain/evolution-metrics.js\";\nimport {\n DEFAULT_EVOLUTION_CONFIG,\n type EvolutionComputationConfig,\n} from \"../domain/evolution-types.js\";\nimport type { GitHistoryProvider } from \"./git-history-provider.js\";\n\nexport type AnalyzeRepositoryEvolutionInput = {\n repositoryPath: string;\n config?: Partial<EvolutionComputationConfig>;\n};\n\nconst createEffectiveConfig = (\n overrides: Partial<EvolutionComputationConfig> | undefined,\n): EvolutionComputationConfig => ({\n ...DEFAULT_EVOLUTION_CONFIG,\n ...overrides,\n});\n\nexport const analyzeRepositoryEvolution = (\n input: AnalyzeRepositoryEvolutionInput,\n historyProvider: GitHistoryProvider,\n): RepositoryEvolutionSummary => {\n if (!historyProvider.isGitRepository(input.repositoryPath)) {\n return {\n targetPath: input.repositoryPath,\n available: false,\n reason: \"not_git_repository\",\n };\n }\n\n const commits = historyProvider.getCommitHistory(input.repositoryPath);\n const config = createEffectiveConfig(input.config);\n\n return computeRepositoryEvolutionSummary(input.repositoryPath, commits, config);\n};\n","import { execFileSync } from \"node:child_process\";\n\nexport class GitCommandError extends Error {\n readonly args: readonly string[];\n\n constructor(message: string, args: readonly string[]) {\n super(message);\n this.name = \"GitCommandError\";\n this.args = args;\n }\n}\n\nexport interface GitCommandClient {\n run(repositoryPath: string, args: readonly string[]): string;\n}\n\nexport class ExecGitCommandClient implements GitCommandClient {\n run(repositoryPath: string, args: readonly string[]): string {\n try {\n return execFileSync(\"git\", [\"-C\", repositoryPath, ...args], {\n encoding: \"utf8\",\n maxBuffer: 1024 * 1024 * 64,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : \"Unknown git execution error\";\n throw new GitCommandError(message, args);\n }\n }\n}\n","export const COMMIT_RECORD_SEPARATOR = \"\\u001e\";\nexport const COMMIT_FIELD_SEPARATOR = \"\\u001f\";\n\nexport const GIT_LOG_FORMAT =\n `%x1e%H%x1f%at%x1f%an%x1f%ae`;\n","import { COMMIT_FIELD_SEPARATOR, COMMIT_RECORD_SEPARATOR } from \"../domain/git-log-format.js\";\nimport type { GitCommitRecord, GitFileChange } from \"../domain/evolution-types.js\";\n\nconst parseInteger = (value: string): number | null => {\n if (value.length === 0) {\n return null;\n }\n\n const parsed = Number.parseInt(value, 10);\n if (Number.isNaN(parsed)) {\n return null;\n }\n\n return parsed;\n};\n\nconst normalizeAuthorIdentity = (authorName: string, authorEmail: string): string => {\n const normalizedName = authorName.trim().replace(/\\s+/g, \" \").toLowerCase();\n const normalizedEmail = authorEmail.trim().toLowerCase();\n\n if (/\\[bot\\]/i.test(normalizedName) || /\\[bot\\]/i.test(normalizedEmail)) {\n return normalizedEmail.length > 0 ? normalizedEmail : normalizedName;\n }\n\n const githubNoReplyMatch = normalizedEmail.match(/^\\d+\\+([^@]+)@users\\.noreply\\.github\\.com$/);\n const githubHandle = githubNoReplyMatch?.[1]?.trim().toLowerCase();\n if (githubHandle !== undefined && githubHandle.length > 0) {\n return `${githubHandle}@users.noreply.github.com`;\n }\n\n if (normalizedEmail.length > 0) {\n return normalizedEmail;\n }\n\n return normalizedName;\n};\n\nconst parseRenamedPath = (pathSpec: string): string => {\n if (!pathSpec.includes(\" => \")) {\n return pathSpec;\n }\n\n const braceRenameMatch = pathSpec.match(/^(.*)\\{(.+) => (.+)\\}(.*)$/);\n if (braceRenameMatch !== null) {\n const [, prefix, , renamedTo, suffix] = braceRenameMatch;\n return `${prefix}${renamedTo}${suffix}`;\n }\n\n const parts = pathSpec.split(\" => \");\n const finalPart = parts[parts.length - 1];\n return finalPart ?? pathSpec;\n};\n\nconst parseNumstatLine = (line: string): GitFileChange | null => {\n const parts = line.split(\"\\t\");\n if (parts.length < 3) {\n return null;\n }\n\n const additionsRaw = parts[0];\n const deletionsRaw = parts[1];\n const pathRaw = parts.slice(2).join(\"\\t\");\n\n if (additionsRaw === undefined || deletionsRaw === undefined) {\n return null;\n }\n\n const additions = additionsRaw === \"-\" ? 0 : parseInteger(additionsRaw);\n const deletions = deletionsRaw === \"-\" ? 0 : parseInteger(deletionsRaw);\n\n if (additions === null || deletions === null) {\n return null;\n }\n\n const filePath = parseRenamedPath(pathRaw);\n return {\n filePath,\n additions,\n deletions,\n };\n};\n\nexport const parseGitLog = (rawLog: string): readonly GitCommitRecord[] => {\n const records = rawLog\n .split(COMMIT_RECORD_SEPARATOR)\n .map((record) => record.trim())\n .filter((record) => record.length > 0);\n\n const commits: GitCommitRecord[] = [];\n\n for (const record of records) {\n const lines = record\n .split(\"\\n\")\n .map((line) => line.trimEnd())\n .filter((line) => line.length > 0);\n\n if (lines.length === 0) {\n continue;\n }\n\n const headerParts = lines[0]?.split(COMMIT_FIELD_SEPARATOR) ?? [];\n if (headerParts.length !== 4) {\n continue;\n }\n\n const [hash, authoredAtRaw, authorName, authorEmail] = headerParts;\n if (hash === undefined || authoredAtRaw === undefined || authorName === undefined || authorEmail === undefined) {\n continue;\n }\n\n const authoredAtUnix = parseInteger(authoredAtRaw);\n if (authoredAtUnix === null) {\n continue;\n }\n\n const fileChanges: GitFileChange[] = [];\n for (const line of lines.slice(1)) {\n const parsedLine = parseNumstatLine(line);\n if (parsedLine !== null) {\n fileChanges.push(parsedLine);\n }\n }\n\n commits.push({\n hash,\n authorId: normalizeAuthorIdentity(authorName, authorEmail),\n authorName,\n authoredAtUnix,\n fileChanges,\n });\n }\n\n commits.sort((a, b) => a.authoredAtUnix - b.authoredAtUnix || a.hash.localeCompare(b.hash));\n return commits;\n};\n","import { GIT_LOG_FORMAT } from \"../domain/git-log-format.js\";\nimport type { GitCommitRecord } from \"../domain/evolution-types.js\";\nimport type { GitHistoryProvider } from \"../application/git-history-provider.js\";\nimport { GitCommandError, type GitCommandClient } from \"./git-command-client.js\";\nimport { parseGitLog } from \"../parsing/git-log-parser.js\";\n\nconst NON_GIT_CODES = [\"not a git repository\", \"not in a git directory\"];\n\nconst isNotGitError = (error: GitCommandError): boolean => {\n const lower = error.message.toLowerCase();\n return NON_GIT_CODES.some((code) => lower.includes(code));\n};\n\nexport class GitCliHistoryProvider implements GitHistoryProvider {\n constructor(private readonly gitClient: GitCommandClient) {}\n\n isGitRepository(repositoryPath: string): boolean {\n try {\n const output = this.gitClient.run(repositoryPath, [\"rev-parse\", \"--is-inside-work-tree\"]);\n return output.trim() === \"true\";\n } catch (error) {\n if (error instanceof GitCommandError && isNotGitError(error)) {\n return false;\n }\n\n throw error;\n }\n }\n\n getCommitHistory(repositoryPath: string): readonly GitCommitRecord[] {\n const output = this.gitClient.run(repositoryPath, [\n \"-c\",\n \"core.quotepath=false\",\n \"log\",\n \"--use-mailmap\",\n \"--no-merges\",\n \"--date=unix\",\n `--pretty=format:${GIT_LOG_FORMAT}`,\n \"--numstat\",\n \"--find-renames\",\n ]);\n\n return parseGitLog(output);\n }\n}\n","import type { RepositoryEvolutionSummary } from \"@codesentinel/core\";\nimport {\n analyzeRepositoryEvolution,\n type AnalyzeRepositoryEvolutionInput,\n} from \"./application/analyze-repository-evolution.js\";\nimport { ExecGitCommandClient } from \"./infrastructure/git-command-client.js\";\nimport { GitCliHistoryProvider } from \"./infrastructure/git-history-provider.js\";\n\nexport type { AnalyzeRepositoryEvolutionInput } from \"./application/analyze-repository-evolution.js\";\n\nexport const analyzeRepositoryEvolutionFromGit = (\n input: AnalyzeRepositoryEvolutionInput,\n): RepositoryEvolutionSummary => {\n const historyProvider = new GitCliHistoryProvider(new ExecGitCommandClient());\n return analyzeRepositoryEvolution(input, historyProvider);\n};\n"],"mappings":";;;AAAA,SAAS,SAAS,cAAc;AAChC,SAAS,gBAAAA,qBAAoB;AAC7B,SAAS,SAAS,WAAAC,gBAAe;AACjC,SAAS,qBAAqB;;;ACH9B,SAAS,WAAAC,gBAAe;;;AIAxB,SAAS,SAAS,YAAY,UAAU,eAAe;AACvD,YAAY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AAA,EACF,EACG,QAAQ,CAAC,gBAAgB,cAAc,CAAC,EACxC,QAAQ,cAAc;AAC3B,EACC,OAAO,OAAO,MAA0B,YAAuD;AAC9F,QAAM,SAAS,MAAM,kBAAkB,MAAM,QAAQ,cAAc;AACnE,UAAQ,OAAO,MAAM,GAAG,MAAM;AAAA,CAAI;AACpC,CAAC;AAEH,IAAI,QAAQ,KAAK,UAAU,GAAG;AAC5B,UAAQ,WAAW;AACnB,UAAQ,KAAK,CAAC;AAChB;AAEA,MAAM,QAAQ,WAAW,QAAQ,IAAI;","names":["readFileSync","resolve","resolve","nodeLowLink","program","packageJsonPath","version","round4","round4","resolve","resolve","readFileSync"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codesentinel/codesentinel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Command-line interface for CodeSentinel.",
|
|
6
6
|
"repository": {
|
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsup",
|
|
23
23
|
"dev": "node --import tsx/esm src/index.ts",
|
|
24
|
-
"prepack": "cp ../../README.md ./README.md && cp ../../LICENSE ./LICENSE && pnpm --filter @codesentinel/core build && pnpm --filter @codesentinel/code-graph build && pnpm --filter @codesentinel/git-analyzer build && pnpm run build",
|
|
24
|
+
"prepack": "cp ../../README.md ./README.md && cp ../../LICENSE ./LICENSE && pnpm --filter @codesentinel/core build && pnpm --filter @codesentinel/code-graph build && pnpm --filter @codesentinel/git-analyzer build && pnpm --filter @codesentinel/dependency-firewall build && pnpm run build",
|
|
25
25
|
"test": "vitest run --passWithNoTests"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@codesentinel/code-graph": "workspace:*",
|
|
29
29
|
"@codesentinel/core": "workspace:*",
|
|
30
|
+
"@codesentinel/dependency-firewall": "workspace:*",
|
|
30
31
|
"@codesentinel/git-analyzer": "workspace:*",
|
|
31
32
|
"commander": "^14.0.3"
|
|
32
33
|
},
|