speccrew 0.6.68 → 0.7.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.
Files changed (134) hide show
  1. package/.speccrew/agents/speccrew-task-worker.md +1 -1
  2. package/.speccrew/agents/speccrew-team-leader.md +336 -189
  3. package/.speccrew/skills/speccrew-agentflow-manager/SKILL.md +161 -0
  4. package/.speccrew/skills/speccrew-agentflow-manager/workflow.agentflow.xml +347 -0
  5. package/.speccrew/skills/speccrew-deploy-build/SKILL.md +3 -56
  6. package/.speccrew/skills/speccrew-deploy-build/workflow.agentflow.xml +125 -0
  7. package/.speccrew/skills/speccrew-deploy-migrate/SKILL.md +3 -64
  8. package/.speccrew/skills/speccrew-deploy-migrate/workflow.agentflow.xml +135 -0
  9. package/.speccrew/skills/speccrew-deploy-smoke-test/SKILL.md +4 -156
  10. package/.speccrew/skills/speccrew-deploy-smoke-test/workflow.agentflow.xml +178 -0
  11. package/.speccrew/skills/speccrew-deploy-startup/SKILL.md +3 -135
  12. package/.speccrew/skills/speccrew-deploy-startup/workflow.agentflow.xml +223 -0
  13. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +10 -2
  14. package/.speccrew/skills/speccrew-dev-backend/workflow.agentflow.xml +254 -0
  15. package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +10 -2
  16. package/.speccrew/skills/speccrew-dev-desktop-electron/workflow.agentflow.xml +259 -0
  17. package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +10 -2
  18. package/.speccrew/skills/speccrew-dev-desktop-tauri/workflow.agentflow.xml +245 -0
  19. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +10 -2
  20. package/.speccrew/skills/speccrew-dev-frontend/workflow.agentflow.xml +262 -0
  21. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +10 -2
  22. package/.speccrew/skills/speccrew-dev-mobile/workflow.agentflow.xml +244 -0
  23. package/.speccrew/skills/speccrew-dev-review-backend/SKILL.md +10 -2
  24. package/.speccrew/skills/speccrew-dev-review-backend/workflow.agentflow.xml +251 -0
  25. package/.speccrew/skills/speccrew-dev-review-desktop/SKILL.md +10 -2
  26. package/.speccrew/skills/speccrew-dev-review-desktop/workflow.agentflow.xml +214 -0
  27. package/.speccrew/skills/speccrew-dev-review-frontend/SKILL.md +10 -2
  28. package/.speccrew/skills/speccrew-dev-review-frontend/workflow.agentflow.xml +213 -0
  29. package/.speccrew/skills/speccrew-dev-review-mobile/SKILL.md +10 -2
  30. package/.speccrew/skills/speccrew-dev-review-mobile/workflow.agentflow.xml +214 -0
  31. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +7 -1
  32. package/.speccrew/skills/speccrew-fd-api-contract/workflow.agentflow.xml +222 -0
  33. package/.speccrew/skills/speccrew-fd-feature-analyze/SKILL.md +7 -1
  34. package/.speccrew/skills/speccrew-fd-feature-analyze/workflow.agentflow.xml +223 -0
  35. package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +7 -1
  36. package/.speccrew/skills/speccrew-fd-feature-design/workflow.agentflow.xml +322 -0
  37. package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +3 -39
  38. package/.speccrew/skills/speccrew-get-timestamp/workflow.agentflow.xml +43 -0
  39. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +57 -508
  40. package/.speccrew/skills/{speccrew-knowledge-bizs-api-analyze-xml/SKILL.md → speccrew-knowledge-bizs-api-analyze/workflow.agentflow.xml} +1 -154
  41. package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +73 -283
  42. package/.speccrew/skills/{speccrew-knowledge-bizs-api-graph-xml/SKILL.md → speccrew-knowledge-bizs-api-graph/workflow.agentflow.xml} +0 -298
  43. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +931 -801
  44. package/.speccrew/skills/{speccrew-knowledge-bizs-dispatch-xml/SKILL.md → speccrew-knowledge-bizs-dispatch/workflow.agentflow.xml} +42 -272
  45. package/.speccrew/skills/speccrew-knowledge-bizs-identify-entries/SKILL.md +263 -71
  46. package/.speccrew/skills/{speccrew-knowledge-bizs-identify-entries-xml/SKILL.md → speccrew-knowledge-bizs-identify-entries/workflow.agentflow.xml} +8 -184
  47. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +200 -181
  48. package/.speccrew/skills/{speccrew-knowledge-bizs-init-features-xml/SKILL.md → speccrew-knowledge-bizs-init-features/workflow.agentflow.xml} +7 -134
  49. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +5 -89
  50. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/workflow.agentflow.xml +129 -0
  51. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +454 -326
  52. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-analyze-xml/SKILL.md → speccrew-knowledge-bizs-ui-analyze/workflow.agentflow.xml} +8 -128
  53. package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +302 -247
  54. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-graph-xml/SKILL.md → speccrew-knowledge-bizs-ui-graph/workflow.agentflow.xml} +7 -199
  55. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +267 -156
  56. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-style-extract-xml/SKILL.md → speccrew-knowledge-bizs-ui-style-extract/workflow.agentflow.xml} +7 -151
  57. package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +3 -122
  58. package/.speccrew/skills/speccrew-knowledge-graph-query/workflow.agentflow.xml +106 -0
  59. package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +3 -80
  60. package/.speccrew/skills/speccrew-knowledge-graph-write/workflow.agentflow.xml +152 -0
  61. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +371 -265
  62. package/.speccrew/skills/{speccrew-knowledge-module-summarize-xml/SKILL.md → speccrew-knowledge-module-summarize/workflow.agentflow.xml} +7 -197
  63. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +45 -333
  64. package/.speccrew/skills/{speccrew-knowledge-system-summarize-xml/SKILL.md → speccrew-knowledge-system-summarize/workflow.agentflow.xml} +0 -177
  65. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +174 -727
  66. package/.speccrew/skills/{speccrew-knowledge-techs-dispatch-xml/SKILL.md → speccrew-knowledge-techs-dispatch/workflow.agentflow.xml} +10 -351
  67. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +20 -150
  68. package/.speccrew/skills/{speccrew-knowledge-techs-generate-xml/SKILL.md → speccrew-knowledge-techs-generate/workflow.agentflow.xml} +0 -169
  69. package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +75 -587
  70. package/.speccrew/skills/{speccrew-knowledge-techs-generate-conventions-xml/SKILL.md → speccrew-knowledge-techs-generate-conventions/workflow.agentflow.xml} +0 -153
  71. package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +463 -297
  72. package/.speccrew/skills/{speccrew-knowledge-techs-generate-quality-xml/SKILL.md → speccrew-knowledge-techs-generate-quality/workflow.agentflow.xml} +0 -164
  73. package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +57 -292
  74. package/.speccrew/skills/{speccrew-knowledge-techs-generate-ui-style-xml/SKILL.md → speccrew-knowledge-techs-generate-ui-style/workflow.agentflow.xml} +2 -193
  75. package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +49 -335
  76. package/.speccrew/skills/{speccrew-knowledge-techs-index-xml/SKILL.md → speccrew-knowledge-techs-index/workflow.agentflow.xml} +0 -167
  77. package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +28 -109
  78. package/.speccrew/skills/{speccrew-knowledge-techs-init-xml/SKILL.md → speccrew-knowledge-techs-init/workflow.agentflow.xml} +0 -189
  79. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +3 -487
  80. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/workflow.agentflow.xml +278 -0
  81. package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +3 -71
  82. package/.speccrew/skills/speccrew-pm-knowledge-detector/workflow.agentflow.xml +108 -0
  83. package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +3 -107
  84. package/.speccrew/skills/speccrew-pm-module-initializer/workflow.agentflow.xml +139 -0
  85. package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +3 -115
  86. package/.speccrew/skills/speccrew-pm-module-matcher/workflow.agentflow.xml +146 -0
  87. package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +3 -343
  88. package/.speccrew/skills/speccrew-pm-requirement-analysis/workflow.agentflow.xml +174 -0
  89. package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +3 -91
  90. package/.speccrew/skills/speccrew-pm-requirement-assess/workflow.agentflow.xml +173 -0
  91. package/.speccrew/skills/speccrew-pm-requirement-clarify/SKILL.md +3 -224
  92. package/.speccrew/skills/speccrew-pm-requirement-clarify/workflow.agentflow.xml +159 -0
  93. package/.speccrew/skills/speccrew-pm-requirement-model/SKILL.md +3 -275
  94. package/.speccrew/skills/speccrew-pm-requirement-model/workflow.agentflow.xml +210 -0
  95. package/.speccrew/skills/speccrew-pm-requirement-simple/SKILL.md +3 -76
  96. package/.speccrew/skills/speccrew-pm-requirement-simple/workflow.agentflow.xml +120 -0
  97. package/.speccrew/skills/speccrew-pm-sub-prd-generate/SKILL.md +7 -1
  98. package/.speccrew/skills/speccrew-pm-sub-prd-generate/workflow.agentflow.xml +218 -0
  99. package/.speccrew/skills/speccrew-sd-backend/SKILL.md +7 -1
  100. package/.speccrew/skills/speccrew-sd-backend/workflow.agentflow.xml +264 -0
  101. package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +7 -1
  102. package/.speccrew/skills/speccrew-sd-desktop/workflow.agentflow.xml +288 -0
  103. package/.speccrew/skills/speccrew-sd-framework-evaluate/SKILL.md +7 -1
  104. package/.speccrew/skills/speccrew-sd-framework-evaluate/workflow.agentflow.xml +235 -0
  105. package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +7 -1
  106. package/.speccrew/skills/speccrew-sd-frontend/workflow.agentflow.xml +299 -0
  107. package/.speccrew/skills/speccrew-sd-mobile/SKILL.md +7 -1
  108. package/.speccrew/skills/speccrew-sd-mobile/workflow.agentflow.xml +301 -0
  109. package/.speccrew/skills/speccrew-test-case-design/SKILL.md +165 -284
  110. package/.speccrew/skills/speccrew-test-case-design/workflow.agentflow.xml +210 -0
  111. package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +204 -324
  112. package/.speccrew/skills/speccrew-test-code-gen/workflow.agentflow.xml +265 -0
  113. package/.speccrew/skills/speccrew-test-reporter/SKILL.md +205 -184
  114. package/.speccrew/skills/speccrew-test-reporter/workflow.agentflow.xml +284 -0
  115. package/.speccrew/skills/speccrew-test-runner/SKILL.md +242 -241
  116. package/.speccrew/skills/speccrew-test-runner/workflow.agentflow.xml +314 -0
  117. package/bin/cli.js +8 -1
  118. package/lib/commands/validate.js +565 -0
  119. package/package.json +1 -1
  120. package/workspace-template/docs/rules/{xml-workflow-spec.md → agentflow-spec.md} +5 -5
  121. package/workspace-template/scripts/validate-agentflow.js +637 -0
  122. package/.speccrew/agents/speccrew-team-leader-xml.md +0 -480
  123. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +0 -99
  124. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +0 -176
  125. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +0 -150
  126. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +0 -106
  127. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +0 -249
  128. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js +0 -300
  129. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +0 -915
  130. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +0 -226
  131. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +0 -34
  132. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +0 -1071
  133. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +0 -26
  134. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +0 -550
