adhdev 0.8.13 → 0.8.14
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 +157 -16
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +47 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -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
|
}
|
|
@@ -7053,13 +7078,16 @@ var init_provider_cli_adapter = __esm({
|
|
|
7053
7078
|
let shellArgs;
|
|
7054
7079
|
const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
|
|
7055
7080
|
const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
|
|
7056
|
-
const
|
|
7081
|
+
const useShellWin = isCmdShim || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath);
|
|
7082
|
+
const useShell = isWin ? useShellWin : useShellUnix;
|
|
7057
7083
|
if (useShell) {
|
|
7058
7084
|
if (!spawnConfig.shell && !isWin) {
|
|
7059
7085
|
LOG.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
|
|
7060
7086
|
}
|
|
7061
7087
|
if (isCmdShim) {
|
|
7062
7088
|
LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
|
|
7089
|
+
} else if (isWin) {
|
|
7090
|
+
LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell on Windows: ${binaryPath}`);
|
|
7063
7091
|
}
|
|
7064
7092
|
shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
|
|
7065
7093
|
if (isWin) {
|
|
@@ -7069,6 +7097,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
7069
7097
|
shellArgs = ["-l", "-c", fullCmd];
|
|
7070
7098
|
}
|
|
7071
7099
|
} else {
|
|
7100
|
+
if (isWin && spawnConfig.shell) {
|
|
7101
|
+
LOG.info("CLI", `[${this.cliType}] Spawning Windows binary directly without cmd.exe: ${binaryPath}`);
|
|
7102
|
+
}
|
|
7072
7103
|
shellCmd = binaryPath;
|
|
7073
7104
|
shellArgs = allArgs;
|
|
7074
7105
|
}
|
|
@@ -45988,7 +46019,7 @@ function getSessionHostPid() {
|
|
|
45988
46019
|
function killPid2(pid) {
|
|
45989
46020
|
try {
|
|
45990
46021
|
if (process.platform === "win32") {
|
|
45991
|
-
(0, import_child_process11.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore" });
|
|
46022
|
+
(0, import_child_process11.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
|
|
45992
46023
|
} else {
|
|
45993
46024
|
process.kill(pid, "SIGTERM");
|
|
45994
46025
|
}
|
|
@@ -46006,7 +46037,7 @@ function getWindowsProcessCommandLine(pid) {
|
|
|
46006
46037
|
pidFilter,
|
|
46007
46038
|
"get",
|
|
46008
46039
|
"CommandLine"
|
|
46009
|
-
], { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "ignore"] });
|
|
46040
|
+
], { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
|
|
46010
46041
|
const text = wmicOut.trim();
|
|
46011
46042
|
if (text) return text;
|
|
46012
46043
|
} catch {
|
|
@@ -46019,7 +46050,7 @@ function getWindowsProcessCommandLine(pid) {
|
|
|
46019
46050
|
"Bypass",
|
|
46020
46051
|
"-Command",
|
|
46021
46052
|
`(Get-CimInstance Win32_Process -Filter "${pidFilter}").CommandLine`
|
|
46022
|
-
], { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "ignore"] });
|
|
46053
|
+
], { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
|
|
46023
46054
|
const text = psOut.trim();
|
|
46024
46055
|
if (text) return text;
|
|
46025
46056
|
} catch {
|
|
@@ -46048,7 +46079,8 @@ function stopSessionHost() {
|
|
|
46048
46079
|
const raw = (0, import_child_process11.execFileSync)("tasklist", ["/FO", "CSV", "/NH", "/FI", "IMAGENAME eq node.exe"], {
|
|
46049
46080
|
encoding: "utf8",
|
|
46050
46081
|
timeout: 5e3,
|
|
46051
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
46082
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
46083
|
+
windowsHide: true
|
|
46052
46084
|
}).trim();
|
|
46053
46085
|
for (const line of raw.split(/\r?\n/)) {
|
|
46054
46086
|
const match = line.match(/^"node\.exe","(\d+)"/i);
|
|
@@ -46259,7 +46291,7 @@ var init_adhdev_daemon = __esm({
|
|
|
46259
46291
|
import_ws3 = require("ws");
|
|
46260
46292
|
import_chalk2 = __toESM(require("chalk"));
|
|
46261
46293
|
init_version();
|
|
46262
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
46294
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.14" });
|
|
46263
46295
|
DANGEROUS_PATTERNS = [
|
|
46264
46296
|
/\brm\s+(-[a-z]*f|-[a-z]*r|--force|--recursive)/i,
|
|
46265
46297
|
/\bsudo\b/i,
|
|
@@ -47780,6 +47812,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
47780
47812
|
const child = spawn5(process.execPath, [process.argv[1], ...args], {
|
|
47781
47813
|
detached: true,
|
|
47782
47814
|
stdio: "ignore",
|
|
47815
|
+
windowsHide: true,
|
|
47783
47816
|
env: { ...process.env }
|
|
47784
47817
|
});
|
|
47785
47818
|
child.unref();
|
|
@@ -47858,6 +47891,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
47858
47891
|
const child = spawn5(process.execPath, [process.argv[1], "daemon", "-p", "19222"], {
|
|
47859
47892
|
detached: true,
|
|
47860
47893
|
stdio: "ignore",
|
|
47894
|
+
windowsHide: true,
|
|
47861
47895
|
env: { ...process.env }
|
|
47862
47896
|
});
|
|
47863
47897
|
child.unref();
|
|
@@ -47907,6 +47941,111 @@ function resolveModuleFromPackage(specifier, packageRoot) {
|
|
|
47907
47941
|
return null;
|
|
47908
47942
|
}
|
|
47909
47943
|
}
|
|
47944
|
+
function probeNodeDatachannel(packageRoot) {
|
|
47945
|
+
const resolved = resolveModuleFromPackage("node-datachannel", packageRoot);
|
|
47946
|
+
if (!resolved) {
|
|
47947
|
+
return {
|
|
47948
|
+
label: "node-datachannel",
|
|
47949
|
+
ok: false,
|
|
47950
|
+
detail: "module not found",
|
|
47951
|
+
fatal: true
|
|
47952
|
+
};
|
|
47953
|
+
}
|
|
47954
|
+
try {
|
|
47955
|
+
const mod = require(resolved);
|
|
47956
|
+
const Ctor = mod?.PeerConnection || mod?.default?.PeerConnection;
|
|
47957
|
+
if (!Ctor) {
|
|
47958
|
+
return {
|
|
47959
|
+
label: "node-datachannel",
|
|
47960
|
+
ok: false,
|
|
47961
|
+
detail: `${resolved} (PeerConnection export missing)`,
|
|
47962
|
+
fatal: true
|
|
47963
|
+
};
|
|
47964
|
+
}
|
|
47965
|
+
const testPc = new Ctor("doctor-smoke", { iceServers: ["stun:stun.cloudflare.com:3478"] });
|
|
47966
|
+
try {
|
|
47967
|
+
testPc.close?.();
|
|
47968
|
+
} catch {
|
|
47969
|
+
}
|
|
47970
|
+
return {
|
|
47971
|
+
label: "node-datachannel",
|
|
47972
|
+
ok: true,
|
|
47973
|
+
detail: resolved
|
|
47974
|
+
};
|
|
47975
|
+
} catch (error48) {
|
|
47976
|
+
return {
|
|
47977
|
+
label: "node-datachannel",
|
|
47978
|
+
ok: false,
|
|
47979
|
+
detail: `${resolved} (${error48?.message || "load failed"})`,
|
|
47980
|
+
fatal: true
|
|
47981
|
+
};
|
|
47982
|
+
}
|
|
47983
|
+
}
|
|
47984
|
+
function probeConfigAccess() {
|
|
47985
|
+
const configDir = path23.join(os23.homedir(), ".adhdev");
|
|
47986
|
+
const configPath = path23.join(configDir, "config.json");
|
|
47987
|
+
const checks = [];
|
|
47988
|
+
try {
|
|
47989
|
+
fs18.mkdirSync(configDir, { recursive: true });
|
|
47990
|
+
checks.push({
|
|
47991
|
+
label: "Config directory",
|
|
47992
|
+
ok: true,
|
|
47993
|
+
detail: configDir
|
|
47994
|
+
});
|
|
47995
|
+
} catch (error48) {
|
|
47996
|
+
return [{
|
|
47997
|
+
label: "Config directory",
|
|
47998
|
+
ok: false,
|
|
47999
|
+
detail: `${configDir} (${error48?.message || "mkdir failed"})`,
|
|
48000
|
+
fatal: true
|
|
48001
|
+
}];
|
|
48002
|
+
}
|
|
48003
|
+
try {
|
|
48004
|
+
if (fs18.existsSync(configPath)) {
|
|
48005
|
+
fs18.readFileSync(configPath, "utf-8");
|
|
48006
|
+
checks.push({
|
|
48007
|
+
label: "Config file",
|
|
48008
|
+
ok: true,
|
|
48009
|
+
detail: configPath
|
|
48010
|
+
});
|
|
48011
|
+
} else {
|
|
48012
|
+
checks.push({
|
|
48013
|
+
label: "Config file",
|
|
48014
|
+
ok: true,
|
|
48015
|
+
detail: `${configPath} (will be created on demand)`
|
|
48016
|
+
});
|
|
48017
|
+
}
|
|
48018
|
+
} catch (error48) {
|
|
48019
|
+
checks.push({
|
|
48020
|
+
label: "Config file",
|
|
48021
|
+
ok: false,
|
|
48022
|
+
detail: `${configPath} (${error48?.message || "read failed"})`,
|
|
48023
|
+
fatal: true
|
|
48024
|
+
});
|
|
48025
|
+
}
|
|
48026
|
+
const probePath = path23.join(configDir, `.doctor-write-${process.pid}-${Date.now()}.tmp`);
|
|
48027
|
+
try {
|
|
48028
|
+
fs18.writeFileSync(probePath, "ok", "utf-8");
|
|
48029
|
+
fs18.rmSync(probePath, { force: true });
|
|
48030
|
+
checks.push({
|
|
48031
|
+
label: "Config write",
|
|
48032
|
+
ok: true,
|
|
48033
|
+
detail: configDir
|
|
48034
|
+
});
|
|
48035
|
+
} catch (error48) {
|
|
48036
|
+
try {
|
|
48037
|
+
fs18.rmSync(probePath, { force: true });
|
|
48038
|
+
} catch {
|
|
48039
|
+
}
|
|
48040
|
+
checks.push({
|
|
48041
|
+
label: "Config write",
|
|
48042
|
+
ok: false,
|
|
48043
|
+
detail: `${configDir} (${error48?.message || "write failed"})`,
|
|
48044
|
+
fatal: true
|
|
48045
|
+
});
|
|
48046
|
+
}
|
|
48047
|
+
return checks;
|
|
48048
|
+
}
|
|
47910
48049
|
function findCommandPaths(command) {
|
|
47911
48050
|
try {
|
|
47912
48051
|
const bin = process.platform === "win32" ? "where.exe" : "which";
|
|
@@ -47927,7 +48066,7 @@ function readLogHints(logPath) {
|
|
|
47927
48066
|
const lines = content.split(/\r?\n/);
|
|
47928
48067
|
const recent = lines.slice(-400);
|
|
47929
48068
|
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")
|
|
48069
|
+
(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
48070
|
);
|
|
47932
48071
|
return hits.slice(-5);
|
|
47933
48072
|
} catch {
|
|
@@ -47989,6 +48128,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
47989
48128
|
detail: resolveModuleFromPackage("node-pty", packageRoot) || "module not found",
|
|
47990
48129
|
fatal: true
|
|
47991
48130
|
},
|
|
48131
|
+
probeNodeDatachannel(packageRoot),
|
|
47992
48132
|
{
|
|
47993
48133
|
label: "sharp",
|
|
47994
48134
|
ok: Boolean(resolveModuleFromPackage("sharp", packageRoot)),
|
|
@@ -48001,6 +48141,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
48001
48141
|
detail: resolveModuleFromPackage(nativeSharpPackage, packageRoot) || "module not found",
|
|
48002
48142
|
fatal: false
|
|
48003
48143
|
},
|
|
48144
|
+
...probeConfigAccess(),
|
|
48004
48145
|
...buildBrowseProbeChecks()
|
|
48005
48146
|
];
|
|
48006
48147
|
try {
|