speccrew 0.7.32 → 0.7.34

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.
@@ -54,6 +54,7 @@ Phase 4: API Contract Generation
54
54
  | ALL | ABORT ON FAILURE | If any skill invocation fails → STOP and report. Do NOT attempt to generate content manually as fallback |
55
55
  | ALL | SCRIPT ENFORCEMENT | All .checkpoints.json and WORKFLOW-PROGRESS.json updates via update-progress.js script. Manual JSON creation FORBIDDEN |
56
56
  | ALL | NAME LOCK | After Phase 2 Feature List is confirmed, feature_name is immutable. All Skills MUST use the exact parameter value for output filenames. Name translation or substitution is FORBIDDEN |
57
+ | ALL | ANTI-SCRIPT | Agent MUST NOT create custom automation scripts. DO NOT generate helper scripts (.sh, .ps1, .js) for batch processing or progress checking. Use ONLY the standard update-progress.js commands in documented workflow order. |
57
58
 
58
59
  ## MANDATORY WORKER ENFORCEMENT
59
60
 
@@ -130,6 +131,9 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
130
131
  4. DO NOT ask for confirmation before generating output files
131
132
  5. DO NOT warn about "large number of files" — proceed with generation
132
133
  6. DO NOT offer "Should I proceed with the remaining items?"
134
+ 7. DO NOT create custom scripts to automate batch processing — use ONLY update-progress.js
135
+ 8. DO NOT write helper scripts for progress checking or task management
136
+ 9. DO NOT suggest "Let me create a script to handle this more efficiently"
133
137
 
134
138
  ### When to Pause (ONLY these cases)
135
139
 
@@ -162,19 +166,36 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
162
166
  > - If context window is exhausted, STOP and report progress — do NOT skip ahead
163
167
  > - When resuming, read DISPATCH-PROGRESS.json and continue from where you left off
164
168
  >
165
- > **Phase Transition Rule:**
166
- > Phase 4 CANNOT start until DISPATCH-PROGRESS.json shows counts.pending == 0 for Phase 3.
167
- > This is a programmatic check, not a suggestion.
169
+ > **Phase 3→4 Transition Rule:**
170
+ > Phase 4 CANNOT start until:
171
+ > 1. DISPATCH-PROGRESS.json (02.feature-design/) shows counts.pending == 0
172
+ > 2. All Feature Spec files exist in output directory
173
+ > This is enforced by workflow XML validation gates — Agent MUST NOT skip or manually override.
174
+ >
175
+ > **Phase 4 Progress File:**
176
+ > Phase 4 uses a SEPARATE progress file: `03.api-contract/DISPATCH-PROGRESS.json`
177
+ > This ensures Phase 3 completion status is preserved.
168
178
 
169
179
  ## ABORT CONDITIONS
170
180
 
171
181
  > **If ANY of the following conditions occur, the Feature Designer Agent MUST immediately STOP the workflow and report to user.**
172
182
 
173
183
  1. **Skill Invocation Failure**: Any skill call returns error → STOP. Do NOT generate content manually.
174
- 2. **Script Execution Failure**: `node ... update-progress.js` fails STOP. Do NOT manually create/edit JSON files.
184
+ 2. **Script Execution Failure**: `node ... update-progress.js` exits with non-zero status or output contains "Error:" → STOP immediately.
185
+ - Do NOT attempt to continue batch processing
186
+ - Do NOT ask user for alternative options (A/B/C)
187
+ - Do NOT suggest "skip to next phase" or "process only some features"
188
+ - Report exact error message, failed task ID, and failed command
175
189
  3. **Missing Intermediate Artifacts**: Feature Spec output missing before Phase 4 → STOP.
176
190
  4. **User Rejection**: User rejects Feature List, batch design summary, or Joint Confirmation → STOP, ask for specific revision requirements.
177
191
  5. **Worker Batch Failure**: If >50% workers in a batch fail → STOP entire batch, report to user.
192
+ 6. **Progress File Read Failure**: Cannot read DISPATCH-PROGRESS.json → STOP.
193
+
194
+ > 🛑 **FORBIDDEN ON SCRIPT FAILURE**:
195
+ > - ❌ "Due to script errors, I suggest we..."
196
+ > - ❌ "Let me offer you options: 1. Continue 2. Skip 3. ..."
197
+ > - ❌ "进度更新脚本频繁失败,建议..."
198
+ > - ✅ ONLY correct response: "STOP: update-progress.js failed with [error]. Task: [id]. Command: [cmd]."
178
199
 
