adhdev 0.1.17 → 0.1.19
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 +26 -58
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -519,7 +519,6 @@ async function runWizard(options = {}) {
|
|
|
519
519
|
message: "What would you like to do?",
|
|
520
520
|
choices: [
|
|
521
521
|
{ name: "\u{1F504} Reconfigure (run setup again)", value: "reconfigure" },
|
|
522
|
-
{ name: "\u2795 Add more extensions", value: "add-extensions" },
|
|
523
522
|
{ name: "\u{1F527} Install/Update CLI (adhdev command)", value: "install-cli" },
|
|
524
523
|
{ name: "\u{1F510} Re-login", value: "relogin" },
|
|
525
524
|
{ name: "\u274C Exit", value: "exit" }
|
|
@@ -527,10 +526,6 @@ async function runWizard(options = {}) {
|
|
|
527
526
|
}
|
|
528
527
|
]);
|
|
529
528
|
if (action === "exit") return;
|
|
530
|
-
if (action === "add-extensions") {
|
|
531
|
-
await addExtensionsFlow();
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
529
|
if (action === "relogin") {
|
|
535
530
|
await loginFlow();
|
|
536
531
|
return;
|
|
@@ -873,55 +868,20 @@ async function injectTokenToIDE(ide, connectionToken) {
|
|
|
873
868
|
console.log(import_chalk.default.gray(` You can set it manually: adhdev.connectionToken = ${connectionToken}`));
|
|
874
869
|
}
|
|
875
870
|
}
|
|
876
|
-
async function addExtensionsFlow() {
|
|
877
|
-
const config = loadConfig();
|
|
878
|
-
const ides = await detectIDEs();
|
|
879
|
-
const selectedIDE = ides.find((i) => i.id === config.selectedIde);
|
|
880
|
-
if (!selectedIDE || !selectedIDE.installed) {
|
|
881
|
-
console.log(import_chalk.default.yellow("\u26A0 Previously selected IDE not found."));
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
const aiExtensions = getAIExtensions();
|
|
885
|
-
const notInstalled = aiExtensions.filter((e) => !config.installedExtensions.includes(e.id));
|
|
886
|
-
if (notInstalled.length === 0) {
|
|
887
|
-
console.log(import_chalk.default.green("\u2713 All extensions already installed!"));
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
const { selectedExtIds } = await import_inquirer.default.prompt([
|
|
891
|
-
{
|
|
892
|
-
type: "checkbox",
|
|
893
|
-
name: "selectedExtIds",
|
|
894
|
-
message: "Select extensions to install:",
|
|
895
|
-
choices: notInstalled.map((ext) => ({
|
|
896
|
-
name: `${ext.icon} ${ext.displayName}`,
|
|
897
|
-
value: ext.id
|
|
898
|
-
}))
|
|
899
|
-
}
|
|
900
|
-
]);
|
|
901
|
-
if (selectedExtIds.length === 0) return;
|
|
902
|
-
const extensions = notInstalled.filter((e) => selectedExtIds.includes(e.id));
|
|
903
|
-
await installExtensions(selectedIDE, extensions, (current, total, ext, result) => {
|
|
904
|
-
const status = result.success ? import_chalk.default.green("installed \u2713") : import_chalk.default.red("failed \u2717");
|
|
905
|
-
console.log(` [${current}/${total}] ${ext.icon} ${ext.displayName} \u2014 ${status}`);
|
|
906
|
-
});
|
|
907
|
-
updateConfig({
|
|
908
|
-
installedExtensions: [...config.installedExtensions, ...selectedExtIds]
|
|
909
|
-
});
|
|
910
|
-
console.log(import_chalk.default.green("\n\u2713 Extensions added!"));
|
|
911
|
-
}
|
|
912
871
|
async function installCliOnly() {
|
|
913
872
|
const { execSync: execSyncLocal } = await import("child_process");
|
|
914
873
|
let currentVersion = null;
|
|
915
874
|
try {
|
|
916
875
|
const result = execSyncLocal("npm list -g adhdev --json 2>/dev/null || npm list -g adhdev --json 2>nul", {
|
|
917
876
|
encoding: "utf-8",
|
|
918
|
-
timeout:
|
|
877
|
+
timeout: 5e3,
|
|
919
878
|
stdio: ["pipe", "pipe", "pipe"]
|
|
920
879
|
});
|
|
921
880
|
const parsed = JSON.parse(result);
|
|
922
881
|
currentVersion = parsed.dependencies?.adhdev?.version || null;
|
|
923
882
|
} catch {
|
|
924
883
|
}
|
|
884
|
+
const isNpx = process.env.npm_execpath?.includes("npx") || process.argv[1]?.includes("npx") || process.argv[1]?.includes("_npx");
|
|
925
885
|
console.log(import_chalk.default.bold("\n\u{1F527} ADHDev CLI\n"));
|
|
926
886
|
console.log(import_chalk.default.gray(" The `adhdev` command lets you:"));
|
|
927
887
|
console.log(import_chalk.default.gray(" \u2022 Launch IDE with CDP debugging (adhdev launch cursor)"));
|
|
@@ -930,24 +890,32 @@ async function installCliOnly() {
|
|
|
930
890
|
console.log();
|
|
931
891
|
if (currentVersion) {
|
|
932
892
|
console.log(import_chalk.default.green(` \u2713 Currently installed: v${currentVersion}`));
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
893
|
+
if (!isNpx) {
|
|
894
|
+
const { doUpdate } = await import_inquirer.default.prompt([{
|
|
895
|
+
type: "confirm",
|
|
896
|
+
name: "doUpdate",
|
|
897
|
+
message: "Update to latest version?",
|
|
898
|
+
default: true
|
|
899
|
+
}]);
|
|
900
|
+
if (!doUpdate) return;
|
|
901
|
+
} else {
|
|
902
|
+
console.log(import_chalk.default.gray(" Updating to latest..."));
|
|
903
|
+
}
|
|
940
904
|
} else {
|
|
941
905
|
console.log(import_chalk.default.yellow(" \u2717 Not installed globally"));
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
906
|
+
if (!isNpx) {
|
|
907
|
+
const { doInstall } = await import_inquirer.default.prompt([{
|
|
908
|
+
type: "confirm",
|
|
909
|
+
name: "doInstall",
|
|
910
|
+
message: "Install adhdev CLI globally? (npm install -g adhdev)",
|
|
911
|
+
default: true
|
|
912
|
+
}]);
|
|
913
|
+
if (!doInstall) {
|
|
914
|
+
console.log(import_chalk.default.gray("\n You can install later: npm install -g adhdev\n"));
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
} else {
|
|
918
|
+
console.log(import_chalk.default.gray(" Installing globally..."));
|
|
951
919
|
}
|
|
952
920
|
}
|
|
953
921
|
const installSpinner = (0, import_ora.default)("Installing adhdev CLI...").start();
|