wiggum-cli 0.5.3 → 0.6.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/README.md +57 -12
- package/dist/ai/conversation/conversation-manager.d.ts +84 -0
- package/dist/ai/conversation/conversation-manager.d.ts.map +1 -0
- package/dist/ai/conversation/conversation-manager.js +159 -0
- package/dist/ai/conversation/conversation-manager.js.map +1 -0
- package/dist/ai/conversation/index.d.ts +8 -0
- package/dist/ai/conversation/index.d.ts.map +1 -0
- package/dist/ai/conversation/index.js +8 -0
- package/dist/ai/conversation/index.js.map +1 -0
- package/dist/ai/conversation/spec-generator.d.ts +62 -0
- package/dist/ai/conversation/spec-generator.d.ts.map +1 -0
- package/dist/ai/conversation/spec-generator.js +267 -0
- package/dist/ai/conversation/spec-generator.js.map +1 -0
- package/dist/ai/conversation/url-fetcher.d.ts +26 -0
- package/dist/ai/conversation/url-fetcher.d.ts.map +1 -0
- package/dist/ai/conversation/url-fetcher.js +145 -0
- package/dist/ai/conversation/url-fetcher.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +44 -34
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +50 -23
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/new.d.ts +11 -1
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +102 -43
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/run.js +3 -3
- package/dist/commands/run.js.map +1 -1
- package/dist/generator/config.d.ts.map +1 -1
- package/dist/generator/config.js +2 -0
- package/dist/generator/config.js.map +1 -1
- package/dist/repl/command-parser.d.ts +79 -0
- package/dist/repl/command-parser.d.ts.map +1 -0
- package/dist/repl/command-parser.js +107 -0
- package/dist/repl/command-parser.js.map +1 -0
- package/dist/repl/index.d.ts +8 -0
- package/dist/repl/index.d.ts.map +1 -0
- package/dist/repl/index.js +8 -0
- package/dist/repl/index.js.map +1 -0
- package/dist/repl/repl-loop.d.ts +30 -0
- package/dist/repl/repl-loop.d.ts.map +1 -0
- package/dist/repl/repl-loop.js +201 -0
- package/dist/repl/repl-loop.js.map +1 -0
- package/dist/repl/session-state.d.ts +35 -0
- package/dist/repl/session-state.d.ts.map +1 -0
- package/dist/repl/session-state.js +25 -0
- package/dist/repl/session-state.js.map +1 -0
- package/package.json +1 -1
- package/src/ai/conversation/conversation-manager.ts +230 -0
- package/src/ai/conversation/index.ts +23 -0
- package/src/ai/conversation/spec-generator.ts +327 -0
- package/src/ai/conversation/url-fetcher.ts +180 -0
- package/src/cli.ts +47 -34
- package/src/commands/init.ts +59 -23
- package/src/commands/new.ts +121 -44
- package/src/commands/run.ts +3 -3
- package/src/generator/config.ts +2 -0
- package/src/repl/command-parser.ts +149 -0
- package/src/repl/index.ts +23 -0
- package/src/repl/repl-loop.ts +269 -0
- package/src/repl/session-state.ts +59 -0
package/README.md
CHANGED
|
@@ -35,11 +35,12 @@ npm install -g wiggum-cli
|
|
|
35
35
|
# 1. Initialize Wiggum in your project
|
|
36
36
|
npx wiggum-cli init
|
|
37
37
|
|
|
38
|
-
# 2. Create a new feature specification
|
|
39
|
-
wiggum new my-feature
|
|
38
|
+
# 2. Create a new feature specification (with AI interview)
|
|
39
|
+
wiggum new my-feature --ai
|
|
40
40
|
|
|
41
|
-
# 3.
|
|
42
|
-
wiggum
|
|
41
|
+
# 3. Or use interactive mode (stays in REPL after init)
|
|
42
|
+
wiggum init -i
|
|
43
|
+
# Then use: /new my-feature, /run my-feature, /help, /exit
|
|
43
44
|
|
|
44
45
|
# 4. Run the feature development loop
|
|
45
46
|
wiggum run my-feature
|
|
@@ -62,6 +63,7 @@ wiggum init [options]
|
|
|
62
63
|
| Flag | Description |
|
|
63
64
|
|------|-------------|
|
|
64
65
|
| `--provider <name>` | AI provider: `anthropic`, `openai`, or `openrouter` (default: `anthropic`) |
|
|
66
|
+
| `-i, --interactive` | Stay in interactive REPL mode after initialization |
|
|
65
67
|
| `-y, --yes` | Accept defaults and skip confirmations |
|
|
66
68
|
|
|
67
69
|
**Examples:**
|
|
@@ -69,6 +71,9 @@ wiggum init [options]
|
|
|
69
71
|
# Initialize with AI analysis (interactive)
|
|
70
72
|
wiggum init
|
|
71
73
|
|
|
74
|
+
# Initialize and enter REPL mode
|
|
75
|
+
wiggum init -i
|
|
76
|
+
|
|
72
77
|
# Initialize with OpenAI provider
|
|
73
78
|
wiggum init --provider openai
|
|
74
79
|
|
|
@@ -143,7 +148,7 @@ wiggum monitor my-feature --bash
|
|
|
143
148
|
|
|
144
149
|
### `wiggum new <feature>`
|
|
145
150
|
|
|
146
|
-
Create a new feature specification from template.
|
|
151
|
+
Create a new feature specification from template or AI-powered interview.
|
|
147
152
|
|
|
148
153
|
```bash
|
|
149
154
|
wiggum new <feature> [options]
|
|
@@ -152,6 +157,9 @@ wiggum new <feature> [options]
|
|
|
152
157
|
**Options:**
|
|
153
158
|
| Flag | Description |
|
|
154
159
|
|------|-------------|
|
|
160
|
+
| `--ai` | Use AI interview to generate the spec |
|
|
161
|
+
| `--provider <name>` | AI provider for spec generation |
|
|
162
|
+
| `--model <model>` | Model to use for AI spec generation |
|
|
155
163
|
| `-e, --edit` | Open in editor after creation |
|
|
156
164
|
| `--editor <editor>` | Editor to use (defaults to `$EDITOR` or `code`) |
|
|
157
165
|
| `-y, --yes` | Skip confirmation prompts |
|
|
@@ -159,7 +167,10 @@ wiggum new <feature> [options]
|
|
|
159
167
|
|
|
160
168
|
**Examples:**
|
|
161
169
|
```bash
|
|
162
|
-
# Create
|
|
170
|
+
# Create spec with AI interview (recommended)
|
|
171
|
+
wiggum new user-dashboard --ai
|
|
172
|
+
|
|
173
|
+
# Create a new spec from template
|
|
163
174
|
wiggum new user-dashboard
|
|
164
175
|
|
|
165
176
|
# Create and open in VS Code
|
|
@@ -172,6 +183,45 @@ wiggum new user-dashboard --edit --editor vim --yes
|
|
|
172
183
|
wiggum new user-dashboard --force
|
|
173
184
|
```
|
|
174
185
|
|
|
186
|
+
**AI Mode (`--ai`):**
|
|
187
|
+
The AI-powered spec generation guides you through a 4-phase interview:
|
|
188
|
+
1. **Context Gathering** - Share reference URLs or files for context
|
|
189
|
+
2. **Goals Discussion** - Describe what you want to build
|
|
190
|
+
3. **Interview** - AI asks clarifying questions (3-5 questions typically)
|
|
191
|
+
4. **Generation** - AI generates a detailed, project-specific specification
|
|
192
|
+
|
|
193
|
+
## Interactive REPL Mode
|
|
194
|
+
|
|
195
|
+
Start an interactive session after initialization with `-i`:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
wiggum init -i
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Once in REPL mode, use slash commands:
|
|
202
|
+
|
|
203
|
+
| Command | Description |
|
|
204
|
+
|---------|-------------|
|
|
205
|
+
| `/new <feature>` | Create a new feature spec (with AI interview) |
|
|
206
|
+
| `/run <feature>` | Run the feature development loop |
|
|
207
|
+
| `/monitor <feature>` | Monitor a running feature |
|
|
208
|
+
| `/help` | Show available commands |
|
|
209
|
+
| `/exit` | Exit the REPL |
|
|
210
|
+
|
|
211
|
+
**Aliases:** `/n`, `/r`, `/m`, `/h`, `/q`
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
wiggum> /new user-dashboard
|
|
215
|
+
# AI interview starts...
|
|
216
|
+
|
|
217
|
+
wiggum> /run user-dashboard
|
|
218
|
+
# Development loop starts...
|
|
219
|
+
|
|
220
|
+
wiggum> /exit
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
175
225
|
## Generated Files Structure
|
|
176
226
|
|
|
177
227
|
After running `wiggum init`, the following structure is created:
|
|
@@ -265,7 +315,7 @@ Wiggum uses a 4-phase multi-agent architecture:
|
|
|
265
315
|
### ralph.config.js
|
|
266
316
|
|
|
267
317
|
```javascript
|
|
268
|
-
|
|
318
|
+
module.exports = {
|
|
269
319
|
// Project paths
|
|
270
320
|
paths: {
|
|
271
321
|
root: '.ralph',
|
|
@@ -281,11 +331,6 @@ export default {
|
|
|
281
331
|
defaultModel: 'sonnet',
|
|
282
332
|
},
|
|
283
333
|
|
|
284
|
-
// AI settings
|
|
285
|
-
ai: {
|
|
286
|
-
provider: 'anthropic',
|
|
287
|
-
},
|
|
288
|
-
|
|
289
334
|
// Detected stack (auto-populated)
|
|
290
335
|
stack: {
|
|
291
336
|
framework: { name: 'Next.js', version: '14.0.0' },
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversation Manager
|
|
3
|
+
* Manages multi-turn AI conversations for spec generation
|
|
4
|
+
*/
|
|
5
|
+
import { type AIProvider } from '../providers.js';
|
|
6
|
+
import type { ScanResult } from '../../scanner/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Conversation message
|
|
9
|
+
*/
|
|
10
|
+
export interface ConversationMessage {
|
|
11
|
+
role: 'user' | 'assistant' | 'system';
|
|
12
|
+
content: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Conversation context
|
|
16
|
+
*/
|
|
17
|
+
export interface ConversationContext {
|
|
18
|
+
codebaseSummary?: string;
|
|
19
|
+
references: Array<{
|
|
20
|
+
source: string;
|
|
21
|
+
content: string;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Conversation manager options
|
|
26
|
+
*/
|
|
27
|
+
export interface ConversationManagerOptions {
|
|
28
|
+
provider: AIProvider;
|
|
29
|
+
model: string;
|
|
30
|
+
systemPrompt?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Manages a multi-turn conversation with an AI model
|
|
34
|
+
*/
|
|
35
|
+
export declare class ConversationManager {
|
|
36
|
+
private messages;
|
|
37
|
+
private context;
|
|
38
|
+
private readonly provider;
|
|
39
|
+
private readonly modelId;
|
|
40
|
+
private readonly systemPrompt;
|
|
41
|
+
constructor(options: ConversationManagerOptions);
|
|
42
|
+
private getDefaultSystemPrompt;
|
|
43
|
+
/**
|
|
44
|
+
* Set codebase context from scan result
|
|
45
|
+
*/
|
|
46
|
+
setCodebaseContext(scanResult: ScanResult): void;
|
|
47
|
+
/**
|
|
48
|
+
* Add a reference document to the context
|
|
49
|
+
*/
|
|
50
|
+
addReference(content: string, source: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Clear all references
|
|
53
|
+
*/
|
|
54
|
+
clearReferences(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Get the current context as a string for inclusion in prompts
|
|
57
|
+
*/
|
|
58
|
+
private getContextString;
|
|
59
|
+
/**
|
|
60
|
+
* Build the full message array for the AI
|
|
61
|
+
*/
|
|
62
|
+
private buildMessages;
|
|
63
|
+
/**
|
|
64
|
+
* Send a message and get a response
|
|
65
|
+
*/
|
|
66
|
+
chat(userMessage: string): Promise<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Send a message and stream the response
|
|
69
|
+
*/
|
|
70
|
+
chatStream(userMessage: string): AsyncIterable<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Get conversation history
|
|
73
|
+
*/
|
|
74
|
+
getHistory(): ConversationMessage[];
|
|
75
|
+
/**
|
|
76
|
+
* Clear conversation history
|
|
77
|
+
*/
|
|
78
|
+
clearHistory(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Add a message to history without sending to AI
|
|
81
|
+
*/
|
|
82
|
+
addToHistory(message: ConversationMessage): void;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=conversation-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-manager.d.ts","sourceRoot":"","sources":["../../../src/ai/conversation/conversation-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAA8B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAUzD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IA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,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI;CAGjD"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversation Manager
|
|
3
|
+
* Manages multi-turn AI conversations for spec generation
|
|
4
|
+
*/
|
|
5
|
+
import { generateText, streamText } from 'ai';
|
|
6
|
+
import { getModel, isReasoningModel } from '../providers.js';
|
|
7
|
+
/**
|
|
8
|
+
* Format scan result into a concise codebase summary
|
|
9
|
+
*/
|
|
10
|
+
function formatCodebaseSummary(scanResult) {
|
|
11
|
+
const { stack } = scanResult;
|
|
12
|
+
const parts = [];
|
|
13
|
+
if (stack.framework) {
|
|
14
|
+
parts.push(`Framework: ${stack.framework.name}${stack.framework.version ? ` v${stack.framework.version}` : ''}`);
|
|
15
|
+
}
|
|
16
|
+
if (stack.testing?.unit) {
|
|
17
|
+
parts.push(`Unit Testing: ${stack.testing.unit.name}`);
|
|
18
|
+
}
|
|
19
|
+
if (stack.testing?.e2e) {
|
|
20
|
+
parts.push(`E2E Testing: ${stack.testing.e2e.name}`);
|
|
21
|
+
}
|
|
22
|
+
if (stack.styling) {
|
|
23
|
+
parts.push(`Styling: ${stack.styling.name}`);
|
|
24
|
+
}
|
|
25
|
+
if (stack.packageManager) {
|
|
26
|
+
parts.push(`Package Manager: ${stack.packageManager.name}`);
|
|
27
|
+
}
|
|
28
|
+
return parts.join('\n');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Manages a multi-turn conversation with an AI model
|
|
32
|
+
*/
|
|
33
|
+
export class ConversationManager {
|
|
34
|
+
messages = [];
|
|
35
|
+
context = { references: [] };
|
|
36
|
+
provider;
|
|
37
|
+
modelId;
|
|
38
|
+
systemPrompt;
|
|
39
|
+
constructor(options) {
|
|
40
|
+
this.provider = options.provider;
|
|
41
|
+
this.modelId = options.model;
|
|
42
|
+
this.systemPrompt = options.systemPrompt || this.getDefaultSystemPrompt();
|
|
43
|
+
}
|
|
44
|
+
getDefaultSystemPrompt() {
|
|
45
|
+
return `You are a helpful assistant that helps developers create feature specifications.
|
|
46
|
+
You ask clarifying questions to understand the user's requirements and then help generate a detailed specification.
|
|
47
|
+
Be concise but thorough. Focus on understanding the user's needs before proposing solutions.`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Set codebase context from scan result
|
|
51
|
+
*/
|
|
52
|
+
setCodebaseContext(scanResult) {
|
|
53
|
+
this.context.codebaseSummary = formatCodebaseSummary(scanResult);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Add a reference document to the context
|
|
57
|
+
*/
|
|
58
|
+
addReference(content, source) {
|
|
59
|
+
this.context.references.push({ source, content });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Clear all references
|
|
63
|
+
*/
|
|
64
|
+
clearReferences() {
|
|
65
|
+
this.context.references = [];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get the current context as a string for inclusion in prompts
|
|
69
|
+
*/
|
|
70
|
+
getContextString() {
|
|
71
|
+
const parts = [];
|
|
72
|
+
if (this.context.codebaseSummary) {
|
|
73
|
+
parts.push(`## Project Tech Stack\n${this.context.codebaseSummary}`);
|
|
74
|
+
}
|
|
75
|
+
if (this.context.references.length > 0) {
|
|
76
|
+
parts.push('## Reference Documents');
|
|
77
|
+
for (const ref of this.context.references) {
|
|
78
|
+
parts.push(`### ${ref.source}\n${ref.content}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return parts.join('\n\n');
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Build the full message array for the AI
|
|
85
|
+
*/
|
|
86
|
+
buildMessages() {
|
|
87
|
+
const contextString = this.getContextString();
|
|
88
|
+
const fullSystemPrompt = contextString
|
|
89
|
+
? `${this.systemPrompt}\n\n${contextString}`
|
|
90
|
+
: this.systemPrompt;
|
|
91
|
+
const aiMessages = [
|
|
92
|
+
{ role: 'system', content: fullSystemPrompt },
|
|
93
|
+
];
|
|
94
|
+
for (const msg of this.messages) {
|
|
95
|
+
if (msg.role === 'user' || msg.role === 'assistant') {
|
|
96
|
+
aiMessages.push({ role: msg.role, content: msg.content });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return aiMessages;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Send a message and get a response
|
|
103
|
+
*/
|
|
104
|
+
async chat(userMessage) {
|
|
105
|
+
// Add user message to history
|
|
106
|
+
this.messages.push({ role: 'user', content: userMessage });
|
|
107
|
+
const { model } = getModel(this.provider, this.modelId);
|
|
108
|
+
const messages = this.buildMessages();
|
|
109
|
+
const result = await generateText({
|
|
110
|
+
model,
|
|
111
|
+
messages,
|
|
112
|
+
...(isReasoningModel(this.modelId) ? {} : { temperature: 0.7 }),
|
|
113
|
+
});
|
|
114
|
+
const assistantMessage = result.text;
|
|
115
|
+
// Add assistant response to history
|
|
116
|
+
this.messages.push({ role: 'assistant', content: assistantMessage });
|
|
117
|
+
return assistantMessage;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Send a message and stream the response
|
|
121
|
+
*/
|
|
122
|
+
async *chatStream(userMessage) {
|
|
123
|
+
// Add user message to history
|
|
124
|
+
this.messages.push({ role: 'user', content: userMessage });
|
|
125
|
+
const { model } = getModel(this.provider, this.modelId);
|
|
126
|
+
const messages = this.buildMessages();
|
|
127
|
+
const result = streamText({
|
|
128
|
+
model,
|
|
129
|
+
messages,
|
|
130
|
+
...(isReasoningModel(this.modelId) ? {} : { temperature: 0.7 }),
|
|
131
|
+
});
|
|
132
|
+
let fullResponse = '';
|
|
133
|
+
for await (const textPart of result.textStream) {
|
|
134
|
+
fullResponse += textPart;
|
|
135
|
+
yield textPart;
|
|
136
|
+
}
|
|
137
|
+
// Add assistant response to history
|
|
138
|
+
this.messages.push({ role: 'assistant', content: fullResponse });
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get conversation history
|
|
142
|
+
*/
|
|
143
|
+
getHistory() {
|
|
144
|
+
return [...this.messages];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Clear conversation history
|
|
148
|
+
*/
|
|
149
|
+
clearHistory() {
|
|
150
|
+
this.messages = [];
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Add a message to history without sending to AI
|
|
154
|
+
*/
|
|
155
|
+
addToHistory(message) {
|
|
156
|
+
this.messages.push(message);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=conversation-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-manager.js","sourceRoot":"","sources":["../../../src/ai/conversation/conversation-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAmB,MAAM,iBAAiB,CAAC;AAoC9E;;GAEG;AACH,SAAS,qBAAqB,CAAC,UAAsB;IACnD,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;IAE7B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACpB,KAAK,CAAC,IAAI,CAAC,cAAc,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACnH,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,gBAAgB,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G,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC;SAChE,CAAC,CAAC;QAEH,IAAI,YAAY,GAAG,EAAE,CAAC;QAEtB,IAAI,KAAK,EAAE,MAAM,QAAQ,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAC/C,YAAY,IAAI,QAAQ,CAAC;YACzB,MAAM,QAAQ,CAAC;QACjB,CAAC;QAED,oCAAoC;QACpC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,YAAY;QACV,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,OAA4B;QACvC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversation Module
|
|
3
|
+
* AI-powered conversation and spec generation
|
|
4
|
+
*/
|
|
5
|
+
export { ConversationManager, type ConversationMessage, type ConversationContext, type ConversationManagerOptions, } from './conversation-manager.js';
|
|
6
|
+
export { SpecGenerator, type SpecGeneratorOptions, } from './spec-generator.js';
|
|
7
|
+
export { fetchContent, fetchMultipleSources, isUrl, type FetchedContent, } from './url-fetcher.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ai/conversation/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,GAChC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,KAAK,cAAc,GACpB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversation Module
|
|
3
|
+
* AI-powered conversation and spec generation
|
|
4
|
+
*/
|
|
5
|
+
export { ConversationManager, } from './conversation-manager.js';
|
|
6
|
+
export { SpecGenerator, } from './spec-generator.js';
|
|
7
|
+
export { fetchContent, fetchMultipleSources, isUrl, } from './url-fetcher.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ai/conversation/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,mBAAmB,GAIpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,aAAa,GAEd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,KAAK,GAEN,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec Generator
|
|
3
|
+
* AI-powered feature specification generator with interview flow
|
|
4
|
+
*/
|
|
5
|
+
import type { AIProvider } from '../providers.js';
|
|
6
|
+
import type { ScanResult } from '../../scanner/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Spec generator options
|
|
9
|
+
*/
|
|
10
|
+
export interface SpecGeneratorOptions {
|
|
11
|
+
featureName: string;
|
|
12
|
+
projectRoot: string;
|
|
13
|
+
provider: AIProvider;
|
|
14
|
+
model: string;
|
|
15
|
+
scanResult?: ScanResult;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Generation phases
|
|
19
|
+
*/
|
|
20
|
+
type GeneratorPhase = 'context' | 'goals' | 'interview' | 'generation' | 'complete';
|
|
21
|
+
/**
|
|
22
|
+
* AI-powered spec generator with interview flow
|
|
23
|
+
*/
|
|
24
|
+
export declare class SpecGenerator {
|
|
25
|
+
private conversation;
|
|
26
|
+
private phase;
|
|
27
|
+
private readonly featureName;
|
|
28
|
+
private readonly projectRoot;
|
|
29
|
+
private generatedSpec;
|
|
30
|
+
constructor(options: SpecGeneratorOptions);
|
|
31
|
+
/**
|
|
32
|
+
* Phase 1: Gather context from URLs/files
|
|
33
|
+
*/
|
|
34
|
+
private gatherContext;
|
|
35
|
+
/**
|
|
36
|
+
* Phase 2: Discuss goals
|
|
37
|
+
*/
|
|
38
|
+
private discussGoals;
|
|
39
|
+
/**
|
|
40
|
+
* Phase 3: Conduct interview
|
|
41
|
+
*/
|
|
42
|
+
private conductInterview;
|
|
43
|
+
/**
|
|
44
|
+
* Phase 4: Generate spec
|
|
45
|
+
*/
|
|
46
|
+
private generateSpec;
|
|
47
|
+
/**
|
|
48
|
+
* Run the full spec generation flow
|
|
49
|
+
* Returns the generated spec or null if cancelled
|
|
50
|
+
*/
|
|
51
|
+
run(): Promise<string | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Get the generated spec
|
|
54
|
+
*/
|
|
55
|
+
getSpec(): string;
|
|
56
|
+
/**
|
|
57
|
+
* Get current phase
|
|
58
|
+
*/
|
|
59
|
+
getPhase(): GeneratorPhase;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=spec-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-generator.d.ts","sourceRoot":"","sources":["../../../src/ai/conversation/spec-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAMzD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,UAAU,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED;;GAEG;AACH,KAAK,cAAc,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AA+EpF;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,aAAa,CAAc;gBAEvB,OAAO,EAAE,oBAAoB;IAezC;;OAEG;YACW,aAAa;IA2B3B;;OAEG;YACW,YAAY;IAgC1B;;OAEG;YACW,gBAAgB;IAgD9B;;OAEG;YACW,YAAY;IAsB1B;;;OAGG;IACG,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAkCnC;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;OAEG;IACH,QAAQ,IAAI,cAAc;CAG3B"}
|