@nodii/dev 0.6.129 → 0.6.130
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/core.js +1 -1
- package/dist/watchdog.js +16 -2
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
4
4
|
import { homedir, platform } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
|
|
7
|
-
export const VERSION = "0.6.
|
|
7
|
+
export const VERSION = "0.6.130";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
package/dist/watchdog.js
CHANGED
|
@@ -398,9 +398,23 @@ export async function sweepWatchdog({
|
|
|
398
398
|
|
|
399
399
|
const xml = (value) => String(value).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
400
400
|
|
|
401
|
-
|
|
401
|
+
/**
|
|
402
|
+
* hub-251: launchd starts a job with PATH=/usr/bin:/bin:/usr/sbin:/sbin, where
|
|
403
|
+
* a lane runtime such as `claude` (~/.local/bin) or `codex` is not found, so a
|
|
404
|
+
* resume-due lane's relaunch failed with `Executable not found in $PATH`. The
|
|
405
|
+
* plist carries the installing shell's PATH, plus the directory of the runtime
|
|
406
|
+
* that runs the CLI.
|
|
407
|
+
*/
|
|
408
|
+
export function watchdogPath(envPath = process.env.PATH, runtime = process.execPath) {
|
|
409
|
+
const dirs = [dirname(runtime), ...String(envPath ?? "").split(":"), "/usr/bin", "/bin", "/usr/sbin", "/sbin"];
|
|
410
|
+
// A package runner's own bins (npx's _npx cache, node_modules/.bin) are left out: they are temporary.
|
|
411
|
+
const kept = dirs.filter((dir) => dir && dir.startsWith("/") && !dir.includes("/node_modules/") && !dir.includes("/_npx/"));
|
|
412
|
+
return [...new Set(kept)].join(":");
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export function launchdPlist({ runtime, entry, config, interval, stdoutPath, stderrPath, path = watchdogPath(undefined, runtime) }) {
|
|
402
416
|
const args = [runtime, entry, "watchdog", "sweep", "--json"].map((value) => `<string>${xml(value)}</string>`).join("");
|
|
403
|
-
return `<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict><key>Label</key><string>${WATCHDOG_LABEL}</string><key>ProgramArguments</key><array>${args}</array><key>EnvironmentVariables</key><dict><key>NODII_DEV_CONFIG_PATH</key><string>${xml(config)}</string></dict><key>RunAtLoad</key><true/><key>StartInterval</key><integer>${interval}</integer><key>ProcessType</key><string>Background</string><key>StandardOutPath</key><string>${xml(stdoutPath)}</string><key>StandardErrorPath</key><string>${xml(stderrPath)}</string></dict></plist>\n`;
|
|
417
|
+
return `<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict><key>Label</key><string>${WATCHDOG_LABEL}</string><key>ProgramArguments</key><array>${args}</array><key>EnvironmentVariables</key><dict><key>NODII_DEV_CONFIG_PATH</key><string>${xml(config)}</string><key>PATH</key><string>${xml(path)}</string></dict><key>RunAtLoad</key><true/><key>StartInterval</key><integer>${interval}</integer><key>ProcessType</key><string>Background</string><key>StandardOutPath</key><string>${xml(stdoutPath)}</string><key>StandardErrorPath</key><string>${xml(stderrPath)}</string></dict></plist>\n`;
|
|
404
418
|
}
|
|
405
419
|
|
|
406
420
|
export async function installWatchdog({
|