@polymorphism-tech/morph-spec 2.4.0 → 3.0.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.
Files changed (87) hide show
  1. package/CLAUDE.md +75 -239
  2. package/bin/morph-spec.js +8 -0
  3. package/content/.claude/commands/morph-deploy.md +529 -0
  4. package/content/.claude/skills/level-0-meta/README.md +7 -0
  5. package/content/.claude/skills/{checklists → level-0-meta}/morph-checklist.md +117 -117
  6. package/content/.claude/skills/level-1-workflows/README.md +7 -0
  7. package/content/.claude/skills/{workflows → level-1-workflows}/morph-replicate.md +213 -213
  8. package/content/.claude/skills/{workflows → level-1-workflows}/phase-clarify.md +131 -131
  9. package/content/.claude/skills/{workflows → level-1-workflows}/phase-design.md +213 -205
  10. package/content/.claude/skills/{workflows → level-1-workflows}/phase-setup.md +106 -92
  11. package/content/.claude/skills/{workflows → level-1-workflows}/phase-tasks.md +164 -164
  12. package/content/.claude/skills/{workflows → level-1-workflows}/phase-uiux.md +169 -138
  13. package/content/.claude/skills/level-2-domains/README.md +14 -0
  14. package/content/.claude/skills/level-2-domains/architecture/prompt-engineer.md +189 -0
  15. package/content/.claude/skills/level-2-domains/architecture/seo-growth-hacker.md +320 -0
  16. package/content/.claude/skills/level-2-domains/infrastructure/azure-deploy-specialist.md +699 -0
  17. package/content/.claude/skills/{specialists → level-2-domains/quality}/testing-specialist.md +126 -126
  18. package/content/.claude/skills/level-3-technologies/README.md +7 -0
  19. package/content/.claude/skills/level-4-patterns/README.md +7 -0
  20. package/content/.morph/config/agents.json +744 -358
  21. package/content/.morph/config/config.template.json +33 -0
  22. package/content/.morph/docs/workflows/enforcement-pipeline.md +668 -0
  23. package/content/.morph/examples/scheduled-reports/decisions.md +158 -158
  24. package/content/.morph/examples/scheduled-reports/proposal.md +95 -95
  25. package/content/.morph/examples/scheduled-reports/spec.md +267 -267
  26. package/content/.morph/hooks/README.md +158 -0
  27. package/content/.morph/hooks/task-completed.js +73 -0
  28. package/content/.morph/hooks/teammate-idle.js +68 -0
  29. package/content/.morph/schemas/tasks.schema.json +220 -220
  30. package/content/.morph/standards/agent-teams-workflow.md +474 -0
  31. package/content/.morph/templates/CONTEXT-FEATURE.md +276 -0
  32. package/content/.morph/templates/CONTEXT.md +170 -0
  33. package/content/.morph/templates/clarify-questions.md +159 -159
  34. package/content/.morph/templates/contracts/Commands.cs +74 -74
  35. package/content/.morph/templates/contracts/Entities.cs +25 -25
  36. package/content/.morph/templates/contracts/Queries.cs +74 -74
  37. package/content/.morph/templates/contracts/README.md +74 -74
  38. package/content/.morph/templates/infra/azure-pipelines-deploy.yml +480 -0
  39. package/package.json +1 -2
  40. package/scripts/reorganize-skills.cjs +175 -0
  41. package/scripts/validate-agents-structure.cjs +52 -0
  42. package/scripts/validate-skills.cjs +180 -0
  43. package/src/commands/advance-phase.js +83 -0
  44. package/src/commands/deploy.js +780 -0
  45. package/src/commands/detect-agents.js +43 -6
  46. package/src/commands/detect.js +1 -1
  47. package/src/commands/generate-context.js +40 -0
  48. package/src/commands/state.js +2 -1
  49. package/src/commands/sync.js +1 -1
  50. package/src/commands/update.js +13 -1
  51. package/src/lib/context-generator.js +513 -0
  52. package/src/lib/design-system-detector.js +187 -0
  53. package/src/lib/design-system-scaffolder.js +299 -0
  54. package/src/lib/hook-executor.js +256 -0
  55. package/src/lib/spec-validator.js +258 -0
  56. package/src/lib/standards-context-injector.js +287 -0
  57. package/src/lib/state-manager.js +21 -4
  58. package/src/lib/team-orchestrator.js +322 -0
  59. package/src/lib/validation-runner.js +65 -13
  60. package/src/lib/validators/design-system-validator.js +231 -0
  61. package/src/utils/file-copier.js +9 -1
  62. /package/content/.claude/skills/{checklists → level-0-meta}/code-review.md +0 -0
  63. /package/content/.claude/skills/{checklists → level-0-meta}/simulation-checklist.md +0 -0
  64. /package/content/.claude/skills/{specialists → level-2-domains/ai-agents}/ai-system-architect.md +0 -0
  65. /package/content/.claude/skills/{specialists → level-2-domains/architecture}/po-pm-advisor.md +0 -0
  66. /package/content/.claude/skills/{specialists → level-2-domains/architecture}/standards-architect.md +0 -0
  67. /package/content/.claude/skills/{specialists → level-2-domains/backend}/dotnet-senior.md +0 -0
  68. /package/content/.claude/skills/{specialists → level-2-domains/backend}/ef-modeler.md +0 -0
  69. /package/content/.claude/skills/{specialists → level-2-domains/backend}/hangfire-orchestrator.md +0 -0
  70. /package/content/.claude/skills/{specialists → level-2-domains/backend}/ms-agent-expert.md +0 -0
  71. /package/content/.claude/skills/{stacks/dotnet-blazor.md → level-2-domains/frontend/blazor-builder.md} +0 -0
  72. /package/content/.claude/skills/{stacks/dotnet-nextjs.md → level-2-domains/frontend/nextjs-expert.md} +0 -0
  73. /package/content/.claude/skills/{specialists → level-2-domains/frontend}/ui-ux-designer.md +0 -0
  74. /package/content/.claude/skills/{specialists → level-2-domains/infrastructure}/azure-architect.md +0 -0
  75. /package/content/.claude/skills/{infra → level-2-domains/infrastructure}/bicep-architect.md +0 -0
  76. /package/content/.claude/skills/{infra → level-2-domains/infrastructure}/container-specialist.md +0 -0
  77. /package/content/.claude/skills/{infra → level-2-domains/infrastructure}/devops-engineer.md +0 -0
  78. /package/content/.claude/skills/{integrations → level-2-domains/integrations}/asaas-financial.md +0 -0
  79. /package/content/.claude/skills/{integrations → level-2-domains/integrations}/azure-identity.md +0 -0
  80. /package/content/.claude/skills/{integrations → level-2-domains/integrations}/clerk-auth.md +0 -0
  81. /package/content/.claude/skills/{integrations → level-2-domains/integrations}/resend-email.md +0 -0
  82. /package/content/.claude/skills/{specialists → level-2-domains/quality}/code-analyzer.md +0 -0
  83. /package/{detectors → src/lib/detectors}/config-detector.js +0 -0
  84. /package/{detectors → src/lib/detectors}/conversation-analyzer.js +0 -0
  85. /package/{detectors → src/lib/detectors}/index.js +0 -0
  86. /package/{detectors → src/lib/detectors}/standards-generator.js +0 -0
  87. /package/{detectors → src/lib/detectors}/structure-detector.js +0 -0
