fix(cli): stream large JavaScript JSON results (#1024)
* fix(javascript): report application analysis progress on the CLI * test(cli): preserve progress in filtered output checks * fix(cli): stream large JavaScript JSON results * test(cli): include streaming output in dispatcher fixture
This commit is contained in:
@@ -24,15 +24,17 @@ import {
|
||||
javascriptApplicationOptions,
|
||||
} from "../cliObservationOptions.js";
|
||||
import { runCliJavaScriptApplicationAnalysis } from "./javascriptApplicationAnalysis.js";
|
||||
import type { CliResultOutput } from "./streamedJsonOutput.js";
|
||||
|
||||
/** Register CLI equivalents of the Electron MCP tools. */
|
||||
export const registerElectronCommands = (
|
||||
cli: ReturnType<typeof Cli.create>,
|
||||
logger: Logger,
|
||||
resultOutput?: CliResultOutput,
|
||||
): void => {
|
||||
registerElectronObservationCommands(cli, logger);
|
||||
registerElectronActiveCommand(cli, logger);
|
||||
registerJavaScriptApplicationCommand(cli, logger);
|
||||
registerJavaScriptApplicationCommand(cli, logger, resultOutput);
|
||||
registerJavaScriptRuntimeReconciliationCommand(cli, logger);
|
||||
};
|
||||
|
||||
@@ -172,6 +174,7 @@ const registerElectronPageInspection = (
|
||||
const registerJavaScriptApplicationCommand = (
|
||||
cli: ReturnType<typeof Cli.create>,
|
||||
logger: Logger,
|
||||
resultOutput?: CliResultOutput,
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.analyzeJavaScriptApplication, {
|
||||
description:
|
||||
@@ -180,12 +183,18 @@ const registerJavaScriptApplicationCommand = (
|
||||
path: z.string().describe("ASAR or extracted application path"),
|
||||
}),
|
||||
options: javascriptApplicationOptions,
|
||||
run: ({ args, options }) =>
|
||||
run: ({ args, options, format }) =>
|
||||
logCliCommand(logger, CLI_COMMANDS.analyzeJavaScriptApplication, () =>
|
||||
runCliJavaScriptApplicationAnalysis({
|
||||
input_path: args.path,
|
||||
format: options.artifactFormat,
|
||||
}),
|
||||
runCliJavaScriptApplicationAnalysis(
|
||||
{ input_path: args.path, format: options.artifactFormat },
|
||||
resultOutput === undefined
|
||||
? undefined
|
||||
: {
|
||||
output: resultOutput,
|
||||
command: CLI_COMMANDS.analyzeJavaScriptApplication,
|
||||
format,
|
||||
},
|
||||
),
|
||||
),
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user