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