Skip to content

Commit 23567a2

Browse files
committed
fix(prepare): apply matching eval-local target hooks
1 parent f5efa28 commit 23567a2

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎apps/cli/src/commands/prepare/index.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,18 @@ async function prepareAttempt(options: {
273273
throw new Error(`Test ID '${options.testId}' not found in ${evalPath}`);
274274
}
275275

276+
const targetRefs =
277+
suite.targetSpec?.hooks !== undefined && suite.targetSpec.name === options.target
278+
? [
279+
...(suite.targetRefs ?? []),
280+
{ name: suite.targetSpec.name, hooks: suite.targetSpec.hooks },
281+
]
282+
: suite.targetRefs;
276283
const { resolvedTarget, targetHooks } = await selectPrepareTarget({
277284
evalPath,
278285
repoRoot,
279286
target: options.target,
280-
targetRefs: suite.targetRefs,
287+
targetRefs,
281288
});
282289

283290
const prepared = await prepareEvalWorkspace({

‎apps/cli/test/commands/prepare/prepare.test.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,18 @@ describe('agentv prepare', () => {
116116

117117
const result = await execa(
118118
'bun',
119-
['--no-env-file', CLI_ENTRY, 'prepare', evalPath, '--test-id', 'case-1', '--out', outDir],
119+
[
120+
'--no-env-file',
121+
CLI_ENTRY,
122+
'prepare',
123+
evalPath,
124+
'--test-id',
125+
'case-1',
126+
'--target',
127+
'codex',
128+
'--out',
129+
outDir,
130+
],
120131
{
121132
cwd: tempDir,
122133
env: {
@@ -196,6 +207,8 @@ describe('agentv prepare', () => {
196207
evalPath,
197208
'--test-id',
198209
'case-1',
210+
'--target',
211+
'codex',
199212
'--out',
200213
outDir,
201214
'--format',

0 commit comments

Comments
 (0)