@atlashub/smartstack-cli 3.36.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 (219) 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 +3 -2
  6. package/scripts/extract-api-endpoints.ts +325 -0
  7. package/scripts/extract-business-rules.ts +440 -0
  8. package/scripts/generate-doc-with-mock-ui.ts +804 -0
  9. package/scripts/health-check.sh +168 -0
  10. package/scripts/postinstall.js +18 -0
  11. package/templates/agents/ba-reader.md +9 -9
  12. package/templates/agents/ba-writer.md +12 -15
  13. package/templates/agents/code-reviewer.md +1 -1
  14. package/templates/agents/docs-context-reader.md +1 -1
  15. package/templates/agents/gitflow/merge.md +0 -4
  16. package/templates/agents/gitflow/pr.md +0 -4
  17. package/templates/agents/gitflow/start.md +30 -5
  18. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
  19. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
  20. package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
  21. package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
  22. package/templates/skills/_shared.md +15 -17
  23. package/templates/skills/ai-prompt/SKILL.md +1 -1
  24. package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
  25. package/templates/skills/apex/SKILL.md +3 -4
  26. package/templates/skills/apex/_shared.md +10 -20
  27. package/templates/skills/apex/references/analysis-methods.md +141 -0
  28. package/templates/skills/apex/references/challenge-questions.md +1 -21
  29. package/templates/skills/apex/references/core-seed-data.md +35 -57
  30. package/templates/skills/apex/references/examine-build-validation.md +87 -0
  31. package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
  32. package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
  33. package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
  34. package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
  35. package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
  36. package/templates/skills/apex/references/post-checks.md +145 -40
  37. package/templates/skills/apex/references/smartstack-api.md +35 -51
  38. package/templates/skills/apex/references/smartstack-frontend.md +17 -17
  39. package/templates/skills/apex/references/smartstack-layers.md +38 -62
  40. package/templates/skills/apex/steps/step-00-init.md +14 -26
  41. package/templates/skills/apex/steps/step-01-analyze.md +10 -143
  42. package/templates/skills/apex/steps/step-02-plan.md +10 -92
  43. package/templates/skills/apex/steps/step-03-execute.md +47 -249
  44. package/templates/skills/apex/steps/step-04-examine.md +14 -78
  45. package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
  46. package/templates/skills/apex/steps/step-08-run-tests.md +2 -0
  47. package/templates/skills/application/SKILL.md +6 -7
  48. package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
  49. package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
  50. package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
  51. package/templates/skills/application/references/backend-verification.md +1 -1
  52. package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
  53. package/templates/skills/application/references/frontend-route-naming.md +117 -0
  54. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
  55. package/templates/skills/application/references/frontend-verification.md +12 -12
  56. package/templates/skills/application/references/init-parameter-detection.md +120 -0
  57. package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
  58. package/templates/skills/application/references/nav-fallback-procedure.md +5 -6
  59. package/templates/skills/application/references/provider-template.md +2 -6
  60. package/templates/skills/application/references/roles-client-project-handling.md +55 -0
  61. package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
  62. package/templates/skills/application/references/test-coverage-requirements.md +213 -0
  63. package/templates/skills/application/references/test-frontend.md +3 -3
  64. package/templates/skills/application/steps/step-00-init.md +11 -141
  65. package/templates/skills/application/steps/step-01-navigation.md +3 -3
  66. package/templates/skills/application/steps/step-02-permissions.md +4 -4
  67. package/templates/skills/application/steps/step-03-roles.md +18 -175
  68. package/templates/skills/application/steps/step-03b-provider.md +1 -2
  69. package/templates/skills/application/steps/step-04-backend.md +19 -110
  70. package/templates/skills/application/steps/step-05-frontend.md +17 -143
  71. package/templates/skills/application/steps/step-06-migration.md +12 -60
  72. package/templates/skills/application/steps/step-07-tests.md +9 -76
  73. package/templates/skills/application/templates-backend.md +29 -27
  74. package/templates/skills/application/templates-frontend.md +48 -48
  75. package/templates/skills/application/templates-seed.md +57 -131
  76. package/templates/skills/business-analyse/SKILL.md +27 -30
  77. package/templates/skills/business-analyse/_architecture.md +6 -6
  78. package/templates/skills/business-analyse/_shared.md +60 -88
  79. package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
  80. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  81. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
  82. package/templates/skills/business-analyse/react/application-viewer.md +12 -12
  83. package/templates/skills/business-analyse/react/components.md +8 -12
  84. package/templates/skills/business-analyse/react/schema.md +11 -11
  85. package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
  86. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
  87. package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
  88. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
  89. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
  90. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
  91. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
  92. package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
  93. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
  94. package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
  95. package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
  96. package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
  97. package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
  98. package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
  99. package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
  100. package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
  101. package/templates/skills/business-analyse/references/prd-generation.md +2 -2
  102. package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
  103. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  104. package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
  105. package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
  106. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  107. package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
  108. package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
  109. package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
  110. package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
  111. package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
  112. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
  113. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
  114. package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
  115. package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
  116. package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
  117. package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
  118. package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
  119. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
  120. package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
  121. package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
  122. package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
  123. package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
  124. package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
  125. package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
  126. package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
  127. package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
  128. package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
  129. package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
  130. package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
  131. package/templates/skills/business-analyse/templates-frd.md +25 -25
  132. package/templates/skills/business-analyse/templates-react.md +15 -21
  133. package/templates/skills/controller/SKILL.md +1 -1
  134. package/templates/skills/controller/postman-templates.md +1 -1
  135. package/templates/skills/controller/references/controller-code-templates.md +2 -2
  136. package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
  137. package/templates/skills/controller/references/permission-sync-templates.md +13 -16
  138. package/templates/skills/controller/steps/step-00-init.md +11 -11
  139. package/templates/skills/controller/steps/step-03-generate.md +64 -103
  140. package/templates/skills/controller/templates.md +67 -71
  141. package/templates/skills/debug/SKILL.md +13 -218
  142. package/templates/skills/debug/steps/step-00-init.md +57 -0
  143. package/templates/skills/debug/steps/step-01-analyze.md +219 -0
  144. package/templates/skills/debug/steps/step-02-resolve.md +85 -0
  145. package/templates/skills/documentation/SKILL.md +49 -345
  146. package/templates/skills/documentation/data-schema.md +11 -8
  147. package/templates/skills/documentation/steps/step-00-init.md +70 -0
  148. package/templates/skills/documentation/steps/step-01-scan.md +113 -0
  149. package/templates/skills/documentation/steps/step-02-generate.md +231 -0
  150. package/templates/skills/documentation/steps/step-03-validate.md +238 -0
  151. package/templates/skills/documentation/templates.md +480 -322
  152. package/templates/skills/efcore/references/both-contexts.md +32 -0
  153. package/templates/skills/efcore/references/database-operations.md +67 -0
  154. package/templates/skills/efcore/references/destructive-operations.md +38 -0
  155. package/templates/skills/efcore/references/reset-operations.md +81 -0
  156. package/templates/skills/efcore/references/seed-methods.md +86 -0
  157. package/templates/skills/efcore/references/shared-init-functions.md +250 -0
  158. package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
  159. package/templates/skills/efcore/references/troubleshooting.md +81 -0
  160. package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
  161. package/templates/skills/efcore/steps/db/step-reset.md +7 -103
  162. package/templates/skills/efcore/steps/db/step-seed.md +10 -132
  163. package/templates/skills/efcore/steps/db/step-status.md +5 -44
  164. package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
  165. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
  166. package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
  167. package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
  168. package/templates/skills/feature-full/SKILL.md +1 -1
  169. package/templates/skills/feature-full/steps/step-00-init.md +57 -0
  170. package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
  171. package/templates/skills/gitflow/SKILL.md +1 -1
  172. package/templates/skills/gitflow/_shared.md +23 -0
  173. package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
  174. package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
  175. package/templates/skills/gitflow/references/finish-cleanup.md +51 -0
  176. package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
  177. package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
  178. package/templates/skills/gitflow/references/init-questions.md +185 -0
  179. package/templates/skills/gitflow/references/init-structure-creation.md +71 -0
  180. package/templates/skills/gitflow/references/init-version-detection.md +21 -0
  181. package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
  182. package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
  183. package/templates/skills/gitflow/references/merge-execution.md +62 -0
  184. package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
  185. package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
  186. package/templates/skills/gitflow/references/pr-generation.md +58 -0
  187. package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
  188. package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
  189. package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
  190. package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
  191. package/templates/skills/gitflow/steps/step-commit.md +12 -91
  192. package/templates/skills/gitflow/steps/step-finish.md +15 -159
  193. package/templates/skills/gitflow/steps/step-init.md +24 -326
  194. package/templates/skills/gitflow/steps/step-merge.md +17 -176
  195. package/templates/skills/gitflow/steps/step-pr.md +10 -116
  196. package/templates/skills/gitflow/steps/step-start.md +16 -109
  197. package/templates/skills/gitflow/steps/step-sync.md +6 -69
  198. package/templates/skills/ralph-loop/SKILL.md +6 -0
  199. package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
  200. package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
  201. package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
  202. package/templates/skills/ralph-loop/references/module-transition.md +151 -0
  203. package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
  204. package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
  205. package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
  206. package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
  207. package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
  208. package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
  209. package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
  210. package/templates/skills/ralph-loop/steps/step-04-check.md +21 -73
  211. package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
  212. package/templates/skills/review-code/references/smartstack-conventions.md +11 -11
  213. package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
  214. package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
  215. package/templates/skills/validate-feature/steps/step-01-compile.md +5 -2
  216. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
  217. package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
  218. package/templates/skills/workflow/SKILL.md +1 -1
  219. package/templates/skills/workflow/steps/step-00-init.md +57 -0
@@ -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
+ # Fix cross-platform paths in worktree metadata (if created from different platform)
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