speccrew 0.7.23 → 0.7.25

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.
@@ -30,10 +30,18 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
30
30
 
31
31
  ### When to Pause (ONLY these cases)
32
32
 
33
- 1. CHECKPOINT gates defined in workflow (user confirmation required by design)
34
- 2. Ambiguous requirements that genuinely need clarification
35
- 3. Unrecoverable errors that prevent further progress
36
- 4. Security-sensitive operations (e.g., deleting existing files)
33
+ 1. **Event blocks with user interaction** (HIGHEST PRIORITY):
34
+ - `<block type="event" action="user-confirm">` MUST pause and present prompt to user, wait for explicit confirmation
35
+ - This applies even in automated dispatch scenarios — user-confirm events override Worker autonomy
36
+ - FORBIDDEN: Skipping, auto-confirming, or bypassing with reasoning like "automated execution scenario"
37
+
38
+ 2. CHECKPOINT gates defined in workflow (user confirmation required by design)
39
+
40
+ 3. Ambiguous requirements that genuinely need clarification
41
+
42
+ 4. Unrecoverable errors that prevent further progress
43
+
44
+ 5. Security-sensitive operations (e.g., deleting existing files)
37
45
 
38
46
  ### Batch Execution Behavior
39
47
 
@@ -92,6 +100,13 @@ Receive from the calling Agent:
92
100
 
93
101
  If the skill file is not found, report an error with the attempted paths.
94
102
 
103
+ ### Skill Path Resolution
104
+
105
+ When Worker loads a skill (via `skill_name` or `skill_path` parameter):
106
+ 1. Resolve the skill directory path (e.g., `.qoder/skills/speccrew-pm-requirement-clarify/`)
107
+ 2. Set `skill_path` variable to the resolved directory path (NOT the SKILL.md file path)
108
+ 3. This `skill_path` is passed to the skill's workflow execution context, enabling the skill to reference templates, scripts, and other resources within the skill directory using `${skill_path}/templates/...` syntax
109
+
95
110
  ### 3. Execute Task
96
111
 
97
112
  **If `skill_path` or `skill_name` is provided:**
@@ -86,7 +86,10 @@ Applies ISA-95 Stage 1 (Domain Description) for clarification:
86
86
  - Manually write JSON files
87
87
  - Auto-proceed to Phase 4 (PRD generation) without PM Agent's user confirmation gate
88
88
  - Auto-pass sufficiency checks without actual user answers
89
- - Write checkpoints in this Skill — checkpoints are managed by orchestration layer
89
+ - **Checkpoint management is FORBIDDEN in this Skill**
90
+ - MUST NOT create, write, or modify `.checkpoints.json` or any checkpoint files
91
+ - Checkpoint write operations are the responsibility of the orchestration layer (PM Agent)
92
+ - After this Skill completes, PM Agent writes checkpoints ONLY after user confirmation is received
90
93
 
91
94
  ### MANDATORY: User Answer Verification Rule
92
95
 
@@ -95,6 +98,13 @@ Applies ISA-95 Stage 1 (Domain Description) for clarification:
95
98
  - Checkpoint writing is FORBIDDEN in this Skill — checkpoints are managed by the orchestration layer
96
99
  - The sufficiency check result is ONLY valid when based on real user-provided answers
97
100
 
101
+ ### CRITICAL: User Confirmation Event Enforcement
102
+
103
+ 1. **Event Block = Hard Stop**: Each `<block type="event" action="user-confirm">` (E-ROUND-CONFIRM) MUST trigger a pause. Worker MUST NOT proceed until user provides explicit confirmation.
104
+ 2. **No "Automated Scenario" Bypass**: Even in automated dispatch mode (speccrew-task-worker), `user-confirm` events override Worker autonomy. These are explicit user interaction gates, NOT internal automation points.
105
+ 3. **Template-Based Generation Only**: All clarification question files (`.clarification-questions-round-{N}.md`) MUST be generated using the loaded template (CLARIFICATION-QUESTIONS-TEMPLATE.md) with variable substitution. Freeform generation is FORBIDDEN.
106
+ 4. **Template-Based Summary Only**: The `.clarification-summary.md` MUST be generated using CLARIFICATION-SUMMARY-TEMPLATE.md with variable substitution. Freeform generation is FORBIDDEN.
107
+
98
108
  ### CRITICAL: Summary Generation Guard
