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

Function extractInclude

src/project-config.ts:337–354  ·  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

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