baro-ai 0.133.2 → 0.133.3
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/dist/cli.mjs +399 -287
- package/dist/cli.mjs.map +1 -1
- package/dist/runner.mjs +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -30070,7 +30070,7 @@ var require_cross_spawn = __commonJS({
|
|
|
30070
30070
|
|
|
30071
30071
|
// ../baro-memory/dist/vectra-store.js
|
|
30072
30072
|
import { LocalIndex } from "vectra";
|
|
30073
|
-
import { readFileSync as readFileSync18, writeFileSync as writeFileSync9, mkdirSync as mkdirSync12, existsSync as existsSync17, renameSync as renameSync5, rmSync as rmSync5, readdirSync as
|
|
30073
|
+
import { readFileSync as readFileSync18, writeFileSync as writeFileSync9, mkdirSync as mkdirSync12, existsSync as existsSync17, renameSync as renameSync5, rmSync as rmSync5, readdirSync as readdirSync12, statSync as statSync8, lstatSync as lstatSync8 } from "fs";
|
|
30074
30074
|
import { join as join29 } from "path";
|
|
30075
30075
|
import { tmpdir as tmpdir9, homedir as homedir7 } from "os";
|
|
30076
30076
|
async function createMemoryStore(config2) {
|
|
@@ -30121,7 +30121,7 @@ function pruneOldSessions(sessionsDir) {
|
|
|
30121
30121
|
if (!existsSync17(sessionsDir))
|
|
30122
30122
|
return;
|
|
30123
30123
|
const now = Date.now();
|
|
30124
|
-
for (const entry of
|
|
30124
|
+
for (const entry of readdirSync12(sessionsDir)) {
|
|
30125
30125
|
if (!entry.startsWith("run-"))
|
|
30126
30126
|
continue;
|
|
30127
30127
|
const entryPath = join29(sessionsDir, entry);
|
|
@@ -71364,12 +71364,12 @@ function extractStderr(e2) {
|
|
|
71364
71364
|
|
|
71365
71365
|
// ../baro-orchestrator/src/integration/dependency-materializer.ts
|
|
71366
71366
|
import { createHash as createHash7 } from "crypto";
|
|
71367
|
-
import { existsSync as existsSync11, lstatSync as lstatSync3, readdirSync as
|
|
71367
|
+
import { existsSync as existsSync11, lstatSync as lstatSync3, readdirSync as readdirSync5, readFileSync as readFileSync11, unlinkSync as unlinkSync2 } from "fs";
|
|
71368
71368
|
import { homedir as homedir4 } from "os";
|
|
71369
71369
|
import { join as join16, relative as relative6, resolve as resolve9 } from "path";
|
|
71370
71370
|
|
|
71371
71371
|
// ../baro-orchestrator/src/verification/verify.ts
|
|
71372
|
-
import { existsSync as existsSync10, lstatSync as lstatSync2, readdirSync as
|
|
71372
|
+
import { existsSync as existsSync10, lstatSync as lstatSync2, readdirSync as readdirSync4, readFileSync as readFileSync10, realpathSync as realpathSync6, statSync as statSync5 } from "fs";
|
|
71373
71373
|
import { isAbsolute as isAbsolute4, join as join14, relative as relative5, resolve as resolve8, sep as sep3 } from "path";
|
|
71374
71374
|
|
|
71375
71375
|
// ../baro-orchestrator/src/harness/liveness.ts
|
|
@@ -71572,222 +71572,20 @@ function cargoEnvFor(hostRoot, env) {
|
|
|
71572
71572
|
|
|
71573
71573
|
// ../baro-orchestrator/src/verification/change-scope.ts
|
|
71574
71574
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
71575
|
-
import { existsSync as
|
|
71576
|
-
import { basename as
|
|
71577
|
-
var JAVASCRIPT_TOOLS = /* @__PURE__ */ new Set(["npm", "pnpm", "yarn", "corepack", "node", "npx", "bun"]);
|
|
71578
|
-
var JAVASCRIPT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
71579
|
-
".js",
|
|
71580
|
-
".jsx",
|
|
71581
|
-
".ts",
|
|
71582
|
-
".tsx",
|
|
71583
|
-
".mjs",
|
|
71584
|
-
".cjs",
|
|
71585
|
-
".mts",
|
|
71586
|
-
".cts",
|
|
71587
|
-
".vue",
|
|
71588
|
-
".svelte",
|
|
71589
|
-
".astro",
|
|
71590
|
-
".css",
|
|
71591
|
-
".scss",
|
|
71592
|
-
".sass",
|
|
71593
|
-
".less"
|
|
71594
|
-
]);
|
|
71595
|
-
var JAVASCRIPT_ROOT_FILES = /* @__PURE__ */ new Set([
|
|
71596
|
-
"package.json",
|
|
71597
|
-
"package-lock.json",
|
|
71598
|
-
"npm-shrinkwrap.json",
|
|
71599
|
-
"pnpm-lock.yaml",
|
|
71600
|
-
"pnpm-workspace.yaml",
|
|
71601
|
-
"yarn.lock",
|
|
71602
|
-
".yarnrc",
|
|
71603
|
-
".yarnrc.yml",
|
|
71604
|
-
".npmrc",
|
|
71605
|
-
".nvmrc",
|
|
71606
|
-
".node-version",
|
|
71607
|
-
"bun.lockb",
|
|
71608
|
-
"bun.lock"
|
|
71609
|
-
]);
|
|
71610
|
-
var RUST_FILES = /* @__PURE__ */ new Set([
|
|
71611
|
-
"Cargo.toml",
|
|
71612
|
-
"Cargo.lock",
|
|
71613
|
-
"build.rs",
|
|
71614
|
-
"rust-toolchain",
|
|
71615
|
-
"rust-toolchain.toml",
|
|
71616
|
-
"rustfmt.toml",
|
|
71617
|
-
".rustfmt.toml",
|
|
71618
|
-
"clippy.toml",
|
|
71619
|
-
".clippy.toml"
|
|
71620
|
-
]);
|
|
71621
|
-
var GO_FILES = /* @__PURE__ */ new Set(["go.mod", "go.sum", "go.work", "go.work.sum"]);
|
|
71622
|
-
var JVM_EXTENSIONS = /* @__PURE__ */ new Set([".java", ".kt", ".kts", ".groovy", ".scala"]);
|
|
71623
|
-
var JVM_FILES = /* @__PURE__ */ new Set([
|
|
71624
|
-
"pom.xml",
|
|
71625
|
-
"build.gradle",
|
|
71626
|
-
"build.gradle.kts",
|
|
71627
|
-
"settings.gradle",
|
|
71628
|
-
"settings.gradle.kts",
|
|
71629
|
-
"gradle.properties",
|
|
71630
|
-
"mvnw",
|
|
71631
|
-
"mvnw.cmd",
|
|
71632
|
-
"gradlew",
|
|
71633
|
-
"gradlew.bat"
|
|
71634
|
-
]);
|
|
71635
|
-
var DOC_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".mdx", ".rst", ".adoc", ".txt"]);
|
|
71636
|
-
var DOC_FILES = /^(LICENSE|LICENCE|COPYING|NOTICE|AUTHORS|CHANGELOG|CODEOWNERS)(\..*)?$/iu;
|
|
71637
|
-
var DOC_DIRS = ["docs/", ".github/"];
|
|
71638
|
-
var NEUTRAL_FILES = /* @__PURE__ */ new Set([".gitignore", ".gitattributes", ".editorconfig", ".mailmap"]);
|
|
71639
|
-
function commandEcosystem(command) {
|
|
71640
|
-
if (command.origin === "declared" || command.preflightFailure || command.incompleteReason) {
|
|
71641
|
-
return null;
|
|
71642
|
-
}
|
|
71643
|
-
if (command.tool === "cargo") return "rust";
|
|
71644
|
-
if (command.tool === "go") return "go";
|
|
71645
|
-
if (/^(mvn|gradle) /u.test(command.label)) return "jvm";
|
|
71646
|
-
if (JAVASCRIPT_TOOLS.has(command.tool)) return "javascript";
|
|
71647
|
-
return null;
|
|
71648
|
-
}
|
|
71649
|
-
function affectedEcosystems(paths, root, javascriptDirs = javascriptPackageDirs(root)) {
|
|
71650
|
-
const affected = /* @__PURE__ */ new Set();
|
|
71651
|
-
const workspaces = javascriptDirs.map((dir) => relative(resolve3(root), resolve3(dir)).replace(/\\/gu, "/")).filter((dir) => dir !== "" && !dir.startsWith("..")).map((dir) => `${dir}/`);
|
|
71652
|
-
for (const raw of paths) {
|
|
71653
|
-
const path7 = raw.replace(/\\/gu, "/").replace(/^\.\//u, "");
|
|
71654
|
-
if (!path7) continue;
|
|
71655
|
-
const claims = claimsOf(path7, root, workspaces);
|
|
71656
|
-
if (claims.length > 0) {
|
|
71657
|
-
for (const claim of claims) affected.add(claim);
|
|
71658
|
-
continue;
|
|
71659
|
-
}
|
|
71660
|
-
if (isNeutral(path7)) continue;
|
|
71661
|
-
return "all";
|
|
71662
|
-
}
|
|
71663
|
-
return affected;
|
|
71664
|
-
}
|
|
71665
|
-
function claimsOf(path7, root, workspaces) {
|
|
71666
|
-
const name = basename5(path7);
|
|
71667
|
-
const ext = extname(name).toLowerCase();
|
|
71668
|
-
const claims = [];
|
|
71669
|
-
if (ext === ".rs" || RUST_FILES.has(name) || path7.startsWith(".cargo/") || insidePackageDir(path7, root, ["Cargo.toml"])) {
|
|
71670
|
-
claims.push("rust");
|
|
71671
|
-
}
|
|
71672
|
-
if (ext === ".go" || GO_FILES.has(name) || insidePackageDir(path7, root, ["go.mod"])) {
|
|
71673
|
-
claims.push("go");
|
|
71674
|
-
}
|
|
71675
|
-
if (JVM_EXTENSIONS.has(ext) || JVM_FILES.has(name) || path7.startsWith("gradle/") || insidePackageDir(path7, root, ["pom.xml", "build.gradle", "build.gradle.kts"])) {
|
|
71676
|
-
claims.push("jvm");
|
|
71677
|
-
}
|
|
71678
|
-
if (JAVASCRIPT_EXTENSIONS.has(ext) || JAVASCRIPT_ROOT_FILES.has(name) && !path7.includes("/") || /^tsconfig.*\.json$/u.test(name) || workspaces.some((dir) => path7.startsWith(dir))) {
|
|
71679
|
-
claims.push("javascript");
|
|
71680
|
-
}
|
|
71681
|
-
return claims;
|
|
71682
|
-
}
|
|
71683
|
-
function insidePackageDir(path7, root, manifests) {
|
|
71684
|
-
let dir = dirname3(path7);
|
|
71685
|
-
while (dir && dir !== "." && dir !== "/") {
|
|
71686
|
-
if (manifests.some((manifest) => existsSync3(join5(root, dir, manifest)))) return true;
|
|
71687
|
-
dir = dirname3(dir);
|
|
71688
|
-
}
|
|
71689
|
-
return false;
|
|
71690
|
-
}
|
|
71691
|
-
function isNeutral(path7) {
|
|
71692
|
-
const name = basename5(path7);
|
|
71693
|
-
return DOC_EXTENSIONS.has(extname(name).toLowerCase()) || DOC_FILES.test(name) || NEUTRAL_FILES.has(name) || DOC_DIRS.some((dir) => path7.startsWith(dir));
|
|
71694
|
-
}
|
|
71695
|
-
function javascriptPackageDirs(root) {
|
|
71696
|
-
try {
|
|
71697
|
-
const manifest = JSON.parse(readFileSync5(join5(root, "package.json"), "utf8"));
|
|
71698
|
-
const patterns = Array.isArray(manifest.workspaces) ? manifest.workspaces : manifest.workspaces?.packages;
|
|
71699
|
-
if (!Array.isArray(patterns)) return [];
|
|
71700
|
-
return patterns.filter((pattern) => typeof pattern === "string").map((pattern) => pattern.replace(/\/?\*.*$/u, "")).filter(Boolean).map((dir) => join5(root, dir));
|
|
71701
|
-
} catch {
|
|
71702
|
-
return [];
|
|
71703
|
-
}
|
|
71704
|
-
}
|
|
71705
|
-
function changedPathsSince(cwd, base) {
|
|
71706
|
-
const git3 = (args) => execFileSync2("git", args, {
|
|
71707
|
-
cwd,
|
|
71708
|
-
encoding: "utf8",
|
|
71709
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
71710
|
-
timeout: 15e3,
|
|
71711
|
-
maxBuffer: 16 * 1024 * 1024
|
|
71712
|
-
});
|
|
71713
|
-
try {
|
|
71714
|
-
const paths = /* @__PURE__ */ new Set();
|
|
71715
|
-
for (const line of git3(["diff", "--name-only", "-z", base]).split("\0")) {
|
|
71716
|
-
if (line) paths.add(line);
|
|
71717
|
-
}
|
|
71718
|
-
for (const line of git3(["ls-files", "--others", "--exclude-standard", "-z"]).split("\0")) {
|
|
71719
|
-
if (line) paths.add(line);
|
|
71720
|
-
}
|
|
71721
|
-
return [...paths];
|
|
71722
|
-
} catch {
|
|
71723
|
-
return null;
|
|
71724
|
-
}
|
|
71725
|
-
}
|
|
71726
|
-
function scopeCommandsToChange(commands, paths, root, env = process.env) {
|
|
71727
|
-
if (env.BARO_VERIFY_SCOPE === "0" || paths === null || paths.length === 0) {
|
|
71728
|
-
return { run: commands, notAffected: [] };
|
|
71729
|
-
}
|
|
71730
|
-
const affected = affectedEcosystems(paths, root);
|
|
71731
|
-
if (affected === "all") return { run: commands, notAffected: [] };
|
|
71732
|
-
const run2 = [];
|
|
71733
|
-
const notAffected = [];
|
|
71734
|
-
for (const command of commands) {
|
|
71735
|
-
const ecosystem = commandEcosystem(command);
|
|
71736
|
-
if (ecosystem === null || affected.has(ecosystem)) run2.push(command);
|
|
71737
|
-
else notAffected.push(command);
|
|
71738
|
-
}
|
|
71739
|
-
if (!run2.some((command) => commandEcosystem(command) !== null)) {
|
|
71740
|
-
return { run: commands, notAffected: [] };
|
|
71741
|
-
}
|
|
71742
|
-
return { run: run2, notAffected };
|
|
71743
|
-
}
|
|
71744
|
-
|
|
71745
|
-
// ../baro-orchestrator/src/verification/lockfile-guard.ts
|
|
71746
|
-
import { execFileSync as execFileSync3 } from "child_process";
|
|
71747
|
-
import { existsSync as existsSync4 } from "fs";
|
|
71748
|
-
import { join as join6 } from "path";
|
|
71749
|
-
var LOCKFILES = ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock"];
|
|
71750
|
-
function git(cwd, args) {
|
|
71751
|
-
try {
|
|
71752
|
-
return execFileSync3("git", args, {
|
|
71753
|
-
cwd,
|
|
71754
|
-
encoding: "utf8",
|
|
71755
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
71756
|
-
timeout: 15e3
|
|
71757
|
-
});
|
|
71758
|
-
} catch {
|
|
71759
|
-
return null;
|
|
71760
|
-
}
|
|
71761
|
-
}
|
|
71762
|
-
function pristineLockfiles(cwd) {
|
|
71763
|
-
const changed = git(cwd, ["status", "--porcelain", "-z", "--untracked-files=all"]);
|
|
71764
|
-
if (changed === null) return [];
|
|
71765
|
-
const paths = changed.split("\0").filter(Boolean).map((entry) => entry.slice(3));
|
|
71766
|
-
if (paths.some((path7) => path7 === "package.json" || path7.endsWith("/package.json"))) return [];
|
|
71767
|
-
return LOCKFILES.filter(
|
|
71768
|
-
(file) => existsSync4(join6(cwd, file)) && !paths.includes(file) && git(cwd, ["ls-files", "--error-unmatch", "--", file]) !== null
|
|
71769
|
-
);
|
|
71770
|
-
}
|
|
71771
|
-
function restoreLockfiles(cwd, pristine) {
|
|
71772
|
-
const restored = [];
|
|
71773
|
-
for (const file of pristine) {
|
|
71774
|
-
if (git(cwd, ["diff", "--quiet", "HEAD", "--", file]) !== null) continue;
|
|
71775
|
-
if (git(cwd, ["checkout", "HEAD", "--", file]) !== null) restored.push(file);
|
|
71776
|
-
}
|
|
71777
|
-
return restored;
|
|
71778
|
-
}
|
|
71575
|
+
import { existsSync as existsSync5, readdirSync as readdirSync3, readFileSync as readFileSync5 } from "fs";
|
|
71576
|
+
import { basename as basename7, dirname as dirname5, extname, join as join7, relative as relative2, resolve as resolve5 } from "path";
|
|
71779
71577
|
|
|
71780
71578
|
// ../baro-orchestrator/src/verification/command-cwd.ts
|
|
71781
|
-
import { existsSync as
|
|
71782
|
-
import { dirname as
|
|
71579
|
+
import { existsSync as existsSync4 } from "fs";
|
|
71580
|
+
import { dirname as dirname4, isAbsolute as isAbsolute2, join as join6, relative, resolve as resolve4, sep } from "path";
|
|
71783
71581
|
|
|
71784
71582
|
// ../baro-orchestrator/src/integration/integration-worktree.ts
|
|
71785
|
-
import { existsSync as
|
|
71583
|
+
import { existsSync as existsSync3, readdirSync as readdirSync2, realpathSync as realpathSync3, rmSync, rmdirSync } from "fs";
|
|
71786
71584
|
import { tmpdir as tmpdir2 } from "os";
|
|
71787
|
-
import { basename as
|
|
71585
|
+
import { basename as basename5, dirname as dirname3, join as join5, resolve as resolve3 } from "path";
|
|
71788
71586
|
var INTEGRATION_WORKTREE_DIRNAME = "__run";
|
|
71789
71587
|
function integrationWorktreePath(runId, repoRoot) {
|
|
71790
|
-
return
|
|
71588
|
+
return join5(
|
|
71791
71589
|
tmpdir2(),
|
|
71792
71590
|
"baro-worktrees",
|
|
71793
71591
|
runId,
|
|
@@ -71796,16 +71594,16 @@ function integrationWorktreePath(runId, repoRoot) {
|
|
|
71796
71594
|
);
|
|
71797
71595
|
}
|
|
71798
71596
|
function worktreeLeafName(repoRoot) {
|
|
71799
|
-
let name =
|
|
71597
|
+
let name = basename5(resolve3(repoRoot));
|
|
71800
71598
|
try {
|
|
71801
|
-
name =
|
|
71599
|
+
name = basename5(realpathSync3(repoRoot));
|
|
71802
71600
|
} catch {
|
|
71803
71601
|
}
|
|
71804
71602
|
return name && name !== "." && name !== ".." ? name : "repo";
|
|
71805
71603
|
}
|
|
71806
71604
|
function isIntegrationWorktreeRoot(path7) {
|
|
71807
|
-
const resolved =
|
|
71808
|
-
return
|
|
71605
|
+
const resolved = resolve3(path7);
|
|
71606
|
+
return basename5(resolved) === INTEGRATION_WORKTREE_DIRNAME || basename5(dirname3(resolved)) === INTEGRATION_WORKTREE_DIRNAME;
|
|
71809
71607
|
}
|
|
71810
71608
|
var IntegrationWorktree = class {
|
|
71811
71609
|
constructor(opts) {
|
|
@@ -71829,28 +71627,28 @@ var IntegrationWorktree = class {
|
|
|
71829
71627
|
const { goalBranch } = this.opts;
|
|
71830
71628
|
const release = await this.opts.gitGate.acquire();
|
|
71831
71629
|
try {
|
|
71832
|
-
await
|
|
71833
|
-
const hostBranchAtStart = await
|
|
71834
|
-
const hostHeadAtStart = await
|
|
71835
|
-
const startPoint = this.opts.baseRef ? await
|
|
71630
|
+
await git(["worktree", "prune"], repoRoot);
|
|
71631
|
+
const hostBranchAtStart = await git(["branch", "--show-current"], repoRoot) || null;
|
|
71632
|
+
const hostHeadAtStart = await git(["rev-parse", "HEAD"], repoRoot);
|
|
71633
|
+
const startPoint = this.opts.baseRef ? await git(["rev-parse", "--verify", `${this.opts.baseRef}^{commit}`], repoRoot) : hostHeadAtStart;
|
|
71836
71634
|
const registered = await this.isRegistered();
|
|
71837
71635
|
let reused = false;
|
|
71838
|
-
if (registered &&
|
|
71839
|
-
const branch = await
|
|
71636
|
+
if (registered && existsSync3(integrationRoot)) {
|
|
71637
|
+
const branch = await git(["branch", "--show-current"], integrationRoot).catch((error) => {
|
|
71840
71638
|
if (isRepositoryCommandTimeout(error)) throw error;
|
|
71841
71639
|
return null;
|
|
71842
71640
|
});
|
|
71843
71641
|
reused = branch === goalBranch;
|
|
71844
71642
|
}
|
|
71845
71643
|
if (!reused) {
|
|
71846
|
-
if (registered ||
|
|
71644
|
+
if (registered || existsSync3(integrationRoot)) {
|
|
71847
71645
|
await gitQuiet(["worktree", "remove", "--force", integrationRoot], repoRoot);
|
|
71848
|
-
if (
|
|
71646
|
+
if (existsSync3(integrationRoot)) {
|
|
71849
71647
|
rmSync(integrationRoot, { recursive: true, force: true });
|
|
71850
71648
|
}
|
|
71851
|
-
await
|
|
71649
|
+
await git(["worktree", "prune"], repoRoot);
|
|
71852
71650
|
}
|
|
71853
|
-
const branchExists = await
|
|
71651
|
+
const branchExists = await git(
|
|
71854
71652
|
["show-ref", "--verify", "--quiet", `refs/heads/${goalBranch}`],
|
|
71855
71653
|
repoRoot
|
|
71856
71654
|
).then(
|
|
@@ -71861,7 +71659,7 @@ var IntegrationWorktree = class {
|
|
|
71861
71659
|
}
|
|
71862
71660
|
);
|
|
71863
71661
|
if (branchExists) await this.releaseStaleHolders(goalBranch);
|
|
71864
|
-
await
|
|
71662
|
+
await git(
|
|
71865
71663
|
branchExists ? ["worktree", "add", integrationRoot, goalBranch] : ["worktree", "add", "-b", goalBranch, integrationRoot, startPoint],
|
|
71866
71664
|
repoRoot
|
|
71867
71665
|
);
|
|
@@ -71874,7 +71672,7 @@ var IntegrationWorktree = class {
|
|
|
71874
71672
|
} else {
|
|
71875
71673
|
this.log(`[git] local-only; not pushing ${goalBranch}`);
|
|
71876
71674
|
}
|
|
71877
|
-
const baseSha = await
|
|
71675
|
+
const baseSha = await git(["rev-parse", "HEAD"], integrationRoot);
|
|
71878
71676
|
this.prepared = {
|
|
71879
71677
|
integrationRoot,
|
|
71880
71678
|
baseSha,
|
|
@@ -71901,12 +71699,12 @@ var IntegrationWorktree = class {
|
|
|
71901
71699
|
try {
|
|
71902
71700
|
release = await this.opts.gitGate.acquire();
|
|
71903
71701
|
await gitQuiet(["worktree", "remove", "--force", integrationRoot], repoRoot);
|
|
71904
|
-
if (
|
|
71702
|
+
if (existsSync3(integrationRoot)) {
|
|
71905
71703
|
rmSync(integrationRoot, { recursive: true, force: true });
|
|
71906
71704
|
}
|
|
71907
71705
|
await gitQuiet(["worktree", "prune"], repoRoot);
|
|
71908
|
-
for (const dir of [
|
|
71909
|
-
if (
|
|
71706
|
+
for (const dir of [dirname3(integrationRoot), dirname3(dirname3(integrationRoot))]) {
|
|
71707
|
+
if (existsSync3(dir) && readdirSync2(dir).length === 0) rmdirSync(dir);
|
|
71910
71708
|
}
|
|
71911
71709
|
} catch (error) {
|
|
71912
71710
|
this.log(
|
|
@@ -71940,7 +71738,7 @@ var IntegrationWorktree = class {
|
|
|
71940
71738
|
let release = null;
|
|
71941
71739
|
try {
|
|
71942
71740
|
release = await this.opts.gitGate.acquire();
|
|
71943
|
-
const current = await
|
|
71741
|
+
const current = await git(["branch", "--show-current"], repoRoot);
|
|
71944
71742
|
if (!prepared.hostBranchAtStart || current !== prepared.hostBranchAtStart) {
|
|
71945
71743
|
return untouched(
|
|
71946
71744
|
"not_on_base_branch",
|
|
@@ -71959,13 +71757,13 @@ var IntegrationWorktree = class {
|
|
|
71959
71757
|
`uncommitted changes on [${paths.join(", ")}]; merge ${goalBranch} manually`
|
|
71960
71758
|
);
|
|
71961
71759
|
}
|
|
71962
|
-
const head = await
|
|
71963
|
-
const goalSha = await
|
|
71760
|
+
const head = await git(["rev-parse", "HEAD"], repoRoot);
|
|
71761
|
+
const goalSha = await git(["rev-parse", `refs/heads/${goalBranch}`], repoRoot);
|
|
71964
71762
|
if (head === goalSha) {
|
|
71965
71763
|
return untouched("up_to_date", `${current} already at ${goalBranch}`);
|
|
71966
71764
|
}
|
|
71967
71765
|
try {
|
|
71968
|
-
await
|
|
71766
|
+
await git(["merge-base", "--is-ancestor", head, goalSha], repoRoot);
|
|
71969
71767
|
} catch (error) {
|
|
71970
71768
|
if (!(error instanceof RepositoryCommandError) || error.code !== 1) throw error;
|
|
71971
71769
|
return untouched(
|
|
@@ -71973,7 +71771,7 @@ var IntegrationWorktree = class {
|
|
|
71973
71771
|
`${current} has diverged from ${goalBranch}`
|
|
71974
71772
|
);
|
|
71975
71773
|
}
|
|
71976
|
-
await
|
|
71774
|
+
await git(["merge", "--ff-only", goalSha], repoRoot);
|
|
71977
71775
|
return { kind: "fast_forwarded", from: head, to: goalSha };
|
|
71978
71776
|
} catch (error) {
|
|
71979
71777
|
return untouched("error", errMsg(error));
|
|
@@ -71989,7 +71787,7 @@ var IntegrationWorktree = class {
|
|
|
71989
71787
|
* the user's and stays, with git's own error.
|
|
71990
71788
|
*/
|
|
71991
71789
|
async releaseStaleHolders(goalBranch) {
|
|
71992
|
-
const listing = await
|
|
71790
|
+
const listing = await git(["worktree", "list", "--porcelain"], this.repoRoot);
|
|
71993
71791
|
const own = canonicalPath(this.integrationRoot);
|
|
71994
71792
|
for (const entry of listing.split(/\n\s*\n/u)) {
|
|
71995
71793
|
const lines = entry.split("\n");
|
|
@@ -71999,17 +71797,17 @@ var IntegrationWorktree = class {
|
|
|
71999
71797
|
if (canonicalPath(path7) === own || !isIntegrationWorktreeRoot(path7)) continue;
|
|
72000
71798
|
this.log(`[integration] releasing ${goalBranch} from a stopped run's worktree ${path7}`);
|
|
72001
71799
|
await gitQuiet(["worktree", "remove", "--force", path7], this.repoRoot);
|
|
72002
|
-
if (
|
|
71800
|
+
if (existsSync3(path7)) rmSync(path7, { recursive: true, force: true });
|
|
72003
71801
|
}
|
|
72004
|
-
await
|
|
71802
|
+
await git(["worktree", "prune"], this.repoRoot);
|
|
72005
71803
|
}
|
|
72006
71804
|
async isRegistered() {
|
|
72007
|
-
const listing = await
|
|
71805
|
+
const listing = await git(["worktree", "list", "--porcelain"], this.repoRoot);
|
|
72008
71806
|
const target = canonicalPath(this.integrationRoot);
|
|
72009
71807
|
return listing.split("\n").filter((line) => line.startsWith("worktree ")).some((line) => canonicalPath(line.slice("worktree ".length)) === target);
|
|
72010
71808
|
}
|
|
72011
71809
|
};
|
|
72012
|
-
async function
|
|
71810
|
+
async function git(args, cwd) {
|
|
72013
71811
|
const { stdout } = await runRepositoryCommand("git", args, { cwd });
|
|
72014
71812
|
return stdout.trim();
|
|
72015
71813
|
}
|
|
@@ -72021,12 +71819,12 @@ async function gitQuiet(args, cwd) {
|
|
|
72021
71819
|
}
|
|
72022
71820
|
}
|
|
72023
71821
|
function canonicalPath(path7) {
|
|
72024
|
-
const absolute =
|
|
71822
|
+
const absolute = resolve3(path7);
|
|
72025
71823
|
try {
|
|
72026
71824
|
return realpathSync3(absolute);
|
|
72027
71825
|
} catch {
|
|
72028
|
-
const parent =
|
|
72029
|
-
return parent === absolute ? absolute :
|
|
71826
|
+
const parent = dirname3(absolute);
|
|
71827
|
+
return parent === absolute ? absolute : join5(canonicalPath(parent), basename5(absolute));
|
|
72030
71828
|
}
|
|
72031
71829
|
}
|
|
72032
71830
|
function untouched(reason, detail) {
|
|
@@ -72055,7 +71853,7 @@ function repositoryRelativePath(root, path7) {
|
|
|
72055
71853
|
// ../baro-orchestrator/src/verification/command-cwd.ts
|
|
72056
71854
|
var RETRY_BACKOFF_MS = 2e3;
|
|
72057
71855
|
function strictlyUnder(root, candidate) {
|
|
72058
|
-
const rel =
|
|
71856
|
+
const rel = relative(root, candidate);
|
|
72059
71857
|
return rel !== "" && !rel.startsWith("..") && !isAbsolute2(rel);
|
|
72060
71858
|
}
|
|
72061
71859
|
function sameDirectory(a, b) {
|
|
@@ -72066,10 +71864,10 @@ function remappableWorktreeRoot(runCwd, candidate) {
|
|
|
72066
71864
|
const at = parts.lastIndexOf("baro-worktrees");
|
|
72067
71865
|
if (at < 0 || parts.length < at + 4) return null;
|
|
72068
71866
|
const root = parts.slice(0, at + 4).join(sep);
|
|
72069
|
-
return sameDirectory(
|
|
71867
|
+
return sameDirectory(dirname4(dirname4(root)), dirname4(dirname4(runCwd))) || !existsSync4(root) ? root : null;
|
|
72070
71868
|
}
|
|
72071
71869
|
function integrationCwdResolver(integrationRoot, repoRoot) {
|
|
72072
|
-
return () =>
|
|
71870
|
+
return () => existsSync4(integrationRoot) ? integrationRoot : repoRoot;
|
|
72073
71871
|
}
|
|
72074
71872
|
function spawnRunCwd(cwd, hostRepoRoot, resolveRunCwd) {
|
|
72075
71873
|
if (resolveRunCwd) return resolveRunCwd();
|
|
@@ -72077,8 +71875,8 @@ function spawnRunCwd(cwd, hostRepoRoot, resolveRunCwd) {
|
|
|
72077
71875
|
}
|
|
72078
71876
|
function resolveCommandCwd(runCwd, commandCwd) {
|
|
72079
71877
|
if (commandCwd === void 0) return runCwd;
|
|
72080
|
-
const resolved =
|
|
72081
|
-
const runResolved =
|
|
71878
|
+
const resolved = resolve4(commandCwd);
|
|
71879
|
+
const runResolved = resolve4(runCwd);
|
|
72082
71880
|
if (sameDirectory(runResolved, resolved) || strictlyUnder(runResolved, resolved)) {
|
|
72083
71881
|
return commandCwd;
|
|
72084
71882
|
}
|
|
@@ -72089,12 +71887,297 @@ function resolveCommandCwd(runCwd, commandCwd) {
|
|
|
72089
71887
|
}
|
|
72090
71888
|
const worktreeRoot = remappableWorktreeRoot(runCanonical, canonical);
|
|
72091
71889
|
if (worktreeRoot) {
|
|
72092
|
-
const remapped =
|
|
72093
|
-
if (
|
|
71890
|
+
const remapped = join6(runCwd, relative(worktreeRoot, canonical));
|
|
71891
|
+
if (existsSync4(remapped)) return remapped;
|
|
72094
71892
|
}
|
|
72095
71893
|
return runCwd;
|
|
72096
71894
|
}
|
|
72097
71895
|
|
|
71896
|
+
// ../baro-orchestrator/src/verification/change-scope.ts
|
|
71897
|
+
var JAVASCRIPT_TOOLS = /* @__PURE__ */ new Set(["npm", "pnpm", "yarn", "corepack", "node", "npx", "bun"]);
|
|
71898
|
+
var JAVASCRIPT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
71899
|
+
".js",
|
|
71900
|
+
".jsx",
|
|
71901
|
+
".ts",
|
|
71902
|
+
".tsx",
|
|
71903
|
+
".mjs",
|
|
71904
|
+
".cjs",
|
|
71905
|
+
".mts",
|
|
71906
|
+
".cts",
|
|
71907
|
+
".vue",
|
|
71908
|
+
".svelte",
|
|
71909
|
+
".astro",
|
|
71910
|
+
".css",
|
|
71911
|
+
".scss",
|
|
71912
|
+
".sass",
|
|
71913
|
+
".less"
|
|
71914
|
+
]);
|
|
71915
|
+
var JAVASCRIPT_ROOT_FILES = /* @__PURE__ */ new Set([
|
|
71916
|
+
"package.json",
|
|
71917
|
+
"package-lock.json",
|
|
71918
|
+
"npm-shrinkwrap.json",
|
|
71919
|
+
"pnpm-lock.yaml",
|
|
71920
|
+
"pnpm-workspace.yaml",
|
|
71921
|
+
"yarn.lock",
|
|
71922
|
+
".yarnrc",
|
|
71923
|
+
".yarnrc.yml",
|
|
71924
|
+
".npmrc",
|
|
71925
|
+
".nvmrc",
|
|
71926
|
+
".node-version",
|
|
71927
|
+
"bun.lockb",
|
|
71928
|
+
"bun.lock"
|
|
71929
|
+
]);
|
|
71930
|
+
var RUST_FILES = /* @__PURE__ */ new Set([
|
|
71931
|
+
"Cargo.toml",
|
|
71932
|
+
"Cargo.lock",
|
|
71933
|
+
"build.rs",
|
|
71934
|
+
"rust-toolchain",
|
|
71935
|
+
"rust-toolchain.toml",
|
|
71936
|
+
"rustfmt.toml",
|
|
71937
|
+
".rustfmt.toml",
|
|
71938
|
+
"clippy.toml",
|
|
71939
|
+
".clippy.toml"
|
|
71940
|
+
]);
|
|
71941
|
+
var GO_FILES = /* @__PURE__ */ new Set(["go.mod", "go.sum", "go.work", "go.work.sum"]);
|
|
71942
|
+
var JVM_EXTENSIONS = /* @__PURE__ */ new Set([".java", ".kt", ".kts", ".groovy", ".scala"]);
|
|
71943
|
+
var JVM_FILES = /* @__PURE__ */ new Set([
|
|
71944
|
+
"pom.xml",
|
|
71945
|
+
"build.gradle",
|
|
71946
|
+
"build.gradle.kts",
|
|
71947
|
+
"settings.gradle",
|
|
71948
|
+
"settings.gradle.kts",
|
|
71949
|
+
"gradle.properties",
|
|
71950
|
+
"mvnw",
|
|
71951
|
+
"mvnw.cmd",
|
|
71952
|
+
"gradlew",
|
|
71953
|
+
"gradlew.bat"
|
|
71954
|
+
]);
|
|
71955
|
+
var DOC_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".mdx", ".rst", ".adoc", ".txt"]);
|
|
71956
|
+
var DOC_FILES = /^(LICENSE|LICENCE|COPYING|NOTICE|AUTHORS|CHANGELOG|CODEOWNERS)(\..*)?$/iu;
|
|
71957
|
+
var DOC_DIRS = ["docs/", ".github/"];
|
|
71958
|
+
var NEUTRAL_FILES = /* @__PURE__ */ new Set([".gitignore", ".gitattributes", ".editorconfig", ".mailmap"]);
|
|
71959
|
+
function commandEcosystem(command) {
|
|
71960
|
+
if (command.origin === "declared" || command.preflightFailure || command.incompleteReason) {
|
|
71961
|
+
return null;
|
|
71962
|
+
}
|
|
71963
|
+
if (command.tool === "cargo") return "rust";
|
|
71964
|
+
if (command.tool === "go") return "go";
|
|
71965
|
+
if (/^(mvn|gradle) /u.test(command.label)) return "jvm";
|
|
71966
|
+
if (JAVASCRIPT_TOOLS.has(command.tool)) return "javascript";
|
|
71967
|
+
return null;
|
|
71968
|
+
}
|
|
71969
|
+
function affectedEcosystems(paths, root, javascriptDirs = javascriptPackageDirs(root)) {
|
|
71970
|
+
const affected = /* @__PURE__ */ new Set();
|
|
71971
|
+
const workspaces = javascriptDirs.map((dir) => relative2(resolve5(root), resolve5(dir)).replace(/\\/gu, "/")).filter((dir) => dir !== "" && !dir.startsWith("..")).map((dir) => `${dir}/`);
|
|
71972
|
+
for (const raw of paths) {
|
|
71973
|
+
const path7 = raw.replace(/\\/gu, "/").replace(/^\.\//u, "");
|
|
71974
|
+
if (!path7) continue;
|
|
71975
|
+
const claims = claimsOf(path7, root, workspaces);
|
|
71976
|
+
if (claims.length > 0) {
|
|
71977
|
+
for (const claim of claims) affected.add(claim);
|
|
71978
|
+
continue;
|
|
71979
|
+
}
|
|
71980
|
+
if (isNeutral(path7)) continue;
|
|
71981
|
+
return "all";
|
|
71982
|
+
}
|
|
71983
|
+
return affected;
|
|
71984
|
+
}
|
|
71985
|
+
function claimsOf(path7, root, workspaces) {
|
|
71986
|
+
const name = basename7(path7);
|
|
71987
|
+
const ext = extname(name).toLowerCase();
|
|
71988
|
+
const claims = [];
|
|
71989
|
+
if (ext === ".rs" || RUST_FILES.has(name) || path7.startsWith(".cargo/") || insidePackageDir(path7, root, ["Cargo.toml"])) {
|
|
71990
|
+
claims.push("rust");
|
|
71991
|
+
}
|
|
71992
|
+
if (ext === ".go" || GO_FILES.has(name) || insidePackageDir(path7, root, ["go.mod"])) {
|
|
71993
|
+
claims.push("go");
|
|
71994
|
+
}
|
|
71995
|
+
if (JVM_EXTENSIONS.has(ext) || JVM_FILES.has(name) || path7.startsWith("gradle/") || insidePackageDir(path7, root, ["pom.xml", "build.gradle", "build.gradle.kts"])) {
|
|
71996
|
+
claims.push("jvm");
|
|
71997
|
+
}
|
|
71998
|
+
if (JAVASCRIPT_EXTENSIONS.has(ext) || JAVASCRIPT_ROOT_FILES.has(name) && !path7.includes("/") || /^tsconfig.*\.json$/u.test(name) || workspaces.some((dir) => path7.startsWith(dir))) {
|
|
71999
|
+
claims.push("javascript");
|
|
72000
|
+
}
|
|
72001
|
+
return claims;
|
|
72002
|
+
}
|
|
72003
|
+
function insidePackageDir(path7, root, manifests) {
|
|
72004
|
+
let dir = dirname5(path7);
|
|
72005
|
+
while (dir && dir !== "." && dir !== "/") {
|
|
72006
|
+
if (manifests.some((manifest) => existsSync5(join7(root, dir, manifest)))) return true;
|
|
72007
|
+
dir = dirname5(dir);
|
|
72008
|
+
}
|
|
72009
|
+
return false;
|
|
72010
|
+
}
|
|
72011
|
+
function isNeutral(path7) {
|
|
72012
|
+
const name = basename7(path7);
|
|
72013
|
+
return DOC_EXTENSIONS.has(extname(name).toLowerCase()) || DOC_FILES.test(name) || NEUTRAL_FILES.has(name) || DOC_DIRS.some((dir) => path7.startsWith(dir));
|
|
72014
|
+
}
|
|
72015
|
+
function javascriptPackageDirs(root) {
|
|
72016
|
+
try {
|
|
72017
|
+
const manifest = JSON.parse(readFileSync5(join7(root, "package.json"), "utf8"));
|
|
72018
|
+
const patterns = Array.isArray(manifest.workspaces) ? manifest.workspaces : manifest.workspaces?.packages;
|
|
72019
|
+
if (!Array.isArray(patterns)) return [];
|
|
72020
|
+
return patterns.filter((pattern) => typeof pattern === "string").map((pattern) => pattern.replace(/\/?\*.*$/u, "")).filter(Boolean).map((dir) => join7(root, dir));
|
|
72021
|
+
} catch {
|
|
72022
|
+
return [];
|
|
72023
|
+
}
|
|
72024
|
+
}
|
|
72025
|
+
function changedPathsSince(cwd, base) {
|
|
72026
|
+
const git3 = (args) => execFileSync2("git", args, {
|
|
72027
|
+
cwd,
|
|
72028
|
+
encoding: "utf8",
|
|
72029
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
72030
|
+
timeout: 15e3,
|
|
72031
|
+
maxBuffer: 16 * 1024 * 1024
|
|
72032
|
+
});
|
|
72033
|
+
try {
|
|
72034
|
+
const paths = /* @__PURE__ */ new Set();
|
|
72035
|
+
for (const line of git3(["diff", "--name-only", "-z", base]).split("\0")) {
|
|
72036
|
+
if (line) paths.add(line);
|
|
72037
|
+
}
|
|
72038
|
+
for (const line of git3(["ls-files", "--others", "--exclude-standard", "-z"]).split("\0")) {
|
|
72039
|
+
if (line) paths.add(line);
|
|
72040
|
+
}
|
|
72041
|
+
return [...paths];
|
|
72042
|
+
} catch {
|
|
72043
|
+
return null;
|
|
72044
|
+
}
|
|
72045
|
+
}
|
|
72046
|
+
function commandsOfUntouchedPackages(commands, paths, root) {
|
|
72047
|
+
const untouched2 = /* @__PURE__ */ new Set();
|
|
72048
|
+
const packages = workspacePackages(root);
|
|
72049
|
+
if (packages.length === 0) return untouched2;
|
|
72050
|
+
const prefixes = javascriptPackageDirs(root).map((dir) => relative2(resolve5(root), resolve5(dir)).replace(/\\/gu, "/")).filter((dir) => dir !== "" && !dir.startsWith("..")).map((dir) => `${dir}/`);
|
|
72051
|
+
const touched = /* @__PURE__ */ new Set();
|
|
72052
|
+
for (const raw of paths) {
|
|
72053
|
+
const path7 = raw.replace(/\\/gu, "/").replace(/^\.\//u, "");
|
|
72054
|
+
if (!path7 || !claimsOf(path7, root, prefixes).includes("javascript")) continue;
|
|
72055
|
+
const owner = packageOf(path7, packages);
|
|
72056
|
+
if (!owner) return untouched2;
|
|
72057
|
+
touched.add(owner);
|
|
72058
|
+
}
|
|
72059
|
+
if (touched.size === 0) return untouched2;
|
|
72060
|
+
const affected = new Set(touched);
|
|
72061
|
+
for (let grew = true; grew; ) {
|
|
72062
|
+
grew = false;
|
|
72063
|
+
for (const candidate of packages) {
|
|
72064
|
+
if (affected.has(candidate)) continue;
|
|
72065
|
+
if ([...affected].some(({ name }) => name !== null && candidate.dependsOn.includes(name))) {
|
|
72066
|
+
affected.add(candidate);
|
|
72067
|
+
grew = true;
|
|
72068
|
+
}
|
|
72069
|
+
}
|
|
72070
|
+
}
|
|
72071
|
+
for (const command of commands) {
|
|
72072
|
+
if (commandEcosystem(command) !== "javascript" || command.cwd === void 0) continue;
|
|
72073
|
+
const dir = relative2(resolve5(root), resolve5(resolveCommandCwd(root, command.cwd))).replace(/\\/gu, "/");
|
|
72074
|
+
const owner = packages.find((candidate) => candidate.dir === `${dir}/`);
|
|
72075
|
+
if (owner && !affected.has(owner)) untouched2.add(command);
|
|
72076
|
+
}
|
|
72077
|
+
return untouched2;
|
|
72078
|
+
}
|
|
72079
|
+
function packageOf(path7, packages) {
|
|
72080
|
+
let owner = null;
|
|
72081
|
+
for (const candidate of packages) {
|
|
72082
|
+
if (path7.startsWith(candidate.dir) && (owner === null || candidate.dir.length > owner.dir.length)) {
|
|
72083
|
+
owner = candidate;
|
|
72084
|
+
}
|
|
72085
|
+
}
|
|
72086
|
+
return owner;
|
|
72087
|
+
}
|
|
72088
|
+
function workspacePackages(root) {
|
|
72089
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
72090
|
+
for (const prefix of javascriptPackageDirs(root)) {
|
|
72091
|
+
if (existsSync5(join7(prefix, "package.json"))) {
|
|
72092
|
+
dirs.add(prefix);
|
|
72093
|
+
continue;
|
|
72094
|
+
}
|
|
72095
|
+
try {
|
|
72096
|
+
for (const entry of readdirSync3(prefix, { withFileTypes: true })) {
|
|
72097
|
+
if (entry.isDirectory() && existsSync5(join7(prefix, entry.name, "package.json"))) {
|
|
72098
|
+
dirs.add(join7(prefix, entry.name));
|
|
72099
|
+
}
|
|
72100
|
+
}
|
|
72101
|
+
} catch {
|
|
72102
|
+
}
|
|
72103
|
+
}
|
|
72104
|
+
const packages = [];
|
|
72105
|
+
for (const dir of dirs) {
|
|
72106
|
+
try {
|
|
72107
|
+
const manifest = JSON.parse(readFileSync5(join7(dir, "package.json"), "utf8"));
|
|
72108
|
+
const dependsOn = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"].flatMap((field) => {
|
|
72109
|
+
const value = manifest[field];
|
|
72110
|
+
return value && typeof value === "object" ? Object.keys(value) : [];
|
|
72111
|
+
});
|
|
72112
|
+
packages.push({
|
|
72113
|
+
dir: `${relative2(resolve5(root), resolve5(dir)).replace(/\\/gu, "/")}/`,
|
|
72114
|
+
name: typeof manifest.name === "string" ? manifest.name : null,
|
|
72115
|
+
dependsOn
|
|
72116
|
+
});
|
|
72117
|
+
} catch {
|
|
72118
|
+
return [];
|
|
72119
|
+
}
|
|
72120
|
+
}
|
|
72121
|
+
return packages;
|
|
72122
|
+
}
|
|
72123
|
+
function scopeCommandsToChange(commands, paths, root, env = process.env, options = {}) {
|
|
72124
|
+
if (env.BARO_VERIFY_SCOPE === "0" || paths === null || paths.length === 0) {
|
|
72125
|
+
return { run: commands, notAffected: [] };
|
|
72126
|
+
}
|
|
72127
|
+
const affected = affectedEcosystems(paths, root);
|
|
72128
|
+
if (affected === "all") return { run: commands, notAffected: [] };
|
|
72129
|
+
const untouchedPackages = options.byPackage && affected.has("javascript") ? commandsOfUntouchedPackages(commands, paths, root) : /* @__PURE__ */ new Set();
|
|
72130
|
+
const run2 = [];
|
|
72131
|
+
const notAffected = [];
|
|
72132
|
+
for (const command of commands) {
|
|
72133
|
+
const ecosystem = commandEcosystem(command);
|
|
72134
|
+
if (ecosystem !== null && (!affected.has(ecosystem) || untouchedPackages.has(command))) {
|
|
72135
|
+
notAffected.push(command);
|
|
72136
|
+
} else {
|
|
72137
|
+
run2.push(command);
|
|
72138
|
+
}
|
|
72139
|
+
}
|
|
72140
|
+
if (!run2.some((command) => commandEcosystem(command) !== null)) {
|
|
72141
|
+
return { run: commands, notAffected: [] };
|
|
72142
|
+
}
|
|
72143
|
+
return { run: run2, notAffected };
|
|
72144
|
+
}
|
|
72145
|
+
|
|
72146
|
+
// ../baro-orchestrator/src/verification/lockfile-guard.ts
|
|
72147
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
72148
|
+
import { existsSync as existsSync6 } from "fs";
|
|
72149
|
+
import { join as join8 } from "path";
|
|
72150
|
+
var LOCKFILES = ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock"];
|
|
72151
|
+
function git2(cwd, args) {
|
|
72152
|
+
try {
|
|
72153
|
+
return execFileSync3("git", args, {
|
|
72154
|
+
cwd,
|
|
72155
|
+
encoding: "utf8",
|
|
72156
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
72157
|
+
timeout: 15e3
|
|
72158
|
+
});
|
|
72159
|
+
} catch {
|
|
72160
|
+
return null;
|
|
72161
|
+
}
|
|
72162
|
+
}
|
|
72163
|
+
function pristineLockfiles(cwd) {
|
|
72164
|
+
const changed = git2(cwd, ["status", "--porcelain", "-z", "--untracked-files=all"]);
|
|
72165
|
+
if (changed === null) return [];
|
|
72166
|
+
const paths = changed.split("\0").filter(Boolean).map((entry) => entry.slice(3));
|
|
72167
|
+
if (paths.some((path7) => path7 === "package.json" || path7.endsWith("/package.json"))) return [];
|
|
72168
|
+
return LOCKFILES.filter(
|
|
72169
|
+
(file) => existsSync6(join8(cwd, file)) && !paths.includes(file) && git2(cwd, ["ls-files", "--error-unmatch", "--", file]) !== null
|
|
72170
|
+
);
|
|
72171
|
+
}
|
|
72172
|
+
function restoreLockfiles(cwd, pristine) {
|
|
72173
|
+
const restored = [];
|
|
72174
|
+
for (const file of pristine) {
|
|
72175
|
+
if (git2(cwd, ["diff", "--quiet", "HEAD", "--", file]) !== null) continue;
|
|
72176
|
+
if (git2(cwd, ["checkout", "HEAD", "--", file]) !== null) restored.push(file);
|
|
72177
|
+
}
|
|
72178
|
+
return restored;
|
|
72179
|
+
}
|
|
72180
|
+
|
|
72098
72181
|
// ../baro-orchestrator/src/verification/command-timing.ts
|
|
72099
72182
|
import { createHash as createHash5, randomUUID as randomUUID3 } from "crypto";
|
|
72100
72183
|
import { mkdirSync as mkdirSync4, readFileSync as readFileSync6, realpathSync as realpathSync4, renameSync as renameSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
@@ -74146,6 +74229,13 @@ function packageManagerCommand(pm, declared, script, trailingArgs = []) {
|
|
|
74146
74229
|
}
|
|
74147
74230
|
return { tool: pm, args: ["run", script, ...trailingArgs] };
|
|
74148
74231
|
}
|
|
74232
|
+
function gateScript(manifest, gate) {
|
|
74233
|
+
const scripts = manifest?.scripts ?? {};
|
|
74234
|
+
const declared = manifest?.baro?.verification?.scripts;
|
|
74235
|
+
const override = declared && typeof declared === "object" ? declared[gate] : void 0;
|
|
74236
|
+
if (typeof override === "string" && typeof scripts[override] === "string") return override;
|
|
74237
|
+
return typeof scripts[gate] === "string" ? gate : null;
|
|
74238
|
+
}
|
|
74149
74239
|
function readPackageManifest(path7) {
|
|
74150
74240
|
try {
|
|
74151
74241
|
return JSON.parse(readFileSync10(path7, "utf8"));
|
|
@@ -74201,7 +74291,7 @@ function workspacePackageDirs(cwd, workspaces) {
|
|
|
74201
74291
|
if (!pattern.endsWith("/*") || pattern.slice(0, -2).includes("*")) continue;
|
|
74202
74292
|
const parent = join14(root, pattern.slice(0, -2));
|
|
74203
74293
|
if (!existsSync10(parent)) continue;
|
|
74204
|
-
for (const entry of
|
|
74294
|
+
for (const entry of readdirSync4(parent, { withFileTypes: true })) {
|
|
74205
74295
|
if (entry.isDirectory()) addIfPackage(join14(parent, entry.name));
|
|
74206
74296
|
}
|
|
74207
74297
|
}
|
|
@@ -74299,17 +74389,19 @@ function detectCommands(cwd) {
|
|
|
74299
74389
|
preflightFailure: `${displayCwd}/package.json is not valid JSON`
|
|
74300
74390
|
});
|
|
74301
74391
|
}
|
|
74302
|
-
for (const
|
|
74303
|
-
|
|
74304
|
-
|
|
74392
|
+
for (const gate of managerResolutionFailed ? [] : ["build", "typecheck", "test", "lint"]) {
|
|
74393
|
+
const rootScript = gateScript(manifest, gate);
|
|
74394
|
+
if (rootScript) {
|
|
74395
|
+
const command = packageManagerCommand(pm, declared, rootScript);
|
|
74305
74396
|
cmds.push({
|
|
74306
|
-
label: `${pm} run ${
|
|
74397
|
+
label: `${pm} run ${rootScript}`,
|
|
74307
74398
|
...command
|
|
74308
74399
|
});
|
|
74309
74400
|
continue;
|
|
74310
74401
|
}
|
|
74311
74402
|
for (const workspace of workspaces) {
|
|
74312
|
-
|
|
74403
|
+
const script = gateScript(workspace.manifest, gate);
|
|
74404
|
+
if (!script) continue;
|
|
74313
74405
|
const displayCwd = relative5(cwd, workspace.cwd).replace(/\\/g, "/");
|
|
74314
74406
|
const command = packageManagerCommand(pm, declared, script);
|
|
74315
74407
|
cmds.push({
|
|
@@ -74936,7 +75028,13 @@ async function verifyBuild(cwd, options = {}) {
|
|
|
74936
75028
|
const hostRepoRoot = options.hostRepoRoot ?? cwd;
|
|
74937
75029
|
const emitActivity = options.emitActivity ?? emit;
|
|
74938
75030
|
const ceilingFor = createCeilingResolver(cwd, hostRepoRoot, options.ceilingFloorMs);
|
|
74939
|
-
const scoped = options.changedSince ? scopeCommandsToChange(
|
|
75031
|
+
const scoped = options.changedSince ? scopeCommandsToChange(
|
|
75032
|
+
plan.commands,
|
|
75033
|
+
changedPathsSince(cwd, options.changedSince),
|
|
75034
|
+
cwd,
|
|
75035
|
+
process.env,
|
|
75036
|
+
{ byPackage: options.scopeByPackage === true }
|
|
75037
|
+
) : { run: plan.commands, notAffected: [] };
|
|
74940
75038
|
if (scoped.notAffected.length > 0) {
|
|
74941
75039
|
emitActivity({
|
|
74942
75040
|
type: "activity",
|
|
@@ -75269,7 +75367,7 @@ function nestedLockedPackages(root, depth = 3) {
|
|
|
75269
75367
|
if (left <= 0) return;
|
|
75270
75368
|
let entries;
|
|
75271
75369
|
try {
|
|
75272
|
-
entries =
|
|
75370
|
+
entries = readdirSync5(dir, { withFileTypes: true });
|
|
75273
75371
|
} catch {
|
|
75274
75372
|
return;
|
|
75275
75373
|
}
|
|
@@ -75343,7 +75441,7 @@ import {
|
|
|
75343
75441
|
lstatSync as lstatSync5,
|
|
75344
75442
|
mkdirSync as mkdirSync6,
|
|
75345
75443
|
readFileSync as readFileSync13,
|
|
75346
|
-
readdirSync as
|
|
75444
|
+
readdirSync as readdirSync8,
|
|
75347
75445
|
rmSync as rmSync3,
|
|
75348
75446
|
rmdirSync as rmdirSync3,
|
|
75349
75447
|
unlinkSync as unlinkSync3,
|
|
@@ -75353,7 +75451,7 @@ import { tmpdir as tmpdir4 } from "os";
|
|
|
75353
75451
|
import { join as join19, resolve as resolve11 } from "path";
|
|
75354
75452
|
|
|
75355
75453
|
// ../baro-orchestrator/src/runtime/disk-usage.ts
|
|
75356
|
-
import { lstatSync as lstatSync4, readdirSync as
|
|
75454
|
+
import { lstatSync as lstatSync4, readdirSync as readdirSync6 } from "fs";
|
|
75357
75455
|
import { join as join17 } from "path";
|
|
75358
75456
|
function diskUsage(path7) {
|
|
75359
75457
|
let stat3;
|
|
@@ -75365,7 +75463,7 @@ function diskUsage(path7) {
|
|
|
75365
75463
|
if (!stat3.isDirectory()) return stat3.size;
|
|
75366
75464
|
let names;
|
|
75367
75465
|
try {
|
|
75368
|
-
names =
|
|
75466
|
+
names = readdirSync6(path7);
|
|
75369
75467
|
} catch {
|
|
75370
75468
|
return 0;
|
|
75371
75469
|
}
|
|
@@ -75386,7 +75484,7 @@ import {
|
|
|
75386
75484
|
existsSync as existsSync12,
|
|
75387
75485
|
mkdirSync as mkdirSync5,
|
|
75388
75486
|
readFileSync as readFileSync12,
|
|
75389
|
-
readdirSync as
|
|
75487
|
+
readdirSync as readdirSync7,
|
|
75390
75488
|
rmSync as rmSync2,
|
|
75391
75489
|
rmdirSync as rmdirSync2,
|
|
75392
75490
|
symlinkSync
|
|
@@ -76550,7 +76648,7 @@ var WorktreeManager = class {
|
|
|
76550
76648
|
const scan = (rel, depth) => {
|
|
76551
76649
|
let entries;
|
|
76552
76650
|
try {
|
|
76553
|
-
entries =
|
|
76651
|
+
entries = readdirSync7(join18(root, rel) || root, { withFileTypes: true });
|
|
76554
76652
|
} catch {
|
|
76555
76653
|
return;
|
|
76556
76654
|
}
|
|
@@ -76954,7 +77052,7 @@ async function execQuiet(cmd, args, cwd) {
|
|
|
76954
77052
|
}
|
|
76955
77053
|
function rmdirIfEmpty(path7) {
|
|
76956
77054
|
try {
|
|
76957
|
-
if (
|
|
77055
|
+
if (readdirSync7(path7).length === 0) rmdirSync2(path7);
|
|
76958
77056
|
} catch {
|
|
76959
77057
|
}
|
|
76960
77058
|
}
|
|
@@ -77001,7 +77099,7 @@ function claimRunDir(runDir, pid = process.pid) {
|
|
|
77001
77099
|
} catch {
|
|
77002
77100
|
}
|
|
77003
77101
|
try {
|
|
77004
|
-
if (
|
|
77102
|
+
if (readdirSync8(runDir).length === 0) rmdirSync3(runDir);
|
|
77005
77103
|
} catch {
|
|
77006
77104
|
}
|
|
77007
77105
|
};
|
|
@@ -77140,7 +77238,7 @@ async function inspectWorktree(tree, integration) {
|
|
|
77140
77238
|
}
|
|
77141
77239
|
function listDir(path7) {
|
|
77142
77240
|
try {
|
|
77143
|
-
return
|
|
77241
|
+
return readdirSync8(path7);
|
|
77144
77242
|
} catch {
|
|
77145
77243
|
return [];
|
|
77146
77244
|
}
|
|
@@ -80100,7 +80198,7 @@ import {
|
|
|
80100
80198
|
mkdirSync as mkdirSync8,
|
|
80101
80199
|
lstatSync as lstatSync6,
|
|
80102
80200
|
readFileSync as readFileSync15,
|
|
80103
|
-
readdirSync as
|
|
80201
|
+
readdirSync as readdirSync9,
|
|
80104
80202
|
renameSync as renameSync4,
|
|
80105
80203
|
unlinkSync as unlinkSync5,
|
|
80106
80204
|
writeFileSync as writeFileSync6
|
|
@@ -82398,7 +82496,7 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
82398
82496
|
}
|
|
82399
82497
|
consumeAvailableOutbox() {
|
|
82400
82498
|
if (!existsSync14(this.outboxDir)) return;
|
|
82401
|
-
const files =
|
|
82499
|
+
const files = readdirSync9(this.outboxDir).filter((name) => name.endsWith(".json")).sort();
|
|
82402
82500
|
for (const name of files) this.consume(join20(this.outboxDir, name));
|
|
82403
82501
|
}
|
|
82404
82502
|
consume(path7) {
|
|
@@ -82555,7 +82653,7 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
82555
82653
|
return sameChallenge2(candidate, persisted) ? "duplicate" : `challenge id ${candidate.challengeId} conflicts with persisted evidence`;
|
|
82556
82654
|
}
|
|
82557
82655
|
if (existsSync14(this.challengeInflightDir)) {
|
|
82558
|
-
for (const name of
|
|
82656
|
+
for (const name of readdirSync9(this.challengeInflightDir)) {
|
|
82559
82657
|
if (!name.endsWith(".json")) continue;
|
|
82560
82658
|
try {
|
|
82561
82659
|
const retained = this.readInflightChallenge(
|
|
@@ -82595,7 +82693,7 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
82595
82693
|
}
|
|
82596
82694
|
publishAvailableInflightChallenges() {
|
|
82597
82695
|
if (!existsSync14(this.challengeInflightDir)) return;
|
|
82598
|
-
const files =
|
|
82696
|
+
const files = readdirSync9(this.challengeInflightDir).filter((name) => name.endsWith(".json")).sort();
|
|
82599
82697
|
for (const name of files) {
|
|
82600
82698
|
try {
|
|
82601
82699
|
this.publishInflightChallenge(
|
|
@@ -82651,7 +82749,7 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
82651
82749
|
});
|
|
82652
82750
|
}
|
|
82653
82751
|
if (!existsSync14(this.challengeInflightDir)) return;
|
|
82654
|
-
const files =
|
|
82752
|
+
const files = readdirSync9(this.challengeInflightDir).filter((name) => name.endsWith(".json")).sort();
|
|
82655
82753
|
for (const name of files) {
|
|
82656
82754
|
const path7 = join20(this.challengeInflightDir, name);
|
|
82657
82755
|
try {
|
|
@@ -94593,7 +94691,7 @@ function importAliases() {
|
|
|
94593
94691
|
}
|
|
94594
94692
|
|
|
94595
94693
|
// ../baro-orchestrator/src/harness/package-cache.ts
|
|
94596
|
-
import { mkdirSync as mkdirSync9, readdirSync as
|
|
94694
|
+
import { mkdirSync as mkdirSync9, readdirSync as readdirSync11, realpathSync as realpathSync8 } from "fs";
|
|
94597
94695
|
import { homedir as homedir5 } from "os";
|
|
94598
94696
|
import { join as join23 } from "path";
|
|
94599
94697
|
function packageCacheRoot(env = process.env) {
|
|
@@ -94634,7 +94732,7 @@ function sharedDependencyTargets(worktreeRoot, depth = 4) {
|
|
|
94634
94732
|
const scan = (dir, left) => {
|
|
94635
94733
|
let entries;
|
|
94636
94734
|
try {
|
|
94637
|
-
entries =
|
|
94735
|
+
entries = readdirSync11(dir, { withFileTypes: true });
|
|
94638
94736
|
} catch {
|
|
94639
94737
|
return;
|
|
94640
94738
|
}
|
|
@@ -111575,7 +111673,7 @@ function nativeTurnUsage(usage) {
|
|
|
111575
111673
|
}
|
|
111576
111674
|
|
|
111577
111675
|
// ../baro-orchestrator/src/verification/cargo-target-prune.ts
|
|
111578
|
-
import { lstatSync as lstatSync9, readdirSync as
|
|
111676
|
+
import { lstatSync as lstatSync9, readdirSync as readdirSync14, rmSync as rmSync8 } from "fs";
|
|
111579
111677
|
import { homedir as homedir10 } from "os";
|
|
111580
111678
|
import { join as join33 } from "path";
|
|
111581
111679
|
var CARGO_LEFTOVER_MAX_AGE_MS = 2 * 24 * 60 * 6e4;
|
|
@@ -111647,7 +111745,7 @@ function subdirs(path7) {
|
|
|
111647
111745
|
}
|
|
111648
111746
|
function list(path7) {
|
|
111649
111747
|
try {
|
|
111650
|
-
return
|
|
111748
|
+
return readdirSync14(path7);
|
|
111651
111749
|
} catch {
|
|
111652
111750
|
return [];
|
|
111653
111751
|
}
|
|
@@ -117173,7 +117271,9 @@ function summarizeGate(commands) {
|
|
|
117173
117271
|
});
|
|
117174
117272
|
}
|
|
117175
117273
|
function gateFingerprint(outcome) {
|
|
117176
|
-
return outcome.commands.map(
|
|
117274
|
+
return outcome.commands.map(
|
|
117275
|
+
({ label, passed, detail, timedOut }) => `${label}\0${timedOut ? "slow" : passed ? "1" : "0"}\0${timedOut ? "" : detail}`
|
|
117276
|
+
).join("");
|
|
117177
117277
|
}
|
|
117178
117278
|
function shouldDeliverGate(previous, next) {
|
|
117179
117279
|
if (next.commands.length === 0) return false;
|
|
@@ -117182,10 +117282,11 @@ function shouldDeliverGate(previous, next) {
|
|
|
117182
117282
|
}
|
|
117183
117283
|
function renderGateReport(outcome) {
|
|
117184
117284
|
const lines = ["[baro] Your worktree was checked after your last change:"];
|
|
117185
|
-
for (const { label, passed } of outcome.commands) {
|
|
117186
|
-
lines.push(` ${passed ? "PASS" : "FAIL"} ${label}`);
|
|
117285
|
+
for (const { label, passed, timedOut } of outcome.commands) {
|
|
117286
|
+
lines.push(` ${timedOut ? "SLOW" : passed ? "PASS" : "FAIL"} ${label}`);
|
|
117187
117287
|
}
|
|
117188
|
-
const failures = outcome.commands.filter(({ passed }) => !passed);
|
|
117288
|
+
const failures = outcome.commands.filter(({ passed, timedOut }) => !passed && !timedOut);
|
|
117289
|
+
const unfinished = outcome.commands.filter(({ timedOut }) => timedOut);
|
|
117189
117290
|
for (const failure of failures.slice(0, MAX_REPORTED_FAILURES)) {
|
|
117190
117291
|
if (!failure.detail) continue;
|
|
117191
117292
|
lines.push("", `--- ${failure.label} ---`, boundedDetail(failure.detail));
|
|
@@ -117197,6 +117298,12 @@ function renderGateReport(outcome) {
|
|
|
117197
117298
|
"",
|
|
117198
117299
|
outcome.allPassed ? "These are the project's own gates and they are green. You do not need to run them yourself." : "These are the project's own gates. You do not need to run them yourself \u2014 they are re-run and reported after every change you make."
|
|
117199
117300
|
);
|
|
117301
|
+
if (unfinished.length > 0) {
|
|
117302
|
+
lines.push(
|
|
117303
|
+
"",
|
|
117304
|
+
`SLOW means the command did not finish within this gate's time limit: it says nothing about your change. Run the part of it your change needs yourself (${unfinished.map(({ label }) => label).join(", ")}).`
|
|
117305
|
+
);
|
|
117306
|
+
}
|
|
117200
117307
|
return lines.join("\n");
|
|
117201
117308
|
}
|
|
117202
117309
|
function boundedDetail(detail) {
|
|
@@ -117214,6 +117321,14 @@ function gateCommandWasKilled(command) {
|
|
|
117214
117321
|
const tail = command.tail ?? "";
|
|
117215
117322
|
return /exited with code null/u.test(tail) || /signal: (killed|terminated)/u.test(tail);
|
|
117216
117323
|
}
|
|
117324
|
+
function gateCommandOutcomes(commands) {
|
|
117325
|
+
return commands.filter((command) => command.status !== "skipped").map((command) => ({
|
|
117326
|
+
label: command.command,
|
|
117327
|
+
passed: command.status === "passed",
|
|
117328
|
+
detail: command.status === "passed" ? "" : command.tail ?? "",
|
|
117329
|
+
...command.status === "failed" && command.timedOut ? { timedOut: true } : {}
|
|
117330
|
+
}));
|
|
117331
|
+
}
|
|
117217
117332
|
var ContinuousGateRunner = class extends BusMember {
|
|
117218
117333
|
constructor(opts) {
|
|
117219
117334
|
super();
|
|
@@ -117319,16 +117434,13 @@ var ContinuousGateRunner = class extends BusMember {
|
|
|
117319
117434
|
signal: this.controller.signal,
|
|
117320
117435
|
...this.opts.plan ? { plan: this.opts.plan } : {},
|
|
117321
117436
|
...this.opts.hostRepoRoot ? { hostRepoRoot: this.opts.hostRepoRoot } : {},
|
|
117322
|
-
changedSince: baseSha
|
|
117437
|
+
changedSince: baseSha,
|
|
117438
|
+
scopeByPackage: true
|
|
117323
117439
|
});
|
|
117324
117440
|
if (result.commands.some((command) => gateCommandWasKilled(command))) {
|
|
117325
117441
|
throw new Error("a gate command was killed before it reported");
|
|
117326
117442
|
}
|
|
117327
|
-
return result.commands
|
|
117328
|
-
label: command.command,
|
|
117329
|
-
passed: command.status === "passed",
|
|
117330
|
-
detail: command.status === "passed" ? "" : command.tail ?? ""
|
|
117331
|
-
}));
|
|
117443
|
+
return gateCommandOutcomes(result.commands);
|
|
117332
117444
|
}
|
|
117333
117445
|
deliver(agentId, outcome) {
|
|
117334
117446
|
const event = AgentTargetedMessage.create({
|