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 / agents-md / tests / fixtures / project-of.ts
31 lines · 922 BRaw
1import type { FsAncestor, On } from 'claude-code'
2
3import { startedOf } from './started-of.js'
4import type { Started } from './types'
5
6/**
7 * A project whose walks up from the working directory find the given files,
8 * one list per set of names, its session starting untouched (startedOf);
9 * each walk's first name is kept in `walks`.
10 *
11 * @param on the test's `on`
12 * @param agents what a walk for AGENTS.md and .claude/AGENTS.md finds
13 * @param claude what a walk for CLAUDE.md, .claude/CLAUDE.md and
14 * CLAUDE.local.md finds
15 * @returns the toasts, lines and walks the plugins raised, in order
16 */
17export function projectOf(
18 on: On,
19 agents: readonly FsAncestor[],
20 claude: readonly FsAncestor[],
21): Started {
22 const started = startedOf(on)
23
24 on('fs.ancestors', ($, e) => {
25 started.walks.push(e.names[0] ?? '')
26
27 return { value: e.names.includes('AGENTS.md') ? agents : claude }
28 })
29
30 return started
31}