@specship/specship-win32-arm64 0.25.0 → 0.29.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/bin/specship.cmd +31 -1
- package/lib/dist/activation/cheatsheet.d.ts +17 -1
- package/lib/dist/activation/cheatsheet.d.ts.map +1 -1
- package/lib/dist/activation/cheatsheet.js +47 -3
- package/lib/dist/activation/cheatsheet.js.map +1 -1
- package/lib/dist/activation/hook-output.d.ts +80 -0
- package/lib/dist/activation/hook-output.d.ts.map +1 -0
- package/lib/dist/activation/hook-output.js +103 -0
- package/lib/dist/activation/hook-output.js.map +1 -0
- package/lib/dist/activation/search-intercept.d.ts +60 -29
- package/lib/dist/activation/search-intercept.d.ts.map +1 -1
- package/lib/dist/activation/search-intercept.js +159 -55
- package/lib/dist/activation/search-intercept.js.map +1 -1
- package/lib/dist/activation/steering.d.ts +8 -10
- package/lib/dist/activation/steering.d.ts.map +1 -1
- package/lib/dist/activation/steering.js +21 -6
- package/lib/dist/activation/steering.js.map +1 -1
- package/lib/dist/behaviour/behaviour-surface.d.ts +47 -0
- package/lib/dist/behaviour/behaviour-surface.d.ts.map +1 -1
- package/lib/dist/behaviour/behaviour-surface.js +108 -2
- package/lib/dist/behaviour/behaviour-surface.js.map +1 -1
- package/lib/dist/bin/node-version-check.d.ts +22 -7
- package/lib/dist/bin/node-version-check.d.ts.map +1 -1
- package/lib/dist/bin/node-version-check.js +39 -9
- package/lib/dist/bin/node-version-check.js.map +1 -1
- package/lib/dist/bin/specship.js +799 -81
- package/lib/dist/bin/specship.js.map +1 -1
- package/lib/dist/commands/specship/learn.md +22 -0
- package/lib/dist/commands/specship/spec.md +19 -1
- package/lib/dist/db/sqlite-adapter.d.ts +7 -5
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/lib/dist/db/sqlite-adapter.js +11 -9
- package/lib/dist/db/sqlite-adapter.js.map +1 -1
- package/lib/dist/design-md/check.d.ts +51 -0
- package/lib/dist/design-md/check.d.ts.map +1 -0
- package/lib/dist/design-md/check.js +335 -0
- package/lib/dist/design-md/check.js.map +1 -0
- package/lib/dist/design-md/css.d.ts +40 -0
- package/lib/dist/design-md/css.d.ts.map +1 -0
- package/lib/dist/design-md/css.js +224 -0
- package/lib/dist/design-md/css.js.map +1 -0
- package/lib/dist/design-md/extract.d.ts +84 -0
- package/lib/dist/design-md/extract.d.ts.map +1 -0
- package/lib/dist/design-md/extract.js +595 -0
- package/lib/dist/design-md/extract.js.map +1 -0
- package/lib/dist/design-md/maintain.d.ts +45 -0
- package/lib/dist/design-md/maintain.d.ts.map +1 -0
- package/lib/dist/design-md/maintain.js +127 -0
- package/lib/dist/design-md/maintain.js.map +1 -0
- package/lib/dist/design-md/render.d.ts +28 -0
- package/lib/dist/design-md/render.d.ts.map +1 -0
- package/lib/dist/design-md/render.js +178 -0
- package/lib/dist/design-md/render.js.map +1 -0
- package/lib/dist/design-md/upkeep.d.ts +48 -0
- package/lib/dist/design-md/upkeep.d.ts.map +1 -0
- package/lib/dist/design-md/upkeep.js +169 -0
- package/lib/dist/design-md/upkeep.js.map +1 -0
- package/lib/dist/design-md/verify.d.ts +65 -0
- package/lib/dist/design-md/verify.d.ts.map +1 -0
- package/lib/dist/design-md/verify.js +311 -0
- package/lib/dist/design-md/verify.js.map +1 -0
- package/lib/dist/enforce/changed-files.d.ts +11 -0
- package/lib/dist/enforce/changed-files.d.ts.map +1 -1
- package/lib/dist/enforce/changed-files.js +42 -0
- package/lib/dist/enforce/changed-files.js.map +1 -1
- package/lib/dist/enforce/enforce.d.ts +25 -1
- package/lib/dist/enforce/enforce.d.ts.map +1 -1
- package/lib/dist/enforce/enforce.js +58 -3
- package/lib/dist/enforce/enforce.js.map +1 -1
- package/lib/dist/enforce/mutation.d.ts +46 -0
- package/lib/dist/enforce/mutation.d.ts.map +1 -0
- package/lib/dist/enforce/mutation.js +104 -0
- package/lib/dist/enforce/mutation.js.map +1 -0
- package/lib/dist/enforce/suppressions.d.ts +33 -0
- package/lib/dist/enforce/suppressions.d.ts.map +1 -0
- package/lib/dist/enforce/suppressions.js +159 -0
- package/lib/dist/enforce/suppressions.js.map +1 -0
- package/lib/dist/extraction/specs/markdown-spec-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/specs/markdown-spec-extractor.js +16 -2
- package/lib/dist/extraction/specs/markdown-spec-extractor.js.map +1 -1
- package/lib/dist/graph/spec-coverage.d.ts +57 -1
- package/lib/dist/graph/spec-coverage.d.ts.map +1 -1
- package/lib/dist/graph/spec-coverage.js +129 -5
- package/lib/dist/graph/spec-coverage.js.map +1 -1
- package/lib/dist/health/smoke-check.js +2 -2
- package/lib/dist/health/smoke-check.js.map +1 -1
- package/lib/dist/index.d.ts +8 -3
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +65 -9
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/gemini-commands.d.ts +107 -0
- package/lib/dist/installer/gemini-commands.d.ts.map +1 -0
- package/lib/dist/installer/gemini-commands.js +271 -0
- package/lib/dist/installer/gemini-commands.js.map +1 -0
- package/lib/dist/installer/index.d.ts +23 -1
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +22 -3
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/install-defaults.d.ts +19 -0
- package/lib/dist/installer/install-defaults.d.ts.map +1 -1
- package/lib/dist/installer/install-defaults.js +28 -0
- package/lib/dist/installer/install-defaults.js.map +1 -1
- package/lib/dist/installer/instructions-template.d.ts +22 -0
- package/lib/dist/installer/instructions-template.d.ts.map +1 -1
- package/lib/dist/installer/instructions-template.js +37 -1
- package/lib/dist/installer/instructions-template.js.map +1 -1
- package/lib/dist/installer/targets/claude.d.ts +5 -1
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +15 -27
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/gemini.d.ts +85 -12
- package/lib/dist/installer/targets/gemini.d.ts.map +1 -1
- package/lib/dist/installer/targets/gemini.js +527 -30
- package/lib/dist/installer/targets/gemini.js.map +1 -1
- package/lib/dist/installer/targets/shared.d.ts +13 -0
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +18 -0
- package/lib/dist/installer/targets/shared.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +12 -0
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/jira/auto-publish.d.ts +71 -4
- package/lib/dist/jira/auto-publish.d.ts.map +1 -1
- package/lib/dist/jira/auto-publish.js +186 -17
- package/lib/dist/jira/auto-publish.js.map +1 -1
- package/lib/dist/jira/reconcile.d.ts +24 -1
- package/lib/dist/jira/reconcile.d.ts.map +1 -1
- package/lib/dist/jira/reconcile.js +46 -2
- package/lib/dist/jira/reconcile.js.map +1 -1
- package/lib/dist/jira/repo-config.d.ts +9 -0
- package/lib/dist/jira/repo-config.d.ts.map +1 -1
- package/lib/dist/jira/repo-config.js +11 -0
- package/lib/dist/jira/repo-config.js.map +1 -1
- package/lib/dist/jira/types.d.ts +7 -0
- package/lib/dist/jira/types.d.ts.map +1 -1
- package/lib/dist/jira/types.js.map +1 -1
- package/lib/dist/knowledge/enforce.d.ts +75 -0
- package/lib/dist/knowledge/enforce.d.ts.map +1 -0
- package/lib/dist/knowledge/enforce.js +250 -0
- package/lib/dist/knowledge/enforce.js.map +1 -0
- package/lib/dist/knowledge/facts.d.ts +33 -0
- package/lib/dist/knowledge/facts.d.ts.map +1 -0
- package/lib/dist/knowledge/facts.js +117 -0
- package/lib/dist/knowledge/facts.js.map +1 -0
- package/lib/dist/knowledge/proposals.d.ts +88 -0
- package/lib/dist/knowledge/proposals.d.ts.map +1 -0
- package/lib/dist/knowledge/proposals.js +360 -0
- package/lib/dist/knowledge/proposals.js.map +1 -0
- package/lib/dist/knowledge/stale.d.ts +64 -0
- package/lib/dist/knowledge/stale.d.ts.map +1 -0
- package/lib/dist/knowledge/stale.js +174 -0
- package/lib/dist/knowledge/stale.js.map +1 -0
- package/lib/dist/mcp/gemini-session.d.ts +50 -0
- package/lib/dist/mcp/gemini-session.d.ts.map +1 -0
- package/lib/dist/mcp/gemini-session.js +159 -0
- package/lib/dist/mcp/gemini-session.js.map +1 -0
- package/lib/dist/mcp/jira-tools.d.ts.map +1 -1
- package/lib/dist/mcp/jira-tools.js +25 -0
- package/lib/dist/mcp/jira-tools.js.map +1 -1
- package/lib/dist/mcp/model-context.d.ts +22 -9
- package/lib/dist/mcp/model-context.d.ts.map +1 -1
- package/lib/dist/mcp/model-context.js +35 -13
- package/lib/dist/mcp/model-context.js.map +1 -1
- package/lib/dist/mcp/proxy.js +1 -1
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +16 -15
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +67 -1
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.js +1 -1
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/spec-tools.d.ts +9 -1
- package/lib/dist/mcp/spec-tools.d.ts.map +1 -1
- package/lib/dist/mcp/spec-tools.js +69 -21
- package/lib/dist/mcp/spec-tools.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +37 -1
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +120 -9
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/pulse/pulse.d.ts +93 -0
- package/lib/dist/pulse/pulse.d.ts.map +1 -0
- package/lib/dist/pulse/pulse.js +401 -0
- package/lib/dist/pulse/pulse.js.map +1 -0
- package/lib/dist/reflect/apply.d.ts.map +1 -1
- package/lib/dist/reflect/apply.js +38 -3
- package/lib/dist/reflect/apply.js.map +1 -1
- package/lib/dist/reflect/auto-sweep.d.ts +26 -0
- package/lib/dist/reflect/auto-sweep.d.ts.map +1 -0
- package/lib/dist/reflect/auto-sweep.js +90 -0
- package/lib/dist/reflect/auto-sweep.js.map +1 -0
- package/lib/dist/reflect/cli.d.ts +62 -0
- package/lib/dist/reflect/cli.d.ts.map +1 -0
- package/lib/dist/reflect/cli.js +163 -0
- package/lib/dist/reflect/cli.js.map +1 -0
- package/lib/dist/reflect/miner.d.ts.map +1 -1
- package/lib/dist/reflect/miner.js +119 -0
- package/lib/dist/reflect/miner.js.map +1 -1
- package/lib/dist/reflect/sweep.d.ts +1 -0
- package/lib/dist/reflect/sweep.d.ts.map +1 -1
- package/lib/dist/reflect/sweep.js +62 -13
- package/lib/dist/reflect/sweep.js.map +1 -1
- package/lib/dist/reflect/targets.d.ts +2 -0
- package/lib/dist/reflect/targets.d.ts.map +1 -1
- package/lib/dist/reflect/targets.js +33 -0
- package/lib/dist/reflect/targets.js.map +1 -1
- package/lib/dist/reflect/types.d.ts +19 -2
- package/lib/dist/reflect/types.d.ts.map +1 -1
- package/lib/dist/resolution/test-title-links.d.ts.map +1 -1
- package/lib/dist/resolution/test-title-links.js +3 -14
- package/lib/dist/resolution/test-title-links.js.map +1 -1
- package/lib/dist/server/routes/claude.js +15 -7
- package/lib/dist/server/routes/knowledge.js +118 -0
- package/lib/dist/server/server.js +2 -0
- package/lib/dist/skills/design-md/SKILL.md +172 -0
- package/lib/dist/skills/design-md/references/authored-sections.md +90 -0
- package/lib/dist/skills/design-md/references/sources.md +71 -0
- package/lib/dist/spec-lint/lint.d.ts +1 -1
- package/lib/dist/spec-lint/lint.d.ts.map +1 -1
- package/lib/dist/spec-lint/lint.js +63 -2
- package/lib/dist/spec-lint/lint.js.map +1 -1
- package/lib/dist/spec-quality/criterion-ids.d.ts +13 -0
- package/lib/dist/spec-quality/criterion-ids.d.ts.map +1 -0
- package/lib/dist/spec-quality/criterion-ids.js +38 -0
- package/lib/dist/spec-quality/criterion-ids.js.map +1 -0
- package/lib/dist/spec-quality/evidence-kind.d.ts +54 -0
- package/lib/dist/spec-quality/evidence-kind.d.ts.map +1 -0
- package/lib/dist/spec-quality/evidence-kind.js +183 -0
- package/lib/dist/spec-quality/evidence-kind.js.map +1 -0
- package/lib/dist/spec-quality/link-persist.d.ts +65 -0
- package/lib/dist/spec-quality/link-persist.d.ts.map +1 -0
- package/lib/dist/spec-quality/link-persist.js +249 -0
- package/lib/dist/spec-quality/link-persist.js.map +1 -0
- package/lib/dist/spec-quality/plan-scope.d.ts +38 -0
- package/lib/dist/spec-quality/plan-scope.d.ts.map +1 -0
- package/lib/dist/spec-quality/plan-scope.js +129 -0
- package/lib/dist/spec-quality/plan-scope.js.map +1 -0
- package/lib/dist/spec-quality/postcheck.d.ts +91 -0
- package/lib/dist/spec-quality/postcheck.d.ts.map +1 -0
- package/lib/dist/spec-quality/postcheck.js +421 -0
- package/lib/dist/spec-quality/postcheck.js.map +1 -0
- package/lib/dist/spec-quality/readiness.d.ts +72 -0
- package/lib/dist/spec-quality/readiness.d.ts.map +1 -0
- package/lib/dist/spec-quality/readiness.js +226 -0
- package/lib/dist/spec-quality/readiness.js.map +1 -0
- package/lib/dist/workflows/agents/claude.d.ts +16 -0
- package/lib/dist/workflows/agents/claude.d.ts.map +1 -0
- package/lib/dist/workflows/agents/claude.js +82 -0
- package/lib/dist/workflows/agents/claude.js.map +1 -0
- package/lib/dist/workflows/agents/gemini.d.ts +21 -0
- package/lib/dist/workflows/agents/gemini.d.ts.map +1 -0
- package/lib/dist/workflows/agents/gemini.js +124 -0
- package/lib/dist/workflows/agents/gemini.js.map +1 -0
- package/lib/dist/workflows/agents/index.d.ts +28 -0
- package/lib/dist/workflows/agents/index.d.ts.map +1 -0
- package/lib/dist/workflows/agents/index.js +104 -0
- package/lib/dist/workflows/agents/index.js.map +1 -0
- package/lib/dist/workflows/agents/types.d.ts +55 -0
- package/lib/dist/workflows/agents/types.d.ts.map +1 -0
- package/lib/dist/workflows/agents/types.js +46 -0
- package/lib/dist/workflows/agents/types.js.map +1 -0
- package/lib/dist/workflows/batch.d.ts +63 -0
- package/lib/dist/workflows/batch.d.ts.map +1 -0
- package/lib/dist/workflows/batch.js +151 -0
- package/lib/dist/workflows/batch.js.map +1 -0
- package/lib/dist/workflows/defaults/claude-design-implement.yaml +37 -9
- package/lib/dist/workflows/defaults/spec-author.yaml +11 -9
- package/lib/dist/workflows/defaults/spec-implement-mixed.yaml +21 -436
- package/lib/dist/workflows/defaults/spec-implement.yaml +481 -46
- package/lib/dist/workflows/discovery.d.ts +13 -0
- package/lib/dist/workflows/discovery.d.ts.map +1 -1
- package/lib/dist/workflows/discovery.js +79 -17
- package/lib/dist/workflows/discovery.js.map +1 -1
- package/lib/dist/workflows/executor.d.ts +18 -0
- package/lib/dist/workflows/executor.d.ts.map +1 -1
- package/lib/dist/workflows/executor.js +130 -33
- package/lib/dist/workflows/executor.js.map +1 -1
- package/lib/dist/workflows/gc.d.ts +50 -0
- package/lib/dist/workflows/gc.d.ts.map +1 -0
- package/lib/dist/workflows/gc.js +120 -0
- package/lib/dist/workflows/gc.js.map +1 -0
- package/lib/dist/workflows/merge-queue.d.ts +64 -0
- package/lib/dist/workflows/merge-queue.d.ts.map +1 -0
- package/lib/dist/workflows/merge-queue.js +162 -0
- package/lib/dist/workflows/merge-queue.js.map +1 -0
- package/lib/dist/workflows/runners/approval.d.ts +1 -1
- package/lib/dist/workflows/runners/approval.d.ts.map +1 -1
- package/lib/dist/workflows/runners/approval.js +11 -2
- package/lib/dist/workflows/runners/approval.js.map +1 -1
- package/lib/dist/workflows/runners/bash.d.ts +15 -0
- package/lib/dist/workflows/runners/bash.d.ts.map +1 -1
- package/lib/dist/workflows/runners/bash.js +50 -1
- package/lib/dist/workflows/runners/bash.js.map +1 -1
- package/lib/dist/workflows/runners/prompt.d.ts +16 -41
- package/lib/dist/workflows/runners/prompt.d.ts.map +1 -1
- package/lib/dist/workflows/runners/prompt.js +55 -120
- package/lib/dist/workflows/runners/prompt.js.map +1 -1
- package/lib/dist/workflows/runners/types.d.ts +12 -0
- package/lib/dist/workflows/runners/types.d.ts.map +1 -1
- package/lib/dist/workflows/schemas/workflow.d.ts +17 -0
- package/lib/dist/workflows/schemas/workflow.d.ts.map +1 -1
- package/lib/dist/workflows/schemas/workflow.js +27 -0
- package/lib/dist/workflows/schemas/workflow.js.map +1 -1
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +2 -2
- package/package.json +5 -3
- package/node.exe +0 -4
|
@@ -58,6 +58,7 @@ exports.enableGateChecks = enableGateChecks;
|
|
|
58
58
|
const fs = __importStar(require("fs"));
|
|
59
59
|
const path = __importStar(require("path"));
|
|
60
60
|
const maintainability_1 = require("../graph/maintainability");
|
|
61
|
+
const suppressions_1 = require("./suppressions");
|
|
61
62
|
/**
|
|
62
63
|
* Project-relative, forward-slashed, no `./` prefix. Link target paths, spec
|
|
63
64
|
* source paths and git's output all have to compare in one shape before
|
|
@@ -135,7 +136,61 @@ function evaluateEnforcement(deps, config = {}, scope) {
|
|
|
135
136
|
...(changed ? { scoped: true } : {}),
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
+
// --- suppressions (REQ-QGATE-004) ---
|
|
140
|
+
// Only when a diff scan actually ran: an absent scan is unknown, and an
|
|
141
|
+
// unknown result is never rendered as a pass (same doctrine as
|
|
142
|
+
// VERIFY_RESULT=skipped).
|
|
143
|
+
if (deps.suppressions !== undefined) {
|
|
144
|
+
const findings = deps.suppressions.map(suppressions_1.formatSuppressionFinding);
|
|
145
|
+
checks.push({
|
|
146
|
+
check: 'suppressions',
|
|
147
|
+
gating: gate.suppressions === true,
|
|
148
|
+
passed: findings.length === 0,
|
|
149
|
+
findings,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
// --- mutation score (REQ-QGATE-002) ---
|
|
153
|
+
// Present only when configured (A1). Per spec: aggregate mutant kill rates
|
|
154
|
+
// over the requirement's linked files that appear in the report; below the
|
|
155
|
+
// threshold → the spec's test evidence is weak. Report unavailable →
|
|
156
|
+
// skipped, which never fails and is never rendered as pass (A3).
|
|
157
|
+
if (deps.mutation !== undefined) {
|
|
158
|
+
const mu = deps.mutation;
|
|
159
|
+
if (mu.stats === null) {
|
|
160
|
+
checks.push({
|
|
161
|
+
check: 'mutation',
|
|
162
|
+
gating: gate.mutation === true,
|
|
163
|
+
passed: false,
|
|
164
|
+
skipped: true,
|
|
165
|
+
findings: [`mutation gate: skipped — ${mu.reason ?? 'no report'}`],
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const findings = [];
|
|
170
|
+
const pct = (n) => `${Math.round(n * 100)}%`;
|
|
171
|
+
for (const req of deps.requirements) {
|
|
172
|
+
if (changed && !touches(req.sourcePath) && !(req.linkedFiles ?? []).some(touches))
|
|
173
|
+
continue;
|
|
174
|
+
for (const file of new Set((req.linkedFiles ?? []).map(normalizePath))) {
|
|
175
|
+
const s = mu.stats.get(file);
|
|
176
|
+
if (!s || s.total === 0)
|
|
177
|
+
continue;
|
|
178
|
+
const rate = s.killed / s.total;
|
|
179
|
+
if (rate < mu.threshold) {
|
|
180
|
+
findings.push(`${req.id}: weak test evidence — ${file} mutant kill rate ${pct(rate)} < ${pct(mu.threshold)} threshold (${s.killed}/${s.total} killed)`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
checks.push({
|
|
185
|
+
check: 'mutation',
|
|
186
|
+
gating: gate.mutation === true,
|
|
187
|
+
passed: findings.length === 0,
|
|
188
|
+
findings,
|
|
189
|
+
...(changed ? { scoped: true } : {}),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const gatedFailures = checks.filter((c) => c.gating && !c.passed && !c.skipped).map((c) => c.check);
|
|
139
194
|
return { checks, gatedFailures, passed: gatedFailures.length === 0 };
|
|
140
195
|
}
|
|
141
196
|
/** Default name of the checked-in project config file at the project root. */
|
|
@@ -157,13 +212,13 @@ function loadEnforceConfig(projectRoot) {
|
|
|
157
212
|
return {};
|
|
158
213
|
}
|
|
159
214
|
/** All check names, for `--strict` / `--enable-gate` validation. */
|
|
160
|
-
exports.ALL_CHECKS = ['drift', 'fitness', 'maintainability', 'behaviour'];
|
|
215
|
+
exports.ALL_CHECKS = ['drift', 'fitness', 'maintainability', 'behaviour', 'suppressions', 'mutation'];
|
|
161
216
|
/**
|
|
162
217
|
* The `--strict` override (REQ-ENFORCE-004.A2): every check gates for this
|
|
163
218
|
* run only. Nothing is read from or written to the project config.
|
|
164
219
|
*/
|
|
165
220
|
function strictEnforceConfig() {
|
|
166
|
-
return { gate: { drift: true, fitness: true, maintainability: true, behaviour: true } };
|
|
221
|
+
return { gate: { drift: true, fitness: true, maintainability: true, behaviour: true, suppressions: true, mutation: true } };
|
|
167
222
|
}
|
|
168
223
|
/**
|
|
169
224
|
* Persist gating for the named checks into `specship.config.json`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enforce.js","sourceRoot":"","sources":["../../src/enforce/enforce.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"enforce.js","sourceRoot":"","sources":["../../src/enforce/enforce.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBH,sCAEC;AA2FD,kDAsIC;AASD,8CASC;AASD,kDAEC;AASD,4CAmBC;AA3SD,uCAAyB;AACzB,2CAA6B;AAG7B,8DAAqF;AACrF,iDAA8E;AAK9E;;;;GAIG;AACH,SAAgB,aAAa,CAAC,CAAS;IACrC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxE,CAAC;AA2FD,SAAgB,mBAAmB,CACjC,IAAiB,EACjB,SAAwB,EAAE,EAC1B,KAAoB;IAEpB,M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I,GAAG,EAAE,CAAC;IACrF,MAAM,OAAO,GAAgB,EAAE,CAAC;IAChC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;YACrC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;YAC/B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7F,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutation-score gate (REQ-QGATE-002).
|
|
3
|
+
*
|
|
4
|
+
* A `tests` link proves a test exists and passed — not that it would notice
|
|
5
|
+
* the implementation breaking (agent-written suites average high coverage but
|
|
6
|
+
* low mutant kill rates). This gate closes that: per spec, the kill rate of
|
|
7
|
+
* mutants in its linked implementation files must clear a threshold for the
|
|
8
|
+
* test evidence to count as strong.
|
|
9
|
+
*
|
|
10
|
+
* SpecShip does NOT run the mutation tool. It consumes a checked-in/CI-produced
|
|
11
|
+
* report in the cross-tool mutation-testing-report-schema JSON (StrykerJS and
|
|
12
|
+
* friends emit it natively; mutmut ecosystems convert). That keeps
|
|
13
|
+
* `specship check` deterministic and fast, and keeps the tool choice with the
|
|
14
|
+
* project. Opt-in via `specship.config.json` → `enforce.mutation`; with no
|
|
15
|
+
* config the check does not exist and the gate's output is unchanged (A1).
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_MUTATION_THRESHOLD = 0.8;
|
|
18
|
+
export declare const DEFAULT_MUTATION_REPORT = "reports/mutation/mutation.json";
|
|
19
|
+
/** Per-file mutant stats: killed includes Timeout (the mutant didn't survive). */
|
|
20
|
+
export interface MutationFileStats {
|
|
21
|
+
killed: number;
|
|
22
|
+
total: number;
|
|
23
|
+
}
|
|
24
|
+
export interface MutationConfig {
|
|
25
|
+
/** Project-relative path of the mutation-testing-report-schema JSON. */
|
|
26
|
+
report?: string;
|
|
27
|
+
/** Minimum kill rate (0–1) for a spec's implementation files. */
|
|
28
|
+
threshold?: number;
|
|
29
|
+
}
|
|
30
|
+
/** Deps snapshot the enforcement evaluation consumes. */
|
|
31
|
+
export interface MutationDeps {
|
|
32
|
+
/** Null when the report could not be read — the check reports skipped (A3). */
|
|
33
|
+
stats: Map<string, MutationFileStats> | null;
|
|
34
|
+
reason?: string;
|
|
35
|
+
threshold: number;
|
|
36
|
+
reportPath: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parse a mutation-testing-report-schema JSON into per-file kill stats.
|
|
40
|
+
* File keys are normalized to project-relative forward-slash paths so they
|
|
41
|
+
* compare against link target paths.
|
|
42
|
+
*/
|
|
43
|
+
export declare function parseMutationReport(json: string): Map<string, MutationFileStats>;
|
|
44
|
+
/** Assemble the deps snapshot from disk — missing/unreadable report → skipped. */
|
|
45
|
+
export declare function loadMutationDeps(projectRoot: string, cfg?: MutationConfig): MutationDeps;
|
|
46
|
+
//# sourceMappingURL=mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../../src/enforce/mutation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,uBAAuB,mCAAmC,CAAC;AAExE,kFAAkF;AAClF,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,+EAA+E;IAC/E,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,IAAI,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAOD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAehF;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,GAAE,cAAmB,GAAG,YAAY,CAc5F"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Mutation-score gate (REQ-QGATE-002).
|
|
4
|
+
*
|
|
5
|
+
* A `tests` link proves a test exists and passed — not that it would notice
|
|
6
|
+
* the implementation breaking (agent-written suites average high coverage but
|
|
7
|
+
* low mutant kill rates). This gate closes that: per spec, the kill rate of
|
|
8
|
+
* mutants in its linked implementation files must clear a threshold for the
|
|
9
|
+
* test evidence to count as strong.
|
|
10
|
+
*
|
|
11
|
+
* SpecShip does NOT run the mutation tool. It consumes a checked-in/CI-produced
|
|
12
|
+
* report in the cross-tool mutation-testing-report-schema JSON (StrykerJS and
|
|
13
|
+
* friends emit it natively; mutmut ecosystems convert). That keeps
|
|
14
|
+
* `specship check` deterministic and fast, and keeps the tool choice with the
|
|
15
|
+
* project. Opt-in via `specship.config.json` → `enforce.mutation`; with no
|
|
16
|
+
* config the check does not exist and the gate's output is unchanged (A1).
|
|
17
|
+
*/
|
|
18
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
21
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
22
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
23
|
+
}
|
|
24
|
+
Object.defineProperty(o, k2, desc);
|
|
25
|
+
}) : (function(o, m, k, k2) {
|
|
26
|
+
if (k2 === undefined) k2 = k;
|
|
27
|
+
o[k2] = m[k];
|
|
28
|
+
}));
|
|
29
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
30
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
31
|
+
}) : function(o, v) {
|
|
32
|
+
o["default"] = v;
|
|
33
|
+
});
|
|
34
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
35
|
+
var ownKeys = function(o) {
|
|
36
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
37
|
+
var ar = [];
|
|
38
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
39
|
+
return ar;
|
|
40
|
+
};
|
|
41
|
+
return ownKeys(o);
|
|
42
|
+
};
|
|
43
|
+
return function (mod) {
|
|
44
|
+
if (mod && mod.__esModule) return mod;
|
|
45
|
+
var result = {};
|
|
46
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
47
|
+
__setModuleDefault(result, mod);
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
50
|
+
})();
|
|
51
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
+
exports.DEFAULT_MUTATION_REPORT = exports.DEFAULT_MUTATION_THRESHOLD = void 0;
|
|
53
|
+
exports.parseMutationReport = parseMutationReport;
|
|
54
|
+
exports.loadMutationDeps = loadMutationDeps;
|
|
55
|
+
const fs = __importStar(require("fs"));
|
|
56
|
+
const path = __importStar(require("path"));
|
|
57
|
+
const enforce_1 = require("./enforce");
|
|
58
|
+
exports.DEFAULT_MUTATION_THRESHOLD = 0.8;
|
|
59
|
+
exports.DEFAULT_MUTATION_REPORT = 'reports/mutation/mutation.json';
|
|
60
|
+
/** Mutant statuses that count as caught by the suite. */
|
|
61
|
+
const CAUGHT = new Set(['Killed', 'Timeout']);
|
|
62
|
+
/** Statuses that count toward the denominator (detectable-in-principle). */
|
|
63
|
+
const COUNTED = new Set(['Killed', 'Timeout', 'Survived', 'NoCoverage']);
|
|
64
|
+
/**
|
|
65
|
+
* Parse a mutation-testing-report-schema JSON into per-file kill stats.
|
|
66
|
+
* File keys are normalized to project-relative forward-slash paths so they
|
|
67
|
+
* compare against link target paths.
|
|
68
|
+
*/
|
|
69
|
+
function parseMutationReport(json) {
|
|
70
|
+
const parsed = JSON.parse(json);
|
|
71
|
+
const out = new Map();
|
|
72
|
+
for (const [file, data] of Object.entries(parsed.files ?? {})) {
|
|
73
|
+
let killed = 0;
|
|
74
|
+
let total = 0;
|
|
75
|
+
for (const m of data.mutants ?? []) {
|
|
76
|
+
const status = m.status ?? '';
|
|
77
|
+
if (!COUNTED.has(status))
|
|
78
|
+
continue;
|
|
79
|
+
total++;
|
|
80
|
+
if (CAUGHT.has(status))
|
|
81
|
+
killed++;
|
|
82
|
+
}
|
|
83
|
+
out.set((0, enforce_1.normalizePath)(file), { killed, total });
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
87
|
+
/** Assemble the deps snapshot from disk — missing/unreadable report → skipped. */
|
|
88
|
+
function loadMutationDeps(projectRoot, cfg = {}) {
|
|
89
|
+
const reportPath = cfg.report ?? exports.DEFAULT_MUTATION_REPORT;
|
|
90
|
+
const threshold = cfg.threshold ?? exports.DEFAULT_MUTATION_THRESHOLD;
|
|
91
|
+
try {
|
|
92
|
+
const json = fs.readFileSync(path.join(projectRoot, reportPath), 'utf-8');
|
|
93
|
+
return { stats: parseMutationReport(json), threshold, reportPath };
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
return {
|
|
97
|
+
stats: null,
|
|
98
|
+
reason: `mutation report not readable: ${reportPath} (${err instanceof Error ? err.message.split('\n')[0] : String(err)})`,
|
|
99
|
+
threshold,
|
|
100
|
+
reportPath,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation.js","sourceRoot":"","sources":["../../src/enforce/mutation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCH,kDAeC;AAGD,4CAcC;AAvED,uCAAyB;AACzB,2CAA6B;AAC7B,uCAA0C;AAE7B,QAAA,0BAA0B,GAAG,GAAG,CAAC;AACjC,QAAA,uBAAuB,GAAG,gCAAgC,CAAC;AAwBxE,yDAAyD;AACzD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAC9C,4EAA4E;AAC5E,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;AAEzE;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAyE,CAAC;IACxG,MAAM,GAAG,GAAG,IAAI,GAAG,EAA6B,CAAC;IACjD,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9D,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,CAAC,IAAI,IAAI,CAA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ression-comment scan (REQ-QGATE-004).
|
|
3
|
+
*
|
|
4
|
+
* Agents under pressure silence lint/type rules instead of fixing code — the
|
|
5
|
+
* implement workflows forbid it in prose, but prose isn't enforcement. This
|
|
6
|
+
* module detects suppression markers INTRODUCED by a change: a pure function
|
|
7
|
+
* over unified diff text (A2), so the workflows' gate, `specship check`, and
|
|
8
|
+
* tests all share one implementation.
|
|
9
|
+
*
|
|
10
|
+
* Ratchet semantics (A1): only added lines count, and an added line whose
|
|
11
|
+
* exact content also appears among the diff's removed lines is a move, not an
|
|
12
|
+
* introduction. Pre-existing suppressions are out of scope.
|
|
13
|
+
*/
|
|
14
|
+
export interface SuppressionFinding {
|
|
15
|
+
/** Project-relative path of the file the suppression was added to. */
|
|
16
|
+
file: string;
|
|
17
|
+
/** 1-indexed line number in the new file. */
|
|
18
|
+
line: number;
|
|
19
|
+
/** Which marker family matched (e.g. `noqa`, `eslint-disable`). */
|
|
20
|
+
marker: string;
|
|
21
|
+
/** True when the suppression carries an inline justification. */
|
|
22
|
+
justified: boolean;
|
|
23
|
+
/** The added line, trimmed. */
|
|
24
|
+
text: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Scan unified diff text for suppression markers on added lines (A1, A2).
|
|
28
|
+
* Pure: input diff text, output findings — no git, no filesystem.
|
|
29
|
+
*/
|
|
30
|
+
export declare function scanDisableComments(diffText: string): SuppressionFinding[];
|
|
31
|
+
/** Render a finding as one gate-report line. */
|
|
32
|
+
export declare function formatSuppressionFinding(f: SuppressionFinding): string;
|
|
33
|
+
//# sourceMappingURL=suppressions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suppressions.d.ts","sourceRoot":"","sources":["../../src/enforce/suppressions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,SAAS,EAAE,OAAO,CAAC;IACnB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAsFD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,EAAE,CA4C1E;AAED,gDAAgD;AAChD,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAEtE"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Suppression-comment scan (REQ-QGATE-004).
|
|
4
|
+
*
|
|
5
|
+
* Agents under pressure silence lint/type rules instead of fixing code — the
|
|
6
|
+
* implement workflows forbid it in prose, but prose isn't enforcement. This
|
|
7
|
+
* module detects suppression markers INTRODUCED by a change: a pure function
|
|
8
|
+
* over unified diff text (A2), so the workflows' gate, `specship check`, and
|
|
9
|
+
* tests all share one implementation.
|
|
10
|
+
*
|
|
11
|
+
* Ratchet semantics (A1): only added lines count, and an added line whose
|
|
12
|
+
* exact content also appears among the diff's removed lines is a move, not an
|
|
13
|
+
* introduction. Pre-existing suppressions are out of scope.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.scanDisableComments = scanDisableComments;
|
|
17
|
+
exports.formatSuppressionFinding = formatSuppressionFinding;
|
|
18
|
+
/** File families a linter actually honors each marker in (precision guard). */
|
|
19
|
+
const JS_EXT = new Set(['ts', 'tsx', 'mts', 'cts', 'js', 'jsx', 'mjs', 'cjs', 'svelte', 'vue', 'astro']);
|
|
20
|
+
const PY_EXT = new Set(['py', 'pyi']);
|
|
21
|
+
/**
|
|
22
|
+
* Marker families. Precision rules (A2): a marker only counts in a file type
|
|
23
|
+
* its linter reads (`exts`) AND in comment position (`pos` must match the
|
|
24
|
+
* line up to and including the marker) — a mention in prose, a YAML/markdown
|
|
25
|
+
* doc, or a string literal is not a suppression. The first dogfood run of
|
|
26
|
+
* this scanner flagged its own documentation; that false-positive class is
|
|
27
|
+
* what these guards remove.
|
|
28
|
+
*/
|
|
29
|
+
// A directive is only honored at the START of its comment (eslint, tsc and
|
|
30
|
+
// biome all require this), so the regexes anchor there — a prose mention
|
|
31
|
+
// later in a comment is not a suppression.
|
|
32
|
+
const MARKERS = [
|
|
33
|
+
{ marker: 'eslint-disable', re: /^\s*eslint-disable(?:-next-line|-line)?\b/, exts: JS_EXT },
|
|
34
|
+
{ marker: '@ts-expect-error', re: /^\s*@ts-expect-error\b/, exts: JS_EXT },
|
|
35
|
+
{ marker: '@ts-ignore', re: /^\s*@ts-ignore\b/, exts: JS_EXT },
|
|
36
|
+
{ marker: 'biome-ignore', re: /^\s*biome-ignore\b/, exts: JS_EXT },
|
|
37
|
+
{ marker: 'type: ignore', re: /#\s*type:\s*ignore\b/, exts: PY_EXT },
|
|
38
|
+
{ marker: 'noqa', re: /#\s*noqa\b/, exts: PY_EXT },
|
|
39
|
+
];
|
|
40
|
+
function fileExt(file) {
|
|
41
|
+
const dot = file.lastIndexOf('.');
|
|
42
|
+
return dot === -1 ? '' : file.slice(dot + 1).toLowerCase();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The comment part of a line, or null when the line has none. Line-local
|
|
46
|
+
* heuristic: a `//`, `/*` (JS families) or `#` (Python) opener counts only
|
|
47
|
+
* when every quote character before it is balanced — an opener inside a
|
|
48
|
+
* string literal is content, not a comment. Multi-line strings/comments are
|
|
49
|
+
* out of reach for a diff-line scanner; linters need the marker on its own
|
|
50
|
+
* statement line anyway, so line-local is where the real suppressions are.
|
|
51
|
+
*/
|
|
52
|
+
function commentPart(line, js) {
|
|
53
|
+
const openerAt = (idx) => {
|
|
54
|
+
const before = line.slice(0, idx);
|
|
55
|
+
for (const q of ["'", '"', '`']) {
|
|
56
|
+
if ((before.split(q).length - 1) % 2 === 1)
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
};
|
|
61
|
+
const openers = js ? ['//', '/*'] : ['#'];
|
|
62
|
+
let best = -1;
|
|
63
|
+
for (const o of openers) {
|
|
64
|
+
let i = line.indexOf(o);
|
|
65
|
+
while (i !== -1) {
|
|
66
|
+
if (openerAt(i)) {
|
|
67
|
+
best = best === -1 ? i : Math.min(best, i);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
i = line.indexOf(o, i + 1);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return best === -1 ? null : line.slice(best);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A suppression is "justified" when it carries an inline explanation in the
|
|
77
|
+
* family's own syntax: eslint's ` -- reason`, biome-ignore's `: reason`.
|
|
78
|
+
* Justified suppressions are still findings — the label exists so a reviewer
|
|
79
|
+
* can triage, not so the gate waves them through.
|
|
80
|
+
*/
|
|
81
|
+
function isJustified(marker, line) {
|
|
82
|
+
if (marker === 'eslint-disable')
|
|
83
|
+
return /--\s*\S/.test(line.slice(line.indexOf('eslint-disable')));
|
|
84
|
+
if (marker === 'biome-ignore')
|
|
85
|
+
return /biome-ignore\s+\S+\s*:\s*\S/.test(line);
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
function matchMarker(line, file) {
|
|
89
|
+
const ext = fileExt(file);
|
|
90
|
+
for (const { marker, re, exts } of MARKERS) {
|
|
91
|
+
if (!exts.has(ext))
|
|
92
|
+
continue;
|
|
93
|
+
const comment = commentPart(line, exts === JS_EXT);
|
|
94
|
+
if (comment === null)
|
|
95
|
+
continue;
|
|
96
|
+
// Strip the opener so the start-anchored directive regexes see the
|
|
97
|
+
// comment TEXT (`// @ts-ignore` → ` @ts-ignore`); Python regexes carry
|
|
98
|
+
// their own `#` anchor and test the raw comment.
|
|
99
|
+
const text = exts === JS_EXT ? comment.replace(/^(?:\/\/+|\/\*+)/, '') : comment;
|
|
100
|
+
if (re.test(text))
|
|
101
|
+
return marker;
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Scan unified diff text for suppression markers on added lines (A1, A2).
|
|
107
|
+
* Pure: input diff text, output findings — no git, no filesystem.
|
|
108
|
+
*/
|
|
109
|
+
function scanDisableComments(diffText) {
|
|
110
|
+
const lines = diffText.split('\n');
|
|
111
|
+
// First pass: collect removed-line content so moves don't count (A1).
|
|
112
|
+
const removed = new Set();
|
|
113
|
+
for (const l of lines) {
|
|
114
|
+
if (l.startsWith('-') && !l.startsWith('---'))
|
|
115
|
+
removed.add(l.slice(1).trim());
|
|
116
|
+
}
|
|
117
|
+
const findings = [];
|
|
118
|
+
let file = null;
|
|
119
|
+
let newLine = 0; // 1-indexed line number in the new file for the NEXT line
|
|
120
|
+
for (const l of lines) {
|
|
121
|
+
if (l.startsWith('+++ ')) {
|
|
122
|
+
const p = l.slice(4).trim();
|
|
123
|
+
file = p === '/dev/null' ? null : p.replace(/^b\//, '');
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const hunk = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(l);
|
|
127
|
+
if (hunk) {
|
|
128
|
+
newLine = parseInt(hunk[1] ?? '0', 10);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (l.startsWith('-') && !l.startsWith('---'))
|
|
132
|
+
continue; // old-file only
|
|
133
|
+
if (l.startsWith('+')) {
|
|
134
|
+
const content = l.slice(1);
|
|
135
|
+
const marker = file ? matchMarker(content, file) : null;
|
|
136
|
+
if (marker && file && !removed.has(content.trim())) {
|
|
137
|
+
findings.push({
|
|
138
|
+
file,
|
|
139
|
+
line: newLine,
|
|
140
|
+
marker,
|
|
141
|
+
justified: isJustified(marker, content),
|
|
142
|
+
text: content.trim(),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
newLine++;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
// Context line (or anything else inside a hunk body) advances the counter
|
|
149
|
+
// only when we're inside a hunk; headers between hunks reset it anyway.
|
|
150
|
+
if (newLine > 0 && !l.startsWith('diff ') && !l.startsWith('--- '))
|
|
151
|
+
newLine++;
|
|
152
|
+
}
|
|
153
|
+
return findings;
|
|
154
|
+
}
|
|
155
|
+
/** Render a finding as one gate-report line. */
|
|
156
|
+
function formatSuppressionFinding(f) {
|
|
157
|
+
return `${f.file}:${f.line} introduces ${f.marker}${f.justified ? ' (justified)' : ''} — ${f.text}`;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=suppressions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suppressions.js","sourceRoot":"","sources":["../../src/enforce/suppressions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAuGH,kDA4CC;AAGD,4DAEC;AAzID,+EAA+E;AAC/E,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AACzG,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAEtC;;;;;;;GAOG;AACH,2EAA2E;AAC3E,yEAAyE;AACzE,2CAA2C;AAC3C,MAAM,OAAO,GAA6D;IACxE,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,EAAE,2CAA2C,EAAE,IAAI,EAAE,MAAM,EAAE;IAC3F,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,wBAAwB,EAAE,IAAI,EAAE,MAAM,EAAE;IAC1E,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,EAAE;IAC9D,EAAE,MAAM,EAAE,cAAc,E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,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACtG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-spec-extractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/specs/markdown-spec-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAIH,OAAO,EAAE,oBAAoB,EAAqB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-spec-extractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/specs/markdown-spec-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAIH,OAAO,EAAE,oBAAoB,EAAqB,MAAM,SAAS,CAAC;AA4BlE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGjE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnE;AAaD,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAS;gBAEX,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK5C,OAAO,IAAI,oBAAoB;IAsZ/B,kEAAkE;IAClE,OAAO,CAAC,WAAW;IAKnB,mEAAmE;IACnE,OAAO,CAAC,YAAY;IAIpB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,aAAa;IA4GrB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,YAAY;IAgEpB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IA6DxB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,yBAAyB;IAajC;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;CAyD5B"}
|
|
@@ -50,7 +50,13 @@ const IMPL_REF = /^[-*]\s+([^\s:]+)\s*:\s*([A-Za-z0-9_$.]+)\s*$/;
|
|
|
50
50
|
/** Pattern: a Markdown list bullet (`- foo` / `* foo`, indentation tolerant). */
|
|
51
51
|
const BULLET = /^\s*[-*]\s+(.*\S)\s*$/;
|
|
52
52
|
/** The four recognized domain-fact `type` values (REQ-DOMAIN-001). */
|
|
53
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Recognized domain-fact types. `external` (REQ-KNOW-001) is a fact about a
|
|
55
|
+
* third-party tool or library, pinned to the dependency version it was
|
|
56
|
+
* verified against; its provenance (`dependency` / `version` / `source`) is
|
|
57
|
+
* checked by the spec lint, not here, so a fact missing it still indexes.
|
|
58
|
+
*/
|
|
59
|
+
const DOMAIN_TYPES = new Set(['term', 'rule', 'decision', 'constraint', 'external']);
|
|
54
60
|
/**
|
|
55
61
|
* Derive an acceptance criterion's parent requirement from its id suffix
|
|
56
62
|
* (REQ-ACCEPTANCE-001.A2). The convention is `<REQ-ID>.A<N>` — `REQ-AUTH-001.A2`
|
|
@@ -471,13 +477,21 @@ class MarkdownSpecExtractor {
|
|
|
471
477
|
const type = meta.type;
|
|
472
478
|
if (typeof type === 'string' && !DOMAIN_TYPES.has(type)) {
|
|
473
479
|
errors.push({
|
|
474
|
-
message: `Domain fact "${id}" has unknown type "${type}" (expected one of:
|
|
480
|
+
message: `Domain fact "${id}" has unknown type "${type}" (expected one of: ${[...DOMAIN_TYPES].join(', ')})`,
|
|
475
481
|
filePath: this.filePath,
|
|
476
482
|
line: 1,
|
|
477
483
|
severity: 'warning',
|
|
478
484
|
code: 'spec_unknown_domain_type',
|
|
479
485
|
});
|
|
480
486
|
}
|
|
487
|
+
// An external fact's `version` is the dependency version it was verified
|
|
488
|
+
// against (REQ-KNOW-001), not the document revision — `version` is a known
|
|
489
|
+
// frontmatter key, so carry it into metadata (as a string) where the rest of
|
|
490
|
+
// the fact's provenance lives. The spec revision then falls back to 1
|
|
491
|
+
// unless it was a plain integer.
|
|
492
|
+
if (type === 'external' && frontmatter.version !== undefined) {
|
|
493
|
+
meta.version = String(frontmatter.version);
|
|
494
|
+
}
|
|
481
495
|
// Title: frontmatter `title`, else the first heading, else the id.
|
|
482
496
|
let title = typeof frontmatter.title === 'string' && frontmatter.title.length > 0
|
|
483
497
|
? frontmatter.title
|