baro-ai 0.133.1 → 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 +508 -320
- 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 {
|
|
@@ -91240,6 +91338,30 @@ function parseContractConflicts(value) {
|
|
|
91240
91338
|
}
|
|
91241
91339
|
return conflicts;
|
|
91242
91340
|
}
|
|
91341
|
+
function parseUnavailableChecks(value) {
|
|
91342
|
+
if (!Array.isArray(value)) return [];
|
|
91343
|
+
const seen = /* @__PURE__ */ new Set();
|
|
91344
|
+
const checks = [];
|
|
91345
|
+
for (const entry of value) {
|
|
91346
|
+
if (typeof entry !== "object" || entry === null) continue;
|
|
91347
|
+
const { criterion, reason, kind } = entry;
|
|
91348
|
+
if (kind !== "check_unavailable") continue;
|
|
91349
|
+
if (typeof criterion !== "string" || !criterion.trim() || seen.has(criterion)) continue;
|
|
91350
|
+
if (typeof reason !== "string" || !reason.trim()) continue;
|
|
91351
|
+
seen.add(criterion);
|
|
91352
|
+
checks.push({ criterion, reason: reason.trim().slice(0, MAX_CONFLICT_REASON_CHARS) });
|
|
91353
|
+
if (checks.length >= MAX_CONTRACT_CONFLICTS) break;
|
|
91354
|
+
}
|
|
91355
|
+
return checks;
|
|
91356
|
+
}
|
|
91357
|
+
function parsedConflictFields(value) {
|
|
91358
|
+
const conflicts = parseContractConflicts(value);
|
|
91359
|
+
const unavailable = parseUnavailableChecks(value);
|
|
91360
|
+
return {
|
|
91361
|
+
...conflicts.length > 0 ? { contractConflicts: conflicts } : {},
|
|
91362
|
+
...unavailable.length > 0 ? { unavailableChecks: unavailable } : {}
|
|
91363
|
+
};
|
|
91364
|
+
}
|
|
91243
91365
|
function applyContractConflicts(evaluation, criteria, enabled = CONTRACT_CONFLICTS_ENABLED) {
|
|
91244
91366
|
const conflicts = (enabled ? evaluation.contractConflicts ?? [] : []).filter(
|
|
91245
91367
|
(conflict) => criteria.includes(conflict.criterion)
|
|
@@ -91269,9 +91391,10 @@ or
|
|
|
91269
91391
|
const remediationRule = options.remediationGroups ? `
|
|
91270
91392
|
- For "fail", "remediation_groups" is required and must partition "violated_criteria" exactly once. Every group needs a concise "root_cause" and one or more exact failed criterion strings. For "pass" or "inconclusive", omit "remediation_groups".` : "";
|
|
91271
91393
|
const conflictsRule = options.contractConflicts ? `
|
|
91272
|
-
- "contract_conflicts" (optional, default []) lists criteria this story cannot satisfy as written, each as {"criterion":"exact criterion string","kind":"outside_write_surface" or "
|
|
91394
|
+
- "contract_conflicts" (optional, default []) lists criteria this story cannot satisfy as written, each as {"criterion":"exact criterion string","kind":"outside_write_surface", "contradiction" or "check_unavailable","reason":"\u2026"}. Use "outside_write_surface" only when meeting the criterion requires changing files outside the "## Write surface" Baro lists for this story, and name those files. Use "contradiction" only when no change could meet it together with another of this story's criteria, and quote that other criterion.
|
|
91273
91395
|
- A conflicted criterion is not this story's to meet: leave it out of "violated_criteria" and decide "verdict" on every other criterion. Baro moves an "outside_write_surface" criterion to a follow-up story that may change those files, and records a "contradiction" for the run-level reviews.
|
|
91274
|
-
-
|
|
91396
|
+
- A command whose runtime status reads "could not start" did not run: its tool is not installed in this worktree. That is a fact about the environment, not about the work. When the only thing a criterion lacks is a passing run of such a command, use kind "check_unavailable" and name the command; leave the criterion out of "violated_criteria". Never use it for a command that ran and failed, or when no command is marked "could not start".
|
|
91397
|
+
- Never list a criterion the story could meet within its write surface but did not, or one that merely lacks evidence: those are violations. Without a "## Write surface" section, only the contradiction and check_unavailable cases apply.` : "";
|
|
91275
91398
|
return `You are a strict acceptance-criteria evaluator. You will receive:
|
|
91276
91399
|
1. A list of acceptance criteria that must ALL be satisfied.
|
|
91277
91400
|
2. Optionally, the accepted architecture decisions the agent was bound to.
|
|
@@ -91648,6 +91771,8 @@ var MAX_FINGERPRINT_PATHS = 5e3;
|
|
|
91648
91771
|
var MAX_FINGERPRINT_FILE_BYTES = 64 * 1024 * 1024;
|
|
91649
91772
|
var MAX_FINGERPRINT_TOTAL_BYTES = 256 * 1024 * 1024;
|
|
91650
91773
|
var CRITIC_MAX_PROMPT_CHARS = 14e4;
|
|
91774
|
+
var COULD_NOT_START_STATUS = "could not start; the command's tool is not available in this worktree";
|
|
91775
|
+
var TOOL_UNAVAILABLE_ISSUE = "a verification command could not start: its tool is not available in the worktree";
|
|
91651
91776
|
var PublishedNoteCollector = class extends BusMember {
|
|
91652
91777
|
constructor(maxNotesPerStory = 6) {
|
|
91653
91778
|
super();
|
|
@@ -91768,7 +91893,8 @@ var CriticCommandEvidenceCollector = class extends BusMember {
|
|
|
91768
91893
|
entry.fingerprint,
|
|
91769
91894
|
currentFingerprint
|
|
91770
91895
|
);
|
|
91771
|
-
const
|
|
91896
|
+
const toolUnavailable = output !== null && outputLooksToolUnavailable(output);
|
|
91897
|
+
const status = output === null ? "pending/no output observed" : toolUnavailable ? COULD_NOT_START_STATUS : commandOutputLooksFailed(output) ? "completed; output indicates failure" : "completed; consult captured output for the result";
|
|
91772
91898
|
return {
|
|
91773
91899
|
chronologicalIndex: index,
|
|
91774
91900
|
command: entry.command,
|
|
@@ -91776,7 +91902,8 @@ var CriticCommandEvidenceCollector = class extends BusMember {
|
|
|
91776
91902
|
command: entry.command,
|
|
91777
91903
|
terminal: output !== null,
|
|
91778
91904
|
freshness: freshness.state,
|
|
91779
|
-
sandboxBlocked: output !== null && outputLooksSandboxBlocked(output)
|
|
91905
|
+
sandboxBlocked: output !== null && outputLooksSandboxBlocked(output),
|
|
91906
|
+
toolUnavailable
|
|
91780
91907
|
},
|
|
91781
91908
|
rendered: [
|
|
91782
91909
|
`### Command ${index + 1}`,
|
|
@@ -92278,7 +92405,8 @@ async function prepareCriticEvaluation(criteria, resultText, agentId, source, es
|
|
|
92278
92405
|
issues,
|
|
92279
92406
|
staleCommands: staleCommandsToRerun(commandEvidence, issues),
|
|
92280
92407
|
repositoryFingerprint: issues.length === 0 ? afterFingerprint.value : null,
|
|
92281
|
-
established
|
|
92408
|
+
established,
|
|
92409
|
+
unavailableCommands: (commandEvidence.commands ?? []).filter((command) => command.toolUnavailable && command.freshness === "fresh").map((command) => command.command)
|
|
92282
92410
|
};
|
|
92283
92411
|
}
|
|
92284
92412
|
function mergeSegmentVerdicts(verdicts) {
|
|
@@ -92301,6 +92429,11 @@ function mergeSegmentVerdicts(verdicts) {
|
|
|
92301
92429
|
verdicts.flatMap((verdict) => verdict.contractConflicts ?? []).map((conflict) => [conflict.criterion, conflict])
|
|
92302
92430
|
).values()
|
|
92303
92431
|
];
|
|
92432
|
+
const unavailable = [
|
|
92433
|
+
...new Map(
|
|
92434
|
+
verdicts.flatMap((verdict) => verdict.unavailableChecks ?? []).map((check) => [check.criterion, check])
|
|
92435
|
+
).values()
|
|
92436
|
+
];
|
|
92304
92437
|
const reasoning = decisive.length > 0 ? decisive.map(({ verdict, pass }) => `[pass ${pass}] ${verdict.reasoning}`).join(" ") : first.reasoning;
|
|
92305
92438
|
return {
|
|
92306
92439
|
...first,
|
|
@@ -92308,7 +92441,32 @@ function mergeSegmentVerdicts(verdicts) {
|
|
|
92308
92441
|
verdict: decisive.length > 0 ? "fail" : "pass",
|
|
92309
92442
|
reasoning,
|
|
92310
92443
|
violatedCriteria: violated,
|
|
92311
|
-
...conflicts.length > 0 ? { contractConflicts: conflicts } : {}
|
|
92444
|
+
...conflicts.length > 0 ? { contractConflicts: conflicts } : {},
|
|
92445
|
+
...unavailable.length > 0 ? { unavailableChecks: unavailable } : {}
|
|
92446
|
+
};
|
|
92447
|
+
}
|
|
92448
|
+
var EVIDENCE_UNAVAILABLE_MARKER = "[acceptance evidence unavailable]";
|
|
92449
|
+
function applyUnavailableChecks(evaluation, criteria, unavailableCommands) {
|
|
92450
|
+
const { unavailableChecks, ...rest } = evaluation;
|
|
92451
|
+
const settled = rest;
|
|
92452
|
+
const claims = (unavailableChecks ?? []).filter(({ criterion }) => criteria.includes(criterion));
|
|
92453
|
+
if (claims.length === 0 || (settled.status ?? "evaluated") !== "evaluated") return settled;
|
|
92454
|
+
const claimed = new Set(claims.map(({ criterion }) => criterion));
|
|
92455
|
+
if (unavailableCommands.length === 0) {
|
|
92456
|
+
return {
|
|
92457
|
+
...settled,
|
|
92458
|
+
verdict: "fail",
|
|
92459
|
+
violatedCriteria: [.../* @__PURE__ */ new Set([...settled.violatedCriteria, ...claimed])]
|
|
92460
|
+
};
|
|
92461
|
+
}
|
|
92462
|
+
const violated = settled.violatedCriteria.filter((criterion) => !claimed.has(criterion));
|
|
92463
|
+
if (violated.length > 0) return { ...settled, verdict: "fail", violatedCriteria: violated };
|
|
92464
|
+
return {
|
|
92465
|
+
...settled,
|
|
92466
|
+
status: "inconclusive",
|
|
92467
|
+
verdict: "fail",
|
|
92468
|
+
reasoning: `Critic could not evaluate the candidate: ${claims.length} ${claims.length === 1 ? "criterion needs" : "criteria need"} a command that could not start in this worktree (${unavailableCommands.map((command) => boundText(command, 120)).join("; ")}). ` + settled.reasoning,
|
|
92469
|
+
violatedCriteria: [EVIDENCE_UNAVAILABLE_MARKER]
|
|
92312
92470
|
};
|
|
92313
92471
|
}
|
|
92314
92472
|
function inconclusiveEvidenceVerdict(issues) {
|
|
@@ -92317,7 +92475,7 @@ function inconclusiveEvidenceVerdict(issues) {
|
|
|
92317
92475
|
status: "inconclusive",
|
|
92318
92476
|
verdict: "fail",
|
|
92319
92477
|
reasoning: `Critic could not evaluate the candidate: ${detail}`,
|
|
92320
|
-
violatedCriteria: [
|
|
92478
|
+
violatedCriteria: [EVIDENCE_UNAVAILABLE_MARKER]
|
|
92321
92479
|
};
|
|
92322
92480
|
}
|
|
92323
92481
|
function buildEvalPrompt(criteria, resultText, commandEvidence = null, repositoryEvidence = null, decisionDocument = null, segment, publishedNotes = [], hostRunsWholeTreeVerification = false, altitudeSection = null, writeSurface = null, established = []) {
|
|
@@ -92510,7 +92668,7 @@ function evidenceReadinessIssues(commandEvidence, repositoryEvidence) {
|
|
|
92510
92668
|
issues.push("no terminal shell command evidence was observed");
|
|
92511
92669
|
} else if (commandEvidence.commands && commandEvidence.commands.length > 0) {
|
|
92512
92670
|
const hasUsableFreshTerminalCommand = commandEvidence.commands.some(
|
|
92513
|
-
(command) => command.freshness === "fresh" && command.terminal && !command.sandboxBlocked
|
|
92671
|
+
(command) => command.freshness === "fresh" && command.terminal && !command.sandboxBlocked && !command.toolUnavailable
|
|
92514
92672
|
);
|
|
92515
92673
|
if (!hasUsableFreshTerminalCommand) {
|
|
92516
92674
|
if (commandEvidence.commands.some(
|
|
@@ -92526,8 +92684,13 @@ function evidenceReadinessIssues(commandEvidence, repositoryEvidence) {
|
|
|
92526
92684
|
)) {
|
|
92527
92685
|
issues.push("verification command was blocked by the sandbox");
|
|
92528
92686
|
}
|
|
92687
|
+
if (commandEvidence.commands.some(
|
|
92688
|
+
(command) => command.toolUnavailable
|
|
92689
|
+
)) {
|
|
92690
|
+
issues.push(TOOL_UNAVAILABLE_ISSUE);
|
|
92691
|
+
}
|
|
92529
92692
|
if (!issues.some(
|
|
92530
|
-
(issue2) => issue2 === STALE_COMMAND_EVIDENCE || issue2 === "a verification command has no terminal output" || issue2 === "verification command was blocked by the sandbox"
|
|
92693
|
+
(issue2) => issue2 === STALE_COMMAND_EVIDENCE || issue2 === "a verification command has no terminal output" || issue2 === "verification command was blocked by the sandbox" || issue2 === TOOL_UNAVAILABLE_ISSUE
|
|
92531
92694
|
)) {
|
|
92532
92695
|
issues.push("command evidence has no usable fresh terminal command");
|
|
92533
92696
|
}
|
|
@@ -92563,11 +92726,13 @@ function parseRenderedCommandEvidence(evidence) {
|
|
|
92563
92726
|
const command = /^command:\s*(.+)$/m.exec(metadata)?.[1]?.trim() ?? "";
|
|
92564
92727
|
const freshnessText = /^freshness:\s*(.+)$/m.exec(metadata)?.[1]?.trim();
|
|
92565
92728
|
const freshness = freshnessText?.startsWith("fresh") === true ? "fresh" : freshnessText?.startsWith("STALE/UNVERIFIABLE") === true ? "unverifiable" : "stale";
|
|
92729
|
+
const toolUnavailable = runtime === COULD_NOT_START_STATUS || outputLooksToolUnavailable(output);
|
|
92566
92730
|
return {
|
|
92567
92731
|
command,
|
|
92568
|
-
terminal: runtime?.startsWith("completed;") === true,
|
|
92732
|
+
terminal: runtime?.startsWith("completed;") === true || toolUnavailable,
|
|
92569
92733
|
freshness,
|
|
92570
|
-
sandboxBlocked: outputLooksSandboxBlocked(output)
|
|
92734
|
+
sandboxBlocked: outputLooksSandboxBlocked(output),
|
|
92735
|
+
toolUnavailable
|
|
92571
92736
|
};
|
|
92572
92737
|
});
|
|
92573
92738
|
}
|
|
@@ -93040,6 +93205,11 @@ function shellCommandSegments(command) {
|
|
|
93040
93205
|
(segment) => segment.trim().replace(/^\(+\s*/u, "").replace(/^(?:[A-Za-z_][A-Za-z0-9_]*=[^\s]+\s+)+/u, "")
|
|
93041
93206
|
);
|
|
93042
93207
|
}
|
|
93208
|
+
function outputLooksToolUnavailable(output) {
|
|
93209
|
+
return /\b(?:exit(?:ed)?(?: with)? (?:code|status)|status=)\s*127\b|(?:^|\n)\s*(?:(?:ba|z|da)?sh|npm error|npx)(?::\s*(?:line\s*)?\d+)?:\s.*(?:command not found|: not found)\b|\bcommand not found: \S+|\bis not recognized as an internal or external command\b|\bspawn \S+ ENOENT\b/i.test(
|
|
93210
|
+
output
|
|
93211
|
+
);
|
|
93212
|
+
}
|
|
93043
93213
|
function outputLooksSandboxBlocked(output) {
|
|
93044
93214
|
return /sandbox-exec|operation not permitted|permission denied|seatbelt|denied by sandbox/i.test(
|
|
93045
93215
|
output
|
|
@@ -93143,13 +93313,12 @@ var OneShotCritic = class extends BusMember {
|
|
|
93143
93313
|
/** Turn raw evaluator text into a verdict; throw to mark inconclusive. */
|
|
93144
93314
|
parseVerdict(text3) {
|
|
93145
93315
|
const parsed = JSON.parse(extractVerdictJson(text3.trim()));
|
|
93146
|
-
const conflicts = parseContractConflicts(parsed.contract_conflicts);
|
|
93147
93316
|
return {
|
|
93148
93317
|
status: "evaluated",
|
|
93149
93318
|
verdict: parsed.verdict === "pass" ? "pass" : "fail",
|
|
93150
93319
|
reasoning: parsed.reasoning ?? "",
|
|
93151
93320
|
violatedCriteria: Array.isArray(parsed.violated_criteria) ? parsed.violated_criteria : [],
|
|
93152
|
-
...
|
|
93321
|
+
...parsedConflictFields(parsed.contract_conflicts)
|
|
93153
93322
|
};
|
|
93154
93323
|
}
|
|
93155
93324
|
/**
|
|
@@ -93196,15 +93365,19 @@ var OneShotCritic = class extends BusMember {
|
|
|
93196
93365
|
staleCommands = preparation.staleCommands;
|
|
93197
93366
|
preparationReady = preparation.status === "ready";
|
|
93198
93367
|
evaluation = preparationReady ? honorEstablished(
|
|
93199
|
-
|
|
93200
|
-
|
|
93201
|
-
|
|
93202
|
-
|
|
93203
|
-
|
|
93368
|
+
applyUnavailableChecks(
|
|
93369
|
+
applyContractConflicts(
|
|
93370
|
+
mergeSegmentVerdicts(
|
|
93371
|
+
await Promise.all(
|
|
93372
|
+
preparation.prompts.map(
|
|
93373
|
+
(prompt) => this.evaluate(prompt, agentId, turn)
|
|
93374
|
+
)
|
|
93204
93375
|
)
|
|
93205
|
-
)
|
|
93376
|
+
),
|
|
93377
|
+
criteria
|
|
93206
93378
|
),
|
|
93207
|
-
criteria
|
|
93379
|
+
criteria,
|
|
93380
|
+
preparation.unavailableCommands
|
|
93208
93381
|
),
|
|
93209
93382
|
preparation.established
|
|
93210
93383
|
) : inconclusiveEvidenceVerdict(preparation.issues);
|
|
@@ -93420,13 +93593,12 @@ var Critic = class extends OneShotCritic {
|
|
|
93420
93593
|
}
|
|
93421
93594
|
const verdictJson = extractVerdictJson(verdictText);
|
|
93422
93595
|
const parsed = JSON.parse(verdictJson);
|
|
93423
|
-
const conflicts = parseContractConflicts(parsed.contract_conflicts);
|
|
93424
93596
|
return {
|
|
93425
93597
|
status: "evaluated",
|
|
93426
93598
|
verdict: parsed.verdict === "pass" ? "pass" : "fail",
|
|
93427
93599
|
reasoning: parsed.reasoning ?? "",
|
|
93428
93600
|
violatedCriteria: Array.isArray(parsed.violated_criteria) ? parsed.violated_criteria : [],
|
|
93429
|
-
...
|
|
93601
|
+
...parsedConflictFields(parsed.contract_conflicts),
|
|
93430
93602
|
telemetry
|
|
93431
93603
|
};
|
|
93432
93604
|
} catch (err) {
|
|
@@ -94519,7 +94691,7 @@ function importAliases() {
|
|
|
94519
94691
|
}
|
|
94520
94692
|
|
|
94521
94693
|
// ../baro-orchestrator/src/harness/package-cache.ts
|
|
94522
|
-
import { mkdirSync as mkdirSync9, readdirSync as
|
|
94694
|
+
import { mkdirSync as mkdirSync9, readdirSync as readdirSync11, realpathSync as realpathSync8 } from "fs";
|
|
94523
94695
|
import { homedir as homedir5 } from "os";
|
|
94524
94696
|
import { join as join23 } from "path";
|
|
94525
94697
|
function packageCacheRoot(env = process.env) {
|
|
@@ -94560,7 +94732,7 @@ function sharedDependencyTargets(worktreeRoot, depth = 4) {
|
|
|
94560
94732
|
const scan = (dir, left) => {
|
|
94561
94733
|
let entries;
|
|
94562
94734
|
try {
|
|
94563
|
-
entries =
|
|
94735
|
+
entries = readdirSync11(dir, { withFileTypes: true });
|
|
94564
94736
|
} catch {
|
|
94565
94737
|
return;
|
|
94566
94738
|
}
|
|
@@ -95763,13 +95935,12 @@ ${prompt}`,
|
|
|
95763
95935
|
if (!isCodexVerdict(parsed)) {
|
|
95764
95936
|
throw new Error("Codex critic returned an invalid verdict object");
|
|
95765
95937
|
}
|
|
95766
|
-
const conflicts = parseContractConflicts(parsed.contract_conflicts);
|
|
95767
95938
|
return {
|
|
95768
95939
|
status: "evaluated",
|
|
95769
95940
|
verdict: parsed.verdict,
|
|
95770
95941
|
reasoning: parsed.reasoning,
|
|
95771
95942
|
violatedCriteria: [...parsed.violated_criteria],
|
|
95772
|
-
...
|
|
95943
|
+
...parsedConflictFields(parsed.contract_conflicts)
|
|
95773
95944
|
};
|
|
95774
95945
|
}
|
|
95775
95946
|
};
|
|
@@ -96366,15 +96537,19 @@ var CriticOpenAI = class extends BusMember {
|
|
|
96366
96537
|
(fingerprint) => this.ledger.established(agentId, fingerprint)
|
|
96367
96538
|
);
|
|
96368
96539
|
const evaluation = preparation.status === "ready" ? honorEstablished(
|
|
96369
|
-
|
|
96370
|
-
|
|
96371
|
-
|
|
96372
|
-
|
|
96373
|
-
|
|
96540
|
+
applyUnavailableChecks(
|
|
96541
|
+
applyContractConflicts(
|
|
96542
|
+
mergeSegmentVerdicts(
|
|
96543
|
+
await Promise.all(
|
|
96544
|
+
preparation.prompts.map(
|
|
96545
|
+
(prompt) => this.evaluate(prompt, agentId, turn, correlation)
|
|
96546
|
+
)
|
|
96374
96547
|
)
|
|
96375
|
-
)
|
|
96548
|
+
),
|
|
96549
|
+
criteria
|
|
96376
96550
|
),
|
|
96377
|
-
criteria
|
|
96551
|
+
criteria,
|
|
96552
|
+
preparation.unavailableCommands
|
|
96378
96553
|
),
|
|
96379
96554
|
preparation.established
|
|
96380
96555
|
) : inconclusiveEvidenceVerdict(preparation.issues);
|
|
@@ -96523,13 +96698,12 @@ var CriticOpenAI = class extends BusMember {
|
|
|
96523
96698
|
}
|
|
96524
96699
|
const verdictJson = extractVerdictJson(assistantText);
|
|
96525
96700
|
const parsed = JSON.parse(verdictJson);
|
|
96526
|
-
const conflicts = parseContractConflicts(parsed.contract_conflicts);
|
|
96527
96701
|
return {
|
|
96528
96702
|
status: "evaluated",
|
|
96529
96703
|
verdict: parsed.verdict === "pass" ? "pass" : "fail",
|
|
96530
96704
|
reasoning: parsed.reasoning ?? "",
|
|
96531
96705
|
violatedCriteria: Array.isArray(parsed.violated_criteria) ? parsed.violated_criteria : [],
|
|
96532
|
-
...
|
|
96706
|
+
...parsedConflictFields(parsed.contract_conflicts),
|
|
96533
96707
|
telemetry
|
|
96534
96708
|
};
|
|
96535
96709
|
} catch (err) {
|
|
@@ -111499,7 +111673,7 @@ function nativeTurnUsage(usage) {
|
|
|
111499
111673
|
}
|
|
111500
111674
|
|
|
111501
111675
|
// ../baro-orchestrator/src/verification/cargo-target-prune.ts
|
|
111502
|
-
import { lstatSync as lstatSync9, readdirSync as
|
|
111676
|
+
import { lstatSync as lstatSync9, readdirSync as readdirSync14, rmSync as rmSync8 } from "fs";
|
|
111503
111677
|
import { homedir as homedir10 } from "os";
|
|
111504
111678
|
import { join as join33 } from "path";
|
|
111505
111679
|
var CARGO_LEFTOVER_MAX_AGE_MS = 2 * 24 * 60 * 6e4;
|
|
@@ -111571,7 +111745,7 @@ function subdirs(path7) {
|
|
|
111571
111745
|
}
|
|
111572
111746
|
function list(path7) {
|
|
111573
111747
|
try {
|
|
111574
|
-
return
|
|
111748
|
+
return readdirSync14(path7);
|
|
111575
111749
|
} catch {
|
|
111576
111750
|
return [];
|
|
111577
111751
|
}
|
|
@@ -117097,7 +117271,9 @@ function summarizeGate(commands) {
|
|
|
117097
117271
|
});
|
|
117098
117272
|
}
|
|
117099
117273
|
function gateFingerprint(outcome) {
|
|
117100
|
-
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("");
|
|
117101
117277
|
}
|
|
117102
117278
|
function shouldDeliverGate(previous, next) {
|
|
117103
117279
|
if (next.commands.length === 0) return false;
|
|
@@ -117106,10 +117282,11 @@ function shouldDeliverGate(previous, next) {
|
|
|
117106
117282
|
}
|
|
117107
117283
|
function renderGateReport(outcome) {
|
|
117108
117284
|
const lines = ["[baro] Your worktree was checked after your last change:"];
|
|
117109
|
-
for (const { label, passed } of outcome.commands) {
|
|
117110
|
-
lines.push(` ${passed ? "PASS" : "FAIL"} ${label}`);
|
|
117285
|
+
for (const { label, passed, timedOut } of outcome.commands) {
|
|
117286
|
+
lines.push(` ${timedOut ? "SLOW" : passed ? "PASS" : "FAIL"} ${label}`);
|
|
117111
117287
|
}
|
|
117112
|
-
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);
|
|
117113
117290
|
for (const failure of failures.slice(0, MAX_REPORTED_FAILURES)) {
|
|
117114
117291
|
if (!failure.detail) continue;
|
|
117115
117292
|
lines.push("", `--- ${failure.label} ---`, boundedDetail(failure.detail));
|
|
@@ -117121,6 +117298,12 @@ function renderGateReport(outcome) {
|
|
|
117121
117298
|
"",
|
|
117122
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."
|
|
117123
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
|
+
}
|
|
117124
117307
|
return lines.join("\n");
|
|
117125
117308
|
}
|
|
117126
117309
|
function boundedDetail(detail) {
|
|
@@ -117138,6 +117321,14 @@ function gateCommandWasKilled(command) {
|
|
|
117138
117321
|
const tail = command.tail ?? "";
|
|
117139
117322
|
return /exited with code null/u.test(tail) || /signal: (killed|terminated)/u.test(tail);
|
|
117140
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
|
+
}
|
|
117141
117332
|
var ContinuousGateRunner = class extends BusMember {
|
|
117142
117333
|
constructor(opts) {
|
|
117143
117334
|
super();
|
|
@@ -117243,16 +117434,13 @@ var ContinuousGateRunner = class extends BusMember {
|
|
|
117243
117434
|
signal: this.controller.signal,
|
|
117244
117435
|
...this.opts.plan ? { plan: this.opts.plan } : {},
|
|
117245
117436
|
...this.opts.hostRepoRoot ? { hostRepoRoot: this.opts.hostRepoRoot } : {},
|
|
117246
|
-
changedSince: baseSha
|
|
117437
|
+
changedSince: baseSha,
|
|
117438
|
+
scopeByPackage: true
|
|
117247
117439
|
});
|
|
117248
117440
|
if (result.commands.some((command) => gateCommandWasKilled(command))) {
|
|
117249
117441
|
throw new Error("a gate command was killed before it reported");
|
|
117250
117442
|
}
|
|
117251
|
-
return result.commands
|
|
117252
|
-
label: command.command,
|
|
117253
|
-
passed: command.status === "passed",
|
|
117254
|
-
detail: command.status === "passed" ? "" : command.tail ?? ""
|
|
117255
|
-
}));
|
|
117443
|
+
return gateCommandOutcomes(result.commands);
|
|
117256
117444
|
}
|
|
117257
117445
|
deliver(agentId, outcome) {
|
|
117258
117446
|
const event = AgentTargetedMessage.create({
|