fix(cli): route JavaScript applications from analyze

This commit is contained in:
N0zoM1z0
2026-07-21 23:42:28 +08:00
parent 5a908a03a6
commit 74965d9088
17 changed files with 227 additions and 68 deletions
+62
View File
@@ -117,6 +117,68 @@ describe("Electron CLI parity", () => {
INTEGRATION_TEST_TIMEOUT_MS,
);
it(
"routes generic approved analysis of a directory to static JavaScript",
async () => {
const root = await mkdtemp(join(tmpdir(), "rea-electron-routed-cli-"));
temporary.push(root);
await writeElectronBoundaryFixture(root);
const environment = {
...process.env,
REA_INVESTIGATION_INPUT_ROOTS_JSON: JSON.stringify([root]),
};
const analyzed = await runCli(
["analyze", root, "--approved", "--json"],
environment,
);
expect(analyzed).toMatchObject({
operation: "analyze_javascript_application",
provider: { id: "rea-javascript-application" },
normalized_result: {
input_path: root,
format: "directory",
summary: { ipc: { paired_renderer_transmissions: 4 } },
},
});
},
INTEGRATION_TEST_TIMEOUT_MS,
);
it(
"requires explicit approval before generic JavaScript analysis",
async () => {
const root = await mkdtemp(
join(tmpdir(), "rea-electron-unapproved-cli-"),
);
temporary.push(root);
await writeElectronBoundaryFixture(root);
const environment = {
...process.env,
REA_INVESTIGATION_INPUT_ROOTS_JSON: JSON.stringify([root]),
};
const denied = await runCli(["analyze", root, "--json"], environment);
expect(denied).toMatchObject({
code: "invalid_request",
details: {
operation: "analyze_javascript_application",
issues: [
{
path: ["approved"],
reason: "invalid_value",
expected: [true],
},
],
},
});
expect(denied).not.toHaveProperty("details.candidate_ids");
},
INTEGRATION_TEST_TIMEOUT_MS,
);
it(
"reads a file and returns the derived static/runtime reconciliation contract",
async () => {