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

Function extractInclude

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

246 * project-root-relative paths.
247 */
248function extractInclude(parsed: object, file: string): string[] {
249 const raw = (parsed as ProjectConfig).include;
250 if (raw === undefined) return [];
251 if (!Array.isArray(raw)) {
252 logWarn(`Ignoring "include" in ${PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file });
253 return [];
254 }
255
256 const out: string[] = [];
257 for (const entry of raw) {
258 if (typeof entry !== 'string' || !entry.trim()) {
259 logWarn(`Ignoring an "include" entry in ${PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file });
260 continue;
261 }
262 out.push(entry.trim());
263 }
264 return out;
265}
266
267/**
268 * Load the parsed `codegraph.json` for a project, mtime-cached. A missing or

Callers 1

parseConfigFunction · 0.85

Calls 1

logWarnFunction · 0.90

Tested by

no test coverage detected