Skip to content

Commit ef22041

Browse files
authored
feat(cli): add version check to studio/serve commands (#1131)
* feat(cli): add version check to studio/serve commands Enforce `required_version` from `.agentv/config.yaml` before starting Studio so the dashboard matches `agentv eval` behavior. Interactive TTY prompts to update; non-interactive warns to stderr and continues. Closes #1128 * docs(cli): document version check in studio/serve file header Address review feedback: reflect the new startup-time version enforcement in the module's header JSDoc, and reword the inline comment to describe the multi-project limitation without referencing an external issue number.
1 parent df5c338 commit ef22041

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

apps/cli/src/commands/results/serve.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
* variants. They share handler functions via DataContext, differing only in
2020
* how searchDir is resolved.
2121
*
22+
* Before starting the server, the command enforces `required_version` from
23+
* the cwd's `.agentv/config.yaml` (single-project scope) via
24+
* `enforceRequiredVersion()`, matching the behavior of `agentv eval`.
25+
*
2226
* Exported functions (for testing):
2327
* - resolveSourceFile(source, cwd) — resolves a run manifest path
2428
* - loadResults(content) — parses JSONL into EvaluationResult[]
@@ -37,14 +41,17 @@ import {
3741
discoverBenchmarks,
3842
getBenchmark,
3943
loadBenchmarkRegistry,
44+
loadConfig,
4045
removeBenchmark,
4146
} from '@agentv/core';
4247
import type { Context } from 'hono';
4348
import { Hono } from 'hono';
4449

50+
import { enforceRequiredVersion } from '../../version-check.js';
4551
import { parseJsonlResults } from '../eval/artifact-writer.js';
4652
import { resolveRunManifestPath } from '../eval/result-layout.js';
4753
import { loadRunCache, resolveRunCacheFile } from '../eval/run-cache.js';
54+
import { findRepoRoot } from '../eval/shared.js';
4855
import { listResultFiles } from '../inspect/utils.js';
4956
import { registerEvalRoutes } from './eval-runner.js';
5057
import {
@@ -1449,6 +1456,18 @@ export const resultsServeCommand = command({
14491456
return;
14501457
}
14511458

1459+
// ── Version check ────────────────────────────────────────────────
1460+
// Enforce `required_version` from .agentv/config.yaml so Studio/serve
1461+
// match `agentv eval` behavior. Same prompt in TTY, warn+continue
1462+
// otherwise. Single-project scope only — when one agentv instance
1463+
// serves multiple repos with differing version requirements, a
1464+
// per-project local install is required instead.
1465+
const repoRoot = await findRepoRoot(cwd);
1466+
const yamlConfig = await loadConfig(path.join(cwd, '_'), repoRoot);
1467+
if (yamlConfig?.required_version) {
1468+
await enforceRequiredVersion(yamlConfig.required_version);
1469+
}
1470+
14521471
// ── Determine multi-project mode ────────────────────────────────
14531472
const registry = loadBenchmarkRegistry();
14541473
const { isMultiProject, showMultiWarning } = resolveDashboardMode(registry.benchmarks.length, {

0 commit comments

Comments
 (0)