@atlashub/smartstack-cli 3.37.0 → 3.39.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 (228) hide show
  1. package/dist/index.js +16 -24
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +235 -265
  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/efcore/scan.md +3 -1
  13. package/templates/agents/gitflow/commit.md +74 -0
  14. package/templates/agents/gitflow/finish.md +5 -2
  15. package/templates/agents/gitflow/init-clone.md +3 -3
  16. package/templates/agents/gitflow/init-validate.md +3 -2
  17. package/templates/agents/gitflow/merge.md +5 -4
  18. package/templates/agents/gitflow/pr.md +5 -4
  19. package/templates/agents/gitflow/start.md +37 -5
  20. package/templates/hooks/hooks.json +11 -0
  21. package/templates/hooks/wsl-dotnet-cleanup.sh +24 -0
  22. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
  23. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
  24. package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
  25. package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
  26. package/templates/skills/_shared.md +15 -17
  27. package/templates/skills/ai-prompt/SKILL.md +1 -1
  28. package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
  29. package/templates/skills/apex/SKILL.md +3 -4
  30. package/templates/skills/apex/_shared.md +10 -20
  31. package/templates/skills/apex/references/analysis-methods.md +141 -0
  32. package/templates/skills/apex/references/challenge-questions.md +1 -21
  33. package/templates/skills/apex/references/core-seed-data.md +35 -58
  34. package/templates/skills/apex/references/examine-build-validation.md +82 -0
  35. package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
  36. package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
  37. package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
  38. package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
  39. package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
  40. package/templates/skills/apex/references/post-checks.md +145 -40
  41. package/templates/skills/apex/references/smartstack-api.md +35 -51
  42. package/templates/skills/apex/references/smartstack-frontend.md +18 -18
  43. package/templates/skills/apex/references/smartstack-layers.md +38 -62
  44. package/templates/skills/apex/steps/step-00-init.md +14 -26
  45. package/templates/skills/apex/steps/step-01-analyze.md +10 -143
  46. package/templates/skills/apex/steps/step-02-plan.md +10 -92
  47. package/templates/skills/apex/steps/step-03-execute.md +45 -252
  48. package/templates/skills/apex/steps/step-04-examine.md +14 -78
  49. package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
  50. package/templates/skills/apex/steps/step-08-run-tests.md +1 -0
  51. package/templates/skills/application/SKILL.md +241 -242
  52. package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
  53. package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
  54. package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
  55. package/templates/skills/application/references/backend-verification.md +1 -1
  56. package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
  57. package/templates/skills/application/references/frontend-route-naming.md +117 -0
  58. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
  59. package/templates/skills/application/references/frontend-verification.md +12 -12
  60. package/templates/skills/application/references/init-parameter-detection.md +121 -0
  61. package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
  62. package/templates/skills/application/references/nav-fallback-procedure.md +199 -200
  63. package/templates/skills/application/references/provider-template.md +2 -6
  64. package/templates/skills/application/references/roles-client-project-handling.md +55 -0
  65. package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
  66. package/templates/skills/application/references/test-coverage-requirements.md +213 -0
  67. package/templates/skills/application/references/test-frontend.md +3 -3
  68. package/templates/skills/application/steps/step-00-init.md +130 -260
  69. package/templates/skills/application/steps/step-01-navigation.md +170 -170
  70. package/templates/skills/application/steps/step-02-permissions.md +196 -196
  71. package/templates/skills/application/steps/step-03-roles.md +182 -339
  72. package/templates/skills/application/steps/step-03b-provider.md +133 -134
  73. package/templates/skills/application/steps/step-04-backend.md +174 -265
  74. package/templates/skills/application/steps/step-05-frontend.md +18 -144
  75. package/templates/skills/application/steps/step-06-migration.md +12 -60
  76. package/templates/skills/application/steps/step-07-tests.md +9 -76
  77. package/templates/skills/application/templates-backend.md +29 -27
  78. package/templates/skills/application/templates-frontend.md +49 -49
  79. package/templates/skills/application/templates-seed.md +57 -131
  80. package/templates/skills/business-analyse/SKILL.md +27 -30
  81. package/templates/skills/business-analyse/_architecture.md +6 -6
  82. package/templates/skills/business-analyse/_shared.md +60 -88
  83. package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
  84. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  85. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
  86. package/templates/skills/business-analyse/react/application-viewer.md +12 -12
  87. package/templates/skills/business-analyse/react/components.md +8 -12
  88. package/templates/skills/business-analyse/react/schema.md +836 -836
  89. package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
  90. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
  91. package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
  92. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
  93. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
  94. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
  95. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
  96. package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
  97. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
  98. package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
  99. package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
  100. package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
  101. package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
  102. package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
  103. package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
  104. package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
  105. package/templates/skills/business-analyse/references/prd-generation.md +2 -2
  106. package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
  107. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  108. package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
  109. package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
  110. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  111. package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
  112. package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
  113. package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
  114. package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
  115. package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
  116. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
  117. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
  118. package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
  119. package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
  120. package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
  121. package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
  122. package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
  123. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
  124. package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
  125. package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
  126. package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
  127. package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
  128. package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
  129. package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
  130. package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
  131. package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
  132. package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
  133. package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
  134. package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
  135. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  136. package/templates/skills/business-analyse/templates-frd.md +25 -25
  137. package/templates/skills/business-analyse/templates-react.md +15 -21
  138. package/templates/skills/controller/SKILL.md +1 -1
  139. package/templates/skills/controller/postman-templates.md +1 -1
  140. package/templates/skills/controller/references/controller-code-templates.md +2 -2
  141. package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
  142. package/templates/skills/controller/references/permission-sync-templates.md +13 -16
  143. package/templates/skills/controller/steps/step-00-init.md +11 -11
  144. package/templates/skills/controller/steps/step-03-generate.md +64 -103
  145. package/templates/skills/controller/templates.md +67 -71
  146. package/templates/skills/debug/SKILL.md +13 -218
  147. package/templates/skills/debug/steps/step-00-init.md +57 -0
  148. package/templates/skills/debug/steps/step-01-analyze.md +219 -0
  149. package/templates/skills/debug/steps/step-02-resolve.md +85 -0
  150. package/templates/skills/documentation/SKILL.md +49 -345
  151. package/templates/skills/documentation/data-schema.md +11 -8
  152. package/templates/skills/documentation/steps/step-00-init.md +70 -0
  153. package/templates/skills/documentation/steps/step-01-scan.md +113 -0
  154. package/templates/skills/documentation/steps/step-02-generate.md +231 -0
  155. package/templates/skills/documentation/steps/step-03-validate.md +238 -0
  156. package/templates/skills/documentation/templates.md +480 -322
  157. package/templates/skills/efcore/SKILL.md +1 -1
  158. package/templates/skills/efcore/references/both-contexts.md +32 -0
  159. package/templates/skills/efcore/references/database-operations.md +67 -0
  160. package/templates/skills/efcore/references/destructive-operations.md +38 -0
  161. package/templates/skills/efcore/references/reset-operations.md +81 -0
  162. package/templates/skills/efcore/references/seed-methods.md +86 -0
  163. package/templates/skills/efcore/references/shared-init-functions.md +250 -0
  164. package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
  165. package/templates/skills/efcore/references/troubleshooting.md +81 -0
  166. package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
  167. package/templates/skills/efcore/steps/db/step-reset.md +7 -103
  168. package/templates/skills/efcore/steps/db/step-seed.md +10 -132
  169. package/templates/skills/efcore/steps/db/step-status.md +5 -44
  170. package/templates/skills/efcore/steps/migration/step-02-create.md +1 -14
  171. package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
  172. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
  173. package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
  174. package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
  175. package/templates/skills/feature-full/SKILL.md +1 -1
  176. package/templates/skills/feature-full/steps/step-00-init.md +57 -0
  177. package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
  178. package/templates/skills/gitflow/SKILL.md +28 -5
  179. package/templates/skills/gitflow/_shared.md +109 -12
  180. package/templates/skills/gitflow/phases/abort.md +4 -0
  181. package/templates/skills/gitflow/phases/cleanup.md +4 -0
  182. package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
  183. package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
  184. package/templates/skills/gitflow/references/finish-cleanup.md +55 -0
  185. package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
  186. package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
  187. package/templates/skills/gitflow/references/init-questions.md +185 -0
  188. package/templates/skills/gitflow/references/init-structure-creation.md +75 -0
  189. package/templates/skills/gitflow/references/init-version-detection.md +21 -0
  190. package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
  191. package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
  192. package/templates/skills/gitflow/references/merge-execution.md +62 -0
  193. package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
  194. package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
  195. package/templates/skills/gitflow/references/pr-generation.md +58 -0
  196. package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
  197. package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
  198. package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
  199. package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
  200. package/templates/skills/gitflow/steps/step-commit.md +12 -91
  201. package/templates/skills/gitflow/steps/step-finish.md +15 -159
  202. package/templates/skills/gitflow/steps/step-init.md +24 -326
  203. package/templates/skills/gitflow/steps/step-merge.md +17 -176
  204. package/templates/skills/gitflow/steps/step-pr.md +10 -116
  205. package/templates/skills/gitflow/steps/step-start.md +16 -109
  206. package/templates/skills/gitflow/steps/step-sync.md +6 -69
  207. package/templates/skills/ralph-loop/SKILL.md +6 -0
  208. package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
  209. package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
  210. package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
  211. package/templates/skills/ralph-loop/references/module-transition.md +151 -0
  212. package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
  213. package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
  214. package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
  215. package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
  216. package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
  217. package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
  218. package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
  219. package/templates/skills/ralph-loop/steps/step-04-check.md +20 -73
  220. package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
  221. package/templates/skills/review-code/references/smartstack-conventions.md +568 -568
  222. package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
  223. package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
  224. package/templates/skills/validate-feature/steps/step-01-compile.md +1 -3
  225. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
  226. package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
  227. package/templates/skills/workflow/SKILL.md +1 -1
  228. package/templates/skills/workflow/steps/step-00-init.md +57 -0
