@outerlayer/cli 0.34.0-next.20261028010245 → 0.34.0-next.20261028122415
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/dist/{agent-setup-6FPE6EYN.js → agent-setup-LZ7PEM6A.js} +6 -6
- package/dist/{bridge-JGIHPGMY.js → bridge-4DFOWIY2.js} +2 -2
- package/dist/{build-AAQ4PVP2.js → build-VVZHFSZK.js} +8 -8
- package/dist/{build-disk-L7JRQA22.js → build-disk-QV4TO7HZ.js} +6 -6
- package/dist/build-info.json +1 -1
- package/dist/{builder-LMLAVVVF.js → builder-6JLFMAGJ.js} +5 -5
- package/dist/{check-C7UKLYZQ.js → check-FWRVWOVY.js} +38 -38
- package/dist/{chunk-WEQMLC7P.js → chunk-265SXBQ5.js} +3 -3
- package/dist/{chunk-AJTGTSNA.js → chunk-2CW2QMSG.js} +1 -1
- package/dist/{chunk-AHWMY3MS.js → chunk-2LCNMAWP.js} +4 -4
- package/dist/{chunk-SWCOWG2C.js → chunk-3EU4MWCE.js} +3 -3
- package/dist/{chunk-L2OARQKP.js → chunk-4N7BQBO4.js} +28 -13
- package/dist/{chunk-6OLXDSQ6.js → chunk-5B6DLEVM.js} +1 -1
- package/dist/{chunk-QNF7LT7W.js → chunk-5VKSPEST.js} +3 -3
- package/dist/{chunk-3X6OSXSB.js → chunk-64LLUVJR.js} +1 -1
- package/dist/{chunk-WSVE5QGL.js → chunk-6CQXOTNL.js} +4 -4
- package/dist/{chunk-GJYGOFF3.js → chunk-72N7GOLM.js} +6 -6
- package/dist/{chunk-4A5OJOCR.js → chunk-7DHESPSV.js} +10 -10
- package/dist/{chunk-VB4QD4WN.js → chunk-7JBG43BX.js} +67 -25
- package/dist/{chunk-EGJY6MBC.js → chunk-7LKOOGSN.js} +2 -2
- package/dist/{chunk-KTVZ7TZY.js → chunk-7XZQTJOD.js} +1 -1
- package/dist/{chunk-A6PJSNP6.js → chunk-A2KLVZBU.js} +31 -29
- package/dist/{chunk-BQ4C47K2.js → chunk-AGNFPJSP.js} +5 -5
- package/dist/{chunk-JXY66VYX.js → chunk-AKQX462F.js} +3 -3
- package/dist/{chunk-5LUN7TTR.js → chunk-AVI3MGQO.js} +2 -2
- package/dist/{chunk-3XOLOV5A.js → chunk-AXKSVN4U.js} +4 -4
- package/dist/{work-proofs-record-LIQGUDWH.js → chunk-BEGMZKMG.js} +176 -497
- package/dist/{chunk-QJ2SNBHL.js → chunk-BUVDDPOM.js} +1 -1
- package/dist/{chunk-32FAPJFD.js → chunk-C2E4PWEN.js} +6 -6
- package/dist/{chunk-57WFXHCB.js → chunk-D7MWJM2G.js} +1 -1
- package/dist/{chunk-G4SOMWXL.js → chunk-DKIZDYUX.js} +1 -1
- package/dist/{chunk-I4YOWQH7.js → chunk-E3GX4WVJ.js} +1 -1
- package/dist/{chunk-F3BGTGQC.js → chunk-EXKOPZQV.js} +1 -1
- package/dist/{chunk-BTDBDTUY.js → chunk-GJHOU5V3.js} +3 -3
- package/dist/{chunk-D6SH7DWA.js → chunk-H5YUWLIY.js} +3 -3
- package/dist/{chunk-PAGB3DCI.js → chunk-IZKUPAXF.js} +1 -1
- package/dist/{chunk-GET5HKLM.js → chunk-JDQBJUXQ.js} +1 -1
- package/dist/{chunk-23XAA7YD.js → chunk-LEJWPGO7.js} +3 -3
- package/dist/{chunk-NBETYM32.js → chunk-N4KQMGEZ.js} +4 -4
- package/dist/{chunk-4J5GRWAY.js → chunk-N6V4ZHI7.js} +2 -2
- package/dist/{chunk-PHIQHIRJ.js → chunk-NPTEYMBW.js} +1 -1
- package/dist/{chunk-3E7QAXUW.js → chunk-OFKM35MX.js} +6 -6
- package/dist/{chunk-LBKCYEJT.js → chunk-ORENXMHA.js} +1 -1
- package/dist/{chunk-6Q7O4MRI.js → chunk-QGTJ5IJN.js} +1 -1
- package/dist/{chunk-5IUC2B6J.js → chunk-QTL7VZVF.js} +2 -2
- package/dist/{chunk-GXMMILQ4.js → chunk-QXAPVAPR.js} +3 -3
- package/dist/{chunk-6LS62EO4.js → chunk-S37IAT3A.js} +3 -3
- package/dist/{chunk-PPQTTJSW.js → chunk-SODV2YMW.js} +5 -5
- package/dist/{chunk-SYMBXSAT.js → chunk-SX3LYSWR.js} +3 -3
- package/dist/{chunk-77D5ENBA.js → chunk-TZXJSNN4.js} +1 -1
- package/dist/{chunk-HFMK2R7O.js → chunk-U3O7MULV.js} +20 -20
- package/dist/{chunk-GMEXR6PY.js → chunk-UDMFRKFJ.js} +6 -6
- package/dist/{chunk-NCKH3KCM.js → chunk-UKEIJKCH.js} +25 -12
- package/dist/{chunk-VKYU4HHW.js → chunk-VJQQVTCS.js} +1 -1
- package/dist/{chunk-UEDRRWZ3.js → chunk-XDCD4GD5.js} +3 -3
- package/dist/{chunk-PBI4CM4M.js → chunk-YGU43DH4.js} +57 -27
- package/dist/{chunk-NOEJGR4X.js → chunk-ZIXLG6EQ.js} +3 -3
- package/dist/{claude-launcher-GGZEWVYJ.js → claude-launcher-XX2MLBDW.js} +1 -1
- package/dist/{cli-IG52447Q.js → cli-K7AWWU6C.js} +112 -112
- package/dist/{command-NSTOWAZ6.js → command-GJKJ5WT4.js} +25 -25
- package/dist/{config-YPUOOZB6.js → config-AB5Y73BU.js} +7 -7
- package/dist/{connect-cmd-RPEEANNE.js → connect-cmd-FOD7PKVW.js} +6 -6
- package/dist/{container-start-OOBTGHWF.js → container-start-XGKAKLUD.js} +32 -32
- package/dist/{context-show-cmd-R5WCECOT.js → context-show-cmd-A226Q6K5.js} +7 -7
- package/dist/{control-plane-launch-55CJGYBK.js → control-plane-launch-RJSAIFEP.js} +5 -5
- package/dist/{demo-record-cmd-SFOWQPL7.js → demo-record-cmd-KM2UPWPL.js} +2 -2
- package/dist/{demo-voice-cmd-ZOBRVHOK.js → demo-voice-cmd-W4NYPCVL.js} +12 -12
- package/dist/{dist-BUSLJNSZ.js → dist-ZW7I72SD.js} +1 -1
- package/dist/{docker-VPJW5LXB.js → docker-OQP6NU7P.js} +5 -5
- package/dist/{doctor-O2EJAPZB.js → doctor-OXMOYIKK.js} +25 -25
- package/dist/{emit-artifact-cmd-HBFYBXJR.js → emit-artifact-cmd-X2YWXLKQ.js} +11 -11
- package/dist/{emit-criteria-cmd-TPUL7M2R.js → emit-criteria-cmd-HYKOTFXG.js} +8 -8
- package/dist/{emit-demo-cmd-5CUT7W3R.js → emit-demo-cmd-DTARV6RI.js} +12 -12
- package/dist/{emit-finding-cmd-IKHGMACP.js → emit-finding-cmd-GSLYQC43.js} +8 -8
- package/dist/{emit-result-cmd-F7CI6SNZ.js → emit-result-cmd-PKJH76NG.js} +10 -10
- package/dist/{emit-step-cmd-DVEKGHK7.js → emit-step-cmd-IW2Y4N67.js} +8 -8
- package/dist/{exec-client-H2JG36OS.js → exec-client-BQIZRROT.js} +3 -3
- package/dist/find-unit-2C6EK5YY.js +19 -0
- package/dist/{findings-cmd-ODKZ462L.js → findings-cmd-CFF2I3TU.js} +8 -8
- package/dist/{fleet-readiness-UHCBNW6A.js → fleet-readiness-ZSG4UDYR.js} +5 -5
- package/dist/{governing-source-SRECHKPR.js → governing-source-TUGE7QJY.js} +10 -10
- package/dist/{guest-init-6FUC4XZX.js → guest-init-DXXSPKHY.js} +4 -4
- package/dist/{hook-fast-WM6YZVBJ.js → hook-fast-5C4MQ5ZS.js} +1 -1
- package/dist/{host-checks-FLIHLR35.js → host-checks-L4GX6F3H.js} +30 -30
- package/dist/{host-key-OSWPVMIA.js → host-key-5P3ZL5XW.js} +3 -3
- package/dist/{image-tag-LF3NEGSL.js → image-tag-3KPTSRB4.js} +3 -3
- package/dist/index.js +4 -4
- package/dist/{init-LPD75DCX.js → init-NSTWRPRM.js} +22 -22
- package/dist/{init-OX677NNB.js → init-WU2S3WRO.js} +22 -22
- package/dist/{init-cmd-ZCLVC5RR.js → init-cmd-H4HYM5V3.js} +11 -11
- package/dist/{init-update-POKSLQDQ.js → init-update-WOYX2AIO.js} +9 -9
- package/dist/{install-cmd-6SQVZEXL.js → install-cmd-6HGNO2HF.js} +5 -5
- package/dist/{logs-QHXZTSKZ.js → logs-E2O53NUI.js} +2 -2
- package/dist/{loop-ELTO36MN.js → loop-GQLSSBQB.js} +37 -37
- package/dist/{machine-7VPFAC6L.js → machine-IRBCGRUO.js} +22 -22
- package/dist/{mcp-serve-cmd-J32K42HM.js → mcp-serve-cmd-OFK3CS2T.js} +4 -4
- package/dist/{paths-4ZGWWNTG.js → paths-VQ3ALYZ3.js} +2 -2
- package/dist/{pending-CRXJKKKI.js → pending-V5FBWIJ4.js} +3 -3
- package/dist/{pidfile-VLZPRIBZ.js → pidfile-AVJFRZZT.js} +3 -3
- package/dist/{record-4ZJPJTWO.js → record-XE7Z3QGF.js} +3 -3
- package/dist/{runner-env-W53VDVOK.js → runner-env-TYGE6BFU.js} +9 -9
- package/dist/{runner-identity-BH42S2MU.js → runner-identity-B2MZQFYN.js} +5 -5
- package/dist/{runner-key-ESAZRV3A.js → runner-key-NPPEGU6H.js} +22 -22
- package/dist/{session-sender-UB45MUKV.js → session-sender-ZS4OIE3M.js} +11 -11
- package/dist/{spec-cmd-H5B55O5L.js → spec-cmd-N45YF6UL.js} +9 -9
- package/dist/{status-L2OYAZHY.js → status-EP6QSFRY.js} +30 -30
- package/dist/{sync-cmd-IWA5ZTI2.js → sync-cmd-VCB4YDCB.js} +10 -10
- package/dist/{update-steps-FWQ5ASZ6.js → update-steps-BJB7NL6L.js} +31 -31
- package/dist/{watch-NOEBVS6U.js → watch-XU2AUR6Z.js} +10 -10
- package/dist/{work-claim-cmd-7P7U3OQ6.js → work-claim-cmd-WEP3OWAU.js} +13 -13
- package/dist/{work-cmd-77GUT7LY.js → work-cmd-DWR27TKQ.js} +8 -8
- package/dist/{work-comment-cmd-VS3BSPGM.js → work-comment-cmd-HSDVPYWM.js} +9 -9
- package/dist/{work-demo-cmd-S3GXBYIA.js → work-demo-cmd-3EQYHRBP.js} +8 -8
- package/dist/{work-logs-cmd-6BXIINCM.js → work-logs-cmd-3YACDH7Y.js} +8 -8
- package/dist/{work-open-pr-cmd-EPOFWJDC.js → work-open-pr-cmd-MHVTTTLD.js} +9 -9
- package/dist/{work-pr-cmd-DYSYOP74.js → work-pr-cmd-XETSFFM2.js} +8 -8
- package/dist/{work-proofs-cmd-DS2VX4E4.js → work-proofs-cmd-RYQ7Y6KO.js} +10 -10
- package/dist/work-proofs-record-IC3RWDDQ.js +509 -0
- package/dist/{work-stop-cmd-HYQTDNUY.js → work-stop-cmd-4BE2B7TY.js} +8 -8
- package/package.json +1 -1
- package/skill-pack/maintained/outerlayer-build/scripts/criterion-citations.mjs +44 -4
- package/dist/chunk-6CK2OC4Q.js +0 -152
- package/dist/find-unit-ACTOZVVS.js +0 -19
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
// criterion's id appears as a whole token in a test's title or in a comment
|
|
12
12
|
// above it. `WC-01 counts`, `WC-01: counts` and `WC-01 - counts` all cite
|
|
13
13
|
// WC-01. Only git-tracked test files are scanned, so every link names code
|
|
14
|
-
// that a commit contains.
|
|
14
|
+
// that a commit contains. A file that only a runner glob in
|
|
15
|
+
// `.outerlayer-proofs.yaml` names is not scanned here. The link names the HEAD commit and is written only
|
|
15
16
|
// when the origin remote is on GitHub; otherwise the test is listed unlinked.
|
|
16
17
|
// A criterion no test cites gets an empty list. An existing block in the
|
|
17
18
|
// report is replaced.
|
|
@@ -20,8 +21,47 @@ import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
|
20
21
|
import { join } from "node:path";
|
|
21
22
|
import { pathToFileURL } from "node:url";
|
|
22
23
|
|
|
23
|
-
/**
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* A tracked file whose name marks it as a test. Class-name conventions
|
|
26
|
+
* (`WalletTest.java`) match the capital letter, so `Contest.java` is not a test.
|
|
27
|
+
*
|
|
28
|
+
* - JS and TS: `.test`/`.spec` files, any file under `__tests__/`, Deno `*_test.ts`, Cypress `*.cy.ts`
|
|
29
|
+
* - Python `test_*.py` and `*_test.py`, Go `*_test.go`
|
|
30
|
+
* - Ruby `*_spec.rb`, `*_test.rb` and `test_*.rb`
|
|
31
|
+
* - Java, Kotlin: `*Test`, `*Tests`, `*IT`; Groovy `*Spec`; Scala `*Spec` and `*Test`
|
|
32
|
+
* - C# `*Test.cs` and `*Tests.cs`, PHP `*Test.php`, Swift `*Tests.swift`
|
|
33
|
+
* - Elixir `*_test.exs`, Dart `*_test.dart`, Rust files under `tests/`, `.bats` files
|
|
34
|
+
*/
|
|
35
|
+
export const TEST_FILE = new RegExp(
|
|
36
|
+
`(?:${[
|
|
37
|
+
String.raw`\.(?:test|spec|cy)\.[cm]?[jt]sx?`,
|
|
38
|
+
String.raw`(?:^|/)__tests__/.+\.[cm]?[jt]sx?`,
|
|
39
|
+
String.raw`_test\.[cm]?[jt]s`,
|
|
40
|
+
String.raw`(?:^|/)test_[^/]*\.(?:py|rb)`,
|
|
41
|
+
String.raw`_test\.(?:py|go|rb|exs|dart)`,
|
|
42
|
+
String.raw`_spec\.rb`,
|
|
43
|
+
String.raw`(?:Test|Tests|IT)\.(?:java|kt)`,
|
|
44
|
+
String.raw`Spec\.groovy`,
|
|
45
|
+
String.raw`(?:Spec|Test)\.scala`,
|
|
46
|
+
String.raw`Tests?\.(?:cs|php)`,
|
|
47
|
+
String.raw`Tests\.swift`,
|
|
48
|
+
String.raw`(?:^|/)tests/.+\.rs`,
|
|
49
|
+
String.raw`\.bats`,
|
|
50
|
+
]
|
|
51
|
+
.map((alternative) => `(?:${alternative})`)
|
|
52
|
+
.join("|")})$`,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Whether the repository-relative `path` holds tests. `inRunnerGlob` is the
|
|
57
|
+
* caller's test for the files that a runner glob in `.outerlayer-proofs.yaml`
|
|
58
|
+
* matches. It only adds files: a file the built-in names read stays read. The
|
|
59
|
+
* criteria judge and `outerlayer work proofs` pass it. This script reads the
|
|
60
|
+
* built-in names alone, and the CLI's two readers add the runner globs.
|
|
61
|
+
*/
|
|
62
|
+
export function isTestFile(path, inRunnerGlob) {
|
|
63
|
+
return TEST_FILE.test(path) || (inRunnerGlob?.(path) ?? false);
|
|
64
|
+
}
|
|
25
65
|
/** A line that is only a comment: `//`, `#`, `*`, `/*`, `--` or `<!--` first. */
|
|
26
66
|
const COMMENT_LINE = /^\s*(?:\/\/|#|\*|\/\*|--|<!--)/;
|
|
27
67
|
const BLOCK_ID = /<script type="application\/json" id="criterion-citations">[\s\S]*?<\/script>/;
|
|
@@ -136,7 +176,7 @@ function readRepository(cwd) {
|
|
|
136
176
|
const tracked = top ? git(top, ["ls-files", "-z"]) : null;
|
|
137
177
|
if (!top || tracked === null) return null;
|
|
138
178
|
const files = [];
|
|
139
|
-
for (const path of tracked.split("\0").filter((p) => p !== "" &&
|
|
179
|
+
for (const path of tracked.split("\0").filter((p) => p !== "" && isTestFile(p))) {
|
|
140
180
|
try {
|
|
141
181
|
files.push({ path, contents: readFileSync(join(top, path), "utf8") });
|
|
142
182
|
} catch {
|
package/dist/chunk-6CK2OC4Q.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
import { resolvePackRoot } from './chunk-OVNF4LLC.js';
|
|
4
|
-
import { CHECK_ITEM_REASON_MAX_LENGTH, CheckItemsSchema } from './chunk-DINRXUQA.js';
|
|
5
|
-
import { createHash } from 'crypto';
|
|
6
|
-
import { join } from 'path';
|
|
7
|
-
import { pathToFileURL } from 'url';
|
|
8
|
-
|
|
9
|
-
createRequire(import.meta.url);
|
|
10
|
-
var ARTIFACT_PROOF_REASON = "Its declared artifact proves it; the judge does not judge artifacts.";
|
|
11
|
-
var NO_CITING_TEST_REASON = "No test cites this criterion, and it declares no artifact proof.";
|
|
12
|
-
var NO_VERDICT_REASON = "The judge gave no result for this criterion.";
|
|
13
|
-
function criterionInputs(input) {
|
|
14
|
-
const paths = [...new Set((input.citations[input.criterion.id] ?? []).map((citation) => citation.path))].sort();
|
|
15
|
-
const hash = createHash("sha256");
|
|
16
|
-
const part = (text) => {
|
|
17
|
-
hash.update(`${Buffer.byteLength(text)}:`);
|
|
18
|
-
hash.update(text);
|
|
19
|
-
};
|
|
20
|
-
part("judge-criterion-v1");
|
|
21
|
-
part(input.brief);
|
|
22
|
-
part(input.criterion.id);
|
|
23
|
-
part(input.criterion.text);
|
|
24
|
-
part(input.criterion.proof ?? "");
|
|
25
|
-
for (const path of paths) {
|
|
26
|
-
part(path);
|
|
27
|
-
part(input.testFiles.get(path) ?? "");
|
|
28
|
-
}
|
|
29
|
-
return hash.digest("hex");
|
|
30
|
-
}
|
|
31
|
-
var HTTPS_LINK = /^https:\/\/\S+$/;
|
|
32
|
-
function refsFor(id, citations) {
|
|
33
|
-
const refs = (citations[id] ?? []).slice(0, 20).map((citation) => ({
|
|
34
|
-
path: citation.path,
|
|
35
|
-
line: citation.line,
|
|
36
|
-
// Only an https link becomes an href on a page; any other is left off rather than refusing the check.
|
|
37
|
-
...HTTPS_LINK.test(citation.href ?? "") ? { href: citation.href } : {}
|
|
38
|
-
}));
|
|
39
|
-
return refs.length === 0 ? void 0 : refs;
|
|
40
|
-
}
|
|
41
|
-
function planCriteria(input) {
|
|
42
|
-
const previousById = new Map(input.previous.map((item) => [item.id, item]));
|
|
43
|
-
const settled = [];
|
|
44
|
-
const toJudge = [];
|
|
45
|
-
for (const criterion of input.criteria) {
|
|
46
|
-
const inputs = input.inputs.get(criterion.id);
|
|
47
|
-
const base = { id: criterion.id, criterion: criterion.id, ...inputs === void 0 ? {} : { inputs } };
|
|
48
|
-
const refs = refsFor(criterion.id, input.citations);
|
|
49
|
-
if (criterion.proof !== null) {
|
|
50
|
-
settled.push({ ...base, result: "skipped", reason: ARTIFACT_PROOF_REASON });
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (refs === void 0) {
|
|
54
|
-
settled.push({ ...base, result: "fail", reason: NO_CITING_TEST_REASON });
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
const kept = previousById.get(criterion.id);
|
|
58
|
-
if (kept !== void 0 && inputs !== void 0 && kept.inputs === inputs && (kept.result === "pass" || kept.result === "fail")) {
|
|
59
|
-
settled.push({ ...base, result: kept.result, ...kept.reason === void 0 ? {} : { reason: kept.reason }, refs });
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
toJudge.push(criterion);
|
|
63
|
-
}
|
|
64
|
-
return { settled, toJudge };
|
|
65
|
-
}
|
|
66
|
-
var MAX_ANSWER_ENTRIES = 500;
|
|
67
|
-
function readAnswer(raw) {
|
|
68
|
-
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return { ok: false, problem: "expected an object" };
|
|
69
|
-
const { result, items } = raw;
|
|
70
|
-
if (result !== void 0 && result !== "pass" && result !== "fail") return { ok: false, problem: 'result: must be "pass" or "fail"' };
|
|
71
|
-
if (items !== void 0 && !Array.isArray(items)) return { ok: false, problem: "items: must be an array" };
|
|
72
|
-
const entries = items ?? [];
|
|
73
|
-
if (entries.length > MAX_ANSWER_ENTRIES) return { ok: false, problem: `items: at most ${MAX_ANSWER_ENTRIES} entries` };
|
|
74
|
-
const read = [];
|
|
75
|
-
for (const [index, entry] of entries.entries()) {
|
|
76
|
-
const { id, result: itemResult, reason } = typeof entry === "object" && entry !== null ? entry : {};
|
|
77
|
-
if (typeof id !== "string" || id === "" || id.length > 200) return { ok: false, problem: `items.${index}.id: must be text of 1 to 200 characters` };
|
|
78
|
-
if (itemResult !== "pass" && itemResult !== "fail") return { ok: false, problem: `items.${index}.result: must be "pass" or "fail"` };
|
|
79
|
-
if (reason !== void 0 && typeof reason !== "string") return { ok: false, problem: `items.${index}.reason: must be text` };
|
|
80
|
-
read.push({ id, result: itemResult, ...reason === void 0 ? {} : { reason } });
|
|
81
|
-
}
|
|
82
|
-
return { ok: true, answer: { ...result === void 0 ? {} : { result }, items: read } };
|
|
83
|
-
}
|
|
84
|
-
function parseJudgeAnswer(text) {
|
|
85
|
-
if (text === void 0 || text.trim() === "") return void 0;
|
|
86
|
-
let raw;
|
|
87
|
-
try {
|
|
88
|
-
raw = JSON.parse(text);
|
|
89
|
-
} catch {
|
|
90
|
-
return { ok: false, reason: "the judge's items.json is not JSON" };
|
|
91
|
-
}
|
|
92
|
-
const read = readAnswer(raw);
|
|
93
|
-
return read.ok ? read : { ok: false, reason: `the judge's items.json does not match its shape: ${read.problem}` };
|
|
94
|
-
}
|
|
95
|
-
function oneLineReason(text) {
|
|
96
|
-
if (text === void 0) return void 0;
|
|
97
|
-
const line = text.replace(/\s+/g, " ").trim();
|
|
98
|
-
if (line === "") return void 0;
|
|
99
|
-
return line.length <= CHECK_ITEM_REASON_MAX_LENGTH ? line : `${line.slice(0, CHECK_ITEM_REASON_MAX_LENGTH - 1)}\u2026`;
|
|
100
|
-
}
|
|
101
|
-
function judgedItems(input) {
|
|
102
|
-
return input.toJudge.map((criterion) => {
|
|
103
|
-
const said = input.results.get(criterion.id);
|
|
104
|
-
const inputs = input.inputs.get(criterion.id);
|
|
105
|
-
const refs = refsFor(criterion.id, input.citations);
|
|
106
|
-
const reason = said === void 0 ? NO_VERDICT_REASON : oneLineReason(said.reason);
|
|
107
|
-
return {
|
|
108
|
-
id: criterion.id,
|
|
109
|
-
criterion: criterion.id,
|
|
110
|
-
result: said?.result ?? "fail",
|
|
111
|
-
...reason === void 0 ? {} : { reason },
|
|
112
|
-
...refs === void 0 ? {} : { refs },
|
|
113
|
-
...inputs === void 0 || said === void 0 ? {} : { inputs }
|
|
114
|
-
};
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
function inCriteriaOrder(items, criteria) {
|
|
118
|
-
const order = new Map(criteria.map((criterion, index) => [criterion.id, index]));
|
|
119
|
-
return [...items].sort((a, b) => (order.get(a.id) ?? Number.MAX_SAFE_INTEGER) - (order.get(b.id) ?? Number.MAX_SAFE_INTEGER));
|
|
120
|
-
}
|
|
121
|
-
function itemsSentence(items, noun) {
|
|
122
|
-
const failing = items.filter((item) => item.result === "fail").map((item) => item.id);
|
|
123
|
-
if (failing.length === 0) return void 0;
|
|
124
|
-
return `${failing.length} of ${items.length} ${items.length === 1 ? noun.one : noun.many} not satisfied: ${failing.join(", ")}`;
|
|
125
|
-
}
|
|
126
|
-
var MAX_TEST_FILES = 2e4;
|
|
127
|
-
var MAX_TEST_FILE_BYTES = 1024 * 1024;
|
|
128
|
-
async function loadCitationFinder() {
|
|
129
|
-
return await import(pathToFileURL(join(resolvePackRoot(), "maintained", "outerlayer-build", "scripts", "criterion-citations.mjs")).href);
|
|
130
|
-
}
|
|
131
|
-
function criteriaOf(workItem) {
|
|
132
|
-
const criteria = Object(Object(workItem).criteria);
|
|
133
|
-
if (!Array.isArray(criteria.items)) return void 0;
|
|
134
|
-
const drafted = criteria.drafted === true;
|
|
135
|
-
const items = [];
|
|
136
|
-
for (const entry of criteria.items) {
|
|
137
|
-
const { id, text, proof } = Object(entry);
|
|
138
|
-
if (typeof id !== "string" || typeof text !== "string") continue;
|
|
139
|
-
items.push({ id, text, proof: typeof proof === "string" ? proof : null, drafted });
|
|
140
|
-
}
|
|
141
|
-
return items.length === 0 ? void 0 : items;
|
|
142
|
-
}
|
|
143
|
-
function hostItemsOf(workItem, name) {
|
|
144
|
-
const checks = Object(workItem).checks;
|
|
145
|
-
if (!Array.isArray(checks)) return [];
|
|
146
|
-
const check = checks.find((entry) => Object(entry).name === name);
|
|
147
|
-
if (check?.source !== "host") return [];
|
|
148
|
-
const parsed = CheckItemsSchema.safeParse(check.items);
|
|
149
|
-
return parsed.success ? parsed.data : [];
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export { MAX_TEST_FILES, MAX_TEST_FILE_BYTES, NO_CITING_TEST_REASON, NO_VERDICT_REASON, criteriaOf, criterionInputs, hostItemsOf, inCriteriaOrder, itemsSentence, judgedItems, loadCitationFinder, oneLineReason, parseJudgeAnswer, planCriteria };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
export { findServiceUnit, inspectRunnerService } from './chunk-5LUN7TTR.js';
|
|
4
|
-
import './chunk-NBETYM32.js';
|
|
5
|
-
import './chunk-GXMMILQ4.js';
|
|
6
|
-
import './chunk-EGJY6MBC.js';
|
|
7
|
-
import './chunk-AHWMY3MS.js';
|
|
8
|
-
import './chunk-CM4J53WZ.js';
|
|
9
|
-
import './chunk-D3CT6XQ4.js';
|
|
10
|
-
import './chunk-VKYU4HHW.js';
|
|
11
|
-
import './chunk-A6PJSNP6.js';
|
|
12
|
-
import './chunk-DINRXUQA.js';
|
|
13
|
-
import './chunk-VNVZDWO3.js';
|
|
14
|
-
import './chunk-AJTGTSNA.js';
|
|
15
|
-
import './chunk-L2OARQKP.js';
|
|
16
|
-
import './chunk-MESOOLF4.js';
|
|
17
|
-
import './chunk-Z5GEFMRW.js';
|
|
18
|
-
|
|
19
|
-
createRequire(import.meta.url);
|