swixter 0.0.5 → 0.0.6
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/cli/index.js +224 -27
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -12960,6 +12960,13 @@ var init_types = __esm(() => {
|
|
|
12960
12960
|
authToken: exports_external.string().optional(),
|
|
12961
12961
|
baseURL: exports_external.string().url().optional(),
|
|
12962
12962
|
model: exports_external.string().optional(),
|
|
12963
|
+
openaiModel: exports_external.string().optional(),
|
|
12964
|
+
models: exports_external.object({
|
|
12965
|
+
anthropicModel: exports_external.string().optional(),
|
|
12966
|
+
defaultHaikuModel: exports_external.string().optional(),
|
|
12967
|
+
defaultOpusModel: exports_external.string().optional(),
|
|
12968
|
+
defaultSonnetModel: exports_external.string().optional()
|
|
12969
|
+
}).optional(),
|
|
12963
12970
|
envKey: exports_external.string().optional(),
|
|
12964
12971
|
headers: exports_external.record(exports_external.string(), exports_external.string()).optional(),
|
|
12965
12972
|
createdAt: exports_external.string(),
|
|
@@ -12993,7 +13000,11 @@ var init_coders = __esm(() => {
|
|
|
12993
13000
|
envVarMapping: {
|
|
12994
13001
|
apiKey: "ANTHROPIC_API_KEY",
|
|
12995
13002
|
authToken: "ANTHROPIC_AUTH_TOKEN",
|
|
12996
|
-
baseURL: "ANTHROPIC_BASE_URL"
|
|
13003
|
+
baseURL: "ANTHROPIC_BASE_URL",
|
|
13004
|
+
anthropicModel: "ANTHROPIC_MODEL",
|
|
13005
|
+
defaultHaikuModel: "ANTHROPIC_DEFAULT_HAIKU_MODEL",
|
|
13006
|
+
defaultOpusModel: "ANTHROPIC_DEFAULT_OPUS_MODEL",
|
|
13007
|
+
defaultSonnetModel: "ANTHROPIC_DEFAULT_SONNET_MODEL"
|
|
12997
13008
|
},
|
|
12998
13009
|
configPath: {
|
|
12999
13010
|
dir: ".claude",
|
|
@@ -13008,7 +13019,8 @@ var init_coders = __esm(() => {
|
|
|
13008
13019
|
adapter: "continue",
|
|
13009
13020
|
envVarMapping: {
|
|
13010
13021
|
apiKey: "OPENAI_API_KEY",
|
|
13011
|
-
baseURL: "OPENAI_BASE_URL"
|
|
13022
|
+
baseURL: "OPENAI_BASE_URL",
|
|
13023
|
+
openaiModel: "OPENAI_MODEL"
|
|
13012
13024
|
},
|
|
13013
13025
|
configPath: {
|
|
13014
13026
|
dir: ".continue",
|
|
@@ -13023,7 +13035,8 @@ var init_coders = __esm(() => {
|
|
|
13023
13035
|
adapter: "codex",
|
|
13024
13036
|
envVarMapping: {
|
|
13025
13037
|
apiKey: "OPENAI_API_KEY",
|
|
13026
|
-
baseURL: "OPENAI_BASE_URL"
|
|
13038
|
+
baseURL: "OPENAI_BASE_URL",
|
|
13039
|
+
openaiModel: "OPENAI_MODEL"
|
|
13027
13040
|
},
|
|
13028
13041
|
configPath: {
|
|
13029
13042
|
dir: ".codex",
|
|
@@ -13061,6 +13074,14 @@ var init_messages = __esm(() => {
|
|
|
13061
13074
|
apiKeyOllama: "API Key (optional, not required for Ollama)",
|
|
13062
13075
|
authToken: "Auth Token (for ANTHROPIC_AUTH_TOKEN, optional)",
|
|
13063
13076
|
baseUrl: "Base URL (optional, leave empty for default)",
|
|
13077
|
+
configureModels: "Would you like to configure model settings?",
|
|
13078
|
+
anthropicModel: "Default model (ANTHROPIC_MODEL, optional)",
|
|
13079
|
+
defaultHaikuModel: "Default Haiku model (ANTHROPIC_DEFAULT_HAIKU_MODEL, optional)",
|
|
13080
|
+
defaultOpusModel: "Default Opus model (ANTHROPIC_DEFAULT_OPUS_MODEL, optional)",
|
|
13081
|
+
defaultSonnetModel: "Default Sonnet model (ANTHROPIC_DEFAULT_SONNET_MODEL, optional)",
|
|
13082
|
+
qwenModel: "Model name (e.g., gpt-4, claude-3-5-sonnet-20241022)",
|
|
13083
|
+
enterQwenModel: "Please enter the model name for qwen:",
|
|
13084
|
+
codexModelNote: "Note: Model is stored in profile and also available as OPENAI_MODEL environment variable",
|
|
13064
13085
|
confirmApply: (app) => `Apply this configuration to ${app} now?`,
|
|
13065
13086
|
selectToSwitch: "Select profile to switch to",
|
|
13066
13087
|
selectToEdit: "Select profile to edit",
|
|
@@ -13201,7 +13222,7 @@ var CONFIG_VERSION = "2.0.0", EXPORT_VERSION = "1.0.0";
|
|
|
13201
13222
|
var init_versions2 = () => {};
|
|
13202
13223
|
|
|
13203
13224
|
// src/constants/meta.ts
|
|
13204
|
-
var APP_VERSION = "0.0.
|
|
13225
|
+
var APP_VERSION = "0.0.6";
|
|
13205
13226
|
var init_meta = () => {};
|
|
13206
13227
|
|
|
13207
13228
|
// src/constants/index.ts
|
|
@@ -13284,8 +13305,10 @@ var exports_presets = {};
|
|
|
13284
13305
|
__export(exports_presets, {
|
|
13285
13306
|
ollamaPreset: () => ollamaPreset,
|
|
13286
13307
|
getStandardPresets: () => getStandardPresets,
|
|
13308
|
+
getProvidersByWireApi: () => getProvidersByWireApi,
|
|
13287
13309
|
getPresetByIdAsync: () => getPresetByIdAsync,
|
|
13288
13310
|
getPresetById: () => getPresetById,
|
|
13311
|
+
getBuiltInProvidersByWireApi: () => getBuiltInProvidersByWireApi,
|
|
13289
13312
|
getBuiltInPresets: () => getBuiltInPresets,
|
|
13290
13313
|
getBuiltInPresetById: () => getBuiltInPresetById,
|
|
13291
13314
|
getAllPresets: () => getAllPresets,
|
|
@@ -13315,6 +13338,19 @@ async function getStandardPresets() {
|
|
|
13315
13338
|
const allPresets2 = await getAllPresets();
|
|
13316
13339
|
return allPresets2.filter((preset) => preset.id !== "custom");
|
|
13317
13340
|
}
|
|
13341
|
+
async function getProvidersByWireApi(wireApi, includeUserProviders = true) {
|
|
13342
|
+
const allPresets2 = includeUserProviders ? await getAllPresets() : builtInPresets;
|
|
13343
|
+
return allPresets2.filter((preset) => {
|
|
13344
|
+
const presetWireApi = preset.wire_api || "chat";
|
|
13345
|
+
return presetWireApi === wireApi;
|
|
13346
|
+
});
|
|
13347
|
+
}
|
|
13348
|
+
function getBuiltInProvidersByWireApi(wireApi) {
|
|
13349
|
+
return builtInPresets.filter((preset) => {
|
|
13350
|
+
const presetWireApi = preset.wire_api || "chat";
|
|
13351
|
+
return presetWireApi === wireApi;
|
|
13352
|
+
});
|
|
13353
|
+
}
|
|
13318
13354
|
function getBuiltInPresets() {
|
|
13319
13355
|
return builtInPresets;
|
|
13320
13356
|
}
|
|
@@ -13410,6 +13446,20 @@ class ClaudeCodeAdapter {
|
|
|
13410
13446
|
if (profile.authToken && envVars.authToken) {
|
|
13411
13447
|
newEnv[envVars.authToken] = profile.authToken;
|
|
13412
13448
|
}
|
|
13449
|
+
if (profile.models) {
|
|
13450
|
+
if (profile.models.anthropicModel && envVars.anthropicModel) {
|
|
13451
|
+
newEnv[envVars.anthropicModel] = profile.models.anthropicModel;
|
|
13452
|
+
}
|
|
13453
|
+
if (profile.models.defaultHaikuModel && envVars.defaultHaikuModel) {
|
|
13454
|
+
newEnv[envVars.defaultHaikuModel] = profile.models.defaultHaikuModel;
|
|
13455
|
+
}
|
|
13456
|
+
if (profile.models.defaultOpusModel && envVars.defaultOpusModel) {
|
|
13457
|
+
newEnv[envVars.defaultOpusModel] = profile.models.defaultOpusModel;
|
|
13458
|
+
}
|
|
13459
|
+
if (profile.models.defaultSonnetModel && envVars.defaultSonnetModel) {
|
|
13460
|
+
newEnv[envVars.defaultSonnetModel] = profile.models.defaultSonnetModel;
|
|
13461
|
+
}
|
|
13462
|
+
}
|
|
13413
13463
|
const newConfig = {
|
|
13414
13464
|
...existingConfig,
|
|
13415
13465
|
env: newEnv
|
|
@@ -13430,7 +13480,22 @@ class ClaudeCodeAdapter {
|
|
|
13430
13480
|
const envVars = this.coderConfig.envVarMapping;
|
|
13431
13481
|
const hasApiKey = profile.apiKey && config2.env?.[envVars.apiKey] === profile.apiKey;
|
|
13432
13482
|
const hasAuthToken = profile.authToken && envVars.authToken && config2.env?.[envVars.authToken] === profile.authToken;
|
|
13433
|
-
|
|
13483
|
+
let hasMatchingModels = true;
|
|
13484
|
+
if (profile.models) {
|
|
13485
|
+
if (profile.models.anthropicModel && envVars.anthropicModel) {
|
|
13486
|
+
hasMatchingModels = hasMatchingModels && config2.env?.[envVars.anthropicModel] === profile.models.anthropicModel;
|
|
13487
|
+
}
|
|
13488
|
+
if (profile.models.defaultHaikuModel && envVars.defaultHaikuModel) {
|
|
13489
|
+
hasMatchingModels = hasMatchingModels && config2.env?.[envVars.defaultHaikuModel] === profile.models.defaultHaikuModel;
|
|
13490
|
+
}
|
|
13491
|
+
if (profile.models.defaultOpusModel && envVars.defaultOpusModel) {
|
|
13492
|
+
hasMatchingModels = hasMatchingModels && config2.env?.[envVars.defaultOpusModel] === profile.models.defaultOpusModel;
|
|
13493
|
+
}
|
|
13494
|
+
if (profile.models.defaultSonnetModel && envVars.defaultSonnetModel) {
|
|
13495
|
+
hasMatchingModels = hasMatchingModels && config2.env?.[envVars.defaultSonnetModel] === profile.models.defaultSonnetModel;
|
|
13496
|
+
}
|
|
13497
|
+
}
|
|
13498
|
+
return (hasApiKey || hasAuthToken) && config2.env?.[envVars.baseURL] === expectedBaseURL && hasMatchingModels;
|
|
13434
13499
|
} catch (error46) {
|
|
13435
13500
|
return false;
|
|
13436
13501
|
}
|
|
@@ -16054,6 +16119,14 @@ var init_js_yaml = __esm(() => {
|
|
|
16054
16119
|
safeDump = renamed("safeDump", "dump");
|
|
16055
16120
|
});
|
|
16056
16121
|
|
|
16122
|
+
// src/utils/model-helper.ts
|
|
16123
|
+
function getOpenAIModel(profile) {
|
|
16124
|
+
if (profile.models) {
|
|
16125
|
+
return;
|
|
16126
|
+
}
|
|
16127
|
+
return profile.model || profile.openaiModel;
|
|
16128
|
+
}
|
|
16129
|
+
|
|
16057
16130
|
// src/adapters/continue.ts
|
|
16058
16131
|
import { existsSync as existsSync3 } from "node:fs";
|
|
16059
16132
|
import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
|
|
@@ -16075,10 +16148,12 @@ class ContinueAdapter {
|
|
|
16075
16148
|
console.warn(`Warning: Unable to read existing Continue config, will create new config`);
|
|
16076
16149
|
}
|
|
16077
16150
|
}
|
|
16151
|
+
const modelValue = getOpenAIModel(profile);
|
|
16078
16152
|
const newModel = {
|
|
16079
16153
|
title: profile.name,
|
|
16080
16154
|
provider: continueProvider,
|
|
16081
16155
|
apiBase: baseURL,
|
|
16156
|
+
...modelValue && { model: modelValue },
|
|
16082
16157
|
...profile.apiKey && { apiKey: profile.apiKey },
|
|
16083
16158
|
roles: ["chat", "edit", "apply"]
|
|
16084
16159
|
};
|
|
@@ -16117,7 +16192,14 @@ class ContinueAdapter {
|
|
|
16117
16192
|
}
|
|
16118
16193
|
const preset = getPresetById(profile.providerId);
|
|
16119
16194
|
const expectedBaseURL = profile.baseURL || preset?.baseURL || "";
|
|
16120
|
-
|
|
16195
|
+
const expectedModel = getOpenAIModel(profile);
|
|
16196
|
+
if (model.apiBase !== expectedBaseURL) {
|
|
16197
|
+
return false;
|
|
16198
|
+
}
|
|
16199
|
+
if (expectedModel && model.model !== expectedModel) {
|
|
16200
|
+
return false;
|
|
16201
|
+
}
|
|
16202
|
+
return true;
|
|
16121
16203
|
} catch (error46) {
|
|
16122
16204
|
return false;
|
|
16123
16205
|
}
|
|
@@ -17302,6 +17384,23 @@ var init_dist = __esm(() => {
|
|
|
17302
17384
|
*/
|
|
17303
17385
|
});
|
|
17304
17386
|
|
|
17387
|
+
// src/utils/env-key-helper.ts
|
|
17388
|
+
function getEnvKey(profile) {
|
|
17389
|
+
const preset = getPresetById(profile.providerId);
|
|
17390
|
+
return profile.envKey || preset?.env_key || "OPENAI_API_KEY";
|
|
17391
|
+
}
|
|
17392
|
+
function getEnvExportCommands(profile) {
|
|
17393
|
+
const commands = [];
|
|
17394
|
+
const envKey = getEnvKey(profile);
|
|
17395
|
+
if (profile.apiKey) {
|
|
17396
|
+
commands.push(`export ${envKey}="${profile.apiKey}"`);
|
|
17397
|
+
}
|
|
17398
|
+
return commands;
|
|
17399
|
+
}
|
|
17400
|
+
var init_env_key_helper = __esm(() => {
|
|
17401
|
+
init_presets();
|
|
17402
|
+
});
|
|
17403
|
+
|
|
17305
17404
|
// src/adapters/codex.ts
|
|
17306
17405
|
import { mkdir as mkdir4, readFile as readFile4, writeFile as writeFile4 } from "node:fs/promises";
|
|
17307
17406
|
import { existsSync as existsSync4 } from "node:fs";
|
|
@@ -17383,8 +17482,7 @@ class CodexAdapter {
|
|
|
17383
17482
|
base_url: profile.baseURL || preset.baseURL,
|
|
17384
17483
|
wire_api: preset.wire_api || "chat"
|
|
17385
17484
|
};
|
|
17386
|
-
|
|
17387
|
-
providerTable.env_key = envKey;
|
|
17485
|
+
providerTable.env_key = getEnvKey(profile);
|
|
17388
17486
|
if (preset.headers) {
|
|
17389
17487
|
providerTable.http_headers = preset.headers;
|
|
17390
17488
|
}
|
|
@@ -17394,8 +17492,9 @@ class CodexAdapter {
|
|
|
17394
17492
|
const profileTable = {
|
|
17395
17493
|
model_provider: providerName
|
|
17396
17494
|
};
|
|
17397
|
-
|
|
17398
|
-
|
|
17495
|
+
const modelValue = getOpenAIModel(profile);
|
|
17496
|
+
if (modelValue) {
|
|
17497
|
+
profileTable.model = modelValue;
|
|
17399
17498
|
} else {
|
|
17400
17499
|
const preset = getPresetById(profile.providerId);
|
|
17401
17500
|
if (preset && preset.defaultModels && preset.defaultModels.length > 0) {
|
|
@@ -17405,11 +17504,10 @@ class CodexAdapter {
|
|
|
17405
17504
|
return profileTable;
|
|
17406
17505
|
}
|
|
17407
17506
|
getEnvExportCommands(profile) {
|
|
17408
|
-
const
|
|
17409
|
-
const
|
|
17410
|
-
|
|
17411
|
-
|
|
17412
|
-
commands.push(`export ${envKey}="${profile.apiKey}"`);
|
|
17507
|
+
const commands = getEnvExportCommands(profile);
|
|
17508
|
+
const modelValue = getOpenAIModel(profile);
|
|
17509
|
+
if (modelValue) {
|
|
17510
|
+
commands.push(`export OPENAI_MODEL="${modelValue}"`);
|
|
17413
17511
|
}
|
|
17414
17512
|
return commands;
|
|
17415
17513
|
}
|
|
@@ -17448,6 +17546,7 @@ class CodexAdapter {
|
|
|
17448
17546
|
var init_codex = __esm(() => {
|
|
17449
17547
|
init_dist();
|
|
17450
17548
|
init_presets();
|
|
17549
|
+
init_env_key_helper();
|
|
17451
17550
|
});
|
|
17452
17551
|
|
|
17453
17552
|
// src/adapters/index.ts
|
|
@@ -18434,7 +18533,7 @@ ${import_picocolors6.default.bold("Create profile (interactive):")}
|
|
|
18434
18533
|
${import_picocolors6.default.green(`swixter ${CODER_NAME} create`)}
|
|
18435
18534
|
|
|
18436
18535
|
${import_picocolors6.default.bold("Create profile (non-interactive):")}
|
|
18437
|
-
${import_picocolors6.default.green(`swixter ${CODER_NAME} create --quiet --name <name> --provider <id> --api-key <key> [--base-url <url>] [--apply]`)}
|
|
18536
|
+
${import_picocolors6.default.green(`swixter ${CODER_NAME} create --quiet --name <name> --provider <id> --api-key <key> [--base-url <url>] [--anthropic-model <model>] [--default-haiku-model <model>] [--default-opus-model <model>] [--default-sonnet-model <model>] [--apply]`)}
|
|
18438
18537
|
|
|
18439
18538
|
${import_picocolors6.default.bold("Examples:")}
|
|
18440
18539
|
${import_picocolors6.default.dim("# Interactive profile creation")}
|
|
@@ -18544,6 +18643,57 @@ async function cmdCreateInteractive() {
|
|
|
18544
18643
|
xe(ERRORS.cancelled);
|
|
18545
18644
|
process.exit(EXIT_CODES.userCancelled);
|
|
18546
18645
|
}
|
|
18646
|
+
let models = undefined;
|
|
18647
|
+
if (true) {
|
|
18648
|
+
const configureModels = await ye({
|
|
18649
|
+
message: PROMPTS.configureModels,
|
|
18650
|
+
initialValue: false
|
|
18651
|
+
});
|
|
18652
|
+
if (pD(configureModels)) {
|
|
18653
|
+
xe(ERRORS.cancelled);
|
|
18654
|
+
process.exit(EXIT_CODES.userCancelled);
|
|
18655
|
+
}
|
|
18656
|
+
if (configureModels) {
|
|
18657
|
+
const anthropicModel = await he({
|
|
18658
|
+
message: PROMPTS.anthropicModel,
|
|
18659
|
+
placeholder: "claude-3-5-sonnet-20241022"
|
|
18660
|
+
});
|
|
18661
|
+
if (pD(anthropicModel)) {
|
|
18662
|
+
xe(ERRORS.cancelled);
|
|
18663
|
+
process.exit(EXIT_CODES.userCancelled);
|
|
18664
|
+
}
|
|
18665
|
+
const defaultHaikuModel = await he({
|
|
18666
|
+
message: PROMPTS.defaultHaikuModel,
|
|
18667
|
+
placeholder: "claude-3-5-haiku-20241022"
|
|
18668
|
+
});
|
|
18669
|
+
if (pD(defaultHaikuModel)) {
|
|
18670
|
+
xe(ERRORS.cancelled);
|
|
18671
|
+
process.exit(EXIT_CODES.userCancelled);
|
|
18672
|
+
}
|
|
18673
|
+
const defaultOpusModel = await he({
|
|
18674
|
+
message: PROMPTS.defaultOpusModel,
|
|
18675
|
+
placeholder: "claude-3-opus-20240229"
|
|
18676
|
+
});
|
|
18677
|
+
if (pD(defaultOpusModel)) {
|
|
18678
|
+
xe(ERRORS.cancelled);
|
|
18679
|
+
process.exit(EXIT_CODES.userCancelled);
|
|
18680
|
+
}
|
|
18681
|
+
const defaultSonnetModel = await he({
|
|
18682
|
+
message: PROMPTS.defaultSonnetModel,
|
|
18683
|
+
placeholder: "claude-3-5-sonnet-20241022"
|
|
18684
|
+
});
|
|
18685
|
+
if (pD(defaultSonnetModel)) {
|
|
18686
|
+
xe(ERRORS.cancelled);
|
|
18687
|
+
process.exit(EXIT_CODES.userCancelled);
|
|
18688
|
+
}
|
|
18689
|
+
models = {
|
|
18690
|
+
...anthropicModel && { anthropicModel },
|
|
18691
|
+
...defaultHaikuModel && { defaultHaikuModel },
|
|
18692
|
+
...defaultOpusModel && { defaultOpusModel },
|
|
18693
|
+
...defaultSonnetModel && { defaultSonnetModel }
|
|
18694
|
+
};
|
|
18695
|
+
}
|
|
18696
|
+
}
|
|
18547
18697
|
const shouldApply = await ye({
|
|
18548
18698
|
message: "Apply this profile to Claude Code now?",
|
|
18549
18699
|
initialValue: true
|
|
@@ -18569,6 +18719,9 @@ async function cmdCreateInteractive() {
|
|
|
18569
18719
|
if (finalBaseURL) {
|
|
18570
18720
|
profile.baseURL = finalBaseURL;
|
|
18571
18721
|
}
|
|
18722
|
+
if (models) {
|
|
18723
|
+
profile.models = models;
|
|
18724
|
+
}
|
|
18572
18725
|
await upsertProfile(profile, CODER_NAME);
|
|
18573
18726
|
spinner.stop("Profile created successfully!");
|
|
18574
18727
|
console.log();
|
|
@@ -18588,7 +18741,7 @@ async function cmdCreateInteractive() {
|
|
|
18588
18741
|
async function cmdCreateQuiet(params) {
|
|
18589
18742
|
if (!params.name || !params.provider) {
|
|
18590
18743
|
console.log(import_picocolors6.default.red("Error: Missing required parameters"));
|
|
18591
|
-
console.log(import_picocolors6.default.dim("Usage: swixter claude create --quiet --name <name> --provider <id> [--api-key <key>] [--auth-token <token>] [--base-url <url>] [--apply]"));
|
|
18744
|
+
console.log(import_picocolors6.default.dim("Usage: swixter claude create --quiet --name <name> --provider <id> [--api-key <key>] [--auth-token <token>] [--base-url <url>] [--anthropic-model <model>] [--default-haiku-model <model>] [--default-opus-model <model>] [--default-sonnet-model <model>] [--apply]"));
|
|
18592
18745
|
process.exit(1);
|
|
18593
18746
|
}
|
|
18594
18747
|
const preset = getPresetById(params.provider);
|
|
@@ -18612,6 +18765,18 @@ async function cmdCreateQuiet(params) {
|
|
|
18612
18765
|
if (finalBaseURL) {
|
|
18613
18766
|
profile.baseURL = finalBaseURL;
|
|
18614
18767
|
}
|
|
18768
|
+
const anthropicModel = params["anthropic-model"];
|
|
18769
|
+
const defaultHaikuModel = params["default-haiku-model"];
|
|
18770
|
+
const defaultOpusModel = params["default-opus-model"];
|
|
18771
|
+
const defaultSonnetModel = params["default-sonnet-model"];
|
|
18772
|
+
if (anthropicModel || defaultHaikuModel || defaultOpusModel || defaultSonnetModel) {
|
|
18773
|
+
profile.models = {
|
|
18774
|
+
...anthropicModel && { anthropicModel },
|
|
18775
|
+
...defaultHaikuModel && { defaultHaikuModel },
|
|
18776
|
+
...defaultOpusModel && { defaultOpusModel },
|
|
18777
|
+
...defaultSonnetModel && { defaultSonnetModel }
|
|
18778
|
+
};
|
|
18779
|
+
}
|
|
18615
18780
|
await upsertProfile(profile, CODER_NAME);
|
|
18616
18781
|
console.log();
|
|
18617
18782
|
console.log(import_picocolors6.default.green("✓") + " Profile created successfully!");
|
|
@@ -19183,8 +19348,8 @@ async function cmdCreateInteractive2() {
|
|
|
19183
19348
|
console.log();
|
|
19184
19349
|
console.log(import_picocolors7.default.bold(import_picocolors7.default.cyan("Create Continue/Qwen Profile")));
|
|
19185
19350
|
console.log();
|
|
19186
|
-
const {
|
|
19187
|
-
const presets =
|
|
19351
|
+
const { getProvidersByWireApi: getProvidersByWireApi2 } = await Promise.resolve().then(() => (init_presets(), exports_presets));
|
|
19352
|
+
const presets = await getProvidersByWireApi2("chat");
|
|
19188
19353
|
const name = await he({
|
|
19189
19354
|
message: "Profile name",
|
|
19190
19355
|
placeholder: "my-qwen-config",
|
|
@@ -19240,6 +19405,19 @@ async function cmdCreateInteractive2() {
|
|
|
19240
19405
|
xe(ERRORS.cancelled);
|
|
19241
19406
|
process.exit(EXIT_CODES.userCancelled);
|
|
19242
19407
|
}
|
|
19408
|
+
const modelName = await he({
|
|
19409
|
+
message: PROMPTS.enterQwenModel,
|
|
19410
|
+
placeholder: "e.g., gpt-4",
|
|
19411
|
+
validate: (value) => {
|
|
19412
|
+
if (!value || value.trim() === "")
|
|
19413
|
+
return "Model name is required";
|
|
19414
|
+
return;
|
|
19415
|
+
}
|
|
19416
|
+
});
|
|
19417
|
+
if (pD(modelName)) {
|
|
19418
|
+
xe(ERRORS.cancelled);
|
|
19419
|
+
process.exit(EXIT_CODES.userCancelled);
|
|
19420
|
+
}
|
|
19243
19421
|
const shouldApply = await ye({
|
|
19244
19422
|
message: "Apply this profile to Continue now?",
|
|
19245
19423
|
initialValue: true
|
|
@@ -19256,6 +19434,8 @@ async function cmdCreateInteractive2() {
|
|
|
19256
19434
|
name,
|
|
19257
19435
|
providerId,
|
|
19258
19436
|
apiKey: apiKey || "",
|
|
19437
|
+
model: modelName,
|
|
19438
|
+
openaiModel: modelName,
|
|
19259
19439
|
createdAt: new Date().toISOString(),
|
|
19260
19440
|
updatedAt: new Date().toISOString()
|
|
19261
19441
|
};
|
|
@@ -19268,6 +19448,7 @@ async function cmdCreateInteractive2() {
|
|
|
19268
19448
|
console.log(` Profile name: ${import_picocolors7.default.cyan(profile.name)}`);
|
|
19269
19449
|
console.log(` Provider: ${import_picocolors7.default.yellow(preset?.displayName)}`);
|
|
19270
19450
|
console.log(` Base URL: ${import_picocolors7.default.yellow(finalBaseURL || "Default")}`);
|
|
19451
|
+
console.log(` Model: ${import_picocolors7.default.yellow(modelName)}`);
|
|
19271
19452
|
console.log();
|
|
19272
19453
|
if (shouldApply) {
|
|
19273
19454
|
await setActiveProfileForCoder(CODER_NAME2, profile.name);
|
|
@@ -19279,9 +19460,9 @@ async function cmdCreateInteractive2() {
|
|
|
19279
19460
|
}
|
|
19280
19461
|
}
|
|
19281
19462
|
async function cmdCreateQuiet2(params) {
|
|
19282
|
-
if (!params.name || !params.provider) {
|
|
19463
|
+
if (!params.name || !params.provider || !params.model) {
|
|
19283
19464
|
console.log(import_picocolors7.default.red("Error: Missing required parameters"));
|
|
19284
|
-
console.log(import_picocolors7.default.dim("Usage: swixter qwen create --quiet --name <name> --provider <id> [--api-key <key>] [--base-url <url>]"));
|
|
19465
|
+
console.log(import_picocolors7.default.dim("Usage: swixter qwen create --quiet --name <name> --provider <id> --model <model> [--api-key <key>] [--base-url <url>]"));
|
|
19285
19466
|
process.exit(1);
|
|
19286
19467
|
}
|
|
19287
19468
|
const preset = getPresetById(params.provider);
|
|
@@ -19305,6 +19486,8 @@ async function cmdCreateQuiet2(params) {
|
|
|
19305
19486
|
name: params.name,
|
|
19306
19487
|
providerId: params.provider,
|
|
19307
19488
|
apiKey: params["api-key"] || "",
|
|
19489
|
+
model: params.model,
|
|
19490
|
+
openaiModel: params.model,
|
|
19308
19491
|
createdAt: new Date().toISOString(),
|
|
19309
19492
|
updatedAt: new Date().toISOString()
|
|
19310
19493
|
};
|
|
@@ -19318,6 +19501,7 @@ async function cmdCreateQuiet2(params) {
|
|
|
19318
19501
|
console.log(` Profile name: ${import_picocolors7.default.cyan(profile.name)}`);
|
|
19319
19502
|
console.log(` Provider: ${import_picocolors7.default.yellow(preset.displayName)}`);
|
|
19320
19503
|
console.log(` Base URL: ${import_picocolors7.default.yellow(finalBaseURL || "Default")}`);
|
|
19504
|
+
console.log(` Model: ${import_picocolors7.default.yellow(params.model)}`);
|
|
19321
19505
|
console.log();
|
|
19322
19506
|
if (params.apply) {
|
|
19323
19507
|
console.log(import_picocolors7.default.dim("Applying profile to Continue..."));
|
|
@@ -19438,8 +19622,8 @@ async function cmdEdit2(profileName) {
|
|
|
19438
19622
|
console.log();
|
|
19439
19623
|
console.log(import_picocolors7.default.bold(import_picocolors7.default.cyan(`Edit profile: ${profileName}`)));
|
|
19440
19624
|
console.log();
|
|
19441
|
-
const {
|
|
19442
|
-
const presets =
|
|
19625
|
+
const { getProvidersByWireApi: getProvidersByWireApi2 } = await Promise.resolve().then(() => (init_presets(), exports_presets));
|
|
19626
|
+
const presets = await getProvidersByWireApi2("chat");
|
|
19443
19627
|
const currentPreset = getPresetById(profile.providerId);
|
|
19444
19628
|
const shouldChangeProvider = await ye({
|
|
19445
19629
|
message: `Change provider? Current: ${currentPreset?.displayName}`,
|
|
@@ -19712,6 +19896,9 @@ async function cmdRun2(args) {
|
|
|
19712
19896
|
if (baseURL) {
|
|
19713
19897
|
env.OPENAI_BASE_URL = baseURL;
|
|
19714
19898
|
}
|
|
19899
|
+
if (profile.model || profile.openaiModel) {
|
|
19900
|
+
env.OPENAI_MODEL = profile.model || profile.openaiModel;
|
|
19901
|
+
}
|
|
19715
19902
|
const qwenArgs = [];
|
|
19716
19903
|
if (profile.apiKey) {
|
|
19717
19904
|
qwenArgs.push("--openai-api-key", profile.apiKey);
|
|
@@ -19719,6 +19906,9 @@ async function cmdRun2(args) {
|
|
|
19719
19906
|
if (baseURL) {
|
|
19720
19907
|
qwenArgs.push("--openai-base-url", baseURL);
|
|
19721
19908
|
}
|
|
19909
|
+
if (profile.model || profile.openaiModel) {
|
|
19910
|
+
qwenArgs.push("--model", profile.model || profile.openaiModel);
|
|
19911
|
+
}
|
|
19722
19912
|
for (let i2 = 0;i2 < args.length; i2++) {
|
|
19723
19913
|
if (args[i2] === "--profile") {
|
|
19724
19914
|
i2++;
|
|
@@ -19726,9 +19916,13 @@ async function cmdRun2(args) {
|
|
|
19726
19916
|
}
|
|
19727
19917
|
qwenArgs.push(args[i2]);
|
|
19728
19918
|
}
|
|
19919
|
+
const modelToUse = profile.model || profile.openaiModel;
|
|
19729
19920
|
console.log();
|
|
19730
19921
|
console.log(import_picocolors7.default.dim(`Using profile: ${import_picocolors7.default.cyan(profile.name)} (${preset?.displayName})`));
|
|
19731
19922
|
console.log(import_picocolors7.default.dim(`Base URL: ${import_picocolors7.default.yellow(baseURL || "Default")}`));
|
|
19923
|
+
if (modelToUse) {
|
|
19924
|
+
console.log(import_picocolors7.default.dim(`Model: ${import_picocolors7.default.yellow(modelToUse)}`));
|
|
19925
|
+
}
|
|
19732
19926
|
console.log();
|
|
19733
19927
|
spawnCLI({
|
|
19734
19928
|
command: "qwen",
|
|
@@ -19874,8 +20068,8 @@ async function cmdCreateInteractive3() {
|
|
|
19874
20068
|
console.log();
|
|
19875
20069
|
console.log(import_picocolors8.default.bold(import_picocolors8.default.cyan(PROMPTS.createProfile(CODER_CONFIG3.displayName))));
|
|
19876
20070
|
console.log();
|
|
19877
|
-
const {
|
|
19878
|
-
const presets =
|
|
20071
|
+
const { getProvidersByWireApi: getProvidersByWireApi2 } = await Promise.resolve().then(() => (init_presets(), exports_presets));
|
|
20072
|
+
const presets = await getProvidersByWireApi2("chat");
|
|
19879
20073
|
const name = await he({
|
|
19880
20074
|
message: PROMPTS.configName,
|
|
19881
20075
|
placeholder: DEFAULT_PLACEHOLDERS.configName,
|
|
@@ -20205,8 +20399,8 @@ async function cmdEdit3(profileName) {
|
|
|
20205
20399
|
console.log();
|
|
20206
20400
|
console.log(import_picocolors8.default.bold(import_picocolors8.default.cyan(`Edit profile: ${profileName}`)));
|
|
20207
20401
|
console.log();
|
|
20208
|
-
const {
|
|
20209
|
-
const presets =
|
|
20402
|
+
const { getProvidersByWireApi: getProvidersByWireApi2 } = await Promise.resolve().then(() => (init_presets(), exports_presets));
|
|
20403
|
+
const presets = await getProvidersByWireApi2("chat");
|
|
20210
20404
|
const currentPreset = getPresetById(profile.providerId);
|
|
20211
20405
|
const shouldChangeProvider = await ye({
|
|
20212
20406
|
message: `Change provider? Current: ${currentPreset?.displayName}`,
|
|
@@ -20571,6 +20765,9 @@ async function cmdRun3(args) {
|
|
|
20571
20765
|
if (profile.apiKey) {
|
|
20572
20766
|
env[envKey] = profile.apiKey;
|
|
20573
20767
|
}
|
|
20768
|
+
if (profile.model || profile.openaiModel) {
|
|
20769
|
+
env["OPENAI_MODEL"] = profile.model || profile.openaiModel;
|
|
20770
|
+
}
|
|
20574
20771
|
const codexArgs = args.filter((arg, idx) => {
|
|
20575
20772
|
if (arg === "--profile" || arg === "-p") {
|
|
20576
20773
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swixter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "CLI tool for managing AI coding assistant configurations - easily switch between providers (Claude Code, Codex, Continue) with Anthropic, Ollama, or custom APIs",
|
|
5
5
|
"main": "dist/cli/index.js",
|
|
6
6
|
"module": "dist/cli/index.js",
|