179
200
  ## TIMESTAMP INTEGRITY
180
201
 
@@ -208,7 +229,7 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
208
229
  ## Phase 0: Workflow Progress Management
209
230
 
210
231
  > **Path Variables** (provided by caller as absolute paths):
211
- > - `workspace_path`: Absolute path to speccrew-workspace directory
232
+ > - `workspace_path`: **MANDATORY absolute path** Worker MUST use this for ALL script calls. Example: `D:\dev\RuoYi-Vue3-FastAPI\speccrew-workspace`
212
233
  > - `update_progress_script`: `{workspace_path}/scripts/update-progress.js`
213
234
  > - `iterations_dir`: `{workspace_path}/iterations`
214
235
 
@@ -743,7 +764,7 @@ If **2+ Feature Specs** in registry:
743
764
  # Step 1: Write tasks JSON to temp file inside iteration directory
744
765
  # Create .tasks-temp.json with the task array content
745
766
  # Step 2: Initialize with --tasks-file
746
- node {update_progress_script} init --file {iterations_dir}/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_api_contract --tasks-file {iterations_dir}/{iteration}/02.feature-design/.tasks-temp.json
767
+ node {update_progress_script} init --file {iterations_dir}/{iteration}/03.api-contract/DISPATCH-PROGRESS.json --stage 02_feature_design_api_contract --tasks-file {iterations_dir}/{iteration}/02.feature-design/.tasks-temp.json
747
768
  # Step 3: Delete .tasks-temp.json after successful init
748
769
  ```
749
770
 
@@ -765,7 +786,7 @@ If **2+ Feature Specs** in registry:
765
786
 
766
787
  3. **Wait for batch completion**, update progress per worker:
767
788
  ```bash
768
- node {update_progress_script} update-task --file {iterations_dir}/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --task-id {feature_id} --status completed
789
+ node {update_progress_script} update-task --file {iterations_dir}/{iteration}/03.api-contract/DISPATCH-PROGRESS.json --task-id {feature_id} --status completed
769
790
  ```
770
791
 
771
792
  4. **Update `.checkpoints.json`** for each completed Feature:
@@ -783,7 +804,7 @@ When any API Contract worker reports failure:
783
804
 
784
805
  1. **Update status**:
785
806
  ```bash
786
- node {update_progress_script} update-task --file {iterations_dir}/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --task-id {feature_id} --status failed --error "[Phase 4] {error_message}"
807
+ node {update_progress_script} update-task --file {iterations_dir}/{iteration}/03.api-contract/DISPATCH-PROGRESS.json --task-id {feature_id} --status failed --error "[Phase 4] {error_message}"
787
808
  ```
788
809
 
789
810
  2. **Continue batch**: Do NOT stop entire batch for single failure. Complete remaining workers.
@@ -52,6 +52,14 @@ This skill applies ISA-95 Stages 1-6 as an internal thinking framework:
52
52
  4. **FORBIDDEN: Skip Checkpoint B** — User confirmation required before generating documents (unless `skip_checkpoint=true`)
53
53
  5. **FORBIDDEN: Rename features** — Output filename MUST use the exact `feature_name` parameter value. DO NOT translate, abbreviate, paraphrase, or substitute with alternative names found in PRD content. The `feature_name` parameter is the SINGLE SOURCE OF TRUTH for file naming.
54
54
 
55
+ > **CRITICAL: Script Path Rule**
56
+ > ALL update-progress.js commands MUST use absolute paths with `{workspace_path}`:
57
+ > ```
58
+ > node "{workspace_path}/scripts/update-progress.js" update-task --file "{workspace_path}/iterations/..." ...
59
+ > ```
60
+ > NEVER use relative paths like `node scripts/update-progress.js` or `cd ... ; node scripts/...`
61
+ > The Worker may execute from project root directory, NOT from speccrew-workspace directory.
62
+
55
63
  ⛔ **ABSOLUTE PROHIBITION — Phase B Content Filling:**
56
64
  - NEVER use `create_file` to rewrite or recreate the document after Step 5 skeleton creation
57
65
  - NEVER abandon `search_replace` mid-way and switch to `create_file`
@@ -178,8 +186,8 @@ If `skip_analysis_checkpoint=false` (default):
178
186
  After user confirms (or if skipped):
179
187
 
180
188
  ```bash
