adhdev 0.8.56 → 0.8.57
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/index.js +193 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/vendor/terminal-mux-cli/index.js +41 -10
- package/vendor/terminal-mux-cli/index.mjs +40 -5
package/dist/cli/index.js
CHANGED
|
@@ -83381,7 +83381,7 @@ var init_adhdev_daemon = __esm({
|
|
|
83381
83381
|
import_ws3 = require("ws");
|
|
83382
83382
|
init_source();
|
|
83383
83383
|
init_version();
|
|
83384
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
83384
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.57" });
|
|
83385
83385
|
ACTIVE_CHAT_POLL_STATUSES = /* @__PURE__ */ new Set([
|
|
83386
83386
|
"generating",
|
|
83387
83387
|
"waiting_approval",
|
|
@@ -86442,6 +86442,12 @@ async function getDiagnosticsRuntimeGroups(diagnostics) {
|
|
|
86442
86442
|
}
|
|
86443
86443
|
return partitionRuntimeRecords(Array.isArray(diagnostics?.sessions) ? diagnostics.sessions : []);
|
|
86444
86444
|
}
|
|
86445
|
+
function getRuntimeGroupsHint(groups) {
|
|
86446
|
+
if (groups.liveRuntimes.length === 0 && groups.recoverySnapshots.length > 0) {
|
|
86447
|
+
return " No live attach targets right now. The records below are recovery snapshots, so recover or restart them instead of trying to attach.";
|
|
86448
|
+
}
|
|
86449
|
+
return null;
|
|
86450
|
+
}
|
|
86445
86451
|
function getRuntimeNextAction(record2, options) {
|
|
86446
86452
|
const lifecycle = String(record2?.lifecycle || "").trim();
|
|
86447
86453
|
if (["starting", "running", "stopping", "interrupted"].includes(lifecycle)) {
|
|
@@ -86467,6 +86473,7 @@ function formatRuntimeRecordLine(record2, options) {
|
|
|
86467
86473
|
async function printRuntimeGroups(records, options) {
|
|
86468
86474
|
const groups = options?.diagnostics ? await getDiagnosticsRuntimeGroups(options.diagnostics) : await partitionRuntimeRecords(records || []);
|
|
86469
86475
|
const includeInactive = options?.includeInactive === true;
|
|
86476
|
+
const groupsHint = getRuntimeGroupsHint(groups);
|
|
86470
86477
|
const sections = [
|
|
86471
86478
|
{ title: " Live Runtimes:", records: groups.liveRuntimes },
|
|
86472
86479
|
{ title: " Recovery Snapshots:", records: groups.recoverySnapshots, recoveryLabels: true }
|
|
@@ -86475,6 +86482,10 @@ async function printRuntimeGroups(records, options) {
|
|
|
86475
86482
|
sections.push({ title: " Inactive Records:", records: groups.inactiveRecords });
|
|
86476
86483
|
}
|
|
86477
86484
|
let printedSection = false;
|
|
86485
|
+
if (groupsHint) {
|
|
86486
|
+
console.log(source_default.yellow(groupsHint));
|
|
86487
|
+
console.log();
|
|
86488
|
+
}
|
|
86478
86489
|
for (const section of sections) {
|
|
86479
86490
|
if (section.records.length === 0) continue;
|
|
86480
86491
|
printedSection = true;
|
|
@@ -87152,6 +87163,95 @@ var os29 = __toESM(require("os"));
|
|
|
87152
87163
|
var path33 = __toESM(require("path"));
|
|
87153
87164
|
init_src();
|
|
87154
87165
|
init_session_host();
|
|
87166
|
+
|
|
87167
|
+
// src/cli/doctor-runtime-surface.ts
|
|
87168
|
+
function normalizeVersion(version2) {
|
|
87169
|
+
return String(version2 || "").trim().replace(/^v/i, "");
|
|
87170
|
+
}
|
|
87171
|
+
function extractNvmNodeVersion(pathValue) {
|
|
87172
|
+
const match = String(pathValue || "").match(/[\\/]\.nvm[\\/]versions[\\/]node[\\/](v[^\\/]+)[\\/]/i);
|
|
87173
|
+
return match?.[1] || null;
|
|
87174
|
+
}
|
|
87175
|
+
function evaluateCliDriftCheck(probe) {
|
|
87176
|
+
const parts = [probe.commandPath];
|
|
87177
|
+
if (probe.versionError || probe.helpError) {
|
|
87178
|
+
const error48 = probe.versionError || probe.helpError || "unknown failure";
|
|
87179
|
+
parts.push(`broken (${error48})`);
|
|
87180
|
+
return { ok: false, detail: parts.join(" \u2014 ") };
|
|
87181
|
+
}
|
|
87182
|
+
const detectedVersion = normalizeVersion(probe.version);
|
|
87183
|
+
const currentVersion = normalizeVersion(probe.currentVersion);
|
|
87184
|
+
const hasRuntimeSurface = /(^|\s)runtime(\s|$)/m.test(probe.helpText || "");
|
|
87185
|
+
let ok = true;
|
|
87186
|
+
if (detectedVersion) {
|
|
87187
|
+
parts.push(`v${detectedVersion}`);
|
|
87188
|
+
} else {
|
|
87189
|
+
parts.push("version unknown");
|
|
87190
|
+
ok = false;
|
|
87191
|
+
}
|
|
87192
|
+
if (detectedVersion && currentVersion && detectedVersion !== currentVersion) {
|
|
87193
|
+
parts.push(`stale vs current v${currentVersion}`);
|
|
87194
|
+
ok = false;
|
|
87195
|
+
}
|
|
87196
|
+
if (hasRuntimeSurface) {
|
|
87197
|
+
parts.push("runtime surface ok");
|
|
87198
|
+
} else {
|
|
87199
|
+
parts.push("missing runtime surface");
|
|
87200
|
+
ok = false;
|
|
87201
|
+
}
|
|
87202
|
+
return { ok, detail: parts.join(" \u2014 ") };
|
|
87203
|
+
}
|
|
87204
|
+
function evaluateAdhmuxHelpCheck(probe) {
|
|
87205
|
+
const parts = [probe.commandPath];
|
|
87206
|
+
if (probe.helpError) {
|
|
87207
|
+
parts.push(`broken (${probe.helpError})`);
|
|
87208
|
+
return { ok: false, detail: parts.join(" \u2014 ") };
|
|
87209
|
+
}
|
|
87210
|
+
const helpText = probe.helpText || "";
|
|
87211
|
+
const mentionsPowerUser = /power-user/i.test(helpText);
|
|
87212
|
+
const mentionsRuntimeSurface = /adhdev runtime/i.test(helpText);
|
|
87213
|
+
const ok = mentionsPowerUser && mentionsRuntimeSurface;
|
|
87214
|
+
parts.push(ok ? "help surface ok" : "missing runtime guidance");
|
|
87215
|
+
return { ok, detail: parts.join(" \u2014 ") };
|
|
87216
|
+
}
|
|
87217
|
+
function evaluateNodeInstallDrift(probe) {
|
|
87218
|
+
const currentNodeVersion = extractNvmNodeVersion(probe.currentExecPath);
|
|
87219
|
+
const commandNodeVersion = extractNvmNodeVersion(probe.commandPath);
|
|
87220
|
+
if (!currentNodeVersion || !commandNodeVersion) {
|
|
87221
|
+
return {
|
|
87222
|
+
ok: true,
|
|
87223
|
+
detail: "no obvious node install drift"
|
|
87224
|
+
};
|
|
87225
|
+
}
|
|
87226
|
+
if (currentNodeVersion === commandNodeVersion) {
|
|
87227
|
+
return {
|
|
87228
|
+
ok: true,
|
|
87229
|
+
detail: `node install roots aligned (${currentNodeVersion})`
|
|
87230
|
+
};
|
|
87231
|
+
}
|
|
87232
|
+
return {
|
|
87233
|
+
ok: false,
|
|
87234
|
+
detail: `node install drift: current runtime ${currentNodeVersion} vs resolved binary ${commandNodeVersion}`
|
|
87235
|
+
};
|
|
87236
|
+
}
|
|
87237
|
+
function buildDoctorAdvice(input) {
|
|
87238
|
+
const advice = [];
|
|
87239
|
+
if (input.adhdevCheck && !input.adhdevCheck.ok) {
|
|
87240
|
+
advice.push(`Refresh the PATH adhdev binary${input.adhdevPath ? ` at ${input.adhdevPath}` : ""} so it matches v${input.currentVersion}. Example: npm install -g adhdev@${input.currentVersion}`);
|
|
87241
|
+
if (input.sourceCliExample) {
|
|
87242
|
+
advice.push(`Until the PATH binary is fixed, use the source CLI directly: ${input.sourceCliExample}`);
|
|
87243
|
+
}
|
|
87244
|
+
}
|
|
87245
|
+
if (input.adhmuxCheck && !input.adhmuxCheck.ok) {
|
|
87246
|
+
advice.push(`Refresh the PATH adhmux binary${input.adhmuxPath ? ` at ${input.adhmuxPath}` : ""} by reinstalling the current adhdev package so the mux help/runtime guidance matches the current surface.`);
|
|
87247
|
+
}
|
|
87248
|
+
if (input.nodeDriftCheck && !input.nodeDriftCheck.ok) {
|
|
87249
|
+
advice.push("Align the Node version that launches adhdev with the Node install root that owns the PATH binary (for nvm users: run `nvm use <version>` and reopen the shell).");
|
|
87250
|
+
}
|
|
87251
|
+
return advice;
|
|
87252
|
+
}
|
|
87253
|
+
|
|
87254
|
+
// src/cli/doctor-commands.ts
|
|
87155
87255
|
function resolvePackageRoot() {
|
|
87156
87256
|
return path33.resolve(__dirname, "..", "..");
|
|
87157
87257
|
}
|
|
@@ -87318,6 +87418,36 @@ function findCommandPaths(command) {
|
|
|
87318
87418
|
return [];
|
|
87319
87419
|
}
|
|
87320
87420
|
}
|
|
87421
|
+
function probeCliBinary(commandPath, currentVersion) {
|
|
87422
|
+
const probe = {
|
|
87423
|
+
commandPath,
|
|
87424
|
+
currentVersion
|
|
87425
|
+
};
|
|
87426
|
+
try {
|
|
87427
|
+
probe.version = (0, import_child_process13.execFileSync)(commandPath, ["--version"], {
|
|
87428
|
+
encoding: "utf-8",
|
|
87429
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
87430
|
+
}).trim();
|
|
87431
|
+
} catch (error48) {
|
|
87432
|
+
probe.versionError = error48?.stderr?.toString?.().trim() || error48?.message || "version probe failed";
|
|
87433
|
+
}
|
|
87434
|
+
try {
|
|
87435
|
+
probe.helpText = (0, import_child_process13.execFileSync)(commandPath, ["--help"], {
|
|
87436
|
+
encoding: "utf-8",
|
|
87437
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
87438
|
+
});
|
|
87439
|
+
} catch (error48) {
|
|
87440
|
+
const stdout = error48?.stdout?.toString?.().trim() || "";
|
|
87441
|
+
const stderr = error48?.stderr?.toString?.().trim() || "";
|
|
87442
|
+
const combined = [stdout, stderr].filter(Boolean).join("\n");
|
|
87443
|
+
if (combined) {
|
|
87444
|
+
probe.helpText = combined;
|
|
87445
|
+
} else {
|
|
87446
|
+
probe.helpError = error48?.message || "help probe failed";
|
|
87447
|
+
}
|
|
87448
|
+
}
|
|
87449
|
+
return probe;
|
|
87450
|
+
}
|
|
87321
87451
|
function readLogHints(logPath) {
|
|
87322
87452
|
if (!fs25.existsSync(logPath)) return [];
|
|
87323
87453
|
try {
|
|
@@ -87363,6 +87493,8 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
87363
87493
|
const linked = isLinkedInstall(packageRoot);
|
|
87364
87494
|
const logPath = getCurrentDaemonLogPath();
|
|
87365
87495
|
const claudePaths = findCommandPaths("claude");
|
|
87496
|
+
const adhdevPaths = findCommandPaths("adhdev");
|
|
87497
|
+
const adhmuxPaths = findCommandPaths("adhmux");
|
|
87366
87498
|
const nativeSharpPackage = process.platform === "win32" ? "@img/sharp-win32-x64" : process.platform === "darwin" ? process.arch === "arm64" ? "@img/sharp-darwin-arm64" : "@img/sharp-darwin-x64" : process.arch === "arm64" ? "@img/sharp-linux-arm64" : "@img/sharp-linux-x64";
|
|
87367
87499
|
const checks = [
|
|
87368
87500
|
{
|
|
@@ -87375,6 +87507,16 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
87375
87507
|
ok: true,
|
|
87376
87508
|
detail: cliPath
|
|
87377
87509
|
},
|
|
87510
|
+
{
|
|
87511
|
+
label: "adhdev on PATH",
|
|
87512
|
+
ok: adhdevPaths.length > 0,
|
|
87513
|
+
detail: adhdevPaths.length > 0 ? adhdevPaths.join(", ") : "not found on PATH"
|
|
87514
|
+
},
|
|
87515
|
+
{
|
|
87516
|
+
label: "adhmux on PATH",
|
|
87517
|
+
ok: adhmuxPaths.length > 0,
|
|
87518
|
+
detail: adhmuxPaths.length > 0 ? adhmuxPaths.join(", ") : "not found on PATH"
|
|
87519
|
+
},
|
|
87378
87520
|
{
|
|
87379
87521
|
label: "Claude CLI",
|
|
87380
87522
|
ok: claudePaths.length > 0,
|
|
@@ -87392,6 +87534,40 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
87392
87534
|
...probeConfigAccess(),
|
|
87393
87535
|
...buildBrowseProbeChecks()
|
|
87394
87536
|
];
|
|
87537
|
+
let runtimeSurfaceCheck = null;
|
|
87538
|
+
let nodeDriftCheck = null;
|
|
87539
|
+
let adhmuxHelpCheck = null;
|
|
87540
|
+
if (adhdevPaths.length > 0) {
|
|
87541
|
+
const runtimeSurfaceProbe = probeCliBinary(adhdevPaths[0], pkgVersion3);
|
|
87542
|
+
runtimeSurfaceCheck = evaluateCliDriftCheck(runtimeSurfaceProbe);
|
|
87543
|
+
checks.push({
|
|
87544
|
+
label: "adhdev runtime surface",
|
|
87545
|
+
ok: runtimeSurfaceCheck.ok,
|
|
87546
|
+
detail: runtimeSurfaceCheck.detail
|
|
87547
|
+
});
|
|
87548
|
+
nodeDriftCheck = evaluateNodeInstallDrift({
|
|
87549
|
+
currentExecPath: process.execPath,
|
|
87550
|
+
commandPath: adhdevPaths[0]
|
|
87551
|
+
});
|
|
87552
|
+
checks.push({
|
|
87553
|
+
label: "Node install drift",
|
|
87554
|
+
ok: nodeDriftCheck.ok,
|
|
87555
|
+
detail: nodeDriftCheck.detail
|
|
87556
|
+
});
|
|
87557
|
+
}
|
|
87558
|
+
if (adhmuxPaths.length > 0) {
|
|
87559
|
+
const adhmuxHelpProbe = probeCliBinary(adhmuxPaths[0], pkgVersion3);
|
|
87560
|
+
adhmuxHelpCheck = evaluateAdhmuxHelpCheck({
|
|
87561
|
+
commandPath: adhmuxPaths[0],
|
|
87562
|
+
helpText: adhmuxHelpProbe.helpText,
|
|
87563
|
+
helpError: adhmuxHelpProbe.helpError
|
|
87564
|
+
});
|
|
87565
|
+
checks.push({
|
|
87566
|
+
label: "adhmux help surface",
|
|
87567
|
+
ok: adhmuxHelpCheck.ok,
|
|
87568
|
+
detail: adhmuxHelpCheck.detail
|
|
87569
|
+
});
|
|
87570
|
+
}
|
|
87395
87571
|
try {
|
|
87396
87572
|
const sessionHostPid = getSessionHostPid();
|
|
87397
87573
|
const probe = await probeSessionHostStatus();
|
|
@@ -87439,6 +87615,15 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
87439
87615
|
const failures = checks.filter((check2) => !check2.ok && check2.fatal);
|
|
87440
87616
|
const warnings = checks.filter((check2) => !check2.ok && !check2.fatal);
|
|
87441
87617
|
const logHints = readLogHints(logPath);
|
|
87618
|
+
const advice = buildDoctorAdvice({
|
|
87619
|
+
currentVersion: pkgVersion3,
|
|
87620
|
+
adhdevPath: adhdevPaths[0],
|
|
87621
|
+
adhdevCheck: runtimeSurfaceCheck || void 0,
|
|
87622
|
+
adhmuxPath: adhmuxPaths[0],
|
|
87623
|
+
adhmuxCheck: adhmuxHelpCheck || void 0,
|
|
87624
|
+
nodeDriftCheck: nodeDriftCheck || void 0,
|
|
87625
|
+
sourceCliExample: "node --import tsx packages/daemon-cloud/src/cli/index.ts doctor"
|
|
87626
|
+
});
|
|
87442
87627
|
const sessionHostLogPath = path33.join(os29.homedir(), ".adhdev", "logs", "session-host.log");
|
|
87443
87628
|
console.log(source_default.bold("\n\u{1FA7A} ADHDev Doctor\n"));
|
|
87444
87629
|
console.log(source_default.gray(` Version: ${pkgVersion3}`));
|
|
@@ -87462,6 +87647,13 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
87462
87647
|
console.log();
|
|
87463
87648
|
console.log(source_default.yellow(` Warning: ${warnings.length} optional check failed.`));
|
|
87464
87649
|
}
|
|
87650
|
+
if (advice.length > 0) {
|
|
87651
|
+
console.log();
|
|
87652
|
+
console.log(source_default.bold(" Suggested actions:"));
|
|
87653
|
+
for (const line of advice) {
|
|
87654
|
+
console.log(source_default.gray(` - ${line}`));
|
|
87655
|
+
}
|
|
87656
|
+
}
|
|
87465
87657
|
if (failures.length > 0) {
|
|
87466
87658
|
console.log();
|
|
87467
87659
|
console.log(source_default.red(` Doctor found ${failures.length} blocking issue(s).`));
|