import { i as formatErrorMessage } from "./errors-CSrrtEb1.js";
import { r as loadInstalledPluginIndexInstallRecords } from "./manifest-registry-G5tC5D9T.js";
import { b as refreshPluginRegistry } from "./plugin-registry-D41oHopy.js";
import "./installed-plugin-index-records-Be6251l_.js";
//#region src/cli/plugins-registry-refresh.ts
async function refreshPluginRegistryAfterConfigMutation(params) {
	try {
		const installRecords = params.installRecords ?? await loadInstalledPluginIndexInstallRecords(params.env ? { env: params.env } : {});
		await refreshPluginRegistry({
			config: params.config,
			reason: params.reason,
			installRecords,
			...params.workspaceDir ? { workspaceDir: params.workspaceDir } : {},
			...params.env ? { env: params.env } : {}
		});
	} catch (error) {
		params.logger?.warn?.(`Plugin registry refresh failed: ${formatErrorMessage(error)}`);
	}
}
//#endregion
export { refreshPluginRegistryAfterConfigMutation as t };
