@polymorphism-tech/morph-spec 4.10.9 → 4.10.10

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 (114) hide show
  1. package/CLAUDE.md +3 -3
  2. package/LICENSE +71 -71
  3. package/README.md +2 -2
  4. package/bin/morph-spec.js +22 -0
  5. package/claude-plugin.json +1 -1
  6. package/docs/CHEATSHEET.md +1 -1
  7. package/docs/QUICKSTART.md +1 -1
  8. package/framework/agents/README.md +14 -14
  9. package/framework/agents/architecture/standards-architect.md +159 -159
  10. package/framework/agents/infrastructure/azure-architect.md +149 -149
  11. package/framework/agents/infrastructure/infra-architect.md +48 -48
  12. package/framework/hooks/README.md +204 -204
  13. package/framework/hooks/shared/phase-utils.js +139 -139
  14. package/framework/rules/csharp-standards.md +13 -13
  15. package/framework/rules/frontend-standards.md +13 -13
  16. package/framework/rules/infrastructure-standards.md +16 -16
  17. package/framework/rules/testing-standards.md +14 -14
  18. package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +254 -254
  19. package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +1 -1
  20. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +1 -1
  21. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +1 -1
  22. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +38 -0
  23. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +1 -1
  24. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +1 -1
  25. package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +1 -1
  26. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +14 -0
  27. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +1 -1
  28. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +1 -1
  29. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
  30. package/framework/standards/STANDARDS.json +2338 -2041
  31. package/framework/standards/frontend/nextjs/nextjs-patterns.md +17 -17
  32. package/framework/standards/infrastructure/supabase/supabase-custom-jwt.md +206 -0
  33. package/framework/templates/.idea/morph-templates.xml +92 -0
  34. package/framework/templates/.vscode/morph-templates.code-snippets +186 -0
  35. package/framework/templates/README.md +814 -814
  36. package/framework/templates/code/dotnet/contracts/Commands.cs +74 -74
  37. package/framework/templates/code/dotnet/contracts/Entities.cs +25 -25
  38. package/framework/templates/code/dotnet/contracts/Queries.cs +74 -74
  39. package/framework/templates/code/dotnet/contracts/README.md +74 -74
  40. package/framework/templates/code/dotnet/contracts/api-contracts.cs +173 -173
  41. package/framework/templates/code/dotnet/frontend/component.razor +239 -239
  42. package/framework/templates/code/dotnet/jobs/agent.cs +163 -163
  43. package/framework/templates/code/dotnet/jobs/job.cs +171 -171
  44. package/framework/templates/code/dotnet/test.cs +239 -239
  45. package/framework/templates/code/sql/rls-policy.sql +57 -57
  46. package/framework/templates/code/sql/supabase-migration.sql +100 -100
  47. package/framework/templates/code/sql/supabase-migration.template.sql +113 -113
  48. package/framework/templates/code/typescript/contracts.ts +168 -168
  49. package/framework/templates/context/CONTEXT.md +181 -181
  50. package/framework/templates/docs/proposal.md +182 -182
  51. package/framework/templates/docs/user-stories.md +34 -34
  52. package/framework/templates/examples/design-system-examples.md +357 -357
  53. package/framework/templates/examples/spec-examples.md +90 -90
  54. package/framework/templates/feature/decisions.md +187 -187
  55. package/framework/templates/feature/recap.md +146 -146
  56. package/framework/templates/feature/tasks.md +199 -199
  57. package/framework/templates/infrastructure/azure/README.md +286 -286
  58. package/framework/templates/infrastructure/azure/deploy-checklist.md +426 -426
  59. package/framework/templates/infrastructure/azure/parameters.dev.json +29 -29
  60. package/framework/templates/infrastructure/azure/parameters.prod.json +29 -29
  61. package/framework/templates/infrastructure/azure/parameters.staging.json +29 -29
  62. package/framework/templates/infrastructure/docker/docker-compose.template.yml +67 -67
  63. package/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -38
  64. package/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -48
  65. package/framework/templates/infrastructure/docker/easypanel.template.json +54 -54
  66. package/package.json +1 -1
  67. package/src/commands/agents/dispatch-agents.js +17 -0
  68. package/src/commands/agents/index.js +13 -13
  69. package/src/commands/agents/project-metrics.js +74 -0
  70. package/src/commands/project/install-plugin-cmd.js +28 -28
  71. package/src/commands/project/setup-infra-cmd.js +12 -12
  72. package/src/commands/standards/context-budget.js +89 -0
  73. package/src/commands/tasks/index.js +4 -4
  74. package/src/commands/templates/index.js +5 -5
  75. package/src/commands/utils/index.js +3 -3
  76. package/src/commands/validation/index.js +4 -4
  77. package/src/core/state/phase-state-machine.js +217 -217
  78. package/src/lib/agents/metrics-aggregator.js +56 -0
  79. package/src/lib/generators/design-system-generator.js +298 -298
  80. package/src/lib/generators/index.js +10 -10
  81. package/src/lib/generators/metadata-extractor.js +387 -387
  82. package/src/lib/stack-filter.js +65 -65
  83. package/src/lib/standards/digest-builder.js +57 -3
  84. package/src/lib/standards/index.js +7 -7
  85. package/src/lib/standards/standards-context-injector.js +302 -302
  86. package/src/lib/validators/architecture/architecture-validator.js +387 -387
  87. package/src/lib/validators/architecture/index.js +7 -7
  88. package/src/lib/validators/blazor/blazor-concurrency-analyzer.js +316 -316
  89. package/src/lib/validators/blazor/blazor-state-validator.js +279 -279
  90. package/src/lib/validators/blazor/blazor-validator.js +369 -369
  91. package/src/lib/validators/blazor/index.js +9 -9
  92. package/src/lib/validators/content/content-validator.js +287 -287
  93. package/src/lib/validators/content/index.js +7 -7
  94. package/src/lib/validators/contracts/index.js +7 -7
  95. package/src/lib/validators/css/css-validator.js +352 -352
  96. package/src/lib/validators/css/index.js +7 -7
  97. package/src/lib/validators/design-system/design-system-validator.js +231 -231
  98. package/src/lib/validators/design-system/index.js +7 -7
  99. package/src/lib/validators/nextjs/index.js +6 -6
  100. package/src/lib/validators/nextjs/next-component-validator.js +183 -183
  101. package/src/lib/validators/packages/index.js +7 -7
  102. package/src/lib/validators/packages/package-validator.js +360 -360
  103. package/src/lib/validators/shared/index.js +12 -12
  104. package/src/lib/validators/shared/issue-counter.js +18 -18
  105. package/src/lib/validators/shared/result-formatter.js +124 -124
  106. package/src/lib/validators/ui/index.js +7 -7
  107. package/src/lib/validators/ui/ui-contrast-validator.js +422 -422
  108. package/src/scripts/global-install.js +58 -58
  109. package/src/scripts/install-plugin.js +126 -126
  110. package/src/utils/claude-md-injector.js +90 -90
  111. package/src/utils/file-copier.js +200 -200
  112. package/src/utils/logger.js +32 -32
  113. package/src/utils/skills-installer.js +178 -178
  114. package/src/utils/version-checker.js +175 -175
