oxe-cc 1.22.0 → 1.22.2
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/.cursor/commands/oxe-discuss.md +45 -45
- package/.cursor/commands/oxe-execute.md +52 -52
- package/.cursor/commands/oxe-help.md +44 -44
- package/.cursor/commands/oxe-next.md +44 -44
- package/.cursor/commands/oxe-plan.md +49 -49
- package/.cursor/commands/oxe-quick.md +49 -49
- package/.cursor/commands/oxe-review-pr.md +47 -47
- package/.cursor/commands/oxe-scan.md +47 -47
- package/.cursor/commands/oxe-ship.md +47 -47
- package/.cursor/commands/oxe-spec.md +49 -49
- package/.cursor/commands/oxe-verify.md +50 -50
- package/.cursor/commands/oxe.md +51 -51
- package/.github/prompts/oxe-alm.prompt.md +47 -47
- package/.github/prompts/oxe-ask.prompt.md +47 -47
- package/.github/prompts/oxe-capabilities.prompt.md +47 -47
- package/.github/prompts/oxe-checkpoint.prompt.md +47 -47
- package/.github/prompts/oxe-compact.prompt.md +46 -46
- package/.github/prompts/oxe-dashboard.prompt.md +47 -47
- package/.github/prompts/oxe-debug.prompt.md +47 -47
- package/.github/prompts/oxe-discuss.prompt.md +47 -47
- package/.github/prompts/oxe-execute.prompt.md +52 -52
- package/.github/prompts/oxe-forensics.prompt.md +47 -47
- package/.github/prompts/oxe-help.prompt.md +46 -46
- package/.github/prompts/oxe-loop.prompt.md +47 -47
- package/.github/prompts/oxe-milestone.prompt.md +47 -47
- package/.github/prompts/oxe-next.prompt.md +46 -46
- package/.github/prompts/oxe-obs.prompt.md +47 -47
- package/.github/prompts/oxe-plan-agent.prompt.md +46 -46
- package/.github/prompts/oxe-plan.prompt.md +49 -49
- package/.github/prompts/oxe-project.prompt.md +47 -47
- package/.github/prompts/oxe-quick.prompt.md +49 -49
- package/.github/prompts/oxe-research.prompt.md +47 -47
- package/.github/prompts/oxe-retro.prompt.md +47 -47
- package/.github/prompts/oxe-review-pr.prompt.md +47 -47
- package/.github/prompts/oxe-route.prompt.md +47 -47
- package/.github/prompts/oxe-scan.prompt.md +47 -47
- package/.github/prompts/oxe-security.prompt.md +47 -47
- package/.github/prompts/oxe-session.prompt.md +47 -47
- package/.github/prompts/oxe-ship.prompt.md +47 -47
- package/.github/prompts/oxe-skill.prompt.md +47 -47
- package/.github/prompts/oxe-spec.prompt.md +49 -49
- package/.github/prompts/oxe-ui-review.prompt.md +47 -47
- package/.github/prompts/oxe-ui-spec.prompt.md +47 -47
- package/.github/prompts/oxe-update.prompt.md +46 -46
- package/.github/prompts/oxe-validate-gaps.prompt.md +47 -47
- package/.github/prompts/oxe-verify.prompt.md +50 -50
- package/.github/prompts/oxe-workstream.prompt.md +47 -47
- package/.github/prompts/oxe.prompt.md +51 -51
- package/.github/workflows/release.yml +31 -0
- package/CHANGELOG.md +88 -0
- package/README.md +1 -1
- package/bin/lib/commands/ops-commands.cjs +751 -0
- package/bin/lib/commands/spec-program-commands.cjs +337 -0
- package/bin/lib/operational/alm-refine-runtime.cjs +791 -0
- package/bin/lib/operational/child-env.cjs +52 -0
- package/bin/lib/operational/promote-runtime.cjs +1187 -0
- package/bin/lib/oxe-agent-coord.cjs +246 -0
- package/bin/lib/oxe-alm-refine.cjs +97 -1
- package/bin/lib/oxe-ci-adapter.cjs +304 -0
- package/bin/lib/oxe-complexity.cjs +1 -1
- package/bin/lib/oxe-decisions.cjs +9 -3
- package/bin/lib/oxe-dir-info.cjs +20 -1
- package/bin/lib/oxe-env-sanitize.cjs +6 -1
- package/bin/lib/oxe-git-root.cjs +97 -0
- package/bin/lib/oxe-grill.cjs +90 -1
- package/bin/lib/oxe-onboard.cjs +640 -0
- package/bin/lib/oxe-operational.cjs +14481 -15949
- package/bin/lib/oxe-origin.cjs +4 -1
- package/bin/lib/oxe-phase-gates.cjs +139 -2
- package/bin/lib/oxe-plan-build.cjs +62 -2
- package/bin/lib/oxe-plan-mutate.cjs +108 -2
- package/bin/lib/oxe-preflight.cjs +9 -3
- package/bin/lib/oxe-presets.cjs +216 -0
- package/bin/lib/oxe-project-env.cjs +79 -0
- package/bin/lib/oxe-project-health.cjs +2 -0
- package/bin/lib/oxe-reevaluate.cjs +198 -0
- package/bin/lib/oxe-release-ops.cjs +51 -15
- package/bin/lib/oxe-scorecard.cjs +394 -1
- package/bin/lib/oxe-ship-pr.cjs +72 -4
- package/bin/lib/oxe-spec-check.cjs +32 -0
- package/bin/lib/oxe-suite-impact.cjs +1160 -1145
- package/bin/lib/oxe-sync.cjs +99 -2
- package/bin/lib/oxe-verify-cache.cjs +132 -0
- package/bin/lib/oxe-vitest-batch.cjs +10 -3
- package/bin/lib/oxe-worktree-gc.cjs +655 -170
- package/bin/oxe-cc.js +10042 -10669
- package/commands/oxe/alm.md +54 -54
- package/commands/oxe/ask.md +55 -55
- package/commands/oxe/capabilities.md +50 -50
- package/commands/oxe/checkpoint.md +53 -53
- package/commands/oxe/compact.md +47 -47
- package/commands/oxe/dashboard.md +51 -51
- package/commands/oxe/debug.md +58 -58
- package/commands/oxe/discuss.md +58 -58
- package/commands/oxe/execute.md +63 -63
- package/commands/oxe/forensics.md +53 -53
- package/commands/oxe/help.md +48 -48
- package/commands/oxe/loop.md +54 -54
- package/commands/oxe/milestone.md +53 -53
- package/commands/oxe/next.md +49 -49
- package/commands/oxe/obs.md +53 -53
- package/commands/oxe/oxe.md +55 -55
- package/commands/oxe/plan-agent.md +57 -57
- package/commands/oxe/plan.md +59 -59
- package/commands/oxe/project.md +53 -53
- package/commands/oxe/quick.md +53 -53
- package/commands/oxe/research.md +53 -53
- package/commands/oxe/retro.md +53 -53
- package/commands/oxe/review-pr.md +53 -53
- package/commands/oxe/route.md +48 -48
- package/commands/oxe/scan.md +58 -58
- package/commands/oxe/security.md +53 -53
- package/commands/oxe/session.md +53 -53
- package/commands/oxe/ship.md +53 -53
- package/commands/oxe/skill.md +53 -53
- package/commands/oxe/spec.md +59 -59
- package/commands/oxe/ui-review.md +53 -53
- package/commands/oxe/ui-spec.md +53 -53
- package/commands/oxe/update.md +53 -53
- package/commands/oxe/validate-gaps.md +53 -53
- package/commands/oxe/verify-audit.md +50 -50
- package/commands/oxe/verify.md +60 -60
- package/commands/oxe/workflow-authoring.md +50 -50
- package/commands/oxe/workstream.md +53 -53
- package/docs/RELEASE-READINESS.md +7 -1
- package/docs/adr/D-1-isolamento-read-only-e-sanitizacao-centralizada-de-env-vars.md +29 -29
- package/docs/adr/D-2-junction-segura-de-node-modules-condicionada-a-sha-256-de-pa.md +29 -29
- package/docs/adr/D-3-preflight-local-5s-impacto-estatico-e2e-e-leitura-explicita.md +29 -29
- package/docs/adr/D-4-governanca-de-release-unificada-retomada-idempotente-pos-rei.md +29 -29
- package/docs/adr/D-5-core-agnostico-vs-presets-declarativos-de-dominio.md +29 -0
- package/docs/adr/D-6-decomposicao-strangler-fig-de-oxe-cc-e-oxe-operational.md +29 -0
- package/docs/adr/D-7-paridade-pre-push-com-phase-gates-path-aware-json-compacto-e.md +28 -0
- package/docs/adr/D-F1F4-1-paridade-pre-push-compactacao-json-sync-version-pins-e-quali.md +44 -0
- package/docs/adr/README.md +18 -14
- package/lib/runtime/verification/verification-compiler.d.ts +12 -1
- package/lib/runtime/verification/verification-compiler.js +235 -65
- package/oxe/templates/CONFIG.md +14 -1
- package/oxe/workflows/help.md +3 -0
- package/oxe/workflows/lean/execute.md +2 -1
- package/oxe/workflows/ship.md +4 -2
- package/package.json +4 -4
- package/packages/runtime/package.json +1 -1
- package/packages/runtime/src/verification/verification-compiler.ts +193 -25
- package/packages/runtime/tsconfig.json +1 -0
- package/vscode-extension/package.json +1 -1
package/bin/lib/oxe-sync.cjs
CHANGED
|
@@ -14,7 +14,14 @@ const { spawnSync } = require('child_process');
|
|
|
14
14
|
|
|
15
15
|
const envSanitize = require('./oxe-env-sanitize.cjs');
|
|
16
16
|
|
|
17
|
-
const DEFAULT_MIGRATION_DIRS = [
|
|
17
|
+
const DEFAULT_MIGRATION_DIRS = [
|
|
18
|
+
'migrations',
|
|
19
|
+
'db/migrations',
|
|
20
|
+
'src/db/migrations',
|
|
21
|
+
'src/main/db/migrations',
|
|
22
|
+
'electron/db/migrations',
|
|
23
|
+
'electron/main/db/migrations',
|
|
24
|
+
];
|
|
18
25
|
const MIGRATION_NUM_RE = /^(\d+)([_-].+)$/;
|
|
19
26
|
|
|
20
27
|
function readJsonQuiet(file) {
|
|
@@ -168,7 +175,72 @@ function planRatchetSync(root, cfg) {
|
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
/**
|
|
171
|
-
* OXB-
|
|
178
|
+
* OXB-222-03: Plans atomic updates to declared `sync.version_pins` (`[{ file, pattern, label? }]`)
|
|
179
|
+
* whenever colliding migrations bump the maximum schema version.
|
|
180
|
+
*/
|
|
181
|
+
function planVersionPinSync(root, cfg, migrationBumps = []) {
|
|
182
|
+
const syncCfg = cfg && cfg.sync && typeof cfg.sync === 'object' ? cfg.sync : {};
|
|
183
|
+
const pins = Array.isArray(syncCfg.version_pins) ? syncCfg.version_pins : [];
|
|
184
|
+
if (!pins.length || !Array.isArray(migrationBumps) || !migrationBumps.length) return [];
|
|
185
|
+
const targetVersion = Math.max(...migrationBumps.map((b) => Number(b && b.new_number) || 0));
|
|
186
|
+
if (!Number.isFinite(targetVersion) || targetVersion <= 0) return [];
|
|
187
|
+
|
|
188
|
+
const updates = [];
|
|
189
|
+
for (const pin of pins) {
|
|
190
|
+
if (!pin || typeof pin !== 'object' || typeof pin.file !== 'string' || typeof pin.pattern !== 'string') continue;
|
|
191
|
+
const rel = pin.file.replace(/\\/g, '/').replace(/^\.\//, '').trim();
|
|
192
|
+
if (!rel) continue;
|
|
193
|
+
const abs = path.join(root, rel);
|
|
194
|
+
if (!fs.existsSync(abs)) continue;
|
|
195
|
+
let text = '';
|
|
196
|
+
try { text = fs.readFileSync(abs, 'utf8'); } catch { continue; }
|
|
197
|
+
const rawPattern = pin.pattern.includes('{version}')
|
|
198
|
+
? pin.pattern.replace(/\{version\}/g, '(\\d+)')
|
|
199
|
+
: pin.pattern;
|
|
200
|
+
let re;
|
|
201
|
+
try { re = new RegExp(rawPattern, 'g'); } catch { continue; }
|
|
202
|
+
for (const m of text.matchAll(re)) {
|
|
203
|
+
if (m.index == null) continue;
|
|
204
|
+
let prefix = '';
|
|
205
|
+
let numStr = '';
|
|
206
|
+
let suffix = '';
|
|
207
|
+
if (m.length >= 3 && /^\d+$/.test(String(m[2] || ''))) {
|
|
208
|
+
prefix = String(m[1] || '');
|
|
209
|
+
numStr = String(m[2]);
|
|
210
|
+
const endPrefix = m[0].indexOf(prefix) + prefix.length;
|
|
211
|
+
const endNum = m[0].indexOf(numStr, endPrefix) + numStr.length;
|
|
212
|
+
suffix = m[0].slice(endNum);
|
|
213
|
+
} else if (m.length >= 2 && /^\d+$/.test(String(m[1] || ''))) {
|
|
214
|
+
numStr = String(m[1]);
|
|
215
|
+
const pos = m[0].indexOf(numStr);
|
|
216
|
+
prefix = m[0].slice(0, pos);
|
|
217
|
+
suffix = m[0].slice(pos + numStr.length);
|
|
218
|
+
} else {
|
|
219
|
+
const d = /\d+/.exec(m[0]);
|
|
220
|
+
if (!d) continue;
|
|
221
|
+
numStr = d[0];
|
|
222
|
+
prefix = m[0].slice(0, d.index);
|
|
223
|
+
suffix = m[0].slice(d.index + numStr.length);
|
|
224
|
+
}
|
|
225
|
+
const current = Number(numStr);
|
|
226
|
+
if (!Number.isFinite(current) || current === targetVersion) continue;
|
|
227
|
+
updates.push({
|
|
228
|
+
file: rel,
|
|
229
|
+
label: typeof pin.label === 'string' && pin.label.trim() ? pin.label.trim() : null,
|
|
230
|
+
from: current,
|
|
231
|
+
to: targetVersion,
|
|
232
|
+
index: m.index,
|
|
233
|
+
length: m[0].length,
|
|
234
|
+
replacement: `${prefix}${targetVersion}${suffix}`,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return updates;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* OXB-G06 + OXB-222-03: Detects and optionally applies deterministic auto-bumps for sequential migrations,
|
|
243
|
+
* declared `sync.version_pins`, and numeric ratchets.
|
|
172
244
|
*/
|
|
173
245
|
function syncSequentialResources(projectRoot, options = {}) {
|
|
174
246
|
const rootAbs = path.resolve(projectRoot);
|
|
@@ -182,9 +254,11 @@ function syncSequentialResources(projectRoot, options = {}) {
|
|
|
182
254
|
for (const d of migDirs) {
|
|
183
255
|
migrationBumps.push(...planMigrationBumps(rootAbs, base, d, spawn));
|
|
184
256
|
}
|
|
257
|
+
const versionPinUpdates = planVersionPinSync(rootAbs, cfg, migrationBumps);
|
|
185
258
|
const ratchetUpdates = planRatchetSync(rootAbs, cfg);
|
|
186
259
|
|
|
187
260
|
const appliedMigrations = [];
|
|
261
|
+
const appliedVersionPins = [];
|
|
188
262
|
const appliedRatchets = [];
|
|
189
263
|
|
|
190
264
|
if (apply) {
|
|
@@ -205,6 +279,25 @@ function syncSequentialResources(projectRoot, options = {}) {
|
|
|
205
279
|
if (!mv.ok) fs.renameSync(fromAbs, toAbs);
|
|
206
280
|
appliedMigrations.push(b);
|
|
207
281
|
}
|
|
282
|
+
// Apply version_pins grouped per file in reverse offset order so multiple matches in one file stay exact.
|
|
283
|
+
const freshPins = planVersionPinSync(rootAbs, cfg, appliedMigrations.length ? appliedMigrations : migrationBumps);
|
|
284
|
+
const pinsByFile = new Map();
|
|
285
|
+
for (const u of freshPins) {
|
|
286
|
+
if (!pinsByFile.has(u.file)) pinsByFile.set(u.file, []);
|
|
287
|
+
pinsByFile.get(u.file).push(u);
|
|
288
|
+
}
|
|
289
|
+
for (const [rel, list] of pinsByFile.entries()) {
|
|
290
|
+
const abs = path.join(rootAbs, rel);
|
|
291
|
+
let text = fs.readFileSync(abs, 'utf8');
|
|
292
|
+
const ordered = [...list].sort((a, b) => b.index - a.index);
|
|
293
|
+
for (const u of ordered) {
|
|
294
|
+
text = text.slice(0, u.index) + u.replacement + text.slice(u.index + u.length);
|
|
295
|
+
}
|
|
296
|
+
fs.writeFileSync(abs, text, 'utf8');
|
|
297
|
+
for (const u of list) {
|
|
298
|
+
appliedVersionPins.push({ file: u.file, label: u.label, from: u.from, to: u.to });
|
|
299
|
+
}
|
|
300
|
+
}
|
|
208
301
|
// Re-plan ratchets right before applying (in case migration rename changed anything)
|
|
209
302
|
const freshRatchets = planRatchetSync(rootAbs, cfg);
|
|
210
303
|
for (const u of freshRatchets) {
|
|
@@ -236,15 +329,19 @@ function syncSequentialResources(projectRoot, options = {}) {
|
|
|
236
329
|
dry_run: !apply,
|
|
237
330
|
base,
|
|
238
331
|
migration_bumps: migrationBumps,
|
|
332
|
+
version_pin_updates: versionPinUpdates.map(({ file, label, from, to }) => ({ file, label, from, to })),
|
|
239
333
|
ratchet_updates: ratchetUpdates.map(({ file, line, from, to }) => ({ file, line, from, to })),
|
|
240
334
|
applied_migrations: appliedMigrations,
|
|
335
|
+
applied_version_pins: appliedVersionPins,
|
|
241
336
|
applied_ratchets: appliedRatchets,
|
|
242
337
|
verify,
|
|
243
338
|
};
|
|
244
339
|
}
|
|
245
340
|
|
|
246
341
|
module.exports = {
|
|
342
|
+
DEFAULT_MIGRATION_DIRS,
|
|
247
343
|
planMigrationBumps,
|
|
344
|
+
planVersionPinSync,
|
|
248
345
|
planRatchetSync,
|
|
249
346
|
syncSequentialResources,
|
|
250
347
|
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 1.22.2 (OXB-222-15): Incremental verification regression cache keyed by
|
|
5
|
+
* (check_id, command, tree_fingerprint). Only caches verified PASS results;
|
|
6
|
+
* never caches failures, errors, skips, or checks with modified frozen files.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const crypto = require('crypto');
|
|
12
|
+
const { spawnSync } = require('child_process');
|
|
13
|
+
|
|
14
|
+
const CACHE_SCHEMA = 1;
|
|
15
|
+
const MAX_ENTRIES = 400;
|
|
16
|
+
|
|
17
|
+
function cacheFilePath(projectRoot) {
|
|
18
|
+
return path.join(path.resolve(projectRoot), '.oxe', 'runs', 'verify-regression-cache.json');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function makeCacheKey(check, fingerprint) {
|
|
22
|
+
const raw = JSON.stringify({
|
|
23
|
+
id: String((check && check.id) || ''),
|
|
24
|
+
cmd: String((check && check.command) || ''),
|
|
25
|
+
proves: Array.isArray(check && check.proves) ? check.proves : [],
|
|
26
|
+
fp: String(fingerprint || ''),
|
|
27
|
+
});
|
|
28
|
+
return crypto.createHash('sha256').update(raw, 'utf8').digest('hex').slice(0, 24);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Computes a deterministic workspace code fingerprint (HEAD + working-tree diff + untracked hashes),
|
|
33
|
+
* ignoring `.oxe/` runtime artifacts so non-code projections do not needlessly bust regression cache.
|
|
34
|
+
*/
|
|
35
|
+
function computeVerifyFingerprint(projectRoot, options = {}) {
|
|
36
|
+
const spawn = options.spawn || spawnSync;
|
|
37
|
+
const rootAbs = path.resolve(projectRoot);
|
|
38
|
+
const hash = crypto.createHash('sha256');
|
|
39
|
+
try {
|
|
40
|
+
const head = spawn('git', ['rev-parse', 'HEAD'], { cwd: rootAbs, encoding: 'utf8', windowsHide: true });
|
|
41
|
+
if (head.status !== 0) return null;
|
|
42
|
+
hash.update(`HEAD:${String(head.stdout || '').trim()}\n`);
|
|
43
|
+
const diff = spawn('git', ['diff', 'HEAD', '--', '.', ':!.oxe'], { cwd: rootAbs, encoding: 'utf8', windowsHide: true, maxBuffer: 16 * 1024 * 1024 });
|
|
44
|
+
hash.update(`DIFF:${String(diff.stdout || '')}\n`);
|
|
45
|
+
const untracked = spawn('git', ['ls-files', '--others', '--exclude-standard', '--', '.', ':!.oxe'], { cwd: rootAbs, encoding: 'utf8', windowsHide: true });
|
|
46
|
+
const files = String(untracked.stdout || '').split(/\r?\n/).map((s) => s.trim()).filter(Boolean).sort();
|
|
47
|
+
for (const rel of files.slice(0, 200)) {
|
|
48
|
+
const abs = path.join(rootAbs, rel);
|
|
49
|
+
try {
|
|
50
|
+
const st = fs.statSync(abs);
|
|
51
|
+
if (st.isFile() && st.size <= 1024 * 1024) {
|
|
52
|
+
hash.update(`U:${rel}:${st.size}:${crypto.createHash('sha256').update(fs.readFileSync(abs)).digest('hex')}\n`);
|
|
53
|
+
}
|
|
54
|
+
} catch { /* ignore */ }
|
|
55
|
+
}
|
|
56
|
+
return hash.digest('hex').slice(0, 24);
|
|
57
|
+
} catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function loadVerifyCache(projectRoot) {
|
|
63
|
+
const file = cacheFilePath(projectRoot);
|
|
64
|
+
try {
|
|
65
|
+
const doc = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
66
|
+
if (doc && doc.schema === CACHE_SCHEMA && doc.entries && typeof doc.entries === 'object') {
|
|
67
|
+
return doc;
|
|
68
|
+
}
|
|
69
|
+
} catch { /* absent or corrupt */ }
|
|
70
|
+
return { schema: CACHE_SCHEMA, entries: {} };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function saveVerifyCache(projectRoot, cache) {
|
|
74
|
+
if (!cache || typeof cache !== 'object') return;
|
|
75
|
+
const file = cacheFilePath(projectRoot);
|
|
76
|
+
const entries = cache.entries && typeof cache.entries === 'object' ? cache.entries : {};
|
|
77
|
+
const keys = Object.keys(entries);
|
|
78
|
+
if (keys.length > MAX_ENTRIES) {
|
|
79
|
+
keys.sort((a, b) => String((entries[a] && entries[a].recorded_at) || '').localeCompare(String((entries[b] && entries[b].recorded_at) || '')));
|
|
80
|
+
for (const k of keys.slice(0, keys.length - MAX_ENTRIES)) delete entries[k];
|
|
81
|
+
}
|
|
82
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
83
|
+
fs.writeFileSync(file, `${JSON.stringify({ schema: CACHE_SCHEMA, entries }, null, 2)}\n`, 'utf8');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function lookupCachedPass(cache, check, fingerprint) {
|
|
87
|
+
if (!cache || !cache.entries || !check || !check.command || !fingerprint) return null;
|
|
88
|
+
const key = makeCacheKey(check, fingerprint);
|
|
89
|
+
const entry = cache.entries[key];
|
|
90
|
+
if (!entry || entry.status !== 'pass' || entry.fingerprint !== fingerprint) return null;
|
|
91
|
+
return {
|
|
92
|
+
check_id: check.id,
|
|
93
|
+
acceptance_ref: check.acceptance_ref || null,
|
|
94
|
+
status: 'pass',
|
|
95
|
+
stdout: String(entry.stdout || ''),
|
|
96
|
+
stderr: String(entry.stderr || ''),
|
|
97
|
+
exit_code: 0,
|
|
98
|
+
duration_ms: 0,
|
|
99
|
+
error: null,
|
|
100
|
+
tests_executed: entry.tests_executed ?? null,
|
|
101
|
+
evidence_refs: [],
|
|
102
|
+
cached: true,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function recordVerifyPass(cache, check, result, fingerprint) {
|
|
107
|
+
if (!cache || !check || !result || !fingerprint) return false;
|
|
108
|
+
if (result.status !== 'pass' || !check.command) return false;
|
|
109
|
+
if (!cache.entries || typeof cache.entries !== 'object') cache.entries = {};
|
|
110
|
+
const key = makeCacheKey(check, fingerprint);
|
|
111
|
+
cache.entries[key] = {
|
|
112
|
+
check_id: check.id,
|
|
113
|
+
command: check.command,
|
|
114
|
+
fingerprint,
|
|
115
|
+
status: 'pass',
|
|
116
|
+
stdout: String(result.stdout || '').slice(0, 64 * 1024),
|
|
117
|
+
stderr: String(result.stderr || '').slice(0, 16 * 1024),
|
|
118
|
+
tests_executed: result.tests_executed ?? null,
|
|
119
|
+
recorded_at: new Date().toISOString(),
|
|
120
|
+
};
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
module.exports = {
|
|
125
|
+
cacheFilePath,
|
|
126
|
+
makeCacheKey,
|
|
127
|
+
computeVerifyFingerprint,
|
|
128
|
+
loadVerifyCache,
|
|
129
|
+
saveVerifyCache,
|
|
130
|
+
lookupCachedPass,
|
|
131
|
+
recordVerifyPass,
|
|
132
|
+
};
|
|
@@ -81,12 +81,19 @@ function splitSegments(command) {
|
|
|
81
81
|
* A task's verify with its vitest segments merged per key (first occurrence keeps its place). Same meaning: every file
|
|
82
82
|
* must pass; one process per runner+flags instead of one per file.
|
|
83
83
|
*/
|
|
84
|
-
function batchVerifyCommand(command) {
|
|
84
|
+
function batchVerifyCommand(command, options = {}) {
|
|
85
85
|
const segments = splitSegments(command);
|
|
86
86
|
if (segments.length < 2) return command;
|
|
87
|
+
const noBatch = Array.isArray(options && options.noBatchPatterns)
|
|
88
|
+
? options.noBatchPatterns.map((p) => String(p || '').toLowerCase()).filter(Boolean)
|
|
89
|
+
: [];
|
|
87
90
|
const groups = new Map();
|
|
88
91
|
const order = [];
|
|
89
92
|
for (const seg of segments) {
|
|
93
|
+
if (noBatch.length && noBatch.some((p) => seg.toLowerCase().includes(p))) {
|
|
94
|
+
order.push({ raw: seg });
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
90
97
|
const v = parseVitest(seg);
|
|
91
98
|
if (!v) { order.push({ raw: seg }); continue; }
|
|
92
99
|
if (!groups.has(v.key)) { groups.set(v.key, { ...v, files: [] }); order.push({ key: v.key }); }
|
|
@@ -98,10 +105,10 @@ function batchVerifyCommand(command) {
|
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
/** Applies batchVerifyCommand to each pending task of a parsed plan (graph and verify suite). */
|
|
101
|
-
function batchPlanVerifies(parsedPlan) {
|
|
108
|
+
function batchPlanVerifies(parsedPlan, options = {}) {
|
|
102
109
|
for (const task of (parsedPlan && parsedPlan.tasks) || []) {
|
|
103
110
|
if (task.done || !task.verifyCommand) continue;
|
|
104
|
-
const batched = batchVerifyCommand(task.verifyCommand);
|
|
111
|
+
const batched = batchVerifyCommand(task.verifyCommand, options);
|
|
105
112
|
if (batched !== task.verifyCommand) {
|
|
106
113
|
task.meta = { ...(task.meta || {}), verify_batched_from: task.verifyCommand };
|
|
107
114
|
task.verifyCommand = batched;
|