erosolar-cli 1.7.55 → 1.7.57
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/shell/unifiedInputProcessor.d.ts +15 -12
- package/dist/shell/unifiedInputProcessor.d.ts.map +1 -1
- package/dist/shell/unifiedInputProcessor.js +45 -72
- package/dist/shell/unifiedInputProcessor.js.map +1 -1
- package/package.json +4 -4
- package/dist/active-stack-security.d.ts +0 -110
- package/dist/active-stack-security.js +0 -313
- package/dist/active-stack-security.js.map +0 -1
- package/dist/advanced-targeting.d.ts +0 -113
- package/dist/advanced-targeting.js +0 -252
- package/dist/advanced-targeting.js.map +0 -1
- package/dist/bin/adapters/node/index.js +0 -33
- package/dist/bin/adapters/types.js +0 -1
- package/dist/bin/alpha-zero/agentWrapper.js +0 -165
- package/dist/bin/alpha-zero/codeEvaluator.js +0 -272
- package/dist/bin/alpha-zero/competitiveRunner.js +0 -219
- package/dist/bin/alpha-zero/index.js +0 -98
- package/dist/bin/alpha-zero/introspection.js +0 -298
- package/dist/bin/alpha-zero/metricsTracker.js +0 -207
- package/dist/bin/alpha-zero/security/core.js +0 -269
- package/dist/bin/alpha-zero/security/google.js +0 -308
- package/dist/bin/alpha-zero/security/googleLoader.js +0 -40
- package/dist/bin/alpha-zero/security/index.js +0 -31
- package/dist/bin/alpha-zero/security/simulation.js +0 -274
- package/dist/bin/alpha-zero/selfModification.js +0 -231
- package/dist/bin/alpha-zero/types.js +0 -30
- package/dist/bin/bin/erosolar-optimized.js +0 -205
- package/dist/bin/capabilities/agentSpawningCapability.js +0 -116
- package/dist/bin/capabilities/bashCapability.js +0 -22
- package/dist/bin/capabilities/cloudCapability.js +0 -36
- package/dist/bin/capabilities/codeAnalysisCapability.js +0 -22
- package/dist/bin/capabilities/codeQualityCapability.js +0 -23
- package/dist/bin/capabilities/dependencySecurityCapability.js +0 -22
- package/dist/bin/capabilities/devCapability.js +0 -22
- package/dist/bin/capabilities/editCapability.js +0 -28
- package/dist/bin/capabilities/emailCapability.js +0 -20
- package/dist/bin/capabilities/enhancedGitCapability.js +0 -221
- package/dist/bin/capabilities/filesystemCapability.js +0 -22
- package/dist/bin/capabilities/globCapability.js +0 -28
- package/dist/bin/capabilities/interactionCapability.js +0 -20
- package/dist/bin/capabilities/learnCapability.js +0 -22
- package/dist/bin/capabilities/mcpCapability.js +0 -20
- package/dist/bin/capabilities/notebookCapability.js +0 -28
- package/dist/bin/capabilities/planningCapability.js +0 -27
- package/dist/bin/capabilities/refactoringCapability.js +0 -23
- package/dist/bin/capabilities/repoChecksCapability.js +0 -22
- package/dist/bin/capabilities/searchCapability.js +0 -22
- package/dist/bin/capabilities/skillCapability.js +0 -76
- package/dist/bin/capabilities/taskManagementCapability.js +0 -20
- package/dist/bin/capabilities/testingCapability.js +0 -23
- package/dist/bin/capabilities/toolManifest.js +0 -159
- package/dist/bin/capabilities/toolRegistry.js +0 -114
- package/dist/bin/capabilities/webCapability.js +0 -20
- package/dist/bin/config.js +0 -139
- package/dist/bin/contracts/v1/agent.js +0 -7
- package/dist/bin/contracts/v1/agentProfileManifest.js +0 -8
- package/dist/bin/contracts/v1/agentRules.js +0 -9
- package/dist/bin/contracts/v1/toolAccess.js +0 -8
- package/dist/bin/erosolar-optimized.d.ts +0 -12
- package/dist/bin/erosolar-optimized.d.ts.map +0 -1
- package/dist/bin/erosolar-optimized.js +0 -239
- package/dist/bin/erosolar-optimized.js.map +0 -1
- package/dist/bin/headless/headlessApp.js +0 -172
- package/dist/bin/mcp/config.js +0 -202
- package/dist/bin/mcp/stdioClient.js +0 -172
- package/dist/bin/mcp/toolBridge.js +0 -104
- package/dist/bin/mcp/types.js +0 -1
- package/dist/bin/plugins/index.js +0 -113
- package/dist/bin/plugins/providers/anthropic/index.js +0 -25
- package/dist/bin/plugins/providers/deepseek/index.js +0 -24
- package/dist/bin/plugins/providers/google/index.js +0 -26
- package/dist/bin/plugins/providers/index.js +0 -19
- package/dist/bin/plugins/providers/ollama/index.js +0 -59
- package/dist/bin/plugins/providers/openai/index.js +0 -26
- package/dist/bin/plugins/providers/xai/index.js +0 -24
- package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -8
- package/dist/bin/plugins/tools/bash/localBashPlugin.js +0 -13
- package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +0 -13
- package/dist/bin/plugins/tools/cloud/cloudPlugin.js +0 -13
- package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -13
- package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +0 -13
- package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +0 -11
- package/dist/bin/plugins/tools/development/devPlugin.js +0 -13
- package/dist/bin/plugins/tools/edit/editPlugin.js +0 -14
- package/dist/bin/plugins/tools/email/emailPlugin.js +0 -11
- package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -8
- package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +0 -13
- package/dist/bin/plugins/tools/glob/globPlugin.js +0 -14
- package/dist/bin/plugins/tools/index.js +0 -2
- package/dist/bin/plugins/tools/interaction/interactionPlugin.js +0 -11
- package/dist/bin/plugins/tools/learn/learnPlugin.js +0 -13
- package/dist/bin/plugins/tools/mcp/mcpPlugin.js +0 -8
- package/dist/bin/plugins/tools/nodeDefaults.js +0 -56
- package/dist/bin/plugins/tools/notebook/notebookPlugin.js +0 -14
- package/dist/bin/plugins/tools/planning/planningPlugin.js +0 -14
- package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +0 -11
- package/dist/bin/plugins/tools/registry.js +0 -57
- package/dist/bin/plugins/tools/search/localSearchPlugin.js +0 -13
- package/dist/bin/plugins/tools/skills/skillPlugin.js +0 -8
- package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +0 -11
- package/dist/bin/plugins/tools/testing/testingPlugin.js +0 -11
- package/dist/bin/plugins/tools/web/webPlugin.js +0 -11
- package/dist/bin/providers/anthropicProvider.js +0 -329
- package/dist/bin/providers/googleProvider.js +0 -203
- package/dist/bin/providers/openaiChatCompletionsProvider.js +0 -208
- package/dist/bin/providers/openaiResponsesProvider.js +0 -249
- package/dist/bin/providers/providerFactory.js +0 -24
- package/dist/bin/runtime/agentController.js +0 -321
- package/dist/bin/runtime/agentHost.js +0 -153
- package/dist/bin/runtime/agentSession.js +0 -195
- package/dist/bin/runtime/node.js +0 -10
- package/dist/bin/runtime/universal.js +0 -28
- package/dist/bin/skills/skillRepository.js +0 -236
- package/dist/bin/skills/types.js +0 -1
- package/dist/bin/subagents/taskRunner.js +0 -269
- package/dist/bin/tools/backgroundBashTools.js +0 -211
- package/dist/bin/tools/bashTools.js +0 -159
- package/dist/bin/tools/cloudTools.js +0 -864
- package/dist/bin/tools/codeAnalysisTools.js +0 -641
- package/dist/bin/tools/codeQualityTools.js +0 -294
- package/dist/bin/tools/dependencyTools.js +0 -282
- package/dist/bin/tools/devTools.js +0 -238
- package/dist/bin/tools/diffUtils.js +0 -137
- package/dist/bin/tools/editTools.js +0 -134
- package/dist/bin/tools/emailTools.js +0 -448
- package/dist/bin/tools/fileTools.js +0 -282
- package/dist/bin/tools/globTools.js +0 -173
- package/dist/bin/tools/grepTools.js +0 -332
- package/dist/bin/tools/interactionTools.js +0 -170
- package/dist/bin/tools/learnTools.js +0 -1818
- package/dist/bin/tools/notebookEditTools.js +0 -196
- package/dist/bin/tools/planningTools.js +0 -46
- package/dist/bin/tools/refactoringTools.js +0 -293
- package/dist/bin/tools/repoChecksTools.js +0 -160
- package/dist/bin/tools/searchTools.js +0 -206
- package/dist/bin/tools/skillTools.js +0 -177
- package/dist/bin/tools/taskManagementTools.js +0 -156
- package/dist/bin/tools/testingTools.js +0 -232
- package/dist/bin/tools/webTools.js +0 -480
- package/dist/bin/workspace.js +0 -106
- package/dist/bin/workspace.validator.js +0 -213
- package/dist/capabilities/offensiveSecurityCapability.d.ts +0 -26
- package/dist/capabilities/offensiveSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/offensiveSecurityCapability.js +0 -58
- package/dist/capabilities/offensiveSecurityCapability.js.map +0 -1
- package/dist/capabilities/realSecurityCapability.d.ts +0 -26
- package/dist/capabilities/realSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/realSecurityCapability.js +0 -53
- package/dist/capabilities/realSecurityCapability.js.map +0 -1
- package/dist/capabilities/securityCapability.d.ts +0 -32
- package/dist/capabilities/securityCapability.d.ts.map +0 -1
- package/dist/capabilities/securityCapability.js +0 -57
- package/dist/capabilities/securityCapability.js.map +0 -1
- package/dist/capabilities/ultimateSecurityCapability.d.ts +0 -42
- package/dist/capabilities/ultimateSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/ultimateSecurityCapability.js +0 -96
- package/dist/capabilities/ultimateSecurityCapability.js.map +0 -1
- package/dist/core/designThoughtCheck.d.ts +0 -196
- package/dist/core/designThoughtCheck.d.ts.map +0 -1
- package/dist/core/designThoughtCheck.js +0 -287
- package/dist/core/designThoughtCheck.js.map +0 -1
- package/dist/core/designThoughtCheckEngine.d.ts +0 -58
- package/dist/core/designThoughtCheckEngine.d.ts.map +0 -1
- package/dist/core/designThoughtCheckEngine.js +0 -358
- package/dist/core/designThoughtCheckEngine.js.map +0 -1
- package/dist/core/designThoughtCheckIntegration.d.ts +0 -103
- package/dist/core/designThoughtCheckIntegration.d.ts.map +0 -1
- package/dist/core/designThoughtCheckIntegration.js +0 -207
- package/dist/core/designThoughtCheckIntegration.js.map +0 -1
- package/dist/core/intelligenceTools.d.ts +0 -19
- package/dist/core/intelligenceTools.d.ts.map +0 -1
- package/dist/core/intelligenceTools.js +0 -453
- package/dist/core/intelligenceTools.js.map +0 -1
- package/dist/core/operationalTools.d.ts +0 -19
- package/dist/core/operationalTools.d.ts.map +0 -1
- package/dist/core/operationalTools.js +0 -467
- package/dist/core/operationalTools.js.map +0 -1
- package/dist/offensive/core/offensive-engine.d.ts +0 -171
- package/dist/offensive/core/offensive-engine.d.ts.map +0 -1
- package/dist/offensive/core/offensive-engine.js +0 -345
- package/dist/offensive/core/offensive-engine.js.map +0 -1
- package/dist/offensive/core/offensive-integration.d.ts +0 -129
- package/dist/offensive/core/offensive-integration.d.ts.map +0 -1
- package/dist/offensive/core/offensive-integration.js +0 -364
- package/dist/offensive/core/offensive-integration.js.map +0 -1
- package/dist/offensive/core/offensive-tools.d.ts +0 -55
- package/dist/offensive/core/offensive-tools.d.ts.map +0 -1
- package/dist/offensive/core/offensive-tools.js +0 -438
- package/dist/offensive/core/offensive-tools.js.map +0 -1
- package/dist/offensive/offensive-cli.d.ts +0 -48
- package/dist/offensive/offensive-cli.d.ts.map +0 -1
- package/dist/offensive/offensive-cli.js +0 -233
- package/dist/offensive/offensive-cli.js.map +0 -1
- package/dist/security/apt-simulation-cli.d.ts +0 -57
- package/dist/security/apt-simulation-cli.d.ts.map +0 -1
- package/dist/security/apt-simulation-cli.js +0 -278
- package/dist/security/apt-simulation-cli.js.map +0 -1
- package/dist/security/apt-simulation-engine-complete.d.ts +0 -97
- package/dist/security/apt-simulation-engine-complete.d.ts.map +0 -1
- package/dist/security/apt-simulation-engine-complete.js +0 -441
- package/dist/security/apt-simulation-engine-complete.js.map +0 -1
- package/dist/security/apt-simulation-engine.d.ts +0 -97
- package/dist/security/apt-simulation-engine.d.ts.map +0 -1
- package/dist/security/apt-simulation-engine.js +0 -441
- package/dist/security/apt-simulation-engine.js.map +0 -1
- package/dist/security/authorization.d.ts +0 -45
- package/dist/security/authorization.d.ts.map +0 -1
- package/dist/security/authorization.js +0 -128
- package/dist/security/authorization.js.map +0 -1
- package/dist/security/comprehensive-security-research.d.ts +0 -84
- package/dist/security/comprehensive-security-research.d.ts.map +0 -1
- package/dist/security/comprehensive-security-research.js +0 -211
- package/dist/security/comprehensive-security-research.js.map +0 -1
- package/dist/security/offensive/exploitationEngine.d.ts +0 -54
- package/dist/security/offensive/exploitationEngine.d.ts.map +0 -1
- package/dist/security/offensive/exploitationEngine.js +0 -263
- package/dist/security/offensive/exploitationEngine.js.map +0 -1
- package/dist/security/real/networkExploitation.d.ts +0 -92
- package/dist/security/real/networkExploitation.d.ts.map +0 -1
- package/dist/security/real/networkExploitation.js +0 -316
- package/dist/security/real/networkExploitation.js.map +0 -1
- package/dist/security/real/persistenceImplementation.d.ts +0 -62
- package/dist/security/real/persistenceImplementation.d.ts.map +0 -1
- package/dist/security/real/persistenceImplementation.js +0 -323
- package/dist/security/real/persistenceImplementation.js.map +0 -1
- package/dist/security/real/vulnerabilityScanner.d.ts +0 -73
- package/dist/security/real/vulnerabilityScanner.d.ts.map +0 -1
- package/dist/security/real/vulnerabilityScanner.js +0 -341
- package/dist/security/real/vulnerabilityScanner.js.map +0 -1
- package/dist/shell/capturePastePatch.d.ts +0 -9
- package/dist/shell/capturePastePatch.d.ts.map +0 -1
- package/dist/shell/capturePastePatch.js +0 -98
- package/dist/shell/capturePastePatch.js.map +0 -1
- package/dist/shell/enhancedInteractiveShell.d.ts +0 -90
- package/dist/shell/enhancedInteractiveShell.d.ts.map +0 -1
- package/dist/shell/enhancedInteractiveShell.js +0 -248
- package/dist/shell/enhancedInteractiveShell.js.map +0 -1
- package/dist/shell/inputProcessor.d.ts +0 -56
- package/dist/shell/inputProcessor.d.ts.map +0 -1
- package/dist/shell/inputProcessor.js +0 -172
- package/dist/shell/inputProcessor.js.map +0 -1
- package/dist/shell/interactiveShell-patch.d.ts +0 -27
- package/dist/shell/interactiveShell-patch.d.ts.map +0 -1
- package/dist/shell/interactiveShell-patch.js +0 -38
- package/dist/shell/interactiveShell-patch.js.map +0 -1
- package/dist/shell/interactiveShell-robust.d.ts +0 -26
- package/dist/shell/interactiveShell-robust.d.ts.map +0 -1
- package/dist/shell/interactiveShell-robust.js +0 -34
- package/dist/shell/interactiveShell-robust.js.map +0 -1
- package/dist/shell/multiLinePasteManager.d.ts +0 -106
- package/dist/shell/multiLinePasteManager.d.ts.map +0 -1
- package/dist/shell/multiLinePasteManager.js +0 -308
- package/dist/shell/multiLinePasteManager.js.map +0 -1
- package/dist/shell/processInputBlockPatch.d.ts +0 -8
- package/dist/shell/processInputBlockPatch.d.ts.map +0 -1
- package/dist/shell/processInputBlockPatch.js +0 -133
- package/dist/shell/processInputBlockPatch.js.map +0 -1
- package/dist/tools/enhancedSecurityTools.d.ts +0 -19
- package/dist/tools/enhancedSecurityTools.d.ts.map +0 -1
- package/dist/tools/enhancedSecurityTools.js +0 -215
- package/dist/tools/enhancedSecurityTools.js.map +0 -1
- package/dist/tools/offensiveSecurityTools.d.ts +0 -16
- package/dist/tools/offensiveSecurityTools.d.ts.map +0 -1
- package/dist/tools/offensiveSecurityTools.js +0 -285
- package/dist/tools/offensiveSecurityTools.js.map +0 -1
- package/dist/tools/realSecurityTools.d.ts +0 -18
- package/dist/tools/realSecurityTools.d.ts.map +0 -1
- package/dist/tools/realSecurityTools.js +0 -468
- package/dist/tools/realSecurityTools.js.map +0 -1
- package/dist/tools/securityTools.d.ts +0 -20
- package/dist/tools/securityTools.d.ts.map +0 -1
- package/dist/tools/securityTools.js +0 -449
- package/dist/tools/securityTools.js.map +0 -1
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import { exec } from 'node:child_process';
|
|
2
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { promisify } from 'node:util';
|
|
6
|
-
import { analyzeTypeScriptFile, performAdvancedAstAnalysis } from './codeAnalysisTools.js';
|
|
7
|
-
const execAsync = promisify(exec);
|
|
8
|
-
const LINT_CONFIG_CANDIDATES = [
|
|
9
|
-
'eslint.config.js',
|
|
10
|
-
'eslint.config.cjs',
|
|
11
|
-
'eslint.config.mjs',
|
|
12
|
-
'eslint.config.json',
|
|
13
|
-
'.eslintrc',
|
|
14
|
-
'.eslintrc.json',
|
|
15
|
-
'.eslintrc.cjs',
|
|
16
|
-
'.eslintrc.js',
|
|
17
|
-
'.eslintrc.yml',
|
|
18
|
-
'.eslintrc.yaml',
|
|
19
|
-
];
|
|
20
|
-
export function createCodeQualityTools(workingDir) {
|
|
21
|
-
return [
|
|
22
|
-
{
|
|
23
|
-
name: 'run_lint_checks',
|
|
24
|
-
description: 'Run ESLint (or npm run lint) with optional pattern targeting and auto-fix support.',
|
|
25
|
-
parameters: {
|
|
26
|
-
type: 'object',
|
|
27
|
-
properties: {
|
|
28
|
-
pattern: {
|
|
29
|
-
type: 'string',
|
|
30
|
-
description: 'Optional file/glob pattern to pass to the linter.',
|
|
31
|
-
},
|
|
32
|
-
fix: {
|
|
33
|
-
type: 'boolean',
|
|
34
|
-
description: 'Apply automatic fixes when supported.',
|
|
35
|
-
},
|
|
36
|
-
timeout: {
|
|
37
|
-
type: 'number',
|
|
38
|
-
description: 'Command timeout in milliseconds (default: 120000).',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
additionalProperties: false,
|
|
42
|
-
},
|
|
43
|
-
handler: async (args) => {
|
|
44
|
-
const rawPattern = args['pattern'];
|
|
45
|
-
const pattern = typeof rawPattern === 'string' && rawPattern.trim() ? rawPattern.trim() : null;
|
|
46
|
-
const fix = args['fix'] === true;
|
|
47
|
-
const timeout = typeof args['timeout'] === 'number' && Number.isFinite(args['timeout']) && args['timeout'] > 0
|
|
48
|
-
? args['timeout']
|
|
49
|
-
: 120000;
|
|
50
|
-
try {
|
|
51
|
-
const packageJsonPath = join(workingDir, 'package.json');
|
|
52
|
-
if (!existsSync(packageJsonPath)) {
|
|
53
|
-
return 'Error: package.json not found. Cannot determine lint command.';
|
|
54
|
-
}
|
|
55
|
-
const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
56
|
-
let command;
|
|
57
|
-
if (pkg.scripts?.['lint']) {
|
|
58
|
-
const extras = [];
|
|
59
|
-
if (pattern) {
|
|
60
|
-
extras.push(pattern);
|
|
61
|
-
}
|
|
62
|
-
if (fix) {
|
|
63
|
-
extras.push('--fix');
|
|
64
|
-
}
|
|
65
|
-
command = 'npm run lint';
|
|
66
|
-
if (extras.length > 0) {
|
|
67
|
-
command += ` -- ${extras.map(shellEscape).join(' ')}`;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
const target = pattern ?? '.';
|
|
72
|
-
command = `npx eslint ${shellEscape(target)} --ext .ts,.tsx,.js,.jsx`;
|
|
73
|
-
if (fix) {
|
|
74
|
-
command += ' --fix';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const { stdout, stderr } = await execAsync(command, {
|
|
78
|
-
cwd: workingDir,
|
|
79
|
-
timeout,
|
|
80
|
-
maxBuffer: 1024 * 1024 * 10,
|
|
81
|
-
});
|
|
82
|
-
let result = `Lint command: ${command}\n\n`;
|
|
83
|
-
if (stdout)
|
|
84
|
-
result += `stdout:\n${stdout}\n`;
|
|
85
|
-
if (stderr)
|
|
86
|
-
result += `stderr:\n${stderr}\n`;
|
|
87
|
-
return result || 'Lint run completed (no output).';
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
const stdout = error.stdout ?? '';
|
|
91
|
-
const stderr = error.stderr ?? '';
|
|
92
|
-
if (error.killed) {
|
|
93
|
-
return `Error: lint command timed out after ${timeout}ms`;
|
|
94
|
-
}
|
|
95
|
-
return `Error running lint command: ${error.message}\nstdout: ${stdout}\nstderr: ${stderr}`;
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: 'inspect_code_quality',
|
|
101
|
-
description: 'Generate a maintainability report (function complexity, TODO density, comment coverage) for a file.',
|
|
102
|
-
parameters: {
|
|
103
|
-
type: 'object',
|
|
104
|
-
properties: {
|
|
105
|
-
path: {
|
|
106
|
-
type: 'string',
|
|
107
|
-
description: 'Path to the TypeScript/JavaScript file to inspect.',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
required: ['path'],
|
|
111
|
-
additionalProperties: false,
|
|
112
|
-
},
|
|
113
|
-
handler: async (args) => {
|
|
114
|
-
try {
|
|
115
|
-
const filePath = resolveFilePath(workingDir, args['path']);
|
|
116
|
-
if (!existsSync(filePath)) {
|
|
117
|
-
return `Error: File not found: ${filePath}`;
|
|
118
|
-
}
|
|
119
|
-
const content = readFileSync(filePath, 'utf-8');
|
|
120
|
-
const analysis = analyzeTypeScriptFile(content, filePath);
|
|
121
|
-
const ast = performAdvancedAstAnalysis(content, filePath);
|
|
122
|
-
return formatQualityReport(content, analysis, ast);
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
return `Error analyzing code quality: ${error instanceof Error ? error.message : String(error)}`;
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'list_lint_rules',
|
|
131
|
-
description: 'Summarize the ESLint configuration and active rules.',
|
|
132
|
-
parameters: {
|
|
133
|
-
type: 'object',
|
|
134
|
-
properties: {},
|
|
135
|
-
additionalProperties: false,
|
|
136
|
-
},
|
|
137
|
-
handler: async () => {
|
|
138
|
-
try {
|
|
139
|
-
const configInfo = await loadLintConfig(workingDir);
|
|
140
|
-
if (!configInfo) {
|
|
141
|
-
return 'No ESLint configuration found (package.json eslintConfig or .eslintrc/eslint.config.*).';
|
|
142
|
-
}
|
|
143
|
-
const rules = extractLintRules(configInfo.config);
|
|
144
|
-
if (Object.keys(rules).length === 0) {
|
|
145
|
-
return `ESLint configuration "${configInfo.source}" found, but no rules were declared.`;
|
|
146
|
-
}
|
|
147
|
-
return formatLintRules(configInfo.source, rules);
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
return `Error reading ESLint configuration: ${error instanceof Error ? error.message : String(error)}`;
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
];
|
|
155
|
-
}
|
|
156
|
-
function resolveFilePath(workingDir, path) {
|
|
157
|
-
const value = validatePathArg(path);
|
|
158
|
-
return value.startsWith('/') ? value : join(workingDir, value);
|
|
159
|
-
}
|
|
160
|
-
function validatePathArg(path) {
|
|
161
|
-
if (typeof path !== 'string' || !path.trim()) {
|
|
162
|
-
throw new Error('Path must be a non-empty string.');
|
|
163
|
-
}
|
|
164
|
-
return path.trim();
|
|
165
|
-
}
|
|
166
|
-
function shellEscape(value) {
|
|
167
|
-
if (!value) {
|
|
168
|
-
return "''";
|
|
169
|
-
}
|
|
170
|
-
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
171
|
-
}
|
|
172
|
-
async function loadLintConfig(workingDir) {
|
|
173
|
-
const packageJsonPath = join(workingDir, 'package.json');
|
|
174
|
-
if (existsSync(packageJsonPath)) {
|
|
175
|
-
const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
176
|
-
if (pkg.eslintConfig) {
|
|
177
|
-
return {
|
|
178
|
-
config: pkg.eslintConfig,
|
|
179
|
-
source: 'package.json eslintConfig',
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
for (const relativePath of LINT_CONFIG_CANDIDATES) {
|
|
184
|
-
const absolute = join(workingDir, relativePath);
|
|
185
|
-
if (!existsSync(absolute)) {
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
if (relativePath.endsWith('.json') || relativePath === '.eslintrc') {
|
|
189
|
-
const config = JSON.parse(readFileSync(absolute, 'utf-8'));
|
|
190
|
-
return { config, source: relativePath };
|
|
191
|
-
}
|
|
192
|
-
if (relativePath.endsWith('.js') || relativePath.endsWith('.cjs') || relativePath.endsWith('.mjs')) {
|
|
193
|
-
const module = await import(pathToFileURL(absolute).href);
|
|
194
|
-
const config = module.default ?? module;
|
|
195
|
-
return { config, source: relativePath };
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
function extractLintRules(config) {
|
|
201
|
-
if (!config) {
|
|
202
|
-
return {};
|
|
203
|
-
}
|
|
204
|
-
if (Array.isArray(config)) {
|
|
205
|
-
return config.reduce((acc, entry) => {
|
|
206
|
-
if (entry && typeof entry === 'object' && 'rules' in entry && typeof entry.rules === 'object') {
|
|
207
|
-
Object.assign(acc, entry.rules);
|
|
208
|
-
}
|
|
209
|
-
return acc;
|
|
210
|
-
}, {});
|
|
211
|
-
}
|
|
212
|
-
if (typeof config === 'object' && 'rules' in config && typeof config.rules === 'object') {
|
|
213
|
-
return { ...config.rules };
|
|
214
|
-
}
|
|
215
|
-
return {};
|
|
216
|
-
}
|
|
217
|
-
function formatLintRules(source, rules) {
|
|
218
|
-
const output = [];
|
|
219
|
-
output.push(`# ESLint rules (${source})`);
|
|
220
|
-
output.push('');
|
|
221
|
-
const entries = Object.entries(rules).sort(([a], [b]) => a.localeCompare(b));
|
|
222
|
-
for (const [rule, setting] of entries) {
|
|
223
|
-
const normalized = normalizeRuleSetting(setting);
|
|
224
|
-
output.push(`- **${rule}** → ${normalized.level}${normalized.details ? ` (${normalized.details})` : ''}`);
|
|
225
|
-
}
|
|
226
|
-
return output.join('\n');
|
|
227
|
-
}
|
|
228
|
-
function normalizeRuleSetting(setting) {
|
|
229
|
-
if (typeof setting === 'string') {
|
|
230
|
-
return { level: setting };
|
|
231
|
-
}
|
|
232
|
-
if (typeof setting === 'number') {
|
|
233
|
-
return { level: severityFromNumber(setting) };
|
|
234
|
-
}
|
|
235
|
-
if (Array.isArray(setting) && setting.length > 0) {
|
|
236
|
-
const [levelRaw, ...rest] = setting;
|
|
237
|
-
const level = typeof levelRaw === 'number' ? severityFromNumber(levelRaw) : String(levelRaw);
|
|
238
|
-
return {
|
|
239
|
-
level,
|
|
240
|
-
details: rest.length > 0 ? JSON.stringify(rest) : undefined,
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
if (typeof setting === 'object' && setting !== null) {
|
|
244
|
-
return {
|
|
245
|
-
level: 'configured',
|
|
246
|
-
details: JSON.stringify(setting),
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
return { level: 'off' };
|
|
250
|
-
}
|
|
251
|
-
function severityFromNumber(level) {
|
|
252
|
-
switch (level) {
|
|
253
|
-
case 0:
|
|
254
|
-
return 'off';
|
|
255
|
-
case 1:
|
|
256
|
-
return 'warn';
|
|
257
|
-
case 2:
|
|
258
|
-
return 'error';
|
|
259
|
-
default:
|
|
260
|
-
return `level-${level}`;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
function formatQualityReport(content, structural, ast) {
|
|
264
|
-
const lines = content.split('\n');
|
|
265
|
-
const totalLines = lines.length;
|
|
266
|
-
const todoCount = lines.filter((line) => /TODO|FIXME|HACK/.test(line)).length;
|
|
267
|
-
const commentLines = lines.filter((line) => line.trim().startsWith('//') || line.trim().startsWith('/*')).length;
|
|
268
|
-
const commentCoverage = totalLines === 0 ? 0 : (commentLines / totalLines) * 100;
|
|
269
|
-
const longStructures = ast.symbols.filter((symbol) => symbol.kind !== 'class' && (symbol.statementCount > 40 || symbol.cyclomaticComplexity > 12));
|
|
270
|
-
const maintainabilityScore = Math.max(10, Math.round(100 -
|
|
271
|
-
longStructures.length * 4 -
|
|
272
|
-
Math.min(todoCount * 2, 30) -
|
|
273
|
-
Math.min(structural.functions.length * 0.5, 15) -
|
|
274
|
-
Math.min(commentCoverage < 10 ? 20 : 0, 20)));
|
|
275
|
-
const output = [];
|
|
276
|
-
output.push(`# Code quality snapshot`);
|
|
277
|
-
output.push('');
|
|
278
|
-
output.push(`- Total lines: ${totalLines}`);
|
|
279
|
-
output.push(`- Comment coverage: ${commentCoverage.toFixed(1)}%`);
|
|
280
|
-
output.push(`- TODO/FIXME occurrences: ${todoCount}`);
|
|
281
|
-
output.push(`- Named exports: ${structural.exports.length}`);
|
|
282
|
-
output.push(`- Maintainability score (heuristic): ${maintainabilityScore}/100`);
|
|
283
|
-
output.push('');
|
|
284
|
-
output.push('## Hotspots');
|
|
285
|
-
if (longStructures.length === 0) {
|
|
286
|
-
output.push('No large or unusually complex functions detected.');
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
for (const symbol of longStructures) {
|
|
290
|
-
output.push(`- ${symbol.name} (${symbol.kind}) — statements: ${symbol.statementCount}, CC: ${symbol.cyclomaticComplexity}, lines ${symbol.startLine}-${symbol.endLine}`);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return output.join('\n');
|
|
294
|
-
}
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { exec } from 'node:child_process';
|
|
2
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { promisify } from 'node:util';
|
|
5
|
-
const execAsync = promisify(exec);
|
|
6
|
-
export function createDependencyTools(workingDir) {
|
|
7
|
-
return [
|
|
8
|
-
{
|
|
9
|
-
name: 'summarize_dependencies',
|
|
10
|
-
description: 'Summarize dependency counts, categories, and notable packages from package.json.',
|
|
11
|
-
parameters: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
detail: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
enum: ['basic', 'full'],
|
|
17
|
-
description: 'Detail level for the summary (default: basic).',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
additionalProperties: false,
|
|
21
|
-
},
|
|
22
|
-
handler: async (args) => {
|
|
23
|
-
try {
|
|
24
|
-
const pkg = readPackageJson(workingDir);
|
|
25
|
-
if (!pkg) {
|
|
26
|
-
return 'Error: package.json not found.';
|
|
27
|
-
}
|
|
28
|
-
const detail = args['detail'] === 'full' ? 'full' : 'basic';
|
|
29
|
-
return formatDependencySummary(pkg, detail);
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
return `Error summarizing dependencies: ${error instanceof Error ? error.message : String(error)}`;
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: 'scan_dependency_health',
|
|
38
|
-
description: 'Run npm audit to surface known vulnerabilities (requires npm registry access).',
|
|
39
|
-
parameters: {
|
|
40
|
-
type: 'object',
|
|
41
|
-
properties: {
|
|
42
|
-
timeout: {
|
|
43
|
-
type: 'number',
|
|
44
|
-
description: 'Timeout in milliseconds (default: 180000).',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
additionalProperties: false,
|
|
48
|
-
},
|
|
49
|
-
handler: async (args) => {
|
|
50
|
-
const timeoutArg = args['timeout'];
|
|
51
|
-
const timeout = typeof timeoutArg === 'number' && Number.isFinite(timeoutArg) && timeoutArg > 0
|
|
52
|
-
? timeoutArg
|
|
53
|
-
: 180000;
|
|
54
|
-
try {
|
|
55
|
-
const { stdout } = await execAsync('npm audit --json', {
|
|
56
|
-
cwd: workingDir,
|
|
57
|
-
timeout,
|
|
58
|
-
maxBuffer: 1024 * 1024 * 15,
|
|
59
|
-
});
|
|
60
|
-
return formatAuditReport(stdout);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
if (error.killed) {
|
|
64
|
-
return `Error: npm audit timed out after ${timeout}ms.`;
|
|
65
|
-
}
|
|
66
|
-
const stdout = error.stdout;
|
|
67
|
-
if (stdout && stdout.trim()) {
|
|
68
|
-
try {
|
|
69
|
-
return formatAuditReport(stdout);
|
|
70
|
-
}
|
|
71
|
-
catch (parseError) {
|
|
72
|
-
// fall through to generic error
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return `Error running npm audit: ${error.message}. stderr: ${error.stderr ?? 'none'}`;
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'inspect_dependency_tree',
|
|
81
|
-
description: 'Analyze package-lock.json for resolved versions and duplicate dependency instances.',
|
|
82
|
-
parameters: {
|
|
83
|
-
type: 'object',
|
|
84
|
-
properties: {},
|
|
85
|
-
additionalProperties: false,
|
|
86
|
-
},
|
|
87
|
-
handler: async () => {
|
|
88
|
-
try {
|
|
89
|
-
const pkg = readPackageJson(workingDir);
|
|
90
|
-
if (!pkg) {
|
|
91
|
-
return 'Error: package.json not found.';
|
|
92
|
-
}
|
|
93
|
-
const lockPath = join(workingDir, 'package-lock.json');
|
|
94
|
-
if (!existsSync(lockPath)) {
|
|
95
|
-
return 'package-lock.json not found. Run npm install to generate it.';
|
|
96
|
-
}
|
|
97
|
-
const lock = JSON.parse(readFileSync(lockPath, 'utf-8'));
|
|
98
|
-
return formatLockSummary(pkg, lock);
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
return `Error inspecting dependency tree: ${error instanceof Error ? error.message : String(error)}`;
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
];
|
|
106
|
-
}
|
|
107
|
-
function readPackageJson(workingDir) {
|
|
108
|
-
const packageJsonPath = join(workingDir, 'package.json');
|
|
109
|
-
if (!existsSync(packageJsonPath)) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
return JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
113
|
-
}
|
|
114
|
-
function formatDependencySummary(pkg, detail) {
|
|
115
|
-
const deps = Object.entries(pkg.dependencies ?? {});
|
|
116
|
-
const devDeps = Object.entries(pkg.devDependencies ?? {});
|
|
117
|
-
const optionalDeps = Object.entries(pkg.optionalDependencies ?? {});
|
|
118
|
-
const output = [];
|
|
119
|
-
output.push(`# Dependency summary for ${pkg.name ?? 'package'} v${pkg.version ?? '0.0.0'}`);
|
|
120
|
-
output.push('');
|
|
121
|
-
output.push(`- Production dependencies: ${deps.length}`);
|
|
122
|
-
output.push(`- Dev dependencies: ${devDeps.length}`);
|
|
123
|
-
output.push(`- Optional dependencies: ${optionalDeps.length}`);
|
|
124
|
-
output.push('');
|
|
125
|
-
if (detail === 'full') {
|
|
126
|
-
if (deps.length > 0) {
|
|
127
|
-
output.push('## Production dependencies');
|
|
128
|
-
deps
|
|
129
|
-
.sort(([a], [b]) => a.localeCompare(b))
|
|
130
|
-
.forEach(([name, version]) => {
|
|
131
|
-
output.push(`- ${name}: ${version}`);
|
|
132
|
-
});
|
|
133
|
-
output.push('');
|
|
134
|
-
}
|
|
135
|
-
if (devDeps.length > 0) {
|
|
136
|
-
output.push('## Dev dependencies');
|
|
137
|
-
devDeps
|
|
138
|
-
.sort(([a], [b]) => a.localeCompare(b))
|
|
139
|
-
.forEach(([name, version]) => {
|
|
140
|
-
output.push(`- ${name}: ${version}`);
|
|
141
|
-
});
|
|
142
|
-
output.push('');
|
|
143
|
-
}
|
|
144
|
-
if (optionalDeps.length > 0) {
|
|
145
|
-
output.push('## Optional dependencies');
|
|
146
|
-
optionalDeps
|
|
147
|
-
.sort(([a], [b]) => a.localeCompare(b))
|
|
148
|
-
.forEach(([name, version]) => {
|
|
149
|
-
output.push(`- ${name}: ${version}`);
|
|
150
|
-
});
|
|
151
|
-
output.push('');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
if (deps.length > 0) {
|
|
156
|
-
output.push('Top production dependencies:');
|
|
157
|
-
deps
|
|
158
|
-
.sort(([a], [b]) => a.localeCompare(b))
|
|
159
|
-
.slice(0, 10)
|
|
160
|
-
.forEach(([name, version]) => {
|
|
161
|
-
output.push(`- ${name}: ${version}`);
|
|
162
|
-
});
|
|
163
|
-
output.push('');
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return output.join('\n');
|
|
167
|
-
}
|
|
168
|
-
function formatAuditReport(jsonText) {
|
|
169
|
-
const report = JSON.parse(jsonText);
|
|
170
|
-
const metadata = report.metadata ?? {};
|
|
171
|
-
const vulnerabilityCounts = metadata.vulnerabilities ?? report.vulnerabilities ?? {};
|
|
172
|
-
const output = [];
|
|
173
|
-
output.push('# npm audit report');
|
|
174
|
-
output.push('');
|
|
175
|
-
if (Object.keys(vulnerabilityCounts).length === 0) {
|
|
176
|
-
output.push('No vulnerabilities reported.');
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
output.push('## Totals by severity');
|
|
180
|
-
for (const [severity, count] of Object.entries(vulnerabilityCounts)) {
|
|
181
|
-
output.push(`- ${severity}: ${count}`);
|
|
182
|
-
}
|
|
183
|
-
output.push('');
|
|
184
|
-
}
|
|
185
|
-
const vulnerabilities = report.vulnerabilities ?? report.advisories ?? {};
|
|
186
|
-
const entries = Object.entries(vulnerabilities);
|
|
187
|
-
if (entries.length > 0) {
|
|
188
|
-
output.push('## Notable vulnerabilities');
|
|
189
|
-
entries.slice(0, 10).forEach(([name, info]) => {
|
|
190
|
-
const data = info;
|
|
191
|
-
const severity = data.severity ?? data.metadata?.severity ?? 'unknown';
|
|
192
|
-
const via = Array.isArray(data.via)
|
|
193
|
-
? data.via.map((item) => (typeof item === 'string' ? item : item.title)).join(', ')
|
|
194
|
-
: '';
|
|
195
|
-
output.push(`- ${name}: severity ${severity}${via ? ` (via ${via})` : ''}`);
|
|
196
|
-
if (data.range) {
|
|
197
|
-
output.push(` Affected versions: ${data.range}`);
|
|
198
|
-
}
|
|
199
|
-
else if (data.vulnerable_versions) {
|
|
200
|
-
output.push(` Affected versions: ${data.vulnerable_versions}`);
|
|
201
|
-
}
|
|
202
|
-
if (data.patch_available || data.fixAvailable) {
|
|
203
|
-
output.push(` Fix available: ${JSON.stringify(data.patch_available ?? data.fixAvailable)}`);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
output.push('No detailed vulnerability entries were returned by npm audit.');
|
|
209
|
-
}
|
|
210
|
-
return output.join('\n');
|
|
211
|
-
}
|
|
212
|
-
function formatLockSummary(pkg, lock) {
|
|
213
|
-
const deps = Object.keys(pkg.dependencies ?? {});
|
|
214
|
-
const devDeps = Object.keys(pkg.devDependencies ?? {});
|
|
215
|
-
const output = [];
|
|
216
|
-
output.push(`# Dependency tree (${pkg.name ?? 'package'})`);
|
|
217
|
-
if (lock.lockfileVersion) {
|
|
218
|
-
output.push(`Lockfile version: ${lock.lockfileVersion}`);
|
|
219
|
-
}
|
|
220
|
-
output.push('');
|
|
221
|
-
if (deps.length > 0) {
|
|
222
|
-
output.push('## Resolved production dependencies');
|
|
223
|
-
deps.forEach((dep) => {
|
|
224
|
-
const version = resolveLockVersion(lock, dep);
|
|
225
|
-
output.push(`- ${dep}: ${version ?? 'unknown version'}`);
|
|
226
|
-
});
|
|
227
|
-
output.push('');
|
|
228
|
-
}
|
|
229
|
-
if (devDeps.length > 0) {
|
|
230
|
-
output.push('## Resolved dev dependencies');
|
|
231
|
-
devDeps.forEach((dep) => {
|
|
232
|
-
const version = resolveLockVersion(lock, dep);
|
|
233
|
-
output.push(`- ${dep}: ${version ?? 'unknown version'}`);
|
|
234
|
-
});
|
|
235
|
-
output.push('');
|
|
236
|
-
}
|
|
237
|
-
const duplicates = detectDuplicateVersions(lock);
|
|
238
|
-
if (duplicates.length > 0) {
|
|
239
|
-
output.push('## Duplicate packages detected');
|
|
240
|
-
duplicates.forEach(({ name, versions }) => {
|
|
241
|
-
output.push(`- ${name}: ${Array.from(versions).join(', ')}`);
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
output.push('No duplicate package versions detected across the lockfile.');
|
|
246
|
-
}
|
|
247
|
-
return output.join('\n');
|
|
248
|
-
}
|
|
249
|
-
function resolveLockVersion(lock, name) {
|
|
250
|
-
if (lock.dependencies && lock.dependencies[name]?.version) {
|
|
251
|
-
return lock.dependencies[name].version ?? null;
|
|
252
|
-
}
|
|
253
|
-
if (lock.packages) {
|
|
254
|
-
const key = name.startsWith('node_modules/') ? name : `node_modules/${name}`;
|
|
255
|
-
const entry = lock.packages[key];
|
|
256
|
-
if (entry?.version) {
|
|
257
|
-
return entry.version;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
function detectDuplicateVersions(lock) {
|
|
263
|
-
const versionMap = new Map();
|
|
264
|
-
if (!lock.packages) {
|
|
265
|
-
return [];
|
|
266
|
-
}
|
|
267
|
-
for (const [key, entry] of Object.entries(lock.packages)) {
|
|
268
|
-
if (!key.startsWith('node_modules/')) {
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
const name = key.replace(/^node_modules\//, '');
|
|
272
|
-
if (!versionMap.has(name)) {
|
|
273
|
-
versionMap.set(name, new Set());
|
|
274
|
-
}
|
|
275
|
-
if (entry.version) {
|
|
276
|
-
versionMap.get(name).add(entry.version);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return [...versionMap.entries()]
|
|
280
|
-
.filter(([, versions]) => versions.size > 1)
|
|
281
|
-
.map(([name, versions]) => ({ name, versions }));
|
|
282
|
-
}
|