Keep failed JSON read handles in the existing server resource scope and fail admission until cleanup succeeds. Thread cancellation through every process CLI input read and replace timer-driven cancellation checks with a shared first-read gate. Classify authenticated standalone Evidence as wrong-kind input while preserving tampered-record integrity failures and actionable messages across ledger, CLI, and MCP consumers. Record unrelated CS_RESTRICT process neighbors as unverified without weakening related-process ownership checks. Update stale ADB fixtures for the actual shell protocol. Validated focused CLI, MCP, filesystem, ownership, and error projection tests; static, docs, and duplication gates pass. The host-level CS_RESTRICT load reproduction was not run. Refs #2050, #2035, #2064.
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import { Cli, z } from "incur";
|
|
|
|
import {
|
|
captureProcessScenarioFile,
|
|
compareProcessEvidenceFiles,
|
|
isProcessCliFailure,
|
|
} from "../application/process/ProcessCli.js";
|
|
import { logCliCommand } from "../cliLogging.js";
|
|
import type { Logger } from "pino";
|
|
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
|
import { withCommandCancellation } from "./commandCancellation.js";
|
|
|
|
/** Register direct process capture and comparison commands. */
|
|
export const registerProcessCommands = (
|
|
cli: ReturnType<typeof Cli.create>,
|
|
logger: Logger,
|
|
environment: Readonly<Record<string, string | undefined>>,
|
|
): void => {
|
|
cli.command(CLI_COMMANDS.captureProcess, {
|
|
description: "Capture one caller-selected process scenario",
|
|
args: z.object({ scenario: z.string().describe("Scenario JSON path") }),
|
|
run: ({ args }) =>
|
|
withCommandCancellation((signal) =>
|
|
logCliCommand(
|
|
logger,
|
|
"capture-process",
|
|
() => captureProcessScenarioFile(args.scenario, environment, signal),
|
|
isProcessCliFailure,
|
|
),
|
|
),
|
|
});
|
|
cli.command(CLI_COMMANDS.compareProcessCaptures, {
|
|
description: "Compare two process capture Evidence JSON files",
|
|
args: z.object({
|
|
left: z.string().describe("Left capture Evidence JSON path"),
|
|
right: z.string().describe("Right capture Evidence JSON path"),
|
|
traceSpec: z
|
|
.string()
|
|
.optional()
|
|
.describe("Optional partial-order or finite-trace specification path"),
|
|
}),
|
|
run: ({ args }) =>
|
|
withCommandCancellation((signal) =>
|
|
logCliCommand(
|
|
logger,
|
|
"compare-process-captures",
|
|
() =>
|
|
compareProcessEvidenceFiles(
|
|
args.left,
|
|
args.right,
|
|
args.traceSpec,
|
|
signal,
|
|
),
|
|
isProcessCliFailure,
|
|
),
|
|
),
|
|
});
|
|
};
|