speccrew 0.7.33 → 0.7.35

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. If a required temp file (.tasks-temp.json) is missing, this indicates a workflow orchestration gap — follow the XML workflow's regeneration step, do NOT implement workarounds with ad-hoc commands. |
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,9 +166,15 @@ 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
 
@@ -746,15 +756,33 @@ If **2+ Feature Specs** in registry:
746
756
  > Worker will read the skill's workflow.agentflow.xml for its execution plan.
747
757
  > See: MANDATORY: Worker Dispatch Prompt Format section above.
748
758
 
759
+ ### Phase 4: API Contract — Task File Management
760
+
761
+ ⚠️ **CRITICAL: .tasks-temp.json Regeneration**
762
+
763
+ Phase 3 deletes `.tasks-temp.json` after init. Phase 4 MUST regenerate it before init:
764
+
765
+ 1. Read `{iteration_path}/02.feature-design/DISPATCH-PROGRESS.json` (Phase 3 results)
766
+ 2. Extract ALL task IDs from the tasks array
767
+ 3. Build flat JSON array: `[{"id":"F-M01-01"},{"id":"F-M01-02"},...]`
768
+ 4. Write to `{iteration_path}/03.api-contract/.tasks-temp.json`
769
+ 5. Run init: `node {workspace_path}/scripts/update-progress.js init --file {iteration_path}/03.api-contract/DISPATCH-PROGRESS.json --stage 02_feature_design_api_contract --tasks-file {iteration_path}/03.api-contract/.tasks-temp.json`
770
+ 6. Delete `.tasks-temp.json` after successful init
771
+
772
+ **DO NOT**:
773
+ - Run ad-hoc PowerShell/Bash commands to parse `.prd-feature-list.json`
774
+ - Create custom scripts to build task lists
775
+ - Skip the init step and manually edit DISPATCH-PROGRESS.json
776
+
749
777
  1. **Initialize DISPATCH-PROGRESS.json for API Contract stage**:
750
778
 
751
779
  > ⚠️ Use `--tasks-file` instead of `--tasks` to avoid PowerShell JSON parsing issues.
752
780
 
753
781
  ```bash
754
- # Step 1: Write tasks JSON to temp file inside iteration directory
755
- # Create .tasks-temp.json with the task array content
782
+ # Step 1: Read Phase 3 DISPATCH-PROGRESS.json and extract all task IDs
783
+ # Build flat JSON array: [{"id":"F-XXX"},...] and write to .tasks-temp.json
756
784
  # Step 2: Initialize with --tasks-file
757
- 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
785
+ 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}/03.api-contract/.tasks-temp.json
758
786
  # Step 3: Delete .tasks-temp.json after successful init
759
787
  ```
760
788
 
@@ -776,7 +804,7 @@ If **2+ Feature Specs** in registry:
776
804
 
777
805
  3. **Wait for batch completion**, update progress per worker:
778
806
  ```bash
779
- node {update_progress_script} update-task --file {iterations_dir}/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --task-id {feature_id} --status completed
807
+ node {update_progress_script} update-task --file {iterations_dir}/{iteration}/03.api-contract/DISPATCH-PROGRESS.json --task-id {feature_id} --status completed
780
808
  ```
781
809
 
782
810
  4. **Update `.checkpoints.json`** for each completed Feature:
@@ -794,7 +822,7 @@ When any API Contract worker reports failure:
794
822
 
795
823
  1. **Update status**:
796
824
  ```bash
797
- 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}"
825
+ 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}"
798
826
  ```
799
827
 
800
828
  2. **Continue batch**: Do NOT stop entire batch for single failure. Complete remaining workers.
@@ -65,6 +65,13 @@ When executing design or document generation skills:
65
65
  - Only output brief block execution announcements
66
66
  - This is especially critical in batch mode where multiple Workers run simultaneously
67
67
 
68
+ ### FILE ENCODING
69
+
70
+ ALL file operations MUST use UTF-8 encoding explicitly:
71
+ - When creating files via tools: ensure UTF-8 (most IDE tools default to UTF-8)
72
+ - When writing via Node.js: always pass `'utf8'` as encoding parameter
73
+ - NEVER rely on system default encoding — Chinese Windows defaults to GBK which corrupts Unicode characters
74
+
68
75
  **FORBIDDEN output in conversation during design tasks:**
