speccrew 0.5.19 → 0.6.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.
@@ -188,19 +188,19 @@ node speccrew-workspace/scripts/update-progress.js read --file speccrew-workspac
188
188
  ```
189
189
 
190
190
  **Validation Rules:**
191
- - Verify `stages.04_development.status == "confirmed"` in the output
192
- - If not confirmed → **STOP** with message: "Development stage has not been confirmed. Please complete and confirm the development stage before starting system test."
191
+ - Verify `stages.05_deployment.status == "confirmed"` in the output
192
+ - If not confirmed → **STOP** with message: "Deployment stage has not been confirmed. Please complete and confirm the deployment stage before starting system test."
193
193
 
194
194
  **Update Current Stage**:
195
195
  ```bash
196
- node speccrew-workspace/scripts/update-progress.js update-workflow --file speccrew-workspace/WORKFLOW-PROGRESS.json --stage 05_system_test --status in_progress
196
+ node speccrew-workspace/scripts/update-progress.js update-workflow --file speccrew-workspace/WORKFLOW-PROGRESS.json --stage 06_system_test --status in_progress
197
197
  ```
198
198
 
199
199
  ### Step 0.2: Check Resume State (断点续传)
200
200
 
201
201
  **Read Checkpoints** (if file exists):
202
202
  ```bash
203
- node speccrew-workspace/scripts/update-progress.js read --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/.checkpoints.json --checkpoints
203
+ node speccrew-workspace/scripts/update-progress.js read --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/.checkpoints.json --checkpoints
204
204
  ```
205
205
 
206
206
  **Resume Decision Matrix:**
@@ -221,7 +221,7 @@ node speccrew-workspace/scripts/update-progress.js read --file speccrew-workspac
221
221
 
222
222
  **Read Dispatch Progress Summary** (if file exists):
223
223
  ```bash
224
- node speccrew-workspace/scripts/update-progress.js read --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS.json --summary
224
+ node speccrew-workspace/scripts/update-progress.js read --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --summary
225
225
  ```
226
226
 
227
227
  **Parse Task Status by Phase:**
@@ -325,7 +325,7 @@ Locate all required input documents:
325
325
  ### 1.3 Check Existing Test Artifacts
326
326
 
327
327
  Check if test artifacts already exist:
328
- - Check path: `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/`
328
+ - Check path: `speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/`
329
329
  - Look for existing: `cases/`, `code/`, `reports/`, `bugs/` directories
330
330
 
331
331
  ### 1.4 User Confirmation
@@ -470,7 +470,7 @@ Each task entry in DISPATCH-PROGRESS.json contains:
470
470
 
471
471
  Before dispatching, create dispatch tracking:
472
472
  ```bash
473
- node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS.json --stage 05_system_test --tasks '[{"id":"test-case-{platform_id}","platform":"{platform_id}","phase":"test_case_design","skill":"speccrew-test-case-design","status":"pending"}]'
473
+ node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --stage 06_system_test --tasks '[{"id":"test-case-{platform_id}","platform":"{platform_id}","phase":"test_case_design","skill":"speccrew-test-case-design","status":"pending"}]'
474
474
  ```
475
475
  Or use `--tasks-file` to load from a JSON file.
476
476
 
@@ -498,11 +498,11 @@ Dispatch `speccrew-task-worker` agents for `speccrew-test-case-design` for each
498
498
  For each completed worker, parse Task Completion Report and update:
499
499
  - On SUCCESS:
500
500
  ```bash
501
- node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS.json --task-id test-case-{platform_id} --status completed --output "{output_path}"
501
+ node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --task-id test-case-{platform_id} --status completed --output "{output_path}"
502
502
  ```
503
503
  - On FAILED:
504
504
  ```bash
505
- node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS.json --task-id test-case-{platform_id} --status failed --error "{error_message}"
505
+ node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --task-id test-case-{platform_id} --status failed --error "{error_message}"
506
506
  ```
507
507
 
508
508
  ### 3.4 Re-dispatch Failed Tasks
@@ -511,7 +511,7 @@ After all initial workers complete:
511
511
 
512
512
  1. **Query failed tasks:**
513
513
  ```bash