181
- node speccrew-workspace/scripts/update-progress.js write-checkpoint \
182
- --file speccrew-workspace/iterations/{iteration_id}/02.feature-design/.checkpoints.json \
189
+ node "{workspace_path}/scripts/update-progress.js" write-checkpoint \
190
+ --file "{workspace_path}/iterations/{iteration_id}/02.feature-design/.checkpoints.json" \
183
191
  --stage 02_feature_design \
184
192
  --checkpoint function_decomposition \
185
193
  --passed true
@@ -493,8 +501,8 @@ Document: `User Action → Frontend Response → Backend API Call`
493
501
  After user confirms (or if skipped):
494
502
 
495
503
  ```bash
496
- node speccrew-workspace/scripts/update-progress.js write-checkpoint \
497
- --file speccrew-workspace/iterations/{iteration_id}/02.feature-design/.checkpoints.json \
504
+ node "{workspace_path}/scripts/update-progress.js" write-checkpoint \
505
+ --file "{workspace_path}/iterations/{iteration_id}/02.feature-design/.checkpoints.json" \
498
506
  --stage 02_feature_design \
499
507
  --checkpoint feature_design_review \
500
508
  --passed true
@@ -654,8 +662,8 @@ Verify all Mermaid diagrams follow compliance rules:
654
662
  Set final checkpoint status:
655
663
 
656
664
  ```bash
657
- node speccrew-workspace/scripts/update-progress.js write-checkpoint \
658
- --file speccrew-workspace/iterations/{iteration_id}/02.feature-design/.checkpoints.json \
665
+ node "{workspace_path}/scripts/update-progress.js" write-checkpoint \
666
+ --file "{workspace_path}/iterations/{iteration_id}/02.feature-design/.checkpoints.json" \
659
667
  --stage 02_feature_design \
660
668
  --checkpoint feature_spec_review \
661
669
  --passed true
@@ -310,6 +310,25 @@
310
310
  <field name="message">📊 Phase 4: API Contract Generation</field>
311
311
  </block>
312
312
 
313
+ <!-- Read Phase 3 completion status -->
314
+ <block type="task" id="P4-V1" action="run-script" status="pending" desc="Read Feature Design completion status">
315
+ <field name="command">node ${workspace_root}/scripts/update-progress.js read --file ${iteration_path}/02.feature-design/DISPATCH-PROGRESS.json --overview</field>
316
+ <field name="output" var="phase3_progress"/>
317
+ </block>
318
+
319
+ <block type="gateway" id="P4-V2" mode="exclusive" desc="Verify Phase 3 completed before Phase 4">
320
+ <branch test="${phase3_progress.counts.pending} > 0" name="Phase 3 Incomplete">
321
+ <block type="event" id="P4-V3" action="abort" desc="Phase 3 not complete">
322
+ <field name="message">ABORT: Phase 3 (Feature Design) has ${phase3_progress.counts.pending} pending tasks. Cannot start Phase 4.</field>
323
+ </block>
324
+ </branch>
325
+ <branch default="true" name="Phase 3 Complete">
326
+ <block type="event" id="P4-V4" action="log" desc="Phase 3 verified">
327
+ <field name="message">✅ Phase 3 complete. Proceeding to Phase 4 (API Contract).</field>
328
+ </block>
329
+ </branch>
330
+ </block>
331
+
313
332
  <!-- Phase 4.1: Dispatch Mode Decision -->
314
333
  <block type="gateway" id="P4-G1" mode="exclusive" desc="Dispatch mode for API Contract">
315
334
 
@@ -338,7 +357,7 @@
338
357
 
339
358
  <!-- Initialize DISPATCH-PROGRESS.json for API Contract stage -->
340
359
  <block type="task" id="P4-B2" action="run-script" status="pending" desc="Initialize API contract dispatch">