69
76
  - ASCII wireframes / UI prototypes
70
77
  - Mermaid diagrams (these go in the file only)
@@ -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
 
@@ -336,9 +355,15 @@
336
355
  <field name="text">DO NOT invoke speccrew-fd-api-contract directly</field>
337
356
  </block>
338
357
 
358
+ <!-- Phase 4.1a: Regenerate tasks file from Phase 3 completed features -->
359
+ <block type="task" id="P4-B1c" action="analyze" status="pending" desc="Build API Contract task list from Phase 3 DISPATCH-PROGRESS.json">
360
+ <field name="text">Read ${iteration_path}/02.feature-design/DISPATCH-PROGRESS.json. Extract all task IDs (regardless of status). Build a flat JSON array: [{"id":"F-M01-01"},{"id":"F-M01-02"},...]. Write this array to ${iteration_path}/03.api-contract/.tasks-temp.json</field>
361
+ <field name="output" var="api_contract_tasks_file"/>
362
+ </block>
363
+
339
364
  <!-- Initialize DISPATCH-PROGRESS.json for API Contract stage -->
340
365
  <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>
366
+ <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}/03.api-contract/.tasks-temp.json</field>
342
367
  </block>
343
368
 
344
369
  <!-- MANDATORY: Dispatch prompt must contain ONLY skill path + context data parameters.
@@ -362,12 +387,27 @@
362
387
  </block>
363
388
 
364
389
  <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>
390
+ <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
391
  </block>
367
392
  </block>
368
393
  </branch>
369
394
  </block>
370
395
 
396
+ <!-- Read Phase 4 completion summary -->
397
+ <block type="task" id="P4-B5a" action="run-script" status="pending" desc="Read API Contract completion summary">
398
+ <field name="command">node ${workspace_root}/scripts/update-progress.js read --file ${iteration_path}/03.api-contract/DISPATCH-PROGRESS.json --overview</field>
399
+ <field name="output" var="api_contract_progress"/>
400
+ </block>
401
+
402
+ <block type="gateway" id="P4-G2" mode="exclusive" desc="Check API Contract dispatch status">
403
+ <branch test="${api_contract_progress.counts.failed} > ${api_contract_progress.counts.total} / 2" name="Majority Failed">
404
+ <block type="event" id="P4-E-ABORT" action="abort" desc="API Contract batch failure threshold exceeded">
405
+ <field name="message">ABORT: More than 50% of API Contract tasks failed (${api_contract_progress.counts.failed}/${api_contract_progress.counts.total}).</field>
406
+ </block>
407
+ </branch>
408
+ <branch default="true" name="Acceptable"/>
409
+ </block>
410
+
371
411
  <!-- Phase 4.4: Joint Confirmation -->
372
412
  <block type="checkpoint" id="P4-CP1" name="api_contract_joint" desc="Joint confirmation gate">
373
413
  <field name="required" value="true"/>
@@ -201,6 +201,14 @@ IF verification fails:
201
201
  > **Purpose:** Separate feature data from dispatch plan into dedicated `.prd-feature-list.json` file.
202
202
  > Each Sub-PRD Worker writes its module's features upon completion.
203
203
 
204
+ > **CRITICAL: UTF-8 Encoding**
205
+ >
206
+ > When writing ANY file (JSON, Markdown, or other text files), you MUST ensure UTF-8 encoding:
207
+ > - Use `create_file` tool (which defaults to UTF-8) for file creation
208
+ > - If using Node.js scripts: `fs.writeFileSync(path, content, 'utf8')`
209
+ > - NEVER rely on system default encoding (may be GBK on Chinese Windows)
210
+ > - This applies to ALL output files including `.prd-feature-list.json`
211
+
204
212
  ### 5.1 Determine Feature List File Path
205
213
 
206
214
  ```
@@ -190,6 +190,7 @@
190
190
 
191
191
  <block type="task" id="B17" action="write-file" desc="Update feature list file">
192
192
  <field name="path" value="${feature_list_path}"/>
193
+ <field name="encoding">utf8</field>
193
194
  <field name="merge">true</field>
194
195
  <field name="entry" value="${feature_list_entry}"/>
195
196
  <field name="output" var="feature_list_updated"/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.7.33",
3
+ "version": "0.7.35",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {