@polymorphism-tech/morph-spec 4.14.0 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/morph-spec.js +1 -0
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/agents/ai-agents/ai-system-architect.md +2 -0
- package/framework/agents/ai-agents/vector-search-expert.md +233 -0
- package/framework/agents/architecture/seo-growth-hacker.md +2 -0
- package/framework/agents/architecture/standards-architect.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 +3 -0
- package/framework/agents/backend/supabase-expert.md +256 -0
- package/framework/agents/frontend/css-specialist.md +2 -0
- package/framework/agents/frontend/nextjs-expert.md +3 -0
- package/framework/agents/frontend/ui-ux-designer.md +3 -1
- package/framework/agents/infrastructure/infra-architect.md +3 -0
- package/framework/agents/integrations/asaas-financial.md +2 -0
- package/framework/agents/integrations/clerk-auth.md +2 -0
- package/framework/agents/integrations/resend-email.md +2 -0
- package/framework/agents.json +31 -30
- package/framework/skills/level-0-meta/morph-init/SKILL.md +19 -0
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
- package/package.json +1 -1
- package/src/commands/project/setup-infra-cmd.js +1 -1
- package/src/scripts/setup-infra.js +60 -30
- package/src/utils/agents-installer.js +18 -8
- package/framework/agents/integrations/hangfire-integration.md +0 -69
package/framework/agents.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"role": "Team Lead (Delegate Mode)",
|
|
30
30
|
"icon": "🎯",
|
|
31
31
|
"triggers": "cross-domain conflicts, full spec synthesis, architecture decisions, team coordination",
|
|
32
|
-
"spawn_prompt": "You are the Chief Architect and Team Lead for MORPH-SPEC.
|
|
32
|
+
"spawn_prompt": "You are the Chief Architect and Team Lead for MORPH-SPEC. Coordinate Domain Leaders, resolve architectural conflicts, and synthesize results.\n\nWorkflow:\n1. Read `.morph/state.json` for active feature and phase\n2. Read `.morph/features/{feature}/spec.md` for scope\n3. Delegate to Domain Leaders — DO NOT implement code yourself\n4. Synthesize results and escalate unresolvable conflicts to the user\n\nRefer to the Domain Knowledge section below for naming rules, instant-fail checks, and VSA project structure."
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"ai-system-architect": {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"role": "AI Architect",
|
|
76
76
|
"icon": "🤖",
|
|
77
77
|
"triggers": "AI system design, agent workflows, MCP integration, orchestration patterns",
|
|
78
|
-
"spawn_prompt": "You are the AI/Agent System Architect
|
|
78
|
+
"spawn_prompt": "You are the AI/Agent System Architect. Design agent workflows, tool integrations, and AI orchestration patterns.\n\nWorkflow:\n1. Read `.morph/state.json` and spec.md for AI requirements\n2. Design architecture using patterns from Domain Knowledge section below\n3. Delegate implementation to ms-agent-expert and vector-search-expert\n\nDO NOT implement code yourself. Refer to the Domain Knowledge section below for the 20 agentic patterns, MAF orchestration, and RAG pipeline architecture."
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"dotnet-senior": {
|
|
@@ -114,13 +114,10 @@
|
|
|
114
114
|
"feature-slice",
|
|
115
115
|
"vsa-scaffold",
|
|
116
116
|
"rest",
|
|
117
|
-
"graphql",
|
|
118
|
-
"grpc",
|
|
119
117
|
"openapi",
|
|
120
118
|
"swagger",
|
|
121
119
|
"versioning",
|
|
122
120
|
"rate limiting",
|
|
123
|
-
"hot chocolate",
|
|
124
121
|
"endpoint"
|
|
125
122
|
],
|
|
126
123
|
"validators": [
|
|
@@ -166,7 +163,7 @@
|
|
|
166
163
|
"role": "Backend Squad Leader",
|
|
167
164
|
"icon": "⚙️",
|
|
168
165
|
"triggers": ".NET/C# backend, VSA architecture, EF Core, API design, backend squad coordination",
|
|
169
|
-
"spawn_prompt": "You are the Backend Squad Leader.
|
|
166
|
+
"spawn_prompt": "You are the Backend Squad Leader. Coordinate backend specialists and own VSA architecture, API design, and .NET/C# standards.\n\nWorkflow:\n1. Read `.morph/state.json` and spec.md for backend requirements\n2. Produce VSA Blueprint: entity fields, operations (slices), routes, error types, validation rules\n3. Delegate to squad: ef-modeler, hangfire-orchestrator, ms-agent-expert, supabase-expert, vector-search-expert, asaas-financial, clerk-auth, resend-email\n\nRefer to the Domain Knowledge section below for IHandler, Result<T>, Scrutor, IApiEndpoint patterns and code templates."
|
|
170
167
|
}
|
|
171
168
|
},
|
|
172
169
|
"infra-architect": {
|
|
@@ -193,11 +190,7 @@
|
|
|
193
190
|
"container",
|
|
194
191
|
"iac",
|
|
195
192
|
"pipeline",
|
|
196
|
-
"
|
|
197
|
-
"neon",
|
|
198
|
-
"planetscale",
|
|
199
|
-
"serverless database",
|
|
200
|
-
"serverless postgres",
|
|
193
|
+
"easypanel",
|
|
201
194
|
"docker",
|
|
202
195
|
"containerize",
|
|
203
196
|
"dockerfile",
|
|
@@ -214,8 +207,8 @@
|
|
|
214
207
|
"teammate": {
|
|
215
208
|
"role": "Infrastructure Squad Leader",
|
|
216
209
|
"icon": "🏗️",
|
|
217
|
-
"triggers": "Docker, CI/CD, GitHub Actions,
|
|
218
|
-
"spawn_prompt": "You are the Infrastructure Squad Leader.
|
|
210
|
+
"triggers": "Docker, CI/CD, GitHub Actions, EasyPanel deployment, containerization",
|
|
211
|
+
"spawn_prompt": "You are the Infrastructure Squad Leader. Coordinate Docker, CI/CD, and EasyPanel deployment.\n\nWorkflow:\n1. Read `.morph/state.json` and spec.md for infrastructure requirements\n2. Design containerization and deployment architecture\n3. Escalate to standards-architect on cross-domain conflicts\n\nRefer to the Domain Knowledge section below for Docker, GitHub Actions, and EasyPanel patterns."
|
|
219
212
|
}
|
|
220
213
|
},
|
|
221
214
|
"ui-designer": {
|
|
@@ -266,16 +259,17 @@
|
|
|
266
259
|
}
|
|
267
260
|
],
|
|
268
261
|
"teammate": {
|
|
269
|
-
"role": "UI/UX Squad Leader
|
|
262
|
+
"role": "UI/UX Squad Leader",
|
|
270
263
|
"icon": "🎨",
|
|
271
264
|
"triggers": "UI/UX design, wireframes, user flows, design system, shadcn/ui component selection",
|
|
272
|
-
"spawn_prompt": "You are the UI/UX Squad Leader.
|
|
265
|
+
"spawn_prompt": "You are the UI/UX Squad Leader. Create wireframes, design system, and user flows during the UI/UX phase.\n\nWorkflow:\n1. Read `.morph/context/design-system.md` FIRST — use only defined tokens\n2. Read spec.md for UI requirements\n3. Generate deliverables: design-system.md, mockups.md, components.md, flows.md\n4. Coordinate squad: nextjs-expert, css-specialist, seo-growth-hacker\n\nWork is UI/UX phase ONLY — no implementation code. Refer to the Domain Knowledge section below for design brief protocol, shadcn/ui reference, and accessibility rules."
|
|
273
266
|
}
|
|
274
267
|
},
|
|
275
268
|
"ef-modeler": {
|
|
276
269
|
"color": "teal",
|
|
277
270
|
"tier": 3,
|
|
278
271
|
"title": "Data Persistence Specialist (Relational)",
|
|
272
|
+
"stacks": ["dotnet"],
|
|
279
273
|
"group": "backend",
|
|
280
274
|
"active_phases": [
|
|
281
275
|
"design",
|
|
@@ -302,13 +296,14 @@
|
|
|
302
296
|
"role": "Data Persistence Specialist",
|
|
303
297
|
"icon": "🗄️",
|
|
304
298
|
"triggers": "Entity Framework, database entities, migrations, DbContext, SQL schema design",
|
|
305
|
-
"spawn_prompt": "You are the Data Persistence Specialist (EF Core).
|
|
299
|
+
"spawn_prompt": "You are the Data Persistence Specialist (EF Core). Design and implement entities, migrations, and database schema.\n\nWorkflow:\n1. Read spec.md and VSA Blueprint from dotnet-senior for entity definitions\n2. Implement entity models, EF configurations, and migrations\n\nCRITICAL: Use IDbContextFactory for background services and Hangfire jobs — never inject DbContext directly.\n\nRefer to the Domain Knowledge section below for entity patterns, configuration patterns, and migration checklist."
|
|
306
300
|
}
|
|
307
301
|
},
|
|
308
302
|
"hangfire-orchestrator": {
|
|
309
303
|
"color": "teal",
|
|
310
304
|
"tier": 3,
|
|
311
305
|
"title": "Background Jobs Specialist",
|
|
306
|
+
"stacks": ["hangfire"],
|
|
312
307
|
"group": "backend",
|
|
313
308
|
"active_phases": [
|
|
314
309
|
"implement"
|
|
@@ -335,13 +330,14 @@
|
|
|
335
330
|
"role": "Background Jobs Specialist",
|
|
336
331
|
"icon": "⏰",
|
|
337
332
|
"triggers": "background jobs, scheduled tasks, cron jobs, webhooks, async job pipelines",
|
|
338
|
-
"spawn_prompt": "You are the Background Jobs Specialist (Hangfire).
|
|
333
|
+
"spawn_prompt": "You are the Background Jobs Specialist (Hangfire). Implement fire-and-forget, delayed, recurring, and continuation jobs.\n\nWorkflow:\n1. Read spec.md for background processing requirements\n2. Implement jobs with proper scoped service patterns\n\nCRITICAL: Use IDbContextFactory or IRepositoryFactory for scoped DB operations — never inject DbContext directly.\n\nRefer to the Domain Knowledge section below for setup, job types, retry patterns, and dashboard configuration."
|
|
339
334
|
}
|
|
340
335
|
},
|
|
341
336
|
"ms-agent-expert": {
|
|
342
337
|
"color": "yellow",
|
|
343
338
|
"tier": 3,
|
|
344
339
|
"title": "Microsoft Agent Framework Expert",
|
|
340
|
+
"stacks": ["dotnet", "semantic-kernel", "ms-agents"],
|
|
345
341
|
"group": "ai",
|
|
346
342
|
"active_phases": [
|
|
347
343
|
"design",
|
|
@@ -388,13 +384,14 @@
|
|
|
388
384
|
"role": "Microsoft Agent Framework Expert",
|
|
389
385
|
"icon": "🤖",
|
|
390
386
|
"triggers": "Microsoft Agent Framework, IChatClient, agent workflows, MCP tools, A2A protocol",
|
|
391
|
-
"spawn_prompt": "You are the Microsoft Agent Framework Expert.
|
|
387
|
+
"spawn_prompt": "You are the Microsoft Agent Framework Expert. Implement AI agent systems using IChatClient, AIFunctionFactory, and workflow patterns.\n\nWorkflow:\n1. Read spec.md for AI agent requirements\n2. Review architecture from ai-system-architect\n3. Implement using Microsoft.Extensions.AI patterns\n\nRefer to the Domain Knowledge section below for agent implementation, tool registration, MCP integration, and A2A protocol patterns."
|
|
392
388
|
}
|
|
393
389
|
},
|
|
394
390
|
"supabase-expert": {
|
|
395
391
|
"color": "teal",
|
|
396
392
|
"tier": 3,
|
|
397
393
|
"title": "Supabase & PostgreSQL Specialist",
|
|
394
|
+
"stacks": ["supabase"],
|
|
398
395
|
"group": "backend",
|
|
399
396
|
"active_phases": [
|
|
400
397
|
"design",
|
|
@@ -419,7 +416,7 @@
|
|
|
419
416
|
"role": "Supabase & PostgreSQL Specialist",
|
|
420
417
|
"icon": "🐘",
|
|
421
418
|
"triggers": "Supabase, PostgreSQL, RLS policies, pgvector, Edge Functions, Realtime subscriptions",
|
|
422
|
-
"spawn_prompt": "You are the Supabase & PostgreSQL Specialist.
|
|
419
|
+
"spawn_prompt": "You are the Supabase & PostgreSQL Specialist. Implement auth, RLS, Realtime, Edge Functions, and pgvector.\n\nWorkflow:\n1. Read spec.md for database and auth requirements\n2. Design RLS policies and schema\n3. ALWAYS use PgBouncer (port 6543) for application connections\n\nRefer to the Domain Knowledge section below for RLS patterns, migration workflow, pgvector setup, and Clerk JWT integration."
|
|
423
420
|
}
|
|
424
421
|
},
|
|
425
422
|
"vector-search-expert": {
|
|
@@ -461,13 +458,14 @@
|
|
|
461
458
|
"role": "Vector Search & RAG Specialist",
|
|
462
459
|
"icon": "🔎",
|
|
463
460
|
"triggers": "vector embeddings, RAG pipelines, semantic search, pgvector, HNSW indexes",
|
|
464
|
-
"spawn_prompt": "You are the Vector Search & RAG Specialist.
|
|
461
|
+
"spawn_prompt": "You are the Vector Search & RAG Specialist. Implement embeddings, similarity search, and RAG pipelines.\n\nWorkflow:\n1. Read spec.md for search and retrieval requirements\n2. Review AI architecture from ai-system-architect\n3. Implement chunking, embedding, and retrieval components\n\nRefer to the Domain Knowledge section below for chunking strategies, pgvector setup, hybrid search, and RAG tool patterns."
|
|
465
462
|
}
|
|
466
463
|
},
|
|
467
464
|
"asaas-financial": {
|
|
468
465
|
"color": "teal",
|
|
469
466
|
"tier": 3,
|
|
470
467
|
"title": "Payment Integration Specialist (Brazil)",
|
|
468
|
+
"stacks": ["asaas"],
|
|
471
469
|
"group": "backend",
|
|
472
470
|
"active_phases": [
|
|
473
471
|
"design",
|
|
@@ -495,13 +493,14 @@
|
|
|
495
493
|
"role": "Payment Integration Specialist",
|
|
496
494
|
"icon": "💳",
|
|
497
495
|
"triggers": "PIX payments, Boleto, Asaas SDK, subscription billing, Brazilian payments",
|
|
498
|
-
"spawn_prompt": "You are the Payment Integration Specialist (Asaas/Brazil).
|
|
496
|
+
"spawn_prompt": "You are the Payment Integration Specialist (Asaas/Brazil). Implement PIX, Boleto, Credit Card, and subscription billing.\n\nNever hardcode API keys. Follow contract-compliance patterns.\n\nRefer to the Domain Knowledge section below for Asaas SDK patterns, webhook handling, and payment flow examples."
|
|
499
497
|
}
|
|
500
498
|
},
|
|
501
499
|
"clerk-auth": {
|
|
502
500
|
"color": "teal",
|
|
503
501
|
"tier": 3,
|
|
504
502
|
"title": "Auth SaaS Integration Specialist",
|
|
503
|
+
"stacks": ["clerk"],
|
|
505
504
|
"group": "backend",
|
|
506
505
|
"active_phases": [
|
|
507
506
|
"design",
|
|
@@ -526,13 +525,14 @@
|
|
|
526
525
|
"role": "Auth SaaS Integration Specialist",
|
|
527
526
|
"icon": "🔐",
|
|
528
527
|
"triggers": "Clerk authentication, login/signup flows, OAuth, session management",
|
|
529
|
-
"spawn_prompt": "You are the Auth SaaS Integration Specialist (Clerk).
|
|
528
|
+
"spawn_prompt": "You are the Auth SaaS Integration Specialist (Clerk). Implement authentication flows and session management with Next.js App Router.\n\nRefer to the Domain Knowledge section below for Clerk SDK patterns, middleware configuration, and webhook handling."
|
|
530
529
|
}
|
|
531
530
|
},
|
|
532
531
|
"resend-email": {
|
|
533
532
|
"color": "teal",
|
|
534
533
|
"tier": 3,
|
|
535
534
|
"title": "Email Integration Specialist",
|
|
535
|
+
"stacks": ["resend"],
|
|
536
536
|
"group": "backend",
|
|
537
537
|
"active_phases": [
|
|
538
538
|
"implement"
|
|
@@ -559,13 +559,14 @@
|
|
|
559
559
|
"role": "Email Integration Specialist",
|
|
560
560
|
"icon": "📧",
|
|
561
561
|
"triggers": "transactional email, Resend SDK, email templates, notifications",
|
|
562
|
-
"spawn_prompt": "You are the Email Integration Specialist (Resend).
|
|
562
|
+
"spawn_prompt": "You are the Email Integration Specialist (Resend). Implement transactional email delivery.\n\nNever hardcode API keys. Follow contract-compliance patterns.\n\nRefer to the Domain Knowledge section below for Resend SDK patterns, React Email templates, and error handling."
|
|
563
563
|
}
|
|
564
564
|
},
|
|
565
565
|
"nextjs-expert": {
|
|
566
566
|
"color": "pink",
|
|
567
567
|
"tier": 3,
|
|
568
568
|
"title": "Next.js Development Specialist",
|
|
569
|
+
"stacks": ["nextjs"],
|
|
569
570
|
"group": "frontend",
|
|
570
571
|
"active_phases": [
|
|
571
572
|
"uiux",
|
|
@@ -675,7 +676,7 @@
|
|
|
675
676
|
"role": "Next.js Development Specialist",
|
|
676
677
|
"icon": "⚛️",
|
|
677
678
|
"triggers": "Next.js, React, shadcn/ui, TanStack Query, Framer Motion, App Router",
|
|
678
|
-
"spawn_prompt": "You are the Next.js Development Specialist.
|
|
679
|
+
"spawn_prompt": "You are the Next.js Development Specialist. Build Next.js 14+ apps with shadcn/ui, TanStack Query, and Framer Motion.\n\nWorkflow:\n1. Read `.morph/context/design-system.md` FIRST — use only defined tokens\n2. Read spec.md for frontend requirements\n3. Implement with App Router patterns (Server Components default, \"use client\" only when needed)\n\nALWAYS: useReducedMotion() for WCAG compliance. Never edit shadcn/ui primitives.\n\nRefer to the Domain Knowledge section below for App Router patterns, data fetching, animation, and component reference."
|
|
679
680
|
}
|
|
680
681
|
},
|
|
681
682
|
"css-specialist": {
|
|
@@ -719,7 +720,7 @@
|
|
|
719
720
|
"role": "CSS & Design System Specialist",
|
|
720
721
|
"icon": "🎨",
|
|
721
722
|
"triggers": "CSS design tokens, Tailwind, color palette, WCAG accessibility, design system compliance",
|
|
722
|
-
"spawn_prompt": "You are the CSS & Design System Specialist.
|
|
723
|
+
"spawn_prompt": "You are the CSS & Design System Specialist. Validate and enforce design token compliance across all styling.\n\nMANDATORY FIRST STEP: Read `.morph/context/design-system.md` — any missing tokens must be added there before making fixes.\n\nRefer to the Domain Knowledge section below for token categories, naming conventions, and WCAG accessibility rules."
|
|
723
724
|
}
|
|
724
725
|
},
|
|
725
726
|
"seo-growth-hacker": {
|
|
@@ -749,7 +750,7 @@
|
|
|
749
750
|
"role": "SEO & Growth Specialist",
|
|
750
751
|
"icon": "📈",
|
|
751
752
|
"triggers": "SEO, meta tags, schema markup, Core Web Vitals, Lighthouse, structured data",
|
|
752
|
-
"spawn_prompt": "You are the SEO & Growth Specialist.
|
|
753
|
+
"spawn_prompt": "You are the SEO & Growth Specialist. Implement technical SEO, structured data, and Core Web Vitals optimization for Next.js.\n\nWorkflow:\n1. Read spec.md for SEO requirements and target keywords\n2. Audit existing pages and implement optimizations\n3. Target: 90+ Performance, 100 Accessibility, 100 Best Practices, 100 SEO on Lighthouse\n\nRefer to the Domain Knowledge section below for meta tag patterns, JSON-LD schemas, and Next.js optimization."
|
|
753
754
|
}
|
|
754
755
|
},
|
|
755
756
|
"morph-spec-architect": {
|
|
@@ -761,7 +762,7 @@
|
|
|
761
762
|
"design",
|
|
762
763
|
"tasks"
|
|
763
764
|
],
|
|
764
|
-
"reports_to": "
|
|
765
|
+
"reports_to": "standards-architect",
|
|
765
766
|
"domains": [
|
|
766
767
|
"cli",
|
|
767
768
|
"framework-design",
|
|
@@ -853,15 +854,15 @@
|
|
|
853
854
|
"teammate": {
|
|
854
855
|
"icon": "🏗️",
|
|
855
856
|
"role": "Architecture Validator (read-only)",
|
|
856
|
-
"triggers": "architecture validation,
|
|
857
|
-
"spawn_prompt": "You are the Architecture Validator (READ-ONLY). Scan for architectural violations in .NET projects.\n\nWhen invoked:\n1. Use Grep and Glob to scan all .cs files and Program.cs\n2. Check for: DbContext injection, async anti-patterns, DI registration order,
|
|
857
|
+
"triggers": "architecture validation, VSA slice violations, async anti-patterns, DI registration order",
|
|
858
|
+
"spawn_prompt": "You are the Architecture Validator (READ-ONLY). Scan for architectural violations in .NET VSA projects.\n\nWhen invoked:\n1. Use Grep and Glob to scan all .cs files and Program.cs\n2. Check for: DbContext injection, async anti-patterns, DI registration order, VSA violations\n\nScan checklist:\n- DbContext injection: direct DbContext injection in background services (use IDbContextFactory)\n- Async anti-patterns: .Result, .Wait(), .GetAwaiter().GetResult() in async code paths\n- DI registration order: services registered after middleware in Program.cs (services before app.Use*/Map*)\n- VSA slice violations: cross-feature imports (Feature A referencing Feature B internals), shared code not in Shared project\n- Handler pattern: Handlers must return Result<T>, use CancellationToken, be sealed\n\nOutput JSON:\n{\n \"passed\": boolean,\n \"issues\": [{ \"file\": string, \"line\": number, \"message\": string, \"severity\": \"error\" }]\n}\n\nDo NOT modify any files."
|
|
858
859
|
},
|
|
859
860
|
"hook_behavior": {
|
|
860
861
|
"validates": [
|
|
861
862
|
"DbContext injection (IDbContextFactory required)",
|
|
862
863
|
"Async/await patterns (no .Result or .Wait)",
|
|
863
864
|
"DI registration order (services before middleware)",
|
|
864
|
-
"
|
|
865
|
+
"VSA slice isolation (no cross-feature imports)"
|
|
865
866
|
],
|
|
866
867
|
"severity": "error",
|
|
867
868
|
"blocks_on_fail": true
|
|
@@ -364,6 +364,23 @@ To create a new VSA project:
|
|
|
364
364
|
|
|
365
365
|
---
|
|
366
366
|
|
|
367
|
+
## Step 6.5 — Reinstall Stack-Filtered Assets
|
|
368
|
+
|
|
369
|
+
Now that config.json has the correct `project.stack` and `project.integrations`,
|
|
370
|
+
re-install stack-aware assets (rules, skills, agents) with the correct stack tags:
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
morph-spec setup-infra --reinstall
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
This re-runs only the stack-aware installation steps (rules, skills, tier 1-4 agents,
|
|
377
|
+
domain agents) using projectTags derived from the updated config.json.
|
|
378
|
+
Infrastructure steps (directory creation, framework copy, hooks) are skipped.
|
|
379
|
+
|
|
380
|
+
Output confirms: `✓ setup-infra (reinstall): complete.`
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
367
384
|
## Step 7 — Configure MCPs
|
|
368
385
|
|
|
369
386
|
For each detected integration with an available MCP:
|
|
@@ -494,6 +511,8 @@ For Node.js CLI projects, update config:
|
|
|
494
511
|
|
|
495
512
|
Before printing the summary, check `~/.claude/settings.local.json` for `env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`. If set to `"1"`, mark Agent Teams as enabled; otherwise show the warning.
|
|
496
513
|
|
|
514
|
+
**Important:** Report the `morph-spec doctor` output verbatim. Do NOT fabricate or reinterpret warnings about missing agents — the doctor check is authoritative. If doctor reports no issues, do not add your own warnings.
|
|
515
|
+
|
|
497
516
|
```
|
|
498
517
|
✓ Plugins: superpowers ✓ context7 ✓ playwright ✓
|
|
499
518
|
✓ Infrastructure: .morph/ structure, hooks, agents, rules, skills
|
|
@@ -3,7 +3,7 @@ name: morph-phase-codebase-analysis
|
|
|
3
3
|
description: MORPH-SPEC Design sub-phase that analyzes existing codebase and database schema, producing schema-analysis.md with real column names, types, relationships, and field mismatches. Use at the start of Design phase before generating contracts.cs to prevent incorrect field names or types.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
6
|
-
cliVersion: "4.
|
|
6
|
+
cliVersion: "4.16.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# MORPH Codebase Analysis - Design Sub-phase
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 2 (Design). Schema-first interactive design: reads
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, Agent
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.16.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Design — Phase 2
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 3 (Plan). Generates a detailed implementation plan
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.16.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Plan — Phase 3
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 4 (Tasks). Breaks approved spec into bottom-up ord
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.16.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Tasks — Phase 4
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 2 (UI/UX). Creates design-system.md, mockups.md, c
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.16.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH UI/UX Design - Phase 2
|
|
@@ -4,7 +4,7 @@ description: Guided workflow for mid-implementation scope escalation — analyze
|
|
|
4
4
|
user-invocable: true
|
|
5
5
|
argument-hint: "[feature-name]"
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.16.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# Scope Escalation Workflow
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { logger } from '../../utils/logger.js';
|
|
|
4
4
|
export async function setupInfraCommand(options) {
|
|
5
5
|
const targetPath = options.path || process.cwd();
|
|
6
6
|
try {
|
|
7
|
-
await setupInfra(targetPath);
|
|
7
|
+
await setupInfra(targetPath, { reinstall: options.reinstall ?? false });
|
|
8
8
|
} catch (err) {
|
|
9
9
|
logger.error(`setup-infra failed: ${err.message}`);
|
|
10
10
|
process.exit(1);
|
|
@@ -79,19 +79,75 @@ export function installRulesForStack(rulesSrc, rulesDest, projectTags) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Re-install only stack-aware assets (rules, skills, agents) using current config.json.
|
|
84
|
+
* Skips infrastructure steps (dirs, framework copy, hooks).
|
|
85
|
+
*
|
|
86
|
+
* @param {string} targetPath - Absolute path to the target project directory
|
|
87
|
+
* @param {Function} log - Logging function
|
|
88
|
+
* @returns {{ agentCounts: object, domainCounts: object, projectTags: string[] }}
|
|
89
|
+
*/
|
|
90
|
+
async function installStackAwareAssets(targetPath, log) {
|
|
91
|
+
const configPath = join(targetPath, '.morph', 'config', 'config.json');
|
|
92
|
+
let projectTags = [];
|
|
93
|
+
if (await pathExists(configPath)) {
|
|
94
|
+
try {
|
|
95
|
+
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
96
|
+
projectTags = getProjectTags(config);
|
|
97
|
+
} catch { /* ignore malformed config */ }
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
log('Installing stack-filtered rules...');
|
|
101
|
+
const claudeDest = join(targetPath, '.claude');
|
|
102
|
+
const rulesSrc = join(FRAMEWORK_DIR, 'rules');
|
|
103
|
+
const rulesDest = join(claudeDest, 'rules');
|
|
104
|
+
if (await pathExists(rulesSrc)) {
|
|
105
|
+
await ensureDir(rulesDest);
|
|
106
|
+
installRulesForStack(rulesSrc, rulesDest, projectTags);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
log('Installing skills...');
|
|
110
|
+
await installSkills(targetPath, { projectTags });
|
|
111
|
+
|
|
112
|
+
log('Installing agents...');
|
|
113
|
+
const agentCounts = await installAgents(targetPath, FRAMEWORK_DIR, { projectTags });
|
|
114
|
+
|
|
115
|
+
log('Installing domain agents...');
|
|
116
|
+
const domainCounts = await installDomainAgents(targetPath, FRAMEWORK_DIR, { projectTags });
|
|
117
|
+
|
|
118
|
+
return { agentCounts, domainCounts, projectTags };
|
|
119
|
+
}
|
|
120
|
+
|
|
82
121
|
/**
|
|
83
122
|
* Installs MORPH-SPEC infrastructure into the target project directory.
|
|
84
123
|
* Headless — no prompts, no spinner (suppressed when MORPH_QUIET=1), no stack detection.
|
|
85
124
|
*
|
|
86
125
|
* @param {string} targetPath - Absolute path to the target project directory
|
|
126
|
+
* @param {object} options
|
|
127
|
+
* @param {Function} options._exec - exec function (for testing)
|
|
128
|
+
* @param {boolean} options.reinstall - If true, only re-install stack-aware assets (rules, skills, agents)
|
|
87
129
|
*/
|
|
88
|
-
export async function setupInfra(targetPath, { _exec = execSync } = {}) {
|
|
130
|
+
export async function setupInfra(targetPath, { _exec = execSync, reinstall = false } = {}) {
|
|
89
131
|
const quiet = process.env.MORPH_QUIET === '1';
|
|
90
132
|
|
|
91
133
|
function log(msg) {
|
|
92
134
|
if (!quiet) process.stdout.write(msg + '\n');
|
|
93
135
|
}
|
|
94
136
|
|
|
137
|
+
// --- Reinstall mode: only re-install stack-aware assets ---
|
|
138
|
+
if (reinstall) {
|
|
139
|
+
log('setup-infra (reinstall): re-installing stack-aware assets...');
|
|
140
|
+
const { agentCounts, domainCounts } = await installStackAwareAssets(targetPath, log);
|
|
141
|
+
log('setup-infra (reinstall): complete.');
|
|
142
|
+
return {
|
|
143
|
+
agents: {
|
|
144
|
+
tier1: agentCounts?.tier1 ?? 0,
|
|
145
|
+
tier2: agentCounts?.tier2 ?? 0,
|
|
146
|
+
specialists: domainCounts?.specialists ?? 0,
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
95
151
|
// --- 0. Install required Claude Code plugins ---
|
|
96
152
|
await installRequiredPlugins(log, _exec);
|
|
97
153
|
|
|
@@ -188,35 +244,9 @@ export async function setupInfra(targetPath, { _exec = execSync } = {}) {
|
|
|
188
244
|
await copyDirectory(commandsSrc, commandsDest);
|
|
189
245
|
}
|
|
190
246
|
|
|
191
|
-
// ---
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
try {
|
|
195
|
-
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
196
|
-
projectTags = getProjectTags(config);
|
|
197
|
-
} catch { /* ignore malformed config */ }
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// --- 10. Copy framework/rules → .claude/rules (filtered by stack) ---
|
|
201
|
-
log('Step 10: Installing path-scoped rules...');
|
|
202
|
-
const rulesSrc = join(FRAMEWORK_DIR, 'rules');
|
|
203
|
-
const rulesDest = join(claudeDest, 'rules');
|
|
204
|
-
if (await pathExists(rulesSrc)) {
|
|
205
|
-
await ensureDir(rulesDest);
|
|
206
|
-
installRulesForStack(rulesSrc, rulesDest, projectTags);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// --- 11. installSkills (filtered by stack) ---
|
|
210
|
-
log('Step 11: Installing skills...');
|
|
211
|
-
await installSkills(targetPath, { projectTags });
|
|
212
|
-
|
|
213
|
-
// --- 12. installAgents ---
|
|
214
|
-
log('Step 12: Installing agents...');
|
|
215
|
-
const agentCounts = await installAgents(targetPath, FRAMEWORK_DIR, { projectTags });
|
|
216
|
-
|
|
217
|
-
// --- 13. installDomainAgents (filtered by stack) ---
|
|
218
|
-
log('Step 13: Installing domain agents...');
|
|
219
|
-
const domainCounts = await installDomainAgents(targetPath, FRAMEWORK_DIR, { projectTags });
|
|
247
|
+
// --- 10-13. Install stack-aware assets (rules, skills, agents) ---
|
|
248
|
+
log('Steps 10-13: Installing stack-aware assets...');
|
|
249
|
+
const { agentCounts, domainCounts } = await installStackAwareAssets(targetPath, log);
|
|
220
250
|
|
|
221
251
|
// --- 14. Copy framework/CLAUDE.md → .claude/CLAUDE.md (morph-owned, gitignored) ---
|
|
222
252
|
log('Step 14: Installing .claude/CLAUDE.md...');
|
|
@@ -262,19 +262,23 @@ function buildBody(agent) {
|
|
|
262
262
|
* Handles both inline values and YAML block scalars (>).
|
|
263
263
|
*
|
|
264
264
|
* @param {string} rawContent - Raw file content
|
|
265
|
-
* @returns {{ name: string|null, description: string|null, allowedTools: string, body: string }}
|
|
265
|
+
* @returns {{ name: string|null, description: string|null, allowedTools: string, color: string|null, effort: string|null, permissionMode: string|null, background: boolean, stacks: string[], body: string }}
|
|
266
266
|
*/
|
|
267
267
|
export function parseSkillFile(rawContent) {
|
|
268
268
|
// Normalize CRLF to LF for consistent parsing on Windows
|
|
269
269
|
const content = rawContent.replace(/\r\n/g, '\n');
|
|
270
270
|
const match = content.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
|
|
271
|
-
if (!match) return { name: null, description: null, allowedTools: 'Read, Write, Edit, Bash, Glob, Grep', body: rawContent };
|
|
271
|
+
if (!match) return { name: null, description: null, allowedTools: 'Read, Write, Edit, Bash, Glob, Grep', color: null, effort: null, permissionMode: null, background: false, body: rawContent };
|
|
272
272
|
|
|
273
273
|
const fm = match[1];
|
|
274
274
|
const body = match[2];
|
|
275
275
|
|
|
276
276
|
const name = (fm.match(/^name:\s*(.+)$/m) ?? [])[1]?.trim() ?? null;
|
|
277
277
|
const allowedTools = (fm.match(/^allowed-tools:\s*(.+)$/m) ?? [])[1]?.trim() ?? 'Read, Write, Edit, Bash, Glob, Grep';
|
|
278
|
+
const color = (fm.match(/^color:\s*(.+)$/m) ?? [])[1]?.trim() ?? null;
|
|
279
|
+
const effort = (fm.match(/^effort:\s*(.+)$/m) ?? [])[1]?.trim() ?? null;
|
|
280
|
+
const permissionMode = (fm.match(/^permissionMode:\s*(.+)$/m) ?? [])[1]?.trim() ?? null;
|
|
281
|
+
const background = (fm.match(/^background:\s*(.+)$/m) ?? [])[1]?.trim() === 'true';
|
|
278
282
|
|
|
279
283
|
let description = null;
|
|
280
284
|
const blockMatch = fm.match(/^description:\s*>\s*\n((?:[ \t]+.*\n?)*)/m);
|
|
@@ -286,7 +290,7 @@ export function parseSkillFile(rawContent) {
|
|
|
286
290
|
}
|
|
287
291
|
|
|
288
292
|
const stacks = parseStacks(rawContent);
|
|
289
|
-
return { name, description, allowedTools, stacks, body };
|
|
293
|
+
return { name, description, allowedTools, color, effort, permissionMode, background, stacks, body };
|
|
290
294
|
}
|
|
291
295
|
|
|
292
296
|
/**
|
|
@@ -311,6 +315,8 @@ export function collectSkillFiles(dir) {
|
|
|
311
315
|
/**
|
|
312
316
|
* Installs domain agent files as native Claude Code subagents
|
|
313
317
|
* in .claude/agents/ with memory:project, model:sonnet, maxTurns:20.
|
|
318
|
+
* Supports optional CC-native fields (color, effort, permissionMode, background)
|
|
319
|
+
* declared in each domain file's YAML frontmatter.
|
|
314
320
|
*
|
|
315
321
|
* @param {string} projectDir - Target project directory
|
|
316
322
|
* @param {string} frameworkDir - Path to morph-spec framework/ directory
|
|
@@ -326,20 +332,24 @@ export async function installDomainAgents(projectDir, frameworkDir = 'framework'
|
|
|
326
332
|
const installed = new Set();
|
|
327
333
|
for (const filePath of collectSkillFiles(domainsDir)) {
|
|
328
334
|
const raw = readFileSync(filePath, 'utf-8');
|
|
329
|
-
const { name, description, allowedTools, stacks, body } = parseSkillFile(raw);
|
|
335
|
+
const { name, description, allowedTools, color, effort, permissionMode, background, stacks, body } = parseSkillFile(raw);
|
|
330
336
|
if (!name) continue;
|
|
331
337
|
if (!shouldInstall(stacks, projectTags)) continue;
|
|
332
338
|
|
|
333
339
|
const desc = description ?? `MORPH-SPEC domain agent: ${name}`;
|
|
334
|
-
const
|
|
340
|
+
const lines = [
|
|
335
341
|
`name: ${name}`,
|
|
336
342
|
`description: ${desc}`,
|
|
337
343
|
`model: sonnet`,
|
|
338
344
|
`tools: ${allowedTools}`,
|
|
339
345
|
`maxTurns: 20`,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
346
|
+
];
|
|
347
|
+
if (color) lines.push(`color: ${color}`);
|
|
348
|
+
if (effort) lines.push(`effort: ${effort}`);
|
|
349
|
+
if (permissionMode && permissionMode !== 'default') lines.push(`permissionMode: ${permissionMode}`);
|
|
350
|
+
if (background) lines.push(`background: true`);
|
|
351
|
+
lines.push(`memory: project`, '');
|
|
352
|
+
const frontmatter = lines.join('\n');
|
|
343
353
|
|
|
344
354
|
// If agents.json already generated morph-{name}.md, append domain content there
|
|
345
355
|
const agentsJsonFile = `morph-${name}.md`;
|