@atlashub/smartstack-cli 3.37.0 → 3.38.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 (216) hide show
  1. package/dist/index.js +16 -24
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +201 -256
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/scripts/extract-api-endpoints.ts +5 -5
  7. package/scripts/generate-doc-with-mock-ui.ts +10 -17
  8. package/templates/agents/ba-reader.md +9 -9
  9. package/templates/agents/ba-writer.md +12 -15
  10. package/templates/agents/code-reviewer.md +1 -1
  11. package/templates/agents/docs-context-reader.md +1 -1
  12. package/templates/agents/gitflow/merge.md +0 -4
  13. package/templates/agents/gitflow/pr.md +0 -4
  14. package/templates/agents/gitflow/start.md +30 -5
  15. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
  16. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
  17. package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
  18. package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
  19. package/templates/skills/_shared.md +15 -17
  20. package/templates/skills/ai-prompt/SKILL.md +1 -1
  21. package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
  22. package/templates/skills/apex/SKILL.md +3 -4
  23. package/templates/skills/apex/_shared.md +10 -20
  24. package/templates/skills/apex/references/analysis-methods.md +141 -0
  25. package/templates/skills/apex/references/challenge-questions.md +1 -21
  26. package/templates/skills/apex/references/core-seed-data.md +35 -57
  27. package/templates/skills/apex/references/examine-build-validation.md +87 -0
  28. package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
  29. package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
  30. package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
  31. package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
  32. package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
  33. package/templates/skills/apex/references/post-checks.md +145 -40
  34. package/templates/skills/apex/references/smartstack-api.md +35 -51
  35. package/templates/skills/apex/references/smartstack-frontend.md +17 -17
  36. package/templates/skills/apex/references/smartstack-layers.md +38 -62
  37. package/templates/skills/apex/steps/step-00-init.md +14 -26
  38. package/templates/skills/apex/steps/step-01-analyze.md +10 -143
  39. package/templates/skills/apex/steps/step-02-plan.md +10 -92
  40. package/templates/skills/apex/steps/step-03-execute.md +47 -249
  41. package/templates/skills/apex/steps/step-04-examine.md +14 -78
  42. package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
  43. package/templates/skills/apex/steps/step-08-run-tests.md +2 -0
  44. package/templates/skills/application/SKILL.md +6 -7
  45. package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
  46. package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
  47. package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
  48. package/templates/skills/application/references/backend-verification.md +1 -1
  49. package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
  50. package/templates/skills/application/references/frontend-route-naming.md +117 -0
  51. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
  52. package/templates/skills/application/references/frontend-verification.md +12 -12
  53. package/templates/skills/application/references/init-parameter-detection.md +120 -0
  54. package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
  55. package/templates/skills/application/references/nav-fallback-procedure.md +5 -6
  56. package/templates/skills/application/references/provider-template.md +2 -6
  57. package/templates/skills/application/references/roles-client-project-handling.md +55 -0
  58. package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
  59. package/templates/skills/application/references/test-coverage-requirements.md +213 -0
  60. package/templates/skills/application/references/test-frontend.md +3 -3
  61. package/templates/skills/application/steps/step-00-init.md +11 -141
  62. package/templates/skills/application/steps/step-01-navigation.md +3 -3
  63. package/templates/skills/application/steps/step-02-permissions.md +4 -4
  64. package/templates/skills/application/steps/step-03-roles.md +18 -175
  65. package/templates/skills/application/steps/step-03b-provider.md +1 -2
  66. package/templates/skills/application/steps/step-04-backend.md +19 -110
  67. package/templates/skills/application/steps/step-05-frontend.md +17 -143
  68. package/templates/skills/application/steps/step-06-migration.md +12 -60
  69. package/templates/skills/application/steps/step-07-tests.md +9 -76
  70. package/templates/skills/application/templates-backend.md +29 -27
  71. package/templates/skills/application/templates-frontend.md +48 -48
  72. package/templates/skills/application/templates-seed.md +57 -131
  73. package/templates/skills/business-analyse/SKILL.md +27 -30
  74. package/templates/skills/business-analyse/_architecture.md +6 -6
  75. package/templates/skills/business-analyse/_shared.md +60 -88
  76. package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
  77. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  78. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
  79. package/templates/skills/business-analyse/react/application-viewer.md +12 -12
  80. package/templates/skills/business-analyse/react/components.md +8 -12
  81. package/templates/skills/business-analyse/react/schema.md +11 -11
  82. package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
  83. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
  84. package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
  85. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
  86. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
  87. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
  88. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
  89. package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
  90. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
  91. package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
  92. package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
  93. package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
  94. package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
  95. package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
  96. package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
  97. package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
  98. package/templates/skills/business-analyse/references/prd-generation.md +2 -2
  99. package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
  100. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  101. package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
  102. package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
  103. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  104. package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
  105. package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
  106. package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
  107. package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
  108. package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
  109. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
  110. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
  111. package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
  112. package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
  113. package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
  114. package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
  115. package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
  116. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
  117. package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
  118. package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
  119. package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
  120. package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
  121. package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
  122. package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
  123. package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
  124. package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
  125. package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
  126. package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
  127. package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
  128. package/templates/skills/business-analyse/templates-frd.md +25 -25
  129. package/templates/skills/business-analyse/templates-react.md +15 -21
  130. package/templates/skills/controller/SKILL.md +1 -1
  131. package/templates/skills/controller/postman-templates.md +1 -1
  132. package/templates/skills/controller/references/controller-code-templates.md +2 -2
  133. package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
  134. package/templates/skills/controller/references/permission-sync-templates.md +13 -16
  135. package/templates/skills/controller/steps/step-00-init.md +11 -11
  136. package/templates/skills/controller/steps/step-03-generate.md +64 -103
  137. package/templates/skills/controller/templates.md +67 -71
  138. package/templates/skills/debug/SKILL.md +13 -218
  139. package/templates/skills/debug/steps/step-00-init.md +57 -0
  140. package/templates/skills/debug/steps/step-01-analyze.md +219 -0
  141. package/templates/skills/debug/steps/step-02-resolve.md +85 -0
  142. package/templates/skills/documentation/SKILL.md +49 -345
  143. package/templates/skills/documentation/data-schema.md +11 -8
  144. package/templates/skills/documentation/steps/step-00-init.md +70 -0
  145. package/templates/skills/documentation/steps/step-01-scan.md +113 -0
  146. package/templates/skills/documentation/steps/step-02-generate.md +231 -0
  147. package/templates/skills/documentation/steps/step-03-validate.md +238 -0
  148. package/templates/skills/documentation/templates.md +480 -322
  149. package/templates/skills/efcore/references/both-contexts.md +32 -0
  150. package/templates/skills/efcore/references/database-operations.md +67 -0
  151. package/templates/skills/efcore/references/destructive-operations.md +38 -0
  152. package/templates/skills/efcore/references/reset-operations.md +81 -0
  153. package/templates/skills/efcore/references/seed-methods.md +86 -0
  154. package/templates/skills/efcore/references/shared-init-functions.md +250 -0
  155. package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
  156. package/templates/skills/efcore/references/troubleshooting.md +81 -0
  157. package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
  158. package/templates/skills/efcore/steps/db/step-reset.md +7 -103
  159. package/templates/skills/efcore/steps/db/step-seed.md +10 -132
  160. package/templates/skills/efcore/steps/db/step-status.md +5 -44
  161. package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
  162. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
  163. package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
  164. package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
  165. package/templates/skills/feature-full/SKILL.md +1 -1
  166. package/templates/skills/feature-full/steps/step-00-init.md +57 -0
  167. package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
  168. package/templates/skills/gitflow/SKILL.md +1 -1
  169. package/templates/skills/gitflow/_shared.md +23 -0
  170. package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
  171. package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
  172. package/templates/skills/gitflow/references/finish-cleanup.md +51 -0
  173. package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
  174. package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
  175. package/templates/skills/gitflow/references/init-questions.md +185 -0
  176. package/templates/skills/gitflow/references/init-structure-creation.md +71 -0
  177. package/templates/skills/gitflow/references/init-version-detection.md +21 -0
  178. package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
  179. package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
  180. package/templates/skills/gitflow/references/merge-execution.md +62 -0
  181. package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
  182. package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
  183. package/templates/skills/gitflow/references/pr-generation.md +58 -0
  184. package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
  185. package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
  186. package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
  187. package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
  188. package/templates/skills/gitflow/steps/step-commit.md +12 -91
  189. package/templates/skills/gitflow/steps/step-finish.md +15 -159
  190. package/templates/skills/gitflow/steps/step-init.md +24 -326
  191. package/templates/skills/gitflow/steps/step-merge.md +17 -176
  192. package/templates/skills/gitflow/steps/step-pr.md +10 -116
  193. package/templates/skills/gitflow/steps/step-start.md +16 -109
  194. package/templates/skills/gitflow/steps/step-sync.md +6 -69
  195. package/templates/skills/ralph-loop/SKILL.md +6 -0
  196. package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
  197. package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
  198. package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
  199. package/templates/skills/ralph-loop/references/module-transition.md +151 -0
  200. package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
  201. package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
  202. package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
  203. package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
  204. package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
  205. package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
  206. package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
  207. package/templates/skills/ralph-loop/steps/step-04-check.md +21 -73
  208. package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
  209. package/templates/skills/review-code/references/smartstack-conventions.md +11 -11
  210. package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
  211. package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
  212. package/templates/skills/validate-feature/steps/step-01-compile.md +5 -2
  213. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
  214. package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
  215. package/templates/skills/workflow/SKILL.md +1 -1
  216. package/templates/skills/workflow/steps/step-00-init.md +57 -0
