MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / pathIsProjectFile

Function pathIsProjectFile

src/mcp/tools.ts:233–240  ·  view source on GitHub ↗

* Does this query-named span point at a real FILE inside the project? * * The `existsOnDisk` predicate `extractQueryPaths` takes (that module is pure — * no DB, no fs — so the fs access lives here, where the project root is known). * Only a REGULAR FILE counts: a directory span (`src/search`) is

(projectRoot: string, relPath: string)

Source from the content-addressed store, hash-verified

231 * probe outside the project, and every fs error answers `false`.
232 */
233function pathIsProjectFile(projectRoot: string, relPath: string): boolean {
234 try {
235 const abs = validatePathWithinRoot(projectRoot, relPath);
236 return abs !== null && statSync(abs).isFile();
237 } catch {
238 return false;
239 }
240}
241
242/** Kinds that name a thing without defining it in the file that holds them. */
243const NOT_A_DEFINITION = new Set(['file', 'import', 'export', 'parameter']);

Callers 1

handleExploreMethod · 0.85

Calls 1

validatePathWithinRootFunction · 0.90

Tested by

no test coverage detected