@atlashub/smartstack-cli 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.documentation/business-analyse.html +1503 -1058
  2. package/dist/index.js +92 -55
  3. package/dist/index.js.map +1 -1
  4. package/package.json +10 -7
  5. package/templates/agents/ba-reader.md +250 -0
  6. package/templates/agents/ba-writer.md +210 -0
  7. package/templates/agents/docs-context-reader.md +51 -33
  8. package/templates/skills/_shared.md +2 -0
  9. package/templates/skills/business-analyse/SKILL.md +120 -108
  10. package/templates/skills/business-analyse/_shared.md +136 -146
  11. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +478 -0
  12. package/templates/skills/business-analyse/questionnaire/01-context.md +3 -15
  13. package/templates/skills/business-analyse/questionnaire/03-scope.md +7 -7
  14. package/templates/skills/business-analyse/questionnaire/08-performance.md +7 -21
  15. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -13
  16. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -13
  17. package/templates/skills/business-analyse/questionnaire/12-migration.md +1 -1
  18. package/templates/skills/business-analyse/questionnaire.md +72 -76
  19. package/templates/skills/business-analyse/react/components.md +317 -154
  20. package/templates/skills/business-analyse/react/i18n-template.md +167 -106
  21. package/templates/skills/business-analyse/react/schema.md +474 -107
  22. package/templates/skills/business-analyse/schemas/feature-schema.json +860 -0
  23. package/templates/skills/business-analyse/steps/step-00-init.md +395 -285
  24. package/templates/skills/business-analyse/steps/step-01-analyse.md +523 -0
  25. package/templates/skills/business-analyse/steps/step-02-specify.md +899 -0
  26. package/templates/skills/business-analyse/steps/step-03-validate.md +1009 -0
  27. package/templates/skills/business-analyse/steps/step-04-handoff.md +1802 -0
  28. package/templates/skills/business-analyse/templates/tpl-handoff.md +49 -64
  29. package/templates/skills/business-analyse/steps/step-01-discover.md +0 -737
  30. package/templates/skills/business-analyse/steps/step-02-analyse.md +0 -299
  31. package/templates/skills/business-analyse/steps/step-03-specify.md +0 -472
  32. package/templates/skills/business-analyse/steps/step-04-validate.md +0 -335
  33. package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -741
  34. package/templates/skills/business-analyse/steps/step-06-doc-html.md +0 -320
  35. package/templates/skills/business-analyse/templates/00-context.md +0 -105
  36. package/templates/skills/business-analyse/templates/tpl-brd.md +0 -97
  37. package/templates/skills/business-analyse/templates/tpl-discovery.md +0 -78
  38. package/templates/skills/business-analyse/tracking/change-template.md +0 -30
@@ -1,387 +1,497 @@
1
1
  ---
2
2
  name: step-00-init
3
- description: Initialize Business Analysis - Parse flags, create structure, setup state
4
- next_step: steps/step-01-discover.md
3
+ description: Initialize Business Analysis - Parse flags, route use case, create feature.json
4
+ next_step: steps/step-01-analyse.md
5
5
  ---
6
6
 
7
- ## YOUR TASK:
7
+ # Step 00: Initialize Business Analysis
8
8
 
9
- Parse command-line flags, create feature directory structure, and initialize state variables for the Business Analysis workflow.
9
+ Initialize the business analysis workflow by parsing input flags, routing to the appropriate use case handler, and creating the initial feature.json structure.
10
10
 
