/** * Param derivation utilities (Core). * * Converts operation parameter definitions into the shapes required by: * - Commander.js (CLI adapter): positionals + option strings * - JSON Schema (dispatch adapter): input_schema object * * Canonical location: src/core/validation/param-utils.ts * Re-exported from: src/dispatch/lib/param-utils.ts (backward compat) * * @task T4894 * @task T4900 * @task T5706 */ interface OperationDef { gateway: string; domain: string; operation: string; description: string; tier: number; params?: ParamDef[]; [key: string]: unknown; } type ParamType = 'string' | 'number' | 'boolean' | 'array' | 'object'; interface ParamCliDef { positional?: boolean; variadic?: boolean; alias?: string; flag?: string; short?: string; hidden?: boolean; [key: string]: unknown; } interface ParamSchemaDef { name?: string; description?: string; enum?: string[]; hidden?: boolean; [key: string]: unknown; } interface ParamDef { name: string; type: ParamType; required: boolean; description: string; default?: unknown; enum?: string[]; items?: { type: ParamType; }; cli?: ParamCliDef; /** Schema config for dispatch adapter. */ dispatch?: ParamSchemaDef; } export type JsonSchemaType = 'string' | 'number' | 'boolean' | 'array' | 'object'; export interface JsonSchemaProperty { type: JsonSchemaType; description: string; enum?: readonly string[]; items?: { type: JsonSchemaType; }; } export interface JSONSchemaObject { type: 'object'; properties: Record; required: string[]; } /** * Build a JSON Schema `input_schema` object from an `OperationDef`. * * Algorithm: * 1. Iterate `def.params` * 2. Skip params where schema `dispatch.hidden === true` * 3. Map ParamType → JSON Schema type * 4. Collect names where `required === true` into `required[]` * 5. Return { type: 'object', properties, required } */ export declare function buildDispatchInputSchema(def: OperationDef): JSONSchemaObject; export interface CommanderArgSplit { /** Params that map to `.argument('')` or `.argument('[name]')`. */ positionals: ParamDef[]; /** Params that map to `.option(...)` calls. */ options: ParamDef[]; } /** * Split `OperationDef.params` into positional arguments and option flags, * suitable for Commander.js registration. * * - `cli.positional === true` → goes into `positionals[]` * - everything else with a `cli` key → goes into `options[]` * - Params with no `cli` key → dispatch-only; excluded from both arrays */ export declare function buildCommanderArgs(def: OperationDef): CommanderArgSplit; /** * Build the Commander option string for a single non-positional ParamDef. * * Examples: * { name:'taskId', type:'string', cli:{} } * → '--taskId ' * { name:'status', type:'string', cli:{short:'-s', flag:'status'} } * → '-s, --status ' * { name:'dryRun', type:'boolean', cli:{flag:'dry-run'} } * → '--dry-run' * { name:'limit', type:'number', cli:{} } * → '--limit ' */ export declare function buildCommanderOptionString(param: ParamDef): string; /** * Convert a camelCase string to kebab-case. * e.g. 'includeArchive' → 'include-archive' */ export declare function camelToKebab(s: string): string; /** * Validates that all required parameters are present in the request. * Returns an array of missing parameter names. * * Replaces the old `requiredParams: string[]` check in registry.ts. */ export declare function validateRequiredParamsDef(def: OperationDef, params?: Record): string[]; export {}; //# sourceMappingURL=param-utils.d.ts.map