@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.
Files changed (144) hide show
  1. package/README.md +6 -4
  2. package/dist/checks/bin/check-body-bare-digits.js +262 -201
  3. package/dist/checks/bin/check-branch-topology.js +70 -23
  4. package/dist/checks/bin/check-brief-shape.js +262 -201
  5. package/dist/checks/bin/check-changeset-coverage.js +94 -16
  6. package/dist/checks/bin/check-ci-shard-coverage.js +3 -0
  7. package/dist/checks/bin/check-closes-n.js +157 -40
  8. package/dist/checks/bin/check-coherence.js +365 -251
  9. package/dist/checks/bin/check-dispatch-readiness.js +3654 -469
  10. package/dist/checks/bin/check-doc-claims.js +262 -201
  11. package/dist/checks/bin/check-doc-coverage-push.js +272 -202
  12. package/dist/checks/bin/check-doc-coverage.js +272 -202
  13. package/dist/checks/bin/check-doctrine-no-procedures.js +262 -201
  14. package/dist/checks/bin/check-doctrine-portability.js +262 -201
  15. package/dist/checks/bin/check-evidence-fresh.js +10138 -2126
  16. package/dist/checks/bin/check-exec-bits.js +3 -0
  17. package/dist/checks/bin/check-first-push-dispatch.js +330 -230
  18. package/dist/checks/bin/check-issue-milestone-attach.js +94 -16
  19. package/dist/checks/bin/check-issue-objectives-numbering.js +262 -201
  20. package/dist/checks/bin/check-issue-parts-coverage.js +94 -16
  21. package/dist/checks/bin/check-issue-surface-globs.js +1062 -242
  22. package/dist/checks/bin/check-issue-title-grammar.js +21 -5
  23. package/dist/checks/bin/check-no-disk-state.js +5 -1
  24. package/dist/checks/bin/check-pr-premise-reassert.js +22 -2
  25. package/dist/checks/bin/check-pr-report-density.js +5 -1
  26. package/dist/checks/bin/check-principal-test-plan-wait.js +282 -207
  27. package/dist/checks/bin/check-quoted-command.js +262 -201
  28. package/dist/checks/bin/check-reader-resolvable-prose.js +262 -201
  29. package/dist/checks/bin/check-registry-gates.js +131 -34
  30. package/dist/checks/bin/check-retired-vocabulary.js +262 -201
  31. package/dist/checks/bin/check-review-gate.js +262 -201
  32. package/dist/checks/bin/check-single-plan-pr.js +5 -1
  33. package/dist/checks/bin/check-surface-scope.js +136 -38
  34. package/dist/checks/bin/check-test-plan.js +282 -207
  35. package/dist/checks/bin/check-token-collection-wired.js +3 -0
  36. package/dist/checks/bin/check-workspace-escape.js +3 -0
  37. package/dist/checks/bin/verify-coherence.js +237 -148
  38. package/dist/checks/bin/verify-dispatch.js +870 -66
  39. package/dist/checks/bin/verify-docs.js +13 -6
  40. package/dist/harness.js +57 -10
  41. package/dist/index.js +16670 -7196
  42. package/dist/lib/pre-push-cache-test-run.js +4488 -2170
  43. package/dist/lib/pre-push-changed-files.js +251 -12
  44. package/dist/lib/pre-push-mode.js +69 -19
  45. package/dist/lib/pre-push-progress-dir.js +10265 -2853
  46. package/dist/lib/pre-push-record-tests.js +67 -19
  47. package/dist/lib/pre-push-select-tests.js +520 -222
  48. package/dist/lib/push-progress-observer.js +9176 -1757
  49. package/dist/process.js +2 -0
  50. package/dist/programs/archive.js +8948 -1547
  51. package/dist/programs/audit.js +9176 -1772
  52. package/dist/programs/check.js +9248 -1845
  53. package/dist/programs/commit-msg.js +8984 -1583
  54. package/dist/programs/dev-review-loop.js +15621 -7626
  55. package/dist/programs/dispatch.js +9977 -2726
  56. package/dist/programs/log-emit.js +9011 -1660
  57. package/dist/programs/log-selftest.js +8908 -1507
  58. package/dist/programs/log-send.js +9081 -1594
  59. package/dist/programs/pr-report.js +9477 -1820
  60. package/dist/programs/pr-snapshot.js +8916 -1515
  61. package/dist/programs/pr-verify-evidence.js +9482 -1825
  62. package/dist/programs/pr.js +11773 -4082
  63. package/dist/programs/review-post.js +11141 -3496
  64. package/dist/programs/review-status.js +8997 -1533
  65. package/dist/programs/run-engine.js +22149 -18798
  66. package/dist/programs/sync.js +9030 -1629
  67. package/dist/programs/task-brief.js +10234 -1827
  68. package/dist/programs/task-sweep.js +9267 -1621
  69. package/dist/programs/task-tools-serve.js +77141 -16659
  70. package/dist/programs/tokens.js +8966 -1565
  71. package/dist/programs/waiver.js +8983 -1582
  72. package/dist/types/harness/kernel/dev-process-socket/loader/load-process.d.ts +1 -1
  73. package/dist/types/harness/processes/vinaya-strict/tools/legacy-markers.d.ts +8 -0
  74. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/brief-validation.d.ts +17 -10
  75. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/objectives.d.ts +5 -6
  76. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/premise-check.d.ts +14 -0
  77. package/dist/vinaya-strict/checks/registry.ts +2 -2
  78. package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +8 -0
  79. package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +1 -1
  80. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +2 -2
  81. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +30 -20
  82. package/dist/vinaya-strict/executing/developer/reference.md +5 -3
  83. package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +29 -7
  84. package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +4 -4
  85. package/dist/vinaya-strict/integration/process/process-integration.ts +5 -1
  86. package/dist/vinaya-strict/process.yaml +6 -1
  87. package/dist/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  88. package/dist/vinaya-strict/thinking/plan-reviewer/grants.yaml +19 -0
  89. package/dist/vinaya-strict/thinking/plan-reviewer/output.schema.json +388 -0
  90. package/dist/vinaya-strict/thinking/planner/doctrine.md +4 -1
  91. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +10 -2
  92. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +5 -1
  93. package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +198 -34
  94. package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +120 -193
  95. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +629 -15
  96. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +726 -62
  97. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +505 -5
  98. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +636 -21
  99. package/package.json +3 -2
  100. package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
  101. package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
  102. package/studio-standalone/apps/vinaya-studio/.next/prerender-manifest.json +3 -3
  103. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  104. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
  105. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
  106. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  107. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  108. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  109. package/studio-standalone/apps/vinaya-studio/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/.next/server/app/milestones/page_client-reference-manifest.js +1 -1
  111. package/studio-standalone/apps/vinaya-studio/.next/server/app/page_client-reference-manifest.js +1 -1
  112. package/studio-standalone/apps/vinaya-studio/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  113. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/209.js +2 -2
  114. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/951.js +1 -1
  115. package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
  116. package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
  117. package/studio-standalone/apps/vinaya-studio/.next/server/preview-props.json +3 -3
  118. package/studio-standalone/apps/vinaya-studio/.next/server/server-reference-manifest.json +1 -1
  119. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-c365f0ef8268ad13.js +1 -0
  120. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/19-aa314f13784dcc58.js +4 -0
  121. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{layout-dfa2186095e797bd.js → layout-f038e8deecb2bf5f.js} +1 -1
  122. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  123. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{page-6ae258f663623b2a.js → page-7a06aa3cdd046fa8.js} +1 -1
  124. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  125. package/studio-standalone/apps/vinaya-studio/.next/static/css/8eb5ed5b65b9692e.css +1 -0
  126. package/studio-standalone/apps/vinaya-studio/log-follow.mjs +708 -93
  127. package/studio-standalone/apps/vinaya-studio/log-sync-folder-source.mjs +699 -84
  128. package/studio-standalone/apps/vinaya-studio/studio-server.mjs +4692 -3116
  129. package/vinaya-strict/artifacts/templates/brief-template.md +6 -0
  130. package/vinaya-strict/artifacts/templates/issue-rationale-template.md +7 -3
  131. package/vinaya-strict/artifacts/templates/pr-report-template.md +1 -1
  132. package/vinaya-strict/doctrine/contracts/planner-developer.md +4 -3
  133. package/vinaya-strict/doctrine/enforcement.md +4 -4
  134. package/vinaya-strict/doctrine/roles/principal.md +1 -1
  135. package/vinaya-strict/doctrine/state-machine.md +7 -2
  136. package/vinaya-strict/executing/developer/reference.md +5 -3
  137. package/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  138. package/vinaya-strict/thinking/planner/doctrine.md +4 -1
  139. package/vinaya-strict/thinking/planner/reference.md +30 -9
  140. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-23bea4cac9687151.js +0 -1
  141. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/853-1d5548ff3a55a75f.js +0 -4
  142. package/studio-standalone/apps/vinaya-studio/.next/static/css/fb16828fc3128d4c.css +0 -1
  143. /package/studio-standalone/apps/vinaya-studio/.next/static/{_r9iZDxlkoek85d_3oaxL → bJrgAp9Kl4JsCUYkeAYez}/_buildManifest.js +0 -0
  144. /package/studio-standalone/apps/vinaya-studio/.next/static/{_r9iZDxlkoek85d_3oaxL → bJrgAp9Kl4JsCUYkeAYez}/_ssgManifest.js +0 -0