@@ -0,0 +1,76 @@
1
+ # Load PR Context and Load Review Checklist
2
+
3
+ ## Load Config and PR Context
4
+
5
+ ```bash
6
+ # Load GitFlow config (sets GF_* variables)
7
+ read_gitflow_config || { echo "❌ Run /gitflow init first."; exit 1; }
8
+
9
+ CURRENT=$(git rev-parse --abbrev-ref HEAD)
10
+ GIT_PROVIDER="$GF_PROVIDER"
11
+
12
+ # Try loading persisted PR state first
13
+ CONFIG_DIR=$(dirname "$GF_CONFIG_FILE")
14
+ PR_STATE_FILE="$CONFIG_DIR/cache/pr-state.json"
15
+ if [ -f "$PR_STATE_FILE" ]; then
16
+ PR_NUMBER=$(grep -oP '"pr_number":\s*"\K[^"]+' "$PR_STATE_FILE" | head -1)
17
+ TARGET_BRANCH=$(grep -oP '"target_branch":\s*"\K[^"]+' "$PR_STATE_FILE" | head -1)
18
+ echo "✓ Loaded PR state from cache: PR #$PR_NUMBER → $TARGET_BRANCH"
19
+ fi
20
+
21
+ # Fallback: query provider if no cached state
22
+ if [ -z "$PR_NUMBER" ]; then
23
+ if [ "$GIT_PROVIDER" = "github" ]; then
24
+ PR_NUMBER=$(gh pr list --head "$CURRENT" --json number --jq '.[0].number')
25
+ PR_STATUS=$(gh pr view $PR_NUMBER --json state,mergeable,reviews --jq '.')
26
+ elif [ "$GIT_PROVIDER" = "azuredevops" ]; then
27
+ PR_NUMBER=$(az repos pr list --source-branch "$CURRENT" --query "[0].pullRequestId" -o tsv)
28
+ PR_STATUS=$(az repos pr show --id $PR_NUMBER --query "{status:status,mergeStatus:mergeStatus}")
29
+ fi
30
+ fi
31
+
32
+ [ -z "$PR_NUMBER" ] && {
33
+ echo "❌ No PR found for branch $CURRENT"
34
+ echo "→ Run /gitflow pr first"
35
+ STOP
36
+ }
37
+ ```
38
+
39
+ ## Display Review Checklist
40
+
41
+ ```
42
+ ╔══════════════════════════════════════════════════════════════════╗
43
+ ║ PR REVIEW CHECKLIST ║
44
+ ╠══════════════════════════════════════════════════════════════════╣
45
+ ║ PR #${PR_NUMBER}: ${PR_TITLE} ║
46
+ ╠══════════════════════════════════════════════════════════════════╣
47
+
48
+ ## Code Quality
49
+ - [ ] Code follows project conventions
50
+ - [ ] No unnecessary complexity
51
+ - [ ] No code duplication
52
+ - [ ] Variable/function names are clear
53
+
54
+ ## Security
55
+ - [ ] No hardcoded secrets
56
+ - [ ] Input validation present
57
+ - [ ] Authentication/authorization correct
58
+ - [ ] No SQL injection risks
59
+
60
+ ## Testing
61
+ - [ ] Unit tests added/updated
62
+ - [ ] Integration tests pass
63
+ - [ ] Manual testing completed
64
+
65
+ ## EF Core (if applicable)
66
+ - [ ] Migration files complete (3 files)
67
+ - [ ] No destructive operations (or confirmed)
68
+ - [ ] Snapshot synced with base
69
+
70
+ ## Documentation
71
+ - [ ] Code comments where needed
72
+ - [ ] API docs updated (if applicable)
73
+ - [ ] README updated (if applicable)
74
+
75
+ ╚══════════════════════════════════════════════════════════════════╝
76
+ ```
@@ -0,0 +1,60 @@
1
+ # Pre-PR Build Checks
2
+
3
+ ## Multi-Runtime Detection
4
+
5
+ ```bash
6
+ # Build check (multi-runtime detection)
7
+ echo "Running build check..."
8
+ if [ -f "*.sln" ] || ls *.csproj 2>/dev/null | head -1 > /dev/null; then
9
+ dotnet build --no-restore 2>&1 || {
10
+ echo "❌ .NET build failed. Fix before creating PR."
11
+ STOP
12
+ }
13
+ # Migration check
14
+ echo "Checking migrations..."
15
+ dotnet ef migrations list 2>&1 || echo "No migrations or EF Core not configured"
16
+ elif [ -f "package.json" ]; then
17
+ npm run build 2>&1 || {
18
+ echo "❌ npm build failed. Fix before creating PR."
19
+ STOP
20
+ }
21
+ elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
22
+ echo "Python project detected — skipping build check"
23
+ else
24
+ echo "⚠️ No known build system detected — skipping build check"
25
+ fi
26
+ ```
27
+
28
+ ## Enforce Migration Squash (Feature Branches)
29
+
30
+ **BLOCKING**: Feature branches must have at most 1 migration before creating a PR.
31
+
32
+ ```bash
33
+ if [ "$BRANCH_TYPE" = "feature" ]; then
34
+ MIGRATION_DIR=$(find . -path "*/Persistence/Migrations" -type d 2>/dev/null | head -1)
35
+ if [ -n "$MIGRATION_DIR" ]; then
36
+ # Count migration .cs files added by this feature (not in target branch)
37
+ NEW_MIGRATIONS=$(git diff --name-only "origin/$TARGET_BRANCH...HEAD" -- "$MIGRATION_DIR" \
38
+ | grep -E '\.cs$' \
39
+ | grep -v 'Designer\|ModelSnapshot' \
40
+ | wc -l)
41
+
42
+ if [ "$NEW_MIGRATIONS" -gt 1 ]; then
43
+ echo ""
44
+ echo "❌ MULTIPLE MIGRATIONS DETECTED ($NEW_MIGRATIONS migrations)"
45
+ echo "→ Feature branches must have exactly 1 migration (squashed) before PR"
46
+ echo "→ Run: /efcore squash"
47
+ echo ""
48
+ echo "Migrations found:"
49
+ git diff --name-only "origin/$TARGET_BRANCH...HEAD" -- "$MIGRATION_DIR" \
50
+ | grep -E '\.cs$' \
51
+ | grep -v 'Designer\|ModelSnapshot'
52
+ STOP
53
+ elif [ "$NEW_MIGRATIONS" -eq 1 ]; then
54
+ echo "✓ Single migration detected (squashed)"
55
+ else
56
+ echo "✓ No migrations in this feature"
57
+ fi
58
+ fi
59
+ fi
60
+ ```
@@ -0,0 +1,58 @@
1
+ # Pull Request Content Generation
2
+
3
+ ## Generate PR Title
4
+
5
+ ```bash
6
+ BRANCH_NAME=$(echo $CURRENT | sed 's/.*\///')
7
+ BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
8
+
9
+ case "$BRANCH_TYPE" in
10
+ feature) TITLE="feat: $BRANCH_NAME" ;;
11
+ hotfix) TITLE="fix: $BRANCH_NAME" ;;
12
+ release) TITLE="release: v$GF_VERSION" ;;
13
+ esac
14
+ ```
15
+
16
+ ## Generate PR Body
17
+
18
+ ```markdown
19
+ ## Summary
20
+
21
+ {Auto-generated from commit messages}
22
+
23
+ ## Changes
24
+
25
+ {List of files changed with categories}
26
+
27
+ ## Testing
28
+
29
+ - [ ] Build passes
30
+ - [ ] Unit tests pass
31
+ - [ ] Manual testing completed
32
+
33
+ ## EF Core Migrations
34
+
35
+ {Migration status: None | Added | Modified}
36
+
37
+ ---
38
+
39
+ 🤖 Generated with [Claude Code](https://claude.ai/code)
40
+ ```
41
+
42
+ ## Persist PR Info for Merge Step
43
+
44
+ ```bash
45
+ # Persist PR info for merge step (uses config path for portability)
46
+ CONFIG_DIR=$(dirname "$GF_CONFIG_FILE")
47
+ cat > "$CONFIG_DIR/cache/pr-state.json" << EOF
48
+ {
49
+ "pr_number": "$PR_NUMBER",
50
+ "pr_url": "$PR_URL",
51
+ "source_branch": "$CURRENT",
52
+ "target_branch": "$TARGET_BRANCH",
53
+ "git_provider": "$GIT_PROVIDER",
54
+ "created_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
55
+ }
56
+ EOF
57
+ echo "✓ PR state saved to $CONFIG_DIR/cache/pr-state.json"
58
+ ```
@@ -0,0 +1,28 @@
1
+ # Branch Name Normalization and Validation
2
+
3
+ ## Normalize Branch Name
4
+
5
+ ```bash
6
+ normalize_branch_name() {
7
+ echo "$1" | tr '[:upper:]' '[:lower:]' | \
8
+ sed 'y/àâäéèêëïîôùûüçœæ/aaaeeeeiioouucoa/' | \
9
+ sed "s/[ _']/-/g" | sed 's/[^a-z0-9-]//g' | \
10
+ sed 's/--*/-/g' | sed 's/^-//;s/-$//' | cut -c1-50
11
+ }
12
+
13
+ BRANCH_NAME=$(normalize_branch_name "$branch_name")
14
+ FULL_BRANCH="${branch_type}/${BRANCH_NAME}"
15
+ ```
16
+
17
+ ## Check if Branch Already Exists
18
+
19
+ ```bash
20
+ # Check if exists
21
+ LOCAL_EXISTS=$(git branch --list "$FULL_BRANCH")
22
+ REMOTE_EXISTS=$(git branch -r --list "origin/$FULL_BRANCH")
23
+
24
+ [ -n "$LOCAL_EXISTS" ] || [ -n "$REMOTE_EXISTS" ] && {
25
+ echo "ERROR: Branch '$FULL_BRANCH' already exists"
26
+ # Options: Different name | Checkout existing | Delete and recreate
27
+ }
28
+ ```
@@ -0,0 +1,50 @@
1
+ # Worktree Creation and Validation
2
+
3
+ ## Determine Worktree Path
4
+
5
+ **Read worktree mode from config (already loaded by read_gitflow_config):**
6
+ ```bash
7
+ WORKTREE_MODE="$GF_WORKTREE_MODE"
8
+ ```
9
+
10
+ ## Worktree Path Selection (Organized Mode)
11
+
12
+ > **FORBIDDEN — Numbered directories:**
13
+ > NEVER create directories like `03-Release`, `04-Feature`, `05-Hotfix`.
14
+ > Only `01-Main` and `02-Develop` use numbers (they are permanent, created at init).
15
+ > All other worktrees MUST use the paths from `config.json → worktrees.structure`:
16
+ > - `$GF_FEATURES_PATH/{name}` (e.g., `features/my-feature`, NOT `04-Feature`)
17
+ > - `$GF_RELEASES_PATH/v{version}` (e.g., `releases/v2.15.0`, NOT `03-Release`)
18
+ > - `$GF_HOTFIXES_PATH/{name}` (e.g., `hotfixes/fix-bug`, NOT `05-Hotfix`)
19
+
20
+ ```bash
21
+ case "$branch_type" in
22
+ feature) WORKTREE_PATH="$GF_FEATURES_PATH/$BRANCH_NAME" ;;
23
+ release) WORKTREE_PATH="$GF_RELEASES_PATH/v$VERSION" ;;
24
+ hotfix) WORKTREE_PATH="$GF_HOTFIXES_PATH/$BRANCH_NAME" ;;
25
+ esac
26
+
27
+ mkdir -p "$(dirname "$WORKTREE_PATH")"
28
+ git worktree add -b "$FULL_BRANCH" "$WORKTREE_PATH" "origin/$BASE_BRANCH"
29
+
30
+ # Convert worktree paths to relative format (cross-platform: Windows + WSL)
31
+ repair_worktree_paths "$(git rev-parse --git-common-dir)"
32
+
33
+ # POST-CREATION VALIDATION (BLOCKING)
34
+ # Detect if worktree was accidentally created with a numbered prefix
35
+ CREATED_PATH=$(git worktree list | grep "$FULL_BRANCH" | awk '{print $1}')
36
+ validate_worktree_path "$CREATED_PATH" || {
37
+ echo "BLOCKING: Recreating worktree at correct path..."
38
+ git worktree remove "$CREATED_PATH" --force
39
+ git branch -D "$FULL_BRANCH" 2>/dev/null
40
+ git worktree add -b "$FULL_BRANCH" "$WORKTREE_PATH" "origin/$BASE_BRANCH"
41
+ repair_worktree_paths "$(git rev-parse --git-common-dir)"
42
+ }
43
+ ```
44
+
45
+ ## No-Worktree Mode
46
+
47
+ ```bash
48
+ git checkout "$BASE_BRANCH" && git pull origin "$BASE_BRANCH"
49
+ git checkout -b "$FULL_BRANCH"
50
+ ```
@@ -0,0 +1,44 @@
1
+ # Push and Force Push with Verification
2
+
3
+ ## Push Local Commits
4
+
5
+ ```bash
6
+ [ "$AHEAD" -gt 0 ] && {
7
+ echo "Pushing $AHEAD commit(s) to origin/$CURRENT..."
8
+ git push origin $CURRENT
9
+
10
+ # CRITICAL: Verify push and update tracking refs
11
+ git fetch origin $CURRENT:refs/remotes/origin/$CURRENT --force --quiet
12
+ LOCAL_SHA=$(git rev-parse HEAD)
13
+ REMOTE_SHA=$(git rev-parse origin/$CURRENT)
14
+ if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
15
+ echo "✅ Push verified - local/remote in sync"
16
+ else
17
+ echo "⚠️ Push verification FAILED - refs may be stale"
18
+ echo " Local: $LOCAL_SHA"
19
+ echo " Remote: $REMOTE_SHA"
20
+ fi
21
+ }
22
+ ```
23
+
24
+ ## Force Push After Rebase
25
+
26
+ ```bash
27
+ # After successful rebase
28
+ if [ "$REBASED" = true ]; then
29
+ echo "Rebase complete. Force pushing..."
30
+ git push --force-with-lease origin $CURRENT
31
+
32
+ # CRITICAL: Verify push and update tracking refs
33
+ git fetch origin $CURRENT:refs/remotes/origin/$CURRENT --force --quiet
34
+ LOCAL_SHA=$(git rev-parse HEAD)
35
+ REMOTE_SHA=$(git rev-parse origin/$CURRENT)
36
+ if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
37
+ echo "✅ Force push verified - local/remote in sync"
38
+ else
39
+ echo "⚠️ Force push verification FAILED"
40
+ echo " Local: $LOCAL_SHA"
41
+ echo " Remote: $REMOTE_SHA"
42
+ fi
43
+ fi
44
+ ```
@@ -0,0 +1,38 @@
1
+ # Rebase Conflict Handling
2
+
3
+ ## Handle Rebase Conflicts
4
+
5
+ ```bash
6
+ # If rebase has conflicts
7
+ if [ -d ".git/rebase-merge" ] || [ -d ".git/rebase-apply" ]; then
8
+ echo "⚠️ REBASE CONFLICT DETECTED"
9
+
10
+ CONFLICTS=$(git diff --name-only --diff-filter=U)
11
+ echo "Conflicting files:"
12
+ echo "$CONFLICTS"
13
+
14
+ # Check for migration conflicts
15
+ MIGRATION_CONFLICTS=$(echo "$CONFLICTS" | grep "Migrations/")
16
+ [ -n "$MIGRATION_CONFLICTS" ] && {
17
+ echo "⚠️ Migration conflicts detected!"
18
+ echo "Recommend: /efcore:rebase-snapshot"
19
+ }
20
+
21
+ # Options
22
+ AskUserQuestion:
23
+ header: "Conflict"
24
+ question: "How to handle conflicts?"
25
+ options:
26
+ - label: "Resolve manually"
27
+ description: "I'll fix conflicts and continue"
28
+ - label: "Abort rebase"
29
+ description: "Cancel and return to previous state"
30
+ - label: "Accept theirs (migrations)"
31
+ description: "Use base branch migrations, regenerate ours"
32
+ fi
33
+ ```
34
+
35
+ **User actions:**
36
+ - **Resolve manually**: Fix conflicts in editor, then `git rebase --continue`
37
+ - **Abort rebase**: `git rebase --abort`
38
+ - **Accept theirs**: `git checkout --theirs -- {files}`, then `git rebase --continue`
@@ -88,53 +88,13 @@ UNTRACKED=$(git ls-files --others --exclude-standard)
88
88
  }
