@polymorphism-tech/morph-spec 4.15.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 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.15.0
6
+ **Version:** 4.16.0
7
7
  **Requires:** Node.js 18+, Claude Code
8
8
 
9
9
  ---
@@ -364,4 +364,4 @@ Code generated by morph-spec (contracts, templates, implementation output) belon
364
364
 
365
365
  ---
366
366
 
367
- *morph-spec v4.15.0 by [Polymorphism Tech](https://polymorphism.tech)*
367
+ *morph-spec v4.16.0 by [Polymorphism Tech](https://polymorphism.tech)*
package/bin/morph-spec.js CHANGED
@@ -98,6 +98,7 @@ program
98
98
  .command('setup-infra')
99
99
  .description('Install MORPH-SPEC infrastructure (headless, no prompts). Called by /morph-init skill.')
100
100
  .option('-p, --path <path>', 'Target path (default: current directory)')
101
+ .option('--reinstall', 'Re-install only stack-aware assets (rules, skills, agents)')
101
102
  .action(setupInfraCommand);
102
103
 
103
104
  program
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morph-spec",
3
- "version": "4.15.0",
3
+ "version": "4.16.0",
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",
@@ -196,4 +196,4 @@ These files are never edited directly. Use CLI commands or `morph-spec update` i
196
196
 
197
197
  ---
198
198
 
199
- *morph-spec v4.15.0 by Polymorphism Tech*
199
+ *morph-spec v4.16.0 by Polymorphism Tech*
@@ -197,4 +197,4 @@ morph-spec doctor
197
197
 
198
198
  ---
199
199
 
200
- *morph-spec v4.15.0 by Polymorphism Tech*
200
+ *morph-spec v4.16.0 by Polymorphism Tech*
@@ -3,6 +3,7 @@ name: ms-agent-expert
3
3
  description: Microsoft Agent Framework Expert for Semantic Kernel, AI extensions, function calling, MCP/A2A protocols, and agentic pipeline implementation. Use when building AI agents with Semantic Kernel, implementing tool/plugin calling, designing multi-agent workflows, or integrating LLMs with .NET services.
4
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
5
5
  stacks:
6
+ - dotnet
6
7
  - semantic-kernel
7
8
  - ms-agents
8
9
  color: yellow
@@ -269,6 +269,7 @@
269
269
  "color": "teal",
270
270
  "tier": 3,
271
271
  "title": "Data Persistence Specialist (Relational)",
272
+ "stacks": ["dotnet"],
272
273
  "group": "backend",
273
274
  "active_phases": [
274
275
  "design",
@@ -302,6 +303,7 @@
302
303
  "color": "teal",
303
304
  "tier": 3,
304
305
  "title": "Background Jobs Specialist",
306
+ "stacks": ["hangfire"],
305
307
  "group": "backend",
306
308
  "active_phases": [
307
309
  "implement"
@@ -335,6 +337,7 @@
335
337
  "color": "yellow",
336
338
  "tier": 3,
337
339
  "title": "Microsoft Agent Framework Expert",
340
+ "stacks": ["dotnet", "semantic-kernel", "ms-agents"],
338
341
  "group": "ai",
339
342
  "active_phases": [
340
343
  "design",
@@ -388,6 +391,7 @@
388
391
  "color": "teal",
389
392
  "tier": 3,
390
393
  "title": "Supabase & PostgreSQL Specialist",
394
+ "stacks": ["supabase"],
391
395
  "group": "backend",
392
396
  "active_phases": [
393
397
  "design",
@@ -461,6 +465,7 @@
461
465
  "color": "teal",
462
466
  "tier": 3,
463
467
  "title": "Payment Integration Specialist (Brazil)",
468
+ "stacks": ["asaas"],
464
469
  "group": "backend",
465
470
  "active_phases": [
466
471
  "design",
@@ -495,6 +500,7 @@
495
500
  "color": "teal",
496
501
  "tier": 3,
497
502
  "title": "Auth SaaS Integration Specialist",
503
+ "stacks": ["clerk"],
498
504
  "group": "backend",
499
505
  "active_phases": [
500
506
  "design",
@@ -526,6 +532,7 @@
526
532
  "color": "teal",
527
533
  "tier": 3,
528
534
  "title": "Email Integration Specialist",
535
+ "stacks": ["resend"],
529
536
  "group": "backend",
530
537
  "active_phases": [
531
538
  "implement"
@@ -559,6 +566,7 @@
559
566
  "color": "pink",
560
567
  "tier": 3,
561
568
  "title": "Next.js Development Specialist",
569
+ "stacks": ["nextjs"],
562
570
  "group": "frontend",
563
571
  "active_phases": [
564
572
  "uiux",
@@ -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.15.0"
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.15.0"
7
+ cliVersion: "4.16.0"
8
8
  ---
9
9
 
10
10
  # MORPH Design — Phase 2
@@ -5,7 +5,7 @@ argument-hint: "[feature-name]"
5
5
  context: fork
6
6
  agent: general-purpose
7
7
  user-invocable: false
8
- cliVersion: "4.15.0"
8
+ cliVersion: "4.16.0"
9
9
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, Agent
10
10
  ---
11
11
 
@@ -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.15.0"
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.15.0"
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.15.0"
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.15.0"
7
+ cliVersion: "4.16.0"
8
8
  ---
9
9
 
10
10
  # Scope Escalation Workflow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polymorphism-tech/morph-spec",
3
- "version": "4.15.0",
3
+ "version": "4.16.0",
4
4
  "description": "MORPH-SPEC: AI-First development framework with validation pipeline and multi-stack support",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -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
- // --- Compute project tags for stack-aware installation ---
192
- let projectTags = [];
193
- if (await pathExists(configPath)) {
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...');