@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
@@ -16,145 +16,18 @@ Detect EF Core project structure, identify DbContext (Core vs Extensions), and l
16
16
 
17
17
  ## EXECUTION SEQUENCE:
18
18
 
19
- ### 0. Ensure dotnet ef Available (Platform-Aware)
19
+ Load all helper functions from: `references/shared-init-functions.md`
20
20
 
21
- > **CRITICAL:** On Windows (Git Bash, MSYS2), `dotnet ef` may not be on the shell PATH
22
- > even though it's installed. This step fixes PATH before any EF Core command.
21
+ This includes:
22
+ - `ensure_dotnet_ef()` - Platform-aware dotnet-ef PATH fix
23
+ - `detect_efcore_project()` - Find EF Core project
24
+ - `detect_dbcontext()` - Detect Core vs Extensions
25
+ - `detect_environment()` - Load environment configuration
26
+ - `determine_base_branch()` - Determine GitFlow branch
27
+ - `block_production()` - Prevent production deployments
28
+ - `run_for_contexts()` - Helper for dual context execution
23
29
 
24
- ```bash
25
- ensure_dotnet_ef() {
26
- # Quick check: already available?
27
- if dotnet ef --version &>/dev/null; then
28
- DOTNET_EF_VERSION=$(dotnet ef --version 2>/dev/null)
29
- echo "dotnet-ef: $DOTNET_EF_VERSION"
30
- return 0
31
- fi
32
-
33
- echo "dotnet-ef not on PATH, attempting platform-aware fix..."
34
-
35
- # Try all known .NET global tools locations
36
- # - $USERPROFILE/.dotnet/tools → Windows via Git Bash (USERPROFILE=C:\Users\xxx)
37
- # - $HOME/.dotnet/tools → Linux/macOS or Git Bash fallback
38
- # - $LOCALAPPDATA/Microsoft/dotnet/tools → Windows alternate location
39
- for TOOLS_DIR in \
40
- "$USERPROFILE/.dotnet/tools" \
41
- "$HOME/.dotnet/tools" \
42
- "$LOCALAPPDATA/Microsoft/dotnet/tools"; do
43
- if [ -n "$TOOLS_DIR" ] && [ -d "$TOOLS_DIR" ]; then
44
- export PATH="$TOOLS_DIR:$PATH"
45
- echo " PATH += $TOOLS_DIR"
46
- fi
47
- done
48
-
49
- # Verify after PATH fix
50
- if dotnet ef --version &>/dev/null; then
51
- DOTNET_EF_VERSION=$(dotnet ef --version 2>/dev/null)
52
- echo "dotnet-ef: $DOTNET_EF_VERSION (found after PATH fix)"
53
- return 0
54
- fi
55
-
56
- echo "ERROR: dotnet-ef not available"
57
- echo "Install with: dotnet tool install --global dotnet-ef"
58
- echo ""
59
- echo "If installed but not found, check:"
60
- echo " Windows: %USERPROFILE%\\.dotnet\\tools must be in PATH"
61
- echo " Linux: ~/.dotnet/tools must be in PATH"
62
- exit 1
63
- }
64
-
65
- ensure_dotnet_ef
66
- ```
67
-
68
- **IMPORTANT — WSL pitfall:**
69
- If the shell resolves `$HOME` to `/home/{user}` (WSL path) instead of `/c/Users/{user}` (Git Bash),
70
- the .NET SDK may not be found even if `dotnet-ef` is. Use `$USERPROFILE` first on Windows.
71
-
72
- ---
73
-
74
- ### 1. Detect EF Core Project
75
-
76
- ```bash
77
- detect_efcore_project() {
78
- # Find project with EF Core reference
79
- CSPROJ=$(find . -name "*.csproj" -exec grep -l "Microsoft.EntityFrameworkCore" {} \; | head -1)
80
-
81
- if [ -z "$CSPROJ" ]; then
82
- echo "ERROR: No EF Core project found"
83
- exit 1
84
- fi
85
-
86
- PROJECT_DIR=$(dirname "$CSPROJ")
87
- PROJECT_NAME=$(basename "$CSPROJ" .csproj)
88
- MIGRATIONS_DIR="$PROJECT_DIR/Persistence/Migrations"
89
-
90
- # Find startup and infrastructure projects
91
- STARTUP_PROJECT=$(find . -name "*.Api.csproj" -o -name "*Web.csproj" | head -1)
92
- INFRA_PROJECT=$(find . -name "*Infrastructure.csproj" | head -1)
93
- [ -z "$INFRA_PROJECT" ] && INFRA_PROJECT="$CSPROJ"
94
-
95
- echo "Project: $PROJECT_NAME"
96
- echo "Migrations: $MIGRATIONS_DIR"
97
- }
98
- ```
99
-
100
- ### 2. Detect DbContext (Core vs Extensions)
101
-
102
- ```bash
103
- detect_dbcontext() {
104
- # Priority 1: SmartStack.Domain exists → SmartStack source project (Core only)
105
- if find . -type d -name "SmartStack.Domain" | grep -q .; then
106
- DBCONTEXT="CoreDbContext"
107
- DBCONTEXT_TYPE="core"
108
- SCHEMA="core"
109
- RUN_BOTH=false
110
- echo "DbContext: CoreDbContext (SmartStack.Domain found)"
111
- return
112
- fi
113
-
114
- # Priority 2: Client project with SmartStack NuGet → BOTH contexts
115
- # Detect: csproj files that have a PackageReference to SmartStack (not ProjectReference)
116
- # This identifies client projects created via `ss init` that consume SmartStack as NuGet
117
- if find . -name "*.csproj" -exec grep -ql "PackageReference.*SmartStack" {} \; 2>/dev/null; then
118
- DBCONTEXT="CoreDbContext"
119
- DBCONTEXT_TYPE="both"
120
- SCHEMA="core"
121
- RUN_BOTH=true
122
- echo "DbContext: Both (Core from SmartStack NuGet + Extensions local)"
123
- echo " Deploy order: CoreDbContext → ExtensionsDbContext"
124
- return
125
- fi
126
-
127
- # Priority 3: Scan for DbContext in code
128
- CORE_CTX=$(find . -name "*.cs" -exec grep -l "CoreDbContext" {} \; 2>/dev/null | head -1)
129
- EXT_CTX=$(find . -name "*.cs" -exec grep -l "ExtensionsDbContext" {} \; 2>/dev/null | head -1)
130
-
131
- if [ -n "$CORE_CTX" ] && [ -n "$EXT_CTX" ]; then
132
- DBCONTEXT="CoreDbContext"
133
- DBCONTEXT_TYPE="both"
134
- SCHEMA="core"
135
- RUN_BOTH=true
136
- echo "DbContext: Both (CoreDbContext + ExtensionsDbContext found)"
137
- elif [ -n "$CORE_CTX" ] && [ -z "$EXT_CTX" ]; then
138
- DBCONTEXT="CoreDbContext"
139
- DBCONTEXT_TYPE="core"
140
- SCHEMA="core"
141
- RUN_BOTH=false
142
- elif [ -z "$CORE_CTX" ] && [ -n "$EXT_CTX" ]; then
143
- DBCONTEXT="ExtensionsDbContext"
144
- DBCONTEXT_TYPE="extensions"
145
- SCHEMA="extensions"
146
- RUN_BOTH=false
147
- else
148
- # Priority 4: Ask user
149
- DBCONTEXT=""
150
- DBCONTEXT_TYPE=""
151
- SCHEMA=""
152
- RUN_BOTH=false
153
- fi
154
- }
155
- ```
156
-
157
- ### 3. Ask User if DbContext Unknown
30
+ ### User Prompt (if DbContext Unknown)
158
31
 
