@polymorphism-tech/morph-spec 11.2.0 → 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.
Files changed (109) hide show
  1. package/README.md +3 -2
  2. package/bin/morph-spec.js +7 -7
  3. package/docs/CHEATSHEET.md +1 -1
  4. package/docs/QUICKSTART.md +1 -1
  5. package/framework/CLAUDE.md +1 -1
  6. package/framework/MORPH.md +2 -2
  7. package/framework/agents.json +4 -4
  8. package/framework/docs/CLI.md +19 -11
  9. package/framework/evals/review-checklist.md +26 -2
  10. package/framework/hooks/README.md +3 -2
  11. package/framework/hooks/claude-code/core/graph-refresh-kick.js +2 -2
  12. package/framework/mcp/registry.json +15 -15
  13. package/framework/rules/ai-agents-standards.md +9 -1
  14. package/framework/rules/gsap-standards.md +8 -0
  15. package/framework/rules/mcp-standards.md +10 -0
  16. package/framework/schemas/config.schema.json +7 -0
  17. package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
  18. package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
  19. package/framework/skills/core/morph-apply/SKILL.md +4 -3
  20. package/framework/skills/core/morph-plan/SKILL.md +1 -1
  21. package/framework/skills/core/morph-uiux/SKILL.md +1 -1
  22. package/framework/standards/STANDARDS.json +8 -4
  23. package/framework/standards/STANDARDS.meta.json +1 -1
  24. package/framework/standards/ai-agents/agent-archetypes.md +1 -1
  25. package/framework/standards/ai-agents/middleware-patterns.md +0 -2
  26. package/framework/standards/ai-agents/prompt-sources.md +2 -2
  27. package/framework/standards/ai-agents/providers/model-registry.md +9 -12
  28. package/framework/standards/ai-agents/rag-custom-pgvector.md +2 -9
  29. package/framework/standards/frontend/design-system/ai-image-generation.md +1 -1
  30. package/framework/standards/infrastructure/docker/local-compose-isolation.md +2 -2
  31. package/framework/standards/integration/mcp/mcp-tools.md +124 -266
  32. package/framework/templates/README.md +52 -82
  33. package/framework/templates/REGISTRY.json +0 -206
  34. package/framework/templates/code/sql/ai-agents/agent-prompts-migration.sql.template +3 -4
  35. package/framework/templates/context/design-system.md +1 -1
  36. package/framework/templates/docs/plan.md +1 -1
  37. package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/model-registry.v2.json +1 -1
  38. package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaDisclosureTests.cs +1 -1
  39. package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Morph.AiKit.Tests.csproj +2 -4
  40. package/framework/templates/frontend/nextjs/gsap-scroll-section.tsx.hbs +13 -17
  41. package/framework/templates/infrastructure/github/README.md +10 -13
  42. package/package.json +2 -2
  43. package/src/commands/mcp/manual-setup.js +95 -0
  44. package/src/commands/mcp/mcp-setup.js +23 -191
  45. package/src/commands/project/doctor.js +6 -16
  46. package/src/commands/project/init-contract.js +2 -2
  47. package/src/commands/project/init.js +15 -133
  48. package/src/commands/project/stack-scan.js +6 -14
  49. package/src/commands/project/stack-set.js +1 -1
  50. package/src/commands/project/standards.js +1 -2
  51. package/src/commands/project/update.js +52 -66
  52. package/src/commands/scaffold/scaffold.js +28 -7
  53. package/src/lib/ai/ai-project-scan.js +1 -4
  54. package/src/lib/ai/code-audit.js +1 -6
  55. package/src/lib/ai/registry-audit.js +2 -1
  56. package/src/lib/config/project-config.js +3 -2
  57. package/src/lib/contract/apply.js +2 -1
  58. package/src/lib/contract/merge.js +1 -0
  59. package/src/lib/contract/scan.js +5 -5
  60. package/src/lib/detectors/claude-config-detector.js +45 -47
  61. package/src/lib/detectors/mcp-config.js +2 -1
  62. package/src/lib/diff/diff-lines.js +2 -7
  63. package/src/lib/graph/graph-loader.js +2 -1
  64. package/src/lib/graph/graphifyignore.js +2 -1
  65. package/src/lib/installers/install-manifest.js +56 -0
  66. package/src/lib/installers/mcp-installer.js +14 -5
  67. package/src/lib/installers/rules-installer.js +9 -15
  68. package/src/lib/installers/stack-assets.js +42 -21
  69. package/src/lib/installers/stack-sync.js +12 -12
  70. package/src/lib/installers/stack-tooling.js +4 -3
  71. package/src/lib/json-file.js +9 -0
  72. package/src/lib/plan/artifact-vocabulary.js +1 -1
  73. package/src/lib/plan/checks.js +3 -2
  74. package/src/lib/plan/media.js +3 -3
  75. package/src/lib/plan/plan-parser.js +5 -10
  76. package/src/lib/review-reports.js +5 -4
  77. package/src/lib/stack/stack-scan.js +1 -1
  78. package/src/lib/standards/verified-against.js +1 -1
  79. package/src/lib/tests-audit/audit.js +1 -1
  80. package/src/lib/text.js +5 -0
  81. package/src/scripts/setup-infra.js +22 -33
  82. package/src/utils/agents-installer.js +13 -30
  83. package/src/utils/claude-md-injector.js +16 -50
  84. package/src/utils/claude-settings-manager.js +2 -2
  85. package/src/utils/file-copier.js +3 -4
  86. package/src/utils/hooks-installer.js +55 -20
  87. package/src/utils/skills-installer.js +18 -78
  88. package/framework/templates/IDE-SNIPPETS.md +0 -262
  89. package/framework/templates/code/dotnet/ai-agents/AgentBootstrap.cs.template +0 -26
  90. package/framework/templates/code/dotnet/ai-agents/EmbeddingService.cs.template +0 -28
  91. package/framework/templates/code/dotnet/ai-agents/ModelRegistry.cs.template +0 -99
  92. package/framework/templates/code/dotnet/ai-agents/ResilientToolMiddleware.cs.template +0 -40
  93. package/framework/templates/code/dotnet/ai-agents/VectorSearchTool.cs.template +0 -54
  94. package/framework/templates/code/dotnet/ai-agents/model-registry.json.template +0 -53
  95. package/framework/templates/code/dotnet/contracts/README.md +0 -74
  96. package/framework/templates/code/dotnet/database/vector-entity.cs +0 -49
  97. package/framework/templates/code/sql/ai-agents/pgvector-embeddings-migration.sql.template +0 -91
  98. package/framework/templates/code/sql/postgresql-migration.template.sql +0 -108
  99. package/framework/templates/code/typescript/contracts.ts +0 -140
  100. package/framework/templates/examples/design-system-examples.md +0 -354
  101. package/framework/templates/infrastructure/docker/Dockerfile.template +0 -58
  102. package/framework/templates/infrastructure/github/actions/docker-build-push/action.yml.hbs +0 -45
  103. package/framework/templates/infrastructure/github/actions/health-check/action.yml.hbs +0 -27
  104. package/framework/templates/integrations/asaas-client.cs +0 -332
  105. package/framework/templates/integrations/asaas-webhook.cs +0 -290
  106. package/framework/templates/integrations/neon-auth-config.cs +0 -170
  107. package/framework/templates/ui/design-system.css +0 -226
  108. package/src/lib/detectors/index.js +0 -153
  109. package/src/lib/installers/templates-reconcile.js +0 -26
