(
workflow: string,
cliToolName: string,
args: Record<string, unknown>,
invokeOptions: SnapshotInvokeOptions = {},
)
| 129 | options: CreateSnapshotHarnessOptions = {}, |
| 130 | ): Promise<SnapshotHarness> { |
| 131 | async function invoke( |
| 132 | workflow: string, |
| 133 | cliToolName: string, |
| 134 | args: Record<string, unknown>, |
| 135 | invokeOptions: SnapshotInvokeOptions = {}, |
| 136 | ): Promise<SnapshotResult> { |
| 137 | const resolved = resolveSnapshotToolManifest(workflow, cliToolName); |
| 138 | |
| 139 | if (!resolved) { |
| 140 | throw new Error(`Tool '${cliToolName}' not found in workflow '${workflow}'`); |
| 141 | } |
| 142 | |
| 143 | if (resolved.isMcpOnly) { |
| 144 | throw new Error(`Tool '${cliToolName}' in workflow '${workflow}' is not CLI-available`); |
| 145 | } |
| 146 | |
| 147 | const label = `${workflow}/${cliToolName}`; |
| 148 | const result = runSnapshotCli(workflow, cliToolName, args, 'text', options, invokeOptions); |
| 149 | assertCliSnapshotProcessResult(result, label); |
| 150 | const stdout = readProcessOutput(result.stdout); |
| 151 | |
| 152 | return { |
| 153 | text: normalizeSnapshotOutput(stdout), |
| 154 | rawText: stdout, |
| 155 | isError: result.status !== 0, |
| 156 | }; |
| 157 | } |
| 158 | |
| 159 | async function cleanup(): Promise<void> {} |
| 160 |
no test coverage detected