agileflow 2.77.0 → 2.79.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.
Files changed (128) hide show
  1. package/README.md +6 -6
  2. package/package.json +6 -1
  3. package/scripts/agileflow-configure.js +174 -2
  4. package/scripts/agileflow-statusline.sh +171 -78
  5. package/scripts/agileflow-welcome.js +88 -64
  6. package/scripts/auto-self-improve.js +23 -45
  7. package/scripts/check-update.js +35 -42
  8. package/scripts/damage-control/bash-tool-damage-control.js +257 -0
  9. package/scripts/damage-control/edit-tool-damage-control.js +279 -0
  10. package/scripts/damage-control/patterns.yaml +227 -0
  11. package/scripts/damage-control/write-tool-damage-control.js +274 -0
  12. package/scripts/damage-control-bash.js +232 -0
  13. package/scripts/damage-control-edit.js +243 -0
  14. package/scripts/damage-control-write.js +243 -0
  15. package/scripts/obtain-context.js +22 -3
  16. package/scripts/ralph-loop.js +191 -63
  17. package/scripts/screenshot-verifier.js +213 -0
  18. package/scripts/session-manager.js +12 -33
  19. package/src/core/agents/accessibility.md +124 -53
  20. package/src/core/agents/adr-writer.md +192 -52
  21. package/src/core/agents/analytics.md +139 -60
  22. package/src/core/agents/api.md +173 -63
  23. package/src/core/agents/ci.md +139 -57
  24. package/src/core/agents/compliance.md +159 -68
  25. package/src/core/agents/configuration/damage-control.md +356 -0
  26. package/src/core/agents/configuration-damage-control.md +248 -0
  27. package/src/core/agents/database.md +162 -61
  28. package/src/core/agents/datamigration.md +179 -66
  29. package/src/core/agents/design.md +179 -57
  30. package/src/core/agents/devops.md +160 -3
  31. package/src/core/agents/documentation.md +204 -60
  32. package/src/core/agents/epic-planner.md +147 -55
  33. package/src/core/agents/integrations.md +197 -69
  34. package/src/core/agents/mentor.md +158 -57
  35. package/src/core/agents/mobile.md +159 -67
  36. package/src/core/agents/monitoring.md +154 -65
  37. package/src/core/agents/multi-expert.md +115 -43
  38. package/src/core/agents/orchestrator.md +77 -24
  39. package/src/core/agents/performance.md +130 -75
  40. package/src/core/agents/product.md +151 -55
  41. package/src/core/agents/qa.md +162 -74
  42. package/src/core/agents/readme-updater.md +178 -76
  43. package/src/core/agents/refactor.md +148 -95
  44. package/src/core/agents/research.md +143 -72
  45. package/src/core/agents/security.md +154 -65
  46. package/src/core/agents/testing.md +176 -97
  47. package/src/core/agents/ui.md +170 -79
  48. package/src/core/commands/adr/list.md +171 -0
  49. package/src/core/commands/adr/update.md +235 -0
  50. package/src/core/commands/adr/view.md +252 -0
  51. package/src/core/commands/adr.md +207 -50
  52. package/src/core/commands/agent.md +16 -0
  53. package/src/core/commands/assign.md +148 -44
  54. package/src/core/commands/auto.md +18 -1
  55. package/src/core/commands/babysit.md +391 -38
  56. package/src/core/commands/baseline.md +14 -0
  57. package/src/core/commands/blockers.md +170 -51
  58. package/src/core/commands/board.md +144 -66
  59. package/src/core/commands/changelog.md +15 -0
  60. package/src/core/commands/ci.md +179 -69
  61. package/src/core/commands/compress.md +18 -0
  62. package/src/core/commands/configure.md +16 -0
  63. package/src/core/commands/context/export.md +193 -4
  64. package/src/core/commands/context/full.md +191 -18
  65. package/src/core/commands/context/note.md +248 -4
  66. package/src/core/commands/debt.md +17 -0
  67. package/src/core/commands/deploy.md +208 -65
  68. package/src/core/commands/deps.md +15 -0
  69. package/src/core/commands/diagnose.md +16 -0
  70. package/src/core/commands/docs.md +196 -64
  71. package/src/core/commands/epic/list.md +170 -0
  72. package/src/core/commands/epic/view.md +242 -0
  73. package/src/core/commands/epic.md +192 -69
  74. package/src/core/commands/feedback.md +191 -71
  75. package/src/core/commands/handoff.md +162 -48
  76. package/src/core/commands/help.md +9 -0
  77. package/src/core/commands/ideate.md +446 -0
  78. package/src/core/commands/impact.md +16 -0
  79. package/src/core/commands/metrics.md +141 -37
  80. package/src/core/commands/multi-expert.md +77 -0
  81. package/src/core/commands/packages.md +16 -0
  82. package/src/core/commands/pr.md +161 -67
  83. package/src/core/commands/readme-sync.md +16 -0
  84. package/src/core/commands/research/analyze.md +568 -0
  85. package/src/core/commands/research/ask.md +345 -20
  86. package/src/core/commands/research/import.md +562 -19
  87. package/src/core/commands/research/list.md +173 -5
  88. package/src/core/commands/research/view.md +181 -8
  89. package/src/core/commands/retro.md +135 -48
  90. package/src/core/commands/review.md +219 -47
  91. package/src/core/commands/session/end.md +209 -0
  92. package/src/core/commands/session/history.md +210 -0
  93. package/src/core/commands/session/init.md +116 -0
  94. package/src/core/commands/session/new.md +296 -0
  95. package/src/core/commands/session/resume.md +166 -0
  96. package/src/core/commands/session/status.md +166 -0
  97. package/src/core/commands/setup/visual-e2e.md +462 -0
  98. package/src/core/commands/skill/create.md +115 -17
  99. package/src/core/commands/skill/delete.md +117 -0
  100. package/src/core/commands/skill/edit.md +104 -0
  101. package/src/core/commands/skill/list.md +128 -0
  102. package/src/core/commands/skill/test.md +135 -0
  103. package/src/core/commands/skill/upgrade.md +542 -0
  104. package/src/core/commands/sprint.md +17 -1
  105. package/src/core/commands/status.md +133 -21
  106. package/src/core/commands/story/list.md +176 -0
  107. package/src/core/commands/story/view.md +265 -0
  108. package/src/core/commands/story-validate.md +101 -1
  109. package/src/core/commands/story.md +204 -51
  110. package/src/core/commands/template.md +16 -1
  111. package/src/core/commands/tests.md +226 -64
  112. package/src/core/commands/update.md +17 -1
  113. package/src/core/commands/validate-expertise.md +16 -0
  114. package/src/core/commands/velocity.md +140 -36
  115. package/src/core/commands/verify.md +14 -0
  116. package/src/core/commands/whats-new.md +30 -0
  117. package/src/core/skills/_learnings/README.md +91 -0
  118. package/src/core/skills/_learnings/_template.yaml +106 -0
  119. package/src/core/skills/_learnings/code-review.yaml +118 -0
  120. package/src/core/skills/_learnings/commit.yaml +69 -0
  121. package/src/core/skills/_learnings/story-writer.yaml +71 -0
  122. package/src/core/templates/damage-control-patterns.yaml +234 -0
  123. package/src/core/templates/skill-template.md +53 -11
  124. package/tools/cli/commands/start.js +180 -0
  125. package/tools/cli/installers/ide/claude-code.js +127 -0
  126. package/tools/cli/tui/Dashboard.js +66 -0
  127. package/tools/cli/tui/StoryList.js +69 -0
  128. package/tools/cli/tui/index.js +16 -0
