@itz4blitz/agentful 1.2.0 → 1.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.
- package/README.md +28 -1
- package/bin/cli.js +11 -1055
- package/bin/hooks/block-file-creation.js +271 -0
- package/bin/hooks/product-spec-watcher.js +151 -0
- package/lib/index.js +0 -11
- package/lib/init.js +2 -21
- package/lib/parallel-execution.js +235 -0
- package/lib/presets.js +26 -4
- package/package.json +4 -7
- package/template/.claude/agents/architect.md +2 -2
- package/template/.claude/agents/backend.md +17 -30
- package/template/.claude/agents/frontend.md +17 -39
- package/template/.claude/agents/orchestrator.md +63 -4
- package/template/.claude/agents/product-analyzer.md +1 -1
- package/template/.claude/agents/tester.md +16 -29
- package/template/.claude/commands/agentful-generate.md +221 -14
- package/template/.claude/commands/agentful-init.md +621 -0
- package/template/.claude/commands/agentful-product.md +1 -1
- package/template/.claude/commands/agentful-start.md +99 -1
- package/template/.claude/product/EXAMPLES.md +2 -2
- package/template/.claude/product/index.md +1 -1
- package/template/.claude/settings.json +22 -0
- package/template/.claude/skills/research/SKILL.md +432 -0
- package/template/CLAUDE.md +5 -6
- package/template/bin/hooks/architect-drift-detector.js +242 -0
- package/template/bin/hooks/product-spec-watcher.js +151 -0
- package/version.json +1 -1
- package/bin/hooks/post-agent.js +0 -101
- package/bin/hooks/post-feature.js +0 -227
- package/bin/hooks/pre-agent.js +0 -118
- package/bin/hooks/pre-feature.js +0 -138
- package/lib/VALIDATION_README.md +0 -455
- package/lib/ci/claude-action-integration.js +0 -641
- package/lib/ci/index.js +0 -10
- package/lib/core/analyzer.js +0 -497
- package/lib/core/cli.js +0 -141
- package/lib/core/detectors/conventions.js +0 -342
- package/lib/core/detectors/framework.js +0 -276
- package/lib/core/detectors/index.js +0 -15
- package/lib/core/detectors/language.js +0 -199
- package/lib/core/detectors/patterns.js +0 -356
- package/lib/core/generator.js +0 -626
- package/lib/core/index.js +0 -9
- package/lib/core/output-parser.js +0 -458
- package/lib/core/storage.js +0 -515
- package/lib/core/templates.js +0 -556
- package/lib/pipeline/cli.js +0 -423
- package/lib/pipeline/engine.js +0 -928
- package/lib/pipeline/executor.js +0 -440
- package/lib/pipeline/index.js +0 -33
- package/lib/pipeline/integrations.js +0 -559
- package/lib/pipeline/schemas.js +0 -288
- package/lib/remote/client.js +0 -361
- package/lib/server/auth.js +0 -270
- package/lib/server/client-example.js +0 -190
- package/lib/server/executor.js +0 -477
- package/lib/server/index.js +0 -494
- package/lib/update-helpers.js +0 -505
- package/lib/validation.js +0 -460
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentful-init
|
|
3
|
+
description: Interactive onboarding - 7 guided questions to set up agentful for your project
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /agentful-init
|
|
7
|
+
|
|
8
|
+
Interactive first-time setup for agentful. Collects product requirements through guided questions and auto-generates specialized agents.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- **Fresh project**: No product spec exists yet
|
|
13
|
+
- **New to agentful**: First time using the framework
|
|
14
|
+
- **Quick start**: Want guided setup instead of manual editing
|
|
15
|
+
|
|
16
|
+
## Flow Overview
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
/agentful-init
|
|
20
|
+
↓
|
|
21
|
+
7 Guided Questions (AskUserQuestion)
|
|
22
|
+
↓
|
|
23
|
+
Generate .claude/product/index.md
|
|
24
|
+
↓
|
|
25
|
+
Auto-trigger /agentful-generate
|
|
26
|
+
↓
|
|
27
|
+
Research best practices (Context7/WebSearch)
|
|
28
|
+
↓
|
|
29
|
+
Generate specialized agents + skills
|
|
30
|
+
↓
|
|
31
|
+
Ready for /agentful-start
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Implementation
|
|
35
|
+
|
|
36
|
+
### Step 1: Detect Existing Setup
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
// Check if already initialized
|
|
40
|
+
const hasProductSpec = exists('.claude/product/index.md') &&
|
|
41
|
+
Read('.claude/product/index.md').length > 200;
|
|
42
|
+
const hasAgents = exists('.agentful/architecture.json');
|
|
43
|
+
|
|
44
|
+
if (hasProductSpec && hasAgents) {
|
|
45
|
+
// Already set up - offer to re-run or skip
|
|
46
|
+
const answer = AskUserQuestion({
|
|
47
|
+
question: `agentful is already set up for this project.
|
|
48
|
+
|
|
49
|
+
What would you like to do?`,
|
|
50
|
+
options: [
|
|
51
|
+
'Continue with existing setup',
|
|
52
|
+
'Re-run initialization (will overwrite product spec)',
|
|
53
|
+
'Cancel'
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
if (answer === 'Continue with existing setup') {
|
|
58
|
+
console.log(`
|
|
59
|
+
✅ Keeping existing setup.
|
|
60
|
+
|
|
61
|
+
Current status:
|
|
62
|
+
- Product spec: .claude/product/index.md
|
|
63
|
+
- Generated agents: ${getAgentCount()} agents
|
|
64
|
+
- Tech stack: ${getTechStack()}
|
|
65
|
+
|
|
66
|
+
Run /agentful-start to begin development.
|
|
67
|
+
`);
|
|
68
|
+
return;
|
|
69
|
+
} else if (answer === 'Cancel') {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
// Otherwise continue with re-initialization
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Step 2: Detect Tech Stack
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
// Auto-detect before asking questions
|
|
80
|
+
const techStack = detectTechStack();
|
|
81
|
+
|
|
82
|
+
console.log(`
|
|
83
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
84
|
+
agentful - Interactive Setup
|
|
85
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
86
|
+
|
|
87
|
+
Let's get you set up! I'll ask 7 quick questions to understand your project.
|
|
88
|
+
|
|
89
|
+
Tech Stack Detected:
|
|
90
|
+
${formatTechStack(techStack)}
|
|
91
|
+
|
|
92
|
+
This will take about 5 minutes.
|
|
93
|
+
`);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Step 3: Ask 7 Guided Questions
|
|
97
|
+
|
|
98
|
+
Use `AskUserQuestion` for each question with validation:
|
|
99
|
+
|
|
100
|
+
#### Q1: What are you building?
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
const productDescription = AskUserQuestion({
|
|
104
|
+
question: `
|
|
105
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
106
|
+
Question 1/7: Product Description
|
|
107
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
108
|
+
|
|
109
|
+
What are you building?
|
|
110
|
+
|
|
111
|
+
Describe your product in 1-3 sentences:
|
|
112
|
+
- What problem does it solve?
|
|
113
|
+
- Who is it for?
|
|
114
|
+
- What makes it unique?
|
|
115
|
+
|
|
116
|
+
Example: "A task management app for remote teams that integrates with Slack and automatically prioritizes work based on deadlines and dependencies."
|
|
117
|
+
`,
|
|
118
|
+
// Free-form text input
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Validate response
|
|
122
|
+
if (!productDescription || productDescription.trim().length < 20) {
|
|
123
|
+
throw new Error('Please provide a more detailed description (at least 20 characters)');
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Q2: Tech Stack Confirmation
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
const techStackConfirmation = AskUserQuestion({
|
|
131
|
+
question: `
|
|
132
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
133
|
+
Question 2/7: Tech Stack
|
|
134
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
135
|
+
|
|
136
|
+
I detected this tech stack:
|
|
137
|
+
|
|
138
|
+
${formatTechStack(techStack)}
|
|
139
|
+
|
|
140
|
+
Is this correct?
|
|
141
|
+
`,
|
|
142
|
+
options: ['Yes, correct', 'No, let me specify manually']
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
let finalTechStack = techStack;
|
|
146
|
+
|
|
147
|
+
if (techStackConfirmation === 'No, let me specify manually') {
|
|
148
|
+
// Ask for manual input
|
|
149
|
+
const manualStack = AskUserQuestion({
|
|
150
|
+
question: `
|
|
151
|
+
Please describe your tech stack:
|
|
152
|
+
|
|
153
|
+
Format: Language, Framework, Database, Testing
|
|
154
|
+
Example: TypeScript, Next.js 15, PostgreSQL with Prisma, Vitest
|
|
155
|
+
`,
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
finalTechStack = parseManualTechStack(manualStack);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### Q3: Key Features
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
const features = AskUserQuestion({
|
|
166
|
+
question: `
|
|
167
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
168
|
+
Question 3/7: Key Features
|
|
169
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
170
|
+
|
|
171
|
+
What are the main features you want to build?
|
|
172
|
+
|
|
173
|
+
List 3-10 key features, one per line.
|
|
174
|
+
|
|
175
|
+
Example:
|
|
176
|
+
User authentication with email/password
|
|
177
|
+
Task creation and assignment
|
|
178
|
+
Real-time notifications
|
|
179
|
+
Calendar integration
|
|
180
|
+
Team collaboration spaces
|
|
181
|
+
`,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const featureList = features.split('\n')
|
|
185
|
+
.map(f => f.trim())
|
|
186
|
+
.filter(f => f.length > 0);
|
|
187
|
+
|
|
188
|
+
if (featureList.length < 2) {
|
|
189
|
+
throw new Error('Please provide at least 2 features');
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### Q4: Priority Levels
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
const priorityGuidance = AskUserQuestion({
|
|
197
|
+
question: `
|
|
198
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
199
|
+
Question 4/7: Feature Priorities
|
|
200
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
201
|
+
|
|
202
|
+
I'll assign priority levels to your features.
|
|
203
|
+
|
|
204
|
+
Priority Levels:
|
|
205
|
+
- CRITICAL: Must have for MVP (core value prop)
|
|
206
|
+
- HIGH: Important for launch
|
|
207
|
+
- MEDIUM: Nice to have soon
|
|
208
|
+
- LOW: Future enhancements
|
|
209
|
+
|
|
210
|
+
Should I:
|
|
211
|
+
`,
|
|
212
|
+
options: [
|
|
213
|
+
'Auto-assign priorities based on typical MVP (recommended)',
|
|
214
|
+
'Let me set priorities for each feature manually'
|
|
215
|
+
]
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
let featuresPrioritized = [];
|
|
219
|
+
|
|
220
|
+
if (priorityGuidance.includes('Auto-assign')) {
|
|
221
|
+
// First 2-3 features = CRITICAL, next 3-4 = HIGH, rest = MEDIUM
|
|
222
|
+
featuresPrioritized = autoAssignPriorities(featureList);
|
|
223
|
+
} else {
|
|
224
|
+
// Ask for each feature
|
|
225
|
+
for (const feature of featureList) {
|
|
226
|
+
const priority = AskUserQuestion({
|
|
227
|
+
question: `Priority for "${feature}"?`,
|
|
228
|
+
options: ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW']
|
|
229
|
+
});
|
|
230
|
+
featuresPrioritized.push({ feature, priority });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### Q5: Testing Preferences
|
|
236
|
+
|
|
237
|
+
```javascript
|
|
238
|
+
const testingPreference = AskUserQuestion({
|
|
239
|
+
question: `
|
|
240
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
241
|
+
Question 5/7: Testing Strategy
|
|
242
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
243
|
+
|
|
244
|
+
How should agentful handle testing?
|
|
245
|
+
|
|
246
|
+
agentful automatically ensures:
|
|
247
|
+
- ✅ All tests passing
|
|
248
|
+
- ✅ 80% code coverage minimum
|
|
249
|
+
- ✅ No type errors
|
|
250
|
+
- ✅ Security scans
|
|
251
|
+
|
|
252
|
+
What level of testing do you want?
|
|
253
|
+
`,
|
|
254
|
+
options: [
|
|
255
|
+
'Comprehensive (unit + integration + E2E)',
|
|
256
|
+
'Standard (unit + integration)',
|
|
257
|
+
'Minimal (unit tests only)'
|
|
258
|
+
]
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
const coverageTarget = testingPreference.includes('Comprehensive') ? 85 : 80;
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### Q6: Deployment Target
|
|
265
|
+
|
|
266
|
+
```javascript
|
|
267
|
+
const deploymentTarget = AskUserQuestion({
|
|
268
|
+
question: `
|
|
269
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
270
|
+
Question 6/7: Deployment
|
|
271
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
272
|
+
|
|
273
|
+
Where will this be deployed?
|
|
274
|
+
|
|
275
|
+
This helps optimize build configs and suggest best practices.
|
|
276
|
+
`,
|
|
277
|
+
options: [
|
|
278
|
+
'Vercel',
|
|
279
|
+
'AWS (EC2, Lambda, etc.)',
|
|
280
|
+
'Google Cloud',
|
|
281
|
+
'Docker/Self-hosted',
|
|
282
|
+
'Not sure yet / Multiple targets'
|
|
283
|
+
]
|
|
284
|
+
});
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
#### Q7: Experience Level
|
|
288
|
+
|
|
289
|
+
```javascript
|
|
290
|
+
const experienceLevel = AskUserQuestion({
|
|
291
|
+
question: `
|
|
292
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
293
|
+
Question 7/7: Your Experience
|
|
294
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
295
|
+
|
|
296
|
+
What's your experience level with ${finalTechStack.framework}?
|
|
297
|
+
|
|
298
|
+
This helps me explain decisions and suggest best practices.
|
|
299
|
+
`,
|
|
300
|
+
options: [
|
|
301
|
+
'Expert - I know the internals',
|
|
302
|
+
'Proficient - I build with it regularly',
|
|
303
|
+
'Intermediate - I know the basics',
|
|
304
|
+
'Beginner - First time using this stack'
|
|
305
|
+
]
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
const verbosityLevel = experienceLevel.includes('Beginner') ? 'detailed' :
|
|
309
|
+
experienceLevel.includes('Intermediate') ? 'moderate' :
|
|
310
|
+
'concise';
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Step 4: Generate Product Specification
|
|
314
|
+
|
|
315
|
+
```javascript
|
|
316
|
+
console.log(`
|
|
317
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
318
|
+
Generating Product Specification
|
|
319
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
320
|
+
|
|
321
|
+
Creating .claude/product/index.md...
|
|
322
|
+
`);
|
|
323
|
+
|
|
324
|
+
// Generate structured product spec
|
|
325
|
+
const productSpec = generateProductSpec({
|
|
326
|
+
description: productDescription,
|
|
327
|
+
techStack: finalTechStack,
|
|
328
|
+
features: featuresPrioritized,
|
|
329
|
+
testing: {
|
|
330
|
+
level: testingPreference,
|
|
331
|
+
coverageTarget
|
|
332
|
+
},
|
|
333
|
+
deployment: deploymentTarget,
|
|
334
|
+
verbosity: verbosityLevel
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
// Write to file
|
|
338
|
+
Write('.claude/product/index.md', productSpec);
|
|
339
|
+
|
|
340
|
+
console.log(`✅ Product specification created
|
|
341
|
+
|
|
342
|
+
File: .claude/product/index.md
|
|
343
|
+
Features: ${featureList.length}
|
|
344
|
+
Priorities: ${countByPriority(featuresPrioritized)}
|
|
345
|
+
`);
|
|
346
|
+
|
|
347
|
+
// Save setup progress
|
|
348
|
+
const setupProgress = {
|
|
349
|
+
completed: true,
|
|
350
|
+
timestamp: new Date().toISOString(),
|
|
351
|
+
answers: {
|
|
352
|
+
productDescription,
|
|
353
|
+
techStack: finalTechStack,
|
|
354
|
+
features: featuresPrioritized,
|
|
355
|
+
testing: testingPreference,
|
|
356
|
+
deployment: deploymentTarget,
|
|
357
|
+
experience: experienceLevel
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
Write('.agentful/setup-progress.json', JSON.stringify(setupProgress, null, 2));
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Step 5: Auto-Trigger Research & Generation
|
|
365
|
+
|
|
366
|
+
```javascript
|
|
367
|
+
console.log(`
|
|
368
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
369
|
+
Analyzing & Generating Agents
|
|
370
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
371
|
+
|
|
372
|
+
Now that I understand your product, I'll:
|
|
373
|
+
1. Research best practices for ${finalTechStack.framework}
|
|
374
|
+
2. Research patterns for your domain
|
|
375
|
+
3. Generate specialized agents
|
|
376
|
+
4. Create workflow skills
|
|
377
|
+
|
|
378
|
+
This takes about 30-60 seconds...
|
|
379
|
+
`);
|
|
380
|
+
|
|
381
|
+
// Delegate to architect agent with FULL context
|
|
382
|
+
Task('architect', `
|
|
383
|
+
You have been invoked by /agentful-init after collecting user requirements.
|
|
384
|
+
|
|
385
|
+
Context:
|
|
386
|
+
- Product: ${productDescription}
|
|
387
|
+
- Tech Stack: ${JSON.stringify(finalTechStack)}
|
|
388
|
+
- Features: ${featureList.length} features defined
|
|
389
|
+
- Experience Level: ${experienceLevel}
|
|
390
|
+
|
|
391
|
+
Your tasks:
|
|
392
|
+
1. Research best practices for this tech stack using Context7 MCP or WebSearch
|
|
393
|
+
2. Research domain-specific patterns for the product type
|
|
394
|
+
3. Generate specialized agents tailored to this product
|
|
395
|
+
4. Create skills for the tech stack
|
|
396
|
+
5. Save architecture.json with findings
|
|
397
|
+
|
|
398
|
+
IMPORTANT: You have BOTH tech stack AND product requirements.
|
|
399
|
+
Generate agents specific to the user's actual product domains.
|
|
400
|
+
`);
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Step 6: Completion Message
|
|
404
|
+
|
|
405
|
+
```javascript
|
|
406
|
+
console.log(`
|
|
407
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
408
|
+
✅ Setup Complete!
|
|
409
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
410
|
+
|
|
411
|
+
Your agentful project is ready for autonomous development.
|
|
412
|
+
|
|
413
|
+
What was created:
|
|
414
|
+
📄 .claude/product/index.md (${featureList.length} features)
|
|
415
|
+
🤖 Specialized agents (generated for your domains)
|
|
416
|
+
📚 Tech skills (${finalTechStack.framework}, etc.)
|
|
417
|
+
⚙️ Quality gates (tests, linting, security)
|
|
418
|
+
|
|
419
|
+
Next steps:
|
|
420
|
+
|
|
421
|
+
1. Review your product spec:
|
|
422
|
+
cat .claude/product/index.md
|
|
423
|
+
|
|
424
|
+
2. Start development:
|
|
425
|
+
/agentful-start
|
|
426
|
+
|
|
427
|
+
3. Monitor progress:
|
|
428
|
+
/agentful-status
|
|
429
|
+
|
|
430
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
431
|
+
|
|
432
|
+
Need help? Run /agentful (no arguments) for quick reference.
|
|
433
|
+
`);
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
## Product Spec Template
|
|
437
|
+
|
|
438
|
+
The generated `.claude/product/index.md` should follow this structure:
|
|
439
|
+
|
|
440
|
+
```markdown
|
|
441
|
+
# [Product Name]
|
|
442
|
+
|
|
443
|
+
[Product description from Q1]
|
|
444
|
+
|
|
445
|
+
## Tech Stack
|
|
446
|
+
|
|
447
|
+
- **Language**: [Language]
|
|
448
|
+
- **Framework**: [Framework + Version]
|
|
449
|
+
- **Database**: [Database + ORM]
|
|
450
|
+
- **Testing**: [Testing framework]
|
|
451
|
+
- **Deployment**: [Deployment target]
|
|
452
|
+
|
|
453
|
+
## Features
|
|
454
|
+
|
|
455
|
+
### [Feature 1] - CRITICAL
|
|
456
|
+
[Auto-generated description based on feature name]
|
|
457
|
+
|
|
458
|
+
**Acceptance Criteria**:
|
|
459
|
+
- [ ] [Generated criterion 1]
|
|
460
|
+
- [ ] [Generated criterion 2]
|
|
461
|
+
|
|
462
|
+
**Priority**: CRITICAL
|
|
463
|
+
**Status**: Not started
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
### [Feature 2] - HIGH
|
|
468
|
+
...
|
|
469
|
+
|
|
470
|
+
[Repeat for all features]
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
## Resume Support
|
|
474
|
+
|
|
475
|
+
If initialization is interrupted:
|
|
476
|
+
|
|
477
|
+
```javascript
|
|
478
|
+
if (exists('.agentful/setup-progress.json')) {
|
|
479
|
+
const progress = JSON.parse(Read('.agentful/setup-progress.json'));
|
|
480
|
+
|
|
481
|
+
if (!progress.completed) {
|
|
482
|
+
const resume = AskUserQuestion({
|
|
483
|
+
question: `
|
|
484
|
+
Found incomplete setup from ${progress.timestamp}.
|
|
485
|
+
|
|
486
|
+
Completed so far:
|
|
487
|
+
${formatCompletedSteps(progress)}
|
|
488
|
+
|
|
489
|
+
Would you like to:
|
|
490
|
+
`,
|
|
491
|
+
options: [
|
|
492
|
+
'Resume where I left off',
|
|
493
|
+
'Start over from beginning'
|
|
494
|
+
]
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
if (resume === 'Resume where I left off') {
|
|
498
|
+
return resumeSetup(progress);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
## Error Handling
|
|
505
|
+
|
|
506
|
+
```javascript
|
|
507
|
+
try {
|
|
508
|
+
// Run initialization
|
|
509
|
+
runInit();
|
|
510
|
+
} catch (error) {
|
|
511
|
+
console.error(`
|
|
512
|
+
❌ Setup failed: ${error.message}
|
|
513
|
+
|
|
514
|
+
Your progress has been saved to .agentful/setup-progress.json
|
|
515
|
+
|
|
516
|
+
To retry:
|
|
517
|
+
/agentful-init (will resume where you left off)
|
|
518
|
+
|
|
519
|
+
To start fresh:
|
|
520
|
+
rm .agentful/setup-progress.json
|
|
521
|
+
/agentful-init
|
|
522
|
+
|
|
523
|
+
Need help? https://github.com/itz4blitz/agentful/issues
|
|
524
|
+
`);
|
|
525
|
+
|
|
526
|
+
// Save error state
|
|
527
|
+
const progress = exists('.agentful/setup-progress.json')
|
|
528
|
+
? JSON.parse(Read('.agentful/setup-progress.json'))
|
|
529
|
+
: {};
|
|
530
|
+
|
|
531
|
+
progress.error = {
|
|
532
|
+
message: error.message,
|
|
533
|
+
timestamp: new Date().toISOString()
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
Write('.agentful/setup-progress.json', JSON.stringify(progress, null, 2));
|
|
537
|
+
}
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
## Integration with Existing Commands
|
|
541
|
+
|
|
542
|
+
### Hook: PostToolUse on Product Spec
|
|
543
|
+
|
|
544
|
+
After `Write(.claude/product/index.md)`, auto-trigger analysis if from `/agentful-init`:
|
|
545
|
+
|
|
546
|
+
```javascript
|
|
547
|
+
// In bin/hooks/product-spec-watcher.js
|
|
548
|
+
|
|
549
|
+
const toolUse = JSON.parse(process.env.CLAUDE_TOOL_USE || '{}');
|
|
550
|
+
const filePath = toolUse.parameters?.file_path || '';
|
|
551
|
+
|
|
552
|
+
if (filePath.includes('.claude/product/index.md')) {
|
|
553
|
+
// Check if this came from /agentful-init
|
|
554
|
+
const setupProgress = exists('.agentful/setup-progress.json')
|
|
555
|
+
? JSON.parse(Read('.agentful/setup-progress.json'))
|
|
556
|
+
: null;
|
|
557
|
+
|
|
558
|
+
if (setupProgress && !setupProgress.agents_generated) {
|
|
559
|
+
console.log(`
|
|
560
|
+
✅ Product specification created by /agentful-init
|
|
561
|
+
|
|
562
|
+
Auto-triggering agent generation...
|
|
563
|
+
`);
|
|
564
|
+
|
|
565
|
+
// Trigger /agentful-generate
|
|
566
|
+
// (Implementation depends on Claude Code hook system)
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
## Helper Functions
|
|
572
|
+
|
|
573
|
+
```javascript
|
|
574
|
+
function detectTechStack() {
|
|
575
|
+
// Read package.json, go.mod, requirements.txt, etc.
|
|
576
|
+
// Return structured tech stack object
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function formatTechStack(stack) {
|
|
580
|
+
return `
|
|
581
|
+
- Language: ${stack.language}
|
|
582
|
+
- Framework: ${stack.framework} ${stack.version}
|
|
583
|
+
- Database: ${stack.database}
|
|
584
|
+
- ORM: ${stack.orm}
|
|
585
|
+
- Testing: ${stack.testing}
|
|
586
|
+
`.trim();
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function autoAssignPriorities(features) {
|
|
590
|
+
// First 30% = CRITICAL
|
|
591
|
+
// Next 40% = HIGH
|
|
592
|
+
// Rest = MEDIUM
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function generateProductSpec(config) {
|
|
596
|
+
// Generate markdown following template
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function countByPriority(features) {
|
|
600
|
+
// Count CRITICAL: X, HIGH: Y, etc.
|
|
601
|
+
}
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
## Success Metrics
|
|
605
|
+
|
|
606
|
+
Track in `.agentful/setup-progress.json`:
|
|
607
|
+
|
|
608
|
+
```json
|
|
609
|
+
{
|
|
610
|
+
"completed": true,
|
|
611
|
+
"timestamp": "2026-01-23T00:00:00Z",
|
|
612
|
+
"duration_seconds": 247,
|
|
613
|
+
"questions_answered": 7,
|
|
614
|
+
"features_defined": 8,
|
|
615
|
+
"agents_generated": 5,
|
|
616
|
+
"metrics": {
|
|
617
|
+
"time_to_first_feature": null,
|
|
618
|
+
"setup_completion_rate": 100
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
```
|
|
@@ -103,7 +103,7 @@ Use the project analyzer to scan the codebase and show detected domains:
|
|
|
103
103
|
|
|
104
104
|
Tech Stack detected:
|
|
105
105
|
Language: TypeScript
|
|
106
|
-
Framework: Next.js
|
|
106
|
+
Framework: Next.js 15
|
|
107
107
|
Database: PostgreSQL with Prisma
|
|
108
108
|
|
|
109
109
|
Generate product spec? (y/n): > _______________________________
|