mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 19:53:50 +00:00
* refactor(contracts): move the CLI command name owner into src/contracts * refactor(contracts): own catalog identity in contracts and server identity in process (#11435) * refactor(contracts): move catalog identity into contracts and server identity into process * refactor(contracts): own the advertised MCP schema presentation in contracts * test(mcp): import the advertised presentation from contracts in toolSchemaValidity * test(release): expect the catalog identity at its contracts path in the canary * test(mcp): import the catalog identity from contracts in syntheticContractSurfaces * refactor(contracts): import CLI command names from contracts in the capability conformance test
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import { registerManagedCommands } from "../../src/cli/managedCommands.js";
|
|
import { cliCommandFor } from "../../src/contracts/cliCommandNames.js";
|
|
import { createDirectAnalysis } from "../../src/composition/directAnalysis.js";
|
|
import type { DirectAnalysis } from "../../src/composition/directAnalysis.js";
|
|
import { silentLogger } from "../../src/logger.js";
|
|
|
|
type ManagedEvidenceRunner = DirectAnalysis["runManagedProviderEvidence"];
|
|
|
|
/**
|
|
* The registered compare-managed-members command, run in this process with
|
|
* the production managed Evidence runner unless a test supplies one.
|
|
*/
|
|
export const managedComparisonCommand = (
|
|
runManagedProviderEvidence: ManagedEvidenceRunner = createDirectAnalysis({})
|
|
.runManagedProviderEvidence,
|
|
) => {
|
|
let registered:
|
|
| { run(input: unknown): Promise<Record<string, unknown>> }
|
|
| undefined;
|
|
const cli = {
|
|
command: (
|
|
name: string,
|
|
definition: { run(input: unknown): Promise<Record<string, unknown>> },
|
|
) => {
|
|
if (name === cliCommandFor("compare_managed_members"))
|
|
registered = definition;
|
|
return cli;
|
|
},
|
|
} as unknown as Parameters<typeof registerManagedCommands>[0];
|
|
registerManagedCommands(cli, silentLogger, {
|
|
runProviderAnalysis: () => {
|
|
throw new Error("Comparison runs only managed Evidence");
|
|
},
|
|
runManagedProviderEvidence,
|
|
});
|
|
const command = registered;
|
|
if (command === undefined)
|
|
throw new Error("compare-managed-members is not registered");
|
|
/** Run the command as argv would select it, returning its JSON output. */
|
|
return (
|
|
leftPath: string,
|
|
rightPath: string,
|
|
options: Readonly<Record<string, unknown>> = {},
|
|
): Promise<Record<string, unknown>> =>
|
|
command.run({ args: { leftPath, rightPath }, options });
|
|
};
|