spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / sec-default / tests / fixtures / tool-check / checks-answered.ts
21 lines · 535 BRaw
1import type { EventResult, On } from 'claude-code'
2
3/**
4 * Answers every `tool.check` beneath the plugins with the verdict given, as
5 * the engine's own evaluation would, counting the evaluations.
6 *
7 * @param on the test's `on`
8 * @param verdict what the engine's evaluation decides
9 * @returns how many evaluations ran so far
10 */
11export function checksAnswered(on: On, verdict: EventResult<'tool.check'>) {
12 let evaluations = 0
13
14 on('tool.check', () => {
15 evaluations += 1
16
17 return verdict
18 })
19
20 return () => evaluations
21}