wiggum-cli 0.2.6 → 0.3.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.
Files changed (79) hide show
  1. package/README.md +73 -60
  2. package/dist/ai/agents/codebase-analyst.d.ts +11 -0
  3. package/dist/ai/agents/codebase-analyst.d.ts.map +1 -0
  4. package/dist/ai/agents/codebase-analyst.js +150 -0
  5. package/dist/ai/agents/codebase-analyst.js.map +1 -0
  6. package/dist/ai/agents/index.d.ts +16 -0
  7. package/dist/ai/agents/index.d.ts.map +1 -0
  8. package/dist/ai/agents/index.js +85 -0
  9. package/dist/ai/agents/index.js.map +1 -0
  10. package/dist/ai/agents/orchestrator.d.ts +15 -0
  11. package/dist/ai/agents/orchestrator.d.ts.map +1 -0
  12. package/dist/ai/agents/orchestrator.js +187 -0
  13. package/dist/ai/agents/orchestrator.js.map +1 -0
  14. package/dist/ai/agents/stack-researcher.d.ts +15 -0
  15. package/dist/ai/agents/stack-researcher.d.ts.map +1 -0
  16. package/dist/ai/agents/stack-researcher.js +274 -0
  17. package/dist/ai/agents/stack-researcher.js.map +1 -0
  18. package/dist/ai/agents/types.d.ts +123 -0
  19. package/dist/ai/agents/types.d.ts.map +1 -0
  20. package/dist/ai/agents/types.js +6 -0
  21. package/dist/ai/agents/types.js.map +1 -0
  22. package/dist/ai/enhancer.d.ts +39 -1
  23. package/dist/ai/enhancer.d.ts.map +1 -1
  24. package/dist/ai/enhancer.js +54 -4
  25. package/dist/ai/enhancer.js.map +1 -1
  26. package/dist/ai/index.d.ts +4 -2
  27. package/dist/ai/index.d.ts.map +1 -1
  28. package/dist/ai/index.js +5 -1
  29. package/dist/ai/index.js.map +1 -1
  30. package/dist/ai/prompts.d.ts +2 -2
  31. package/dist/ai/prompts.d.ts.map +1 -1
  32. package/dist/ai/prompts.js +66 -4
  33. package/dist/ai/prompts.js.map +1 -1
  34. package/dist/ai/providers.d.ts +28 -0
  35. package/dist/ai/providers.d.ts.map +1 -1
  36. package/dist/ai/providers.js +40 -0
  37. package/dist/ai/providers.js.map +1 -1
  38. package/dist/ai/tools/context7.d.ts +34 -0
  39. package/dist/ai/tools/context7.d.ts.map +1 -0
  40. package/dist/ai/tools/context7.js +135 -0
  41. package/dist/ai/tools/context7.js.map +1 -0
  42. package/dist/ai/tools/index.d.ts +7 -0
  43. package/dist/ai/tools/index.d.ts.map +1 -0
  44. package/dist/ai/tools/index.js +7 -0
  45. package/dist/ai/tools/index.js.map +1 -0
  46. package/dist/ai/tools/tavily.d.ts +27 -0
  47. package/dist/ai/tools/tavily.d.ts.map +1 -0
  48. package/dist/ai/tools/tavily.js +75 -0
  49. package/dist/ai/tools/tavily.js.map +1 -0
  50. package/dist/cli.d.ts.map +1 -1
  51. package/dist/cli.js +14 -12
  52. package/dist/cli.js.map +1 -1
  53. package/dist/commands/init.d.ts +2 -5
  54. package/dist/commands/init.d.ts.map +1 -1
  55. package/dist/commands/init.js +233 -154
  56. package/dist/commands/init.js.map +1 -1
  57. package/dist/utils/colors.d.ts.map +1 -1
  58. package/dist/utils/colors.js +10 -3
  59. package/dist/utils/colors.js.map +1 -1
  60. package/dist/utils/header.d.ts +1 -1
  61. package/dist/utils/header.js +3 -3
  62. package/dist/utils/header.js.map +1 -1
  63. package/package.json +3 -3
  64. package/src/ai/agents/codebase-analyst.ts +172 -0
  65. package/src/ai/agents/index.ts +147 -0
  66. package/src/ai/agents/orchestrator.ts +222 -0
  67. package/src/ai/agents/stack-researcher.ts +298 -0
  68. package/src/ai/agents/types.ts +132 -0
  69. package/src/ai/enhancer.ts +102 -4
  70. package/src/ai/index.ts +31 -1
  71. package/src/ai/prompts.ts +67 -4
  72. package/src/ai/providers.ts +48 -0
  73. package/src/ai/tools/context7.ts +167 -0
  74. package/src/ai/tools/index.ts +17 -0
  75. package/src/ai/tools/tavily.ts +101 -0
  76. package/src/cli.ts +14 -12
  77. package/src/commands/init.ts +278 -173
  78. package/src/utils/colors.ts +11 -3
  79. package/src/utils/header.ts +3 -3
