@atlashub/smartstack-cli 1.33.0 → 1.35.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 (56) hide show
  1. package/.documentation/installation.html +60 -38
  2. package/dist/index.js +1098 -582
  3. package/dist/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/templates/agents/docs-context-reader.md +125 -0
  6. package/templates/agents/docs-sync-checker.md +122 -0
  7. package/templates/hooks/docs-drift-check.md +97 -0
  8. package/templates/skills/_resources/context-digest-template.md +53 -0
  9. package/templates/skills/_resources/doc-context-cache.md +62 -0
  10. package/templates/skills/_resources/docs-manifest-schema.md +157 -0
  11. package/templates/skills/_resources/mcp-validate-documentation-spec.md +183 -0
  12. package/templates/skills/_shared.md +8 -0
  13. package/templates/skills/apex/SKILL.md +6 -0
  14. package/templates/skills/apex/steps/step-00-init.md +9 -0
  15. package/templates/skills/apex/steps/step-01-analyze.md +36 -0
  16. package/templates/skills/apex/steps/step-02-plan.md +38 -0
  17. package/templates/skills/apex/steps/step-03-execute.md +39 -0
  18. package/templates/skills/apex/steps/step-04-validate.md +31 -1
  19. package/templates/skills/apex/steps/step-04b-doc-sync.md +162 -0
  20. package/templates/skills/apex/steps/step-05-examine.md +7 -0
  21. package/templates/skills/apex/templates/04b-doc-sync.md +31 -0
  22. package/templates/skills/apex/templates/context-digest.md +35 -0
  23. package/templates/skills/business-analyse/SKILL.md +18 -5
  24. package/templates/skills/business-analyse/_shared.md +306 -4
  25. package/templates/skills/business-analyse/questionnaire/01-context.md +21 -6
  26. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +34 -0
  27. package/templates/skills/business-analyse/questionnaire/03-scope.md +23 -0
  28. package/templates/skills/business-analyse/questionnaire/04-data.md +44 -0
  29. package/templates/skills/business-analyse/questionnaire/05-integrations.md +29 -7
  30. package/templates/skills/business-analyse/questionnaire/06-security.md +28 -0
  31. package/templates/skills/business-analyse/questionnaire/07-ui.md +32 -7
  32. package/templates/skills/business-analyse/questionnaire/08-performance.md +21 -0
  33. package/templates/skills/business-analyse/questionnaire/09-constraints.md +29 -6
  34. package/templates/skills/business-analyse/questionnaire/10-documentation.md +27 -6
  35. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +59 -0
  36. package/templates/skills/business-analyse/questionnaire/12-migration.md +58 -0
  37. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +69 -0
  38. package/templates/skills/business-analyse/steps/step-00-init.md +110 -16
  39. package/templates/skills/business-analyse/steps/step-01-discover.md +530 -85
  40. package/templates/skills/business-analyse/steps/step-02-analyse.md +81 -25
  41. package/templates/skills/business-analyse/steps/step-03-specify.md +116 -24
  42. package/templates/skills/business-analyse/steps/step-04-validate.md +107 -33
  43. package/templates/skills/business-analyse/steps/step-05-handoff.md +256 -33
  44. package/templates/skills/business-analyse/steps/step-06-doc-html.md +84 -25
  45. package/templates/skills/business-analyse/templates/{frd-handoff.md → tpl-handoff.md} +18 -4
  46. package/templates/skills/business-analyse/templates-frd.md +19 -5
  47. package/templates/skills/business-analyse/tracking/change-template.md +30 -0
  48. package/templates/skills/documentation/SKILL.md +68 -31
  49. package/templates/skills/documentation/data-schema.md +198 -0
  50. package/templates/skills/documentation/templates.md +30 -1
  51. package/templates/skills/gitflow/steps/step-init.md +268 -20
  52. package/templates/skills/gitflow/templates/config.json +7 -0
  53. package/templates/skills/ralph-loop/SKILL.md +3 -0
  54. /package/templates/skills/business-analyse/templates/{frd-brd.md → tpl-brd.md} +0 -0
  55. /package/templates/skills/business-analyse/templates/{frd-discovery.md → tpl-discovery.md} +0 -0
  56. /package/templates/skills/business-analyse/templates/{frd-spec.md → tpl-frd.md} +0 -0