89
89
  ```
90
90
 
91
- ### 2. Detect EF Core Migrations
91
+ ### 2. Detect and Validate EF Core Migrations
92
92
 
93
- ```bash
94
- # Find migration files in changes
95
- MIGRATIONS=$(echo "$STAGED $MODIFIED $UNTRACKED" | tr ' ' '\n' | grep -E "Migrations/.*\.cs$")
96
- HAS_MIGRATIONS=$([ -n "$MIGRATIONS" ] && echo "true" || echo "false")
97
-
98
- if [ "$HAS_MIGRATIONS" = "true" ]; then
99
- # Check for the 3 required files
100
- MIGRATION_NAME=$(echo "$MIGRATIONS" | grep -v "Designer\|Snapshot" | head -1 | sed 's/.*\///' | sed 's/\.cs$//')
101
-
102
- HAS_MAIN=$(echo "$MIGRATIONS" | grep -c "${MIGRATION_NAME}.cs")
103
- HAS_DESIGNER=$(echo "$MIGRATIONS" | grep -c "${MIGRATION_NAME}.Designer.cs")
104
- HAS_SNAPSHOT=$(echo "$MIGRATIONS" | grep -c "ModelSnapshot.cs")
105
-
106
- [ "$HAS_MAIN" -eq 0 ] || [ "$HAS_DESIGNER" -eq 0 ] || [ "$HAS_SNAPSHOT" -eq 0 ] && {
107
- echo "❌ INCOMPLETE MIGRATION"
108
- echo "Required: Migration.cs + Designer.cs + ModelSnapshot.cs"
109
- echo "Found: Main=$HAS_MAIN, Designer=$HAS_DESIGNER, Snapshot=$HAS_SNAPSHOT"
110
- STOP
111
- }
112
- fi
113
- ```
114
-
115
- ### 3. Check Destructive Operations (BLOCKING)
116
-
117
- ```bash
118
- if [ "$HAS_MIGRATIONS" = "true" ]; then
119
- DESTRUCTIVE=$(grep -l "DropTable\|DropColumn\|DeleteData" $MIGRATIONS 2>/dev/null)
120
-
121
- [ -n "$DESTRUCTIVE" ] && {
122
- echo "⚠️ DESTRUCTIVE OPERATIONS DETECTED"
123
- grep -n "DropTable\|DropColumn\|DeleteData" $DESTRUCTIVE
124
-
125
- # Require explicit confirmation
126
- AskUserQuestion:
127
- header: "Confirm"
128
- question: "Destructive migration detected. Continue?"
129
- options:
130
- - label: "Yes, I understand the risks"
131
- - label: "No, let me review"
132
-
133
- # Log to audit trail
134
- echo "$(date) - DESTRUCTIVE: $DESTRUCTIVE - User: $USER" >> .claude/gitflow/logs/audit.log
135
- }
136
- fi
137
- ```
93
+ See [references/commit-migration-validation.md](../references/commit-migration-validation.md) for:
94
+ - Migration file detection (3-file requirement)
95
+ - Destructive operation detection (DropTable, DropColumn, DeleteData)
96
+ - User confirmation for destructive changes
97
+ - Audit trail logging
138
98
 
139
99
  ### 4. Stage All Changes
140
100
 
@@ -147,52 +107,13 @@ echo "Files to commit:"
147
107
  git diff --cached --stat
148
108
  ```
