@girardelli/architect-core 8.1.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/dist/src/core/analyzer.d.ts +42 -0
- package/dist/src/core/analyzer.js +431 -0
- package/dist/src/core/analyzer.js.map +1 -0
- package/dist/src/core/analyzers/forecast.d.ts +84 -0
- package/dist/src/core/analyzers/forecast.js +338 -0
- package/dist/src/core/analyzers/forecast.js.map +1 -0
- package/dist/src/core/analyzers/index.d.ts +9 -0
- package/dist/src/core/analyzers/index.js +7 -0
- package/dist/src/core/analyzers/index.js.map +1 -0
- package/dist/src/core/analyzers/temporal-scorer.d.ts +71 -0
- package/dist/src/core/analyzers/temporal-scorer.js +141 -0
- package/dist/src/core/analyzers/temporal-scorer.js.map +1 -0
- package/dist/src/core/anti-patterns.d.ts +28 -0
- package/dist/src/core/anti-patterns.js +264 -0
- package/dist/src/core/anti-patterns.js.map +1 -0
- package/dist/src/core/ast/ast-parser.interface.d.ts +20 -0
- package/dist/src/core/ast/ast-parser.interface.js +2 -0
- package/dist/src/core/ast/ast-parser.interface.js.map +1 -0
- package/dist/src/core/ast/path-resolver.d.ts +13 -0
- package/dist/src/core/ast/path-resolver.js +54 -0
- package/dist/src/core/ast/path-resolver.js.map +1 -0
- package/dist/src/core/ast/tree-sitter-parser.d.ts +10 -0
- package/dist/src/core/ast/tree-sitter-parser.js +142 -0
- package/dist/src/core/ast/tree-sitter-parser.js.map +1 -0
- package/dist/src/core/config.d.ts +11 -0
- package/dist/src/core/config.js +112 -0
- package/dist/src/core/config.js.map +1 -0
- package/dist/src/core/diagram.d.ts +9 -0
- package/dist/src/core/diagram.js +101 -0
- package/dist/src/core/diagram.js.map +1 -0
- package/dist/src/core/i18n.d.ts +14 -0
- package/dist/src/core/i18n.js +54 -0
- package/dist/src/core/i18n.js.map +1 -0
- package/dist/src/core/locales/en.d.ts +2 -0
- package/dist/src/core/locales/en.js +337 -0
- package/dist/src/core/locales/en.js.map +1 -0
- package/dist/src/core/locales/pt-BR.d.ts +172 -0
- package/dist/src/core/locales/pt-BR.js +337 -0
- package/dist/src/core/locales/pt-BR.js.map +1 -0
- package/dist/src/core/locales/types.d.ts +86 -0
- package/dist/src/core/locales/types.js +2 -0
- package/dist/src/core/locales/types.js.map +1 -0
- package/dist/src/core/plugin-loader.d.ts +11 -0
- package/dist/src/core/plugin-loader.js +67 -0
- package/dist/src/core/plugin-loader.js.map +1 -0
- package/dist/src/core/project-summarizer.d.ts +16 -0
- package/dist/src/core/project-summarizer.js +37 -0
- package/dist/src/core/project-summarizer.js.map +1 -0
- package/dist/src/core/refactor-engine.d.ts +18 -0
- package/dist/src/core/refactor-engine.js +87 -0
- package/dist/src/core/refactor-engine.js.map +1 -0
- package/dist/src/core/rules/barrel-optimizer.d.ts +13 -0
- package/dist/src/core/rules/barrel-optimizer.js +76 -0
- package/dist/src/core/rules/barrel-optimizer.js.map +1 -0
- package/dist/src/core/rules/dead-code-detector.d.ts +21 -0
- package/dist/src/core/rules/dead-code-detector.js +116 -0
- package/dist/src/core/rules/dead-code-detector.js.map +1 -0
- package/dist/src/core/rules/hub-splitter.d.ts +13 -0
- package/dist/src/core/rules/hub-splitter.js +117 -0
- package/dist/src/core/rules/hub-splitter.js.map +1 -0
- package/dist/src/core/rules/import-organizer.d.ts +13 -0
- package/dist/src/core/rules/import-organizer.js +84 -0
- package/dist/src/core/rules/import-organizer.js.map +1 -0
- package/dist/src/core/rules/module-grouper.d.ts +13 -0
- package/dist/src/core/rules/module-grouper.js +116 -0
- package/dist/src/core/rules/module-grouper.js.map +1 -0
- package/dist/src/core/rules-engine.d.ts +7 -0
- package/dist/src/core/rules-engine.js +89 -0
- package/dist/src/core/rules-engine.js.map +1 -0
- package/dist/src/core/scorer.d.ts +15 -0
- package/dist/src/core/scorer.js +165 -0
- package/dist/src/core/scorer.js.map +1 -0
- package/dist/src/core/summarizer/keyword-extractor.d.ts +6 -0
- package/dist/src/core/summarizer/keyword-extractor.js +38 -0
- package/dist/src/core/summarizer/keyword-extractor.js.map +1 -0
- package/dist/src/core/summarizer/module-inferrer.d.ts +11 -0
- package/dist/src/core/summarizer/module-inferrer.js +171 -0
- package/dist/src/core/summarizer/module-inferrer.js.map +1 -0
- package/dist/src/core/summarizer/package-reader.d.ts +3 -0
- package/dist/src/core/summarizer/package-reader.js +33 -0
- package/dist/src/core/summarizer/package-reader.js.map +1 -0
- package/dist/src/core/summarizer/purpose-inferrer.d.ts +8 -0
- package/dist/src/core/summarizer/purpose-inferrer.js +179 -0
- package/dist/src/core/summarizer/purpose-inferrer.js.map +1 -0
- package/dist/src/core/summarizer/readme-reader.d.ts +3 -0
- package/dist/src/core/summarizer/readme-reader.js +24 -0
- package/dist/src/core/summarizer/readme-reader.js.map +1 -0
- package/dist/src/core/types/architect-rules.d.ts +27 -0
- package/dist/src/core/types/architect-rules.js +2 -0
- package/dist/src/core/types/architect-rules.js.map +1 -0
- package/dist/src/core/types/core.d.ts +87 -0
- package/dist/src/core/types/core.js +2 -0
- package/dist/src/core/types/core.js.map +1 -0
- package/dist/src/core/types/infrastructure.d.ts +38 -0
- package/dist/src/core/types/infrastructure.js +2 -0
- package/dist/src/core/types/infrastructure.js.map +1 -0
- package/dist/src/core/types/plugin.d.ts +12 -0
- package/dist/src/core/types/plugin.js +2 -0
- package/dist/src/core/types/plugin.js.map +1 -0
- package/dist/src/core/types/rules.d.ts +53 -0
- package/dist/src/core/types/rules.js +2 -0
- package/dist/src/core/types/rules.js.map +1 -0
- package/dist/src/core/types/summarizer.d.ts +12 -0
- package/dist/src/core/types/summarizer.js +2 -0
- package/dist/src/core/types/summarizer.js.map +1 -0
- package/dist/src/infrastructure/git-cache.d.ts +6 -0
- package/dist/src/infrastructure/git-cache.js +41 -0
- package/dist/src/infrastructure/git-cache.js.map +1 -0
- package/dist/src/infrastructure/git-history.d.ts +112 -0
- package/dist/src/infrastructure/git-history.js +340 -0
- package/dist/src/infrastructure/git-history.js.map +1 -0
- package/dist/src/infrastructure/logger.d.ts +20 -0
- package/dist/src/infrastructure/logger.js +57 -0
- package/dist/src/infrastructure/logger.js.map +1 -0
- package/dist/src/infrastructure/scanner.d.ts +31 -0
- package/dist/src/infrastructure/scanner.js +334 -0
- package/dist/src/infrastructure/scanner.js.map +1 -0
- package/dist/tests/analyzers-integration.test.d.ts +7 -0
- package/dist/tests/analyzers-integration.test.js +140 -0
- package/dist/tests/analyzers-integration.test.js.map +1 -0
- package/dist/tests/anti-patterns.test.d.ts +1 -0
- package/dist/tests/anti-patterns.test.js +81 -0
- package/dist/tests/anti-patterns.test.js.map +1 -0
- package/dist/tests/ast-parser.test.d.ts +1 -0
- package/dist/tests/ast-parser.test.js +94 -0
- package/dist/tests/ast-parser.test.js.map +1 -0
- package/dist/tests/fixtures/monorepo/packages/app/src/index.d.ts +1 -0
- package/dist/tests/fixtures/monorepo/packages/app/src/index.js +9 -0
- package/dist/tests/fixtures/monorepo/packages/app/src/index.js.map +1 -0
- package/dist/tests/fixtures/monorepo/packages/core/src/index.d.ts +2 -0
- package/dist/tests/fixtures/monorepo/packages/core/src/index.js +11 -0
- package/dist/tests/fixtures/monorepo/packages/core/src/index.js.map +1 -0
- package/dist/tests/forecast.test.d.ts +7 -0
- package/dist/tests/forecast.test.js +380 -0
- package/dist/tests/forecast.test.js.map +1 -0
- package/dist/tests/git-history.test.d.ts +7 -0
- package/dist/tests/git-history.test.js +193 -0
- package/dist/tests/git-history.test.js.map +1 -0
- package/dist/tests/i18n.test.d.ts +1 -0
- package/dist/tests/i18n.test.js +39 -0
- package/dist/tests/i18n.test.js.map +1 -0
- package/dist/tests/monorepo-scan.test.d.ts +11 -0
- package/dist/tests/monorepo-scan.test.js +143 -0
- package/dist/tests/monorepo-scan.test.js.map +1 -0
- package/dist/tests/plugin-loader.test.d.ts +1 -0
- package/dist/tests/plugin-loader.test.js +31 -0
- package/dist/tests/plugin-loader.test.js.map +1 -0
- package/dist/tests/rules-engine.test.d.ts +1 -0
- package/dist/tests/rules-engine.test.js +112 -0
- package/dist/tests/rules-engine.test.js.map +1 -0
- package/dist/tests/scanner.test.d.ts +1 -0
- package/dist/tests/scanner.test.js +44 -0
- package/dist/tests/scanner.test.js.map +1 -0
- package/dist/tests/scorer.test.d.ts +1 -0
- package/dist/tests/scorer.test.js +610 -0
- package/dist/tests/scorer.test.js.map +1 -0
- package/dist/tests/temporal-scorer.test.d.ts +7 -0
- package/dist/tests/temporal-scorer.test.js +239 -0
- package/dist/tests/temporal-scorer.test.js.map +1 -0
- package/package.json +29 -0
- package/src/core/analyzer.ts +499 -0
- package/src/core/analyzers/forecast.ts +497 -0
- package/src/core/analyzers/index.ts +33 -0
- package/src/core/analyzers/temporal-scorer.ts +227 -0
- package/src/core/anti-patterns.ts +324 -0
- package/src/core/ast/ast-parser.interface.ts +21 -0
- package/src/core/ast/path-resolver.ts +61 -0
- package/src/core/ast/tree-sitter-parser.ts +158 -0
- package/src/core/config.ts +125 -0
- package/src/core/diagram.ts +129 -0
- package/src/core/i18n.ts +64 -0
- package/src/core/locales/en.ts +340 -0
- package/src/core/locales/pt-BR.ts +341 -0
- package/src/core/locales/types.ts +95 -0
- package/src/core/plugin-loader.ts +80 -0
- package/src/core/project-summarizer.ts +42 -0
- package/src/core/refactor-engine.ts +112 -0
- package/src/core/rules/barrel-optimizer.ts +99 -0
- package/src/core/rules/dead-code-detector.ts +134 -0
- package/src/core/rules/hub-splitter.ts +135 -0
- package/src/core/rules/import-organizer.ts +100 -0
- package/src/core/rules/module-grouper.ts +133 -0
- package/src/core/rules-engine.ts +100 -0
- package/src/core/scorer.ts +181 -0
- package/src/core/summarizer/keyword-extractor.ts +53 -0
- package/src/core/summarizer/module-inferrer.ts +194 -0
- package/src/core/summarizer/package-reader.ts +34 -0
- package/src/core/summarizer/purpose-inferrer.ts +197 -0
- package/src/core/summarizer/readme-reader.ts +24 -0
- package/src/core/types/architect-rules.ts +29 -0
- package/src/core/types/core.ts +94 -0
- package/src/core/types/infrastructure.ts +41 -0
- package/src/core/types/plugin.ts +19 -0
- package/src/core/types/rules.ts +51 -0
- package/src/core/types/summarizer.ts +8 -0
- package/src/infrastructure/git-cache.ts +52 -0
- package/src/infrastructure/git-history.ts +496 -0
- package/src/infrastructure/logger.ts +68 -0
- package/src/infrastructure/scanner.ts +349 -0
- package/tests/analyzers-integration.test.ts +174 -0
- package/tests/anti-patterns.test.ts +95 -0
- package/tests/ast-parser.test.ts +102 -0
- package/tests/fixtures/monorepo/package.json +6 -0
- package/tests/fixtures/monorepo/packages/app/package.json +12 -0
- package/tests/fixtures/monorepo/packages/app/src/index.ts +6 -0
- package/tests/fixtures/monorepo/packages/core/package.json +7 -0
- package/tests/fixtures/monorepo/packages/core/src/index.ts +7 -0
- package/tests/forecast.test.ts +504 -0
- package/tests/git-history.test.ts +254 -0
- package/tests/i18n.test.ts +47 -0
- package/tests/monorepo-scan.test.ts +170 -0
- package/tests/plugin-loader.test.ts +40 -0
- package/tests/rules-engine.test.ts +131 -0
- package/tests/scanner.test.ts +54 -0
- package/tests/scorer.test.ts +675 -0
- package/tests/temporal-scorer.test.ts +306 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AntiPattern, ArchitectConfig } from './core.js';
|
|
2
|
+
import { FileNode } from './infrastructure.js';
|
|
3
|
+
export interface PluginContext {
|
|
4
|
+
projectPath: string;
|
|
5
|
+
config: ArchitectConfig;
|
|
6
|
+
}
|
|
7
|
+
export type CustomAntiPatternDetector = (fileTree: FileNode, dependencies: Map<string, Set<string>>, context: PluginContext) => AntiPattern[] | Promise<AntiPattern[]>;
|
|
8
|
+
export interface ArchitectPlugin {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
detectAntiPatterns?: CustomAntiPatternDetector;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/core/types/plugin.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ArchitectureScore, AnalysisReport } from './core.js';
|
|
2
|
+
export interface RefactoringPlan {
|
|
3
|
+
timestamp: string;
|
|
4
|
+
projectPath: string;
|
|
5
|
+
currentScore: ArchitectureScore;
|
|
6
|
+
estimatedScoreAfter: {
|
|
7
|
+
overall: number;
|
|
8
|
+
breakdown: Record<string, number>;
|
|
9
|
+
};
|
|
10
|
+
steps: RefactorStep[];
|
|
11
|
+
totalOperations: number;
|
|
12
|
+
tier1Steps: number;
|
|
13
|
+
tier2Steps: number;
|
|
14
|
+
}
|
|
15
|
+
export interface RefactorStep {
|
|
16
|
+
id: number;
|
|
17
|
+
tier: 1 | 2;
|
|
18
|
+
rule: string;
|
|
19
|
+
priority: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
rationale: string;
|
|
23
|
+
operations: FileOperation[];
|
|
24
|
+
scoreImpact: {
|
|
25
|
+
metric: string;
|
|
26
|
+
before: number;
|
|
27
|
+
after: number;
|
|
28
|
+
}[];
|
|
29
|
+
codePreview?: string;
|
|
30
|
+
aiPrompt?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface FileOperation {
|
|
33
|
+
type: 'CREATE' | 'MOVE' | 'MODIFY' | 'DELETE';
|
|
34
|
+
path: string;
|
|
35
|
+
newPath?: string;
|
|
36
|
+
content?: string;
|
|
37
|
+
diff?: string;
|
|
38
|
+
description: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CodeSymbol {
|
|
41
|
+
name: string;
|
|
42
|
+
type: 'function' | 'class' | 'variable' | 'import' | 'export';
|
|
43
|
+
startLine: number;
|
|
44
|
+
endLine: number;
|
|
45
|
+
lines: number;
|
|
46
|
+
dependencies: string[];
|
|
47
|
+
usedBy: string[];
|
|
48
|
+
}
|
|
49
|
+
export interface RefactorRule {
|
|
50
|
+
name: string;
|
|
51
|
+
tier: 1 | 2;
|
|
52
|
+
analyze(report: AnalysisReport, projectPath: string): RefactorStep[];
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../src/core/types/rules.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summarizer.js","sourceRoot":"","sources":["../../../../src/core/types/summarizer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git History Cache — Serialize/deserialize GitHistoryReport
|
|
3
|
+
*/
|
|
4
|
+
import type { GitHistoryReport } from './git-history.js';
|
|
5
|
+
export declare function saveToCache(report: GitHistoryReport, projectPath: string, cacheDir?: string): void;
|
|
6
|
+
export declare function loadFromCache(projectPath: string, cacheDir?: string, maxAgeMs?: number): GitHistoryReport | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git History Cache — Serialize/deserialize GitHistoryReport
|
|
3
|
+
*/
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
export function saveToCache(report, projectPath, cacheDir = '.architect-cache') {
|
|
7
|
+
const dir = path.join(projectPath, cacheDir);
|
|
8
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
9
|
+
const serializable = {
|
|
10
|
+
...report,
|
|
11
|
+
modules: report.modules.map(m => ({
|
|
12
|
+
...m,
|
|
13
|
+
files: m.files.map(f => ({
|
|
14
|
+
...f,
|
|
15
|
+
authors: Array.from(f.authors),
|
|
16
|
+
lastModified: f.lastModified.toISOString(),
|
|
17
|
+
})),
|
|
18
|
+
})),
|
|
19
|
+
hotspots: report.hotspots.map(f => ({
|
|
20
|
+
...f,
|
|
21
|
+
authors: Array.from(f.authors),
|
|
22
|
+
lastModified: f.lastModified.toISOString(),
|
|
23
|
+
})),
|
|
24
|
+
};
|
|
25
|
+
fs.writeFileSync(path.join(dir, 'git-history.json'), JSON.stringify(serializable, null, 2));
|
|
26
|
+
}
|
|
27
|
+
export function loadFromCache(projectPath, cacheDir = '.architect-cache', maxAgeMs = 3600000) {
|
|
28
|
+
const cachePath = path.join(projectPath, cacheDir, 'git-history.json');
|
|
29
|
+
if (!fs.existsSync(cachePath))
|
|
30
|
+
return null;
|
|
31
|
+
try {
|
|
32
|
+
const raw = JSON.parse(fs.readFileSync(cachePath, 'utf-8'));
|
|
33
|
+
if (Date.now() - new Date(raw.analyzedAt).getTime() > maxAgeMs)
|
|
34
|
+
return null;
|
|
35
|
+
return raw;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=git-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-cache.js","sourceRoot":"","sources":["../../../src/infrastructure/git-cache.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,MAAM,UAAU,WAAW,CACzB,MAAwB,EACxB,WAAmB,EACnB,QAAQ,GAAG,kBAAkB;IAE7B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC7C,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAG;QACnB,GAAG,MAAM;QACT,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAChC,GAAG,CAAC;YACJ,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACvB,GAAG,CAAC;gBACJ,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;gBAC9B,YAA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
|
+
*
|
|
4
|
+
* Reads git log to build velocity vectors, churn rates, and hotspot maps.
|
|
5
|
+
* Enables Architect v4's predictive capabilities.
|
|
6
|
+
*
|
|
7
|
+
* Key metrics per module:
|
|
8
|
+
* - Commit frequency (commits/week rolling 4-week average)
|
|
9
|
+
* - Churn rate (lines added + deleted per commit)
|
|
10
|
+
* - Author diversity (bus factor proxy)
|
|
11
|
+
* - Change coupling (files that change together)
|
|
12
|
+
*
|
|
13
|
+
* @author Camilo Girardelli — Girardelli Tecnologia
|
|
14
|
+
* @license MIT
|
|
15
|
+
*/
|
|
16
|
+
export interface GitCommit {
|
|
17
|
+
hash: string;
|
|
18
|
+
author: string;
|
|
19
|
+
date: Date;
|
|
20
|
+
message: string;
|
|
21
|
+
files: FileChange[];
|
|
22
|
+
}
|
|
23
|
+
export interface FileChange {
|
|
24
|
+
path: string;
|
|
25
|
+
additions: number;
|
|
26
|
+
deletions: number;
|
|
27
|
+
}
|
|
28
|
+
export interface FileHistory {
|
|
29
|
+
path: string;
|
|
30
|
+
commits: number;
|
|
31
|
+
totalAdditions: number;
|
|
32
|
+
totalDeletions: number;
|
|
33
|
+
churnRate: number;
|
|
34
|
+
authors: Set<string>;
|
|
35
|
+
busFactor: number;
|
|
36
|
+
lastModified: Date;
|
|
37
|
+
weeklyCommitRate: number;
|
|
38
|
+
isHotspot: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ModuleHistory {
|
|
41
|
+
modulePath: string;
|
|
42
|
+
files: FileHistory[];
|
|
43
|
+
aggregateCommits: number;
|
|
44
|
+
aggregateChurn: number;
|
|
45
|
+
avgWeeklyRate: number;
|
|
46
|
+
topHotspots: FileHistory[];
|
|
47
|
+
velocityVector: VelocityVector;
|
|
48
|
+
busFactor: number;
|
|
49
|
+
}
|
|
50
|
+
export interface VelocityVector {
|
|
51
|
+
/** Commit rate trend: positive = accelerating, negative = decelerating */
|
|
52
|
+
commitAcceleration: number;
|
|
53
|
+
/** Churn trend: positive = increasing complexity, negative = stabilizing */
|
|
54
|
+
churnTrend: number;
|
|
55
|
+
/** Overall direction: "accelerating" | "stable" | "decelerating" */
|
|
56
|
+
direction: 'accelerating' | 'stable' | 'decelerating';
|
|
57
|
+
}
|
|
58
|
+
export interface ChangeCoupling {
|
|
59
|
+
fileA: string;
|
|
60
|
+
fileB: string;
|
|
61
|
+
cochangeCount: number;
|
|
62
|
+
confidence: number;
|
|
63
|
+
}
|
|
64
|
+
export interface GitHistoryReport {
|
|
65
|
+
projectPath: string;
|
|
66
|
+
analyzedAt: string;
|
|
67
|
+
periodWeeks: number;
|
|
68
|
+
totalCommits: number;
|
|
69
|
+
totalAuthors: number;
|
|
70
|
+
modules: ModuleHistory[];
|
|
71
|
+
hotspots: FileHistory[];
|
|
72
|
+
changeCouplings: ChangeCoupling[];
|
|
73
|
+
commitTimeline: WeeklySnapshot[];
|
|
74
|
+
}
|
|
75
|
+
export interface WeeklySnapshot {
|
|
76
|
+
weekStart: string;
|
|
77
|
+
commits: number;
|
|
78
|
+
churn: number;
|
|
79
|
+
activeFiles: number;
|
|
80
|
+
}
|
|
81
|
+
export interface GitAnalyzerConfig {
|
|
82
|
+
/** How many weeks of history to analyze (default: 24) */
|
|
83
|
+
periodWeeks?: number;
|
|
84
|
+
/** Rolling window for averages (default: 4 weeks) */
|
|
85
|
+
rollingWindowWeeks?: number;
|
|
86
|
+
/** Churn threshold to flag as hotspot (default: 500 lines) */
|
|
87
|
+
hotspotChurnThreshold?: number;
|
|
88
|
+
/** Minimum co-change count for coupling (default: 3) */
|
|
89
|
+
couplingMinCochanges?: number;
|
|
90
|
+
/** Path to cache dir (default: .architect-cache/) */
|
|
91
|
+
cacheDir?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare class GitHistoryAnalyzer {
|
|
94
|
+
private config;
|
|
95
|
+
constructor(config?: GitAnalyzerConfig);
|
|
96
|
+
/**
|
|
97
|
+
* Analyze git history for the project at the given path.
|
|
98
|
+
* Returns a comprehensive GitHistoryReport.
|
|
99
|
+
*/
|
|
100
|
+
analyze(projectPath: string): Promise<GitHistoryReport>;
|
|
101
|
+
private parseGitLog;
|
|
102
|
+
private parseLogOutput;
|
|
103
|
+
private buildFileHistories;
|
|
104
|
+
private groupByModule;
|
|
105
|
+
private calculateVelocity;
|
|
106
|
+
private detectHotspots;
|
|
107
|
+
private detectChangeCoupling;
|
|
108
|
+
private buildTimeline;
|
|
109
|
+
private validateGitRepo;
|
|
110
|
+
private getSinceDate;
|
|
111
|
+
private getModulePath;
|
|
112
|
+
}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git History Analyzer — Temporal analysis of codebase evolution
|
|
3
|
+
*
|
|
4
|
+
* Reads git log to build velocity vectors, churn rates, and hotspot maps.
|
|
5
|
+
* Enables Architect v4's predictive capabilities.
|
|
6
|
+
*
|
|
7
|
+
* Key metrics per module:
|
|
8
|
+
* - Commit frequency (commits/week rolling 4-week average)
|
|
9
|
+
* - Churn rate (lines added + deleted per commit)
|
|
10
|
+
* - Author diversity (bus factor proxy)
|
|
11
|
+
* - Change coupling (files that change together)
|
|
12
|
+
*
|
|
13
|
+
* @author Camilo Girardelli — Girardelli Tecnologia
|
|
14
|
+
* @license MIT
|
|
15
|
+
*/
|
|
16
|
+
import { exec } from 'child_process';
|
|
17
|
+
import { promisify } from 'util';
|
|
18
|
+
import { logger } from './logger.js';
|
|
19
|
+
const execAsync = promisify(exec);
|
|
20
|
+
const DEFAULT_CONFIG = {
|
|
21
|
+
periodWeeks: 24,
|
|
22
|
+
rollingWindowWeeks: 4,
|
|
23
|
+
hotspotChurnThreshold: 500,
|
|
24
|
+
couplingMinCochanges: 3,
|
|
25
|
+
cacheDir: '.architect-cache',
|
|
26
|
+
};
|
|
27
|
+
// ═══════════════════════════════════════════════════════════════
|
|
28
|
+
// GIT HISTORY ANALYZER
|
|
29
|
+
// ═══════════════════════════════════════════════════════════════
|
|
30
|
+
export class GitHistoryAnalyzer {
|
|
31
|
+
config;
|
|
32
|
+
constructor(config) {
|
|
33
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Analyze git history for the project at the given path.
|
|
37
|
+
* Returns a comprehensive GitHistoryReport.
|
|
38
|
+
*/
|
|
39
|
+
async analyze(projectPath) {
|
|
40
|
+
logger.debug('Starting GitHistory analysis', { projectPath, periodWeeks: this.config.periodWeeks });
|
|
41
|
+
await this.validateGitRepo(projectPath);
|
|
42
|
+
const sinceDate = this.getSinceDate();
|
|
43
|
+
const commits = await this.parseGitLog(projectPath, sinceDate);
|
|
44
|
+
logger.debug('Git history parsed', { commitCount: commits.length });
|
|
45
|
+
const fileHistories = this.buildFileHistories(commits);
|
|
46
|
+
const modules = this.groupByModule(fileHistories);
|
|
47
|
+
const hotspots = this.detectHotspots(fileHistories);
|
|
48
|
+
const changeCouplings = this.detectChangeCoupling(commits);
|
|
49
|
+
const timeline = this.buildTimeline(commits);
|
|
50
|
+
const allAuthors = new Set();
|
|
51
|
+
commits.forEach(c => allAuthors.add(c.author));
|
|
52
|
+
return {
|
|
53
|
+
projectPath,
|
|
54
|
+
analyzedAt: new Date().toISOString(),
|
|
55
|
+
periodWeeks: this.config.periodWeeks,
|
|
56
|
+
totalCommits: commits.length,
|
|
57
|
+
totalAuthors: allAuthors.size,
|
|
58
|
+
modules,
|
|
59
|
+
hotspots,
|
|
60
|
+
changeCouplings,
|
|
61
|
+
commitTimeline: timeline,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// ── Git Log Parsing ──
|
|
65
|
+
async parseGitLog(projectPath, since) {
|
|
66
|
+
const cmd = `git log --format='%H|%an|%aI|%s' --numstat --since="${since}" -- .`;
|
|
67
|
+
let output;
|
|
68
|
+
try {
|
|
69
|
+
const { stdout } = await execAsync(cmd, {
|
|
70
|
+
cwd: projectPath,
|
|
71
|
+
encoding: 'utf-8',
|
|
72
|
+
maxBuffer: 10 * 1024 * 1024, // 10MB buffer for large repos
|
|
73
|
+
});
|
|
74
|
+
output = stdout;
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
logger.warn('Failed to parse git log. History features will be bypassed.', { error, cmd });
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
return this.parseLogOutput(output);
|
|
81
|
+
}
|
|
82
|
+
parseLogOutput(output) {
|
|
83
|
+
const commits = [];
|
|
84
|
+
const lines = output.trim().split('\n');
|
|
85
|
+
let current = null;
|
|
86
|
+
for (const line of lines) {
|
|
87
|
+
if (!line.trim()) {
|
|
88
|
+
// Blank lines separate numstat blocks, but also appear between
|
|
89
|
+
// the commit header and its numstat output. Only finalize a commit
|
|
90
|
+
// on blank line if it already has file changes (otherwise it's just
|
|
91
|
+
// the gap between header and numstat).
|
|
92
|
+
if (current && current.files.length > 0) {
|
|
93
|
+
commits.push(current);
|
|
94
|
+
current = null;
|
|
95
|
+
}
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
// Commit header: hash|author|date|message
|
|
99
|
+
if (line.includes('|') && !line.startsWith('\t') && /^[0-9a-f]{7,}/.test(line)) {
|
|
100
|
+
if (current)
|
|
101
|
+
commits.push(current);
|
|
102
|
+
const parts = line.split('|');
|
|
103
|
+
if (parts.length >= 4) {
|
|
104
|
+
current = {
|
|
105
|
+
hash: parts[0],
|
|
106
|
+
author: parts[1],
|
|
107
|
+
date: new Date(parts[2]),
|
|
108
|
+
message: parts.slice(3).join('|'),
|
|
109
|
+
files: [],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
// Numstat line: additions\tdeletions\tfilepath
|
|
115
|
+
if (current && /^\d+\t\d+\t/.test(line)) {
|
|
116
|
+
const [add, del, filePath] = line.split('\t');
|
|
117
|
+
if (filePath && !filePath.includes('{') /* skip renames */) {
|
|
118
|
+
current.files.push({
|
|
119
|
+
path: filePath,
|
|
120
|
+
additions: parseInt(add, 10) || 0,
|
|
121
|
+
deletions: parseInt(del, 10) || 0,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (current)
|
|
127
|
+
commits.push(current);
|
|
128
|
+
return commits;
|
|
129
|
+
}
|
|
130
|
+
// ── File History Building ──
|
|
131
|
+
buildFileHistories(commits) {
|
|
132
|
+
const histories = new Map();
|
|
133
|
+
const now = new Date();
|
|
134
|
+
const windowMs = this.config.rollingWindowWeeks * 7 * 24 * 60 * 60 * 1000;
|
|
135
|
+
const windowStart = new Date(now.getTime() - windowMs);
|
|
136
|
+
for (const commit of commits) {
|
|
137
|
+
for (const file of commit.files) {
|
|
138
|
+
if (!histories.has(file.path)) {
|
|
139
|
+
histories.set(file.path, {
|
|
140
|
+
path: file.path,
|
|
141
|
+
commits: 0,
|
|
142
|
+
totalAdditions: 0,
|
|
143
|
+
totalDeletions: 0,
|
|
144
|
+
churnRate: 0,
|
|
145
|
+
authors: new Set(),
|
|
146
|
+
busFactor: 0,
|
|
147
|
+
lastModified: commit.date,
|
|
148
|
+
weeklyCommitRate: 0,
|
|
149
|
+
isHotspot: false,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const h = histories.get(file.path);
|
|
153
|
+
h.commits++;
|
|
154
|
+
h.totalAdditions += file.additions;
|
|
155
|
+
h.totalDeletions += file.deletions;
|
|
156
|
+
h.authors.add(commit.author);
|
|
157
|
+
if (commit.date > h.lastModified) {
|
|
158
|
+
h.lastModified = commit.date;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// Calculate derived metrics
|
|
163
|
+
const recentCommits = commits.filter(c => c.date >= windowStart);
|
|
164
|
+
const weekCount = Math.max(this.config.rollingWindowWeeks, 1);
|
|
165
|
+
for (const [filePath, h] of histories) {
|
|
166
|
+
h.churnRate = h.commits > 0
|
|
167
|
+
? (h.totalAdditions + h.totalDeletions) / h.commits
|
|
168
|
+
: 0;
|
|
169
|
+
h.busFactor = h.authors.size;
|
|
170
|
+
// Weekly commit rate from rolling window
|
|
171
|
+
const recentFileCommits = recentCommits.filter(c => c.files.some(f => f.path === filePath)).length;
|
|
172
|
+
h.weeklyCommitRate = recentFileCommits / weekCount;
|
|
173
|
+
// Hotspot: high churn + high frequency
|
|
174
|
+
h.isHotspot = (h.totalAdditions + h.totalDeletions) >= this.config.hotspotChurnThreshold
|
|
175
|
+
&& h.weeklyCommitRate >= 1;
|
|
176
|
+
}
|
|
177
|
+
return histories;
|
|
178
|
+
}
|
|
179
|
+
// ── Module Grouping ──
|
|
180
|
+
groupByModule(fileHistories) {
|
|
181
|
+
const moduleMap = new Map();
|
|
182
|
+
for (const [filePath, history] of fileHistories) {
|
|
183
|
+
const modulePath = this.getModulePath(filePath);
|
|
184
|
+
if (!moduleMap.has(modulePath)) {
|
|
185
|
+
moduleMap.set(modulePath, []);
|
|
186
|
+
}
|
|
187
|
+
moduleMap.get(modulePath).push(history);
|
|
188
|
+
}
|
|
189
|
+
return Array.from(moduleMap.entries()).map(([modulePath, files]) => {
|
|
190
|
+
const aggregateCommits = files.reduce((s, f) => s + f.commits, 0);
|
|
191
|
+
const aggregateChurn = files.reduce((s, f) => s + f.totalAdditions + f.totalDeletions, 0);
|
|
192
|
+
const avgWeeklyRate = files.reduce((s, f) => s + f.weeklyCommitRate, 0) / Math.max(files.length, 1);
|
|
193
|
+
const allAuthors = new Set();
|
|
194
|
+
files.forEach(f => f.authors.forEach(a => allAuthors.add(a)));
|
|
195
|
+
const topHotspots = files
|
|
196
|
+
.filter(f => f.isHotspot)
|
|
197
|
+
.sort((a, b) => (b.totalAdditions + b.totalDeletions) - (a.totalAdditions + a.totalDeletions))
|
|
198
|
+
.slice(0, 5);
|
|
199
|
+
return {
|
|
200
|
+
modulePath,
|
|
201
|
+
files,
|
|
202
|
+
aggregateCommits,
|
|
203
|
+
aggregateChurn,
|
|
204
|
+
avgWeeklyRate,
|
|
205
|
+
topHotspots,
|
|
206
|
+
velocityVector: this.calculateVelocity(files),
|
|
207
|
+
busFactor: allAuthors.size,
|
|
208
|
+
};
|
|
209
|
+
}).sort((a, b) => b.aggregateChurn - a.aggregateChurn);
|
|
210
|
+
}
|
|
211
|
+
// ── Velocity Calculation ──
|
|
212
|
+
calculateVelocity(files) {
|
|
213
|
+
if (files.length === 0) {
|
|
214
|
+
return { commitAcceleration: 0, churnTrend: 0, direction: 'stable' };
|
|
215
|
+
}
|
|
216
|
+
// Sort files by last modified (most recent first)
|
|
217
|
+
const sorted = [...files].sort((a, b) => b.lastModified.getTime() - a.lastModified.getTime());
|
|
218
|
+
// Split into halves: recent vs older
|
|
219
|
+
const mid = Math.floor(sorted.length / 2) || 1;
|
|
220
|
+
const recentHalf = sorted.slice(0, mid);
|
|
221
|
+
const olderHalf = sorted.slice(mid);
|
|
222
|
+
const recentAvgRate = recentHalf.reduce((s, f) => s + f.weeklyCommitRate, 0) / recentHalf.length;
|
|
223
|
+
const olderAvgRate = olderHalf.length > 0
|
|
224
|
+
? olderHalf.reduce((s, f) => s + f.weeklyCommitRate, 0) / olderHalf.length
|
|
225
|
+
: recentAvgRate;
|
|
226
|
+
const recentAvgChurn = recentHalf.reduce((s, f) => s + f.churnRate, 0) / recentHalf.length;
|
|
227
|
+
const olderAvgChurn = olderHalf.length > 0
|
|
228
|
+
? olderHalf.reduce((s, f) => s + f.churnRate, 0) / olderHalf.length
|
|
229
|
+
: recentAvgChurn;
|
|
230
|
+
const commitAcceleration = olderAvgRate > 0
|
|
231
|
+
? ((recentAvgRate - olderAvgRate) / olderAvgRate) * 100
|
|
232
|
+
: 0;
|
|
233
|
+
const churnTrend = olderAvgChurn > 0
|
|
234
|
+
? ((recentAvgChurn - olderAvgChurn) / olderAvgChurn) * 100
|
|
235
|
+
: 0;
|
|
236
|
+
let direction = 'stable';
|
|
237
|
+
if (commitAcceleration > 15)
|
|
238
|
+
direction = 'accelerating';
|
|
239
|
+
else if (commitAcceleration < -15)
|
|
240
|
+
direction = 'decelerating';
|
|
241
|
+
return {
|
|
242
|
+
commitAcceleration: Math.round(commitAcceleration * 10) / 10,
|
|
243
|
+
churnTrend: Math.round(churnTrend * 10) / 10,
|
|
244
|
+
direction,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
// ── Hotspot Detection ──
|
|
248
|
+
detectHotspots(fileHistories) {
|
|
249
|
+
return Array.from(fileHistories.values())
|
|
250
|
+
.filter(f => f.isHotspot)
|
|
251
|
+
.sort((a, b) => (b.totalAdditions + b.totalDeletions) - (a.totalAdditions + a.totalDeletions))
|
|
252
|
+
.slice(0, 20);
|
|
253
|
+
}
|
|
254
|
+
// ── Change Coupling Detection ──
|
|
255
|
+
detectChangeCoupling(commits) {
|
|
256
|
+
const cochangeMap = new Map();
|
|
257
|
+
const fileCommitCount = new Map();
|
|
258
|
+
for (const commit of commits) {
|
|
259
|
+
const files = commit.files.map(f => f.path).sort();
|
|
260
|
+
for (const f of files) {
|
|
261
|
+
fileCommitCount.set(f, (fileCommitCount.get(f) || 0) + 1);
|
|
262
|
+
}
|
|
263
|
+
// Pairwise co-change counting (limit to 10 files per commit to avoid explosion)
|
|
264
|
+
const limited = files.slice(0, 10);
|
|
265
|
+
for (let i = 0; i < limited.length; i++) {
|
|
266
|
+
for (let j = i + 1; j < limited.length; j++) {
|
|
267
|
+
const key = `${limited[i]}|||${limited[j]}`;
|
|
268
|
+
cochangeMap.set(key, (cochangeMap.get(key) || 0) + 1);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
const couplings = [];
|
|
273
|
+
for (const [key, count] of cochangeMap) {
|
|
274
|
+
if (count < this.config.couplingMinCochanges)
|
|
275
|
+
continue;
|
|
276
|
+
const [fileA, fileB] = key.split('|||');
|
|
277
|
+
const maxCommits = Math.max(fileCommitCount.get(fileA) || 1, fileCommitCount.get(fileB) || 1);
|
|
278
|
+
couplings.push({
|
|
279
|
+
fileA,
|
|
280
|
+
fileB,
|
|
281
|
+
cochangeCount: count,
|
|
282
|
+
confidence: Math.round((count / maxCommits) * 100) / 100,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
return couplings
|
|
286
|
+
.sort((a, b) => b.confidence - a.confidence)
|
|
287
|
+
.slice(0, 50);
|
|
288
|
+
}
|
|
289
|
+
// ── Timeline Building ──
|
|
290
|
+
buildTimeline(commits) {
|
|
291
|
+
if (commits.length === 0)
|
|
292
|
+
return [];
|
|
293
|
+
const snapshots = new Map();
|
|
294
|
+
const toMonday = (d) => {
|
|
295
|
+
d.setHours(0, 0, 0, 0);
|
|
296
|
+
d.setDate(d.getDate() - ((d.getDay() + 6) % 7));
|
|
297
|
+
return d.toISOString().split('T')[0];
|
|
298
|
+
};
|
|
299
|
+
const now = new Date();
|
|
300
|
+
for (let w = 0; w < this.config.periodWeeks; w++) {
|
|
301
|
+
const key = toMonday(new Date(now.getTime() - w * 604800000));
|
|
302
|
+
if (!snapshots.has(key)) {
|
|
303
|
+
snapshots.set(key, { weekStart: key, commits: 0, churn: 0, activeFiles: 0 });
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
for (const commit of commits) {
|
|
307
|
+
const key = toMonday(new Date(commit.date));
|
|
308
|
+
const snap = snapshots.get(key);
|
|
309
|
+
if (snap) {
|
|
310
|
+
snap.commits++;
|
|
311
|
+
snap.churn += commit.files.reduce((s, f) => s + f.additions + f.deletions, 0);
|
|
312
|
+
snap.activeFiles += commit.files.length;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return Array.from(snapshots.values()).sort((a, b) => a.weekStart.localeCompare(b.weekStart));
|
|
316
|
+
}
|
|
317
|
+
// ── Utilities ──
|
|
318
|
+
async validateGitRepo(projectPath) {
|
|
319
|
+
try {
|
|
320
|
+
await execAsync('git rev-parse --is-inside-work-tree', {
|
|
321
|
+
cwd: projectPath,
|
|
322
|
+
encoding: 'utf-8',
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
throw new Error(`Not a git repository: ${projectPath}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
getSinceDate() {
|
|
330
|
+
const d = new Date();
|
|
331
|
+
d.setDate(d.getDate() - (this.config.periodWeeks * 7));
|
|
332
|
+
return d.toISOString().split('T')[0];
|
|
333
|
+
}
|
|
334
|
+
getModulePath(filePath) {
|
|
335
|
+
const parts = filePath.split('/');
|
|
336
|
+
// Use first directory as module, or "root" if no directory
|
|
337
|
+
return parts.length > 1 ? parts[0] : 'root';
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=git-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-history.js","sourceRoot":"","sources":["../../../src/infrastructure/git-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AA4FlC,MAAM,cAAc,GAAgC;IAClD,WAAW,EAAE,EAAE;IACf,kBAAkB,EAAE,CAAC;IACrB,qBAAqB,EAAE,GAAG;IAC1B,oBAAoB,EAAE,CAAC;IACvB,QAAQ,EAAE,kBAAkB;CAC7B,CAAC;AAEF,kEAAkE;AAClE,uBAAuB;AACvB,kEAAkE;AAElE,MAAM,OAAO,kBAAkB;IACrB,MAAM,CAA8B;IAE5C,YAAY,MAA0B;QACpC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;IACjD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,WAAmB;QAC/B,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAEpG,MAAM,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AC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC;QACvD,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAEO,aAAa,CAAC,QAAgB;QACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,2DAA2D;QAC3D,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured Logger for Architect
|
|
3
|
+
* Provides leveled logging that respects CLI verbosity and environment.
|
|
4
|
+
*/
|
|
5
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
6
|
+
declare class Logger {
|
|
7
|
+
private isVerbose;
|
|
8
|
+
private isJson;
|
|
9
|
+
setup(options: {
|
|
10
|
+
verbose?: boolean;
|
|
11
|
+
json?: boolean;
|
|
12
|
+
}): void;
|
|
13
|
+
debug(message: string, meta?: Record<string, any>): void;
|
|
14
|
+
info(message: string, meta?: Record<string, any>): void;
|
|
15
|
+
warn(message: string, meta?: Record<string, any>): void;
|
|
16
|
+
error(message: string, error?: Error | unknown, meta?: Record<string, any>): void;
|
|
17
|
+
private log;
|
|
18
|
+
}
|
|
19
|
+
export declare const logger: Logger;
|
|
20
|
+
export {};
|