* fix(comparisons)!: preserve unknowns across partial observations Share absence and digest semantics, keep unobserved managed bodies unknown, and match unique managed type/name/signatures before structural fallback. BREAKING CHANGE: Managed comparison metadata adds exact-signature matching and its count, and name_matching now reports exact-signature-fallback. * fix(javascript): preserve projected result binding semantics Share syntax-aware property reads and assigned-result resolution. Retain destructuring paths and downgrade downstream whole-result relationships instead of resolving nested or wrapped calls as aliases. * fix(native)!: admit complete parser values and preserve typed failures Decode Mach headers by named columns, validate complete slice keys and lipo alignment, and preserve codesign runtime flags and tagged parser errors. Rename the Ghidra test dossier fixture and connect fake-backed suites to real verification lanes. BREAKING CHANGE: Native load-command results no longer contain the unused, always-null file_offset field. * fix(process): preserve host identity and actionable boundary failures Thread selected platform and environment through process and Doctor seams, stamp observed producer identity in Evidence, and retain PTY, filesystem, lease and lazy-provider failure causes. Drain cancelled lazy loads and omit exited descendants from verified lineage. * fix(browser): preserve cleanup and document-transition evidence Make V8 and Playwright teardown cancellation-aware, expose primary failures alongside incomplete cleanup, share frame-tree and navigation rules, and clear stale WebMCP registrations without pruning unrelated child frames. * fix(adapters): align managed targets and typed CLI outcomes Inspect managed PE/CLI targets independently of native provider selection, reuse successful managed selections, and keep evidence bound to the actual inspected target. Classify canonical CLI error envelopes and exhaustive setup/update/uninstall outcomes, audit registered CLI coverage, and assert platform-specific runtime results. * docs: refresh boundary contracts and shipped roadmap behavior
161 lines
5.5 KiB
TypeScript
161 lines
5.5 KiB
TypeScript
import { z } from "incur";
|
|
|
|
import { compareManagedMemberPaths } from "../application/ManagedMemberComparisonService.js";
|
|
import { verifyManagedNativeBoundariesEvidence } from "../application/ManagedNativeVerificationService.js";
|
|
import { importManagedReconstructionEvidence } from "../application/ManagedReconstructionService.js";
|
|
import { runProviderAnalysis } from "../application/DirectAnalysis.js";
|
|
import { parseCliJsonInput } from "../cliJsonInput.js";
|
|
import { projectAnalysisError } from "../domain/errors.js";
|
|
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
|
import { logCliCommand } from "../cliLogging.js";
|
|
import type { Logger } from "../logger.js";
|
|
import type { CliInstance } from "./types.js";
|
|
import { registerProjectManagedApplicationGraph } from "./managedProjectGraphCommand.js";
|
|
|
|
export const registerManagedCommands = (
|
|
cli: CliInstance,
|
|
logger: Logger,
|
|
): void => {
|
|
registerInspectManagedArtifact(cli, logger);
|
|
registerInspectManagedMembers(cli, logger);
|
|
registerInspectManagedNativeBoundaries(cli, logger);
|
|
registerCompareManagedMembers(cli, logger);
|
|
registerImportManagedReconstruction(cli, logger);
|
|
registerVerifyManagedNativeBoundaries(cli, logger);
|
|
registerProjectManagedApplicationGraph(cli, logger);
|
|
};
|
|
|
|
const registerInspectManagedArtifact = (
|
|
cli: CliInstance,
|
|
logger: Logger,
|
|
): void => {
|
|
cli.command(CLI_COMMANDS.inspectManagedArtifact, {
|
|
description: "Inspect PE/CLI identity without loading target code",
|
|
args: z.object({
|
|
path: z.string().describe("Managed PE executable or assembly path"),
|
|
}),
|
|
run: ({ args }) =>
|
|
logCliCommand(logger, "inspect-managed-artifact", () =>
|
|
runProviderAnalysis(args.path, "inspect_managed_artifact", {}, logger),
|
|
),
|
|
});
|
|
};
|
|
|
|
const registerInspectManagedMembers = (
|
|
cli: CliInstance,
|
|
logger: Logger,
|
|
): void => {
|
|
cli.command(CLI_COMMANDS.inspectManagedMembers, {
|
|
description:
|
|
"Inspect PE/CLI metadata members, signatures, and CIL anchors without loading target code",
|
|
args: z.object({
|
|
path: z.string().describe("Managed PE executable or assembly path"),
|
|
}),
|
|
run: ({ args }) =>
|
|
logCliCommand(logger, "inspect-managed-members", () =>
|
|
runProviderAnalysis(args.path, "inspect_managed_members", {}, logger),
|
|
),
|
|
});
|
|
};
|
|
|
|
const registerInspectManagedNativeBoundaries = (
|
|
cli: CliInstance,
|
|
logger: Logger,
|
|
): void => {
|
|
cli.command(CLI_COMMANDS.inspectManagedNativeBoundaries, {
|
|
description:
|
|
"Inspect PE/CLI PInvoke and native implementation boundary declarations without loading target code",
|
|
args: z.object({
|
|
path: z.string().describe("Managed PE executable or assembly path"),
|
|
}),
|
|
run: ({ args }) =>
|
|
logCliCommand(logger, "inspect-managed-native-boundaries", () =>
|
|
runProviderAnalysis(
|
|
args.path,
|
|
"inspect_managed_native_boundaries",
|
|
{},
|
|
logger,
|
|
),
|
|
),
|
|
});
|
|
};
|
|
|
|
const compareManagedMemberArgs = z.object({
|
|
leftPath: z.string().describe("Baseline managed PE executable or assembly"),
|
|
rightPath: z.string().describe("Candidate managed PE executable or assembly"),
|
|
});
|
|
|
|
const registerCompareManagedMembers = (
|
|
cli: CliInstance,
|
|
logger: Logger,
|
|
): void => {
|
|
cli.command(CLI_COMMANDS.compareManagedMembers, {
|
|
description:
|
|
"Compare managed PE/CLI member inventories by exact declared type, name, and signature; names alone never form a match",
|
|
args: compareManagedMemberArgs,
|
|
run: ({ args }) =>
|
|
logCliCommand(logger, "compare-managed-members", async () => {
|
|
const result = await compareManagedMemberPaths({
|
|
leftPath: args.leftPath,
|
|
rightPath: args.rightPath,
|
|
});
|
|
return result.ok
|
|
? result.value
|
|
: {
|
|
error: "Managed member comparison failed",
|
|
...projectAnalysisError(result.error),
|
|
};
|
|
}),
|
|
});
|
|
};
|
|
|
|
const registerImportManagedReconstruction = (
|
|
cli: CliInstance,
|
|
logger: Logger,
|
|
): void => {
|
|
cli.command(CLI_COMMANDS.importManagedReconstruction, {
|
|
description:
|
|
"Import decompiler-produced managed reconstruction against exact static member evidence",
|
|
args: z.object({
|
|
inputJson: z
|
|
.string()
|
|
.describe("Inline managed reconstruction JSON or JSON file path"),
|
|
}),
|
|
run: ({ args }) =>
|
|
logCliCommand(logger, "import-managed-reconstruction", async () => {
|
|
const input = await parseCliJsonInput(
|
|
args.inputJson,
|
|
"import-managed-reconstruction",
|
|
);
|
|
if (!input.ok) return input.error;
|
|
const result = importManagedReconstructionEvidence(input.value);
|
|
return result.ok ? result.value : projectAnalysisError(result.error);
|
|
}),
|
|
});
|
|
};
|
|
|
|
const registerVerifyManagedNativeBoundaries = (
|
|
cli: CliInstance,
|
|
logger: Logger,
|
|
): void => {
|
|
cli.command(CLI_COMMANDS.verifyManagedNativeBoundaries, {
|
|
description:
|
|
"Verify managed P/Invoke declarations against authenticated native Evidence",
|
|
args: z.object({
|
|
inputJson: z
|
|
.string()
|
|
.describe("Inline managed/native verification JSON or JSON file path"),
|
|
}),
|
|
run: ({ args }) =>
|
|
logCliCommand(logger, "verify-managed-native-boundaries", async () => {
|
|
const input = await parseCliJsonInput(
|
|
args.inputJson,
|
|
"verify-managed-native-boundaries",
|
|
);
|
|
if (!input.ok) return input.error;
|
|
const result = verifyManagedNativeBoundariesEvidence(input.value);
|
|
return result.ok ? result.value : projectAnalysisError(result.error);
|
|
}),
|
|
});
|
|
};
|