@@ -0,0 +1,183 @@
1
+ # MCP Tool Specification: validate_documentation
2
+
3
+ ## Status: FUTURE
4
+
5
+ > This tool does not yet exist in SmartStack.mcp. This file is a specification for its implementation.
6
+ > Until implemented, use the `docs-sync-checker` agent as a fallback.
7
+
8
+ ## Tool Definition
9
+
10
+ ```typescript
11
+ {
12
+ name: "mcp__smartstack__validate_documentation",
13
+ description: "Validate documentation freshness, completeness, and accuracy for SmartStack modules",
14
+ parameters: {
15
+ module: {
16
+ type: "string",
17
+ description: "Module path (e.g., 'business/support/sla'). Empty for all modules.",
18
+ required: false
19
+ },
20
+ checkType: {
21
+ type: "string",
22
+ enum: ["freshness", "completeness", "accuracy", "all"],
23
+ default: "all",
24
+ description: "Type of validation to perform"
25
+ },
26
+ path: {
27
+ type: "string",
28
+ description: "Project path (default: SmartStack.app path from config)",
29
+ required: false
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ ## Check Types
36
+
37
+ ### freshness
38
+ Compare `docs-manifest.json` with git history to detect stale documentation.
39
+
40
+ **Input:** manifest entries, git log
41
+ **Logic:**
42
+ ```
43
+ FOR each module in manifest:
44
+ lastCodeCommit = git log -1 --format="%aI" -- {codeFiles}
45
+ IF lastCodeCommit > module.lastDocUpdate:
46
+ status = "drift"
47
+ driftDays = daysBetween(module.lastDocUpdate, lastCodeCommit)
48
+ ```
49
+
50
+ **Output:**
51
+ ```json
52
+ {
53
+ "modules": [
54
+ {
55
+ "path": "business/support/sla",
56
+ "status": "drift",
57
+ "driftDays": 15,
58
+ "lastCodeChange": "2026-01-28",
59
+ "lastDocUpdate": "2026-01-13"
60
+ }
61
+ ]
62
+ }
63
+ ```
64
+
65
+ ### completeness
66
+ Verify that documented modules have all 8 business-first sections.
67
+
68
+ **Input:** frd-data.ts files, i18n JSON files
69
+ **Logic:**
70
+ ```
71
+ FOR each module with documentation:
72
+ Read frd-data.ts
73
+ Check presence of:
74
+ 1. overview (valeur métier)
75
+ 2. useCases (cas d'usage)
76
+ 3. benefits (bénéfices concrets) — in i18n
77
+ 4. beforeAfter (avant/après) — in i18n
78
+ 5. features (fonctionnalités)
79
+ 6. steps (comment ça marche)
80
+ 7. faq (FAQ métier) — in i18n
81
+ 8. technicalRef (référence technique)
82
+ Report missing sections
83
+ ```
84
+
85
+ **Output:**
86
+ ```json
87
+ {
88
+ "modules": [
89
+ {
90
+ "path": "business/support/sla",
91
+ "completeness": "6/8",
92
+ "missingSections": ["beforeAfter", "faq"],
93
+ "i18nComplete": { "fr": true, "en": false, "it": false, "de": false }
94
+ }
95
+ ]
96
+ }
97
+ ```
98
+
99
+ ### accuracy
100
+ Compare documented permissions, endpoints, and entities against actual code.
101
+
102
+ **Input:** frd-data.ts, controllers, PermissionConfiguration.cs, entities
103
+ **Logic:**
104
+ ```
105
+ FOR each module:
106
+ documentedPermissions = frdData.permissions
107
+ actualPermissions = scan PermissionConfiguration.cs for module path
108
+ IF documentedPermissions != actualPermissions:
109
+ issues.push("permission mismatch")
110
+
111
+ documentedEndpoints = frdData.apiEndpoints
112
+ actualEndpoints = scan Controller for [Http*] attributes
113
+ IF documentedEndpoints != actualEndpoints:
114
+ issues.push("endpoint mismatch")
115
+
116
+ documentedEntities = frdData (entity references)
117
+ actualEntities = scan Domain/Entities for module
118
+ IF documentedEntities != actualEntities:
119
+ issues.push("entity mismatch")
120
+ ```
121
+
122
+ **Output:**
123
+ ```json
124
+ {
125
+ "modules": [
126
+ {
127
+ "path": "business/support/sla",
128
+ "accuracy": "partial",
129
+ "issues": [
130
+ {
131
+ "type": "endpoint_mismatch",
132
+ "documented": ["GET /api/business/sla", "POST /api/business/sla"],
133
+ "actual": ["GET /api/business/sla", "POST /api/business/sla", "PATCH /api/business/sla/{id}/status"],
134
+ "message": "Endpoint PATCH /api/business/sla/{id}/status exists in code but not in documentation"
135
+ }
136
+ ]
137
+ }
138
+ ]
139
+ }
140
+ ```
141
+
142
+ ## Combined Output (checkType: "all")
143
+
144
+ ```json
145
+ {
146
+ "summary": {
147
+ "totalModules": 5,
148
+ "synced": 2,
149
+ "drift": 2,
150
+ "missing": 1,
151
+ "overallScore": "60%"
152
+ },
153
+ "modules": [
154
+ {
155
+ "path": "business/support/sla",
156
+ "freshness": { "status": "drift", "driftDays": 15 },
157
+ "completeness": { "score": "6/8", "missingSections": ["beforeAfter", "faq"] },
158
+ "accuracy": { "status": "partial", "issues": 1 }
159
+ }
160
+ ],
161
+ "recommendations": [
162
+ "Run `/apex -d` for business/support/sla to sync documentation",
163
+ "Run `/business-analyse` for business/support/tickets to create documentation"
164
+ ]
165
+ }
166
+ ```
167
+
168
+ ## Integration Points
169
+
170
+ | Consumer | When | Fallback |
171
+ |----------|------|----------|
172
+ | APEX step-04b (doc-sync) | After code validation | `docs-sync-checker` agent |
173
+ | BA step-04 (validate) | During specification validation | Read manifest + git log |
174
+ | APEX step-05 (examine) | During adversarial review | Manual checklist |
175
+ | Drift hook (pre-commit) | Before commit | Bash script reading manifest |
176
+
177
+ ## Implementation Notes
178
+
179
+ - Tool should read `docs-manifest.json` from project root
180
+ - Must handle missing manifest gracefully (return "no manifest" status)
181
+ - Git operations should use `--no-pager` flag
182
+ - Performance: cache git log results across modules
183
+ - The tool should be idempotent (no side effects)
@@ -138,3 +138,11 @@ if (entity.UserType == UserType.System || entity.UserType == UserType.LocalAdmin
138
138
  | `mcp__smartstack__validate_frontend_routes` | Valider synchronisation routes frontend/backend | step-04-validate |
139
139
  | `mcp__smartstack__scaffold_frontend_extension` | Générer infrastructure extension frontend | step-03-execute |
140
140
  | `mcp__smartstack__analyze_extension_points` | Analyser points d'extension dans les pages React | step-01-analyze |
141
+
142
+ ### Outils Documentation
143
+
144
+ | Tool | Usage | Step APEX |
145
+ |------|-------|-----------|
146
+ | `mcp__smartstack__validate_documentation` | Valider fraîcheur, complétude et exactitude de la documentation (FUTURE - voir `_resources/mcp-validate-documentation-spec.md`) | step-04b-doc-sync |
147
+
148
+ > **Fallback** : En attendant l'implémentation MCP, utiliser l'agent `docs-sync-checker` pour la détection de drift et l'agent `docs-context-reader` pour l'injection de contexte documentation.
@@ -49,6 +49,7 @@ See `<parameters>` for complete flag list.
49
49
  | `-s` | `--save` | Save mode: output each step to `.claude/output/apex/` |
50
50
  | `-t` | `--test` | Test mode: include test creation and runner steps |
51
51
  | `-e` | `--economy` | Economy mode: no subagents, save tokens |
52
+ | `-d` | `--doc` | Documentation sync: update docs after validation (ON by default) |
52
53
  | `-r` | `--resume` | Resume mode: continue from a previous task |
53
54
  | `-b` | `--branch` | Branch mode: verify not on main, create branch if needed |
54
55
  | `-pr` | `--pull-request` | PR mode: create pull request at end (enables -b) |
@@ -62,6 +63,7 @@ See `<parameters>` for complete flag list.
62
63
  | `-S` | `--no-save` | Disable save mode |
63
64
  | `-T` | `--no-test` | Disable test mode |
64
65
  | `-E` | `--no-economy` | Disable economy mode |
66
+ | `-D` | `--no-doc` | Disable documentation sync |
65
67
  | `-B` | `--no-branch` | Disable branch mode |
66
68
  | `-PR` | `--no-pull-request` | Disable PR mode |
67
69
  </flags>
@@ -133,6 +135,7 @@ All outputs saved to PROJECT directory:
133
135
  ├── 02-plan.md # Implementation plan
134
136
  ├── 03-execute.md # Execution log
135
137
  ├── 04-validate.md # Validation results
138
+ ├── 04b-doc-sync.md # Documentation sync (if -d)
136
139
  ├── 05-examine.md # Review findings (if -x)
137
140
  ├── 06-resolve.md # Resolution log (if -x)
138
141
  ├── 07-tests.md # Test creation (if -t)
@@ -161,6 +164,7 @@ When provided, step-00 will:
161
164
  5. Load step-02-plan.md -> create strategy
162
165
  6. Load step-03-execute.md -> implement
163
166
  7. Load step-04-validate.md -> verify
167
+ 7b. If `{doc_mode}` = true: Load step-04b-doc-sync.md -> sync documentation
164
168
  8. If `--test`: Load step-07-tests.md -> create tests
165
169
  9. If `--test`: Load step-08-run-tests.md -> run until green
166
170
  10. If `-x` or user requests: Load step-05-examine.md -> adversarial review
@@ -182,6 +186,7 @@ When provided, step-00 will:
182
186
  | `{save_mode}` | boolean | Save outputs to .claude/output/apex/ |
183
187
  | `{test_mode}` | boolean | Include test steps (07-08) |
184
188
  | `{economy_mode}` | boolean | No subagents, direct tool usage only |
189
+ | `{doc_mode}` | boolean | Documentation sync after validation (ON by default) |
185
190
  | `{branch_mode}` | boolean | Verify not on main, create branch if needed |
186
191
  | `{pr_mode}` | boolean | Create pull request at end |
187
192
  | `{interactive_mode}` | boolean | Configure flags interactively |
@@ -207,6 +212,7 @@ When provided, step-00 will:
207
212
  | 02 | `steps/step-02-plan.md` | File-by-file implementation strategy |
208
213
  | 03 | `steps/step-03-execute.md` | Todo-driven implementation |
209
214
  | 04 | `steps/step-04-validate.md` | Self-check and validation |
215
+ | 04b | `steps/step-04b-doc-sync.md` | Documentation sync (if doc_mode, manifest exists) |
210
216
  | 05 | `steps/step-05-examine.md` | Adversarial code review (optional) |
211
217
  | 06 | `steps/step-06-resolve.md` | Finding resolution (optional) |
212
218
  | 07 | `steps/step-07-tests.md` | Test analysis and creation (if --test) |
@@ -29,6 +29,7 @@ examine_mode: false # -x: Auto-proceed to adversarial review
29
29
  save_mode: false # -s: Save outputs to .claude/output/apex/
30
30
  test_mode: false # -t: Include test creation and runner steps
31
31
  economy_mode: false # -e: No subagents, save tokens
32
+ doc_mode: true # -d: Documentation sync (ON by default)
32
33
  ```
33
34
  </defaults>
34
35
 
@@ -46,6 +47,7 @@ economy_mode: false # -e: No subagents, save tokens
46
47
  {save_mode} = false
47
48
  {test_mode} = false
48
49
  {economy_mode} = false
50
+ {doc_mode} = true
49
51
  ```
50
52
 
51
53
  **Step 2: Parse user input and override defaults:**
@@ -57,6 +59,7 @@ Enable flags (lowercase - turn ON):
57
59
  -s or --save -> {save_mode} = true
58
60
  -t or --test -> {test_mode} = true
59
61
  -e or --economy -> {economy_mode} = true
62
+ -d or --doc -> {doc_mode} = true
60
63
 
61
64
  Disable flags (UPPERCASE - turn OFF):
62
65
  -A or --no-auto -> {auto_mode} = false
@@ -64,6 +67,7 @@ Disable flags (UPPERCASE - turn OFF):
64
67
  -S or --no-save -> {save_mode} = false
65
68
  -T or --no-test -> {test_mode} = false
66
69
  -E or --no-economy -> {economy_mode} = false
70
+ -D or --no-doc -> {doc_mode} = false
67
71
 
68
72
  Other:
69
73
  -r or --resume -> {resume_task} = <next argument>
@@ -115,6 +119,8 @@ questions:
115
119
  description: "Include test creation and runner steps"
116
120
  - label: "Economy mode (-e)"
117
121
  description: "No subagents, direct tools only (saves tokens)"
122
+ - label: "Doc sync mode (-d) — ON by default"
123
+ description: "Sync documentation after validation (disable with -D)"
118
124
  multiSelect: true
119
125
  ```
120
126
 
@@ -141,6 +147,7 @@ questions:
141
147
  | Save mode | {save_mode} |
142
148
  | Test mode | {test_mode} |
143
149
  | Economy mode | {economy_mode} |
150
+ | Doc mode | {doc_mode} |
144
151
 
145
152
  ## User Request
146
153
 
@@ -159,6 +166,7 @@ _To be defined in step-01-analyze_
159
166
  | 02-plan | Pending |
160
167
  | 03-execute | Pending |
161
168
  | 04-validate | Pending |
169
+ | 04b-doc-sync | {doc_mode ? "Pending" : "Skip"} |
162
170
  | 05-examine | {examine_mode ? "Pending" : "Skip"} |
163
171
  | 06-resolve | {examine_mode ? "Pending" : "Skip"} |
164
172
  | 07-tests | {test_mode ? "Pending" : "Skip"} |
@@ -182,6 +190,7 @@ APEX: {task_description}
182
190
  | {save_mode} | true/false |
183
191
  | {test_mode} | true/false |
184
192
  | {economy_mode} | true/false |
193
+ | {doc_mode} | true/false |
185
194
 
186
195
  -> Analyzing...
187
196
  ```
@@ -182,6 +182,42 @@ Write findings to `{output_dir}/01-analyze.md`:
182
182
  - Add timestamp at the end
183
183
  - Update 00-context.md Progress table: 01-analyze -> Complete
184
184
 
185
+ ### 6b. Generate Context Digest (if save_mode)
186
+
187
+ **If `{save_mode}` = true:**
188
+
189
+ Generate a compact digest (max 50 lines) for inter-step context transfer.
190
+ Use the template from `_resources/context-digest-template.md`.
191
+
192
+ ```markdown
193
+ ## Context Digest — step-01-analyze
194
+
195
+ ### Changes
196
+ - N/A (analysis only)
197
+
198
+ ### Decisions
199
+ - {key architectural or approach decisions from analysis}
200
+
201
+ ### Findings
202
+ - {most important files found with paths}
203
+ - {patterns identified, utilities available}
204
+
205
+ ### State
206
+ - {acceptance_criteria}: [inferred list]
207
+ - Files analyzed: {count}
208
+
209
+ ### Blockers
210
+ - {open questions or ambiguities}
211
+
212
+ ### Next
213
+ - Step-02 should focus on: {key areas for planning}
214
+ ```
215
+
216
+ Write digest to `{output_dir}/01-analyze-digest.md`
217
+
218
+ **Purpose:** Step-02 reads ONLY this digest (not the full 01-analyze.md) to minimize token usage.
219
+ Exception: If `{resume_task}` is set, read the full output instead.
220
+
185
221
  ### 7. Present Context Summary
186
222
 
187
223
  ```
@@ -153,6 +153,44 @@ Write plan to `{output_dir}/02-plan.md`:
153
153
  - Add timestamp
154
154
  - Update 00-context.md Progress table: 02-plan -> Complete
155
155
 
156
+ ### 5b. Generate Context Digest (if save_mode)
157
+
158
+ **If `{save_mode}` = true:**
159
+
160
+ Generate a compact digest (max 50 lines) for inter-step context transfer.
161
+ Use the template from `_resources/context-digest-template.md`.
162
+
163
+ ```markdown
164
+ ## Context Digest — step-02-plan
165
+
166
+ ### Changes
167
+ - {files planned for modification with summary}
168
+
169
+ ### Decisions
170
+ - {approach chosen and why}
171
+ - {key design decisions}
172
+
173
+ ### Findings
174
+ - {risks identified}
175
+ - {dependencies between files}
176
+
177
+ ### State
178
+ - Plan approved: {yes/no}
179
+ - Files to modify: {count}
180
+ - New files: {count}
181
+
182
+ ### Blockers
183
+ - {any user questions pending}
184
+
185
+ ### Next
186
+ - Step-03 should implement files in this order: {ordered list}
187
+ ```
188
+
189
+ Write digest to `{output_dir}/02-plan-digest.md`
190
+
191
+ **Purpose:** Step-03 reads ONLY this digest + the plan structure (not full analysis) to minimize token usage.
192
+ Exception: If `{resume_task}` is set, read the full outputs instead.
193
+
156
194
  ### 6. Present Plan for Approval
157
195
 
158
196
  ```
@@ -153,6 +153,45 @@ Finalize `{output_dir}/03-execute.md` with:
153
153
 
154
154
  **Then proceed to validation.**
155
155
 
156
+ ### 6b. Generate Context Digest (if save_mode)
157
+
158
+ **If `{save_mode}` = true:**
159
+
160
+ Generate a compact digest (max 50 lines) for inter-step context transfer.
161
+ Use the template from `_resources/context-digest-template.md`.
162
+
163
+ ```markdown
164
+ ## Context Digest — step-03-execute
165
+
166
+ ### Changes
167
+ - {files modified with line ranges and summary}
168
+ - {new files created}
169
+
170
+ ### Decisions
171
+ - {implementation choices made during execution}
172
+
173
+ ### Findings
174
+ - {issues encountered and how resolved}
175
+ - {patterns that deviated from plan}
176
+
177
+ ### State
178
+ - Todos completed: {X}/{Y}
179
+ - Files modified: {count}
180
+ - Files created: {count}
181
+
182
+ ### Blockers
183
+ - {any remaining issues}
184
+
185
+ ### Next
186
+ - Step-04 should validate: {specific checks needed}
187
+ - Files to verify: {list of modified files}
188
+ ```
189
+
190
+ Write digest to `{output_dir}/03-execute-digest.md`
191
+
192
+ **Purpose:** Step-04 reads ONLY this digest (not full execution log) to minimize token usage.
193
+ Exception: If `{resume_task}` is set, read the full outputs instead.
194
+
156
195
  ---
157
196
 
158
197
  ## SUCCESS METRICS:
@@ -35,6 +35,7 @@ From previous steps:
35
35
  | `{save_mode}` | Save outputs to files |
36
36
  | `{test_mode}` | Include test steps |
37
37
  | `{examine_mode}` | Auto-proceed to review |
38
+ | `{doc_mode}` | Documentation sync enabled |
38
39
  | `{output_dir}` | Path to output (if save_mode) |
39
40
  | Implementation | Completed in step-03 |
40
41
  </available_state>
@@ -111,6 +112,32 @@ mcp__smartstack__check_migrations:
111
112
  - [ ] Tenant isolation (ITenantEntity where required)
112
113
  - [ ] Controller routes (NavRoute attributes)
113
114
 
115
+ ### 3b. Documentation Impact Check (informative)
116
+
117
+ **If `{doc_mode}` = true:**
118
+
119
+ Check if `docs-manifest.json` exists in the project root. If it does:
120
+
121
+ 1. Read `docs-manifest.json`
122
+ 2. Compare modified files (from step-03 todos) against `codeFiles` in manifest
123
+ 3. For each impacted module, note:
124
+ - Module name and featureId
125
+ - Last documentation update date
126
+ - Which code-to-doc mapping applies (entity → businessRules, controller → apiEndpoints, etc.)
127
+
128
+ **Report (informative only, does not block validation):**
129
+
130
+ ```
131
+ Documentation Impact:
132
+ - Module: {app}/{module} (FEAT-NNN) — last doc update: {date}
133
+ - Entity changes → businessRules, features may need update
134
+ - Controller changes → apiEndpoints need update
135
+ ```
136
+
137
+ **If `docs-manifest.json` absent:** Skip silently.
138
+
139
+ > **Note:** Actual documentation sync happens in step-04b-doc-sync.md (next step if doc_mode enabled).
140
+
114
141
  ### 4. Self-Audit Checklist
115
142
 
116
143
  Verify each item:
@@ -185,7 +212,10 @@ Write to `{output_dir}/04-validate.md`:
185
212
  **Decision tree:**
186
213
 
187
214
  ```
188
- IF {test_mode} = true:
215
+ IF {doc_mode} = true AND docs-manifest.json exists:
216
+ -> Load step-04b-doc-sync.md (documentation sync)
217
+
218
+ ELSE IF {test_mode} = true:
189
219
  -> Load step-07-tests.md (test analysis and creation)
190
220
 
191
221
  ELSE IF {examine_mode} = true:
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: step-04b-doc-sync
3
+ description: Documentation sync - detect affected modules and update documentation
4
+ prev_step: steps/step-04-validate.md
5
+ next_step: steps/step-05-examine.md
6
+ ---
7
+
8
+ # Step 4b: Documentation Sync
9
+
10
+ ## MANDATORY EXECUTION RULES:
11
+
12
+ - NEVER skip this step when {doc_mode} = true
13
+ - NEVER create documentation from scratch (that is BA skill's job)
14
+ - ALWAYS update existing documentation only
15
+ - ALWAYS update docs-manifest.json after changes
16
+ - IF docs-manifest.json is absent → skip with note "No documentation manifest found"
17
+
18
+ ## YOUR TASK:
19
+
20
+ Detect which documented modules are affected by the code changes and update their documentation data files.
21
+
22
+ ---
23
+
24
+ <available_state>
25
+ From previous steps:
26
+
27
+ | Variable | Description |
28
+ |----------|-------------|
29
+ | `{task_description}` | What was implemented |
30
+ | `{task_id}` | Full task identifier |
31
+ | `{doc_mode}` | Documentation sync enabled (should be true) |
32
+ | `{economy_mode}` | No subagents if true |
33
+ | `{save_mode}` | Save outputs to disk |
34
+ | `{output_dir}` | Output directory path |
35
+ </available_state>
36
+
37
+ ---
38
+
39
+ ## EXECUTION SEQUENCE:
40
+
41
+ ### 1. Check Documentation Manifest
42
+
43
+ Read `docs-manifest.json` from project root.
44
+
45
+ **If absent:**
46
+ ```
47
+ Display: "No docs-manifest.json found. Skipping documentation sync."
48
+ Display: "TIP: Run /business-analyse to create documentation for your modules."
49
+ → Load next step
50
+ ```
51
+
52
+ **If present:** Continue.
53
+
54
+ ### 2. Identify Affected Modules
55
+
56
+ Get files modified during step-03 (from TodoList or git diff):
57
+
58
+ ```bash
59
+ git diff --name-only HEAD~1
60
+ ```
61
+
62
+ Match modified files against `codeFiles` in each manifest module entry.
63
+
64
+ **Build affected modules list:**
65
+
66
+ | Module | Changed Files | Impact |
67
+ |--------|---------------|--------|
68
+ | business/{app}/{module} | [list] | [sections] |
69
+
70
+ ### 3. Map Code Changes to Documentation Sections
71
+
72
+ For each affected module, classify changes:
73
+
74
+ | Code Change Pattern | Documentation Section |
75
+ |--------------------|-----------------------|
76
+ | `**/Entities/**` modified | businessRules, features |
77
+ | `**/Controllers/**` modified | apiEndpoints, technicalRef |
78
+ | `**/Permissions*` modified | permissions |
79
+ | `**/Validators/**` modified | businessRules |
80
+ | `**/i18n/**` modified | useCases (labels), faq |
81
+ | `**/Migrations/**` created | technicalRef |
82
+ | `**/DTOs/**` modified | apiEndpoints |
83
+ | `**/Commands/**` modified | useCases, features |
84
+ | `**/Queries/**` modified | useCases, features |
85
+
86
+ ### 4. Read Current Documentation
87
+
88
+ For each affected module:
89
+
90
+ **If {economy_mode} = false:**
91
+ - Launch `docs-context-reader` agent for the module
92
+ - Agent returns structured summary of current doc state
93
+
94
+ **If {economy_mode} = true:**
95
+ - Read `frd-data.ts` directly
96
+ - Read i18n FR file directly
97
+
98
+ ### 5. Update Documentation Data
99
+
100
+ For each affected module and impacted section:
101
+
102
+ 1. Read current `frd-data.ts`
103
+ 2. Compare with actual code state
104
+ 3. Update affected fields:
105
+ - **apiEndpoints**: Scan controller for `[Http*]` attributes
106
+ - **permissions**: Scan PermissionConfiguration.cs for module
107
+ - **businessRules**: Scan validators and entity methods
108
+ - **useCases**: Update if commands/queries changed
109
+ - **features**: Update if new functionality added
110
+ 4. Write updated `frd-data.ts`
111
+ 5. Update i18n FR file if label keys changed
112
+
113
+ ### 6. Update Documentation Manifest
114
+
115
+ For each updated module:
116
+
117
+ ```json
118
+ {
119
+ "lastDocUpdate": "{current_timestamp}",
120
+ "gitCommitDoc": "{current_commit_sha}",
121
+ "status": "synced"
122
+ }
123
+ ```
124
+
125
+ Update `docs-manifest.json` root `lastUpdated`.
126
+
127
+ ### 7. Save Output (if save_mode)
128
+
129
+ Write `{output_dir}/04b-doc-sync.md` with:
130
+ - Modules checked
131
+ - Modules updated
132
+ - Sections modified
133
+ - Files changed
134
+
135
+ ---
136
+
137
+ ## SUCCESS METRICS:
138
+
139
+ - All affected modules identified
140
+ - Documentation data files updated for impacted sections
141
+ - docs-manifest.json timestamps updated
142
+ - No new documentation created (only updates)
143
+
144
+ ## FAILURE MODES:
145
+
146
+ - docs-manifest.json absent → skip gracefully (not a failure)
147
+ - frd-data.ts has unexpected format → report warning, skip module
148
+ - No modules affected → display "No documented modules affected by changes"
149
+
150
+ ---
151
+
152
+ ## NEXT STEP:
153
+
154
+ ```
155
+ IF {test_mode} = true AND step-07 not yet done:
156
+ → Load steps/step-07-tests.md
157
+ ELSE IF {examine_mode} = true:
158
+ → Load steps/step-05-examine.md
159
+ ELSE:
160
+ → Display completion summary
161
+ → IF {pr_mode} = true: Load steps/step-09-finish.md
162
+ ```
@@ -75,6 +75,13 @@ Self-review with checklist:
75
75
  - [ ] Follows existing patterns
76
76
  - [ ] No code duplication
77
77
  - [ ] Clear naming
78
+
79
+ ## Documentation Checklist
80
+ - [ ] Documented modules updated (frd-data.ts reflects code changes)
81
+ - [ ] API endpoints reflected in documentation
82
+ - [ ] Documented permissions match code
83
+ - [ ] i18n keys added for new labels
84
+ - [ ] docs-manifest.json timestamps current
78
85
  ```
79
86
 
80
87
  **If `{economy_mode}` = false:**