MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _load_graphifyinclude

Function _load_graphifyinclude

graphify/detect.py:891–918  ·  view source on GitHub ↗

Read .graphifyinclude allowlist patterns from root and ancestors. Include patterns opt matching hidden files/dirs into traversal. Sensitive files and hard-skipped noise directories are still excluded later. Uses the same VCS-root ceiling logic as _load_graphifyignore.

(root: Path)

Source from the content-addressed store, hash-verified

889
890
891def _load_graphifyinclude(root: Path) -> list[tuple[Path, str]]:
892 """Read .graphifyinclude allowlist patterns from root and ancestors.
893
894 Include patterns opt matching hidden files/dirs into traversal. Sensitive
895 files and hard-skipped noise directories are still excluded later.
896 Uses the same VCS-root ceiling logic as _load_graphifyignore.
897 """
898 root = root.resolve()
899 ceiling = _find_vcs_root(root) or root
900
901 dirs: list[Path] = []
902 current = root
903 while True:
904 dirs.append(current)
905 if current == ceiling:
906 break
907 current = current.parent
908 dirs.reverse()
909
910 patterns: list[tuple[Path, str]] = []
911 for d in dirs:
912 include_file = d / ".graphifyinclude"
913 if include_file.exists():
914 for raw in include_file.read_text(encoding="utf-8", errors="ignore").splitlines():
915 line = _parse_gitignore_line(raw)
916 if line:
917 patterns.append((d, line))
918 return patterns
919
920
921def _is_included(path: Path, root: Path, patterns: list[tuple[Path, str]]) -> bool:

Callers 1

detectFunction · 0.85

Calls 2

_find_vcs_rootFunction · 0.85
_parse_gitignore_lineFunction · 0.85

Tested by

no test coverage detected