(value: unknown, suites: SuiteRegistry)
| 103 | |
| 104 | /** Parses and resolves `defaults.executor.config` for the gh-agent executor. */ |
| 105 | export function parseExecutorConfig(value: unknown, suites: SuiteRegistry): ExecutorConfig { |
| 106 | const config = record(value); |
| 107 | const unknown = Object.keys(config).filter(key => key !== "suite" && key !== "scenario"); |
| 108 | if (unknown.length) throw new Error(`gh-agent config has unknown field(s): ${unknown.join(", ")}`); |
| 109 | const suite = typeof config.suite === "string" && Object.hasOwn(suites, config.suite) ? suites[config.suite] : undefined; |
| 110 | if (!suite) throw new Error(`gh-agent config.suite must be one of: ${Object.keys(suites).join(", ")}`); |
| 111 | if (typeof config.scenario !== "string" || !suite.scenarios.includes(config.scenario)) { |
| 112 | throw new Error(`gh-agent config.scenario must be one of: ${suite.scenarios.join(", ")}`); |
| 113 | } |
| 114 | return { suite, scenario: config.scenario }; |
| 115 | } |
| 116 | |
| 117 | /** Substitutes `{{NAME}}` placeholders, refusing prompts that need a value the fixture does not provide. */ |
| 118 | export function resolvePrompt(prompt: string, placeholders: Readonly<Record<string, string>>): string { |
no test coverage detected