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 / is-below.ts
12 lines · 468 BRaw
1import { normalSpellingOf } from './normal-spelling-of.js'
2
3/**
4 * Whether a path lies strictly inside a directory, by spelling (no links
5 * followed), as the engine bounds its nested CLAUDE.md walk.
6 *
7 * @param path an absolute path
8 * @param dir an absolute directory
9 * @returns true when `path` is under `dir` and not `dir` itself
10 */
11export const isBelow = (path: string, dir: string): boolean =>
12 normalSpellingOf(path).startsWith(`${normalSpellingOf(dir)}/`)