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 / policy-reads.ts
21 lines · 477 BRaw
1import type { On, Settings } from 'claude-code'
2
3/**
4 * Answers every settings read beneath the plugins with the policy given,
5 * counting the reads.
6 *
7 * @param on the test's `on`
8 * @param policy the managed settings in force
9 * @returns how many reads reached the bottom so far
10 */
11export function policyReads(on: On, policy: Settings): () => number {
12 let reads = 0
13
14 on('settings.read', () => {
15 reads += 1
16
17 return { value: policy }
18 })
19
20 return () => reads
21}