@girardelli/architect 1.2.1 ā 2.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/README.md +111 -112
- package/dist/agent-generator.d.ts +95 -0
- package/dist/agent-generator.d.ts.map +1 -0
- package/dist/agent-generator.js +1295 -0
- package/dist/agent-generator.js.map +1 -0
- package/dist/cli.js +76 -2
- package/dist/cli.js.map +1 -1
- package/dist/html-reporter.d.ts +26 -4
- package/dist/html-reporter.d.ts.map +1 -1
- package/dist/html-reporter.js +832 -33
- package/dist/html-reporter.js.map +1 -1
- package/dist/index.d.ts +26 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +85 -8
- package/dist/index.js.map +1 -1
- package/dist/refactor-engine.d.ts +18 -0
- package/dist/refactor-engine.d.ts.map +1 -0
- package/dist/refactor-engine.js +86 -0
- package/dist/refactor-engine.js.map +1 -0
- package/dist/refactor-reporter.d.ts +20 -0
- package/dist/refactor-reporter.d.ts.map +1 -0
- package/dist/refactor-reporter.js +389 -0
- package/dist/refactor-reporter.js.map +1 -0
- package/dist/rules/barrel-optimizer.d.ts +13 -0
- package/dist/rules/barrel-optimizer.d.ts.map +1 -0
- package/dist/rules/barrel-optimizer.js +77 -0
- package/dist/rules/barrel-optimizer.js.map +1 -0
- package/dist/rules/dead-code-detector.d.ts +21 -0
- package/dist/rules/dead-code-detector.d.ts.map +1 -0
- package/dist/rules/dead-code-detector.js +117 -0
- package/dist/rules/dead-code-detector.js.map +1 -0
- package/dist/rules/hub-splitter.d.ts +13 -0
- package/dist/rules/hub-splitter.d.ts.map +1 -0
- package/dist/rules/hub-splitter.js +110 -0
- package/dist/rules/hub-splitter.js.map +1 -0
- package/dist/rules/import-organizer.d.ts +13 -0
- package/dist/rules/import-organizer.d.ts.map +1 -0
- package/dist/rules/import-organizer.js +85 -0
- package/dist/rules/import-organizer.js.map +1 -0
- package/dist/rules/module-grouper.d.ts +13 -0
- package/dist/rules/module-grouper.d.ts.map +1 -0
- package/dist/rules/module-grouper.js +110 -0
- package/dist/rules/module-grouper.js.map +1 -0
- package/dist/scorer.d.ts +12 -0
- package/dist/scorer.d.ts.map +1 -1
- package/dist/scorer.js +61 -17
- package/dist/scorer.js.map +1 -1
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agent-generator.ts +1401 -0
- package/src/cli.ts +83 -2
- package/src/html-reporter.ts +872 -35
- package/src/index.ts +108 -9
- package/src/refactor-engine.ts +117 -0
- package/src/refactor-reporter.ts +408 -0
- package/src/rules/barrel-optimizer.ts +97 -0
- package/src/rules/dead-code-detector.ts +132 -0
- package/src/rules/hub-splitter.ts +123 -0
- package/src/rules/import-organizer.ts +98 -0
- package/src/rules/module-grouper.ts +124 -0
- package/src/scorer.ts +63 -17
- package/src/types.ts +52 -0
package/src/cli.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import { architect } from './index.js';
|
|
17
17
|
import { ReportGenerator } from './reporter.js';
|
|
18
18
|
import { HtmlReportGenerator } from './html-reporter.js';
|
|
19
|
+
import { RefactorReportGenerator } from './refactor-reporter.js';
|
|
19
20
|
import { writeFileSync } from 'fs';
|
|
20
21
|
import { resolve, basename } from 'path';
|
|
21
22
|
|
|
@@ -48,6 +49,8 @@ Usage:
|
|
|
48
49
|
|
|
49
50
|
Commands:
|
|
50
51
|
analyze Full architecture analysis (default)
|
|
52
|
+
refactor Generate refactoring plan with actionable steps
|
|
53
|
+
agents Generate/audit .agent/ directory with AI agents
|
|
51
54
|
diagram Generate architecture diagram only
|
|
52
55
|
score Calculate quality score only
|
|
53
56
|
anti-patterns Detect anti-patterns only
|
|
@@ -85,16 +88,20 @@ async function main(): Promise<void> {
|
|
|
85
88
|
switch (options.command) {
|
|
86
89
|
case 'analyze': {
|
|
87
90
|
const report = await architect.analyze(options.path);
|
|
91
|
+
const plan = architect.refactor(report, options.path);
|
|
92
|
+
const agentSuggestion = architect.suggestAgents(report, plan, options.path);
|
|
88
93
|
const projectName = report.projectInfo.name || basename(options.path);
|
|
89
94
|
|
|
90
95
|
if (options.format === 'html') {
|
|
91
96
|
const htmlGenerator = new HtmlReportGenerator();
|
|
92
|
-
const html = htmlGenerator.generateHtml(report);
|
|
97
|
+
const html = htmlGenerator.generateHtml(report, plan, agentSuggestion);
|
|
93
98
|
const outputPath = options.output || `architect-report-${projectName}.html`;
|
|
94
99
|
writeFileSync(outputPath, html);
|
|
95
100
|
console.log(`ā
HTML report saved to: ${outputPath}`);
|
|
96
101
|
console.log(`š Score: ${report.score.overall}/100`);
|
|
97
102
|
console.log(`ā ļø Anti-patterns: ${report.antiPatterns.length}`);
|
|
103
|
+
console.log(`š§ Refactoring steps: ${plan.steps.length}`);
|
|
104
|
+
console.log(`š¤ Suggested agents: ${agentSuggestion.suggestedAgents.length}`);
|
|
98
105
|
} else if (options.format === 'markdown') {
|
|
99
106
|
const mdGenerator = new ReportGenerator();
|
|
100
107
|
const markdown = mdGenerator.generateMarkdownReport(report);
|
|
@@ -103,7 +110,7 @@ async function main(): Promise<void> {
|
|
|
103
110
|
console.log(`ā
Markdown report saved to: ${outputPath}`);
|
|
104
111
|
} else {
|
|
105
112
|
const outputPath = options.output || `architect-report-${projectName}.json`;
|
|
106
|
-
writeFileSync(outputPath, JSON.stringify(report, null, 2));
|
|
113
|
+
writeFileSync(outputPath, JSON.stringify({ report, plan, agentSuggestion }, null, 2));
|
|
107
114
|
console.log(`ā
JSON report saved to: ${outputPath}`);
|
|
108
115
|
}
|
|
109
116
|
|
|
@@ -117,6 +124,80 @@ async function main(): Promise<void> {
|
|
|
117
124
|
console.log(`āā Layering: ${report.score.breakdown.layering}`);
|
|
118
125
|
console.log(`\nš Files: ${report.projectInfo.totalFiles} | š Lines: ${report.projectInfo.totalLines.toLocaleString()}`);
|
|
119
126
|
console.log(`ā ļø Anti-patterns: ${report.antiPatterns.length}`);
|
|
127
|
+
console.log(`š¤ Agents: ${agentSuggestion.suggestedAgents.length} suggested | ${agentSuggestion.hasExistingAgents ? 'Existing .agent/ audited' : 'No .agent/ found'}`);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
case 'refactor': {
|
|
132
|
+
const report = await architect.analyze(options.path);
|
|
133
|
+
const plan = architect.refactor(report, options.path);
|
|
134
|
+
const projectName = report.projectInfo.name || basename(options.path);
|
|
135
|
+
|
|
136
|
+
if (options.format === 'json') {
|
|
137
|
+
const outputPath = options.output || `refactor-plan-${projectName}.json`;
|
|
138
|
+
writeFileSync(outputPath, JSON.stringify(plan, null, 2));
|
|
139
|
+
console.log(`ā
JSON refactoring plan saved to: ${outputPath}`);
|
|
140
|
+
} else {
|
|
141
|
+
const refactorReporter = new RefactorReportGenerator();
|
|
142
|
+
const html = refactorReporter.generateHtml(plan);
|
|
143
|
+
const outputPath = options.output || `refactor-plan-${projectName}.html`;
|
|
144
|
+
writeFileSync(outputPath, html);
|
|
145
|
+
console.log(`ā
Refactoring plan saved to: ${outputPath}`);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
console.log(`\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā`);
|
|
149
|
+
console.log(` REFACTORING PLAN`);
|
|
150
|
+
console.log(`āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā`);
|
|
151
|
+
console.log(`āā Steps: ${plan.steps.length}`);
|
|
152
|
+
console.log(`āā Operations: ${plan.totalOperations}`);
|
|
153
|
+
console.log(`āā Tier 1: ${plan.tier1Steps} (rule-based)`);
|
|
154
|
+
console.log(`āā Tier 2: ${plan.tier2Steps} (AST-based)`);
|
|
155
|
+
console.log(`āā Current: ${plan.currentScore.overall}/100`);
|
|
156
|
+
console.log(`āā Estimated: ${plan.estimatedScoreAfter.overall}/100 (+${plan.estimatedScoreAfter.overall - plan.currentScore.overall})`);
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
case 'agents': {
|
|
161
|
+
const report = await architect.analyze(options.path);
|
|
162
|
+
const plan = architect.refactor(report, options.path);
|
|
163
|
+
const outputDir = options.output || undefined;
|
|
164
|
+
const result = architect.agents(report, plan, options.path, outputDir);
|
|
165
|
+
|
|
166
|
+
console.log(`\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā`);
|
|
167
|
+
console.log(` š¤ AGENT SYSTEM`);
|
|
168
|
+
console.log(`āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā`);
|
|
169
|
+
|
|
170
|
+
if (result.generated.length > 0) {
|
|
171
|
+
console.log(`\nā
Generated ${result.generated.length} files:`);
|
|
172
|
+
for (const file of result.generated) {
|
|
173
|
+
console.log(` š ${file}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (result.audit.length > 0) {
|
|
178
|
+
const missing = result.audit.filter(f => f.type === 'MISSING');
|
|
179
|
+
const improvements = result.audit.filter(f => f.type === 'IMPROVEMENT');
|
|
180
|
+
const ok = result.audit.filter(f => f.type === 'OK');
|
|
181
|
+
|
|
182
|
+
if (ok.length > 0) {
|
|
183
|
+
console.log(`\nā
${ok.length} checks passed`);
|
|
184
|
+
}
|
|
185
|
+
if (missing.length > 0) {
|
|
186
|
+
console.log(`\nā ${missing.length} missing (auto-generated):`);
|
|
187
|
+
for (const f of missing) {
|
|
188
|
+
console.log(` š ${f.file} ā ${f.description}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (improvements.length > 0) {
|
|
192
|
+
console.log(`\nš” ${improvements.length} improvement suggestions:`);
|
|
193
|
+
for (const f of improvements) {
|
|
194
|
+
console.log(` ā” ${f.description}`);
|
|
195
|
+
if (f.suggestion) console.log(` ā ${f.suggestion}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
console.log(`\nš Score: ${report.score.overall}/100`);
|
|
120
201
|
break;
|
|
121
202
|
}
|
|
122
203
|
|