514
- node speccrew-workspace/scripts/update-progress.js read --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS.json --status failed
514
+ node speccrew-workspace/scripts/update-progress.js read --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --status failed
515
515
  ```
516
516
 
517
517
  2. **For each failed task (max 2 re-dispatches, total 3 attempts):**
@@ -520,7 +520,7 @@ After all initial workers complete:
520
520
 
521
521
  3. **After max attempts, mark permanently failed:**
522
522
  ```bash
523
- node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS.json --task-id {task_id} --status failed --error "Max re-dispatch attempts (3) exceeded"
523
+ node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --task-id {task_id} --status failed --error "Max re-dispatch attempts (3) exceeded"
524
524
  ```
525
525
 
526
526
  ### 3.5 Checkpoint A: Test Case Review
@@ -544,11 +544,11 @@ After test case design completes for all platforms:
544
544
  **Write Checkpoint File:**
545
545
 
546
546
  ```bash
547
- node speccrew-workspace/scripts/update-progress.js write-checkpoint --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/.checkpoints.json --stage 05_system_test --checkpoint test_case_coverage --passed true --description "Test case coverage review (Checkpoint A)"
547
+ node speccrew-workspace/scripts/update-progress.js write-checkpoint --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/.checkpoints.json --stage 06_system_test --checkpoint test_case_coverage --passed true --description "Test case coverage review (Checkpoint A)"
548
548
  ```
549
549
 
550
550
  **Output Path:**
551
- - `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/cases/{platform_id}/[feature]-test-cases.md`
551
+ - `speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/cases/{platform_id}/[feature]-test-cases.md`
552
552
 
553
553
  ## Phase 4: Test Code Generation
554
554
 
@@ -584,7 +584,7 @@ Invoke Skill directly:
584
584
 
585
585
  Append new tasks for test_code_gen phase by reading existing file and adding tasks:
586
586
  ```bash
587
- node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS-test-code-gen.json --stage 05_system_test --tasks '[{"id":"test-code-{platform_id}","platform":"{platform_id}","phase":"test_code_gen","skill":"speccrew-test-code-gen","status":"pending"}]'
587
+ node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS-test-code-gen.json --stage 06_system_test --tasks '[{"id":"test-code-{platform_id}","platform":"{platform_id}","phase":"test_code_gen","skill":"speccrew-test-code-gen","status":"pending"}]'
588
588
  ```
589
589
  > **Note**: In practice, maintain a single DISPATCH-PROGRESS.json with all phases by merging task arrays.
590
590
 
@@ -604,11 +604,11 @@ Dispatch `speccrew-task-worker` agents for `speccrew-test-code-gen` for each pla
604
604
  For each completed worker, parse Task Completion Report:
605
605
  - On SUCCESS:
606
606
  ```bash
607
- node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS.json --task-id test-code-{platform_id} --status completed --output "{output_path}"
607
+ node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --task-id test-code-{platform_id} --status completed --output "{output_path}"
608
608
  ```
609
609
  - On FAILED:
610
610
  ```bash
611
- node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS.json --task-id test-code-{platform_id} --status failed --error "{error_message}"
611
+ node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --task-id test-code-{platform_id} --status failed --error "{error_message}"
612
612
  ```
613
613
 
614
614
  ### 4.4 Review Verification (MANDATORY)
@@ -673,12 +673,12 @@ After test code generation completes for all platforms:
673
673
  **Update Checkpoint File:**
674
674
 
675
675
  ```bash
676
- node speccrew-workspace/scripts/update-progress.js write-checkpoint --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/.checkpoints.json --stage 05_system_test --checkpoint test_code_review --passed true --description "Test code generation review (Checkpoint B)"
676
+ node speccrew-workspace/scripts/update-progress.js write-checkpoint --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/.checkpoints.json --stage 06_system_test --checkpoint test_code_review --passed true --description "Test code generation review (Checkpoint B)"
677
677
  ```
678
678
 
679
679
  **Output:**
680
680
  - Test code: Written to project source test directories
681
- - Test code plan: `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/code/{platform_id}/[feature]-test-code-plan.md`
681
+ - Test code plan: `speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/code/{platform_id}/[feature]-test-code-plan.md`
682
682
 
683
683
  ## Phase 5: Test Execution & Bug Reporting
684
684
 
@@ -716,11 +716,11 @@ Execute tests and generate reports:
716
716
  For each completed worker, parse Task Completion Report:
717
717
  - On SUCCESS:
718
718
  ```bash
