agileflow 2.37.2 → 2.38.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/package.json +1 -1
- package/src/core/agents/api.md +24 -0
- package/src/core/agents/database.md +25 -0
- package/src/core/agents/devops.md +25 -0
- package/src/core/agents/mentor.md +35 -0
- package/src/core/agents/performance.md +25 -0
- package/src/core/agents/refactor.md +25 -0
- package/src/core/agents/security.md +25 -0
- package/src/core/agents/ui.md +24 -0
- package/src/core/commands/babysit.md +56 -0
- package/tools/cli/installers/ide/_base-ide.js +7 -4
- package/tools/cli/installers/ide/claude-code.js +78 -47
package/package.json
CHANGED
package/src/core/agents/api.md
CHANGED
|
@@ -364,6 +364,30 @@ RESEARCH INTEGRATION
|
|
|
364
364
|
- Validation libraries (Zod, Yup, class-validator)
|
|
365
365
|
- External integrations (Stripe, SendGrid, Twilio, etc.)
|
|
366
366
|
|
|
367
|
+
PLAN MODE FOR COMPLEX API WORK
|
|
368
|
+
|
|
369
|
+
**Reference**: `@docs/02-practices/plan-mode.md`
|
|
370
|
+
|
|
371
|
+
Before implementing, evaluate complexity:
|
|
372
|
+
|
|
373
|
+
| Situation | Action |
|
|
374
|
+
|-----------|--------|
|
|
375
|
+
| Simple CRUD endpoint | Just implement it |
|
|
376
|
+
| Schema migration | → `EnterPlanMode` (analyze impact) |
|
|
377
|
+
| New auth pattern | → `EnterPlanMode` (architectural decision) |
|
|
378
|
+
| External integration | → `EnterPlanMode` (research first) |
|
|
379
|
+
| Multi-service changes | → `EnterPlanMode` (coordinate approach) |
|
|
380
|
+
|
|
381
|
+
**Plan Mode Workflow**:
|
|
382
|
+
1. `EnterPlanMode` → Read-only exploration
|
|
383
|
+
2. Explore existing API patterns (routes, middleware, validation)
|
|
384
|
+
3. Design endpoint/schema approach
|
|
385
|
+
4. Present plan with file paths
|
|
386
|
+
5. Get approval → `ExitPlanMode`
|
|
387
|
+
6. Implement
|
|
388
|
+
|
|
389
|
+
**Skip Plan Mode For**: Single endpoint additions following existing patterns, simple CRUD operations, minor bug fixes.
|
|
390
|
+
|
|
367
391
|
WORKFLOW
|
|
368
392
|
1. **[KNOWLEDGE LOADING]** Before implementation:
|
|
369
393
|
- Read CLAUDE.md for project-specific API conventions
|
|
@@ -305,6 +305,31 @@ SLASH COMMANDS
|
|
|
305
305
|
- `/agileflow:impact-analysis` → Analyze impact of schema changes on other tables
|
|
306
306
|
- `/agileflow:status STORY=... STATUS=...` → Update status
|
|
307
307
|
|
|
308
|
+
PLAN MODE FOR DATABASE CHANGES (CRITICAL)
|
|
309
|
+
|
|
310
|
+
**Reference**: `@docs/02-practices/plan-mode.md`
|
|
311
|
+
|
|
312
|
+
**Database changes are high-risk**. Always plan before schema modifications:
|
|
313
|
+
|
|
314
|
+
| Situation | Action |
|
|
315
|
+
|-----------|--------|
|
|
316
|
+
| Simple query optimization | May skip planning |
|
|
317
|
+
| New table/column | → `EnterPlanMode` (design schema) |
|
|
318
|
+
| Schema migration | → `EnterPlanMode` (rollback strategy) |
|
|
319
|
+
| Index changes | → `EnterPlanMode` (analyze query patterns) |
|
|
320
|
+
| Data model refactoring | → `EnterPlanMode` (impact on all queries) |
|
|
321
|
+
|
|
322
|
+
**Plan Mode Workflow**:
|
|
323
|
+
1. `EnterPlanMode` → Read-only exploration
|
|
324
|
+
2. Map current schema and relationships
|
|
325
|
+
3. Identify all queries affected by change
|
|
326
|
+
4. Design migration with rollback strategy
|
|
327
|
+
5. Plan data migration if needed
|
|
328
|
+
6. Present plan → Get approval → `ExitPlanMode`
|
|
329
|
+
7. Implement with reversible migrations
|
|
330
|
+
|
|
331
|
+
**Database Principle**: Schema changes are permanent. Plan twice, migrate once.
|
|
332
|
+
|
|
308
333
|
WORKFLOW
|
|
309
334
|
|
|
310
335
|
1. **[KNOWLEDGE LOADING]**:
|
|
@@ -291,6 +291,31 @@ RESEARCH INTEGRATION
|
|
|
291
291
|
- Monitoring and observability (Prometheus, Grafana, Datadog, Sentry)
|
|
292
292
|
- Infrastructure as Code (Terraform, Pulumi, CloudFormation)
|
|
293
293
|
|
|
294
|
+
PLAN MODE FOR INFRASTRUCTURE CHANGES
|
|
295
|
+
|
|
296
|
+
**Reference**: `@docs/02-practices/plan-mode.md`
|
|
297
|
+
|
|
298
|
+
**Infrastructure changes affect production**. Plan before deploying:
|
|
299
|
+
|
|
300
|
+
| Situation | Action |
|
|
301
|
+
|-----------|--------|
|
|
302
|
+
| Minor config tweak | May skip planning |
|
|
303
|
+
| New CI/CD pipeline | → `EnterPlanMode` (design workflow) |
|
|
304
|
+
| Deployment strategy change | → `EnterPlanMode` (rollback plan) |
|
|
305
|
+
| Infrastructure as Code | → `EnterPlanMode` (terraform plan) |
|
|
306
|
+
| Environment changes | → `EnterPlanMode` (impact analysis) |
|
|
307
|
+
|
|
308
|
+
**Plan Mode Workflow**:
|
|
309
|
+
1. `EnterPlanMode` → Read-only exploration
|
|
310
|
+
2. Map current infrastructure and dependencies
|
|
311
|
+
3. Design change with rollback strategy
|
|
312
|
+
4. Identify blast radius (what breaks if this fails?)
|
|
313
|
+
5. Plan monitoring/alerting for the change
|
|
314
|
+
6. Present plan → Get approval → `ExitPlanMode`
|
|
315
|
+
7. Implement with verification at each step
|
|
316
|
+
|
|
317
|
+
**DevOps Principle**: Infrastructure is cattle, not pets—but still needs planning.
|
|
318
|
+
|
|
294
319
|
WORKFLOW
|
|
295
320
|
1. **[KNOWLEDGE LOADING]** Before implementation:
|
|
296
321
|
- Read CLAUDE.md for project-specific infrastructure setup
|
|
@@ -241,6 +241,41 @@ IMPLEMENTATION FLOW
|
|
|
241
241
|
8. Generate PR body with /agileflow:pr-template command
|
|
242
242
|
9. Suggest syncing docs/context.md and saving research if applicable
|
|
243
243
|
|
|
244
|
+
PLAN MODE FOR COMPLEX IMPLEMENTATIONS
|
|
245
|
+
|
|
246
|
+
**Reference**: `@docs/02-practices/plan-mode.md`
|
|
247
|
+
|
|
248
|
+
Before implementing, evaluate task complexity:
|
|
249
|
+
|
|
250
|
+
| Situation | Action |
|
|
251
|
+
|-----------|--------|
|
|
252
|
+
| Trivial fix (typo, small tweak) | Just do it |
|
|
253
|
+
| Specific instructions given | Follow directly |
|
|
254
|
+
| Research/exploration only | Use Task tool with Explore agent |
|
|
255
|
+
| Complex/multi-file/unclear | → `EnterPlanMode` first |
|
|
256
|
+
|
|
257
|
+
**When to Enter Plan Mode**:
|
|
258
|
+
- New features with multiple valid approaches
|
|
259
|
+
- Multi-file changes or refactoring
|
|
260
|
+
- Architectural decisions (choosing patterns, libraries, approaches)
|
|
261
|
+
- Unclear requirements (need to explore before designing)
|
|
262
|
+
|
|
263
|
+
**Plan Mode Workflow**:
|
|
264
|
+
1. `EnterPlanMode` → Read-only exploration
|
|
265
|
+
2. Explore codebase with Glob, Grep, Read
|
|
266
|
+
3. Design implementation approach
|
|
267
|
+
4. Present plan with file paths and steps
|
|
268
|
+
5. Clarify decisions with user
|
|
269
|
+
6. Get approval → `ExitPlanMode`
|
|
270
|
+
7. Implement the approved plan
|
|
271
|
+
|
|
272
|
+
**Plan Quality Checklist**:
|
|
273
|
+
- [ ] Explored relevant codebase
|
|
274
|
+
- [ ] Identified all files to change
|
|
275
|
+
- [ ] Considered existing patterns
|
|
276
|
+
- [ ] Noted risks/breaking changes
|
|
277
|
+
- [ ] Got user approval
|
|
278
|
+
|
|
244
279
|
AGENT COORDINATION PATTERNS
|
|
245
280
|
|
|
246
281
|
**When to Delegate to Specialized Agents**:
|
|
@@ -308,6 +308,31 @@ SLASH COMMANDS
|
|
|
308
308
|
- `/agileflow:impact-analysis` → Analyze performance impact of changes
|
|
309
309
|
- `/agileflow:status STORY=... STATUS=...` → Update status
|
|
310
310
|
|
|
311
|
+
PLAN MODE FOR PERFORMANCE OPTIMIZATION
|
|
312
|
+
|
|
313
|
+
**Reference**: `@docs/02-practices/plan-mode.md`
|
|
314
|
+
|
|
315
|
+
**Performance work requires measurement first**. Always plan before optimizing:
|
|
316
|
+
|
|
317
|
+
| Situation | Action |
|
|
318
|
+
|-----------|--------|
|
|
319
|
+
| "Make it faster" (vague) | → `EnterPlanMode` (profile first!) |
|
|
320
|
+
| Known bottleneck | → `EnterPlanMode` (design optimization) |
|
|
321
|
+
| Caching implementation | → `EnterPlanMode` (invalidation strategy) |
|
|
322
|
+
| Query optimization | → `EnterPlanMode` (measure before/after) |
|
|
323
|
+
| Bundle size reduction | → `EnterPlanMode` (analyze dependencies) |
|
|
324
|
+
|
|
325
|
+
**Plan Mode Workflow**:
|
|
326
|
+
1. `EnterPlanMode` → Read-only exploration
|
|
327
|
+
2. **Profile first** - measure current performance
|
|
328
|
+
3. Identify actual bottlenecks (not assumptions)
|
|
329
|
+
4. Design optimization with benchmarks
|
|
330
|
+
5. Plan verification (how to prove it's faster?)
|
|
331
|
+
6. Present plan → Get approval → `ExitPlanMode`
|
|
332
|
+
7. Implement, measure, verify improvement
|
|
333
|
+
|
|
334
|
+
**Performance Principle**: Measure, don't guess. Premature optimization is the root of all evil.
|
|
335
|
+
|
|
311
336
|
WORKFLOW
|
|
312
337
|
|
|
313
338
|
1. **[KNOWLEDGE LOADING]**:
|
|
@@ -345,6 +345,31 @@ SLASH COMMANDS
|
|
|
345
345
|
- `/agileflow:impact-analysis` → Analyze impact of refactoring changes
|
|
346
346
|
- `/agileflow:status STORY=... STATUS=...` → Update status
|
|
347
347
|
|
|
348
|
+
PLAN MODE FOR REFACTORING (ALWAYS USE)
|
|
349
|
+
|
|
350
|
+
**Reference**: `@docs/02-practices/plan-mode.md`
|
|
351
|
+
|
|
352
|
+
**Refactoring REQUIRES planning**. Always enter plan mode before refactoring:
|
|
353
|
+
|
|
354
|
+
| Situation | Action |
|
|
355
|
+
|-----------|--------|
|
|
356
|
+
| ANY refactoring work | → `EnterPlanMode` |
|
|
357
|
+
| Rename across codebase | → `EnterPlanMode` (find all usages) |
|
|
358
|
+
| Extract component/function | → `EnterPlanMode` (identify dependencies) |
|
|
359
|
+
| Architectural changes | → `EnterPlanMode` (impact analysis) |
|
|
360
|
+
| Technical debt cleanup | → `EnterPlanMode` (prioritize changes) |
|
|
361
|
+
|
|
362
|
+
**Plan Mode Workflow**:
|
|
363
|
+
1. `EnterPlanMode` → Read-only exploration
|
|
364
|
+
2. Map current architecture and dependencies
|
|
365
|
+
3. Identify all affected files and tests
|
|
366
|
+
4. Design migration path (small, reversible steps)
|
|
367
|
+
5. Note breaking changes and risks
|
|
368
|
+
6. Present plan → Get approval → `ExitPlanMode`
|
|
369
|
+
7. Implement incrementally, verify tests after each step
|
|
370
|
+
|
|
371
|
+
**Refactoring Principle**: Never refactor without a plan. Small changes cascade.
|
|
372
|
+
|
|
348
373
|
WORKFLOW
|
|
349
374
|
|
|
350
375
|
1. **[KNOWLEDGE LOADING]**:
|
|
@@ -303,6 +303,31 @@ AGENT COORDINATION
|
|
|
303
303
|
{"ts":"2025-10-21T10:10:00Z","from":"AG-SECURITY","type":"status","story":"US-0050","text":"Security review complete: 3 high vulnerabilities found in dependency X, recommended updates"}
|
|
304
304
|
```
|
|
305
305
|
|
|
306
|
+
PLAN MODE FOR SECURITY IMPLEMENTATIONS
|
|
307
|
+
|
|
308
|
+
**Reference**: `@docs/02-practices/plan-mode.md`
|
|
309
|
+
|
|
310
|
+
**Security changes require careful planning**. Always plan before implementing:
|
|
311
|
+
|
|
312
|
+
| Situation | Action |
|
|
313
|
+
|-----------|--------|
|
|
314
|
+
| Simple dependency update | May skip planning |
|
|
315
|
+
| New auth mechanism | → `EnterPlanMode` (design security model) |
|
|
316
|
+
| Vulnerability remediation | → `EnterPlanMode` (root cause analysis) |
|
|
317
|
+
| Access control changes | → `EnterPlanMode` (audit impact) |
|
|
318
|
+
| Encryption/secrets handling | → `EnterPlanMode` (key management plan) |
|
|
319
|
+
|
|
320
|
+
**Plan Mode Workflow**:
|
|
321
|
+
1. `EnterPlanMode` → Read-only exploration
|
|
322
|
+
2. Audit current security posture
|
|
323
|
+
3. Identify all attack surfaces affected
|
|
324
|
+
4. Design fix with defense-in-depth approach
|
|
325
|
+
5. Plan verification (how to prove it's secure?)
|
|
326
|
+
6. Present plan → Get approval → `ExitPlanMode`
|
|
327
|
+
7. Implement with security review at each step
|
|
328
|
+
|
|
329
|
+
**Security Principle**: Security is not a feature—it's a property. Plan comprehensively.
|
|
330
|
+
|
|
306
331
|
WORKFLOW
|
|
307
332
|
|
|
308
333
|
1. **[KNOWLEDGE LOADING]** Before review:
|
package/src/core/agents/ui.md
CHANGED
|
@@ -606,6 +606,30 @@ RESEARCH INTEGRATION
|
|
|
606
606
|
- Animation libraries (Framer Motion, React Spring, GSAP)
|
|
607
607
|
- State management for UI (React Context, Zustand, Redux)
|
|
608
608
|
|
|
609
|
+
PLAN MODE FOR COMPLEX UI WORK
|
|
610
|
+
|
|
611
|
+
**Reference**: `@docs/02-practices/plan-mode.md`
|
|
612
|
+
|
|
613
|
+
Before implementing, evaluate complexity:
|
|
614
|
+
|
|
615
|
+
| Situation | Action |
|
|
616
|
+
|-----------|--------|
|
|
617
|
+
| Simple component tweak | Just implement it |
|
|
618
|
+
| New design system pattern | → `EnterPlanMode` (explore existing patterns) |
|
|
619
|
+
| Multi-component feature | → `EnterPlanMode` (plan component hierarchy) |
|
|
620
|
+
| Responsive/accessibility overhaul | → `EnterPlanMode` (audit first) |
|
|
621
|
+
| State management changes | → `EnterPlanMode` (impact analysis) |
|
|
622
|
+
|
|
623
|
+
**Plan Mode Workflow**:
|
|
624
|
+
1. `EnterPlanMode` → Read-only exploration
|
|
625
|
+
2. Explore existing UI patterns (components, styles, state)
|
|
626
|
+
3. Design component structure and props
|
|
627
|
+
4. Present plan with file paths
|
|
628
|
+
5. Get approval → `ExitPlanMode`
|
|
629
|
+
6. Implement
|
|
630
|
+
|
|
631
|
+
**Skip Plan Mode For**: Single component additions following existing patterns, style tweaks, minor bug fixes.
|
|
632
|
+
|
|
609
633
|
WORKFLOW
|
|
610
634
|
1. **[PROACTIVE - First Story Only]** Check for design system (see DESIGN SYSTEM INITIALIZATION section above)
|
|
611
635
|
- If none exists → Ask to create one
|
|
@@ -546,6 +546,62 @@ This ensures the expert loads their mental model before working.
|
|
|
546
546
|
|
|
547
547
|
---
|
|
548
548
|
|
|
549
|
+
PLAN MODE FOR COMPLEX IMPLEMENTATIONS
|
|
550
|
+
|
|
551
|
+
**Reference**: `@docs/02-practices/plan-mode.md`
|
|
552
|
+
|
|
553
|
+
Before implementing features, evaluate complexity to decide whether to plan first or implement directly.
|
|
554
|
+
|
|
555
|
+
**Decision Tree**:
|
|
556
|
+
```
|
|
557
|
+
Is this a trivial fix (typo, obvious bug, small tweak)?
|
|
558
|
+
→ Just do it (no planning needed)
|
|
559
|
+
|
|
560
|
+
Are specific, detailed instructions given?
|
|
561
|
+
→ Follow instructions directly
|
|
562
|
+
|
|
563
|
+
Is this research/exploration only?
|
|
564
|
+
→ Use Task tool with Explore agent (no plan mode)
|
|
565
|
+
|
|
566
|
+
Is this complex, multi-file, or unclear?
|
|
567
|
+
→ EnterPlanMode FIRST
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
**When to Enter Plan Mode**:
|
|
571
|
+
| Trigger | Example |
|
|
572
|
+
|---------|---------|
|
|
573
|
+
| New feature with choices | "Add user authentication" (JWT vs sessions?) |
|
|
574
|
+
| Multiple valid approaches | "Add caching" (Redis vs in-memory?) |
|
|
575
|
+
| Multi-file changes | "Refactor the auth system" |
|
|
576
|
+
| Architectural decisions | "Add real-time updates" (WebSocket vs SSE?) |
|
|
577
|
+
| Unclear requirements | "Make the app faster" |
|
|
578
|
+
|
|
579
|
+
**Plan Mode Workflow**:
|
|
580
|
+
1. `EnterPlanMode` → Switches to read-only exploration
|
|
581
|
+
2. Explore with Glob, Grep, Read (understand codebase)
|
|
582
|
+
3. Design implementation approach
|
|
583
|
+
4. Present plan to user with file paths and steps
|
|
584
|
+
5. Use AskUserQuestion to clarify decisions
|
|
585
|
+
6. Get user approval
|
|
586
|
+
7. `ExitPlanMode` → Resume with write access
|
|
587
|
+
8. Implement the approved plan
|
|
588
|
+
|
|
589
|
+
**Skip Plan Mode For**:
|
|
590
|
+
- Single-line or few-line fixes
|
|
591
|
+
- Adding a single function with clear requirements
|
|
592
|
+
- Tasks where user gave very specific instructions
|
|
593
|
+
- Pure research (use Task tool with Explore agent)
|
|
594
|
+
|
|
595
|
+
**Plan Quality Checklist** (before ExitPlanMode):
|
|
596
|
+
- [ ] Explored relevant parts of codebase
|
|
597
|
+
- [ ] Identified all files that need changes
|
|
598
|
+
- [ ] Considered existing patterns/conventions
|
|
599
|
+
- [ ] Noted potential risks or breaking changes
|
|
600
|
+
- [ ] Presented clear implementation steps
|
|
601
|
+
- [ ] Got explicit user approval
|
|
602
|
+
|
|
603
|
+
---
|
|
604
|
+
|
|
549
605
|
ERROR HANDLING & RECOVERY
|
|
550
606
|
|
|
551
607
|
When things go wrong, diagnose the issue and provide recovery steps. Follow the general recovery pattern:
|
|
@@ -91,10 +91,13 @@ class BaseIdeSetup {
|
|
|
91
91
|
*/
|
|
92
92
|
async cleanup(projectDir) {
|
|
93
93
|
if (this.configDir) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
// Clean up both old (AgileFlow) and new (agileflow) folder names
|
|
95
|
+
for (const folderName of ['agileflow', 'AgileFlow']) {
|
|
96
|
+
const agileflowPath = path.join(projectDir, this.configDir, 'commands', folderName);
|
|
97
|
+
if (await fs.pathExists(agileflowPath)) {
|
|
98
|
+
await fs.remove(agileflowPath);
|
|
99
|
+
console.log(chalk.dim(` Removed old ${folderName} configuration from ${this.displayName}`));
|
|
100
|
+
}
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
}
|
|
@@ -20,80 +20,111 @@ class ClaudeCodeSetup extends BaseIdeSetup {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @param {string}
|
|
25
|
-
* @param {string}
|
|
26
|
-
* @param {
|
|
23
|
+
* Recursively install commands from a source directory
|
|
24
|
+
* @param {string} sourceDir - Source directory path
|
|
25
|
+
* @param {string} targetDir - Target directory path
|
|
26
|
+
* @param {string} agileflowDir - AgileFlow installation directory (for dynamic content)
|
|
27
|
+
* @param {boolean} injectDynamic - Whether to inject dynamic content (only for top-level commands)
|
|
28
|
+
* @returns {Promise<{commands: number, subdirs: number}>} Count of installed items
|
|
27
29
|
*/
|
|
28
|
-
async
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// Clean up old installation first
|
|
32
|
-
await this.cleanup(projectDir);
|
|
30
|
+
async installCommandsRecursive(sourceDir, targetDir, agileflowDir, injectDynamic = false) {
|
|
31
|
+
let commandCount = 0;
|
|
32
|
+
let subdirCount = 0;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const agileflowCommandsDir = path.join(commandsDir, 'AgileFlow');
|
|
34
|
+
if (!(await this.exists(sourceDir))) {
|
|
35
|
+
return { commands: 0, subdirs: 0 };
|
|
36
|
+
}
|
|
38
37
|
|
|
39
|
-
await this.ensureDir(
|
|
38
|
+
await this.ensureDir(targetDir);
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
const commandsSource = path.join(agileflowDir, 'commands');
|
|
43
|
-
let commandCount = 0;
|
|
40
|
+
const entries = await fs.readdir(sourceDir, { withFileTypes: true });
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
const
|
|
42
|
+
for (const entry of entries) {
|
|
43
|
+
const sourcePath = path.join(sourceDir, entry.name);
|
|
44
|
+
const targetPath = path.join(targetDir, entry.name);
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
// Read
|
|
50
|
-
let content = await this.readFile(
|
|
46
|
+
if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
47
|
+
// Read and process .md file
|
|
48
|
+
let content = await this.readFile(sourcePath);
|
|
51
49
|
|
|
52
|
-
// Inject dynamic content (
|
|
53
|
-
|
|
50
|
+
// Inject dynamic content if enabled (for top-level commands)
|
|
51
|
+
if (injectDynamic) {
|
|
52
|
+
content = this.injectDynamicContent(content, agileflowDir);
|
|
53
|
+
}
|
|
54
54
|
|
|
55
55
|
// Replace docs/ references with custom folder name
|
|
56
56
|
content = this.replaceDocsReferences(content);
|
|
57
57
|
|
|
58
|
-
const targetPath = path.join(agileflowCommandsDir, `${command.name}.md`);
|
|
59
58
|
await this.writeFile(targetPath, content);
|
|
60
59
|
commandCount++;
|
|
60
|
+
} else if (entry.isDirectory()) {
|
|
61
|
+
// Recursively process subdirectory
|
|
62
|
+
const subResult = await this.installCommandsRecursive(
|
|
63
|
+
sourcePath,
|
|
64
|
+
targetPath,
|
|
65
|
+
agileflowDir,
|
|
66
|
+
false // Don't inject dynamic content in subdirectories
|
|
67
|
+
);
|
|
68
|
+
commandCount += subResult.commands;
|
|
69
|
+
subdirCount += 1 + subResult.subdirs;
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
await this.ensureDir(agileflowAgentsDir);
|
|
73
|
+
return { commands: commandCount, subdirs: subdirCount };
|
|
74
|
+
}
|
|
67
75
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Setup Claude Code IDE configuration
|
|
78
|
+
* @param {string} projectDir - Project directory
|
|
79
|
+
* @param {string} agileflowDir - AgileFlow installation directory
|
|
80
|
+
* @param {Object} options - Setup options
|
|
81
|
+
*/
|
|
82
|
+
async setup(projectDir, agileflowDir, options = {}) {
|
|
83
|
+
console.log(chalk.hex('#e8683a')(` Setting up ${this.displayName}...`));
|
|
71
84
|
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
// Clean up old installation first
|
|
86
|
+
await this.cleanup(projectDir);
|
|
74
87
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
88
|
+
// Create .claude/commands/agileflow directory
|
|
89
|
+
const claudeDir = path.join(projectDir, this.configDir);
|
|
90
|
+
const commandsDir = path.join(claudeDir, this.commandsDir);
|
|
91
|
+
const agileflowCommandsDir = path.join(commandsDir, 'agileflow');
|
|
78
92
|
|
|
79
|
-
|
|
80
|
-
content = this.replaceDocsReferences(content);
|
|
93
|
+
await this.ensureDir(agileflowCommandsDir);
|
|
81
94
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
// Recursively install all commands (including subdirectories like agents/, session/)
|
|
96
|
+
const commandsSource = path.join(agileflowDir, 'commands');
|
|
97
|
+
const commandResult = await this.installCommandsRecursive(
|
|
98
|
+
commandsSource,
|
|
99
|
+
agileflowCommandsDir,
|
|
100
|
+
agileflowDir,
|
|
101
|
+
true // Inject dynamic content for top-level commands
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
// Also install agents (they're in a separate directory in agileflowDir)
|
|
105
|
+
const agentsSource = path.join(agileflowDir, 'agents');
|
|
106
|
+
const agentsTargetDir = path.join(agileflowCommandsDir, 'agents');
|
|
107
|
+
const agentResult = await this.installCommandsRecursive(
|
|
108
|
+
agentsSource,
|
|
109
|
+
agentsTargetDir,
|
|
110
|
+
agileflowDir,
|
|
111
|
+
false // No dynamic content for agents
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const totalCommands = commandResult.commands + agentResult.commands;
|
|
115
|
+
const totalSubdirs = commandResult.subdirs + (agentResult.commands > 0 ? 1 : 0) + agentResult.subdirs;
|
|
87
116
|
|
|
88
117
|
console.log(chalk.green(` ✓ ${this.displayName} configured:`));
|
|
89
|
-
console.log(chalk.dim(` - ${
|
|
90
|
-
|
|
118
|
+
console.log(chalk.dim(` - ${totalCommands} commands installed`));
|
|
119
|
+
if (totalSubdirs > 0) {
|
|
120
|
+
console.log(chalk.dim(` - ${totalSubdirs} subdirectories`));
|
|
121
|
+
}
|
|
91
122
|
console.log(chalk.dim(` - Path: ${path.relative(projectDir, agileflowCommandsDir)}`));
|
|
92
123
|
|
|
93
124
|
return {
|
|
94
125
|
success: true,
|
|
95
|
-
commands:
|
|
96
|
-
|
|
126
|
+
commands: totalCommands,
|
|
127
|
+
subdirs: totalSubdirs,
|
|
97
128
|
};
|
|
98
129
|
}
|
|
99
130
|
}
|