@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
@@ -187,4 +187,162 @@ bash -x content/.morph/hooks/pre-commit-costs.sh
187
187
 
188
188
  ---
189
189
 
190
+ ## Agent Teams Hooks (Claude Code)
191
+
192
+ **New in MORPH 3.0:** Hooks for Claude Code's experimental Agent Teams feature.
193
+
194
+ ### Available Agent Teams Hooks
195
+
196
+ | Hook | Event | Description | Action |
197
+ |------|-------|-------------|--------|
198
+ | `teammate-idle.js` | TeammateIdle | Validates teammate's work before proceeding | ❌ Blocks if errors |
199
+ | `task-completed.js` | TaskCompleted | Validates task deliverables on completion | ❌ Blocks if errors |
200
+
201
+ ### teammate-idle.js
202
+
203
+ **Triggered:** When a teammate in Agent Teams is idle and waiting for instructions
204
+ **Purpose:** Quality gate to validate recent work before allowing teammate to proceed
205
+ **Validates:** Security, code quality, standards compliance
206
+
207
+ **Usage:**
208
+ ```bash
209
+ node content/.morph/hooks/teammate-idle.js <feature-name> [--dry-run] [--verbose]
210
+ ```
211
+
212
+ **Example:**
213
+ ```bash
214
+ node content/.morph/hooks/teammate-idle.js user-authentication --verbose
215
+ ```
216
+
217
+ **Output:**
218
+ ```
219
+ 🔔 TeammateIdle Hook Triggered
220
+ Feature: user-authentication
221
+ Event: Teammate is idle, validating recent work...
222
+
223
+ 🎯 Executing TeammateIdle hook for feature: user-authentication
224
+ Validators: security-expert
225
+
226
+ 🔍 Running security-expert validators...
227
+
228
+ ✅ TeammateIdle hook: All validators passed
229
+ ```
230
+
231
+ **Configuration:**
232
+
233
+ Validators are configured in `agents.json` for Tier 4 agents:
234
+
235
+ ```json
236
+ {
237
+ "security-expert": {
238
+ "tier": 4,
239
+ "role": "validator",
240
+ "relationships": {
241
+ "runs_in": "hooks",
242
+ "hook_triggers": ["TeammateIdle", "TaskCompleted"]
243
+ },
244
+ "hook_behavior": {
245
+ "validates": [
246
+ "SQL injection (string concatenation in queries)",
247
+ "Hardcoded secrets (API keys, passwords, connection strings)",
248
+ "XSS (@Html.Raw usage in Razor/Blazor)"
249
+ ],
250
+ "severity": "error",
251
+ "blocks_on_fail": true
252
+ }
253
+ }
254
+ }
255
+ ```
256
+
257
+ ### task-completed.js
258
+
259
+ **Triggered:** When a task is marked as completed
260
+ **Purpose:** Quality gate to validate task deliverables before marking done
261
+ **Validates:** All active validators for the feature
262
+
263
+ **Usage:**
264
+ ```bash
265
+ node content/.morph/hooks/task-completed.js <feature-name> <task-id> [--dry-run] [--verbose]
266
+ ```
267
+
268
+ **Example:**
269
+ ```bash
270
+ node content/.morph/hooks/task-completed.js user-authentication T003 --verbose
271
+ ```
272
+
273
+ **Output:**
274
+ ```
275
+ 🔔 TaskCompleted Hook Triggered
276
+ Feature: user-authentication
277
+ Task: T003
278
+ Event: Task marked complete, validating deliverables...
279
+
280
+ 🎯 Executing TaskCompleted hook for feature: user-authentication
281
+ Validators: security-expert
282
+
283
+ 🔍 Running security-expert validators...
284
+
285
+ ❌ TaskCompleted hook: Validation FAILED
286
+
287
+ 🚫 ERRORS (blocking):
288
+ security-expert → security
289
+ • Hardcoded secret detected: API key in appsettings.json (appsettings.json:15)
290
+ • SQL injection risk: String concatenation in UserService.cs (UserService.cs:42)
291
+
292
+ ⛔ Hook execution BLOCKED - fix errors before proceeding
293
+
294
+ 💡 TIP: Fix the errors above before the task can be marked complete.
295
+ ```
296
+
297
+ ### Integration with Claude Code
298
+
299
+ When Agent Teams is enabled (`CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`), these hooks run automatically:
300
+
301
+ 1. **TeammateIdle**: When a teammate finishes work and waits
302
+ 2. **TaskCompleted**: When `morph-spec task done` is called
303
+
304
+ **Claude Code Settings:**
305
+ ```json
306
+ {
307
+ "hooks": {
308
+ "TeammateIdle": "node content/.morph/hooks/teammate-idle.js {feature}",
309
+ "TaskCompleted": "node content/.morph/hooks/task-completed.js {feature} {taskId}"
310
+ }
311
+ }
312
+ ```
313
+
314
+ ### Dry Run Mode
315
+
316
+ Test hooks without blocking:
317
+
318
+ ```bash
319
+ # See what would run without executing
320
+ node content/.morph/hooks/teammate-idle.js my-feature --dry-run
321
+
322
+ # Output:
323
+ # 🔍 DRY RUN - Would execute:
324
+ # - security-expert (severity: error)
325
+ # • SQL injection (string concatenation in queries)
326
+ # • Hardcoded secrets (API keys, passwords, connection strings)
327
+ # • XSS (@Html.Raw usage in Razor/Blazor)
328
+ ```
329
+
330
+ ### Hook Behavior Configuration
331
+
332
+ | Field | Description | Values |
333
+ |-------|-------------|--------|
334
+ | `validates` | Array of validation checks | Descriptive strings |
335
+ | `severity` | Error level | `"error"` (blocks) \| `"warning"` (warns only) |
336
+ | `blocks_on_fail` | Block on failure | `true` (default) \| `false` |
337
+
338
+ ### Exit Codes
339
+
340
+ | Code | Meaning |
341
+ |------|---------|
342
+ | 0 | All validators passed |
343
+ | 1 | Validation failed and blocked |
344
+ | 2 | Configuration error (missing feature, etc.) |
345
+
346
+ ---
347
+
190
348
  *MORPH-SPEC Framework - Git Hooks*
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * TaskCompleted Hook - Claude Code Agent Teams
5
+ *
6
+ * Triggered when a task is marked as completed.
7
+ * Validates the task deliverables before allowing the task to be marked done.
8
+ *
9
+ * Usage (from Claude Code hooks):
10
+ * task-completed.js <feature-name> <task-id> [--dry-run] [--verbose]
11
+ *
12
+ * Exit codes:
13
+ * 0 - All validators passed
14
+ * 1 - Validation failed and blocked
15
+ * 2 - Configuration error
16
+ */
17
+
18
+ import { executeHook, formatHookResults } from '../../../src/lib/hook-executor.js';
19
+ import { fileURLToPath } from 'url';
20
+ import { dirname, join } from 'path';
21
+
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = dirname(__filename);
24
+
25
+ // Get project root (3 levels up from hooks dir)
26
+ const projectPath = join(__dirname, '../../..');
27
+
28
+ async function main() {
29
+ const args = process.argv.slice(2);
30
+
31
+ if (args.length < 2) {
32
+ console.error('Usage: task-completed.js <feature-name> <task-id> [--dry-run] [--verbose]');
33
+ process.exit(2);
34
+ }
35
+
36
+ const featureName = args[0];
37
+ const taskId = args[1];
38
+ const dryRun = args.includes('--dry-run');
39
+ const verbose = args.includes('--verbose');
40
+
41
+ console.log('🔔 TaskCompleted Hook Triggered');
42
+ console.log(` Feature: ${featureName}`);
43
+ console.log(` Task: ${taskId}`);
44
+ console.log(` Event: Task marked complete, validating deliverables...\n`);
45
+
46
+ try {
47
+ const results = await executeHook(projectPath, featureName, 'TaskCompleted', {
48
+ dryRun,
49
+ verbose
50
+ });
51
+
52
+ const output = formatHookResults(results, 'TaskCompleted');
53
+ console.log(output);
54
+
55
+ if (results.blocked) {
56
+ console.log('\n💡 TIP: Fix the errors above before the task can be marked complete.');
57
+ console.log(` Run: morph-spec task done ${featureName} ${taskId} --skip-validation`);
58
+ console.log(' (Not recommended - only use if you know what you\'re doing)');
59
+ process.exit(1);
60
+ }
61
+
62
+ console.log('\n✅ Task deliverables validated successfully.');
63
+ process.exit(0);
64
+ } catch (err) {
65
+ console.error(`\n❌ Hook execution error: ${err.message}`);
66
+ if (verbose) {
67
+ console.error(err.stack);
68
+ }
69
+ process.exit(2);
70
+ }
71
+ }
72
+
73
+ main();
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * TeammateIdle Hook - Claude Code Agent Teams
5
+ *
6
+ * Triggered when a teammate is idle and waiting for next instructions.
7
+ * Validates the teammate's recent work before allowing them to proceed.
8
+ *
9
+ * Usage (from Claude Code hooks):
10
+ * teammate-idle.js <feature-name> [--dry-run] [--verbose]
11
+ *
12
+ * Exit codes:
13
+ * 0 - All validators passed
14
+ * 1 - Validation failed and blocked
15
+ * 2 - Configuration error
16
+ */
17
+
18
+ import { executeHook, formatHookResults } from '../../../src/lib/hook-executor.js';
19
+ import { fileURLToPath } from 'url';
20
+ import { dirname, join } from 'path';
21
+
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = dirname(__filename);
24
+
25
+ // Get project root (3 levels up from hooks dir)
26
+ const projectPath = join(__dirname, '../../..');
27
+
28
+ async function main() {
29
+ const args = process.argv.slice(2);
30
+
31
+ if (args.length === 0) {
32
+ console.error('Usage: teammate-idle.js <feature-name> [--dry-run] [--verbose]');
33
+ process.exit(2);
34
+ }
35
+
36
+ const featureName = args[0];
37
+ const dryRun = args.includes('--dry-run');
38
+ const verbose = args.includes('--verbose');
39
+
40
+ console.log('🔔 TeammateIdle Hook Triggered');
41
+ console.log(` Feature: ${featureName}`);
42
+ console.log(` Event: Teammate is idle, validating recent work...\n`);
43
+
44
+ try {
45
+ const results = await executeHook(projectPath, featureName, 'TeammateIdle', {
46
+ dryRun,
47
+ verbose
48
+ });
49
+
50
+ const output = formatHookResults(results, 'TeammateIdle');
51
+ console.log(output);
52
+
53
+ if (results.blocked) {
54
+ console.log('\n💡 TIP: Fix the errors above before the teammate can proceed.');
55
+ process.exit(1);
56
+ }
57
+
58
+ process.exit(0);
59
+ } catch (err) {
60
+ console.error(`\n❌ Hook execution error: ${err.message}`);
61
+ if (verbose) {
62
+ console.error(err.stack);
63
+ }
64
+ process.exit(2);
65
+ }
66
+ }
67
+
68
+ main();