search_policy.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. """Shared directory pruning policy for broad recursive scans.
  2. These names identify version-control internals, dependency trees, generated
  3. artifacts, caches, and backup copies that are not useful results for broad
  4. agent-facing discovery. Ordinary search callers may still target an explicit
  5. path; broad diagnostic probes should apply this policy to recursive walks.
  6. """
  7. from __future__ import annotations
  8. # Keep this policy conservative and name-based so it works for local and remote
  9. # shell backends alike. The same set is used by context discovery and search
  10. # probes; adding a directory here protects every broad recursive consumer.
  11. SEARCH_PRUNE_DIR_NAMES = frozenset({
  12. # Version-control internals.
  13. ".git", ".hg", ".svn",
  14. # Dependency and vendored trees.
  15. "node_modules", "venv", ".venv", "site-packages", "dist-packages",
  16. "vendor", "third_party",
  17. # Generated/build output.
  18. "build", "dist", "target", "out", "coverage",
  19. ".next", ".turbo", ".parcel-cache", ".nuxt", ".svelte-kit",
  20. # Archived trees: stale copies of projects that used to be live workspaces
  21. # (~/.hermes/skills/.archive/ holds dozens of retired skills, each of which
  22. # can carry an AGENTS.md — #76902).
  23. ".archive",
  24. # Python and package-manager caches.
  25. "__pycache__", ".cache", ".Trash", ".tox", ".nox", ".mypy_cache",
  26. ".pytest_cache", ".ruff_cache", ".npm", ".yarn", ".pnpm-store",
  27. ".gradle", ".m2", ".nuget",
  28. # Backup copies.
  29. "backups", "backup", ".backups",
  30. })