adhdev 0.1.12 → 0.1.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/index.js +63 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -153,7 +153,10 @@ function checkPathExists(paths) {
|
|
|
153
153
|
for (const p of paths) {
|
|
154
154
|
if (p.includes("*")) {
|
|
155
155
|
const home = (0, import_os.homedir)();
|
|
156
|
-
const
|
|
156
|
+
const starIdx = p.indexOf("*");
|
|
157
|
+
const suffix = p.substring(starIdx + 1);
|
|
158
|
+
const homeNormalized = home.replace(/\//g, "\\");
|
|
159
|
+
const resolved = homeNormalized + suffix;
|
|
157
160
|
if ((0, import_fs.existsSync)(resolved)) return resolved;
|
|
158
161
|
} else {
|
|
159
162
|
if ((0, import_fs.existsSync)(p)) return p;
|
|
@@ -426,6 +429,7 @@ var DEFAULT_CONFIG = {
|
|
|
426
429
|
apiToken: null,
|
|
427
430
|
connectionToken: null,
|
|
428
431
|
selectedIde: null,
|
|
432
|
+
configuredIdes: [],
|
|
429
433
|
installedExtensions: [],
|
|
430
434
|
autoConnect: true,
|
|
431
435
|
notifications: true,
|
|
@@ -472,8 +476,10 @@ function updateConfig(updates) {
|
|
|
472
476
|
return updated;
|
|
473
477
|
}
|
|
474
478
|
function markSetupComplete(ideId, extensions) {
|
|
479
|
+
const ideIds = Array.isArray(ideId) ? ideId : [ideId];
|
|
475
480
|
return updateConfig({
|
|
476
|
-
selectedIde:
|
|
481
|
+
selectedIde: ideIds[0],
|
|
482
|
+
configuredIdes: ideIds,
|
|
477
483
|
installedExtensions: extensions,
|
|
478
484
|
setupCompleted: true,
|
|
479
485
|
setupDate: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -501,7 +507,8 @@ async function runWizard(options = {}) {
|
|
|
501
507
|
if (isSetupComplete() && !options.force) {
|
|
502
508
|
const config = loadConfig();
|
|
503
509
|
console.log(import_chalk.default.green("\u2713") + " ADHDev is already set up!");
|
|
504
|
-
|
|
510
|
+
const ides = config.configuredIdes?.length ? config.configuredIdes.join(", ") : config.selectedIde || "none";
|
|
511
|
+
console.log(import_chalk.default.gray(` IDEs: ${ides}`));
|
|
505
512
|
console.log(import_chalk.default.gray(` User: ${config.userEmail || "not logged in"}`));
|
|
506
513
|
console.log(import_chalk.default.gray(` Extensions: ${config.installedExtensions.length} installed`));
|
|
507
514
|
console.log();
|
|
@@ -513,6 +520,7 @@ async function runWizard(options = {}) {
|
|
|
513
520
|
choices: [
|
|
514
521
|
{ name: "\u{1F504} Reconfigure (run setup again)", value: "reconfigure" },
|
|
515
522
|
{ name: "\u2795 Add more extensions", value: "add-extensions" },
|
|
523
|
+
{ name: "\u{1F527} Install/Update CLI (adhdev command)", value: "install-cli" },
|
|
516
524
|
{ name: "\u{1F510} Re-login", value: "relogin" },
|
|
517
525
|
{ name: "\u274C Exit", value: "exit" }
|
|
518
526
|
]
|
|
@@ -527,6 +535,10 @@ async function runWizard(options = {}) {
|
|
|
527
535
|
await loginFlow();
|
|
528
536
|
return;
|
|
529
537
|
}
|
|
538
|
+
if (action === "install-cli") {
|
|
539
|
+
await installCliOnly();
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
530
542
|
}
|
|
531
543
|
const { mode } = await import_inquirer.default.prompt([
|
|
532
544
|
{
|
|
@@ -534,13 +546,16 @@ async function runWizard(options = {}) {
|
|
|
534
546
|
name: "mode",
|
|
535
547
|
message: "Setup mode:",
|
|
536
548
|
choices: [
|
|
537
|
-
{ name: `\u{1F680} ${import_chalk.default.bold("Quick Setup")} \u2014 Auto-detect
|
|
538
|
-
{ name: `\u2699\uFE0F ${import_chalk.default.bold("Custom Setup")} \u2014 Choose IDE, AI extensions, and more`, value: "custom" }
|
|
549
|
+
{ name: `\u{1F680} ${import_chalk.default.bold("Quick Setup")} \u2014 Auto-detect IDEs, install bridge, login ${import_chalk.default.gray("(recommended)")}`, value: "quick" },
|
|
550
|
+
{ name: `\u2699\uFE0F ${import_chalk.default.bold("Custom Setup")} \u2014 Choose IDE, AI extensions, and more`, value: "custom" },
|
|
551
|
+
{ name: `\u{1F527} ${import_chalk.default.bold("CLI Only")} \u2014 Install adhdev command globally`, value: "cli-only" }
|
|
539
552
|
]
|
|
540
553
|
}
|
|
541
554
|
]);
|
|
542
555
|
if (mode === "quick") {
|
|
543
556
|
await quickSetup();
|
|
557
|
+
} else if (mode === "cli-only") {
|
|
558
|
+
await installCliOnly();
|
|
544
559
|
} else {
|
|
545
560
|
await customSetup();
|
|
546
561
|
}
|
|
@@ -605,8 +620,8 @@ async function quickSetup() {
|
|
|
605
620
|
await injectTokenToIDE(ide, loginResult.connectionToken);
|
|
606
621
|
}
|
|
607
622
|
}
|
|
608
|
-
const
|
|
609
|
-
markSetupComplete(
|
|
623
|
+
const ideIds = selectedIDEs.map((i) => i.id);
|
|
624
|
+
markSetupComplete(ideIds, ["adhdev"]);
|
|
610
625
|
if (loginResult) {
|
|
611
626
|
updateConfig({
|
|
612
627
|
connectionToken: loginResult.connectionToken,
|
|
@@ -624,7 +639,7 @@ async function quickSetup() {
|
|
|
624
639
|
console.log(` ${import_chalk.default.bold("User:")} ${loginResult?.email || "not logged in"}`);
|
|
625
640
|
console.log(` ${import_chalk.default.bold("Status:")} ${import_chalk.default.green("Ready to connect")}`);
|
|
626
641
|
console.log();
|
|
627
|
-
await
|
|
642
|
+
await installCliOnly();
|
|
628
643
|
}
|
|
629
644
|
async function customSetup() {
|
|
630
645
|
console.log(import_chalk.default.bold("\n\u{1F4CD} Step 1/4 \u2014 Detecting installed IDEs...\n"));
|
|
@@ -888,9 +903,9 @@ async function addExtensionsFlow() {
|
|
|
888
903
|
});
|
|
889
904
|
console.log(import_chalk.default.green("\n\u2713 Extensions added!"));
|
|
890
905
|
}
|
|
891
|
-
async function
|
|
906
|
+
async function installCliOnly() {
|
|
892
907
|
const { execSync: execSyncLocal } = await import("child_process");
|
|
893
|
-
let
|
|
908
|
+
let currentVersion = null;
|
|
894
909
|
try {
|
|
895
910
|
const result = execSyncLocal("npm list -g adhdev --json 2>/dev/null || npm list -g adhdev --json 2>nul", {
|
|
896
911
|
encoding: "utf-8",
|
|
@@ -898,48 +913,65 @@ async function suggestGlobalInstall() {
|
|
|
898
913
|
stdio: ["pipe", "pipe", "pipe"]
|
|
899
914
|
});
|
|
900
915
|
const parsed = JSON.parse(result);
|
|
901
|
-
|
|
916
|
+
currentVersion = parsed.dependencies?.adhdev?.version || null;
|
|
902
917
|
} catch {
|
|
903
|
-
isGloballyInstalled = false;
|
|
904
918
|
}
|
|
905
|
-
|
|
906
|
-
console.log(import_chalk.default.cyan(DIVIDER));
|
|
907
|
-
console.log(import_chalk.default.bold("\n\u{1F4A1} Install ADHDev CLI globally?\n"));
|
|
919
|
+
console.log(import_chalk.default.bold("\n\u{1F527} ADHDev CLI\n"));
|
|
908
920
|
console.log(import_chalk.default.gray(" The `adhdev` command lets you:"));
|
|
909
921
|
console.log(import_chalk.default.gray(" \u2022 Launch IDE with CDP debugging (adhdev launch cursor)"));
|
|
910
|
-
console.log(import_chalk.default.gray(" \u2022 Relaunch IDE
|
|
922
|
+
console.log(import_chalk.default.gray(" \u2022 Relaunch IDE for remote control"));
|
|
911
923
|
console.log(import_chalk.default.gray(" \u2022 Check status anytime (adhdev status)"));
|
|
912
924
|
console.log();
|
|
913
|
-
|
|
914
|
-
{
|
|
925
|
+
if (currentVersion) {
|
|
926
|
+
console.log(import_chalk.default.green(` \u2713 Currently installed: v${currentVersion}`));
|
|
927
|
+
const { doUpdate } = await import_inquirer.default.prompt([{
|
|
928
|
+
type: "confirm",
|
|
929
|
+
name: "doUpdate",
|
|
930
|
+
message: "Update to latest version?",
|
|
931
|
+
default: true
|
|
932
|
+
}]);
|
|
933
|
+
if (!doUpdate) return;
|
|
934
|
+
} else {
|
|
935
|
+
console.log(import_chalk.default.yellow(" \u2717 Not installed globally"));
|
|
936
|
+
const { doInstall } = await import_inquirer.default.prompt([{
|
|
915
937
|
type: "confirm",
|
|
916
938
|
name: "doInstall",
|
|
917
|
-
message:
|
|
939
|
+
message: "Install adhdev CLI globally? (npm install -g adhdev)",
|
|
918
940
|
default: true
|
|
941
|
+
}]);
|
|
942
|
+
if (!doInstall) {
|
|
943
|
+
console.log(import_chalk.default.gray("\n You can install later: npm install -g adhdev\n"));
|
|
944
|
+
return;
|
|
919
945
|
}
|
|
920
|
-
]);
|
|
921
|
-
if (!doInstall) {
|
|
922
|
-
console.log(import_chalk.default.gray("\n You can install later: npm install -g adhdev\n"));
|
|
923
|
-
return;
|
|
924
946
|
}
|
|
925
|
-
const installSpinner = (0, import_ora.default)("Installing adhdev
|
|
947
|
+
const installSpinner = (0, import_ora.default)("Installing adhdev CLI...").start();
|
|
926
948
|
try {
|
|
927
|
-
execSyncLocal("npm install -g adhdev", {
|
|
949
|
+
execSyncLocal("npm install -g adhdev@latest", {
|
|
928
950
|
encoding: "utf-8",
|
|
929
951
|
timeout: 6e4,
|
|
930
952
|
stdio: ["pipe", "pipe", "pipe"]
|
|
931
953
|
});
|
|
932
|
-
|
|
954
|
+
let newVersion = "latest";
|
|
955
|
+
try {
|
|
956
|
+
newVersion = execSyncLocal("adhdev --version 2>/dev/null || adhdev --version 2>nul", {
|
|
957
|
+
encoding: "utf-8",
|
|
958
|
+
timeout: 5e3,
|
|
959
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
960
|
+
}).trim();
|
|
961
|
+
} catch {
|
|
962
|
+
}
|
|
963
|
+
installSpinner.succeed(`adhdev CLI ${currentVersion ? "updated" : "installed"} \u2713 (v${newVersion})`);
|
|
933
964
|
console.log(import_chalk.default.gray(" Try: adhdev launch cursor"));
|
|
965
|
+
console.log(import_chalk.default.gray(" adhdev status"));
|
|
934
966
|
console.log();
|
|
935
967
|
} catch (e) {
|
|
936
|
-
installSpinner.fail("
|
|
968
|
+
installSpinner.fail("Install failed");
|
|
937
969
|
console.log(import_chalk.default.yellow(` Error: ${e?.message?.split("\n")[0] || "Unknown"}`));
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
console.log(import_chalk.default.gray(" On Windows, you may need to run PowerShell as Administrator"));
|
|
970
|
+
const osModule = await import("os");
|
|
971
|
+
if (osModule.platform() === "win32") {
|
|
972
|
+
console.log(import_chalk.default.gray(" On Windows, run PowerShell as Administrator"));
|
|
942
973
|
}
|
|
974
|
+
console.log(import_chalk.default.gray(" Manual: npm install -g adhdev@latest"));
|
|
943
975
|
console.log();
|
|
944
976
|
}
|
|
945
977
|
}
|