ccman 3.3.14-beta.2 → 3.3.14

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.
Files changed (2) hide show
  1. package/dist/index.js +38 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ var init_package = __esm({
15
15
  "../core/package.json"() {
16
16
  package_default = {
17
17
  name: "@ccman/core",
18
- version: "3.3.14-beta.2",
18
+ version: "3.3.14",
19
19
  type: "module",
20
20
  description: "Core business logic for ccman - Manage Codex, Claude Code, Gemini CLI, OpenCode, OpenClaw, and MCP configurations",
21
21
  main: "./dist/index.js",
@@ -1210,6 +1210,15 @@ function resolveProviderName(provider) {
1210
1210
  return name;
1211
1211
  return DEFAULT_PROVIDER_NAME;
1212
1212
  }
1213
+ function loadExistingJSON(filePath) {
1214
+ if (!fileExists(filePath))
1215
+ return null;
1216
+ try {
1217
+ return readJSON(filePath);
1218
+ } catch {
1219
+ return null;
1220
+ }
1221
+ }
1213
1222
  function writeOpenClawConfig(provider) {
1214
1223
  const configPath = getOpenClawConfigPath();
1215
1224
  const modelsPath = getOpenClawModelsPath();
@@ -1226,17 +1235,36 @@ function writeOpenClawConfig(provider) {
1226
1235
  };
1227
1236
  const nextOpenClawConfig = replaceVariables(rawConfigTemplate, variables);
1228
1237
  const nextModelsConfig = replaceVariables(rawModelsTemplate, variables);
1229
- const currentAgents = nextOpenClawConfig.agents || {};
1230
- const defaults = currentAgents.defaults || {};
1231
- nextOpenClawConfig.agents = {
1232
- ...currentAgents,
1233
- defaults: {
1234
- ...defaults,
1235
- workspace: homeDir
1238
+ const existingOpenClawConfig = loadExistingJSON(configPath) || {};
1239
+ const existingModelsConfig = loadExistingJSON(modelsPath) || {};
1240
+ const mergedConfigModels = deepMerge(existingOpenClawConfig.models || {}, nextOpenClawConfig.models || {});
1241
+ const mergedAgents = deepMerge(nextOpenClawConfig.agents || {}, existingOpenClawConfig.agents || {});
1242
+ const mergedDefaults = mergedAgents.defaults || {};
1243
+ const mergedModel = mergedDefaults.model || {};
1244
+ const templatePrimary = nextOpenClawConfig.agents?.defaults?.model?.primary || `${providerName}/gpt-5.3-codex`;
1245
+ const workspace = typeof mergedDefaults.workspace === "string" && mergedDefaults.workspace.trim() ? mergedDefaults.workspace : homeDir;
1246
+ const finalOpenClawConfig = {
1247
+ ...existingOpenClawConfig,
1248
+ models: mergedConfigModels,
1249
+ agents: {
1250
+ ...mergedAgents,
1251
+ defaults: {
1252
+ ...mergedDefaults,
1253
+ workspace,
1254
+ model: {
1255
+ ...mergedModel,
1256
+ primary: templatePrimary
1257
+ }
1258
+ }
1236
1259
  }
1237
1260
  };
1238
- writeJSON(configPath, nextOpenClawConfig);
1239
- writeJSON(modelsPath, nextModelsConfig);
1261
+ const mergedProviders = deepMerge(existingModelsConfig.providers || {}, nextModelsConfig.providers || {});
1262
+ const finalModelsConfig = {
1263
+ ...existingModelsConfig,
1264
+ providers: mergedProviders
1265
+ };
1266
+ writeJSON(configPath, finalOpenClawConfig);
1267
+ writeJSON(modelsPath, finalModelsConfig);
1240
1268
  }
1241
1269
  var DEFAULT_PROVIDER_NAME, __filename5, __dirname5, OPENCLAW_CONFIG_TEMPLATE, OPENCLAW_MODELS_TEMPLATE;
1242
1270
  var init_openclaw2 = __esm({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccman",
3
- "version": "3.3.14-beta.2",
3
+ "version": "3.3.14",
4
4
  "type": "module",
5
5
  "description": "Manage Codex, Claude Code, Gemini CLI, OpenCode, OpenClaw, and MCP API service provider configurations",
6
6
  "main": "./dist/index.js",