@attalabs/vinaya 0.44.1 → 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 (143) hide show
  1. package/README.md +6 -4
  2. package/dist/checks/bin/check-body-bare-digits.js +233 -195
  3. package/dist/checks/bin/check-branch-topology.js +70 -23
  4. package/dist/checks/bin/check-brief-shape.js +233 -195
  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 +128 -34
  8. package/dist/checks/bin/check-coherence.js +336 -245
  9. package/dist/checks/bin/check-dispatch-readiness.js +3623 -463
  10. package/dist/checks/bin/check-doc-claims.js +233 -195
  11. package/dist/checks/bin/check-doc-coverage-push.js +243 -196
  12. package/dist/checks/bin/check-doc-coverage.js +243 -196
  13. package/dist/checks/bin/check-doctrine-no-procedures.js +233 -195
  14. package/dist/checks/bin/check-doctrine-portability.js +233 -195
  15. package/dist/checks/bin/check-evidence-fresh.js +9983 -1995
  16. package/dist/checks/bin/check-exec-bits.js +3 -0
  17. package/dist/checks/bin/check-first-push-dispatch.js +301 -224
  18. package/dist/checks/bin/check-issue-milestone-attach.js +65 -10
  19. package/dist/checks/bin/check-issue-objectives-numbering.js +233 -195
  20. package/dist/checks/bin/check-issue-parts-coverage.js +65 -10
  21. package/dist/checks/bin/check-issue-surface-globs.js +1032 -236
  22. package/dist/checks/bin/check-issue-title-grammar.js +5 -1
  23. package/dist/checks/bin/check-no-disk-state.js +5 -1
  24. package/dist/checks/bin/check-pr-premise-reassert.js +10 -1
  25. package/dist/checks/bin/check-pr-report-density.js +5 -1
  26. package/dist/checks/bin/check-principal-test-plan-wait.js +253 -201
  27. package/dist/checks/bin/check-quoted-command.js +233 -195
  28. package/dist/checks/bin/check-reader-resolvable-prose.js +233 -195
  29. package/dist/checks/bin/check-registry-gates.js +131 -34
  30. package/dist/checks/bin/check-retired-vocabulary.js +233 -195
  31. package/dist/checks/bin/check-review-gate.js +233 -195
  32. package/dist/checks/bin/check-single-plan-pr.js +5 -1
  33. package/dist/checks/bin/check-surface-scope.js +107 -32
  34. package/dist/checks/bin/check-test-plan.js +253 -201
  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 +16617 -7187
  42. package/dist/lib/pre-push-cache-test-run.js +4487 -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 +15612 -7634
  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 +9476 -1820
  60. package/dist/programs/pr-snapshot.js +8916 -1515
  61. package/dist/programs/pr-verify-evidence.js +9481 -1825
  62. package/dist/programs/pr.js +11709 -4033
  63. package/dist/programs/review-post.js +11140 -3496
  64. package/dist/programs/review-status.js +8996 -1533
  65. package/dist/programs/run-engine.js +22031 -18759
  66. package/dist/programs/sync.js +9030 -1629
  67. package/dist/programs/task-brief.js +10185 -1821
  68. package/dist/programs/task-sweep.js +9266 -1621
  69. package/dist/programs/task-tools-serve.js +77118 -16678
  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 +3 -3
  75. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/objectives.d.ts +5 -6
  76. package/dist/vinaya-strict/checks/registry.ts +2 -2
  77. package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +8 -0
  78. package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +1 -1
  79. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +2 -2
  80. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +30 -20
  81. package/dist/vinaya-strict/executing/developer/reference.md +5 -3
  82. package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +29 -7
  83. package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +4 -4
  84. package/dist/vinaya-strict/integration/process/process-integration.ts +5 -1
  85. package/dist/vinaya-strict/process.yaml +6 -1
  86. package/dist/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  87. package/dist/vinaya-strict/thinking/plan-reviewer/grants.yaml +19 -0
  88. package/dist/vinaya-strict/thinking/plan-reviewer/output.schema.json +388 -0
  89. package/dist/vinaya-strict/thinking/planner/doctrine.md +4 -1
  90. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +10 -2
  91. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +5 -1
  92. package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +198 -34
  93. package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +120 -193
  94. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +629 -15
  95. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +726 -62
  96. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +505 -5
  97. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +636 -21
  98. package/package.json +3 -2
  99. package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
  100. package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
  101. package/studio-standalone/apps/vinaya-studio/.next/prerender-manifest.json +3 -3
  102. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  103. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
  104. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
  105. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  106. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  107. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  108. package/studio-standalone/apps/vinaya-studio/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  109. package/studio-standalone/apps/vinaya-studio/.next/server/app/milestones/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/.next/server/app/page_client-reference-manifest.js +1 -1
  111. package/studio-standalone/apps/vinaya-studio/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  112. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/209.js +2 -2
  113. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/951.js +1 -1
  114. package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
  115. package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
  116. package/studio-standalone/apps/vinaya-studio/.next/server/preview-props.json +3 -3
  117. package/studio-standalone/apps/vinaya-studio/.next/server/server-reference-manifest.json +1 -1
  118. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-c365f0ef8268ad13.js +1 -0
  119. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/19-aa314f13784dcc58.js +4 -0
  120. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{layout-dfa2186095e797bd.js → layout-f038e8deecb2bf5f.js} +1 -1
  121. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  122. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{page-6ae258f663623b2a.js → page-7a06aa3cdd046fa8.js} +1 -1
  123. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  124. package/studio-standalone/apps/vinaya-studio/.next/static/css/8eb5ed5b65b9692e.css +1 -0
  125. package/studio-standalone/apps/vinaya-studio/log-follow.mjs +708 -93
  126. package/studio-standalone/apps/vinaya-studio/log-sync-folder-source.mjs +699 -84
  127. package/studio-standalone/apps/vinaya-studio/studio-server.mjs +4692 -3116
  128. package/vinaya-strict/artifacts/templates/brief-template.md +4 -0
  129. package/vinaya-strict/artifacts/templates/issue-rationale-template.md +7 -3
  130. package/vinaya-strict/artifacts/templates/pr-report-template.md +1 -1
  131. package/vinaya-strict/doctrine/contracts/planner-developer.md +2 -1
  132. package/vinaya-strict/doctrine/enforcement.md +4 -4
  133. package/vinaya-strict/doctrine/roles/principal.md +1 -1
  134. package/vinaya-strict/doctrine/state-machine.md +7 -2
  135. package/vinaya-strict/executing/developer/reference.md +5 -3
  136. package/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  137. package/vinaya-strict/thinking/planner/doctrine.md +4 -1
  138. package/vinaya-strict/thinking/planner/reference.md +29 -8
  139. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-23bea4cac9687151.js +0 -1
  140. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/853-1d5548ff3a55a75f.js +0 -4
  141. package/studio-standalone/apps/vinaya-studio/.next/static/css/fb16828fc3128d4c.css +0 -1
  142. /package/studio-standalone/apps/vinaya-studio/.next/static/{3URbt6IPajL5OOhijN1-x → bJrgAp9Kl4JsCUYkeAYez}/_buildManifest.js +0 -0
  143. /package/studio-standalone/apps/vinaya-studio/.next/static/{3URbt6IPajL5OOhijN1-x → bJrgAp9Kl4JsCUYkeAYez}/_ssgManifest.js +0 -0
