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 / caught / answering.ts
23 lines · 547 BRaw
1import type { Settings } from 'claude-code'
2
3/**
4 * A `$` whose calls are answered from the bottom: the policy given is read,
5 * and each line logged is handed on.
6 *
7 * @param policy the managed settings in force
8 * @param told what each logged line is handed to
9 * @returns the stand-in
10 */
11export const answering = (
12 policy: Settings,
13 told: (line: string) => void = () => undefined,
14) => ({
15 settings: { read: () => Promise.resolve(policy) },
16 ui: {
17 log(line: string) {
18 told(line)
19
20 return Promise.resolve()
21 },
22 },
23})