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-by-source.ts
15 lines · 517 BRaw
1import type { On, Settings } from 'claude-code'
2
3/**
4 * Answers a read of the policy source with one settings object and every
5 * other read, a named source or the merge, with another.
6 *
7 * @param on the test's `on`
8 * @param policy what `{ source: "policy" }` reads
9 * @param others what any other read answers
10 * @returns the registration
11 */
12export const policyBySource = (on: On, policy: Settings, others: Settings) =>
13 on('settings.read', ($, e) => ({
14 value: e.source === 'policy' ? policy : others,
15 }))