@appchy/jarvis 0.1.98 → 0.1.100
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/bin.js +30 -5
- package/dist/bin.js.map +1 -1
- package/package.json +5 -5
package/dist/bin.js
CHANGED
|
@@ -1395,8 +1395,16 @@ var SCRIPT = `#!/bin/sh
|
|
|
1395
1395
|
${SIGNATURE} \u2014 keeps this repo's map current, so what an agent plans against is what is here.
|
|
1396
1396
|
# Detached and silenced: git waits for a hook's output streams to close, so a build left on stdout
|
|
1397
1397
|
# would hold up every commit by the length of a build. Never fails a commit.
|
|
1398
|
+
#
|
|
1399
|
+
# Run at the lowest priority the machine offers. A code commit still costs a real extract, and one
|
|
1400
|
+
# arriving at normal priority the instant you commit is felt as the machine going away for half a
|
|
1401
|
+
# minute \u2014 which is how a background job becomes something people turn off. Borrowed from the
|
|
1402
|
+
# docdoc-era hook in crispy, which had this right first.
|
|
1398
1403
|
command -v jarvis >/dev/null 2>&1 || exit 0
|
|
1399
|
-
|
|
1404
|
+
NICE=""
|
|
1405
|
+
command -v nice >/dev/null 2>&1 && NICE="nice -n 19"
|
|
1406
|
+
command -v taskpolicy >/dev/null 2>&1 && NICE="taskpolicy -b $NICE"
|
|
1407
|
+
( $NICE jarvis build graph >/dev/null 2>&1 & ) >/dev/null 2>&1
|
|
1400
1408
|
exit 0
|
|
1401
1409
|
`;
|
|
1402
1410
|
function installCommitHook(repoRoot) {
|
|
@@ -10252,7 +10260,7 @@ import { createRequire as createRequire2 } from "module";
|
|
|
10252
10260
|
var _require = createRequire2(import.meta.url);
|
|
10253
10261
|
var VERSION2 = _require("../package.json").version ?? "0.0.0";
|
|
10254
10262
|
var IS_DEV = String(_require("../package.json").name ?? "").endsWith("-dev");
|
|
10255
|
-
var SHA = "
|
|
10263
|
+
var SHA = "07085df";
|
|
10256
10264
|
var BUILT = "2026-09-11";
|
|
10257
10265
|
var BUILD = SHA ?? "source";
|
|
10258
10266
|
var BUILD_LABEL = `${SHA ? `${VERSION2} (${SHA}${BUILT ? ` ${BUILT}` : ""})` : `${VERSION2} (source)`}${IS_DEV ? " \u2014 development build" : ""}`;
|
|
@@ -11400,19 +11408,36 @@ async function runBuild(cwd, argv = []) {
|
|
|
11400
11408
|
if (argv.includes("--rebuild")) process.env.JARVIS_DATA_REBUILD = "1";
|
|
11401
11409
|
else process.env.JARVIS_DATA_REFRESH = "1";
|
|
11402
11410
|
if (argv.includes("--label")) process.env.JARVIS_DATA_LABEL = "1";
|
|
11403
|
-
const
|
|
11411
|
+
const gate = argv.includes("--gate");
|
|
11412
|
+
const lock = gate ? await awaitBuildLock(cwd) : acquireBuildLock(cwd);
|
|
11404
11413
|
if (!lock) {
|
|
11414
|
+
if (gate) {
|
|
11415
|
+
process.stderr.write(
|
|
11416
|
+
"[data] another build held the lock for the whole wait, so this gate measured NOTHING. Reporting that rather than a pass \u2014 re-run it once the other build is done.\n"
|
|
11417
|
+
);
|
|
11418
|
+
return 1;
|
|
11419
|
+
}
|
|
11405
11420
|
process.stderr.write(
|
|
11406
11421
|
"[data] a build is already running for this repo \u2014 skipping (it will refresh the graph).\n"
|
|
11407
11422
|
);
|
|
11408
11423
|
return 0;
|
|
11409
11424
|
}
|
|
11410
11425
|
try {
|
|
11411
|
-
return await build(cwd,
|
|
11426
|
+
return await build(cwd, gate);
|
|
11412
11427
|
} finally {
|
|
11413
11428
|
lock.release();
|
|
11414
11429
|
}
|
|
11415
11430
|
}
|
|
11431
|
+
var GATE_LOCK_WAIT_MS = 5 * 6e4;
|
|
11432
|
+
async function awaitBuildLock(cwd, timeoutMs = GATE_LOCK_WAIT_MS) {
|
|
11433
|
+
const deadline = Date.now() + timeoutMs;
|
|
11434
|
+
for (; ; ) {
|
|
11435
|
+
const lock = acquireBuildLock(cwd);
|
|
11436
|
+
if (lock) return lock;
|
|
11437
|
+
if (Date.now() >= deadline) return null;
|
|
11438
|
+
await new Promise((done) => setTimeout(done, 500));
|
|
11439
|
+
}
|
|
11440
|
+
}
|
|
11416
11441
|
async function build(cwd, gate = false) {
|
|
11417
11442
|
const config2 = await loadConfig2(cwd);
|
|
11418
11443
|
if (config2.backend?.name === "graphify") await ensureGraphify();
|
|
@@ -11489,7 +11514,7 @@ function acquireBuildLock(repoRoot, options = {}) {
|
|
|
11489
11514
|
}
|
|
11490
11515
|
function isStale(lockPath, staleMs) {
|
|
11491
11516
|
try {
|
|
11492
|
-
return Date.now() - statSync3(lockPath).mtimeMs >= staleMs;
|
|
11517
|
+
return Math.max(0, Date.now() - statSync3(lockPath).mtimeMs) >= staleMs;
|
|
11493
11518
|
} catch {
|
|
11494
11519
|
return true;
|
|
11495
11520
|
}
|