package/README.md CHANGED
@@ -1,14 +1,21 @@
1
- # ralph-cli
1
+ # wiggum-cli
2
2
 
3
3
  **AI-powered feature development loop CLI** - Auto-detect your tech stack and generate intelligent development environments.
4
4
 
5
5
  ```
6
- ██████╗ █████╗ ██╗ ██████╗ ██╗ ██╗
7
- ██╔══██╗ ██╔══██╗ ██║ ██╔══██╗ ██║ ██║
8
- ██████╔╝ ███████║ ██║ ██████╔╝ ███████║
9
- ██╔══██╗ ██╔══██║ ██║ ██╔═══╝ ██╔══██║
10
- ██║ ██║ ██║ ██║ ███████╗ ██║ ██║ ██║
11
- ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝
6
+ ██╗ ██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ███╗ ███╗
7
+ ██║ ██║ ██║ ██╔════╝ ██╔════╝ ██║ ██║ ████╗ ████║
8
+ ██║ █╗ ██║ ██║ ██║ ███╗ ██║ ███╗ ██║ ██║ ██╔████╔██║
9
+ ██║███╗██║ ██║ ██║ ██║ ██║ ██║ ██║ ██║ ██║╚██╔╝██║
10
+ ╚███╔███╔╝ ██║ ╚██████╔╝ ╚██████╔╝ ╚██████╔╝ ██║ ╚═╝ ██║
11
+ ╚══╝╚══╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
12
+
13
+ ██████╗ ██╗ ██╗
14
+ ██╔════╝ ██║ ██║
15
+ ██║ ██║ ██║
16
+ ██║ ██║ ██║
17
+ ╚██████╗ ███████╗ ██║
18
+ ╚═════╝ ╚══════╝ ╚═╝
12
19
  ```
