@polymorphism-tech/morph-spec 8.10.0 → 8.11.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/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- 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 +1 -1
- package/framework/skills/core/morph-brainstorming/SKILL.md +1 -1
- package/framework/skills/core/morph-eval/SKILL.md +1 -1
- package/framework/skills/core/morph-hotfix/SKILL.md +1 -1
- package/framework/skills/core/morph-implement/SKILL.md +1 -1
- package/framework/skills/core/morph-plan/SKILL.md +1 -1
- package/framework/skills/core/morph-proposal/SKILL.md +1 -1
- package/framework/skills/core/morph-review/SKILL.md +1 -1
- package/framework/skills/core/morph-stack-scan/SKILL.md +1 -1
- package/framework/skills/core/morph-standards/SKILL.md +1 -1
- package/package.json +1 -1
- package/src/commands/mcp/mcp-setup.js +6 -1
- package/src/core/templates/template-registry.js +0 -59
- package/src/dashboard/scanner/hooks-scanner.js +64 -6
- package/src/dashboard/scanner/standards-scanner.js +15 -3
- package/src/lib/stack/stack-profile.js +0 -5
- package/src/lib/validators/validation-runner.js +32 -12
- package/src/lib/validators/content/content-validator.js +0 -89
- package/src/lib/validators/content/index.js +0 -7
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:** 8.
|
|
6
|
+
**Version:** 8.11.0
|
|
7
7
|
**Requires:** Node.js 22+, Claude Code
|
|
8
8
|
|
|
9
9
|
---
|
|
@@ -368,4 +368,4 @@ Code generated by morph-spec (contracts, templates, implementation output) belon
|
|
|
368
368
|
|
|
369
369
|
---
|
|
370
370
|
|
|
371
|
-
*morph-spec v8.
|
|
371
|
+
*morph-spec v8.11.0 by [Polymorphism Tech](https://polymorphism.tech)*
|
package/claude-plugin.json
CHANGED
package/docs/CHEATSHEET.md
CHANGED
package/docs/QUICKSTART.md
CHANGED
|
@@ -4,7 +4,7 @@ description: Guia a criação de uma landing page nova ponta-a-ponta a partir do
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: ao iniciar um novo projeto de LP com o template Umbraco genérico
|
|
6
6
|
user-invokable: true
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# create-umbraco-lp
|
|
@@ -4,7 +4,7 @@ description: Migra uma landing page existente (React/Vite, Next.js estático ou
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: ao receber instrução "use /migrate-lp-to-umbraco {projeto}" do usuário, ou quando o usuário descrever necessidade de migrar uma LP para Umbraco
|
|
6
6
|
user-invokable: true
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# migrate-lp-to-umbraco
|
|
@@ -4,7 +4,7 @@ description: Orquestra a execução autônoma de tasks de uma feature morph-spec
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: após Gate 2 aprovado, ao receber instrução "use /morph-apply" ou "implementar feature"
|
|
6
6
|
user-invokable: true
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# morph-apply
|
|
@@ -4,7 +4,7 @@ description: Entende o negócio, os usuários e a arquitetura antes de qualquer
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: ao receber um novo request de feature, antes de morph-plan
|
|
6
6
|
user-invokable: true
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# morph-brainstorming
|
|
@@ -4,7 +4,7 @@ description: Avalia a qualidade de uma tarefa ou fase com rubricas graduadas 0-1
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: ao completar uma tarefa ou ao finalizar uma fase de implementação
|
|
6
6
|
user-invokable: false
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# morph-eval
|
|
@@ -4,7 +4,7 @@ description: ADW cirúrgico de hotfix — resolve uma queda/bug crítico de prod
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: ao receber "/morph-hotfix {feature}", quando a morph-proposal classifica o pedido como workType hotfix (Passo 0), ou o usuário diz "produção caiu / hotfix / urgente"
|
|
6
6
|
user-invokable: true
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# morph-hotfix
|
|
@@ -4,7 +4,7 @@ description: Guia a execução de cada tarefa de implementação com standard e
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: ao iniciar cada task de implementação listada em tasks.json
|
|
6
6
|
user-invokable: false
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# morph-implement
|
|
@@ -4,7 +4,7 @@ description: Guia a produção dos artefatos de planejamento de uma feature (use
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: ao iniciar a fase plan de uma feature, após o Gate 1 (proposal aprovado)
|
|
6
6
|
user-invokable: true
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# morph-plan
|
|
@@ -4,7 +4,7 @@ description: Orquestra a fase de proposta+plano de uma feature morph-spec. Encad
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: ao receber instrução "use /morph-proposal" do usuário, ou ao iniciar uma nova feature
|
|
6
6
|
user-invokable: true
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# morph-proposal
|
|
@@ -4,7 +4,7 @@ description: Conduz a fase de revisão e produz o review-report.md para o Gate 3
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: ao iniciar a fase review, após todas as tasks de tasks.json estarem com status `done`
|
|
6
6
|
user-invokable: true
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# morph-review
|
|
@@ -4,7 +4,7 @@ description: Varre o codebase existente, detecta stack atual, compara com o stac
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: ao iniciar uma feature em projeto brownfield (codebase já existente)
|
|
6
6
|
user-invokable: true
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# morph-stack-scan
|
|
@@ -4,7 +4,7 @@ description: Localiza e carrega um standard específico do STANDARDS.json sob de
|
|
|
4
4
|
version: core
|
|
5
5
|
when-to-invoke: quando precisar consultar um standard específico durante a implementação
|
|
6
6
|
user-invokable: true
|
|
7
|
-
cliVersion: "8.
|
|
7
|
+
cliVersion: "8.11.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# morph-standards
|
package/package.json
CHANGED
|
@@ -34,8 +34,13 @@ import { detectProject } from '../../lib/detectors/index.js';
|
|
|
34
34
|
/**
|
|
35
35
|
* Detect the current project's stack.
|
|
36
36
|
* Prefers .morph/config/config.json (set during morph-spec init) over filesystem re-detection.
|
|
37
|
+
*
|
|
38
|
+
* Exported for testing: the stack decides which MCPs are relevant, and it is
|
|
39
|
+
* the one branch here worth pinning — `.morph/config/config.json` is the only
|
|
40
|
+
* place a compound stack (`dotnet-nextjs`) survives, since filesystem
|
|
41
|
+
* re-detection collapses it to whichever half it notices first.
|
|
37
42
|
*/
|
|
38
|
-
async function detectStack(targetPath) {
|
|
43
|
+
export async function detectStack(targetPath) {
|
|
39
44
|
// 1. Prefer the authoritative config (handles compound stacks like nextjs+dotnet)
|
|
40
45
|
try {
|
|
41
46
|
const configPath = join(targetPath, '.morph', 'config', 'config.json');
|
|
@@ -151,65 +151,6 @@ export function getRequiredTemplates(stackId = null, projectPath = null) {
|
|
|
151
151
|
return templates;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
/**
|
|
155
|
-
* Get infrastructure templates for a specific stack.
|
|
156
|
-
*
|
|
157
|
-
* @param {string} stackId - Stack identifier
|
|
158
|
-
* @param {string} [projectPath] - Optional project path
|
|
159
|
-
* @returns {Array} Infrastructure template array
|
|
160
|
-
*/
|
|
161
|
-
export function getInfrastructureTemplates(stackId, projectPath = null) {
|
|
162
|
-
const registry = loadTemplateRegistry(projectPath);
|
|
163
|
-
return registry.infrastructureTemplates?.[stackId] || [];
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Get contract templates for a specific stack.
|
|
168
|
-
*
|
|
169
|
-
* @param {string} stackId - Stack identifier
|
|
170
|
-
* @param {string} [projectPath] - Optional project path
|
|
171
|
-
* @returns {Array} Contract template array
|
|
172
|
-
*/
|
|
173
|
-
export function getContractTemplates(stackId, projectPath = null) {
|
|
174
|
-
const registry = loadTemplateRegistry(projectPath);
|
|
175
|
-
return registry.contractTemplates?.[stackId] || [];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Get integration templates for a specific stack.
|
|
180
|
-
*
|
|
181
|
-
* @param {string} stackId - Stack identifier
|
|
182
|
-
* @param {string} [projectPath] - Optional project path
|
|
183
|
-
* @returns {Array} Integration template array
|
|
184
|
-
*/
|
|
185
|
-
export function getIntegrationTemplates(stackId, projectPath = null) {
|
|
186
|
-
const registry = loadTemplateRegistry(projectPath);
|
|
187
|
-
return registry.integrationTemplates?.[stackId] || [];
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Get SaaS templates for a specific stack.
|
|
192
|
-
*
|
|
193
|
-
* @param {string} stackId - Stack identifier
|
|
194
|
-
* @param {string} [projectPath] - Optional project path
|
|
195
|
-
* @returns {Array} SaaS template array
|
|
196
|
-
*/
|
|
197
|
-
export function getSaasTemplates(stackId, projectPath = null) {
|
|
198
|
-
const registry = loadTemplateRegistry(projectPath);
|
|
199
|
-
return registry.saasTemplates?.[stackId] || [];
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Get example templates.
|
|
204
|
-
*
|
|
205
|
-
* @param {string} [projectPath] - Optional project path
|
|
206
|
-
* @returns {Array} Example template array
|
|
207
|
-
*/
|
|
208
|
-
export function getExampleTemplates(projectPath = null) {
|
|
209
|
-
const registry = loadTemplateRegistry(projectPath);
|
|
210
|
-
return registry.exampleTemplates || [];
|
|
211
|
-
}
|
|
212
|
-
|
|
213
154
|
/**
|
|
214
155
|
* Search templates by keyword (searches id, name, description).
|
|
215
156
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync, readdirSync, existsSync } from 'fs';
|
|
2
|
-
import { join, basename
|
|
2
|
+
import { join, basename } from 'path';
|
|
3
|
+
import { getHookDefinitions } from '../../utils/hooks-installer.js';
|
|
3
4
|
|
|
4
5
|
function findJsFiles(dir) {
|
|
5
6
|
const results = [];
|
|
@@ -25,17 +26,74 @@ function extractImports(source) {
|
|
|
25
26
|
return imports;
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Claude Code event name → the kebab-case key the Hook Inspector groups by.
|
|
31
|
+
* `pre-compact` and `teammate-idle` have no MORPH hooks — those nodes render
|
|
32
|
+
* empty on purpose.
|
|
33
|
+
*/
|
|
34
|
+
const EVENT_KEYS = {
|
|
35
|
+
SessionStart: 'session-start',
|
|
36
|
+
UserPromptSubmit: 'user-prompt',
|
|
37
|
+
PreToolUse: 'pre-tool-use',
|
|
38
|
+
PostToolUse: 'post-tool-use',
|
|
39
|
+
Stop: 'stop',
|
|
40
|
+
SubagentStop: 'stop',
|
|
41
|
+
PreCompact: 'pre-compact',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Build filename → [{ event, matcher }] from the installer's MORPH_HOOKS.
|
|
46
|
+
*
|
|
47
|
+
* The event is NOT derivable from the path. Before the v4→v5 migration the
|
|
48
|
+
* hooks sat in per-event folders, so `basename(dirname(file))` produced the
|
|
49
|
+
* event key; the migration flattened everything into `core/`, and from then on
|
|
50
|
+
* every hook reported `event: 'core'`. Nothing crashed — the Inspector groups
|
|
51
|
+
* by event, found no key it knew, and rendered every node empty. Twelve hooks,
|
|
52
|
+
* zero shown.
|
|
53
|
+
*
|
|
54
|
+
* `getHookDefinitions()` is the single source of truth (the same array the
|
|
55
|
+
* installer writes into settings.local.json), so the registration and the
|
|
56
|
+
* drawing can no longer disagree.
|
|
57
|
+
*/
|
|
58
|
+
export function hookRegistrations(definitions = getHookDefinitions()) {
|
|
59
|
+
const byFile = new Map();
|
|
60
|
+
for (const def of definitions) {
|
|
61
|
+
const key = EVENT_KEYS[def.event];
|
|
62
|
+
if (!key) continue;
|
|
63
|
+
for (const h of def.hooks || []) {
|
|
64
|
+
const file = basename(String(h.command || '').trim());
|
|
65
|
+
if (!file.endsWith('.js')) continue;
|
|
66
|
+
if (!byFile.has(file)) byFile.set(file, []);
|
|
67
|
+
byFile.get(file).push({ event: key, rawEvent: def.event, matcher: def.matcher || null });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return byFile;
|
|
71
|
+
}
|
|
72
|
+
|
|
28
73
|
export function scanHooks(frameworkDir) {
|
|
29
74
|
const hooksDir = join(frameworkDir, 'hooks', 'claude-code');
|
|
30
75
|
if (!existsSync(hooksDir)) return [];
|
|
31
|
-
|
|
76
|
+
|
|
77
|
+
const registrations = hookRegistrations();
|
|
78
|
+
|
|
79
|
+
return findJsFiles(hooksDir).flatMap(filePath => {
|
|
32
80
|
const source = readFileSync(filePath, 'utf8');
|
|
33
|
-
|
|
34
|
-
|
|
81
|
+
const filename = basename(filePath);
|
|
82
|
+
const base = {
|
|
35
83
|
name: basename(filePath, '.js'),
|
|
36
|
-
filename
|
|
37
|
-
source,
|
|
84
|
+
filename,
|
|
85
|
+
source,
|
|
86
|
+
imports: extractImports(source),
|
|
38
87
|
description: extractJsDocDescription(source),
|
|
39
88
|
};
|
|
89
|
+
|
|
90
|
+
// One entry per (file × event): telemetry-log is registered on both
|
|
91
|
+
// PostToolUse and UserPromptSubmit, and must show under both.
|
|
92
|
+
const regs = registrations.get(filename);
|
|
93
|
+
if (!regs || regs.length === 0) {
|
|
94
|
+
// On disk but never registered — real dead weight, and worth seeing.
|
|
95
|
+
return [{ ...base, event: 'unregistered', matcher: null }];
|
|
96
|
+
}
|
|
97
|
+
return regs.map(r => ({ ...base, event: r.event, rawEvent: r.rawEvent, matcher: r.matcher }));
|
|
40
98
|
});
|
|
41
99
|
}
|
|
@@ -7,9 +7,21 @@ export function scanStandards(frameworkDir, agents) {
|
|
|
7
7
|
const sJson = JSON.parse(readFileSync(standardsJsonPath, 'utf8'));
|
|
8
8
|
const refMap = {};
|
|
9
9
|
for (const agent of agents) {
|
|
10
|
-
for (const std of agent.standards) {
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
for (const std of agent.standards || []) {
|
|
11
|
+
// agents.json stores standards as plain id STRINGS. Reading `std.id` off
|
|
12
|
+
// a string yields undefined, so every reference piled into refMap
|
|
13
|
+
// [undefined] and the lookup below missed all 60 — the Standards graph
|
|
14
|
+
// drew standards with no agent edge at all. The object form is the v4
|
|
15
|
+
// shape (`{ id, scope, priority }`); still accepted so a mixed or
|
|
16
|
+
// restored agents.json does not silently lose edges again.
|
|
17
|
+
const id = typeof std === 'string' ? std : std?.id;
|
|
18
|
+
if (!id) continue;
|
|
19
|
+
if (!refMap[id]) refMap[id] = [];
|
|
20
|
+
refMap[id].push({
|
|
21
|
+
agentId: agent.id,
|
|
22
|
+
scope: typeof std === 'string' ? null : (std.scope ?? null),
|
|
23
|
+
priority: typeof std === 'string' ? null : (std.priority ?? null),
|
|
24
|
+
});
|
|
13
25
|
}
|
|
14
26
|
}
|
|
15
27
|
const list = sJson.standards.map(std => {
|
|
@@ -9,7 +9,6 @@ import { join } from 'path';
|
|
|
9
9
|
* @property {boolean} isDotnet
|
|
10
10
|
* @property {boolean} isNextjs
|
|
11
11
|
* @property {string[]} defaultValidators
|
|
12
|
-
* @property {string[]} checkpointValidators
|
|
13
12
|
* @property {string|null} buildCommand
|
|
14
13
|
*/
|
|
15
14
|
|
|
@@ -21,19 +20,16 @@ const PROFILES = {
|
|
|
21
20
|
dotnet: {
|
|
22
21
|
isDotnet: true, isNextjs: false,
|
|
23
22
|
defaultValidators: ['architecture', 'packages'],
|
|
24
|
-
checkpointValidators: ['architecture', 'packages', 'design-system', 'security'],
|
|
25
23
|
buildCommand: 'dotnet build --no-restore',
|
|
26
24
|
},
|
|
27
25
|
nextjs: {
|
|
28
26
|
isDotnet: false, isNextjs: true,
|
|
29
27
|
defaultValidators: ['nextjs-component'],
|
|
30
|
-
checkpointValidators: ['nextjs-component', 'css'],
|
|
31
28
|
buildCommand: 'npx tsc --noEmit',
|
|
32
29
|
},
|
|
33
30
|
empty: {
|
|
34
31
|
isDotnet: false, isNextjs: false,
|
|
35
32
|
defaultValidators: [],
|
|
36
|
-
checkpointValidators: [],
|
|
37
33
|
buildCommand: null,
|
|
38
34
|
},
|
|
39
35
|
};
|
|
@@ -57,7 +53,6 @@ function mergeProfiles(profiles) {
|
|
|
57
53
|
isDotnet: profiles.some((p) => p.isDotnet),
|
|
58
54
|
isNextjs: profiles.some((p) => p.isNextjs),
|
|
59
55
|
defaultValidators: [...new Set(profiles.flatMap((p) => p.defaultValidators))],
|
|
60
|
-
checkpointValidators: [...new Set(profiles.flatMap((p) => p.checkpointValidators))],
|
|
61
56
|
buildCommand: profiles.map((p) => p.buildCommand).find(Boolean) ?? null,
|
|
62
57
|
};
|
|
63
58
|
}
|
|
@@ -16,7 +16,11 @@ import { aggregateScores, loadRubric } from './score-aggregator.js';
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Heavy validators skipped in 'light' mode (checkpoint-only).
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
|
+
* What light mode actually leaves behind is whatever the stack contributes that
|
|
21
|
+
* is NOT in this set — in practice `contrast` and `nextjs-component`. There are
|
|
22
|
+
* no `spec` or `content` validators; the switch in runSingleValidator has no
|
|
23
|
+
* case for either, and the old comment here promised both.
|
|
20
24
|
*/
|
|
21
25
|
const HEAVY_VALIDATORS = new Set([
|
|
22
26
|
'architecture', 'packages', 'contract-compliance',
|
|
@@ -49,27 +53,38 @@ export async function runValidation(projectPath, featureName, options = {}) {
|
|
|
49
53
|
validators: {} // No validator-specific constraints
|
|
50
54
|
};
|
|
51
55
|
|
|
52
|
-
// Determine which validators to run
|
|
53
|
-
|
|
56
|
+
// Determine which validators to run.
|
|
57
|
+
// COPY: the mode filter below used to splice in place, and when the caller
|
|
58
|
+
// passed `options.validators` that array WAS this array — so a light run
|
|
59
|
+
// emptied the caller's own list, and running the same list twice validated
|
|
60
|
+
// less the second time.
|
|
61
|
+
const detected = options.validators || detectValidators(projectPath);
|
|
62
|
+
let validatorIds = [...detected];
|
|
54
63
|
|
|
55
64
|
// Filter by mode: 'light' skips heavy validators, 'full' (default) runs all
|
|
56
65
|
const mode = options.mode || 'full';
|
|
66
|
+
const droppedByMode = [];
|
|
57
67
|
if (mode === 'light') {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
}
|
|
68
|
+
validatorIds = validatorIds.filter(id => {
|
|
69
|
+
if (HEAVY_VALIDATORS.has(id)) { droppedByMode.push(id); return false; }
|
|
70
|
+
return true;
|
|
71
|
+
});
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
// Merge constraint-enabled validators
|
|
67
75
|
validatorIds.push(...constraints.enabledValidators);
|
|
68
76
|
|
|
69
77
|
if (validatorIds.length === 0) {
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
// Say which of the two it is. On a pure `dotnet` project every default
|
|
79
|
+
// validator is heavy, so a light run legitimately runs none — but the old
|
|
80
|
+
// message blamed the stack ("no validators configured"), which reads as
|
|
81
|
+
// "your stack has nothing to check" when the full run has two.
|
|
82
|
+
result.summary = droppedByMode.length > 0
|
|
83
|
+
? `No validators ran — light mode skipped ${droppedByMode.length} heavy validator(s): ${droppedByMode.join(', ')}`
|
|
84
|
+
: 'No validators ran — no validators configured for this stack';
|
|
85
|
+
console.log(chalk.gray(`\n ℹ️ ${result.summary.replace('No validators ran — ', '')}`));
|
|
72
86
|
result._skipReason = result.summary;
|
|
87
|
+
result._droppedByMode = droppedByMode;
|
|
73
88
|
return result;
|
|
74
89
|
}
|
|
75
90
|
|
|
@@ -87,7 +102,12 @@ export async function runValidation(projectPath, featureName, options = {}) {
|
|
|
87
102
|
// Positive check on isDotnet (contract-compliance is a VSA/.NET concern) —
|
|
88
103
|
// NOT `!isNextjs`, which used to wrongly suppress it for a compound
|
|
89
104
|
// "dotnet-nextjs" stack that has a .NET backend but is ALSO isNextjs.
|
|
90
|
-
|
|
105
|
+
// `mode: 'light'` has to hold here too. This push sits AFTER the mode
|
|
106
|
+
// filter, so contract-compliance — which is in HEAVY_VALIDATORS — used to
|
|
107
|
+
// slip into every light run that had a contracts file, making light mode
|
|
108
|
+
// heavier than declared on exactly the compound stacks it matters for.
|
|
109
|
+
const contractsIsHeavyAndSkipped = mode === 'light' && HEAVY_VALIDATORS.has('contract-compliance');
|
|
110
|
+
if (existsSync(contractsPath) && _profileForContracts.isDotnet && !contractsIsHeavyAndSkipped) {
|
|
91
111
|
validatorIds.push('contract-compliance');
|
|
92
112
|
}
|
|
93
113
|
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { readFileSync, existsSync } from 'fs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Content Validator - Validates structure and content of output files
|
|
5
|
-
*
|
|
6
|
-
* Ensures spec.md, tasks.json, and other outputs have required sections
|
|
7
|
-
* and proper structure before allowing phase transitions.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Validate spec.md structure
|
|
12
|
-
* @param {string} specPath - Path to spec.md file
|
|
13
|
-
* @returns {Object} Validation result
|
|
14
|
-
*/
|
|
15
|
-
export function validateSpecContent(specPath) {
|
|
16
|
-
if (!existsSync(specPath)) {
|
|
17
|
-
return {
|
|
18
|
-
valid: false,
|
|
19
|
-
missing: ['File does not exist'],
|
|
20
|
-
errors: ['Spec file not found at: ' + specPath]
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const content = readFileSync(specPath, 'utf8');
|
|
25
|
-
|
|
26
|
-
// Required sections (flexible regex handles numbered variants like '## 1. Overview')
|
|
27
|
-
const requiredSections = [
|
|
28
|
-
{ label: '## Overview', pattern: /^##\s+(?:\d+\.?\s+)?Overview/i },
|
|
29
|
-
{ label: '## Functional Requirements', pattern: /^##\s+(?:\d+\.?\s+)?Functional Requirements/i },
|
|
30
|
-
{ label: '## Technical', pattern: /^##\s+(?:\d+\.?\s+)?Technical/i },
|
|
31
|
-
{ label: '## Data Model', pattern: /^##\s+(?:\d+\.?\s+)?Data Model/i },
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
const lines = content.split('\n');
|
|
35
|
-
const missing = requiredSections.filter(s =>
|
|
36
|
-
!lines.some(line => s.pattern.test(line))
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
// Additional quality checks
|
|
40
|
-
const errors = [];
|
|
41
|
-
const warnings = [];
|
|
42
|
-
|
|
43
|
-
// Missing sections are warnings, not errors — not every spec needs all sections
|
|
44
|
-
// (e.g., frontend-only features may not have Data Model, CLI tools may not have Technical Architecture)
|
|
45
|
-
if (missing.length > 0) {
|
|
46
|
-
missing.forEach(s => {
|
|
47
|
-
warnings.push(`Missing recommended section: ${s.label}`);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Check minimum content length
|
|
52
|
-
if (content.length < 500) {
|
|
53
|
-
warnings.push('Spec seems very short (< 500 characters). Consider adding more detail.');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Check for placeholder text that should be replaced
|
|
57
|
-
const placeholders = ['TODO', 'TBD', 'PLACEHOLDER', '{{'];
|
|
58
|
-
placeholders.forEach(placeholder => {
|
|
59
|
-
if (content.includes(placeholder)) {
|
|
60
|
-
warnings.push(`Spec contains "${placeholder}" - ensure all placeholders are replaced`);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Check for anti-patterns mentioned in the plan
|
|
65
|
-
if (content.toLowerCase().includes('manual azure portal')) {
|
|
66
|
-
errors.push(
|
|
67
|
-
'Spec mentions manual Azure portal creation. ' +
|
|
68
|
-
'All infrastructure must be defined in Bicep (Infrastructure as Code).'
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (content.toLowerCase().includes('create resource manually')) {
|
|
73
|
-
errors.push(
|
|
74
|
-
'Spec mentions manual resource creation. ' +
|
|
75
|
-
'Use IaC (Bicep) for all infrastructure resources.'
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
valid: errors.length === 0,
|
|
81
|
-
missing,
|
|
82
|
-
errors,
|
|
83
|
-
warnings,
|
|
84
|
-
sections: {
|
|
85
|
-
required: requiredSections.length,
|
|
86
|
-
found: requiredSections.length - missing.length
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|