149
109
 
150
- ### 5. Generate Commit Message
151
-
152
- **If no message provided:**
110
+ ### 5-6. Generate and Create Commit
153
111
 
154
- ```bash
155
- # Determine commit type from branch
156
- BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
157
- case "$BRANCH_TYPE" in
158
- feature) PREFIX="feat" ;;
159
- hotfix) PREFIX="fix" ;;
160
- release) PREFIX="chore" ;;
161
- *) PREFIX="chore" ;;
162
- esac
163
-
164
- # Determine scope from branch name
165
- SCOPE=$(echo $CURRENT | cut -d'/' -f2 | cut -d'-' -f1)
166
-
167
- # If migrations present
168
- [ "$HAS_MIGRATIONS" = "true" ] && PREFIX="db(migrations)"
169
-
170
- # Generate message from diff analysis
171
- SUMMARY=$(git diff --cached --stat | tail -1 | sed 's/^ *//')
172
- ```
173
-
174
- **Message format:**
175
- ```
176
- {type}({scope}): {summary - 50 chars max}
177
-
178
- **CHANGE**
179
- PROBLEM: {what was wrong}
180
- SOLUTION: {what was done}
181
- IMPACT: {benefit}
182
-
183
- Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
184
- ```
185
-
186
- ### 6. Create Commit
187
-
188
- ```bash
189
- git commit -m "$(cat <<'EOF'
190
- {generated_message}
191
- EOF
192
- )"
193
-
194
- COMMIT_HASH=$(git rev-parse --short HEAD)
195
- ```
112
+ See [references/commit-message-generation.md](../references/commit-message-generation.md) for:
113
+ - Commit type determination (feat/fix/chore/db)
114
+ - Scope extraction from branch name
115
+ - Message format with CHANGE block
116
+ - Stage all and commit
196
117
 
