@attalabs/vinaya 0.44.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/checks/bin/check-body-bare-digits.js +262 -201
- package/dist/checks/bin/check-branch-topology.js +70 -23
- package/dist/checks/bin/check-brief-shape.js +262 -201
- package/dist/checks/bin/check-changeset-coverage.js +94 -16
- package/dist/checks/bin/check-ci-shard-coverage.js +3 -0
- package/dist/checks/bin/check-closes-n.js +157 -40
- package/dist/checks/bin/check-coherence.js +365 -251
- package/dist/checks/bin/check-dispatch-readiness.js +3654 -469
- package/dist/checks/bin/check-doc-claims.js +262 -201
- package/dist/checks/bin/check-doc-coverage-push.js +272 -202
- package/dist/checks/bin/check-doc-coverage.js +272 -202
- package/dist/checks/bin/check-doctrine-no-procedures.js +262 -201
- package/dist/checks/bin/check-doctrine-portability.js +262 -201
- package/dist/checks/bin/check-evidence-fresh.js +10138 -2126
- package/dist/checks/bin/check-exec-bits.js +3 -0
- package/dist/checks/bin/check-first-push-dispatch.js +330 -230
- package/dist/checks/bin/check-issue-milestone-attach.js +94 -16
- package/dist/checks/bin/check-issue-objectives-numbering.js +262 -201
- package/dist/checks/bin/check-issue-parts-coverage.js +94 -16
- package/dist/checks/bin/check-issue-surface-globs.js +1062 -242
- package/dist/checks/bin/check-issue-title-grammar.js +21 -5
- package/dist/checks/bin/check-no-disk-state.js +5 -1
- package/dist/checks/bin/check-pr-premise-reassert.js +22 -2
- package/dist/checks/bin/check-pr-report-density.js +5 -1
- package/dist/checks/bin/check-principal-test-plan-wait.js +282 -207
- package/dist/checks/bin/check-quoted-command.js +262 -201
- package/dist/checks/bin/check-reader-resolvable-prose.js +262 -201
- package/dist/checks/bin/check-registry-gates.js +131 -34
- package/dist/checks/bin/check-retired-vocabulary.js +262 -201
- package/dist/checks/bin/check-review-gate.js +262 -201
- package/dist/checks/bin/check-single-plan-pr.js +5 -1
- package/dist/checks/bin/check-surface-scope.js +136 -38
- package/dist/checks/bin/check-test-plan.js +282 -207
- package/dist/checks/bin/check-token-collection-wired.js +3 -0
- package/dist/checks/bin/check-workspace-escape.js +3 -0
- package/dist/checks/bin/verify-coherence.js +237 -148
- package/dist/checks/bin/verify-dispatch.js +870 -66
- package/dist/checks/bin/verify-docs.js +13 -6
- package/dist/harness.js +57 -10
- package/dist/index.js +16670 -7196
- package/dist/lib/pre-push-cache-test-run.js +4488 -2170
- package/dist/lib/pre-push-changed-files.js +251 -12
- package/dist/lib/pre-push-mode.js +69 -19
- package/dist/lib/pre-push-progress-dir.js +10265 -2853
- package/dist/lib/pre-push-record-tests.js +67 -19
- package/dist/lib/pre-push-select-tests.js +520 -222
- package/dist/lib/push-progress-observer.js +9176 -1757
- package/dist/process.js +2 -0
- package/dist/programs/archive.js +8948 -1547
- package/dist/programs/audit.js +9176 -1772
- package/dist/programs/check.js +9248 -1845
- package/dist/programs/commit-msg.js +8984 -1583
- package/dist/programs/dev-review-loop.js +15621 -7626
- package/dist/programs/dispatch.js +9977 -2726
- package/dist/programs/log-emit.js +9011 -1660
- package/dist/programs/log-selftest.js +8908 -1507
- package/dist/programs/log-send.js +9081 -1594
- package/dist/programs/pr-report.js +9477 -1820
- package/dist/programs/pr-snapshot.js +8916 -1515
- package/dist/programs/pr-verify-evidence.js +9482 -1825
- package/dist/programs/pr.js +11773 -4082
- package/dist/programs/review-post.js +11141 -3496
- package/dist/programs/review-status.js +8997 -1533
- package/dist/programs/run-engine.js +22149 -18798
- package/dist/programs/sync.js +9030 -1629
- package/dist/programs/task-brief.js +10234 -1827
- package/dist/programs/task-sweep.js +9267 -1621
- package/dist/programs/task-tools-serve.js +77141 -16659
- package/dist/programs/tokens.js +8966 -1565
- package/dist/programs/waiver.js +8983 -1582
- package/dist/types/harness/kernel/dev-process-socket/loader/load-process.d.ts +1 -1
- package/dist/types/harness/processes/vinaya-strict/tools/legacy-markers.d.ts +8 -0
- package/dist/types/harness/processes/vinaya-strict/tools/task-contract/brief-validation.d.ts +17 -10
- package/dist/types/harness/processes/vinaya-strict/tools/task-contract/objectives.d.ts +5 -6
- package/dist/types/harness/processes/vinaya-strict/tools/task-contract/premise-check.d.ts +14 -0
- package/dist/vinaya-strict/checks/registry.ts +2 -2
- package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +8 -0
- package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +1 -1
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +2 -2
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +30 -20
- package/dist/vinaya-strict/executing/developer/reference.md +5 -3
- package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +29 -7
- package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +4 -4
- package/dist/vinaya-strict/integration/process/process-integration.ts +5 -1
- package/dist/vinaya-strict/process.yaml +6 -1
- package/dist/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
- package/dist/vinaya-strict/thinking/plan-reviewer/grants.yaml +19 -0
- package/dist/vinaya-strict/thinking/plan-reviewer/output.schema.json +388 -0
- package/dist/vinaya-strict/thinking/planner/doctrine.md +4 -1
- package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +10 -2
- package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +5 -1
- package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +198 -34
- package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +120 -193
- package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +629 -15
- package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +726 -62
- package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +505 -5
- package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +636 -21
- package/package.json +3 -2
- package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/milestones/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/chunks/209.js +2 -2
- package/studio-standalone/apps/vinaya-studio/.next/server/chunks/951.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/preview-props.json +3 -3
- package/studio-standalone/apps/vinaya-studio/.next/server/server-reference-manifest.json +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-c365f0ef8268ad13.js +1 -0
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/19-aa314f13784dcc58.js +4 -0
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{layout-dfa2186095e797bd.js → layout-f038e8deecb2bf5f.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{page-6ae258f663623b2a.js → page-7a06aa3cdd046fa8.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/css/8eb5ed5b65b9692e.css +1 -0
- package/studio-standalone/apps/vinaya-studio/log-follow.mjs +708 -93
- package/studio-standalone/apps/vinaya-studio/log-sync-folder-source.mjs +699 -84
- package/studio-standalone/apps/vinaya-studio/studio-server.mjs +4692 -3116
- package/vinaya-strict/artifacts/templates/brief-template.md +6 -0
- package/vinaya-strict/artifacts/templates/issue-rationale-template.md +7 -3
- package/vinaya-strict/artifacts/templates/pr-report-template.md +1 -1
- package/vinaya-strict/doctrine/contracts/planner-developer.md +4 -3
- package/vinaya-strict/doctrine/enforcement.md +4 -4
- package/vinaya-strict/doctrine/roles/principal.md +1 -1
- package/vinaya-strict/doctrine/state-machine.md +7 -2
- package/vinaya-strict/executing/developer/reference.md +5 -3
- package/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
- package/vinaya-strict/thinking/planner/doctrine.md +4 -1
- package/vinaya-strict/thinking/planner/reference.md +30 -9
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-23bea4cac9687151.js +0 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/853-1d5548ff3a55a75f.js +0 -4
- package/studio-standalone/apps/vinaya-studio/.next/static/css/fb16828fc3128d4c.css +0 -1
- /package/studio-standalone/apps/vinaya-studio/.next/static/{_r9iZDxlkoek85d_3oaxL → bJrgAp9Kl4JsCUYkeAYez}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/.next/static/{_r9iZDxlkoek85d_3oaxL → bJrgAp9Kl4JsCUYkeAYez}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -23,6 +24,7 @@ var __toCommonJS = (from) => {
|
|
|
23
24
|
return entry;
|
|
24
25
|
};
|
|
25
26
|
var __moduleCache;
|
|
27
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
26
28
|
var __returnValue = (v) => v;
|
|
27
29
|
function __exportSetter(name, newValue) {
|
|
28
30
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -47,6 +49,7 @@ var __esm = (fn, res, err) => () => {
|
|
|
47
49
|
throw err[0];
|
|
48
50
|
return res;
|
|
49
51
|
};
|
|
52
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
50
53
|
|
|
51
54
|
// ../../harness/processes/vinaya-strict/tools/task-contract/forge/labels.ts
|
|
52
55
|
function entry(key) {
|
|
@@ -489,6 +492,7 @@ var init_doctrine_map = __esm(() => {
|
|
|
489
492
|
{ key: "roles/developer.md", source: "executing/developer/doctrine.md", role: "developer", ships: true },
|
|
490
493
|
{ key: "roles/developer/reference.md", source: "executing/developer/reference.md", ships: true },
|
|
491
494
|
{ key: "roles/operator.md", source: "executing/operator/doctrine.md", role: "operator", ships: true },
|
|
495
|
+
{ key: "roles/plan-reviewer.md", source: "thinking/plan-reviewer/doctrine.md", role: "plan-reviewer", ships: true },
|
|
492
496
|
{ key: "roles/planner.md", source: "thinking/planner/doctrine.md", role: "planner", ships: true },
|
|
493
497
|
{ key: "roles/planner/reference.md", source: "thinking/planner/reference.md", ships: true },
|
|
494
498
|
{ key: "roles/principal.md", source: "doctrine/roles/principal.md", role: "principal", ships: true },
|
|
@@ -644,7 +648,7 @@ function commentMarkerFamily(name) {
|
|
|
644
648
|
function anchorAlternation(spellings) {
|
|
645
649
|
return `(?:${spellings.map((spelling) => spelling.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`;
|
|
646
650
|
}
|
|
647
|
-
var REGION_PREFIX, PROVENANCE_HEADING, CLAIM_ANCHOR, QUOTES_FILE_ANCHOR, VENDOR_EXAMPLE_ANCHOR, COMMENT_MARKER_PREFIX, FROZEN_BRIEF_MARKER, DEVELOPER_ROUND_MARKER, DEVELOPER_STOP_MARKER, LOOP_PUBLISHED_MARKER, LOOP_PAUSED_MARKER, LOOP_UNPUSHED_WORK_RESUME_MARKER, PRINCIPAL_RULING_MARKER, OBJECTIVES_VERSION_MARKER, DEFERRED_FINDINGS_MARKER, COMMENT_MARKER_PREFIX_CURRENT, COMMENT_MARKER_PREFIXES, COMMENT_MARKER_PREFIX_PATTERN, REGION_PREFIX_CURRENT, REGION_PREFIXES, PROVENANCE_HEADINGS, CLAIM_ANCHORS, QUOTES_FILE_ANCHORS, VENDOR_EXAMPLE_ANCHORS;
|
|
651
|
+
var REGION_PREFIX, PROVENANCE_HEADING, CLAIM_ANCHOR, QUOTES_FILE_ANCHOR, VENDOR_EXAMPLE_ANCHOR, COMMENT_MARKER_PREFIX, FROZEN_BRIEF_MARKER, DEVELOPER_ROUND_MARKER, DEVELOPER_STOP_MARKER, LOOP_PUBLISHED_MARKER, LOOP_PAUSED_MARKER, LOOP_UNPUSHED_WORK_RESUME_MARKER, PRINCIPAL_RULING_MARKER, OBJECTIVES_VERSION_MARKER, DOCUMENTATION_EDIT_MARKER, DEFERRED_FINDINGS_MARKER, COMMENT_MARKER_PREFIX_CURRENT, COMMENT_MARKER_PREFIXES, COMMENT_MARKER_PREFIX_PATTERN, REGION_PREFIX_CURRENT, REGION_PREFIXES, PROVENANCE_HEADINGS, CLAIM_ANCHORS, QUOTES_FILE_ANCHORS, VENDOR_EXAMPLE_ANCHORS;
|
|
648
652
|
var init_legacy_markers = __esm(() => {
|
|
649
653
|
REGION_PREFIX = { old: "AEG", current: "VINAYA" };
|
|
650
654
|
PROVENANCE_HEADING = {
|
|
@@ -666,6 +670,7 @@ var init_legacy_markers = __esm(() => {
|
|
|
666
670
|
LOOP_UNPUSHED_WORK_RESUME_MARKER = commentMarkerFamily("loop:unpushed-work-resume");
|
|
667
671
|
PRINCIPAL_RULING_MARKER = commentMarkerFamily("principal:ruling");
|
|
668
672
|
OBJECTIVES_VERSION_MARKER = commentMarkerFamily("objectives");
|
|
673
|
+
DOCUMENTATION_EDIT_MARKER = commentMarkerFamily("documentation");
|
|
669
674
|
DEFERRED_FINDINGS_MARKER = commentMarkerFamily("deferred-findings");
|
|
670
675
|
COMMENT_MARKER_PREFIX_CURRENT = COMMENT_MARKER_PREFIX.current;
|
|
671
676
|
COMMENT_MARKER_PREFIXES = [COMMENT_MARKER_PREFIX.current, COMMENT_MARKER_PREFIX.old];
|
|
@@ -1163,7 +1168,7 @@ init_review_gate();
|
|
|
1163
1168
|
init_diff_evidence();
|
|
1164
1169
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
1165
1170
|
import { readdirSync, readFileSync } from "node:fs";
|
|
1166
|
-
import { join as join2
|
|
1171
|
+
import { join as join2 } from "node:path";
|
|
1167
1172
|
|
|
1168
1173
|
// ../../harness/processes/vinaya-strict/checks/changeset-coverage-logic.ts
|
|
1169
1174
|
function stripTrailingSlash(entry) {
|
|
@@ -1218,7 +1223,7 @@ function isShippedPath(member, repoRelativePath) {
|
|
|
1218
1223
|
return isShippedRelPath(member.files, repoRelativePath.slice(prefix.length));
|
|
1219
1224
|
}
|
|
1220
1225
|
function isChangesetFile(repoRelativePath) {
|
|
1221
|
-
return /^\.changeset\/(?!README\.md$).+\.md
|
|
1226
|
+
return /^\.changeset\/(?!README\.md$).+\.md$/s.test(repoRelativePath);
|
|
1222
1227
|
}
|
|
1223
1228
|
function evaluateChangesetCoverage(fixedGroup, changedFiles, isReleaseBranch) {
|
|
1224
1229
|
if (isReleaseBranch)
|
|
@@ -1230,6 +1235,42 @@ function evaluateChangesetCoverage(fixedGroup, changedFiles, isReleaseBranch) {
|
|
|
1230
1235
|
return { status: "pass" };
|
|
1231
1236
|
return { status: "finding", shippedPathsHit };
|
|
1232
1237
|
}
|
|
1238
|
+
function changesetPackageNames(text) {
|
|
1239
|
+
const lines = text.split(/\r?\n/);
|
|
1240
|
+
const start = lines.findIndex((line) => line.trimEnd() === "---");
|
|
1241
|
+
if (start < 0)
|
|
1242
|
+
return [];
|
|
1243
|
+
const end = lines.findIndex((line, index) => index > start && line.trimEnd() === "---");
|
|
1244
|
+
if (end < 0)
|
|
1245
|
+
return [];
|
|
1246
|
+
const names = new Set;
|
|
1247
|
+
for (const line of lines.slice(start + 1, end)) {
|
|
1248
|
+
const key = /^\s*(?:'((?:[^']|'')+)'|"((?:[^"\\]|\\.)+)"|([^\s:'"#]+))\s*:\s*\S/.exec(line);
|
|
1249
|
+
const name = key?.[1]?.replaceAll("''", "'") ?? decodeDoubleQuotedKey(key?.[2]) ?? key?.[3];
|
|
1250
|
+
if (name)
|
|
1251
|
+
names.add(name);
|
|
1252
|
+
}
|
|
1253
|
+
return [...names];
|
|
1254
|
+
}
|
|
1255
|
+
function decodeDoubleQuotedKey(key) {
|
|
1256
|
+
return key?.replace(/\\(?:x([a-fA-F\d]{2})|u([a-fA-F\d]{4})|U([a-fA-F\d]{8})|(\/)|.)/g, (sequence, short, medium, long, slash) => {
|
|
1257
|
+
if (slash)
|
|
1258
|
+
return slash;
|
|
1259
|
+
const code = Number.parseInt(short ?? medium ?? long ?? "", 16);
|
|
1260
|
+
return code <= 1114111 ? String.fromCodePoint(code) : sequence;
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
function evaluateIgnoredChangesets(ignore, changedChangesets, isReleaseBranch) {
|
|
1264
|
+
if (isReleaseBranch)
|
|
1265
|
+
return [];
|
|
1266
|
+
const patterns = ignore.filter((entry) => !entry.startsWith("!") && !/[?{}]/.test(entry)).map(filesGlobToRegex);
|
|
1267
|
+
if (patterns.length === 0)
|
|
1268
|
+
return [];
|
|
1269
|
+
return changedChangesets.flatMap(({ path, text }) => {
|
|
1270
|
+
const packages = changesetPackageNames(text).filter((name) => patterns.some((pattern) => pattern.test(name)));
|
|
1271
|
+
return packages.length > 0 ? [{ path, packages }] : [];
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1233
1274
|
|
|
1234
1275
|
// ../../harness/processes/vinaya-strict/checks/bin/check-changeset-coverage.ts
|
|
1235
1276
|
var CHECK_NAME = "changeset-coverage";
|
|
@@ -1240,6 +1281,15 @@ function git(args) {
|
|
|
1240
1281
|
return "";
|
|
1241
1282
|
}
|
|
1242
1283
|
}
|
|
1284
|
+
function readSnapshotFile(root, path, staged) {
|
|
1285
|
+
const args = staged ? ["ls-files", "--stage"] : ["ls-tree", "HEAD"];
|
|
1286
|
+
const options = { cwd: root, encoding: "utf8", stdio: "pipe" };
|
|
1287
|
+
const entry = execFileSync2("git", ["--literal-pathspecs", ...args, "-z", "--", path], options);
|
|
1288
|
+
const oid = (staged ? /^100(?:644|755) ([a-f0-9]+) 0\t/.exec(entry) : /^100(?:644|755) blob ([a-f0-9]+)\t/.exec(entry))?.[1];
|
|
1289
|
+
if (!oid)
|
|
1290
|
+
return null;
|
|
1291
|
+
return execFileSync2("git", ["cat-file", "blob", oid], options);
|
|
1292
|
+
}
|
|
1243
1293
|
function currentBranch() {
|
|
1244
1294
|
return git(["symbolic-ref", "--quiet", "--short", "HEAD"]);
|
|
1245
1295
|
}
|
|
@@ -1247,8 +1297,13 @@ function defaultBranch() {
|
|
|
1247
1297
|
const ref = git(["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"]);
|
|
1248
1298
|
return ref.startsWith("origin/") ? ref.slice("origin/".length) : "";
|
|
1249
1299
|
}
|
|
1250
|
-
function
|
|
1251
|
-
|
|
1300
|
+
function changedPaths(staged) {
|
|
1301
|
+
const diff = resolveDiff();
|
|
1302
|
+
if (!diff)
|
|
1303
|
+
return null;
|
|
1304
|
+
const options = { cwd: diff.root, encoding: "utf8", stdio: "pipe" };
|
|
1305
|
+
const args = staged ? ["--cached", "--merge-base", diff.base] : [`${diff.base}...HEAD`];
|
|
1306
|
+
return execFileSync2("git", ["diff", "--name-only", "-z", ...args], options).split("\x00").filter(Boolean);
|
|
1252
1307
|
}
|
|
1253
1308
|
function readPackageJson(path) {
|
|
1254
1309
|
try {
|
|
@@ -1294,9 +1349,7 @@ function resolveWorkspaceMembers(root) {
|
|
|
1294
1349
|
}
|
|
1295
1350
|
return members;
|
|
1296
1351
|
}
|
|
1297
|
-
function fixedGroupNames(
|
|
1298
|
-
const pkg = readPackageJson(join2(root, ".changeset", "config.json"));
|
|
1299
|
-
const fixed = pkg?.fixed;
|
|
1352
|
+
function fixedGroupNames(fixed) {
|
|
1300
1353
|
if (!Array.isArray(fixed))
|
|
1301
1354
|
return [];
|
|
1302
1355
|
return fixed.flat().filter((n) => typeof n === "string");
|
|
@@ -1308,8 +1361,9 @@ function main() {
|
|
|
1308
1361
|
if (current !== "" && current === base) {
|
|
1309
1362
|
process.exit(0);
|
|
1310
1363
|
}
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1364
|
+
const staged = process.env.VINAYA_COMMIT_HOOK === "1" && Boolean(process.env.GIT_INDEX_FILE);
|
|
1365
|
+
const changedFiles = changedPaths(staged);
|
|
1366
|
+
if (changedFiles === null) {
|
|
1313
1367
|
emitCheckError({
|
|
1314
1368
|
schema: CHECK_SCHEMA_VERSION,
|
|
1315
1369
|
check: CHECK_NAME,
|
|
@@ -1319,28 +1373,52 @@ function main() {
|
|
|
1319
1373
|
});
|
|
1320
1374
|
process.exit(0);
|
|
1321
1375
|
}
|
|
1322
|
-
if (
|
|
1376
|
+
if (changedFiles.length === 0) {
|
|
1323
1377
|
process.exit(0);
|
|
1324
1378
|
}
|
|
1325
|
-
const changedFiles = changedAbs.map((p) => toPosix(relative2(root, p)));
|
|
1326
1379
|
const branch = git(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
1327
1380
|
const isReleaseBranch = branch === CHANGESET_RELEASE_BRANCH;
|
|
1381
|
+
const config = readPackageJson(join2(root, ".changeset", "config.json"));
|
|
1382
|
+
const snapshotConfig = isReleaseBranch ? null : readSnapshotFile(root, ".changeset/config.json", staged);
|
|
1383
|
+
let snapshotIgnore;
|
|
1384
|
+
if (snapshotConfig !== null) {
|
|
1385
|
+
try {
|
|
1386
|
+
snapshotIgnore = JSON.parse(snapshotConfig)?.ignore;
|
|
1387
|
+
} catch {}
|
|
1388
|
+
}
|
|
1389
|
+
const ignore = Array.isArray(snapshotIgnore) ? snapshotIgnore.filter((entry) => typeof entry === "string") : [];
|
|
1390
|
+
const changedChangesets = ignore.length > 0 && !isReleaseBranch ? changedFiles.filter(isChangesetFile).flatMap((path) => {
|
|
1391
|
+
const text = readSnapshotFile(root, path, staged);
|
|
1392
|
+
return text === null ? [] : [{ path, text }];
|
|
1393
|
+
}) : [];
|
|
1394
|
+
const ignored = evaluateIgnoredChangesets(ignore, changedChangesets, isReleaseBranch);
|
|
1328
1395
|
const workspaceMembers = resolveWorkspaceMembers(root);
|
|
1329
|
-
const fixedGroup = fixedGroupNames(
|
|
1396
|
+
const fixedGroup = fixedGroupNames(config?.fixed).map((name) => {
|
|
1330
1397
|
const member = workspaceMembers.get(name);
|
|
1331
1398
|
return member ? { name, dir: member.dir, files: member.files } : null;
|
|
1332
1399
|
}).filter((m) => m !== null);
|
|
1333
|
-
const
|
|
1400
|
+
const refusedChangesets = new Set(ignored.map(({ path }) => path));
|
|
1401
|
+
const result = evaluateChangesetCoverage(fixedGroup, changedFiles.filter((path) => !refusedChangesets.has(path)), isReleaseBranch);
|
|
1334
1402
|
console.log(`${CHECK_NAME}: ${fixedGroup.length} fixed-group member(s) resolved; ${result.status === "finding" ? result.shippedPathsHit.length : 0} shipped path(s) hit`);
|
|
1335
1403
|
if (result.status === "finding") {
|
|
1336
1404
|
emitCheckError({
|
|
1337
1405
|
schema: CHECK_SCHEMA_VERSION,
|
|
1338
1406
|
check: CHECK_NAME,
|
|
1339
1407
|
severity: "error",
|
|
1340
|
-
message: `changeset-coverage: this diff changes a published package's shipped file(s) with no \`.changeset/*.md\` in the same diff: ${result.shippedPathsHit.join(", ")}. Add a changeset describing the change, or add an empty one when the change ships nothing users see.`,
|
|
1408
|
+
message: `changeset-coverage: this diff changes a published package's shipped file(s) with no accepted \`.changeset/*.md\` in the same diff: ${result.shippedPathsHit.join(", ")}. Add a changeset describing the change, or add an empty one when the change ships nothing users see.`,
|
|
1341
1409
|
agent_recovery_prompt: "Either add a `.changeset/*.md` entry describing the change in user terms (run the repo's changeset CLI, e.g. `bunx changeset`), or, when the change ships nothing users see, add an empty changeset (`bunx changeset add --empty`). Commit it in the same PR."
|
|
1342
1410
|
});
|
|
1343
|
-
process.exit(1);
|
|
1344
1411
|
}
|
|
1412
|
+
for (const { path, packages } of ignored) {
|
|
1413
|
+
emitCheckError({
|
|
1414
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
1415
|
+
check: CHECK_NAME,
|
|
1416
|
+
severity: "error",
|
|
1417
|
+
message: `changeset-coverage: ${path} names ignored package(s): ${packages.join(", ")}.`,
|
|
1418
|
+
agent_recovery_prompt: "Remove the ignored package entries from the changeset frontmatter. If no release is intended, use an empty changeset or delete the file when a changeset is unnecessary."
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
if (result.status === "finding" || ignored.length > 0)
|
|
1422
|
+
process.exit(1);
|
|
1345
1423
|
}
|
|
1346
1424
|
main();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -23,6 +24,7 @@ var __toCommonJS = (from) => {
|
|
|
23
24
|
return entry;
|
|
24
25
|
};
|
|
25
26
|
var __moduleCache;
|
|
27
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
26
28
|
var __returnValue = (v) => v;
|
|
27
29
|
function __exportSetter(name, newValue) {
|
|
28
30
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -47,6 +49,7 @@ var __esm = (fn, res, err) => () => {
|
|
|
47
49
|
throw err[0];
|
|
48
50
|
return res;
|
|
49
51
|
};
|
|
52
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
50
53
|
|
|
51
54
|
// ../../harness/kernel/connectors/git/changed-line-ranges.ts
|
|
52
55
|
function parseChangedLineRanges(diffOutput) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -23,6 +24,7 @@ var __toCommonJS = (from) => {
|
|
|
23
24
|
return entry;
|
|
24
25
|
};
|
|
25
26
|
var __moduleCache;
|
|
27
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
26
28
|
var __returnValue = (v) => v;
|
|
27
29
|
function __exportSetter(name, newValue) {
|
|
28
30
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -47,6 +49,7 @@ var __esm = (fn, res, err) => () => {
|
|
|
47
49
|
throw err[0];
|
|
48
50
|
return res;
|
|
49
51
|
};
|
|
52
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
50
53
|
|
|
51
54
|
// ../../harness/kernel/adapters/code-host/github/gh.ts
|
|
52
55
|
import { execFile as execFile2, execFileSync } from "node:child_process";
|
|
@@ -82,6 +85,23 @@ async function ghApiGetAllPagesAsync(pathWithoutPage, opts) {
|
|
|
82
85
|
}
|
|
83
86
|
throw new Error(`ghApiGetAllPagesAsync: "${pathWithoutPage}" did not terminate within ${MAX_PAGES} pages (${MAX_PAGES * MAX_PER_PAGE} items) — refusing to keep walking.`);
|
|
84
87
|
}
|
|
88
|
+
async function ghLabelIssueCountsAsync(owner, repo, labelQuery) {
|
|
89
|
+
const stdout = await runAsync([
|
|
90
|
+
"api",
|
|
91
|
+
"graphql",
|
|
92
|
+
"--paginate",
|
|
93
|
+
"-f",
|
|
94
|
+
`query=${LABEL_ISSUE_COUNTS_QUERY.replace("$labelQuery", JSON.stringify(labelQuery))}`,
|
|
95
|
+
"-f",
|
|
96
|
+
`owner=${owner}`,
|
|
97
|
+
"-f",
|
|
98
|
+
`name=${repo}`,
|
|
99
|
+
"--jq",
|
|
100
|
+
".data.repository.labels.nodes[] | {name, open: .open.totalCount, total: .all.totalCount}"
|
|
101
|
+
]);
|
|
102
|
+
return stdout.split(`
|
|
103
|
+
`).filter((line) => line.trim() !== "").map((line) => JSON.parse(line));
|
|
104
|
+
}
|
|
85
105
|
function issueListByLabelArgs(owner, repo, label) {
|
|
86
106
|
return [
|
|
87
107
|
"issue",
|
|
@@ -115,7 +135,14 @@ async function ghIssueListByAnyLabelAsync(owner, repo, labels) {
|
|
|
115
135
|
const perLabel = await Promise.all(labels.map((l) => ghIssueListByLabelAsync(owner, repo, l)));
|
|
116
136
|
return dedupeByNumber(perLabel.flat());
|
|
117
137
|
}
|
|
118
|
-
var execFileAsync2, systemEnv2, MAX_PER_PAGE = 100, MAX_PAGES = 100
|
|
138
|
+
var execFileAsync2, systemEnv2, MAX_PER_PAGE = 100, MAX_PAGES = 100, LABEL_ISSUE_COUNTS_QUERY = `query($owner: String!, $name: String!, $endCursor: String) {
|
|
139
|
+
repository(owner: $owner, name: $name) {
|
|
140
|
+
labels(first: 100, after: $endCursor, query: $labelQuery) {
|
|
141
|
+
pageInfo { hasNextPage endCursor }
|
|
142
|
+
nodes { name open: issues(states: OPEN) { totalCount } all: issues { totalCount } }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}`;
|
|
119
146
|
var init_gh = __esm(() => {
|
|
120
147
|
execFileAsync2 = promisify2(execFile2);
|
|
121
148
|
systemEnv2 = {
|
|
@@ -766,7 +793,7 @@ function commentMarkerFamily(name) {
|
|
|
766
793
|
function anchorAlternation(spellings) {
|
|
767
794
|
return `(?:${spellings.map((spelling) => spelling.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`;
|
|
768
795
|
}
|
|
769
|
-
var REGION_PREFIX, PROVENANCE_HEADING, CLAIM_ANCHOR, QUOTES_FILE_ANCHOR, VENDOR_EXAMPLE_ANCHOR, COMMENT_MARKER_PREFIX, FROZEN_BRIEF_MARKER, DEVELOPER_ROUND_MARKER, DEVELOPER_STOP_MARKER, LOOP_PUBLISHED_MARKER, LOOP_PAUSED_MARKER, LOOP_UNPUSHED_WORK_RESUME_MARKER, PRINCIPAL_RULING_MARKER, OBJECTIVES_VERSION_MARKER, DEFERRED_FINDINGS_MARKER, COMMENT_MARKER_PREFIX_CURRENT, COMMENT_MARKER_PREFIXES, COMMENT_MARKER_PREFIX_PATTERN, REGION_PREFIX_CURRENT, REGION_PREFIXES, PROVENANCE_HEADINGS, CLAIM_ANCHORS, QUOTES_FILE_ANCHORS, VENDOR_EXAMPLE_ANCHORS;
|
|
796
|
+
var REGION_PREFIX, PROVENANCE_HEADING, CLAIM_ANCHOR, QUOTES_FILE_ANCHOR, VENDOR_EXAMPLE_ANCHOR, COMMENT_MARKER_PREFIX, FROZEN_BRIEF_MARKER, DEVELOPER_ROUND_MARKER, DEVELOPER_STOP_MARKER, LOOP_PUBLISHED_MARKER, LOOP_PAUSED_MARKER, LOOP_UNPUSHED_WORK_RESUME_MARKER, PRINCIPAL_RULING_MARKER, OBJECTIVES_VERSION_MARKER, DOCUMENTATION_EDIT_MARKER, DEFERRED_FINDINGS_MARKER, COMMENT_MARKER_PREFIX_CURRENT, COMMENT_MARKER_PREFIXES, COMMENT_MARKER_PREFIX_PATTERN, REGION_PREFIX_CURRENT, REGION_PREFIXES, PROVENANCE_HEADINGS, CLAIM_ANCHORS, QUOTES_FILE_ANCHORS, VENDOR_EXAMPLE_ANCHORS;
|
|
770
797
|
var init_legacy_markers = __esm(() => {
|
|
771
798
|
REGION_PREFIX = { old: "AEG", current: "VINAYA" };
|
|
772
799
|
PROVENANCE_HEADING = {
|
|
@@ -788,6 +815,7 @@ var init_legacy_markers = __esm(() => {
|
|
|
788
815
|
LOOP_UNPUSHED_WORK_RESUME_MARKER = commentMarkerFamily("loop:unpushed-work-resume");
|
|
789
816
|
PRINCIPAL_RULING_MARKER = commentMarkerFamily("principal:ruling");
|
|
790
817
|
OBJECTIVES_VERSION_MARKER = commentMarkerFamily("objectives");
|
|
818
|
+
DOCUMENTATION_EDIT_MARKER = commentMarkerFamily("documentation");
|
|
791
819
|
DEFERRED_FINDINGS_MARKER = commentMarkerFamily("deferred-findings");
|
|
792
820
|
COMMENT_MARKER_PREFIX_CURRENT = COMMENT_MARKER_PREFIX.current;
|
|
793
821
|
COMMENT_MARKER_PREFIXES = [COMMENT_MARKER_PREFIX.current, COMMENT_MARKER_PREFIX.old];
|
|
@@ -949,6 +977,15 @@ function parsePremiseBlock(prBody) {
|
|
|
949
977
|
}
|
|
950
978
|
return assertions;
|
|
951
979
|
}
|
|
980
|
+
function declaresNewFilesOnly(prBody) {
|
|
981
|
+
const searchIn = anchoredRegion(prBody, "PREMISE", REGION_PREFIXES) ?? prBody;
|
|
982
|
+
const lines = searchIn.split(/\r?\n/).map((l) => l.trim());
|
|
983
|
+
const header = lines.findIndex(isPremiseHeader);
|
|
984
|
+
if (header === -1)
|
|
985
|
+
return false;
|
|
986
|
+
const first = lines.slice(header + 1).find((l) => l !== "");
|
|
987
|
+
return first === NEW_FILES_ONLY_PREMISE && parsePremiseBlock(prBody).length === 0;
|
|
988
|
+
}
|
|
952
989
|
function premiseBlockText(prBody) {
|
|
953
990
|
const searchIn = anchoredRegion(prBody, "PREMISE", REGION_PREFIXES) ?? prBody;
|
|
954
991
|
const lines = searchIn.split(/\r?\n/);
|
|
@@ -996,7 +1033,7 @@ function checkPremises(assertions, fileReader) {
|
|
|
996
1033
|
}
|
|
997
1034
|
return { pass: failures.length === 0, failures };
|
|
998
1035
|
}
|
|
999
|
-
var ASSERTION_KINDS, PREMISE_LINE;
|
|
1036
|
+
var ASSERTION_KINDS, NEW_FILES_ONLY_PREMISE = "- (no pin — every file this task names is new, so no existing content can be pinned)", PREMISE_LINE;
|
|
1000
1037
|
var init_premise_check = __esm(() => {
|
|
1001
1038
|
init_anchored_region();
|
|
1002
1039
|
init_legacy_markers();
|
|
@@ -1138,13 +1175,16 @@ function checkSurfaceMap(prBody) {
|
|
|
1138
1175
|
function checkDocUpdateList(prBody) {
|
|
1139
1176
|
return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
|
|
1140
1177
|
}
|
|
1141
|
-
function checkWorktreeStep0(
|
|
1142
|
-
|
|
1178
|
+
function checkWorktreeStep0(body) {
|
|
1179
|
+
const prBody = body.replaceAll(`\r
|
|
1180
|
+
`, `
|
|
1181
|
+
`);
|
|
1182
|
+
if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody) || /\*\*Step 0 \(mandatory, verbatim\):\*\*\n\n```\n(?:npm ci|pnpm install --frozen-lockfile|yarn install --frozen-lockfile)\n```/.test(prBody))
|
|
1143
1183
|
return { status: "pass", errors: [] };
|
|
1144
1184
|
return {
|
|
1145
1185
|
status: "fail",
|
|
1146
1186
|
errors: [
|
|
1147
|
-
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile`
|
|
1187
|
+
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or frozen-lockfile install (`bun install --frozen-lockfile`, `npm ci`, `pnpm install --frozen-lockfile`, `yarn install --frozen-lockfile`) found in the PR body."
|
|
1148
1188
|
]
|
|
1149
1189
|
};
|
|
1150
1190
|
}
|
|
@@ -1586,6 +1626,7 @@ var init_doctrine_map = __esm(() => {
|
|
|
1586
1626
|
{ key: "roles/developer.md", source: "executing/developer/doctrine.md", role: "developer", ships: true },
|
|
1587
1627
|
{ key: "roles/developer/reference.md", source: "executing/developer/reference.md", ships: true },
|
|
1588
1628
|
{ key: "roles/operator.md", source: "executing/operator/doctrine.md", role: "operator", ships: true },
|
|
1629
|
+
{ key: "roles/plan-reviewer.md", source: "thinking/plan-reviewer/doctrine.md", role: "plan-reviewer", ships: true },
|
|
1589
1630
|
{ key: "roles/planner.md", source: "thinking/planner/doctrine.md", role: "planner", ships: true },
|
|
1590
1631
|
{ key: "roles/planner/reference.md", source: "thinking/planner/reference.md", ships: true },
|
|
1591
1632
|
{ key: "roles/principal.md", source: "doctrine/roles/principal.md", role: "principal", ships: true },
|
|
@@ -2708,7 +2749,13 @@ function isMechanicallyNeutralDiff(diffText, path) {
|
|
|
2708
2749
|
}
|
|
2709
2750
|
return sawChange;
|
|
2710
2751
|
}
|
|
2711
|
-
function
|
|
2752
|
+
function prBodyGiven(env = process.env) {
|
|
2753
|
+
return env.PR_BODY !== undefined || env.PR_BODY_FILE !== undefined;
|
|
2754
|
+
}
|
|
2755
|
+
function owedNeutralNotes(result) {
|
|
2756
|
+
return result.notes.filter((n) => n.startsWith(DOC_NEUTRAL_OWED_PREFIX));
|
|
2757
|
+
}
|
|
2758
|
+
function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive, getDiff, bodyGiven = true) {
|
|
2712
2759
|
const out = { errors: [], notes: [] };
|
|
2713
2760
|
if (docOwnersContent === null)
|
|
2714
2761
|
return out;
|
|
@@ -2748,24 +2795,28 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2748
2795
|
}
|
|
2749
2796
|
if (changed.includes(pointerPath))
|
|
2750
2797
|
continue;
|
|
2798
|
+
const evidenced = () => getDiff !== undefined && matchedFiles.every((f) => {
|
|
2799
|
+
const diff = getDiff(f);
|
|
2800
|
+
return diff !== null && isMechanicallyNeutralDiff(diff, f);
|
|
2801
|
+
});
|
|
2751
2802
|
const declared = neutrals.find((n) => n.surface === b.pointer);
|
|
2752
2803
|
if (declared) {
|
|
2753
|
-
|
|
2754
|
-
const diff = getDiff(f);
|
|
2755
|
-
return diff !== null && isMechanicallyNeutralDiff(diff, f);
|
|
2756
|
-
});
|
|
2757
|
-
if (evidenced) {
|
|
2804
|
+
if (evidenced()) {
|
|
2758
2805
|
out.notes.push(`C5 doc-neutral: ${b.pointer} not required for ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\`) — declared neutral ("${declared.note}"), diff of ${matchedFiles.join(", ")} confirmed comment/whitespace-only.`);
|
|
2759
2806
|
continue;
|
|
2760
2807
|
}
|
|
2761
2808
|
out.errors.push(`C5 doc-neutral-unverified: ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\` → ${b.pointer}) declared \`Doc-neutral: ${b.pointer} — ${declared.note}\`, but the diff of ${matchedFiles.join(", ")} contains changes beyond comments/whitespace. Update ${pointerPath}, or have a principal apply the \`${WAIVER_LABEL}\` label.`);
|
|
2762
2809
|
continue;
|
|
2763
2810
|
}
|
|
2811
|
+
if (!bodyGiven && evidenced()) {
|
|
2812
|
+
out.notes.push(`${DOC_NEUTRAL_OWED_PREFIX} ${b.pointer} not required in this run for ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\`) — no pull request body was given, and the diff of ${matchedFiles.join(", ")} is comment/whitespace-only. The pull request body owes \`Doc-neutral: ${b.pointer} — <why>\`.`);
|
|
2813
|
+
continue;
|
|
2814
|
+
}
|
|
2764
2815
|
out.errors.push(`C5 doc-coverage: code change matched ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\` → ${b.pointer}), but ${pointerPath} is not in the PR diff. Update it, declare \`Doc-neutral: ${b.pointer} — <why>\` if the change is genuinely mechanically-neutral, or have a principal apply the \`${WAIVER_LABEL}\` label.`);
|
|
2765
2816
|
}
|
|
2766
2817
|
return out;
|
|
2767
2818
|
}
|
|
2768
|
-
var DOC_OWNERS_PATH = ".vinaya/doc-owners", SEPARATOR, LANGUAGE_COMMENT_PREFIXES;
|
|
2819
|
+
var DOC_OWNERS_PATH = ".vinaya/doc-owners", SEPARATOR, LANGUAGE_COMMENT_PREFIXES, DOC_NEUTRAL_OWED_PREFIX = "C5 doc-neutral-owed:";
|
|
2769
2820
|
var init_doc_owners = __esm(() => {
|
|
2770
2821
|
init_file_classify();
|
|
2771
2822
|
init_waiver_label();
|
|
@@ -2820,6 +2871,20 @@ var init_protected_paths = __esm(() => {
|
|
|
2820
2871
|
];
|
|
2821
2872
|
});
|
|
2822
2873
|
|
|
2874
|
+
// ../../harness/processes/vinaya-strict/tools/task-contract/test-plan-proof.ts
|
|
2875
|
+
function stripObjectiveIdSpans(text) {
|
|
2876
|
+
return text.replace(ITEM_IDS_SPAN_RE, "").trim();
|
|
2877
|
+
}
|
|
2878
|
+
var ID_LIST, LINE_IDS_RE, ITEM_IDS_SPAN_RE;
|
|
2879
|
+
var init_test_plan_proof = __esm(() => {
|
|
2880
|
+
init_brief_validation();
|
|
2881
|
+
init_objectives();
|
|
2882
|
+
init_test_plan_section();
|
|
2883
|
+
ID_LIST = String.raw`O\d+(?:\s*,\s*O\d+)*`;
|
|
2884
|
+
LINE_IDS_RE = new RegExp(String.raw`\(\s*(${ID_LIST})\s*\)\s*$`);
|
|
2885
|
+
ITEM_IDS_SPAN_RE = new RegExp(String.raw`(?<!\`)(\`+)\s*\(?\s*(${ID_LIST})\s*\)?\s*\1(?!\`)`, "g");
|
|
2886
|
+
});
|
|
2887
|
+
|
|
2823
2888
|
// ../../harness/processes/vinaya-strict/tools/task-contract/issue-validation.ts
|
|
2824
2889
|
function hasRationaleField(body, labelPattern) {
|
|
2825
2890
|
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
@@ -3018,7 +3083,7 @@ function checkPartsCiteDefinedObjectives(body) {
|
|
|
3018
3083
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3019
3084
|
}
|
|
3020
3085
|
function liveCommand(text) {
|
|
3021
|
-
const trimmed = text
|
|
3086
|
+
const trimmed = stripObjectiveIdSpans(text);
|
|
3022
3087
|
const span = /^(`+)(.+)\1$/.exec(trimmed);
|
|
3023
3088
|
return span ? span[2].trim() : trimmed;
|
|
3024
3089
|
}
|
|
@@ -3127,9 +3192,19 @@ function namedPathsIn(text) {
|
|
|
3127
3192
|
function boundaryPinnedFiles(body) {
|
|
3128
3193
|
const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
|
|
3129
3194
|
const excluded = new Set(namedPathsIn(boundaryOutText(body)));
|
|
3130
|
-
|
|
3195
|
+
const named = [...namedPathsIn(boundary), ...rootFilesPinnedIn(boundary)];
|
|
3196
|
+
return [...new Set(named)].filter((p) => looksLikeFilePath(p) && !excluded.has(p));
|
|
3197
|
+
}
|
|
3198
|
+
function rootFilesPinnedIn(boundary) {
|
|
3199
|
+
const start = boundary.search(/\bPinned files\s*:/i);
|
|
3200
|
+
if (start === -1)
|
|
3201
|
+
return [];
|
|
3202
|
+
const clause = boundary.slice(start);
|
|
3203
|
+
const out = BOUNDARY_OUT_RE.exec(clause);
|
|
3204
|
+
const pinned = out ? clause.slice(0, out.index) : clause;
|
|
3205
|
+
return [...pinned.matchAll(ROOT_FILE_RE_GLOBAL)].map((m) => m[1]);
|
|
3131
3206
|
}
|
|
3132
|
-
var RATIONALE_FIELDS, DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale", SINGLE_FIX_OPTIONAL_FIELDS, OBJECTIVES_SINCE_ISSUE = 404, PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3, ISSUE_PART_LINE_RE, ISSUE_LIVE_LINE_RE, TYPE_LABEL_IDS, PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" }), MESSAGE_VALUE_COUNT_MAX = 5, MESSAGE_VALUE_MAX = 64, DOC_PATH_RE, DOC_PATH_RE_GLOBAL, RATIONALE_PATH_RE_GLOBAL, DEFAULT_COLLISION_THRESHOLD = 3, BOUNDARY_OUT_RE, FILE_EXTENSIONS, CI_SHARD_DIR = "apps/cli/tests/ci-shards", CI_SHARD_PROBE;
|
|
3207
|
+
var RATIONALE_FIELDS, DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale", SINGLE_FIX_OPTIONAL_FIELDS, OBJECTIVES_SINCE_ISSUE = 404, PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3, ISSUE_PART_LINE_RE, ISSUE_LIVE_LINE_RE, TYPE_LABEL_IDS, PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" }), MESSAGE_VALUE_COUNT_MAX = 5, MESSAGE_VALUE_MAX = 64, DOC_PATH_RE, DOC_PATH_RE_GLOBAL, RATIONALE_PATH_RE_GLOBAL, DEFAULT_COLLISION_THRESHOLD = 3, BOUNDARY_OUT_RE, FILE_EXTENSIONS, ROOT_FILE_RE_GLOBAL, CI_SHARD_DIR = "apps/cli/tests/ci-shards", CI_SHARD_PROBE;
|
|
3133
3208
|
var init_issue_validation = __esm(() => {
|
|
3134
3209
|
init_parse_rationale_deps();
|
|
3135
3210
|
init_labels();
|
|
@@ -3143,11 +3218,13 @@ var init_issue_validation = __esm(() => {
|
|
|
3143
3218
|
init_derive_section7();
|
|
3144
3219
|
init_doctrine_map();
|
|
3145
3220
|
init_objectives();
|
|
3221
|
+
init_waiver_label();
|
|
3146
3222
|
init_issue_documentation();
|
|
3147
3223
|
init_touched_path();
|
|
3148
3224
|
init_protected_paths();
|
|
3149
3225
|
init_quoted_command();
|
|
3150
3226
|
init_test_plan_section();
|
|
3227
|
+
init_test_plan_proof();
|
|
3151
3228
|
RATIONALE_FIELDS = [
|
|
3152
3229
|
{ name: "Boundary", pattern: "Boundary" },
|
|
3153
3230
|
{ name: "Sizing", pattern: "Sizing" },
|
|
@@ -3191,6 +3268,7 @@ var init_issue_validation = __esm(() => {
|
|
|
3191
3268
|
"html",
|
|
3192
3269
|
"css"
|
|
3193
3270
|
]);
|
|
3271
|
+
ROOT_FILE_RE_GLOBAL = /`([\w.@-]+\.(?:md|mdx|txt|json|jsonc|ts|tsx|js|jsx|mjs|cjs|mts|cts|yml|yaml|toml|lock|html|css|scss|sh|py|rb|go|rs|xml|ini|cfg|conf))`/g;
|
|
3194
3272
|
CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
|
|
3195
3273
|
});
|
|
3196
3274
|
|
|
@@ -3931,6 +4009,7 @@ function parseTaskBranchIdentity(branch) {
|
|
|
3931
4009
|
// ../../harness/processes/vinaya-strict/checks/coherence-checks.ts
|
|
3932
4010
|
init_parse_rationale_deps();
|
|
3933
4011
|
init_labels();
|
|
4012
|
+
init_list_tasks();
|
|
3934
4013
|
init_anchored_region();
|
|
3935
4014
|
init_legacy_markers();
|
|
3936
4015
|
init_issue_validation();
|
|
@@ -3942,6 +4021,21 @@ function isGrandfathered(isoDate) {
|
|
|
3942
4021
|
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
3943
4022
|
}
|
|
3944
4023
|
var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
|
|
4024
|
+
function buildIssueEntries(trancheSlug, archived, tasks, factsByIssue) {
|
|
4025
|
+
return tasks.map((task) => ({
|
|
4026
|
+
trancheSlug,
|
|
4027
|
+
archived,
|
|
4028
|
+
task,
|
|
4029
|
+
facts: task.issue === null ? undefined : factsByIssue?.get(task.issue)
|
|
4030
|
+
}));
|
|
4031
|
+
}
|
|
4032
|
+
function buildTaskEntries(trancheSlug, archived, tasks, factsByIssue) {
|
|
4033
|
+
const { tasks: standing } = resolveDuplicateTasks(tasks, (n) => factsByIssue?.get(n)?.issueState === "open");
|
|
4034
|
+
return buildIssueEntries(trancheSlug, archived, standing, factsByIssue);
|
|
4035
|
+
}
|
|
4036
|
+
function provenanceKey(issue) {
|
|
4037
|
+
return String(issue);
|
|
4038
|
+
}
|
|
3945
4039
|
function checkA1(entries, principalAllowlist) {
|
|
3946
4040
|
const failures = [];
|
|
3947
4041
|
for (const e of entries) {
|
|
@@ -3977,10 +4071,13 @@ function checkA2(entries, hasProvenanceByKey) {
|
|
|
3977
4071
|
for (const e of entries) {
|
|
3978
4072
|
if (!e.facts)
|
|
3979
4073
|
continue;
|
|
4074
|
+
if (e.task.issue === null)
|
|
4075
|
+
continue;
|
|
4076
|
+
if (e.facts.stateReason === "not_planned")
|
|
4077
|
+
continue;
|
|
3980
4078
|
if (e.facts.issueState !== "closed" || e.facts.prState !== "merged")
|
|
3981
4079
|
continue;
|
|
3982
|
-
const
|
|
3983
|
-
const hasProvenance = hasProvenanceByKey.get(key);
|
|
4080
|
+
const hasProvenance = hasProvenanceByKey.get(provenanceKey(e.task.issue));
|
|
3984
4081
|
if (hasProvenance === undefined)
|
|
3985
4082
|
continue;
|
|
3986
4083
|
if (!hasProvenance) {
|
|
@@ -4428,6 +4525,19 @@ function lifecycleFromIssues(issues) {
|
|
|
4428
4525
|
return "planned";
|
|
4429
4526
|
return issues.some((i) => i.state === "OPEN") ? "active" : "complete";
|
|
4430
4527
|
}
|
|
4528
|
+
function lifecycleFromCounts(open, total) {
|
|
4529
|
+
if (total === 0)
|
|
4530
|
+
return "planned";
|
|
4531
|
+
return open > 0 ? "active" : "complete";
|
|
4532
|
+
}
|
|
4533
|
+
function resolveLegacyFactsFromCounts(milestone, open, total) {
|
|
4534
|
+
if (milestone.state === "closed" && total > 0) {
|
|
4535
|
+
return { goal: milestone.description ?? "", lifecycle: lifecycleFromCounts(open, total) };
|
|
4536
|
+
}
|
|
4537
|
+
return factsFromLegacyMilestone(milestone);
|
|
4538
|
+
}
|
|
4539
|
+
var TRANCHE_LABEL_QUERY = "vinaya/tranche:";
|
|
4540
|
+
var ACTIVE_ISSUE_READ_CONCURRENCY = 4;
|
|
4431
4541
|
function goalFromMilestones(milestones, slug) {
|
|
4432
4542
|
for (const m of milestones) {
|
|
4433
4543
|
const goal = intentGoalForSlug(m.description ?? "", slug);
|
|
@@ -4455,10 +4565,20 @@ function trancheSlugsFromLabels(labels) {
|
|
|
4455
4565
|
}
|
|
4456
4566
|
async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
4457
4567
|
const read = (fetch) => options.retryFailedReads ? retryOnce(fetch) : fetch();
|
|
4458
|
-
const [milestones, labels] = await Promise.all([
|
|
4568
|
+
const [milestones, labels, counts] = await Promise.all([
|
|
4459
4569
|
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
|
|
4460
|
-
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
|
|
4570
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)),
|
|
4571
|
+
read(() => ghLabelIssueCountsAsync(owner, repo, TRANCHE_LABEL_QUERY))
|
|
4461
4572
|
]);
|
|
4573
|
+
const countsByLabel = new Map(counts.map((c) => [c.name, c]));
|
|
4574
|
+
const uncounted = trancheSlugsFromLabels(labels).map((slug) => trancheLabel(slug)).filter((label) => !countsByLabel.has(label));
|
|
4575
|
+
if (uncounted.length > 0) {
|
|
4576
|
+
throw new Error(`the label Issue-count query returned no count for ${uncounted.join(", ")}`);
|
|
4577
|
+
}
|
|
4578
|
+
const lifecycleOf = (slug) => {
|
|
4579
|
+
const c = countsByLabel.get(trancheLabel(slug));
|
|
4580
|
+
return lifecycleFromCounts(c?.open ?? 0, c?.total ?? 0);
|
|
4581
|
+
};
|
|
4462
4582
|
const active = [];
|
|
4463
4583
|
const archived = [];
|
|
4464
4584
|
const facts = new Map;
|
|
@@ -4466,33 +4586,21 @@ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
|
4466
4586
|
const legacyMilestoneBySlug = new Map(milestones.filter((m) => legacySlugs.has(m.title)).map((m) => [m.title, m]));
|
|
4467
4587
|
const newPathSlugs = trancheSlugsFromLabels(labels).filter((slug) => !legacySlugs.has(slug));
|
|
4468
4588
|
const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
|
|
4469
|
-
const
|
|
4470
|
-
const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
|
|
4471
|
-
Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
|
|
4472
|
-
Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
|
|
4473
|
-
]);
|
|
4474
|
-
const issuesBySlug = new Map;
|
|
4475
|
-
uniqueLegacySlugs.forEach((slug, i) => {
|
|
4476
|
-
issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
|
|
4477
|
-
});
|
|
4478
|
-
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
4479
|
-
issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
|
|
4480
|
-
});
|
|
4481
|
-
uniqueLegacySlugs.forEach((slug, i) => {
|
|
4589
|
+
for (const slug of legacySlugs) {
|
|
4482
4590
|
const m = legacyMilestoneBySlug.get(slug);
|
|
4483
4591
|
if (!m)
|
|
4484
|
-
|
|
4592
|
+
continue;
|
|
4485
4593
|
const ref = { slug, goal: m.description ?? "" };
|
|
4486
|
-
const
|
|
4594
|
+
const c = countsByLabel.get(trancheLabel(slug));
|
|
4595
|
+
const f = resolveLegacyFactsFromCounts(m, c?.open ?? 0, c?.total ?? 0);
|
|
4487
4596
|
if (f.lifecycle === "complete")
|
|
4488
4597
|
archived.push(ref);
|
|
4489
4598
|
else if (f.lifecycle === "active")
|
|
4490
4599
|
active.push(ref);
|
|
4491
4600
|
facts.set(slug, f);
|
|
4492
|
-
}
|
|
4493
|
-
|
|
4494
|
-
const
|
|
4495
|
-
const lifecycle = lifecycleFromIssues(issues);
|
|
4601
|
+
}
|
|
4602
|
+
for (const slug of uniqueNewPathSlugs) {
|
|
4603
|
+
const lifecycle = lifecycleOf(slug);
|
|
4496
4604
|
const goal = goalFromMilestones(milestones, slug);
|
|
4497
4605
|
const f = { goal, lifecycle };
|
|
4498
4606
|
facts.set(slug, f);
|
|
@@ -4500,7 +4608,16 @@ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
|
4500
4608
|
active.push({ slug, goal });
|
|
4501
4609
|
else if (lifecycle === "complete")
|
|
4502
4610
|
archived.push({ slug, goal });
|
|
4503
|
-
}
|
|
4611
|
+
}
|
|
4612
|
+
const issuesBySlug = new Map;
|
|
4613
|
+
const activeSlugs = active.map((r) => r.slug);
|
|
4614
|
+
for (let i = 0;i < activeSlugs.length; i += ACTIVE_ISSUE_READ_CONCURRENCY) {
|
|
4615
|
+
const batch = activeSlugs.slice(i, i + ACTIVE_ISSUE_READ_CONCURRENCY);
|
|
4616
|
+
const lists = await Promise.all(batch.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))));
|
|
4617
|
+
batch.forEach((slug, j) => {
|
|
4618
|
+
issuesBySlug.set(slug, lists[j] ?? []);
|
|
4619
|
+
});
|
|
4620
|
+
}
|
|
4504
4621
|
return { active, archived, facts, legacySlugs, issuesBySlug };
|
|
4505
4622
|
}
|
|
4506
4623
|
async function retryOnce(fetch) {
|