plugin-updater 1.3.2 → 1.3.4
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/README.md +2 -0
- package/dist/index.js +8 -1
- package/lib/core.js +16 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,6 +91,8 @@ Deployed automatically to both apps on each `earlyLaunch` (`~/.config/opencode/c
|
|
|
91
91
|
|
|
92
92
|
## Configuration
|
|
93
93
|
|
|
94
|
+
> Config files are **auto-created with defaults on first run** (via core `ensureConfig`). **Global console logging** for every plugin is toggled in `config/settings.json` (`logConsole: true`, the opencode.json-equivalent).
|
|
95
|
+
|
|
94
96
|
Config file: `~/.config/opencode/config/plugin-updater.json` (preferred) or `~/.config/opencode/plugin-updater.json` (fallback); same under `~/.claude` for Claude Code.
|
|
95
97
|
|
|
96
98
|
| Key | Type | Default | Description |
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,8 @@ import { deployToExecutionDir } from "./deploy.js";
|
|
|
7
7
|
import { syncPluginsAcrossApps } from "./syncbridge.js";
|
|
8
8
|
// @ts-ignore — generated bundle, no .d.ts
|
|
9
9
|
import { maybeRunCli, deployUpdaterCommands } from "./commands.js";
|
|
10
|
+
// @ts-ignore — generated bundle, no .d.ts
|
|
11
|
+
import { ensureConfig } from "../lib/core.js";
|
|
10
12
|
import path from "path";
|
|
11
13
|
import fs from "fs";
|
|
12
14
|
// `node dist/index.js config …` (from the /plugin-updater-config command) runs the
|
|
@@ -64,11 +66,16 @@ export async function earlyLaunch(configDir, plugins) {
|
|
|
64
66
|
return {};
|
|
65
67
|
setEarlyLaunchConfigDir(configDir);
|
|
66
68
|
writeLog("Starting earlyLaunch updater sequence");
|
|
67
|
-
// keep the cross-app /plugin-updater-config command deployed (idempotent)
|
|
69
|
+
// keep the cross-app /plugin-updater-config command deployed (idempotent) + the
|
|
70
|
+
// config file materialized (so it's discoverable in the home / agentbox data folder)
|
|
68
71
|
try {
|
|
69
72
|
deployUpdaterCommands();
|
|
70
73
|
}
|
|
71
74
|
catch { /* best-effort */ }
|
|
75
|
+
try {
|
|
76
|
+
ensureConfig("plugin-updater", { logging: true });
|
|
77
|
+
}
|
|
78
|
+
catch { /* best-effort */ }
|
|
72
79
|
// pull in any `sync: true` plugins from the other app BEFORE building, then
|
|
73
80
|
// re-read the list so a freshly-synced-in plugin is cloned/built this pass.
|
|
74
81
|
await syncPluginsAcrossApps(configDir);
|
package/lib/core.js
CHANGED
|
@@ -83,6 +83,20 @@ function loadConfig(name, configDir = getAppConfigDir()) {
|
|
|
83
83
|
CACHE[key] = data && typeof data === "object" && !Array.isArray(data) ? data : {};
|
|
84
84
|
return CACHE[key];
|
|
85
85
|
}
|
|
86
|
+
function ensureConfig(name, defaults, configDir = getAppConfigDir()) {
|
|
87
|
+
const trivial = Object.keys(defaults).every((k) => k === "logging");
|
|
88
|
+
const preferred = join2(configDir, "config", `${name}.json`);
|
|
89
|
+
const fallback = join2(configDir, `${name}.json`);
|
|
90
|
+
if (!trivial && !existsSync3(preferred) && !existsSync3(fallback)) {
|
|
91
|
+
try {
|
|
92
|
+
writeJson(preferred, defaults);
|
|
93
|
+
} catch {
|
|
94
|
+
}
|
|
95
|
+
CACHE[configDir + "::" + name] = { ...defaults };
|
|
96
|
+
return CACHE[configDir + "::" + name];
|
|
97
|
+
}
|
|
98
|
+
return { ...defaults, ...loadConfig(name, configDir) };
|
|
99
|
+
}
|
|
86
100
|
function getConfigValue(name, key, configDir = getAppConfigDir()) {
|
|
87
101
|
let node = loadConfig(name, configDir);
|
|
88
102
|
for (const part of key.split(".")) {
|
|
@@ -127,7 +141,7 @@ import { join as join3 } from "path";
|
|
|
127
141
|
import { appendFileSync } from "fs";
|
|
128
142
|
var START_TIME = (/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-").split(".")[0];
|
|
129
143
|
function globalSetting(key, fallback, configDir = getAppConfigDir()) {
|
|
130
|
-
const v = loadConfig("
|
|
144
|
+
const v = loadConfig("settings", configDir)[key];
|
|
131
145
|
return v === void 0 ? fallback : v;
|
|
132
146
|
}
|
|
133
147
|
function envTruthy(v) {
|
|
@@ -276,6 +290,7 @@ export {
|
|
|
276
290
|
configPath,
|
|
277
291
|
createLogger,
|
|
278
292
|
deployCommands,
|
|
293
|
+
ensureConfig,
|
|
279
294
|
ensureDir,
|
|
280
295
|
existingApps,
|
|
281
296
|
existingConfigDirs,
|