erosolar-cli 1.3.6 → 1.3.7
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/StringUtils.d.ts +8 -0
- package/dist/StringUtils.d.ts.map +1 -0
- package/dist/StringUtils.js +11 -0
- package/dist/StringUtils.js.map +1 -0
- package/dist/capabilities/index.d.ts +1 -1
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +1 -1
- package/dist/capabilities/index.js.map +1 -1
- package/dist/capabilities/skillCapability.d.ts +2 -6
- package/dist/capabilities/skillCapability.d.ts.map +1 -1
- package/dist/capabilities/skillCapability.js +70 -20
- package/dist/capabilities/skillCapability.js.map +1 -1
- package/dist/core/agent.d.ts +16 -0
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +171 -54
- package/dist/core/agent.js.map +1 -1
- package/dist/core/contextWindow.d.ts +6 -0
- package/dist/core/contextWindow.d.ts.map +1 -1
- package/dist/core/contextWindow.js +12 -4
- package/dist/core/contextWindow.js.map +1 -1
- package/dist/plugins/tools/skills/skillPlugin.js +2 -2
- package/dist/plugins/tools/skills/skillPlugin.js.map +1 -1
- package/dist/shell/interactiveShell.d.ts +19 -0
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +177 -0
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/skills/skillRepository.d.ts +99 -23
- package/dist/skills/skillRepository.d.ts.map +1 -1
- package/dist/skills/skillRepository.js +213 -329
- package/dist/skills/skillRepository.js.map +1 -1
- package/dist/tools/skillTools.d.ts.map +1 -1
- package/dist/tools/skillTools.js +24 -62
- package/dist/tools/skillTools.js.map +1 -1
- package/package.json +21 -5
- package/scripts/ai-code-reviewer.mjs +343 -0
- package/scripts/code-intelligence-enhancer.mjs +415 -0
- package/scripts/dev-productivity-booster.mjs +342 -0
- package/dist/ui/advancedPrompt.d.ts +0 -58
- package/dist/ui/advancedPrompt.d.ts.map +0 -1
- package/dist/ui/advancedPrompt.js +0 -219
- package/dist/ui/advancedPrompt.js.map +0 -1
- package/dist/ui/overlay/OverlayManager.d.ts +0 -105
- package/dist/ui/overlay/OverlayManager.d.ts.map +0 -1
- package/dist/ui/overlay/OverlayManager.js +0 -291
- package/dist/ui/overlay/OverlayManager.js.map +0 -1
package/dist/tools/skillTools.js
CHANGED
|
@@ -77,7 +77,8 @@ export function createSkillTools(options) {
|
|
|
77
77
|
return `Skill "${identifier}" not found. Run ListSkills to inspect available skills.`;
|
|
78
78
|
}
|
|
79
79
|
const sections = normalizeSections(args?.['sections']);
|
|
80
|
-
|
|
80
|
+
// Use simplified format for basic Skill type
|
|
81
|
+
const output = formatBasicSkillDetail(skill, sections);
|
|
81
82
|
return output || `Skill "${skill.name}" has no content.`;
|
|
82
83
|
},
|
|
83
84
|
},
|
|
@@ -136,81 +137,42 @@ function formatSkillSummary(skill) {
|
|
|
136
137
|
];
|
|
137
138
|
return lines.join('\n');
|
|
138
139
|
}
|
|
139
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Simplified skill detail formatter for the basic Skill type from skillRepository
|
|
142
|
+
*/
|
|
143
|
+
function formatBasicSkillDetail(skill, sections) {
|
|
140
144
|
const lines = [];
|
|
141
145
|
lines.push(`# Skill: ${skill.name}`);
|
|
142
|
-
if (skill.version) {
|
|
143
|
-
lines.push(`Version: ${skill.version}`);
|
|
144
|
-
}
|
|
145
146
|
lines.push(`ID: ${skill.id}`);
|
|
146
|
-
lines.push(`Location: ${skill.relativeLocation ?? skill.location}`);
|
|
147
147
|
lines.push('');
|
|
148
148
|
if (sections.has('metadata')) {
|
|
149
149
|
lines.push('## Metadata');
|
|
150
150
|
lines.push(`- Description: ${skill.description}`);
|
|
151
|
-
lines.push(`-
|
|
152
|
-
lines.push(`-
|
|
153
|
-
if (Object.keys(skill.frontMatter).length) {
|
|
154
|
-
for (const [key, value] of Object.entries(skill.frontMatter)) {
|
|
155
|
-
lines.push(`- ${key}: ${value}`);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
lines.push('');
|
|
159
|
-
}
|
|
160
|
-
if (sections.has('body') && skill.body) {
|
|
161
|
-
lines.push('## Skill Body');
|
|
162
|
-
lines.push(skill.body.trim());
|
|
163
|
-
lines.push('');
|
|
164
|
-
}
|
|
165
|
-
if (sections.has('references')) {
|
|
166
|
-
lines.push('## References');
|
|
167
|
-
if (skill.references.length) {
|
|
168
|
-
for (const ref of skill.references) {
|
|
169
|
-
lines.push(`- ${ref.path} (${formatBytes(ref.bytes)})`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
lines.push('- None');
|
|
174
|
-
}
|
|
151
|
+
lines.push(`- Category: ${skill.category}`);
|
|
152
|
+
lines.push(`- Tags: ${skill.tags.join(', ')}`);
|
|
175
153
|
lines.push('');
|
|
176
154
|
}
|
|
177
|
-
if (sections.has('
|
|
178
|
-
lines.push('##
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
else {
|
|
185
|
-
lines.push('- None');
|
|
155
|
+
if (sections.has('body')) {
|
|
156
|
+
lines.push('## Implementation');
|
|
157
|
+
lines.push(`Pattern: ${skill.implementation.pattern}`);
|
|
158
|
+
if (skill.implementation.template) {
|
|
159
|
+
lines.push('');
|
|
160
|
+
lines.push('Template:');
|
|
161
|
+
lines.push(skill.implementation.template);
|
|
186
162
|
}
|
|
187
163
|
lines.push('');
|
|
188
164
|
}
|
|
189
|
-
if (sections.has('
|
|
190
|
-
lines.push('##
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
165
|
+
if (sections.has('references') && skill.examples.length > 0) {
|
|
166
|
+
lines.push('## Examples');
|
|
167
|
+
for (const example of skill.examples) {
|
|
168
|
+
lines.push(`### ${example.name}`);
|
|
169
|
+
lines.push(example.description);
|
|
170
|
+
lines.push('```');
|
|
171
|
+
lines.push(example.code);
|
|
172
|
+
lines.push('```');
|
|
173
|
+
lines.push('');
|
|
195
174
|
}
|
|
196
|
-
else {
|
|
197
|
-
lines.push('- None');
|
|
198
|
-
}
|
|
199
|
-
lines.push('');
|
|
200
175
|
}
|
|
201
176
|
return lines.join('\n').trim();
|
|
202
177
|
}
|
|
203
|
-
function formatBytes(bytes) {
|
|
204
|
-
if (!Number.isFinite(bytes) || bytes <= 0) {
|
|
205
|
-
return '0 B';
|
|
206
|
-
}
|
|
207
|
-
const units = ['B', 'KB', 'MB'];
|
|
208
|
-
let value = bytes;
|
|
209
|
-
let unitIndex = 0;
|
|
210
|
-
while (value >= 1024 && unitIndex < units.length - 1) {
|
|
211
|
-
value /= 1024;
|
|
212
|
-
unitIndex += 1;
|
|
213
|
-
}
|
|
214
|
-
return `${value.toFixed(value >= 10 || unitIndex === 0 ? 0 : 1)} ${units[unitIndex]}`;
|
|
215
|
-
}
|
|
216
178
|
//# sourceMappingURL=skillTools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillTools.js","sourceRoot":"","sources":["../../src/tools/skillTools.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,gBAAgB,CAAC,OAAyB;IACxD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAEtC,OAAO;QACL;YACE,IAAI,EAAE,YAAY;YAClB,WAAW,EACT,uHAAuH;YACzH,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,yEAAyE;qBACvF;oBACD,aAAa,EAAE;wBACb,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,iEAAiE;qBAC/E;iBACF;aACF;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBACtB,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,SAAS,IAAI,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;oBAChF,UAAU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,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,IAAI,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1B,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAChC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "erosolar-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7",
|
|
4
4
|
"description": "Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning",
|
|
5
5
|
"main": "dist/bin/erosolar.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
"scripts/preinstall-clean-bins.mjs",
|
|
13
13
|
"scripts/health-check.mjs",
|
|
14
14
|
"scripts/complexity-validation.mjs",
|
|
15
|
-
"scripts/code-quality-dashboard.js"
|
|
15
|
+
"scripts/code-quality-dashboard.js",
|
|
16
|
+
"scripts/ai-code-reviewer.mjs",
|
|
17
|
+
"scripts/code-intelligence-enhancer.mjs",
|
|
18
|
+
"scripts/dev-productivity-booster.mjs"
|
|
16
19
|
],
|
|
17
20
|
"bin": {
|
|
18
21
|
"erosolar-ts": "dist/bin/erosolar.js",
|
|
@@ -29,8 +32,9 @@
|
|
|
29
32
|
"dev": "node --loader ts-node/esm src/bin/erosolar.ts",
|
|
30
33
|
"dev:watch": "node --watch --loader ts-node/esm src/bin/erosolar.ts",
|
|
31
34
|
"start": "node dist/bin/erosolar.js",
|
|
32
|
-
"test": "
|
|
33
|
-
"test:watch": "
|
|
35
|
+
"test": "jest --config jest.config.cjs",
|
|
36
|
+
"test:watch": "jest --config jest.config.cjs --watch",
|
|
37
|
+
"test:coverage": "jest --config jest.config.cjs --coverage",
|
|
34
38
|
"lint": "eslint src/**/*.ts --max-warnings 0",
|
|
35
39
|
"lint:fix": "eslint src/**/*.ts --fix",
|
|
36
40
|
"type-check": "tsc --noEmit",
|
|
@@ -38,7 +42,11 @@
|
|
|
38
42
|
"complexity-check": "node scripts/complexity-validation.mjs",
|
|
39
43
|
"complexity-check:legacy": "npm run lint && npm run type-check",
|
|
40
44
|
"quality-gate": "npm run complexity-check && npm run health-check && npm run type-check",
|
|
41
|
-
"quality-dashboard": "node scripts/code-quality-dashboard.js"
|
|
45
|
+
"quality-dashboard": "node scripts/code-quality-dashboard.js",
|
|
46
|
+
"ai-code-review": "node scripts/ai-code-reviewer.mjs",
|
|
47
|
+
"code-intelligence": "node scripts/code-intelligence-enhancer.mjs",
|
|
48
|
+
"dev-productivity": "node scripts/dev-productivity-booster.mjs",
|
|
49
|
+
"generate": "node scripts/dev-productivity-booster.mjs generate"
|
|
42
50
|
},
|
|
43
51
|
"erosolar": {
|
|
44
52
|
"rulebookSchema": "src/contracts/schemas/agent-rules.schema.json"
|
|
@@ -70,11 +78,19 @@
|
|
|
70
78
|
"node": ">=20.0.0"
|
|
71
79
|
},
|
|
72
80
|
"devDependencies": {
|
|
81
|
+
"@babel/core": "^7.28.5",
|
|
82
|
+
"@babel/preset-env": "^7.28.5",
|
|
83
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
84
|
+
"@types/glob": "^8.1.0",
|
|
73
85
|
"@types/gradient-string": "^1.1.6",
|
|
86
|
+
"@types/jest": "^29.5.0",
|
|
74
87
|
"@types/node": "^20.11.24",
|
|
75
88
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
76
89
|
"@typescript-eslint/parser": "^6.21.0",
|
|
90
|
+
"babel-jest": "^30.2.0",
|
|
77
91
|
"eslint": "^8.45.0",
|
|
92
|
+
"jest": "^29.7.0",
|
|
93
|
+
"ts-jest": "^29.1.0",
|
|
78
94
|
"ts-node": "^10.9.2"
|
|
79
95
|
},
|
|
80
96
|
"dependencies": {
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AI-Powered Code Reviewer
|
|
5
|
+
*
|
|
6
|
+
* Uses the Erosolar CLI's intelligence engine to provide
|
|
7
|
+
* automated code reviews with actionable insights.
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Automated code quality analysis
|
|
11
|
+
* - Security vulnerability detection
|
|
12
|
+
* - Performance optimization suggestions
|
|
13
|
+
* - Best practices validation
|
|
14
|
+
* - Integration with existing toolchain
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { readFileSync, existsSync } from 'fs';
|
|
18
|
+
import { join, dirname } from 'path';
|
|
19
|
+
import { fileURLToPath } from 'url';
|
|
20
|
+
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
+
const __dirname = dirname(__filename);
|
|
23
|
+
|
|
24
|
+
class AICodeReviewer {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.projectRoot = join(__dirname, '..');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async reviewFile(filePath) {
|
|
30
|
+
const fullPath = join(this.projectRoot, filePath);
|
|
31
|
+
|
|
32
|
+
if (!existsSync(fullPath)) {
|
|
33
|
+
throw new Error(`File not found: ${filePath}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const content = readFileSync(fullPath, 'utf8');
|
|
37
|
+
const analysis = await this.analyzeCode(content, filePath);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
file: filePath,
|
|
41
|
+
analysis,
|
|
42
|
+
recommendations: this.generateRecommendations(analysis)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async analyzeCode(content, filePath) {
|
|
47
|
+
// Basic code analysis
|
|
48
|
+
const lines = content.split('\n');
|
|
49
|
+
const functions = this.extractFunctions(content);
|
|
50
|
+
const imports = this.extractImports(content);
|
|
51
|
+
const complexity = this.calculateComplexity(content);
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
lines: lines.length,
|
|
55
|
+
functions: functions.length,
|
|
56
|
+
imports: imports.length,
|
|
57
|
+
complexity,
|
|
58
|
+
issues: this.detectIssues(content, filePath),
|
|
59
|
+
patterns: this.detectPatterns(content),
|
|
60
|
+
security: this.checkSecurity(content, filePath)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
extractFunctions(content) {
|
|
65
|
+
const functionRegex = /(?:function|const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*[=:]?\s*(?:\([^)]*\)\s*=>|function\s*(?:\([^)]*\))?)/g;
|
|
66
|
+
const matches = [];
|
|
67
|
+
let match;
|
|
68
|
+
|
|
69
|
+
while ((match = functionRegex.exec(content)) !== null) {
|
|
70
|
+
matches.push({
|
|
71
|
+
name: match[1],
|
|
72
|
+
line: content.substring(0, match.index).split('\n').length
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return matches;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
extractImports(content) {
|
|
80
|
+
const importRegex = /import\s+(?:{[^}]*}|[^{}\s]+)\s+from\s+['"]([^'"]+)['"]/g;
|
|
81
|
+
const matches = [];
|
|
82
|
+
let match;
|
|
83
|
+
|
|
84
|
+
while ((match = importRegex.exec(content)) !== null) {
|
|
85
|
+
matches.push(match[1]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return matches;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
calculateComplexity(content) {
|
|
92
|
+
// Simplified complexity calculation
|
|
93
|
+
const lines = content.split('\n');
|
|
94
|
+
let complexity = 0;
|
|
95
|
+
|
|
96
|
+
lines.forEach(line => {
|
|
97
|
+
const trimmed = line.trim();
|
|
98
|
+
if (trimmed.includes('if') || trimmed.includes('for') || trimmed.includes('while')) {
|
|
99
|
+
complexity += 1;
|
|
100
|
+
}
|
|
101
|
+
if (trimmed.includes('&&') || trimmed.includes('||')) {
|
|
102
|
+
complexity += 0.5;
|
|
103
|
+
}
|
|
104
|
+
if (trimmed.includes('try') || trimmed.includes('catch')) {
|
|
105
|
+
complexity += 1;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return Math.round(complexity);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
detectIssues(content, filePath) {
|
|
113
|
+
const issues = [];
|
|
114
|
+
const lines = content.split('\n');
|
|
115
|
+
|
|
116
|
+
lines.forEach((line, index) => {
|
|
117
|
+
const lineNumber = index + 1;
|
|
118
|
+
|
|
119
|
+
// Detect console.log in production code
|
|
120
|
+
if (line.includes('console.log') && !filePath.includes('test')) {
|
|
121
|
+
issues.push({
|
|
122
|
+
type: 'DEBUG_CODE',
|
|
123
|
+
severity: 'LOW',
|
|
124
|
+
line: lineNumber,
|
|
125
|
+
message: 'Console.log found in non-test file',
|
|
126
|
+
suggestion: 'Remove or use proper logging framework'
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Detect long functions
|
|
131
|
+
if (line.includes('function') && line.length > 100) {
|
|
132
|
+
issues.push({
|
|
133
|
+
type: 'LONG_FUNCTION',
|
|
134
|
+
severity: 'MEDIUM',
|
|
135
|
+
line: lineNumber,
|
|
136
|
+
message: 'Function declaration exceeds 100 characters',
|
|
137
|
+
suggestion: 'Break into smaller functions'
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Detect magic numbers
|
|
142
|
+
const magicNumberRegex = /\b(?:\d{3,}|0x[0-9a-fA-F]+)\b/g;
|
|
143
|
+
let match;
|
|
144
|
+
while ((match = magicNumberRegex.exec(line)) !== null) {
|
|
145
|
+
if (!match[0].match(/^(?:0|1|100|1000)$/)) {
|
|
146
|
+
issues.push({
|
|
147
|
+
type: 'MAGIC_NUMBER',
|
|
148
|
+
severity: 'LOW',
|
|
149
|
+
line: lineNumber,
|
|
150
|
+
message: `Magic number detected: ${match[0]}`,
|
|
151
|
+
suggestion: 'Extract to named constant'
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
return issues;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
detectPatterns(content) {
|
|
161
|
+
const patterns = [];
|
|
162
|
+
|
|
163
|
+
// Check for async/await patterns
|
|
164
|
+
if (content.includes('async') && content.includes('await')) {
|
|
165
|
+
patterns.push({
|
|
166
|
+
name: 'ASYNC_AWAIT',
|
|
167
|
+
quality: 'GOOD',
|
|
168
|
+
description: 'Uses modern async/await syntax'
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Check for TypeScript features
|
|
173
|
+
if (content.includes('interface') || content.includes('type ')) {
|
|
174
|
+
patterns.push({
|
|
175
|
+
name: 'TYPESCRIPT_TYPES',
|
|
176
|
+
quality: 'GOOD',
|
|
177
|
+
description: 'Uses TypeScript type definitions'
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Check for error handling
|
|
182
|
+
if (content.includes('try') && content.includes('catch')) {
|
|
183
|
+
patterns.push({
|
|
184
|
+
name: 'ERROR_HANDLING',
|
|
185
|
+
quality: 'GOOD',
|
|
186
|
+
description: 'Includes proper error handling'
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return patterns;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
checkSecurity(content, filePath) {
|
|
194
|
+
const securityIssues = [];
|
|
195
|
+
const lines = content.split('\n');
|
|
196
|
+
|
|
197
|
+
lines.forEach((line, index) => {
|
|
198
|
+
const lineNumber = index + 1;
|
|
199
|
+
|
|
200
|
+
// Check for potential security issues
|
|
201
|
+
if (line.includes('eval(') || line.includes('Function(')) {
|
|
202
|
+
securityIssues.push({
|
|
203
|
+
type: 'DYNAMIC_CODE_EXECUTION',
|
|
204
|
+
severity: 'HIGH',
|
|
205
|
+
line: lineNumber,
|
|
206
|
+
message: 'Dynamic code execution detected',
|
|
207
|
+
suggestion: 'Avoid eval() and Function() constructors'
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (line.includes('process.env') && !line.includes('require')) {
|
|
212
|
+
securityIssues.push({
|
|
213
|
+
type: 'ENV_VAR_USAGE',
|
|
214
|
+
severity: 'INFO',
|
|
215
|
+
line: lineNumber,
|
|
216
|
+
message: 'Environment variable usage',
|
|
217
|
+
suggestion: 'Ensure proper validation of env vars'
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
return securityIssues;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
generateRecommendations(analysis) {
|
|
226
|
+
const recommendations = [];
|
|
227
|
+
|
|
228
|
+
if (analysis.complexity > 20) {
|
|
229
|
+
recommendations.push({
|
|
230
|
+
priority: 'HIGH',
|
|
231
|
+
title: 'Reduce code complexity',
|
|
232
|
+
description: `File has complexity score of ${analysis.complexity}, consider refactoring`,
|
|
233
|
+
action: 'Break down complex functions into smaller ones'
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (analysis.issues.some(issue => issue.severity === 'HIGH')) {
|
|
238
|
+
recommendations.push({
|
|
239
|
+
priority: 'HIGH',
|
|
240
|
+
title: 'Address critical issues',
|
|
241
|
+
description: 'Critical issues detected that need immediate attention',
|
|
242
|
+
action: 'Review and fix high-severity issues'
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (analysis.security.length > 0) {
|
|
247
|
+
recommendations.push({
|
|
248
|
+
priority: 'MEDIUM',
|
|
249
|
+
title: 'Review security concerns',
|
|
250
|
+
description: 'Potential security issues identified',
|
|
251
|
+
action: 'Validate security-related code patterns'
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (analysis.lines > 500) {
|
|
256
|
+
recommendations.push({
|
|
257
|
+
priority: 'MEDIUM',
|
|
258
|
+
title: 'Consider file splitting',
|
|
259
|
+
description: `File is ${analysis.lines} lines long`,
|
|
260
|
+
action: 'Split into smaller, focused modules'
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return recommendations;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
formatReview(review) {
|
|
268
|
+
const output = [];
|
|
269
|
+
|
|
270
|
+
output.push('╔══════════════════════════════════════════════════════════════════════════════╗');
|
|
271
|
+
output.push('║ AI CODE REVIEW REPORT ║');
|
|
272
|
+
output.push('╚══════════════════════════════════════════════════════════════════════════════╝\n');
|
|
273
|
+
|
|
274
|
+
output.push(`📄 FILE: ${review.file}`);
|
|
275
|
+
output.push('─'.repeat(60));
|
|
276
|
+
output.push(`📊 Metrics:`);
|
|
277
|
+
output.push(` • Lines: ${review.analysis.lines}`);
|
|
278
|
+
output.push(` • Functions: ${review.analysis.functions}`);
|
|
279
|
+
output.push(` • Imports: ${review.analysis.imports}`);
|
|
280
|
+
output.push(` • Complexity: ${review.analysis.complexity}`);
|
|
281
|
+
output.push('');
|
|
282
|
+
|
|
283
|
+
if (review.analysis.issues.length > 0) {
|
|
284
|
+
output.push('⚠️ Issues:');
|
|
285
|
+
review.analysis.issues.forEach(issue => {
|
|
286
|
+
const icon = issue.severity === 'HIGH' ? '🔴' : issue.severity === 'MEDIUM' ? '🟡' : '🔵';
|
|
287
|
+
output.push(` ${icon} [${issue.type}] Line ${issue.line}: ${issue.message}`);
|
|
288
|
+
output.push(` → ${issue.suggestion}`);
|
|
289
|
+
});
|
|
290
|
+
output.push('');
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (review.analysis.patterns.length > 0) {
|
|
294
|
+
output.push('✅ Good Patterns:');
|
|
295
|
+
review.analysis.patterns.forEach(pattern => {
|
|
296
|
+
output.push(` ✓ ${pattern.name}: ${pattern.description}`);
|
|
297
|
+
});
|
|
298
|
+
output.push('');
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (review.recommendations.length > 0) {
|
|
302
|
+
output.push('🎯 Recommendations:');
|
|
303
|
+
review.recommendations.forEach(rec => {
|
|
304
|
+
const priorityIcon = rec.priority === 'HIGH' ? '🔥' : '📌';
|
|
305
|
+
output.push(` ${priorityIcon} ${rec.title}`);
|
|
306
|
+
output.push(` ${rec.description}`);
|
|
307
|
+
output.push(` Action: ${rec.action}`);
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
output.push('\n' + '═'.repeat(60));
|
|
312
|
+
|
|
313
|
+
return output.join('\n');
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// CLI interface
|
|
318
|
+
async function main() {
|
|
319
|
+
const args = process.argv.slice(2);
|
|
320
|
+
|
|
321
|
+
if (args.length === 0) {
|
|
322
|
+
console.log('Usage: node scripts/ai-code-reviewer.mjs <file-path>');
|
|
323
|
+
console.log('Example: node scripts/ai-code-reviewer.mjs src/core/agent.ts');
|
|
324
|
+
process.exit(1);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const reviewer = new AICodeReviewer();
|
|
328
|
+
|
|
329
|
+
try {
|
|
330
|
+
const review = await reviewer.reviewFile(args[0]);
|
|
331
|
+
console.log(reviewer.formatReview(review));
|
|
332
|
+
} catch (error) {
|
|
333
|
+
console.error('❌ Error:', error.message);
|
|
334
|
+
process.exit(1);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Run if called directly
|
|
339
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
340
|
+
main();
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export { AICodeReviewer };
|