@itz4blitz/agentful 0.3.0 → 0.5.1
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 +139 -10
- package/bin/cli.js +1032 -48
- package/bin/hooks/README.md +338 -82
- package/bin/hooks/analyze-trigger.js +69 -0
- package/bin/hooks/block-random-docs.js +77 -0
- package/bin/hooks/health-check.js +153 -0
- package/bin/hooks/post-agent.js +101 -0
- package/bin/hooks/post-feature.js +227 -0
- package/bin/hooks/pre-agent.js +118 -0
- package/bin/hooks/pre-feature.js +138 -0
- package/lib/VALIDATION_README.md +455 -0
- package/lib/atomic.js +350 -0
- package/lib/ci/claude-action-integration.js +641 -0
- package/lib/ci/index.js +10 -0
- package/lib/core/CLAUDE_EXECUTOR.md +371 -0
- package/lib/core/README.md +321 -0
- package/lib/core/analyzer.js +497 -0
- package/lib/core/claude-executor.example.js +210 -0
- package/lib/core/claude-executor.js +1046 -0
- package/lib/core/cli.js +141 -0
- package/lib/core/detectors/conventions.js +342 -0
- package/lib/core/detectors/framework.js +276 -0
- package/lib/core/detectors/index.js +15 -0
- package/lib/core/detectors/language.js +199 -0
- package/lib/core/detectors/patterns.js +356 -0
- package/lib/core/generator.js +626 -0
- package/lib/core/index.js +9 -0
- package/lib/core/output-parser.example.js +250 -0
- package/lib/core/output-parser.js +458 -0
- package/lib/core/storage.js +515 -0
- package/lib/core/templates.js +556 -0
- package/lib/index.js +32 -0
- package/lib/init.js +497 -25
- package/lib/pipeline/cli.js +423 -0
- package/lib/pipeline/engine.js +928 -0
- package/lib/pipeline/executor.js +440 -0
- package/lib/pipeline/index.js +33 -0
- package/lib/pipeline/integrations.js +559 -0
- package/lib/pipeline/schemas.js +288 -0
- package/lib/presets.js +207 -0
- package/lib/remote/client.js +361 -0
- package/lib/server/auth.js +286 -0
- package/lib/server/client-example.js +190 -0
- package/lib/server/executor.js +426 -0
- package/lib/server/index.js +469 -0
- package/lib/update-helpers.js +505 -0
- package/lib/validation.js +460 -0
- package/package.json +19 -2
- package/template/.claude/agents/architect.md +260 -0
- package/template/.claude/agents/backend.md +203 -0
- package/template/.claude/agents/fixer.md +244 -0
- package/template/.claude/agents/frontend.md +232 -0
- package/template/.claude/agents/orchestrator.md +528 -0
- package/template/.claude/agents/product-analyzer.md +1130 -0
- package/template/.claude/agents/reviewer.md +229 -0
- package/template/.claude/agents/tester.md +242 -0
- package/{.claude → template/.claude}/commands/agentful-analyze.md +151 -43
- package/template/.claude/commands/agentful-decide.md +470 -0
- package/{.claude → template/.claude}/commands/agentful-product.md +92 -8
- package/template/.claude/commands/agentful-start.md +432 -0
- package/{.claude → template/.claude}/commands/agentful-status.md +88 -3
- package/template/.claude/commands/agentful-update.md +402 -0
- package/template/.claude/commands/agentful-validate.md +369 -0
- package/{.claude → template/.claude}/commands/agentful.md +111 -195
- package/template/.claude/product/EXAMPLES.md +167 -0
- package/{.claude → template/.claude}/settings.json +9 -13
- package/{.claude → template/.claude}/skills/conversation/SKILL.md +13 -7
- package/template/.claude/skills/deployment/SKILL.md +116 -0
- package/template/.claude/skills/product-planning/SKILL.md +463 -0
- package/{.claude → template/.claude}/skills/product-tracking/SKILL.md +10 -21
- package/template/.claude/skills/testing/SKILL.md +228 -0
- package/template/.claude/skills/validation/SKILL.md +650 -0
- package/template/CLAUDE.md +84 -16
- package/template/bin/hooks/block-random-docs.js +121 -0
- package/version.json +1 -1
- package/.claude/agents/architect.md +0 -524
- package/.claude/agents/backend.md +0 -315
- package/.claude/agents/fixer.md +0 -263
- package/.claude/agents/frontend.md +0 -274
- package/.claude/agents/orchestrator.md +0 -283
- package/.claude/agents/product-analyzer.md +0 -799
- package/.claude/agents/reviewer.md +0 -332
- package/.claude/agents/tester.md +0 -410
- package/.claude/commands/agentful-decide.md +0 -214
- package/.claude/commands/agentful-start.md +0 -182
- package/.claude/commands/agentful-validate.md +0 -127
- package/.claude/product/EXAMPLES.md +0 -610
- package/.claude/product/README.md +0 -344
- package/.claude/skills/validation/SKILL.md +0 -271
- package/bin/hooks/analyze-trigger.sh +0 -57
- package/bin/hooks/health-check.sh +0 -36
- package/template/PRODUCT.md +0 -584
- /package/{.claude → template/.claude}/commands/agentful-generate.md +0 -0
- /package/{.claude → template/.claude}/product/index.md +0 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentful-update
|
|
3
|
+
description: Smart update mechanism - fetches latest agentful templates and gracefully migrates changes
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# agentful Update
|
|
7
|
+
|
|
8
|
+
This command updates your local `.claude/` configuration to the latest agentful version while preserving your customizations.
|
|
9
|
+
|
|
10
|
+
## What It Does
|
|
11
|
+
|
|
12
|
+
1. **Fetches latest templates** from npm package `@itz4blitz/agentful`
|
|
13
|
+
2. **Three-way merge analysis** - compares:
|
|
14
|
+
- Your current `.claude/` files (with customizations)
|
|
15
|
+
- Old template version (what you started with)
|
|
16
|
+
- New template version (what's available now)
|
|
17
|
+
3. **Smart migration** using specialized sub-agent
|
|
18
|
+
4. **Validation** to ensure nothing broke
|
|
19
|
+
5. **Backup** with rollback capability
|
|
20
|
+
|
|
21
|
+
## CRITICAL: Do NOT modify .claude/ yourself
|
|
22
|
+
|
|
23
|
+
This command is the ONLY authorized way to update `.claude/` files after initial installation.
|
|
24
|
+
|
|
25
|
+
Other agentful commands should NEVER touch `.claude/` - only this command has permission.
|
|
26
|
+
|
|
27
|
+
## Implementation
|
|
28
|
+
|
|
29
|
+
### 1. Pre-flight Checks
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
// Check if agentful is initialized
|
|
33
|
+
if (!exists('.agentful/state.json')) {
|
|
34
|
+
console.error(`
|
|
35
|
+
❌ agentful not initialized!
|
|
36
|
+
|
|
37
|
+
Run: npx @itz4blitz/agentful init
|
|
38
|
+
|
|
39
|
+
Cannot update before initialization.
|
|
40
|
+
`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Check if .claude/ exists
|
|
45
|
+
if (!exists('.claude/settings.json')) {
|
|
46
|
+
console.error(`
|
|
47
|
+
❌ .claude/ directory missing or corrupted!
|
|
48
|
+
|
|
49
|
+
This might have been deleted accidentally. To restore:
|
|
50
|
+
|
|
51
|
+
1. Reinstall from templates: npx @itz4blitz/agentful init --force
|
|
52
|
+
2. Or restore from backup: cp -r .claude.backup/ .claude/
|
|
53
|
+
|
|
54
|
+
Cannot update without existing .claude/ directory.
|
|
55
|
+
`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Check for git (required for safe updates)
|
|
60
|
+
const gitCheck = Bash("git rev-parse --is-inside-work-tree 2>/dev/null");
|
|
61
|
+
if (!gitCheck.success) {
|
|
62
|
+
console.error(`
|
|
63
|
+
⚠️ Not in a git repository!
|
|
64
|
+
|
|
65
|
+
For safety, agentful-update requires git to track changes.
|
|
66
|
+
|
|
67
|
+
Initialize git first:
|
|
68
|
+
git init
|
|
69
|
+
git add .
|
|
70
|
+
git commit -m "Initial commit"
|
|
71
|
+
|
|
72
|
+
Then run /agentful-update again.
|
|
73
|
+
`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Check for uncommitted changes in .claude/
|
|
78
|
+
const dirtyCheck = Bash("git diff --quiet .claude/ && git diff --cached --quiet .claude/");
|
|
79
|
+
if (!dirtyCheck.success) {
|
|
80
|
+
console.error(`
|
|
81
|
+
⚠️ Uncommitted changes in .claude/
|
|
82
|
+
|
|
83
|
+
Please commit or stash your .claude/ changes before updating:
|
|
84
|
+
|
|
85
|
+
git add .claude/
|
|
86
|
+
git commit -m "Save .claude/ customizations"
|
|
87
|
+
|
|
88
|
+
Or stash:
|
|
89
|
+
git stash push .claude/
|
|
90
|
+
|
|
91
|
+
This ensures we can safely merge updates.
|
|
92
|
+
`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 2. Create Backup
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
101
|
+
const backupDir = `.claude.backup-${timestamp}`;
|
|
102
|
+
|
|
103
|
+
console.log("📦 Creating backup...");
|
|
104
|
+
Bash(`cp -r .claude/ ${backupDir}`);
|
|
105
|
+
|
|
106
|
+
console.log(`✅ Backup created: ${backupDir}`);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 3. Get Latest Templates
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
console.log("🔍 Checking for updates...");
|
|
113
|
+
|
|
114
|
+
// Get current installed version
|
|
115
|
+
const currentVersion = JSON.parse(Read('node_modules/@itz4blitz/agentful/package.json')).version;
|
|
116
|
+
|
|
117
|
+
// Get latest version from npm
|
|
118
|
+
const latestVersionCmd = Bash("npm view @itz4blitz/agentful version");
|
|
119
|
+
const latestVersion = latestVersionCmd.stdout.trim();
|
|
120
|
+
|
|
121
|
+
if (currentVersion === latestVersion) {
|
|
122
|
+
console.log(`✅ Already on latest version (${currentVersion})`);
|
|
123
|
+
|
|
124
|
+
// Still offer to re-sync templates
|
|
125
|
+
console.log(`
|
|
126
|
+
Would you like to re-sync your .claude/ with the current templates?
|
|
127
|
+
This will preserve your customizations but update base files.
|
|
128
|
+
|
|
129
|
+
Reply 'yes' to continue, or 'no' to cancel.
|
|
130
|
+
`);
|
|
131
|
+
|
|
132
|
+
// Wait for user confirmation
|
|
133
|
+
// If no, return early
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
console.log(`📥 Updating from ${currentVersion} to ${latestVersion}...`);
|
|
137
|
+
|
|
138
|
+
// Install latest version
|
|
139
|
+
Bash("npm install @itz4blitz/agentful@latest");
|
|
140
|
+
|
|
141
|
+
console.log("✅ Latest version installed");
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 4. Analyze Differences
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
// Path to new templates
|
|
148
|
+
const templatePath = 'node_modules/@itz4blitz/agentful/template/.claude/';
|
|
149
|
+
|
|
150
|
+
console.log("🔍 Analyzing changes...");
|
|
151
|
+
|
|
152
|
+
// Get list of all template files
|
|
153
|
+
const templateFiles = Bash(`find ${templatePath} -type f -not -path "*/.*"`).stdout
|
|
154
|
+
.split('\n')
|
|
155
|
+
.filter(f => f.trim())
|
|
156
|
+
.map(f => f.replace(templatePath, ''));
|
|
157
|
+
|
|
158
|
+
// Categorize files
|
|
159
|
+
const analysis = {
|
|
160
|
+
new_in_template: [], // Files in new template, not in user's .claude/
|
|
161
|
+
modified_by_user: [], // Files user customized vs old template
|
|
162
|
+
updated_in_template: [], // Files changed in new template
|
|
163
|
+
unchanged: [], // No changes needed
|
|
164
|
+
conflicts: [] // Both user and template modified same file
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
for (const file of templateFiles) {
|
|
168
|
+
const templateFile = `${templatePath}${file}`;
|
|
169
|
+
const userFile = `.claude/${file}`;
|
|
170
|
+
|
|
171
|
+
const userExists = exists(userFile);
|
|
172
|
+
|
|
173
|
+
if (!userExists) {
|
|
174
|
+
// New file in template
|
|
175
|
+
analysis.new_in_template.push(file);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Compare hashes to detect changes
|
|
180
|
+
const templateContent = Read(templateFile);
|
|
181
|
+
const userContent = Read(userFile);
|
|
182
|
+
|
|
183
|
+
if (templateContent === userContent) {
|
|
184
|
+
analysis.unchanged.push(file);
|
|
185
|
+
} else {
|
|
186
|
+
// File differs - need to determine if user customized or template updated
|
|
187
|
+
// For now, mark as potential conflict (we'll handle in migration step)
|
|
188
|
+
analysis.conflicts.push(file);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
console.log(`
|
|
193
|
+
📊 Analysis complete:
|
|
194
|
+
- ${analysis.new_in_template.length} new files in template
|
|
195
|
+
- ${analysis.conflicts.length} files with potential conflicts
|
|
196
|
+
- ${analysis.unchanged.length} files unchanged
|
|
197
|
+
`);
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 5. Delegate to Update Agent
|
|
201
|
+
|
|
202
|
+
```javascript
|
|
203
|
+
console.log("🤖 Launching update agent...");
|
|
204
|
+
|
|
205
|
+
// Use Task tool with specialized update agent
|
|
206
|
+
const updatePrompt = `
|
|
207
|
+
You are the agentful update agent. Your job is to safely migrate .claude/ files from an old template version to a new one while preserving user customizations.
|
|
208
|
+
|
|
209
|
+
## Current State
|
|
210
|
+
|
|
211
|
+
**Backup created**: ${backupDir}
|
|
212
|
+
|
|
213
|
+
**New template files** (${analysis.new_in_template.length}):
|
|
214
|
+
${analysis.new_in_template.map(f => ' - ' + f).join('\n')}
|
|
215
|
+
|
|
216
|
+
**Potential conflicts** (${analysis.conflicts.length}):
|
|
217
|
+
${analysis.conflicts.map(f => ' - ' + f).join('\n')}
|
|
218
|
+
|
|
219
|
+
**Unchanged** (${analysis.unchanged.length} files)
|
|
220
|
+
|
|
221
|
+
## Your Task
|
|
222
|
+
|
|
223
|
+
For each category:
|
|
224
|
+
|
|
225
|
+
### New Files
|
|
226
|
+
- Copy directly from template to .claude/
|
|
227
|
+
- These are new features/improvements
|
|
228
|
+
|
|
229
|
+
### Conflicts
|
|
230
|
+
For each conflicting file:
|
|
231
|
+
1. Read both versions (user's .claude/ and new template)
|
|
232
|
+
2. Identify what changed:
|
|
233
|
+
- If user made cosmetic changes (comments, formatting): keep user's version, log it
|
|
234
|
+
- If template has critical updates (new validation, bug fixes): merge carefully
|
|
235
|
+
- If both have substantial changes: create side-by-side comparison and ask user
|
|
236
|
+
|
|
237
|
+
3. Strategy:
|
|
238
|
+
- **Commands** (agentful-*.md): Usually safe to replace unless user added custom logic
|
|
239
|
+
- **Agents**: Check if user customized. If yes, preserve personality/style but merge new capabilities
|
|
240
|
+
- **Skills**: Usually safe to replace
|
|
241
|
+
- **settings.json**: Merge carefully - preserve user's hooks/customizations
|
|
242
|
+
|
|
243
|
+
### Merge Process
|
|
244
|
+
|
|
245
|
+
Use a git-like approach:
|
|
246
|
+
1. Copy new template file to .claude/
|
|
247
|
+
2. If user had customizations, apply them on top
|
|
248
|
+
3. Mark file with comment: "Updated by /agentful-update on ${new Date().toISOString()}"
|
|
249
|
+
|
|
250
|
+
## Validation
|
|
251
|
+
|
|
252
|
+
After all files are updated:
|
|
253
|
+
1. Run validation to ensure .claude/ is still functional
|
|
254
|
+
2. Test that settings.json is valid JSON
|
|
255
|
+
3. Verify all agent files have required frontmatter
|
|
256
|
+
|
|
257
|
+
## Output
|
|
258
|
+
|
|
259
|
+
Provide a summary:
|
|
260
|
+
- Files added
|
|
261
|
+
- Files updated (with merge strategy used)
|
|
262
|
+
- Files unchanged
|
|
263
|
+
- Any manual review needed
|
|
264
|
+
|
|
265
|
+
## CRITICAL RULES
|
|
266
|
+
|
|
267
|
+
- NEVER delete user's customizations without asking
|
|
268
|
+
- ALWAYS preserve user's hooks in settings.json
|
|
269
|
+
- If uncertain about a merge, ask the user
|
|
270
|
+
- Keep backup directory intact until user confirms success
|
|
271
|
+
`;
|
|
272
|
+
|
|
273
|
+
Task({
|
|
274
|
+
description: "Update .claude/ templates",
|
|
275
|
+
prompt: updatePrompt,
|
|
276
|
+
subagent_type: "general-purpose"
|
|
277
|
+
});
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### 6. Post-Update Validation
|
|
281
|
+
|
|
282
|
+
```javascript
|
|
283
|
+
console.log("✅ Update complete!");
|
|
284
|
+
|
|
285
|
+
console.log(`
|
|
286
|
+
🔍 Running validation...
|
|
287
|
+
`);
|
|
288
|
+
|
|
289
|
+
// Validate settings.json
|
|
290
|
+
try {
|
|
291
|
+
const settings = JSON.parse(Read('.claude/settings.json'));
|
|
292
|
+
console.log(" ✅ settings.json is valid");
|
|
293
|
+
} catch (e) {
|
|
294
|
+
console.error(`
|
|
295
|
+
❌ settings.json is invalid!
|
|
296
|
+
|
|
297
|
+
Error: ${e.message}
|
|
298
|
+
|
|
299
|
+
Restoring from backup...
|
|
300
|
+
`);
|
|
301
|
+
Bash(`cp ${backupDir}/settings.json .claude/settings.json`);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Validate agent files have frontmatter
|
|
306
|
+
const agents = Bash("find .claude/agents -name '*.md'").stdout.split('\n').filter(f => f.trim());
|
|
307
|
+
for (const agent of agents) {
|
|
308
|
+
const content = Read(agent);
|
|
309
|
+
if (!content.startsWith('---')) {
|
|
310
|
+
console.error(`
|
|
311
|
+
❌ ${agent} missing frontmatter!
|
|
312
|
+
|
|
313
|
+
Restoring from backup...
|
|
314
|
+
`);
|
|
315
|
+
Bash(`cp ${backupDir}/${agent.replace('.claude/', '')} ${agent}`);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
console.log(" ✅ All agents valid");
|
|
320
|
+
|
|
321
|
+
console.log(`
|
|
322
|
+
✅ Update successful!
|
|
323
|
+
|
|
324
|
+
Backup preserved at: ${backupDir}
|
|
325
|
+
|
|
326
|
+
To remove backup:
|
|
327
|
+
rm -rf ${backupDir}
|
|
328
|
+
|
|
329
|
+
To rollback:
|
|
330
|
+
rm -rf .claude/
|
|
331
|
+
cp -r ${backupDir} .claude/
|
|
332
|
+
|
|
333
|
+
Next steps:
|
|
334
|
+
1. Review changes: git diff .claude/
|
|
335
|
+
2. Test commands: /agentful-start
|
|
336
|
+
3. If everything works, commit: git add .claude/ && git commit -m "Update agentful to ${latestVersion}"
|
|
337
|
+
`);
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## Rollback Process
|
|
341
|
+
|
|
342
|
+
If update fails or causes issues:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
# Remove broken .claude/
|
|
346
|
+
rm -rf .claude/
|
|
347
|
+
|
|
348
|
+
# Restore from backup
|
|
349
|
+
cp -r .claude.backup-<timestamp> .claude/
|
|
350
|
+
|
|
351
|
+
# Verify
|
|
352
|
+
/agentful-status
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Update Strategies
|
|
356
|
+
|
|
357
|
+
### Aggressive (--force)
|
|
358
|
+
Replace everything with new templates, discarding customizations.
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
/agentful-update --force
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Conservative (default)
|
|
365
|
+
Preserve customizations, only update unchanged files.
|
|
366
|
+
|
|
367
|
+
### Interactive (--interactive)
|
|
368
|
+
Prompt for each file with conflicts.
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
/agentful-update --interactive
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
## Common Scenarios
|
|
375
|
+
|
|
376
|
+
**Scenario: You customized agent personalities**
|
|
377
|
+
→ Update preserves personality while merging new capabilities
|
|
378
|
+
|
|
379
|
+
**Scenario: You added custom commands**
|
|
380
|
+
→ Custom commands preserved, core commands updated
|
|
381
|
+
|
|
382
|
+
**Scenario: You modified settings.json hooks**
|
|
383
|
+
→ Hooks preserved, new settings merged in
|
|
384
|
+
|
|
385
|
+
**Scenario: Template has breaking changes**
|
|
386
|
+
→ Update agent creates migration guide and asks for confirmation
|
|
387
|
+
|
|
388
|
+
## Frequency
|
|
389
|
+
|
|
390
|
+
Check for updates:
|
|
391
|
+
- Monthly for active projects
|
|
392
|
+
- Before major feature work
|
|
393
|
+
- After reporting bugs (fixes might be available)
|
|
394
|
+
|
|
395
|
+
## Compatibility
|
|
396
|
+
|
|
397
|
+
agentful follows semantic versioning:
|
|
398
|
+
- **Patch** (0.5.1 → 0.5.2): Bug fixes, safe to update anytime
|
|
399
|
+
- **Minor** (0.5.0 → 0.6.0): New features, backward compatible
|
|
400
|
+
- **Major** (0.5.0 → 1.0.0): Breaking changes, review carefully
|
|
401
|
+
|
|
402
|
+
The update agent handles version-specific migrations automatically.
|