@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
@@ -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, 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 execFileAsync, systemEnv, MAX_PER_PAGE = 100, MAX_PAGES = 100;
138
+ var execFileAsync, systemEnv, 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
  execFileAsync = promisify(execFile);
121
148
  systemEnv = {
@@ -815,6 +842,19 @@ function lifecycleFromIssues(issues) {
815
842
  return "planned";
816
843
  return issues.some((i) => i.state === "OPEN") ? "active" : "complete";
817
844
  }
845
+ function lifecycleFromCounts(open, total) {
846
+ if (total === 0)
847
+ return "planned";
848
+ return open > 0 ? "active" : "complete";
849
+ }
850
+ function resolveLegacyFactsFromCounts(milestone, open, total) {
851
+ if (milestone.state === "closed" && total > 0) {
852
+ return { goal: milestone.description ?? "", lifecycle: lifecycleFromCounts(open, total) };
853
+ }
854
+ return factsFromLegacyMilestone(milestone);
855
+ }
856
+ var TRANCHE_LABEL_QUERY = "vinaya/tranche:";
857
+ var ACTIVE_ISSUE_READ_CONCURRENCY = 4;
818
858
  function goalFromMilestones(milestones, slug) {
819
859
  for (const m of milestones) {
820
860
  const goal = intentGoalForSlug(m.description ?? "", slug);
@@ -842,10 +882,20 @@ function trancheSlugsFromLabels(labels) {
842
882
  }
843
883
  async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
844
884
  const read = (fetch) => options.retryFailedReads ? retryOnce(fetch) : fetch();
845
- const [milestones, labels] = await Promise.all([
885
+ const [milestones, labels, counts] = await Promise.all([
846
886
  read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
847
- read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
887
+ read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)),
888
+ read(() => ghLabelIssueCountsAsync(owner, repo, TRANCHE_LABEL_QUERY))
848
889
  ]);
890
+ const countsByLabel = new Map(counts.map((c) => [c.name, c]));
891
+ const uncounted = trancheSlugsFromLabels(labels).map((slug) => trancheLabel(slug)).filter((label) => !countsByLabel.has(label));
892
+ if (uncounted.length > 0) {
893
+ throw new Error(`the label Issue-count query returned no count for ${uncounted.join(", ")}`);
894
+ }
895
+ const lifecycleOf = (slug) => {
896
+ const c = countsByLabel.get(trancheLabel(slug));
897
+ return lifecycleFromCounts(c?.open ?? 0, c?.total ?? 0);
898
+ };
849
899
  const active = [];
850
900
  const archived = [];
851
901
  const facts = new Map;
@@ -853,33 +903,21 @@ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
853
903
  const legacyMilestoneBySlug = new Map(milestones.filter((m) => legacySlugs.has(m.title)).map((m) => [m.title, m]));
854
904
  const newPathSlugs = trancheSlugsFromLabels(labels).filter((slug) => !legacySlugs.has(slug));
855
905
  const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
856
- const uniqueLegacySlugs = [...legacySlugs];
857
- const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
858
- Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
859
- Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
860
- ]);
861
- const issuesBySlug = new Map;
862
- uniqueLegacySlugs.forEach((slug, i) => {
863
- issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
864
- });
865
- uniqueNewPathSlugs.forEach((slug, i) => {
866
- issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
867
- });
868
- uniqueLegacySlugs.forEach((slug, i) => {
906
+ for (const slug of legacySlugs) {
869
907
  const m = legacyMilestoneBySlug.get(slug);
870
908
  if (!m)
871
- return;
909
+ continue;
872
910
  const ref = { slug, goal: m.description ?? "" };
873
- const f = resolveLegacyFacts(m, legacyIssuesBySlug[i] ?? []);
911
+ const c = countsByLabel.get(trancheLabel(slug));
912
+ const f = resolveLegacyFactsFromCounts(m, c?.open ?? 0, c?.total ?? 0);
874
913
  if (f.lifecycle === "complete")
875
914
  archived.push(ref);
876
915
  else if (f.lifecycle === "active")
877
916
  active.push(ref);
878
917
  facts.set(slug, f);
879
- });
880
- uniqueNewPathSlugs.forEach((slug, i) => {
881
- const issues = newPathIssuesBySlug[i] ?? [];
882
- const lifecycle = lifecycleFromIssues(issues);
918
+ }
919
+ for (const slug of uniqueNewPathSlugs) {
920
+ const lifecycle = lifecycleOf(slug);
883
921
  const goal = goalFromMilestones(milestones, slug);
884
922
  const f = { goal, lifecycle };
885
923
  facts.set(slug, f);
@@ -887,7 +925,16 @@ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
887
925
  active.push({ slug, goal });
888
926
  else if (lifecycle === "complete")
889
927
  archived.push({ slug, goal });
890
- });
928
+ }
929
+ const issuesBySlug = new Map;
930
+ const activeSlugs = active.map((r) => r.slug);
931
+ for (let i = 0;i < activeSlugs.length; i += ACTIVE_ISSUE_READ_CONCURRENCY) {
932
+ const batch = activeSlugs.slice(i, i + ACTIVE_ISSUE_READ_CONCURRENCY);
933
+ const lists = await Promise.all(batch.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))));
934
+ batch.forEach((slug, j) => {
935
+ issuesBySlug.set(slug, lists[j] ?? []);
936
+ });
937
+ }
891
938
  return { active, archived, facts, legacySlugs, issuesBySlug };
892
939
  }
893
940
  async function retryOnce(fetch) {