@cortexkit/opencode-magic-context 0.2.4 → 0.2.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/cli/setup.ts"],"names":[],"mappings":"AAgIA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAoJhD"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/cli/setup.ts"],"names":[],"mappings":"AA0IA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAoJhD"}
package/dist/cli.js CHANGED
@@ -1304,55 +1304,60 @@ function readJsonc(path) {
1304
1304
  return {};
1305
1305
  }
1306
1306
  }
1307
- function writeJsonc(path, data) {
1308
- writeFileSync(path, `${JSON.stringify(data, null, 2)}
1309
- `);
1310
- }
1311
1307
  function addPluginToOpenCodeConfig(configPath, format) {
1312
1308
  ensureDir(dirname(configPath));
1313
1309
  if (format === "none") {
1314
- const config2 = {
1310
+ const config = {
1315
1311
  plugin: [PLUGIN_NAME],
1316
1312
  compaction: { auto: false, prune: false }
1317
1313
  };
1318
- writeJsonc(configPath, config2);
1314
+ writeFileSync(configPath, `${JSON.stringify(config, null, 2)}
1315
+ `);
1319
1316
  return;
1320
1317
  }
1321
- const config = readJsonc(configPath);
1322
- const plugins = config.plugin ?? [];
1318
+ const existing = readJsonc(configPath);
1319
+ const plugins = existing.plugin ?? [];
1323
1320
  const hasPlugin = plugins.some((p) => p === PLUGIN_NAME || p.startsWith(`${PLUGIN_NAME}@`));
1324
1321
  if (!hasPlugin) {
1325
1322
  plugins.push(PLUGIN_NAME);
1326
- config.plugin = plugins;
1327
1323
  }
1328
- const compaction = config.compaction ?? {};
1324
+ existing.plugin = plugins;
1325
+ const compaction = existing.compaction ?? {};
1329
1326
  compaction.auto = false;
1330
1327
  compaction.prune = false;
1331
- config.compaction = compaction;
1332
- writeJsonc(configPath, config);
1328
+ existing.compaction = compaction;
1329
+ writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
1330
+ `);
1333
1331
  }
1334
1332
  function writeMagicContextConfig(configPath, options) {
1335
- const config = {};
1333
+ const config = existsSync2(configPath) ? readJsonc(configPath) : {};
1336
1334
  if (options.historianModel) {
1337
- config.historian = { model: options.historianModel };
1335
+ const historian = config.historian ?? {};
1336
+ historian.model = options.historianModel;
1337
+ config.historian = historian;
1338
1338
  }
1339
1339
  if (options.dreamerEnabled) {
1340
- const dreamer = { enabled: true };
1340
+ const dreamer = config.dreamer ?? {};
1341
+ dreamer.enabled = true;
1341
1342
  if (options.dreamerModel) {
1342
1343
  dreamer.model = options.dreamerModel;
1343
1344
  }
1344
1345
  config.dreamer = dreamer;
1345
1346
  } else {
1346
- config.dreamer = { enabled: false };
1347
+ const dreamer = config.dreamer ?? {};
1348
+ dreamer.enabled = false;
1349
+ config.dreamer = dreamer;
1347
1350
  }
1348
1351
  if (options.sidekickEnabled) {
1349
- const sidekick = { enabled: true };
1352
+ const sidekick = config.sidekick ?? {};
1353
+ sidekick.enabled = true;
1350
1354
  if (options.sidekickModel) {
1351
1355
  sidekick.model = options.sidekickModel;
1352
1356
  }
1353
1357
  config.sidekick = sidekick;
1354
1358
  }
1355
- writeJsonc(configPath, config);
1359
+ writeFileSync(configPath, `${JSON.stringify(config, null, 2)}
1360
+ `);
1356
1361
  }
1357
1362
  function disableOmoHooks(omoConfigPath) {
1358
1363
  const config = readJsonc(omoConfigPath);
@@ -1368,7 +1373,8 @@ function disableOmoHooks(omoConfigPath) {
1368
1373
  }
1369
1374
  }
1370
1375
  config.disabled_hooks = disabledHooks;
1371
- writeJsonc(omoConfigPath, config);
1376
+ writeFileSync(omoConfigPath, `${JSON.stringify(config, null, 2)}
1377
+ `);
1372
1378
  }
1373
1379
  async function runSetup() {
1374
1380
  Wt2("Magic Context — Setup");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",