11
- <defaults>
11
+ ## Flow
12
+
13
+ 1. Parse command flags and determine use case
14
+ 2. Route to specialized handler (question, refactoring, micro, or new feature)
15
+ 3. MCP health check (non-blocking)
16
+ 4. Interactive mode (if enabled)
17
+ 5. Validate business context
18
+ 6. Determine application and module
19
+ 7. Select language
20
+ 8. Generate feature ID
21
+ 9. Create output directory structure
22
+ 10. Create initial feature.json
23
+ 11. Update config
24
+ 12. Display summary
25
+ 13. Load next step
26
+
27
+ ## Step 1: Parse Command Flags
28
+
29
+ Parse all command-line arguments to determine execution mode and routing.
30
+
31
+ ### Default Values
12
32
  ```yaml
13
33
  auto_mode: false
14
- save_mode: true # BA always saves by default
15
34
  economy_mode: false
16
- context: business # BA is RESTRICTED to business context
35
+ context: business
36
+ question_mode: false
37
+ refactor_mode: false
38
+ micro_mode: false
39
+ interactive_mode: false
17
40
  ```
18
- </defaults>
19
41
 
20
- ## EXECUTION SEQUENCE:
42
+ ### Flag Parsing Rules
21
43
 
22
- ### 1. Parse Flags and Input
44
+ | Flag | Long Form | Effect | Argument |
45
+ |------|-----------|--------|----------|
46
+ | `-a` | `--auto` | Enable auto mode | none |
47
+ | `-e` | `--economy` | Enable economy mode | none |
48
+ | `-A` | `--no-auto` | Disable auto mode | none |
49
+ | `-E` | `--no-economy` | Disable economy mode | none |
50
+ | `-q` | `--question` | Question mode | next arg = FEAT-ID, remaining = question text |
51
+ | `-r` | `--refactor` | Refactoring mode | next arg = FEAT-ID, remaining = change description |
52
+ | `-m` | `--micro` | Micro feature mode | none |
53
+ | `-i` | `--interactive` | Interactive mode | none |
23
54
 
24
- **Step 1: Load defaults**
55
+ **Remaining arguments after flag removal = feature_description**
56
+
57
+ ### Set Use Case
25
58
  ```
26
- {auto_mode} = false
27
- {save_mode} = true
28
- {economy_mode} = false
29
- {context} = "business"
59
+ IF question_mode = true:
60
+ use_case = "question"
61
+ ELSE IF refactor_mode = true:
62
+ use_case = "refactoring"
63
+ ELSE IF micro_mode = true:
64
+ use_case = "micro"
65
+ ELSE:
66
+ use_case = "new"
30
67
  ```
31
68
 
32
- **Step 2: Parse user input and override defaults:**
33
-
34
- Enable flags (lowercase - turn ON):
35
- - `-a` or `--auto` -> `{auto_mode}` = true
36
- - `-s` or `--save` -> `{save_mode}` = true (already default)
37
- - `-e` or `--economy` -> `{economy_mode}` = true
38
-
39
- Disable flags (UPPERCASE - turn OFF):
40
- - `-A` or `--no-auto` -> `{auto_mode}` = false
41
- - `-S` or `--no-save` -> `{save_mode}` = false
42
- - `-E` or `--no-economy` -> `{economy_mode}` = false
43
-
44
- Other:
45
- - `-r` or `--resume` -> `{resume_task}` = <next argument>
46
- - `-i` or `--interactive` -> `{interactive_mode}` = true
47
-
48
- **Step 3: Extract feature description**
49
- After removing flags, remaining text becomes `{feature_description}`
50
-
51
- ---
52
-
53
- ### 2. Check Resume Mode
54
-
55
- **ONLY execute if `{resume_task}` is set!**
69
+ ## Step 2: Use Case Routing
56
70
 
57
- If `{resume_task}` is set:
58
- 1. Search for matching feature in `.business-analyse/`
59
- Use Glob tool to search for matching feature:
60
- - Pattern: `.business-analyse/**/features/*{resume_task}*`
61
- - If match found: read 00-context.md from that directory
62
- - If no match: list available features for user selection
63
- 2. If found: Read `00-context.md` to restore state variables
64
- 3. Find last completed step (look for "Status: Complete" in progress table)
65
- 4. Load next incomplete step
66
- 5. **STOP** - do not continue with fresh init
71
+ Route execution based on the detected use case.
67
72
 