@@ -1,6 +1,20 @@
1
1
  ---
2
2
  description: Set up automated deployment pipeline
3
3
  argument-hint: (no arguments)
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "Auto-detect project type (static, full-stack, mobile, containers, serverless)"
8
+ - "Recommend deployment platform based on project (Vercel for Next.js, Netlify for static, Railway for containers)"
9
+ - "ALWAYS show configuration preview and wait for YES/NO before creating files"
10
+ - "Generate platform-specific config (vercel.json, netlify.toml, Dockerfile, etc.)"
11
+ - "Create .env.example template with all required secrets (never commit actual secrets)"
12
+ - "Create CI/CD workflow (.github/workflows/deploy.yml) with staging+production environments"
13
+ state_fields:
14
+ - project_type
15
+ - detected_platform
16
+ - environments_configured
17
+ - secrets_template_created
4
18
  ---
5
19
 
6
20
  # setup-deployment
@@ -15,89 +29,218 @@ If the user confirms they want the full details, continue. Otherwise, stop here.
15
29
  Automatically set up deployment pipeline for the project.
16
30
 
17
31
  <!-- COMPACT_SUMMARY_START -->
18
- ## Compact Summary
19
32
 
20
- **Purpose**: Auto-configure CI/CD deployment pipeline for your project type
33
+ ## ⚠️ COMPACT SUMMARY - /agileflow:setup-deployment IS ACTIVE
34
+
35
+ **CRITICAL**: You are configuring deployment pipeline for production. Auto-detection determines platform; always show preview before creating files.
36
+
37
+ **ROLE**: Deployment Configurator - Auto-detect project type, recommend platform, generate configs, create CI/CD workflow
38
+
39
+ ---
40
+
41
+ ### 🚨 RULE #1: AUTO-DETECT PROJECT TYPE
42
+
43
+ Always detect first (before prompting for platform):
44
+ - **Static**: package.json + only build script (no server)
45
+ - **Full-stack**: Express/FastAPI/Next.js API routes
46
+ - **Mobile**: expo config or react-native
47
+ - **Containers**: Dockerfile present
48
+ - **Serverless**: Lambda functions or serverless.yml
49
+
50
+ If unclear, ask user: "Is this [static/full-stack/containers]?"
51
+
52
+ ---
53
+
54
+ ### 🚨 RULE #2: PLATFORM RECOMMENDATIONS
55
+
56
+ | Project Type | Recommended | Reason |
57
+ |---|---|---|
58
+ | Next.js | **Vercel** | Built for Next.js, no config needed |
59
+ | React SPA | **Netlify** | Static + built-in redirects |
60
+ | Node.js server | **Railway** | Cheap, Docker-based, easy |
61
+ | Docker container | **Fly.io** | Native container support |
62
+ | Expo/React Native | **EAS** | Official Expo deployment |
63
+ | AWS preference | **Lambda + API Gateway** | FaaS with full control |
64
+
65
+ ---
66
+
67
+ ### 🚨 RULE #3: DIFF-FIRST PATTERN
68
+
69
+ ALWAYS preview all generated files before creating:
21
70
 