719
- node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS.json --task-id test-run-{platform_id} --status completed --output "{output_path}"
719
+ node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --task-id test-run-{platform_id} --status completed --output "{output_path}"
720
720
  ```
721
721
  - On FAILED:
722
722
  ```bash
723
- node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/DISPATCH-PROGRESS.json --task-id test-run-{platform_id} --status failed --error "{error_message}"
723
+ node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --task-id test-run-{platform_id} --status failed --error "{error_message}"
724
724
  ```
725
725
 
726
726
  ### 5.3 Stage 2: Test Reporter Dispatch
@@ -763,8 +763,8 @@ For each deviation identified:
763
763
  - Link to related feature requirement
764
764
 
765
765
  **Output Paths:**
766
- - Test Report: `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/reports/[feature]-test-report.md`
767
- - Bug Reports: `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/bugs/[feature]-bug-{序号}.md`
766
+ - Test Report: `speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/reports/[feature]-test-report.md`
767
+ - Bug Reports: `speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/bugs/[feature]-bug-{序号}.md`
768
768
 
769
769
  ## Phase 6: Delivery Summary
770
770
 
@@ -809,30 +809,30 @@ Provide clear recommendation:
809
809
  **Update Checkpoint File:**
810
810
 
811
811
  ```bash
812
- node speccrew-workspace/scripts/update-progress.js write-checkpoint --file speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/.checkpoints.json --stage 05_system_test --checkpoint test_execution_report --passed true --description "Test execution final report"
812
+ node speccrew-workspace/scripts/update-progress.js write-checkpoint --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/.checkpoints.json --stage 06_system_test --checkpoint test_execution_report --passed true --description "Test execution final report"
813
813
  ```
814
814
 
815
815
  **Update Workflow Progress:**
816
816
 
817
817
  ```bash
