apex-dev 3.10.15 → 3.10.16
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/cli.js +17 -21
- package/dist/index.js +4180 -3183
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -210,10 +210,21 @@ function tryBun() {
|
|
|
210
210
|
|
|
211
211
|
function runWithBun() {
|
|
212
212
|
const bunPath = process.env.BUN_PATH || "bun";
|
|
213
|
-
const scriptPath = path.join(__dirname, "
|
|
213
|
+
const scriptPath = path.join(__dirname, "apex.mjs");
|
|
214
214
|
if (!fs.existsSync(scriptPath)) {
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
// Fallback to dist/index.js for npm-installed usage
|
|
216
|
+
const distPath = path.join(__dirname, "dist", "index.js");
|
|
217
|
+
if (!fs.existsSync(distPath)) {
|
|
218
|
+
console.error("Neither apex.mjs nor dist/index.js found for bun fallback.");
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
221
|
+
const child = spawn(bunPath, [distPath, ...process.argv.slice(2)], {
|
|
222
|
+
stdio: "inherit",
|
|
223
|
+
});
|
|
224
|
+
child.on("exit", (code) => {
|
|
225
|
+
process.exit(code || 0);
|
|
226
|
+
});
|
|
227
|
+
return;
|
|
217
228
|
}
|
|
218
229
|
const child = spawn(bunPath, [scriptPath, ...process.argv.slice(2)], {
|
|
219
230
|
stdio: "inherit",
|
|
@@ -266,9 +277,8 @@ async function ensureApiKeys() {
|
|
|
266
277
|
process.exit(0);
|
|
267
278
|
}
|
|
268
279
|
|
|
269
|
-
// Normal flow: fill missing keys from config
|
|
280
|
+
// Normal flow: fill missing keys from config (non-interactive — TUI handles selection)
|
|
270
281
|
const config = readConfig();
|
|
271
|
-
let newKeys = false;
|
|
272
282
|
|
|
273
283
|
for (const provider of PROVIDERS) {
|
|
274
284
|
if (process.env[provider.envKey]) continue;
|
|
@@ -276,29 +286,15 @@ async function ensureApiKeys() {
|
|
|
276
286
|
const stored = config[provider.name];
|
|
277
287
|
if (stored) {
|
|
278
288
|
process.env[provider.envKey] = stored;
|
|
279
|
-
} else {
|
|
280
|
-
if (!newKeys) {
|
|
281
|
-
console.error("");
|
|
282
|
-
newKeys = true;
|
|
283
|
-
}
|
|
284
|
-
const key = await promptKey(provider.label);
|
|
285
|
-
if (key) {
|
|
286
|
-
process.env[provider.envKey] = key;
|
|
287
|
-
config[provider.name] = key;
|
|
288
|
-
}
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
if (newKeys) {
|
|
293
|
-
saveConfig(config);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
292
|
// Summary
|
|
297
293
|
const configured = PROVIDERS.filter((p) => process.env[p.envKey]);
|
|
298
294
|
if (configured.length > 0) {
|
|
299
|
-
console.error(`\n\u2713
|
|
295
|
+
console.error(`\n\u2713 ${configured.length} provider(s) configured`);
|
|
300
296
|
} else {
|
|
301
|
-
console.error("\n\u26A0 No API keys configured.
|
|
297
|
+
console.error("\n\u26A0 No API keys configured. Launching interactive provider selection.");
|
|
302
298
|
}
|
|
303
299
|
}
|
|
304
300
|
|