wiggum-cli 0.4.8 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/agents/codebase-analyzer.d.ts +24 -0
- package/dist/ai/agents/codebase-analyzer.d.ts.map +1 -0
- package/dist/ai/agents/codebase-analyzer.js +375 -0
- package/dist/ai/agents/codebase-analyzer.js.map +1 -0
- package/dist/ai/agents/context-enricher.d.ts +4 -0
- package/dist/ai/agents/context-enricher.d.ts.map +1 -1
- package/dist/ai/agents/context-enricher.js +12 -7
- package/dist/ai/agents/context-enricher.js.map +1 -1
- package/dist/ai/agents/evaluator-optimizer.d.ts +4 -0
- package/dist/ai/agents/evaluator-optimizer.d.ts.map +1 -1
- package/dist/ai/agents/evaluator-optimizer.js +4 -0
- package/dist/ai/agents/evaluator-optimizer.js.map +1 -1
- package/dist/ai/agents/index.d.ts +20 -14
- package/dist/ai/agents/index.d.ts.map +1 -1
- package/dist/ai/agents/index.js +38 -107
- package/dist/ai/agents/index.js.map +1 -1
- package/dist/ai/agents/planning-orchestrator.d.ts +4 -0
- package/dist/ai/agents/planning-orchestrator.d.ts.map +1 -1
- package/dist/ai/agents/planning-orchestrator.js +4 -0
- package/dist/ai/agents/planning-orchestrator.js.map +1 -1
- package/dist/ai/agents/synthesis-agent.d.ts +4 -0
- package/dist/ai/agents/synthesis-agent.d.ts.map +1 -1
- package/dist/ai/agents/synthesis-agent.js +4 -0
- package/dist/ai/agents/synthesis-agent.js.map +1 -1
- package/dist/ai/agents/tech-researcher.d.ts +4 -0
- package/dist/ai/agents/tech-researcher.d.ts.map +1 -1
- package/dist/ai/agents/tech-researcher.js +4 -0
- package/dist/ai/agents/tech-researcher.js.map +1 -1
- package/dist/ai/agents/types.d.ts +8 -0
- package/dist/ai/agents/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ai/agents/codebase-analyzer.test.ts +115 -0
- package/src/ai/agents/codebase-analyzer.ts +450 -0
- package/src/ai/agents/context-enricher.ts +12 -7
- package/src/ai/agents/evaluator-optimizer.ts +4 -0
- package/src/ai/agents/index.ts +45 -146
- package/src/ai/agents/planning-orchestrator.ts +4 -0
- package/src/ai/agents/synthesis-agent.ts +4 -0
- package/src/ai/agents/tech-researcher.ts +4 -0
- package/src/ai/agents/types.ts +9 -0
package/src/ai/agents/index.ts
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Agents Index
|
|
3
|
-
*
|
|
2
|
+
* Agents Index (v0.5.0)
|
|
3
|
+
* Simplified single-agent analysis with MCP detection
|
|
4
4
|
*
|
|
5
5
|
* Architecture:
|
|
6
|
-
* Phase 1:
|
|
7
|
-
* Phase 2:
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Phase 1: Codebase Analyzer (unified agent with tools)
|
|
7
|
+
* Phase 2: MCP Detection (pure function)
|
|
8
|
+
*
|
|
9
|
+
* This replaces the complex 4-phase multi-agent system (v0.4.5-v0.4.9)
|
|
10
|
+
* which added overhead without improving output quality.
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
// Types - export all for consumers
|
|
13
14
|
export type {
|
|
14
|
-
// New architecture types
|
|
15
|
+
// New architecture types (v0.5.0)
|
|
16
|
+
CodebaseAnalyzerInput,
|
|
17
|
+
RalphMcpServers,
|
|
18
|
+
ProgressCallback,
|
|
19
|
+
// Legacy types (backward compatibility)
|
|
15
20
|
AnalysisPlan,
|
|
16
21
|
EnrichedContext,
|
|
17
22
|
TechResearchResult,
|
|
18
|
-
RalphMcpServers,
|
|
19
23
|
EvaluationResult,
|
|
20
24
|
ContextEnricherInput,
|
|
21
25
|
TechResearcherInput,
|
|
22
26
|
SynthesisInput,
|
|
23
|
-
ProgressCallback,
|
|
24
|
-
// Legacy types (backward compatibility)
|
|
25
27
|
CodebaseAnalysis,
|
|
26
28
|
StackResearch,
|
|
27
29
|
McpRecommendations,
|
|
@@ -33,16 +35,17 @@ export type {
|
|
|
33
35
|
OrchestratorInput,
|
|
34
36
|
} from './types.js';
|
|
35
37
|
|
|
36
|
-
//
|
|
38
|
+
// v0.5.0 exports
|
|
39
|
+
export { runCodebaseAnalyzer } from './codebase-analyzer.js';
|
|
40
|
+
export { detectRalphMcpServers, convertToLegacyMcpRecommendations } from './mcp-detector.js';
|
|
41
|
+
export { detectProjectType } from './stack-utils.js';
|
|
42
|
+
|
|
43
|
+
// Legacy exports (deprecated but kept for backward compatibility)
|
|
37
44
|
export { runPlanningOrchestrator } from './planning-orchestrator.js';
|
|
38
45
|
export { runContextEnricher } from './context-enricher.js';
|
|
39
46
|
export { runTechResearcher, runTechResearchPool } from './tech-researcher.js';
|
|
40
|
-
export { detectRalphMcpServers, convertToLegacyMcpRecommendations } from './mcp-detector.js';
|
|
41
47
|
export { runSynthesisAgent } from './synthesis-agent.js';
|
|
42
48
|
export { runEvaluatorOptimizer } from './evaluator-optimizer.js';
|
|
43
|
-
export { detectProjectType } from './stack-utils.js';
|
|
44
|
-
|
|
45
|
-
// Legacy exports (for backward compatibility during migration)
|
|
46
49
|
export { runCodebaseAnalyst } from './codebase-analyst.js';
|
|
47
50
|
export { runStackResearcher } from './stack-researcher.js';
|
|
48
51
|
export { runOrchestrator, mergeAgentResults } from './orchestrator.js';
|
|
@@ -52,26 +55,24 @@ import type { LanguageModel } from 'ai';
|
|
|
52
55
|
import type { ScanResult } from '../../scanner/types.js';
|
|
53
56
|
import type {
|
|
54
57
|
MultiAgentAnalysis,
|
|
55
|
-
AgentCapabilities,
|
|
56
58
|
AgentOptions,
|
|
57
|
-
EnrichedContext,
|
|
58
59
|
} from './types.js';
|
|
59
|
-
import {
|
|
60
|
-
import { runContextEnricher } from './context-enricher.js';
|
|
61
|
-
import { runTechResearchPool } from './tech-researcher.js';
|
|
62
|
-
import { detectRalphMcpServers } from './mcp-detector.js';
|
|
63
|
-
import { runSynthesisAgent } from './synthesis-agent.js';
|
|
64
|
-
import { runEvaluatorOptimizer } from './evaluator-optimizer.js';
|
|
60
|
+
import { runCodebaseAnalyzer } from './codebase-analyzer.js';
|
|
65
61
|
import { detectProjectType } from './stack-utils.js';
|
|
62
|
+
import { detectRalphMcpServers, convertToLegacyMcpRecommendations } from './mcp-detector.js';
|
|
66
63
|
import { logger } from '../../utils/logger.js';
|
|
67
64
|
|
|
68
65
|
/**
|
|
69
|
-
* Run
|
|
66
|
+
* Run simplified multi-agent analysis pipeline (v0.5.0)
|
|
67
|
+
*
|
|
68
|
+
* Phase 1: Codebase Analyzer - Single agent explores codebase with tools
|
|
69
|
+
* Phase 2: MCP Detection - Pure function detects required MCP servers
|
|
70
70
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
71
|
+
* This simplified architecture reduces:
|
|
72
|
+
* - Token cost: ~15,000 → ~5,000
|
|
73
|
+
* - LLM calls: 7-11 → 2-3
|
|
74
|
+
* - Agents: 7 → 1
|
|
75
|
+
* - Failure points: Many → Few
|
|
75
76
|
*/
|
|
76
77
|
export async function runMultiAgentAnalysis(
|
|
77
78
|
model: LanguageModel,
|
|
@@ -79,9 +80,9 @@ export async function runMultiAgentAnalysis(
|
|
|
79
80
|
scanResult: ScanResult,
|
|
80
81
|
options: AgentOptions = {}
|
|
81
82
|
): Promise<MultiAgentAnalysis | null> {
|
|
82
|
-
const {
|
|
83
|
+
const { verbose = false, onProgress } = options;
|
|
83
84
|
|
|
84
|
-
// Helper to report progress
|
|
85
|
+
// Helper to report progress
|
|
85
86
|
const report = (phase: string, detail?: string) => {
|
|
86
87
|
if (onProgress) {
|
|
87
88
|
onProgress(phase, detail);
|
|
@@ -90,116 +91,36 @@ export async function runMultiAgentAnalysis(
|
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
93
|
|
|
93
|
-
// Determine capabilities
|
|
94
|
-
const capabilities: AgentCapabilities = {
|
|
95
|
-
hasTavily: !!tavilyApiKey,
|
|
96
|
-
hasContext7: !!context7ApiKey,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
94
|
if (verbose && !onProgress) {
|
|
100
|
-
logger.info('Starting
|
|
101
|
-
logger.info(`Capabilities: Tavily=${capabilities.hasTavily}, Context7=${capabilities.hasContext7}`);
|
|
95
|
+
logger.info('Starting simplified analysis (v0.5.0)...');
|
|
102
96
|
}
|
|
103
97
|
|
|
104
98
|
try {
|
|
105
99
|
// ═══════════════════════════════════════════════════════════════
|
|
106
|
-
// PHASE 1:
|
|
107
|
-
// ═══════════════════════════════════════════════════════════════
|
|
108
|
-
report('Phase 1/4: Planning');
|
|
109
|
-
|
|
110
|
-
const plan = await runPlanningOrchestrator(model, modelId, scanResult, verbose && !onProgress);
|
|
111
|
-
|
|
112
|
-
report('Phase 1/4: Planning', `${plan.areasToExplore.length} areas, ${plan.technologiesToResearch.length} technologies`);
|
|
113
|
-
|
|
114
|
-
// ═══════════════════════════════════════════════════════════════
|
|
115
|
-
// PHASE 2: Parallel Workers
|
|
116
|
-
// ═══════════════════════════════════════════════════════════════
|
|
117
|
-
const workerCount = plan.technologiesToResearch.length + 1; // tech researchers + context enricher
|
|
118
|
-
report('Phase 2/4: Analyzing', `${workerCount} parallel workers`);
|
|
119
|
-
|
|
120
|
-
// Run context enricher and tech researchers in parallel with error recovery
|
|
121
|
-
const [contextResult, researchResult] = await Promise.allSettled([
|
|
122
|
-
runContextEnricher(
|
|
123
|
-
model,
|
|
124
|
-
modelId,
|
|
125
|
-
{
|
|
126
|
-
scanResult,
|
|
127
|
-
areasToExplore: plan.areasToExplore,
|
|
128
|
-
questionsToAnswer: plan.questionsToAnswer,
|
|
129
|
-
},
|
|
130
|
-
verbose && !onProgress
|
|
131
|
-
),
|
|
132
|
-
runTechResearchPool(
|
|
133
|
-
model,
|
|
134
|
-
modelId,
|
|
135
|
-
plan.technologiesToResearch,
|
|
136
|
-
{ tavilyApiKey, context7ApiKey },
|
|
137
|
-
verbose && !onProgress
|
|
138
|
-
),
|
|
139
|
-
]);
|
|
140
|
-
|
|
141
|
-
// Extract results with fallbacks for failed workers
|
|
142
|
-
const enrichedContext = contextResult.status === 'fulfilled'
|
|
143
|
-
? contextResult.value
|
|
144
|
-
: getDefaultEnrichedContext(scanResult);
|
|
145
|
-
|
|
146
|
-
const techResearch = researchResult.status === 'fulfilled'
|
|
147
|
-
? researchResult.value
|
|
148
|
-
: [];
|
|
149
|
-
|
|
150
|
-
// Log any worker failures
|
|
151
|
-
if (contextResult.status === 'rejected') {
|
|
152
|
-
logger.warn(`Context Enricher failed: ${contextResult.reason instanceof Error ? contextResult.reason.message : String(contextResult.reason)}`);
|
|
153
|
-
}
|
|
154
|
-
if (researchResult.status === 'rejected') {
|
|
155
|
-
logger.warn(`Tech Research Pool failed: ${researchResult.reason instanceof Error ? researchResult.reason.message : String(researchResult.reason)}`);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
report('Phase 2/4: Analyzing', 'complete');
|
|
159
|
-
|
|
160
|
-
// ═══════════════════════════════════════════════════════════════
|
|
161
|
-
// PHASE 3: Synthesis + MCP Detection
|
|
100
|
+
// PHASE 1: Codebase Analyzer (unified agent)
|
|
162
101
|
// ═══════════════════════════════════════════════════════════════
|
|
163
|
-
report('Phase
|
|
164
|
-
|
|
165
|
-
// Detect MCPs (pure function, no LLM) - pass project type for context-aware recommendations
|
|
166
|
-
const mcpServers = detectRalphMcpServers(scanResult.stack, enrichedContext.projectType);
|
|
102
|
+
report('Phase 1/2: Analyzing codebase');
|
|
167
103
|
|
|
168
|
-
|
|
169
|
-
const synthesizedResult = await runSynthesisAgent(
|
|
104
|
+
const result = await runCodebaseAnalyzer(
|
|
170
105
|
model,
|
|
171
106
|
modelId,
|
|
172
|
-
{
|
|
173
|
-
enrichedContext,
|
|
174
|
-
techResearch,
|
|
175
|
-
mcpServers,
|
|
176
|
-
plan,
|
|
177
|
-
stack: scanResult.stack,
|
|
178
|
-
},
|
|
107
|
+
{ scanResult },
|
|
179
108
|
verbose && !onProgress
|
|
180
109
|
);
|
|
181
110
|
|
|
182
|
-
report('Phase
|
|
111
|
+
report('Phase 1/2: Analyzing codebase', 'complete');
|
|
183
112
|
|
|
184
113
|
// ═══════════════════════════════════════════════════════════════
|
|
185
|
-
// PHASE
|
|
114
|
+
// PHASE 2: MCP Detection (already done in analyzer, just report)
|
|
186
115
|
// ═══════════════════════════════════════════════════════════════
|
|
187
|
-
report('Phase
|
|
116
|
+
report('Phase 2/2: Detecting MCP servers');
|
|
188
117
|
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
modelId,
|
|
192
|
-
synthesizedResult,
|
|
193
|
-
scanResult,
|
|
194
|
-
2, // Max 2 iterations
|
|
195
|
-
verbose && !onProgress
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
report('Phase 4/4: Quality check', 'complete');
|
|
118
|
+
const mcpCount = result.mcpServers.essential.length + result.mcpServers.recommended.length;
|
|
119
|
+
report('Phase 2/2: Detecting MCP servers', `${mcpCount} servers detected`);
|
|
199
120
|
|
|
200
|
-
return
|
|
121
|
+
return result;
|
|
201
122
|
} catch (error) {
|
|
202
|
-
logger.error(`
|
|
123
|
+
logger.error(`Analysis failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
203
124
|
|
|
204
125
|
// Fall back to default result
|
|
205
126
|
return getDefaultMultiAgentAnalysis(scanResult);
|
|
@@ -211,6 +132,7 @@ export async function runMultiAgentAnalysis(
|
|
|
211
132
|
*/
|
|
212
133
|
function getDefaultMultiAgentAnalysis(scanResult: ScanResult): MultiAgentAnalysis {
|
|
213
134
|
const projectType = detectProjectType(scanResult.stack);
|
|
135
|
+
const mcpServers = detectRalphMcpServers(scanResult.stack, projectType);
|
|
214
136
|
|
|
215
137
|
return {
|
|
216
138
|
codebaseAnalysis: {
|
|
@@ -242,29 +164,6 @@ function getDefaultMultiAgentAnalysis(scanResult: ScanResult): MultiAgentAnalysi
|
|
|
242
164
|
documentationHints: ['Check official docs'],
|
|
243
165
|
researchMode: 'knowledge-only',
|
|
244
166
|
},
|
|
245
|
-
mcpServers:
|
|
246
|
-
essential: ['filesystem', 'git', 'playwright'],
|
|
247
|
-
recommended: [],
|
|
248
|
-
},
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Get default enriched context when Context Enricher fails
|
|
254
|
-
*/
|
|
255
|
-
function getDefaultEnrichedContext(scanResult: ScanResult): EnrichedContext {
|
|
256
|
-
const projectType = detectProjectType(scanResult.stack);
|
|
257
|
-
|
|
258
|
-
return {
|
|
259
|
-
entryPoints: ['src/index.ts'],
|
|
260
|
-
keyDirectories: { src: 'Source code' },
|
|
261
|
-
namingConventions: 'camelCase',
|
|
262
|
-
commands: {
|
|
263
|
-
test: 'npm test',
|
|
264
|
-
build: 'npm run build',
|
|
265
|
-
dev: 'npm run dev',
|
|
266
|
-
},
|
|
267
|
-
answeredQuestions: {},
|
|
268
|
-
projectType,
|
|
167
|
+
mcpServers: convertToLegacyMcpRecommendations(mcpServers),
|
|
269
168
|
};
|
|
270
169
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Planning Orchestrator Agent (Phase 1)
|
|
3
3
|
* Creates an analysis plan that guides the parallel workers
|
|
4
|
+
*
|
|
5
|
+
* @deprecated v0.5.0 - No longer used in main pipeline.
|
|
6
|
+
* The unified codebase-analyzer.ts replaces this agent.
|
|
7
|
+
* Kept for backward compatibility and reference.
|
|
4
8
|
*/
|
|
5
9
|
|
|
6
10
|
import { type LanguageModel } from 'ai';
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Synthesis Agent (Phase 3)
|
|
3
3
|
* Merges results from parallel workers and generates implementation guidelines
|
|
4
|
+
*
|
|
5
|
+
* @deprecated v0.5.0 - No longer used in main pipeline.
|
|
6
|
+
* The unified codebase-analyzer.ts outputs directly without synthesis.
|
|
7
|
+
* Kept for backward compatibility and reference.
|
|
4
8
|
*/
|
|
5
9
|
|
|
6
10
|
import { type LanguageModel } from 'ai';
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Tech Researcher Worker (Phase 2)
|
|
3
3
|
* Researches best practices for a specific technology
|
|
4
4
|
* Multiple instances run in parallel via runTechResearchPool
|
|
5
|
+
*
|
|
6
|
+
* @deprecated v0.5.0 - No longer used in main pipeline.
|
|
7
|
+
* Tech research is now handled by the model's built-in knowledge.
|
|
8
|
+
* Kept for backward compatibility and reference.
|
|
5
9
|
*/
|
|
6
10
|
|
|
7
11
|
import { stepCountIs, type LanguageModel, type Tool } from 'ai';
|
package/src/ai/agents/types.ts
CHANGED
|
@@ -255,8 +255,17 @@ export interface OrchestratorInput {
|
|
|
255
255
|
// New Agent Input Types
|
|
256
256
|
// ============================================================
|
|
257
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Input for the Codebase Analyzer (v0.5.0 unified agent)
|
|
260
|
+
*/
|
|
261
|
+
export interface CodebaseAnalyzerInput {
|
|
262
|
+
/** The scan result from the scanner */
|
|
263
|
+
scanResult: ScanResult;
|
|
264
|
+
}
|
|
265
|
+
|
|
258
266
|
/**
|
|
259
267
|
* Input for the Context Enricher worker
|
|
268
|
+
* @deprecated Use CodebaseAnalyzerInput with runCodebaseAnalyzer
|
|
260
269
|
*/
|
|
261
270
|
export interface ContextEnricherInput {
|
|
262
271
|
/** The scan result from the scanner */
|