@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
|
@@ -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
|
-
|
|
327
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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";
|