@@ -93,6 +93,7 @@ var DOCTRINE_MAP = [
93
93
  { key: "roles/developer.md", source: "executing/developer/doctrine.md", role: "developer", ships: true },
94
94
  { key: "roles/developer/reference.md", source: "executing/developer/reference.md", ships: true },
95
95
  { key: "roles/operator.md", source: "executing/operator/doctrine.md", role: "operator", ships: true },
96
+ { key: "roles/plan-reviewer.md", source: "thinking/plan-reviewer/doctrine.md", role: "plan-reviewer", ships: true },
96
97
  { key: "roles/planner.md", source: "thinking/planner/doctrine.md", role: "planner", ships: true },
97
98
  { key: "roles/planner/reference.md", source: "thinking/planner/reference.md", ships: true },
98
99
  { key: "roles/principal.md", source: "doctrine/roles/principal.md", role: "principal", ships: true },
@@ -1246,6 +1247,7 @@ var LOOP_PAUSED_MARKER = commentMarkerFamily("loop:paused");
1246
1247
  var LOOP_UNPUSHED_WORK_RESUME_MARKER = commentMarkerFamily("loop:unpushed-work-resume");
1247
1248
  var PRINCIPAL_RULING_MARKER = commentMarkerFamily("principal:ruling");
1248
1249
  var OBJECTIVES_VERSION_MARKER = commentMarkerFamily("objectives");
1250
+ var DOCUMENTATION_EDIT_MARKER = commentMarkerFamily("documentation");
1249
1251
  var DEFERRED_FINDINGS_MARKER = commentMarkerFamily("deferred-findings");
1250
1252
  var COMMENT_MARKER_PREFIX_CURRENT = COMMENT_MARKER_PREFIX.current;
1251
1253
  var COMMENT_MARKER_PREFIXES = [COMMENT_MARKER_PREFIX.current, COMMENT_MARKER_PREFIX.old];
@@ -1940,7 +1942,8 @@ function isMechanicallyNeutralDiff(diffText, path) {
1940
1942
  }
1941
1943
  return sawChange;
1942
1944
  }