22
- **Quick Usage**:
23
71
  ```
24
- /agileflow:setup-deployment PLATFORM=auto ENV=both AUTO_DEPLOY=no
72
+ Deployment Setup for: Next.js web app
73
+ Recommended platform: Vercel
74
+
75
+ Will create:
76
+ ✓ vercel.json (deployment config)
77
+ ✓ .github/workflows/deploy.yml (CI/CD)
78
+ ✓ .env.example (secrets template)
79
+ ✓ docs/02-practices/deployment.md (guide)
80
+
81
+ Environments:
82
+ • Staging: staging.example.com (branch: staging)
83
+ • Production: example.com (branch: main)
84
+
85
+ Proceed? (YES/NO)
25
86
  ```
26
87
 
27
- **What It Does**:
28
- 1. Detects project type (static, full-stack, mobile, containers, serverless)
29
- 2. Recommends deployment platform based on project
30
- 3. Generates platform-specific configuration files
31
- 4. Creates CI/CD workflow file
32
- 5. Creates .env.example and secrets management docs
33
- 6. Shows configuration preview
34
- 7. Creates files after YES/NO confirmation
35
- 8. Displays next steps (add secrets, connect repo, test deploy)
36
-
37
- **Required Inputs**:
38
- - None (all optional with auto-detection)
39
-
40
- **Optional Inputs**:
41
- - `PLATFORM=auto|vercel|netlify|heroku|aws|gcp|docker|eas` (default: auto)
42
- - `ENV=staging|production|both` (default: both)
43
- - `AUTO_DEPLOY=yes|no` (default: no, manual trigger)
44
-
45
- **Output Files**:
46
- - Platform config (vercel.json, netlify.toml, Dockerfile, etc.)
47
- - `.github/workflows/deploy.yml` - CI/CD workflow
48
- - `.env.example` - Secrets template
49
- - `docs/02-practices/deployment.md` - Deployment guide
50
- - `docs/02-practices/secrets-management.md` - Secrets guide
51
-
52
- **Platform Recommendations**:
53
- - Next.js / React Vercel
54
- - Static sites Netlify
55
- - Node.js server Railway, Heroku
56
- - Docker apps Fly.io
57
- - Mobile (Expo) EAS
58
- - Serverless AWS Lambda, Vercel Functions
59
-
60
- **Tools Used**:
61
- - TodoWrite: Track 8-step deployment setup workflow
62
-
63
- **TodoWrite Example**:
88
+ Then ask: "Create deployment configuration? (YES/NO)"
89
+
90
+ ---
91
+
92
+ ### 🚨 RULE #4: ENVIRONMENT CONFIGURATION
93
+
94
+ Always create BOTH environments (unless ENV=production specified):
95
+
96
+ **Staging**:
97
+ - Branch: staging
98
+ - URL: staging.example.com or staging.vercel.app
99
+ - Database: Staging DB
100
+ - Secrets from: STAGING_* variables
101
+
102
+ **Production**:
103
+ - Branch: main
104
+ - URL: example.com
105
+ - Database: Production DB
106
+ - Secrets from: PROD_* variables
107
+
108
+ Both workflows deploy automatically on push.
109
+
110
+ ---
111
+
112
+ ### 🚨 RULE #5: SECRETS MANAGEMENT
113
+
114
+ **NEVER** commit actual secrets to git:
115
+ 1. Create `.env.example` with placeholder values
116
+ 2. Create `docs/02-practices/secrets-management.md` with instructions
117
+ 3. Show user how to add secrets to platform:
118
+ - Vercel: `vercel env add DATABASE_URL`
119
+ - Heroku: `heroku config:set DATABASE_URL=...`
120
+ - GitHub Actions: Settings → Secrets → Actions
121
+
122
+ ---
123
+
124
+ ### 🚨 RULE #6: USE TodoWrite FOR TRACKING
125
+
126
+ Track all 8 steps explicitly:
64
127
  ```xml
65
128
  <invoke name="TodoWrite">
66
129
  <parameter name="content">
67
- 1. Detect project type (static, full-stack, mobile, containers, serverless)
68
- 2. Recommend platform based on project type
69
- 3. Generate deployment configuration files
70
- 4. Create CI/CD workflow file
71
- 5. Create .env.example and secrets management docs
72
- 6. Show configuration preview
73
- 7. Create files after YES/NO confirmation
74
- 8. Display next steps (add secrets, connect repo, test deploy)
130
+ 1. Detect project type
131
+ 2. Recommend platform
132
+ 3. Generate config files
133
+ 4. Create CI/CD workflow
134
+ 5. Create .env.example
135
+ 6. Create deployment docs
136
+ 7. Show preview + confirm
137
+ 8. Display next steps
75
138
  </parameter>
76
139
  <parameter name="status">in-progress</parameter>
77
140
  </invoke>
78
141
  ```
