perf(cli): decouple guided-workflows and comparison commands from applicationToolContracts (#13448)

* perf(cli): decouple guided-workflows and comparison commands from applicationToolContracts

* perf(cli): register comparison commands lazily and assert applicationToolContracts startup isolation
This commit is contained in:
morluto authored and GitHub committed 2026-11-22 15:53:39 +00:00
1 parent 07df0f1c04
commit edbb844e6b
11 files changed
+150 -108

No files matched your search

-4
View File
@@ -8,8 +8,6 @@ import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
import type { AnalysisError } from "../domain/analysisErrorBase.js";
import type { JsonValue } from "../domain/jsonValue.js";
import type { Logger } from "pino";
import { registerSourceToBundleCommand } from "./sourceToBundleCommand.js";
import { registerStaticObservedEndpointsCommand } from "./staticObservedEndpointsCommand.js";
import { APPLICATION_TOOL_CONTRACTS } from "../contracts/applicationToolContracts.js";
import { contractNamed } from "./contractCliDescription.js";
import { registerContractDocumentCommand } from "./contractCommand.js";
@@ -87,8 +85,6 @@ export const registerApplicationCommands = (
return result.ok ? { ok: true, value: result.value.evidence } : result;
},
});
registerSourceToBundleCommand(cli, logger);
registerStaticObservedEndpointsCommand(cli, logger);
registerApiContractCommand(cli, logger);
registerNtfsJournalCommand(cli, logger);
registerPlaywrightTraceCommand(cli, logger);
+15
View File
@@ -345,6 +345,19 @@ export const CLI_COMMAND_REGISTRATIONS = {
(module, context) =>
module.registerGuidedWorkflowCommands(context.cli, context.logger),
),
sourceToBundle: plain(
() => import("./sourceToBundleCommand.js"),
(module, context) =>
module.registerSourceToBundleCommand(context.cli, context.logger),
),
staticObservedEndpoints: plain(
() => import("./staticObservedEndpointsCommand.js"),
(module, context) =>
module.registerStaticObservedEndpointsCommand(
context.cli,
context.logger,
),
),
analysisView: plain(
() => import("./analysisViewCommands.js"),
(module, context) =>
@@ -496,6 +509,8 @@ const CLI_FAMILY_REGISTRATIONS: {
application: [
"guidance",
"guidedWorkflow",
"sourceToBundle",
"staticObservedEndpoints",
"analysisView",
"evidence",
"environment",
+2 -3
View File
@@ -1,8 +1,7 @@
import type { Logger } from "pino";
import { APPLICATION_TOOL_CONTRACTS } from "../contracts/applicationToolContracts.js";
import { GUIDED_WORKFLOWS_TOOL_CONTRACT } from "../contracts/guidedWorkflowToolContract.js";
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
import { contractNamed } from "./contractCliDescription.js";
import { registerContractCommand } from "./contractCommand.js";
import type { CliInstance } from "./types.js";
@@ -14,7 +13,7 @@ export const registerGuidedWorkflowCommands = (
registerContractCommand(
cli,
logger,
contractNamed(APPLICATION_TOOL_CONTRACTS, "guided_workflows"),
GUIDED_WORKFLOWS_TOOL_CONTRACT,
{
description: "List or render REA's existing guided workflows",
runtimeJson: {
+2 -3
View File
@@ -1,7 +1,6 @@
import type { Logger } from "pino";
import type { CliInstance } from "./types.js";
import { APPLICATION_TOOL_CONTRACTS } from "../contracts/applicationToolContracts.js";
import { contractNamed } from "./contractCliDescription.js";
import { COMPARE_SOURCE_TO_BUNDLE_TOOL_CONTRACT } from "../contracts/sourceToBundleToolContract.js";
import { registerContractDocumentCommand } from "./contractCommand.js";
import {
evidenceBundleOption,
@@ -25,7 +24,7 @@ export const registerSourceToBundleCommand = (
registerContractDocumentCommand(
cli,
logger,
contractNamed(APPLICATION_TOOL_CONTRACTS, "compare_source_to_bundle"),
COMPARE_SOURCE_TO_BUNDLE_TOOL_CONTRACT,
{
description:
"Compare historical source (inline graph or reference {kind:file,path}) with authenticated application Evidence. Save the complete JSON to query with inspect-analysis-view.",
+2 -6
View File
@@ -1,8 +1,7 @@
import type { Logger } from "pino";
import type { Evidence } from "../domain/evidence.js";
import type { CliInstance } from "./types.js";
import { APPLICATION_TOOL_CONTRACTS } from "../contracts/applicationToolContracts.js";
import { contractNamed } from "./contractCliDescription.js";
import { COMPARE_STATIC_AND_OBSERVED_ENDPOINTS_TOOL_CONTRACT } from "../contracts/staticObservedEndpointsToolContract.js";
import { registerContractDocumentCommand } from "./contractCommand.js";
import {
evidenceBundleOption,
@@ -18,10 +17,7 @@ export const registerStaticObservedEndpointsCommand = (
registerContractDocumentCommand(
cli,
logger,
contractNamed(
APPLICATION_TOOL_CONTRACTS,
"compare_static_and_observed_endpoints",
),
COMPARE_STATIC_AND_OBSERVED_ENDPOINTS_TOOL_CONTRACT,
{
description:
"Compare static JavaScript endpoints and HAR Evidence JSON offline; --detail summary with --evidence_output saves full facts for selected inspect-analysis-view pages",