@attalabs/vinaya 0.31.0 → 0.32.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.
Files changed (46) hide show
  1. package/README.md +1 -2
  2. package/aeg-root/roles/developer/reference.md +3 -3
  3. package/aeg-root/templates/pr-report-template.md +7 -2
  4. package/dist/checks/bin/check-body-bare-digits.js +229 -86
  5. package/dist/checks/bin/check-branch-topology.js +101 -89
  6. package/dist/checks/bin/check-brief-shape.js +222 -79
  7. package/dist/checks/bin/check-changeset-coverage.js +739 -232
  8. package/dist/checks/bin/check-ci-shard-coverage.js +82 -0
  9. package/dist/checks/bin/check-closes-n.js +101 -89
  10. package/dist/checks/bin/check-coherence.js +233 -129
  11. package/dist/checks/bin/check-dead-branch-push.js +97 -44
  12. package/dist/checks/bin/check-dispatch-readiness.js +238 -134
  13. package/dist/checks/bin/check-doc-coverage-push.js +722 -215
  14. package/dist/checks/bin/check-doc-coverage.js +726 -219
  15. package/dist/checks/bin/check-doctrine-no-procedures.js +222 -79
  16. package/dist/checks/bin/check-doctrine-portability.js +724 -217
  17. package/dist/checks/bin/check-evidence-fresh.js +720 -206
  18. package/dist/checks/bin/check-exec-bits.js +720 -213
  19. package/dist/checks/bin/check-first-push-dispatch.js +231 -129
  20. package/dist/checks/bin/check-issue-assignment.js +103 -91
  21. package/dist/checks/bin/check-issue-milestone-attach.js +94 -41
  22. package/dist/checks/bin/check-issue-objectives-numbering.js +94 -41
  23. package/dist/checks/bin/check-issue-parts-coverage.js +94 -41
  24. package/dist/checks/bin/check-issue-surface-globs.js +251 -127
  25. package/dist/checks/bin/check-issue-title-grammar.js +94 -41
  26. package/dist/checks/bin/check-issue-tranche-label.js +94 -41
  27. package/dist/checks/bin/check-main-branch-refusal.js +94 -41
  28. package/dist/checks/bin/check-no-disk-state.js +94 -41
  29. package/dist/checks/bin/check-pr-premise-reassert.js +222 -77
  30. package/dist/checks/bin/check-pr-report-density.js +94 -41
  31. package/dist/checks/bin/check-principal-test-plan-wait.js +94 -39
  32. package/dist/checks/bin/check-quoted-command.js +710 -201
  33. package/dist/checks/bin/check-reader-resolvable-prose.js +722 -213
  34. package/dist/checks/bin/check-registry-gates.js +104 -41
  35. package/dist/checks/bin/check-retired-vocabulary.js +708 -199
  36. package/dist/checks/bin/check-review-gate.js +224 -79
  37. package/dist/checks/bin/check-single-plan-pr.js +94 -41
  38. package/dist/checks/bin/check-surface-scope.js +101 -89
  39. package/dist/checks/bin/check-test-plan.js +94 -39
  40. package/dist/checks/bin/check-token-collection-wired.js +100 -42
  41. package/dist/checks/bin/check-token-report.js +96 -43
  42. package/dist/checks/bin/check-workspace-escape.js +722 -213
  43. package/dist/index.js +3725 -3148
  44. package/dist/lib/pre-push-cache-test-run.js +4175 -0
  45. package/dist/lib/pre-push-select-tests.js +709 -101
  46. package/package.json +3 -2
@@ -1,6 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from "node:module";
3
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
2
 
5
3
  // src/checks/bin/check-dead-branch-push.ts
6
4
  import { execFileSync as execFileSync2 } from "node:child_process";