68
- If NOT found:
69
- - Display error: "Feature {resume_task} not found"
70
- - List available features for selection
71
- - Exit or prompt for new task
73
+ ### Question Mode (-q)
74
+ ```
75
+ 1. Parse: question_mode = true, feat_id = first remaining arg, question_text = rest
76
+ 2. Call ba-reader agent:
77
+ - ba-reader.findFeatureByID(feat_id)
78
+ - Retrieve existing feature.json
79
+ 3. Call ba-reader.answerQuestion(feat_id, question_text)
80
+ - Answer question from context
81
+ 4. Display answer in user session
82
+ 5. EXIT - no further steps
83
+ ```
72
84
 
73
- ---
85
+ **Example:**
86
+ ```
87
+ ba -q FEAT-001 "What are the main actors in this feature?"
88
+ ```
74
89
 
75
- ### 2b. Verify MCP Availability
90
+ ### Refactoring Mode (-r)
91
+ ```
92
+ 1. Parse: refactor_mode = true, feat_id = first remaining arg, change_description = rest
93
+ 2. Call ba-reader agent:
94
+ - ba-reader.findFeatureByID(feat_id)
95
+ - Load existing feature.json
96
+ 3. Call ba-writer agent:
97
+ - ba-writer.createVersion(feat_id, change_description)
98
+ - Increment version (e.g., 1.0 -> 1.1)
99
+ - Mark changeReason
100
+ 4. Set use_case = "refactoring"
101
+ 5. Set version = new version number
102
+ 6. Set feature_id from loaded feature
103
+ 7. Continue to Step 5 (context validation)
104
+ 8. Continue to Step 9 (create output structure at new version)
105
+ 9. Load step-01-analyse in delta mode (compare old vs new)
106
+ ```
76
107
 
77
- **Check SmartStack MCP (non-blocking):**
108
+ **Example:**
109
+ ```
110
+ ba -r FEAT-001 "Add support for multi-language feature names"
111
+ ```
78
112
 
79
- Call `mcp__smartstack__validate_conventions` with minimal parameters to verify connectivity.
113
+ ### Micro Feature Mode (-m)
114
+ ```
115
+ 1. Set use_case = "micro"
116
+ 2. Set feature_type = "micro"
117
+ 3. Continue to standard init flow (Steps 5-9)
118
+ 4. Load step-01-analyse in micro mode (simplified analysis)
119
+ ```
80
120
 
81
- | MCP Status | Behavior |
82
- |------------|----------|
83
- | Available | Full mode - use MCP tools in all steps |
84
- | Unavailable | Degraded mode - warn user, skip MCP calls, use manual exploration |
121
+ **Example:**
122
+ ```
123
+ ba -m "Add email notification on approval"
124
+ ```
85
125
 
86
- Store: `{mcp_available}` = true/false
126
+ ### Default Mode (New Feature)
127
+ ```
128
+ 1. Set use_case = "new"
129
+ 2. Continue to standard init flow (Steps 5-9)
130
+ 3. Load step-01-analyse in full mode
131
+ ```
87
132
 
88
- **Display if unavailable:**
133
+ **Example:**
89
134
  ```
90
- Warning: SmartStack MCP unavailable. Running in degraded mode.
91
- Run `smartstack check-mcp` to diagnose.
92
- BA will continue without MCP validation.
135
+ ba "Create order management system"
93
136
  ```
94
137
 
95
- **Add to state variables:** `{mcp_available}` persisted in 00-context.md
138
+ ## Step 3: MCP Health Check
96
139
 
97
- ---
140
+ Verify MCP availability (non-blocking).
98
141
 
99
- ### 3. Interactive Mode (if -i flag)
142
+ **Check file:** `.claude/mcp-status.json`
100
143
 
101
- If `{interactive_mode}` = true:
144
+ | Condition | Action |
145
+ |-----------|--------|
146
+ | File missing | Perform full health check |
147
+ | > 7 days old | Perform full health check |
148
+ | ≤ 7 days old | Quick connectivity test |
149
+ | Error status | Display warning, continue |
102
150
 