@@ -99,101 +99,16 @@ EXISTING_PR=$(gh pr list --head "$CURRENT" --json number --jq '.[0].number' 2>/d
99
99
 
100
100
  ### 4. Run Pre-PR Checks
101
101
 
102
- ```bash
103
- # Build check (multi-runtime detection)
104
- echo "Running build check..."
105
- if [ -f "*.sln" ] || ls *.csproj 2>/dev/null | head -1 > /dev/null; then
106
- dotnet build --no-restore 2>&1 || {
107
- echo "❌ .NET build failed. Fix before creating PR."
108
- STOP
109
- }
110
- # Migration check
111
- echo "Checking migrations..."
112
- dotnet ef migrations list 2>&1 || echo "No migrations or EF Core not configured"
113
- elif [ -f "package.json" ]; then
114
- npm run build 2>&1 || {
115
- echo "❌ npm build failed. Fix before creating PR."
116
- STOP
117
- }
118
- elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
119
- echo "Python project detected — skipping build check"
120
- else
121
- echo "⚠️ No known build system detected — skipping build check"
122
- fi
123
- ```
124
-
125
- ### 4b. Enforce Migration Squash (Feature Branches)
126
-
127
- **BLOCKING**: Feature branches must have at most 1 migration before creating a PR.
128
-
129
- ```bash
130
- if [ "$BRANCH_TYPE" = "feature" ]; then
131
- MIGRATION_DIR=$(find . -path "*/Persistence/Migrations" -type d 2>/dev/null | head -1)
132
- if [ -n "$MIGRATION_DIR" ]; then
133
- # Count migration .cs files added by this feature (not in target branch)
134
- NEW_MIGRATIONS=$(git diff --name-only "origin/$TARGET_BRANCH...HEAD" -- "$MIGRATION_DIR" \
135
- | grep -E '\.cs$' \
136
- | grep -v 'Designer\|ModelSnapshot' \
137
- | wc -l)
138
-
139
- if [ "$NEW_MIGRATIONS" -gt 1 ]; then
140
- echo ""
141
- echo "❌ MULTIPLE MIGRATIONS DETECTED ($NEW_MIGRATIONS migrations)"
142
- echo "→ Feature branches must have exactly 1 migration (squashed) before PR"
143
- echo "→ Run: /efcore squash"
144
- echo ""
145
- echo "Migrations found:"
146
- git diff --name-only "origin/$TARGET_BRANCH...HEAD" -- "$MIGRATION_DIR" \
147
- | grep -E '\.cs$' \
148
- | grep -v 'Designer\|ModelSnapshot'
149
- STOP
150
- elif [ "$NEW_MIGRATIONS" -eq 1 ]; then
151
- echo "✓ Single migration detected (squashed)"
152
- else
153
- echo "✓ No migrations in this feature"
154
- fi
155
- fi
156
- fi
157
- ```
102
+ See [references/pr-build-checks.md](../references/pr-build-checks.md) for:
103
+ - Multi-runtime detection (.NET, npm, Python)
104
+ - Build validation per runtime
105
+ - Migration squash enforcement (feature branches: max 1 migration)
158
106
 
159
107
  ### 5. Generate PR Content
160
108
 
161
- **Title:**
162
- ```bash
163
- BRANCH_NAME=$(echo $CURRENT | sed 's/.*\///')
164
- BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
165
-
166
- case "$BRANCH_TYPE" in
167
- feature) TITLE="feat: $BRANCH_NAME" ;;
168
- hotfix) TITLE="fix: $BRANCH_NAME" ;;
169
- release) TITLE="release: v$GF_VERSION" ;;
170
- esac
171
- ```
172
-
173
- **Body:**
174
- ```markdown
175
- ## Summary
176
-
177
- {Auto-generated from commit messages}
178
-
179
- ## Changes
180
-
181
- {List of files changed with categories}
182
-
183
- ## Testing
184
-
185
- - [ ] Build passes
186
- - [ ] Unit tests pass
187
- - [ ] Manual testing completed
188
-
189
- ## EF Core Migrations
190
-
191
- {Migration status: None | Added | Modified}
192
-
193
- ---
194
-
195
- 🤖 Generated with [Claude Code](https://claude.ai/code)
196
- ```
109
+ See [references/pr-generation.md](../references/pr-generation.md) for:
110
+ - PR title generation (feat/fix/release format)
111
+ - PR body template with summary, changes, testing, migrations
197
112
 
198
113
  ### 6. Create Pull Request
199
114
 
@@ -228,33 +143,12 @@ PR_ID=$(az repos pr list --source-branch "$CURRENT" --query "[0].pullRequestId"
228
143
 
229
144
  ### 7. Add Labels (GitHub)
230
145
 
231
- ```bash
232
- if [ "$GIT_PROVIDER" = "github" ]; then
233
- case "$BRANCH_TYPE" in
234
- feature) gh pr edit $PR_NUMBER --add-label "enhancement" ;;
235
- hotfix) gh pr edit $PR_NUMBER --add-label "bug,priority" ;;
236
- release) gh pr edit $PR_NUMBER --add-label "release" ;;
237
- esac
238
- fi
239
- ```
146
+ Auto-label PRs (enhancement/bug/priority/release) based on branch type.
240
147
 
241
148
  ### 8. Store PR Info
242
149
 
243
- ```bash
244
- # Persist PR info for merge step (uses config path for portability)
245
- CONFIG_DIR=$(dirname "$GF_CONFIG_FILE")
246
- cat > "$CONFIG_DIR/cache/pr-state.json" << EOF
247
- {
248
- "pr_number": "$PR_NUMBER",
249
- "pr_url": "$PR_URL",
250
- "source_branch": "$CURRENT",
251
- "target_branch": "$TARGET_BRANCH",
252
- "git_provider": "$GIT_PROVIDER",
253
- "created_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
254
- }
255
- EOF
256
- echo "✓ PR state saved to $CONFIG_DIR/cache/pr-state.json"
257
- ```
150
+ See [references/pr-generation.md](../references/pr-generation.md) for:
151
+ - PR state persistence to cache for merge step
258
152
 
259
153
  ### 9. Summary
260
154
 
@@ -33,103 +33,29 @@ Create a new feature/release/hotfix branch with optional worktree setup.
33
33
 
34
34
  ### 1. Load Config and Analyze Context
35
35
 
36
- ```bash
37
- # Load GitFlow config (sets GF_* variables)
38
- # See _shared.md → READ_GITFLOW_CONFIG for all variables
39
- read_gitflow_config || { echo "❌ Run /gitflow init first."; exit 1; }
40
-
41
- CURRENT_BRANCH=$(git branch --show-current)
42
- git fetch origin --quiet
43
-
44
- # Version from config
45
- VERSION="$GF_VERSION"
46
- LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
47
-
48
- # Develop ahead of main?
49
- DEVELOP_AHEAD=$(git rev-list --count origin/$GF_MAIN_BRANCH..origin/$GF_DEVELOP_BRANCH 2>/dev/null || echo "0")
50
-
51
- # Working directory status
52
- DIRTY=$(git status --porcelain | wc -l)
53
- ```
54
-
55
- **Display:**
56
- ```
57
- Current: {CURRENT_BRANCH} | Version: {VERSION} | Tag: {LAST_TAG}
58
- Develop → Main: {DEVELOP_AHEAD} commits {DEVELOP_AHEAD > 10 ? "(Release recommended)" : ""}
59
- ```
36
+ Load GitFlow config. Display current branch, version, tag, and dirty status.
60
37
 
61
38
  ### 2. Interactive Questions (if no args)
62
39
 
63
- **If branch_type missing:**
64
- ```yaml
65
- AskUserQuestion:
66
- header: "Type"
67
- question: "What type of branch?"
68
- options:
69
- - label: "Feature"
70
- description: "New feature from develop"
71
- - label: "Release v{X.Y+1.0}"
72
- description: "Prepare release from develop"
73
- - label: "Hotfix"
74
- description: "Urgent fix from main"
75
- ```
76
-
77
- **If branch_name missing:**
78
- ```yaml
79
- AskUserQuestion:
80
- header: "Name"
81
- question: "Branch name? (will be normalized to kebab-case)"
82
- # Free text input
83
- ```
40
+ Ask for branch type (feature/release/hotfix) and name if not provided via args. Display suggested next version for releases.
84
41
 
85
42
  ### 3. Normalize and Validate
86
43
 
87
- ```bash
88
- # Normalize name
89
- normalize_branch_name() {
90
- echo "$1" | tr '[:upper:]' '[:lower:]' | \
91
- sed 'y/àâäéèêëïîôùûüçœæ/aaaeeeeiioouucoa/' | \
92
- sed "s/[ _']/-/g" | sed 's/[^a-z0-9-]//g' | \
93
- sed 's/--*/-/g' | sed 's/^-//;s/-$//' | cut -c1-50
94
- }
95
-
96
- BRANCH_NAME=$(normalize_branch_name "$branch_name")
97
- FULL_BRANCH="${branch_type}/${BRANCH_NAME}"
98
-
99
- # Check if exists
100
- LOCAL_EXISTS=$(git branch --list "$FULL_BRANCH")
101
- REMOTE_EXISTS=$(git branch -r --list "origin/$FULL_BRANCH")
102
-
103
- [ -n "$LOCAL_EXISTS" ] || [ -n "$REMOTE_EXISTS" ] && {
104
- echo "ERROR: Branch '$FULL_BRANCH' already exists"
105
- # Options: Different name | Checkout existing | Delete and recreate
106
- }
107
- ```
44
+ See [references/start-branch-normalization.md](../references/start-branch-normalization.md) for:
45
+ - Branch name normalization (kebab-case)
46
+ - Branch existence validation
108
47
 
109
48
  ### 4. Determine Base Branch
110
49
 
111
- | Type | Base Branch | Target |
112
- |------|-------------|--------|
50
+ | Type | Base | Target |
51
+ |------|------|--------|
113
52
  | feature | develop | develop |
114
- | release | develop | main + develop |
115
- | hotfix | main | main + develop |
116
-
117
- ```bash
118
- case "$branch_type" in
119
- feature) BASE_BRANCH="develop"; TARGET="develop" ;;
120
- release) BASE_BRANCH="develop"; TARGET="main" ;;
121
- hotfix) BASE_BRANCH="main"; TARGET="main" ;;
122
- esac
123
- ```
53
+ | release | develop | main |
54
+ | hotfix | main | main |
124
55
 
125
56
  ### 5. Handle Dirty Working Directory
126
57
 
127
- ```bash
128
- [ "$DIRTY" -gt 0 ] && {
129
- echo "Working directory has uncommitted changes"
130
- # Options: Stash | Commit | Continue anyway | Cancel
131
- }
132
- ```
58
+ Offer user to stash, commit, or continue if working directory has changes.
133
59
 
134
60
  ### 5b. EF Core Migration Pre-flight (Release/Hotfix only)
135
61
 
@@ -143,31 +69,12 @@ Expected format: `{context}_v{version}_{sequence}_{Description}` (e.g., `core_v2
143
69
 
144
70
  ### 6. Create Branch and Worktree
145
71
 
146
- **Read worktree mode from config (already loaded by read_gitflow_config):**
147
- ```bash
148
- WORKTREE_MODE="$GF_WORKTREE_MODE"
149
- ```
150
-
151
- **Mode: organized (uses absolute paths from config)**
152
- ```bash
153
- case "$branch_type" in
154
- feature) WORKTREE_PATH="$GF_FEATURES_PATH/$BRANCH_NAME" ;;
155
- release) WORKTREE_PATH="$GF_RELEASES_PATH/v$VERSION" ;;
156
- hotfix) WORKTREE_PATH="$GF_HOTFIXES_PATH/$BRANCH_NAME" ;;
157
- esac
158
-
159
- mkdir -p "$(dirname $WORKTREE_PATH)"
160
- git worktree add -b "$FULL_BRANCH" "$WORKTREE_PATH" "origin/$BASE_BRANCH"
161
-
162
- # Fix cross-platform paths in worktree metadata (if created from different platform)
163
- repair_worktree_paths "$(git rev-parse --git-common-dir)"
164
- ```
165
-
166
- **Mode: --no-worktree**
167
- ```bash
168
- git checkout "$BASE_BRANCH" && git pull origin "$BASE_BRANCH"
169
- git checkout -b "$FULL_BRANCH"
170
- ```
72
+ See [references/start-worktree-creation.md](../references/start-worktree-creation.md) for:
73
+ - Worktree path selection (organized mode)
74
+ - Numbering rules (only 01-Main/02-Develop, no numbered feature/release/hotfix)
75
+ - Cross-platform path repair
76
+ - Worktree validation
77
+ - No-worktree mode fallback
171
78
 
172
79
  ### 6b. Push Branch to Remote (AUTOMATIC)
173
80
 
@@ -65,24 +65,7 @@ Sync Status: {CURRENT}
65
65
 
66
66
  ### 4. Push Local Commits
67
67
 
68
- ```bash
69
- [ "$AHEAD" -gt 0 ] && {
70
- echo "Pushing $AHEAD commit(s) to origin/$CURRENT..."
71
- git push origin $CURRENT
72
-
73
- # CRITICAL: Verify push and update tracking refs
74
- git fetch origin $CURRENT:refs/remotes/origin/$CURRENT --force --quiet
75
- LOCAL_SHA=$(git rev-parse HEAD)
76
- REMOTE_SHA=$(git rev-parse origin/$CURRENT)
77
- if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
78
- echo "✅ Push verified - local/remote in sync"
79
- else
80
- echo "⚠️ Push verification FAILED - refs may be stale"
81
- echo " Local: $LOCAL_SHA"
82
- echo " Remote: $REMOTE_SHA"
83
- fi
84
- }
85
- ```
68
+ See [references/sync-push-verify.md](../references/sync-push-verify.md) for push with verification.
86
69
 
87
70
  ### 5. Pull Remote Commits
88
71
 
@@ -126,59 +109,13 @@ Sync Status: {CURRENT}
126
109
  }
127
110
  ```