1943
- function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive, getDiff) {
1945
+ var DOC_NEUTRAL_OWED_PREFIX = "C5 doc-neutral-owed:";
1946
+ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive, getDiff, bodyGiven = true) {
1944
1947
  const out = { errors: [], notes: [] };
1945
1948
  if (docOwnersContent === null)
1946
1949
  return out;
@@ -1980,19 +1983,23 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
1980
1983
  }
1981
1984
  if (changed.includes(pointerPath))
1982
1985
  continue;
1986
+ const evidenced = () => getDiff !== undefined && matchedFiles.every((f) => {
1987
+ const diff = getDiff(f);
1988
+ return diff !== null && isMechanicallyNeutralDiff(diff, f);
1989
+ });
1983
1990
  const declared = neutrals.find((n) => n.surface === b.pointer);
1984
1991
  if (declared) {
1985
- const evidenced = getDiff !== undefined && matchedFiles.every((f) => {
1986
- const diff = getDiff(f);
1987
- return diff !== null && isMechanicallyNeutralDiff(diff, f);
1988
- });
1989
- if (evidenced) {
1992
+ if (evidenced()) {
1990
1993
  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.`);
1991
1994
  continue;
1992
1995
  }
1993
1996
  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.`);
1994
1997
  continue;
1995
1998
  }
1999
+ if (!bodyGiven && evidenced()) {
2000
+ 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>\`.`);
2001
+ continue;
2002
+ }
1996
2003
  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.`);
1997
2004
  }
1998
2005
  return out;
package/dist/harness.js CHANGED
@@ -6999,8 +6999,8 @@ function parseOwnerRepo(value) {
6999
6999
  }
7000
7000
  // ../../harness/kernel/dev-process-socket/loader/load-process.ts
7001
7001
  import { createHash } from "node:crypto";
7002
- import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
7003
- import { isAbsolute, join, relative, resolve } from "node:path";
7002
+ import { closeSync, constants, existsSync, lstatSync, openSync, readdirSync, readFileSync } from "node:fs";
7003
+ import { isAbsolute, join, relative, resolve, sep } from "node:path";
7004
7004
 
7005
7005
  // ../../node_modules/yaml/dist/index.js
7006
7006
  var composer = require_composer();
@@ -7148,21 +7148,63 @@ function resolveInside(folder, declared, field) {
7148
7148
  if (isAbsolute(declared) || rel === ".." || rel.startsWith("../") || isAbsolute(rel)) {
7149
7149
  throw new ProcessLoadError("declared-path-escapes", `${field} "${declared}" escapes the process folder`, field);
7150
7150
  }
7151
+ const subject = `${field} "${declared}"`;
7152
+ let at = folder;
7153
+ for (const segment of rel.split(sep).filter((part) => part !== "")) {
7154
+ at = join(at, segment);
7155
+ const stats = lstatOrUndefined(at);
7156
+ if (stats === undefined)
7157
+ break;
7158
+ if (stats.isSymbolicLink())
7159
+ throw symlinkRefusal(folder, at, subject, field);
7160
+ }
7151
7161
  if (!existsSync(resolved)) {
7152
- throw new ProcessLoadError("declared-path-missing", `${field} "${declared}" does not exist`, field);
7162
+ throw new ProcessLoadError("declared-path-missing", `${subject} does not exist`, field);
7153
7163
  }
7164
+ filesUnder(folder, resolved, subject, field);
7154
7165
  return resolved;
7155
7166
  }
7156
- function filesUnder(path) {
7157
- if (!statSync(path).isDirectory())
7167
+ function lstatOrUndefined(path) {
7168
+ try {
7169
+ return lstatSync(path);
7170
+ } catch (error) {
7171
+ const code = error.code;
7172
+ if (code === "ENOENT" || code === "ENOTDIR")
7173
+ return;
7174
+ throw error;
7175
+ }
7176
+ }
7177
+ function symlinkRefusal(folder, link, subject, field) {
7178
+ return new ProcessLoadError("declared-path-symlink", `${subject}: "${relative(folder, link)}" is a symbolic link; a process folder's declared inputs are real files and folders inside it`, field);
7179
+ }
7180
+ function filesUnder(folder, path, subject = "a declared folder", field) {
7181
+ const stats = lstatSync(path);
7182
+ if (stats.isSymbolicLink())
7183
+ throw symlinkRefusal(folder, path, subject, field);
7184
+ if (!stats.isDirectory())
7158
7185
  return [path];
7159
- return readdirSync(path).sort().flatMap((entry) => filesUnder(join(path, entry)));
7186
+ return readdirSync(path).sort().flatMap((entry) => filesUnder(folder, join(path, entry), subject, field));
7187
+ }
7188
+ function readWithoutFollowing(folder, file, subject) {
7189
+ let descriptor;
7190
+ try {
7191
+ descriptor = openSync(file, constants.O_RDONLY | constants.O_NOFOLLOW);
7192
+ } catch (error) {
7193
+ if (error.code === "ELOOP")
7194
+ throw symlinkRefusal(folder, file, subject);
7195
+ throw error;
7196
+ }
7197
+ try {
7198
+ return readFileSync(descriptor);
7199
+ } finally {
7200
+ closeSync(descriptor);
7201
+ }
7160
7202
  }