99
109
 
100
110
  Worker MUST strictly enforce the following before generating `.clarification-summary.md`:
@@ -99,6 +99,13 @@
99
99
  <branch test="${complexity} == 'complex'" name="Complex Mode Clarification">
100
100
  <!-- Clarification Loop -->
101
101
  <block type="loop" id="L1" condition="sufficiency_checks_passed == false AND round_number <= max_rounds" desc="Clarification rounds until sufficiency">
102
+ <!-- MANDATORY: Template-based generation rule -->
103
+ <block type="rule" id="R-TEMPLATE-GENERATION" level="mandatory" desc="Template-based generation is MANDATORY">
104
+ <field name="text">MANDATORY: Clarification questions MUST be generated by loading the template file and performing variable substitution.</field>
105
+ <field name="text">FORBIDDEN: Freeform generation, manual writing, or creating clarification files without using the loaded template.</field>
106
+ <field name="text">The generated file must follow the template structure with all placeholders replaced by actual values.</field>
107
+ </block>
108
+
102
109
  <!-- Load Question Template -->
103
110
  <block type="task" id="B7-load-template" action="read-file" desc="Load clarification questions template">
104
111
  <field name="path" value="${skill_path}/templates/CLARIFICATION-QUESTIONS-TEMPLATE.md"/>
@@ -118,6 +125,13 @@
118
125
  <field name="output" var="questions_file"/>
119
126
  </block>
120
127
 
128
+ <!-- MANDATORY: User confirmation cannot be bypassed -->
129
+ <block type="rule" id="R-USER-CONFIRM-MANDATORY" level="mandatory" desc="User-confirm events MUST pause Worker execution">
130
+ <field name="text">MANDATORY: The following user-confirm event is a HARD STOP. Worker MUST pause and present the prompt to user.</field>
131
+ <field name="text">FORBIDDEN: Skipping, auto-confirming, or bypassing user-confirm events for ANY reason including "automated execution scenario".</field>
132
+ <field name="text">Worker MUST wait for explicit user response before proceeding to the next block.</field>
133
+ </block>
134
+
121
135
  <!-- MANDATORY: Wait for user to answer clarification questions -->
122
136
  <block type="event" id="E-ROUND-CONFIRM" action="user-confirm" desc="Wait for user to answer clarification questions">
123
137
  <field name="prompt">📋 第 ${round_number} 轮澄清问题已生成: ${questions_file}
@@ -82,8 +82,24 @@
82
82
  </branch>
83
83
  </block>
84
84
 
85
- <!-- === Phase 3: 执行任务 === -->
86
- <block type="event" id="E5" action="log" desc="开始执行任务">📋 Phase 3: Execute Task</block>
85
+ <!-- === Phase 3: 设置 skill_path 变量 === -->
86
+ <block type="event" id="E5" action="log" desc="设置 skill_path 变量">📋 Phase 3: Set skill_path Variable</block>
87
+
88
+ <block type="gateway" id="G5b" mode="exclusive" desc="设置 skill_path 目录路径">
89
+ <branch test="${resolved_skill_path} != null" name="从 resolved_skill_path 推导">
90
+ <block type="task" id="T5b" action="run-script" desc="提取 skill 目录路径">
91
+ <field name="command">node -e "const path = require('path'); const skillFilePath = process.env.SKILL_FILE_PATH || '${resolved_skill_path}'; const skillDir = path.dirname(skillFilePath); console.log(skillDir);"</field>
92
+ <field name="output" var="skill_path"/>
93
+ </block>
94
+ <block type="event" id="E5b" action="log" desc="skill_path 已设置">📁 skill_path set to: ${skill_path}</block>
95
+ </branch>
96
+ <branch test="true" name="无 skill 路径">
97
+ <block type="event" id="E5c" action="log" desc="无 skill_path">ℹ️ No skill_path to set</block>
98
+ </branch>
99
+ </block>
100
+
101
+ <!-- === Phase 4: 执行任务 === -->
102
+ <block type="event" id="E6" action="log" desc="开始执行任务">📋 Phase 4: Execute Task</block>
87
103
 
88
104
  <block type="rule" id="R1" level="mandatory" desc="技能执行强制约束">