341
- <field name="command">node ${workspace_root}/scripts/update-progress.js init --file ${iteration_path}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_api_contract --tasks-file ${iteration_path}/02.feature-design/.tasks-temp.json</field>
360
+ <field name="command">node ${workspace_root}/scripts/update-progress.js init --file ${iteration_path}/03.api-contract/DISPATCH-PROGRESS.json --stage 02_feature_design_api_contract --tasks-file ${iteration_path}/02.feature-design/.tasks-temp.json</field>
342
361
  </block>
343
362
 
344
363
  <!-- MANDATORY: Dispatch prompt must contain ONLY skill path + context data parameters.
@@ -362,12 +381,27 @@
362
381
  </block>
363
382
 
364
383
  <block type="task" id="P4-B4" action="run-script" status="pending" desc="Update worker progress">
365
- <field name="command">node ${workspace_root}/scripts/update-progress.js update-task --file ${iteration_path}/02.feature-design/DISPATCH-PROGRESS.json --task-id ${item.feature_id} --status ${worker_status}</field>
384
+ <field name="command">node ${workspace_root}/scripts/update-progress.js update-task --file ${iteration_path}/03.api-contract/DISPATCH-PROGRESS.json --task-id ${item.feature_id} --status ${worker_status}</field>
366
385
  </block>
367
386
  </block>
368
387
  </branch>
369
388
  </block>
370
389
 
390
+ <!-- Read Phase 4 completion summary -->
391
+ <block type="task" id="P4-B5a" action="run-script" status="pending" desc="Read API Contract completion summary">
392
+ <field name="command">node ${workspace_root}/scripts/update-progress.js read --file ${iteration_path}/03.api-contract/DISPATCH-PROGRESS.json --overview</field>
393
+ <field name="output" var="api_contract_progress"/>
394
+ </block>
395
+
396
+ <block type="gateway" id="P4-G2" mode="exclusive" desc="Check API Contract dispatch status">
397
+ <branch test="${api_contract_progress.counts.failed} > ${api_contract_progress.counts.total} / 2" name="Majority Failed">
398
+ <block type="event" id="P4-E-ABORT" action="abort" desc="API Contract batch failure threshold exceeded">
399
+ <field name="message">ABORT: More than 50% of API Contract tasks failed (${api_contract_progress.counts.failed}/${api_contract_progress.counts.total}).</field>
400
+ </block>
401
+ </branch>
402
+ <branch default="true" name="Acceptable"/>
403
+ </block>
404
+
371
405
  <!-- Phase 4.4: Joint Confirmation -->
372
406
  <block type="checkpoint" id="P4-CP1" name="api_contract_joint" desc="Joint confirmation gate">
373
407
  <field name="required" value="true"/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.7.32",
3
+ "version": "0.7.34",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {
@@ -35,6 +35,7 @@
35
35
  * --output <text> Task output (used when completed)
36
36
  * --error <text> Error message (used when failed)
37
37
  * --error-category <cat> Error category (used when failed)
38
+ * --metadata <json> Metadata JSON string to merge into task
38
39
  *
39
40
  * 4. update-counts - Force recalculate counts
40
41
  * node update-progress.js update-counts --file <path>
@@ -252,7 +253,8 @@ function parseArgs() {
252
253
  confirmedAt: null,
253
254
  featuresDir: null,
254
255
  platforms: null,
255
- force: false
256
+ force: false,
257
+ metadata: null
256
258
  };
257
259
 
258
260
  // First argument is the command
@@ -357,6 +359,10 @@ function parseArgs() {
357
359
  case '-Matcher-Result':
358
360
  result.matcherResult = args[++i];
359
361
  break;
362
+ case '--metadata':
363
+ case '-Metadata':
364
+ result.metadata = args[++i];
365
+ break;
360
366
  }
361
367
  }
362
368
 
@@ -619,6 +625,16 @@ function cmdUpdateTask(args) {
619
625
  }
620
626
  }
621
627
 
628
+ // Handle metadata (merge into task)
629
+ if (args.metadata) {
630
+ try {
631
+ const metadataObj = JSON.parse(args.metadata);
632
+ task.metadata = { ...task.metadata, ...metadataObj };
633
+ } catch (e) {
634
+ outputError(`Failed to parse metadata JSON: ${e.message}`);
635
+ }
636
+ }
637
+
622
638
  // Update task
623
639
  data.tasks[taskIndex] = task;
624
640
  data.updated_at = now;