refactor: consolidate plugin install index store

This commit is contained in:
Shakker
2026-04-25 23:06:49 +01:00
parent f8123e4b68
commit c19f8a5223
35 changed files with 522 additions and 489 deletions

View File

@@ -7,13 +7,13 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
import type { PluginInstallRecord } from "../config/types.plugins.js";
import { enablePluginInConfig } from "../plugins/enable.js";
import {
loadPluginInstallRecords,
loadInstalledPluginIndexInstallRecords,
PLUGIN_INSTALLS_CONFIG_PATH,
removePluginInstallRecordFromRecords,
withoutPluginInstallRecords,
writePersistedPluginInstallLedger,
writePersistedInstalledPluginIndexInstallRecords,
withPluginInstallRecords,
} from "../plugins/install-ledger-store.js";
} from "../plugins/installed-plugin-index-records.js";
import { listMarketplacePlugins } from "../plugins/marketplace.js";
import { inspectPluginRegistry, refreshPluginRegistry } from "../plugins/plugin-registry.js";
import { defaultSlotIdForKey } from "../plugins/slots.js";
@@ -290,7 +290,7 @@ export function registerPluginsCli(program: Command) {
.option("--json", "Print JSON")
.action(async (id: string | undefined, opts: PluginInspectOptions) => {
const cfg = loadConfig();
const installRecords = await loadPluginInstallRecords({ config: cfg });
const installRecords = await loadInstalledPluginIndexInstallRecords();
const report = buildPluginDiagnosticsReport({
config: cfg,
...(opts.json ? { logger: quietPluginJsonLogger } : {}),
@@ -584,7 +584,7 @@ export function registerPluginsCli(program: Command) {
.action(async (id: string, opts: PluginUninstallOptions) => {
const snapshot = await readConfigFileSnapshot();
const sourceConfig = (snapshot.sourceConfig ?? snapshot.config) as OpenClawConfig;
const installRecords = await loadPluginInstallRecords({ config: sourceConfig });
const installRecords = await loadInstalledPluginIndexInstallRecords();
const cfg = withPluginInstallRecords(sourceConfig, installRecords);
const report = buildPluginDiagnosticsReport({ config: cfg });
const extensionsDir = path.join(resolveStateDir(process.env, os.homedir), "extensions");
@@ -691,7 +691,7 @@ export function registerPluginsCli(program: Command) {
defaultRuntime.log(theme.warn(warning));
}
await writePersistedPluginInstallLedger(
await writePersistedInstalledPluginIndexInstallRecords(
removePluginInstallRecordFromRecords(installRecords, pluginId),
);
await replaceConfigFile({