@appchy/jarvis 0.1.99 → 0.1.101
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 +28 -6
- package/dist/bin.js.map +1 -1
- package/package.json +5 -5
package/dist/bin.js
CHANGED
|
@@ -10260,7 +10260,7 @@ import { createRequire as createRequire2 } from "module";
|
|
|
10260
10260
|
var _require = createRequire2(import.meta.url);
|
|
10261
10261
|
var VERSION2 = _require("../package.json").version ?? "0.0.0";
|
|
10262
10262
|
var IS_DEV = String(_require("../package.json").name ?? "").endsWith("-dev");
|
|
10263
|
-
var SHA = "
|
|
10263
|
+
var SHA = "1a10c0d";
|
|
10264
10264
|
var BUILT = "2026-09-11";
|
|
10265
10265
|
var BUILD = SHA ?? "source";
|
|
10266
10266
|
var BUILD_LABEL = `${SHA ? `${VERSION2} (${SHA}${BUILT ? ` ${BUILT}` : ""})` : `${VERSION2} (source)`}${IS_DEV ? " \u2014 development build" : ""}`;
|
|
@@ -11408,19 +11408,36 @@ async function runBuild(cwd, argv = []) {
|
|
|
11408
11408
|
if (argv.includes("--rebuild")) process.env.JARVIS_DATA_REBUILD = "1";
|
|
11409
11409
|
else process.env.JARVIS_DATA_REFRESH = "1";
|
|
11410
11410
|
if (argv.includes("--label")) process.env.JARVIS_DATA_LABEL = "1";
|
|
11411
|
-
const
|
|
11411
|
+
const gate = argv.includes("--gate");
|
|
11412
|
+
const lock = gate ? await awaitBuildLock(cwd) : acquireBuildLock(cwd);
|
|
11412
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
|
+
}
|
|
11413
11420
|
process.stderr.write(
|
|
11414
11421
|
"[data] a build is already running for this repo \u2014 skipping (it will refresh the graph).\n"
|
|
11415
11422
|
);
|
|
11416
11423
|
return 0;
|
|
11417
11424
|
}
|
|
11418
11425
|
try {
|
|
11419
|
-
return await build(cwd,
|
|
11426
|
+
return await build(cwd, gate);
|
|
11420
11427
|
} finally {
|
|
11421
11428
|
lock.release();
|
|
11422
11429
|
}
|
|
11423
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
|
+
}
|
|
11424
11441
|
async function build(cwd, gate = false) {
|
|
11425
11442
|
const config2 = await loadConfig2(cwd);
|
|
11426
11443
|
if (config2.backend?.name === "graphify") await ensureGraphify();
|
|
@@ -11497,7 +11514,7 @@ function acquireBuildLock(repoRoot, options = {}) {
|
|
|
11497
11514
|
}
|
|
11498
11515
|
function isStale(lockPath, staleMs) {
|
|
11499
11516
|
try {
|
|
11500
|
-
return Date.now() - statSync3(lockPath).mtimeMs >= staleMs;
|
|
11517
|
+
return Math.max(0, Date.now() - statSync3(lockPath).mtimeMs) >= staleMs;
|
|
11501
11518
|
} catch {
|
|
11502
11519
|
return true;
|
|
11503
11520
|
}
|
|
@@ -12374,7 +12391,7 @@ async function asset(repo, assets, url, res) {
|
|
|
12374
12391
|
const wanted = url.pathname === "/" || !extname(url.pathname) ? "/index.html" : url.pathname;
|
|
12375
12392
|
const path23 = join9(assets, wanted);
|
|
12376
12393
|
if (!path23.startsWith(assets)) {
|
|
12377
|
-
res.writeHead(403).end("no");
|
|
12394
|
+
res.writeHead(403, { "cache-control": "no-store" }).end("no");
|
|
12378
12395
|
return;
|
|
12379
12396
|
}
|
|
12380
12397
|
try {
|
|
@@ -12392,7 +12409,12 @@ async function asset(repo, assets, url, res) {
|
|
|
12392
12409
|
});
|
|
12393
12410
|
res.end(body);
|
|
12394
12411
|
} catch {
|
|
12395
|
-
res.writeHead(404, {
|
|
12412
|
+
res.writeHead(404, {
|
|
12413
|
+
"content-type": "text/plain; charset=utf-8",
|
|
12414
|
+
// A refusal is cached as readily as a page. A missing asset on a half-built checkout would
|
|
12415
|
+
// otherwise stay missing in the browser after the build that creates it.
|
|
12416
|
+
"cache-control": "no-store"
|
|
12417
|
+
});
|
|
12396
12418
|
res.end(
|
|
12397
12419
|
"not found. If this is a fresh checkout, the UI is built by `pnpm --filter @appchy/jarvis build`."
|
|
12398
12420
|
);
|