Skip to content

Commit 96bb8a9

Browse files
committed
feat: support wcs run with a different reports directory
Supports `wcs run` with a different reports directory.
1 parent 0032223 commit 96bb8a9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

runner/run-cli.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {BUILT_IN_ENVIRONMENTS, LLM_OUTPUT_DIR} from './configuration/constants.j
66
import {UserFacingError} from './utils/errors.js';
77
import {existsSync, rmSync} from 'fs';
88
import {readFile, readdir} from 'fs/promises';
9-
import {join} from 'path';
9+
import {join, resolve} from 'path';
1010
import {glob} from 'tinyglobby';
1111
import {LlmResponseFile} from './shared-interfaces.js';
1212
import {setupProjectStructure, writeResponseFiles} from './orchestration/file-system.js';
@@ -26,6 +26,7 @@ export const RunModule = {
2626
interface Options {
2727
environment: string;
2828
prompt: string;
29+
reportsDirectory?: string;
2930
}
3031

3132
function builder(argv: Argv): Argv<Options> {
@@ -41,6 +42,11 @@ function builder(argv: Argv): Argv<Options> {
4142
default: '',
4243
description: 'ID of the prompt within the environment that should be run',
4344
})
45+
.option('reports-directory', {
46+
type: 'string',
47+
description: 'Path from which to read local reports',
48+
demandOption: false,
49+
})
4450
.version(false)
4551
.help();
4652
}
@@ -129,7 +135,7 @@ async function resolveConfig(options: Options) {
129135
BUILT_IN_ENVIRONMENTS.get(options.environment) || options.environment,
130136
'genkit',
131137
);
132-
const environmentDir = join(LLM_OUTPUT_DIR, environment.id);
138+
const environmentDir = resolve(options.reportsDirectory ?? LLM_OUTPUT_DIR, environment.id);
133139

134140
if (!existsSync(environmentDir)) {
135141
throw new UserFacingError(

0 commit comments

Comments
 (0)