@@ -1037,7 +1035,7 @@ function withDefaults(oldDefaults, newDefaults) {
1037
1035
  var endpoint = withDefaults(null, DEFAULTS);
1038
1036
 
1039
1037
  // ../../node_modules/fast-content-type-parse/index.js
1040
- var NullObject = function NullObject2() {};
1038
+ var NullObject = function NullObject() {};
1041
1039
  NullObject.prototype = Object.create(null);
1042
1040
  var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
1043
1041
  var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
@@ -1781,27 +1779,27 @@ function splitTableRow(row) {
1781
1779
  return parts.map((p) => p.split(PLACEHOLDER).join("|"));
1782
1780
  }
1783
1781
  // ../../packages/aeg-core/src/blast-radius-domains.ts
1784
- function resolveWorkspaceEntry(entry2, listDirs) {
1785
- if (entry2.endsWith("/*")) {
1786
- const baseDir = entry2.slice(0, -2);
1782
+ function resolveWorkspaceEntry(entry, listDirs) {
1783
+ if (entry.endsWith("/*")) {
1784
+ const baseDir = entry.slice(0, -2);
1787
1785
  return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
1788
1786
  }
1789
- if (entry2.includes("*"))
1787
+ if (entry.includes("*"))
1790
1788
  return [];
1791
- return [entry2];
1789
+ return [entry];
1792
1790
  }
1793
1791
  // ../../packages/aeg-core/src/consumer-enumeration.ts
1794
1792
  function deriveWorkspaceMemberDirs(workspaces, listDirs) {
1795
- const positive = workspaces.filter((entry2) => !entry2.startsWith("!"));
1796
- const negative = workspaces.filter((entry2) => entry2.startsWith("!")).map((entry2) => entry2.slice(1));
1793
+ const positive = workspaces.filter((entry) => !entry.startsWith("!"));
1794
+ const negative = workspaces.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
1797
1795
  const excluded = new Set;
1798
- for (const entry2 of negative) {
1799
- for (const member of resolveWorkspaceEntry(entry2, listDirs))
1796
+ for (const entry of negative) {
1797
+ for (const member of resolveWorkspaceEntry(entry, listDirs))
1800
1798
  excluded.add(member);
1801
1799
  }
1802
1800
  const members = new Set;
1803
- for (const entry2 of positive) {
1804
- for (const member of resolveWorkspaceEntry(entry2, listDirs)) {
1801
+ for (const entry of positive) {
1802
+ for (const member of resolveWorkspaceEntry(entry, listDirs)) {
1805
1803
  if (!excluded.has(member))
1806
1804
  members.add(member);
1807
1805
  }
@@ -2125,15 +2123,15 @@ function summarizeTranscript(jsonl) {
2125
2123
  const line = rawLine.trim();
2126
2124
  if (!line)
2127
2125
  continue;
2128
- let entry2;
2126
+ let entry;
2129
2127
  try {
2130
- entry2 = JSON.parse(line);
2128
+ entry = JSON.parse(line);
2131
2129
  } catch {
2132
2130
  continue;
2133
2131
  }
2134
- if (!entry2 || typeof entry2 !== "object")
2132
+ if (!entry || typeof entry !== "object")
2135
2133
  continue;
2136
- const obj = entry2;
2134
+ const obj = entry;
2137
2135
  if (obj.type !== "assistant")
2138
2136
  continue;
2139
2137
  const message = obj.message;
@@ -2981,7 +2979,7 @@ function isStep0Block(content) {
2981
2979
  }
2982
2980
  function checkCommandsCarryOutput(prBody) {
2983
2981
  const errors = [];
2984
- for (const [label2, num] of [
2982
+ for (const [label, num] of [
2985
2983
  ["5", 5],
2986
2984
  ["6", 6]
2987
2985
  ]) {
@@ -2995,7 +2993,7 @@ function checkCommandsCarryOutput(prBody) {
2995
2993
  continue;
2996
2994
  const next = blocks[i + 1];
2997
2995
  if (!next || isCommandBlock(next.content)) {
2998
- errors.push(`brief-validation commands carry output: §${label2} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
2996
+ errors.push(`brief-validation commands carry output: §${label} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
2999
2997
  }
3000
2998
  }
3001
2999
  }
@@ -3432,8 +3430,8 @@ function stripPartBackticks(text) {
3432
3430
  function partWordCount(text) {
3433
3431
  return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
3434
3432
  }
3435
- function looksLikeFilePath(entry2) {
3436
- const stripped = entry2.replace(/\/\*\*?$/, "");
3433
+ function looksLikeFilePath(entry) {
3434
+ const stripped = entry.replace(/\/\*\*?$/, "");
3437
3435
  const lastSegment = stripped.split("/").pop() ?? stripped;
3438
3436
  const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
3439
3437
  return extMatch !== null && extMatch.index > 0;
@@ -3919,14 +3917,14 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
3919
3917
  const referenced = extractClosesReferences(prBody);
3920
3918
  if (taskIssueRefs) {
3921
3919
  for (const n of referenced) {
3922
- const ref2 = taskIssueRefs.get(n);
3923
- if (!ref2)
3920
+ const ref = taskIssueRefs.get(n);
3921
+ if (!ref)
3924
3922
  continue;
3925
- const expectedBranch = `task/${ref2.trancheSlug}/${ref2.taskId}`;
3923
+ const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
3926
3924
  if (branch !== expectedBranch) {
3927
3925
  return {
3928
3926
  ok: false,
3929
- message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref2.taskId} of tranche "${ref2.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
3927
+ message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref.taskId} of tranche "${ref.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
3930
3928
  };
3931
3929
  }
3932
3930
  }
@@ -3935,15 +3933,15 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
3935
3933
  if (!ref)
3936
3934
  return { ok: true };
3937
3935
  if (ref.kind === "issue") {
3938
- const expectedIssue2 = ref.issueNumber;
3939
- if (!referenced.has(expectedIssue2)) {
3936
+ const expectedIssue = ref.issueNumber;
3937
+ if (!referenced.has(expectedIssue)) {
3940
3938
  return {
3941
3939
  ok: false,
3942
- expectedIssue: expectedIssue2,
3943
- message: `closes-n: PR body does not contain \`Closes #${expectedIssue2}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
3940
+ expectedIssue,
3941
+ message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
3944
3942
  };
3945
3943
  }
3946
- return { ok: true, expectedIssue: expectedIssue2 };
3944
+ return { ok: true, expectedIssue };
3947
3945
  }
3948
3946
  const trancheSlug = ref.tranche;
3949
3947
  const taskId = ref.taskId;
@@ -3989,8 +3987,8 @@ function extractIssue(body) {
3989
3987
  const anchorNums = closesRefs(anchored);
3990
3988
  if (anchorNums.length === 0)
3991
3989
  return { issue: null, extraIssues: bodyNums, outsideHeader: false };
3992
- const issue2 = anchorNums[0];
3993
- return { issue: issue2, extraIssues: bodyNums.filter((n) => n !== issue2), outsideHeader: false };
3990
+ const issue = anchorNums[0];
3991
+ return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
3994
3992
  }
3995
3993
  const headerNums = closesRefs(headerRegion(stripped));
3996
3994
  if (bodyNums.length === 0)
@@ -4059,15 +4057,15 @@ function compareManifest(echoed, current, patchIdOf) {
4059
4057
  const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
4060
4058
  const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
4061
4059
  const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
4062
- const objectivesVersion2 = isBoundToObjectives(echoed, current.objectivesVersion);
4060
+ const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
4063
4061
  const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
4064
4062
  const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
4065
4063
  return {
4066
- bound: head && base && briefHashBound && objectivesVersion2 && rulingOrdinal && policyDigestBound,
4064
+ bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
4067
4065
  head,
4068
4066
  base,
4069
4067
  briefHash: briefHashBound,
4070
- objectivesVersion: objectivesVersion2,
4068
+ objectivesVersion,
4071
4069
  rulingOrdinal,
4072
4070
  policyDigest: policyDigestBound
4073
4071
  };
@@ -5499,6 +5497,10 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
5499
5497
  }
5500
5498
  return findings;
5501
5499
  }
5500
+ // ../../packages/aeg-core/src/dev-review-loop/types.ts
5501
+ var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
5502
+ // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
5503
+ var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
5502
5504
  // ../../packages/aeg-core/src/log/envelope.ts
5503
5505
  import { createHash as createHash5 } from "node:crypto";
5504
5506
 
@@ -6037,6 +6039,7 @@ function redact(value, home) {
6037
6039
  return value;
6038
6040
  }
6039
6041
  // ../../packages/aeg-core/src/log/store.ts
6042
+ var KNOWN_SCHEMA_VERSIONS = [1, 2];
6040
6043
  function metaOf(obj) {
6041
6044
  if (obj === null || typeof obj !== "object")
6042
6045
  return null;
@@ -6059,11 +6062,61 @@ function recordIdentity(obj) {
6059
6062
  }
6060
6063
  return null;
6061
6064
  }
6062
-
6063
- // ../../packages/aeg-core/src/log/artifact.ts
6064
- var TASK_LOG_ARTIFACT_MAX_BYTES = 8 * 1024 * 1024;
6065
- // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
6066
- var STOPPED_CONDITIONS = new Set(["confidence", "reappearance", "no_progress", "max_rounds"]);
6065
+ function schemaVersionOf(obj) {
6066
+ const meta = metaOf(obj);
6067
+ const schema = meta?.schema;
6068
+ return typeof schema === "number" ? schema : null;
6069
+ }
6070
+ function isKnownSchema(version) {
6071
+ return version !== null && KNOWN_SCHEMA_VERSIONS.includes(version);
6072
+ }
6073
+ function classifyStoredLine(raw, home) {
6074
+ let obj;
6075
+ try {
6076
+ obj = JSON.parse(raw);
6077
+ } catch {
6078
+ return { status: "invalid", identity: null, raw, reason: "not valid JSON" };
6079
+ }
6080
+ const version = schemaVersionOf(obj);
6081
+ if (version === null) {
6082
+ return { status: "invalid", identity: recordIdentity(obj), raw, reason: "no readable meta.schema" };
6083
+ }
6084
+ if (!isKnownSchema(version)) {
6085
+ return {
6086
+ status: "unknown_version",
6087
+ identity: recordIdentity(obj),
6088
+ schema: version,
6089
+ raw,
6090
+ reason: `schema version ${version} is not one this build validates (${KNOWN_SCHEMA_VERSIONS.join(", ")}) — kept for diagnosis`
6091
+ };
6092
+ }
6093
+ const result = LogEventSchema.safeParse(obj);
6094
+ if (!result.success) {
6095
+ return {
6096
+ status: "invalid",
6097
+ identity: recordIdentity(obj),
6098
+ raw,
6099
+ reason: result.error.issues[0]?.message ?? "schema violation"
6100
+ };
6101
+ }
6102
+ const event = result.data;
6103
+ const identity = recordIdentity(event);
6104
+ if (identity === null) {
6105
+ return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
6106
+ }
6107
+ const redacted = redact(event, home);
6108
+ const provenance = version === 2 ? event.meta.provenance ?? null : null;
6109
+ return {
6110
+ status: "ok",
6111
+ identity,
6112
+ runId: event.meta.run_id,
6113
+ seq: event.meta.seq,
6114
+ schema: version,
6115
+ provenance,
6116
+ event,
6117
+ postLine: JSON.stringify(redacted)
6118
+ };
6119
+ }
6067
6120
  // ../../packages/aeg-core/src/control-store/records.ts
6068
6121
  import { z as z3 } from "zod";
6069
6122
  var isoTimestamp = z3.string().min(1);
@@ -6222,10 +6275,10 @@ function fetchPrState(branch) {
6222
6275
  } catch {
6223
6276
  return { state: "UNKNOWN", number: null };
6224
6277
  }
6225
- const entry2 = entries[0];
6226
- if (!entry2)
6278
+ const entry = entries[0];
6279
+ if (!entry)
6227
6280
  return { state: "NONE", number: null };
6228
- return { state: entry2.state, number: entry2.number };
6281
+ return { state: entry.state, number: entry.number };
6229
6282
  }
6230
6283
  function main() {
6231
6284
  const branch = process.env.BRANCH || git(["rev-parse", "--abbrev-ref", "HEAD"]);