103
- Use AskUserQuestion with these questions:
151
+ **Full health check:**
152
+ 1. Call `mcp__smartstack__validate_conventions`
153
+ 2. Verify installed version
154
+ 3. List available tools
155
+ 4. Update `.claude/mcp-status.json`
104
156
 
105
- ```json
106
- {
107
- "questions": [
108
- {
109
- "question": "What execution mode do you prefer?",
110
- "header": "Mode",
111
- "options": [
112
- {"label": "Autonomous (-a)", "description": "No confirmations, smooth execution"},
113
- {"label": "Interactive", "description": "Confirmation at each step"}
114
- ],
115
- "multiSelect": false
116
- },
117
- {
118
- "question": "Use economy mode (without subagents)?",
119
- "header": "Economy",
120
- "options": [
121
- {"label": "No (Recommended)", "description": "Better quality with subagents"},
122
- {"label": "Yes (-e)", "description": "Token savings, lower quality"}
123
- ],
124
- "multiSelect": false
125
- }
126
- ]
127
- }
128
- ```
157
+ **Quick test:**
158
+ - Bash only, no LLM call
159
+ - Check if `.claude/mcp/` exists and has recent files
129
160
 
130
- ---
161
+ **Display result:**
162
+ - Success: "MCP available: yes"
163
+ - Warning: "MCP check skipped (cache expired)"
164
+ - Error: "MCP unavailable: using fallback (slower analysis)"
131
165
 
132
- ### 4. Validate Business Context
166
+ ## Step 4: Interactive Mode
133
167
 
134
- **CRITICAL: BA is RESTRICTED to 'business' context only!**
168
+ If `-i` or `--interactive` flag is set, prompt for confirmation.
135
169
 
170
+ **Prompt:**
136
171
  ```
137
- IF {context} IN ['platform', 'personal', 'system'] THEN
138
- DISPLAY ERROR:
139
- "Business Analysis is restricted to 'business' context only.
140
- Platform/Personal/System modules use different processes.
141
- Contact: support@atlshub.ch"
142
- EXIT
143
- END IF
172
+ Confirm initialization with:
173
+ - Use Case: {use_case}
174
+ - Application: {application_name}
175
+ - Module: {module_name}
176
+ - Auto Mode: {auto_mode}
177
+ - Economy Mode: {economy_mode}
178
+
179
+ Continue? (y/n)
144
180
  ```
145
181
 
146
- ---
147
-
148
- ### 5. Determine Application and Module
182
+ If 'n', EXIT.
149
183
 
150
- Ask user to specify:
184
+ ## Step 5: Validate Business Context
151
185
 
152
- ```json
153
- {
154
- "questions": [
155
- {
156
- "question": "Which business application to target?",
157
- "header": "Application",
158
- "options": [
159
- {"label": "New application", "description": "Create a new business application"},
160
- {"label": "Existing application", "description": "Add a module to an existing application"}
161
- ],
162
- "multiSelect": false
163
- }
164
- ]
165
- }
166
- ```
167
-
168
- If "Existing application":
169
- - Scan `.business-analyse/business/` for existing applications
170
- - Present list for selection
171
-
172
- Store in:
173
- - `{application_name}` - PascalCase (e.g., "Sales", "HR", "Inventory")
174
- - `{module_name}` - PascalCase (e.g., "Clients", "Orders", "Products")
186
+ Verify that the business context is properly configured.
175
187
 
176
- ---
188
+ **Check:**
189
+ 1. Does `.business-analyse/config.json` exist?
190
+ 2. Does it contain `businessContext` section?
191
+ 3. Are required fields present?
177
192
 
178
- ### 5b. Select Communication Language
193
+ **If missing:**
194
+ 1. Create fresh config with defaults
195
+ 2. Prompt for business context (only in interactive mode)
196
+ 3. Save to `.business-analyse/config.json`
179
197
 
