@codyswann/lisa 2.280.0 → 2.282.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/all/copy-contents/gitignore +2 -0
- package/dist/cli/doctor-readiness-capabilities.d.ts +33 -0
- package/dist/cli/doctor-readiness-capabilities.d.ts.map +1 -0
- package/dist/cli/doctor-readiness-capabilities.js +26 -0
- package/dist/cli/doctor-readiness-capabilities.js.map +1 -0
- package/dist/cli/doctor-readiness-domain.d.ts +17 -0
- package/dist/cli/doctor-readiness-domain.d.ts.map +1 -0
- package/dist/cli/doctor-readiness-domain.js +197 -0
- package/dist/cli/doctor-readiness-domain.js.map +1 -0
- package/dist/cli/doctor-readiness-guardrails.d.ts +15 -0
- package/dist/cli/doctor-readiness-guardrails.d.ts.map +1 -0
- package/dist/cli/doctor-readiness-guardrails.js +219 -0
- package/dist/cli/doctor-readiness-guardrails.js.map +1 -0
- package/dist/cli/doctor-readiness-operations.d.ts +103 -0
- package/dist/cli/doctor-readiness-operations.d.ts.map +1 -0
- package/dist/cli/doctor-readiness-operations.js +207 -0
- package/dist/cli/doctor-readiness-operations.js.map +1 -0
- package/dist/cli/doctor-readiness-workflows.d.ts +20 -0
- package/dist/cli/doctor-readiness-workflows.d.ts.map +1 -1
- package/dist/cli/doctor-readiness-workflows.js +29 -7
- package/dist/cli/doctor-readiness-workflows.js.map +1 -1
- package/dist/cli/doctor-readiness.d.ts.map +1 -1
- package/dist/cli/doctor-readiness.js +18 -12
- package/dist/cli/doctor-readiness.js.map +1 -1
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +20 -15
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/standards-proof-cmd.d.ts +7 -0
- package/dist/cli/standards-proof-cmd.d.ts.map +1 -0
- package/dist/cli/standards-proof-cmd.js +14 -0
- package/dist/cli/standards-proof-cmd.js.map +1 -0
- package/dist/cli/ui-setup-readiness-local.d.ts +2 -1
- package/dist/cli/ui-setup-readiness-local.d.ts.map +1 -1
- package/dist/cli/ui-setup-readiness-local.js +4 -2
- package/dist/cli/ui-setup-readiness-local.js.map +1 -1
- package/dist/cli/ui-setup-readiness.d.ts.map +1 -1
- package/dist/cli/ui-setup-readiness.js +3 -2
- package/dist/cli/ui-setup-readiness.js.map +1 -1
- package/dist/cli/update-check-hook.d.ts +19 -0
- package/dist/cli/update-check-hook.d.ts.map +1 -0
- package/dist/cli/update-check-hook.js +36 -0
- package/dist/cli/update-check-hook.js.map +1 -0
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +47 -6
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/standards/capture.d.ts +41 -0
- package/dist/standards/capture.d.ts.map +1 -0
- package/dist/standards/capture.js +196 -0
- package/dist/standards/capture.js.map +1 -0
- package/dist/standards/contract.d.ts +45 -0
- package/dist/standards/contract.d.ts.map +1 -0
- package/dist/standards/contract.js +175 -0
- package/dist/standards/contract.js.map +1 -0
- package/dist/standards/git-state.d.ts +30 -0
- package/dist/standards/git-state.d.ts.map +1 -0
- package/dist/standards/git-state.js +179 -0
- package/dist/standards/git-state.js.map +1 -0
- package/dist/standards/index.d.ts +8 -0
- package/dist/standards/index.d.ts.map +1 -0
- package/dist/standards/index.js +8 -0
- package/dist/standards/index.js.map +1 -0
- package/dist/standards/readiness.d.ts +11 -0
- package/dist/standards/readiness.d.ts.map +1 -0
- package/dist/standards/readiness.js +170 -0
- package/dist/standards/readiness.js.map +1 -0
- package/dist/standards/registry.d.ts +42 -0
- package/dist/standards/registry.d.ts.map +1 -0
- package/dist/standards/registry.js +330 -0
- package/dist/standards/registry.js.map +1 -0
- package/dist/standards/storage-reasons.d.ts +15 -0
- package/dist/standards/storage-reasons.d.ts.map +1 -0
- package/dist/standards/storage-reasons.js +48 -0
- package/dist/standards/storage-reasons.js.map +1 -0
- package/dist/standards/storage.d.ts +36 -0
- package/dist/standards/storage.d.ts.map +1 -0
- package/dist/standards/storage.js +330 -0
- package/dist/standards/storage.js.map +1 -0
- package/dist/standards/test-evidence.d.ts +19 -0
- package/dist/standards/test-evidence.d.ts.map +1 -0
- package/dist/standards/test-evidence.js +195 -0
- package/dist/standards/test-evidence.js.map +1 -0
- package/package.json +1 -1
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-doctor/SKILL.md +21 -3
- package/plugins/lisa/scripts/doctor-report.mjs +266 -22
- package/plugins/lisa/skills/lisa-doctor/SKILL.md +21 -3
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/scripts/doctor-report.mjs +266 -22
- package/plugins/lisa-agy/skills/lisa-doctor/SKILL.md +21 -3
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/scripts/doctor-report.mjs +266 -22
- package/plugins/lisa-copilot/skills/lisa-doctor/SKILL.md +21 -3
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/scripts/doctor-report.mjs +266 -22
- package/plugins/lisa-cursor/skills/lisa-doctor/SKILL.md +21 -3
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/scripts/doctor-report.mjs +266 -22
- package/plugins/src/base/skills/lisa-doctor/SKILL.md +21 -3
- package/rails/copy-overwrite/lefthook.yml +9 -11
- package/rails/copy-overwrite/scripts/lisa-clean-git-env.sh +13 -0
- package/typescript/copy-contents/.husky/pre-push +9 -0
- package/ui/index.html +3 -2
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/** Closed standards-check registry shared by every supported harness. */
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { realpath } from "node:fs/promises";
|
|
4
|
+
import { projectPathKind, readProjectText } from "../health/read-only-fs.js";
|
|
5
|
+
import { isJsonObject } from "../sync/json-path.js";
|
|
6
|
+
import { inferTestEvidenceFormat, } from "./test-evidence.js";
|
|
7
|
+
const STATIC_ANALYSIS = "static-analysis";
|
|
8
|
+
const TYPESCRIPT_SCRIPT_CHECKS = [
|
|
9
|
+
{
|
|
10
|
+
id: "typescript.lint",
|
|
11
|
+
script: "lint",
|
|
12
|
+
category: "lint",
|
|
13
|
+
timeoutMs: 180_000,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: "typescript.lint-slow",
|
|
17
|
+
script: "lint:slow",
|
|
18
|
+
category: "lint",
|
|
19
|
+
timeoutMs: 180_000,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "typescript.typecheck",
|
|
23
|
+
script: "typecheck",
|
|
24
|
+
category: STATIC_ANALYSIS,
|
|
25
|
+
timeoutMs: 180_000,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "typescript.build",
|
|
29
|
+
script: "build",
|
|
30
|
+
category: "guardrail",
|
|
31
|
+
timeoutMs: 600_000,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "typescript.test",
|
|
35
|
+
script: "test",
|
|
36
|
+
category: "test",
|
|
37
|
+
timeoutMs: 600_000,
|
|
38
|
+
requiresTestEvidence: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "typescript.test-unit",
|
|
42
|
+
script: "test:unit",
|
|
43
|
+
category: "test",
|
|
44
|
+
timeoutMs: 600_000,
|
|
45
|
+
requiresTestEvidence: true,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "typescript.test-coverage",
|
|
49
|
+
script: "test:cov",
|
|
50
|
+
category: "threshold",
|
|
51
|
+
timeoutMs: 900_000,
|
|
52
|
+
requiresTestEvidence: true,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "typescript.test-integration",
|
|
56
|
+
script: "test:integration",
|
|
57
|
+
category: "test",
|
|
58
|
+
timeoutMs: 600_000,
|
|
59
|
+
requiresTestEvidence: true,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "typescript.test-e2e",
|
|
63
|
+
script: "test:e2e",
|
|
64
|
+
category: "test",
|
|
65
|
+
timeoutMs: 900_000,
|
|
66
|
+
requiresTestEvidence: true,
|
|
67
|
+
optional: true,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "typescript.test-contract",
|
|
71
|
+
script: "test:contract",
|
|
72
|
+
category: "test",
|
|
73
|
+
timeoutMs: 600_000,
|
|
74
|
+
requiresTestEvidence: true,
|
|
75
|
+
optional: true,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "typescript.format",
|
|
79
|
+
script: "format:check",
|
|
80
|
+
category: "guardrail",
|
|
81
|
+
timeoutMs: 180_000,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "typescript.dead-code",
|
|
85
|
+
script: "knip:check",
|
|
86
|
+
category: STATIC_ANALYSIS,
|
|
87
|
+
timeoutMs: 300_000,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "typescript.ast-grep",
|
|
91
|
+
script: "sg:scan",
|
|
92
|
+
category: "guardrail",
|
|
93
|
+
timeoutMs: 180_000,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "typescript.mutation",
|
|
97
|
+
script: "test:mutation",
|
|
98
|
+
category: "guardrail",
|
|
99
|
+
timeoutMs: 1_800_000,
|
|
100
|
+
mutation: true,
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
const RAILS_CHECKS = [
|
|
104
|
+
direct("rails.rubocop", "lint", 300_000, "bundle", "exec", "rubocop"),
|
|
105
|
+
directTest("rails.rspec", 900_000, "rspec", "bundle", "exec", "rspec"),
|
|
106
|
+
direct("rails.reek", STATIC_ANALYSIS, 300_000, "bundle", "exec", "reek", "app/", "lib/"),
|
|
107
|
+
direct("rails.flog", STATIC_ANALYSIS, 300_000, "bundle", "exec", "flog", "--all", "--group", "app/", "lib/"),
|
|
108
|
+
direct("rails.flay", STATIC_ANALYSIS, 300_000, "bundle", "exec", "flay", "app/", "lib/"),
|
|
109
|
+
direct("rails.brakeman", "guardrail", 300_000, "bundle", "exec", "brakeman", "--no-pager", "--quiet"),
|
|
110
|
+
direct("rails.bundler-audit", "guardrail", 300_000, "bundle", "exec", "bundler-audit", "check", "--update"),
|
|
111
|
+
direct("rails.ast-grep", "guardrail", 180_000, "sg", "scan"),
|
|
112
|
+
];
|
|
113
|
+
/**
|
|
114
|
+
* Resolve the exact ordered union of checks for current detected stacks.
|
|
115
|
+
* Missing managed scripts and threshold tooling fail before any command runs.
|
|
116
|
+
* @param projectRoot - Canonical project root
|
|
117
|
+
* @param projectTypes - Expanded, canonical detected types
|
|
118
|
+
* @param config - Current bounded merged Lisa config
|
|
119
|
+
* @returns Closed current check plan
|
|
120
|
+
*/
|
|
121
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- explicit stack gates preserve fail-closed requirements and command order
|
|
122
|
+
export async function resolveStandardsCheckPlan(// eslint-disable-line max-lines-per-function -- the closed multi-stack registry is one auditable ordered plan
|
|
123
|
+
projectRoot, projectTypes, config) {
|
|
124
|
+
const root = await realpath(projectRoot);
|
|
125
|
+
if (projectTypes.length === 0) {
|
|
126
|
+
throw new Error("No supported Lisa project type was detected.");
|
|
127
|
+
}
|
|
128
|
+
const checks = [];
|
|
129
|
+
if (projectTypes.includes("typescript")) {
|
|
130
|
+
const manifest = await readPackageManifest(root);
|
|
131
|
+
const scripts = isJsonObject(manifest.scripts) ? manifest.scripts : {};
|
|
132
|
+
const packageManager = await resolvePackageManager(root);
|
|
133
|
+
for (const check of TYPESCRIPT_SCRIPT_CHECKS) {
|
|
134
|
+
if (check.mutation === true && !mutationGateEnabled(config))
|
|
135
|
+
continue;
|
|
136
|
+
const script = scripts[check.script];
|
|
137
|
+
if (typeof script !== "string" || script.trim().length === 0) {
|
|
138
|
+
if (check.optional === true)
|
|
139
|
+
continue;
|
|
140
|
+
throw new Error(`Required package script is missing: ${check.script}.`);
|
|
141
|
+
}
|
|
142
|
+
// eslint-disable-next-line functional/immutable-data -- the private ordered plan is frozen before it leaves this resolver
|
|
143
|
+
checks.push(Object.freeze({
|
|
144
|
+
id: check.id,
|
|
145
|
+
category: check.category,
|
|
146
|
+
argv: Object.freeze([
|
|
147
|
+
packageManager,
|
|
148
|
+
"run",
|
|
149
|
+
check.script,
|
|
150
|
+
]),
|
|
151
|
+
timeoutMs: check.timeoutMs,
|
|
152
|
+
...(check.requiresTestEvidence === true
|
|
153
|
+
? { testEvidence: inferTestEvidenceFormat(script) }
|
|
154
|
+
: {}),
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (projectTypes.includes("rails")) {
|
|
159
|
+
// eslint-disable-next-line functional/immutable-data -- the private ordered plan is frozen before it leaves this resolver
|
|
160
|
+
checks.push(...RAILS_CHECKS);
|
|
161
|
+
if (mutationGateEnabled(config)) {
|
|
162
|
+
if ((await projectPathKind(root, "scripts/lisa-mutation.sh")) !== "file") {
|
|
163
|
+
throw new Error("Required Rails mutation command is missing: scripts/lisa-mutation.sh.");
|
|
164
|
+
}
|
|
165
|
+
// eslint-disable-next-line functional/immutable-data -- the private ordered plan is frozen before it leaves this resolver
|
|
166
|
+
checks.push(direct("rails.mutation", "guardrail", 1_800_000, "bash", "scripts/lisa-mutation.sh"));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (projectTypes.includes("phaser")) {
|
|
170
|
+
if ((await projectPathKind(root, "scripts/check-verification-coverage.mjs")) !== "file") {
|
|
171
|
+
throw new Error("Required verification-coverage command is missing: scripts/check-verification-coverage.mjs.");
|
|
172
|
+
}
|
|
173
|
+
// eslint-disable-next-line functional/immutable-data -- the private ordered plan is frozen before it leaves this resolver
|
|
174
|
+
checks.push(Object.freeze({
|
|
175
|
+
...direct("phaser.verification-coverage", "guardrail", 180_000, "node", "scripts/check-verification-coverage.mjs"),
|
|
176
|
+
environment: Object.freeze({
|
|
177
|
+
VERIFY_BASE_SHA: "HEAD^",
|
|
178
|
+
VERIFY_HEAD_SHA: "HEAD",
|
|
179
|
+
}),
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
if ((await projectPathKind(root, "scripts/check-threshold-ratchet.mjs")) !==
|
|
183
|
+
"file") {
|
|
184
|
+
throw new Error("Required threshold command is missing: scripts/check-threshold-ratchet.mjs.");
|
|
185
|
+
}
|
|
186
|
+
// eslint-disable-next-line functional/immutable-data -- the private ordered plan is frozen before it leaves this resolver
|
|
187
|
+
checks.push(direct("shared.threshold-ratchet", "threshold", 180_000, "node", "scripts/check-threshold-ratchet.mjs", "--base", "HEAD^"));
|
|
188
|
+
if (new Set(checks.map(check => check.id)).size !== checks.length) {
|
|
189
|
+
throw new Error("Standards registry produced duplicate check identifiers.");
|
|
190
|
+
}
|
|
191
|
+
return freezePlan(checks, config);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Freeze the resolved checks and bind their registry and configuration digests.
|
|
195
|
+
* @param checks - Private ordered check accumulator
|
|
196
|
+
* @param config - Current bounded merged Lisa config
|
|
197
|
+
* @returns Frozen current check plan
|
|
198
|
+
*/
|
|
199
|
+
function freezePlan(checks, config) {
|
|
200
|
+
const frozen = Object.freeze(checks.map(check => Object.freeze(check)));
|
|
201
|
+
// eslint-disable-next-line max-lines -- this single closed registry keeps every supported stack command reviewable together
|
|
202
|
+
return Object.freeze({
|
|
203
|
+
checks: frozen,
|
|
204
|
+
registryDigest: digest({ version: 1, checks: frozen }),
|
|
205
|
+
configDigest: digestStandardsConfig(config),
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Digest only configuration that changes standards applicability or policy.
|
|
210
|
+
* @param config - Current merged Lisa config
|
|
211
|
+
* @returns Canonical standards configuration digest
|
|
212
|
+
*/
|
|
213
|
+
export function digestStandardsConfig(config) {
|
|
214
|
+
return digest({
|
|
215
|
+
quality: config.quality ?? null,
|
|
216
|
+
thresholdRatchet: config.thresholdRatchet ?? null,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Return a canonical SHA-256 digest without retaining config values.
|
|
221
|
+
* @param value - JSON-like value to digest
|
|
222
|
+
* @returns Canonical SHA-256 digest
|
|
223
|
+
*/
|
|
224
|
+
export function digestStandardsValue(value) {
|
|
225
|
+
return digest(value);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Construct one fixed direct-command check.
|
|
229
|
+
* @param id - Stable check identifier
|
|
230
|
+
* @param category - Standards category
|
|
231
|
+
* @param timeoutMs - Command deadline in milliseconds
|
|
232
|
+
* @param command - Fixed no-shell argv
|
|
233
|
+
* @returns Frozen standards check
|
|
234
|
+
*/
|
|
235
|
+
function direct(id, category, timeoutMs, ...command) {
|
|
236
|
+
return Object.freeze({
|
|
237
|
+
id,
|
|
238
|
+
category,
|
|
239
|
+
argv: Object.freeze(command),
|
|
240
|
+
timeoutMs,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Construct one direct test check with positive runner-evidence semantics.
|
|
245
|
+
* @param id - Stable check identifier
|
|
246
|
+
* @param timeoutMs - Command deadline in milliseconds
|
|
247
|
+
* @param testEvidence - Positive test-evidence parser
|
|
248
|
+
* @param command - Fixed no-shell argv
|
|
249
|
+
* @returns Frozen standards test check
|
|
250
|
+
*/
|
|
251
|
+
function directTest(id, timeoutMs, testEvidence, ...command) {
|
|
252
|
+
return Object.freeze({
|
|
253
|
+
...direct(id, "test", timeoutMs, ...command),
|
|
254
|
+
testEvidence,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Read a bounded package manifest and require its object shape.
|
|
259
|
+
* @param projectRoot - Canonical project repository
|
|
260
|
+
* @returns Parsed package manifest
|
|
261
|
+
*/
|
|
262
|
+
async function readPackageManifest(projectRoot) {
|
|
263
|
+
const payload = await readProjectText(projectRoot, "package.json");
|
|
264
|
+
if (payload === undefined) {
|
|
265
|
+
throw new Error("Required package manifest is missing: package.json.");
|
|
266
|
+
}
|
|
267
|
+
const parsed = JSON.parse(payload);
|
|
268
|
+
if (!isJsonObject(parsed)) {
|
|
269
|
+
throw new Error("package.json must contain a JSON object.");
|
|
270
|
+
}
|
|
271
|
+
return parsed;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Resolve one managed package runner in stable precedence order.
|
|
275
|
+
* @param projectRoot - Canonical project repository
|
|
276
|
+
* @returns Package runner selected by lockfile
|
|
277
|
+
*/
|
|
278
|
+
async function resolvePackageManager(projectRoot) {
|
|
279
|
+
const candidates = [
|
|
280
|
+
["bun.lock", "bun"],
|
|
281
|
+
["bun.lockb", "bun"],
|
|
282
|
+
["pnpm-lock.yaml", "pnpm"],
|
|
283
|
+
["yarn.lock", "yarn"],
|
|
284
|
+
["package-lock.json", "npm"],
|
|
285
|
+
];
|
|
286
|
+
for (const [lockfile, manager] of candidates) {
|
|
287
|
+
if ((await projectPathKind(projectRoot, lockfile)) === "file")
|
|
288
|
+
return manager;
|
|
289
|
+
}
|
|
290
|
+
return "npm";
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Read the shared mutation-gate switch without treating absence as enabled.
|
|
294
|
+
* @param config - Current merged Lisa config
|
|
295
|
+
* @returns Whether mutation proof is required
|
|
296
|
+
*/
|
|
297
|
+
function mutationGateEnabled(config) {
|
|
298
|
+
return (isJsonObject(config.quality) &&
|
|
299
|
+
isJsonObject(config.quality.mutation) &&
|
|
300
|
+
isJsonObject(config.quality.mutation.gate) &&
|
|
301
|
+
config.quality.mutation.gate.enabled === true);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Stable recursive JSON serialization for registry/config digests.
|
|
305
|
+
* @param value - JSON-like value to digest
|
|
306
|
+
* @returns Canonical SHA-256 digest
|
|
307
|
+
*/
|
|
308
|
+
function digest(value) {
|
|
309
|
+
return `sha256:${createHash("sha256")
|
|
310
|
+
.update(canonicalJson(value))
|
|
311
|
+
.digest("hex")}`;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Serialize JSON-like input with recursively sorted object keys.
|
|
315
|
+
* @param value - JSON-like value to serialize
|
|
316
|
+
* @returns Canonical JSON text
|
|
317
|
+
*/
|
|
318
|
+
function canonicalJson(value) {
|
|
319
|
+
if (Array.isArray(value)) {
|
|
320
|
+
return `[${value.map(item => canonicalJson(item)).join(",")}]`;
|
|
321
|
+
}
|
|
322
|
+
if (isJsonObject(value)) {
|
|
323
|
+
return `{${Object.keys(value)
|
|
324
|
+
.sort((left, right) => left.localeCompare(right))
|
|
325
|
+
.map(key => `${JSON.stringify(key)}:${canonicalJson(value[key])}`)
|
|
326
|
+
.join(",")}}`;
|
|
327
|
+
}
|
|
328
|
+
return JSON.stringify(value) ?? "null";
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1C,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,KAAK,IAAI,CAC9C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC;SAClC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;SAC5B,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACjE,CAAC;IACD,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;aAC1B,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;aAChD,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;aACjE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Finite, sanitized public reasons for standards-proof read failures. */
|
|
2
|
+
export declare const MALFORMED_STANDARDS_PROOF_REASON = "malformed standards proof";
|
|
3
|
+
/**
|
|
4
|
+
* Classify only errors emitted after strict contract validation begins.
|
|
5
|
+
* @param error - Strict validator failure
|
|
6
|
+
* @returns Finite public validation reason
|
|
7
|
+
*/
|
|
8
|
+
export declare function safeStandardsValidationReason(error: unknown): string;
|
|
9
|
+
/**
|
|
10
|
+
* Classify only failures from confined bounded filesystem operations.
|
|
11
|
+
* @param error - Storage read failure
|
|
12
|
+
* @returns Finite public storage reason
|
|
13
|
+
*/
|
|
14
|
+
export declare function safeStandardsStorageReason(error: unknown): string;
|
|
15
|
+
//# sourceMappingURL=storage-reasons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-reasons.d.ts","sourceRoot":"","sources":["../../src/standards/storage-reasons.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,eAAO,MAAM,gCAAgC,8BAA8B,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAmCpE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOjE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Finite, sanitized public reasons for standards-proof read failures. */
|
|
2
|
+
export const MALFORMED_STANDARDS_PROOF_REASON = "malformed standards proof";
|
|
3
|
+
/**
|
|
4
|
+
* Classify only errors emitted after strict contract validation begins.
|
|
5
|
+
* @param error - Strict validator failure
|
|
6
|
+
* @returns Finite public validation reason
|
|
7
|
+
*/
|
|
8
|
+
export function safeStandardsValidationReason(error) {
|
|
9
|
+
const message = error instanceof Error ? error.message : "unknown";
|
|
10
|
+
if (message === "Invalid standards proof schemaVersion: expected 1") {
|
|
11
|
+
return "unsupported standards proof schema";
|
|
12
|
+
}
|
|
13
|
+
if (message === "Invalid standards proof artifact identity" ||
|
|
14
|
+
message.startsWith("Invalid repository")) {
|
|
15
|
+
return "invalid standards proof identity";
|
|
16
|
+
}
|
|
17
|
+
if (message.startsWith("Invalid projectTypes") ||
|
|
18
|
+
message.startsWith("Invalid applicableChecks")) {
|
|
19
|
+
return "invalid standards proof check membership";
|
|
20
|
+
}
|
|
21
|
+
if (message ===
|
|
22
|
+
"Invalid standards proof results: checks must exactly match applicableChecks" ||
|
|
23
|
+
message.startsWith("Invalid results:") ||
|
|
24
|
+
/^Invalid results\[\d+\](?: fields|:|\.(?:check|category|status):)/u.test(message)) {
|
|
25
|
+
return "invalid standards proof check results";
|
|
26
|
+
}
|
|
27
|
+
if (message.startsWith("Invalid capturedAt:") ||
|
|
28
|
+
/^Invalid results\[\d+\]\.(?:startedAt|completedAt):/u.test(message) ||
|
|
29
|
+
/^Invalid results\[\d+\] timestamp order$/u.test(message)) {
|
|
30
|
+
return "invalid standards proof timestamps";
|
|
31
|
+
}
|
|
32
|
+
return MALFORMED_STANDARDS_PROOF_REASON;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Classify only failures from confined bounded filesystem operations.
|
|
36
|
+
* @param error - Storage read failure
|
|
37
|
+
* @returns Finite public storage reason
|
|
38
|
+
*/
|
|
39
|
+
export function safeStandardsStorageReason(error) {
|
|
40
|
+
const message = error instanceof Error ? error.message : "unknown";
|
|
41
|
+
if (message.includes("128 KiB"))
|
|
42
|
+
return "standards proof exceeds size limit";
|
|
43
|
+
if (message.includes("Unsafe") || message.includes("changed during read")) {
|
|
44
|
+
return "unsafe standards proof storage";
|
|
45
|
+
}
|
|
46
|
+
return MALFORMED_STANDARDS_PROOF_REASON;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=storage-reasons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-reasons.js","sourceRoot":"","sources":["../../src/standards/storage-reasons.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,MAAM,CAAC,MAAM,gCAAgC,GAAG,2BAA2B,CAAC;AAE5E;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAAC,KAAc;IAC1D,MAAM,OAAO,GAAG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AgC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type StandardsProof } from "./contract.js";
|
|
2
|
+
export declare const MAX_STANDARDS_PROOF_BYTES: number;
|
|
3
|
+
/** Closed result of reading a standards proof artifact. */
|
|
4
|
+
export type StandardsProofReadResult = {
|
|
5
|
+
readonly status: "available";
|
|
6
|
+
readonly proof: StandardsProof;
|
|
7
|
+
} | {
|
|
8
|
+
readonly status: "missing";
|
|
9
|
+
} | {
|
|
10
|
+
readonly status: "unreadable";
|
|
11
|
+
readonly reason: string;
|
|
12
|
+
};
|
|
13
|
+
/** Test-only timing boundary used to exercise post-open file growth. */
|
|
14
|
+
export interface StandardsProofReadDependencies {
|
|
15
|
+
readonly afterOpen?: (target: string) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read strict proof state without throwing for runtime-state faults.
|
|
19
|
+
* @param projectRoot - Project directory containing the proof
|
|
20
|
+
* @param now - Observation time for future-timestamp rejection
|
|
21
|
+
* @param dependencies - Test-only timing dependencies
|
|
22
|
+
* @returns Closed proof read result
|
|
23
|
+
*/
|
|
24
|
+
export declare function readStandardsProof(projectRoot: string, now?: Date, dependencies?: StandardsProofReadDependencies): Promise<StandardsProofReadResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Validate and atomically replace the proof only after capture succeeds.
|
|
27
|
+
* @param projectRoot - Project directory that owns the proof
|
|
28
|
+
* @param candidate - Untrusted proof candidate
|
|
29
|
+
* @param now - Validation time for future-timestamp rejection
|
|
30
|
+
* @returns Stored path and immutable proof
|
|
31
|
+
*/
|
|
32
|
+
export declare function writeStandardsProof(projectRoot: string, candidate: unknown, now?: Date): Promise<{
|
|
33
|
+
readonly path: string;
|
|
34
|
+
readonly proof: StandardsProof;
|
|
35
|
+
}>;
|
|
36
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/standards/storage.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AAOvB,eAAO,MAAM,yBAAyB,QAAa,CAAC;AAMpD,2DAA2D;AAC3D,MAAM,MAAM,wBAAwB,GAChC;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D,wEAAwE;AACxE,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EACnB,GAAG,GAAE,IAAiB,EACtB,YAAY,GAAE,8BAAmC,GAChD,OAAO,CAAC,wBAAwB,CAAC,CAanC;AAsDD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,OAAO,EAClB,GAAG,GAAE,IAAiB,GACrB,OAAO,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAAC,CA0BpE"}
|