7161
7203
  function pin(folder, processFile, declared) {
7162
- const files = [processFile, ...declared.flatMap(filesUnder)];
7204
+ const files = [processFile, ...declared.flatMap((path) => filesUnder(folder, path))];
7163
7205
  const hash = createHash("sha256");
7164
7206
  for (const file of [...new Set(files)].sort()) {
7165
- const content = readFileSync(file);
7207
+ const content = readWithoutFollowing(folder, file, "a declared file");
7166
7208
  hash.update(`${relative(folder, file)}\x00${content.length}\x00`);
7167
7209
  hash.update(content);
7168
7210
  }
@@ -7180,13 +7222,18 @@ function defaultFlowKey(identity) {
7180
7222
  function loadProcess(folderPath, options = {}) {
7181
7223
  const folder = resolve(folderPath);
7182
7224
  const processFile = join(folder, PROCESS_FILE);
7183
- if (!existsSync(processFile)) {
7225
+ const processFileStats = lstatOrUndefined(processFile);
7226
+ if (processFileStats === undefined) {
7184
7227
  throw new ProcessLoadError("missing-process-file", `${PROCESS_FILE} not found in ${folder}`);
7185
7228
  }
7229
+ if (processFileStats.isSymbolicLink())
7230
+ throw symlinkRefusal(folder, processFile, PROCESS_FILE);
7186
7231
  let raw;
7187
7232
  try {
7188
- raw = $parse(readFileSync(processFile, "utf8"));
7233
+ raw = $parse(readWithoutFollowing(folder, processFile, PROCESS_FILE).toString("utf8"));
7189
7234
  } catch (error) {
7235
+ if (error instanceof ProcessLoadError)
7236
+ throw error;
7190
7237
  throw new ProcessLoadError("unparseable-yaml", `${PROCESS_FILE} is not valid YAML: ${error.message}`);
7191
7238
  }
7192
7239
  const result = processSchema.safeParse(raw);