128
111
 
129
- ### 7. Handle Rebase Conflicts
130
-
131
- ```bash
132
- # If rebase has conflicts
133
- if [ -d ".git/rebase-merge" ] || [ -d ".git/rebase-apply" ]; then
134
- echo "⚠️ REBASE CONFLICT DETECTED"
135
-
136
- CONFLICTS=$(git diff --name-only --diff-filter=U)
137
- echo "Conflicting files:"
138
- echo "$CONFLICTS"
139
-
140
- # Check for migration conflicts
141
- MIGRATION_CONFLICTS=$(echo "$CONFLICTS" | grep "Migrations/")
142
- [ -n "$MIGRATION_CONFLICTS" ] && {
143
- echo "⚠️ Migration conflicts detected!"
144
- echo "Recommend: /efcore:rebase-snapshot"
145
- }
146
-
147
- # Options
148
- AskUserQuestion:
149
- header: "Conflict"
150
- question: "How to handle conflicts?"
151
- options:
152
- - label: "Resolve manually"
153
- description: "I'll fix conflicts and continue"
154
- - label: "Abort rebase"
155
- description: "Cancel and return to previous state"
156
- - label: "Accept theirs (migrations)"
157
- description: "Use base branch migrations, regenerate ours"
158
- fi
159
- ```
112
+ ### 7-8. Handle Rebase Conflicts and Force Push
160
113
 