@@ -168,8 +168,26 @@ function parseHunkRanges(patch) {
168
168
  // ../../packages/test-selection/src/hunk-classes.ts
169
169
  var LOAD_ERROR_CODES = new Set([2300, 2392, 2393, 2440, 2448, 2449, 2450, 2451]);
170
170
  // ../../packages/test-selection/src/compiler-graph.ts
171
+ import { createHash } from "node:crypto";
172
+ import { readdirSync, readFileSync, realpathSync } from "node:fs";
171
173
  import { createRequire } from "node:module";
172
174
  import { dirname, join, resolve } from "node:path";
175
+
176
+ // ../../packages/test-selection/src/path-aliases.ts
177
+ function resolveAliasedSpecifier(specifier, table) {
178
+ if (!table)
179
+ return null;
180
+ let best = null;
181
+ for (const alias of table) {
182
+ if (!specifier.startsWith(alias.prefix) || specifier.length === alias.prefix.length)
183
+ continue;
184
+ if (!best || alias.prefix.length > best.prefix.length)
185
+ best = alias;
186
+ }
187
+ return best ? `${best.directory}${specifier.slice(best.prefix.length)}` : null;
188
+ }
189
+
190
+ // ../../packages/test-selection/src/compiler-graph.ts
173
191
  function loadTypeScript(repoRoot) {
174
192
  return loadTypeScriptFrom([join(repoRoot, "package.json"), import.meta.url]);
175
193
  }
@@ -195,6 +213,8 @@ function graphCompilerOptions(ts, input) {
195
213
  const paths = {};
196
214
  for (const [specifier, entry] of input.entrypoints)
197
215
  paths[specifier] = [entry];
216
+ for (const alias of input.pathAliases ?? [])
217
+ paths[`${alias.prefix}*`] = [join(input.repoRoot, alias.directory, "*")];
198
218
  return {
199
219
  baseUrl: input.repoRoot,
200
220
  paths,
@@ -231,7 +251,109 @@ function viewCompilerHost(ts, options, root, view) {
231
251
  }
232
252
  };
233
253
  }
254
+ var REUSED_GRAPH_SLOTS = 2;
255
+ var reusedGraphs = [];
256
+ var compilerIdentities = new WeakMap;
257
+ var compilersSeen = 0;
258
+ function compilerIdentity(ts) {
259
+ let id = compilerIdentities.get(ts);
260
+ if (id === undefined) {
261
+ id = ++compilersSeen;
262
+ compilerIdentities.set(ts, id);
263
+ }
264
+ return id;
265
+ }
266
+ function readRootFile(view, file) {
267
+ if (view)
268
+ return view.readFile(file);
269
+ try {
270
+ return readFileSync(file, "utf8");
271
+ } catch {
272
+ return;
273
+ }
274
+ }
275
+ function nodeModulesLinks(files) {
276
+ const folders = new Set;
277
+ for (const file of files) {
278
+ let folder = dirname(file);
279
+ while (!folders.has(folder)) {
280
+ folders.add(folder);
281
+ const parent = dirname(folder);
282
+ if (parent === folder)
283
+ break;
284
+ folder = parent;
285
+ }
286
+ }
287
+ const links = [];
288
+ const scan = (folder, scoped) => {
289
+ let entries;
290
+ try {
291
+ entries = readdirSync(folder, { withFileTypes: true });
292
+ } catch {
293
+ return;
294
+ }
295
+ entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
296
+ for (const entry of entries) {
297
+ const path = join(folder, entry.name);
298
+ if (entry.isSymbolicLink()) {
299
+ let target;
300
+ try {
301
+ target = realpathSync(path);
302
+ } catch {
303
+ target = "(dangling)";
304
+ }
305
+ links.push(`${path} -> ${target}`);
306
+ } else if (!scoped && entry.isDirectory() && entry.name.startsWith("@")) {
307
+ scan(path, true);
308
+ }
309
+ }
310
+ };
311
+ for (const folder of [...folders].sort()) {
312
+ if (folder.split("/").includes("node_modules"))
313
+ continue;
314
+ scan(join(folder, "node_modules"), false);
315
+ }
316
+ return links;
317
+ }
318
+ function reuseKey(ts, input) {
319
+ if (input.workspaceKey === undefined)
320
+ return null;
321
+ const hash = createHash("sha256");
322
+ const part = (text) => {
323
+ hash.update(`${text.length}:${text}`);
324
+ };
325
+ part(String(compilerIdentity(ts)));
326
+ part(input.repoRoot);
327
+ part(input.host ? "view" : "disk");
328
+ part(input.workspaceKey);
329
+ part(JSON.stringify([...input.entrypoints]));
330
+ part(JSON.stringify(input.pathAliases ?? []));
331
+ part(String(input.files.length));
332
+ for (const file of input.files) {
333
+ part(file);
334
+ const text = readRootFile(input.host, file);
335
+ part(text === undefined ? "(absent)" : `=${text}`);
336
+ }
337
+ if (!input.host)
338
+ for (const link of nodeModulesLinks(input.files))
339
+ part(link);
340
+ return hash.digest("hex");
341
+ }
234
342
  function buildCompilerGraph(ts, input) {
343
+ const key = reuseKey(ts, input);
344
+ if (key !== null) {
345
+ const hit = reusedGraphs.find((entry) => entry.key === key);
346
+ if (hit) {
347
+ reusedGraphs = [hit, ...reusedGraphs.filter((entry) => entry !== hit)];
348
+ return { edges: hit.edges, programMs: 0 };
349
+ }
350
+ }
351
+ const built = buildFreshCompilerGraph(ts, input);
352
+ if (key !== null)
353
+ reusedGraphs = [{ key, edges: built.edges }, ...reusedGraphs].slice(0, REUSED_GRAPH_SLOTS);
354
+ return built;
355
+ }
356
+ function buildFreshCompilerGraph(ts, input) {
235
357
  const { files, packageOfFile, packageOfBareSpecifier } = input;
236
358
  const fileSet = new Set(files);
237
359
  const options = graphCompilerOptions(ts, input);
@@ -319,12 +441,14 @@ ${specifier}`;
319
441
  if (!fileSet.has(file))
320
442
  continue;
321
443
  const ownPackage = packageOfFile(file);
444
+ const isPathLike = (specifier) => specifier.startsWith(".") || resolveAliasedSpecifier(specifier, input.pathAliases) !== null;
322
445
  const moduleScope = [];
323
446
  const reexport = [];
324
447
  const resolveWithLiteral = (specifier, into) => {
325
448
  const target = resolveToWorkspaceFile(specifier, file);
326
- if (specifier.startsWith(".")) {
327
- const literal = resolve(dirname(file), specifier);
449
+ const aliased = resolveAliasedSpecifier(specifier, input.pathAliases);
450
+ if (specifier.startsWith(".") || aliased !== null) {
451
+ const literal = aliased !== null ? resolve(input.repoRoot, aliased) : resolve(dirname(file), specifier);
328
452
  if (literal !== target && fileSet.has(literal))
329
453
  into.push(`${ALL_PREFIX}${literal}`);
330
454
  }
@@ -338,7 +462,7 @@ ${specifier}`;
338
462
  }
339
463
  };