package/CLAUDE.md CHANGED
@@ -1,3 +1,3 @@
1
- # Project
2
-
3
- @.claude/CLAUDE.md
1
+ # Project
2
+
3
+ @.claude/CLAUDE.md
package/LICENSE CHANGED
@@ -1,71 +1,71 @@
1
- Proprietary License
2
-
3
- Copyright (c) 2024-2025 Polymorphism Tech
4
- All rights reserved.
5
-
6
- MORPH-SPEC Framework - Proprietary Software License
7
-
8
- 1. GRANT OF LICENSE
9
-
10
- Subject to the terms and conditions of this License, Polymorphism Tech ("Licensor")
11
- grants you a limited, non-exclusive, non-transferable license to:
12
-
13
- a) Install and use the MORPH-SPEC CLI tool for personal or commercial projects
14
- b) Use the generated templates and code in your own projects
15
- c) Modify generated code for your specific use cases
16
-
17
- 2. RESTRICTIONS
18
-
19
- You may NOT:
20
-
21
- a) Redistribute, sell, lease, or sublicense the MORPH-SPEC framework itself
22
- b) Modify, decompile, reverse engineer, or create derivative works of the framework
23
- c) Remove or modify any copyright notices or proprietary markings
24
- d) Use the framework to create competing products or services
25
- e) Publicly fork or redistribute the source code
26
- f) Share access credentials to private repositories
27
-
28
- 3. OWNERSHIP
29
-
30
- The MORPH-SPEC framework, including all code, documentation, templates, and
31
- associated materials, remains the exclusive property of Polymorphism Tech.
32
-
33
- 4. GENERATED CODE
34
-
35
- Code and projects generated using MORPH-SPEC are yours to use, modify, and
36
- distribute as you see fit, including commercial use.
37
-
38
- 5. SUPPORT AND UPDATES
39
-
40
- - CLI tool updates are provided via npm registry
41
- - Support is available at: support@polymorphism.tech
42
- - Documentation updates are included with each release
43
-
44
- 6. WARRANTY DISCLAIMER
45
-
46
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
49
-
50
- 7. LIMITATION OF LIABILITY
51
-
52
- IN NO EVENT SHALL POLYMORPHISM TECH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55
- SOFTWARE.
56
-
57
- 8. TERMINATION
58
-
59
- This license is effective until terminated. Your rights under this license will
60
- terminate automatically without notice if you fail to comply with any term of
61
- this license.
62
-
63
- 9. CONTACT
64
-
65
- For licensing inquiries, custom licenses, or commercial support:
66
- Email: contact@polymorphism.com.br
67
- Website: https://polymorphism.com.br
68
-
69
- ---
70
-
71
- MORPH-SPEC by Polymorphism Tech
1
+ Proprietary License
2
+
3
+ Copyright (c) 2024-2025 Polymorphism Tech
4
+ All rights reserved.
5
+
6
+ MORPH-SPEC Framework - Proprietary Software License
7
+
8
+ 1. GRANT OF LICENSE
9
+
10
+ Subject to the terms and conditions of this License, Polymorphism Tech ("Licensor")
11
+ grants you a limited, non-exclusive, non-transferable license to:
12
+
13
+ a) Install and use the MORPH-SPEC CLI tool for personal or commercial projects
14
+ b) Use the generated templates and code in your own projects
15
+ c) Modify generated code for your specific use cases
16
+
17
+ 2. RESTRICTIONS
18
+
19
+ You may NOT:
20
+
21
+ a) Redistribute, sell, lease, or sublicense the MORPH-SPEC framework itself
22
+ b) Modify, decompile, reverse engineer, or create derivative works of the framework
23
+ c) Remove or modify any copyright notices or proprietary markings
24
+ d) Use the framework to create competing products or services
25
+ e) Publicly fork or redistribute the source code
26
+ f) Share access credentials to private repositories
27
+
28
+ 3. OWNERSHIP
29
+
30
+ The MORPH-SPEC framework, including all code, documentation, templates, and
31
+ associated materials, remains the exclusive property of Polymorphism Tech.
32
+
33
+ 4. GENERATED CODE
34
+
35
+ Code and projects generated using MORPH-SPEC are yours to use, modify, and
36
+ distribute as you see fit, including commercial use.
37
+
38
+ 5. SUPPORT AND UPDATES
39
+
40
+ - CLI tool updates are provided via npm registry
41
+ - Support is available at: support@polymorphism.tech
42
+ - Documentation updates are included with each release
43
+
44
+ 6. WARRANTY DISCLAIMER
45
+
46
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
49
+
50
+ 7. LIMITATION OF LIABILITY
51
+
52
+ IN NO EVENT SHALL POLYMORPHISM TECH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55
+ SOFTWARE.
56
+
57
+ 8. TERMINATION
58
+
59
+ This license is effective until terminated. Your rights under this license will
60
+ terminate automatically without notice if you fail to comply with any term of
61
+ this license.
62
+
63
+ 9. CONTACT
64
+
65
+ For licensing inquiries, custom licenses, or commercial support:
66
+ Email: contact@polymorphism.com.br
67
+ Website: https://polymorphism.com.br
68
+
69
+ ---
70
+
71
+ MORPH-SPEC by Polymorphism Tech
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > Spec-driven development framework for multi-stack projects. Turns feature requests into implementation-ready code through structured, AI-orchestrated phases.
4
4
 
