@polymorphism-tech/morph-spec 4.8.17 → 4.8.19

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/CLAUDE.md ADDED
@@ -0,0 +1,77 @@
1
+ # MORPH-SPEC Runtime Instructions
2
+
3
+ > by Polymorphism Tech — Spec-driven development for .NET/Blazor/Next.js/Azure
4
+
5
+ ---
6
+
7
+ ## Project Context
8
+
9
+ @.morph/context/README.md
10
+
11
+ ---
12
+
13
+ ## Critical Rules
14
+
15
+ **NEVER:**
16
+ - Skip to code without a specification
17
+ - Implement without design approval
18
+ - Ignore standards in `.morph/framework/standards/`
19
+ - Create infrastructure manually
20
+ - Generate code without defined contracts
21
+
22
+ **ALWAYS:**
23
+ - Follow the mandatory phases
24
+ - Generate outputs in `.morph/features/{feature}/`
25
+ - Document decisions in `decisions.md`
26
+ - Checkpoint every 3 implemented tasks
27
+ - Use Infrastructure as Code
28
+
29
+ ---
30
+
31
+ ## Quick Reference
32
+
33
+ | Command | Purpose |
34
+ |---------|---------|
35
+ | `/morph-proposal {feature}` | Full spec pipeline (phases 1–4, pauses for approval) |
36
+ | `/morph-apply {feature}` | Implement feature (phase 5) |
37
+ | `/morph-status` | Feature status dashboard |
38
+ | `/morph-preflight` | Pre-implementation validation |
39
+
40
+ ---
41
+
42
+ ## State & Outputs
43
+
44
+ | Path | Notes |
45
+ |------|-------|
46
+ | `.morph/state.json` | **READ-ONLY** — use `morph-spec` CLI to update |
47
+ | `.morph/features/{feature}/{phase}/` | Feature outputs organized by phase |
48
+ | `.morph/framework/` | **READ-ONLY** — framework files managed by morph-spec |
49
+ | `.morph/config/config.json` | Project configuration (editable) |
50
+
51
+ ---
52
+
53
+ ## Phase Sequence
54
+
55
+ ```
56
+ proposal → setup → [uiux] → design → clarify → tasks → implement → [sync]
57
+ ```
58
+
59
+ Use `morph-spec status {feature}` to see current phase and pending approval gates.
60
+
61
+ ---
62
+
63
+ ## Agents
64
+
65
+ Tier-1 and tier-2 MORPH agents are available as native subagents in `.claude/agents/`.
66
+ They can be invoked directly by Claude Code during multi-agent workflows.
67
+
68
+ ---
69
+
70
+ ## Context Window Tip
71
+
72
+ When using 3+ MCPs, add `"experimental": { "mcpCliMode": true }` to `.claude/settings.json`.
73
+ MCP tools load on-demand instead of all at startup — keeps context clean for actual work.
74
+
75
+ ---
76
+
77
+ *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.8.17
6
+ **Version:** 4.8.19
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.8.17 by [Polymorphism Tech](https://polymorphism.tech)*
379
+ *morph-spec v4.8.19 by [Polymorphism Tech](https://polymorphism.tech)*
package/bin/morph-spec.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import { program } from 'commander';
4
4
  import chalk from 'chalk';
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morph-spec",
3
- "version": "4.8.17",
3
+ "version": "4.8.19",
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",
@@ -200,4 +200,4 @@ These files are never edited directly. Use CLI commands or `morph-spec update` i
200
200
 
201
201
  ---
202
202
 
203
- *morph-spec v4.8.17 by Polymorphism Tech*
203
+ *morph-spec v4.8.19 by Polymorphism Tech*
@@ -203,4 +203,4 @@ morph-spec doctor
203
203
 
204
204
  ---
205
205
 
206
- *morph-spec v4.8.17 by Polymorphism Tech*
206
+ *morph-spec v4.8.19 by Polymorphism Tech*
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "$schema": "./agent-schema.json",
3
- "version": "3.2.0-hierarchical",
4
- "total_agents": 39,
3
+ "version": "3.3.0-hierarchical",
4
+ "total_agents": 42,
5
5
  "tiers": {
6
6
  "tier_1_orchestrators": 3,
7
7
  "tier_2_leaders": 4,
8
- "tier_3_specialists": 27,
9
- "tier_4_validators": 5
8
+ "tier_3_specialists": 29,
9
+ "tier_4_validators": 6
10
10
  },
11
11
  "agents": {
12
12
  "_comment_tier_1": "=== TIER 1: ORCHESTRATORS (3) ===",
@@ -1615,7 +1615,51 @@
1615
1615
  "spawn_prompt": "Você é o VSA Specialist. Analise a proposta e produza um VSA Blueprint:\n1. ENTITY FIELDS: todos os campos com tipos C# corretos (sem AggregateRoot, sem Value Objects)\n2. OPERATIONS: slices necessários (Create, GetAll, GetById, Update, Delete + operações customizadas)\n3. ROUTES: HTTP method + rota por operação (ex: POST /api/products, GET /api/products/{id:guid})\n4. ERROR TYPES: Error factory methods para {Entity}Errors (apenas NotFound e casos específicos)\n5. VALIDATION RULES: regras FluentValidation por campo por operação\n\nNão use AggregateRoot, DomainEvent, CQRS formal, MediatR, Application Service layer.\nCada operação é um slice autônomo: Request + Response + Handler + Validator + Endpoint.\nRef: framework/standards/architecture/vertical-slice/vertical-slice.md"
1616
1616
  }
1617
1617
  },
1618
- "_comment_tier_4": "=== TIER 4: VALIDATORS (5) ===",
1618
+ "_comment_tier_3_nodejs": "=== TIER 3: NODEJS/CLI SPECIALISTS (2) ===",
1619
+ "morph-spec-architect": {
1620
+ "tier": 3,
1621
+ "role": "specialist",
1622
+ "title": "Morph-Spec Architect",
1623
+ "domains": ["cli", "framework-design", "nodejs", "architecture"],
1624
+ "keywords": ["morph-spec", "framework feature", "new command", "cli architecture", "plugin", "hook design"],
1625
+ "negativeKeywords": ["blazor", "dotnet", "react", "frontend"],
1626
+ "always_active": false,
1627
+ "validators": [],
1628
+ "relationships": {
1629
+ "reports_to": "feature-lead",
1630
+ "coordinates": ["nodejs-cli-expert", "morph-spec-validator"],
1631
+ "active_phases": ["design", "tasks"]
1632
+ },
1633
+ "standards": [],
1634
+ "teammate": {
1635
+ "role": "specialist",
1636
+ "icon": "🔧",
1637
+ "spawn_prompt": "You are the Morph-Spec Architect. You deeply understand the morph-spec-framework codebase: its 4-tier agent hierarchy, state machine (v5.0.0 with filesystem-based phase derivation), Commander.js CLI surface (~25 commands registered in bin/morph-spec.js), hooks system (v2.5, 10 hooks), skills system, and the .morph/ directory layout. Your job is to design new features that fit naturally into the existing architecture. Before proposing implementation, always: (1) identify which existing modules can be reused, (2) determine where the new command should live in src/commands/, (3) define the state impact (does it need new state fields?), (4) list which tests need to be written. Follow ESM module patterns throughout."
1638
+ }
1639
+ },
1640
+ "nodejs-cli-expert": {
1641
+ "tier": 3,
1642
+ "role": "specialist",
1643
+ "title": "Node.js CLI Expert",
1644
+ "domains": ["nodejs", "cli", "javascript", "esm", "testing"],
1645
+ "keywords": ["nodejs", "javascript", "esm", "commander", "node --test", "cli command", "morph-spec implementation"],
1646
+ "negativeKeywords": ["blazor", "dotnet", "react", "typescript"],
1647
+ "always_active": false,
1648
+ "validators": [],
1649
+ "relationships": {
1650
+ "reports_to": "feature-lead",
1651
+ "coordinates": ["morph-spec-architect"],
1652
+ "escalates_to": "morph-spec-validator",
1653
+ "active_phases": ["implement"]
1654
+ },
1655
+ "standards": [],
1656
+ "teammate": {
1657
+ "role": "specialist",
1658
+ "icon": "🟢",
1659
+ "spawn_prompt": "You are the Node.js CLI Expert for the morph-spec-framework. You implement features in Node.js ESM following the project's conventions: (1) All imports use ESM syntax with .js extensions on relative paths; (2) Commands are registered in bin/morph-spec.js after being defined in src/commands/<domain>/<command>.js; (3) Tests use native node:test runner with mock.fn() for mocking — no external test libraries; (4) Error handling: hooks are fail-open (catch+exit 0), CLI commands exit(1) on fatal errors; (5) Never use require() or module.exports. When implementing a feature, always write the tests alongside the implementation. The test command is: node --test --test-concurrency=1"
1660
+ }
1661
+ },
1662
+ "_comment_tier_4": "=== TIER 4: VALIDATORS (6) ===",
1619
1663
  "security-expert": {
1620
1664
  "tier": 4,
1621
1665
  "role": "validator",
@@ -1831,6 +1875,34 @@
1831
1875
  "severity": "error",
1832
1876
  "blocks_on_fail": true
1833
1877
  }
1878
+ },
1879
+ "morph-spec-validator": {
1880
+ "tier": 4,
1881
+ "role": "validator",
1882
+ "title": "Morph-Spec Validator",
1883
+ "domains": ["nodejs", "cli", "testing", "validation"],
1884
+ "keywords": ["validate morph-spec", "node.js validation", "cli test"],
1885
+ "always_active": false,
1886
+ "validators": ["morph-spec-standards"],
1887
+ "relationships": {
1888
+ "reports_to": "qa-lead",
1889
+ "runs_in": "post-implement",
1890
+ "active_phases": ["implement", "validate"]
1891
+ },
1892
+ "standards": [],
1893
+ "teammate": null,
1894
+ "hook_behavior": {
1895
+ "validates": [
1896
+ "ESM imports use .js extensions on relative paths",
1897
+ "New commands are registered in bin/morph-spec.js",
1898
+ "Tests exist for new modules (one test file per module)",
1899
+ "npm test passes with no failures",
1900
+ "No require() or module.exports used",
1901
+ "Error handling follows fail-open pattern for hooks"
1902
+ ],
1903
+ "severity": "error",
1904
+ "blocks_on_fail": true
1905
+ }
1834
1906
  }
