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.
TypeScript
import Frames from '../frames'
/**
* The project directory an instruction file speaks for: the directory
* holding it, or the one holding its `.claude` folder.
*
* @param path the file's path, absolute
* @returns the directory, in the walk's normal spelling
*/
export function projectDirOf(path: string): string {
const spelled = Frames.normalSpellingOf(path)
const claudeAt = spelled.lastIndexOf('/.claude/')
const cut = claudeAt === -1 ? spelled.lastIndexOf('/') : claudeAt
return cut <= 0 ? '/' : spelled.slice(0, cut)
}