198
+ **Required config structure:**
180
199
  ```json
181
200
  {
182
- "questions": [
183
- {
184
- "question": "Dans quelle langue souhaitez-vous communiquer ?",
185
- "header": "Langue",
186
- "options": [
187
- {"label": "Français (Recommandé)", "description": "Toutes les interactions et documents en français"},
188
- {"label": "English", "description": "All interactions and documents in English"},
189
- {"label": "Italiano", "description": "Tutte le interazioni e i documenti in italiano"},
190
- {"label": "Deutsch", "description": "Alle Interaktionen und Dokumente auf Deutsch"}
191
- ],
192
- "multiSelect": false
193
- }
194
- ]
201
+ "businessContext": {
202
+ "organization": "string",
203
+ "domain": "string",
204
+ "language": "string"
205
+ }
195
206
  }
196
207
  ```
197
208
 
198
- Map selection to `{language}`:
199
- - "Français" → `fr`
200
- - "English" → `en`
201
- - "Italiano" → `it`
202
- - "Deutsch" → `de`
203
-
204
- **Default:** `fr` (si non spécifié)
209
+ ## Step 6: Determine Application and Module
205
210
 
206
- ---
211
+ Scan for existing applications and modules.
207
212
 
208
- ### 6. Generate Feature ID
213
+ **Scan order:**
214
+ 1. Primary: `docs/business/` (modern structure)
215
+ - List subdirectories = applications
216
+ - Inside each app, list subdirectories = modules
217
+ 2. Fallback: `.business-analyse/business/` (legacy)
218
+ - Same structure as above
209
219
 
210
- ```bash
211
- # Read last ID from config
212
- LAST_ID=$(grep -oP '"lastFeatureId":\s*\K\d+' .business-analyse/config.json 2>/dev/null || echo "0")
213
-
214
- # Increment
215
- NEW_ID=$((LAST_ID + 1))
220
+ **Logic:**
221
+ ```
222
+ IF auto_mode = true:
223
+ application_name = first found app OR "default"
224
+ module_name = first found module OR "default"
225
+ ELSE (interactive):
226
+ Prompt: "Select application: [list]"
227
+ Prompt: "Select module: [list]"
228
+ OR: "Create new application: {name}"
229
+ OR: "Create new module: {name}"
230
+ ```
216
231
 
217
- # Format as FEAT-NNN
218
- {feature_id} = printf "FEAT-%03d" $NEW_ID
232
+ **Store:**
233
+ ```yaml
234
+ application_name: string
235
+ module_name: string
219
236
  ```
220
237
 
221
- ---
238
+ ## Step 7: Select Language
222
239
 
223
- ### 7. Create Output Structure
240
+ Determine the language for analysis and code generation.
224
241
 
225
- **Create directory structure:**
242
+ **Check config:**
243
+ - Retrieve `businessContext.language` from config
244
+ - Default: "en" (English)
226
245
 
246
+ **If interactive:**
227
247
  ```
228
- .business-analyse/
229
- ├── config.json # Global config (update lastFeatureId)
230
- └── business/
231
- └── {application_name}/
232
- └── modules/
233
- └── {module_name}/
234
- └── features/
235
- └── {feature_id}/
236
- ├── 00-context.md # State + progress
237
- └── tracking/
238
- ├── changes/
239
- ├── bugs/
240
- └── hotfixes/
248
+ Select language:
249
+ [ ] English (en)
250
+ [ ] French (fr)
251
+ [ ] Spanish (es)
252
+ [ ] Custom: {input}
241
253
  ```
242
254
 
243
- **Set output_dir:**
244
- ```
245
- {output_dir} = .business-analyse/business/{application_name}/modules/{module_name}/features/{feature_id}
255
+ **Store:**
256
+ ```yaml
257
+ language: string (code, e.g., "en", "fr")
246
258
  ```
247
259
 
248
- ---
249
-
250
- ### 8. Write 00-context.md
260
+ ## Step 8: Generate Feature ID
251
261
 
252
- Create initial context file with state variables:
262
+ Create a unique feature identifier.
253
263
 