@@ -1,126 +1,126 @@
1
- # Testing Specialist
2
-
3
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** test, testing, mock, fake, simulation, unit test, integration test
4
-
5
- Especialista em testes, mocking e simulação para projetos .NET.
6
-
7
- ## Strategy
8
-
9
- | Level | What | Tools |
10
- |-------|------|-------|
11
- | **Unit** | Business logic, domain, handlers | xUnit + Moq + FluentAssertions |
12
- | **Integration** | API flows, DB operations | WebApplicationFactory + TestContainers |
13
- | **Component** | Blazor rendering, events | bUnit |
14
- | **E2E** | Critical user journeys | Playwright (if needed) |
15
-
16
- **Focus:** Critical/complex code. Don't aim for 100%, aim for value. Cover edge cases and error paths.
17
-
18
- ---
19
-
20
- ## Core Patterns
21
-
22
- ### AAA (Arrange-Act-Assert)
23
-
24
- ```csharp
25
- [Fact]
26
- public async Task CreateOrder_Should_ReturnSuccess_When_ValidInput()
27
- {
28
- // Arrange
29
- var command = new CreateOrderCommand { CustomerId = 1, Items = [...] };
30
- var handler = new CreateOrderHandler(_mockRepo.Object);
31
- // Act
32
- var result = await handler.Handle(command, CancellationToken.None);
33
- // Assert
34
- result.IsSuccess.Should().BeTrue();
35
- }
36
- ```
37
-
38
- ### Naming Convention
39
- ```
40
- [Method]_Should_[ExpectedResult]_When_[Condition]
41
- ```
42
-
43
- ### Test Data Builders
44
- Use builder pattern for complex test entities: `new OrderBuilder().WithCustomer(123).WithStatus(Completed).Build()`
45
-
46
- ### Mocking (Moq)
47
- ```csharp
48
- var mockRepo = new Mock<IOrderRepository>();
49
- mockRepo.Setup(r => r.GetByIdAsync(It.IsAny<int>())).ReturnsAsync(new Order { Id = 1 });
50
- mockRepo.Verify(r => r.SaveAsync(It.IsAny<Order>()), Times.Once);
51
- ```
52
-
53
- ### Integration Tests (WebApplicationFactory)
54
- Replace real DB with in-memory in `ConfigureServices`, use `CreateClient()` for HTTP calls.
55
-
56
- ### bUnit (Blazor)
57
- `RenderComponent<Counter>()` → `Find("button").Click()` → assert `TextContent`.
58
-
59
- ---
60
-
61
- ## Libraries
62
-
63
- | Library | Purpose | NuGet |
64
- |---------|---------|-------|
65
- | xUnit | Test framework | `xunit` |
66
- | Moq | Mocking | `Moq` |
67
- | FluentAssertions | Readable assertions | `FluentAssertions` |
68
- | Bogus | Fake data | `Bogus` |
69
- | TestContainers | DB containers | `Testcontainers` |
70
- | Respawn | DB reset | `Respawn` |
71
- | WireMock | HTTP mocking | `WireMock.Net` |
72
- | bUnit | Blazor testing | `bunit` |
73
-
74
- ## Folder Structure
75
-
76
- ```
77
- tests/
78
- ├── Unit/{Domain,Application,Builders}/
79
- ├── Integration/{Api,Fixtures}/
80
- └── E2E/
81
- ```
82
-
83
- ## Anti-Patterns
84
- 1. **Fragile tests** — test behavior, not implementation
85
- 2. **Slow tests** — use mocks, not real DB for unit tests
86
- 3. **Coupled tests** — each test independent
87
- 4. **Vague assertions** — use specific FluentAssertions
88
- 5. **Giant setup** — extract to builders/fixtures
89
-
90
- ---
91
-
92
- ## Simulation of External Services
93
-
94
- > **Ref:** `.claude/skills/checklists/simulation-checklist.md` for complete checklist
95
-
96
- ### Key Rules
97
-
98
- | Mock Type | Characteristic | DI Lifetime |
99
- |-----------|---------------|-------------|
100
- | **Stateful** (Dictionary, List) | Keeps data between calls | `Singleton` |
101
- | **Stateless** | No state | `Scoped` |
102
-
103
- ```csharp
104
- // ❌ Stateful with Scoped = loses state between requests
105
- services.AddScoped<IReplicateClient, FakeReplicateClient>();
106
- // ✅ Stateful with Singleton
107
- services.AddSingleton<IReplicateClient, FakeReplicateClient>();
108
- ```
109
-
110
- **Before implementing mocks:** Map ALL dependencies (interfaces, transitive deps, lifetimes).
111
-
112
- ---
113
-
114
- ## Checklists
115
-
116
- ### Per Test Type
117
- | Target | Test |
118
- |--------|------|
119
- | Entity/Domain | Creation validation, state transitions (valid + invalid), invariants |
120
- | Handler/Service | Happy path, invalid input, not found (404), auth error, timeout |
121
- | API | Status codes, response body, request validation, auth |
122
- | Blazor Component | Initial render, user events, states (loading/error/empty), form validation |
123
-
124
- ---
125
-
126
- *MORPH-SPEC by Polymorphism Tech*
1
+ # Testing Specialist
2
+
3
+ > **Layer:** 2 | **Load:** on-keyword | **Keywords:** test, testing, mock, fake, simulation, unit test, integration test
4
+
5
+ Especialista em testes, mocking e simulação para projetos .NET.
6
+
7
+ ## Strategy
8
+
9
+ | Level | What | Tools |
10
+ |-------|------|-------|
11
+ | **Unit** | Business logic, domain, handlers | xUnit + Moq + FluentAssertions |
12
+ | **Integration** | API flows, DB operations | WebApplicationFactory + TestContainers |
13
+ | **Component** | Blazor rendering, events | bUnit |
14
+ | **E2E** | Critical user journeys | Playwright (if needed) |
15
+
16
+ **Focus:** Critical/complex code. Don't aim for 100%, aim for value. Cover edge cases and error paths.
17
+
18
+ ---
19
+
20
+ ## Core Patterns
21
+
22
+ ### AAA (Arrange-Act-Assert)
23
+
24
+ ```csharp
25
+ [Fact]
26
+ public async Task CreateOrder_Should_ReturnSuccess_When_ValidInput()
27
+ {
28
+ // Arrange
29
+ var command = new CreateOrderCommand { CustomerId = 1, Items = [...] };
30
+ var handler = new CreateOrderHandler(_mockRepo.Object);
31
+ // Act
32
+ var result = await handler.Handle(command, CancellationToken.None);
33
+ // Assert
34
+ result.IsSuccess.Should().BeTrue();
35
+ }
36
+ ```
37
+
38
+ ### Naming Convention
39
+ ```
40
+ [Method]_Should_[ExpectedResult]_When_[Condition]
41
+ ```
42
+
43
+ ### Test Data Builders
44
+ Use builder pattern for complex test entities: `new OrderBuilder().WithCustomer(123).WithStatus(Completed).Build()`
45
+
46
+ ### Mocking (Moq)
47
+ ```csharp
48
+ var mockRepo = new Mock<IOrderRepository>();
49
+ mockRepo.Setup(r => r.GetByIdAsync(It.IsAny<int>())).ReturnsAsync(new Order { Id = 1 });
50
+ mockRepo.Verify(r => r.SaveAsync(It.IsAny<Order>()), Times.Once);
51
+ ```
52
+
53
+ ### Integration Tests (WebApplicationFactory)
54
+ Replace real DB with in-memory in `ConfigureServices`, use `CreateClient()` for HTTP calls.
55
+
56
+ ### bUnit (Blazor)
57
+ `RenderComponent<Counter>()` → `Find("button").Click()` → assert `TextContent`.
58
+
59
+ ---
60
+
61
+ ## Libraries
62
+
63
+ | Library | Purpose | NuGet |
64
+ |---------|---------|-------|
65
+ | xUnit | Test framework | `xunit` |
66
+ | Moq | Mocking | `Moq` |
67
+ | FluentAssertions | Readable assertions | `FluentAssertions` |
68
+ | Bogus | Fake data | `Bogus` |
69
+ | TestContainers | DB containers | `Testcontainers` |
70
+ | Respawn | DB reset | `Respawn` |
71
+ | WireMock | HTTP mocking | `WireMock.Net` |
72
+ | bUnit | Blazor testing | `bunit` |
73
+
74
+ ## Folder Structure
75
+
76
+ ```
77
+ tests/
78
+ ├── Unit/{Domain,Application,Builders}/
79
+ ├── Integration/{Api,Fixtures}/
80
+ └── E2E/
81
+ ```
82
+
83
+ ## Anti-Patterns
84
+ 1. **Fragile tests** — test behavior, not implementation
85
+ 2. **Slow tests** — use mocks, not real DB for unit tests
86
+ 3. **Coupled tests** — each test independent
87
+ 4. **Vague assertions** — use specific FluentAssertions
88
+ 5. **Giant setup** — extract to builders/fixtures
89
+
90
+ ---
91
+
92
+ ## Simulation of External Services
93
+
94
+ > **Ref:** `.claude/skills/checklists/simulation-checklist.md` for complete checklist
95
+
96
+ ### Key Rules
97
+
98
+ | Mock Type | Characteristic | DI Lifetime |
99
+ |-----------|---------------|-------------|
100
+ | **Stateful** (Dictionary, List) | Keeps data between calls | `Singleton` |
101
+ | **Stateless** | No state | `Scoped` |
102
+
103
+ ```csharp
104
+ // ❌ Stateful with Scoped = loses state between requests
105
+ services.AddScoped<IReplicateClient, FakeReplicateClient>();
106
+ // ✅ Stateful with Singleton
107
+ services.AddSingleton<IReplicateClient, FakeReplicateClient>();
108
+ ```
109
+
110
+ **Before implementing mocks:** Map ALL dependencies (interfaces, transitive deps, lifetimes).
111
+
112
+ ---
113
+
114
+ ## Checklists
115
+
116
+ ### Per Test Type
117
+ | Target | Test |
118
+ |--------|------|
119
+ | Entity/Domain | Creation validation, state transitions (valid + invalid), invariants |
120
+ | Handler/Service | Happy path, invalid input, not found (404), auth error, timeout |
121
+ | API | Status codes, response body, request validation, auth |
122
+ | Blazor Component | Initial render, user events, states (loading/error/empty), form validation |
123
+
124
+ ---
125
+
126
+ *MORPH-SPEC by Polymorphism Tech*
@@ -0,0 +1,7 @@
1
+ # Level 3: Technologies
2
+
3
+ Technology-specific implementation patterns.
4
+
5
+ **Purpose:** Skills for specific technologies (EF Core, Blazor, Hangfire, SignalR, etc.).
6
+
7
+ **To be populated in Phase 8/9.**
@@ -0,0 +1,7 @@
1
+ # Level 4: Patterns
2
+
3
+ Architectural and design patterns.
4
+
5
+ **Purpose:** Skills for specific patterns (CQRS, Event Sourcing, DDD, Repository, etc.).
6
+
7
+ **To be populated later.**