@polymorphism-tech/morph-spec 4.9.0 → 4.10.1
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.
- package/README.md +2 -2
- package/bin/morph-spec.js +30 -0
- package/bin/task-manager.js +34 -22
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +35 -98
- package/framework/agents/backend/api-designer.md +3 -0
- package/framework/agents/backend/dotnet-senior.md +3 -0
- package/framework/agents/backend/ef-modeler.md +2 -0
- package/framework/agents/backend/hangfire-orchestrator.md +2 -0
- package/framework/agents/backend/ms-agent-expert.md +2 -0
- package/framework/agents/frontend/blazor-builder.md +2 -0
- package/framework/agents/frontend/nextjs-expert.md +2 -0
- package/framework/agents/infrastructure/azure-architect.md +2 -0
- package/framework/agents/infrastructure/azure-deploy-specialist.md +2 -0
- package/framework/agents/infrastructure/bicep-architect.md +2 -0
- package/framework/agents/infrastructure/container-specialist.md +2 -0
- package/framework/agents/infrastructure/devops-engineer.md +3 -0
- package/framework/agents/infrastructure/infra-architect.md +3 -0
- package/framework/agents/integrations/asaas-financial.md +2 -0
- package/framework/agents/integrations/azure-identity.md +2 -0
- package/framework/agents/integrations/clerk-auth.md +3 -0
- package/framework/agents/integrations/hangfire-integration.md +2 -0
- package/framework/agents/integrations/resend-email.md +2 -0
- package/framework/agents.json +37 -7
- package/framework/commands/commit.md +166 -0
- package/framework/commands/morph-apply.md +156 -155
- package/framework/commands/morph-archive.md +33 -27
- package/framework/commands/morph-infra.md +83 -77
- package/framework/commands/morph-preflight.md +97 -55
- package/framework/commands/morph-proposal.md +131 -58
- package/framework/commands/morph-status.md +36 -30
- package/framework/commands/morph-troubleshoot.md +68 -59
- package/framework/hooks/claude-code/notification/approval-reminder.js +3 -2
- package/framework/hooks/claude-code/post-tool-use/dispatch.js +154 -31
- package/framework/hooks/claude-code/post-tool-use/skill-reminder.js +7 -84
- package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +8 -17
- package/framework/hooks/claude-code/pre-compact/save-morph-context.js +16 -3
- package/framework/hooks/claude-code/pre-tool-use/enforce-phase-writes.js +4 -3
- package/framework/hooks/claude-code/pre-tool-use/protect-spec-files.js +3 -2
- package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +60 -0
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +55 -2
- package/framework/hooks/claude-code/session-start/post-compact-restore.js +41 -0
- package/framework/hooks/claude-code/stop/validate-completion.js +2 -15
- package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +23 -5
- package/framework/hooks/shared/compact-restore.js +100 -0
- package/framework/hooks/shared/dispatch-helpers.js +116 -0
- package/framework/hooks/shared/phase-utils.js +9 -5
- package/framework/hooks/shared/state-reader.js +27 -3
- package/framework/phases.json +30 -7
- package/framework/rules/csharp-standards.md +3 -0
- package/framework/rules/frontend-standards.md +2 -0
- package/framework/rules/infrastructure-standards.md +3 -0
- package/framework/rules/morph-workflow.md +143 -86
- package/framework/rules/nextjs-standards.md +2 -0
- package/framework/rules/testing-standards.md +3 -0
- package/framework/skills/level-0-meta/mcp-registry.json +86 -51
- package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +139 -0
- package/framework/skills/level-0-meta/morph-checklist/SKILL.md +42 -19
- package/framework/skills/level-0-meta/{code-review → morph-code-review}/SKILL.md +8 -5
- package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/SKILL.md +8 -6
- package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +362 -0
- package/framework/skills/level-0-meta/morph-init/SKILL.md +114 -20
- package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +362 -0
- package/framework/skills/level-0-meta/morph-replicate/SKILL.md +95 -87
- package/framework/skills/level-0-meta/{simulation-checklist → morph-simulation-checklist}/SKILL.md +24 -0
- package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/SKILL.md +43 -43
- package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/references/tools-per-phase.md +1 -2
- package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/SKILL.md +23 -12
- package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/scripts/check-phase-outputs.mjs +2 -2
- package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +247 -0
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +270 -0
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +499 -0
- package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +38 -0
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +472 -0
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +50 -0
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +45 -0
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +47 -0
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +246 -0
- package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +238 -0
- package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +14 -0
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +312 -0
- package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/scripts/validate-tasks.mjs +3 -3
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +324 -0
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +146 -0
- package/framework/standards/integration/mcp/mcp-tools.md +25 -7
- package/framework/templates/docs/onboarding.md +2 -2
- package/package.json +3 -4
- package/src/commands/agents/dispatch-agents.js +50 -3
- package/src/commands/mcp/mcp-setup.js +39 -2
- package/src/commands/phase/phase-reset.js +74 -0
- package/src/commands/project/doctor.js +26 -7
- package/src/commands/project/update.js +4 -4
- package/src/commands/scope/escalate.js +215 -0
- package/src/commands/state/advance-phase.js +27 -53
- package/src/commands/state/state.js +1 -1
- package/src/commands/task/expand.js +100 -0
- package/src/core/paths/output-schema.js +4 -3
- package/src/core/state/phase-state-machine.js +7 -4
- package/src/core/state/state-manager.js +4 -3
- package/src/lib/detectors/claude-config-detector.js +93 -347
- package/src/lib/detectors/design-system-detector.js +189 -189
- package/src/lib/detectors/index.js +155 -57
- package/src/lib/generators/context-generator.js +2 -2
- package/src/lib/installers/mcp-installer.js +37 -5
- package/src/lib/phase-chain/phase-validator.js +22 -16
- package/src/lib/scope/impact-analyzer.js +106 -0
- package/src/lib/stack-filter.js +58 -0
- package/src/lib/tasks/task-parser.js +1 -1
- package/src/lib/validators/shared/emit-validator-dispatch.js +64 -0
- package/src/scripts/setup-infra.js +68 -18
- package/src/utils/agents-installer.js +51 -17
- package/src/utils/claude-md-injector.js +90 -0
- package/src/utils/file-copier.js +0 -1
- package/src/utils/hooks-installer.js +16 -5
- package/src/utils/skills-installer.js +67 -7
- package/CLAUDE.md +0 -98
- package/framework/memory/patterns-learned.md +0 -766
- package/framework/skills/level-0-meta/brainstorming/SKILL.md +0 -137
- package/framework/skills/level-0-meta/frontend-review/SKILL.md +0 -359
- package/framework/skills/level-0-meta/post-implementation/SKILL.md +0 -362
- package/framework/skills/level-0-meta/terminal-title/SKILL.md +0 -61
- package/framework/skills/level-0-meta/terminal-title/scripts/set_title.sh +0 -65
- package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +0 -216
- package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +0 -252
- package/framework/skills/level-1-workflows/phase-design/SKILL.md +0 -383
- package/framework/skills/level-1-workflows/phase-implement/SKILL.md +0 -492
- package/framework/skills/level-1-workflows/phase-setup/SKILL.md +0 -195
- package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +0 -271
- package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +0 -286
- package/src/commands/project/index.js +0 -8
- package/src/core/index.js +0 -10
- package/src/core/state/index.js +0 -8
- package/src/core/templates/index.js +0 -9
- package/src/core/templates/template-data-sources.js +0 -325
- package/src/core/workflows/index.js +0 -7
- package/src/lib/detectors/config-detector.js +0 -223
- package/src/lib/detectors/standards-generator.js +0 -335
- package/src/lib/detectors/structure-detector.js +0 -275
- package/src/lib/monitor/agent-resolver.js +0 -144
- package/src/lib/monitor/renderer.js +0 -230
- package/src/lib/orchestration/index.js +0 -7
- package/src/lib/orchestration/team-orchestrator.js +0 -404
- package/src/sanitizer/context-sanitizer.js +0 -221
- package/src/sanitizer/patterns.js +0 -163
- package/src/writer/file-writer.js +0 -86
- /package/framework/skills/level-0-meta/{brainstorming → morph-brainstorming}/references/proposal-example.md +0 -0
- /package/framework/skills/level-0-meta/{code-review → morph-code-review}/references/review-example.md +0 -0
- /package/framework/skills/level-0-meta/{code-review → morph-code-review}/references/review-guidelines.md +0 -0
- /package/framework/skills/level-0-meta/{code-review → morph-code-review}/scripts/scan-csharp.mjs +0 -0
- /package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/references/review-example-nextjs.md +0 -0
- /package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/scripts/scan-nextjs.mjs +0 -0
- /package/framework/skills/level-0-meta/{frontend-review → morph-frontend-review}/scripts/scan-accessibility.mjs +0 -0
- /package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/scripts/detect-dev-server.mjs +0 -0
- /package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/scripts/detect-stack.mjs +0 -0
- /package/framework/skills/level-1-workflows/{phase-clarify → morph-phase-clarify}/references/clarifications-example.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/architecture-analysis-guide.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/spec-authoring-guide.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/spec-example.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/references/recap-example.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/references/vsa-implementation-guide.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/references/task-planning-patterns.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/references/tasks-example.md +0 -0
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Manage Azure infrastructure with Bicep templates — provision, update, and monitor cloud resources
|
|
3
|
+
argument-hint: [up|down|plan|status]
|
|
4
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# /morph-infra - Infrastructure Management
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
Manage Azure infrastructure using Bicep templates.
|
|
4
10
|
|
|
5
|
-
##
|
|
11
|
+
## Usage
|
|
6
12
|
|
|
7
13
|
```
|
|
8
14
|
/morph-infra [action] [options]
|
|
@@ -10,23 +16,23 @@ Gerencia infraestrutura Azure usando Bicep templates.
|
|
|
10
16
|
|
|
11
17
|
### Actions
|
|
12
18
|
|
|
13
|
-
| Action |
|
|
14
|
-
|
|
15
|
-
| `init` |
|
|
16
|
-
| `validate` |
|
|
17
|
-
| `plan` |
|
|
18
|
-
| `deploy` |
|
|
19
|
-
| `destroy` | Remove
|
|
19
|
+
| Action | Description |
|
|
20
|
+
|--------|-------------|
|
|
21
|
+
| `init` | Initialize IaC structure in the project |
|
|
22
|
+
| `validate` | Validate Bicep templates |
|
|
23
|
+
| `plan` | Show what-if of changes |
|
|
24
|
+
| `deploy` | Execute resource deployment |
|
|
25
|
+
| `destroy` | Remove all resources |
|
|
20
26
|
|
|
21
27
|
---
|
|
22
28
|
|
|
23
29
|
## Workflow
|
|
24
30
|
|
|
25
|
-
### 1. INIT -
|
|
31
|
+
### 1. INIT - Initialize IaC
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
When the user requests `/morph-infra init`:
|
|
28
34
|
|
|
29
|
-
1.
|
|
35
|
+
1. Create the `infra/` structure in the project:
|
|
30
36
|
```
|
|
31
37
|
infra/
|
|
32
38
|
├── main.bicep
|
|
@@ -41,42 +47,42 @@ Quando o usuário solicitar `/morph-infra init`:
|
|
|
41
47
|
└── app-insights.bicep
|
|
42
48
|
```
|
|
43
49
|
|
|
44
|
-
2.
|
|
50
|
+
2. Copy templates from `.morph/framework/templates/infrastructure/...`
|
|
45
51
|
|
|
46
|
-
3.
|
|
47
|
-
- `{{APP_NAME}}` →
|
|
48
|
-
- `{{SUBSCRIPTION_ID}}` →
|
|
49
|
-
- `{{RESOURCE_GROUP}}` →
|
|
52
|
+
3. Replace placeholders:
|
|
53
|
+
- `{{APP_NAME}}` → project name
|
|
54
|
+
- `{{SUBSCRIPTION_ID}}` → request from user
|
|
55
|
+
- `{{RESOURCE_GROUP}}` → suggest default `rg-{app}-{env}`
|
|
50
56
|
|
|
51
|
-
4.
|
|
57
|
+
4. Document the created structure in `decisions.md`
|
|
52
58
|
|
|
53
59
|
---
|
|
54
60
|
|
|
55
|
-
### 2. VALIDATE -
|
|
61
|
+
### 2. VALIDATE - Validate Templates
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
When the user requests `/morph-infra validate`:
|
|
58
64
|
|
|
59
|
-
1.
|
|
65
|
+
1. Run Bicep validation:
|
|
60
66
|
```bash
|
|
61
67
|
az bicep build --file infra/main.bicep
|
|
62
68
|
```
|
|
63
69
|
|
|
64
|
-
2.
|
|
70
|
+
2. Check required parameters
|
|
65
71
|
|
|
66
|
-
3.
|
|
72
|
+
3. Report errors or success
|
|
67
73
|
|
|
68
74
|
---
|
|
69
75
|
|
|
70
|
-
### 3. PLAN - Preview
|
|
76
|
+
### 3. PLAN - Preview Changes
|
|
71
77
|
|
|
72
|
-
|
|
78
|
+
When the user requests `/morph-infra plan [env]`:
|
|
73
79
|
|
|
74
|
-
1.
|
|
80
|
+
1. Check if Azure CLI is authenticated:
|
|
75
81
|
```bash
|
|
76
82
|
az account show
|
|
77
83
|
```
|
|
78
84
|
|
|
79
|
-
2.
|
|
85
|
+
2. Run what-if:
|
|
80
86
|
```bash
|
|
81
87
|
az deployment group what-if \
|
|
82
88
|
--resource-group rg-{app}-{env} \
|
|
@@ -84,28 +90,28 @@ Quando o usuário solicitar `/morph-infra plan [env]`:
|
|
|
84
90
|
--parameters @infra/parameters.{env}.json
|
|
85
91
|
```
|
|
86
92
|
|
|
87
|
-
3.
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
93
|
+
3. Present change summary:
|
|
94
|
+
- Resources to create
|
|
95
|
+
- Resources to modify
|
|
96
|
+
- Resources to delete
|
|
97
|
+
- Estimated costs
|
|
92
98
|
|
|
93
|
-
4.
|
|
99
|
+
4. **STOP and wait for approval** before deploy
|
|
94
100
|
|
|
95
101
|
---
|
|
96
102
|
|
|
97
|
-
### 4. DEPLOY -
|
|
103
|
+
### 4. DEPLOY - Execute Deploy
|
|
98
104
|
|
|
99
|
-
|
|
105
|
+
When the user requests `/morph-infra deploy [env]`:
|
|
100
106
|
|
|
101
|
-
1.
|
|
107
|
+
1. Verify plan was approved
|
|
102
108
|
|
|
103
|
-
2.
|
|
109
|
+
2. Create resource group if it doesn't exist:
|
|
104
110
|
```bash
|
|
105
111
|
az group create --name rg-{app}-{env} --location brazilsouth
|
|
106
112
|
```
|
|
107
113
|
|
|
108
|
-
3.
|
|
114
|
+
3. Execute deploy:
|
|
109
115
|
```bash
|
|
110
116
|
az deployment group create \
|
|
111
117
|
--resource-group rg-{app}-{env} \
|
|
@@ -113,75 +119,75 @@ Quando o usuário solicitar `/morph-infra deploy [env]`:
|
|
|
113
119
|
--parameters @infra/parameters.{env}.json
|
|
114
120
|
```
|
|
115
121
|
|
|
116
|
-
4.
|
|
122
|
+
4. Capture outputs:
|
|
117
123
|
- Container App URL
|
|
118
124
|
- SQL Connection String
|
|
119
125
|
- Key Vault URI
|
|
120
126
|
|
|
121
|
-
5.
|
|
127
|
+
5. Update documentation with deploy information
|
|
122
128
|
|
|
123
129
|
---
|
|
124
130
|
|
|
125
|
-
### 5. DESTROY -
|
|
131
|
+
### 5. DESTROY - Remove Resources
|
|
126
132
|
|
|
127
|
-
|
|
133
|
+
When the user requests `/morph-infra destroy [env]`:
|
|
128
134
|
|
|
129
|
-
1.
|
|
135
|
+
1. **WARN** that this action is irreversible
|
|
130
136
|
|
|
131
|
-
2.
|
|
137
|
+
2. List resources that will be deleted
|
|
132
138
|
|
|
133
|
-
3.
|
|
139
|
+
3. **STOP and wait for explicit confirmation** ("yes, delete")
|
|
134
140
|
|
|
135
|
-
4.
|
|
141
|
+
4. Execute:
|
|
136
142
|
```bash
|
|
137
143
|
az group delete --name rg-{app}-{env} --yes --no-wait
|
|
138
144
|
```
|
|
139
145
|
|
|
140
146
|
---
|
|
141
147
|
|
|
142
|
-
##
|
|
148
|
+
## Security Rules
|
|
143
149
|
|
|
144
|
-
###
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
150
|
+
### NEVER:
|
|
151
|
+
- Expose secrets in logs
|
|
152
|
+
- Commit files with secrets
|
|
153
|
+
- Delete production resources without explicit confirmation
|
|
154
|
+
- Create resources outside Bicep (zero portal)
|
|
149
155
|
|
|
150
|
-
###
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
+
### ALWAYS:
|
|
157
|
+
- Use Key Vault for secrets
|
|
158
|
+
- Validate Bicep before deploy
|
|
159
|
+
- Run what-if before deploy
|
|
160
|
+
- Document estimated costs
|
|
161
|
+
- Keep parameters.json separated by environment
|
|
156
162
|
|
|
157
163
|
---
|
|
158
164
|
|
|
159
165
|
## Cost Guardian Integration
|
|
160
166
|
|
|
161
|
-
|
|
167
|
+
Before any deploy, check with Cost Guardian:
|
|
162
168
|
|
|
163
|
-
1.
|
|
164
|
-
2.
|
|
165
|
-
- Free tier:
|
|
166
|
-
-
|
|
167
|
-
-
|
|
169
|
+
1. Estimate monthly resource costs
|
|
170
|
+
2. Verify it's within approved limits:
|
|
171
|
+
- Free tier: no approval needed
|
|
172
|
+
- Up to $10/month: requires confirmation
|
|
173
|
+
- Above $10: requires ADR
|
|
168
174
|
|
|
169
175
|
---
|
|
170
176
|
|
|
171
|
-
##
|
|
177
|
+
## Usage Example
|
|
172
178
|
|
|
173
179
|
```
|
|
174
|
-
|
|
175
|
-
Claude:
|
|
180
|
+
User: /morph-infra init
|
|
181
|
+
Claude: Creating IaC structure...
|
|
176
182
|
- infra/main.bicep
|
|
177
183
|
- infra/parameters.dev.json
|
|
178
184
|
- infra/modules/*.bicep
|
|
179
|
-
|
|
185
|
+
Done! Run /morph-infra validate to verify.
|
|
180
186
|
|
|
181
|
-
|
|
182
|
-
Claude:
|
|
187
|
+
User: /morph-infra plan dev
|
|
188
|
+
Claude: Analyzing changes for dev environment...
|
|
183
189
|
|
|
184
|
-
|
|
190
|
+
CREATE:
|
|
185
191
|
+ Container App Environment
|
|
186
192
|
+ Container App
|
|
187
193
|
+ SQL Server (Free)
|
|
@@ -189,14 +195,14 @@ Claude: Analisando mudanças para ambiente dev...
|
|
|
189
195
|
+ Key Vault
|
|
190
196
|
+ Application Insights
|
|
191
197
|
|
|
192
|
-
|
|
198
|
+
ESTIMATED COST: ~$0/month (Free tier)
|
|
193
199
|
|
|
194
|
-
|
|
200
|
+
Approve deploy? (yes/no)
|
|
195
201
|
|
|
196
|
-
|
|
197
|
-
Claude:
|
|
198
|
-
✓ Resource Group
|
|
199
|
-
✓ Deploy
|
|
202
|
+
User: yes
|
|
203
|
+
Claude: Executing deploy...
|
|
204
|
+
✓ Resource Group created
|
|
205
|
+
✓ Deploy completed in 3m 45s
|
|
200
206
|
|
|
201
207
|
OUTPUTS:
|
|
202
208
|
- URL: https://myapp-dev.azurecontainerapps.io
|
|
@@ -1,34 +1,76 @@
|
|
|
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
|
+
|
|
1
7
|
# Pre-Flight Check for Azure Deployment
|
|
2
8
|
|
|
3
9
|
Validates project readiness before deploying to Azure.
|
|
4
10
|
|
|
5
|
-
##
|
|
11
|
+
## Usage
|
|
6
12
|
|
|
7
13
|
```
|
|
8
14
|
/morph-preflight azure
|
|
9
15
|
```
|
|
10
16
|
|
|
11
|
-
##
|
|
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
|
+
npx morph-spec state get {feature}
|
|
30
|
+
npx morph-spec approval-status {feature}
|
|
31
|
+
npx 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
|
+
```
|
|
12
51
|
|
|
13
|
-
|
|
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
|
|
14
56
|
|
|
15
57
|
---
|
|
16
58
|
|
|
17
|
-
##
|
|
59
|
+
## Validations Performed
|
|
18
60
|
|
|
19
61
|
### 1. Package Version Conflicts
|
|
20
62
|
|
|
21
|
-
**
|
|
22
|
-
- `Azure.Identity`
|
|
23
|
-
-
|
|
24
|
-
-
|
|
63
|
+
**What it checks:**
|
|
64
|
+
- `Azure.Identity` explicitly specified
|
|
65
|
+
- No version conflicts (NU1605, NU1608)
|
|
66
|
+
- Critical packages with compatible versions
|
|
25
67
|
|
|
26
|
-
**
|
|
68
|
+
**How to check:**
|
|
27
69
|
```bash
|
|
28
70
|
dotnet restore --verbosity normal 2>&1 | grep -E "(NU1605|NU1608|warning)"
|
|
29
71
|
```
|
|
30
72
|
|
|
31
|
-
**
|
|
73
|
+
**Common fix:**
|
|
32
74
|
```xml
|
|
33
75
|
<PackageReference Include="Azure.Identity" Version="1.14.2" />
|
|
34
76
|
```
|
|
@@ -37,19 +79,19 @@ dotnet restore --verbosity normal 2>&1 | grep -E "(NU1605|NU1608|warning)"
|
|
|
37
79
|
|
|
38
80
|
### 2. EF Core Migrations
|
|
39
81
|
|
|
40
|
-
**
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- Migration scripts
|
|
82
|
+
**What it checks:**
|
|
83
|
+
- No pending model changes
|
|
84
|
+
- Applicable migrations exist
|
|
85
|
+
- Migration scripts are valid
|
|
44
86
|
|
|
45
|
-
**
|
|
87
|
+
**How to check:**
|
|
46
88
|
```bash
|
|
47
89
|
dotnet ef migrations has-pending-model-changes \
|
|
48
90
|
--project src/Infrastructure \
|
|
49
91
|
--startup-project src/Web
|
|
50
92
|
```
|
|
51
93
|
|
|
52
|
-
**
|
|
94
|
+
**Common fix:**
|
|
53
95
|
```bash
|
|
54
96
|
dotnet ef migrations add <MigrationName> \
|
|
55
97
|
--project src/Infrastructure \
|
|
@@ -58,30 +100,30 @@ dotnet ef migrations add <MigrationName> \
|
|
|
58
100
|
|
|
59
101
|
---
|
|
60
102
|
|
|
61
|
-
### 3. Dockerfile Validation (
|
|
103
|
+
### 3. Dockerfile Validation (if Container Apps)
|
|
62
104
|
|
|
63
|
-
**
|
|
64
|
-
- Dockerfile
|
|
65
|
-
- Base image
|
|
66
|
-
- Multi-stage build
|
|
67
|
-
- EXPOSE ports
|
|
68
|
-
- ENTRYPOINT
|
|
105
|
+
**What it checks:**
|
|
106
|
+
- Dockerfile exists
|
|
107
|
+
- Base image is valid
|
|
108
|
+
- Multi-stage build configured
|
|
109
|
+
- EXPOSE ports correct
|
|
110
|
+
- ENTRYPOINT defined
|
|
69
111
|
|
|
70
|
-
**
|
|
112
|
+
**How to check:**
|
|
71
113
|
```bash
|
|
72
114
|
docker build --check .
|
|
73
|
-
#
|
|
115
|
+
# Or manual Dockerfile validation
|
|
74
116
|
```
|
|
75
117
|
|
|
76
118
|
---
|
|
77
119
|
|
|
78
120
|
### 4. Blazor .NET 10 Assets
|
|
79
121
|
|
|
80
|
-
**
|
|
81
|
-
- `RequiresAspNetWebAssets`
|
|
82
|
-
- Static web assets
|
|
122
|
+
**What it checks:**
|
|
123
|
+
- `RequiresAspNetWebAssets` is `true` (if Blazor + .NET 10)
|
|
124
|
+
- Static web assets configured correctly
|
|
83
125
|
|
|
84
|
-
**
|
|
126
|
+
**How to check:**
|
|
85
127
|
```bash
|
|
86
128
|
grep -r "RequiresAspNetWebAssets" *.csproj
|
|
87
129
|
```
|
|
@@ -97,12 +139,12 @@ grep -r "RequiresAspNetWebAssets" *.csproj
|
|
|
97
139
|
|
|
98
140
|
### 5. Bicep Syntax Validation
|
|
99
141
|
|
|
100
|
-
**
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
- Resources
|
|
142
|
+
**What it checks:**
|
|
143
|
+
- `.bicep` files without syntax errors
|
|
144
|
+
- Required parameters defined
|
|
145
|
+
- Resources with valid names
|
|
104
146
|
|
|
105
|
-
**
|
|
147
|
+
**How to check:**
|
|
106
148
|
```bash
|
|
107
149
|
az bicep build --file infra/main.bicep --stdout > /dev/null
|
|
108
150
|
```
|
|
@@ -111,20 +153,20 @@ az bicep build --file infra/main.bicep --stdout > /dev/null
|
|
|
111
153
|
|
|
112
154
|
### 6. Key Vault Configuration
|
|
113
155
|
|
|
114
|
-
**
|
|
115
|
-
- Key Vault URI
|
|
116
|
-
-
|
|
117
|
-
- Managed Identity
|
|
156
|
+
**What it checks:**
|
|
157
|
+
- Key Vault URI configured in `appsettings.json` or environment
|
|
158
|
+
- Key Vault not conditioned on environment (common bug)
|
|
159
|
+
- Managed Identity enabled
|
|
118
160
|
|
|
119
|
-
**
|
|
161
|
+
**How to check:**
|
|
120
162
|
```bash
|
|
121
163
|
grep -r "KeyVaultUri\|AzureKeyVault" appsettings*.json
|
|
122
164
|
grep -r "IsDevelopment()" Program.cs | grep -i keyvault
|
|
123
165
|
```
|
|
124
166
|
|
|
125
|
-
**Anti-pattern
|
|
167
|
+
**Anti-pattern to detect:**
|
|
126
168
|
```csharp
|
|
127
|
-
// ❌
|
|
169
|
+
// ❌ WRONG - Doesn't load Key Vault in dev!
|
|
128
170
|
if (!builder.Environment.IsDevelopment())
|
|
129
171
|
{
|
|
130
172
|
builder.Configuration.AddAzureKeyVault(...);
|
|
@@ -135,20 +177,20 @@ if (!builder.Environment.IsDevelopment())
|
|
|
135
177
|
|
|
136
178
|
### 7. Connection Strings Security
|
|
137
179
|
|
|
138
|
-
**
|
|
139
|
-
- Connection strings
|
|
140
|
-
- Secrets
|
|
141
|
-
-
|
|
180
|
+
**What it checks:**
|
|
181
|
+
- Connection strings not hardcoded in code
|
|
182
|
+
- Secrets in Key Vault or User Secrets
|
|
183
|
+
- No credentials in `appsettings.json` (except Development)
|
|
142
184
|
|
|
143
|
-
**
|
|
185
|
+
**How to check:**
|
|
144
186
|
```bash
|
|
145
|
-
#
|
|
187
|
+
# Detect passwords in appsettings
|
|
146
188
|
grep -rE "(Password=|Pwd=|Secret=)" appsettings*.json | grep -v Development
|
|
147
189
|
```
|
|
148
190
|
|
|
149
191
|
---
|
|
150
192
|
|
|
151
|
-
## Output
|
|
193
|
+
## Example Output
|
|
152
194
|
|
|
153
195
|
```
|
|
154
196
|
🔍 MORPH Pre-Flight Check: Azure Deployment
|
|
@@ -175,15 +217,15 @@ Recommended fixes:
|
|
|
175
217
|
|
|
176
218
|
---
|
|
177
219
|
|
|
178
|
-
## Workflow
|
|
220
|
+
## Usage Workflow
|
|
179
221
|
|
|
180
|
-
###
|
|
222
|
+
### Before creating PR for production
|
|
181
223
|
|
|
182
224
|
```bash
|
|
183
225
|
/morph-preflight azure
|
|
184
226
|
```
|
|
185
227
|
|
|
186
|
-
###
|
|
228
|
+
### In CI/CD pipeline
|
|
187
229
|
|
|
188
230
|
```yaml
|
|
189
231
|
- script: |
|
|
@@ -206,9 +248,9 @@ Recommended fixes:
|
|
|
206
248
|
|
|
207
249
|
---
|
|
208
250
|
|
|
209
|
-
##
|
|
251
|
+
## Future Validations (Roadmap)
|
|
210
252
|
|
|
211
|
-
- [ ] Cost estimation validation (
|
|
253
|
+
- [ ] Cost estimation validation (within budget)
|
|
212
254
|
- [ ] RBAC permissions check
|
|
213
255
|
- [ ] Network security rules validation
|
|
214
256
|
- [ ] Health probe endpoint exists
|
|
@@ -216,9 +258,9 @@ Recommended fixes:
|
|
|
216
258
|
|
|
217
259
|
---
|
|
218
260
|
|
|
219
|
-
##
|
|
261
|
+
## References
|
|
220
262
|
|
|
221
|
-
- [azure.md](../../standards/azure.md) -
|
|
263
|
+
- [azure.md](../../standards/azure.md) - Azure Standards
|
|
222
264
|
- [dotnet10-migration.md](../../standards/dotnet10-migration.md) - Breaking changes .NET 10
|
|
223
265
|
- [blazor-efcore.md](../../../../framework/standards/blazor-efcore.md) - EF Core patterns
|
|
224
266
|
|