adhdev 0.8.13 → 0.8.15
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 +243 -93
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +125 -92
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/cli/index.js
CHANGED
|
@@ -5459,8 +5459,24 @@ var init_stream_commands = __esm({
|
|
|
5459
5459
|
});
|
|
5460
5460
|
|
|
5461
5461
|
// ../../oss/packages/daemon-core/src/commands/workspace-commands.ts
|
|
5462
|
+
function loadWorkspaceConfig() {
|
|
5463
|
+
try {
|
|
5464
|
+
return loadConfig();
|
|
5465
|
+
} catch (e) {
|
|
5466
|
+
return { error: `Could not load config: ${e?.message || "unknown error"}` };
|
|
5467
|
+
}
|
|
5468
|
+
}
|
|
5469
|
+
function persistWorkspaceConfig(config2) {
|
|
5470
|
+
try {
|
|
5471
|
+
saveConfig(config2);
|
|
5472
|
+
return { ok: true };
|
|
5473
|
+
} catch (e) {
|
|
5474
|
+
return { error: `Could not save config: ${e?.message || "unknown error"}` };
|
|
5475
|
+
}
|
|
5476
|
+
}
|
|
5462
5477
|
function handleWorkspaceList() {
|
|
5463
|
-
const config2 =
|
|
5478
|
+
const config2 = loadWorkspaceConfig();
|
|
5479
|
+
if ("error" in config2) return { success: false, error: config2.error };
|
|
5464
5480
|
const state = getWorkspaceState(config2);
|
|
5465
5481
|
return {
|
|
5466
5482
|
success: true,
|
|
@@ -5474,31 +5490,37 @@ function handleWorkspaceAdd(args) {
|
|
|
5474
5490
|
const label = (args?.label || "").trim() || void 0;
|
|
5475
5491
|
const createIfMissing = args?.createIfMissing === true;
|
|
5476
5492
|
if (!rawPath) return { success: false, error: "path required" };
|
|
5477
|
-
const config2 =
|
|
5493
|
+
const config2 = loadWorkspaceConfig();
|
|
5494
|
+
if ("error" in config2) return { success: false, error: config2.error };
|
|
5478
5495
|
const result = addWorkspaceEntry(config2, rawPath, label, { createIfMissing });
|
|
5479
5496
|
if ("error" in result) return { success: false, error: result.error };
|
|
5480
|
-
|
|
5497
|
+
const saveResult = persistWorkspaceConfig(result.config);
|
|
5498
|
+
if ("error" in saveResult) return { success: false, error: saveResult.error };
|
|
5481
5499
|
const state = getWorkspaceState(result.config);
|
|
5482
5500
|
return { success: true, entry: result.entry, ...state };
|
|
5483
5501
|
}
|
|
5484
5502
|
function handleWorkspaceRemove(args) {
|
|
5485
5503
|
const id = (args?.id || "").trim();
|
|
5486
5504
|
if (!id) return { success: false, error: "id required" };
|
|
5487
|
-
const config2 =
|
|
5505
|
+
const config2 = loadWorkspaceConfig();
|
|
5506
|
+
if ("error" in config2) return { success: false, error: config2.error };
|
|
5488
5507
|
const removed = (config2.workspaces || []).find((w) => w.id === id);
|
|
5489
5508
|
const result = removeWorkspaceEntry(config2, id);
|
|
5490
5509
|
if ("error" in result) return { success: false, error: result.error };
|
|
5491
|
-
|
|
5510
|
+
const saveResult = persistWorkspaceConfig(result.config);
|
|
5511
|
+
if ("error" in saveResult) return { success: false, error: saveResult.error };
|
|
5492
5512
|
const state = getWorkspaceState(result.config);
|
|
5493
5513
|
return { success: true, removedId: id, ...state };
|
|
5494
5514
|
}
|
|
5495
5515
|
function handleWorkspaceSetDefault(args) {
|
|
5496
5516
|
const clear = args?.clear === true || args?.id === null || args?.id === "";
|
|
5497
5517
|
if (clear) {
|
|
5498
|
-
const config3 =
|
|
5518
|
+
const config3 = loadWorkspaceConfig();
|
|
5519
|
+
if ("error" in config3) return { success: false, error: config3.error };
|
|
5499
5520
|
const result2 = setDefaultWorkspaceId(config3, null);
|
|
5500
5521
|
if ("error" in result2) return { success: false, error: result2.error };
|
|
5501
|
-
|
|
5522
|
+
const saveResult2 = persistWorkspaceConfig(result2.config);
|
|
5523
|
+
if ("error" in saveResult2) return { success: false, error: saveResult2.error };
|
|
5502
5524
|
const state2 = getWorkspaceState(result2.config);
|
|
5503
5525
|
return {
|
|
5504
5526
|
success: true,
|
|
@@ -5510,7 +5532,9 @@ function handleWorkspaceSetDefault(args) {
|
|
|
5510
5532
|
if (!pathArg && !idArg) {
|
|
5511
5533
|
return { success: false, error: "id or path required (or clear: true)" };
|
|
5512
5534
|
}
|
|
5513
|
-
|
|
5535
|
+
const configResult = loadWorkspaceConfig();
|
|
5536
|
+
if ("error" in configResult) return { success: false, error: configResult.error };
|
|
5537
|
+
let config2 = configResult;
|
|
5514
5538
|
let nextId;
|
|
5515
5539
|
if (pathArg) {
|
|
5516
5540
|
let w = findWorkspaceByPath(config2, pathArg);
|
|
@@ -5526,7 +5550,8 @@ function handleWorkspaceSetDefault(args) {
|
|
|
5526
5550
|
}
|
|
5527
5551
|
const result = setDefaultWorkspaceId(config2, nextId);
|
|
5528
5552
|
if ("error" in result) return { success: false, error: result.error };
|
|
5529
|
-
|
|
5553
|
+
const saveResult = persistWorkspaceConfig(result.config);
|
|
5554
|
+
if ("error" in saveResult) return { success: false, error: saveResult.error };
|
|
5530
5555
|
const state = getWorkspaceState(result.config);
|
|
5531
5556
|
return { success: true, ...state };
|
|
5532
5557
|
}
|
|
@@ -6297,71 +6322,6 @@ var init_terminal_screen = __esm({
|
|
|
6297
6322
|
}
|
|
6298
6323
|
});
|
|
6299
6324
|
|
|
6300
|
-
// ../../oss/packages/daemon-core/src/cli-adapters/pty-transport.ts
|
|
6301
|
-
var os7, pty, NodePtyRuntimeTransport, NodePtyTransportFactory;
|
|
6302
|
-
var init_pty_transport = __esm({
|
|
6303
|
-
"../../oss/packages/daemon-core/src/cli-adapters/pty-transport.ts"() {
|
|
6304
|
-
"use strict";
|
|
6305
|
-
os7 = __toESM(require("os"));
|
|
6306
|
-
try {
|
|
6307
|
-
pty = require("node-pty");
|
|
6308
|
-
} catch {
|
|
6309
|
-
pty = null;
|
|
6310
|
-
}
|
|
6311
|
-
NodePtyRuntimeTransport = class {
|
|
6312
|
-
constructor(handle) {
|
|
6313
|
-
this.handle = handle;
|
|
6314
|
-
}
|
|
6315
|
-
ready = Promise.resolve();
|
|
6316
|
-
terminalQueriesHandled = false;
|
|
6317
|
-
get pid() {
|
|
6318
|
-
return this.handle.pid;
|
|
6319
|
-
}
|
|
6320
|
-
write(data) {
|
|
6321
|
-
this.handle.write(data);
|
|
6322
|
-
}
|
|
6323
|
-
resize(cols, rows) {
|
|
6324
|
-
this.handle.resize(cols, rows);
|
|
6325
|
-
}
|
|
6326
|
-
kill() {
|
|
6327
|
-
this.handle.kill();
|
|
6328
|
-
}
|
|
6329
|
-
getMetadata() {
|
|
6330
|
-
return null;
|
|
6331
|
-
}
|
|
6332
|
-
onData(callback) {
|
|
6333
|
-
this.handle.onData(callback);
|
|
6334
|
-
}
|
|
6335
|
-
onExit(callback) {
|
|
6336
|
-
this.handle.onExit(callback);
|
|
6337
|
-
}
|
|
6338
|
-
};
|
|
6339
|
-
NodePtyTransportFactory = class {
|
|
6340
|
-
spawn(command, args, options) {
|
|
6341
|
-
if (!pty) throw new Error("node-pty is not installed");
|
|
6342
|
-
let cwd = options.cwd;
|
|
6343
|
-
if (cwd) {
|
|
6344
|
-
try {
|
|
6345
|
-
const fs19 = require("fs");
|
|
6346
|
-
const stat4 = fs19.statSync(cwd);
|
|
6347
|
-
if (!stat4.isDirectory()) cwd = os7.homedir();
|
|
6348
|
-
} catch {
|
|
6349
|
-
cwd = os7.homedir();
|
|
6350
|
-
}
|
|
6351
|
-
}
|
|
6352
|
-
const handle = pty.spawn(command, args, {
|
|
6353
|
-
name: "xterm-256color",
|
|
6354
|
-
cols: options.cols,
|
|
6355
|
-
rows: options.rows,
|
|
6356
|
-
cwd,
|
|
6357
|
-
env: options.env
|
|
6358
|
-
});
|
|
6359
|
-
return new NodePtyRuntimeTransport(handle);
|
|
6360
|
-
}
|
|
6361
|
-
};
|
|
6362
|
-
}
|
|
6363
|
-
});
|
|
6364
|
-
|
|
6365
6325
|
// ../../oss/packages/session-host-core/dist/index.mjs
|
|
6366
6326
|
function getDefaultSessionHostEndpoint(appName = "adhdev") {
|
|
6367
6327
|
if (process.platform === "win32") {
|
|
@@ -6372,7 +6332,7 @@ function getDefaultSessionHostEndpoint(appName = "adhdev") {
|
|
|
6372
6332
|
}
|
|
6373
6333
|
return {
|
|
6374
6334
|
kind: "unix",
|
|
6375
|
-
path: path22.join(
|
|
6335
|
+
path: path22.join(os7.tmpdir(), `${appName}-session-host.sock`)
|
|
6376
6336
|
};
|
|
6377
6337
|
}
|
|
6378
6338
|
function serializeEnvelope(envelope) {
|
|
@@ -6437,11 +6397,11 @@ function ensureNodePtySpawnHelperPermissions(logFn) {
|
|
|
6437
6397
|
} catch {
|
|
6438
6398
|
}
|
|
6439
6399
|
}
|
|
6440
|
-
var
|
|
6400
|
+
var os7, path22, net, import_crypto3, os22, path32, __require, SessionHostClient;
|
|
6441
6401
|
var init_dist = __esm({
|
|
6442
6402
|
"../../oss/packages/session-host-core/dist/index.mjs"() {
|
|
6443
6403
|
"use strict";
|
|
6444
|
-
|
|
6404
|
+
os7 = __toESM(require("os"), 1);
|
|
6445
6405
|
path22 = __toESM(require("path"), 1);
|
|
6446
6406
|
net = __toESM(require("net"), 1);
|
|
6447
6407
|
import_crypto3 = require("crypto");
|
|
@@ -6570,6 +6530,78 @@ var init_spawn_env = __esm({
|
|
|
6570
6530
|
}
|
|
6571
6531
|
});
|
|
6572
6532
|
|
|
6533
|
+
// ../../oss/packages/daemon-core/src/cli-adapters/pty-transport.ts
|
|
6534
|
+
function loadNodePty() {
|
|
6535
|
+
if (cachedPty !== void 0) return cachedPty;
|
|
6536
|
+
try {
|
|
6537
|
+
cachedPty = require("node-pty");
|
|
6538
|
+
ensureNodePtySpawnHelperPermissions();
|
|
6539
|
+
} catch {
|
|
6540
|
+
cachedPty = null;
|
|
6541
|
+
}
|
|
6542
|
+
return cachedPty;
|
|
6543
|
+
}
|
|
6544
|
+
var os8, cachedPty, NodePtyRuntimeTransport, NodePtyTransportFactory;
|
|
6545
|
+
var init_pty_transport = __esm({
|
|
6546
|
+
"../../oss/packages/daemon-core/src/cli-adapters/pty-transport.ts"() {
|
|
6547
|
+
"use strict";
|
|
6548
|
+
os8 = __toESM(require("os"));
|
|
6549
|
+
init_spawn_env();
|
|
6550
|
+
NodePtyRuntimeTransport = class {
|
|
6551
|
+
constructor(handle) {
|
|
6552
|
+
this.handle = handle;
|
|
6553
|
+
}
|
|
6554
|
+
ready = Promise.resolve();
|
|
6555
|
+
terminalQueriesHandled = false;
|
|
6556
|
+
get pid() {
|
|
6557
|
+
return this.handle.pid;
|
|
6558
|
+
}
|
|
6559
|
+
write(data) {
|
|
6560
|
+
this.handle.write(data);
|
|
6561
|
+
}
|
|
6562
|
+
resize(cols, rows) {
|
|
6563
|
+
this.handle.resize(cols, rows);
|
|
6564
|
+
}
|
|
6565
|
+
kill() {
|
|
6566
|
+
this.handle.kill();
|
|
6567
|
+
}
|
|
6568
|
+
getMetadata() {
|
|
6569
|
+
return null;
|
|
6570
|
+
}
|
|
6571
|
+
onData(callback) {
|
|
6572
|
+
this.handle.onData(callback);
|
|
6573
|
+
}
|
|
6574
|
+
onExit(callback) {
|
|
6575
|
+
this.handle.onExit(callback);
|
|
6576
|
+
}
|
|
6577
|
+
};
|
|
6578
|
+
NodePtyTransportFactory = class {
|
|
6579
|
+
spawn(command, args, options) {
|
|
6580
|
+
const pty = loadNodePty();
|
|
6581
|
+
if (!pty) throw new Error("node-pty is not installed");
|
|
6582
|
+
let cwd = options.cwd;
|
|
6583
|
+
if (cwd) {
|
|
6584
|
+
try {
|
|
6585
|
+
const fs19 = require("fs");
|
|
6586
|
+
const stat4 = fs19.statSync(cwd);
|
|
6587
|
+
if (!stat4.isDirectory()) cwd = os8.homedir();
|
|
6588
|
+
} catch {
|
|
6589
|
+
cwd = os8.homedir();
|
|
6590
|
+
}
|
|
6591
|
+
}
|
|
6592
|
+
const handle = pty.spawn(command, args, {
|
|
6593
|
+
name: "xterm-256color",
|
|
6594
|
+
cols: options.cols,
|
|
6595
|
+
rows: options.rows,
|
|
6596
|
+
cwd,
|
|
6597
|
+
env: options.env
|
|
6598
|
+
});
|
|
6599
|
+
return new NodePtyRuntimeTransport(handle);
|
|
6600
|
+
}
|
|
6601
|
+
};
|
|
6602
|
+
}
|
|
6603
|
+
});
|
|
6604
|
+
|
|
6573
6605
|
// ../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts
|
|
6574
6606
|
var provider_cli_adapter_exports = {};
|
|
6575
6607
|
__export(provider_cli_adapter_exports, {
|
|
@@ -6713,7 +6745,7 @@ function normalizeCliProviderForRuntime(raw) {
|
|
|
6713
6745
|
}
|
|
6714
6746
|
};
|
|
6715
6747
|
}
|
|
6716
|
-
var os9, path7, import_child_process4,
|
|
6748
|
+
var os9, path7, import_child_process4, buildCliSpawnEnv, ProviderCliAdapter;
|
|
6717
6749
|
var init_provider_cli_adapter = __esm({
|
|
6718
6750
|
"../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts"() {
|
|
6719
6751
|
"use strict";
|
|
@@ -6724,12 +6756,6 @@ var init_provider_cli_adapter = __esm({
|
|
|
6724
6756
|
init_terminal_screen();
|
|
6725
6757
|
init_pty_transport();
|
|
6726
6758
|
init_spawn_env();
|
|
6727
|
-
try {
|
|
6728
|
-
pty2 = require("node-pty");
|
|
6729
|
-
ensureNodePtySpawnHelperPermissions((msg) => LOG.info("CLI", msg));
|
|
6730
|
-
} catch {
|
|
6731
|
-
LOG.error("CLI", "[ProviderCliAdapter] node-pty not found. Terminal features disabled.");
|
|
6732
|
-
}
|
|
6733
6759
|
buildCliSpawnEnv = sanitizeSpawnEnv;
|
|
6734
6760
|
ProviderCliAdapter = class _ProviderCliAdapter {
|
|
6735
6761
|
constructor(provider, workingDir, extraArgs = [], transportFactory = new NodePtyTransportFactory()) {
|
|
@@ -7053,13 +7079,16 @@ var init_provider_cli_adapter = __esm({
|
|
|
7053
7079
|
let shellArgs;
|
|
7054
7080
|
const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
|
|
7055
7081
|
const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
|
|
7056
|
-
const
|
|
7082
|
+
const useShellWin = isCmdShim || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath);
|
|
7083
|
+
const useShell = isWin ? useShellWin : useShellUnix;
|
|
7057
7084
|
if (useShell) {
|
|
7058
7085
|
if (!spawnConfig.shell && !isWin) {
|
|
7059
7086
|
LOG.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
|
|
7060
7087
|
}
|
|
7061
7088
|
if (isCmdShim) {
|
|
7062
7089
|
LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
|
|
7090
|
+
} else if (isWin) {
|
|
7091
|
+
LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell on Windows: ${binaryPath}`);
|
|
7063
7092
|
}
|
|
7064
7093
|
shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
|
|
7065
7094
|
if (isWin) {
|
|
@@ -7069,6 +7098,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
7069
7098
|
shellArgs = ["-l", "-c", fullCmd];
|
|
7070
7099
|
}
|
|
7071
7100
|
} else {
|
|
7101
|
+
if (isWin && spawnConfig.shell) {
|
|
7102
|
+
LOG.info("CLI", `[${this.cliType}] Spawning Windows binary directly without cmd.exe: ${binaryPath}`);
|
|
7103
|
+
}
|
|
7072
7104
|
shellCmd = binaryPath;
|
|
7073
7105
|
shellArgs = allArgs;
|
|
7074
7106
|
}
|
|
@@ -34494,10 +34526,10 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
34494
34526
|
let isPty = false;
|
|
34495
34527
|
const { spawn: spawnFn } = await import("child_process");
|
|
34496
34528
|
try {
|
|
34497
|
-
const
|
|
34529
|
+
const pty = require("node-pty");
|
|
34498
34530
|
ctx.log(`Auto-implement spawn (PTY): ${shellCmd}`);
|
|
34499
34531
|
const isWin2 = os18.platform() === "win32";
|
|
34500
|
-
child =
|
|
34532
|
+
child = pty.spawn(isWin2 ? "cmd.exe" : process.env.SHELL || "/bin/zsh", [isWin2 ? "/c" : "-c", shellCmd], {
|
|
34501
34533
|
name: "xterm-256color",
|
|
34502
34534
|
cols: 120,
|
|
34503
34535
|
rows: 40,
|
|
@@ -45988,7 +46020,7 @@ function getSessionHostPid() {
|
|
|
45988
46020
|
function killPid2(pid) {
|
|
45989
46021
|
try {
|
|
45990
46022
|
if (process.platform === "win32") {
|
|
45991
|
-
(0, import_child_process11.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore" });
|
|
46023
|
+
(0, import_child_process11.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
|
|
45992
46024
|
} else {
|
|
45993
46025
|
process.kill(pid, "SIGTERM");
|
|
45994
46026
|
}
|
|
@@ -46006,7 +46038,7 @@ function getWindowsProcessCommandLine(pid) {
|
|
|
46006
46038
|
pidFilter,
|
|
46007
46039
|
"get",
|
|
46008
46040
|
"CommandLine"
|
|
46009
|
-
], { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "ignore"] });
|
|
46041
|
+
], { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
|
|
46010
46042
|
const text = wmicOut.trim();
|
|
46011
46043
|
if (text) return text;
|
|
46012
46044
|
} catch {
|
|
@@ -46019,7 +46051,7 @@ function getWindowsProcessCommandLine(pid) {
|
|
|
46019
46051
|
"Bypass",
|
|
46020
46052
|
"-Command",
|
|
46021
46053
|
`(Get-CimInstance Win32_Process -Filter "${pidFilter}").CommandLine`
|
|
46022
|
-
], { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "ignore"] });
|
|
46054
|
+
], { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
|
|
46023
46055
|
const text = psOut.trim();
|
|
46024
46056
|
if (text) return text;
|
|
46025
46057
|
} catch {
|
|
@@ -46048,7 +46080,8 @@ function stopSessionHost() {
|
|
|
46048
46080
|
const raw = (0, import_child_process11.execFileSync)("tasklist", ["/FO", "CSV", "/NH", "/FI", "IMAGENAME eq node.exe"], {
|
|
46049
46081
|
encoding: "utf8",
|
|
46050
46082
|
timeout: 5e3,
|
|
46051
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
46083
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
46084
|
+
windowsHide: true
|
|
46052
46085
|
}).trim();
|
|
46053
46086
|
for (const line of raw.split(/\r?\n/)) {
|
|
46054
46087
|
const match = line.match(/^"node\.exe","(\d+)"/i);
|
|
@@ -46259,7 +46292,7 @@ var init_adhdev_daemon = __esm({
|
|
|
46259
46292
|
import_ws3 = require("ws");
|
|
46260
46293
|
import_chalk2 = __toESM(require("chalk"));
|
|
46261
46294
|
init_version();
|
|
46262
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
46295
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.15" });
|
|
46263
46296
|
DANGEROUS_PATTERNS = [
|
|
46264
46297
|
/\brm\s+(-[a-z]*f|-[a-z]*r|--force|--recursive)/i,
|
|
46265
46298
|
/\bsudo\b/i,
|
|
@@ -47780,6 +47813,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
47780
47813
|
const child = spawn5(process.execPath, [process.argv[1], ...args], {
|
|
47781
47814
|
detached: true,
|
|
47782
47815
|
stdio: "ignore",
|
|
47816
|
+
windowsHide: true,
|
|
47783
47817
|
env: { ...process.env }
|
|
47784
47818
|
});
|
|
47785
47819
|
child.unref();
|
|
@@ -47858,6 +47892,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
47858
47892
|
const child = spawn5(process.execPath, [process.argv[1], "daemon", "-p", "19222"], {
|
|
47859
47893
|
detached: true,
|
|
47860
47894
|
stdio: "ignore",
|
|
47895
|
+
windowsHide: true,
|
|
47861
47896
|
env: { ...process.env }
|
|
47862
47897
|
});
|
|
47863
47898
|
child.unref();
|
|
@@ -47907,6 +47942,111 @@ function resolveModuleFromPackage(specifier, packageRoot) {
|
|
|
47907
47942
|
return null;
|
|
47908
47943
|
}
|
|
47909
47944
|
}
|
|
47945
|
+
function probeNodeDatachannel(packageRoot) {
|
|
47946
|
+
const resolved = resolveModuleFromPackage("node-datachannel", packageRoot);
|
|
47947
|
+
if (!resolved) {
|
|
47948
|
+
return {
|
|
47949
|
+
label: "node-datachannel",
|
|
47950
|
+
ok: false,
|
|
47951
|
+
detail: "module not found",
|
|
47952
|
+
fatal: true
|
|
47953
|
+
};
|
|
47954
|
+
}
|
|
47955
|
+
try {
|
|
47956
|
+
const mod = require(resolved);
|
|
47957
|
+
const Ctor = mod?.PeerConnection || mod?.default?.PeerConnection;
|
|
47958
|
+
if (!Ctor) {
|
|
47959
|
+
return {
|
|
47960
|
+
label: "node-datachannel",
|
|
47961
|
+
ok: false,
|
|
47962
|
+
detail: `${resolved} (PeerConnection export missing)`,
|
|
47963
|
+
fatal: true
|
|
47964
|
+
};
|
|
47965
|
+
}
|
|
47966
|
+
const testPc = new Ctor("doctor-smoke", { iceServers: ["stun:stun.cloudflare.com:3478"] });
|
|
47967
|
+
try {
|
|
47968
|
+
testPc.close?.();
|
|
47969
|
+
} catch {
|
|
47970
|
+
}
|
|
47971
|
+
return {
|
|
47972
|
+
label: "node-datachannel",
|
|
47973
|
+
ok: true,
|
|
47974
|
+
detail: resolved
|
|
47975
|
+
};
|
|
47976
|
+
} catch (error48) {
|
|
47977
|
+
return {
|
|
47978
|
+
label: "node-datachannel",
|
|
47979
|
+
ok: false,
|
|
47980
|
+
detail: `${resolved} (${error48?.message || "load failed"})`,
|
|
47981
|
+
fatal: true
|
|
47982
|
+
};
|
|
47983
|
+
}
|
|
47984
|
+
}
|
|
47985
|
+
function probeConfigAccess() {
|
|
47986
|
+
const configDir = path23.join(os23.homedir(), ".adhdev");
|
|
47987
|
+
const configPath = path23.join(configDir, "config.json");
|
|
47988
|
+
const checks = [];
|
|
47989
|
+
try {
|
|
47990
|
+
fs18.mkdirSync(configDir, { recursive: true });
|
|
47991
|
+
checks.push({
|
|
47992
|
+
label: "Config directory",
|
|
47993
|
+
ok: true,
|
|
47994
|
+
detail: configDir
|
|
47995
|
+
});
|
|
47996
|
+
} catch (error48) {
|
|
47997
|
+
return [{
|
|
47998
|
+
label: "Config directory",
|
|
47999
|
+
ok: false,
|
|
48000
|
+
detail: `${configDir} (${error48?.message || "mkdir failed"})`,
|
|
48001
|
+
fatal: true
|
|
48002
|
+
}];
|
|
48003
|
+
}
|
|
48004
|
+
try {
|
|
48005
|
+
if (fs18.existsSync(configPath)) {
|
|
48006
|
+
fs18.readFileSync(configPath, "utf-8");
|
|
48007
|
+
checks.push({
|
|
48008
|
+
label: "Config file",
|
|
48009
|
+
ok: true,
|
|
48010
|
+
detail: configPath
|
|
48011
|
+
});
|
|
48012
|
+
} else {
|
|
48013
|
+
checks.push({
|
|
48014
|
+
label: "Config file",
|
|
48015
|
+
ok: true,
|
|
48016
|
+
detail: `${configPath} (will be created on demand)`
|
|
48017
|
+
});
|
|
48018
|
+
}
|
|
48019
|
+
} catch (error48) {
|
|
48020
|
+
checks.push({
|
|
48021
|
+
label: "Config file",
|
|
48022
|
+
ok: false,
|
|
48023
|
+
detail: `${configPath} (${error48?.message || "read failed"})`,
|
|
48024
|
+
fatal: true
|
|
48025
|
+
});
|
|
48026
|
+
}
|
|
48027
|
+
const probePath = path23.join(configDir, `.doctor-write-${process.pid}-${Date.now()}.tmp`);
|
|
48028
|
+
try {
|
|
48029
|
+
fs18.writeFileSync(probePath, "ok", "utf-8");
|
|
48030
|
+
fs18.rmSync(probePath, { force: true });
|
|
48031
|
+
checks.push({
|
|
48032
|
+
label: "Config write",
|
|
48033
|
+
ok: true,
|
|
48034
|
+
detail: configDir
|
|
48035
|
+
});
|
|
48036
|
+
} catch (error48) {
|
|
48037
|
+
try {
|
|
48038
|
+
fs18.rmSync(probePath, { force: true });
|
|
48039
|
+
} catch {
|
|
48040
|
+
}
|
|
48041
|
+
checks.push({
|
|
48042
|
+
label: "Config write",
|
|
48043
|
+
ok: false,
|
|
48044
|
+
detail: `${configDir} (${error48?.message || "write failed"})`,
|
|
48045
|
+
fatal: true
|
|
48046
|
+
});
|
|
48047
|
+
}
|
|
48048
|
+
return checks;
|
|
48049
|
+
}
|
|
47910
48050
|
function findCommandPaths(command) {
|
|
47911
48051
|
try {
|
|
47912
48052
|
const bin = process.platform === "win32" ? "where.exe" : "which";
|
|
@@ -47927,7 +48067,7 @@ function readLogHints(logPath) {
|
|
|
47927
48067
|
const lines = content.split(/\r?\n/);
|
|
47928
48068
|
const recent = lines.slice(-400);
|
|
47929
48069
|
const hits = recent.filter(
|
|
47930
|
-
(line) => line.includes("sharp native module unavailable") || line.includes("node-pty not found") || line.includes("Could not browse folder") || line.includes("ENOENT")
|
|
48070
|
+
(line) => line.includes("sharp native module unavailable") || line.includes("node-pty not found") || line.includes("Could not browse folder") || line.includes("Could not save config") || line.includes("Could not load config") || line.includes("ENOENT")
|
|
47931
48071
|
);
|
|
47932
48072
|
return hits.slice(-5);
|
|
47933
48073
|
} catch {
|
|
@@ -47989,6 +48129,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
47989
48129
|
detail: resolveModuleFromPackage("node-pty", packageRoot) || "module not found",
|
|
47990
48130
|
fatal: true
|
|
47991
48131
|
},
|
|
48132
|
+
probeNodeDatachannel(packageRoot),
|
|
47992
48133
|
{
|
|
47993
48134
|
label: "sharp",
|
|
47994
48135
|
ok: Boolean(resolveModuleFromPackage("sharp", packageRoot)),
|
|
@@ -48001,6 +48142,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
48001
48142
|
detail: resolveModuleFromPackage(nativeSharpPackage, packageRoot) || "module not found",
|
|
48002
48143
|
fatal: false
|
|
48003
48144
|
},
|
|
48145
|
+
...probeConfigAccess(),
|
|
48004
48146
|
...buildBrowseProbeChecks()
|
|
48005
48147
|
];
|
|
48006
48148
|
try {
|
|
@@ -49153,6 +49295,14 @@ function registerCdpCommands(program2) {
|
|
|
49153
49295
|
// src/cli/index.ts
|
|
49154
49296
|
init_version();
|
|
49155
49297
|
var pkgVersion2 = resolvePackageVersion();
|
|
49298
|
+
if (process.platform === "win32") {
|
|
49299
|
+
const nodeMajor = Number.parseInt(process.versions.node.split(".")[0] || "0", 10);
|
|
49300
|
+
if (nodeMajor >= 24) {
|
|
49301
|
+
console.error(import_chalk8.default.red("\n\u2717 Windows is currently unsupported on Node.js 24+ for ADHDev."));
|
|
49302
|
+
console.error(import_chalk8.default.gray(" Install Node.js 22.x on Windows, then retry.\n"));
|
|
49303
|
+
process.exit(1);
|
|
49304
|
+
}
|
|
49305
|
+
}
|
|
49156
49306
|
var _cliProviderLoader = new ProviderLoader({ logFn: () => {
|
|
49157
49307
|
} });
|
|
49158
49308
|
_cliProviderLoader.loadAll();
|