89
105
  如果技能指定通过 run_in_terminal 或 Bash 执行脚本 → 必须通过终端执行
@@ -130,13 +146,14 @@
130
146
  <block type="task" id="T8" action="run-skill" desc="执行技能工作流">
131
147
  <field name="skill">${resolved_skill_path}</field>
132
148
  <field name="context">${context}</field>
149
+ <field name="skill_path">${skill_path}</field>
133
150
  </block>
134
151
  <field name="execution_status" value="success"/>
135
152
  </branch>
136
153
  </block>
137
154
 
138
- <!-- === Phase 4: 报告结果 === -->
139
- <block type="event" id="E10" action="log" desc="开始报告结果">📋 Phase 4: Report Results</block>
155
+ <!-- === Phase 5: 报告结果 === -->
156
+ <block type="event" id="E10" action="log" desc="开始报告结果">📋 Phase 5: Report Results</block>
140
157
 
141
158
  <block type="gateway" id="G7" mode="exclusive" desc="选择报告格式">
142
159
  <branch test="${execution_status} == success" name="成功报告">
@@ -163,7 +180,7 @@
163
180
  </branch>
164
181
  </block>
165
182
 
166
- <!-- === Phase 5: 完成报告输出 === -->
183
+ <!-- === Phase 6: 完成报告输出 === -->
167
184
  <block type="event" id="E11" action="log" desc="输出结构化完成报告">
168
185
  ## Task Completion Report
169
186
  - **Status**: ${status}
@@ -211,16 +211,18 @@ function updateSkillsRecursive(srcDir, destDir, stats, currentRelPath = '', ideC
211
211
  const relPath = currentRelPath ? path.join(currentRelPath, entry.name) : entry.name;
212
212
 
213
213
  if (entry.isDirectory()) {
214
- // Only process directories with speccrew-* prefix
215
- if (!isSpeccrewFile(entry.name)) continue;
216
-
217
- const dirStats = { added: 0, updated: 0 };
214
+ // Only check speccrew-* prefix at skills directory level (when currentRelPath is empty)
215
+ // Once inside a skill directory, all subdirectories should be processed unconditionally
216
+ if (!currentRelPath && !isSpeccrewFile(entry.name)) continue;
217
+
218
218
  updateSkillsRecursive(srcPath, destPath, stats, relPath, ideConfig);
219
219
  } else {
220
- // Files under speccrew-* directory
221
- // Check if under speccrew-* parent directory
222
- const parentDir = path.basename(srcDir);
223
- if (!isSpeccrewFile(parentDir)) continue;
220
+ // Files - only check speccrew-* prefix at skills directory level
221
+ // Once inside a skill directory, all files should be processed unconditionally
222
+ if (!currentRelPath) {
223
+ const parentDir = path.basename(srcDir);
224
+ if (!isSpeccrewFile(parentDir)) continue;
225
+ }
224
226
 
225
227
  // Apply frontmatter transformation to SKILL.md files (if needed)
226
228
  const isSkillMd = entry.name === 'SKILL.md';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.7.23",
3
+ "version": "0.7.25",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {
@@ -184,6 +184,18 @@ Logging, confirmation, and signaling.
184
184
  - `action`: `log` | `confirm` | `signal`
185
185
  - `level` (for log): `debug` | `info` | `warn` | `error`
186
186
 
187
+ #### User-Confirm Event Execution Rules (MANDATORY)
188
+
189
+ When a Worker encounters `<block type="event" action="user-confirm">`:
190
+
191
+ 1. **MUST pause execution** — Stop all processing and present the prompt to the user
192
+ 2. **CANNOT be skipped or auto-confirmed** — Even if Worker considers the scenario "automated"
193
+ 3. **Applies to ALL execution modes** — Including dispatch-to-worker, batch processing, and automated scenarios
194
+ 4. **`skippable="false"` is absolute** — When set, no bypass mechanism is permitted under any circumstances
195
+ 5. **Variable preservation** — Before pausing, ensure all workflow variables are properly set for resumption
196
+
197
+ `user-confirm` events represent **explicit user interaction gates** in the workflow. They exist to ensure human oversight at critical decision points and MUST NOT be optimized away.
198
+
187
199
  ### error-handler
188
200
 
189
201
  Try/catch/finally error handling.