@archme/cli 0.14.6 → 0.14.7
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 +23 -11
- package/package.json +2 -2
- package/sandbox-image.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9653,8 +9653,7 @@ var init_launchctl = __esm({
|
|
|
9653
9653
|
let r = await bootstrap();
|
|
9654
9654
|
if (r.exitCode === 0 || r.exitCode === 17) return;
|
|
9655
9655
|
if (r.exitCode === 5) {
|
|
9656
|
-
await this.
|
|
9657
|
-
await new Promise((resolve7) => setTimeout(resolve7, 500));
|
|
9656
|
+
await this.stop();
|
|
9658
9657
|
r = await bootstrap();
|
|
9659
9658
|
if (r.exitCode === 0 || r.exitCode === 17) return;
|
|
9660
9659
|
}
|
|
@@ -9665,9 +9664,22 @@ var init_launchctl = __esm({
|
|
|
9665
9664
|
"bootout",
|
|
9666
9665
|
SERVICE_TARGET(this.opts.uid)
|
|
9667
9666
|
]);
|
|
9668
|
-
if (r.exitCode
|
|
9667
|
+
if (r.exitCode === 113) return;
|
|
9668
|
+
if (r.exitCode !== 0 && r.exitCode !== 3) {
|
|
9669
9669
|
throw new Error(`launchctl bootout failed (exit ${r.exitCode}): ${r.stderr || r.stdout}`);
|
|
9670
9670
|
}
|
|
9671
|
+
const pollMs = this.opts.stopPollMs ?? 250;
|
|
9672
|
+
const deadline = Date.now() + (this.opts.stopTimeoutMs ?? 25e3);
|
|
9673
|
+
const registered = async () => {
|
|
9674
|
+
const p = await this.opts.spawner.run("launchctl", ["print", SERVICE_TARGET(this.opts.uid)]);
|
|
9675
|
+
return !(p.exitCode === 113 || /Could not find/i.test(p.stderr));
|
|
9676
|
+
};
|
|
9677
|
+
while (await registered()) {
|
|
9678
|
+
if (Date.now() >= deadline) {
|
|
9679
|
+
throw new Error(`launchctl bootout: ${LABEL} is still registered with launchd after ${this.opts.stopTimeoutMs ?? 25e3}ms`);
|
|
9680
|
+
}
|
|
9681
|
+
await new Promise((resolve7) => setTimeout(resolve7, pollMs));
|
|
9682
|
+
}
|
|
9671
9683
|
}
|
|
9672
9684
|
async enable() {
|
|
9673
9685
|
const r = await this.opts.spawner.run("launchctl", ["enable", SERVICE_TARGET(this.opts.uid)]);
|
|
@@ -9684,7 +9696,7 @@ var init_launchctl = __esm({
|
|
|
9684
9696
|
async inspect() {
|
|
9685
9697
|
const printRes = await this.opts.spawner.run("launchctl", ["print", SERVICE_TARGET(this.opts.uid)]);
|
|
9686
9698
|
if (printRes.exitCode === 113 || /Could not find/i.test(printRes.stderr)) {
|
|
9687
|
-
return { loaded: false, running: false, pid: null, enabled:
|
|
9699
|
+
return { loaded: false, running: false, pid: null, enabled: await this.enabled() };
|
|
9688
9700
|
}
|
|
9689
9701
|
if (printRes.exitCode !== 0) {
|
|
9690
9702
|
throw new Error(`launchctl print failed (exit ${printRes.exitCode}): ${printRes.stderr || printRes.stdout}`);
|
|
@@ -9693,13 +9705,13 @@ var init_launchctl = __esm({
|
|
|
9693
9705
|
const stateMatch = printRes.stdout.match(/^\s*state\s*=\s*(\S+)/m);
|
|
9694
9706
|
const pid = pidMatch ? Number(pidMatch[1]) : null;
|
|
9695
9707
|
const running = pid != null && stateMatch?.[1] === "running";
|
|
9708
|
+
return { loaded: true, running, pid, enabled: await this.enabled() };
|
|
9709
|
+
}
|
|
9710
|
+
async enabled() {
|
|
9696
9711
|
const disRes = await this.opts.spawner.run("launchctl", ["print-disabled", DOMAIN(this.opts.uid)]);
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
if (re.test(disRes.stdout)) enabled = false;
|
|
9701
|
-
}
|
|
9702
|
-
return { loaded: true, running, pid, enabled };
|
|
9712
|
+
if (disRes.exitCode !== 0) return true;
|
|
9713
|
+
const re = new RegExp(`"${LABEL.replace(/\./g, "\\.")}"\\s*=>\\s*true`);
|
|
9714
|
+
return !re.test(disRes.stdout);
|
|
9703
9715
|
}
|
|
9704
9716
|
};
|
|
9705
9717
|
}
|
|
@@ -10653,7 +10665,7 @@ function bakedSystemdEnv(unit) {
|
|
|
10653
10665
|
function mergeUnitEnv(shell, unit) {
|
|
10654
10666
|
const out = {};
|
|
10655
10667
|
for (const k of ENV_KEYS_TO_BAKE) {
|
|
10656
|
-
const v = shell[k] !== void 0 ? shell[k] : unit[k];
|
|
10668
|
+
const v = k === "PATH" ? [...new Set(`${shell.PATH ?? ""}:${unit.PATH ?? ""}`.split(":").filter(Boolean))].join(":") : shell[k] !== void 0 ? shell[k] : unit[k];
|
|
10657
10669
|
if (v) out[k] = v;
|
|
10658
10670
|
}
|
|
10659
10671
|
return out;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archme/cli",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.7",
|
|
4
4
|
"description": "Map your codebase into a living architecture diagram: run `archme init` in a repo to scan it, `archme daemon start` to keep it current on every commit.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"build": "node scripts/build.mjs",
|
|
39
39
|
"build:check": "node scripts/smoke-build.mjs",
|
|
40
40
|
"prepublishOnly": "npm run build:check",
|
|
41
|
-
"test": "
|
|
41
|
+
"test": "node --liftoff-only --import tsx --test --experimental-test-module-mocks 'src/**/*.test.ts'",
|
|
42
42
|
"typecheck": "tsc --noEmit"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
package/sandbox-image.json
CHANGED