79
142
 
80
- **Workflow**:
81
- 1. Detect project type from package.json, Dockerfile, etc.
82
- 2. Recommend deployment platform
83
- 3. Generate platform-specific config files
84
- 4. Create CI/CD workflow (staging + production)
85
- 5. Create environment management templates
86
- 6. Show preview of all files
87
- 7. Ask: "Create deployment configuration? (YES/NO)"
88
- 8. If YES: Write files and show next steps
89
-
90
- **Example Next Steps**:
143
+ ---
144
+
145
+ ### ANTI-PATTERNS (DON'T DO THESE)
146
+
147
+ Skip platform detection, use user's first choice
148
+ Create files without preview
149
+ Hardcode secrets in config files
150
+ Only create production environment
151
+ Forget to create .env.example template
152
+ ❌ Create deployment docs without next steps
153
+
154
+ ### DO THESE INSTEAD
155
+
156
+ ✅ Auto-detect project type first
157
+ ✅ Show full preview before creating
158
+ ✅ Use .env.example with placeholders
159
+ ✅ Create staging + production (unless specified)
160
+ ✅ Create .env.example + secrets management guide
161
+ ✅ Display clear next steps checklist
162
+
163
+ ---
164
+
165
+ ### WORKFLOW PHASES
166
+
167
+ **Phase 1: Detection (Steps 1-2)**
168
+ - Scan for package.json, Dockerfile, etc.
169
+ - Detect project type
170
+ - Recommend platform
171
+
172
+ **Phase 2: Generation (Steps 3-6)**
173
+ - Generate platform-specific config
174
+ - Generate CI/CD workflow with both envs
175
+ - Generate .env.example with all required vars
176
+ - Generate deployment guide
177
+
178
+ **Phase 3: Preview & Confirm (Step 7)**
179
+ - Display all files side-by-side
180
+ - Ask: "Create deployment configuration? (YES/NO)"
181
+
182
+ **Phase 4: Complete (Step 8)**
183
+ - Write all files
184
+ - Display next steps checklist
185
+
186
+ ---
187
+
188
+ ### NEXT STEPS TO DISPLAY
189
+
91
190
  ```
92
191
  ✅ Deployment configured for Vercel!
93
192
 
94
193
  Next steps:
95
- 1. Add secrets: vercel env add DATABASE_URL
96
- 2. Link repo: vercel link
97
- 3. Test deploy: git push origin staging
98
- 4. Check logs: vercel logs
99
- 5. Deploy prod: merge staging → main
194
+
195
+ 1. Add secrets to Vercel:
196
+ vercel env add DATABASE_URL production
197
+ vercel env add API_KEY production
198
+ [... more secrets from .env.example]
199
+
200
+ 2. Link repository to Vercel:
201
+ vercel link
202
+
203
+ 3. Test staging deploy:
204
+ git checkout -b staging
205
+ git push origin staging
206
+ Check: https://staging.vercel.app
207
+
208
+ 4. Test production deploy:
209
+ git push origin main
210
+ Check: https://example.com
211
+
212
+ 5. Set up custom domain (if needed):
213
+ vercel domains add example.com
214
+
215
+ Documentation: docs/02-practices/deployment.md
216
+ Secrets guide: docs/02-practices/secrets-management.md
100
217
  ```
