@kilocode/cli 0.22.2 → 0.23.0
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/index.js +481 -396
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -44206,7 +44206,7 @@ var init_logs = __esm({
|
|
|
44206
44206
|
var version;
|
|
44207
44207
|
var init_package = __esm({
|
|
44208
44208
|
"package.json"() {
|
|
44209
|
-
version = "0.
|
|
44209
|
+
version = "0.23.0";
|
|
44210
44210
|
}
|
|
44211
44211
|
});
|
|
44212
44212
|
|
|
@@ -71317,7 +71317,7 @@ function prettyModelName(modelId) {
|
|
|
71317
71317
|
name = name.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
71318
71318
|
return name;
|
|
71319
71319
|
}
|
|
71320
|
-
var PROVIDER_TO_ROUTER_NAME, PROVIDER_MODEL_FIELD, providerSupportsModelList, getModelFieldForProvider, DEFAULT_MODEL_IDS;
|
|
71320
|
+
var PROVIDER_TO_ROUTER_NAME, PROVIDER_MODEL_FIELD, providerSupportsModelList, isModelField, getModelFieldForProvider, DEFAULT_MODEL_IDS;
|
|
71321
71321
|
var init_models = __esm({
|
|
71322
71322
|
"src/constants/providers/models.ts"() {
|
|
71323
71323
|
"use strict";
|
|
@@ -71421,6 +71421,9 @@ var init_models = __esm({
|
|
|
71421
71421
|
providerSupportsModelList = (provider) => {
|
|
71422
71422
|
return PROVIDER_TO_ROUTER_NAME[provider] !== null;
|
|
71423
71423
|
};
|
|
71424
|
+
isModelField = (field) => {
|
|
71425
|
+
return Object.values(PROVIDER_MODEL_FIELD).includes(field);
|
|
71426
|
+
};
|
|
71424
71427
|
getModelFieldForProvider = (provider) => {
|
|
71425
71428
|
return PROVIDER_MODEL_FIELD[provider];
|
|
71426
71429
|
};
|
|
@@ -93195,60 +93198,16 @@ var require_run_async = __commonJS({
|
|
|
93195
93198
|
}
|
|
93196
93199
|
});
|
|
93197
93200
|
|
|
93198
|
-
// src/
|
|
93199
|
-
var models_api_exports = {};
|
|
93200
|
-
__export(models_api_exports, {
|
|
93201
|
-
modelsApiCommand: () => modelsApiCommand,
|
|
93202
|
-
transformModelsToOutput: () => transformModelsToOutput
|
|
93203
|
-
});
|
|
93204
|
-
import { createStore as createStore4 } from "jotai";
|
|
93205
|
-
function getActiveProvider(config2, providerIdOverride) {
|
|
93206
|
-
const providerId = providerIdOverride || config2.provider;
|
|
93207
|
-
const provider = config2.providers.find((p) => p.id === providerId);
|
|
93208
|
-
if (!provider) {
|
|
93209
|
-
logs.error(`Provider not found: ${providerId}`, "ModelsAPI");
|
|
93210
|
-
return null;
|
|
93211
|
-
}
|
|
93212
|
-
return provider;
|
|
93213
|
-
}
|
|
93214
|
-
function transformModelsToOutput(models, currentModelId, providerName) {
|
|
93215
|
-
const sortedModelIds = sortModelsByPreference(models);
|
|
93216
|
-
const outputModels = sortedModelIds.map((id) => {
|
|
93217
|
-
const model = models[id];
|
|
93218
|
-
if (!model) {
|
|
93219
|
-
return null;
|
|
93220
|
-
}
|
|
93221
|
-
return {
|
|
93222
|
-
id,
|
|
93223
|
-
displayName: model.displayName || null,
|
|
93224
|
-
contextWindow: model.contextWindow,
|
|
93225
|
-
...model.supportsImages !== void 0 && { supportsImages: model.supportsImages },
|
|
93226
|
-
...model.inputPrice !== void 0 && { inputPrice: model.inputPrice },
|
|
93227
|
-
...model.outputPrice !== void 0 && { outputPrice: model.outputPrice }
|
|
93228
|
-
};
|
|
93229
|
-
}).filter((m) => m !== null);
|
|
93230
|
-
return {
|
|
93231
|
-
provider: providerName,
|
|
93232
|
-
currentModel: currentModelId,
|
|
93233
|
-
models: outputModels
|
|
93234
|
-
};
|
|
93235
|
-
}
|
|
93236
|
-
function outputJson(data) {
|
|
93237
|
-
console.log(JSON.stringify(data, null, 2));
|
|
93238
|
-
}
|
|
93239
|
-
function outputError(message, code) {
|
|
93240
|
-
outputJson({ error: message, code });
|
|
93241
|
-
process.exit(1);
|
|
93242
|
-
}
|
|
93201
|
+
// src/services/models/fetcher.ts
|
|
93243
93202
|
async function fetchRouterModels(provider, timeoutMs = ROUTER_MODELS_TIMEOUT_MS) {
|
|
93244
93203
|
let service = null;
|
|
93245
93204
|
try {
|
|
93246
|
-
logs.info("Initializing extension to fetch router models", "
|
|
93205
|
+
logs.info("Initializing extension to fetch router models", "ModelFetcher");
|
|
93247
93206
|
service = createExtensionService({
|
|
93248
93207
|
workspace: process.cwd()
|
|
93249
93208
|
});
|
|
93250
93209
|
await service.initialize();
|
|
93251
|
-
logs.debug("Extension service initialized", "
|
|
93210
|
+
logs.debug("Extension service initialized", "ModelFetcher");
|
|
93252
93211
|
if (!service.isReady()) {
|
|
93253
93212
|
await new Promise((resolve3, reject) => {
|
|
93254
93213
|
const timeout2 = setTimeout(() => {
|
|
@@ -93266,7 +93225,7 @@ async function fetchRouterModels(provider, timeoutMs = ROUTER_MODELS_TIMEOUT_MS)
|
|
|
93266
93225
|
apiConfiguration,
|
|
93267
93226
|
currentApiConfigName: provider.id
|
|
93268
93227
|
});
|
|
93269
|
-
logs.debug("Provider configuration injected", "
|
|
93228
|
+
logs.debug("Provider configuration injected", "ModelFetcher");
|
|
93270
93229
|
const routerModelsPromise = new Promise((resolve3, reject) => {
|
|
93271
93230
|
const timeout2 = setTimeout(() => {
|
|
93272
93231
|
reject(new Error(`Router models request timed out after ${timeoutMs}ms`));
|
|
@@ -93283,26 +93242,82 @@ async function fetchRouterModels(provider, timeoutMs = ROUTER_MODELS_TIMEOUT_MS)
|
|
|
93283
93242
|
await service.sendWebviewMessage({
|
|
93284
93243
|
type: "requestRouterModels"
|
|
93285
93244
|
});
|
|
93286
|
-
logs.debug("Sent requestRouterModels message", "
|
|
93245
|
+
logs.debug("Sent requestRouterModels message", "ModelFetcher");
|
|
93287
93246
|
const routerModels = await routerModelsPromise;
|
|
93288
|
-
logs.info("Received router models", "
|
|
93247
|
+
logs.info("Received router models", "ModelFetcher", {
|
|
93289
93248
|
providerCount: routerModels ? Object.keys(routerModels).length : 0
|
|
93290
93249
|
});
|
|
93291
93250
|
return routerModels;
|
|
93292
93251
|
} catch (error) {
|
|
93293
|
-
logs.error("Failed to fetch router models", "
|
|
93252
|
+
logs.error("Failed to fetch router models", "ModelFetcher", { error });
|
|
93294
93253
|
return null;
|
|
93295
93254
|
} finally {
|
|
93296
93255
|
if (service) {
|
|
93297
93256
|
try {
|
|
93298
93257
|
await service.dispose();
|
|
93299
|
-
logs.debug("Extension service disposed", "
|
|
93258
|
+
logs.debug("Extension service disposed", "ModelFetcher");
|
|
93300
93259
|
} catch (disposeError) {
|
|
93301
|
-
logs.warn("Error disposing extension service", "
|
|
93260
|
+
logs.warn("Error disposing extension service", "ModelFetcher", { error: disposeError });
|
|
93302
93261
|
}
|
|
93303
93262
|
}
|
|
93304
93263
|
}
|
|
93305
93264
|
}
|
|
93265
|
+
var ROUTER_MODELS_TIMEOUT_MS;
|
|
93266
|
+
var init_fetcher = __esm({
|
|
93267
|
+
"src/services/models/fetcher.ts"() {
|
|
93268
|
+
"use strict";
|
|
93269
|
+
init_logs();
|
|
93270
|
+
init_extension();
|
|
93271
|
+
init_mapper();
|
|
93272
|
+
ROUTER_MODELS_TIMEOUT_MS = 3e4;
|
|
93273
|
+
}
|
|
93274
|
+
});
|
|
93275
|
+
|
|
93276
|
+
// src/commands/models-api.ts
|
|
93277
|
+
var models_api_exports = {};
|
|
93278
|
+
__export(models_api_exports, {
|
|
93279
|
+
modelsApiCommand: () => modelsApiCommand,
|
|
93280
|
+
transformModelsToOutput: () => transformModelsToOutput
|
|
93281
|
+
});
|
|
93282
|
+
import { createStore as createStore4 } from "jotai";
|
|
93283
|
+
function getActiveProvider(config2, providerIdOverride) {
|
|
93284
|
+
const providerId = providerIdOverride || config2.provider;
|
|
93285
|
+
const provider = config2.providers.find((p) => p.id === providerId);
|
|
93286
|
+
if (!provider) {
|
|
93287
|
+
logs.error(`Provider not found: ${providerId}`, "ModelsAPI");
|
|
93288
|
+
return null;
|
|
93289
|
+
}
|
|
93290
|
+
return provider;
|
|
93291
|
+
}
|
|
93292
|
+
function transformModelsToOutput(models, currentModelId, providerName) {
|
|
93293
|
+
const sortedModelIds = sortModelsByPreference(models);
|
|
93294
|
+
const outputModels = sortedModelIds.map((id) => {
|
|
93295
|
+
const model = models[id];
|
|
93296
|
+
if (!model) {
|
|
93297
|
+
return null;
|
|
93298
|
+
}
|
|
93299
|
+
return {
|
|
93300
|
+
id,
|
|
93301
|
+
displayName: model.displayName || null,
|
|
93302
|
+
contextWindow: model.contextWindow,
|
|
93303
|
+
...model.supportsImages !== void 0 && { supportsImages: model.supportsImages },
|
|
93304
|
+
...model.inputPrice !== void 0 && { inputPrice: model.inputPrice },
|
|
93305
|
+
...model.outputPrice !== void 0 && { outputPrice: model.outputPrice }
|
|
93306
|
+
};
|
|
93307
|
+
}).filter((m) => m !== null);
|
|
93308
|
+
return {
|
|
93309
|
+
provider: providerName,
|
|
93310
|
+
currentModel: currentModelId,
|
|
93311
|
+
models: outputModels
|
|
93312
|
+
};
|
|
93313
|
+
}
|
|
93314
|
+
function outputJson(data) {
|
|
93315
|
+
console.log(JSON.stringify(data, null, 2));
|
|
93316
|
+
}
|
|
93317
|
+
function outputError(message, code) {
|
|
93318
|
+
outputJson({ error: message, code });
|
|
93319
|
+
process.exit(1);
|
|
93320
|
+
}
|
|
93306
93321
|
async function modelsApiCommand(options = {}) {
|
|
93307
93322
|
try {
|
|
93308
93323
|
logs.info("Starting models API command", "ModelsAPI", { options });
|
|
@@ -93373,16 +93388,13 @@ async function modelsApiCommand(options = {}) {
|
|
|
93373
93388
|
}
|
|
93374
93389
|
process.exit(0);
|
|
93375
93390
|
}
|
|
93376
|
-
var ROUTER_MODELS_TIMEOUT_MS;
|
|
93377
93391
|
var init_models_api = __esm({
|
|
93378
93392
|
"src/commands/models-api.ts"() {
|
|
93379
93393
|
"use strict";
|
|
93380
93394
|
init_config2();
|
|
93381
93395
|
init_logs();
|
|
93382
93396
|
init_models();
|
|
93383
|
-
|
|
93384
|
-
init_mapper();
|
|
93385
|
-
ROUTER_MODELS_TIMEOUT_MS = 3e4;
|
|
93397
|
+
init_fetcher();
|
|
93386
93398
|
}
|
|
93387
93399
|
});
|
|
93388
93400
|
|
|
@@ -93393,8 +93405,7 @@ import { join } from "path";
|
|
|
93393
93405
|
function loadEnvFile() {
|
|
93394
93406
|
const envPath = join(__dirname, ".env");
|
|
93395
93407
|
if (!existsSync(envPath)) {
|
|
93396
|
-
|
|
93397
|
-
process.exit(1);
|
|
93408
|
+
return;
|
|
93398
93409
|
}
|
|
93399
93410
|
const result = config({ path: envPath });
|
|
93400
93411
|
if (result.error) {
|
|
@@ -130035,7 +130046,7 @@ var CLI = class {
|
|
|
130035
130046
|
init_telemetry3();
|
|
130036
130047
|
init_package2();
|
|
130037
130048
|
|
|
130038
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130049
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/key.js
|
|
130039
130050
|
var isUpKey = (key, keybindings = []) => (
|
|
130040
130051
|
// The up key
|
|
130041
130052
|
key.name === "up" || // Vim keybinding: hjkl keys map to left/down/up/right
|
|
@@ -130054,7 +130065,7 @@ var isTabKey = (key) => key.name === "tab";
|
|
|
130054
130065
|
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
130055
130066
|
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
130056
130067
|
|
|
130057
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130068
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/errors.js
|
|
130058
130069
|
var AbortPromptError = class extends Error {
|
|
130059
130070
|
name = "AbortPromptError";
|
|
130060
130071
|
message = "Prompt was aborted";
|
|
@@ -130077,10 +130088,10 @@ var ValidationError = class extends Error {
|
|
|
130077
130088
|
name = "ValidationError";
|
|
130078
130089
|
};
|
|
130079
130090
|
|
|
130080
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130091
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
130081
130092
|
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
130082
130093
|
|
|
130083
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130094
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
130084
130095
|
import { AsyncLocalStorage as AsyncLocalStorage2, AsyncResource } from "node:async_hooks";
|
|
130085
130096
|
var hookStorage = new AsyncLocalStorage2();
|
|
130086
130097
|
function createStore2(rl) {
|
|
@@ -130186,7 +130197,7 @@ var effectScheduler = {
|
|
|
130186
130197
|
}
|
|
130187
130198
|
};
|
|
130188
130199
|
|
|
130189
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130200
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
130190
130201
|
function useState11(defaultValue) {
|
|
130191
130202
|
return withPointer((pointer) => {
|
|
130192
130203
|
const setState = AsyncResource2.bind(function setState2(newValue) {
|
|
@@ -130204,7 +130215,7 @@ function useState11(defaultValue) {
|
|
|
130204
130215
|
});
|
|
130205
130216
|
}
|
|
130206
130217
|
|
|
130207
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130218
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
130208
130219
|
function useEffect22(cb, depArray) {
|
|
130209
130220
|
withPointer((pointer) => {
|
|
130210
130221
|
const oldDeps = pointer.get();
|
|
@@ -130216,10 +130227,10 @@ function useEffect22(cb, depArray) {
|
|
|
130216
130227
|
});
|
|
130217
130228
|
}
|
|
130218
130229
|
|
|
130219
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130230
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/theme.js
|
|
130220
130231
|
import { styleText } from "node:util";
|
|
130221
130232
|
|
|
130222
|
-
// ../node_modules/.pnpm/@inquirer+figures@2.0.
|
|
130233
|
+
// ../node_modules/.pnpm/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
|
|
130223
130234
|
import process15 from "node:process";
|
|
130224
130235
|
function isUnicodeSupported() {
|
|
130225
130236
|
if (process15.platform !== "win32") {
|
|
@@ -130511,7 +130522,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
|
130511
130522
|
var dist_default5 = figures;
|
|
130512
130523
|
var replacements = Object.entries(specialMainSymbols);
|
|
130513
130524
|
|
|
130514
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130525
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/theme.js
|
|
130515
130526
|
var defaultTheme = {
|
|
130516
130527
|
prefix: {
|
|
130517
130528
|
idle: styleText("blue", "?"),
|
|
@@ -130532,7 +130543,7 @@ var defaultTheme = {
|
|
|
130532
130543
|
}
|
|
130533
130544
|
};
|
|
130534
130545
|
|
|
130535
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130546
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
130536
130547
|
function isPlainObject2(value) {
|
|
130537
130548
|
if (typeof value !== "object" || value === null)
|
|
130538
130549
|
return false;
|
|
@@ -130560,7 +130571,7 @@ function makeTheme(...themes) {
|
|
|
130560
130571
|
return deepMerge3(...themesToMerge);
|
|
130561
130572
|
}
|
|
130562
130573
|
|
|
130563
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130574
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
130564
130575
|
function usePrefix({ status = "idle", theme }) {
|
|
130565
130576
|
const [showLoader, setShowLoader] = useState11(false);
|
|
130566
130577
|
const [tick, setTick] = useState11(0);
|
|
@@ -130591,7 +130602,7 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
130591
130602
|
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
130592
130603
|
}
|
|
130593
130604
|
|
|
130594
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130605
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
130595
130606
|
function useMemo18(fn, dependencies) {
|
|
130596
130607
|
return withPointer((pointer) => {
|
|
130597
130608
|
const prev = pointer.get();
|
|
@@ -130604,12 +130615,12 @@ function useMemo18(fn, dependencies) {
|
|
|
130604
130615
|
});
|
|
130605
130616
|
}
|
|
130606
130617
|
|
|
130607
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130618
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
130608
130619
|
function useRef11(val) {
|
|
130609
130620
|
return useState11({ current: val })[0];
|
|
130610
130621
|
}
|
|
130611
130622
|
|
|
130612
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130623
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
130613
130624
|
function useKeypress(userHandler) {
|
|
130614
130625
|
const signal = useRef11(userHandler);
|
|
130615
130626
|
signal.current = userHandler;
|
|
@@ -130628,7 +130639,7 @@ function useKeypress(userHandler) {
|
|
|
130628
130639
|
}, []);
|
|
130629
130640
|
}
|
|
130630
130641
|
|
|
130631
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130642
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/utils.js
|
|
130632
130643
|
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
130633
130644
|
function breakLines(content, width) {
|
|
130634
130645
|
return content.split("\n").flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split("\n").map((str) => str.trimEnd())).join("\n");
|
|
@@ -130637,7 +130648,7 @@ function readlineWidth() {
|
|
|
130637
130648
|
return (0, import_cli_width.default)({ defaultWidth: 80, output: readline2().output });
|
|
130638
130649
|
}
|
|
130639
130650
|
|
|
130640
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130651
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
130641
130652
|
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
130642
130653
|
const state = useRef11({
|
|
130643
130654
|
lastPointer: active,
|
|
@@ -130726,7 +130737,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
|
130726
130737
|
return pageBuffer.filter((line) => typeof line === "string").join("\n");
|
|
130727
130738
|
}
|
|
130728
130739
|
|
|
130729
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130740
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
130730
130741
|
var import_mute_stream = __toESM(require_lib(), 1);
|
|
130731
130742
|
import * as readline3 from "node:readline";
|
|
130732
130743
|
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
@@ -130982,10 +130993,10 @@ var {
|
|
|
130982
130993
|
unload
|
|
130983
130994
|
} = signalExitWrap(processOk(process16) ? new SignalExit(process16) : new SignalExitFallback());
|
|
130984
130995
|
|
|
130985
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
130996
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
130986
130997
|
import { stripVTControlCharacters } from "node:util";
|
|
130987
130998
|
|
|
130988
|
-
// ../node_modules/.pnpm/@inquirer+ansi@2.0.
|
|
130999
|
+
// ../node_modules/.pnpm/@inquirer+ansi@2.0.3/node_modules/@inquirer/ansi/dist/index.js
|
|
130989
131000
|
var ESC3 = "\x1B[";
|
|
130990
131001
|
var cursorLeft2 = ESC3 + "G";
|
|
130991
131002
|
var cursorHide2 = ESC3 + "?25l";
|
|
@@ -131001,7 +131012,7 @@ var cursorTo2 = (x, y) => {
|
|
|
131001
131012
|
var eraseLine2 = ESC3 + "2K";
|
|
131002
131013
|
var eraseLines2 = (lines) => lines > 0 ? (eraseLine2 + cursorUp2(1)).repeat(lines - 1) + eraseLine2 + cursorLeft2 : "";
|
|
131003
131014
|
|
|
131004
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
131015
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
131005
131016
|
var height = (content) => content.split("\n").length;
|
|
131006
131017
|
var lastLine = (content) => content.split("\n").pop() ?? "";
|
|
131007
131018
|
var ScreenManager = class {
|
|
@@ -131061,7 +131072,7 @@ var ScreenManager = class {
|
|
|
131061
131072
|
}
|
|
131062
131073
|
};
|
|
131063
131074
|
|
|
131064
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
131075
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
131065
131076
|
var PromisePolyfill = class extends Promise {
|
|
131066
131077
|
// Available starting from Node 22
|
|
131067
131078
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
@@ -131076,7 +131087,7 @@ var PromisePolyfill = class extends Promise {
|
|
|
131076
131087
|
}
|
|
131077
131088
|
};
|
|
131078
131089
|
|
|
131079
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
131090
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
131080
131091
|
function getCallSites() {
|
|
131081
131092
|
const _prepareStackTrace = Error.prepareStackTrace;
|
|
131082
131093
|
let result = [];
|
|
@@ -131163,7 +131174,7 @@ function createPrompt(view) {
|
|
|
131163
131174
|
return prompt2;
|
|
131164
131175
|
}
|
|
131165
131176
|
|
|
131166
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
131177
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/Separator.js
|
|
131167
131178
|
import { styleText as styleText2 } from "node:util";
|
|
131168
131179
|
var Separator = class {
|
|
131169
131180
|
separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default5.line));
|
|
@@ -131178,7 +131189,7 @@ var Separator = class {
|
|
|
131178
131189
|
}
|
|
131179
131190
|
};
|
|
131180
131191
|
|
|
131181
|
-
// ../node_modules/.pnpm/@inquirer+checkbox@5.0.
|
|
131192
|
+
// ../node_modules/.pnpm/@inquirer+checkbox@5.0.4_@types+node@25.0.3/node_modules/@inquirer/checkbox/dist/index.js
|
|
131182
131193
|
import { styleText as styleText3 } from "node:util";
|
|
131183
131194
|
var checkboxTheme = {
|
|
131184
131195
|
icon: {
|
|
@@ -131351,7 +131362,7 @@ var dist_default6 = createPrompt((config2, done) => {
|
|
|
131351
131362
|
return `${lines}${cursorHide2}`;
|
|
131352
131363
|
});
|
|
131353
131364
|
|
|
131354
|
-
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
131365
|
+
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.3_@types+node@25.0.3/node_modules/@inquirer/external-editor/dist/index.js
|
|
131355
131366
|
var import_chardet = __toESM(require_lib2(), 1);
|
|
131356
131367
|
var import_iconv_lite = __toESM(require_lib3(), 1);
|
|
131357
131368
|
import { spawn as spawn2, spawnSync } from "child_process";
|
|
@@ -131360,7 +131371,7 @@ import path20 from "node:path";
|
|
|
131360
131371
|
import os6 from "node:os";
|
|
131361
131372
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
131362
131373
|
|
|
131363
|
-
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
131374
|
+
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.3_@types+node@25.0.3/node_modules/@inquirer/external-editor/dist/errors/CreateFileError.js
|
|
131364
131375
|
var CreateFileError = class extends Error {
|
|
131365
131376
|
originalError;
|
|
131366
131377
|
constructor(originalError) {
|
|
@@ -131369,7 +131380,7 @@ var CreateFileError = class extends Error {
|
|
|
131369
131380
|
}
|
|
131370
131381
|
};
|
|
131371
131382
|
|
|
131372
|
-
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
131383
|
+
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.3_@types+node@25.0.3/node_modules/@inquirer/external-editor/dist/errors/LaunchEditorError.js
|
|
131373
131384
|
var LaunchEditorError = class extends Error {
|
|
131374
131385
|
originalError;
|
|
131375
131386
|
constructor(originalError) {
|
|
@@ -131378,7 +131389,7 @@ var LaunchEditorError = class extends Error {
|
|
|
131378
131389
|
}
|
|
131379
131390
|
};
|
|
131380
131391
|
|
|
131381
|
-
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
131392
|
+
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.3_@types+node@25.0.3/node_modules/@inquirer/external-editor/dist/errors/ReadFileError.js
|
|
131382
131393
|
var ReadFileError = class extends Error {
|
|
131383
131394
|
originalError;
|
|
131384
131395
|
constructor(originalError) {
|
|
@@ -131387,7 +131398,7 @@ var ReadFileError = class extends Error {
|
|
|
131387
131398
|
}
|
|
131388
131399
|
};
|
|
131389
131400
|
|
|
131390
|
-
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
131401
|
+
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.3_@types+node@25.0.3/node_modules/@inquirer/external-editor/dist/errors/RemoveFileError.js
|
|
131391
131402
|
var RemoveFileError = class extends Error {
|
|
131392
131403
|
originalError;
|
|
131393
131404
|
constructor(originalError) {
|
|
@@ -131396,7 +131407,7 @@ var RemoveFileError = class extends Error {
|
|
|
131396
131407
|
}
|
|
131397
131408
|
};
|
|
131398
131409
|
|
|
131399
|
-
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
131410
|
+
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.3_@types+node@25.0.3/node_modules/@inquirer/external-editor/dist/index.js
|
|
131400
131411
|
function editAsync(text = "", callback, fileOptions) {
|
|
131401
131412
|
const editor = new ExternalEditor(text, fileOptions);
|
|
131402
131413
|
editor.runAsync((err, result) => {
|
|
@@ -131550,7 +131561,7 @@ var ExternalEditor = class {
|
|
|
131550
131561
|
}
|
|
131551
131562
|
};
|
|
131552
131563
|
|
|
131553
|
-
// ../node_modules/.pnpm/@inquirer+editor@5.0.
|
|
131564
|
+
// ../node_modules/.pnpm/@inquirer+editor@5.0.4_@types+node@25.0.3/node_modules/@inquirer/editor/dist/index.js
|
|
131554
131565
|
var editorTheme = {
|
|
131555
131566
|
validationFailureMode: "keep"
|
|
131556
131567
|
};
|
|
@@ -131619,7 +131630,7 @@ var dist_default7 = createPrompt((config2, done) => {
|
|
|
131619
131630
|
return [[prefix, message, helpTip].filter(Boolean).join(" "), error];
|
|
131620
131631
|
});
|
|
131621
131632
|
|
|
131622
|
-
// ../node_modules/.pnpm/@inquirer+confirm@6.0.
|
|
131633
|
+
// ../node_modules/.pnpm/@inquirer+confirm@6.0.4_@types+node@25.0.3/node_modules/@inquirer/confirm/dist/index.js
|
|
131623
131634
|
function getBooleanValue(value, defaultValue) {
|
|
131624
131635
|
let answer = defaultValue !== false;
|
|
131625
131636
|
if (/^(y|yes)/i.test(value))
|
|
@@ -131665,7 +131676,7 @@ var dist_default8 = createPrompt((config2, done) => {
|
|
|
131665
131676
|
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
131666
131677
|
});
|
|
131667
131678
|
|
|
131668
|
-
// ../node_modules/.pnpm/@inquirer+input@5.0.
|
|
131679
|
+
// ../node_modules/.pnpm/@inquirer+input@5.0.4_@types+node@25.0.3/node_modules/@inquirer/input/dist/index.js
|
|
131669
131680
|
var inputTheme = {
|
|
131670
131681
|
validationFailureMode: "keep"
|
|
131671
131682
|
};
|
|
@@ -131750,7 +131761,7 @@ var dist_default9 = createPrompt((config2, done) => {
|
|
|
131750
131761
|
];
|
|
131751
131762
|
});
|
|
131752
131763
|
|
|
131753
|
-
// ../node_modules/.pnpm/@inquirer+number@4.0.
|
|
131764
|
+
// ../node_modules/.pnpm/@inquirer+number@4.0.4_@types+node@25.0.3/node_modules/@inquirer/number/dist/index.js
|
|
131754
131765
|
function isStepOf(value, step, min) {
|
|
131755
131766
|
const valuePow = value * Math.pow(10, 6);
|
|
131756
131767
|
const stepPow = step * Math.pow(10, 6);
|
|
@@ -131831,7 +131842,7 @@ var dist_default10 = createPrompt((config2, done) => {
|
|
|
131831
131842
|
];
|
|
131832
131843
|
});
|
|
131833
131844
|
|
|
131834
|
-
// ../node_modules/.pnpm/@inquirer+expand@5.0.
|
|
131845
|
+
// ../node_modules/.pnpm/@inquirer+expand@5.0.4_@types+node@25.0.3/node_modules/@inquirer/expand/dist/index.js
|
|
131835
131846
|
import { styleText as styleText4 } from "node:util";
|
|
131836
131847
|
function normalizeChoices2(choices) {
|
|
131837
131848
|
return choices.map((choice) => {
|
|
@@ -131927,9 +131938,14 @@ var dist_default11 = createPrompt((config2, done) => {
|
|
|
131927
131938
|
];
|
|
131928
131939
|
});
|
|
131929
131940
|
|
|
131930
|
-
// ../node_modules/.pnpm/@inquirer+rawlist@5.
|
|
131941
|
+
// ../node_modules/.pnpm/@inquirer+rawlist@5.2.0_@types+node@25.0.3/node_modules/@inquirer/rawlist/dist/index.js
|
|
131931
131942
|
import { styleText as styleText5 } from "node:util";
|
|
131932
131943
|
var numberRegex = /\d+/;
|
|
131944
|
+
var rawlistTheme = {
|
|
131945
|
+
style: {
|
|
131946
|
+
description: (text) => styleText5("cyan", text)
|
|
131947
|
+
}
|
|
131948
|
+
};
|
|
131933
131949
|
function isSelectableChoice(choice) {
|
|
131934
131950
|
return choice != null && !Separator.isSeparator(choice);
|
|
131935
131951
|
}
|
|
@@ -131953,7 +131969,8 @@ function normalizeChoices3(choices) {
|
|
|
131953
131969
|
value: choice.value,
|
|
131954
131970
|
name,
|
|
131955
131971
|
short: choice.short ?? name,
|
|
131956
|
-
key: choice.key ?? String(index)
|
|
131972
|
+
key: choice.key ?? String(index),
|
|
131973
|
+
description: choice.description
|
|
131957
131974
|
};
|
|
131958
131975
|
});
|
|
131959
131976
|
}
|
|
@@ -131976,7 +131993,7 @@ var dist_default12 = createPrompt((config2, done) => {
|
|
|
131976
131993
|
return defaultChoice?.key ?? "";
|
|
131977
131994
|
});
|
|
131978
131995
|
const [errorMsg, setError] = useState11();
|
|
131979
|
-
const theme = makeTheme(config2.theme);
|
|
131996
|
+
const theme = makeTheme(rawlistTheme, config2.theme);
|
|
131980
131997
|
const prefix = usePrefix({ status, theme });
|
|
131981
131998
|
const bounds = useMemo18(() => {
|
|
131982
131999
|
const first = choices.findIndex(isSelectableChoice);
|
|
@@ -131988,11 +132005,11 @@ var dist_default12 = createPrompt((config2, done) => {
|
|
|
131988
132005
|
}, [choices]);
|
|
131989
132006
|
useKeypress((key, rl) => {
|
|
131990
132007
|
if (isEnterKey(key)) {
|
|
131991
|
-
const [
|
|
131992
|
-
if (isSelectableChoice(
|
|
131993
|
-
setValue(
|
|
132008
|
+
const [selectedChoice2] = getSelectedChoice(value, choices);
|
|
132009
|
+
if (isSelectableChoice(selectedChoice2)) {
|
|
132010
|
+
setValue(selectedChoice2.short);
|
|
131994
132011
|
setStatus("done");
|
|
131995
|
-
done(
|
|
132012
|
+
done(selectedChoice2.value);
|
|
131996
132013
|
} else if (value === "") {
|
|
131997
132014
|
setError("Please input a value");
|
|
131998
132015
|
} else {
|
|
@@ -132000,8 +132017,8 @@ var dist_default12 = createPrompt((config2, done) => {
|
|
|
132000
132017
|
}
|
|
132001
132018
|
} else if (isUpKey(key) || isDownKey(key)) {
|
|
132002
132019
|
rl.clearLine(0);
|
|
132003
|
-
const [
|
|
132004
|
-
if (!
|
|
132020
|
+
const [selectedChoice2, active] = getSelectedChoice(value, choices);
|
|
132021
|
+
if (!selectedChoice2) {
|
|
132005
132022
|
const firstChoice = isDownKey(key) ? choices.find(isSelectableChoice) : choices.findLast(isSelectableChoice);
|
|
132006
132023
|
setValue(firstChoice.key);
|
|
132007
132024
|
} else if (loop || isUpKey(key) && active !== bounds.first || isDownKey(key) && active !== bounds.last) {
|
|
@@ -132026,7 +132043,7 @@ var dist_default12 = createPrompt((config2, done) => {
|
|
|
132026
132043
|
return ` ${choice.separator}`;
|
|
132027
132044
|
}
|
|
132028
132045
|
const line = ` ${choice.key}) ${choice.name}`;
|
|
132029
|
-
if (choice.key === value
|
|
132046
|
+
if (choice.key === value) {
|
|
132030
132047
|
return theme.style.highlight(line);
|
|
132031
132048
|
}
|
|
132032
132049
|
return line;
|
|
@@ -132035,13 +132052,18 @@ var dist_default12 = createPrompt((config2, done) => {
|
|
|
132035
132052
|
if (errorMsg) {
|
|
132036
132053
|
error = theme.style.error(errorMsg);
|
|
132037
132054
|
}
|
|
132055
|
+
const [selectedChoice] = getSelectedChoice(value, choices);
|
|
132056
|
+
let description = "";
|
|
132057
|
+
if (!errorMsg && selectedChoice?.description) {
|
|
132058
|
+
description = theme.style.description(selectedChoice.description);
|
|
132059
|
+
}
|
|
132038
132060
|
return [
|
|
132039
132061
|
`${prefix} ${message} ${value}`,
|
|
132040
|
-
[choicesStr, error].filter(Boolean).join("\n")
|
|
132062
|
+
[choicesStr, error, description].filter(Boolean).join("\n")
|
|
132041
132063
|
];
|
|
132042
132064
|
});
|
|
132043
132065
|
|
|
132044
|
-
// ../node_modules/.pnpm/@inquirer+password@5.0.
|
|
132066
|
+
// ../node_modules/.pnpm/@inquirer+password@5.0.4_@types+node@25.0.3/node_modules/@inquirer/password/dist/index.js
|
|
132045
132067
|
var dist_default13 = createPrompt((config2, done) => {
|
|
132046
132068
|
const { validate: validate3 = () => true } = config2;
|
|
132047
132069
|
const theme = makeTheme(config2.theme);
|
|
@@ -132090,7 +132112,7 @@ var dist_default13 = createPrompt((config2, done) => {
|
|
|
132090
132112
|
return [[prefix, message, config2.mask ? formattedValue : helpTip].join(" "), error];
|
|
132091
132113
|
});
|
|
132092
132114
|
|
|
132093
|
-
// ../node_modules/.pnpm/@inquirer+search@4.
|
|
132115
|
+
// ../node_modules/.pnpm/@inquirer+search@4.1.0_@types+node@25.0.3/node_modules/@inquirer/search/dist/index.js
|
|
132094
132116
|
import { styleText as styleText6 } from "node:util";
|
|
132095
132117
|
var searchTheme = {
|
|
132096
132118
|
icon: { cursor: dist_default5.pointer },
|
|
@@ -132136,6 +132158,7 @@ var dist_default14 = createPrompt((config2, done) => {
|
|
|
132136
132158
|
const [searchTerm, setSearchTerm] = useState11("");
|
|
132137
132159
|
const [searchResults, setSearchResults] = useState11([]);
|
|
132138
132160
|
const [searchError, setSearchError] = useState11();
|
|
132161
|
+
const defaultApplied = useRef11(false);
|
|
132139
132162
|
const prefix = usePrefix({ status, theme });
|
|
132140
132163
|
const bounds = useMemo18(() => {
|
|
132141
132164
|
const first = searchResults.findIndex(isSelectable2);
|
|
@@ -132153,9 +132176,16 @@ var dist_default14 = createPrompt((config2, done) => {
|
|
|
132153
132176
|
signal: controller.signal
|
|
132154
132177
|
});
|
|
132155
132178
|
if (!controller.signal.aborted) {
|
|
132156
|
-
|
|
132179
|
+
const normalized = normalizeChoices4(results);
|
|
132180
|
+
let initialActive;
|
|
132181
|
+
if (!defaultApplied.current && "default" in config2) {
|
|
132182
|
+
const defaultIndex = normalized.findIndex((item) => isSelectable2(item) && item.value === config2.default);
|
|
132183
|
+
initialActive = defaultIndex === -1 ? void 0 : defaultIndex;
|
|
132184
|
+
defaultApplied.current = true;
|
|
132185
|
+
}
|
|
132186
|
+
setActive(initialActive);
|
|
132157
132187
|
setSearchError(void 0);
|
|
132158
|
-
setSearchResults(
|
|
132188
|
+
setSearchResults(normalized);
|
|
132159
132189
|
setStatus("idle");
|
|
132160
132190
|
}
|
|
132161
132191
|
} catch (error2) {
|
|
@@ -132252,7 +132282,7 @@ var dist_default14 = createPrompt((config2, done) => {
|
|
|
132252
132282
|
return [header, body];
|
|
132253
132283
|
});
|
|
132254
132284
|
|
|
132255
|
-
// ../node_modules/.pnpm/@inquirer+select@5.0.
|
|
132285
|
+
// ../node_modules/.pnpm/@inquirer+select@5.0.4_@types+node@25.0.3/node_modules/@inquirer/select/dist/index.js
|
|
132256
132286
|
import { styleText as styleText7 } from "node:util";
|
|
132257
132287
|
var selectTheme = {
|
|
132258
132288
|
icon: { cursor: dist_default5.pointer },
|
|
@@ -132408,271 +132438,6 @@ var dist_default15 = createPrompt((config2, done) => {
|
|
|
132408
132438
|
return `${lines}${cursorHide2}`;
|
|
132409
132439
|
});
|
|
132410
132440
|
|
|
132411
|
-
// ../node_modules/.pnpm/inquirer@13.1.0_@types+node@25.0.3/node_modules/inquirer/dist/ui/prompt.js
|
|
132412
|
-
var import_rxjs = __toESM(require_cjs(), 1);
|
|
132413
|
-
var import_run_async = __toESM(require_run_async(), 1);
|
|
132414
|
-
var import_mute_stream2 = __toESM(require_lib(), 1);
|
|
132415
|
-
import readline4 from "node:readline";
|
|
132416
|
-
var _ = {
|
|
132417
|
-
set: (obj, path21 = "", value) => {
|
|
132418
|
-
let pointer = obj;
|
|
132419
|
-
path21.split(".").forEach((key, index, arr) => {
|
|
132420
|
-
if (key === "__proto__" || key === "constructor")
|
|
132421
|
-
return;
|
|
132422
|
-
if (index === arr.length - 1) {
|
|
132423
|
-
pointer[key] = value;
|
|
132424
|
-
} else if (!(key in pointer) || typeof pointer[key] !== "object") {
|
|
132425
|
-
pointer[key] = {};
|
|
132426
|
-
}
|
|
132427
|
-
pointer = pointer[key];
|
|
132428
|
-
});
|
|
132429
|
-
},
|
|
132430
|
-
get: (obj, path21 = "", defaultValue) => {
|
|
132431
|
-
const travel = (regexp) => String.prototype.split.call(path21, regexp).filter(Boolean).reduce(
|
|
132432
|
-
// @ts-expect-error implicit any on res[key]
|
|
132433
|
-
(res, key) => res == null ? res : res[key],
|
|
132434
|
-
obj
|
|
132435
|
-
);
|
|
132436
|
-
const result = travel(/[,[\]]+?/) || travel(/[,.[\]]+?/);
|
|
132437
|
-
return result === void 0 || result === obj ? defaultValue : result;
|
|
132438
|
-
}
|
|
132439
|
-
};
|
|
132440
|
-
async function fetchAsyncQuestionProperty(question, prop, answers) {
|
|
132441
|
-
const propGetter = question[prop];
|
|
132442
|
-
if (typeof propGetter === "function") {
|
|
132443
|
-
return (0, import_run_async.default)(propGetter)(answers);
|
|
132444
|
-
}
|
|
132445
|
-
return propGetter;
|
|
132446
|
-
}
|
|
132447
|
-
var TTYError = class extends Error {
|
|
132448
|
-
name = "TTYError";
|
|
132449
|
-
isTtyError = true;
|
|
132450
|
-
};
|
|
132451
|
-
function setupReadlineOptions(opt) {
|
|
132452
|
-
opt.skipTTYChecks = opt.skipTTYChecks === void 0 ? true : opt.skipTTYChecks;
|
|
132453
|
-
const input = opt.input || process.stdin;
|
|
132454
|
-
if (!opt.skipTTYChecks && !input.isTTY) {
|
|
132455
|
-
throw new TTYError("Prompts can not be meaningfully rendered in non-TTY environments");
|
|
132456
|
-
}
|
|
132457
|
-
const ms = new import_mute_stream2.default();
|
|
132458
|
-
ms.pipe(opt.output || process.stdout);
|
|
132459
|
-
const output = ms;
|
|
132460
|
-
return {
|
|
132461
|
-
terminal: true,
|
|
132462
|
-
...opt,
|
|
132463
|
-
input,
|
|
132464
|
-
output
|
|
132465
|
-
};
|
|
132466
|
-
}
|
|
132467
|
-
function isQuestionArray(questions) {
|
|
132468
|
-
return Array.isArray(questions);
|
|
132469
|
-
}
|
|
132470
|
-
function isQuestionMap(questions) {
|
|
132471
|
-
return Object.values(questions).every((maybeQuestion) => typeof maybeQuestion === "object" && !Array.isArray(maybeQuestion) && maybeQuestion != null);
|
|
132472
|
-
}
|
|
132473
|
-
function isPromptConstructor(prompt2) {
|
|
132474
|
-
return Boolean(prompt2.prototype && "run" in prompt2.prototype && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
132475
|
-
typeof prompt2.prototype.run === "function");
|
|
132476
|
-
}
|
|
132477
|
-
var PromptsRunner = class {
|
|
132478
|
-
prompts;
|
|
132479
|
-
answers = {};
|
|
132480
|
-
process = import_rxjs.EMPTY;
|
|
132481
|
-
abortController = new AbortController();
|
|
132482
|
-
opt;
|
|
132483
|
-
constructor(prompts, opt = {}) {
|
|
132484
|
-
this.opt = opt;
|
|
132485
|
-
this.prompts = prompts;
|
|
132486
|
-
}
|
|
132487
|
-
async run(questions, answers) {
|
|
132488
|
-
this.abortController = new AbortController();
|
|
132489
|
-
this.answers = typeof answers === "object" ? { ...answers } : {};
|
|
132490
|
-
let obs;
|
|
132491
|
-
if (isQuestionArray(questions)) {
|
|
132492
|
-
obs = (0, import_rxjs.from)(questions);
|
|
132493
|
-
} else if ((0, import_rxjs.isObservable)(questions)) {
|
|
132494
|
-
obs = questions;
|
|
132495
|
-
} else if (isQuestionMap(questions)) {
|
|
132496
|
-
obs = (0, import_rxjs.from)(Object.entries(questions).map(([name, question]) => {
|
|
132497
|
-
return Object.assign({}, question, { name });
|
|
132498
|
-
}));
|
|
132499
|
-
} else {
|
|
132500
|
-
obs = (0, import_rxjs.from)([questions]);
|
|
132501
|
-
}
|
|
132502
|
-
this.process = obs.pipe((0, import_rxjs.concatMap)((question) => (0, import_rxjs.of)(question).pipe((0, import_rxjs.concatMap)((question2) => (0, import_rxjs.from)(this.shouldRun(question2).then((shouldRun) => {
|
|
132503
|
-
if (shouldRun) {
|
|
132504
|
-
return question2;
|
|
132505
|
-
}
|
|
132506
|
-
return;
|
|
132507
|
-
})).pipe((0, import_rxjs.filter)((val) => val != null))), (0, import_rxjs.concatMap)((question2) => (0, import_rxjs.defer)(() => (0, import_rxjs.from)(this.fetchAnswer(question2)))))));
|
|
132508
|
-
return (0, import_rxjs.lastValueFrom)(this.process.pipe((0, import_rxjs.reduce)((answersObj, answer) => {
|
|
132509
|
-
_.set(answersObj, answer.name, answer.answer);
|
|
132510
|
-
return answersObj;
|
|
132511
|
-
}, this.answers))).then(() => this.answers).finally(() => this.close());
|
|
132512
|
-
}
|
|
132513
|
-
prepareQuestion = async (question) => {
|
|
132514
|
-
const [message, defaultValue, resolvedChoices] = await Promise.all([
|
|
132515
|
-
fetchAsyncQuestionProperty(question, "message", this.answers),
|
|
132516
|
-
fetchAsyncQuestionProperty(question, "default", this.answers),
|
|
132517
|
-
fetchAsyncQuestionProperty(question, "choices", this.answers)
|
|
132518
|
-
]);
|
|
132519
|
-
let choices;
|
|
132520
|
-
if (Array.isArray(resolvedChoices)) {
|
|
132521
|
-
choices = resolvedChoices.map((choice) => {
|
|
132522
|
-
const choiceObj = typeof choice !== "object" || choice == null ? { name: choice, value: choice } : {
|
|
132523
|
-
...choice,
|
|
132524
|
-
value: "value" in choice ? choice.value : "name" in choice ? choice.name : void 0
|
|
132525
|
-
};
|
|
132526
|
-
if ("value" in choiceObj && Array.isArray(defaultValue)) {
|
|
132527
|
-
return {
|
|
132528
|
-
checked: defaultValue.includes(choiceObj.value),
|
|
132529
|
-
...choiceObj
|
|
132530
|
-
};
|
|
132531
|
-
}
|
|
132532
|
-
return choiceObj;
|
|
132533
|
-
});
|
|
132534
|
-
}
|
|
132535
|
-
return Object.assign({}, question, {
|
|
132536
|
-
message,
|
|
132537
|
-
default: defaultValue,
|
|
132538
|
-
choices,
|
|
132539
|
-
type: question.type in this.prompts ? question.type : "input"
|
|
132540
|
-
});
|
|
132541
|
-
};
|
|
132542
|
-
fetchAnswer = async (rawQuestion) => {
|
|
132543
|
-
const question = await this.prepareQuestion(rawQuestion);
|
|
132544
|
-
const prompt2 = this.prompts[question.type];
|
|
132545
|
-
if (prompt2 == null) {
|
|
132546
|
-
throw new Error(`Prompt for type ${question.type} not found`);
|
|
132547
|
-
}
|
|
132548
|
-
let cleanupSignal;
|
|
132549
|
-
const promptFn = isPromptConstructor(prompt2) ? (q, opt) => new Promise((resolve3, reject) => {
|
|
132550
|
-
const { signal: signal2 } = opt;
|
|
132551
|
-
if (signal2.aborted) {
|
|
132552
|
-
reject(new AbortPromptError({ cause: signal2.reason }));
|
|
132553
|
-
return;
|
|
132554
|
-
}
|
|
132555
|
-
const rl = readline4.createInterface(setupReadlineOptions(opt));
|
|
132556
|
-
const onForceClose = () => {
|
|
132557
|
-
this.close();
|
|
132558
|
-
process.kill(process.pid, "SIGINT");
|
|
132559
|
-
console.log("");
|
|
132560
|
-
};
|
|
132561
|
-
const onClose = () => {
|
|
132562
|
-
process.removeListener("exit", onForceClose);
|
|
132563
|
-
rl.removeListener("SIGINT", onForceClose);
|
|
132564
|
-
rl.setPrompt("");
|
|
132565
|
-
rl.output.unmute();
|
|
132566
|
-
rl.output.write(cursorShow2);
|
|
132567
|
-
rl.output.end();
|
|
132568
|
-
rl.close();
|
|
132569
|
-
};
|
|
132570
|
-
process.on("exit", onForceClose);
|
|
132571
|
-
rl.on("SIGINT", onForceClose);
|
|
132572
|
-
const activePrompt = new prompt2(q, rl, this.answers);
|
|
132573
|
-
const cleanup = () => {
|
|
132574
|
-
onClose();
|
|
132575
|
-
cleanupSignal?.();
|
|
132576
|
-
};
|
|
132577
|
-
const abort = () => {
|
|
132578
|
-
reject(new AbortPromptError({ cause: signal2.reason }));
|
|
132579
|
-
cleanup();
|
|
132580
|
-
};
|
|
132581
|
-
signal2.addEventListener("abort", abort);
|
|
132582
|
-
cleanupSignal = () => {
|
|
132583
|
-
signal2.removeEventListener("abort", abort);
|
|
132584
|
-
cleanupSignal = void 0;
|
|
132585
|
-
};
|
|
132586
|
-
activePrompt.run().then(resolve3, reject).finally(cleanup);
|
|
132587
|
-
}) : prompt2;
|
|
132588
|
-
let cleanupModuleSignal;
|
|
132589
|
-
const { signal: moduleSignal } = this.opt;
|
|
132590
|
-
if (moduleSignal?.aborted) {
|
|
132591
|
-
this.abortController.abort(moduleSignal.reason);
|
|
132592
|
-
} else if (moduleSignal) {
|
|
132593
|
-
const abort = () => this.abortController.abort(moduleSignal.reason);
|
|
132594
|
-
moduleSignal.addEventListener("abort", abort);
|
|
132595
|
-
cleanupModuleSignal = () => {
|
|
132596
|
-
moduleSignal.removeEventListener("abort", abort);
|
|
132597
|
-
};
|
|
132598
|
-
}
|
|
132599
|
-
const { filter: filter2 = (value) => value } = question;
|
|
132600
|
-
const { signal } = this.abortController;
|
|
132601
|
-
return promptFn(question, { ...this.opt, signal }).then((answer) => ({
|
|
132602
|
-
name: question.name,
|
|
132603
|
-
answer: filter2(answer, this.answers)
|
|
132604
|
-
})).finally(() => {
|
|
132605
|
-
cleanupSignal?.();
|
|
132606
|
-
cleanupModuleSignal?.();
|
|
132607
|
-
});
|
|
132608
|
-
};
|
|
132609
|
-
/**
|
|
132610
|
-
* Close the interface and cleanup listeners
|
|
132611
|
-
*/
|
|
132612
|
-
close = () => {
|
|
132613
|
-
this.abortController.abort();
|
|
132614
|
-
};
|
|
132615
|
-
shouldRun = async (question) => {
|
|
132616
|
-
if (question.askAnswered !== true && _.get(this.answers, question.name) !== void 0) {
|
|
132617
|
-
return false;
|
|
132618
|
-
}
|
|
132619
|
-
const { when } = question;
|
|
132620
|
-
if (typeof when === "function") {
|
|
132621
|
-
const shouldRun = await (0, import_run_async.default)(when)(this.answers);
|
|
132622
|
-
return Boolean(shouldRun);
|
|
132623
|
-
}
|
|
132624
|
-
return when !== false;
|
|
132625
|
-
};
|
|
132626
|
-
};
|
|
132627
|
-
|
|
132628
|
-
// ../node_modules/.pnpm/inquirer@13.1.0_@types+node@25.0.3/node_modules/inquirer/dist/index.js
|
|
132629
|
-
var builtInPrompts = {
|
|
132630
|
-
input: dist_default9,
|
|
132631
|
-
select: dist_default15,
|
|
132632
|
-
number: dist_default10,
|
|
132633
|
-
confirm: dist_default8,
|
|
132634
|
-
rawlist: dist_default12,
|
|
132635
|
-
expand: dist_default11,
|
|
132636
|
-
checkbox: dist_default6,
|
|
132637
|
-
password: dist_default13,
|
|
132638
|
-
editor: dist_default7,
|
|
132639
|
-
search: dist_default14
|
|
132640
|
-
};
|
|
132641
|
-
function createPromptModule(opt) {
|
|
132642
|
-
function promptModule(questions, answers) {
|
|
132643
|
-
const runner = new PromptsRunner(promptModule.prompts, opt);
|
|
132644
|
-
const promptPromise = runner.run(questions, answers);
|
|
132645
|
-
return Object.assign(promptPromise, { ui: runner });
|
|
132646
|
-
}
|
|
132647
|
-
promptModule.prompts = { ...builtInPrompts };
|
|
132648
|
-
promptModule.registerPrompt = function(name, prompt2) {
|
|
132649
|
-
promptModule.prompts[name] = prompt2;
|
|
132650
|
-
return this;
|
|
132651
|
-
};
|
|
132652
|
-
promptModule.restoreDefaultPrompts = function() {
|
|
132653
|
-
promptModule.prompts = { ...builtInPrompts };
|
|
132654
|
-
};
|
|
132655
|
-
return promptModule;
|
|
132656
|
-
}
|
|
132657
|
-
var prompt = createPromptModule();
|
|
132658
|
-
function registerPrompt(name, newPrompt) {
|
|
132659
|
-
prompt.registerPrompt(name, newPrompt);
|
|
132660
|
-
}
|
|
132661
|
-
function restoreDefaultPrompts() {
|
|
132662
|
-
prompt.restoreDefaultPrompts();
|
|
132663
|
-
}
|
|
132664
|
-
var inquirer = {
|
|
132665
|
-
prompt,
|
|
132666
|
-
ui: {
|
|
132667
|
-
Prompt: PromptsRunner
|
|
132668
|
-
},
|
|
132669
|
-
createPromptModule,
|
|
132670
|
-
registerPrompt,
|
|
132671
|
-
restoreDefaultPrompts,
|
|
132672
|
-
Separator
|
|
132673
|
-
};
|
|
132674
|
-
var dist_default16 = inquirer;
|
|
132675
|
-
|
|
132676
132441
|
// src/auth/providers/kilocode/device-auth.ts
|
|
132677
132442
|
init_src();
|
|
132678
132443
|
|
|
@@ -132865,15 +132630,12 @@ async function promptOrganizationSelection(organizations) {
|
|
|
132865
132630
|
value: org.id
|
|
132866
132631
|
}))
|
|
132867
132632
|
];
|
|
132868
|
-
const
|
|
132869
|
-
() =>
|
|
132870
|
-
|
|
132871
|
-
|
|
132872
|
-
|
|
132873
|
-
|
|
132874
|
-
choices: accountChoices
|
|
132875
|
-
}
|
|
132876
|
-
])
|
|
132633
|
+
const accountType = await withRawMode(
|
|
132634
|
+
() => dist_default15({
|
|
132635
|
+
message: "Select account type:",
|
|
132636
|
+
choices: accountChoices,
|
|
132637
|
+
loop: false
|
|
132638
|
+
})
|
|
132877
132639
|
);
|
|
132878
132640
|
return accountType !== "personal" ? accountType : void 0;
|
|
132879
132641
|
}
|
|
@@ -133005,6 +132767,290 @@ Waiting for authorization... \u23F3 (expires in ${Math.floor(expiresIn / 60)}:${
|
|
|
133005
132767
|
};
|
|
133006
132768
|
}
|
|
133007
132769
|
|
|
132770
|
+
// ../node_modules/.pnpm/inquirer@13.1.0_@types+node@25.0.3/node_modules/inquirer/dist/ui/prompt.js
|
|
132771
|
+
var import_rxjs = __toESM(require_cjs(), 1);
|
|
132772
|
+
var import_run_async = __toESM(require_run_async(), 1);
|
|
132773
|
+
var import_mute_stream2 = __toESM(require_lib(), 1);
|
|
132774
|
+
import readline4 from "node:readline";
|
|
132775
|
+
|
|
132776
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.0_@types+node@25.0.3/node_modules/@inquirer/core/dist/lib/errors.js
|
|
132777
|
+
var AbortPromptError2 = class extends Error {
|
|
132778
|
+
name = "AbortPromptError";
|
|
132779
|
+
message = "Prompt was aborted";
|
|
132780
|
+
constructor(options) {
|
|
132781
|
+
super();
|
|
132782
|
+
this.cause = options?.cause;
|
|
132783
|
+
}
|
|
132784
|
+
};
|
|
132785
|
+
|
|
132786
|
+
// ../node_modules/.pnpm/@inquirer+ansi@2.0.2/node_modules/@inquirer/ansi/dist/index.js
|
|
132787
|
+
var ESC4 = "\x1B[";
|
|
132788
|
+
var cursorLeft3 = ESC4 + "G";
|
|
132789
|
+
var cursorHide3 = ESC4 + "?25l";
|
|
132790
|
+
var cursorShow3 = ESC4 + "?25h";
|
|
132791
|
+
var eraseLine3 = ESC4 + "2K";
|
|
132792
|
+
|
|
132793
|
+
// ../node_modules/.pnpm/inquirer@13.1.0_@types+node@25.0.3/node_modules/inquirer/dist/ui/prompt.js
|
|
132794
|
+
var _ = {
|
|
132795
|
+
set: (obj, path21 = "", value) => {
|
|
132796
|
+
let pointer = obj;
|
|
132797
|
+
path21.split(".").forEach((key, index, arr) => {
|
|
132798
|
+
if (key === "__proto__" || key === "constructor")
|
|
132799
|
+
return;
|
|
132800
|
+
if (index === arr.length - 1) {
|
|
132801
|
+
pointer[key] = value;
|
|
132802
|
+
} else if (!(key in pointer) || typeof pointer[key] !== "object") {
|
|
132803
|
+
pointer[key] = {};
|
|
132804
|
+
}
|
|
132805
|
+
pointer = pointer[key];
|
|
132806
|
+
});
|
|
132807
|
+
},
|
|
132808
|
+
get: (obj, path21 = "", defaultValue) => {
|
|
132809
|
+
const travel = (regexp) => String.prototype.split.call(path21, regexp).filter(Boolean).reduce(
|
|
132810
|
+
// @ts-expect-error implicit any on res[key]
|
|
132811
|
+
(res, key) => res == null ? res : res[key],
|
|
132812
|
+
obj
|
|
132813
|
+
);
|
|
132814
|
+
const result = travel(/[,[\]]+?/) || travel(/[,.[\]]+?/);
|
|
132815
|
+
return result === void 0 || result === obj ? defaultValue : result;
|
|
132816
|
+
}
|
|
132817
|
+
};
|
|
132818
|
+
async function fetchAsyncQuestionProperty(question, prop, answers) {
|
|
132819
|
+
const propGetter = question[prop];
|
|
132820
|
+
if (typeof propGetter === "function") {
|
|
132821
|
+
return (0, import_run_async.default)(propGetter)(answers);
|
|
132822
|
+
}
|
|
132823
|
+
return propGetter;
|
|
132824
|
+
}
|
|
132825
|
+
var TTYError = class extends Error {
|
|
132826
|
+
name = "TTYError";
|
|
132827
|
+
isTtyError = true;
|
|
132828
|
+
};
|
|
132829
|
+
function setupReadlineOptions(opt) {
|
|
132830
|
+
opt.skipTTYChecks = opt.skipTTYChecks === void 0 ? true : opt.skipTTYChecks;
|
|
132831
|
+
const input = opt.input || process.stdin;
|
|
132832
|
+
if (!opt.skipTTYChecks && !input.isTTY) {
|
|
132833
|
+
throw new TTYError("Prompts can not be meaningfully rendered in non-TTY environments");
|
|
132834
|
+
}
|
|
132835
|
+
const ms = new import_mute_stream2.default();
|
|
132836
|
+
ms.pipe(opt.output || process.stdout);
|
|
132837
|
+
const output = ms;
|
|
132838
|
+
return {
|
|
132839
|
+
terminal: true,
|
|
132840
|
+
...opt,
|
|
132841
|
+
input,
|
|
132842
|
+
output
|
|
132843
|
+
};
|
|
132844
|
+
}
|
|
132845
|
+
function isQuestionArray(questions) {
|
|
132846
|
+
return Array.isArray(questions);
|
|
132847
|
+
}
|
|
132848
|
+
function isQuestionMap(questions) {
|
|
132849
|
+
return Object.values(questions).every((maybeQuestion) => typeof maybeQuestion === "object" && !Array.isArray(maybeQuestion) && maybeQuestion != null);
|
|
132850
|
+
}
|
|
132851
|
+
function isPromptConstructor(prompt2) {
|
|
132852
|
+
return Boolean(prompt2.prototype && "run" in prompt2.prototype && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
132853
|
+
typeof prompt2.prototype.run === "function");
|
|
132854
|
+
}
|
|
132855
|
+
var PromptsRunner = class {
|
|
132856
|
+
prompts;
|
|
132857
|
+
answers = {};
|
|
132858
|
+
process = import_rxjs.EMPTY;
|
|
132859
|
+
abortController = new AbortController();
|
|
132860
|
+
opt;
|
|
132861
|
+
constructor(prompts, opt = {}) {
|
|
132862
|
+
this.opt = opt;
|
|
132863
|
+
this.prompts = prompts;
|
|
132864
|
+
}
|
|
132865
|
+
async run(questions, answers) {
|
|
132866
|
+
this.abortController = new AbortController();
|
|
132867
|
+
this.answers = typeof answers === "object" ? { ...answers } : {};
|
|
132868
|
+
let obs;
|
|
132869
|
+
if (isQuestionArray(questions)) {
|
|
132870
|
+
obs = (0, import_rxjs.from)(questions);
|
|
132871
|
+
} else if ((0, import_rxjs.isObservable)(questions)) {
|
|
132872
|
+
obs = questions;
|
|
132873
|
+
} else if (isQuestionMap(questions)) {
|
|
132874
|
+
obs = (0, import_rxjs.from)(Object.entries(questions).map(([name, question]) => {
|
|
132875
|
+
return Object.assign({}, question, { name });
|
|
132876
|
+
}));
|
|
132877
|
+
} else {
|
|
132878
|
+
obs = (0, import_rxjs.from)([questions]);
|
|
132879
|
+
}
|
|
132880
|
+
this.process = obs.pipe((0, import_rxjs.concatMap)((question) => (0, import_rxjs.of)(question).pipe((0, import_rxjs.concatMap)((question2) => (0, import_rxjs.from)(this.shouldRun(question2).then((shouldRun) => {
|
|
132881
|
+
if (shouldRun) {
|
|
132882
|
+
return question2;
|
|
132883
|
+
}
|
|
132884
|
+
return;
|
|
132885
|
+
})).pipe((0, import_rxjs.filter)((val) => val != null))), (0, import_rxjs.concatMap)((question2) => (0, import_rxjs.defer)(() => (0, import_rxjs.from)(this.fetchAnswer(question2)))))));
|
|
132886
|
+
return (0, import_rxjs.lastValueFrom)(this.process.pipe((0, import_rxjs.reduce)((answersObj, answer) => {
|
|
132887
|
+
_.set(answersObj, answer.name, answer.answer);
|
|
132888
|
+
return answersObj;
|
|
132889
|
+
}, this.answers))).then(() => this.answers).finally(() => this.close());
|
|
132890
|
+
}
|
|
132891
|
+
prepareQuestion = async (question) => {
|
|
132892
|
+
const [message, defaultValue, resolvedChoices] = await Promise.all([
|
|
132893
|
+
fetchAsyncQuestionProperty(question, "message", this.answers),
|
|
132894
|
+
fetchAsyncQuestionProperty(question, "default", this.answers),
|
|
132895
|
+
fetchAsyncQuestionProperty(question, "choices", this.answers)
|
|
132896
|
+
]);
|
|
132897
|
+
let choices;
|
|
132898
|
+
if (Array.isArray(resolvedChoices)) {
|
|
132899
|
+
choices = resolvedChoices.map((choice) => {
|
|
132900
|
+
const choiceObj = typeof choice !== "object" || choice == null ? { name: choice, value: choice } : {
|
|
132901
|
+
...choice,
|
|
132902
|
+
value: "value" in choice ? choice.value : "name" in choice ? choice.name : void 0
|
|
132903
|
+
};
|
|
132904
|
+
if ("value" in choiceObj && Array.isArray(defaultValue)) {
|
|
132905
|
+
return {
|
|
132906
|
+
checked: defaultValue.includes(choiceObj.value),
|
|
132907
|
+
...choiceObj
|
|
132908
|
+
};
|
|
132909
|
+
}
|
|
132910
|
+
return choiceObj;
|
|
132911
|
+
});
|
|
132912
|
+
}
|
|
132913
|
+
return Object.assign({}, question, {
|
|
132914
|
+
message,
|
|
132915
|
+
default: defaultValue,
|
|
132916
|
+
choices,
|
|
132917
|
+
type: question.type in this.prompts ? question.type : "input"
|
|
132918
|
+
});
|
|
132919
|
+
};
|
|
132920
|
+
fetchAnswer = async (rawQuestion) => {
|
|
132921
|
+
const question = await this.prepareQuestion(rawQuestion);
|
|
132922
|
+
const prompt2 = this.prompts[question.type];
|
|
132923
|
+
if (prompt2 == null) {
|
|
132924
|
+
throw new Error(`Prompt for type ${question.type} not found`);
|
|
132925
|
+
}
|
|
132926
|
+
let cleanupSignal;
|
|
132927
|
+
const promptFn = isPromptConstructor(prompt2) ? (q, opt) => new Promise((resolve3, reject) => {
|
|
132928
|
+
const { signal: signal2 } = opt;
|
|
132929
|
+
if (signal2.aborted) {
|
|
132930
|
+
reject(new AbortPromptError2({ cause: signal2.reason }));
|
|
132931
|
+
return;
|
|
132932
|
+
}
|
|
132933
|
+
const rl = readline4.createInterface(setupReadlineOptions(opt));
|
|
132934
|
+
const onForceClose = () => {
|
|
132935
|
+
this.close();
|
|
132936
|
+
process.kill(process.pid, "SIGINT");
|
|
132937
|
+
console.log("");
|
|
132938
|
+
};
|
|
132939
|
+
const onClose = () => {
|
|
132940
|
+
process.removeListener("exit", onForceClose);
|
|
132941
|
+
rl.removeListener("SIGINT", onForceClose);
|
|
132942
|
+
rl.setPrompt("");
|
|
132943
|
+
rl.output.unmute();
|
|
132944
|
+
rl.output.write(cursorShow3);
|
|
132945
|
+
rl.output.end();
|
|
132946
|
+
rl.close();
|
|
132947
|
+
};
|
|
132948
|
+
process.on("exit", onForceClose);
|
|
132949
|
+
rl.on("SIGINT", onForceClose);
|
|
132950
|
+
const activePrompt = new prompt2(q, rl, this.answers);
|
|
132951
|
+
const cleanup = () => {
|
|
132952
|
+
onClose();
|
|
132953
|
+
cleanupSignal?.();
|
|
132954
|
+
};
|
|
132955
|
+
const abort = () => {
|
|
132956
|
+
reject(new AbortPromptError2({ cause: signal2.reason }));
|
|
132957
|
+
cleanup();
|
|
132958
|
+
};
|
|
132959
|
+
signal2.addEventListener("abort", abort);
|
|
132960
|
+
cleanupSignal = () => {
|
|
132961
|
+
signal2.removeEventListener("abort", abort);
|
|
132962
|
+
cleanupSignal = void 0;
|
|
132963
|
+
};
|
|
132964
|
+
activePrompt.run().then(resolve3, reject).finally(cleanup);
|
|
132965
|
+
}) : prompt2;
|
|
132966
|
+
let cleanupModuleSignal;
|
|
132967
|
+
const { signal: moduleSignal } = this.opt;
|
|
132968
|
+
if (moduleSignal?.aborted) {
|
|
132969
|
+
this.abortController.abort(moduleSignal.reason);
|
|
132970
|
+
} else if (moduleSignal) {
|
|
132971
|
+
const abort = () => this.abortController.abort(moduleSignal.reason);
|
|
132972
|
+
moduleSignal.addEventListener("abort", abort);
|
|
132973
|
+
cleanupModuleSignal = () => {
|
|
132974
|
+
moduleSignal.removeEventListener("abort", abort);
|
|
132975
|
+
};
|
|
132976
|
+
}
|
|
132977
|
+
const { filter: filter2 = (value) => value } = question;
|
|
132978
|
+
const { signal } = this.abortController;
|
|
132979
|
+
return promptFn(question, { ...this.opt, signal }).then((answer) => ({
|
|
132980
|
+
name: question.name,
|
|
132981
|
+
answer: filter2(answer, this.answers)
|
|
132982
|
+
})).finally(() => {
|
|
132983
|
+
cleanupSignal?.();
|
|
132984
|
+
cleanupModuleSignal?.();
|
|
132985
|
+
});
|
|
132986
|
+
};
|
|
132987
|
+
/**
|
|
132988
|
+
* Close the interface and cleanup listeners
|
|
132989
|
+
*/
|
|
132990
|
+
close = () => {
|
|
132991
|
+
this.abortController.abort();
|
|
132992
|
+
};
|
|
132993
|
+
shouldRun = async (question) => {
|
|
132994
|
+
if (question.askAnswered !== true && _.get(this.answers, question.name) !== void 0) {
|
|
132995
|
+
return false;
|
|
132996
|
+
}
|
|
132997
|
+
const { when } = question;
|
|
132998
|
+
if (typeof when === "function") {
|
|
132999
|
+
const shouldRun = await (0, import_run_async.default)(when)(this.answers);
|
|
133000
|
+
return Boolean(shouldRun);
|
|
133001
|
+
}
|
|
133002
|
+
return when !== false;
|
|
133003
|
+
};
|
|
133004
|
+
};
|
|
133005
|
+
|
|
133006
|
+
// ../node_modules/.pnpm/inquirer@13.1.0_@types+node@25.0.3/node_modules/inquirer/dist/index.js
|
|
133007
|
+
var builtInPrompts = {
|
|
133008
|
+
input: dist_default9,
|
|
133009
|
+
select: dist_default15,
|
|
133010
|
+
number: dist_default10,
|
|
133011
|
+
confirm: dist_default8,
|
|
133012
|
+
rawlist: dist_default12,
|
|
133013
|
+
expand: dist_default11,
|
|
133014
|
+
checkbox: dist_default6,
|
|
133015
|
+
password: dist_default13,
|
|
133016
|
+
editor: dist_default7,
|
|
133017
|
+
search: dist_default14
|
|
133018
|
+
};
|
|
133019
|
+
function createPromptModule(opt) {
|
|
133020
|
+
function promptModule(questions, answers) {
|
|
133021
|
+
const runner = new PromptsRunner(promptModule.prompts, opt);
|
|
133022
|
+
const promptPromise = runner.run(questions, answers);
|
|
133023
|
+
return Object.assign(promptPromise, { ui: runner });
|
|
133024
|
+
}
|
|
133025
|
+
promptModule.prompts = { ...builtInPrompts };
|
|
133026
|
+
promptModule.registerPrompt = function(name, prompt2) {
|
|
133027
|
+
promptModule.prompts[name] = prompt2;
|
|
133028
|
+
return this;
|
|
133029
|
+
};
|
|
133030
|
+
promptModule.restoreDefaultPrompts = function() {
|
|
133031
|
+
promptModule.prompts = { ...builtInPrompts };
|
|
133032
|
+
};
|
|
133033
|
+
return promptModule;
|
|
133034
|
+
}
|
|
133035
|
+
var prompt = createPromptModule();
|
|
133036
|
+
function registerPrompt(name, newPrompt) {
|
|
133037
|
+
prompt.registerPrompt(name, newPrompt);
|
|
133038
|
+
}
|
|
133039
|
+
function restoreDefaultPrompts() {
|
|
133040
|
+
prompt.restoreDefaultPrompts();
|
|
133041
|
+
}
|
|
133042
|
+
var inquirer = {
|
|
133043
|
+
prompt,
|
|
133044
|
+
ui: {
|
|
133045
|
+
Prompt: PromptsRunner
|
|
133046
|
+
},
|
|
133047
|
+
createPromptModule,
|
|
133048
|
+
registerPrompt,
|
|
133049
|
+
restoreDefaultPrompts,
|
|
133050
|
+
Separator
|
|
133051
|
+
};
|
|
133052
|
+
var dist_default16 = inquirer;
|
|
133053
|
+
|
|
133008
133054
|
// src/auth/providers/kilocode/token-auth.ts
|
|
133009
133055
|
async function authenticateWithToken() {
|
|
133010
133056
|
console.log("\n\u{1F511} Manual Token Authentication\n");
|
|
@@ -133747,11 +133793,15 @@ var getProviderDefaultModel = (provider) => {
|
|
|
133747
133793
|
};
|
|
133748
133794
|
|
|
133749
133795
|
// src/auth/providers/factory.ts
|
|
133796
|
+
init_models();
|
|
133750
133797
|
function createGenericAuthFunction(providerName) {
|
|
133751
133798
|
return async () => {
|
|
133752
133799
|
const requiredFields = PROVIDER_REQUIRED_FIELDS[providerName] || [];
|
|
133753
133800
|
const prompts = [];
|
|
133754
133801
|
for (const field of requiredFields) {
|
|
133802
|
+
if (isModelField(field) || field === "apiModelId") {
|
|
133803
|
+
continue;
|
|
133804
|
+
}
|
|
133755
133805
|
const fieldMeta = FIELD_REGISTRY[field];
|
|
133756
133806
|
if (!fieldMeta) {
|
|
133757
133807
|
continue;
|
|
@@ -133855,6 +133905,8 @@ var authProviders = [
|
|
|
133855
133905
|
];
|
|
133856
133906
|
|
|
133857
133907
|
// src/auth/index.ts
|
|
133908
|
+
init_fetcher();
|
|
133909
|
+
init_models();
|
|
133858
133910
|
async function authWizard() {
|
|
133859
133911
|
try {
|
|
133860
133912
|
const config2 = await loadConfig();
|
|
@@ -133862,16 +133914,13 @@ async function authWizard() {
|
|
|
133862
133914
|
name: provider2.name,
|
|
133863
133915
|
value: provider2.value
|
|
133864
133916
|
}));
|
|
133865
|
-
const
|
|
133866
|
-
() =>
|
|
133867
|
-
|
|
133868
|
-
|
|
133869
|
-
|
|
133870
|
-
|
|
133871
|
-
|
|
133872
|
-
loop: false
|
|
133873
|
-
}
|
|
133874
|
-
])
|
|
133917
|
+
const selectedProvider = await withRawMode(
|
|
133918
|
+
() => dist_default15({
|
|
133919
|
+
message: "Select an AI provider:",
|
|
133920
|
+
choices: providerChoices,
|
|
133921
|
+
loop: false,
|
|
133922
|
+
pageSize: process.stdout.rows ? Math.min(20, process.stdout.rows - 2) : 10
|
|
133923
|
+
})
|
|
133875
133924
|
);
|
|
133876
133925
|
const provider = authProviders.find((p) => p.value === selectedProvider);
|
|
133877
133926
|
if (!provider) {
|
|
@@ -133889,6 +133938,42 @@ async function authWizard() {
|
|
|
133889
133938
|
\u274C Authentication failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
133890
133939
|
process.exit(1);
|
|
133891
133940
|
}
|
|
133941
|
+
const providerId = authResult.providerConfig.provider;
|
|
133942
|
+
let routerModels = null;
|
|
133943
|
+
if (providerSupportsModelList(providerId)) {
|
|
133944
|
+
console.log("\nFetching available models...");
|
|
133945
|
+
try {
|
|
133946
|
+
routerModels = await fetchRouterModels(authResult.providerConfig);
|
|
133947
|
+
} catch (_2) {
|
|
133948
|
+
console.warn("Failed to fetch models, using defaults if available.");
|
|
133949
|
+
}
|
|
133950
|
+
}
|
|
133951
|
+
const { models, defaultModel } = getModelsByProvider({
|
|
133952
|
+
provider: providerId,
|
|
133953
|
+
routerModels,
|
|
133954
|
+
kilocodeDefaultModel: ""
|
|
133955
|
+
});
|
|
133956
|
+
const modelIds = sortModelsByPreference(models);
|
|
133957
|
+
if (modelIds.length > 0) {
|
|
133958
|
+
const modelChoices = modelIds.map((id) => {
|
|
133959
|
+
const model = models[id];
|
|
133960
|
+
return {
|
|
133961
|
+
name: model?.displayName || id,
|
|
133962
|
+
value: id
|
|
133963
|
+
};
|
|
133964
|
+
});
|
|
133965
|
+
const selectedModel = await withRawMode(
|
|
133966
|
+
() => dist_default15({
|
|
133967
|
+
message: "Select a model to use:",
|
|
133968
|
+
choices: modelChoices,
|
|
133969
|
+
default: defaultModel,
|
|
133970
|
+
loop: false,
|
|
133971
|
+
pageSize: 10
|
|
133972
|
+
})
|
|
133973
|
+
);
|
|
133974
|
+
const modelKey = getModelIdKey(providerId);
|
|
133975
|
+
authResult.providerConfig[modelKey] = selectedModel;
|
|
133976
|
+
}
|
|
133892
133977
|
const newConfig = {
|
|
133893
133978
|
...config2.config,
|
|
133894
133979
|
providers: [authResult.providerConfig]
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kilocode/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@kilocode/cli",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.23.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/bedrock-sdk": "^0.22.0",
|