@thynameisjayvee/alpha-cli 0.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/LICENSE +21 -0
- package/README.md +143 -0
- package/bin/alpha.js +15 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +125 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/alpha.d.ts +64 -0
- package/dist/core/alpha.d.ts.map +1 -0
- package/dist/core/alpha.js +94 -0
- package/dist/core/alpha.js.map +1 -0
- package/dist/core/generator/index.d.ts +16 -0
- package/dist/core/generator/index.d.ts.map +1 -0
- package/dist/core/generator/index.js +231 -0
- package/dist/core/generator/index.js.map +1 -0
- package/dist/core/implementation/index.d.ts +22 -0
- package/dist/core/implementation/index.d.ts.map +1 -0
- package/dist/core/implementation/index.js +398 -0
- package/dist/core/implementation/index.js.map +1 -0
- package/dist/core/init/catalog.d.ts +23 -0
- package/dist/core/init/catalog.d.ts.map +1 -0
- package/dist/core/init/catalog.js +87 -0
- package/dist/core/init/catalog.js.map +1 -0
- package/dist/core/init/index.d.ts +10 -0
- package/dist/core/init/index.d.ts.map +1 -0
- package/dist/core/init/index.js +214 -0
- package/dist/core/init/index.js.map +1 -0
- package/dist/core/requirements/index.d.ts +10 -0
- package/dist/core/requirements/index.d.ts.map +1 -0
- package/dist/core/requirements/index.js +232 -0
- package/dist/core/requirements/index.js.map +1 -0
- package/dist/core/reviewer/index.d.ts +29 -0
- package/dist/core/reviewer/index.d.ts.map +1 -0
- package/dist/core/reviewer/index.js +419 -0
- package/dist/core/reviewer/index.js.map +1 -0
- package/dist/core/stack/index.d.ts +10 -0
- package/dist/core/stack/index.d.ts.map +1 -0
- package/dist/core/stack/index.js +243 -0
- package/dist/core/stack/index.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +128 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/config.d.ts +105 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +99 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/file-system.d.ts +17 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +48 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils/input.d.ts +18 -0
- package/dist/utils/input.d.ts.map +1 -0
- package/dist/utils/input.js +50 -0
- package/dist/utils/input.js.map +1 -0
- package/dist/utils/logger.d.ts +37 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +109 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/paths.d.ts +26 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +51 -0
- package/dist/utils/paths.js.map +1 -0
- package/package.json +79 -0
- package/scripts/postinstall.js +110 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code Review Module
|
|
3
|
+
*
|
|
4
|
+
* Performs static code analysis using TypeScript AST to identify:
|
|
5
|
+
* - Unused variables and imports
|
|
6
|
+
* - Missing type annotations
|
|
7
|
+
* - Console debug statements left in code
|
|
8
|
+
* - Common code quality issues
|
|
9
|
+
*/
|
|
10
|
+
import { ReviewReport, ReviewFinding } from '../../types/index.js';
|
|
11
|
+
export interface ReviewOptions {
|
|
12
|
+
/** Glob root to analyze (defaults to the current working directory). */
|
|
13
|
+
target?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Run deterministic static code review on the project. No LLM or agent is
|
|
17
|
+
* involved: this is a TypeScript-AST pass that the calling LLM consumes.
|
|
18
|
+
* The report is persisted to `.alpha/reports/` for `alpha implement`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function runReview(options?: ReviewOptions): Promise<ReviewReport>;
|
|
21
|
+
/**
|
|
22
|
+
* Generate review report from findings
|
|
23
|
+
*/
|
|
24
|
+
export declare function generateReport(target: string, findings: ReviewFinding[]): ReviewReport;
|
|
25
|
+
/**
|
|
26
|
+
* Render the report to markdown in the exact shape `alpha implement` parses.
|
|
27
|
+
*/
|
|
28
|
+
export declare function renderReportMarkdown(report: ReviewReport): string;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/reviewer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AASnE,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAqDvB;AA2TD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,aAAa,EAAE,GACxB,YAAY,CAmBd;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAmDjE"}
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code Review Module
|
|
3
|
+
*
|
|
4
|
+
* Performs static code analysis using TypeScript AST to identify:
|
|
5
|
+
* - Unused variables and imports
|
|
6
|
+
* - Missing type annotations
|
|
7
|
+
* - Console debug statements left in code
|
|
8
|
+
* - Common code quality issues
|
|
9
|
+
*/
|
|
10
|
+
import { logger, emit } from '../../utils/logger.js';
|
|
11
|
+
import { ensureDir, writeFile } from '../../utils/file-system.js';
|
|
12
|
+
import { getReportsDir } from '../../utils/paths.js';
|
|
13
|
+
import * as ts from 'typescript';
|
|
14
|
+
import { glob } from 'glob';
|
|
15
|
+
import * as path from 'path';
|
|
16
|
+
import * as fs from 'fs/promises';
|
|
17
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
18
|
+
/**
|
|
19
|
+
* Run deterministic static code review on the project. No LLM or agent is
|
|
20
|
+
* involved: this is a TypeScript-AST pass that the calling LLM consumes.
|
|
21
|
+
* The report is persisted to `.alpha/reports/` for `alpha implement`.
|
|
22
|
+
*/
|
|
23
|
+
export async function runReview(options = {}) {
|
|
24
|
+
logger.section('Code Review');
|
|
25
|
+
logger.info('Analyzing codebase...');
|
|
26
|
+
const target = options.target
|
|
27
|
+
? path.resolve(process.cwd(), options.target)
|
|
28
|
+
: process.cwd();
|
|
29
|
+
const findings = [];
|
|
30
|
+
try {
|
|
31
|
+
const files = await glob('**/*.{ts,tsx,js,jsx}', {
|
|
32
|
+
cwd: target,
|
|
33
|
+
ignore: [
|
|
34
|
+
'node_modules/**',
|
|
35
|
+
'dist/**',
|
|
36
|
+
'build/**',
|
|
37
|
+
'.git/**',
|
|
38
|
+
'.alpha/**',
|
|
39
|
+
'*.d.ts',
|
|
40
|
+
'*.min.js',
|
|
41
|
+
],
|
|
42
|
+
});
|
|
43
|
+
logger.info(`Found ${files.length} files to analyze`);
|
|
44
|
+
for (const file of files) {
|
|
45
|
+
const filePath = path.join(target, file);
|
|
46
|
+
const fileFindings = await analyzeFile(filePath, file);
|
|
47
|
+
findings.push(...fileFindings);
|
|
48
|
+
}
|
|
49
|
+
const report = generateReport(options.target || 'codebase', findings);
|
|
50
|
+
const reportPath = await saveReport(report);
|
|
51
|
+
logger.success(`Review complete: ${findings.length} finding(s) identified`);
|
|
52
|
+
emit('review', { ...report, path: reportPath }, renderReportMarkdown(report));
|
|
53
|
+
return report;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
logger.error(`Review failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Analyze a single file using TypeScript AST
|
|
62
|
+
*/
|
|
63
|
+
async function analyzeFile(filePath, relativePath) {
|
|
64
|
+
const findings = [];
|
|
65
|
+
try {
|
|
66
|
+
const sourceCode = await fs.readFile(filePath, 'utf-8');
|
|
67
|
+
const sourceFile = ts.createSourceFile(filePath, sourceCode, ts.ScriptTarget.Latest, true);
|
|
68
|
+
// Find unused variables
|
|
69
|
+
const unusedVars = findUnusedVariables(sourceFile, relativePath);
|
|
70
|
+
findings.push(...unusedVars);
|
|
71
|
+
// Find missing type annotations
|
|
72
|
+
const missingTypes = findMissingTypes(sourceFile, relativePath);
|
|
73
|
+
findings.push(...missingTypes);
|
|
74
|
+
// Find console.debug statements
|
|
75
|
+
const consoleDebugs = findConsoleDebugStatements(sourceFile, relativePath);
|
|
76
|
+
findings.push(...consoleDebugs);
|
|
77
|
+
// Find unused imports
|
|
78
|
+
const unusedImports = findUnusedImports(sourceFile, relativePath, sourceCode);
|
|
79
|
+
findings.push(...unusedImports);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
// Skip files that can't be parsed
|
|
83
|
+
logger.warn(`Skipping ${relativePath}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
84
|
+
}
|
|
85
|
+
return findings;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Find unused variables in the AST
|
|
89
|
+
*/
|
|
90
|
+
function findUnusedVariables(sourceFile, filePath) {
|
|
91
|
+
const findings = [];
|
|
92
|
+
const symbolTable = new Map();
|
|
93
|
+
// First pass: collect all variable declarations
|
|
94
|
+
function collectDeclarations(node) {
|
|
95
|
+
if (ts.isVariableDeclaration(node) || ts.isParameter(node)) {
|
|
96
|
+
const nameNode = ts.isVariableDeclaration(node) ? node.name : node.name;
|
|
97
|
+
if (ts.isIdentifier(nameNode)) {
|
|
98
|
+
const name = nameNode.text;
|
|
99
|
+
// Skip underscore-prefixed variables (intentionally unused)
|
|
100
|
+
if (!name.startsWith('_')) {
|
|
101
|
+
symbolTable.set(name, { node: nameNode, references: 0 });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
ts.forEachChild(node, collectDeclarations);
|
|
106
|
+
}
|
|
107
|
+
// Second pass: count references
|
|
108
|
+
function countReferences(node) {
|
|
109
|
+
if (ts.isIdentifier(node)) {
|
|
110
|
+
const name = node.text;
|
|
111
|
+
const entry = symbolTable.get(name);
|
|
112
|
+
if (entry && node !== entry.node) {
|
|
113
|
+
entry.references++;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
ts.forEachChild(node, countReferences);
|
|
117
|
+
}
|
|
118
|
+
collectDeclarations(sourceFile);
|
|
119
|
+
countReferences(sourceFile);
|
|
120
|
+
// Report unused variables
|
|
121
|
+
for (const [name, entry] of symbolTable.entries()) {
|
|
122
|
+
if (entry.references === 0) {
|
|
123
|
+
const position = sourceFile.getLineAndCharacterOfPosition(entry.node.getStart());
|
|
124
|
+
findings.push({
|
|
125
|
+
id: `unused-var-${filePath}-${name}`,
|
|
126
|
+
title: `Unused variable: ${name}`,
|
|
127
|
+
description: `Variable '${name}' is declared but never used. Remove it to avoid confusion and reduce bundle size.`,
|
|
128
|
+
severity: 'medium',
|
|
129
|
+
location: {
|
|
130
|
+
file: filePath,
|
|
131
|
+
line: position.line + 1,
|
|
132
|
+
},
|
|
133
|
+
dependencies: [],
|
|
134
|
+
recommendationOptions: [
|
|
135
|
+
{
|
|
136
|
+
id: 'opt-remove',
|
|
137
|
+
title: 'Remove unused variable',
|
|
138
|
+
description: `Delete the declaration of '${name}'`,
|
|
139
|
+
implementationSteps: [`Remove the line declaring variable ${name}`],
|
|
140
|
+
estimatedEffort: 'low',
|
|
141
|
+
risks: [],
|
|
142
|
+
recommended: true,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return findings;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Find missing type annotations on function parameters and variables
|
|
152
|
+
*/
|
|
153
|
+
function findMissingTypes(sourceFile, filePath) {
|
|
154
|
+
const findings = [];
|
|
155
|
+
function checkNode(node) {
|
|
156
|
+
// Check function parameters
|
|
157
|
+
if (ts.isParameter(node) && !node.type) {
|
|
158
|
+
const nameNode = node.name;
|
|
159
|
+
if (ts.isIdentifier(nameNode) && !nameNode.text.startsWith('_')) {
|
|
160
|
+
const position = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
161
|
+
findings.push({
|
|
162
|
+
id: `missing-type-${filePath}-${position.line}-${nameNode.text}`,
|
|
163
|
+
title: `Missing type annotation for parameter: ${nameNode.text}`,
|
|
164
|
+
description: `Parameter '${nameNode.text}' lacks explicit type annotation. Add a type for better type safety and documentation.`,
|
|
165
|
+
severity: 'low',
|
|
166
|
+
location: {
|
|
167
|
+
file: filePath,
|
|
168
|
+
line: position.line + 1,
|
|
169
|
+
},
|
|
170
|
+
dependencies: [],
|
|
171
|
+
recommendationOptions: [
|
|
172
|
+
{
|
|
173
|
+
id: 'opt-add-type',
|
|
174
|
+
title: 'Add type annotation',
|
|
175
|
+
description: `Add explicit type annotation to parameter '${nameNode.text}'`,
|
|
176
|
+
implementationSteps: [`Add type annotation: ${nameNode.text}: Type`],
|
|
177
|
+
estimatedEffort: 'low',
|
|
178
|
+
risks: [],
|
|
179
|
+
recommended: true,
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Check variable declarations without type inference
|
|
186
|
+
if (ts.isVariableDeclaration(node) && !node.type) {
|
|
187
|
+
const nameNode = node.name;
|
|
188
|
+
if (ts.isIdentifier(nameNode) && !nameNode.text.startsWith('_')) {
|
|
189
|
+
// Only report if initializer is missing or is 'any'
|
|
190
|
+
if (!node.initializer) {
|
|
191
|
+
const position = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
192
|
+
findings.push({
|
|
193
|
+
id: `missing-type-var-${filePath}-${position.line}-${nameNode.text}`,
|
|
194
|
+
title: `Missing type annotation for variable: ${nameNode.text}`,
|
|
195
|
+
description: `Variable '${nameNode.text}' lacks explicit type annotation and initializer. TypeScript cannot infer the type.`,
|
|
196
|
+
severity: 'low',
|
|
197
|
+
location: {
|
|
198
|
+
file: filePath,
|
|
199
|
+
line: position.line + 1,
|
|
200
|
+
},
|
|
201
|
+
dependencies: [],
|
|
202
|
+
recommendationOptions: [
|
|
203
|
+
{
|
|
204
|
+
id: 'opt-add-type-var',
|
|
205
|
+
title: 'Add type annotation',
|
|
206
|
+
description: `Add explicit type annotation to variable '${nameNode.text}'`,
|
|
207
|
+
implementationSteps: [`Add type annotation: const ${nameNode.text}: Type = ...`],
|
|
208
|
+
estimatedEffort: 'low',
|
|
209
|
+
risks: [],
|
|
210
|
+
recommended: true,
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
ts.forEachChild(node, checkNode);
|
|
218
|
+
}
|
|
219
|
+
checkNode(sourceFile);
|
|
220
|
+
return findings;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Find console.log/debug statements left in code
|
|
224
|
+
*/
|
|
225
|
+
function findConsoleDebugStatements(sourceFile, filePath) {
|
|
226
|
+
const findings = [];
|
|
227
|
+
function checkNode(node) {
|
|
228
|
+
if (ts.isCallExpression(node)) {
|
|
229
|
+
const expr = node.expression;
|
|
230
|
+
if (ts.isPropertyAccessExpression(expr)) {
|
|
231
|
+
if (ts.isIdentifier(expr.expression) && expr.expression.text === 'console') {
|
|
232
|
+
const methodName = expr.name.text;
|
|
233
|
+
if (['log', 'debug', 'info', 'warn', 'error'].includes(methodName)) {
|
|
234
|
+
const position = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
235
|
+
findings.push({
|
|
236
|
+
id: `console-${methodName}-${filePath}-${position.line}`,
|
|
237
|
+
title: `Console.${methodName} statement found`,
|
|
238
|
+
description: `Console.${methodName}() call detected. Remove debug statements before production deployment.`,
|
|
239
|
+
severity: methodName === 'error' || methodName === 'warn' ? 'medium' : 'low',
|
|
240
|
+
location: {
|
|
241
|
+
file: filePath,
|
|
242
|
+
line: position.line + 1,
|
|
243
|
+
},
|
|
244
|
+
dependencies: [],
|
|
245
|
+
recommendationOptions: [
|
|
246
|
+
{
|
|
247
|
+
id: 'opt-remove-console',
|
|
248
|
+
title: 'Remove console statement',
|
|
249
|
+
description: `Remove the console.${methodName}() call`,
|
|
250
|
+
implementationSteps: [`Delete or comment out the console.${methodName}() line`],
|
|
251
|
+
estimatedEffort: 'low',
|
|
252
|
+
risks: [],
|
|
253
|
+
recommended: true,
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: 'opt-use-logger',
|
|
257
|
+
title: 'Replace with proper logging',
|
|
258
|
+
description: 'Replace console call with a structured logging solution',
|
|
259
|
+
implementationSteps: ['Import logger utility', 'Replace console call with logger method'],
|
|
260
|
+
estimatedEffort: 'medium',
|
|
261
|
+
risks: ['Requires logger setup'],
|
|
262
|
+
recommended: false,
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
ts.forEachChild(node, checkNode);
|
|
271
|
+
}
|
|
272
|
+
checkNode(sourceFile);
|
|
273
|
+
return findings;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Find unused imports
|
|
277
|
+
*/
|
|
278
|
+
function findUnusedImports(sourceFile, filePath, sourceCode) {
|
|
279
|
+
const findings = [];
|
|
280
|
+
const imports = new Map();
|
|
281
|
+
// Collect all imports
|
|
282
|
+
function collectImports(node) {
|
|
283
|
+
if (ts.isImportDeclaration(node) && node.importClause) {
|
|
284
|
+
const clause = node.importClause;
|
|
285
|
+
// Default import
|
|
286
|
+
if (clause.name) {
|
|
287
|
+
imports.set(clause.name.text, { node: clause.name, text: clause.name.text });
|
|
288
|
+
}
|
|
289
|
+
// Named imports
|
|
290
|
+
if (clause.namedBindings) {
|
|
291
|
+
if (ts.isNamedImports(clause.namedBindings)) {
|
|
292
|
+
for (const specifier of clause.namedBindings.elements) {
|
|
293
|
+
const name = specifier.propertyName ? specifier.propertyName.text : specifier.name.text;
|
|
294
|
+
imports.set(name, { node: specifier, text: name });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
ts.forEachChild(node, collectImports);
|
|
300
|
+
}
|
|
301
|
+
collectImports(sourceFile);
|
|
302
|
+
// Check if imports are used (simple string-based check)
|
|
303
|
+
for (const [name, entry] of imports.entries()) {
|
|
304
|
+
if (!name.startsWith('_')) {
|
|
305
|
+
// Count occurrences (excluding the import line itself)
|
|
306
|
+
const importPattern = new RegExp(`\\b${name}\\b`, 'g');
|
|
307
|
+
const matches = sourceCode.match(importPattern);
|
|
308
|
+
const count = matches ? matches.length : 0;
|
|
309
|
+
// If only appears once (in import), it's unused
|
|
310
|
+
if (count <= 1) {
|
|
311
|
+
const position = sourceFile.getLineAndCharacterOfPosition(entry.node.getStart());
|
|
312
|
+
findings.push({
|
|
313
|
+
id: `unused-import-${filePath}-${name}`,
|
|
314
|
+
title: `Unused import: ${name}`,
|
|
315
|
+
description: `Import '${name}' is not used anywhere in the file. Remove it to reduce bundle size.`,
|
|
316
|
+
severity: 'low',
|
|
317
|
+
location: {
|
|
318
|
+
file: filePath,
|
|
319
|
+
line: position.line + 1,
|
|
320
|
+
},
|
|
321
|
+
dependencies: [],
|
|
322
|
+
recommendationOptions: [
|
|
323
|
+
{
|
|
324
|
+
id: 'opt-remove-import',
|
|
325
|
+
title: 'Remove unused import',
|
|
326
|
+
description: `Remove '${name}' from the import statement`,
|
|
327
|
+
implementationSteps: [`Delete ${name} from the import declaration`],
|
|
328
|
+
estimatedEffort: 'low',
|
|
329
|
+
risks: [],
|
|
330
|
+
recommended: true,
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return findings;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Generate review report from findings
|
|
341
|
+
*/
|
|
342
|
+
export function generateReport(target, findings) {
|
|
343
|
+
const summary = {
|
|
344
|
+
totalFindings: findings.length,
|
|
345
|
+
critical: findings.filter((f) => f.severity === 'critical').length,
|
|
346
|
+
high: findings.filter((f) => f.severity === 'high').length,
|
|
347
|
+
medium: findings.filter((f) => f.severity === 'medium').length,
|
|
348
|
+
low: findings.filter((f) => f.severity === 'low').length,
|
|
349
|
+
info: findings.filter((f) => f.severity === 'info').length,
|
|
350
|
+
};
|
|
351
|
+
return {
|
|
352
|
+
id: uuidv4(),
|
|
353
|
+
title: 'Code Review',
|
|
354
|
+
reviewTarget: target,
|
|
355
|
+
findings,
|
|
356
|
+
summary,
|
|
357
|
+
createdAt: new Date().toISOString(),
|
|
358
|
+
status: 'ready-for-implementation',
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Render the report to markdown in the exact shape `alpha implement` parses.
|
|
363
|
+
*/
|
|
364
|
+
export function renderReportMarkdown(report) {
|
|
365
|
+
const lines = [
|
|
366
|
+
`# ${report.title}`,
|
|
367
|
+
``,
|
|
368
|
+
`Report ID: ${report.id}`,
|
|
369
|
+
`Target: ${report.reviewTarget}`,
|
|
370
|
+
`Created: ${report.createdAt}`,
|
|
371
|
+
``,
|
|
372
|
+
`## Summary`,
|
|
373
|
+
``,
|
|
374
|
+
`- Total: ${report.summary.totalFindings}`,
|
|
375
|
+
`- Critical: ${report.summary.critical}`,
|
|
376
|
+
`- High: ${report.summary.high}`,
|
|
377
|
+
`- Medium: ${report.summary.medium}`,
|
|
378
|
+
`- Low: ${report.summary.low}`,
|
|
379
|
+
`- Info: ${report.summary.info}`,
|
|
380
|
+
``,
|
|
381
|
+
`## Findings`,
|
|
382
|
+
``,
|
|
383
|
+
];
|
|
384
|
+
report.findings.forEach((finding, idx) => {
|
|
385
|
+
const num = String(idx + 1).padStart(3, '0');
|
|
386
|
+
lines.push(`### Finding F-${num}: ${finding.title}`, ``);
|
|
387
|
+
lines.push(`**Severity:** ${finding.severity}`, ``);
|
|
388
|
+
if (finding.location?.file) {
|
|
389
|
+
const loc = finding.location.line
|
|
390
|
+
? `${finding.location.file}:${finding.location.line}`
|
|
391
|
+
: finding.location.file;
|
|
392
|
+
lines.push(`**Location:** \`${loc}\``, ``);
|
|
393
|
+
}
|
|
394
|
+
if (finding.description) {
|
|
395
|
+
lines.push(finding.description.trim(), ``);
|
|
396
|
+
}
|
|
397
|
+
if (finding.recommendationOptions.length > 0) {
|
|
398
|
+
lines.push(`#### Options`, ``);
|
|
399
|
+
finding.recommendationOptions.forEach((opt, optIdx) => {
|
|
400
|
+
const star = opt.recommended ? ' ⭐ (recommended)' : '';
|
|
401
|
+
lines.push(`${optIdx + 1}. **${opt.title}**${star} - **Estimated Effort:** ${opt.estimatedEffort}`);
|
|
402
|
+
for (const step of opt.implementationSteps) {
|
|
403
|
+
lines.push(` - ${step}`);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
lines.push(``);
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
return lines.join('\n');
|
|
410
|
+
}
|
|
411
|
+
async function saveReport(report) {
|
|
412
|
+
const reportsDir = getReportsDir();
|
|
413
|
+
await ensureDir(reportsDir);
|
|
414
|
+
const reportPath = path.join(reportsDir, `${report.id}.md`);
|
|
415
|
+
await writeFile(reportPath, renderReportMarkdown(report));
|
|
416
|
+
logger.info(`Report saved to ${reportPath}`);
|
|
417
|
+
return reportPath;
|
|
418
|
+
}
|
|
419
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/reviewer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,I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,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;gBACpD,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvD,KAAK,CAAC,IAAI,CACR,GAAG,MAAM,GAAG,CAAC,OAAO,GAAG,CAAC,KAAK,KAAK,IAAI,4BAA4B,GAAG,CAAC,eAAe,EAAE,CACxF,CAAC;gBACF,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,mBAAmB,EAAE,CAAC;oBAC3C,KAAK,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,MAAoB;IAC5C,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,SAAS,CAAC,UAAU,CAAC,CAAC;IAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;IAC5D,MAAM,SAAS,CAAC,UAAU,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1D,MAAM,CAAC,IAAI,CAAC,mBAAmB,UAAU,EAAE,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StackRecommendation } from '../../types/index.js';
|
|
3
|
+
export interface StackOptions {
|
|
4
|
+
/** Run the human-facing interactive selection (inquirer). */
|
|
5
|
+
interactive?: boolean;
|
|
6
|
+
/** Path to a JSON stack/decision file (otherwise stdin is used). */
|
|
7
|
+
input?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function adviseStack(options?: StackOptions): Promise<StackRecommendation | null>;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/stack/index.ts"],"names":[],"mappings":";AAMA,OAAO,EAGL,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAoH9B,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA4JD,wBAAsB,WAAW,CAC/B,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAiCrC"}
|