218
+
219
+ ---
220
+
221
+ ### KEY FILES TO REMEMBER
222
+
223
+ | File | Purpose |
224
+ |------|---------|
225
+ | `vercel.json` (or platform equivalent) | Deployment configuration |
226
+ | `.github/workflows/deploy.yml` | CI/CD workflow for both environments |
227
+ | `.env.example` | Template for all required secrets |
228
+ | `docs/02-practices/deployment.md` | Team deployment guide |
229
+ | `docs/02-practices/secrets-management.md` | How to add secrets |
230
+
231
+ ---
232
+
233
+ ### REMEMBER AFTER COMPACTION
234
+
235
+ - `/agileflow:setup-deployment` IS ACTIVE - configure deployment
236
+ - Always auto-detect project type first
237
+ - Recommend appropriate platform based on type
238
+ - ALWAYS show preview before creating files
239
+ - Create BOTH staging and production (unless specified)
240
+ - Create .env.example template (never commit actual secrets)
241
+ - Use TodoWrite to track 8 steps
242
+ - Display next steps with exact commands
243
+
101
244
  <!-- COMPACT_SUMMARY_END -->
102
245
 
103
246
  ## Prompt
@@ -2,6 +2,21 @@
2
2
  description: Visualize dependency graph with critical path detection
3
3
  argument-hint: [SCOPE=story|epic|all] [EPIC=<id>] [STORY=<id>] [FORMAT=ascii|mermaid|graphviz|json] [ANALYSIS=critical-path|circular|blocking|all]
4
4
  model: haiku
5
+ compact_context:
6
+ priority: high
7
+ preserve_rules:
8
+ - "Parse dependencies from TWO sources: 1) Story frontmatter (depends_on/blocks fields), 2) Bus log (implicit blocked events)"
9
+ - "Build adjacency list graph and run DFS for critical path analysis"
10
+ - "Detect circular dependencies as ERRORS (cannot complete - flag prominently)"
11
+ - "Calculate blocking impact: stories that block multiple others are bottlenecks"
12
+ - "Generate ASCII tree with legend, critical path highlighted, blocking stories marked"
13
+ - "Support multiple formats: ascii (default), mermaid, graphviz, json"
14
+ - "Provide actionable recommendations: work on blockers first, parallelize independent stories"
15
+ state_fields:
16
+ - scope_analyzed
17
+ - circular_deps_detected
18
+ - critical_path_calculated
19
+ - blocking_stories_identified
5
20
  ---
6
21
 
7
22
  # dependencies
@@ -1,5 +1,21 @@
1
1
  ---
2
2
  description: System health diagnostics
