MCPcopy
hub / github.com/promptfoo/promptfoo / evalSetupCommand

Function evalSetupCommand

src/commands/evalSetup.ts:9–41  ·  view source on GitHub ↗
(program: Command)

Source from the content-addressed store, hash-verified

7import type { Command } from 'commander';
8
9export function evalSetupCommand(program: Command) {
10 program
11 .command('setup [configDirectory]')
12 .description('Start browser UI and open to eval setup')
13 .option('-p, --port <number>', 'Port number', getDefaultPort().toString())
14 .option('--env-file, --env-path <path>', 'Path to .env file')
15 .action(
16 async (
17 directory: string | undefined,
18 cmdObj: {
19 port: number;
20 apiBaseUrl?: string;
21 envPath?: string;
22 } & Command,
23 ) => {
24 setupEnv(cmdObj.envPath);
25 telemetry.record('eval setup', {});
26
27 if (directory) {
28 setConfigDirectoryPath(directory);
29 }
30
31 const isRunning = await checkServerRunning();
32 const browserBehavior = BrowserBehavior.OPEN_TO_EVAL_SETUP;
33
34 if (isRunning) {
35 await openBrowser(browserBehavior);
36 } else {
37 await startServer(cmdObj.port, browserBehavior);
38 }
39 },
40 );
41}

Callers 2

evalSetup.test.tsFile · 0.90
mainFunction · 0.90

Calls 8

getDefaultPortFunction · 0.90
setupEnvFunction · 0.90
setConfigDirectoryPathFunction · 0.90
checkServerRunningFunction · 0.90
openBrowserFunction · 0.90
startServerFunction · 0.90
recordMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…