@@ -0,0 +1,125 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="deploy-build" status="pending" version="1.0" desc="Execute application build and verify artifacts">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="platform_id" required="true" type="string" desc="Platform identifier (e.g., backend-spring, frontend-react)"/>
9
+ <field name="build_cmd" required="true" type="string" desc="Build command from conventions-data/build (e.g., mvn package -DskipTests)"/>
10
+ <field name="project_root" required="true" type="string" desc="Absolute path to the project root directory"/>
11
+ <field name="iteration_path" required="true" type="string" desc="Current iteration directory path"/>
12
+ </block>
13
+
14
+ <!-- ============================================================
15
+ Global Constraints
16
+ ============================================================ -->
17
+ <block type="rule" id="R1" level="mandatory" desc="Build execution constraints">
18
+ <field name="text">All build commands come from input parameters - NO hard-coded commands</field>
19
+ <field name="text">Always verify expected artifacts exist after build</field>
20
+ <field name="text">Record and report build duration</field>
21
+ <field name="text">Capture and report relevant build output</field>
22
+ </block>
23
+
24
+ <!-- ============================================================
25
+ Main Processing Sequence
26
+ ============================================================ -->
27
+ <sequence id="S1" name="Build Application" status="pending" desc="Pre-check, execute build, verify output">
28
+
29
+ <!-- Step 1: Pre-build Check -->
30
+ <block type="task" id="B1" action="validate" desc="Verify project root exists">
31
+ <field name="check">directory_exists(${project_root})</field>
32
+ <field name="on_fail">STOP with Error Category: DEPENDENCY_MISSING</field>
33
+ <field name="output" var="project_root_valid"/>
34
+ </block>
35
+
36
+ <block type="task" id="B2" action="run-script" desc="Verify build tool is available">
37
+ <field name="command">detect build tool from "${build_cmd}" and run version check</field>
38
+ <field name="rules">
39
+ - mvn → Run `mvn --version`
40
+ - npm/pnpm/yarn → Run `{tool} --version`
41
+ - gradle → Run `gradle --version`
42
+ - go → Run `go version`
43
+ </field>
44
+ <field name="on_fail">STOP with Error Category: DEPENDENCY_MISSING</field>
45
+ <field name="output" var="tool_check_result"/>
46
+ </block>
47
+
48
+ <block type="task" id="B3" action="validate" desc="Check for build config files">
49
+ <field name="rules">
50
+ - Maven: pom.xml must exist in project_root
51
+ - Node.js: package.json must exist in project_root
52
+ - Gradle: build.gradle or build.gradle.kts must exist
53
+ - Go: go.mod must exist
54
+ </field>
55
+ <field name="on_fail">STOP with Error Category: VALIDATION_ERROR</field>
56
+ <field name="output" var="config_check_result"/>
57
+ </block>
58
+
59
+ <!-- Step 2: Execute Build -->
60
+ <block type="event" id="E1" action="log" level="info" desc="Record build start time">
61
+ <field name="message">Build starting for platform: ${platform_id}</field>
62
+ <field name="output" var="start_time"/>
63
+ </block>
64
+
65
+ <block type="task" id="B4" action="run-script" desc="Execute build command">
66
+ <field name="command">${build_cmd}</field>
67
+ <field name="working_directory">${project_root}</field>
68
+ <field name="capture_stdout">true</field>
69
+ <field name="capture_stderr">true</field>
70
+ <field name="output" var="build_result"/>
71
+ </block>
72
+
73
+ <block type="gateway" id="G1" mode="guard" desc="Check build exit code"
74
+ test="${build_result.exit_code} == 0"
75
+ fail-action="stop">
76
+ <field name="message">Build failed with exit code ${build_result.exit_code}. Error Category: BUILD_FAILURE</field>
77
+ </block>
78
+
79
+ <block type="event" id="E2" action="log" level="info" desc="Record build end time">
80
+ <field name="output" var="end_time"/>
81
+ </block>
82
+
83
+ <!-- Step 3: Verify Build Output -->
84
+ <block type="task" id="B5" action="analyze" desc="Detect expected artifacts by platform">
85
+ <field name="rules">
86
+ - Spring/Maven: target/*.jar files
87
+ - Node.js: dist/ or build/ directory
88
+ - Gradle: build/libs/*.jar
89
+ - Go: Binary executable in project root or bin/
90
+ </field>
91
+ <field name="output" var="artifact_patterns"/>
92
+ </block>
93
+
94
+ <block type="task" id="B6" action="search" desc="Find build artifacts">
95
+ <field name="patterns">${artifact_patterns}</field>
96
+ <field name="base_path">${project_root}</field>
97
+ <field name="output" var="artifacts"/>
98
+ </block>
99
+
100
+ <block type="gateway" id="G2" mode="guard" desc="Verify artifacts exist"
101
+ test="${artifacts.length} > 0"
102
+ fail-action="stop">
103
+ <field name="message">No build artifacts found. Error Category: BUILD_FAILURE</field>
104
+ </block>
105
+
106
+ <block type="event" id="E3" action="log" level="info" desc="Build completed successfully">
107
+ <field name="message">Build completed with ${artifacts.length} artifacts</field>
108
+ </block>
109
+
110
+ </sequence>
111
+
112
+ <!-- ============================================================
113
+ Output Results
114
+ ============================================================ -->
115
+ <block type="output" id="O1" desc="Workflow output results">
116
+ <field name="status" value="SUCCESS" type="string" desc="Build status"/>
117
+ <field name="platform_id" from="${platform_id}" type="string" desc="Platform identifier"/>
118
+ <field name="project_root" from="${project_root}" type="string" desc="Project root path"/>
119
+ <field name="build_duration" from="${end_time - start_time}" type="number" desc="Build duration in seconds"/>
120
+ <field name="build_command" from="${build_cmd}" type="string" desc="Build command executed"/>
121
+ <field name="artifact_paths" from="${artifacts}" type="array" desc="List of generated artifact paths"/>
122
+ <field name="artifact_count" from="${artifacts.length}" type="number" desc="Number of artifacts generated"/>
123
+ </block>
124
+
125
+ </workflow>
@@ -21,72 +21,11 @@ tools: Read, Bash, Glob
21
21
  | `project_root` | Yes | string | Absolute path to the project root directory |
22
22
  | `iteration_path` | Yes | string | Current iteration directory path |
23
23
 
24
- # Workflow
24
+ ## AgentFlow Definition
25
25
 
26
- ## Step 1: Pre-migration Check
26
+ <!-- @agentflow: workflow.agentflow.xml -->
27
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
28
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
90
29
 
91
30
  # Task Completion Report
92
31
 
@@ -0,0 +1,135 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="deploy-migrate" status="pending" version="1.0" desc="Execute database migration and validate results">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="platform_id" required="true" type="string" desc="Platform identifier"/>
9
+ <field name="migration_cmd" required="true" type="string" desc="Migration execution command from conventions-data (e.g., mvn flyway:migrate)"/>
10
+ <field name="validation_cmd" required="false" type="string" desc="Migration validation command (e.g., mvn flyway:validate)"/>
11
+ <field name="migration_scripts" required="true" type="string" desc="JSON array of migration scripts: [{name, path, type}]"/>
12
+ <field name="project_root" required="true" type="string" desc="Absolute path to the project root directory"/>
13
+ <field name="iteration_path" required="true" type="string" desc="Current iteration directory path"/>
14
+ </block>
15
+
16
+ <!-- ============================================================
17
+ Global Constraints
18
+ ============================================================ -->
19
+ <block type="rule" id="R1" level="mandatory" desc="Migration execution constraints">
20
+ <field name="text">Always verify migration script files exist before execution</field>
21
+ <field name="text">Validation step is optional based on validation_cmd presence</field>
22
+ <field name="text">Parse migration_scripts JSON to extract script metadata</field>
23
+ <field name="text">Report tables affected by each migration script</field>
24
+ <field name="text">Record and report migration execution duration</field>
25
+ </block>
26
+
27
+ <!-- ============================================================
28
+ Main Processing Sequence
29
+ ============================================================ -->
30
+ <sequence id="S1" name="Database Migration" status="pending" desc="Pre-check, execute migration, validate results">
31
+
32
+ <!-- Step 1: Pre-migration Check -->
33
+ <block type="task" id="B1" action="analyze" desc="Parse migration scripts JSON">
34
+ <field name="input">${migration_scripts}</field>
35
+ <field name="parse_json">true</field>
36
+ <field name="output" var="scripts_list"/>
37
+ </block>
38
+
39
+ <block type="loop" id="L1" over="${scripts_list}" as="script" desc="Verify each migration script file exists">
40
+ <block type="task" action="validate" desc="Verify script file exists">
41
+ <field name="check">file_exists(${script.path})</field>
42
+ <field name="on_fail">STOP with Error Category: DEPENDENCY_MISSING</field>
43
+ </block>
44
+ </block>
45
+
46
+ <block type="task" id="B2" action="run-script" desc="Verify migration tool is available">
47
+ <field name="command">detect tool from "${migration_cmd}" (e.g., mvn, npm, npx) and run version check</field>
48
+ <field name="on_fail">STOP with Error Category: DEPENDENCY_MISSING</field>
49
+ <field name="output" var="tool_check_result"/>
50
+ </block>
51
+
52
+ <block type="event" id="E1" action="log" level="info" desc="Log script count">
53
+ <field name="message">Preparing to execute ${scripts_list.length} migration scripts</field>
54
+ </block>
55
+
56
+ <!-- Step 2: Execute Migration -->
57
+ <block type="event" id="E2" action="log" level="info" desc="Record migration start time">
58
+ <field name="output" var="start_time"/>
59
+ </block>
60
+
61
+ <block type="task" id="B3" action="run-script" desc="Execute migration command">
62
+ <field name="command">${migration_cmd}</field>
63
+ <field name="working_directory">${project_root}</field>
64
+ <field name="capture_stdout">true</field>
65
+ <field name="capture_stderr">true</field>
66
+ <field name="output" var="migration_result"/>
67
+ </block>
68
+
69
+ <block type="gateway" id="G1" mode="guard" desc="Check migration exit code"
70
+ test="${migration_result.exit_code} == 0"
71
+ fail-action="stop">
72
+ <field name="message">Migration failed with exit code ${migration_result.exit_code}. Error Category: BUILD_FAILURE</field>
73
+ </block>
74
+
75
+ <!-- Step 3: Validate Migration (if validation_cmd provided) -->
76
+ <block type="gateway" id="G2" mode="exclusive" desc="Check if validation is required">
77
+ <branch test="${validation_cmd} != null AND ${validation_cmd} != ''" name="Run Validation">
78
+ <block type="task" id="B4" action="run-script" desc="Execute validation command">
79
+ <field name="command">${validation_cmd}</field>
80
+ <field name="working_directory">${project_root}</field>
81
+ <field name="capture_output">true</field>
82
+ <field name="output" var="validation_result"/>
83
+ </block>
84
+
85
+ <block type="gateway" id="G3" mode="guard" desc="Check validation result"
86
+ test="${validation_result.exit_code} == 0"
87
+ fail-action="stop">
88
+ <field name="message">Migration validation failed. Error Category: VALIDATION_ERROR</field>
89
+ </block>
90
+
91
+ <block type="event" action="log" level="info" desc="Log validation passed">
92
+ <field name="message">Migration validation passed</field>
93
+ <field name="output" var="validation_status" value="PASSED"/>
94
+ </block>
95
+ </branch>
96
+ <branch default="true" name="Skip Validation">
97
+ <block type="event" action="log" level="info" desc="Log validation skipped">
98
+ <field name="message">No validation command provided, skipping validation</field>
99
+ <field name="output" var="validation_status" value="SKIPPED"/>
100
+ </block>
101
+ </branch>
102
+ </block>
103
+
104
+ <!-- Step 4: Report Migration Results -->
105
+ <block type="event" id="E3" action="log" level="info" desc="Record migration end time">
106
+ <field name="output" var="end_time"/>
107
+ </block>
108
+
109
+ <block type="task" id="B5" action="analyze" desc="Analyze tables affected">
110
+ <field name="rules">
111
+ - Parse `type` field from each script:
112
+ - CREATE TABLE → New table created
113
+ - ALTER TABLE → Table modified
114
+ - DROP TABLE → Table removed
115
+ </field>
116
+ <field name="output" var="tables_affected"/>
117
+ </block>
118
+
119
+ </sequence>
120
+
121
+ <!-- ============================================================
122
+ Output Results
123
+ ============================================================ -->
124
+ <block type="output" id="O1" desc="Workflow output results">
125
+ <field name="status" value="SUCCESS" type="string" desc="Migration status"/>
126
+ <field name="platform_id" from="${platform_id}" type="string" desc="Platform identifier"/>
127
+ <field name="project_root" from="${project_root}" type="string" desc="Project root path"/>
128
+ <field name="migration_command" from="${migration_cmd}" type="string" desc="Migration command executed"/>
129
+ <field name="scripts_executed" from="${scripts_list.length}" type="number" desc="Number of scripts executed"/>
130
+ <field name="tables_affected" from="${tables_affected}" type="object" desc="Tables affected by migration"/>
131
+ <field name="validation_status" from="${validation_status}" type="string" desc="Validation status"/>
132
+ <field name="execution_duration" from="${end_time - start_time}" type="number" desc="Execution duration in seconds"/>
133
+ </block>
134
+
135
+ </workflow>
@@ -24,163 +24,11 @@ tools: Read, Bash, Glob
24
24
  | `expected_log_patterns` | No | string | Comma-separated regex patterns expected in log for `log` mode (e.g., `"DB initialized,UI loaded"`) |
25
25
  | `process_name` | No | string | Process name or pattern to check (for `process` mode, e.g., `myapp.exe` or `MyApp`) |
26
26
 
27
- # Workflow
28
-
29
- ### Test Strategy
30
-
31
- Based on `test_mode` parameter:
32
-
33
- **Mode: `http`** (default — for server/web applications)
34
- - Parse API Contract documents
35
- - curl each endpoint and verify HTTP status codes
36
- - Pass criteria: GET returns 200; POST/PUT/DELETE returns non-404
37
-
38
- **Mode: `process`** (for client/desktop applications)
39
- - Verify the application process is still running (not crashed)
40
- - If the app supports a CLI health check command, run it
41
- - Pass criteria: Process alive AND exit code matches `expected_exit_code` (if process has exited)
42
- - For GUI apps: Check process exists and has been running for at least 10 seconds without crash
43
-
44
- **Mode: `log`** (for log-based verification)
45
- - Read `log_file` content
46
- - Check for each pattern in `expected_log_patterns`
47
- - Pass criteria: ALL expected patterns found in log
48
- - Fail: Any pattern missing → report which patterns were not found
49
- - Example patterns for client with local DB:
50
- - "Database migration completed" (DB initialized)
51
- - "Application ready" (app started)
52
- - "UI rendered" (UI loaded, for GUI apps)
53
-
54
- ## Step 1: Parse API Contracts (HTTP Mode)
55
-
56
- Extract endpoints from API Contract documents:
57
-
58
- 1. **Read each API Contract document**
59
- - Split `api_contract_paths` by comma
60
- - Read each document using Read tool
61
-
62
- 2. **Extract endpoint list**
63
- - Parse endpoints from contract:
64
- - Method: GET, POST, PUT, DELETE, etc.
65
- - Path: endpoint path (e.g., `/api/users`)
66
- - Expected status code: from contract definition
67
-
68
- 3. **Filter for core endpoints**
69
- - Focus on core endpoints only
70
- - For GET endpoints: test directly with full validation
71
- - For POST/PUT/DELETE: only verify endpoint exists (expect 400/401/405 is acceptable, NOT 404)
72
-
73
- ## Step 2: Execute Smoke Tests (HTTP Mode)
74
-
75
- Test each endpoint:
76
-
77
- 1. **For each endpoint, execute curl command**
78
- ```bash
79
- curl -s -o /dev/null -w "%{http_code}" -X {METHOD} {base_url}{path}
80
- ```
81
-
82
- 2. **Record test results**
83
- - Endpoint path
84
- - HTTP method
85
- - Expected status (or status range)
86
- - Actual status code
87
- - Pass/fail status
88
-
89
- 3. **Handle connection errors**
90
- - If curl fails to connect → mark as FAILED
91
- - Report: "Cannot connect to {base_url}"
92
-
93
- ## Step 2 (Alternative): Process Mode Verification
94
-
95
- For client/desktop applications:
96
-
97
- 1. **Check process is still running**
98
- - **Windows**:
99
- ```powershell
100
- tasklist /FI "IMAGENAME eq {process_name}" | findstr /I "{process_name}"
101
- ```
102
- - **Unix/Mac**:
103
- ```bash
104
- pgrep -f "{process_name}"
105
- ```
106
-
107
- 2. **Verify process stability**
108
- - Record process start time
109
- - Wait 10 seconds
110
- - Check if process is still running (not crashed)
111
- - If process has exited:
112
- - Get exit code
113
- - Compare with `expected_exit_code` (default: 0)
114
-
115
- 3. **Record test results**
116
- - Process name
117
- - Status: RUNNING / EXITED
118
- - Exit code (if exited)
119
- - Uptime (if running)
120
- - Pass/fail status
121
-
122
- ## Step 2 (Alternative): Log Mode Verification
123
-
124
- For log-based smoke testing:
125
-
126
- 1. **Read log file content**
127
- - Use Read tool to read `log_file`
128
- - If file not found → FAILED
129
-
130
- 2. **Parse expected patterns**
131
- - Split `expected_log_patterns` by comma
132
- - Trim whitespace from each pattern
133
-
134
- 3. **Check each pattern**
135
- - For each pattern in expected patterns:
136
- - **Windows**:
137
- ```powershell
138
- Select-String -Path "{log_file}" -Pattern "{pattern}"
139
- ```
140
- - **Unix/Mac**:
141
- ```bash
142
- grep -E "{pattern}" "{log_file}"
143
- ```
144
- - Record whether pattern was found
145
-
146
- 4. **Record test results**
147
- - Pattern name
148
- - Found: YES/NO
149
- - Pass/fail status
150
-
151
- 5. **Report missing patterns**
152
- - List all patterns not found
153
- - Include context from log if available
154
-
155
- ## Step 3: Evaluate Results
156
-
157
- Apply pass criteria:
158
-
159
- 1. **GET endpoints**
160
- - Pass: HTTP 200 or 301/302 (redirect)
161
- - Fail: 404 or connection error
162
-
163
- 2. **POST/PUT/DELETE endpoints**
164
- - Pass: NOT 404 (any other status is acceptable for smoke test)
165
- - Acceptable: 400 (bad request), 401 (unauthorized), 405 (method not allowed)
166
- - Fail: 404 (not found)
167
-
168
- 3. **Health endpoint**
169
- - Pass: HTTP 200
170
- - Fail: Any other status
171
-
172
- 4. **Calculate pass rate**
173
- - pass_rate = (passed_count / total_count) * 100
174
-
175
- ## Step 4: Report Smoke Test Results
176
-
177
- Compile test results table:
27
+ ## AgentFlow Definition
178
28
 
179
- | Endpoint | Method | Expected | Actual | Status |
180
- |----------|--------|----------|--------|--------|
181
- | /api/users | GET | 200 | 200 | PASS |
182
- | /api/auth/login | POST | !404 | 401 | PASS |
183
- | /api/orders | GET | 200 | 404 | FAIL |
29
+ <!-- @agentflow: workflow.agentflow.xml -->
30
+
31
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
184
32
 
185
33
  # Task Completion Report
186
34