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
| 1 | import type { TelemetryDeps } from '../../telemetry-deps' |
| 2 | import Identity from '../identity' |
| 3 | import Machine from '../machine' |
| 4 | import type { Probe } from '../probe' |
| 5 | import { remoteHashOf } from '../remote-hash-of' |
| 6 | import { vcsOf } from '../vcs-of' |
| 7 | import { linuxFilesOf } from './linux-files-of' |
| 8 | |
| 9 | /** |
| 10 | * Gathers what holds for the whole session through the nouns beneath: the |
| 11 | * variables, the global config, one machine probe, the directory, the remote. |
| 12 | * |
| 13 | * Each read that fails leaves its part empty; the Linux files are read on |
| 14 | * Linux alone. |
| 15 | * |
| 16 | * @param deps the calls on the nouns beneath |
| 17 | * @param isInteractive whether a person is at the prompt |
| 18 | * @returns what was gathered, for context-of to shape |
| 19 | */ |
| 20 | export async function probeOf( |
| 21 | deps: TelemetryDeps, |
| 22 | isInteractive: boolean, |
| 23 | ): Promise<Probe> { |
| 24 | const [facts, signals, location, environment, cwd, repo] = await Promise.all([ |
| 25 | deps.facts(), |
| 26 | deps.deployment(), |
| 27 | deps.configLocation(), |
| 28 | deps.environment(), |
| 29 | deps.cwd().catch(() => undefined), |
| 30 | deps.repo().catch(() => null), |
| 31 | ]) |
| 32 | |
| 33 | const [identity, machine, vcs, remoteHash] = await Promise.all([ |
| 34 | Identity.identityOf(deps.read, location, environment.userType === 'ant'), |
| 35 | Machine.machineOf(deps.run, facts), |
| 36 | cwd === undefined ? undefined : vcsOf(deps.list, cwd, facts.hasP4Port), |
| 37 | remoteHashOf(repo?.remote), |
| 38 | ]) |
| 39 | |
| 40 | const files = await linuxFilesOf(deps, machine.platformRaw === 'linux') |
| 41 | |
| 42 | return { |
| 43 | facts, |
| 44 | signals: [...signals, ...files.fileSignals], |
| 45 | identity, |
| 46 | machine, |
| 47 | platform: Machine.platformOf(facts.hostPlatform, machine.platformRaw), |
| 48 | isInteractive, |
| 49 | distro: files.distro, |
| 50 | wslVersion: files.wslVersion, |
| 51 | vcs, |
| 52 | remoteHash, |
| 53 | } |
| 54 | } |