@tablation/crew 0.169.0 → 0.169.2
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.js +92 -50
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6102,13 +6102,17 @@ function removeLaunchdUnit(unit, dryRun, log) {
|
|
|
6102
6102
|
if (existsSync16(unit.plistPath)) unlinkSync2(unit.plistPath);
|
|
6103
6103
|
log.emit(`removed ${unit.label} (${unit.plistPath})`);
|
|
6104
6104
|
}
|
|
6105
|
+
function foreignInstallRefusal(blocking, ownProgram) {
|
|
6106
|
+
const found = blocking.map((u) => `${u.label} runs ${u.program ?? "an unreadable ProgramArguments"}`).join("; ");
|
|
6107
|
+
const others = [...new Set(blocking.map((u) => u.program).filter((p) => p !== null))];
|
|
6108
|
+
const uninstall = others.length > 0 ? `Or remove only that copy's units by running ${others.map((p) => `\`${p} uninstall\``).join(" / ")} instead (the copy at ${ownProgram} is not changed).` : "The unit has no readable program, so only --replace can remove it.";
|
|
6109
|
+
return `scheduler units on this machine start a different copy of crew than this one (${ownProgram}): ${found}. Nothing was changed. Two sets of units would run two crews against the same board, so install stopped. \`crew install --replace\` removes the other copy's scheduler units and installs this copy's, so this ship keeps serving the same routes from this copy. ${uninstall} Neither command touches crew.yaml, routes or tickets.`;
|
|
6110
|
+
}
|
|
6105
6111
|
function clearForeignLaunchdUnits(crewHome, replace, dryRun, log, dir, loaded) {
|
|
6106
6112
|
const foreign = foreignLaunchdUnits(crewHome, dir, loaded);
|
|
6107
6113
|
const blocking = foreign.filter((u) => !u.orphan && (u.program === null || u.programExists));
|
|
6108
6114
|
if (blocking.length > 0 && !replace) {
|
|
6109
|
-
log.warn(
|
|
6110
|
-
`two crew installs target this machine: ${blocking.map((u) => `${u.label} runs ${u.program ?? "an unreadable ProgramArguments"}`).join("; ")}. Run \`crew uninstall\` from the other one, or pass --replace.`
|
|
6111
|
-
);
|
|
6115
|
+
log.warn(foreignInstallRefusal(blocking, crewInvocation(crewHome).at(-1) ?? crewHome));
|
|
6112
6116
|
return false;
|
|
6113
6117
|
}
|
|
6114
6118
|
for (const unit of foreign) {
|
|
@@ -6196,6 +6200,46 @@ import {
|
|
|
6196
6200
|
} from "fs";
|
|
6197
6201
|
import { tmpdir as tmpdir2 } from "os";
|
|
6198
6202
|
import { dirname as dirname10, basename as basename5, join as join20 } from "path";
|
|
6203
|
+
|
|
6204
|
+
// src/sleep-sync.ts
|
|
6205
|
+
import { spawnSync as spawnSync6 } from "child_process";
|
|
6206
|
+
function sleepSync(ms3) {
|
|
6207
|
+
if (!(ms3 > 0)) return;
|
|
6208
|
+
if (typeof SharedArrayBuffer !== "undefined") {
|
|
6209
|
+
try {
|
|
6210
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms3);
|
|
6211
|
+
return;
|
|
6212
|
+
} catch {
|
|
6213
|
+
}
|
|
6214
|
+
}
|
|
6215
|
+
const bun = globalThis.Bun;
|
|
6216
|
+
if (typeof bun?.sleepSync === "function") {
|
|
6217
|
+
try {
|
|
6218
|
+
bun.sleepSync(ms3);
|
|
6219
|
+
return;
|
|
6220
|
+
} catch {
|
|
6221
|
+
}
|
|
6222
|
+
}
|
|
6223
|
+
const r = spawnSync6("sleep", [String(ms3 / 1e3)], { stdio: "ignore" });
|
|
6224
|
+
if (r.error) {
|
|
6225
|
+
const end = Date.now() + ms3;
|
|
6226
|
+
while (Date.now() < end) {
|
|
6227
|
+
}
|
|
6228
|
+
}
|
|
6229
|
+
}
|
|
6230
|
+
function sleepSyncCheck(sleep = sleepSync) {
|
|
6231
|
+
const started = Date.now();
|
|
6232
|
+
try {
|
|
6233
|
+
sleep(50);
|
|
6234
|
+
} catch (e) {
|
|
6235
|
+
return { ok: false, message: `sleep-sync failed: ${e instanceof Error ? e.message : String(e)}` };
|
|
6236
|
+
}
|
|
6237
|
+
const took = Date.now() - started;
|
|
6238
|
+
if (took < 40) return { ok: false, message: `sleep-sync returned after ${took} ms, expected about 50` };
|
|
6239
|
+
return { ok: true, message: `sleep-sync ok: ${took} ms` };
|
|
6240
|
+
}
|
|
6241
|
+
|
|
6242
|
+
// src/git.ts
|
|
6199
6243
|
var GitError = class extends Error {
|
|
6200
6244
|
};
|
|
6201
6245
|
function execGit(cwd, args, input) {
|
|
@@ -6709,9 +6753,6 @@ var CHECKOUT_LOCK_STALE_MS = 5 * 60 * 1e3;
|
|
|
6709
6753
|
function checkoutLockPath(dir) {
|
|
6710
6754
|
return `${dir}.sync.lock`;
|
|
6711
6755
|
}
|
|
6712
|
-
function sleepSync(ms3) {
|
|
6713
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms3);
|
|
6714
|
-
}
|
|
6715
6756
|
function acquireCheckoutLock(dir, timeoutMs = 3e4) {
|
|
6716
6757
|
const lockPath = checkoutLockPath(dir);
|
|
6717
6758
|
mkdirSync13(dirname10(lockPath), { recursive: true });
|
|
@@ -7370,7 +7411,7 @@ import { execFile as execFile2 } from "child_process";
|
|
|
7370
7411
|
import { promisify as promisify2 } from "util";
|
|
7371
7412
|
|
|
7372
7413
|
// src/deprovision-host.ts
|
|
7373
|
-
import { spawnSync as
|
|
7414
|
+
import { spawnSync as spawnSync8 } from "child_process";
|
|
7374
7415
|
import { existsSync as existsSync33, readdirSync as readdirSync13 } from "fs";
|
|
7375
7416
|
|
|
7376
7417
|
// src/repo-env.ts
|
|
@@ -7440,7 +7481,7 @@ import { existsSync as existsSync30, readdirSync as readdirSync10, readFileSync
|
|
|
7440
7481
|
import { join as join36 } from "path";
|
|
7441
7482
|
|
|
7442
7483
|
// src/agent.ts
|
|
7443
|
-
import { spawnSync as
|
|
7484
|
+
import { spawnSync as spawnSync7 } from "child_process";
|
|
7444
7485
|
import { readFileSync as readFileSync31, existsSync as existsSync29, statSync as statSync9, mkdirSync as mkdirSync23, writeFileSync as writeFileSync24, createWriteStream, openSync as openSync4, closeSync as closeSync4, readSync } from "fs";
|
|
7445
7486
|
import { StringDecoder } from "string_decoder";
|
|
7446
7487
|
import { finished } from "stream/promises";
|
|
@@ -15504,7 +15545,7 @@ function runIsAlive(sc) {
|
|
|
15504
15545
|
} catch (e) {
|
|
15505
15546
|
if (e.code !== "EPERM") return false;
|
|
15506
15547
|
}
|
|
15507
|
-
const ps =
|
|
15548
|
+
const ps = spawnSync7("ps", ["-o", "lstart=", "-p", String(sc.pid)], { encoding: "utf8" });
|
|
15508
15549
|
const started = Date.parse(ps.stdout.trim());
|
|
15509
15550
|
if (ps.status !== 0 || Number.isNaN(started)) return ps.status === 0;
|
|
15510
15551
|
return Math.abs(started - Date.parse(sc.spawnedAt)) < 15e3;
|
|
@@ -16548,7 +16589,7 @@ var DOCKER_LABEL_OWNER = "crew.owner=crew";
|
|
|
16548
16589
|
var DOCKER_LABEL_CACHE = "crew.kind=cache";
|
|
16549
16590
|
var DOCKER_LABEL_REPO_LAYER = "crew.layer=repo";
|
|
16550
16591
|
function docker(args) {
|
|
16551
|
-
const res =
|
|
16592
|
+
const res = spawnSync8("docker", args, { encoding: "utf8" });
|
|
16552
16593
|
if (res.error || res.status !== 0) throw new Error(`docker ${args[0]} ${args[1] ?? ""} failed: ${(res.stderr || String(res.error ?? "")).trim().split("\n").pop()}`);
|
|
16553
16594
|
return res.stdout;
|
|
16554
16595
|
}
|
|
@@ -17302,7 +17343,7 @@ var imageStoreProblem = (engine = "docker", exec = realExec) => (image) => {
|
|
|
17302
17343
|
};
|
|
17303
17344
|
|
|
17304
17345
|
// src/doctor-checks.ts
|
|
17305
|
-
import { execFileSync as execFileSync11, spawnSync as
|
|
17346
|
+
import { execFileSync as execFileSync11, spawnSync as spawnSync9 } from "child_process";
|
|
17306
17347
|
var PROBE_BRANCH = "crew-probe-branch";
|
|
17307
17348
|
var realGit = (cwd, args, env) => {
|
|
17308
17349
|
execFileSync11("git", args, { cwd, env, stdio: ["ignore", "pipe", "pipe"], timeout: 3e4 });
|
|
@@ -17383,7 +17424,7 @@ function probeCredentialHelper(command2, run4 = realHelperRun) {
|
|
|
17383
17424
|
return { state: "failed", detail: `the git credential helper command does not run: ${why}`, hint: "reinstall crew; git cannot authenticate to a private repository until this works" };
|
|
17384
17425
|
}
|
|
17385
17426
|
var realHelperRun = (cmd, input) => {
|
|
17386
|
-
const r =
|
|
17427
|
+
const r = spawnSync9("sh", ["-c", cmd], { input, encoding: "utf8", timeout: 15e3 });
|
|
17387
17428
|
return { status: r.status, stderr: r.stderr ?? (r.error ? String(r.error) : "") };
|
|
17388
17429
|
};
|
|
17389
17430
|
function formatPushAuth(repo, r) {
|
|
@@ -17453,7 +17494,7 @@ function runtimeDirWarning(platform2, uid, exists, user = "the crew user") {
|
|
|
17453
17494
|
var MANAGED_GIT_EMAIL = "crew@tablation.dev";
|
|
17454
17495
|
function readGlobalGitIdentity() {
|
|
17455
17496
|
const get2 = (key) => {
|
|
17456
|
-
const res =
|
|
17497
|
+
const res = spawnSync9("git", ["config", "--global", "--get", key], { encoding: "utf8" });
|
|
17457
17498
|
const v = (res.stdout ?? "").trim();
|
|
17458
17499
|
return res.status === 0 && v ? v : null;
|
|
17459
17500
|
};
|
|
@@ -17747,7 +17788,7 @@ async function runSelfLaunchCheck(own, spawnFn = spawnChild, launch = selfLaunch
|
|
|
17747
17788
|
import { resolve as resolve7, dirname as dirname38, join as join67, basename as basename17 } from "path";
|
|
17748
17789
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
17749
17790
|
import { hostname as hostname5, homedir as homedir11, userInfo as userInfo2 } from "os";
|
|
17750
|
-
import { spawnSync as
|
|
17791
|
+
import { spawnSync as spawnSync15 } from "child_process";
|
|
17751
17792
|
import { parse as parseYaml3 } from "yaml";
|
|
17752
17793
|
|
|
17753
17794
|
// src/argv.ts
|
|
@@ -18639,7 +18680,7 @@ function matchShipRows(ships, shipName2, machineId) {
|
|
|
18639
18680
|
}
|
|
18640
18681
|
|
|
18641
18682
|
// src/provision.ts
|
|
18642
|
-
import { spawnSync as
|
|
18683
|
+
import { spawnSync as spawnSync10 } from "child_process";
|
|
18643
18684
|
import { existsSync as existsSync37, readFileSync as readFileSync39, writeFileSync as writeFileSync31 } from "fs";
|
|
18644
18685
|
import { hostname as hostname2 } from "os";
|
|
18645
18686
|
import { parseDocument as parseDocument3, isMap as isMap2, isScalar } from "yaml";
|
|
@@ -19273,7 +19314,7 @@ function realProvisionDeps(crewHome) {
|
|
|
19273
19314
|
const env = { ...process.env, ...o.env };
|
|
19274
19315
|
delete env.CREW_FORGE_TOKEN;
|
|
19275
19316
|
for (const k of Object.keys(env)) if (k.startsWith("CREW_CONNECT_KEY_")) delete env[k];
|
|
19276
|
-
const res =
|
|
19317
|
+
const res = spawnSync10(bin, [...pre, ...args], { cwd: crewHome, encoding: "utf8", env, input: o.input, maxBuffer: 64 * 1024 * 1024 });
|
|
19277
19318
|
return { status: res.status ?? 1, stdout: res.stdout ?? "", stderr: `${res.stderr ?? ""}${res.error ? String(res.error) : ""}` };
|
|
19278
19319
|
};
|
|
19279
19320
|
const configFile = () => {
|
|
@@ -19321,15 +19362,15 @@ function realProvisionDeps(crewHome) {
|
|
|
19321
19362
|
if (mechanism === "systemd") {
|
|
19322
19363
|
const system = ctx.root || existsSync37(systemUnitPathFor(label));
|
|
19323
19364
|
const ctl = system ? ["systemctl"] : ["systemctl", "--user"];
|
|
19324
|
-
running =
|
|
19365
|
+
running = spawnSync10(ctl[0], [...ctl.slice(1), "is-active", "--quiet", `${label}.service`], { env: withUserBusEnv() }).status === 0;
|
|
19325
19366
|
if (!system) {
|
|
19326
|
-
const out =
|
|
19367
|
+
const out = spawnSync10("loginctl", ["show-user", ctx.user, "-p", "Linger"], { encoding: "utf8" });
|
|
19327
19368
|
lingering = /Linger=yes/.test(out.stdout ?? "");
|
|
19328
19369
|
}
|
|
19329
19370
|
} else if (mechanism === "cron") {
|
|
19330
19371
|
running = true;
|
|
19331
19372
|
} else if (mechanism === "launchd") {
|
|
19332
|
-
running =
|
|
19373
|
+
running = spawnSync10("launchctl", ["list", label]).status === 0;
|
|
19333
19374
|
}
|
|
19334
19375
|
return { mechanism, unitsStale, running, lingering };
|
|
19335
19376
|
},
|
|
@@ -19355,7 +19396,7 @@ function realProvisionDeps(crewHome) {
|
|
|
19355
19396
|
let wrote = false;
|
|
19356
19397
|
for (const [key, value2] of [["user.name", have.name ? null : name], ["user.email", have.email ? null : email]]) {
|
|
19357
19398
|
if (value2 === null) continue;
|
|
19358
|
-
const res =
|
|
19399
|
+
const res = spawnSync10("git", ["config", "--global", key, value2], { encoding: "utf8" });
|
|
19359
19400
|
if (res.status !== 0) throw new Error(`git config --global ${key}: ${(res.stderr ?? "").trim() || `exited ${res.status}`}`);
|
|
19360
19401
|
wrote = true;
|
|
19361
19402
|
}
|
|
@@ -24113,7 +24154,7 @@ async function runCommentDeliveryPass(deps) {
|
|
|
24113
24154
|
|
|
24114
24155
|
// src/launchd-start.ts
|
|
24115
24156
|
import { readFileSync as readFileSync48 } from "fs";
|
|
24116
|
-
import { spawnSync as
|
|
24157
|
+
import { spawnSync as spawnSync13 } from "child_process";
|
|
24117
24158
|
|
|
24118
24159
|
// src/daemon-liveness.ts
|
|
24119
24160
|
import { existsSync as existsSync49, readFileSync as readFileSync47 } from "fs";
|
|
@@ -26451,7 +26492,7 @@ async function settleSignOut(plan, tracker, state, ticketId, emit) {
|
|
|
26451
26492
|
}
|
|
26452
26493
|
|
|
26453
26494
|
// src/daemon-liveness.ts
|
|
26454
|
-
import { spawnSync as
|
|
26495
|
+
import { spawnSync as spawnSync12 } from "child_process";
|
|
26455
26496
|
function parseLaunchctlPrint(text2) {
|
|
26456
26497
|
const num2 = (re) => {
|
|
26457
26498
|
const m = re.exec(text2);
|
|
@@ -26499,7 +26540,7 @@ function classifyDaemon(o) {
|
|
|
26499
26540
|
}
|
|
26500
26541
|
function probeDaemonUnit(o) {
|
|
26501
26542
|
const run4 = o.run ?? ((cmd) => {
|
|
26502
|
-
const r =
|
|
26543
|
+
const r = spawnSync12(cmd[0], cmd.slice(1), { encoding: "utf8" });
|
|
26503
26544
|
return r.error ? null : { status: r.status, stdout: r.stdout ?? "" };
|
|
26504
26545
|
});
|
|
26505
26546
|
const installed = o.plan.unitPaths.some((p) => existsSync49(p));
|
|
@@ -26573,12 +26614,9 @@ function planLaunchdStart(r, unit) {
|
|
|
26573
26614
|
}
|
|
26574
26615
|
var LOG_TAIL_LINES = 10;
|
|
26575
26616
|
function defaultRun(cmd) {
|
|
26576
|
-
const r =
|
|
26617
|
+
const r = spawnSync13(cmd[0], cmd.slice(1), { encoding: "utf8" });
|
|
26577
26618
|
return r.error ? null : { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
|
|
26578
26619
|
}
|
|
26579
|
-
function defaultSleep2(ms3) {
|
|
26580
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms3);
|
|
26581
|
-
}
|
|
26582
26620
|
function defaultReadLog(path) {
|
|
26583
26621
|
try {
|
|
26584
26622
|
return readFileSync48(path, "utf8");
|
|
@@ -26592,7 +26630,7 @@ function logTail2(text2, n = LOG_TAIL_LINES) {
|
|
|
26592
26630
|
}
|
|
26593
26631
|
function startLaunchdDaemon(o) {
|
|
26594
26632
|
const run4 = o.run ?? defaultRun;
|
|
26595
|
-
const sleep = o.sleep ??
|
|
26633
|
+
const sleep = o.sleep ?? sleepSync;
|
|
26596
26634
|
const readLog = o.readLog ?? defaultReadLog;
|
|
26597
26635
|
let out = "";
|
|
26598
26636
|
let err3 = "";
|
|
@@ -28557,7 +28595,7 @@ function readRepoSetupPrompt(crewHome) {
|
|
|
28557
28595
|
}
|
|
28558
28596
|
|
|
28559
28597
|
// src/repos-check.ts
|
|
28560
|
-
import { spawnSync as
|
|
28598
|
+
import { spawnSync as spawnSync14 } from "child_process";
|
|
28561
28599
|
import { readFileSync as readFileSync53 } from "fs";
|
|
28562
28600
|
import { basename as basename12 } from "path";
|
|
28563
28601
|
var POSIX_SHELL = /^(?:ba|z|da|k|a|mk)?sh$|^fish$/;
|
|
@@ -28566,10 +28604,10 @@ function checkHookSyntax(script, shell) {
|
|
|
28566
28604
|
const name = basename12(spec.bin).replace(/\.exe$/i, "").toLowerCase();
|
|
28567
28605
|
let run4;
|
|
28568
28606
|
if (POSIX_SHELL.test(name)) {
|
|
28569
|
-
run4 =
|
|
28607
|
+
run4 = spawnSync14(spec.bin, ["-n"], { input: script, encoding: "utf8" });
|
|
28570
28608
|
} else if (/^(pwsh|powershell)$/.test(name)) {
|
|
28571
28609
|
const parse3 = "$e=$null;[void][System.Management.Automation.Language.Parser]::ParseInput($env:CREW_CHECK_SCRIPT,[ref]$null,[ref]$e);if($e){$e|ForEach-Object{[Console]::Error.WriteLine($_.Message)};exit 1}";
|
|
28572
|
-
run4 =
|
|
28610
|
+
run4 = spawnSync14(spec.bin, ["-NoProfile", "-NonInteractive", "-Command", parse3], {
|
|
28573
28611
|
encoding: "utf8",
|
|
28574
28612
|
env: { ...process.env, CREW_CHECK_SCRIPT: script }
|
|
28575
28613
|
});
|
|
@@ -29822,7 +29860,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
29822
29860
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
29823
29861
|
import { join as join61 } from "path";
|
|
29824
29862
|
function builtVersion() {
|
|
29825
|
-
return true ? "0.169.
|
|
29863
|
+
return true ? "0.169.2" : null;
|
|
29826
29864
|
}
|
|
29827
29865
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
29828
29866
|
function newestMtime(path) {
|
|
@@ -30181,13 +30219,10 @@ function removePersistedSyncDaemon(stateDir, workspaceId) {
|
|
|
30181
30219
|
} catch {
|
|
30182
30220
|
}
|
|
30183
30221
|
}
|
|
30184
|
-
function sleepSync2(ms3) {
|
|
30185
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms3);
|
|
30186
|
-
}
|
|
30187
30222
|
function waitForExit(pid, alive, timeoutMs = 5e3) {
|
|
30188
30223
|
const deadline = Date.now() + timeoutMs;
|
|
30189
30224
|
while (alive(pid) && Date.now() < deadline) {
|
|
30190
|
-
|
|
30225
|
+
sleepSync(50);
|
|
30191
30226
|
}
|
|
30192
30227
|
}
|
|
30193
30228
|
function readAllPersistedSyncWorkspaceIds(stateDir) {
|
|
@@ -32130,6 +32165,12 @@ if (argv[0] === "self-launch-check") {
|
|
|
32130
32165
|
`);
|
|
32131
32166
|
process.exit(verdict.ok ? 0 : 1);
|
|
32132
32167
|
}
|
|
32168
|
+
if (argv[0] === "sleep-sync-check") {
|
|
32169
|
+
const verdict = sleepSyncCheck();
|
|
32170
|
+
(verdict.ok ? process.stdout : process.stderr).write(`${verdict.message}
|
|
32171
|
+
`);
|
|
32172
|
+
process.exit(verdict.ok ? 0 : 1);
|
|
32173
|
+
}
|
|
32133
32174
|
var staleBundle = bundleStaleness({ built: builtVersion(), current: crewVersion(CREW_HOME), home: CREW_HOME, compiled: isCompiledBinary(import.meta.url) });
|
|
32134
32175
|
if (staleBundle) process.stderr.write(`crew: warning: ${staleBundle.message}
|
|
32135
32176
|
`);
|
|
@@ -32671,7 +32712,8 @@ if (command === "passenger-sync-daemon") {
|
|
|
32671
32712
|
const DAEMON_SUBCOMMANDS = /* @__PURE__ */ new Set(["start", "stop", "status", "restart"]);
|
|
32672
32713
|
const worktreeArgs = command === "worktree" ? splitWorktreeArgs(positional, cfg.routes.map((r) => r.route)) : void 0;
|
|
32673
32714
|
const named = worktreeArgs ? worktreeArgs.route : command === "daemon" && DAEMON_SUBCOMMANDS.has(positional[1] ?? "") ? positional[2] : positional[1];
|
|
32674
|
-
const fleetWide = command === "inbox" || command === "connect" || command === "disconnect" || command === "deprovision" || command === "agents" || command === "skills" || command === "logbook" || command === "repos" || command === "ship" || command === "projects" || command === "periscope" || command === "whoami" || command === "sandbox" || releaseFleetWide ||
|
|
32715
|
+
const fleetWide = command === "inbox" || command === "connect" || command === "disconnect" || command === "deprovision" || command === "agents" || command === "skills" || command === "logbook" || command === "repos" || command === "ship" || command === "projects" || command === "periscope" || command === "whoami" || command === "sandbox" || releaseFleetWide || // CREW-3875: the scheduler units are per ship and name no route, so a route given is ignored.
|
|
32716
|
+
command === "install" || command === "uninstall" || command === "pause" || command === "resume" || command === "reload" || FLEET_CAPABLE.has(command) && !named && cfg.routes.length > 1 || worktreeArgs !== void 0 && !named && cfg.routes.length > 1;
|
|
32675
32717
|
let route2;
|
|
32676
32718
|
try {
|
|
32677
32719
|
route2 = fleetWide ? cfg.routes[0] : findRoute(cfg, named);
|
|
@@ -33016,7 +33058,7 @@ if (command === "passenger-sync-daemon") {
|
|
|
33016
33058
|
`removing stale run timer from before the persistent-service cutover: ${staleTimer}${dryRun ? " (dry run, not applied)" : ""}`
|
|
33017
33059
|
);
|
|
33018
33060
|
if (!dryRun) {
|
|
33019
|
-
|
|
33061
|
+
spawnSync15("systemctl", ["--user", "disable", "--now", `${label}.timer`], { cwd: CREW_HOME, env: withUserBusEnv() });
|
|
33020
33062
|
try {
|
|
33021
33063
|
unlinkSync6(staleTimer);
|
|
33022
33064
|
} catch {
|
|
@@ -33101,7 +33143,7 @@ if (command === "passenger-sync-daemon") {
|
|
|
33101
33143
|
async function doctorFix(o) {
|
|
33102
33144
|
const routes = await Promise.all(routesInScope(cfg.routes, named).map((c) => gatherHealth({ route: c.route, enabled: c.enabled, hasRepos: reposOf(c).length > 0 }, () => routeProblems(c))));
|
|
33103
33145
|
const unitExists = (p) => existsSync60(p);
|
|
33104
|
-
const crontab = o.host === "linux" ?
|
|
33146
|
+
const crontab = o.host === "linux" ? spawnSync15("crontab", ["-l"], { encoding: "utf8" }).stdout ?? "" : "";
|
|
33105
33147
|
const schedulerAbsent = o.host !== "windows" ? !schedulerInstalled(planInstall(cfg.ship, CREW_HOME, o.host, detectSystemd(), "run", installContext()), unitExists, crontab) : true;
|
|
33106
33148
|
const plan = planFix({ routes, schedulerAbsent, host: o.host });
|
|
33107
33149
|
if (plan.actions.length === 0) {
|
|
@@ -33119,7 +33161,7 @@ if (command === "passenger-sync-daemon") {
|
|
|
33119
33161
|
if (a.kind === "refresh-snapshot") {
|
|
33120
33162
|
if (prompter && !await prompter.confirm(`${a.route}: the connect snapshot is out of date \u2014 run \`crew connect ${a.route}\` and reload the daemon?`, true)) continue;
|
|
33121
33163
|
const self = selfLaunch();
|
|
33122
|
-
const run4 = (args) =>
|
|
33164
|
+
const run4 = (args) => spawnSync15(self.command, [...self.args, ...args], { stdio: "inherit", cwd: process.cwd(), env: process.env });
|
|
33123
33165
|
const conn = run4(["connect", a.route]);
|
|
33124
33166
|
if (conn.status !== 0) {
|
|
33125
33167
|
process.stdout.write(`fix: crew connect ${a.route} exited ${conn.status ?? "abnormally"} \u2014 snapshot not refreshed
|
|
@@ -34658,7 +34700,7 @@ ${f2.tail.trimEnd()}
|
|
|
34658
34700
|
dryRun,
|
|
34659
34701
|
...o,
|
|
34660
34702
|
run: (c) => {
|
|
34661
|
-
const res2 =
|
|
34703
|
+
const res2 = spawnSync15(c[0], c.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() });
|
|
34662
34704
|
return res2.error ? null : { status: res2.status, stdout: res2.stdout ?? "", stderr: res2.stderr ?? "" };
|
|
34663
34705
|
}
|
|
34664
34706
|
});
|
|
@@ -34675,7 +34717,7 @@ ${f2.tail.trimEnd()}
|
|
|
34675
34717
|
if (dryRun) process.stdout.write(`would run: ${control.stopCommand.join(" ")}
|
|
34676
34718
|
`);
|
|
34677
34719
|
else {
|
|
34678
|
-
const res2 =
|
|
34720
|
+
const res2 = spawnSync15(control.stopCommand[0], control.stopCommand.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() });
|
|
34679
34721
|
if (res2.stdout) process.stdout.write(res2.stdout);
|
|
34680
34722
|
if (res2.stderr) process.stderr.write(res2.stderr);
|
|
34681
34723
|
}
|
|
@@ -34691,7 +34733,7 @@ ${f2.tail.trimEnd()}
|
|
|
34691
34733
|
}
|
|
34692
34734
|
let failed = false;
|
|
34693
34735
|
for (const cmd2 of commands) {
|
|
34694
|
-
const res2 =
|
|
34736
|
+
const res2 = spawnSync15(cmd2[0], cmd2.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() });
|
|
34695
34737
|
if (res2.stdout) process.stdout.write(res2.stdout);
|
|
34696
34738
|
if (res2.stderr) process.stderr.write(res2.stderr);
|
|
34697
34739
|
if (cmd2 === control.startCommand && (res2.error || res2.status !== 0)) {
|
|
@@ -34708,7 +34750,7 @@ ${f2.tail.trimEnd()}
|
|
|
34708
34750
|
`);
|
|
34709
34751
|
break;
|
|
34710
34752
|
}
|
|
34711
|
-
const res =
|
|
34753
|
+
const res = spawnSync15(cmd[0], cmd.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() });
|
|
34712
34754
|
if (res.stdout) process.stdout.write(res.stdout);
|
|
34713
34755
|
if (res.stderr) process.stderr.write(res.stderr);
|
|
34714
34756
|
if (daemonSub !== "status" && (res.error || res.status !== 0)) {
|
|
@@ -37246,7 +37288,7 @@ ${where.join("\n")}`);
|
|
|
37246
37288
|
process.stdout.write(upOutput(res, terminal));
|
|
37247
37289
|
const opener = openerFor(process.platform);
|
|
37248
37290
|
if (opener && shouldOpen({ open: flag("open"), noOpen: flag("no-open"), json: jsonP, terminal })) {
|
|
37249
|
-
const r =
|
|
37291
|
+
const r = spawnSync15(opener, [res.url], { stdio: "ignore" });
|
|
37250
37292
|
if (r.error || r.status !== 0) emit.warn(withFix(`crew periscope: could not open ${res.url} with ${opener}`, `open ${res.url} yourself`));
|
|
37251
37293
|
}
|
|
37252
37294
|
}
|
|
@@ -37587,10 +37629,10 @@ ${where.join("\n")}`);
|
|
|
37587
37629
|
}
|
|
37588
37630
|
const host = hostPlatform();
|
|
37589
37631
|
const control = host === "windows" ? null : planDaemonControl(CREW_HOME, host, detectSystemd());
|
|
37590
|
-
const unitStatus = control?.statusCommand ?
|
|
37632
|
+
const unitStatus = control?.statusCommand ? spawnSync15(control.statusCommand[0], control.statusCommand.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() }) : null;
|
|
37591
37633
|
const unitRunning = unitStatus !== null && !unitStatus.error && unitStatus.status === 0;
|
|
37592
37634
|
if (!unitRunning && control?.mechanism === "systemd" && control.startCommand) {
|
|
37593
|
-
const res =
|
|
37635
|
+
const res = spawnSync15(control.startCommand[0], control.startCommand.slice(1), { cwd: CREW_HOME, encoding: "utf8" });
|
|
37594
37636
|
if (res.error || res.status !== 0) {
|
|
37595
37637
|
emit.error(withFix(`crew reload: ${control.startCommand.join(" ")} exited ${res.status ?? "error"}`, "`crew doctor`"));
|
|
37596
37638
|
process.exitCode = 1;
|
|
@@ -37611,7 +37653,7 @@ ${where.join("\n")}`);
|
|
|
37611
37653
|
);
|
|
37612
37654
|
if (flag("now") && control?.stopCommand && control.startCommand) {
|
|
37613
37655
|
for (const cmd of [control.stopCommand, control.startCommand]) {
|
|
37614
|
-
const res =
|
|
37656
|
+
const res = spawnSync15(cmd[0], cmd.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() });
|
|
37615
37657
|
if (cmd === control.startCommand && (res.error || res.status !== 0)) {
|
|
37616
37658
|
emit.error(withFix(`crew reload: ${cmd.join(" ")} exited ${res.status ?? "error"}`, "`crew doctor`"));
|
|
37617
37659
|
process.exitCode = 1;
|
|
@@ -37751,7 +37793,7 @@ ${where.join("\n")}`);
|
|
|
37751
37793
|
writeFileSync45(join67(dir, "README.md"), SAMPLE_README);
|
|
37752
37794
|
writeFileSync45(join67(dir, ".crew.yaml"), SAMPLE_CREW_YAML);
|
|
37753
37795
|
const g = (...a) => {
|
|
37754
|
-
const r =
|
|
37796
|
+
const r = spawnSync15("git", a, { cwd: dir, encoding: "utf8" });
|
|
37755
37797
|
if (r.status !== 0) fail2(`git ${a[0]} failed in ${dir}: ${(r.stderr || r.stdout).trim()}`);
|
|
37756
37798
|
};
|
|
37757
37799
|
g("init", "-b", "main");
|
|
@@ -38440,7 +38482,7 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
|
|
|
38440
38482
|
const ctl = planDaemonControl(CREW_HOME, host, true);
|
|
38441
38483
|
const unitPlan = planInstall(cfg.ship, CREW_HOME, host, true, "run", installContext());
|
|
38442
38484
|
if (ctl.statusCommand && unitPlan.unitPaths.some((p) => existsSync60(p))) {
|
|
38443
|
-
const st =
|
|
38485
|
+
const st = spawnSync15(ctl.statusCommand[0], ctl.statusCommand.slice(1), { cwd: CREW_HOME, encoding: "utf8" });
|
|
38444
38486
|
if (!st.error && st.status !== 0) {
|
|
38445
38487
|
R.line("daemon unit: WARN installed but not running \u2014 no work is picked up; run `crew reload` (or `crew daemon start`), and `crew install` if the unit still says Restart=on-failure\n");
|
|
38446
38488
|
}
|
package/package.json
CHANGED