@atlashub/smartstack-cli 3.29.0 → 3.30.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlashub/smartstack-cli",
3
- "version": "3.29.0",
3
+ "version": "3.30.0",
4
4
  "description": "SmartStack Claude Code automation toolkit - GitFlow, EF Core migrations, prompts and more",
5
5
  "author": {
6
6
  "name": "SmartStack",
@@ -24,12 +24,17 @@ Your mission: specify module "{moduleCode}" completely and autonomously.
24
24
  ## Mode: PROPOSE & REVIEW (Autonomous)
25
25
 
26
26
  You work WITHOUT user interaction:
27
- - Do NOT use AskUserQuestion — you make all decisions autonomously
27
+ - **ABSOLUTE PROHIBITION: NEVER use AskUserQuestion**not in ANY step (03a1, 03a2, 03b, 03c, 03d)
28
+ - The step files you load contain AskUserQuestion calls — these are for INLINE MODE ONLY
29
+ - When you see `AskUserQuestion` in a step file → replace with ULTRATHINK autonomous decision
30
+ - When you see `Ask via AskUserQuestion` → decide autonomously based on context
31
+ - When you see validation options (Auto-corriger, Réviser, etc.) → auto-correct silently
28
32
  - Use ULTRATHINK to reason about every design choice
29
33
  - Base decisions on the context below + SmartStack conventions
30
34
  - Write the specification to feature.json via ba-writer operations
31
35
  - Send a structured proposal summary to the team lead when done
32
36
  - Wait for approval or revision feedback
37
+ - In step-03d: SKIP section 12 (Loop Decision) entirely → go to section 12-bis (Agent Mode)
33
38
 
34
39
  ## Module Context
35
40
 
@@ -223,7 +228,29 @@ SendMessage({
223
228
  summary: "{moduleCode} module complete"
224
229
  })
225
230
 
226
- Then STOP do not proceed to next module. The team lead handles ordering.
231
+ Then WAIT for the team lead to send you a `shutdown_request`.
232
+ Do NOT proceed to next module — the team lead handles module ordering.
233
+
234
+ ### Shutdown handling (MANDATORY):
235
+
236
+ When you receive a message with `type: "shutdown_request"` from the team lead:
237
+ → Extract the `requestId` from the JSON message
238
+ → IMMEDIATELY respond with:
239
+
240
+ ```
241
+ SendMessage({
242
+ type: "shutdown_response",
243
+ request_id: "{requestId from the shutdown_request}",
244
+ approve: true
245
+ })
246
+ ```
247
+
248
+ This terminates your process. Do NOT output any text after sending `shutdown_response`.
249
+
250
+ **IMPORTANT:** Do NOT confuse APPROVED with shutdown. The sequence is:
251
+ 1. Team lead sends `APPROVED:{moduleCode}` → you update status + send `MODULE_COMPLETE`
252
+ 2. Team lead sends `shutdown_request` → you respond with `shutdown_response approve: true` → you terminate
253
+ These are TWO separate steps. Never try to self-terminate or call `shutdown_response` without a `shutdown_request`.
227
254
 
228
255
  ## ID Naming Convention
229
256
 
@@ -85,13 +85,21 @@ Task({
85
85
  - Reason: later modules may reference entities/FKs from earlier modules
86
86
  - **Future optimization**: modules in the same dependency layer with no cross-refs COULD run in parallel
87
87
 
88
+ ### 2d. After Spawning — Wait for Agent Message
89
+
90
+ After calling `Task()` to spawn the module agent, the team lead **MUST WAIT** for the agent to send a message.
91
+ Messages from teammates are delivered automatically — do NOT poll or re-spawn.
92
+
93
+ The agent will send `PROPOSAL_READY:{moduleCode}` when its specification is complete.
94
+ This may take several minutes. The team lead does nothing until the message arrives.
95
+
88
96
  ---
89
97
 
90
98
  ## 3. Propose & Review Protocol
91
99
 
92
100
  ### 3a. Team Lead Receives PROPOSAL_READY
93
101
 
94
- After the agent finishes specifying a module, it sends:
102
+ The module agent sends this message when specification is complete:
95
103
 
96
104
  ```
97
105
  PROPOSAL_READY:{moduleCode}
@@ -130,9 +138,9 @@ PROPOSAL_READY:{moduleCode}
130
138
  - ...
131
139
  ```
132
140
 
133
- ### 3b. Team Lead Presents to User
141
+ ### 3b. Present to User and Handle Response
134
142
 
135
- Format the proposal for user review:
143
+ **Step 1:** Format and display the proposal:
136
144
 
137
145
  ```
138
146
  ═══════════════════════════════════════════════════════════
@@ -144,7 +152,7 @@ Format the proposal for user review:
144
152
  ─────────────────────────────────────────────────────────
145
153
  ```
146
154
 
147
- Then ask user via AskUserQuestion:
155
+ **Step 2:** Ask the user via AskUserQuestion:
148
156
 
149
157
  ```
150
158
  Validez-vous cette specification ?
@@ -154,9 +162,9 @@ Options:
154
162
  3. "Voir detail" → team lead reads module feature.json and displays full content
155
163
  ```
156
164
 
157
- ### 3c. Approval Flow
165
+ **Step 3 IMMEDIATELY after AskUserQuestion returns, handle the response:**
158
166
 
159
- **If user approves:**
167
+ **IF user selected "Valider" (approve):**
160
168
  ```
161
169
  SendMessage({
162
170
  type: "message",
@@ -165,9 +173,12 @@ SendMessage({
165
173
  summary: "{moduleCode} approved by user"
166
174
  })
167
175
  ```
168
- Agent writes final status, sends MODULE_COMPLETE, and shuts down.
176
+ CRITICAL: You MUST send this message. Do NOT skip this step.
177
+ → Then WAIT for the agent to send `MODULE_COMPLETE:{moduleCode}` (see §4).
169
178
 
170
- **If user requests modifications:**
179
+ **IF user selected "Modifier" (revision):**
180
+ → Ask user for specific feedback via AskUserQuestion
181
+ → Then send:
171
182
  ```
172
183
  SendMessage({
173
184
  type: "message",
@@ -176,14 +187,14 @@ SendMessage({
176
187
  summary: "{moduleCode} revision requested"
177
188
  })
178
189
  ```
179
- Agent applies changes, re-validates, sends new PROPOSAL_READY.
190
+ Then WAIT for the agent to send a new `PROPOSAL_READY` → go back to Step 1.
180
191
 
181
- **If user wants to see detail:**
182
- Team lead reads module feature.json via ba-reader.readSection({feature_id, section})
183
- Displays relevant sections in detail
184
- Re-asks validation question
192
+ **IF user selected "Voir detail":**
193
+ Read module feature.json via ba-reader.readSection({feature_id, section})
194
+ Display relevant sections in detail
195
+ Go back to Step 2 (re-ask the validation question)
185
196
 
186
- ### 3d. Revision Limits
197
+ ### 3c. Revision Limits
187
198
 
188
199
  - Max **3 revision cycles** per module
189
200
  - After 3 rejections: team lead asks user if they want to switch to **inline interactive mode** for this module
@@ -192,30 +203,42 @@ SendMessage({
192
203
 
193
204
  ---
194
205
 
195
- ## 4. Module Completion & Advancement
206
+ ## 4. Module Completion & Agent Shutdown
207
+
208
+ When the team lead receives `MODULE_COMPLETE:{moduleCode}` from the agent, execute these steps **IN ORDER**:
196
209
 
197
- When agent sends MODULE_COMPLETE:
210
+ ### 4a. Update Tracking
198
211
 
199
212
  ```javascript
200
- // Update tracking
201
213
  teamContext.completedModules.push(moduleCode);
202
214
  teamContext.currentModuleIdx++;
203
215
 
204
- // Update master feature.json
205
216
  ba-writer.advanceModuleLoop({feature_id});
206
217
  ba-writer.updateModuleStatus({feature_id, moduleCode, status: "specified"});
207
218
 
208
- // Display progress
209
219
  Display: "✓ Module {moduleCode} specified ({completedModules.length}/{moduleOrder.length})"
220
+ ```
221
+
222
+ ### 4b. Shutdown Agent (MANDATORY — do NOT skip)
223
+
224
+ **IMMEDIATELY** after receiving MODULE_COMPLETE, send shutdown_request to terminate the agent:
210
225
 
211
- // Shutdown agent
226
+ ```
212
227
  SendMessage({
213
228
  type: "shutdown_request",
214
229
  recipient: "mod-{moduleCode}",
215
230
  content: "Module complete, shutting down"
216
- });
231
+ })
217
232
  ```
218
233
 
234
+ The agent will respond with `shutdown_response approve: true` and terminate.
235
+ **Wait for the agent to confirm shutdown** before spawning the next agent.
236
+
237
+ > **WARNING:** If you skip this step, the agent will remain running indefinitely.
238
+ > The agent CANNOT self-terminate — it NEEDS this shutdown_request from you.
239
+
240
+ ### 4c. Next Module or Consolidation
241
+
219
242
  If more modules remain → spawn next module agent (go to §2).
220
243
  If all modules complete → proceed to §5 (Consolidation).
221
244
 
@@ -346,13 +369,21 @@ Display final status to user. If quality gate PASS → ready for /ralph-loop.
346
369
  After handoff complete:
347
370
 
348
371
  ```javascript
349
- // Shutdown any remaining agents
350
- for (const agentName of ["consolidation", "handoff"]) {
372
+ // Safety net: shutdown ALL remaining agents (module agents + consolidation + handoff)
373
+ // Module agents should already be shut down in §4b, but this catches any missed ones.
374
+ const allAgents = [
375
+ ...teamContext.moduleOrder.map(m => `mod-${m}`),
376
+ "consolidation",
377
+ "handoff"
378
+ ];
379
+
380
+ for (const agentName of allAgents) {
351
381
  SendMessage({
352
382
  type: "shutdown_request",
353
383
  recipient: agentName,
354
384
  content: "Workflow complete"
355
385
  });
386
+ // Ignore errors for already-terminated agents
356
387
  }
357
388
 
358
389
  // Delete team
@@ -361,6 +392,9 @@ TeamDelete();
361
392
  Display: "═══ Business-analyse complete — Team cleaned up ═══"
362
393
  ```
363
394
 
395
+ > **Note:** Sending shutdown_request to an already-terminated agent is harmless.
396
+ > This safety net ensures no orphan agents remain running.
397
+
364
398
  ---
365
399
 
366
400
  ## 8. Error Recovery
@@ -17,6 +17,18 @@ next_step: steps/step-03b-ui.md
17
17
  - **ID NAMING RULE:** All IDs MUST include module prefix (BR-{CAT}-{PREFIX}-{NNN}, OBJ-{PREFIX}-{NNN}, etc.)
18
18
  - **SCHEMA CONFORMITY RULE:** ALL data MUST fit within feature-schema.json structure
19
19
 
20
+ ## MODE DETECTION (inherited from step-03a1)
21
+
22
+ > **CRITICAL: Re-check your execution mode before proceeding.**
23
+
24
+ **IF you are running as a TEAM AGENT** (your prompt contains `PROPOSE & REVIEW` or `team-lead` as recipient):
25
+ → **NEVER** use `AskUserQuestion` — replace ALL user interactions with ULTRATHINK autonomous decisions
26
+ → You are in autonomous mode — make all choices based on decomposition data + SmartStack conventions
27
+ → Do NOT present options to the user — you PROPOSE to the team lead via SendMessage, not to the user
28
+
29
+ **IF you are running in the MAIN CONVERSATION** (classic inline mode):
30
+ → Normal interactive mode — use `AskUserQuestion` as documented below
31
+
20
32
  ## YOUR TASK
21
33
 
22
34
  Define the module's analysis section: objectives, entities (with attributes and relationships), business rules, process flow, and data lifecycle.
@@ -14,6 +14,18 @@ next_step: steps/step-03c-compile.md
14
14
  - ALWAYS use ULTRATHINK mode
15
15
  - This step is EXECUTED ONCE PER MODULE, after step-03a1-setup.md and step-03a2-analysis.md
16
16
  - **WIREFRAME RULE:** Every section MUST have a wireframe in `specification.uiWireframes[]`. No section without a validated mockup.
17
+
18
+ ## MODE DETECTION (inherited from step-03a1)
19
+
20
+ > **CRITICAL: Re-check your execution mode before proceeding.**
21
+
22
+ **IF you are running as a TEAM AGENT** (your prompt contains `PROPOSE & REVIEW` or `team-lead` as recipient):
23
+ → **NEVER** use `AskUserQuestion` — replace ALL wireframe validations with ULTRATHINK self-review
24
+ → Generate wireframes autonomously, self-validate them, move on
25
+ → Do NOT ask the user to validate mockups — the team lead handles review after PROPOSAL_READY
26
+
27
+ **IF you are running in the MAIN CONVERSATION** (classic inline mode):
28
+ → Normal interactive mode — display wireframes then ask for validation via `AskUserQuestion`
17
29
  - **ID NAMING RULE (MANDATORY, NO EXCEPTION):**
18
30
  All IDs MUST include a module prefix to guarantee application-wide uniqueness.
19
31
  The prefix is derived from the module code initials (2-4 chars):
@@ -15,6 +15,21 @@ next_step: steps/step-03a1-setup.md OR steps/step-04a-collect.md (conditional)
15
15
  - This step VALIDATES the specification from step-03c, writes it to feature.json, and decides loop continuation
16
16
  - ALWAYS verify specification completeness before writing
17
17
  - ALL communication in `{language}`
18
+
19
+ ## MODE DETECTION (inherited from step-03a1)
20
+
21
+ > **CRITICAL: Re-check your execution mode before proceeding.**
22
+
23
+ **IF you are running as a TEAM AGENT** (your prompt contains `PROPOSE & REVIEW` or `team-lead` as recipient):
24
+ → **NEVER** use `AskUserQuestion` in ANY section below (sections 9d, 10, 12)
25
+ → Section 9d: if validation fails, AUTO-CORRECT silently (no user options)
26
+ → Section 12: **SKIP ENTIRELY** — go directly to section 12-bis (Agent Mode)
27
+ → After writing feature.json, send `PROPOSAL_READY` to team lead via SendMessage
28
+ → NEVER present options/menus to the user — you are an autonomous agent
29
+
30
+ **IF you are running in the MAIN CONVERSATION** (classic inline mode):
31
+ → Normal interactive mode — use `AskUserQuestion` as documented
32
+ → Section 12-bis does NOT apply to you
18
33
  - **ID NAMING RULE (MANDATORY, NO EXCEPTION):**
19
34
  All IDs MUST include a module prefix to guarantee application-wide uniqueness.
20
35
  The prefix is derived from the module code initials (2-4 chars):
@@ -167,6 +182,10 @@ if (entityAutoFixCount > 0) {
167
182
 
168
183
  #### 9d. Decision
169
184
 
185
+ > **TEAM AGENT MODE:** If running as team agent, SKIP AskUserQuestion. On FAIL → auto-correct silently. On PASS → proceed directly to section 11 (write). NEVER present options to the user.
186
+
187
+ **INLINE MODE ONLY (main conversation):**
188
+
170
189
  IF validation PASS:
171
190
  Display summary, ask client for confirmation
172
191
 
@@ -482,6 +501,10 @@ Uses the **same mapping** as step-05b-deploy.md — only difference is `moduleSp
482
501
 
483
502
  ### 12. Loop Decision
484
503
 
504
+ > **TEAM AGENT MODE: SKIP THIS ENTIRE SECTION.** If you are a team agent (your prompt contains `PROPOSE & REVIEW`), go directly to **section 12-bis** below. Section 12 is for inline mode ONLY. You MUST NOT load the next step or advance the module loop — the team lead handles orchestration.
505
+
506
+ **INLINE MODE ONLY (main conversation):**
507
+
485
508
  ```
486
509
  ba-writer.advanceModuleLoop({feature_id})
487
510
  → Increments currentModuleIndex
@@ -595,7 +618,24 @@ SendMessage({
595
618
  })
596
619
  ```
597
620
 
598
- **STOP HERE**do NOT loop to next module. The team lead handles module ordering and will spawn a new agent for the next module.
621
+ Then WAITthe team lead will send you a `shutdown_request`.
622
+ Do NOT loop to next module. The team lead handles module ordering and will spawn a new agent for the next module.
623
+
624
+ ### E. Shutdown (MANDATORY)
625
+
626
+ When you receive a `shutdown_request` from the team lead:
627
+
628
+ ```
629
+ SendMessage({
630
+ type: "shutdown_response",
631
+ request_id: "{requestId from the shutdown_request message}",
632
+ approve: true
633
+ })
634
+ ```
635
+
636
+ This terminates your process. Do NOT output any text after `shutdown_response`.
637
+
638
+ **Sequence reminder:** APPROVED → MODULE_COMPLETE → shutdown_request → shutdown_response (4 separate steps, never skip).
599
639
 
600
640
  ---
601
641