197
118
  ### 7. Push to Remote (ALWAYS ASK USER)
198
119
 
@@ -73,171 +73,27 @@ esac
73
73
  }
74
74
  ```
75
75
 
76
- ### 3. Create Tag (Release/Hotfix only)
76
+ ### 3-4. Create Tag and Merge Back to Develop
77
77
 
78
- ```bash
79
- if [ "$BRANCH_TYPE" = "release" ] || [ "$BRANCH_TYPE" = "hotfix" ]; then
80
- # Get version from config (already loaded)
81
- VERSION="$GF_VERSION"
82
-
83
- # For hotfix, increment patch
84
- if [ "$BRANCH_TYPE" = "hotfix" ]; then
85
- MAJOR=$(echo $VERSION | cut -d'.' -f1)
86
- MINOR=$(echo $VERSION | cut -d'.' -f2)
87
- PATCH=$(echo $VERSION | cut -d'.' -f3)
88
- VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
89
- fi
90
-
91
- TAG_NAME="v$VERSION"
92
-
93
- # Check if tag exists
94
- TAG_EXISTS=$(git tag -l "$TAG_NAME")
95
- [ -n "$TAG_EXISTS" ] && {
96
- echo "⚠️ Tag $TAG_NAME already exists"
97
- # Options: overwrite, different version, skip
98
- }
99
-
100
- # Create tag on main
101
- git checkout $GF_MAIN_BRANCH
102
- git pull origin $GF_MAIN_BRANCH
103
- git tag -a "$TAG_NAME" -m "$BRANCH_TYPE: $BRANCH_NAME"
104
- git push origin "$TAG_NAME"
105
-
106
- echo "✅ Created tag: $TAG_NAME"
107
- fi
108
- ```
109
-
110
- ### 4. Merge Back to Develop (Release/Hotfix only)
111
-
112
- ```bash
113
- if [ "$BRANCH_TYPE" = "release" ] || [ "$BRANCH_TYPE" = "hotfix" ]; then
114
- echo "Merging $TAG_NAME back to $GF_DEVELOP_BRANCH..."
115
-
116
- git checkout $GF_DEVELOP_BRANCH
117
- git pull origin $GF_DEVELOP_BRANCH
118
-
119
- # Merge with merge commit (preserve history)
120
- git merge $GF_MAIN_BRANCH -m "Merge $TAG_NAME back to $GF_DEVELOP_BRANCH"
121
-
122
- # Handle conflicts
123
- CONFLICTS=$(git diff --name-only --diff-filter=U | wc -l)
124
- [ "$CONFLICTS" -gt 0 ] && {
125
- echo "⚠️ Merge conflicts detected"
126
- git diff --name-only --diff-filter=U
127
-
128
- # Options: resolve, abort
129
- }
130
-
131
- git push origin $GF_DEVELOP_BRANCH
132
-
133
- # CRITICAL: Verify push and update tracking refs
134
- git fetch origin $GF_DEVELOP_BRANCH:refs/remotes/origin/$GF_DEVELOP_BRANCH --force --quiet
135
- LOCAL_SHA=$(git rev-parse HEAD)
136
- REMOTE_SHA=$(git rev-parse origin/$GF_DEVELOP_BRANCH)
137
- if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
138
- echo "✅ Push verified - local/remote in sync"
139
- else
140
- echo "⚠️ Push verification FAILED"
141
- echo " Local: $LOCAL_SHA"
142
- echo " Remote: $REMOTE_SHA"
143
- echo " → Try: git push origin $GF_DEVELOP_BRANCH --force-with-lease"
144
- fi
145
-
146
- echo "✅ Merged back to $GF_DEVELOP_BRANCH"
147
- fi
148
- ```
78
+ **For release/hotfix only:**
79
+ - Create annotated tag on main branch (format: v{VERSION})
80
+ - Merge main back to develop with merge commit
81
+ - Handle merge conflicts
82
+ - Push and verify sync
149
83
 
150
84
  ### 5. Update Version (Release and Hotfix)
151
85
 
152
- ```bash
153
- if [ "$BRANCH_TYPE" = "release" ] || [ "$BRANCH_TYPE" = "hotfix" ]; then
154
- MAJOR=$(echo $VERSION | cut -d'.' -f1)
155
- MINOR=$(echo $VERSION | cut -d'.' -f2)
156
- PATCH=$(echo $VERSION | cut -d'.' -f3)
157
-
158
- if [ "$BRANCH_TYPE" = "release" ]; then
159
- # Release: increment minor, reset patch
160
- NEXT_VERSION="$MAJOR.$((MINOR + 1)).0"
161
- else
162
- # Hotfix: increment patch (patch was already bumped for the tag, bump again for next dev)
163
- NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 2))"
164
- fi
165
-
166
- # Update config (using resolved config path)
167
- sed -i "s/\"current\": \".*\"/\"current\": \"$NEXT_VERSION\"/" "$GF_CONFIG_FILE"
86
+ See [references/finish-version-bumping.md](../references/finish-version-bumping.md) for:
87
+ - Version increment logic (release: minor+1.0, hotfix: patch+2)
88
+ - Config and source file updates
89
+ - Push verification
168
90
 
