mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +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
60 lines
2.1 KiB
TypeScript
60 lines
2.1 KiB
TypeScript
/** The kebab-case spelling of a contract name, which names its CLI command. */
|
|
export type CliCommandName<Name extends string> =
|
|
Name extends `${infer Head}_${infer Tail}`
|
|
? `${Head}-${CliCommandName<Tail>}`
|
|
: Name;
|
|
|
|
/**
|
|
* The CLI command of a contract that declares `cli: true`. The contract
|
|
* registry owns these names; `CLI_COMMANDS` holds only the commands no
|
|
* contract names.
|
|
*/
|
|
export const cliCommandFor = <Name extends string>(
|
|
name: Name,
|
|
): CliCommandName<Name> => name.replaceAll("_", "-") as CliCommandName<Name>;
|
|
|
|
/** Names of the CLI commands that no contract names. */
|
|
export const CLI_COMMANDS = Object.freeze({
|
|
analyze: "analyze",
|
|
inspect: "inspect",
|
|
decompile: "decompile",
|
|
setup: "setup",
|
|
doctor: "doctor",
|
|
uninstall: "uninstall",
|
|
update: "update",
|
|
trace: "trace",
|
|
capabilities: "capabilities",
|
|
providers: "providers",
|
|
guidance: "guidance",
|
|
function: "function",
|
|
instructions: "instructions",
|
|
search: "search",
|
|
importReferenceSource: "import-reference-source",
|
|
listObjdumpArchitectures: "list-objdump-architectures",
|
|
debugWithGdb: "debug-with-gdb",
|
|
debugWithRizin: "debug-with-rizin",
|
|
inspectEvidenceBundle: "inspect-evidence-bundle",
|
|
evidenceImport: "evidence-import",
|
|
evidenceExport: "evidence-export",
|
|
environmentServe: "environment-serve",
|
|
environmentExport: "environment-export",
|
|
environmentCompare: "environment-compare",
|
|
environmentBuild: "environment-build",
|
|
compare: "compare",
|
|
captureProcess: "capture-process",
|
|
captureDesktopApplication: "capture-desktop-application",
|
|
inspectDesktopApplicationState: "inspect-desktop-application-state",
|
|
exportDesktopApplication: "export-desktop-application",
|
|
describeDesktopApplicationTask: "describe-desktop-application-task",
|
|
validateBrowserScenario: "validate-browser-scenario",
|
|
});
|
|
|
|
/**
|
|
* Commands that announce their progress at info level when REA_LOG_LEVEL is
|
|
* unset, like `rea mcp --http`. Their logger writes to stderr directly.
|
|
*/
|
|
export const DEFAULT_INFO_LOGGING_COMMANDS: ReadonlySet<string> = new Set([
|
|
CLI_COMMANDS.environmentServe,
|
|
CLI_COMMANDS.environmentBuild,
|
|
]);
|