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

Function extractInclude

src/project-config.ts:338–355  ·  view source on GitHub ↗

* Validate the `include` patterns: an array of non-empty gitignore-style strings * naming first-party source to force INTO the index despite `.gitignore` — the * whitelist for SVN/Perforce-only source a project gitignores out of Git (the * general case `includeIgnored` never covered). A non-array

(parsed: object, file: string)

Source from the content-addressed store, hash-verified

336 * project-root-relative paths.
337 */
338function extractInclude(parsed: object, file: string): string[] {
339 const raw = (parsed as ProjectConfig).include;
340 if (raw === undefined) return [];
341 if (!Array.isArray(raw)) {
342 logWarn(`Ignoring "include" in ${PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file });
343 return [];
344 }
345
346 const out: string[] = [];
347 for (const entry of raw) {
348 if (typeof entry !== 'string' || !entry.trim()) {
349 logWarn(`Ignoring an "include" entry in ${PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file });
350 continue;
351 }
352 out.push(entry.trim());
353 }
354 return out;
355}
356
357/**
358 * Load the parsed `codegraph.json` for a project, mtime-cached. A missing or

Callers 1

parseConfigFunction · 0.85

Calls 2

logWarnFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected