refactor!: enforce canonical evidence and provider boundaries
Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership. Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers. BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { z } from "incur";
|
||||
|
||||
import { runProviderAnalysis } from "../composition/directAnalysis.js";
|
||||
import type { DirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import { createArtifactExtractionDestination } from "../application/artifacts/ArtifactExtractionDestination.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
@@ -10,12 +10,13 @@ import type { CliInstance } from "./types.js";
|
||||
export const registerArtifactCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
registerInspectionCommand(cli, logger);
|
||||
registerExtractionCommand(cli, logger);
|
||||
registerInterfaceBuilderCommand(cli, logger);
|
||||
registerAssetCatalogCommand(cli, logger);
|
||||
registerDylibResolutionCommand(cli, logger);
|
||||
registerInspectionCommand(cli, logger, runProviderAnalysis);
|
||||
registerExtractionCommand(cli, logger, runProviderAnalysis);
|
||||
registerInterfaceBuilderCommand(cli, logger, runProviderAnalysis);
|
||||
registerAssetCatalogCommand(cli, logger, runProviderAnalysis);
|
||||
registerDylibResolutionCommand(cli, logger, runProviderAnalysis);
|
||||
cli.command(CLI_COMMANDS.inspectKeyedArchive, {
|
||||
description:
|
||||
"Inspect a Foundation keyed archive as an object-reference graph",
|
||||
@@ -62,6 +63,7 @@ export const registerArtifactCommands = (
|
||||
const registerDylibResolutionCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.traceDylibResolution, {
|
||||
description:
|
||||
@@ -101,6 +103,7 @@ const registerDylibResolutionCommand = (
|
||||
const registerAssetCatalogCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.inspectAssetCatalog, {
|
||||
description: "Inspect compiled Apple asset catalog metadata",
|
||||
@@ -136,6 +139,7 @@ const registerAssetCatalogCommand = (
|
||||
const registerInterfaceBuilderCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.decodeInterfaceBuilder, {
|
||||
description:
|
||||
@@ -187,7 +191,11 @@ const registerInterfaceBuilderCommand = (
|
||||
});
|
||||
};
|
||||
|
||||
const registerExtractionCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerExtractionCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.extractArtifact, {
|
||||
description: "Extract all regular artifact contents safely",
|
||||
args: z.object({
|
||||
@@ -208,7 +216,11 @@ const registerExtractionCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
});
|
||||
};
|
||||
|
||||
const registerInspectionCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerInspectionCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.inspectArtifact, {
|
||||
description:
|
||||
"Inspect one artifact and return all available observations and next probes",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { DirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import type { Logger } from "../logger.js";
|
||||
import { registerCoreBinaryCommands } from "./coreBinaryCommands.js";
|
||||
import { registerCoreNativeCommands } from "./coreNativeCommands.js";
|
||||
@@ -8,8 +9,9 @@ import type { CliResultOutput } from "./streamedJsonOutput.js";
|
||||
export const registerCoreAnalysisCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
resultOutput?: CliResultOutput,
|
||||
): void => {
|
||||
registerCoreBinaryCommands(cli, logger, resultOutput);
|
||||
registerCoreNativeCommands(cli, logger);
|
||||
registerCoreBinaryCommands(cli, logger, runDirectAnalysis, resultOutput);
|
||||
registerCoreNativeCommands(cli, logger, runDirectAnalysis);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@ import { stat } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import { resolveCliAnalysisSelector } from "./analysisSelector.js";
|
||||
import { runDirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import type { DirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import type { Logger } from "../logger.js";
|
||||
@@ -21,20 +21,22 @@ import type { CliResultOutput } from "./streamedJsonOutput.js";
|
||||
export const registerCoreBinaryCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
resultOutput?: CliResultOutput,
|
||||
): void => {
|
||||
registerOverviewCommands(cli, logger, resultOutput);
|
||||
registerDecompileCommand(cli, logger);
|
||||
registerFunctionCommand(cli, logger);
|
||||
registerInstructionsCommand(cli, logger);
|
||||
registerSearchCommand(cli, logger);
|
||||
registerXrefsCommand(cli, logger);
|
||||
registerTraceCommand(cli, logger);
|
||||
registerOverviewCommands(cli, logger, runDirectAnalysis, resultOutput);
|
||||
registerDecompileCommand(cli, logger, runDirectAnalysis);
|
||||
registerFunctionCommand(cli, logger, runDirectAnalysis);
|
||||
registerInstructionsCommand(cli, logger, runDirectAnalysis);
|
||||
registerSearchCommand(cli, logger, runDirectAnalysis);
|
||||
registerXrefsCommand(cli, logger, runDirectAnalysis);
|
||||
registerTraceCommand(cli, logger, runDirectAnalysis);
|
||||
};
|
||||
|
||||
const registerOverviewCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
resultOutput?: CliResultOutput,
|
||||
): void => {
|
||||
const overviewOptions = z.object({
|
||||
@@ -108,7 +110,11 @@ const registerOverviewCommands = (
|
||||
});
|
||||
};
|
||||
|
||||
const registerDecompileCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerDecompileCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.decompile, {
|
||||
description: "Read one part of an app as code",
|
||||
args: z.object({
|
||||
@@ -187,7 +193,11 @@ const isJavaScriptApplicationPath = async (path: string): Promise<boolean> => {
|
||||
}
|
||||
};
|
||||
|
||||
const registerXrefsCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerXrefsCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.xrefs, {
|
||||
description: "List bounded references to an analyzed address",
|
||||
args: z.object({
|
||||
@@ -234,7 +244,11 @@ const registerXrefsCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
});
|
||||
};
|
||||
|
||||
const registerTraceCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerTraceCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.trace, {
|
||||
description: "Trace a literal feature through analyzed references",
|
||||
args: z.object({
|
||||
@@ -289,7 +303,11 @@ const registerTraceCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
});
|
||||
};
|
||||
|
||||
const registerFunctionCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerFunctionCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.function, {
|
||||
description: "Analyze one complete function with evidence",
|
||||
args: z.object({
|
||||
@@ -343,6 +361,7 @@ const registerFunctionCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerInstructionsCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.instructions, {
|
||||
description: "Read every raw instruction without decompiling",
|
||||
@@ -394,7 +413,11 @@ const registerInstructionsCommand = (
|
||||
});
|
||||
};
|
||||
|
||||
const registerSearchCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerSearchCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.search, {
|
||||
description: "Search every analyzed string or procedure name",
|
||||
args: z.object({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "incur";
|
||||
|
||||
import { runDirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import type { DirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import type { Logger } from "../logger.js";
|
||||
@@ -15,8 +15,9 @@ import type { CliInstance } from "./types.js";
|
||||
export const registerCoreNativeCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
registerAnnotationCommand(cli, logger);
|
||||
registerAnnotationCommand(cli, logger, runDirectAnalysis);
|
||||
cli.command(CLI_COMMANDS.inspectNativeLoadImage, {
|
||||
description:
|
||||
"Verify loaded native bytes, source mappings, relocations and entry",
|
||||
@@ -251,14 +252,15 @@ export const registerCoreNativeCommands = (
|
||||
),
|
||||
});
|
||||
}
|
||||
registerNativeApiCommand(cli, logger);
|
||||
registerNativeUiActionCommand(cli, logger);
|
||||
registerNativeDispatchMetadataCommand(cli, logger);
|
||||
registerNativeApiCommand(cli, logger, runDirectAnalysis);
|
||||
registerNativeUiActionCommand(cli, logger, runDirectAnalysis);
|
||||
registerNativeDispatchMetadataCommand(cli, logger, runDirectAnalysis);
|
||||
};
|
||||
|
||||
const registerNativeDispatchMetadataCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.inspectNativeDispatchMetadata, {
|
||||
description: "Inspect typed Objective-C and Swift dispatch metadata",
|
||||
@@ -302,6 +304,7 @@ const registerNativeDispatchMetadataCommand = (
|
||||
const registerNativeUiActionCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.traceNativeUiAction, {
|
||||
description:
|
||||
@@ -367,7 +370,11 @@ const registerNativeUiActionCommand = (
|
||||
});
|
||||
};
|
||||
|
||||
const registerNativeApiCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerNativeApiCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.inspectNativeApi, {
|
||||
description: "Reconstruct one native function API boundary with evidence",
|
||||
args: z.object({
|
||||
@@ -400,7 +407,11 @@ const registerNativeApiCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
});
|
||||
};
|
||||
|
||||
const registerAnnotationCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerAnnotationCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runDirectAnalysis: DirectAnalysis["runDirectAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.annotateNativeFunction, {
|
||||
description: "Edit function annotations and return refreshed analysis",
|
||||
args: z.object({
|
||||
|
||||
@@ -31,10 +31,11 @@ import { withCommandCancellation } from "./commandCancellation.js";
|
||||
export const registerElectronCommands = (
|
||||
cli: ReturnType<typeof Cli.create>,
|
||||
logger: Logger,
|
||||
environment: Readonly<Record<string, string | undefined>>,
|
||||
resultOutput?: CliResultOutput,
|
||||
): void => {
|
||||
registerElectronObservationCommands(cli, logger);
|
||||
registerElectronActiveCommand(cli, logger);
|
||||
registerElectronActiveCommand(cli, logger, environment);
|
||||
registerJavaScriptApplicationCommand(cli, logger, resultOutput);
|
||||
registerJavaScriptRuntimeReconciliationCommand(cli, logger);
|
||||
};
|
||||
@@ -42,6 +43,7 @@ export const registerElectronCommands = (
|
||||
const registerElectronActiveCommand = (
|
||||
cli: ReturnType<typeof Cli.create>,
|
||||
logger: Logger,
|
||||
environment: Readonly<Record<string, string | undefined>>,
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.captureElectronScenario, {
|
||||
description: "Run one owned Electron scenario with cancellable actions",
|
||||
@@ -79,7 +81,7 @@ const registerElectronActiveCommand = (
|
||||
const { createElectronScenarioProvider } =
|
||||
await import("../composition/electronScenario.js");
|
||||
const result = await captureElectronScenario(
|
||||
createElectronScenarioProvider(),
|
||||
createElectronScenarioProvider(environment),
|
||||
parsed.data,
|
||||
{ signal },
|
||||
);
|
||||
|
||||
@@ -82,13 +82,16 @@ export const renderSetupProgress = (event: SetupProgressEvent): void => {
|
||||
};
|
||||
|
||||
/** Finish an interactive setup journey without exposing the full doctor catalog. */
|
||||
export const renderInteractiveSetupResult = (result: SetupResult): void => {
|
||||
export const renderInteractiveSetupResult = (
|
||||
result: SetupResult,
|
||||
environment: Readonly<NodeJS.ProcessEnv> = process.env,
|
||||
): void => {
|
||||
if (result.status === "ready") {
|
||||
const changedClients = Object.entries(result.clients)
|
||||
.filter(([, client]) => client.status === "configured")
|
||||
.map(([client]) => clientDisplayNames.get(client) ?? client);
|
||||
const readyClients = readyAgentClients(result, changedClients);
|
||||
renderReadyCapabilities(result, readyClients);
|
||||
renderReadyCapabilities(result, readyClients, environment);
|
||||
outro(
|
||||
changedClients.length === 0
|
||||
? "REA is ready for local app analysis."
|
||||
@@ -100,7 +103,7 @@ export const renderInteractiveSetupResult = (result: SetupResult): void => {
|
||||
if (result.status === "planned" || result.status === "cancelled") return;
|
||||
writeLine(`! ${result.remediation ?? "Setup needs attention."}`);
|
||||
outro(
|
||||
`Run \`${cliInvocation()} doctor\` for the remaining checks.`,
|
||||
`Run \`${cliInvocation(environment)} doctor\` for the remaining checks.`,
|
||||
promptStreams,
|
||||
);
|
||||
};
|
||||
@@ -221,12 +224,13 @@ const renderKeyboardHelp = (accessible: boolean): void => {
|
||||
);
|
||||
};
|
||||
|
||||
const cliInvocation = (): string =>
|
||||
process.env.npm_command === "exec" ? "npx rea-agents" : "rea";
|
||||
const cliInvocation = (environment: Readonly<NodeJS.ProcessEnv>): string =>
|
||||
environment.npm_command === "exec" ? "npx rea-agents" : "rea";
|
||||
|
||||
const renderReadyCapabilities = (
|
||||
result: SetupResult,
|
||||
readyClients: readonly string[],
|
||||
environment: Readonly<NodeJS.ProcessEnv>,
|
||||
): void => {
|
||||
writeLine("◆ What you can do now");
|
||||
const providers = readyProviders(result);
|
||||
@@ -237,7 +241,7 @@ const renderReadyCapabilities = (
|
||||
if (result.doctor.identity?.skill.state === "aligned")
|
||||
writeLine("│ Guided reverse-engineering workflows: installed");
|
||||
writeLine(
|
||||
`│ CLI: ${cliInvocation()} ${providers.length > 0 ? "analyze /path/to/app" : "capabilities"}`,
|
||||
`│ CLI: ${cliInvocation(environment)} ${providers.length > 0 ? "analyze /path/to/app" : "capabilities"}`,
|
||||
);
|
||||
const firstClient = readyClients[0];
|
||||
if (firstClient !== undefined)
|
||||
|
||||
@@ -3,7 +3,7 @@ import { z } from "incur";
|
||||
import { compareManagedMemberPaths } from "../application/managed/ManagedMemberComparisonService.js";
|
||||
import { verifyManagedNativeBoundariesEvidence } from "../application/managed/ManagedNativeVerificationService.js";
|
||||
import { importManagedReconstructionEvidence } from "../application/managed/ManagedReconstructionService.js";
|
||||
import { runProviderAnalysis } from "../composition/directAnalysis.js";
|
||||
import type { DirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import { parseCliJsonInput } from "../cliJsonInput.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
@@ -15,10 +15,11 @@ import { registerProjectManagedApplicationGraph } from "./managedProjectGraphCom
|
||||
export const registerManagedCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
registerInspectManagedArtifact(cli, logger);
|
||||
registerInspectManagedMembers(cli, logger);
|
||||
registerInspectManagedNativeBoundaries(cli, logger);
|
||||
registerInspectManagedArtifact(cli, logger, runProviderAnalysis);
|
||||
registerInspectManagedMembers(cli, logger, runProviderAnalysis);
|
||||
registerInspectManagedNativeBoundaries(cli, logger, runProviderAnalysis);
|
||||
registerCompareManagedMembers(cli, logger);
|
||||
registerImportManagedReconstruction(cli, logger);
|
||||
registerVerifyManagedNativeBoundaries(cli, logger);
|
||||
@@ -28,6 +29,7 @@ export const registerManagedCommands = (
|
||||
const registerInspectManagedArtifact = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.inspectManagedArtifact, {
|
||||
description: "Inspect PE/CLI identity without loading target code",
|
||||
@@ -44,6 +46,7 @@ const registerInspectManagedArtifact = (
|
||||
const registerInspectManagedMembers = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.inspectManagedMembers, {
|
||||
description:
|
||||
@@ -61,6 +64,7 @@ const registerInspectManagedMembers = (
|
||||
const registerInspectManagedNativeBoundaries = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.inspectManagedNativeBoundaries, {
|
||||
description:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "incur";
|
||||
|
||||
import { runProviderAnalysis } from "../composition/directAnalysis.js";
|
||||
import type { DirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { parseCliJsonInput } from "../cliJsonInput.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
@@ -17,6 +17,7 @@ const OPERATION = "observe_native_calls";
|
||||
export const registerNativeCallCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.observeNativeCalls, {
|
||||
description:
|
||||
|
||||
@@ -14,7 +14,7 @@ import { withCommandCancellation } from "./commandCancellation.js";
|
||||
export const registerProcessCommands = (
|
||||
cli: ReturnType<typeof Cli.create>,
|
||||
logger: Logger,
|
||||
environment: Readonly<Record<string, string | undefined>> = process.env,
|
||||
environment: Readonly<Record<string, string | undefined>>,
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.captureProcess, {
|
||||
description: "Capture one caller-selected process scenario",
|
||||
|
||||
+42
-16
@@ -11,7 +11,12 @@ import {
|
||||
} from "../application/SetupTypes.js";
|
||||
import { runSetup } from "../application/Setup.js";
|
||||
import { systemSetupHost } from "../application/SetupHost.js";
|
||||
import { isUninstallFailure, runUninstall } from "../application/Uninstall.js";
|
||||
import {
|
||||
isUninstallFailure,
|
||||
runUninstall,
|
||||
systemUninstallHost,
|
||||
} from "../application/Uninstall.js";
|
||||
import { homeDirectoryFromEnvironment } from "../config/homeDirectory.js";
|
||||
import { isUpdateFailure, runUpdate } from "../application/Update.js";
|
||||
import { systemUpdateHost } from "../application/UpdateRuntime.js";
|
||||
import {
|
||||
@@ -39,13 +44,18 @@ const supportedClientSchema = z
|
||||
export const registerSetupCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
environment: Readonly<NodeJS.ProcessEnv>,
|
||||
): void => {
|
||||
registerSetupCommand(cli, logger);
|
||||
registerDoctorCommand(cli, logger);
|
||||
registerMaintenanceCommands(cli, logger);
|
||||
registerSetupCommand(cli, logger, environment);
|
||||
registerDoctorCommand(cli, logger, environment);
|
||||
registerMaintenanceCommands(cli, logger, environment);
|
||||
};
|
||||
|
||||
const registerSetupCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerSetupCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
environment: Readonly<NodeJS.ProcessEnv>,
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.setup, {
|
||||
description: "Configure agent integrations and optional analysis providers",
|
||||
outputPolicy: "agent-only",
|
||||
@@ -86,13 +96,17 @@ const registerSetupCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
logCliCommand(
|
||||
logger,
|
||||
CLI_COMMANDS.setup,
|
||||
() => runSetupCommand({ options, formatExplicit }),
|
||||
() => runSetupCommand({ options, formatExplicit }, environment),
|
||||
isSetupFailure,
|
||||
),
|
||||
});
|
||||
};
|
||||
|
||||
const registerDoctorCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerDoctorCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
environment: Readonly<NodeJS.ProcessEnv>,
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.doctor, {
|
||||
description: "Check whether REA is ready",
|
||||
options: z.object({
|
||||
@@ -114,7 +128,7 @@ const registerDoctorCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
logCliCommand(logger, "doctor", () =>
|
||||
runDoctor(
|
||||
options.target,
|
||||
createSystemDoctorHost(),
|
||||
createSystemDoctorHost(environment),
|
||||
doctorScope(options),
|
||||
),
|
||||
),
|
||||
@@ -124,6 +138,7 @@ const registerDoctorCommand = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerMaintenanceCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
environment: Readonly<NodeJS.ProcessEnv>,
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.uninstall, {
|
||||
description: "Remove REA-owned agent configuration and skill files",
|
||||
@@ -138,7 +153,15 @@ const registerMaintenanceCommands = (
|
||||
logCliCommand(
|
||||
logger,
|
||||
"uninstall",
|
||||
() => runUninstall(options.purgeData),
|
||||
() =>
|
||||
runUninstall(
|
||||
options.purgeData,
|
||||
systemUninstallHost(
|
||||
homeDirectoryFromEnvironment(environment, process.platform),
|
||||
undefined,
|
||||
environment,
|
||||
),
|
||||
),
|
||||
isUninstallFailure,
|
||||
),
|
||||
});
|
||||
@@ -152,7 +175,7 @@ const registerMaintenanceCommands = (
|
||||
() =>
|
||||
runUpdate(
|
||||
PRODUCT_IDENTITY.packageVersion,
|
||||
systemUpdateHost(),
|
||||
systemUpdateHost(undefined, undefined, environment),
|
||||
formatExplicit ? "structured" : "human",
|
||||
),
|
||||
isUpdateFailure,
|
||||
@@ -170,22 +193,25 @@ interface SetupCommandOptions {
|
||||
readonly accessible: boolean;
|
||||
}
|
||||
|
||||
const runSetupCommand = async (input: {
|
||||
readonly options: SetupCommandOptions;
|
||||
readonly formatExplicit: boolean;
|
||||
}) => {
|
||||
const runSetupCommand = async (
|
||||
input: {
|
||||
readonly options: SetupCommandOptions;
|
||||
readonly formatExplicit: boolean;
|
||||
},
|
||||
environment: Readonly<NodeJS.ProcessEnv>,
|
||||
) => {
|
||||
const { options } = input;
|
||||
const interactive = setupIsInteractive(options, input.formatExplicit);
|
||||
const hasExplicitScope = setupHasExplicitScope(options);
|
||||
const result = await runSetup(
|
||||
setupRunOptions(input, interactive, hasExplicitScope),
|
||||
systemSetupHost(createSystemDoctorHost()),
|
||||
systemSetupHost(createSystemDoctorHost(environment), environment),
|
||||
interactive
|
||||
? (actions, context) =>
|
||||
confirmInteractiveSetup(actions, options.accessible, context)
|
||||
: undefined,
|
||||
);
|
||||
if (interactive) renderInteractiveSetupResult(result);
|
||||
if (interactive) renderInteractiveSetupResult(result, environment);
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
+24
-12
@@ -1,10 +1,6 @@
|
||||
import { z } from "incur";
|
||||
|
||||
import {
|
||||
runCapabilityStatus,
|
||||
runProviderAnalysis,
|
||||
runProviderStatus,
|
||||
} from "../composition/directAnalysis.js";
|
||||
import type { DirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import { importReferenceSource } from "../application/ReferenceSourceImport.js";
|
||||
import { projectReferenceSourceImportError } from "../application/ReferenceSourceImportTypes.js";
|
||||
import { parseConfig } from "../config.js";
|
||||
@@ -25,11 +21,16 @@ import { registerNativeCallCommands } from "./nativeCallCommands.js";
|
||||
export const registerUtilityCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
environment: Readonly<Record<string, string | undefined>> = process.env,
|
||||
environment: Readonly<Record<string, string | undefined>>,
|
||||
analysis: Pick<
|
||||
DirectAnalysis,
|
||||
"runProviderAnalysis" | "runProviderStatus" | "runCapabilityStatus"
|
||||
>,
|
||||
): void => {
|
||||
registerCapabilityCommands(cli, logger);
|
||||
registerNativeCommands(cli, logger);
|
||||
registerNativeCallCommands(cli, logger);
|
||||
const { runProviderAnalysis } = analysis;
|
||||
registerCapabilityCommands(cli, logger, analysis);
|
||||
registerNativeCommands(cli, logger, runProviderAnalysis);
|
||||
registerNativeCallCommands(cli, logger, runProviderAnalysis);
|
||||
for (const [command, operation] of [
|
||||
[CLI_COMMANDS.observeNativeUi, "observe_native_ui"],
|
||||
[CLI_COMMANDS.captureNativeUiScenario, "capture_native_ui_scenario"],
|
||||
@@ -125,7 +126,14 @@ const invalidNativeUiScenarioInput = (
|
||||
...projectAnalysisError(new AnalysisInputError(operation, undefined, issues)),
|
||||
});
|
||||
|
||||
const registerCapabilityCommands = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerCapabilityCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
{
|
||||
runProviderStatus,
|
||||
runCapabilityStatus,
|
||||
}: Pick<DirectAnalysis, "runProviderStatus" | "runCapabilityStatus">,
|
||||
): void => {
|
||||
for (const command of [
|
||||
CLI_COMMANDS.capabilities,
|
||||
CLI_COMMANDS.providers,
|
||||
@@ -145,7 +153,11 @@ const registerCapabilityCommands = (cli: CliInstance, logger: Logger): void => {
|
||||
}
|
||||
};
|
||||
|
||||
const registerNativeCommands = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerNativeCommands = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
runProviderAnalysis: DirectAnalysis["runProviderAnalysis"],
|
||||
): void => {
|
||||
for (const [command, tool] of [
|
||||
[CLI_COMMANDS.inspectMacho, "inspect_macho"],
|
||||
[CLI_COMMANDS.inspectSignature, "inspect_signature"],
|
||||
@@ -205,7 +217,7 @@ const registerNativeCommands = (cli: CliInstance, logger: Logger): void => {
|
||||
const registerReferenceSourceCommand = (
|
||||
cli: CliInstance,
|
||||
logger: Logger,
|
||||
environment: Readonly<Record<string, string | undefined>> = process.env,
|
||||
environment: Readonly<Record<string, string | undefined>>,
|
||||
): void => {
|
||||
cli.command(CLI_COMMANDS.importReferenceSource, {
|
||||
description: "Import a source tree as historical reference only",
|
||||
|
||||
Reference in New Issue
Block a user