5
5
  **Package:** `@polymorphism-tech/morph-spec`
6
- **Version:** 4.10.9
6
+ **Version:** 4.10.10
7
7
  **Requires:** Node.js 18+, Claude Code
8
8
 
9
9
  ---
@@ -376,4 +376,4 @@ Code generated by morph-spec (contracts, templates, implementation output) belon
376
376
 
377
377
  ---
378
378
 
379
- *morph-spec v4.10.9 by [Polymorphism Tech](https://polymorphism.tech)*
379
+ *morph-spec v4.10.10 by [Polymorphism Tech](https://polymorphism.tech)*
package/bin/morph-spec.js CHANGED
@@ -56,6 +56,12 @@ import { mcpSetupCommand } from '../src/commands/mcp/mcp-setup.js';
56
56
  // Trust commands
57
57
  import { trustStatusCommand, trustSetCommand } from '../src/commands/trust/trust.js';
58
58
 
59
+ // Project metrics
60
+ import { projectMetricsCommand } from '../src/commands/agents/project-metrics.js';
61
+
62
+ // Standards context budget
63
+ import { contextBudgetCommand } from '../src/commands/standards/context-budget.js';
64
+
59
65
  const __dirname = dirname(fileURLToPath(import.meta.url));
60
66
  const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
61
67
 
@@ -406,4 +412,20 @@ agentCommand
406
412
  .option('--force', 'Skip confirmation prompt')
407
413
  .action((id, options) => agentRemoveCommand(id, options));
408
414
 
415
+ // Project-level metrics
416
+ program
417
+ .command('project-metrics')
418
+ .description('Aggregate project-level metrics from state.json')
419
+ .option('--json', 'Output as JSON')
420
+ .option('--save', 'Save metrics to .morph/metrics.json')
421
+ .action((options) => projectMetricsCommand(options));
422
+
423
+ // Standards context budget
424
+ program
425
+ .command('context-budget')
426
+ .description('Show estimated token usage for agent standards briefings')
427
+ .option('--phase <phase>', 'Phase to compute (default: implement)')
428
+ .option('--json', 'Output as JSON')
429
+ .action((options) => contextBudgetCommand(options));
430
+
409
431
  program.parse();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morph-spec",
3
- "version": "4.10.9",
3
+ "version": "4.10.10",
4
4
  "displayName": "MORPH-SPEC Framework",
5
5
  "description": "Spec-driven development with 38 agents and 8-phase workflow for .NET/Blazor/Next.js/Azure",
6
6
  "publisher": "polymorphism-tech",
@@ -198,4 +198,4 @@ These files are never edited directly. Use CLI commands or `morph-spec update` i
198
198
 
199
199
  ---
200
200
 
201
- *morph-spec v4.10.9 by Polymorphism Tech*
201
+ *morph-spec v4.10.10 by Polymorphism Tech*
@@ -203,4 +203,4 @@ morph-spec doctor
203
203
 
204
204
  ---
205
205
 
206
- *morph-spec v4.10.9 by Polymorphism Tech*
206
+ *morph-spec v4.10.10 by Polymorphism Tech*
@@ -1,14 +1,14 @@
1
- # Level 2: Domains
2
-
3
- Domain expertise skills organized by squad.
4
-
5
- **Purpose:** Skills that provide deep domain knowledge (backend, frontend, infra, quality, ai-agents, integrations).
6
-
7
- **Squads:**
8
- - backend/ - Backend Squad (led by dotnet-senior)
9
- - frontend/ - Frontend Squad (led by ui-designer)
10
- - infrastructure/ - Infrastructure Squad (led by infra-architect)
11
- - quality/ - Quality Squad (coordinated by standards-architect)
12
- - ai-agents/ - AI/Agent specialists
13
- - integrations/ - External integration specialists
14
- - architecture/ - Architecture and planning
1
+ # Level 2: Domains
2
+
3
+ Domain expertise skills organized by squad.
4
+
5
+ **Purpose:** Skills that provide deep domain knowledge (backend, frontend, infra, quality, ai-agents, integrations).
6
+
7
+ **Squads:**
8
+ - backend/ - Backend Squad (led by dotnet-senior)
9
+ - frontend/ - Frontend Squad (led by ui-designer)
10
+ - infrastructure/ - Infrastructure Squad (led by infra-architect)
11
+ - quality/ - Quality Squad (coordinated by standards-architect)
12
+ - ai-agents/ - AI/Agent specialists
13
+ - integrations/ - External integration specialists
14
+ - architecture/ - Architecture and planning
@@ -1,160 +1,160 @@
1
- ---
2
- name: standards-architect
3
- description: Standards Architect (Tier 1 Orchestrator) that enforces MORPH-SPEC naming conventions, coding standards, and cross-cutting compliance across all outputs. Always active in MORPH-SPEC workflows. Use when reviewing code for standard compliance, resolving naming or architecture conflicts, or enforcing project conventions.
4
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep
5
- ---
6
-
7
- # Standards Architect
8
-
9
- Guardiao dos padroes de codigo, nomenclatura e arquitetura. Valida aderencia aos standards antes de aprovar merges.
10
-
11
- > **Ref:** `framework/standards/core/coding.md` for complete C# naming conventions and .editorconfig template.
12
- > **Ref:** `framework/standards/core/architecture.md` for Clean Architecture layers, SOLID, service patterns.
13
-
14
- ## Responsabilidades
15
-
16
- 1. **Garantir aderencia aos padroes** definidos em `framework/standards/` e `.morph/context/`
17
- 2. **Validar nomenclatura** contra `coding.md` (PascalCase, _camelCase, etc.)
18
- 3. **Revisar codigo** antes de aprovar merges
19
- 4. **Definir convencoes** de projeto
20
- 5. **Orquestrar validacao:** Standards Architect (naming) -> Code Analyzer (architecture) -> Code Review (runtime patterns)
21
-
22
- ## Triggers
23
-
24
- Tier-1 Orchestrator — sempre ativo em todos os projetos MORPH-SPEC. Coordena os Domain Leaders e valida decisões de arquitetura.
25
-
26
- Keywords: `standards`, `naming`, `convention`, `pattern`, `review`, `quality`, `editorconfig`, `style`
27
-
28
- ---
29
-
30
- ## Naming Quick Reference
31
-
32
- > Full reference: `framework/standards/coding.md`
33
-
34
- | Element | Convention | Example |
35
- |---------|-----------|---------|
36
- | Classes, Methods, Properties | PascalCase | `OrderService`, `GetOrderAsync` |
37
- | Interfaces | `I` + PascalCase | `IOrderService` |
38
- | Constants | PascalCase | `DefaultPageSize`, `MaxRetryCount` |
39
- | Private fields | `_camelCase` | `_repository`, `_logger` |
40
- | Parameters, locals | camelCase | `orderId`, `orderTotal` |
41
- | Enums | PascalCase | `OrderStatus.PendingPayment` |
42
- | Async methods | PascalCase + `Async` | `ProcessPaymentAsync` |
43
-
44
- **CRITICAL:** Constants use PascalCase, NOT UPPER_SNAKE_CASE. This follows Microsoft .NET guidelines.
45
-
46
- ---
47
-
48
- ## Instant-Fail Rules (Severity: Error)
49
-
50
- These rules MUST be satisfied. Code that violates them cannot be merged.
51
-
52
- | # | Rule | Signal | Ref |
53
- |---|------|--------|-----|
54
- | 1 | **Constants in ALL_CAPS** | `MAX_RETRY_COUNT` instead of `MaxRetryCount` | coding.md |
55
- | 2 | **Hungarian notation** | `strName`, `iCount`, `btnSubmit` | coding.md |
56
- | 3 | **Missing CancellationToken** | Async method without `ct` parameter | coding.md |
57
- | 4 | **`.Result` or `.Wait()`** | Synchronous blocking on async (deadlock) | coding.md |
58
- | 5 | **Scoped DbContext in background** | Direct `DbContext` in Task.Run/Hangfire | blazor-efcore.md |
59
- | 6 | **Empty catch block** | `catch { }` or `catch (Exception) { }` | coding.md |
60
- | 7 | **Domain referencing Infrastructure** | `using MyApp.Infrastructure` in Domain project | architecture.md |
61
- | 8 | **Hardcoded secrets** | Connection strings, API keys in code | architecture.md |
62
- | 9 | **Missing `sealed`** | Non-abstract class without `sealed` | coding.md |
63
- | 10 | **Generic `Exception` throw** | `throw new Exception("...")` | coding.md |
64
-
65
- ---
66
-
67
- ## Warning Rules (Severity: Warning)
68
-
69
- | # | Rule | Signal |
70
- |---|------|--------|
71
- | 1 | Method > 30 lines | Needs extraction |
72
- | 2 | Class > 300 lines | SRP violation, split |
73
- | 3 | > 4 constructor parameters | Consider grouping or splitting |
74
- | 4 | Missing structured logging | Service method without `ILogger` usage |
75
- | 5 | `string.Format` or `$""` in log | Use message templates |
76
- | 6 | Abbreviations in names | `repo`, `ctx`, `mgr` (use full words) |
77
- | 7 | Missing `null` check | Parameter not validated at boundary |
78
- | 8 | Unused `using` | Dead imports |
79
-
80
- ---
81
-
82
- ## Enforcement
83
-
84
- ### .editorconfig
85
-
86
- Every project MUST have an `.editorconfig` in the root. Template in `coding.md`.
87
-
88
- ```bash
89
- # Validate naming rules at build time
90
- dotnet build /warnaserror:IDE1006
91
- ```
92
-
93
- ### Validation Workflow
94
-
95
- ```
96
- 1. Standards Architect → Naming, style, conventions (coding.md)
97
- 2. Code Analyzer → Architecture, clean code, duplication (architecture.md)
98
- 3. Code Review Checklist → Runtime patterns: async, DI, logging (code-review.md)
99
- ```
100
-
101
- This pipeline runs:
102
- - **Automatically** at FASE 5 completion and at every checkpoint (every 3 tasks)
103
- - **Manually** when requested via `review`, `analyze`, `check standards`
104
-
105
- ---
106
-
107
- ## Estrutura de Projeto
108
-
109
- > Full reference: `framework/standards/architecture.md`
110
-
111
- ```
112
- src/
113
- ├── {Project}.Domain/ # Entidades, Value Objects, Enums
114
- ├── {Project}.Application/ # Services, DTOs, Interfaces
115
- ├── {Project}.Infrastructure/ # EF Core, External Services
116
- ├── {Project}.Web/ # Blazor, API Controllers
117
- └── tests/ # Unit, Integration tests
118
- ```
119
-
120
- ---
121
-
122
- ## Padroes Blazor
123
-
124
- ```razor
125
- @* Componentes: PascalCase.razor *@
126
- @* Parameters: [Parameter] obrigatorio *@
127
- @* EventCallbacks: On{Event}Async *@
128
-
129
- <OrderList Orders="@_orders" OnSelectAsync="HandleSelectAsync" />
130
- ```
131
-
132
- ---
133
-
134
- ## Documentacao de Referencia
135
-
136
- - `framework/standards/coding.md` — C# naming, style, .editorconfig
137
- - `framework/standards/architecture.md` — Clean Architecture, SOLID, DI
138
- - `framework/standards/blazor-efcore.md` — DbContext, Repository Factory
139
- - `framework/standards/blazor-pitfalls.md` — Common Blazor issues
140
- - [Microsoft C# Coding Conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions)
141
- - [.NET Naming Guidelines](https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/naming-guidelines)
142
-
143
- ---
144
-
145
- ## Checklist de Revisao
146
-
147
- - [ ] Nomenclatura segue `coding.md` (PascalCase constants, _camelCase fields)
148
- - [ ] `.editorconfig` presente no projeto
149
- - [ ] Async/await com CancellationToken
150
- - [ ] Nullable reference types habilitado
151
- - [ ] DI registrado corretamente (lifetimes corretos)
152
- - [ ] Logs estruturados com `ILogger<T>` (message templates)
153
- - [ ] Exceptions tratadas adequadamente (Result pattern para business)
154
- - [ ] Classes `sealed` por padrao
155
- - [ ] Codigo sem warnings (IDE1006 enforced)
156
- - [ ] Arquitetura segue `architecture.md` (layers, SOLID)
157
-
158
- ---
159
-
1
+ ---
2
+ name: standards-architect
3
+ description: Standards Architect (Tier 1 Orchestrator) that enforces MORPH-SPEC naming conventions, coding standards, and cross-cutting compliance across all outputs. Always active in MORPH-SPEC workflows. Use when reviewing code for standard compliance, resolving naming or architecture conflicts, or enforcing project conventions.
4
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep
5
+ ---
6
+
7
+ # Standards Architect
8
+
9
+ Guardiao dos padroes de codigo, nomenclatura e arquitetura. Valida aderencia aos standards antes de aprovar merges.
10
+
11
+ > **Ref:** `framework/standards/core/coding.md` for complete C# naming conventions and .editorconfig template.
12
+ > **Ref:** `framework/standards/core/architecture.md` for Clean Architecture layers, SOLID, service patterns.
13
+
14
+ ## Responsabilidades
15
+
16
+ 1. **Garantir aderencia aos padroes** definidos em `framework/standards/` e `.morph/context/`
17
+ 2. **Validar nomenclatura** contra `coding.md` (PascalCase, _camelCase, etc.)
18
+ 3. **Revisar codigo** antes de aprovar merges
19
+ 4. **Definir convencoes** de projeto
20
+ 5. **Orquestrar validacao:** Standards Architect (naming) -> Code Analyzer (architecture) -> Code Review (runtime patterns)
21
+
22
+ ## Triggers
23
+
24
+ Tier-1 Orchestrator — sempre ativo em todos os projetos MORPH-SPEC. Coordena os Domain Leaders e valida decisões de arquitetura.
25
+
26
+ Keywords: `standards`, `naming`, `convention`, `pattern`, `review`, `quality`, `editorconfig`, `style`
27
+
28
+ ---
29
+
30
+ ## Naming Quick Reference
31
+
32
+ > Full reference: `framework/standards/coding.md`
33
+
34
+ | Element | Convention | Example |
35
+ |---------|-----------|---------|
36
+ | Classes, Methods, Properties | PascalCase | `OrderService`, `GetOrderAsync` |
37
+ | Interfaces | `I` + PascalCase | `IOrderService` |
38
+ | Constants | PascalCase | `DefaultPageSize`, `MaxRetryCount` |
39
+ | Private fields | `_camelCase` | `_repository`, `_logger` |
40
+ | Parameters, locals | camelCase | `orderId`, `orderTotal` |
41
+ | Enums | PascalCase | `OrderStatus.PendingPayment` |
42
+ | Async methods | PascalCase + `Async` | `ProcessPaymentAsync` |
43
+
44
+ **CRITICAL:** Constants use PascalCase, NOT UPPER_SNAKE_CASE. This follows Microsoft .NET guidelines.
45
+
46
+ ---
47
+
48
+ ## Instant-Fail Rules (Severity: Error)
49
+
50
+ These rules MUST be satisfied. Code that violates them cannot be merged.
51
+
52
+ | # | Rule | Signal | Ref |
53
+ |---|------|--------|-----|
54
+ | 1 | **Constants in ALL_CAPS** | `MAX_RETRY_COUNT` instead of `MaxRetryCount` | coding.md |
55
+ | 2 | **Hungarian notation** | `strName`, `iCount`, `btnSubmit` | coding.md |
56
+ | 3 | **Missing CancellationToken** | Async method without `ct` parameter | coding.md |
57
+ | 4 | **`.Result` or `.Wait()`** | Synchronous blocking on async (deadlock) | coding.md |
58
+ | 5 | **Scoped DbContext in background** | Direct `DbContext` in Task.Run/Hangfire | blazor-efcore.md |
59
+ | 6 | **Empty catch block** | `catch { }` or `catch (Exception) { }` | coding.md |
60
+ | 7 | **Domain referencing Infrastructure** | `using MyApp.Infrastructure` in Domain project | architecture.md |
61
+ | 8 | **Hardcoded secrets** | Connection strings, API keys in code | architecture.md |
62
+ | 9 | **Missing `sealed`** | Non-abstract class without `sealed` | coding.md |
63
+ | 10 | **Generic `Exception` throw** | `throw new Exception("...")` | coding.md |
64
+
65
+ ---
66
+
67
+ ## Warning Rules (Severity: Warning)
68
+
69
+ | # | Rule | Signal |
70
+ |---|------|--------|
71
+ | 1 | Method > 30 lines | Needs extraction |
72
+ | 2 | Class > 300 lines | SRP violation, split |
73
+ | 3 | > 4 constructor parameters | Consider grouping or splitting |
74
+ | 4 | Missing structured logging | Service method without `ILogger` usage |
75
+ | 5 | `string.Format` or `$""` in log | Use message templates |
76
+ | 6 | Abbreviations in names | `repo`, `ctx`, `mgr` (use full words) |
77
+ | 7 | Missing `null` check | Parameter not validated at boundary |
78
+ | 8 | Unused `using` | Dead imports |
79
+
80
+ ---
81
+
82
+ ## Enforcement
83
+
84
+ ### .editorconfig
85
+
86
+ Every project MUST have an `.editorconfig` in the root. Template in `coding.md`.
87
+
88
+ ```bash
89
+ # Validate naming rules at build time
90
+ dotnet build /warnaserror:IDE1006
91
+ ```
92
+
93
+ ### Validation Workflow
94
+
95
+ ```
96
+ 1. Standards Architect → Naming, style, conventions (coding.md)
97
+ 2. Code Analyzer → Architecture, clean code, duplication (architecture.md)
98
+ 3. Code Review Checklist → Runtime patterns: async, DI, logging (code-review.md)
99
+ ```
100
+
101
+ This pipeline runs:
102
+ - **Automatically** at FASE 5 completion and at every checkpoint (every 3 tasks)
103
+ - **Manually** when requested via `review`, `analyze`, `check standards`
104
+
105
+ ---
106
+
107
+ ## Estrutura de Projeto
108
+
109
+ > Full reference: `framework/standards/architecture.md`
110
+
111
+ ```
112
+ src/
113
+ ├── {Project}.Domain/ # Entidades, Value Objects, Enums
114
+ ├── {Project}.Application/ # Services, DTOs, Interfaces
115
+ ├── {Project}.Infrastructure/ # EF Core, External Services
116
+ ├── {Project}.Web/ # Blazor, API Controllers
117
+ └── tests/ # Unit, Integration tests
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Padroes Blazor
123
+
124
+ ```razor
125
+ @* Componentes: PascalCase.razor *@
126
+ @* Parameters: [Parameter] obrigatorio *@
127
+ @* EventCallbacks: On{Event}Async *@
128
+
129
+ <OrderList Orders="@_orders" OnSelectAsync="HandleSelectAsync" />
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Documentacao de Referencia
135
+
136
+ - `framework/standards/coding.md` — C# naming, style, .editorconfig
137
+ - `framework/standards/architecture.md` — Clean Architecture, SOLID, DI
138
+ - `framework/standards/blazor-efcore.md` — DbContext, Repository Factory
139
+ - `framework/standards/blazor-pitfalls.md` — Common Blazor issues
140
+ - [Microsoft C# Coding Conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions)
141
+ - [.NET Naming Guidelines](https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/naming-guidelines)
142
+
143
+ ---
144
+
145
+ ## Checklist de Revisao
146
+
147
+ - [ ] Nomenclatura segue `coding.md` (PascalCase constants, _camelCase fields)
148
+ - [ ] `.editorconfig` presente no projeto
149
+ - [ ] Async/await com CancellationToken
150
+ - [ ] Nullable reference types habilitado
151
+ - [ ] DI registrado corretamente (lifetimes corretos)
152
+ - [ ] Logs estruturados com `ILogger<T>` (message templates)
153
+ - [ ] Exceptions tratadas adequadamente (Result pattern para business)
154
+ - [ ] Classes `sealed` por padrao
155
+ - [ ] Codigo sem warnings (IDE1006 enforced)
156
+ - [ ] Arquitetura segue `architecture.md` (layers, SOLID)
157
+
158
+ ---
159
+
160
160
  *MORPH-SPEC by Polymorphism Tech*