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 / diff / tests / fixtures / backend-of / recording-probe-of.ts
24 lines · 747 BRaw
1import type Backend from '../../../hooks/backend'
2import type { RecordingProbe } from './recording-probe.js'
3import { stubBackendOf } from './stub-backend-of.js'
4
5/**
6 * A backend probe that notes each host it is asked about and answers a stub
7 * backend at the toplevel, or declines (null) when given none.
8 *
9 * @param toplevel the working copy's root, or null to decline
10 * @returns the probe and the hosts it was asked about, in order
11 */
12export function recordingProbeOf(toplevel: string | null): RecordingProbe {
13 const asked: Backend.BackendHost[] = []
14 const answer = toplevel === null ? null : stubBackendOf(toplevel)
15
16 return {
17 asked,
18 probe: host => {
19 asked.push(host)
20
21 return Promise.resolve(answer)
22 },
23 }
24}