169
- # Update source files
170
- # csproj, package.json, etc.
91
+ ### 6-8. Clean Up Worktree, Delete Branches, Archive Plan
171
92
 
172
- git add -A
173
- git commit -m "chore: bump version to $NEXT_VERSION for development"
174
- git push origin $GF_DEVELOP_BRANCH
175
-
176
- # CRITICAL: Verify push and update tracking refs
177
- git fetch origin $GF_DEVELOP_BRANCH:refs/remotes/origin/$GF_DEVELOP_BRANCH --force --quiet
178
- LOCAL_SHA=$(git rev-parse HEAD)
179
- REMOTE_SHA=$(git rev-parse origin/$GF_DEVELOP_BRANCH)
180
- if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
181
- echo "✅ Push verified - local/remote in sync"
182
- else
183
- echo "⚠️ Push verification FAILED"
184
- echo " Local: $LOCAL_SHA"
185
- echo " Remote: $REMOTE_SHA"
186
- fi
187
-
188
- echo "✅ Version bumped to $NEXT_VERSION"
189
- fi
190
- ```
191
-
192
- ### 6. Clean Up Worktree
193
-
194
- ```bash
195
- # Find worktree for this branch (use --porcelain for reliable parsing)
196
- WORKTREE_PATH=$(git worktree list --porcelain | grep -B2 "branch refs/heads/$BRANCH" | grep "^worktree " | sed 's/^worktree //')
197
-
198
- if [ -n "$WORKTREE_PATH" ] && [ -d "$WORKTREE_PATH" ]; then
199
- echo "Removing worktree: $WORKTREE_PATH"
200
-
201
- # Make sure we're not in the worktree directory
202
- cd "$GF_DEVELOP_PATH" 2>/dev/null || cd "$(git rev-parse --show-toplevel)"
203
-
204
- git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || {
205
- rm -rf "$WORKTREE_PATH"
206
- }
207
-
208
- git worktree prune
209
- echo "✅ Worktree removed"
210
- fi
211
- ```
212
-
213
- ### 7. Delete Remote Branch
214
-
215
- ```bash
216
- # Check if remote branch still exists
217
- REMOTE_EXISTS=$(git branch -r --list "origin/$BRANCH")
218
-
219
- if [ -n "$REMOTE_EXISTS" ]; then
220
- echo "Deleting remote branch: $BRANCH"
221
- git push origin --delete "$BRANCH" 2>/dev/null || {
222
- echo "⚠️ Could not delete remote branch (may already be deleted by PR)"
223
- }
224
- fi
225
-
226
- # Delete local branch
227
- git branch -D "$BRANCH" 2>/dev/null || echo "Local branch already deleted"
228
- ```
229
-
230
- ### 8. Archive Plan (if exists)
231
-
232
- ```bash
233
- PLAN_FILE=$(ls .claude/gitflow/plans/*${BRANCH_NAME}*.md 2>/dev/null | head -1)
234
-
235
- if [ -f "$PLAN_FILE" ]; then
236
- ARCHIVE_NAME="${PLAN_FILE%.md}_DONE_$(date +%Y%m%d-%H%M%S).md"
237
- mv "$PLAN_FILE" "$ARCHIVE_NAME"
238
- echo "✅ Plan archived: $ARCHIVE_NAME"
239
- fi
240
- ```
93
+ See [references/finish-cleanup.md](../references/finish-cleanup.md) for:
94
+ - Worktree removal with fallback
95
+ - Remote and local branch deletion
96
+ - Plan file archival
241
97
 
242
98
  ### 9. Summary
243
99