@polymorphism-tech/morph-spec 4.13.0 → 4.14.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.
@@ -82,7 +82,6 @@ cat .morph/config/config.json | grep -A3 '"architecture"'
82
82
  ```
83
83
 
84
84
  - **`"vertical-slice"`** → follow VSA implementation patterns from `framework/standards/architecture/vertical-slice/vertical-slice.md`. Each task is a complete slice (Handler + Validator + Endpoint in one folder).
85
- - **Otherwise** → follow DDD/Clean Architecture patterns. Tasks map to domain layers.
86
85
 
87
86
  ### 4. Get agent dispatch config
88
87
 
@@ -142,7 +141,6 @@ morph-spec task start $ARGUMENTS {task-id}
142
141
  # - Follow spec.md and contracts
143
142
  # - Follow coding standards from framework/standards/ and .morph/context/
144
143
  # - For VSA: create all slice files in one folder (Handler + Validator + Endpoint)
145
- # - For DDD: implement in the correct domain layer
146
144
 
147
145
  # 3. Verify before completing — run validate-feature or check your work
148
146
  # matches the spec and contracts before marking done
@@ -1,247 +1,192 @@
1
- ---
2
- description: Validate project readiness before Azure deploy — checks specs, contracts, tests, and infrastructure
3
- argument-hint: [feature-name]
4
- allowed-tools: Read, Bash, Glob, Grep
5
- ---
6
-
7
- # Pre-Flight Check for Azure Deployment
8
-
9
- Validates project readiness before deploying to Azure.
10
-
11
- ## Usage
12
-
13
- ```
14
- /morph-preflight azure
15
- ```
16
-
17
- ## Purpose
18
-
19
- Detect problems **before** deploy that would cause production failures. Saves time and avoids debugging in Azure environment.
20
-
21
- ---
22
-
23
- ## MORPH-SPEC Validation (run before all other checks)
24
-
25
- These checks verify that the morph-spec workflow is complete for the feature being deployed. Skip only if deploying a non-morph-spec project.
26
-
27
- ```bash
28
- # Verify implementation is complete
29
- morph-spec state get {feature}
30
- morph-spec approval-status {feature}
31
- morph-spec validate-feature {feature}
32
- ```
33
-
34
- | Check | Command | Pass Criteria |
35
- |-------|---------|---------------|
36
- | Phase is implement or later | `state get` | phase derived as `implement` |
37
- | All gates approved | `approval-status` | design, plan, tasks gates all approved |
38
- | Feature validation passes | `validate-feature` | 100% pass rate |
39
- | All tasks complete | `state get` → tasks array | 0 tasks in `pending` or `in_progress` |
40
- | Recap generated | Read `5-implement/recap.md` | File exists and is non-empty |
41
-
42
- **If any MORPH check fails:** Show which check failed and recommend: `Run /morph-apply {feature} to complete implementation before deploying.`
43
-
44
- ---
45
-
46
- ## Test Suite (run before infrastructure checks)
47
-
48
- ```bash
49
- dotnet test --verbosity normal
50
- ```
51
-
52
- **Pass criteria:** 100% test pass rate. Zero tolerance — any failing test blocks deployment. If tests fail, categorize each failure:
53
- - **Genuine bug** → fix implementation
54
- - **Flaky/environment test** → isolate and fix
55
- - **Outdated assertion** → update test to match correct new behavior
56
-
57
- ---
58
-
59
- ## Validations Performed
60
-
61
- ### 1. Package Version Conflicts
62
-
63
- **What it checks:**
64
- - `Azure.Identity` explicitly specified
65
- - No version conflicts (NU1605, NU1608)
66
- - Critical packages with compatible versions
67
-
68
- **How to check:**
69
- ```bash
70
- dotnet restore --verbosity normal 2>&1 | grep -E "(NU1605|NU1608|warning)"
71
- ```
72
-
73
- **Common fix:**
74
- ```xml
75
- <PackageReference Include="Azure.Identity" Version="1.14.2" />
76
- ```
77
-
78
- ---
79
-
80
- ### 2. EF Core Migrations
81
-
82
- **What it checks:**
83
- - No pending model changes
84
- - Applicable migrations exist
85
- - Migration scripts are valid
86
-
87
- **How to check:**
88
- ```bash
89
- dotnet ef migrations has-pending-model-changes \
90
- --project src/Infrastructure \
91
- --startup-project src/Web
92
- ```
93
-
94
- **Common fix:**
95
- ```bash
96
- dotnet ef migrations add <MigrationName> \
97
- --project src/Infrastructure \
98
- --startup-project src/Web
99
- ```
100
-
101
- ---
102
-
103
- ### 3. Dockerfile Validation (if Container Apps)
104
-
105
- **What it checks:**
106
- - Dockerfile exists
107
- - Base image is valid
108
- - Multi-stage build configured
109
- - EXPOSE ports correct
110
- - ENTRYPOINT defined
111
-
112
- **How to check:**
113
- ```bash
114
- docker build --check .
115
- # Or manual Dockerfile validation
116
- ```
117
-
118
- ---
119
-
120
- ### 4. Bicep Syntax Validation
121
-
122
- **What it checks:**
123
- - `.bicep` files without syntax errors
124
- - Required parameters defined
125
- - Resources with valid names
126
-
127
- **How to check:**
128
- ```bash
129
- az bicep build --file infra/main.bicep --stdout > /dev/null
130
- ```
131
-
132
- ---
133
-
134
- ### 5. Key Vault Configuration
135
-
136
- **What it checks:**
137
- - Key Vault URI configured in `appsettings.json` or environment
138
- - Key Vault not conditioned on environment (common bug)
139
- - Managed Identity enabled
140
-
141
- **How to check:**
142
- ```bash
143
- grep -r "KeyVaultUri\|AzureKeyVault" appsettings*.json
144
- grep -r "IsDevelopment()" Program.cs | grep -i keyvault
145
- ```
146
-
147
- **Anti-pattern to detect:**
148
- ```csharp
149
- // ❌ WRONG - Doesn't load Key Vault in dev!
150
- if (!builder.Environment.IsDevelopment())
151
- {
152
- builder.Configuration.AddAzureKeyVault(...);
153
- }
154
- ```
155
-
156
- ---
157
-
158
- ### 6. Connection Strings Security
159
-
160
- **What it checks:**
161
- - Connection strings not hardcoded in code
162
- - Secrets in Key Vault or User Secrets
163
- - No credentials in `appsettings.json` (except Development)
164
-
165
- **How to check:**
166
- ```bash
167
- # Detect passwords in appsettings
168
- grep -rE "(Password=|Pwd=|Secret=)" appsettings*.json | grep -v Development
169
- ```
170
-
171
- ---
172
-
173
- ## Example Output
174
-
175
- ```
176
- 🔍 MORPH Pre-Flight Check: Azure Deployment
177
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
178
-
179
- ✅ Packages: No version conflicts detected
180
- ✅ Migrations: No pending model changes
181
- ✅ Dockerfile: Valid multi-stage build
182
- ✅ Bicep: Syntax valid
183
- ❌ Key Vault: URI not configured in appsettings.Production.json
184
- ⚠️ Connection Strings: Found password in appsettings.Staging.json
185
-
186
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
187
-
188
- 📋 Summary: 4 passed, 1 failed, 1 warning
189
-
190
- ❌ BLOCKED: Fix Key Vault configuration before deploy!
191
-
192
- Recommended fixes:
193
- 1. Add KeyVaultUri to appsettings.Production.json
194
- 2. Move password from appsettings.Staging.json to Key Vault
195
- ```
196
-
197
- ---
198
-
199
- ## Usage Workflow
200
-
201
- ### Before creating PR for production
202
-
203
- ```bash
204
- /morph-preflight azure
205
- ```
206
-
207
- ### In CI/CD pipeline
208
-
209
- ```yaml
210
- - script: |
211
- # Package check
212
- dotnet restore 2>&1 | grep -E "NU1605|NU1608" && exit 1
213
-
214
- # Migration check
215
- dotnet ef migrations has-pending-model-changes \
216
- --project src/Infrastructure \
217
- --startup-project src/Web
218
- if [ $? -ne 0 ]; then exit 1; fi
219
-
220
- # Bicep check
221
- az bicep build --file infra/main.bicep --stdout > /dev/null
222
- if [ $? -ne 0 ]; then exit 1; fi
223
-
224
- echo "Pre-flight checks passed!"
225
- displayName: 'Pre-flight validation'
226
- ```
227
-
228
- ---
229
-
230
- ## Future Validations (Roadmap)
231
-
232
- - [ ] Cost estimation validation (within budget)
233
- - [ ] RBAC permissions check
234
- - [ ] Network security rules validation
235
- - [ ] Health probe endpoint exists
236
- - [ ] Application Insights configured
237
-
238
- ---
239
-
240
- ## References
241
-
242
- - [azure.md](../../standards/azure.md) - Azure Standards
243
- - [dotnet10-migration.md](../../standards/dotnet10-migration.md) - Breaking changes .NET 10
244
-
245
- ---
246
-
247
- *MORPH-SPEC by Polymorphism Tech*
1
+ ---
2
+ description: Validate project readiness before deploy — checks specs, contracts, tests, Docker, Supabase, and EasyPanel configuration
3
+ argument-hint: [feature-name]
4
+ allowed-tools: Read, Bash, Glob, Grep
5
+ ---
6
+
7
+ # Pre-Flight Check for Deployment
8
+
9
+ Validates project readiness before deploying to Docker/EasyPanel + Supabase.
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ /morph-preflight
15
+ ```
16
+
17
+ ## Purpose
18
+
19
+ Detect problems **before** deploy that would cause production failures. Saves time and avoids debugging in production.
20
+
21
+ ---
22
+
23
+ ## MORPH-SPEC Validation (run before all other checks)
24
+
25
+ These checks verify that the morph-spec workflow is complete for the feature being deployed.
26
+
27
+ ```bash
28
+ # Verify implementation is complete
29
+ morph-spec state get {feature}
30
+ morph-spec approval-status {feature}
31
+ morph-spec validate-feature {feature}
32
+ ```
33
+
34
+ | Check | Command | Pass Criteria |
35
+ |-------|---------|---------------|
36
+ | Phase is implement or later | `state get` | phase derived as `implement` |
37
+ | All gates approved | `approval-status` | design, plan, tasks gates all approved |
38
+ | Feature validation passes | `validate-feature` | 100% pass rate |
39
+ | All tasks complete | `state get` → tasks | 0 tasks in `pending` or `in_progress` |
40
+ | Recap generated | Read `5-implement/recap.md` | File exists and is non-empty |
41
+
42
+ **If any MORPH check fails:** Show which check failed and recommend: `Run /morph-apply {feature} to complete implementation before deploying.`
43
+
44
+ ---
45
+
46
+ ## Test Suite (run before infrastructure checks)
47
+
48
+ ```bash
49
+ dotnet test --verbosity normal
50
+ ```
51
+
52
+ **Pass criteria:** 100% test pass rate. Zero tolerance — any failing test blocks deployment.
53
+
54
+ ---
55
+
56
+ ## Validations Performed
57
+
58
+ ### 1. Package Version Conflicts
59
+
60
+ **What it checks:**
61
+ - No version conflicts (NU1605, NU1608)
62
+ - Critical packages with compatible versions
63
+
64
+ **How to check:**
65
+ ```bash
66
+ dotnet restore --verbosity normal 2>&1 | grep -E "(NU1605|NU1608|warning)"
67
+ ```
68
+
69
+ ---
70
+
71
+ ### 2. Supabase Migrations
72
+
73
+ **What it checks:**
74
+ - No pending migrations
75
+ - RLS policies defined for all public tables
76
+ - Database schema matches expected state
77
+
78
+ **How to check:**
79
+ ```bash
80
+ # Check for pending migrations
81
+ npx supabase db diff --local
82
+
83
+ # Verify RLS is enabled on all tables
84
+ npx supabase db lint --level warning
85
+ ```
86
+
87
+ **Common fix:**
88
+ ```bash
89
+ npx supabase migration new <migration-name>
90
+ ```
91
+
92
+ ---
93
+
94
+ ### 3. Dockerfile Validation
95
+
96
+ **What it checks:**
97
+ - Dockerfile exists for each service (API, Web)
98
+ - Multi-stage build configured
99
+ - EXPOSE ports correct
100
+ - ENTRYPOINT defined
101
+ - .dockerignore present
102
+
103
+ **How to check:**
104
+ ```bash
105
+ # Validate API Dockerfile
106
+ docker build --check -f Dockerfile.api .
107
+
108
+ # Validate Web Dockerfile
109
+ docker build --check -f Dockerfile.web .
110
+ ```
111
+
112
+ ---
113
+
114
+ ### 4. Docker Compose
115
+
116
+ **What it checks:**
117
+ - `docker-compose.yml` exists and is valid
118
+ - All services have health checks
119
+ - Environment variables reference `.env` (not hardcoded)
120
+ - Volumes mapped correctly
121
+
122
+ **How to check:**
123
+ ```bash
124
+ docker compose config --quiet
125
+ ```
126
+
127
+ ---
128
+
129
+ ### 5. Environment Variables & Secrets
130
+
131
+ **What it checks:**
132
+ - Connection strings not hardcoded in code
133
+ - Secrets in environment variables (not in appsettings)
134
+ - `.env.example` exists with all required vars documented
135
+ - No credentials in source code
136
+
137
+ **How to check:**
138
+ ```bash
139
+ # Detect passwords in appsettings
140
+ grep -rE "(Password=|Pwd=|Secret=|sk_live|pk_live)" appsettings*.json src/ --include="*.cs" --include="*.json" | grep -v Development
141
+
142
+ # Verify .env.example exists
143
+ test -f .env.example && echo "OK" || echo "MISSING .env.example"
144
+ ```
145
+
146
+ ---
147
+
148
+ ### 6. EasyPanel Configuration
149
+
150
+ **What it checks:**
151
+ - Services correctly defined for EasyPanel
152
+ - Health check endpoints exist (`/health` or `/healthz`)
153
+ - Port mappings match Dockerfile EXPOSE
154
+
155
+ **How to check:**
156
+ ```bash
157
+ # Verify health endpoint exists in code
158
+ grep -rn "MapGet.*health" src/ --include="*.cs"
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Example Output
164
+
165
+ ```
166
+ MORPH Pre-Flight Check: Deployment
167
+
168
+ Packages: No version conflicts detected
169
+ Migrations: No pending changes
170
+ Dockerfile: Valid multi-stage build (API + Web)
171
+ Docker Compose: Valid configuration
172
+ Secrets: No hardcoded credentials found
173
+ EasyPanel: Health endpoint found at /healthz
174
+
175
+ Summary: 6 passed, 0 failed, 0 warnings
176
+
177
+ READY TO DEPLOY
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Usage Workflow
183
+
184
+ ### Before creating PR for production
185
+
186
+ ```bash
187
+ /morph-preflight
188
+ ```
189
+
190
+ ---
191
+
192
+ *MORPH-SPEC by Polymorphism Tech*