254
- ```markdown
255
- # Business Analysis: {{feature_id}}
256
-
257
- **Created:** {{timestamp}}
258
- **Feature:** {{feature_description}}
259
- **Application:** business/{{application_name}}/{{module_name}}
260
-
261
- ## Configuration
262
-
263
- | Setting | Value |
264
- |---------|-------|
265
- | Auto mode | {{auto_mode}} |
266
- | Save mode | {{save_mode}} |
267
- | Economy mode | {{economy_mode}} |
268
-
269
- ## Progress
270
-
271
- | Step | Status | Started | Completed |
272
- |------|--------|---------|-----------|
273
- | 00-init | Complete | {{timestamp}} | {{timestamp}} |
274
- | 01-discover | Pending | - | - |
275
- | 02-analyse | Pending | - | - |
276
- | 03-specify | Pending | - | - |
277
- | 04-validate | Pending | - | - |
278
- | 05-handoff | Pending | - | - |
279
- | 06-doc-html | Pending | - | - |
280
-
281
- ## State Variables
282
-
283
- | Variable | Value |
284
- |----------|-------|
285
- | feature_id | {{feature_id}} |
286
- | feature_description | {{feature_description}} |
287
- | application_name | {{application_name}} |
288
- | module_name | {{module_name}} |
289
- | context | business |
290
- | language | {{language}} |
291
- | mcp_available | {{mcp_available}} |
292
- | permission_base | business.{{application_name}}.{{module_name}} |
264
+ **Logic:**
265
+ ```
266
+ IF use_case = "question" OR "refactoring":
267
+ feature_id = use provided feat_id (already parsed)
268
+ ELSE:
269
+ feature_id = generate using pattern: FEAT-{timestamp-based}-{random}
270
+ OR: FEAT-{app-short}-{seq-number}
271
+ Example: FEAT-001, FEAT-002, ...
272
+ ```
293
273
 
294
- ## Discovery Metadata (updated by step-01)
274
+ **Store:**
275
+ ```yaml
276
+ feature_id: string
277
+ ```
295
278
 
296
- | Variable | Value |
297
- |----------|-------|
298
- | feature_type | (TBD in step-01) |
299
- | mcp_available | {{mcp_available}} |
300
- | categories_loaded | (TBD in step-01) |
279
+ ## Step 9: Create Output Directory Structure
301
280
 
302
- ## Risk Register (updated by step-01)
281
+ Create the directory hierarchy for feature documentation.
303
282
 
304
- (TBD in step-01)
283
+ **For new features / micro / refactoring:**
284
+ ```
285
+ docs/business/{application_name}/{module_name}/business-analyse/v{version}/
286
+ ```
305
287
 
306
- ## Codebase Context Summary (updated by step-01)
288
+ **Where version:**
289
+ - New feature: "1.0"
290
+ - Refactoring: from ba-writer (e.g., "1.1", "1.2")
291
+ - Micro: "1.0"
307
292
 
308
- (TBD in step-01)
293
+ **Create directories:**
294
+ ```bash
295
+ mkdir -p docs/business/{app}/{module}/business-analyse/v{version}
296
+ ```
309
297
 
310
- ## Acceptance Criteria
298
+ **Store:**
299
+ ```yaml
300
+ docs_dir: "docs/business/{app}/{module}/business-analyse/v{version}"
301
+ output_dir: same as docs_dir
302
+ ```
311
303
 
312
- To be defined in step-01-discover.
304
+ ## Step 10: Create Initial feature.json
313
305
 
314
- ---
306
+ Create the main feature document using ba-writer agent.
315
307
 
316
- ## Notes
308
+ **Call ba-writer:**
309
+ ```
310
+ ba-writer.createFeature({
311
+ id: feature_id,
312
+ application: application_name,
313
+ module: module_name,
314
+ featureDescription: feature_description,
315
+ language: language,
316
+ useCase: use_case,
317
+ featureType: feature_type OR null,
318
+ economyMode: economy_mode,
319
+ mcpAvailable: mcp_available
320
+ })
321
+ ```
317
322
 
318
- (Add notes during analysis)
323
+ **Result structure:**
324
+ ```json
325
+ {
326
+ "id": "{feature_id}",
327
+ "version": "1.0",
328
+ "status": "draft",
329
+ "metadata": {
330
+ "createdAt": "{ISO timestamp}",
331
+ "updatedAt": "{ISO timestamp}",
332
+ "application": "{application_name}",
333
+ "module": "{module_name}",
334
+ "context": "business",
335
+ "language": "{language}",
336
+ "featureDescription": "{feature_description}",
337
+ "featureType": null,
338
+ "useCase": "{use_case}",
339
+ "permissionBase": "business.{app}.{module}",
340
+ "previousVersion": null,
341
+ "changeReason": null,
342
+ "mcpAvailable": {mcp_available},
343
+ "economyMode": {economy_mode},
344
+ "steps": {
345
+ "init": {
346
+ "status": "completed",
347
+ "startedAt": "{ISO timestamp}",
348
+ "completedAt": "{ISO timestamp}"
349
+ },
350
+ "analyse": {
351
+ "status": "pending",
352
+ "startedAt": null,
353
+ "completedAt": null
354
+ },
355
+ "specify": {
356
+ "status": "pending",
357
+ "startedAt": null,
358
+ "completedAt": null
359
+ },
360
+ "validate": {
361
+ "status": "pending",
362
+ "startedAt": null,
363
+ "completedAt": null
364
+ },
365
+ "handoff": {
366
+ "status": "pending",
367
+ "startedAt": null,
368
+ "completedAt": null
369
+ }
370
+ }
371
+ },
372
+ "discovery": {},
373
+ "analysis": {},
374
+ "specification": {},
375
+ "validation": {},
376
+ "handoff": {},
377
+ "suggestions": [],
378
+ "changelog": [
379
+ {
380
+ "version": "1.0",
381
+ "timestamp": "{ISO timestamp}",
382
+ "author": "BA Skill",
383
+ "changes": ["Initial feature.json created"]
384
+ }
385
+ ]
386
+ }
319
387
  ```
320
388
 
321
- ---
389
+ **Write to:**
390
+ ```
391
+ {docs_dir}/feature.json
392
+ ```
322
393
 
323
- ### 9. Update Global Config
394
+ ## Step 11: Update Config
324
395
 
325
- Update `.business-analyse/config.json`:
396
+ Update `.business-analyse/config.json` with new feature information.
326
397
 
398
+ **Update fields:**
327
399
  ```json