161
- ### 8. Force Push After Rebase
114
+ See [references/sync-rebase-conflicts.md](../references/sync-rebase-conflicts.md) for:
115
+ - Conflict detection and migration conflict handling
116
+ - User options (resolve, abort, accept theirs)
162
117
 
163
- ```bash
164
- # After successful rebase
165
- if [ "$REBASED" = true ]; then
166
- echo "Rebase complete. Force pushing..."
167
- git push --force-with-lease origin $CURRENT
168
-
169
- # CRITICAL: Verify push and update tracking refs
170
- git fetch origin $CURRENT:refs/remotes/origin/$CURRENT --force --quiet
171
- LOCAL_SHA=$(git rev-parse HEAD)
172
- REMOTE_SHA=$(git rev-parse origin/$CURRENT)
173
- if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
174
- echo "✅ Force push verified - local/remote in sync"
175
- else
176
- echo "⚠️ Force push verification FAILED"
177
- echo " Local: $LOCAL_SHA"
178
- echo " Remote: $REMOTE_SHA"
179
- fi
180
- fi
181
- ```
118
+ See [references/sync-push-verify.md](../references/sync-push-verify.md) for force push with verification.
182
119
 
183
120
  ### 9. Summary
184
121
 
@@ -166,8 +166,14 @@ When the user invokes `/ralph-loop`, they are giving you the instruction to:
166
166
  | File | Loaded when |