13
20
  *Simpson Yellow (#FED90F) branding*
14
21
 
@@ -16,68 +23,67 @@
16
23
 
17
24
  ```bash
18
25
  # Initialize in your project (recommended)
19
- npx ralph-cli init
26
+ npx wiggum-cli init
20
27
 
21
28
  # Or install globally
22
- npm install -g ralph-cli
29
+ npm install -g wiggum-cli
23
30
  ```
24
31
 
25
32
  ## Quick Start
26
33
 
27
34
  ```bash
28
- # 1. Initialize Ralph in your project
29
- npx ralph-cli init
35
+ # 1. Initialize Wiggum in your project
36
+ npx wiggum-cli init
30
37
 
31
38
  # 2. Create a new feature specification
32
- ralph new my-feature
39
+ wiggum new my-feature
33
40
 
34
41
  # 3. Edit the spec file (opens in your editor)
35
- ralph new my-feature --edit
42
+ wiggum new my-feature --edit
36
43
 
37
44
  # 4. Run the feature development loop
38
- ralph run my-feature
45
+ wiggum run my-feature
39
46
 
40
47
  # 5. Monitor progress in real-time
41
- ralph monitor my-feature
48
+ wiggum monitor my-feature
42
49
  ```
43
50
 
44
51
  ## Commands
45
52
 
46
- ### `ralph init`
53
+ ### `wiggum init`
47
54
 
48
- Initialize Ralph in the current project. Scans your codebase to detect the tech stack and generates configuration files.
55
+ Initialize Wiggum in the current project. Uses AI to analyze your codebase, detect the tech stack, and generate intelligent configuration files.
49
56
 
50
57
  ```bash
51
- ralph init [options]
58
+ wiggum init [options]
52
59
  ```
53
60
 
54
61
  **Options:**
55
62
  | Flag | Description |
56
63
  |------|-------------|
57
- | `--ai` | Enable AI-enhanced analysis for deeper insights |
58
64
  | `--provider <name>` | AI provider: `anthropic`, `openai`, or `openrouter` (default: `anthropic`) |
59
65
  | `-y, --yes` | Accept defaults and skip confirmations |
60
66
 
61
67
  **Examples:**
62
68
  ```bash
63
- # Basic initialization with interactive prompts
64
- ralph init
69
+ # Initialize with AI analysis (interactive)
70
+ wiggum init
65
71
 
66
- # Initialize with AI enhancement using Anthropic
67
- ralph init --ai
72
+ # Initialize with OpenAI provider
73
+ wiggum init --provider openai
68
74
 
69
- # Initialize with OpenAI provider, skip confirmations
70
- ralph init --ai --provider openai --yes
75
+ # Non-interactive mode (for CI/scripts)
76
+ wiggum init --yes
71
77
  ```
72
78
 
73
79
  ---
74
80
 
75
- ### `ralph run <feature>`
81
+ ### `wiggum run <feature>`
76
82
 
77
83
  Run the feature development loop for a specific feature. Executes the AI-driven implementation workflow.
78
84
 
79
85
  ```bash
80
- ralph run <feature> [options]
86
+ wiggum run <feature> [options]
81
87
  ```
82
88
 
83
89
  **Options:**
@@ -92,26 +98,26 @@ ralph run <feature> [options]
92
98
  **Examples:**
93
99
  ```bash
94
100
  # Run the feature loop
95
- ralph run user-authentication
101
+ wiggum run user-authentication
96
102
 
97
103
  # Run with git worktree isolation
98
- ralph run payment-flow --worktree
104
+ wiggum run payment-flow --worktree
99
105
 
100
106
  # Resume an interrupted session
101
- ralph run payment-flow --resume
107
+ wiggum run payment-flow --resume
102
108
 
103
109
  # Use specific model with iteration limits
104
- ralph run my-feature --model opus --max-iterations 30
110
+ wiggum run my-feature --model opus --max-iterations 30
105
111
  ```
106
112
 
107
113
  ---
108
114
 
109
- ### `ralph monitor <feature>`
115
+ ### `wiggum monitor <feature>`
110
116
 
111
117
  Launch the monitoring dashboard to track feature development progress in real-time.
112
118
 
113
119
  ```bash
114
- ralph monitor <feature> [options]
120
+ wiggum monitor <feature> [options]
115
121
  ```
116
122
 
117
123
  **Options:**
@@ -124,23 +130,23 @@ ralph monitor <feature> [options]
124
130
  **Examples:**
125
131
  ```bash
126
132
  # Monitor with default settings
127
- ralph monitor user-authentication
133
+ wiggum monitor user-authentication
128
134
 
129
135
  # Monitor with faster refresh rate
130
- ralph monitor my-feature --interval 2
136
+ wiggum monitor my-feature --interval 2
131
137
 
132
138
  # Use bash monitor script
133
- ralph monitor my-feature --bash
139
+ wiggum monitor my-feature --bash
134
140
  ```
135
141
 
136
142
  ---
137
143
 
138
- ### `ralph new <feature>`
144
+ ### `wiggum new <feature>`
139
145
 
140
146
  Create a new feature specification from template.
141
147
 
142
148
  ```bash
143
- ralph new <feature> [options]
149
+ wiggum new <feature> [options]
144
150
  ```
145
151
 
146
152
  **Options:**
@@ -154,21 +160,21 @@ ralph new <feature> [options]
154
160
  **Examples:**
155
161
  ```bash
156
162
  # Create a new spec with interactive prompts
157
- ralph new user-dashboard
163
+ wiggum new user-dashboard
158
164
 
159
165
  # Create and open in VS Code
160
- ralph new user-dashboard --edit
166
+ wiggum new user-dashboard --edit
161
167
 
162
168
  # Create with vim, skip confirmations
163
- ralph new user-dashboard --edit --editor vim --yes
169
+ wiggum new user-dashboard --edit --editor vim --yes
164
170
 
165
171
  # Overwrite existing spec
166
- ralph new user-dashboard --force
172
+ wiggum new user-dashboard --force
167
173
  ```
168
174
 
169
175
  ## Generated Files Structure
170
176
 
171
- After running `ralph init`, the following structure is created:
177
+ After running `wiggum init`, the following structure is created:
172
178
 
173
179
  ```
174
180
  .ralph/
@@ -189,7 +195,7 @@ After running `ralph init`, the following structure is created:
189
195
 
190
196
  ## Detection Capabilities
191
197
 
192
- Ralph automatically detects and configures support for:
198
+ Wiggum automatically detects and configures support for:
193
199
 
194
200
  ### Core
195
201
  - **Frameworks:** Next.js (App/Pages Router), React, Vue, Nuxt, Svelte, SvelteKit, Remix, Astro
@@ -224,27 +230,33 @@ Ralph automatically detects and configures support for:
224
230
 
225
231
  ## AI Enhancement
226
232
 
227
- Ralph supports AI-enhanced analysis for deeper project insights:
233
+ Wiggum uses a multi-agent AI system for deep project analysis:
228
234
 
229
235
  ```bash
230
- ralph init --ai --provider anthropic
236
+ wiggum init --provider anthropic
231
237
  ```
232
238
 
233
239
  ### Supported Providers
234
240
 
235
- | Provider | Environment Variable | Description |
236
- |----------|---------------------|-------------|
237
- | Anthropic | `ANTHROPIC_API_KEY` | Claude models (recommended) |
238
- | OpenAI | `OPENAI_API_KEY` | GPT models |
239
- | OpenRouter | `OPENROUTER_API_KEY` | Multiple model providers |
241
+ | Provider | Environment Variable |
242
+ |----------|---------------------|
243
+ | Anthropic | `ANTHROPIC_API_KEY` |
244
+ | OpenAI | `OPENAI_API_KEY` |
245
+ | OpenRouter | `OPENROUTER_API_KEY` |
246
+
247
+ ### Optional Services
248
+
249
+ | Service | Environment Variable | Description |
250
+ |---------|---------------------|-------------|
251
+ | Tavily | `TAVILY_API_KEY` | Web search for current best practices |
252
+ | Context7 | `CONTEXT7_API_KEY` | Documentation lookup for your stack |
240
253
 
241
254
  ### AI Analysis Features
242
255
 
243
- When AI enhancement is enabled, Ralph provides:
244
- - **Architecture Analysis:** Understanding of project structure and patterns
245
- - **Code Quality Insights:** Best practices and potential improvements
246
- - **Dependency Review:** Security and update recommendations
247
- - **Custom Recommendations:** Tailored suggestions for your stack
256
+ Wiggum's multi-agent system provides:
257
+ - **Codebase Analyst:** Explores project structure, entry points, and patterns
258
+ - **Stack Researcher:** Finds best practices, testing tools, and anti-patterns
259
+ - **Orchestrator:** Merges results and recommends MCP servers
248
260
 
249
261
  ## Configuration
250
262
 
@@ -270,7 +282,6 @@ export default {
270
282
  // AI settings
271
283
  ai: {
272
284
  provider: 'anthropic',
273
- enhance: false,
274
285
  },
275
286
 
276
287
  // Detected stack (auto-populated)
@@ -298,6 +309,8 @@ export default {
298
309
  | `ANTHROPIC_API_KEY` | For AI features | Anthropic API key |
299
310
  | `OPENAI_API_KEY` | For OpenAI provider | OpenAI API key |
300
311
  | `OPENROUTER_API_KEY` | For OpenRouter provider | OpenRouter API key |
312
+ | `TAVILY_API_KEY` | Optional | Tavily API key for web search |
313
+ | `CONTEXT7_API_KEY` | Optional | Context7 API key for doc lookup |
301
314
  | `EDITOR` | Optional | Default editor for `--edit` flag |
302
315
  | `DEBUG` | Optional | Enable debug logging |
303
316
 
@@ -309,8 +322,8 @@ Contributions are welcome! Please read our contributing guidelines before submit
309
322
 
310
323
  ```bash
311
324
  # Clone the repository
312
- git clone https://github.com/your-org/ralph-cli.git
313
- cd ralph-cli
325
+ git clone https://github.com/federiconeri/wiggum-cli.git
326
+ cd wiggum-cli
314
327
 
315
328
  # Install dependencies
316
329
  npm install
@@ -338,4 +351,4 @@ MIT License - see [LICENSE](LICENSE) for details.
338
351
 
339
352
  ---
340
353
 
341
- Built with Simpson Yellow (#FED90F) by the Ralph team.
354
+ Built with Simpson Yellow (#FED90F) by the Wiggum team.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Codebase Analyst Agent
3
+ * Explores the codebase to understand its structure and patterns
4
+ */
5
+ import { type LanguageModel } from 'ai';
6
+ import type { CodebaseAnalysis, CodebaseAnalystInput } from './types.js';
7
+ /**
8
+ * Run the Codebase Analyst agent
9
+ */
10
+ export declare function runCodebaseAnalyst(model: LanguageModel, modelId: string, input: CodebaseAnalystInput, verbose?: boolean): Promise<CodebaseAnalysis | null>;
11
+ //# sourceMappingURL=codebase-analyst.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codebase-analyst.d.ts","sourceRoot":"","sources":["../../../src/ai/agents/codebase-analyst.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,IAAI,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA4DzE;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,oBAAoB,EAC3B,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA6BlC"}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Codebase Analyst Agent
3
+ * Explores the codebase to understand its structure and patterns
4
+ */
5
+ import { generateText, stepCountIs } from 'ai';
6
+ import { createExplorationTools } from '../tools.js';
7
+ import { isReasoningModel } from '../providers.js';
8
+ import { logger } from '../../utils/logger.js';
9
+ /**
10
+ * System prompt for the Codebase Analyst agent
11
+ */
12
+ const CODEBASE_ANALYST_SYSTEM_PROMPT = `You are a Codebase Analyst agent. Your job is to thoroughly explore a codebase and produce a structured analysis.
13
+
14
+ ## Your Mission
15
+ Explore the codebase to understand:
16
+ 1. Project structure and entry points
17
+ 2. Key directories and their purposes
18
+ 3. Naming conventions
19
+ 4. Available commands (from package.json)
20
+ 5. The primary project type
21
+
22
+ ## Exploration Strategy
23
+ 1. First, list the root directory to understand project structure
24
+ 2. Read package.json to understand scripts and dependencies
25
+ 3. Search for key patterns: entry points, routes, components
26
+ 4. Identify the PROJECT TYPE:
27
+ - MCP Server: Has @modelcontextprotocol dependencies
28
+ - REST API: Express/Fastify/Hono with route handlers
29
+ - React SPA: React with components, no server-side rendering
30
+ - Next.js App: Next.js with app or pages directory
31
+ - CLI Tool: Has bin entry in package.json
32
+ - Library: Published package without app entry
33
+
34
+ ## Tools Available
35
+ - searchCode: Search using ripgrep patterns
36
+ - readFile: Read file contents
37
+ - listDirectory: List directory structure
38
+ - getPackageInfo: Get package.json info
39
+
40
+ ## Output Format
41
+ After exploration, output ONLY valid JSON with this exact structure:
42
+ {
43
+ "projectContext": {
44
+ "entryPoints": ["src/index.ts"],
45
+ "keyDirectories": {"src/routes": "API routes"},
46
+ "namingConventions": "camelCase files, PascalCase components",
47
+ "projectType": "MCP Server"
48
+ },
49
+ "commands": {
50
+ "test": "npm test",
51
+ "lint": "npm run lint",
52
+ "build": "npm run build",
53
+ "dev": "npm run dev"
54
+ },
55
+ "implementationGuidelines": [
56
+ "Run npm test after changes",
57
+ "Use Zod for validation"
58
+ ],
59
+ "possibleMissedTechnologies": ["Redis"]
60
+ }
61
+
62
+ Keep each guideline to 5-10 words max. Max 7 guidelines.`;
63
+ /**
64
+ * Run the Codebase Analyst agent
65
+ */
66
+ export async function runCodebaseAnalyst(model, modelId, input, verbose = false) {
67
+ const tools = createExplorationTools(input.projectRoot);
68
+ const prompt = `Analyze this codebase and produce a structured analysis.
69
+
70
+ Project: ${input.projectRoot}
71
+
72
+ Start by exploring the directory structure and package.json, then produce your analysis as JSON.`;
73
+ try {
74
+ const result = await generateText({
75
+ model,
76
+ system: CODEBASE_ANALYST_SYSTEM_PROMPT,
77
+ prompt,
78
+ tools,
79
+ stopWhen: stepCountIs(12),
80
+ maxOutputTokens: 3000,
81
+ ...(isReasoningModel(modelId) ? {} : { temperature: 0.3 }),
82
+ });
83
+ // Extract JSON from response
84
+ const analysis = parseCodebaseAnalysis(result.text, result.steps, verbose);
85
+ return analysis;
86
+ }
87
+ catch (error) {
88
+ if (verbose) {
89
+ logger.error(`Codebase Analyst error: ${error instanceof Error ? error.message : String(error)}`);
90
+ }
91
+ return null;
92
+ }
93
+ }
94
+ /**
95
+ * Parse the codebase analysis from agent response
96
+ */
97
+ function parseCodebaseAnalysis(text, steps, verbose) {
98
+ // Try to get text from the result or steps
99
+ let textToParse = text;
100
+ if (!textToParse || textToParse.trim() === '') {
101
+ // Look through steps for text content
102
+ const stepsList = steps || [];
103
+ for (let i = stepsList.length - 1; i >= 0; i--) {
104
+ const step = stepsList[i];
105
+ if (step.text && step.text.trim() !== '') {
106
+ textToParse = step.text;
107
+ break;
108
+ }
109
+ }
110
+ }
111
+ if (!textToParse || textToParse.trim() === '') {
112
+ if (verbose) {
113
+ logger.warn('Codebase Analyst: No text output found');
114
+ }
115
+ return null;
116
+ }
117
+ try {
118
+ // Remove markdown code blocks if present
119
+ let jsonText = textToParse;
120
+ const jsonMatch = textToParse.match(/```(?:json)?\s*([\s\S]*?)```/);
121
+ if (jsonMatch) {
122
+ jsonText = jsonMatch[1];
123
+ }
124
+ // Find JSON object
125
+ const objectMatch = jsonText.match(/\{[\s\S]*\}/);
126
+ if (objectMatch) {
127
+ jsonText = objectMatch[0];
128
+ }
129
+ const parsed = JSON.parse(jsonText);
130
+ // Validate required fields
131
+ if (!parsed.projectContext || !parsed.commands) {
132
+ if (verbose) {
133
+ logger.warn('Codebase Analyst: Missing required fields in response');
134
+ }
135
+ return null;
136
+ }
137
+ // Ensure projectType is set
138
+ if (!parsed.projectContext.projectType) {
139
+ parsed.projectContext.projectType = 'Unknown';
140
+ }
141
+ return parsed;
142
+ }
143
+ catch (error) {
144
+ if (verbose) {
145
+ logger.warn(`Codebase Analyst: Failed to parse JSON - ${error instanceof Error ? error.message : String(error)}`);
146
+ }
147
+ return null;
148
+ }
149
+ }
150
+ //# sourceMappingURL=codebase-analyst.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codebase-analyst.js","sourceRoot":"","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ACnB,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAClD,IAAI,WAAW,EAAE,CAAC;YAChB,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAqB,CAAC;QAExD,2BAA2B;QAC3B,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC/C,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;YACvE,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,4BAA4B;QAC5B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;YACvC,MAAM,CAAC,cAAc,CAAC,WAAW,GAAG,SAAS,CAAC;QAChD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,IAAI,CAAC,4CAA4C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACpH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Agents Index
3
+ * Exports all agent types and functions
4
+ */
5
+ export type { CodebaseAnalysis, StackResearch, McpRecommendations, MultiAgentAnalysis, AgentCapabilities, AgentOptions, CodebaseAnalystInput, StackResearcherInput, OrchestratorInput, } from './types.js';
6
+ export { runCodebaseAnalyst } from './codebase-analyst.js';
7
+ export { runStackResearcher } from './stack-researcher.js';
8
+ export { runOrchestrator, mergeAgentResults } from './orchestrator.js';
9
+ import type { LanguageModel } from 'ai';
10
+ import type { ScanResult } from '../../scanner/types.js';
11
+ import type { MultiAgentAnalysis, AgentOptions } from './types.js';
12
+ /**
13
+ * Run the full multi-agent analysis pipeline
14
+ */
15
+ export declare function runMultiAgentAnalysis(model: LanguageModel, modelId: string, scanResult: ScanResult, options?: AgentOptions): Promise<MultiAgentAnalysis | null>;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ai/agents/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EACV,kBAAkB,EAElB,YAAY,EACb,MAAM,YAAY,CAAC;AAMpB;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAwFpC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Agents Index
3
+ * Exports all agent types and functions
4
+ */
5
+ // Agents
6
+ export { runCodebaseAnalyst } from './codebase-analyst.js';
7
+ export { runStackResearcher } from './stack-researcher.js';
8
+ export { runOrchestrator, mergeAgentResults } from './orchestrator.js';
9
+ import { runCodebaseAnalyst } from './codebase-analyst.js';
10
+ import { runStackResearcher } from './stack-researcher.js';
11
+ import { runOrchestrator, mergeAgentResults } from './orchestrator.js';
12
+ import { logger } from '../../utils/logger.js';
13
+ /**
14
+ * Run the full multi-agent analysis pipeline
15
+ */
16
+ export async function runMultiAgentAnalysis(model, modelId, scanResult, options = {}) {
17
+ const { tavilyApiKey, context7ApiKey, verbose = false } = options;
18
+ // Determine capabilities
19
+ const capabilities = {
20
+ hasTavily: !!tavilyApiKey,
21
+ hasContext7: !!context7ApiKey,
22
+ };
23
+ if (verbose) {
24
+ logger.info('Starting multi-agent analysis...');
25
+ logger.info(`Capabilities: Tavily=${capabilities.hasTavily}, Context7=${capabilities.hasContext7}`);
26
+ }
27
+ // Run Codebase Analyst
28
+ if (verbose) {
29
+ logger.info('Running Codebase Analyst...');
30
+ }
31
+ const codebaseAnalysis = await runCodebaseAnalyst(model, modelId, {
32
+ scanResult,
33
+ projectRoot: scanResult.projectRoot,
34
+ }, verbose);
35
+ if (!codebaseAnalysis) {
36
+ if (verbose) {
37
+ logger.warn('Codebase Analyst failed, using defaults');
38
+ }
39
+ return null;
40
+ }
41
+ // Run Stack Researcher
42
+ if (verbose) {
43
+ logger.info('Running Stack Researcher...');
44
+ }
45
+ const stackResearch = await runStackResearcher(model, modelId, {
46
+ stack: scanResult.stack,
47
+ projectType: codebaseAnalysis.projectContext.projectType,
48
+ capabilities,
49
+ }, { tavilyApiKey, context7ApiKey }, verbose);
50
+ if (!stackResearch) {
51
+ if (verbose) {
52
+ logger.warn('Stack Researcher failed, using defaults');
53
+ }
54
+ // Continue with defaults - stack research is optional
55
+ }
56
+ // Run Orchestrator to merge results
57
+ if (verbose) {
58
+ logger.info('Running Orchestrator...');
59
+ }
60
+ const mcpServers = await runOrchestrator(model, modelId, {
61
+ codebaseAnalysis,
62
+ stackResearch: stackResearch || getDefaultStackResearch(),
63
+ stack: scanResult.stack,
64
+ }, verbose);
65
+ // Merge all results
66
+ const finalResult = mergeAgentResults(codebaseAnalysis, stackResearch || getDefaultStackResearch(), mcpServers);
67
+ if (verbose) {
68
+ logger.info('Multi-agent analysis complete');
69
+ }
70
+ return finalResult;
71
+ }
72
+ /**
73
+ * Get default stack research when agent fails
74
+ */
75
+ function getDefaultStackResearch() {
76
+ return {
77
+ bestPractices: ['Follow project conventions'],
78
+ antiPatterns: ['Avoid skipping tests'],
79
+ testingTools: ['npm test'],
80
+ debuggingTools: ['console.log'],
81
+ documentationHints: ['Check official docs'],
82
+ researchMode: 'knowledge-only',
83
+ };
84
+ }
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ai/agents/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,SAAS;AACT,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAUvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,KAAoB,EACpB,OAAe,EACf,UAAsB,EACtB,UAAwB,EAAE;IAE1B,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAElE,yBAAyB;IACzB,MAAM,YAAY,GAAsB;QACtC,SAAS,EAAE,CAAC,CAAC,YAAY;QACzB,WAAW,EAAE,CAAC,CAAC,cAAc;KAC9B,CAAC;IAEF,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,C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AChB,aAAa,EAAE,aAAa,IAAI,uBAAuB,EAAE;QACzD,KAAK,EAAE,UAAU,CAAC,KAAK;KACxB,EACD,OAAO,CACR,CAAC;IAEF,oBAAoB;IACpB,MAAM,WAAW,GAAG,iBAAiB,CACnC,gBAAgB,EAChB,aAAa,IAAI,uBAAuB,EAAE,EAC1C,UAAU,CACX,CAAC;IAEF,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,uBAAuB;IAC9B,OAAO;QACL,aAAa,EAAE,CAAC,4BAA4B,CAAC;QAC7C,YAAY,EAAE,CAAC,sBAAsB,CAAC;QACtC,YAAY,EAAE,CAAC,UAAU,CAAC;QAC1B,cAAc,EAAE,CAAC,aAAa,CAAC;QAC/B,kBAAkB,EAAE,CAAC,qBAAqB,CAAC;QAC3C,YAAY,EAAE,gBAAyB;KACxC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Orchestrator Agent
3
+ * Coordinates the multi-agent analysis and merges results
4
+ */
5
+ import { type LanguageModel } from 'ai';
6
+ import type { CodebaseAnalysis, StackResearch, MultiAgentAnalysis, McpRecommendations, OrchestratorInput } from './types.js';
7
+ /**
8
+ * Run the Orchestrator to merge results and recommend MCP servers
9
+ */
10
+ export declare function runOrchestrator(model: LanguageModel, modelId: string, input: OrchestratorInput, verbose?: boolean): Promise<McpRecommendations>;
11
+ /**
12
+ * Merge all agent results into a final MultiAgentAnalysis
13
+ */
14
+ export declare function mergeAgentResults(codebaseAnalysis: CodebaseAnalysis, stackResearch: StackResearch, mcpServers: McpRecommendations): MultiAgentAnalysis;
15
+ //# sourceMappingURL=orchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../src/ai/agents/orchestrator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,IAAI,CAAC;AACtD,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AA6CpB;;GAEG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,kBAAkB,CAAC,CAqB7B;AA0HD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,kBAAkB,GAC7B,kBAAkB,CAMpB"}