@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
|
@@ -18,6 +18,85 @@ Analyze codebase, detect tech stack, discover business domains, generate domain
|
|
|
18
18
|
|
|
19
19
|
## Workflow
|
|
20
20
|
|
|
21
|
+
### Step 0: Check Prerequisites
|
|
22
|
+
|
|
23
|
+
Before generating agents, ensure we have BOTH:
|
|
24
|
+
1. **Tech stack** (detected from code)
|
|
25
|
+
2. **Product requirements** (from .claude/product/index.md or /agentful-init)
|
|
26
|
+
|
|
27
|
+
**Without both, agent generation is premature.**
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
// Check if product spec exists and has content
|
|
31
|
+
const hasProductSpec = exists('.claude/product/index.md') &&
|
|
32
|
+
Read('.claude/product/index.md').length > 200;
|
|
33
|
+
|
|
34
|
+
// Check if tech stack can be detected
|
|
35
|
+
const canDetectTechStack = exists('package.json') ||
|
|
36
|
+
exists('requirements.txt') ||
|
|
37
|
+
exists('go.mod') ||
|
|
38
|
+
exists('Cargo.toml');
|
|
39
|
+
|
|
40
|
+
if (!hasProductSpec && canDetectTechStack) {
|
|
41
|
+
// Fresh project - need requirements first
|
|
42
|
+
const response = AskUserQuestion({
|
|
43
|
+
question: `
|
|
44
|
+
I detected a fresh project with no product requirements yet.
|
|
45
|
+
|
|
46
|
+
Tech Stack Detected:
|
|
47
|
+
${formatDetectedStack()}
|
|
48
|
+
|
|
49
|
+
To generate specialized agents, I need product requirements:
|
|
50
|
+
- What you're building
|
|
51
|
+
- Key features
|
|
52
|
+
- Business domains
|
|
53
|
+
|
|
54
|
+
Would you like to:
|
|
55
|
+
`,
|
|
56
|
+
options: [
|
|
57
|
+
'Use guided setup (/agentful-init) - recommended',
|
|
58
|
+
'Manually edit .claude/product/index.md first',
|
|
59
|
+
'Generate generic agents anyway (not recommended)'
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
if (response.includes('guided setup')) {
|
|
64
|
+
console.log(`
|
|
65
|
+
Launching guided setup...
|
|
66
|
+
|
|
67
|
+
This will ask 7 quick questions to understand your product.
|
|
68
|
+
`);
|
|
69
|
+
// User should run /agentful-init
|
|
70
|
+
// SlashCommand('/agentful-init');
|
|
71
|
+
return;
|
|
72
|
+
} else if (response.includes('Manually edit')) {
|
|
73
|
+
console.log(`
|
|
74
|
+
Please edit .claude/product/index.md with:
|
|
75
|
+
- Product description
|
|
76
|
+
- Key features
|
|
77
|
+
- Business domains
|
|
78
|
+
|
|
79
|
+
When done, run /agentful-generate again.
|
|
80
|
+
|
|
81
|
+
The PostToolUse hook will auto-detect changes and re-run this command.
|
|
82
|
+
`);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
// Otherwise continue with generic agents (user chose option 3)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!canDetectTechStack && !hasProductSpec) {
|
|
89
|
+
// No tech stack AND no product spec
|
|
90
|
+
throw new Error(`
|
|
91
|
+
❌ Cannot generate agents - missing both tech stack and product requirements.
|
|
92
|
+
|
|
93
|
+
Please either:
|
|
94
|
+
1. Run /agentful-init for guided setup
|
|
95
|
+
2. Ensure you're in a project directory with package.json, requirements.txt, etc.
|
|
96
|
+
`);
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
21
100
|
### Step 1: Detect Tech Stack
|
|
22
101
|
|
|
23
102
|
**Read**: package.json, requirements.txt, pyproject.toml, go.mod, Cargo.toml, prisma/schema.prisma
|
|
@@ -31,6 +110,39 @@ Analyze codebase, detect tech stack, discover business domains, generate domain
|
|
|
31
110
|
|
|
32
111
|
### Step 2: Discover Business Domains
|
|
33
112
|
|
|
113
|
+
#### Option A: From Product Specification (Fresh Projects)
|
|
114
|
+
|
|
115
|
+
If no code exists yet, extract domains from `.claude/product/index.md`:
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
const productSpec = Read('.claude/product/index.md');
|
|
119
|
+
const domains = extractDomainsFromProductSpec(productSpec);
|
|
120
|
+
|
|
121
|
+
// Extract from:
|
|
122
|
+
// - Feature headings: "## Authentication System", "### User Management"
|
|
123
|
+
// - Explicit domain sections: "# Domains", "## Product Domains"
|
|
124
|
+
// - Feature descriptions mentioning domains
|
|
125
|
+
// - Tech stack descriptions (auth, users, billing, etc.)
|
|
126
|
+
|
|
127
|
+
// Example domains found:
|
|
128
|
+
// - authentication (from "Authentication System" feature)
|
|
129
|
+
// - tasks (from "Task Management" features)
|
|
130
|
+
// - users (from "User Profile" features)
|
|
131
|
+
// - payments (from "Payment Processing" feature)
|
|
132
|
+
|
|
133
|
+
console.log(`
|
|
134
|
+
Domains extracted from product specification:
|
|
135
|
+
${domains.map(d => `- ${d.name} (${d.features.length} features)`).join('\n')}
|
|
136
|
+
|
|
137
|
+
Since this is a fresh project (no code yet), using product spec
|
|
138
|
+
as source of truth for domain generation.
|
|
139
|
+
`);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Confidence**: 100% (explicitly defined in product spec)
|
|
143
|
+
|
|
144
|
+
#### Option B: From Existing Code (Active Projects)
|
|
145
|
+
|
|
34
146
|
**Scan**: src/**/*, API routes, services, models, components
|
|
35
147
|
|
|
36
148
|
**Evidence scoring**:
|
|
@@ -44,7 +156,80 @@ Analyze codebase, detect tech stack, discover business domains, generate domain
|
|
|
44
156
|
|
|
45
157
|
**Threshold**: Only generate domain agent if confidence >= 75%
|
|
46
158
|
|
|
47
|
-
|
|
159
|
+
#### Hybrid Approach
|
|
160
|
+
|
|
161
|
+
For projects with both code AND product specs:
|
|
162
|
+
|
|
163
|
+
1. Extract domains from code (Option B)
|
|
164
|
+
2. Extract domains from product spec (Option A)
|
|
165
|
+
3. Merge and reconcile:
|
|
166
|
+
- Code domains take precedence (actual implementation)
|
|
167
|
+
- Product spec domains fill gaps (planned but not built)
|
|
168
|
+
- Flag discrepancies (code exists but not in spec, or vice versa)
|
|
169
|
+
|
|
170
|
+
### Step 3: Research Best Practices
|
|
171
|
+
|
|
172
|
+
**NEW**: Before generating agents, research best practices for the detected stack + product domains.
|
|
173
|
+
|
|
174
|
+
```javascript
|
|
175
|
+
console.log(`
|
|
176
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
177
|
+
Researching Best Practices
|
|
178
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
179
|
+
|
|
180
|
+
Analyzing:
|
|
181
|
+
Tech Stack: ${techStack.join(', ')}
|
|
182
|
+
Product Type: ${productType}
|
|
183
|
+
Domains: ${domains.join(', ')}
|
|
184
|
+
|
|
185
|
+
This takes 30-60 seconds...
|
|
186
|
+
`);
|
|
187
|
+
|
|
188
|
+
// Check if Context7 MCP is available
|
|
189
|
+
const hasContext7 = checkMCPAvailable('context7');
|
|
190
|
+
const researchMethod = hasContext7 ? 'Context7 MCP' : 'WebSearch';
|
|
191
|
+
|
|
192
|
+
console.log(`Research method: ${researchMethod}`);
|
|
193
|
+
|
|
194
|
+
// Research queries
|
|
195
|
+
const researchQueries = [
|
|
196
|
+
`${techStack.framework} best practices ${new Date().getFullYear()}`,
|
|
197
|
+
`${techStack.framework} project structure patterns`,
|
|
198
|
+
`${productType} application architecture`,
|
|
199
|
+
...domains.map(d => `${d} domain implementation patterns`)
|
|
200
|
+
];
|
|
201
|
+
|
|
202
|
+
// Execute research
|
|
203
|
+
const findings = [];
|
|
204
|
+
|
|
205
|
+
for (const query of researchQueries) {
|
|
206
|
+
if (hasContext7) {
|
|
207
|
+
// Use Context7 for more accurate, curated results
|
|
208
|
+
const result = await mcp_context7_search(query);
|
|
209
|
+
findings.push(result);
|
|
210
|
+
} else {
|
|
211
|
+
// Fallback to WebSearch
|
|
212
|
+
const result = await WebSearch({ query });
|
|
213
|
+
findings.push(result);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Synthesize findings
|
|
218
|
+
const synthesis = synthesizeResearch(findings, {
|
|
219
|
+
techStack,
|
|
220
|
+
productType,
|
|
221
|
+
domains
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
console.log(`
|
|
225
|
+
✅ Research Complete
|
|
226
|
+
|
|
227
|
+
Key Findings:
|
|
228
|
+
${formatFindings(synthesis)}
|
|
229
|
+
`);
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Step 4: Plan Generation
|
|
48
233
|
|
|
49
234
|
**Show plan to user**:
|
|
50
235
|
|
|
@@ -79,14 +264,16 @@ Proceed? (y/n)
|
|
|
79
264
|
|
|
80
265
|
**Wait for confirmation before generating.**
|
|
81
266
|
|
|
82
|
-
### Step
|
|
267
|
+
### Step 5: Generate Domain Agents
|
|
83
268
|
|
|
84
269
|
Create `.claude/agents/<domain>.md` for each domain with confidence >= 75%:
|
|
85
270
|
|
|
271
|
+
**IMPORTANT**: Use research findings to inform agent generation.
|
|
272
|
+
|
|
86
273
|
```markdown
|
|
87
274
|
---
|
|
88
275
|
name: <domain>
|
|
89
|
-
description: <Domain> domain - <brief description based on evidence>
|
|
276
|
+
description: <Domain> domain - <brief description based on evidence + research>
|
|
90
277
|
model: sonnet
|
|
91
278
|
tools: Read, Write, Edit, Glob, Grep, Bash
|
|
92
279
|
---
|
|
@@ -94,13 +281,19 @@ tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
94
281
|
# <Domain> Agent
|
|
95
282
|
|
|
96
283
|
## Your Scope
|
|
97
|
-
[List responsibilities based on discovered files]
|
|
284
|
+
[List responsibilities based on discovered files AND research findings]
|
|
98
285
|
|
|
99
286
|
## Domain Structure
|
|
100
287
|
[List actual files discovered - services, controllers, routes, components]
|
|
101
288
|
|
|
102
289
|
## Implementation Guidelines
|
|
103
|
-
[Patterns specific to this domain, derived from existing code]
|
|
290
|
+
[Patterns specific to this domain, derived from existing code + research best practices]
|
|
291
|
+
|
|
292
|
+
**From Research**:
|
|
293
|
+
${synthesis.domainPatterns[domain]}
|
|
294
|
+
|
|
295
|
+
## Best Practices
|
|
296
|
+
[Research findings for this domain type]
|
|
104
297
|
|
|
105
298
|
## Boundaries
|
|
106
299
|
- Handles: [what this agent owns]
|
|
@@ -111,13 +304,16 @@ tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
111
304
|
## Rules
|
|
112
305
|
1. Stay within domain boundaries
|
|
113
306
|
2. Follow existing patterns in this domain
|
|
114
|
-
3.
|
|
307
|
+
3. Apply best practices from research
|
|
308
|
+
4. Coordinate with related domains via clear interfaces
|
|
115
309
|
```
|
|
116
310
|
|
|
117
|
-
### Step
|
|
311
|
+
### Step 6: Generate Tech Skills
|
|
118
312
|
|
|
119
313
|
Create `.claude/skills/<tech>/SKILL.md` for each detected technology:
|
|
120
314
|
|
|
315
|
+
**IMPORTANT**: Incorporate research findings for current best practices.
|
|
316
|
+
|
|
121
317
|
```markdown
|
|
122
318
|
---
|
|
123
319
|
name: <tech>
|
|
@@ -135,20 +331,25 @@ description: <Tech> patterns and best practices for this project
|
|
|
135
331
|
## Common Patterns
|
|
136
332
|
[3-5 patterns with code examples from THIS project's style]
|
|
137
333
|
|
|
138
|
-
## Best Practices
|
|
139
|
-
[
|
|
334
|
+
## Best Practices (${new Date().getFullYear()})
|
|
335
|
+
[Current best practices from research, specific to detected version]
|
|
336
|
+
|
|
337
|
+
${synthesis.techStackPatterns[tech]}
|
|
140
338
|
|
|
141
339
|
## Common Pitfalls
|
|
142
|
-
[What to avoid]
|
|
340
|
+
[What to avoid - from research + project experience]
|
|
143
341
|
|
|
144
342
|
## References
|
|
145
|
-
|
|
343
|
+
- Official docs: [Link]
|
|
344
|
+
- Best practices: [Research sources]
|
|
146
345
|
```
|
|
147
346
|
|
|
148
|
-
### Step
|
|
347
|
+
### Step 7: Create architecture.json
|
|
149
348
|
|
|
150
349
|
Write to `.agentful/architecture.json`:
|
|
151
350
|
|
|
351
|
+
**Include research metadata**:
|
|
352
|
+
|
|
152
353
|
```json
|
|
153
354
|
{
|
|
154
355
|
"techStack": {
|
|
@@ -164,11 +365,17 @@ Write to `.agentful/architecture.json`:
|
|
|
164
365
|
],
|
|
165
366
|
"generatedAgents": ["books", "authors"],
|
|
166
367
|
"generatedSkills": ["react", "express", "prisma", "typescript"],
|
|
167
|
-
"
|
|
368
|
+
"research": {
|
|
369
|
+
"method": "Context7",
|
|
370
|
+
"performedAt": "2026-01-23T00:00:00Z",
|
|
371
|
+
"queriesExecuted": 6,
|
|
372
|
+
"findingsSynthesized": true
|
|
373
|
+
},
|
|
374
|
+
"analyzedAt": "2026-01-23T00:00:00Z"
|
|
168
375
|
}
|
|
169
376
|
```
|
|
170
377
|
|
|
171
|
-
### Step
|
|
378
|
+
### Step 8: Report Results
|
|
172
379
|
|
|
173
380
|
```
|
|
174
381
|
✅ Generation Complete
|