167
167
  |------|-------------|
168
168
  | `references/category-rules.md` | Step-01 and compact loop (category ordering and dependency rules) |
169
+ | `references/category-completeness.md` | Step-01 section 4b and step-04 section 1.7 (guardrail injection) |
169
170
  | `references/compact-loop.md` | Step-04 section 5 (module loop with /apex delegation) |
171
+ | `references/init-resume-recovery.md` | Step-00 section 4 (resume mode and auto-recovery) |
172
+ | `references/multi-module-queue.md` | Step-00 and step-01 section 0 (multi-module initialization) |
173
+ | `references/module-transition.md` | Step-04 section 3b (multi-module advancement) |
174
+ | `references/parallel-execution.md` | Step-02 section 3a (Agent Teams for multi-module) |
170
175
  | `references/section-splitting.md` | Step-01 section 4c when module has >4 entities + >1 section |
176
+ | `references/task-transform-legacy.md` | Step-01 (legacy FORMAT A PRD transformation) |
171
177
  | `references/team-orchestration.md` | Step-00 when multi-module detected (2+ PRDs) |
172
178
  </step_files>
173
179
 
@@ -0,0 +1,185 @@
1
+ # Category Completeness Check
2
+
3
+ > **Reference for:** step-01-task.md section 4b and step-04-check.md section 1.7
4
+ > **Purpose:** Ensure PRD contains tasks for ALL required categories before/during execution
5
+ > **Frequency:** On load (step-01) and every iteration (step-04)
6
+
7
+ ---
8
+
9
+ ## The Problem
10
+
11
+ **Test-v4-005 Failure Mode:**
12
+ - PRD generated with only backend categories (domain, infrastructure, application, api, seedData)
13
+ - Frontend and test categories were entirely absent
14
+ - Result: 0 frontend pages, 0 tests generated across 3 modules
15
+ - Root cause: No guardrail detection during load
16
+
17
+ ## The Solution: Required Categories
18
+
19
+ **CRITICAL:** Every PRD MUST have tasks for these categories:
20
+
21
+ ```javascript
22
+ const REQUIRED_CATEGORIES = ['domain', 'infrastructure', 'application', 'api', 'seedData', 'frontend', 'test'];
23
+ ```
24
+
25
+ > **Why seedData is required:**
26
+ > - Without it: Navigation/Permissions are not seeded
27
+ > - Result: Frontend/test tasks execute against empty database
28
+ > - Guardrail must inject NavigationApplicationSeedData, ApplicationRolesSeedData, etc.
29
+
30
+ ---
31
+
32
+ ## Completeness Check Function
33
+
34
+ ```javascript
35
+ function checkCategoryCompleteness(prd) {
36
+ const presentCategories = new Set(prd.tasks.map(t => t.category));
37
+ const REQUIRED_CATEGORIES = ['domain', 'infrastructure', 'application', 'api', 'seedData', 'frontend', 'test'];
38
+ const missingCategories = REQUIRED_CATEGORIES.filter(c => !presentCategories.has(c));
39
+
40
+ if (missingCategories.length === 0) {
41
+ return { missing: [], guardrailsNeeded: [] };
42
+ }
43
+
44
+ console.warn(`⚠ PRD MISSING CATEGORIES: ${missingCategories.join(', ')}`);
45
+
46
+ // Calculate max ID for new guardrails
47
+ let maxIdNum = Math.max(...prd.tasks.map(t => {
48
+ const num = parseInt(t.id.replace(/[^0-9]/g, ''), 10);
49
+ return isNaN(num) ? 0 : num;
50
+ }), 0);
51
+
52
+ const prefix = prd.tasks[0]?.id?.replace(/[0-9]+$/, '') || 'GUARD-';
53
+ const lastApiTask = prd.tasks.filter(t => t.category === 'api').pop()?.id;
54
+ const lastSeedDataTask = prd.tasks.filter(t => t.category === 'seedData').pop()?.id;
55
+
56
+ // Dependency chain: domain → infrastructure → application → api → seedData → frontend → test
57
+ // Frontend MUST depend on seedData (navigation/permissions must be seeded first)
58
+ const frontendDep = lastSeedDataTask || lastApiTask;
59
+
60
+ const guardrailTasks = [];
61
+
62
+ for (const cat of missingCategories) {
63
+ maxIdNum++;
64
+ const taskId = `${prefix}${String(maxIdNum).padStart(3, '0')}`;
65
+
66
+ // Determine dependencies based on category order
67
+ let deps;
68
+ if (cat === 'seedData') {
69
+ deps = [lastApiTask]; // seedData depends on API infrastructure
70
+ } else if (cat === 'frontend') {
71
+ deps = [frontendDep]; // frontend depends on seedData (navigation must be seeded)
72
+ } else if (cat === 'test') {
73
+ deps = [frontendDep]; // test depends on seedData too
74
+ } else {
75
+ deps = [];
76
+ }
77
+
78
+ const guardrailTask = {
79
+ id: taskId,
80
+ description: `[GUARDRAIL] Generate ${cat} layer for ${prd.project?.module || 'module'}`,
81
+ status: 'pending',
82
+ category: cat,
83
+ dependencies: deps,
84
+ acceptance_criteria: determineAcceptanceCriteria(cat),
85
+ started_at: null,
86
+ completed_at: null,
87
+ iteration: null,
88
+ commit_hash: null,
89
+ files_changed: [],
90
+ validation: null,
91
+ error: null
92
+ };
93
+
94
+ guardrailTasks.push(guardrailTask);
95
+ }
96
+
97
+ return { missing: missingCategories, guardrailsNeeded: guardrailTasks };
98
+ }
99
+
100
+ function determineAcceptanceCriteria(category) {
101
+ const criteria = {
102
+ domain: 'Entity classes created with required properties',
103
+ infrastructure: 'EF Core configs, migrations created, dotnet build passes',
104
+ application: 'Service classes implementing business logic',
105
+ api: 'REST controllers with [RequirePermission] attributes',
106
+ seedData: 'NavigationApplicationSeedData + ApplicationRolesSeedData + PermissionsSeedData created, IClientSeedDataProvider wired, startup test passes',
107
+ frontend: 'React pages created via MCP scaffold_api_client + scaffold_routes, wired to App.tsx, navigation seed data verified in DB',
108
+ test: 'Unit + Integration test projects created, scaffold_tests MCP called, dotnet test passes'
109
+ };
110
+ return criteria[category] || `${category} layer fully implemented per category-rules.md`;
111
+ }
112
+ ```
113
+
114
+ ## Application in step-01
115
+
116
+ ```javascript
117
+ // After loading prd.json or generating tasks
118
+ const { missing, guardrailsNeeded } = checkCategoryCompleteness(prd);
119
+
120
+ if (guardrailsNeeded.length > 0) {
121
+ console.log(`PRD updated: ${prd.tasks.length} → ${prd.tasks.length + guardrailsNeeded.length} tasks (${guardrailsNeeded.length} guardrails added)`);
122
+ prd.tasks.push(...guardrailsNeeded);
123
+
124
+ // Update frontendDep for any frontend guardrail if seedData was just injected
125
+ if (missing.includes('seedData')) {
126
+ const seedDataGuard = guardrailsNeeded.find(t => t.category === 'seedData');
127
+ const frontendGuard = prd.tasks.find(t => t.category === 'frontend' && t.description.includes('[GUARDRAIL]'));
128
+ if (frontendGuard && seedDataGuard) {
129
+ frontendGuard.dependencies = [seedDataGuard.id];
130
+ }
131
+ }
132
+
133
+ writeJSON('.ralph/prd.json', prd);
134
+ }
135
+ ```
136
+
137
+ ## Application in step-04 (every iteration)
138
+
139
+ ```javascript
140
+ // RUNS EVERY ITERATION — not just once
141
+ const { missing, guardrailsNeeded } = checkCategoryCompleteness(prd);
142
+
143
+ if (guardrailsNeeded.length > 0) {
144
+ prd.tasks.push(...guardrailsNeeded);
145
+ writeJSON('.ralph/prd.json', prd);
146
+
147
+ const newPending = prd.tasks.filter(t => t.status === 'pending').length;
148
+ console.log(`PRD updated: +${guardrailsNeeded.length} guardrails, ${newPending} pending tasks`);
149
+ }
150
+ ```
151
+
152
+ ## Artifact Verification
153
+
154
+ After category check, verify artifacts actually exist for completed tasks:
155
+
156
+ ```javascript
157
+ const completedCats = new Set(prd.tasks.filter(t => t.status === 'completed').map(t => t.category));
158
+ const artifactChecks = {
159
+ 'frontend': () => glob.sync('**/src/pages/**/*.tsx').length > 0,
160
+ 'test': () => glob.sync('tests/**/*Tests.cs').length > 0,
161
+ 'api': () => glob.sync('src/*/Controllers/**/*Controller.cs').length > 0
162
+ };
163
+
164
+ for (const [cat, check] of Object.entries(artifactChecks)) {
165
+ if (completedCats.has(cat) && !check()) {
166
+ console.warn(`ARTIFACT MISSING: ${cat} tasks marked completed but no files found — resetting to pending`);
167
+ prd.tasks.filter(t => t.category === cat && t.status === 'completed')
168
+ .forEach(t => {
169
+ t.status = 'pending';
170
+ t.error = 'Artifacts missing — re-execute';
171
+ t.completed_at = null;
172
+ });
173
+ writeJSON('.ralph/prd.json', prd);
174
+ }
175
+ }
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Key Rules
181
+
182
+ - **Inject EVERY iteration:** Not just once during load
183
+ - **Frontend depends on seedData:** Not just API
184
+ - **Check artifacts:** Mark tasks pending if files don't exist
185
+ - **Never skip:** This is the blocker for "missing frontend/test" failures
@@ -196,7 +196,7 @@ writeJSON('.ralph/prd.json', prd);
196
196
  **INVOKE `/apex -d .ralph/prd.json`**
197
197
 
198
198
  Apex handles everything for the current module:
199
- - Reads PRD, extracts context (context_code, app_name, module_code, entities, sections)
199
+ - Reads PRD, extracts context (app_name, module_code, entities, sections)
200
200
  - Executes ALL layers: domain → infrastructure → migration → application → api → seed data → frontend → tests
201
201
  - Runs full POST-CHECKs (50 checks from `references/post-checks.md`)
202
202
  - Commits per layer (atomic commits)