3
+ compact_context:
4
+ priority: high
5
+ preserve_rules:
6
+ - "No arguments required - runs full system diagnostics automatically"
7
+ - "Run 4 validation checks: JSON files, auto-archival, hooks system, file sizes"
8
+ - "JSON Validation CRITICAL - validate status.json, metadata, settings with jq empty"
9
+ - "Auto-Archival System - check script executable and hook configuration"
10
+ - "Hooks System - validate .claude/settings.json structure"
11
+ - "File Size Analysis - warn if status.json exceeds 100KB"
12
+ - "Report issues with indicators: ✅ (pass), ❌ (fail), ⚠️ (warn), ℹ️ (info)"
13
+ - "Exit code 0 (healthy) or 1 (issues found)"
14
+ state_fields:
15
+ - total_checks
16
+ - passed_checks
17
+ - warning_count
18
+ - failure_count
3
19
  ---
4
20
 
5
21
  # diagnose
@@ -1,6 +1,21 @@
1
1
  ---
2
2
  description: Synchronize documentation with code changes
3
3
  argument-hint: [BRANCH=<name>] [BASE=<branch>] [AUTO_CREATE=yes|no]
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "Compare BRANCH against BASE using git diff"
8
+ - "Categorize changes: API, UI, services, config, database"
9
+ - "Generate gap report: missing, outdated, up-to-date docs"
10
+ - "NEVER delete docs without explicit approval"
11
+ - "ALWAYS use diff-first, YES/NO pattern before writing"
12
+ - "PRESERVE custom content - use managed section markers"
13
+ - "INFER docs from TypeScript types, JSDoc, OpenAPI, tests"
14
+ - "Optional AUTO_CREATE mode auto-generates all missing docs"
15
+ state_fields:
16
+ - branch_name
17
+ - base_branch
18
+ - auto_create_flag
4
19
  ---
5
20
 
6
21
  # docs-sync
@@ -18,76 +33,180 @@ node .agileflow/scripts/obtain-context.js docs
18
33
  ---
19
34
 
20
35
  <!-- COMPACT_SUMMARY_START -->