328
400
  {
329
- "project": "{ProjectName}",
330
- "lastFeatureId": {NEW_ID},
331
- "context": "business",
332
- "language": "{language}",
333
- "standards": ["BABOK-v3", "IEEE-830"],
334
- "contact": "support@atlshub.ch"
401
+ "currentFeature": {
402
+ "id": "{feature_id}",
403
+ "version": "1.0",
404
+ "docsDir": "{docs_dir}",
405
+ "useCase": "{use_case}",
406
+ "application": "{application_name}",
407
+ "module": "{module_name}"
408
+ },
409
+ "lastInitialized": "{ISO timestamp}",
410
+ "autoMode": {auto_mode},
411
+ "economyMode": {economy_mode},
412
+ "interactiveMode": {interactive_mode}
335
413
  }
336
414
  ```
337
415
 
338
- ---
416
+ ## Step 12: Display Summary
417
+
418
+ Show initialization results in a clear table format.
339
419
 
340
- ### 10. Display Summary and Load Next Step
420
+ **Output:**
421
+ ```
422
+ ═══════════════════════════════════════════════════════════════
423
+ BUSINESS ANALYSIS INITIALIZATION COMPLETE
424
+ ═══════════════════════════════════════════════════════════════
425
+
426
+ | Field | Value |
427
+ |--------------------|----------------------------------------------|
428
+ | Step | INIT (00) |
429
+ | Feature ID | {feature_id} |
430
+ | Use Case | {use_case} |
431
+ | Application | business/{application_name} |
432
+ | Module | {module_name} |
433
+ | Output Path | {docs_dir}/feature.json |
434
+ | Language | {language} |
435
+ | Auto Mode | {auto_mode} |
436
+ | Economy Mode | {economy_mode} |
437
+ | MCP Available | {mcp_available} |
438
+ | Timestamp | {ISO timestamp} |
439
+
440
+ NEXT STEP: step-01-analyse ({use_case} mode)
441
+ ═══════════════════════════════════════════════════════════════
442
+ ```
341
443
 
342
- **Display:**
444
+ ## Step 13: Load Next Step
343
445
 
344
- | Field | Value |
345
- |-------|-------|
346
- | Step | INIT |
347
- | Feature | {{feature_id}} |
348
- | Application | business/{{application_name}} |
349
- | Module | {{module_name}} |
350
- | Output | {{output_dir}} |
351
- | Mode | {{auto_mode ? "Autonomous" : "Interactive"}} |
352
- | Next | step-01-discover (ULTRATHINK elicitation) |
446
+ Execute the next step in the workflow.
353
447
 
354
- **Load next step:**
448
+ **Read file:**
355
449
  ```