@@ -1,153 +0,0 @@
1
- import { existsSync, readFileSync, readdirSync } from 'fs';
2
- import { join } from 'path';
3
-
4
- import { PACKAGE_LOCATIONS } from '../../../framework/hooks/shared/frontend-locations.js';
5
-
6
- export { PACKAGE_LOCATIONS };
7
-
8
- export function detectProject(targetPath) {
9
- const structure = {
10
- stack: 'unknown',
11
- uiLibrary: null,
12
- integrations: [],
13
- hasVercel: false,
14
- };
15
-
16
- try {
17
- const allDeps = {};
18
- let rootPkg = null;
19
- let scripts = [];
20
- for (const loc of PACKAGE_LOCATIONS) {
21
- const pkgPath = join(targetPath, loc, 'package.json');
22
- if (!existsSync(pkgPath)) continue;
23
- try {
24
- const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
25
- if (loc === '.') rootPkg = pkg;
26
- Object.assign(allDeps, pkg.dependencies, pkg.devDependencies);
27
- scripts.push(...Object.keys(pkg.scripts || {}));
28
- if (loc !== '.' && (pkg.dependencies?.next || pkg.dependencies?.react || pkg.dependencies?.vue)) {
29
- structure.frontendPath = loc;
30
- }
31
- } catch {}
32
- }
33
- const depNames = Object.keys(allDeps);
34
-
35
- if (depNames.length > 0) {
36
-
37
- if (depNames.includes('next')) {
38
- structure.stack = 'nextjs';
39
- } else if (depNames.includes('react')) {
40
- structure.stack = 'react';
41
- } else if (depNames.includes('vue')) {
42
- structure.stack = 'vue';
43
- } else if (depNames.includes('express') || depNames.includes('fastify') || depNames.includes('hono')) {
44
- structure.stack = 'node';
45
- } else if (rootPkg?.name) {
46
- structure.stack = 'node';
47
- }
48
-
49
- if (existsSync(join(targetPath, 'components.json')) || existsSync(join(targetPath, structure.frontendPath || '.', 'components.json')) || depNames.includes('@shadcn/ui')) {
50
- structure.uiLibrary = 'shadcn';
51
- }
52
-
53
- if (depNames.includes('@neondatabase/serverless') || depNames.includes('postgres') || depNames.includes('pg')) {
54
- structure.integrations.push('neon');
55
- }
56
- if (depNames.includes('@neon/auth') || depNames.includes('@neondatabase/auth')) {
57
- structure.integrations.push('neon-auth');
58
- }
59
- if (depNames.includes('stripe')) {
60
- structure.integrations.push('stripe');
61
- }
62
-
63
- if (depNames.includes('vercel') || scripts.includes('vercel')) {
64
- structure.hasVercel = true;
65
- }
66
- }
67
-
68
- let hasDotnet = false;
69
- const csprojLocations = ['.', 'src', 'src/Api', 'src/Web', 'src/backend'];
70
-
71
- function checkCsproj(filePath) {
72
- hasDotnet = true;
73
- try {
74
- const content = readFileSync(filePath, 'utf8');
75
- if (content.includes('Hangfire')) {
76
- if (!structure.integrations.includes('hangfire')) structure.integrations.push('hangfire');
77
- }
78
- // Same heuristic as the package.json side (`pg`/`postgres` → neon).
79
- if (content.includes('Npgsql')) {
80
- if (!structure.integrations.includes('neon')) structure.integrations.push('neon');
81
- }
82
- } catch {}
83
- }
84
-
85
- for (const loc of csprojLocations) {
86
- try {
87
- const dir = join(targetPath, loc);
88
- if (!existsSync(dir)) continue;
89
- const entries = readdirSyncSafe(dir);
90
- for (const e of entries.filter(f => f.endsWith('.csproj'))) {
91
- checkCsproj(join(dir, e));
92
- }
93
- for (const sub of entries) {
94
- const subDir = join(dir, sub);
95
- for (const e of readdirSyncSafe(subDir).filter(f => f.endsWith('.csproj'))) {
96
- checkCsproj(join(subDir, e));
97
- }
98
- }
99
- } catch {}
100
- }
101
-
102
- if (hasDotnet) {
103
- if (structure.stack === 'nextjs' || structure.stack === 'react' || structure.stack === 'vue') {
104
- structure.stack = `${structure.stack}+dotnet`;
105
- } else if (structure.stack === 'unknown') {
106
- structure.stack = 'dotnet';
107
- }
108
- }
109
-
110
- if (existsSync(join(targetPath, 'vercel.json'))) {
111
- structure.hasVercel = true;
112
- }
113
-
114
- if (structure.stack === 'unknown' && existsSync(join(targetPath, 'tsconfig.json'))) {
115
- structure.stack = 'node';
116
- }
117
-
118
- if (existsSync(join(targetPath, 'docker-compose.yml')) ||
119
- existsSync(join(targetPath, 'docker-compose.yaml')) ||
120
- existsSync(join(targetPath, 'Dockerfile'))) {
121
- if (!structure.integrations.includes('docker')) structure.integrations.push('docker');
122
- }
123
-
124
- const azureSignals = [
125
- '.azure',
126
- 'azure-pipelines.yml',
127
- 'infra/main.bicep',
128
- 'infra',
129
- ];
130
- const hasAzure = azureSignals.some(signal => {
131
- const p = join(targetPath, signal);
132
- if (!existsSync(p)) return false;
133
- if (signal === 'infra') {
134
- return readdirSyncSafe(p).some(f => f.endsWith('.bicep'));
135
- }
136
- return true;
137
- });
138
- if (hasAzure && !structure.integrations.includes('azure')) {
139
- structure.integrations.push('azure');
140
- }
141
- } catch {
142
- }
143
-
144
- return { structure };
145
- }
146
-
147
- function readdirSyncSafe(dir) {
148
- try {
149
- return readdirSync(dir);
150
- } catch {
151
- return [];
152
- }
153
- }
@@ -1,26 +0,0 @@
1
- import { existsSync } from 'fs';
2
- import { compareVersions } from '../../utils/version-checker.js';
3
- import { realEffects } from './effects.js';
4
-
5
- // Last CLI version whose install still copied `.morph/framework/templates/` unconditionally.
6
- export const LAST_VERSION_THAT_COPIED_TEMPLATES = '8.17.0';
7
-
8
- // Decided by the PRIOR recorded version, not by diffing: a diff can't tell a stale copy from an override.
9
- // Unrecorded or <= the boundary → only the old installer could have written it, delete.
10
- // Newer → placed deliberately, preserve.
11
- export function reconcileLegacyTemplatesCopy(templatesDest, priorProjectVersion, fx = realEffects()) {
12
- if (!existsSync(templatesDest)) return 'absent';
13
-
14
- const isLegacy = !priorProjectVersion
15
- || compareVersions(priorProjectVersion, LAST_VERSION_THAT_COPIED_TEMPLATES) <= 0;
16
-
17
- if (!isLegacy) return 'preserved-override';
18
-
19
- try {
20
- fx.remove(templatesDest);
21
- return 'removed-legacy';
22
- } catch {
23
- // Couldn't remove: leave it; the resolver's override-first check picks it up.
24
- return 'preserved-override';
25
- }
26
- }