refactor(cli): separate json payload output from logging

This commit is contained in:
Peter Steinberger
2026-03-22 23:19:14 +00:00
parent 274af0486a
commit 4ee41cc6f3
89 changed files with 710 additions and 693 deletions

View File

@@ -191,7 +191,7 @@ export function registerPluginsCli(program: Command) {
plugins: list,
diagnostics: report.diagnostics,
};
defaultRuntime.log(JSON.stringify(payload, null, 2));
defaultRuntime.writeJson(payload);
return;
}
@@ -298,7 +298,7 @@ export function registerPluginsCli(program: Command) {
}));
if (opts.json) {
defaultRuntime.log(JSON.stringify(inspectAllWithInstall, null, 2));
defaultRuntime.writeJson(inspectAllWithInstall);
return;
}
@@ -367,16 +367,10 @@ export function registerPluginsCli(program: Command) {
const install = cfg.plugins?.installs?.[inspect.plugin.id];
if (opts.json) {
defaultRuntime.log(
JSON.stringify(
{
...inspect,
install,
},
null,
2,
),
);
defaultRuntime.writeJson({
...inspect,
install,
});
return;
}
@@ -760,18 +754,12 @@ export function registerPluginsCli(program: Command) {
}
if (opts.json) {
defaultRuntime.log(
JSON.stringify(
{
source: result.sourceLabel,
name: result.manifest.name,
version: result.manifest.version,
plugins: result.manifest.plugins,
},
null,
2,
),
);
defaultRuntime.writeJson({
source: result.sourceLabel,
name: result.manifest.name,
version: result.manifest.version,
plugins: result.manifest.plugins,
});
return;
}