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 / hooks / frames / outside-claude-dirs.ts
21 lines · 690 BRaw
1import type { FsAncestor } from 'claude-code'
2
3/**
4 * The AGENTS.md files standing in a directory with no CLAUDE.md of its own,
5 * in walk order.
6 *
7 * Where the engine attaches a directory's CLAUDE.md, that directory's
8 * AGENTS.md is left out rather than merged.
9 *
10 * @param agents the AGENTS.md files of a walk, root first
11 * @param claude the CLAUDE.md files of the same walk
12 * @returns the AGENTS.md files whose directory holds no CLAUDE.md
13 */
14export function outsideClaudeDirs(
15 agents: readonly FsAncestor[],
16 claude: readonly FsAncestor[],
17): readonly FsAncestor[] {
18 const taken = new Set(claude.map(file => file.dir))
19
20 return agents.filter(file => !taken.has(file.dir))
21}