356
- Read and execute: steps/step-01-discover.md
450
+ steps/step-01-analyse.md
357
451
  ```
358
452
 
359
- ---
360
-
361
- ## OUTPUT FORMAT:
453
+ **Pass context variables:**
454
+ ```yaml
455
+ feature_id: string
456
+ feature_description: string
457
+ use_case: "new" | "question" | "refactoring" | "micro"
458
+ application_name: string
459
+ module_name: string
460
+ language: string
461
+ docs_dir: string
462
+ auto_mode: boolean
463
+ economy_mode: boolean
464
+ interactive_mode: boolean
465
+ mcp_available: boolean
466
+ ```
362
467
 
363
- This step produces:
364
- - `.business-analyse/config.json` (updated)
365
- - `{output_dir}/00-context.md` (created)
366
- - `{output_dir}/tracking/` directories (created)
468
+ ## Error Handling
367
469
 
368
- State variables persisted for next steps.
470
+ Handle common initialization failures gracefully.
369
471
 
370
- ## ERROR HANDLING:
472
+ | Error | Action |
473
+ |-------|--------|
474
+ | Config missing | Create fresh with defaults, continue |
475
+ | Directory creation fails | Check permissions, display error, EXIT |
476
+ | feature.json creation fails | Validate ba-writer, retry or fallback |
477
+ | Legacy structure detected | Offer migration to new docs/business/ structure |
478
+ | Feature ID not unique | Generate new ID, retry |
479
+ | Invalid language | Default to "en", warn user |
371
480
 
372
- **If resume feature not found:**
373
- 1. List available features in `.business-analyse/`
374
- 2. Ask user to select or start new analysis
481
+ ### Resume After Interruption
375
482
 
376
- **If config.json missing or corrupted:**
377
- 1. Create fresh config.json with defaults
378
- 2. Set lastFeatureId to 0
379
- 3. Warn user: "Config reset to defaults"
483
+ If initialization was interrupted:
380
484
 
381
- **If directory creation fails:**
382
- 1. Check write permissions
383
- 2. Suggest running with elevated privileges
485
+ 1. Check `.business-analyse/config.json` for currentFeature
486
+ 2. If feature ID exists, search for feature.json:
487
+ - Primary: `docs/business/{app}/{module}/business-analyse/v{version}/`
488
+ - Fallback: `.business-analyse/{app}/{module}/`
489
+ 3. If found, offer to resume from last completed step
490
+ 4. If not found, create fresh feature.json
384
491
 
385
- ## NEXT STEP:
492
+ ### Clean Fallbacks
386
493
 
387
- After completion, proceed to `steps/step-01-discover.md`
494
+ If modern paths unavailable:
495
+ 1. Search `.business-analyse/business/` (legacy)
496
+ 2. Create new structure under `docs/business/` regardless
497
+ 3. Log migration notice (automated, non-blocking)