@polymorphism-tech/morph-spec 11.1.1 → 11.3.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 +3 -2
- package/bin/morph-spec.js +13 -23
- package/docs/CHEATSHEET.md +3 -3
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +3 -1
- package/framework/MORPH.md +8 -3
- package/framework/agents.json +4 -4
- package/framework/docs/CLI.md +28 -18
- package/framework/evals/review-checklist.md +35 -18
- package/framework/hooks/README.md +18 -11
- package/framework/hooks/claude-code/core/README.md +2 -2
- package/framework/hooks/claude-code/core/chain.js +9 -25
- package/framework/hooks/claude-code/core/comment-guard.js +3 -9
- package/framework/hooks/claude-code/core/conventional-commit.js +3 -3
- package/framework/hooks/claude-code/core/graph-refresh-kick.js +6 -6
- package/framework/hooks/claude-code/core/masked-exit.js +4 -3
- package/framework/hooks/claude-code/core/pre-bash-denylist.js +2 -2
- package/framework/hooks/claude-code/core/protect-spec-files.js +2 -4
- package/framework/hooks/claude-code/core/stack-changed.js +5 -4
- package/framework/hooks/claude-code/core/validate-completion.js +15 -12
- package/framework/hooks/shared/contract.js +22 -1
- package/framework/hooks/shared/git-paths.js +6 -0
- package/framework/hooks/shared/graph-freshness.js +3 -3
- package/framework/hooks/shared/graph-refresh.js +5 -10
- package/framework/hooks/shared/hook-response.js +1 -18
- package/framework/hooks/shared/payload-utils.js +12 -1
- package/framework/hooks/shared/phase-utils.js +4 -52
- package/framework/hooks/shared/report-progress.js +1 -1
- package/framework/mcp/registry.json +16 -32
- package/framework/rules/ai-agents-standards.md +9 -1
- package/framework/rules/dotnet-templates.md +32 -33
- package/framework/rules/gsap-standards.md +8 -0
- package/framework/rules/infrastructure-standards.md +9 -9
- package/framework/rules/mcp-standards.md +10 -0
- package/framework/rules/neon-standards.md +4 -4
- package/framework/rules/nextjs-templates.md +10 -11
- package/framework/rules/ui-design.md +2 -2
- package/framework/schemas/config.schema.json +11 -0
- package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
- package/framework/skills/core/morph-apply/SKILL.md +6 -4
- package/framework/skills/core/morph-plan/SKILL.md +1 -1
- package/framework/skills/core/morph-uiux/SKILL.md +5 -5
- package/framework/standards/STANDARDS.json +8 -4
- package/framework/standards/STANDARDS.meta.json +1 -1
- package/framework/standards/ai-agents/agent-archetypes.md +1 -1
- package/framework/standards/ai-agents/middleware-patterns.md +0 -2
- package/framework/standards/ai-agents/prompt-sources.md +2 -2
- package/framework/standards/ai-agents/providers/model-registry.md +9 -12
- package/framework/standards/ai-agents/rag-custom-pgvector.md +2 -9
- package/framework/standards/frontend/design-system/ai-image-generation.md +1 -1
- package/framework/standards/infrastructure/docker/local-compose-isolation.md +2 -2
- package/framework/standards/integration/mcp/mcp-tools.md +125 -267
- package/framework/templates/README.md +52 -82
- package/framework/templates/REGISTRY.json +1 -281
- package/framework/templates/code/sql/ai-agents/agent-prompts-migration.sql.template +3 -4
- package/framework/templates/context/design-system.md +1 -1
- package/framework/templates/docs/plan.md +2 -2
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/model-registry.v2.json +1 -1
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaDisclosureTests.cs +1 -1
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Morph.AiKit.Tests.csproj +3 -5
- package/framework/templates/frontend/nextjs/gsap-scroll-section.tsx.hbs +13 -17
- package/framework/templates/infrastructure/docker/docker-compose.template.yml +15 -16
- package/framework/templates/infrastructure/github/README.md +10 -13
- package/package.json +7 -16
- package/src/commands/graph/build.js +2 -2
- package/src/commands/mcp/manual-setup.js +95 -0
- package/src/commands/mcp/mcp-setup.js +26 -192
- package/src/commands/project/doctor.js +48 -142
- package/src/commands/project/env.js +2 -1
- package/src/commands/project/init-contract.js +2 -2
- package/src/commands/project/init.js +34 -294
- package/src/commands/project/stack-scan.js +6 -14
- package/src/commands/project/stack-set.js +3 -1
- package/src/commands/project/standards.js +1 -2
- package/src/commands/project/update.js +87 -205
- package/src/commands/scaffold/scaffold.js +43 -5
- package/src/commands/validation/check.js +12 -10
- package/src/commands/validation/prove-red.js +61 -22
- package/src/core/paths/output-schema.js +8 -27
- package/src/core/templates/template-registry.js +8 -43
- package/src/core/templates/template-renderer.js +3 -200
- package/src/lib/ai/ai-checks.js +1 -1
- package/src/lib/ai/ai-project-scan.js +2 -5
- package/src/lib/ai/code-audit.js +3 -8
- package/src/lib/ai/registry-audit.js +2 -1
- package/src/lib/check/signals.js +25 -7
- package/src/lib/config/project-config.js +3 -2
- package/src/lib/contract/apply.js +2 -1
- package/src/lib/contract/defaults.js +2 -2
- package/src/lib/contract/merge.js +1 -0
- package/src/lib/contract/scan.js +5 -5
- package/src/lib/detectors/claude-config-detector.js +44 -98
- package/src/lib/detectors/mcp-config.js +2 -1
- package/src/lib/diff/diff-lines.js +4 -9
- package/src/lib/generators/scaffold-generator.js +5 -17
- package/src/lib/git/default-branch.js +5 -13
- package/src/lib/graph/graph-health.js +1 -1
- package/src/lib/graph/graph-loader.js +2 -1
- package/src/lib/graph/graphifyignore.js +5 -5
- package/src/lib/graph/sanitize.js +2 -2
- package/src/lib/installers/effects.js +0 -13
- package/src/lib/installers/install-manifest.js +56 -0
- package/src/lib/installers/mcp-installer.js +16 -19
- package/src/lib/installers/memory-installer.js +5 -8
- package/src/lib/installers/rules-installer.js +9 -15
- package/src/lib/installers/stack-assets.js +54 -7
- package/src/lib/installers/stack-sync.js +16 -16
- package/src/lib/installers/stack-tooling.js +4 -3
- package/src/lib/json-file.js +9 -0
- package/src/lib/plan/artifact-vocabulary.js +1 -1
- package/src/lib/plan/checks.js +4 -3
- package/src/lib/plan/media.js +6 -6
- package/src/lib/plan/plan-parser.js +6 -11
- package/src/lib/review-reports.js +13 -18
- package/src/lib/scan/worktree-dirs.js +1 -3
- package/src/lib/specs/adr-index.js +4 -4
- package/src/lib/specs/revocations.js +3 -3
- package/src/lib/stack/stack-scan.js +4 -4
- package/src/lib/standards/registry.js +1 -1
- package/src/lib/standards/verified-against.js +3 -3
- package/src/lib/tests-audit/audit.js +3 -3
- package/src/lib/text.js +5 -0
- package/src/scripts/global-install.js +41 -19
- package/src/scripts/setup-infra.js +68 -187
- package/src/utils/agents-installer.js +21 -60
- package/src/utils/claude-md-injector.js +16 -50
- package/src/utils/claude-settings-manager.js +29 -27
- package/src/utils/file-copier.js +3 -4
- package/src/utils/hooks-installer.js +83 -62
- package/src/utils/skills-installer.js +18 -78
- package/src/utils/version-checker.js +2 -31
- package/CLAUDE.md +0 -118
- package/framework/commands/create-umbraco-lp.md +0 -37
- package/framework/commands/migrate-lp-to-umbraco.md +0 -35
- package/framework/commands/morph-apply.md +0 -14
- package/framework/hooks/shared/spawn-command.js +0 -23
- package/framework/templates/CLAUDE.md.core.guide.md +0 -29
- package/framework/templates/CLAUDE.md.core.template +0 -22
- package/framework/templates/IDE-SNIPPETS.md +0 -262
- package/framework/templates/code/dotnet/ai-agents/AgentBootstrap.cs.template +0 -26
- package/framework/templates/code/dotnet/ai-agents/EmbeddingService.cs.template +0 -28
- package/framework/templates/code/dotnet/ai-agents/ModelRegistry.cs.template +0 -99
- package/framework/templates/code/dotnet/ai-agents/ResilientToolMiddleware.cs.template +0 -40
- package/framework/templates/code/dotnet/ai-agents/VectorSearchTool.cs.template +0 -54
- package/framework/templates/code/dotnet/ai-agents/model-registry.json.template +0 -53
- package/framework/templates/code/dotnet/contracts/README.md +0 -74
- package/framework/templates/code/dotnet/database/vector-entity.cs +0 -49
- package/framework/templates/code/sql/ai-agents/pgvector-embeddings-migration.sql.template +0 -91
- package/framework/templates/code/sql/postgresql-migration.template.sql +0 -108
- package/framework/templates/code/typescript/contracts.ts +0 -140
- package/framework/templates/context/ARCHITECTURE.md +0 -106
- package/framework/templates/examples/design-system-examples.md +0 -354
- package/framework/templates/infrastructure/docker/Dockerfile.template +0 -58
- package/framework/templates/infrastructure/github/actions/docker-build-push/action.yml.hbs +0 -45
- package/framework/templates/infrastructure/github/actions/health-check/action.yml.hbs +0 -27
- package/framework/templates/integrations/asaas-client.cs +0 -332
- package/framework/templates/integrations/asaas-webhook.cs +0 -290
- package/framework/templates/integrations/neon-auth-config.cs +0 -170
- package/framework/templates/ui/design-system.css +0 -226
- package/src/commands/context/context-refresh.js +0 -63
- package/src/lib/detectors/index.js +0 -178
- package/src/lib/generators/architecture-scanner.js +0 -543
- package/src/lib/generators/settings-generator.js +0 -97
- package/src/lib/graph/god-nodes.js +0 -65
- package/src/lib/installers/templates-reconcile.js +0 -26
|
@@ -1,134 +1,104 @@
|
|
|
1
1
|
# MORPH-SPEC Template System
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Templates organized by **technology**, indexed by `REGISTRY.json`.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
**89 templates**, grouped by the technology they target (dotnet, typescript, sql, docker,
|
|
8
|
-
nextjs) rather than by stack. A template for a .NET slice serves every stack with a .NET
|
|
9
|
-
backend, so a new stack reuses what exists instead of copying it.
|
|
5
|
+
Templates are grouped by the technology they target (dotnet, sql, docker, nextjs)
|
|
6
|
+
rather than by stack: a .NET slice template serves every stack with a .NET backend.
|
|
10
7
|
|
|
11
8
|
`REGISTRY.json` is the source of truth: it maps each template `id` to its `kind`, `path` and
|
|
12
|
-
`category` (the shape per kind is in its `kinds` block).
|
|
13
|
-
|
|
9
|
+
`category` (the shape per kind is in its `kinds` block). Code resolves a template by id through
|
|
10
|
+
the registry, never by a hardcoded path, and this README repeats no path the registry owns.
|
|
11
|
+
|
|
12
|
+
| Kind | What it is |
|
|
13
|
+
|------|------------|
|
|
14
|
+
| `template` | Rendered to an output file |
|
|
15
|
+
| `fragment` | A reference snippet read as an example, never rendered |
|
|
16
|
+
| `project` | A whole compilable project registered as one unit (`ai-kit`) |
|
|
14
17
|
|
|
15
18
|
---
|
|
16
19
|
|
|
17
|
-
##
|
|
20
|
+
## Directory structure
|
|
18
21
|
|
|
19
22
|
```
|
|
20
23
|
framework/templates/
|
|
21
|
-
├── docs/ # plan.md
|
|
22
|
-
├── context/ #
|
|
23
|
-
|
|
24
|
-
├── code/ # Code templates, by technology
|
|
24
|
+
├── docs/ # plan.md — the grammar `morph-spec plan-check` parses
|
|
25
|
+
├── context/ # design-system.md
|
|
26
|
+
├── code/
|
|
25
27
|
│ ├── dotnet/ # abstractions, ai-agents, constants, contracts, database,
|
|
26
28
|
│ │ # exceptions, extensions, feature, jobs, pipelines
|
|
27
|
-
│
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
├── frontend/
|
|
31
|
-
│ └── nextjs/ # page, client-component, feature-form, use-feature, env, tsconfig…
|
|
32
|
-
│
|
|
29
|
+
│ └── sql/ # postgresql migration, RLS policy, ai-agents
|
|
30
|
+
├── dotnet/ai-kit/ # Morph.AiKit — the compilable .NET solution behind the ai-agents standards
|
|
31
|
+
├── frontend/nextjs/ # page, client-component, feature-form, use-feature, env, tsconfig…
|
|
33
32
|
├── infrastructure/
|
|
34
33
|
│ ├── docker/ # Dockerfiles, compose, Coolify config
|
|
35
|
-
│ └── github/ # Actions workflows
|
|
36
|
-
|
|
37
|
-
├── integrations/ # asaas-client, asaas-webhook, neon-auth-config
|
|
38
|
-
├── ui/ # design-system.css
|
|
39
|
-
├── examples/ # design-system-examples.md
|
|
40
|
-
└── REGISTRY.json # template metadata — the index every consumer reads
|
|
34
|
+
│ └── github/ # Actions workflows (.hbs)
|
|
35
|
+
└── REGISTRY.json
|
|
41
36
|
```
|
|
42
37
|
|
|
43
38
|
---
|
|
44
39
|
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
All templates render through Handlebars with custom helpers registered in
|
|
48
|
-
`src/core/templates/template-renderer.js`.
|
|
49
|
-
|
|
50
|
-
```handlebars
|
|
51
|
-
# Feature: {{titleCase FEATURE_NAME}}
|
|
52
|
-
|
|
53
|
-
namespace {{pascalCase FEATURE_NAME}};
|
|
40
|
+
## Template engine: Handlebars
|
|
54
41
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
### Available helpers
|
|
42
|
+
Templates render through Handlebars with the helpers registered in
|
|
43
|
+
`src/core/templates/template-renderer.js`:
|
|
59
44
|
|
|
60
45
|
| Group | Helpers |
|
|
61
46
|
|-------|---------|
|
|
62
|
-
| **Case** | `pascalCase` `camelCase` `snakeCase` `upperSnakeCase` `kebabCase` `titleCase`
|
|
63
|
-
| **Words** | `pluralize`
|
|
64
|
-
| **
|
|
65
|
-
| **
|
|
66
|
-
| **String** | `trim` `replace` `concat` `substr` `startsWith` `endsWith` `contains` `length` |
|
|
67
|
-
| **Math** | `add` `subtract` `multiply` `divide` `mod` `round` |
|
|
68
|
-
| **Array** | `join` `first` `last` `slice` |
|
|
69
|
-
| **Misc** | `json` `now` `year` `formatDate` |
|
|
47
|
+
| **Case** | `pascalCase` `camelCase` `snakeCase` `upperSnakeCase` `kebabCase` `titleCase` |
|
|
48
|
+
| **Words** | `pluralize` |
|
|
49
|
+
| **Logic** | `eq` `and` `or` `default` |
|
|
50
|
+
| **Misc** | `now` `add` |
|
|
70
51
|
|
|
71
52
|
```handlebars
|
|
72
|
-
{{
|
|
73
|
-
|
|
74
|
-
{{
|
|
75
|
-
//
|
|
53
|
+
namespace {{pascalCase FEATURE_NAME}};
|
|
54
|
+
|
|
55
|
+
{{#if (eq STACK "nextjs")}}
|
|
56
|
+
// Next.js only
|
|
76
57
|
{{/if}}
|
|
77
58
|
```
|
|
78
59
|
|
|
79
|
-
|
|
60
|
+
A helper that is not in the table does not exist: Handlebars throws on it at render time.
|
|
80
61
|
|
|
81
|
-
|
|
62
|
+
---
|
|
82
63
|
|
|
83
|
-
|
|
84
|
-
`morph-spec setup-infra` deliberately skips copying `framework/templates/` — a target project
|
|
85
|
-
gets the package's templates for free and stays current on every upgrade.
|
|
64
|
+
## How templates are consumed
|
|
86
65
|
|
|
87
|
-
**
|
|
66
|
+
Templates are **resolved from the installed npm package**, never copied into a project: a
|
|
67
|
+
target project gets the package's templates and stays current on every upgrade.
|
|
88
68
|
|
|
89
69
|
```bash
|
|
90
70
|
morph-spec scaffold dotnet <feature> <slice-name> # VSA slice (endpoint, handler, request,
|
|
91
71
|
# response, validator, errors, entity)
|
|
92
72
|
morph-spec scaffold nextjs <feature> # page, client component, form, hook
|
|
73
|
+
morph-spec scaffold show <template-id> # print one template by its registry id
|
|
93
74
|
```
|
|
94
75
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
### Local override
|
|
100
|
-
|
|
101
|
-
A project may shadow any packaged template by placing a file at the same relative path under
|
|
102
|
-
`.morph/framework/templates/{path}`. The local copy wins, and **stops receiving framework
|
|
103
|
-
updates** — only override when the packaged template genuinely does not fit.
|
|
76
|
+
`scaffold show` is how a session reads a template or a fragment; the ids are listed in the stack
|
|
77
|
+
rules (`*-templates`, `infrastructure-standards`, `neon-standards`, `ai-agents-standards`,
|
|
78
|
+
`gsap-standards`). A `project` is not printed:
|
|
79
|
+
read its files in the package.
|
|
104
80
|
|
|
105
81
|
---
|
|
106
82
|
|
|
107
|
-
##
|
|
83
|
+
## Adding a template
|
|
108
84
|
|
|
109
|
-
1. Create the file under the right technology directory
|
|
110
|
-
|
|
111
|
-
would otherwise confuse tooling).
|
|
85
|
+
1. Create the file under the right technology directory (Handlebars syntax, `.hbs` when the
|
|
86
|
+
extension would otherwise confuse tooling).
|
|
112
87
|
2. Register it in `REGISTRY.json` with a unique `id`, its `kind`, `path` and `category`, plus
|
|
113
|
-
the fields its kind requires
|
|
114
|
-
|
|
88
|
+
the fields its kind requires. `npm run validate` checks the shape, the path, the
|
|
89
|
+
placeholders of an entry with `validatePlaceholders: true`, and that every tracked file
|
|
90
|
+
under `templates/` is registered.
|
|
91
|
+
3. Cite the `id` in the stack rule that should offer it; a template no rule names is never found.
|
|
92
|
+
4. If the scaffolder should emit it, add the `id` to the list in
|
|
115
93
|
`src/lib/generators/scaffold-generator.js`.
|
|
116
94
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
Add `"deprecated": true` plus `"deprecationReason"` to its `REGISTRY.json` entry. Keep the
|
|
120
|
-
file until a major version bump.
|
|
95
|
+
Removing a template is removing the file and its registry entry in the same change.
|
|
121
96
|
|
|
122
97
|
---
|
|
123
98
|
|
|
124
|
-
##
|
|
99
|
+
## References
|
|
125
100
|
|
|
126
|
-
- **Registry
|
|
101
|
+
- **Registry:** [`src/core/templates/template-registry.js`](../../src/core/templates/template-registry.js)
|
|
127
102
|
- **Renderer + helpers:** [`src/core/templates/template-renderer.js`](../../src/core/templates/template-renderer.js)
|
|
128
103
|
- **Scaffold generator:** [`src/lib/generators/scaffold-generator.js`](../../src/lib/generators/scaffold-generator.js)
|
|
129
|
-
- **Stack filtering:** [`src/lib/stack-filter.js`](../../src/lib/stack-filter.js)
|
|
130
104
|
- **Handlebars docs:** https://handlebarsjs.com/
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
**MORPH-SPEC Template System** — technology-based, registry-indexed, resolved from the package.
|