adhdev 0.1.2 → 0.1.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/index.js +44 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -150,12 +150,10 @@ function getIdeVersion(cliCommand) {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
function checkPathExists(paths) {
|
|
153
|
-
const os = (0, import_os.platform)();
|
|
154
153
|
for (const p of paths) {
|
|
155
154
|
if (p.includes("*")) {
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
const resolved = parts.join(homeDir.split(/[/\\]/).pop() || "");
|
|
155
|
+
const home = (0, import_os.homedir)();
|
|
156
|
+
const resolved = p.replace(/^C:\\\\Users\\\\\*/, home.replace(/\//g, "\\"));
|
|
159
157
|
if ((0, import_fs.existsSync)(resolved)) return resolved;
|
|
160
158
|
} else {
|
|
161
159
|
if ((0, import_fs.existsSync)(p)) return p;
|
|
@@ -175,6 +173,24 @@ async function detectIDEs() {
|
|
|
175
173
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
176
174
|
if ((0, import_fs.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
177
175
|
}
|
|
176
|
+
if (!resolvedCli && appPath && os === "win32") {
|
|
177
|
+
const { dirname } = await import("path");
|
|
178
|
+
const appDir = dirname(appPath);
|
|
179
|
+
const candidates = [
|
|
180
|
+
`${appDir}\\bin\\${def.cli}.cmd`,
|
|
181
|
+
`${appDir}\\bin\\${def.cli}`,
|
|
182
|
+
`${appDir}\\${def.cli}.cmd`,
|
|
183
|
+
`${appDir}\\${def.cli}.exe`,
|
|
184
|
+
// resources/app/bin 하위
|
|
185
|
+
`${appDir}\\resources\\app\\bin\\${def.cli}.cmd`
|
|
186
|
+
];
|
|
187
|
+
for (const c of candidates) {
|
|
188
|
+
if ((0, import_fs.existsSync)(c)) {
|
|
189
|
+
resolvedCli = c;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
178
194
|
const version = resolvedCli ? getIdeVersion(resolvedCli) : null;
|
|
179
195
|
results.push({
|
|
180
196
|
id: def.id,
|
|
@@ -182,7 +198,7 @@ async function detectIDEs() {
|
|
|
182
198
|
displayName: def.displayName,
|
|
183
199
|
installed,
|
|
184
200
|
path: appPath || cliPath,
|
|
185
|
-
cliCommand: resolvedCli
|
|
201
|
+
cliCommand: resolvedCli || null,
|
|
186
202
|
version,
|
|
187
203
|
icon: def.icon,
|
|
188
204
|
extensionSupport: def.extensionSupport
|
|
@@ -737,18 +753,32 @@ async function loginFlow() {
|
|
|
737
753
|
}
|
|
738
754
|
async function injectTokenToIDE(ide, connectionToken) {
|
|
739
755
|
if (!ide.cliCommand) return;
|
|
740
|
-
const { execSync: execSync3 } = await import("child_process");
|
|
741
756
|
try {
|
|
742
|
-
const
|
|
743
|
-
vscode: `${(await import("os")).homedir()}/Library/Application Support/Code/User/settings.json`,
|
|
744
|
-
cursor: `${(await import("os")).homedir()}/Library/Application Support/Cursor/User/settings.json`,
|
|
745
|
-
antigravity: `${(await import("os")).homedir()}/Library/Application Support/Antigravity/User/settings.json`,
|
|
746
|
-
windsurf: `${(await import("os")).homedir()}/Library/Application Support/Windsurf/User/settings.json`
|
|
747
|
-
};
|
|
748
|
-
const settingsPath = settingsMap[ide.id];
|
|
749
|
-
if (!settingsPath) return;
|
|
757
|
+
const os = await import("os");
|
|
750
758
|
const fs = await import("fs");
|
|
751
759
|
const path = await import("path");
|
|
760
|
+
const platform2 = os.platform();
|
|
761
|
+
const home = os.homedir();
|
|
762
|
+
const getSettingsPath = (appName2) => {
|
|
763
|
+
if (platform2 === "darwin") {
|
|
764
|
+
return path.join(home, "Library", "Application Support", appName2, "User", "settings.json");
|
|
765
|
+
} else if (platform2 === "win32") {
|
|
766
|
+
return path.join(process.env.APPDATA || path.join(home, "AppData", "Roaming"), appName2, "User", "settings.json");
|
|
767
|
+
} else {
|
|
768
|
+
return path.join(home, ".config", appName2, "User", "settings.json");
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
const appNameMap = {
|
|
772
|
+
vscode: "Code",
|
|
773
|
+
cursor: "Cursor",
|
|
774
|
+
antigravity: "Antigravity",
|
|
775
|
+
windsurf: "Windsurf",
|
|
776
|
+
"vscode-insiders": "Code - Insiders",
|
|
777
|
+
vscodium: "VSCodium"
|
|
778
|
+
};
|
|
779
|
+
const appName = appNameMap[ide.id];
|
|
780
|
+
if (!appName) return;
|
|
781
|
+
const settingsPath = getSettingsPath(appName);
|
|
752
782
|
let settings = {};
|
|
753
783
|
if (fs.existsSync(settingsPath)) {
|
|
754
784
|
try {
|