21
- ## Compact Summary
22
-
23
- **Purpose**: Automatically detect code changes and synchronize documentation to prevent drift.
24
-
25
- **Core Workflow**:
26
- 1. Activate command using STEP 0 registration script
27
- 2. Compare branch against base using git diff
28
- 3. Categorize changes (API, UI, services, config, database)
29
- 4. Map code changes to expected documentation locations
30
- 5. Analyze gaps (missing docs, outdated docs, deprecated references)
31
- 6. Generate gap report with status indicators (❌ missing, ⚠️ incomplete, ✅ up-to-date)
32
- 7. Preview suggested documentation updates
33
- 8. Get explicit user approval before making changes
34
-
35
- **Critical Rules**:
36
- - NEVER delete documentation without explicit user approval
37
- - ALWAYS use diff-first, YES/NO pattern for all modifications
38
- - PRESERVE custom content - don't overwrite manually written sections
39
- - USE managed section markers: `<!-- MANAGED:section-id --> ... <!-- /MANAGED -->`
40
- - LINK docs to source files for traceability
41
- - INFER documentation from TypeScript types, JSDoc, OpenAPI decorators, test files
42
-
43
- **Expected Documentation Mapping**:
44
- - API endpoints → `docs/04-architecture/api.md` or OpenAPI spec
45
- - UI components → `docs/04-architecture/components.md` or Storybook
46
- - Services/utilities → `docs/04-architecture/services.md`
47
- - Configuration `docs/02-practices/configuration.md`
48
- - Database migrations → `docs/04-architecture/database.md`
49
-
50
- **Smart Inference Sources**:
51
- - TypeScript types and interfaces
52
- - JSDoc comments and annotations
53
- - OpenAPI/Swagger decorators
54
- - Function signatures and parameters
55
- - Test files as usage examples
56
-
57
- **Auto-Create Mode** (AUTO_CREATE=yes):
58
- - Creates all missing documentation automatically
59
- - Marks sections with "TODO: Add details" for manual review
60
- - Commits with message: "docs: sync with codebase changes"
61
-
62
- **Integration Features**:
63
- - Create tracking story for significant doc gaps
64
- - Log to agent bus: `{"type":"docs-sync","missing":N,"outdated":N}`
65
- - Suggest PR checklist item: "- [ ] Documentation updated"
66
- - Recommend CI integration for automated checks
67
-
68
- **Gap Report Format**:
36
+
37
+ ## ⚠️ COMPACT SUMMARY - /agileflow:docs-sync IS ACTIVE
38
+
39
+ **CRITICAL**: You are detecting code changes and synchronizing documentation. Goal: prevent documentation drift.
40
+
41
+ **ROLE**: Documentation Synchronizer
42
+
43
+ ---
44
+
45
+ ### 🚨 RULE #1: COMPARE BRANCHES AND DETECT CHANGES
46
+
47
+ Use git diff to compare BRANCH against BASE:
48
+
49
+ ```bash
50
+ git diff <BASE>...<BRANCH> --name-status
51
+ ```
52
+
53
+ Categorize changes:
54
+ - **API endpoints**: src/api/, src/routes/, src/controllers/
55
+ - **UI components**: src/components/, src/pages/
56
+ - **Services**: src/services/, src/utils/
57
+ - **Config**: *.config.js, *.yml, .env.example
58
+ - **Database**: migrations/, schema/
59
+
60
+ ---
61
+
62
+ ### 🚨 RULE #2: MAP TO EXPECTED DOCUMENTATION
63
+
64
+ For each changed file, map to expected docs:
65
+
66
+ | Code Change | Expected Doc Location | Gap Status |
67
+ |-------------|----------------------|-----------|
68
+ | New API endpoint | docs/04-architecture/api.md | Check section exists |
69
+ | New UI component | docs/04-architecture/components.md | Check section exists |
70
+ | New service/utility | docs/04-architecture/services.md | Check section exists |
71
+ | Config change | docs/02-practices/configuration.md | Check referenced |
72
+ | Database migration | docs/04-architecture/database.md | Check documented |
73
+
74
+ ---
75
+
76
+ ### 🚨 RULE #3: GENERATE GAP REPORT
77
+
78
+ Always create gap report showing status for each change:
79
+
69
80
  ```markdown
70
81
  # Documentation Sync Report
71
- **Branch**: <name> | **Base**: <branch> | **Generated**: <timestamp>
82
+ **Branch**: feature/auth | **Base**: main | **Generated**: 2025-12-22T10:30Z
72
83
 
73
- ## Missing Documentation
74
- ### API Endpoints (N)
75
- - ❌ POST /endpoint (src/path/file.ts)
84
+ ## Missing Documentation (3)
85
+ - POST /api/auth/login (src/api/auth/login.ts)
86
+ - ❌ LoginForm component (src/components/LoginForm.tsx)
87
+ - ❌ JWT_SECRET env var (.env.example)
76
88
 
77
- ## Outdated Documentation
78
- - 📄 Deprecated references to removed code
89
+ ## Outdated Documentation (1)
90
+ - 📄 Mentions /api/v1/login (removed in this branch)
79
91
 
80
- ## Up-to-Date
81
- - ✅ Correctly documented components
92
+ ## Up-to-Date (2)
93
+ - ✅ UserAvatar component documented
94
+ - ✅ Database schema up-to-date
95
+ ```
96
+
97
+ ---
98
+
99
+ ### 🚨 RULE #4: NEVER DELETE WITHOUT APPROVAL
100
+
101
+ **CRITICAL**: When docs are removed or changed:
102
+ 1. Show diff to user
103
+ 2. Ask explicit approval: "Delete this section? (YES/NO)"
104
+ 3. Only delete if user approves
105
+
106
+ ❌ WRONG: Remove outdated docs without asking
107
+ ✅ RIGHT: Show diff, ask approval, delete only if approved
108
+
109
+ ---
110
+
111
+ ### 🚨 RULE #5: DIFF-FIRST, YES/NO PATTERN
112
+
113
+ **ALWAYS follow this pattern:**
114
+
115
+ 1. Generate all proposed changes in memory (don't write)
116
+ 2. Show diff/preview to user
117
+ 3. Ask: "Create missing documentation? (YES/NO)"
118
+ 4. Only write files if user says YES
119
+
120
+ ---
121
+
122
+ ### 🚨 RULE #6: SMART INFERENCE
123
+
124
+ Infer documentation from code sources:
125
+
126
+ **From TypeScript**:
127
+ ```typescript
128
+ // Code:
129
+ export interface User {
130
+ id: string;
131
+ email: string;
132
+ name: string;
133
+ }
134
+
135
+ // Generated doc:
136
+ ## User Interface
137
+ - id (string) - Unique user identifier
138
+ - email (string) - User email address
139
+ - name (string) - User full name
140
+ ```
141
+
142
+ **From JSDoc**:
143
+ ```typescript
144
+ /**
145
+ * Authenticates user with email and password
146
+ * @returns JWT token and user profile
147
+ */
148
+ export async function login(email: string, password: string)
149
+
150
+ // Generated doc:
151
+ POST /api/auth/login
152
+ Authenticates user with email and password.
153
+ Returns JWT token and user profile.
82
154
  ```
83
155
 
84
- **Output Deliverables**:
85
- - Markdown gap report with categorized findings
86
- - List of recommended actions with previews
87
- - Optional: Pull request with documentation updates (if approved)
156
+ ---
88
157
 
89
- **Tool Usage Example**:
90
- When asking for approval before creating docs:
158
+ ### ANTI-PATTERNS (DON'T DO THESE)
159
+
160
+ ❌ Delete docs without approval
161
+ ❌ Skip diff-first pattern
162
+ ❌ Overwrite manually written sections
163
+ ❌ Create vague doc stubs ("TODO: Add details")
164
+ ❌ Ignore outdated documentation
165
+ ❌ Skip gap report
166
+
167
+ ### DO THESE INSTEAD
168
+
169
+ ✅ Always ask before deleting
170
+ ✅ Show diffs for user approval
171
+ ✅ Preserve custom content
172
+ ✅ Generate complete doc stubs from code
173
+ ✅ Flag outdated docs clearly
174
+ ✅ Create comprehensive gap report
175
+
176
+ ---
177
+
178
+ ### WORKFLOW
179
+
180
+ 1. **Get Diff**: Compare BRANCH vs BASE with git diff
181
+ 2. **Categorize**: Group changes by type (API, UI, services, etc.)
182
+ 3. **Map**: For each change, identify expected doc location
183
+ 4. **Analyze**: Check if docs exist, are current, or are missing
184
+ 5. **Report**: Generate gap report with status indicators
185
+ 6. **Preview**: Show all proposed changes to user
186
+ 7. **Ask**: "Create missing documentation? (YES/NO)"
187
+ 8. **Create**: Only if user approves - generate stubs from code
188
+ 9. **Commit**: If AUTO_CREATE=yes, commit with message "docs: sync with codebase changes"
189
+
190
+ ---
191
+
192
+ ### TOOL USAGE EXAMPLES
193
+
194
+ **TodoWrite** (to track sync process):
195
+ ```xml
196
+ <invoke name="TodoWrite">
197
+ <parameter name="content">1. Get git diff between BASE and BRANCH
198
+ 2. Categorize changes (API, UI, services, config, DB)
199
+ 3. Map to expected documentation locations
200
+ 4. Analyze gaps (missing, outdated, current)
201
+ 5. Generate gap report
202
+ 6. Preview proposed changes
203
+ 7. Get user approval
204
+ 8. Create docs if approved</parameter>
205
+ <parameter name="status">in-progress</parameter>
206
+ </invoke>
207
+ ```
208
+
209
+ **AskUserQuestion** (for approval):
91
210
  ```xml
92
211
  <invoke name="AskUserQuestion">
93
212
  <parameter name="questions">[{
@@ -95,14 +214,27 @@ When asking for approval before creating docs:
95
214
  "header": "Documentation Sync",
96
215
  "multiSelect": false,
97
216
  "options": [
98
- {"label": "Create all missing docs", "description": "Auto-generate stubs for all missing documentation"},
99
- {"label": "Review each one first", "description": "Preview each change before creating"},
217
+ {"label": "Create all missing docs", "description": "Auto-generate stubs from code"},
218
+ {"label": "Review each one first", "description": "Preview changes before creating"},
100
219
  {"label": "Skip documentation", "description": "Don't create docs now"}
101
220
  ]
102
221
  }]</parameter>
103
222
  </invoke>
104
223
  ```
105
224
 
225
+ ---
226
+
227
+ ### REMEMBER AFTER COMPACTION
228
+
229
+ - `/agileflow:docs-sync` IS ACTIVE
230
+ - Compare BRANCH vs BASE with git diff
231
+ - Categorize changes (API, UI, services, etc.)
232
+ - Generate gap report (missing, outdated, current)
233
+ - Never delete docs without approval
234
+ - Use diff-first, YES/NO pattern
235
+ - Infer docs from code (TypeScript, JSDoc, tests)
236
+ - Optional AUTO_CREATE auto-generates all missing docs
237
+
106
238
  <!-- COMPACT_SUMMARY_END -->
107
239
 
108
240
  ---