@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,171 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { join, basename } from 'path';
|
|
3
|
+
export class ModuleInferrer {
|
|
4
|
+
inferModules(report, _projectPath) {
|
|
5
|
+
const workspaces = report.projectInfo.workspaces;
|
|
6
|
+
// If we have workspaces, use them as the authoritative module list
|
|
7
|
+
if (workspaces && workspaces.length > 0) {
|
|
8
|
+
return this.inferModulesFromWorkspaces(workspaces, report);
|
|
9
|
+
}
|
|
10
|
+
// Fallback: infer from directory structure
|
|
11
|
+
return this.inferModulesFromStructure(report);
|
|
12
|
+
}
|
|
13
|
+
inferModulesFromWorkspaces(workspaces, report) {
|
|
14
|
+
return workspaces
|
|
15
|
+
.map((ws) => {
|
|
16
|
+
// Count files belonging to this workspace
|
|
17
|
+
const wsPrefix = ws.relativePath + '/';
|
|
18
|
+
const fileCount = report.dependencyGraph.nodes.filter((n) => n.startsWith(wsPrefix) || n.startsWith(ws.relativePath)).length;
|
|
19
|
+
// Get description: prefer package.json description, then README, then heuristic
|
|
20
|
+
const description = this.getWorkspaceDescription(ws);
|
|
21
|
+
// Use the short name (last segment of npm scope or dir name)
|
|
22
|
+
const displayName = ws.name.includes('/')
|
|
23
|
+
? ws.name.split('/').pop() || ws.name
|
|
24
|
+
: basename(ws.relativePath);
|
|
25
|
+
return {
|
|
26
|
+
name: displayName,
|
|
27
|
+
files: fileCount || this.countFilesInDir(ws.path),
|
|
28
|
+
description,
|
|
29
|
+
};
|
|
30
|
+
})
|
|
31
|
+
.filter((m) => m.files > 0)
|
|
32
|
+
.sort((a, b) => b.files - a.files);
|
|
33
|
+
}
|
|
34
|
+
getWorkspaceDescription(ws) {
|
|
35
|
+
// 1. package.json description (most reliable)
|
|
36
|
+
if (ws.description && ws.description.trim().length > 5) {
|
|
37
|
+
return ws.description.trim();
|
|
38
|
+
}
|
|
39
|
+
// 2. README.md first paragraph
|
|
40
|
+
const readmePath = join(ws.path, 'README.md');
|
|
41
|
+
if (existsSync(readmePath)) {
|
|
42
|
+
try {
|
|
43
|
+
const lines = readFileSync(readmePath, 'utf-8').split('\n');
|
|
44
|
+
for (const line of lines) {
|
|
45
|
+
const trimmed = line.trim();
|
|
46
|
+
if (!trimmed || trimmed.startsWith('#') || trimmed.startsWith('[')
|
|
47
|
+
|| trimmed.startsWith('<') || trimmed.startsWith('!')
|
|
48
|
+
|| trimmed.length < 15)
|
|
49
|
+
continue;
|
|
50
|
+
return trimmed.slice(0, 200);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// skip
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// 3. Heuristic from name and deps
|
|
58
|
+
return this.describeModule(basename(ws.relativePath), new Set(Object.keys(ws.dependencies)));
|
|
59
|
+
}
|
|
60
|
+
countFilesInDir(dirPath) {
|
|
61
|
+
try {
|
|
62
|
+
const { globSync } = require('glob');
|
|
63
|
+
return globSync('**/*.{ts,tsx,js,jsx,py,java,go}', {
|
|
64
|
+
cwd: dirPath,
|
|
65
|
+
ignore: ['**/node_modules/**', '**/dist/**'],
|
|
66
|
+
nodir: true,
|
|
67
|
+
}).length;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
inferModulesFromStructure(report) {
|
|
74
|
+
const modules = new Map();
|
|
75
|
+
for (const node of report.dependencyGraph.nodes) {
|
|
76
|
+
// Safety: skip any node_modules paths that leaked through
|
|
77
|
+
if (node.includes('node_modules'))
|
|
78
|
+
continue;
|
|
79
|
+
const parts = node.split('/');
|
|
80
|
+
// Skip root-level files
|
|
81
|
+
if (parts.length < 2)
|
|
82
|
+
continue;
|
|
83
|
+
// Get the module directory (2nd level, or 1st level for flat projects)
|
|
84
|
+
let moduleName;
|
|
85
|
+
const firstDir = parts[0];
|
|
86
|
+
// Common source directories — go one level deeper
|
|
87
|
+
if (['src', 'lib', 'app', 'packages', 'modules', 'features', 'apps'].includes(firstDir)) {
|
|
88
|
+
moduleName = parts.length > 2 ? parts[1] : firstDir;
|
|
89
|
+
}
|
|
90
|
+
else if (firstDir === 'tests' || firstDir === 'test' || firstDir === '__tests__') {
|
|
91
|
+
continue; // Skip test directories for module inference
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
moduleName = firstDir;
|
|
95
|
+
}
|
|
96
|
+
if (!modules.has(moduleName)) {
|
|
97
|
+
modules.set(moduleName, { files: new Set(), hints: new Set() });
|
|
98
|
+
}
|
|
99
|
+
const mod = modules.get(moduleName);
|
|
100
|
+
mod.files.add(node);
|
|
101
|
+
// Extract hints from filenames
|
|
102
|
+
const filename = basename(node).replace(/\.(ts|js|py|dart|go|java|rb|php|cs|tsx|jsx)$/, '');
|
|
103
|
+
if (filename !== 'index' && filename !== 'main' && filename !== '__init__') {
|
|
104
|
+
mod.hints.add(filename.toLowerCase());
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return [...modules.entries()]
|
|
108
|
+
.filter(([, data]) => data.files.size > 0)
|
|
109
|
+
.sort((a, b) => b[1].files.size - a[1].files.size)
|
|
110
|
+
.slice(0, 15) // Top 15 modules
|
|
111
|
+
.map(([name, data]) => ({
|
|
112
|
+
name,
|
|
113
|
+
files: data.files.size,
|
|
114
|
+
description: this.describeModule(name, data.hints),
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
describeModule(name, hints) {
|
|
118
|
+
const n = name.toLowerCase();
|
|
119
|
+
const h = [...hints].join(' ');
|
|
120
|
+
// Known module patterns
|
|
121
|
+
const patterns = [
|
|
122
|
+
[/auth/, 'Autenticação e autorização'],
|
|
123
|
+
[/user/, 'Gestão de usuários'],
|
|
124
|
+
[/payment|billing|charge|invoice/, 'Pagamentos e faturamento'],
|
|
125
|
+
[/order|cart|checkout/, 'Pedidos e checkout'],
|
|
126
|
+
[/product|catalog|item/, 'Catálogo de produtos'],
|
|
127
|
+
[/notif/, 'Sistema de notificações'],
|
|
128
|
+
[/email|mail|smtp/, 'Envio de emails'],
|
|
129
|
+
[/report|analytics|dashboard/, 'Relatórios e analytics'],
|
|
130
|
+
[/config|setting/, 'Configuração do sistema'],
|
|
131
|
+
[/util|helper|common|shared/, 'Utilitários compartilhados'],
|
|
132
|
+
[/middleware|interceptor|guard|pipe/, 'Middleware e interceptors'],
|
|
133
|
+
[/database|db|migration|seed/, 'Banco de dados e migrations'],
|
|
134
|
+
[/api|controller|route|endpoint/, 'API endpoints'],
|
|
135
|
+
[/service|business|domain/, 'Lógica de negócio'],
|
|
136
|
+
[/model|entity|schema/, 'Modelos de dados'],
|
|
137
|
+
[/test|spec|fixture/, 'Testes'],
|
|
138
|
+
[/validator|validation|sanitiz/, 'Validação de dados'],
|
|
139
|
+
[/security|crypto|encrypt/, 'Segurança e criptografia'],
|
|
140
|
+
[/cache|redis/, 'Cache e performance'],
|
|
141
|
+
[/queue|worker|job|task/, 'Processamento assíncrono'],
|
|
142
|
+
[/log|monitor|trace|metric/, 'Logging e monitoramento'],
|
|
143
|
+
[/file|upload|storage|s3/, 'Armazenamento de arquivos'],
|
|
144
|
+
[/search|elastic|index/, 'Busca e indexação'],
|
|
145
|
+
[/chat|message|websocket|socket/, 'Comunicação em tempo real'],
|
|
146
|
+
[/i18n|locale|translation/, 'Internacionalização'],
|
|
147
|
+
[/theme|style|design/, 'Design system e temas'],
|
|
148
|
+
[/component|widget|ui/, 'Componentes de UI'],
|
|
149
|
+
[/page|screen|view/, 'Páginas/telas'],
|
|
150
|
+
[/hook|composable/, 'Hooks/composables reutilizáveis'],
|
|
151
|
+
[/store|state|redux|bloc/, 'Gerenciamento de estado'],
|
|
152
|
+
[/navigation|router|routing/, 'Navegação e rotas'],
|
|
153
|
+
[/bridge/, 'Camada de integração'],
|
|
154
|
+
[/core/, 'Núcleo e orquestração'],
|
|
155
|
+
[/event/, 'Sistema de eventos'],
|
|
156
|
+
[/type/, 'Definições de tipos'],
|
|
157
|
+
[/mcp/, 'MCP Server'],
|
|
158
|
+
[/cli/, 'Interface de linha de comando'],
|
|
159
|
+
[/cloud/, 'Serviço cloud / API'],
|
|
160
|
+
[/autonomy/, 'Automação e self-healing'],
|
|
161
|
+
[/app/, 'Aplicação principal'],
|
|
162
|
+
];
|
|
163
|
+
const combined = `${n} ${h}`;
|
|
164
|
+
for (const [regex, desc] of patterns) {
|
|
165
|
+
if (regex.test(combined))
|
|
166
|
+
return desc;
|
|
167
|
+
}
|
|
168
|
+
return `Módulo ${name}`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=module-inferrer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-inferrer.js","sourceRoot":"","sources":["../../../../src/core/summarizer/module-inferrer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IA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,CAAC;QAED,OAAO,UAAU,IAAI,EAAE,CAAC;IAC1B,CAAC;CAEF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { join, basename } from 'path';
|
|
3
|
+
// import { AnalysisReport } from '../types/core.js';
|
|
4
|
+
// import { ProjectSummary } from '../types/summarizer.js';
|
|
5
|
+
// import { FileNode, WorkspaceInfo } from '../types/infrastructure.js';
|
|
6
|
+
export class PackageReader {
|
|
7
|
+
readPackageJson(projectPath) {
|
|
8
|
+
const candidates = [
|
|
9
|
+
join(projectPath, 'package.json'),
|
|
10
|
+
join(projectPath, 'pyproject.toml'),
|
|
11
|
+
join(projectPath, 'pubspec.yaml'),
|
|
12
|
+
join(projectPath, 'Cargo.toml'),
|
|
13
|
+
join(projectPath, 'pom.xml'),
|
|
14
|
+
join(projectPath, 'build.gradle'),
|
|
15
|
+
];
|
|
16
|
+
for (const candidate of candidates) {
|
|
17
|
+
if (existsSync(candidate)) {
|
|
18
|
+
try {
|
|
19
|
+
if (candidate.endsWith('.json')) {
|
|
20
|
+
return JSON.parse(readFileSync(candidate, 'utf-8'));
|
|
21
|
+
}
|
|
22
|
+
// For non-JSON, return raw content as 'raw' field
|
|
23
|
+
return { raw: readFileSync(candidate, 'utf-8'), type: basename(candidate) };
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// ignore
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=package-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-reader.js","sourceRoot":"","sources":["../../../../src/core/summarizer/package-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtC,qDAAqD;AACrD,2DAA2D;AAC3D,wEAAwE;AAExE,MAAM,OAAO,aAAa;IACnB,eAAe,CAAC,WAAmB;QACtC,MAAM,UAAU,GAAG;YACjB,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC;YACjC,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC;YACnC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC;YACjC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC;YAC/B,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;YAC5B,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC;SAClC,CAAC;QAEF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC;oBACH,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;wBAChC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;oBACtD,CAAC;oBACD,kDAAkD;oBAClD,OAAO,EAAE,GAAG,EAAE,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC9E,CAAC;gBAAC,MAAM,CAAC;oBACP,SAAS;gBACX,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;CAEF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnalysisReport } from '../types/core.js';
|
|
2
|
+
import { ProjectSummary } from '../types/summarizer.js';
|
|
3
|
+
export declare class PurposeInferrer {
|
|
4
|
+
buildTechStack(report: AnalysisReport, packageInfo: Record<string, unknown>): string[];
|
|
5
|
+
buildDescription(packageInfo: Record<string, unknown>, readme: string, report: AnalysisReport): string;
|
|
6
|
+
inferPurpose(keywords: string[], modules: ProjectSummary['modules'], report: AnalysisReport): string;
|
|
7
|
+
findEntryPoints(report: AnalysisReport, projectPath: string): string[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
// import { FileNode, WorkspaceInfo } from '../types/infrastructure.js';
|
|
4
|
+
export class PurposeInferrer {
|
|
5
|
+
buildTechStack(report, packageInfo) {
|
|
6
|
+
const stack = [];
|
|
7
|
+
// Languages
|
|
8
|
+
stack.push(...report.projectInfo.primaryLanguages);
|
|
9
|
+
// Frameworks from report
|
|
10
|
+
stack.push(...report.projectInfo.frameworks);
|
|
11
|
+
// Dependencies from package.json
|
|
12
|
+
const deps = { ...(packageInfo.dependencies || {}), ...(packageInfo.devDependencies || {}) };
|
|
13
|
+
const notable = [
|
|
14
|
+
'express', 'fastify', 'nestjs', '@nestjs/core', 'koa', 'hapi',
|
|
15
|
+
'react', 'next', 'angular', 'vue', 'svelte',
|
|
16
|
+
'prisma', '@prisma/client', 'typeorm', 'sequelize', 'mongoose', 'knex',
|
|
17
|
+
'jest', 'mocha', 'vitest', 'cypress', 'playwright',
|
|
18
|
+
'tailwindcss', 'styled-components', 'emotion',
|
|
19
|
+
'redis', 'ioredis', 'bull', 'bullmq',
|
|
20
|
+
'graphql', 'apollo', '@apollo/server',
|
|
21
|
+
'socket.io', 'ws',
|
|
22
|
+
'passport', 'jsonwebtoken', 'bcrypt',
|
|
23
|
+
'winston', 'pino',
|
|
24
|
+
'swagger', '@nestjs/swagger',
|
|
25
|
+
'docker', 'kubernetes',
|
|
26
|
+
'aws-sdk', '@aws-sdk',
|
|
27
|
+
'stripe', 'paypal',
|
|
28
|
+
];
|
|
29
|
+
for (const dep of Object.keys(deps)) {
|
|
30
|
+
const cleaned = dep.replace('@', '').split('/')[0];
|
|
31
|
+
if (notable.some(n => dep.includes(n))) {
|
|
32
|
+
if (!stack.some(s => s.toLowerCase() === cleaned.toLowerCase())) {
|
|
33
|
+
stack.push(dep);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return [...new Set(stack)].slice(0, 15);
|
|
38
|
+
}
|
|
39
|
+
buildDescription(packageInfo, readme, report) {
|
|
40
|
+
// Priority 1: package.json description
|
|
41
|
+
if (typeof packageInfo.description === 'string' && packageInfo.description.trim()) {
|
|
42
|
+
return packageInfo.description.trim();
|
|
43
|
+
}
|
|
44
|
+
// Priority 2: First paragraph of README (skip badges, titles)
|
|
45
|
+
if (readme) {
|
|
46
|
+
const lines = readme.split('\n');
|
|
47
|
+
for (const line of lines) {
|
|
48
|
+
const trimmed = line.trim();
|
|
49
|
+
// Skip empty lines, headers, badges, links, HTML tags
|
|
50
|
+
if (!trimmed)
|
|
51
|
+
continue;
|
|
52
|
+
if (trimmed.startsWith('#'))
|
|
53
|
+
continue;
|
|
54
|
+
if (trimmed.startsWith('[!') || trimmed.startsWith('[!['))
|
|
55
|
+
continue;
|
|
56
|
+
if (trimmed.startsWith('<'))
|
|
57
|
+
continue;
|
|
58
|
+
if (trimmed.startsWith('---') || trimmed.startsWith('==='))
|
|
59
|
+
continue;
|
|
60
|
+
if (trimmed.startsWith('!['))
|
|
61
|
+
continue;
|
|
62
|
+
if (trimmed.length < 20)
|
|
63
|
+
continue;
|
|
64
|
+
// Found a real text paragraph
|
|
65
|
+
return trimmed.slice(0, 300);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Priority 3: Infer from project name and structure
|
|
69
|
+
const name = report.projectInfo.name || 'Unknown';
|
|
70
|
+
const langs = report.projectInfo.primaryLanguages.join(', ');
|
|
71
|
+
const files = report.projectInfo.totalFiles;
|
|
72
|
+
return `Projeto ${name} — ${files} arquivos em ${langs}`;
|
|
73
|
+
}
|
|
74
|
+
inferPurpose(keywords, modules, report) {
|
|
75
|
+
const allSignals = [
|
|
76
|
+
...keywords,
|
|
77
|
+
...modules.map(m => m.name.toLowerCase()),
|
|
78
|
+
...modules.map(m => m.description.toLowerCase()),
|
|
79
|
+
// Only use project nodes, never leaked node_modules paths
|
|
80
|
+
...report.dependencyGraph.nodes
|
|
81
|
+
.filter(n => !n.includes('node_modules'))
|
|
82
|
+
.map(n => n.toLowerCase()),
|
|
83
|
+
].join(' ');
|
|
84
|
+
// Infer project type from signals
|
|
85
|
+
const types = [
|
|
86
|
+
[/api.*(rest|graph|endpoint)|controller.*route|swagger|openapi/, 'API Backend'],
|
|
87
|
+
[/cli|command.*line|bin\/|yargs|commander/, 'CLI Tool'],
|
|
88
|
+
[/component.*ui|react|angular|vue|frontend|page.*screen/, 'Frontend Application'],
|
|
89
|
+
[/mobile|flutter|dart|react.native|ionic/, 'Mobile App'],
|
|
90
|
+
[/library|lib|package|npm|pub|sdk|module/, 'Library / Package'],
|
|
91
|
+
[/test|spec|validator|lint|analyz|check/, 'Tool de Análise / Validação'],
|
|
92
|
+
[/microservice|service|worker|queue/, 'Microservice'],
|
|
93
|
+
[/monorepo|workspace|packages\//, 'Monorepo'],
|
|
94
|
+
[/bot|scraper|crawler|automation/, 'Bot / Automação'],
|
|
95
|
+
[/game|canvas|webgl|three/, 'Game / Visualização'],
|
|
96
|
+
[/e-?commerce|shop|cart|product|catalog/, 'E-commerce'],
|
|
97
|
+
[/blog|cms|content|post|article/, 'CMS / Blog'],
|
|
98
|
+
[/auth|login|oauth|sso|identity/, 'Sistema de Autenticação'],
|
|
99
|
+
[/chat|message|realtime|socket/, 'Comunicação Real-time'],
|
|
100
|
+
[/dashboard|admin|panel|analytics/, 'Dashboard / Admin Panel'],
|
|
101
|
+
[/payment|billing|fintech|finance|bank/, 'Fintech / Pagamentos'],
|
|
102
|
+
[/health|medical|patient|clinic/, 'Healthcare'],
|
|
103
|
+
[/education|course|learn|student/, 'EdTech'],
|
|
104
|
+
];
|
|
105
|
+
const matched = [];
|
|
106
|
+
for (const [regex, type] of types) {
|
|
107
|
+
if (regex.test(allSignals)) {
|
|
108
|
+
matched.push(type);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (matched.length > 0) {
|
|
112
|
+
return matched.slice(0, 3).join(' + ');
|
|
113
|
+
}
|
|
114
|
+
// Fallback
|
|
115
|
+
const langs = report.projectInfo.primaryLanguages.join('/');
|
|
116
|
+
return `Projeto ${langs}`;
|
|
117
|
+
}
|
|
118
|
+
findEntryPoints(report, projectPath) {
|
|
119
|
+
const entries = [];
|
|
120
|
+
// 1. From workspace bin fields
|
|
121
|
+
const workspaces = report.projectInfo.workspaces;
|
|
122
|
+
if (workspaces) {
|
|
123
|
+
for (const ws of workspaces) {
|
|
124
|
+
if (ws.bin) {
|
|
125
|
+
if (typeof ws.bin === 'string') {
|
|
126
|
+
entries.push(`${ws.relativePath}/${ws.bin}`);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
for (const [, binPath] of Object.entries(ws.bin)) {
|
|
130
|
+
const fullPath = `${ws.relativePath}/${binPath}`;
|
|
131
|
+
entries.push(fullPath);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (ws.main) {
|
|
136
|
+
entries.push(`${ws.relativePath}/${ws.main}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// 2. From root package.json bin/main
|
|
141
|
+
const rootPkgPath = join(projectPath, 'package.json');
|
|
142
|
+
if (existsSync(rootPkgPath)) {
|
|
143
|
+
try {
|
|
144
|
+
const pkg = JSON.parse(readFileSync(rootPkgPath, 'utf-8'));
|
|
145
|
+
if (pkg.bin) {
|
|
146
|
+
if (typeof pkg.bin === 'string') {
|
|
147
|
+
entries.push(pkg.bin);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
for (const [, binPath] of Object.entries(pkg.bin)) {
|
|
151
|
+
entries.push(binPath);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (pkg.main && !entries.includes(pkg.main)) {
|
|
156
|
+
entries.push(pkg.main);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
// skip
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// 3. Pattern-based detection (fallback)
|
|
164
|
+
const entryPatterns = [
|
|
165
|
+
/^(src\/)?(main|index|app|server|cli)\.(ts|js|py|dart|go|java)$/,
|
|
166
|
+
/^(src\/)?bin\//,
|
|
167
|
+
/^packages\/[^/]+\/src\/(main|index|app|server|cli)\.(ts|js)$/,
|
|
168
|
+
/^packages\/[^/]+\/src\/bin\//,
|
|
169
|
+
/manage\.py$/,
|
|
170
|
+
/^main\.go$/,
|
|
171
|
+
];
|
|
172
|
+
const patternEntries = report.dependencyGraph.nodes
|
|
173
|
+
.filter(node => entryPatterns.some(p => p.test(node)))
|
|
174
|
+
.filter(node => !entries.includes(node));
|
|
175
|
+
entries.push(...patternEntries);
|
|
176
|
+
return [...new Set(entries)].slice(0, 10);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=purpose-inferrer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purpose-inferrer.js","sourceRoot":"","sources":["../../../../src/core/summarizer/purpose-inferrer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AAG3B,wEAAwE;AAExE,MAAM,OAAO,eAAe;IACrB,cAAc,CAAC,MAAsB,EAAE,WAAoC;QAC9E,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,YAAY;QACZ,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QAEnD,yBAAyB;QACzB,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAE7C,iCAAiC;QACjC,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,WAAW,CAAC,YAAsC,IAAI,EA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BAClC,CAAC;oBACH,CAAC;gBACH,CAAC;gBACD,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC5C,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO;YACT,CAAC;QACH,CAAC;QAED,wCAAwC;QACxC,MAAM,aAAa,GAAG;YACpB,gEAAgE;YAChE,gBAAgB;YAChB,8DAA8D;YAC9D,8BAA8B;YAC9B,aAAa;YACb,YAAY;SACb,CAAC;QAEF,MAAM,cAAc,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK;aAChD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;aACrD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAE3C,OAAO,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;QAEhC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;CAEF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
// import { AnalysisReport } from '../types/core.js';
|
|
4
|
+
// import { ProjectSummary } from '../types/summarizer.js';
|
|
5
|
+
// import { FileNode, WorkspaceInfo } from '../types/infrastructure.js';
|
|
6
|
+
export class ReadmeReader {
|
|
7
|
+
readReadme(projectPath) {
|
|
8
|
+
const candidates = ['README.md', 'readme.md', 'README.txt', 'README', 'README.rst'];
|
|
9
|
+
for (const name of candidates) {
|
|
10
|
+
const path = join(projectPath, name);
|
|
11
|
+
if (existsSync(path)) {
|
|
12
|
+
try {
|
|
13
|
+
// Read first 3000 chars — enough for description, skip excessive content
|
|
14
|
+
return readFileSync(path, 'utf-8').slice(0, 3000);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// ignore
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=readme-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readme-reader.js","sourceRoot":"","sources":["../../../../src/core/summarizer/readme-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AAC3B,qDAAqD;AACrD,2DAA2D;AAC3D,wEAAwE;AAExE,MAAM,OAAO,YAAY;IAClB,UAAU,CAAC,WAAmB;QACjC,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QACpF,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;YACrC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrB,IAAI,CAAC;oBACH,yEAAyE;oBACzE,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;gBACpD,CAAC;gBAAC,MAAM,CAAC;oBACP,SAAS;gBACX,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;CAEF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ArchitectRules {
|
|
2
|
+
version: string;
|
|
3
|
+
project?: {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
};
|
|
7
|
+
quality_gates?: {
|
|
8
|
+
min_overall_score?: number;
|
|
9
|
+
max_critical_anti_patterns?: number;
|
|
10
|
+
max_high_anti_patterns?: number;
|
|
11
|
+
};
|
|
12
|
+
boundaries?: {
|
|
13
|
+
allow_circular_dependencies?: boolean;
|
|
14
|
+
banned_imports?: string[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface RuleViolation {
|
|
18
|
+
level: 'error' | 'warning';
|
|
19
|
+
rule: string;
|
|
20
|
+
message: string;
|
|
21
|
+
actual?: number | string | string[];
|
|
22
|
+
expected?: number | string | string[];
|
|
23
|
+
}
|
|
24
|
+
export interface ValidationResult {
|
|
25
|
+
success: boolean;
|
|
26
|
+
violations: RuleViolation[];
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architect-rules.js","sourceRoot":"","sources":["../../../../src/core/types/architect-rules.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ProjectInfo } from './infrastructure.js';
|
|
2
|
+
import { ProjectSummary } from './summarizer.js';
|
|
3
|
+
export interface DependencyEdge {
|
|
4
|
+
from: string;
|
|
5
|
+
to: string;
|
|
6
|
+
type: 'import' | 'export' | 'inheritance' | 'composition';
|
|
7
|
+
weight: number;
|
|
8
|
+
}
|
|
9
|
+
export interface Layer {
|
|
10
|
+
name: 'API' | 'Service' | 'Data' | 'UI' | 'Infrastructure';
|
|
11
|
+
files: string[];
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AntiPattern {
|
|
15
|
+
name: string;
|
|
16
|
+
severity: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
|
|
17
|
+
location: string;
|
|
18
|
+
description: string;
|
|
19
|
+
suggestion: string;
|
|
20
|
+
affectedFiles?: string[];
|
|
21
|
+
metrics?: Record<string, number | string>;
|
|
22
|
+
}
|
|
23
|
+
export interface ScoreComponent {
|
|
24
|
+
name: string;
|
|
25
|
+
score: number;
|
|
26
|
+
maxScore: number;
|
|
27
|
+
weight: number;
|
|
28
|
+
explanation: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ArchitectureScore {
|
|
31
|
+
overall: number;
|
|
32
|
+
components: ScoreComponent[];
|
|
33
|
+
breakdown: {
|
|
34
|
+
modularity: number;
|
|
35
|
+
coupling: number;
|
|
36
|
+
cohesion: number;
|
|
37
|
+
layering: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface AnalysisReport {
|
|
41
|
+
timestamp: string;
|
|
42
|
+
projectInfo: ProjectInfo;
|
|
43
|
+
score: ArchitectureScore;
|
|
44
|
+
antiPatterns: AntiPattern[];
|
|
45
|
+
layers: Layer[];
|
|
46
|
+
dependencyGraph: {
|
|
47
|
+
nodes: string[];
|
|
48
|
+
edges: DependencyEdge[];
|
|
49
|
+
};
|
|
50
|
+
suggestions: {
|
|
51
|
+
priority: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
|
|
52
|
+
title: string;
|
|
53
|
+
description: string;
|
|
54
|
+
impact: string;
|
|
55
|
+
}[];
|
|
56
|
+
diagram: {
|
|
57
|
+
mermaid: string;
|
|
58
|
+
type: 'component' | 'layer' | 'dependency';
|
|
59
|
+
};
|
|
60
|
+
projectSummary?: ProjectSummary;
|
|
61
|
+
}
|
|
62
|
+
export interface ArchitectConfig {
|
|
63
|
+
ignore?: string[];
|
|
64
|
+
frameworks?: {
|
|
65
|
+
detect?: boolean;
|
|
66
|
+
};
|
|
67
|
+
antiPatterns?: {
|
|
68
|
+
godClass?: {
|
|
69
|
+
linesThreshold?: number;
|
|
70
|
+
methodsThreshold?: number;
|
|
71
|
+
};
|
|
72
|
+
shotgunSurgery?: {
|
|
73
|
+
changePropagationThreshold?: number;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
score?: {
|
|
77
|
+
modularity?: number;
|
|
78
|
+
coupling?: number;
|
|
79
|
+
cohesion?: number;
|
|
80
|
+
layering?: number;
|
|
81
|
+
};
|
|
82
|
+
monorepo?: {
|
|
83
|
+
enabled?: boolean;
|
|
84
|
+
treatPackagesAsModules?: boolean;
|
|
85
|
+
};
|
|
86
|
+
plugins?: string[];
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../src/core/types/core.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface FileNode {
|
|
2
|
+
path: string;
|
|
3
|
+
name: string;
|
|
4
|
+
type: 'file' | 'directory';
|
|
5
|
+
extension?: string;
|
|
6
|
+
lines?: number;
|
|
7
|
+
language?: string;
|
|
8
|
+
children?: FileNode[];
|
|
9
|
+
imports?: string[];
|
|
10
|
+
exports?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface WorkspaceInfo {
|
|
13
|
+
name: string;
|
|
14
|
+
path: string;
|
|
15
|
+
relativePath: string;
|
|
16
|
+
description: string;
|
|
17
|
+
version: string;
|
|
18
|
+
dependencies: Record<string, string>;
|
|
19
|
+
devDependencies: Record<string, string>;
|
|
20
|
+
bin?: Record<string, string>;
|
|
21
|
+
main?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ProjectInfo {
|
|
24
|
+
path: string;
|
|
25
|
+
name: string;
|
|
26
|
+
frameworks: string[];
|
|
27
|
+
totalFiles: number;
|
|
28
|
+
totalLines: number;
|
|
29
|
+
primaryLanguages: string[];
|
|
30
|
+
fileTree?: FileNode;
|
|
31
|
+
workspaces?: WorkspaceInfo[];
|
|
32
|
+
}
|
|
33
|
+
export interface ParsedImport {
|
|
34
|
+
source: string;
|
|
35
|
+
names: string[];
|
|
36
|
+
isDefault: boolean;
|
|
37
|
+
isNamespace: boolean;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infrastructure.js","sourceRoot":"","sources":["../../../../src/core/types/infrastructure.ts"],"names":[],"mappings":""}
|