159
32
  **If `{dbcontext}` is empty after detection:**
160
33
 
@@ -188,123 +61,7 @@ if (answer === "CoreDbContext") {
188
61
  }
189
62
  ```
190
63
 
191
- ### 4. Detect Environment
192
-
193
- ```bash
194
- detect_environment() {
195
- API_DIR=$(find . -type d -name "*.Api" | head -1)
196
- [ -z "$API_DIR" ] && API_DIR="src/SmartStack.Api"
197
-
198
- # Priority: --env flag > appsettings.Local.json > error
199
- if [ -n "$ENV_FLAG" ]; then
200
- CONFIG_FILE="$API_DIR/appsettings.${ENV_FLAG}.json"
201
- elif [ -f "$API_DIR/appsettings.Local.json" ]; then
202
- CONFIG_FILE="$API_DIR/appsettings.Local.json"
203
- SELECTED_ENV="Local"
204
- else
205
- echo "ERROR: No appsettings.Local.json found"
206
- echo "Create one or use --env flag"
207
- exit 1
208
- fi
209
-
210
- echo "Environment: $SELECTED_ENV"
211
- echo "Config: $CONFIG_FILE"
212
- }
213
- ```
214
-
215
- ### 5. Determine Base Branch (for squash/rebase)
216
-
217
- ```bash
218
- determine_base_branch() {
219
- CURRENT_BRANCH=$(git branch --show-current)
220
-
221
- case "$CURRENT_BRANCH" in
222
- feature/*)
223
- BASE_BRANCH="develop"
224
- BRANCH_TYPE="feature"
225
- ;;
226
- release/*)
227
- BASE_BRANCH="main"
228
- BRANCH_TYPE="release"
229
- ;;
230
- hotfix/*)
231
- BASE_BRANCH="main"
232
- BRANCH_TYPE="hotfix"
233
- ;;
234
- develop)
235
- BASE_BRANCH="main"
236
- BRANCH_TYPE="develop"
237
- ;;
238
- main|master)
239
- echo "ERROR: Cannot run on main/master branch"
240
- exit 1
241
- ;;
242
- *)
243
- BASE_BRANCH="develop"
244
- BRANCH_TYPE="unknown"
245
- ;;
246
- esac
247
-
248
- echo "Branch: $CURRENT_BRANCH ($BRANCH_TYPE)"
249
- echo "Base: $BASE_BRANCH"
250
- }
251
- ```
252
-
253
- ### 6. Block Production
254
-
255
- ```bash
256
- block_production() {
257
- # Check for production indicators (case-insensitive)
258
- if grep -qi '"Production"' "$CONFIG_FILE" 2>/dev/null; then
259
- echo "BLOCKED: Production environment detected in $CONFIG_FILE"
260
- exit 1
261
- fi
262
-
263
- # Case-insensitive database name check
264
- DB_LOWER=$(echo "$DATABASE_NAME" | tr '[:upper:]' '[:lower:]')
265
- if [[ "$DB_LOWER" == *"prod"* ]] || [[ "$DB_LOWER" == *"production"* ]]; then
266
- echo "BLOCKED: Production database detected ($DATABASE_NAME)"
267
- exit 1
268
- fi
269
-
270
- # Environment name check (case-insensitive)
271
- ENV_LOWER=$(echo "$SELECTED_ENV" | tr '[:upper:]' '[:lower:]')
272
- if [[ "$ENV_LOWER" == "production" ]] || [[ "$ENV_LOWER" == "prod" ]]; then
273
- echo "BLOCKED: Production environment selected ($SELECTED_ENV)"
274
- exit 1
275
- fi
276
- }
277
- ```
278
-
279
- ### 7. Dual Context Helper
280
-
281
- ```bash
282
- # Helper for steps that need to run for both contexts when RUN_BOTH=true
283
- # Usage: run_for_contexts "command_or_function"
284
- # Executes with CoreDbContext first, then ExtensionsDbContext
285
- # Maintains deploy order constraint: Core MUST run first
286
-
287
- run_for_contexts() {
288
- if [ "$RUN_BOTH" = "true" ]; then
289
- echo "=== Running for CoreDbContext (core schema) ==="
290
- DBCONTEXT="CoreDbContext"
291
- DBCONTEXT_TYPE="core"
292
- SCHEMA="core"
293
- eval "$1"
294
-
295
- echo ""
296
- echo "=== Running for ExtensionsDbContext (extensions schema) ==="
297
- DBCONTEXT="ExtensionsDbContext"
298
- DBCONTEXT_TYPE="extensions"
299
- SCHEMA="extensions"
300
- eval "$1"
301
- else
302
- eval "$1"
303
- fi
304
- }
305
- ```
306
-
307
- ### 8. Display Summary
64
+ ### Display Summary
308
65
 
309
66
  ```
310
67
  EF CORE CONTEXT
@@ -135,64 +135,7 @@ echo " Down methods: $DOWN_METHODS"
135
135
 
136
136
  ### 6. Inject SQL Objects (Functions, Views, SP)
137
137
 
138
- EF Core does NOT generate DDL for TVF, views, and stored procedures.
139
- SQL source scripts are in `Persistence/SqlObjects/` (Embedded Resources).
140
- After a squash, they must be re-injected into the consolidated migration.
141
-
142
- ```bash
143
- # Check if SqlObjects folder exists with .sql files
144
- SQL_OBJECTS_DIR="$INFRA_PROJECT_DIR/Persistence/SqlObjects"
145
- SQL_FILES=$(find "$SQL_OBJECTS_DIR" -name "*.sql" 2>/dev/null | wc -l)
146
-
147
- if [ "$SQL_FILES" -gt 0 ]; then
148
- echo ""
149
- echo "Found $SQL_FILES SQL object(s) in SqlObjects/"
150
- echo "Injecting SqlObjectHelper.ApplyAll(migrationBuilder) into migration..."
151
-
152
- # Validate migration file path before sed operations (prevent path injection)
153
- if [ ! -f "$MIGRATION_FILE" ]; then
154
- echo "ERROR: Migration file not found: $MIGRATION_FILE"
155
- exit 1
156
- fi
157
- if ! echo "$MIGRATION_FILE" | grep -qE '\.cs$'; then
158
- echo "ERROR: Invalid migration file path (not .cs): $MIGRATION_FILE"
159
- exit 1
160
- fi
161
-
162
- # Add using directive if not present
163
- if ! grep -q "using SmartStack.Infrastructure.Persistence.SqlObjects;" "$MIGRATION_FILE"; then
164
- sed -i '1s/^/using SmartStack.Infrastructure.Persistence.SqlObjects;\n/' "$MIGRATION_FILE"
165
- fi
166
-
167
- # Add SqlObjectHelper.ApplyAll at the end of Up() method
168
- # Find the closing brace of Up() and insert before it
169
- sed -i '/protected override void Up/,/^ }/ {
170
- /^ }/ i\
171
- \ // Apply SQL objects (TVF, Views, SP) from embedded resources\
172
- \ SqlObjectHelper.ApplyAll(migrationBuilder);
173
- }' "$MIGRATION_FILE"
174
-
175
- # Verify injection succeeded (fallback to manual step if sed pattern didn't match)
176
- if ! grep -q "SqlObjectHelper.ApplyAll" "$MIGRATION_FILE"; then
177
- echo "WARNING: Automatic injection failed (indentation pattern may differ)"
178
- echo ""
179
- echo "MANUAL STEP REQUIRED: Add these lines inside the Up() method before the closing brace:"
180
- echo ' using SmartStack.Infrastructure.Persistence.SqlObjects;'
181
- echo ' ...'
182
- echo ' SqlObjectHelper.ApplyAll(migrationBuilder);'
183
- echo ""
184
- echo "File: $MIGRATION_FILE"
185
- else
186
- echo " SqlObjectHelper.ApplyAll(migrationBuilder) injected"
187
- fi
188
- find "$SQL_OBJECTS_DIR" -name "*.sql" -exec basename {} \; | while read f; do
189
- echo " - $f"
190
- done
191
- else
192
- echo ""
193
- echo "No SQL objects found in SqlObjects/ - skipping injection"
194
- fi
195
- ```
138
+ Load: `references/sql-objects-injection.md`
196
139
 
197
140
  ---
198
141
 
@@ -43,7 +43,7 @@ DOMAIN -> APPLICATION -> INFRASTRUCTURE -> API -> WEB
43
43
 
44
44
  ## Phases 2-7: Implementation
45
45
 
46
- See [steps/step-01-implementation.md](steps/step-01-implementation.md) for detailed code templates covering:
46
+ Start with [steps/step-00-init.md](steps/step-00-init.md) to analyze requirements and existing patterns, then proceed to [steps/step-01-implementation.md](steps/step-01-implementation.md) for detailed code templates covering:
47
47
  - Phase 2: Domain (Entity + Factory + Behaviors + Enum)
48
48
  - Phase 3: Application (Interface + DTOs + Permissions)
49
49
  - Phase 4: Infrastructure (EF Config + Service + DI)
@@ -0,0 +1,57 @@
1
+ # Step 0: Initialization
2
+
3
+ ## YOUR TASK
4
+ Gather requirements and analyze existing code patterns before implementing a complete full-stack feature.
5
+
6
+ ## EXECUTION SEQUENCE
7
+
8
+ ### 1. Identify Feature Scope
9
+ - What is the main entity/aggregate? (e.g., Product, Invoice, Support Ticket)
10
+ - What are the CRUD operations required? (Create, Read, Update, Delete, Archive)
11
+ - What business rules apply? (validations, state transitions, constraints)
12
+ - What user permissions are needed? (who can create/edit/delete/view)
13
+ - What notifications/workflows are required? (emails, webhooks, automation)
14
+ - Does AI play a role? (content generation, analysis, validation)
15
+
16
+ ### 2. Analyze Existing Code Patterns
17
+ - Review `Domain/` for similar entity structures, factories, and behaviors
18
+ - Check `Application/` for existing service interfaces and DTOs
19
+ - Examine `Infrastructure/` for EF Core configurations and patterns
20
+ - Look at `API/Controllers/` for authorization and RequirePermission attributes
21
+ - Study `web/` for similar pages, forms, and i18n implementations
22
+ - Identify reusable components and patterns to follow
23
+
24
+ ### 3. Define Data Model
25
+ - Entity properties and types
26
+ - Enums for status, types, and classifications
27
+ - Relationships (OneToMany, ManyToMany, etc.)
28
+ - Audit requirements (CreatedAt, CreatedBy, ModifiedAt, ModifiedBy)
29
+ - Soft delete or permanent delete?
30
+
31
+ ### 4. Plan Implementation Phases
32
+ - **Phase 2:** Domain entity, factory method, behaviors, enums, IAuditableEntity
33
+ - **Phase 3:** Application service interface, DTOs, permissions (create + assign permissions files)
34
+ - **Phase 4:** Infrastructure (EF Config, concrete service, DI registration, DbSet, migration)
35
+ - **Phase 5:** API controller with Authorize, RequirePermission, ProducesResponseType
36
+ - **Phase 6:** Frontend (API client, custom hook with SignalR, page, form, routing, i18n for 4 languages)
37
+ - **Phase 7:** Integrations (notifications, workflows, AI if applicable)
38
+
39
+ ### 5. Validate Against Architecture Rules
40
+ - Confirm layered architecture is followed (no frontend-to-DB shortcuts)
41
+ - Verify entity factory methods are used (no direct constructors in services)
42
+ - Check permissions split across 2 files (Create/List/Read/Update/Delete vs Assign)
43
+ - Plan SignalR hooks for real-time updates
44
+ - Define ProducesResponseType for all endpoints
45
+ - Plan i18n for English, French, Italian, German
46
+
47
+ ## SUCCESS METRICS
48
+ - Feature scope clearly defined and bounded
49
+ - All required CRUD operations identified
50
+ - Business rules documented
51
+ - Permissions mapped to roles
52
+ - Implementation plan with all 7 phases outlined
53
+ - Existing code patterns understood and will be followed
54
+ - Data model defined with relationships and audit requirements
55
+
56
+ ## NEXT STEP
57
+ Proceed to `./step-01-implementation.md` to execute all phases (Domain, Application, Infrastructure, API, Frontend, Integrations) with code templates and orchestration of child skills.
@@ -30,7 +30,7 @@ public record {Entity}Dto(Guid Id, string Name, string Status, DateTime CreatedA
30
30
  public record Create{Entity}Request(string Name, string? Description);
31
31
 
32
32
  // Permissions.cs + PermissionConfiguration.cs (2 files!)
33
- public const string View = "{context}.{area}.{module}.read";
33
+ public const string View = "{area}.{module}.read";
34
34
  ```
35
35
 
36
36
  ## Phase 4: Infrastructure
@@ -10,7 +10,7 @@ disable-model-invocation: true
10
10
  - Status: !`git status --short`
11
11
  - Recent commits: !`git log --oneline -5`
12
12
  - Worktrees: !`git worktree list 2>/dev/null`
13
- - Config: !`cat .gitflow/config.json 2>/dev/null || echo "no config found"`
13
+ - Config: !`cat .claude/gitflow/config.json 2>/dev/null || echo "no config found"`
14
14
 
15
15
  <objective>
16
16
  Execute GitFlow workflows with automatic versioning, worktree management, and EF Core migration validation. Uses progressive step loading to minimize context and maintain fresh state at each phase.
@@ -316,6 +316,29 @@ cleanup_worktree_for_branch() {
316
316
 
317
317
  ---
318
318
 
319
+ ## VALIDATE_WORKTREE_PATH
320
+
321
+ Validates that a worktree path follows config conventions. Only `01-Main` and `02-Develop` may use numbered prefixes. All other worktrees (features, releases, hotfixes) MUST use config paths (`features/{name}`, `releases/v{version}`, `hotfixes/{name}`).
322
+
323
+ ```bash
324
+ validate_worktree_path() {
325
+ local WORKTREE_PATH="$1"
326
+ local BASENAME=$(basename "$WORKTREE_PATH")
327
+
328
+ # Only 01-Main and 02-Develop may use numbered prefixes
329
+ if [[ "$BASENAME" =~ ^[0-9]{2}- ]] && [[ "$BASENAME" != "01-Main" ]] && [[ "$BASENAME" != "02-Develop" ]]; then
330
+ echo "ERROR: Invalid numbered worktree directory: $BASENAME"
331
+ echo " Path: $WORKTREE_PATH"
332
+ echo " FORBIDDEN: Numbered directories like 03-Release, 04-Feature, 05-Hotfix"
333
+ echo " REQUIRED: Use config paths → features/{name}, releases/v{version}, hotfixes/{name}"
334
+ return 1
335
+ fi
336
+ return 0
337
+ }
338
+ ```
339
+
340
+ ---
341
+
319
342
  ## REPAIR_WORKTREE_PATHS
320
343
 
321
344
  Repairs worktree metadata files that contain paths from a different platform (e.g., WSL paths `/mnt/d/...` on Windows, or Windows paths `D:/...` on WSL). Scans `.bare/worktrees/*/gitdir` and the corresponding `{worktree}/.git` files.
@@ -0,0 +1,58 @@
1
+ # Commit Message Generation
2
+
3
+ ## Determine Commit Type
4
+
5
+ ```bash
6
+ # Determine commit type from branch
7
+ BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
8
+ case "$BRANCH_TYPE" in
9
+ feature) PREFIX="feat" ;;
10
+ hotfix) PREFIX="fix" ;;
11
+ release) PREFIX="chore" ;;
12
+ *) PREFIX="chore" ;;
13
+ esac
14
+
15
+ # Determine scope from branch name
16
+ SCOPE=$(echo $CURRENT | cut -d'/' -f2 | cut -d'-' -f1)
17
+
18
+ # If migrations present
19
+ [ "$HAS_MIGRATIONS" = "true" ] && PREFIX="db(migrations)"
20
+
21
+ # Generate message from diff analysis
22
+ SUMMARY=$(git diff --cached --stat | tail -1 | sed 's/^ *//')
23
+ ```
24
+
25
+ ## Message Format
26
+
27
+ ```
28
+ {type}({scope}): {summary - 50 chars max}
29
+
30
+ **CHANGE**
31
+ PROBLEM: {what was wrong}
32
+ SOLUTION: {what was done}
33
+ IMPACT: {benefit}
34
+
35
+ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36
+ ```
37
+
38
+ ## Stage and Create Commit
39
+
40
+ ```bash
41
+ # Stage all changes
42
+ git add -A
43
+
44
+ # Show what will be committed
45
+ echo "Files to commit:"
46
+ git diff --cached --stat
47
+ ```
48
+
49
+ ## Create Commit
50
+
51
+ ```bash
52
+ git commit -m "$(cat <<'EOF'
53
+ {generated_message}
54
+ EOF
55
+ )"
56
+
57
+ COMMIT_HASH=$(git rev-parse --short HEAD)
58
+ ```
@@ -0,0 +1,49 @@
1
+ # Migration File Validation
2
+
3
+ ## Detect EF Core Migrations
4
+
5
+ ```bash
6
+ # Find migration files in changes
7
+ MIGRATIONS=$(echo "$STAGED $MODIFIED $UNTRACKED" | tr ' ' '\n' | grep -E "Migrations/.*\.cs$")
8
+ HAS_MIGRATIONS=$([ -n "$MIGRATIONS" ] && echo "true" || echo "false")
9
+
10
+ if [ "$HAS_MIGRATIONS" = "true" ]; then
11
+ # Check for the 3 required files
12
+ MIGRATION_NAME=$(echo "$MIGRATIONS" | grep -v "Designer\|Snapshot" | head -1 | sed 's/.*\///' | sed 's/\.cs$//')
13
+
14
+ HAS_MAIN=$(echo "$MIGRATIONS" | grep -c "${MIGRATION_NAME}.cs")
15
+ HAS_DESIGNER=$(echo "$MIGRATIONS" | grep -c "${MIGRATION_NAME}.Designer.cs")
16
+ HAS_SNAPSHOT=$(echo "$MIGRATIONS" | grep -c "ModelSnapshot.cs")
17
+
18
+ [ "$HAS_MAIN" -eq 0 ] || [ "$HAS_DESIGNER" -eq 0 ] || [ "$HAS_SNAPSHOT" -eq 0 ] && {
19
+ echo "❌ INCOMPLETE MIGRATION"
20
+ echo "Required: Migration.cs + Designer.cs + ModelSnapshot.cs"
21
+ echo "Found: Main=$HAS_MAIN, Designer=$HAS_DESIGNER, Snapshot=$HAS_SNAPSHOT"
22
+ STOP
23
+ }
24
+ fi
25
+ ```
26
+
27
+ ## Check Destructive Operations (BLOCKING)
28
+
29
+ ```bash
30
+ if [ "$HAS_MIGRATIONS" = "true" ]; then
31
+ DESTRUCTIVE=$(grep -l "DropTable\|DropColumn\|DeleteData" $MIGRATIONS 2>/dev/null)
32
+
33
+ [ -n "$DESTRUCTIVE" ] && {
34
+ echo "⚠️ DESTRUCTIVE OPERATIONS DETECTED"
35
+ grep -n "DropTable\|DropColumn\|DeleteData" $DESTRUCTIVE
36
+
37
+ # Require explicit confirmation
38
+ AskUserQuestion:
39
+ header: "Confirm"
40
+ question: "Destructive migration detected. Continue?"
41
+ options:
42
+ - label: "Yes, I understand the risks"
43
+ - label: "No, let me review"
44
+
45
+ # Log to audit trail
46
+ echo "$(date) - DESTRUCTIVE: $DESTRUCTIVE - User: $USER" >> .claude/gitflow/logs/audit.log
47
+ }
48
+ fi
49
+ ```
@@ -0,0 +1,51 @@
1
+ # Worktree and Branch Cleanup
2
+
3
+ ## Clean Up Worktree
4
+
5
+ ```bash
6
+ # Find worktree for this branch (use --porcelain for reliable parsing)
7
+ WORKTREE_PATH=$(git worktree list --porcelain | grep -B2 "branch refs/heads/$BRANCH" | grep "^worktree " | sed 's/^worktree //')
8
+
9
+ if [ -n "$WORKTREE_PATH" ] && [ -d "$WORKTREE_PATH" ]; then
10
+ echo "Removing worktree: $WORKTREE_PATH"
11
+
12
+ # Make sure we're not in the worktree directory
13
+ cd "$GF_DEVELOP_PATH" 2>/dev/null || cd "$(git rev-parse --show-toplevel)"
14
+
15
+ git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || {
16
+ rm -rf "$WORKTREE_PATH"
17
+ }
18
+
19
+ git worktree prune
20
+ echo "✅ Worktree removed"
21
+ fi
22
+ ```
23
+
24
+ ## Delete Remote and Local Branches
25
+
26
+ ```bash
27
+ # Check if remote branch still exists
28
+ REMOTE_EXISTS=$(git branch -r --list "origin/$BRANCH")
29
+
30
+ if [ -n "$REMOTE_EXISTS" ]; then
31
+ echo "Deleting remote branch: $BRANCH"
32
+ git push origin --delete "$BRANCH" 2>/dev/null || {
33
+ echo "⚠️ Could not delete remote branch (may already be deleted by PR)"
34
+ }
35
+ fi
36
+
37
+ # Delete local branch
38
+ git branch -D "$BRANCH" 2>/dev/null || echo "Local branch already deleted"
39
+ ```
40
+
41
+ ## Archive Plan
42
+
43
+ ```bash
44
+ PLAN_FILE=$(ls .claude/gitflow/plans/*${BRANCH_NAME}*.md 2>/dev/null | head -1)
45
+
46
+ if [ -f "$PLAN_FILE" ]; then
47
+ ARCHIVE_NAME="${PLAN_FILE%.md}_DONE_$(date +%Y%m%d-%H%M%S).md"
48
+ mv "$PLAN_FILE" "$ARCHIVE_NAME"
49
+ echo "✅ Plan archived: $ARCHIVE_NAME"
50
+ fi
51
+ ```
@@ -0,0 +1,45 @@
1
+ # Version Bumping After Release/Hotfix
2
+
3
+ ## Determine Next Version
4
+
5
+ ```bash
6
+ MAJOR=$(echo $VERSION | cut -d'.' -f1)
7
+ MINOR=$(echo $VERSION | cut -d'.' -f2)
8
+ PATCH=$(echo $VERSION | cut -d'.' -f3)
9
+
10
+ if [ "$BRANCH_TYPE" = "release" ]; then
11
+ # Release: increment minor, reset patch
12
+ NEXT_VERSION="$MAJOR.$((MINOR + 1)).0"
13
+ else
14
+ # Hotfix: increment patch (patch was already bumped for the tag, bump again for next dev)
15
+ NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 2))"
16
+ fi
17
+ ```
18
+
19
+ ## Update Configuration and Source Files
20
+
21
+ ```bash
22
+ # Update config (using resolved config path)
23
+ sed -i "s/\"current\": \".*\"/\"current\": \"$NEXT_VERSION\"/" "$GF_CONFIG_FILE"
24
+
25
+ # Update source files
26
+ # csproj, package.json, etc.
27
+
28
+ git add -A
29
+ git commit -m "chore: bump version to $NEXT_VERSION for development"
30
+ git push origin $GF_DEVELOP_BRANCH
31
+
32
+ # CRITICAL: Verify push and update tracking refs
33
+ git fetch origin $GF_DEVELOP_BRANCH:refs/remotes/origin/$GF_DEVELOP_BRANCH --force --quiet
34
+ LOCAL_SHA=$(git rev-parse HEAD)
35
+ REMOTE_SHA=$(git rev-parse origin/$GF_DEVELOP_BRANCH)
36
+ if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
37
+ echo "✅ Push verified - local/remote in sync"
38
+ else
39
+ echo "⚠️ Push verification FAILED"
40
+ echo " Local: $LOCAL_SHA"
41
+ echo " Remote: $REMOTE_SHA"
42
+ fi
43
+
44
+ echo "✅ Version bumped to $NEXT_VERSION"
45
+ ```