adhdev 0.9.2 → 0.9.4
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 +633 -508
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +151 -81
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -913,8 +913,8 @@ async function detectIDEs(providerLoader) {
|
|
|
913
913
|
if ((0, import_fs3.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
914
914
|
}
|
|
915
915
|
if (!resolvedCli && appPath && os29 === "win32") {
|
|
916
|
-
const { dirname:
|
|
917
|
-
const appDir =
|
|
916
|
+
const { dirname: dirname10 } = await import("path");
|
|
917
|
+
const appDir = dirname10(appPath);
|
|
918
918
|
const candidates = [
|
|
919
919
|
`${appDir}\\\\bin\\\\${def.cli}.cmd`,
|
|
920
920
|
`${appDir}\\\\bin\\\\${def.cli}`,
|
|
@@ -13110,10 +13110,6 @@ ${data.message || ""}`.trim();
|
|
|
13110
13110
|
throw new Error(`${this.cliName} is still processing the previous prompt`);
|
|
13111
13111
|
}
|
|
13112
13112
|
}
|
|
13113
|
-
const blockingModal = this.activeModal || this.getStartupConfirmationModal(this.terminalScreen.getText() || "");
|
|
13114
|
-
if (blockingModal || this.currentStatus === "waiting_approval") {
|
|
13115
|
-
throw new Error(`${this.cliName} is awaiting confirmation before it can accept a prompt`);
|
|
13116
|
-
}
|
|
13117
13113
|
this.isWaitingForResponse = true;
|
|
13118
13114
|
this.responseBuffer = "";
|
|
13119
13115
|
this.finishRetryCount = 0;
|
|
@@ -32951,10 +32947,10 @@ var init_readdirp = __esm({
|
|
|
32951
32947
|
}
|
|
32952
32948
|
async _formatEntry(dirent, path29) {
|
|
32953
32949
|
let entry;
|
|
32954
|
-
const
|
|
32950
|
+
const basename9 = this._isDirent ? dirent.name : dirent;
|
|
32955
32951
|
try {
|
|
32956
|
-
const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path29,
|
|
32957
|
-
entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename:
|
|
32952
|
+
const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path29, basename9));
|
|
32953
|
+
entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename9 };
|
|
32958
32954
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
32959
32955
|
} catch (err) {
|
|
32960
32956
|
this._onError(err);
|
|
@@ -33485,9 +33481,9 @@ var init_handler2 = __esm({
|
|
|
33485
33481
|
_watchWithNodeFs(path29, listener) {
|
|
33486
33482
|
const opts = this.fsw.options;
|
|
33487
33483
|
const directory = sp.dirname(path29);
|
|
33488
|
-
const
|
|
33484
|
+
const basename9 = sp.basename(path29);
|
|
33489
33485
|
const parent = this.fsw._getWatchedDir(directory);
|
|
33490
|
-
parent.add(
|
|
33486
|
+
parent.add(basename9);
|
|
33491
33487
|
const absolutePath = sp.resolve(path29);
|
|
33492
33488
|
const options = {
|
|
33493
33489
|
persistent: opts.persistent
|
|
@@ -33497,7 +33493,7 @@ var init_handler2 = __esm({
|
|
|
33497
33493
|
let closer;
|
|
33498
33494
|
if (opts.usePolling) {
|
|
33499
33495
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
33500
|
-
options.interval = enableBin && isBinaryPath(
|
|
33496
|
+
options.interval = enableBin && isBinaryPath(basename9) ? opts.binaryInterval : opts.interval;
|
|
33501
33497
|
closer = setFsWatchFileListener(path29, absolutePath, options, {
|
|
33502
33498
|
listener,
|
|
33503
33499
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -33519,11 +33515,11 @@ var init_handler2 = __esm({
|
|
|
33519
33515
|
if (this.fsw.closed) {
|
|
33520
33516
|
return;
|
|
33521
33517
|
}
|
|
33522
|
-
const
|
|
33523
|
-
const
|
|
33524
|
-
const parent = this.fsw._getWatchedDir(
|
|
33518
|
+
const dirname10 = sp.dirname(file2);
|
|
33519
|
+
const basename9 = sp.basename(file2);
|
|
33520
|
+
const parent = this.fsw._getWatchedDir(dirname10);
|
|
33525
33521
|
let prevStats = stats;
|
|
33526
|
-
if (parent.has(
|
|
33522
|
+
if (parent.has(basename9))
|
|
33527
33523
|
return;
|
|
33528
33524
|
const listener = async (path29, newStats) => {
|
|
33529
33525
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
@@ -33548,9 +33544,9 @@ var init_handler2 = __esm({
|
|
|
33548
33544
|
prevStats = newStats2;
|
|
33549
33545
|
}
|
|
33550
33546
|
} catch (error48) {
|
|
33551
|
-
this.fsw._remove(
|
|
33547
|
+
this.fsw._remove(dirname10, basename9);
|
|
33552
33548
|
}
|
|
33553
|
-
} else if (parent.has(
|
|
33549
|
+
} else if (parent.has(basename9)) {
|
|
33554
33550
|
const at = newStats.atimeMs;
|
|
33555
33551
|
const mt = newStats.mtimeMs;
|
|
33556
33552
|
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
|
|
@@ -36865,9 +36861,82 @@ function appendUpgradeLog(message) {
|
|
|
36865
36861
|
} catch {
|
|
36866
36862
|
}
|
|
36867
36863
|
}
|
|
36868
|
-
function
|
|
36864
|
+
function resolveSiblingNpmExecutable(nodeExecutable) {
|
|
36865
|
+
const binDir = path16.dirname(nodeExecutable);
|
|
36866
|
+
const candidates = process.platform === "win32" ? ["npm.cmd", "npm.exe", "npm"] : ["npm"];
|
|
36867
|
+
for (const candidate of candidates) {
|
|
36868
|
+
const candidatePath = path16.join(binDir, candidate);
|
|
36869
|
+
if (fs8.existsSync(candidatePath)) {
|
|
36870
|
+
return candidatePath;
|
|
36871
|
+
}
|
|
36872
|
+
}
|
|
36869
36873
|
return "npm";
|
|
36870
36874
|
}
|
|
36875
|
+
function findCurrentPackageRoot(currentCliPath, packageName) {
|
|
36876
|
+
if (!currentCliPath) return null;
|
|
36877
|
+
let resolvedPath = currentCliPath;
|
|
36878
|
+
try {
|
|
36879
|
+
resolvedPath = fs8.realpathSync.native(currentCliPath);
|
|
36880
|
+
} catch {
|
|
36881
|
+
}
|
|
36882
|
+
let currentDir = resolvedPath;
|
|
36883
|
+
try {
|
|
36884
|
+
if (fs8.statSync(resolvedPath).isFile()) {
|
|
36885
|
+
currentDir = path16.dirname(resolvedPath);
|
|
36886
|
+
}
|
|
36887
|
+
} catch {
|
|
36888
|
+
currentDir = path16.dirname(resolvedPath);
|
|
36889
|
+
}
|
|
36890
|
+
while (true) {
|
|
36891
|
+
const packageJsonPath = path16.join(currentDir, "package.json");
|
|
36892
|
+
try {
|
|
36893
|
+
if (fs8.existsSync(packageJsonPath)) {
|
|
36894
|
+
const parsed = JSON.parse(fs8.readFileSync(packageJsonPath, "utf8"));
|
|
36895
|
+
if (parsed?.name === packageName) {
|
|
36896
|
+
const normalized = currentDir.replace(/\\/g, "/");
|
|
36897
|
+
return normalized.includes("/node_modules/") ? currentDir : null;
|
|
36898
|
+
}
|
|
36899
|
+
}
|
|
36900
|
+
} catch {
|
|
36901
|
+
}
|
|
36902
|
+
const parentDir = path16.dirname(currentDir);
|
|
36903
|
+
if (parentDir === currentDir) {
|
|
36904
|
+
return null;
|
|
36905
|
+
}
|
|
36906
|
+
currentDir = parentDir;
|
|
36907
|
+
}
|
|
36908
|
+
}
|
|
36909
|
+
function resolveInstallPrefixFromPackageRoot(packageRoot, packageName) {
|
|
36910
|
+
const nodeModulesDir = packageName.startsWith("@") ? path16.dirname(path16.dirname(packageRoot)) : path16.dirname(packageRoot);
|
|
36911
|
+
if (path16.basename(nodeModulesDir) !== "node_modules") {
|
|
36912
|
+
return null;
|
|
36913
|
+
}
|
|
36914
|
+
const maybeLibDir = path16.dirname(nodeModulesDir);
|
|
36915
|
+
if (path16.basename(maybeLibDir) === "lib") {
|
|
36916
|
+
return path16.dirname(maybeLibDir);
|
|
36917
|
+
}
|
|
36918
|
+
return maybeLibDir;
|
|
36919
|
+
}
|
|
36920
|
+
function resolveCurrentGlobalInstallSurface(options) {
|
|
36921
|
+
const packageRoot = findCurrentPackageRoot(options.currentCliPath || process.argv[1], options.packageName);
|
|
36922
|
+
return {
|
|
36923
|
+
npmExecutable: resolveSiblingNpmExecutable(options.nodeExecutable || process.execPath),
|
|
36924
|
+
packageRoot,
|
|
36925
|
+
installPrefix: packageRoot ? resolveInstallPrefixFromPackageRoot(packageRoot, options.packageName) : null
|
|
36926
|
+
};
|
|
36927
|
+
}
|
|
36928
|
+
function buildPinnedGlobalInstallCommand(options) {
|
|
36929
|
+
const surface = resolveCurrentGlobalInstallSurface(options);
|
|
36930
|
+
const args = ["install", "-g", `${options.packageName}@${options.targetVersion || "latest"}`, "--force"];
|
|
36931
|
+
if (surface.installPrefix) {
|
|
36932
|
+
args.push("--prefix", surface.installPrefix);
|
|
36933
|
+
}
|
|
36934
|
+
return {
|
|
36935
|
+
command: surface.npmExecutable,
|
|
36936
|
+
args,
|
|
36937
|
+
surface
|
|
36938
|
+
};
|
|
36939
|
+
}
|
|
36871
36940
|
function getNpmExecOptions() {
|
|
36872
36941
|
return { shell: process.platform === "win32" };
|
|
36873
36942
|
}
|
|
@@ -36930,11 +36999,12 @@ function removeDaemonPidFile() {
|
|
|
36930
36999
|
} catch {
|
|
36931
37000
|
}
|
|
36932
37001
|
}
|
|
36933
|
-
function cleanupStaleGlobalInstallDirs(pkgName) {
|
|
37002
|
+
function cleanupStaleGlobalInstallDirs(pkgName, surface) {
|
|
36934
37003
|
const npmExecOpts = getNpmExecOptions();
|
|
36935
|
-
const
|
|
37004
|
+
const prefixArgs = surface.installPrefix ? ["--prefix", surface.installPrefix] : [];
|
|
37005
|
+
const npmRoot = (0, import_child_process7.execFileSync)(surface.npmExecutable, ["root", "-g", ...prefixArgs], { encoding: "utf8", ...npmExecOpts }).trim();
|
|
36936
37006
|
if (!npmRoot) return;
|
|
36937
|
-
const npmPrefix = (0, import_child_process7.execFileSync)(
|
|
37007
|
+
const npmPrefix = surface.installPrefix || (0, import_child_process7.execFileSync)(surface.npmExecutable, ["prefix", "-g", ...prefixArgs], { encoding: "utf8", ...npmExecOpts }).trim();
|
|
36938
37008
|
const binDir = process.platform === "win32" ? npmPrefix : path16.join(npmPrefix, "bin");
|
|
36939
37009
|
const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
|
|
36940
37010
|
const binNames = /* @__PURE__ */ new Set([packageBaseName]);
|
|
@@ -36959,7 +37029,7 @@ function cleanupStaleGlobalInstallDirs(pkgName) {
|
|
|
36959
37029
|
}
|
|
36960
37030
|
if (fs8.existsSync(binDir)) {
|
|
36961
37031
|
for (const entry of fs8.readdirSync(binDir)) {
|
|
36962
|
-
if (!
|
|
37032
|
+
if (!Array.from(binNames).some((name) => entry.startsWith(`.${name}-`))) continue;
|
|
36963
37033
|
fs8.rmSync(path16.join(binDir, entry), { recursive: true, force: true });
|
|
36964
37034
|
appendUpgradeLog(`Removed stale bin staging entry: ${path16.join(binDir, entry)}`);
|
|
36965
37035
|
}
|
|
@@ -36979,19 +37049,27 @@ function spawnDetachedDaemonUpgradeHelper(payload) {
|
|
|
36979
37049
|
async function runDaemonUpgradeHelper(payload) {
|
|
36980
37050
|
const restartArgv = Array.isArray(payload.restartArgv) ? payload.restartArgv : [];
|
|
36981
37051
|
const sessionHostAppName = payload.sessionHostAppName || process.env.ADHDEV_SESSION_HOST_NAME || "adhdev";
|
|
37052
|
+
const installCommand = buildPinnedGlobalInstallCommand({
|
|
37053
|
+
packageName: payload.packageName,
|
|
37054
|
+
targetVersion: payload.targetVersion
|
|
37055
|
+
});
|
|
36982
37056
|
appendUpgradeLog(`Upgrade helper started for ${payload.packageName}@${payload.targetVersion}`);
|
|
37057
|
+
appendUpgradeLog(`Using npm executable: ${installCommand.command}`);
|
|
37058
|
+
if (installCommand.surface.installPrefix) {
|
|
37059
|
+
appendUpgradeLog(`Pinned install prefix: ${installCommand.surface.installPrefix}`);
|
|
37060
|
+
}
|
|
36983
37061
|
if (Number.isFinite(payload.parentPid) && payload.parentPid > 0) {
|
|
36984
37062
|
appendUpgradeLog(`Waiting for parent pid ${payload.parentPid} to exit`);
|
|
36985
37063
|
await waitForPidExit(payload.parentPid, 15e3);
|
|
36986
37064
|
}
|
|
36987
37065
|
stopSessionHostProcesses(sessionHostAppName);
|
|
36988
37066
|
removeDaemonPidFile();
|
|
36989
|
-
cleanupStaleGlobalInstallDirs(payload.packageName);
|
|
37067
|
+
cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
|
|
36990
37068
|
const spec = `${payload.packageName}@${payload.targetVersion || "latest"}`;
|
|
36991
37069
|
appendUpgradeLog(`Installing ${spec}`);
|
|
36992
37070
|
const installOutput = (0, import_child_process7.execFileSync)(
|
|
36993
|
-
|
|
36994
|
-
|
|
37071
|
+
installCommand.command,
|
|
37072
|
+
installCommand.args,
|
|
36995
37073
|
{
|
|
36996
37074
|
encoding: "utf8",
|
|
36997
37075
|
stdio: "pipe",
|
|
@@ -37004,7 +37082,7 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
37004
37082
|
}
|
|
37005
37083
|
if (process.platform === "win32") {
|
|
37006
37084
|
await new Promise((resolve16) => setTimeout(resolve16, 500));
|
|
37007
|
-
cleanupStaleGlobalInstallDirs(payload.packageName);
|
|
37085
|
+
cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
|
|
37008
37086
|
appendUpgradeLog("Post-install staging cleanup complete");
|
|
37009
37087
|
}
|
|
37010
37088
|
if (restartArgv.length > 0) {
|
|
@@ -45892,6 +45970,7 @@ __export(src_exports, {
|
|
|
45892
45970
|
buildChatMessageSignature: () => buildChatMessageSignature,
|
|
45893
45971
|
buildChatTailDeliverySignature: () => buildChatTailDeliverySignature,
|
|
45894
45972
|
buildMachineInfo: () => buildMachineInfo,
|
|
45973
|
+
buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
|
|
45895
45974
|
buildRuntimeSystemChatMessage: () => buildRuntimeSystemChatMessage,
|
|
45896
45975
|
buildSessionEntries: () => buildSessionEntries,
|
|
45897
45976
|
buildSessionModalDeliverySignature: () => buildSessionModalDeliverySignature,
|
|
@@ -45974,6 +46053,7 @@ __export(src_exports, {
|
|
|
45974
46053
|
resetDebugRuntimeConfig: () => resetDebugRuntimeConfig,
|
|
45975
46054
|
resetState: () => resetState,
|
|
45976
46055
|
resolveChatMessageKind: () => resolveChatMessageKind,
|
|
46056
|
+
resolveCurrentGlobalInstallSurface: () => resolveCurrentGlobalInstallSurface,
|
|
45977
46057
|
resolveDebugRuntimeConfig: () => resolveDebugRuntimeConfig,
|
|
45978
46058
|
resolveSessionHostAppName: () => resolveSessionHostAppName,
|
|
45979
46059
|
resolveSessionHostAppNameResolution: () => resolveSessionHostAppNameResolution,
|
|
@@ -55375,7 +55455,7 @@ var init_adhdev_daemon = __esm({
|
|
|
55375
55455
|
init_version();
|
|
55376
55456
|
init_src();
|
|
55377
55457
|
init_runtime_defaults();
|
|
55378
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
55458
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.4" });
|
|
55379
55459
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
55380
55460
|
localHttpServer = null;
|
|
55381
55461
|
localWss = null;
|
|
@@ -87473,6 +87553,7 @@ var open_default = open2;
|
|
|
87473
87553
|
|
|
87474
87554
|
// src/wizard.ts
|
|
87475
87555
|
init_src();
|
|
87556
|
+
init_version();
|
|
87476
87557
|
var SERVER_URL = process.env.ADHDEV_SERVER_URL || "https://api.adhf.dev";
|
|
87477
87558
|
var LOGO = `
|
|
87478
87559
|
${source_default2.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")}
|
|
@@ -87485,6 +87566,36 @@ function hasCloudMachineAuth() {
|
|
|
87485
87566
|
const config2 = loadConfig();
|
|
87486
87567
|
return Boolean(config2.machineSecret && config2.machineSecret.trim());
|
|
87487
87568
|
}
|
|
87569
|
+
function readLatestPublishedCliVersion(execFileSyncLocal) {
|
|
87570
|
+
const surface = resolveCurrentGlobalInstallSurface({ packageName: "adhdev" });
|
|
87571
|
+
try {
|
|
87572
|
+
return execFileSyncLocal(surface.npmExecutable, ["view", "adhdev", "version"], {
|
|
87573
|
+
encoding: "utf-8",
|
|
87574
|
+
timeout: 5e3,
|
|
87575
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
87576
|
+
}).trim();
|
|
87577
|
+
} catch {
|
|
87578
|
+
return null;
|
|
87579
|
+
}
|
|
87580
|
+
}
|
|
87581
|
+
function readInstalledGlobalCliVersion(execFileSyncLocal) {
|
|
87582
|
+
const surface = resolveCurrentGlobalInstallSurface({ packageName: "adhdev" });
|
|
87583
|
+
const args = ["list", "-g", "adhdev", "--json"];
|
|
87584
|
+
if (surface.installPrefix) {
|
|
87585
|
+
args.push("--prefix", surface.installPrefix);
|
|
87586
|
+
}
|
|
87587
|
+
try {
|
|
87588
|
+
const result = execFileSyncLocal(surface.npmExecutable, args, {
|
|
87589
|
+
encoding: "utf-8",
|
|
87590
|
+
timeout: 5e3,
|
|
87591
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
87592
|
+
});
|
|
87593
|
+
const parsed = JSON.parse(result);
|
|
87594
|
+
return parsed.dependencies?.adhdev?.version || null;
|
|
87595
|
+
} catch {
|
|
87596
|
+
return null;
|
|
87597
|
+
}
|
|
87598
|
+
}
|
|
87488
87599
|
async function runWizard(options = {}) {
|
|
87489
87600
|
console.log(LOGO);
|
|
87490
87601
|
if (isSetupComplete() && hasCloudMachineAuth() && !options.force) {
|
|
@@ -87500,27 +87611,10 @@ async function runWizard(options = {}) {
|
|
|
87500
87611
|
}
|
|
87501
87612
|
async function checkForUpdate() {
|
|
87502
87613
|
try {
|
|
87503
|
-
const {
|
|
87504
|
-
|
|
87505
|
-
|
|
87506
|
-
|
|
87507
|
-
encoding: "utf-8",
|
|
87508
|
-
timeout: 3e3,
|
|
87509
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
87510
|
-
}).trim();
|
|
87511
|
-
} catch {
|
|
87512
|
-
return;
|
|
87513
|
-
}
|
|
87514
|
-
let latestVersion = null;
|
|
87515
|
-
try {
|
|
87516
|
-
latestVersion = execSync7("npm show adhdev version", {
|
|
87517
|
-
encoding: "utf-8",
|
|
87518
|
-
timeout: 5e3,
|
|
87519
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
87520
|
-
}).trim();
|
|
87521
|
-
} catch {
|
|
87522
|
-
return;
|
|
87523
|
-
}
|
|
87614
|
+
const { execFileSync: execFileSync4 } = await import("child_process");
|
|
87615
|
+
const currentVersion = resolvePackageVersion();
|
|
87616
|
+
const latestVersion = readLatestPublishedCliVersion(execFileSync4);
|
|
87617
|
+
if (!latestVersion) return;
|
|
87524
87618
|
if (!currentVersion || !latestVersion || currentVersion === latestVersion) return;
|
|
87525
87619
|
console.log(source_default2.yellow(` Update available: ${currentVersion} \u2192 ${latestVersion}`));
|
|
87526
87620
|
const { doUpdate } = await (await Promise.resolve().then(() => (init_lib(), lib_exports))).default.prompt([{
|
|
@@ -87535,7 +87629,8 @@ async function checkForUpdate() {
|
|
|
87535
87629
|
}
|
|
87536
87630
|
const spinner = (await Promise.resolve().then(() => (init_ora(), ora_exports))).default("Updating adhdev CLI...").start();
|
|
87537
87631
|
try {
|
|
87538
|
-
|
|
87632
|
+
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
|
|
87633
|
+
execFileSync4(installCommand.command, installCommand.args, {
|
|
87539
87634
|
encoding: "utf-8",
|
|
87540
87635
|
timeout: 6e4,
|
|
87541
87636
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -87773,18 +87868,8 @@ async function startDaemonFlow() {
|
|
|
87773
87868
|
}
|
|
87774
87869
|
}
|
|
87775
87870
|
async function installCliOnly() {
|
|
87776
|
-
const {
|
|
87777
|
-
|
|
87778
|
-
try {
|
|
87779
|
-
const result = execSyncLocal("npm list -g adhdev --json 2>/dev/null || npm list -g adhdev --json 2>nul", {
|
|
87780
|
-
encoding: "utf-8",
|
|
87781
|
-
timeout: 5e3,
|
|
87782
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
87783
|
-
});
|
|
87784
|
-
const parsed = JSON.parse(result);
|
|
87785
|
-
currentVersion = parsed.dependencies?.adhdev?.version || null;
|
|
87786
|
-
} catch {
|
|
87787
|
-
}
|
|
87871
|
+
const { execFileSync: execFileSyncLocal } = await import("child_process");
|
|
87872
|
+
const currentVersion = readInstalledGlobalCliVersion(execFileSyncLocal);
|
|
87788
87873
|
const isNpx = process.env.npm_execpath?.includes("npx") || process.argv[1]?.includes("npx") || process.argv[1]?.includes("_npx");
|
|
87789
87874
|
console.log(source_default2.bold("\n\u{1F527} ADHDev CLI\n"));
|
|
87790
87875
|
console.log(source_default2.gray(" The `adhdev` command lets you:"));
|
|
@@ -87795,15 +87880,7 @@ async function installCliOnly() {
|
|
|
87795
87880
|
console.log();
|
|
87796
87881
|
if (currentVersion) {
|
|
87797
87882
|
console.log(source_default2.green(` \u2713 Currently installed: v${currentVersion}`));
|
|
87798
|
-
|
|
87799
|
-
try {
|
|
87800
|
-
latestVersion = execSyncLocal("npm show adhdev version", {
|
|
87801
|
-
encoding: "utf-8",
|
|
87802
|
-
timeout: 5e3,
|
|
87803
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
87804
|
-
}).trim();
|
|
87805
|
-
} catch {
|
|
87806
|
-
}
|
|
87883
|
+
const latestVersion = readLatestPublishedCliVersion(execFileSyncLocal);
|
|
87807
87884
|
if (latestVersion && currentVersion === latestVersion) {
|
|
87808
87885
|
console.log(source_default2.gray(" (Already up to date)"));
|
|
87809
87886
|
return;
|
|
@@ -87838,20 +87915,13 @@ async function installCliOnly() {
|
|
|
87838
87915
|
}
|
|
87839
87916
|
const installSpinner = ora2("Installing adhdev CLI...").start();
|
|
87840
87917
|
try {
|
|
87841
|
-
|
|
87918
|
+
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
|
|
87919
|
+
execFileSyncLocal(installCommand.command, installCommand.args, {
|
|
87842
87920
|
encoding: "utf-8",
|
|
87843
87921
|
timeout: 6e4,
|
|
87844
87922
|
stdio: ["pipe", "pipe", "pipe"]
|
|
87845
87923
|
});
|
|
87846
|
-
|
|
87847
|
-
try {
|
|
87848
|
-
newVersion = execSyncLocal("adhdev --version 2>/dev/null || adhdev --version 2>nul", {
|
|
87849
|
-
encoding: "utf-8",
|
|
87850
|
-
timeout: 5e3,
|
|
87851
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
87852
|
-
}).trim();
|
|
87853
|
-
} catch {
|
|
87854
|
-
}
|
|
87924
|
+
const newVersion = readInstalledGlobalCliVersion(execFileSyncLocal) || "latest";
|
|
87855
87925
|
installSpinner.succeed(`adhdev CLI ${currentVersion ? "updated" : "installed"} \u2713 (v${newVersion})`);
|
|
87856
87926
|
console.log(source_default2.gray(" Try: adhdev daemon"));
|
|
87857
87927
|
console.log();
|