1835
1907
  },
1836
1908
  "squads": {
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 3 (Clarify). Reviews spec.md for ambiguities, gene
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
7
- cliVersion: "4.8.17"
7
+ cliVersion: "4.8.19"
8
8
  ---
9
9
 
10
10
  # MORPH Clarify - FASE 3
@@ -3,7 +3,7 @@ name: 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
6
- cliVersion: "4.8.17"
6
+ cliVersion: "4.8.19"
7
7
  ---
8
8
 
9
9
  # MORPH Codebase Analysis - Sub-fase de DESIGN
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 2 (Design). Analyzes codebase/schema, then produce
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
7
- cliVersion: "4.8.17"
7
+ cliVersion: "4.8.19"
8
8
  ---
9
9
 
10
10
  # MORPH Design - FASE 2
@@ -6,7 +6,7 @@ disable-model-invocation: true
6
6
  context: fork
7
7
  agent: general-purpose
8
8
  user-invocable: false
9
- cliVersion: "4.8.17"
9
+ cliVersion: "4.8.19"
10
10
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
11
11
  ---
12
12
 
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 1 (Setup). Reads project context, detects tech sta
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
7
- cliVersion: "4.8.17"
7
+ cliVersion: "4.8.19"
8
8
  ---
9
9
 
10
10
  # MORPH Setup - FASE 1
@@ -5,7 +5,7 @@ argument-hint: "[feature-name]"
5
5
  disable-model-invocation: true
6
6
  user-invocable: false
7
7
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
8
- cliVersion: "4.8.17"
8
+ cliVersion: "4.8.19"
9
9
  ---
10
10
 
11
11
  # MORPH Tasks - FASE 4
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 1.5 (UI/UX). Creates design-system.md, mockups.md,
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
7
- cliVersion: "4.8.17"
7
+ cliVersion: "4.8.19"
8
8
  ---
9
9
 
10
10
  # MORPH UI/UX Design - FASE 1.5
@@ -0,0 +1,40 @@
1
+ {
2
+ "id": "nodejs-cli",
3
+ "name": "Node.js CLI Development",
4
+ "description": "Workflow otimizado para desenvolvimento de features em projetos CLI Node.js/ESM, como o morph-spec-framework.",
5
+ "criteria": {
6
+ "maxFiles": 15,
7
+ "maxLines": 400,
8
+ "maxComponents": 0,
9
+ "noInfrastructure": true,
10
+ "noArchitecturalDecisions": false
11
+ },
12
+ "keywords": [
13
+ "nodejs", "javascript", "esm", "cli", "commander", "command", "morph-spec",
14
+ "hook", "validator", "plugin", "script"
15
+ ],
16
+ "phases": {
17
+ "run": ["proposal", "setup", "design", "tasks", "implement"],
18
+ "skip": ["uiux", "clarify", "sync"],
19
+ "combined": {}
20
+ },
21
+ "pausePoints": [
22
+ {
23
+ "phase": "design",
24
+ "question": "O design da feature está correto? Approve para gerar tasks."
25
+ },
26
+ {
27
+ "phase": "tasks",
28
+ "question": "As tasks estão bem definidas? Approve para iniciar implementação."
29
+ }
30
+ ],
31
+ "outputs": {
32
+ "required": ["proposal", "spec", "tasks"],
33
+ "optional": ["contracts", "decisions", "recap"]
34
+ },
35
+ "agentPreferences": {
36
+ "specialists": ["morph-spec-architect", "nodejs-cli-expert"],
37
+ "validators": ["morph-spec-validator"]
38
+ },
39
+ "priority": 5
40
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polymorphism-tech/morph-spec",
3
- "version": "4.8.17",
3
+ "version": "4.8.19",
4
4
  "description": "MORPH-SPEC: AI-First development framework with validation pipeline and multi-stack support",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -30,17 +30,29 @@ export async function installGlobalSkill(claudeDir = join(homedir(), '.claude'))
30
30
  // Run as postinstall script
31
31
  if (process.argv[1] === fileURLToPath(import.meta.url)) {
32
32
  const HOOKS_SRC = join(FRAMEWORK_DIR, 'hooks', 'claude-code');
33
+ const { readFileSync } = await import('fs');
34
+ const pkg = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8'));
33
35
 
34
- await Promise.allSettled([
35
- installGlobalSkill()
36
- .then(() => console.log('✓ morph-init skill installed to ~/.claude/skills/')),
37
- installGlobalStatusline(HOOKS_SRC)
38
- .then(() => console.log('✓ statusline installed to ~/.claude/')),
39
- ]).then(results => {
40
- for (const r of results) {
41
- if (r.status === 'rejected') {
42
- console.warn(' postinstall warning:', r.reason?.message || r.reason);
43
- }
44
- }
45
- });
36
+ const [skillResult, statuslineResult] = await Promise.allSettled([
37
+ installGlobalSkill(),
38
+ installGlobalStatusline(HOOKS_SRC),
39
+ ]);
40
+
41
+ const results = [
42
+ {
43
+ ok: skillResult.status === 'fulfilled',
44
+ label: 'morph-init skill',
45
+ path: '~/.claude/skills/',
46
+ error: skillResult.reason?.message,
47
+ },
48
+ {
49
+ ok: statuslineResult.status === 'fulfilled',
50
+ label: 'statusline',
51
+ path: '~/.claude/',
52
+ error: statuslineResult.reason?.message,
53
+ },
54
+ ];
55
+
56
+ const { printInstallBanner } = await import('../utils/banner.js');
57
+ printInstallBanner({ version: pkg.version, nodeVersion: process.version, results });
46
58
  }
@@ -0,0 +1,51 @@
1
+ // src/utils/banner.js
2
+ import chalk from 'chalk';
3
+ import { type as osType, release as osRelease } from 'os';
4
+
5
+ const BRAND = chalk.hex('#7C3AED');
6
+ const DIM = chalk.dim;
7
+
8
+ function platformLabel() {
9
+ const t = osType();
10
+ const r = osRelease().split('.').slice(0, 2).join('.');
11
+ if (t === 'Windows_NT') return `Windows ${r}`;
12
+ if (t === 'Darwin') return `macOS ${r}`;
13
+ return `Linux ${r}`;
14
+ }
15
+
16
+ export function printInstallBanner({ version, nodeVersion, results = [] }) {
17
+ const TITLE = '◆ M O R P H - S P E C';
18
+ const pad = ` ${TITLE} `;
19
+ const line = '─'.repeat(pad.length);
20
+
21
+ const box = [
22
+ BRAND(`┌${line}┐`),
23
+ BRAND('│') + chalk.bold.white(pad) + BRAND('│'),
24
+ BRAND(`└${line}┘`),
25
+ ].join('\n');
26
+
27
+ const sep = (label) => DIM(` ── ${label} ${'─'.repeat(Math.max(0, 30 - label.length))}`);
28
+
29
+ const itemLines = results.map(r =>
30
+ r.ok
31
+ ? ` ${chalk.green('✔')} ${r.label.padEnd(20)} ${DIM(r.path)}`
32
+ : ` ${chalk.red('✖')} ${r.label.padEnd(20)} ${chalk.red(r.error ?? 'failed')}`
33
+ );
34
+
35
+ console.log([
36
+ '',
37
+ box,
38
+ '',
39
+ ` Version ${chalk.white(version)}`,
40
+ ` Platform ${chalk.white(platformLabel())}`,
41
+ ` Node ${chalk.white(nodeVersion)}`,
42
+ '',
43
+ sep('Installed'),
44
+ ...itemLines,
45
+ '',
46
+ sep('Next'),
47
+ ` ${chalk.cyan('1.')} Open your project in Claude Code`,
48
+ ` ${chalk.cyan('2.')} Run ${chalk.bold.white('/morph-init')}`,
49
+ '',
50
+ ].join('\n'));
51
+ }