818
- node speccrew-workspace/scripts/update-progress.js update-workflow --file speccrew-workspace/WORKFLOW-PROGRESS.json --stage 05_system_test --status confirmed --output "05.system-test/cases/,05.system-test/code/,05.system-test/reports/,05.system-test/bugs/"
818
+ node speccrew-workspace/scripts/update-progress.js update-workflow --file speccrew-workspace/WORKFLOW-PROGRESS.json --stage 06_system_test --status confirmed --output "06.system-test/cases/,06.system-test/code/,06.system-test/reports/,06.system-test/bugs/"
819
819
  ```
820
820
 
821
- > **Note**: `current_stage` does not advance — 05_system_test is the final stage of the pipeline.
821
+ > **Note**: `current_stage` does not advance — 06_system_test is the final stage of the pipeline.
822
822
 
823
823
  # Deliverables
824
824
 
825
825
  | Deliverable | Path | Notes |
826
826
  |-------------|------|-------|
827
- | Test Case Documents | `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/cases/{platform_id}/[feature]-test-cases.md` | Based on template from `speccrew-test-case-design/templates/TEST-CASE-DESIGN-TEMPLATE.md` |
828
- | Test Code Plan | `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/code/{platform_id}/[feature]-test-code-plan.md` | Based on template from `speccrew-test-code-gen/templates/TEST-CODE-PLAN-TEMPLATE.md` |
829
- | Test Execution Results | `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/results/{platform_id}/[feature]-test-execution-results.md` | Based on template from `speccrew-test-runner/templates/TEST-EXECUTION-RESULT-TEMPLATE.md` |
830
- | Test Report | `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/reports/[feature]-test-report.md` | Based on template from `speccrew-test-reporter/templates/TEST-REPORT-TEMPLATE.md` |
831
- | Bug Reports | `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/bugs/[feature]-bug-{序号}.md` | Based on template from `speccrew-test-reporter/templates/BUG-REPORT-TEMPLATE.md` |
827
+ | Test Case Documents | `speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/cases/{platform_id}/[feature]-test-cases.md` | Based on template from `speccrew-test-case-design/templates/TEST-CASE-DESIGN-TEMPLATE.md` |
828
+ | Test Code Plan | `speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/code/{platform_id}/[feature]-test-code-plan.md` | Based on template from `speccrew-test-code-gen/templates/TEST-CODE-PLAN-TEMPLATE.md` |
829
+ | Test Execution Results | `speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/results/{platform_id}/[feature]-test-execution-results.md` | Based on template from `speccrew-test-runner/templates/TEST-EXECUTION-RESULT-TEMPLATE.md` |
830
+ | Test Report | `speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/reports/[feature]-test-report.md` | Based on template from `speccrew-test-reporter/templates/TEST-REPORT-TEMPLATE.md` |
831
+ | Bug Reports | `speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/bugs/[feature]-bug-{序号}.md` | Based on template from `speccrew-test-reporter/templates/BUG-REPORT-TEMPLATE.md` |
832
832
 
833
833
  # Pipeline Position
834
834
 
835
- **Upstream**: System Developer (receives `04.development/` output and source code)
835
+ **Upstream**: Deployment (receives `05.deployment/` output and deployed system)
836
836
 
837
837
  **Downstream**: Delivery phase (produces test reports and bug reports)
838
838
 
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: speccrew-deploy-build
3
+ description: Executes application build commands based on techs knowledge conventions. Runs the build, verifies success, and reports build artifacts.
4
+ tools: Read, Bash, Glob
5
+ ---
6
+
7
+ # Trigger Scenarios
8
+
9
+ - User requests to build the application before deployment
10
+ - Deploy Agent needs to verify the application compiles successfully
11
+ - CI/CD pipeline requires a build step verification
12
+
13
+ # Input Parameters
14
+
15
+ | Parameter | Required | Type | Description |
16
+ |-----------|----------|------|-------------|
17
+ | `platform_id` | Yes | string | Platform identifier (e.g., backend-spring, frontend-react) |
18
+ | `build_cmd` | Yes | string | Build command from conventions-data/build (e.g., `mvn package -DskipTests`) |
19
+ | `project_root` | Yes | string | Absolute path to the project root directory |
20
+ | `iteration_path` | Yes | string | Current iteration directory path |
21
+
22
+ # Workflow
23
+
24
+ ## Step 1: Pre-build Check
25
+
26
+ Verify prerequisites before executing the build:
27
+
28
+ 1. **Verify project_root exists**
29
+ - Check directory exists at `project_root`
30
+ - If not exists → FAILED with Error Category: DEPENDENCY_MISSING
31
+
32
+ 2. **Verify build tool is available**
33
+ - Detect build tool from `build_cmd`:
34
+ - `mvn` → Run `mvn --version`
35
+ - `npm` / `pnpm` / `yarn` → Run `{tool} --version`
36
+ - `gradle` → Run `gradle --version`
37
+ - `go` → Run `go version`
38
+ - If tool not available → FAILED with Error Category: DEPENDENCY_MISSING
39
+
40
+ 3. **Check for build config files**
41
+ - Maven: `pom.xml` must exist in `project_root`
42
+ - Node.js: `package.json` must exist in `project_root`
43
+ - Gradle: `build.gradle` or `build.gradle.kts` must exist
44
+ - Go: `go.mod` must exist
45
+ - If config missing → FAILED with Error Category: VALIDATION_ERROR
46
+
47
+ ## Step 2: Execute Build
48
+
49
+ Run the build command:
50
+
51
+ 1. **Execute build_cmd via Bash**
52
+ - Working directory: `project_root`
53
+ - Command: `build_cmd`
54
+ - Capture stdout and stderr
55
+ - Record start time before execution
56
+
57
+ 2. **Check exit code**
58
+ - Exit code 0 → Continue to Step 3
59
+ - Exit code non-zero → FAILED with Error Category: BUILD_FAILURE
60
+
61
+ 3. **Calculate build duration**
62
+ - Duration = end_time - start_time
63
+
64
+ ## Step 3: Verify Build Output
65
+
66
+ Check for expected build artifacts:
67
+
68
+ 1. **Detect expected artifacts by platform**
69
+ - Spring/Maven: `target/*.jar` files
70
+ - Node.js: `dist/` or `build/` directory
71
+ - Gradle: `build/libs/*.jar`
72
+ - Go: Binary executable in project root or `bin/`
73
+
74
+ 2. **Verify artifacts exist**
75
+ - Use Glob to find expected artifacts
76
+ - If no artifacts found → FAILED with Error Category: BUILD_FAILURE
77
+
78
+ 3. **Record artifact paths**
79
+ - List all generated artifacts with full paths
80
+
81
+ # Task Completion Report
82
+
83
+ ## Success Report
84
+
85
+ ```
86
+ ## Task Completion Report
87
+ - **Status**: SUCCESS
88
+ - **Platform**: {platform_id}
89
+ - **Project Root**: {project_root}
90
+ - **Build Duration**: {duration_seconds}s
91
+ - **Build Command**: {build_cmd}
92
+ - **Artifact Paths**:
93
+ - {artifact_path_1}
94
+ - {artifact_path_2}
95
+ - ...
96
+ - **Build Log** (last 20 lines):
97
+ ```
98
+ {last_20_lines_of_build_output}
99
+ ```
100
+ - **Summary**: Build completed successfully with {artifact_count} artifacts generated
101
+ ```
102
+
103
+ ## Failure Report
104
+
105
+ ```
106
+ ## Task Completion Report
107
+ - **Status**: FAILED
108
+ - **Platform**: {platform_id}
109
+ - **Project Root**: {project_root}
110
+ - **Build Command**: {build_cmd}
111
+ - **Error Category**: {DEPENDENCY_MISSING | BUILD_FAILURE | VALIDATION_ERROR}
112
+ - **Error**: {detailed error description}
113
+ - **Build Log** (last 30 lines):
114
+ ```
115
+ {last_30_lines_of_build_output}
116
+ ```
117
+ - **Recovery Hint**: {suggestion for resolving the issue}
118
+ ```
119
+
120
+ # Key Rules
121
+
122
+ | Rule | Description |
123
+ |------|-------------|
124
+ | **No Hard-coded Commands** | All build commands come from input parameters |
125
+ | **Tool Detection** | Automatically detect and verify build tool availability |
126
+ | **Artifact Verification** | Always verify expected artifacts exist after build |
127
+ | **Duration Tracking** | Record and report build duration |
128
+ | **Log Capture** | Capture and report relevant build output |
@@ -0,0 +1,141 @@
1
+ ---
2
+ name: speccrew-deploy-migrate
3
+ description: Executes database migration scripts using the project's migration tool. Validates migration results and reports affected tables.
4
+ tools: Read, Bash, Glob
5
+ ---
6
+
7
+ # Trigger Scenarios
8
+
9
+ - User requests to run database migrations before deployment
10
+ - Deploy Agent needs to apply pending schema changes
11
+ - CI/CD pipeline requires database migration verification
12
+
13
+ # Input Parameters
14
+
15
+ | Parameter | Required | Type | Description |
16
+ |-----------|----------|------|-------------|
17
+ | `platform_id` | Yes | string | Platform identifier |
18
+ | `migration_cmd` | Yes | string | Migration execution command from conventions-data (e.g., `mvn flyway:migrate`) |
19
+ | `validation_cmd` | No | string | Migration validation command (e.g., `mvn flyway:validate`) |
20
+ | `migration_scripts` | Yes | string | JSON array of migration scripts: `[{"name":"V001__create_user.sql","path":"...","type":"CREATE TABLE"}]` |
21
+ | `project_root` | Yes | string | Absolute path to the project root directory |
22
+ | `iteration_path` | Yes | string | Current iteration directory path |
23
+
24
+ # Workflow
25
+
26
+ ## Step 1: Pre-migration Check
27
+
28
+ Verify prerequisites before executing migrations:
29
+
30
+ 1. **Verify migration script files exist**
31
+ - Parse `migration_scripts` JSON array
32
+ - For each script, verify file exists at specified `path`
33
+ - If any script missing → FAILED with Error Category: DEPENDENCY_MISSING
34
+
35
+ 2. **Verify migration tool is available**
36
+ - Detect tool from `migration_cmd` (e.g., `mvn`, `npm`, `npx`)
37
+ - Run tool version check
38
+ - If tool not available → FAILED with Error Category: DEPENDENCY_MISSING
39
+
40
+ 3. **Count total scripts to execute**
41
+ - Record total script count from `migration_scripts`
42
+ - Log: "Preparing to execute {count} migration scripts"
43
+
44
+ ## Step 2: Execute Migration
45
+
46
+ Run the migration command:
47
+
48
+ 1. **Execute migration_cmd via Bash**
49
+ - Working directory: `project_root`
50
+ - Command: `migration_cmd`
51
+ - Capture stdout and stderr
52
+ - Record start time before execution
53
+
54
+ 2. **Check exit code**
55
+ - Exit code 0 → Continue to Step 3
56
+ - Exit code non-zero → FAILED with Error Category: BUILD_FAILURE
57
+
58
+ ## Step 3: Validate Migration (if validation_cmd provided)
59
+
60
+ Run validation if command is provided:
61
+
62
+ 1. **Execute validation_cmd via Bash**
63
+ - Working directory: `project_root`
64
+ - Command: `validation_cmd`
65
+ - Capture output
66
+
67
+ 2. **Verify validation result**
68
+ - Exit code 0 → All migrations applied successfully
69
+ - Exit code non-zero → FAILED with Error Category: VALIDATION_ERROR
70
+
71
+ 3. **If validation fails**
72
+ - Report specific failure reason from output
73
+ - Include suggestion for manual intervention
74
+
75
+ ## Step 4: Report Migration Results
76
+
77
+ Compile and report migration summary:
78
+
79
+ 1. **List scripts executed**
80
+ - Extract from migration output or use input `migration_scripts`
81
+
82
+ 2. **List tables affected**
83
+ - Parse `type` field from each script:
84
+ - CREATE TABLE → New table created
85
+ - ALTER TABLE → Table modified
86
+ - DROP TABLE → Table removed
87
+
88
+ 3. **Calculate execution duration**
89
+ - Duration = end_time - start_time
90
+
91
+ # Task Completion Report
92
+
93
+ ## Success Report
94
+
95
+ ```
96
+ ## Task Completion Report
97
+ - **Status**: SUCCESS
98
+ - **Platform**: {platform_id}
99
+ - **Project Root**: {project_root}
100
+ - **Migration Command**: {migration_cmd}
101
+ - **Scripts Executed**: {count}
102
+ - {script_1_name}: {type} ({tables_affected})
103
+ - {script_2_name}: {type} ({tables_affected})
104
+ - ...
105
+ - **Tables Affected**:
106
+ - Created: {table_list}
107
+ - Modified: {table_list}
108
+ - Dropped: {table_list}
109
+ - **Validation Status**: {PASSED | SKIPPED}
110
+ - **Execution Duration**: {duration_seconds}s
111
+ - **Summary**: Database migration completed successfully
112
+ ```
113
+
114
+ ## Failure Report
115
+
116
+ ```
117
+ ## Task Completion Report
118
+ - **Status**: FAILED
119
+ - **Platform**: {platform_id}
120
+ - **Project Root**: {project_root}
121
+ - **Migration Command**: {migration_cmd}
122
+ - **Error Category**: {DEPENDENCY_MISSING | BUILD_FAILURE | VALIDATION_ERROR}
123
+ - **Error**: {detailed error description}
124
+ - **Scripts Attempted**: {count}
125
+ - **Failed Script**: {script_name} (if applicable)
126
+ - **Migration Output** (last 30 lines):
127
+ ```
128
+ {last_30_lines_of_migration_output}
129
+ ```
130
+ - **Recovery Hint**: {suggestion for resolving the issue}
131
+ ```
132
+
133
+ # Key Rules
134
+
135
+ | Rule | Description |
136
+ |------|-------------|
137
+ | **Script Verification** | Always verify migration script files exist before execution |
138
+ | **Optional Validation** | Validation step is optional based on validation_cmd presence |
139
+ | **JSON Parsing** | Parse migration_scripts JSON to extract script metadata |
140
+ | **Table Tracking** | Report tables affected by each migration script |
141
+ | **Duration Tracking** | Record and report migration execution duration |