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

Method constructor

src/extraction/index.ts:1035–1067  ·  view source on GitHub ↗
(
    private rootMatcher: Ignore,
    embedded: Array<{ root: string; matcher: Ignore }>,
    /**
     * Project `codegraph.json` `exclude` patterns (#999), matched against the
     * full root-relative path. Wins over everything else — an explicit user
     * exclude applies even to tracked files and even inside embedded repos.
     */
    private exclude: Ignore | null = null,
    /**
     * Project `codegraph.json` `include` patterns — first-party source forced
     * INTO the index despite `.gitignore`. When a path matches, it is NOT
     * ignored (so the watcher watches it), overriding `.gitignore`/`rootMatcher`
     * — but never `exclude` (checked first) and never a built-in default-ignored
     * dir. `includeRoots` are the static prefixes so a gitignored ANCESTOR
     * directory of an included subtree still isn't pruned by the directory
     * walker/watcher.
     */
    private include: Ignore | null = null,
    private includeRoots: string[] = [],
    /**
     * The directories `git ls-files --exclude-standard` reports as ignored
     * (see listGitIgnoredDirectories): root-relative, trailing-slashed paths.
     * Each names one directory and is matched as a literal path prefix, never
     * as a gitignore pattern. As a pattern, `src/` matched every `src/` below
     * the root too, hiding a whole Maven monorepo's sources (#2849), and a
     * folder named `[draft]` or `a[b` read as a glob (or did not compile).
     */
    private gitIgnoredDirs: ReadonlySet<string> = new Set(),
  )

Source from the content-addressed store, hash-verified

1033 private embedded: Array<{ root: string; matcher: Ignore }>;
1034 private defaults: Ignore = defaultsOnlyIgnore();
1035 constructor(
1036 private rootMatcher: Ignore,
1037 embedded: Array<{ root: string; matcher: Ignore }>,
1038 /**
1039 * Project `codegraph.json` `exclude` patterns (#999), matched against the
1040 * full root-relative path. Wins over everything else — an explicit user
1041 * exclude applies even to tracked files and even inside embedded repos.
1042 */
1043 private exclude: Ignore | null = null,
1044 /**
1045 * Project `codegraph.json` `include` patterns — first-party source forced
1046 * INTO the index despite `.gitignore`. When a path matches, it is NOT
1047 * ignored (so the watcher watches it), overriding `.gitignore`/`rootMatcher`
1048 * — but never `exclude` (checked first) and never a built-in default-ignored
1049 * dir. `includeRoots` are the static prefixes so a gitignored ANCESTOR
1050 * directory of an included subtree still isn't pruned by the directory
1051 * walker/watcher.
1052 */
1053 private include: Ignore | null = null,
1054 private includeRoots: string[] = [],
1055 /**
1056 * The directories `git ls-files --exclude-standard` reports as ignored
1057 * (see listGitIgnoredDirectories): root-relative, trailing-slashed paths.
1058 * Each names one directory and is matched as a literal path prefix, never
1059 * as a gitignore pattern. As a pattern, `src/` matched every `src/` below
1060 * the root too, hiding a whole Maven monorepo's sources (#2849), and a
1061 * folder named `[draft]` or `a[b` read as a glob (or did not compile).
1062 */
1063 private gitIgnoredDirs: ReadonlySet<string> = new Set(),
1064 ) {
1065 // Longest root first so paths in nested embedded repos hit the innermost matcher.
1066 this.embedded = [...embedded].sort((a, b) => b.root.length - a.root.length);
1067 }
1068
1069 /** True when `rel` is one of {@link gitIgnoredDirs} or lies inside one. */
1070 private inGitIgnoredDir(rel: string): boolean {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected