fix: scope plugin inspect runtime loading

This commit is contained in:
Shakker
2026-04-28 10:42:17 +01:00
parent 1bd4b7ac4d
commit 7727e102a5
4 changed files with 56 additions and 9 deletions

View File

@@ -259,24 +259,26 @@ export function registerPluginsCli(program: Command) {
buildAllPluginInspectReports,
buildPluginDiagnosticsReport,
buildPluginInspectReport,
buildPluginSnapshotReport,
formatPluginCompatibilityNotice,
} = await import("../plugins/status.js");
const { loadInstalledPluginIndexInstallRecords } =
await import("../plugins/installed-plugin-index-records.js");
const cfg = getRuntimeConfig();
const installRecords = await loadInstalledPluginIndexInstallRecords();
const report = buildPluginDiagnosticsReport({
config: cfg,
...(opts.json ? { logger: quietPluginJsonLogger } : {}),
});
const loggerParams = opts.json ? { logger: quietPluginJsonLogger } : {};
if (opts.all) {
if (id) {
defaultRuntime.error("Pass either a plugin id or --all, not both.");
return defaultRuntime.exit(1);
}
const report = buildPluginDiagnosticsReport({
config: cfg,
...loggerParams,
});
const inspectAll = buildAllPluginInspectReports({
config: cfg,
...(opts.json ? { logger: quietPluginJsonLogger } : {}),
...loggerParams,
report,
});
const inspectAllWithInstall = inspectAll.map((inspect) => ({
@@ -342,10 +344,26 @@ export function registerPluginsCli(program: Command) {
return defaultRuntime.exit(1);
}
const inspect = buildPluginInspectReport({
id,
const snapshotReport = buildPluginSnapshotReport({
config: cfg,
...(opts.json ? { logger: quietPluginJsonLogger } : {}),
...loggerParams,
});
const targetPlugin = snapshotReport.plugins.find(
(entry) => entry.id === id || entry.name === id,
);
if (!targetPlugin) {
defaultRuntime.error(`Plugin not found: ${id}`);
return defaultRuntime.exit(1);
}
const report = buildPluginDiagnosticsReport({
config: cfg,
...loggerParams,
onlyPluginIds: [targetPlugin.id],
});
const inspect = buildPluginInspectReport({
id: targetPlugin.id,
config: cfg,
...loggerParams,
report,
});
if (!inspect) {