340
464
  const coarse = (specifier, target, into) => {
341
- if (!specifier.startsWith(".")) {
465
+ if (!isPathLike(specifier)) {
342
466
  const pkg = packageOfBareSpecifier(specifier);
343
467
  if (pkg)
344
468
  into.push(`${EXTERNAL_PREFIX}${pkg}`);
@@ -405,7 +529,7 @@ ${specifier}`;
405
529
  if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier)) {
406
530
  const specifier = statement.moduleSpecifier.text;
407
531
  const target = resolveWithLiteral(specifier, moduleScope);
408
- if (!target && specifier.startsWith("."))
532
+ if (!target && isPathLike(specifier))
409
533
  continue;
410
534
  const clause = statement.importClause;
411
535
  if (!clause) {
@@ -428,7 +552,7 @@ ${specifier}`;
428
552
  continue;
429
553
  const specifier = statement.moduleSpecifier.text;
430
554
  const target = resolveWithLiteral(specifier, reexport);
431
- if (!target && specifier.startsWith("."))
555
+ if (!target && isPathLike(specifier))
432
556
  continue;
433
557
  if (!statement.exportClause || !ts.isNamedExports(statement.exportClause)) {
434
558
  coarse(specifier, target, reexport);
@@ -540,8 +664,8 @@ var CLONE_CALLS = new Set(["clone", "clone3", "fork", "vfork"]);
540
664
  var OPEN_CALLS = new Set(["open", "openat", "openat2", "creat"]);
541
665
  var GIT_PATH_READERS = new Set(["show", "cat-file", "rev-parse"]);
542
666
  // ../../packages/test-selection/src/selector.ts
543
- import { readdirSync, readFileSync, statSync } from "node:fs";
544
- import { dirname as dirname4, extname, isAbsolute as isAbsolute3, join as join4, resolve as resolve4 } from "node:path";
667
+ import { readdirSync as readdirSync2, readFileSync as readFileSync2, statSync } from "node:fs";
668
+ import { basename, dirname as dirname4, extname, isAbsolute as isAbsolute3, join as join4, resolve as resolve4 } from "node:path";
545
669
 
546
670
  // ../../packages/test-selection/src/scanner-inputs.ts
547
671
  import { dirname as dirname2, isAbsolute, join as join2, resolve as resolve2 } from "node:path";
@@ -914,7 +1038,7 @@ function diskTree(root) {
914
1038
  root,
915
1039
  readDir: (path) => {
916
1040
  try {
917
- return readdirSync(path);
1041
+ return readdirSync2(path);
918
1042
  } catch {
919
1043
  return null;
920
1044
  }
@@ -928,7 +1052,7 @@ function diskTree(root) {
928
1052
  },
929
1053
  readFile: (path) => {
930
1054
  try {
931
- return readFileSync(path, "utf8");
1055
+ return readFileSync2(path, "utf8");
932
1056
  } catch {
933
1057
  return null;
934
1058
  }
@@ -1058,6 +1182,10 @@ function resolveRelativeImport(fromFile, specifier, knownFiles) {
1058
1182
  return null;
1059
1183
  return resolveFileCandidate(resolve4(dirname4(fromFile), specifier), knownFiles);
1060
1184
  }
1185
+ function resolveAliasedImport(root, specifier, table, knownFiles) {
1186
+ const path = resolveAliasedSpecifier(specifier, table);
1187
+ return path === null ? null : resolveFileCandidate(join4(root, path), knownFiles);
1188
+ }
1061
1189
  function isBunTestScript(script) {
1062
1190
  if (!script)
1063
1191
  return true;
@@ -1113,11 +1241,108 @@ function deriveEntrypoints(dir, pkg, knownFiles) {
1113
1241
  add(".", pkg.main);
1114
1242
  return out;
1115
1243
  }
1244
+ var yamlEscapes = new Map([
1245
+ ["0", "\x00"],
1246
+ ["a", "\x07"],
1247
+ ["b", "\b"],
1248
+ ["t", "\t"],
1249
+ ["\t", "\t"],
1250
+ ["n", `
1251
+ `],
1252
+ ["v", "\v"],
1253
+ ["f", "\f"],
1254
+ ["r", "\r"],
1255
+ ["e", "\x1B"],
1256
+ [" ", " "],
1257
+ ['"', '"'],
1258
+ ["/", "/"],
1259
+ ["\\", "\\"],
1260
+ ["N", "…"],
1261
+ ["_", " "],
1262
+ ["L", "\u2028"],
1263
+ ["P", "\u2029"]
1264
+ ]);
1265
+ function decodeDoubleQuotedPattern(text) {
1266
+ let pattern = "";
1267
+ let offset = 0;
1268
+ for (const match of text.matchAll(/\\(?:x([\da-fA-F]{2})|u([\da-fA-F]{4})|U([\da-fA-F]{8})|([^\n])?)/g)) {
1269
+ pattern += text.slice(offset, match.index);
1270
+ const hex = match[1] ?? match[2] ?? match[3];
1271
+ if (hex !== undefined) {
1272
+ const codePoint = Number.parseInt(hex, 16);
1273
+ if (codePoint > 1114111)
1274
+ return null;
1275
+ pattern += String.fromCodePoint(codePoint);
1276
+ } else {
1277
+ const decoded = yamlEscapes.get(match[4] ?? "");
1278
+ if (decoded === undefined)
1279
+ return null;
1280
+ pattern += decoded;
1281
+ }
1282
+ offset = match.index + match[0].length;
1283
+ }
1284
+ return pattern + text.slice(offset);
1285
+ }
1286
+ function workspacePatternScalar(text, inline) {
1287
+ if (text.startsWith("'") || text.startsWith('"')) {
1288
+ const quoted = /^(?:'((?:[^']|'')*)'|"((?:[^"\\]|\\.)*)")/.exec(text);
1289
+ if (!quoted)
1290
+ return null;
1291
+ const pattern = quoted[1]?.replace(/''/g, "'") ?? decodeDoubleQuotedPattern(quoted[2] ?? "");
1292
+ if (pattern === null)
1293
+ return null;
1294
+ return { pattern, rest: text.slice(quoted[0].length).trimStart() };
1295
+ }
1296
+ const scalar = inline ? /^[^,[\]]*/.exec(text)?.[0] ?? "" : text;
1297
+ const comment = /(?:^|\s)#/.exec(scalar);
1298
+ const pattern = scalar.slice(0, comment?.index ?? scalar.length).trimEnd();
1299
+ if (!pattern || /:(?:\s|$)/.test(pattern) || /^(?:[[{|>]|[-?:](?:\s|$))/.test(pattern))
1300
+ return null;
1301
+ return { pattern, rest: comment ? scalar.slice(comment.index).trimStart() : text.slice(scalar.length) };
1302
+ }
1303
+ function pnpmWorkspacePatterns(content) {
1304
+ const lines = content.split(/\r?\n/);
1305
+ const index = lines.findIndex((line) => /^packages:(?:\s|$)/.test(line));
1306
+ if (index === -1)
1307
+ return [];
1308
+ const value = lines[index]?.slice("packages:".length).trim() ?? "";
1309
+ const patterns = [];
1310
+ if (value.startsWith("[")) {
1311
+ let rest = value.slice(1).trimStart();
1312
+ while (!/^\]\s*(?:#.*)?$/.test(rest)) {
1313
+ const item = workspacePatternScalar(rest, true);
1314
+ if (!item)
1315
+ return [];
1316
+ patterns.push(item.pattern);
1317
+ if (item.rest.startsWith("]"))
1318
+ rest = item.rest;
1319
+ else if (item.rest.startsWith(","))
1320
+ rest = item.rest.slice(1).trimStart();
1321
+ else
1322
+ return [];
1323
+ }
1324
+ } else if (value === "" || value.startsWith("#")) {
1325
+ for (const line of lines.slice(index + 1)) {
1326
+ if (/^\s*(?:#.*)?$/.test(line))
1327
+ continue;
1328
+ const entry = /^\s*-\s+/.exec(line);
1329
+ if (!entry)
1330
+ break;
1331
+ const item = workspacePatternScalar(line.slice(entry[0].length), false);
1332
+ if (!item || item.rest && !item.rest.startsWith("#"))
1333
+ break;
1334
+ patterns.push(item.pattern);
1335
+ }
1336
+ }
1337
+ return patterns;
1338
+ }
1116
1339
  function readWorkspacePatterns(tree) {
1117
1340
  try {
1118
1341
  const rootPkg = JSON.parse(tree.readFile(join4(tree.root, "package.json")) ?? "");
1119
1342
  const declared = Array.isArray(rootPkg.workspaces) ? rootPkg.workspaces : rootPkg.workspaces?.packages ?? [];
1120
- return declared.filter((entry) => typeof entry === "string");
1343
+ const manifestPatterns = declared.filter((entry) => typeof entry === "string");
1344
+ const pnpmPatterns = pnpmWorkspacePatterns(tree.readFile(join4(tree.root, "pnpm-workspace.yaml")) ?? "");
1345
+ return [...manifestPatterns, ...pnpmPatterns.filter((entry) => !manifestPatterns.includes(entry))];
1121
1346
  } catch {
1122
1347
  return null;
1123
1348
  }
@@ -1305,6 +1530,8 @@ function resolveSpecifierToFile(ctx, fromFile, specifier) {
1305
1530
  const knownFiles = pkgDir ? ctx.knownFilesByPkgDir.get(pkgDir) : undefined;
1306
1531
  return knownFiles ? resolveRelativeImport(fromFile, specifier, knownFiles) : null;
1307
1532
  }
1533
+ if (ctx.isAliased(specifier))
1534
+ return ctx.resolveAlias(specifier);
1308
1535
  return ctx.packageOfBareSpecifier(specifier)?.entry ?? null;
1309
1536
  }
1310
1537
  function resolveExportedName(ctx, file, name, stack) {
@@ -1353,7 +1580,7 @@ function resolveThroughTable(ctx, file, name, table, stack) {
1353
1580
  const ownHopDeps = () => {
1354
1581
  const out = new Set;
1355
1582
  for (const record of table.ownImports) {
1356
- if (record.specifier.startsWith(".")) {
1583
+ if (record.specifier.startsWith(".") || ctx.isAliased(record.specifier)) {
1357
1584
  const resolved = resolveSpecifierToFile(ctx, file, record.specifier);
1358
1585
  if (resolved)
1359
1586
  out.add(resolved);
@@ -1473,6 +1700,8 @@ function buildSelectionGraph(tree, options) {
1473
1700
  resultCache,
1474
1701
  knownFilesByPkgDir,
1475
1702
  packageDirOf: (file) => sortedPkgDirs.find((d) => file.startsWith(`${d}/`)) ?? null,
1703
+ isAliased: (specifier) => resolveAliasedSpecifier(specifier, options.pathAliases) !== null,
1704
+ resolveAlias: (specifier) => resolveAliasedImport(repoRoot, specifier, options.pathAliases, allSourceFiles),
1476
1705
  packageOfBareSpecifier: (specifier) => {
1477
1706
  const m = matchPackage(specifier);
1478
1707
  return m ? { name: m.pkg.name, entry: m.pkg.entrypoints.get(m.subpath) ?? null } : null;
@@ -1490,11 +1719,13 @@ function buildSelectionGraph(tree, options) {
1490
1719
  }
1491
1720
  }
1492
1721
  const graph = buildCompilerGraph(graphTypescript, {
1722
+ workspaceKey: JSON.stringify(packages.map((pkg) => [pkg.name, pkg.dir, tree.readFile(join4(pkg.dir, "package.json"))])),
1493
1723
  repoRoot,
1494
1724
  files: [...allSourceFiles],
1495
1725
  packageOfFile: (f) => fileToPackage.get(f) ?? null,
1496
1726
  packageOfBareSpecifier: (specifier) => matchPackage(specifier)?.pkg.name ?? null,
1497
1727
  entrypoints,
1728
+ ...options.pathAliases ? { pathAliases: options.pathAliases } : {},
1498
1729
  ...tree.host ? { host: tree.host } : {}
1499
1730
  });
1500
1731
  for (const [node, deps] of graph.edges)
@@ -1519,6 +1750,12 @@ function buildSelectionGraph(tree, options) {
1519
1750
  deps.push(resolved);
1520
1751
  continue;
1521
1752
  }
1753
+ if (ctx.isAliased(specifier)) {
1754
+ const resolved = ctx.resolveAlias(specifier);
1755
+ if (resolved)
1756
+ deps.push(resolved);
1757
+ continue;
1758
+ }
1522
1759
  const match = matchPackage(specifier);
1523
1760
  if (!match)
1524
1761
  continue;
@@ -1666,7 +1903,8 @@ function selectAffectedFiles(tree, changedFiles, options = {}) {
1666
1903
  repoTreeScanners: options.repoTreeScanners ?? depthOneDefault,
1667
1904
  spawnDetection: options.spawnDetection ?? depthOneDefault,
1668
1905
  spawnPrograms: options.spawnPrograms ?? [],
1669
- isTest: isTestFile
1906
+ isTest: isTestFile,
1907
+ ...options.pathAliases ? { pathAliases: options.pathAliases } : {}
1670
1908
  });
1671
1909
  const { packages, pkgFiles, edges, readSource } = graph;
1672
1910
  const changeFacts = changeFactsFor(graph, absChanged, options.affectedNames ?? new Map);
@@ -1827,6 +2065,7 @@ function reaches(start, edges, changed, maxDepth = Number.POSITIVE_INFINITY) {
1827
2065
  }
1828
2066
  return null;
1829
2067
  }
2068
+ var DEPENDENCY_LISTS = new Set(["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]);
1830
2069
 
1831
2070
  // ../../packages/test-selection/src/recorder.ts
1832
2071
  var RECORDER_TIME_LIMIT_MS = 15 * 60000;
@@ -1,18 +1,61 @@
1
1
  #!/usr/bin/env node
2
-
3
- // ../../harness/kernel/gates/ring0-hooks/pre-push/pre-push-mode.ts
4
- import { execFileSync as execFileSync2 } from "node:child_process";
5
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toCommonJS = (from) => {
11
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
12
+ if (entry)
13
+ return entry;
14
+ entry = __defProp({}, "__esModule", { value: true });
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (var key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(entry, key))
18
+ __defProp(entry, key, {
19
+ get: __accessProp.bind(from, key),
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ __moduleCache.set(from, entry);
24
+ return entry;
25
+ };
26
+ var __moduleCache;
27
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
28
+ var __returnValue = (v) => v;
29
+ function __exportSetter(name, newValue) {
30
+ this[name] = __returnValue.bind(null, newValue);
31
+ }
32
+ var __export = (target, all) => {
33
+ for (var name in all)
34
+ __defProp(target, name, {
35
+ get: all[name],
36
+ enumerable: true,
37
+ configurable: true,
38
+ set: __exportSetter.bind(all, name)
39
+ });
40
+ };
41
+ var __esm = (fn, res, err) => () => {
42
+ if (fn)
43
+ try {
44
+ res = fn(fn = 0);
45
+ } catch (e) {
46
+ err = [e];
47
+ }
48
+ if (err)
49
+ throw err[0];
50
+ return res;
51
+ };
52
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
6
53
 
7
54
  // ../../harness/kernel/gates/ring0-hooks/pre-push/pre-push-failed-tests.ts
8
55
  import { execFileSync } from "node:child_process";
9
56
  import { createHash } from "node:crypto";
10
57
  import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
11
58
  import { dirname, isAbsolute, join } from "node:path";
12
- var FAILED_TESTS_RECORD = "vinaya/pre-push-failed-tests.json";
13
- var LAST_PUSH_RESULT = "vinaya/pre-push-last-result.json";
14
- var SELECTION_NOTE = "vinaya/pre-push-selection.json";
15
- var TEST_SELECTION_COMPLETE = "vinaya-test-selection-complete ";
16
59
  function completedTestSelection(log, cwd, expected) {
17
60
  const completed = new Set;
18
61
  let batch = [];
@@ -123,17 +166,6 @@ function parseRecord(text) {
123
166
  return null;
124
167
  }
125
168
  }
126
- var PASSING_RECORD_VERSION = 2;
127
- var SELECTION_POLICY = {
128
- name: "pre-push-since-green",
129
- version: 1,
130
- depth: "one",
131
- testTimeoutMs: 30000,
132
- rootConfigFile: "vinaya.config.json"
133
- };
134
- var VERIFICATION_LOCKFILES = ["bun.lock", "bun.lockb", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"];
135
- var VERIFICATION_INPUT_FILES = ["vinaya.config.json", "package.json", "bunfig.toml", ...VERIFICATION_LOCKFILES];
136
- var VERIFICATION_ENV_KEYS = ["BUN_ENV", "CI", "NODE_ENV", "NODE_OPTIONS", "TZ"];
137
169
  function parsePassingRecord(text) {
138
170
  if (!text)
139
171
  return null;
@@ -374,6 +406,24 @@ function verificationInputsDirty(repoRoot) {
374
406
  const out = git(repoRoot, ["status", "--porcelain", "--", ...VERIFICATION_INPUT_FILES]);
375
407
  return out === null ? null : out !== "";
376
408
  }
409
+ var FAILED_TESTS_RECORD = "vinaya/pre-push-failed-tests.json", LAST_PUSH_RESULT = "vinaya/pre-push-last-result.json", SELECTION_NOTE = "vinaya/pre-push-selection.json", TEST_SELECTION_COMPLETE = "vinaya-test-selection-complete ", PASSING_RECORD_VERSION = 2, SELECTION_POLICY, VERIFICATION_LOCKFILES, VERIFICATION_INPUT_FILES, VERIFICATION_ENV_KEYS;
410
+ var init_pre_push_failed_tests = __esm(() => {
411
+ SELECTION_POLICY = {
412
+ name: "pre-push-since-green",
413
+ version: 1,
414
+ depth: "one",
415
+ testTimeoutMs: 30000,
416
+ rootConfigFile: "vinaya.config.json"
417
+ };
418
+ VERIFICATION_LOCKFILES = ["bun.lock", "bun.lockb", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"];
419
+ VERIFICATION_INPUT_FILES = ["vinaya.config.json", "package.json", "bunfig.toml", ...VERIFICATION_LOCKFILES];
420
+ VERIFICATION_ENV_KEYS = ["BUN_ENV", "CI", "NODE_ENV", "NODE_OPTIONS", "TZ"];
421
+ });
422
+
423
+ // ../../harness/kernel/gates/ring0-hooks/pre-push/pre-push-mode.ts
424
+ init_pre_push_failed_tests();
425
+ import { execFileSync as execFileSync2 } from "node:child_process";
426
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
377
427
 
378
428
  // ../../harness/kernel/gates/ring0-hooks/pre-push/pre-push-mode-logic.ts
379
429
  var PUSH_MODE_MARKER = "vinaya/push-mode";