@lark-apaas/openclaw-scripts-diagnose-cli 0.1.4 → 0.1.5-alpha.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.
Files changed (2) hide show
  1. package/dist/index.cjs +19 -3
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -53,7 +53,7 @@ let json_diff = require("json-diff");
53
53
  * it terse and parseable.
54
54
  */
55
55
  function getVersion() {
56
- return "0.1.4";
56
+ return "0.1.5-alpha.0";
57
57
  }
58
58
  //#endregion
59
59
  //#region src/rule-engine/base.ts
@@ -2995,6 +2995,7 @@ async function installExtension(tag, ossFileMap, opts = {}) {
2995
2995
  else console.error(`[install-extension] skipConfigUpdate=true — not touching openclaw.json`);
2996
2996
  console.error(`[install-extension] done ${targets.length}/${targets.length} in ${Date.now() - t0}ms`);
2997
2997
  }
2998
+ const MEM0_PLUGIN_NAME = "openclaw-mem0-plugin";
2998
2999
  /**
2999
3000
  * Merge each installed extension's installMetadata into openclaw.json's
3000
3001
  * plugins.installs[<pkg.name>]. Atomic write via tmp + rename.
@@ -3002,6 +3003,11 @@ async function installExtension(tag, ossFileMap, opts = {}) {
3002
3003
  * - No openclaw.json → log + return (not an error; some install contexts don't have it yet)
3003
3004
  * - Extension without installMetadata in manifest → skip that entry (log)
3004
3005
  * - Existing plugins.installs entries for other extensions left untouched
3006
+ *
3007
+ * Special-case for mem0: when openclaw-mem0-plugin is among the installed
3008
+ * targets, also append it to plugins.allow (idempotent) and seed
3009
+ * plugins.entries.openclaw-mem0-plugin = { enabled: false } when the key
3010
+ * is absent. Existing values are preserved (user toggles survive).
3005
3011
  */
3006
3012
  function updatePluginInstalls(configPath, installedPkgs) {
3007
3013
  if (!node_fs.default.existsSync(configPath)) {
@@ -3021,10 +3027,20 @@ function updatePluginInstalls(configPath, installedPkgs) {
3021
3027
  installs[pkg.name] = pkg.installMetadata;
3022
3028
  updated++;
3023
3029
  } else skipped++;
3030
+ const installedMem0 = installedPkgs.some((p) => p.name === MEM0_PLUGIN_NAME);
3031
+ if (installedMem0) {
3032
+ const allowRaw = plugins.allow;
3033
+ const allow = Array.isArray(allowRaw) ? allowRaw : [];
3034
+ if (!allow.filter((e) => typeof e === "string").includes(MEM0_PLUGIN_NAME)) allow.push(MEM0_PLUGIN_NAME);
3035
+ plugins.allow = allow;
3036
+ if (!plugins.entries || typeof plugins.entries !== "object" || Array.isArray(plugins.entries)) plugins.entries = {};
3037
+ const entries = plugins.entries;
3038
+ if (!(MEM0_PLUGIN_NAME in entries)) entries[MEM0_PLUGIN_NAME] = { enabled: false };
3039
+ }
3024
3040
  const tmpPath = configPath + ".installs-tmp";
3025
3041
  node_fs.default.writeFileSync(tmpPath, JSON.stringify(config, null, 2), "utf-8");
3026
3042
  moveSafe(tmpPath, configPath);
3027
- console.error(`[install-extension] plugins.installs updated: ${updated} entry(ies) in ${configPath}` + (skipped > 0 ? ` (${skipped} package(s) without installMetadata skipped)` : ""));
3043
+ console.error(`[install-extension] plugins.installs updated: ${updated} entry(ies) in ${configPath}` + (skipped > 0 ? ` (${skipped} package(s) without installMetadata skipped)` : "") + (installedMem0 ? " [mem0: allow+entries seeded]" : ""));
3028
3044
  }
3029
3045
  function installOne(pkg, tarball, homeBase) {
3030
3046
  const destDir = node_path.default.join(homeBase, pkg.installPath);
@@ -4297,7 +4313,7 @@ async function reportCliRun(opts) {
4297
4313
  //#region src/help.ts
4298
4314
  const BIN = "mclaw-diagnose";
4299
4315
  function versionBanner() {
4300
- return `v0.1.4`;
4316
+ return `v0.1.5-alpha.0`;
4301
4317
  }
4302
4318
  const COMMANDS = [
4303
4319
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/openclaw-scripts-diagnose-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5-alpha.0",
4
4
  "description": "CLI for OpenClaw config diagnose and repair with JSON5 support",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {