fix(config): cover dependency and build-output directories in default_exclude_patterns.json
Description
default_exclude_patterns.json currently covers test files, snapshots and generated code, but not dependency directories or build output. The most direct evidence is line 17: **/oh_modules/** (the HarmonyOS dependency directory) is there, while **/node_modules/** is not.
Two reasons .gitignore does not cover this:
- Once a directory is committed,
git diffstops looking at.gitignore. Reviewing that commit — or any range spanning it — pulls in every file. This repository has a real case: the root.gitignorehad/node_modules(anchored to the root), soextensions/frontend/node_moduleswas never ignored and got committed in c640c109. A single review picked up 389 files before it was removed in 27c43fa8. - The extension allowlist does not help. Files inside these directories are
.js,.ts,.json,.css— all insupported_file_types.json, so they pass the extension gate inwhyExcluded(internal/agent/selection.go:92) and reach the default-path gate on the next line.
Worth knowing before adding entries: .map, .lock, .sum, .class and .jar are not in the extension allowlist, so source maps, yarn.lock, Cargo.lock, go.sum and compiled artifacts are already excluded upstream — no pattern needed. But package-lock.json and pnpm-lock.yaml resolve to .json / .yaml, which are allowed, so those need explicit path patterns.
Scope
- File:
internal/config/allowlist/default_exclude_patterns.json - Tests:
internal/config/allowlist/allowed_ext_test.go
Add at least the following. Matching is case-insensitive and uses doublestar globs, so ** crosses directory boundaries and handles nesting at any depth:
JS/TS deps and output
**/node_modules/**
**/bower_components/**
**/.pnpm-store/**
**/.yarn/{cache,unplugged,releases,sdks,patches}/**
**/package-lock.json
**/pnpm-lock.yaml
**/npm-shrinkwrap.json
**/*.min.{js,css}
**/dist/**
**/.next/**
**/.nuxt/**
**/.svelte-kit/**
**/.astro/**
**/.turbo/**
Vendored deps
**/vendor/**
**/.bundle/**
JVM
**/target/**
**/.gradle/**
Python
**/__pycache__/**
**/.venv/**
**/venv/**
**/site-packages/**
**/*.egg-info/**
**/.tox/**
**/.mypy_cache/**
**/.pytest_cache/**
**/.ruff_cache/**
Swift/iOS
**/Pods/**
**/Carthage/**
**/.build/**
Other
**/obj/**
**/.dart_tool/**
**/.terraform/**
**/coverage/**
**/vendor/** supersedes the existing **/vendor/**/*.{jsonnet,libsonnet} on line 40 — drop that line.
Additions beyond this list are welcome. If you know a dependency or build-output directory from an ecosystem we missed, include it and say which toolchain produces it. Two names that are deliberately left out: **/build/** and **/bin/** — plenty of projects keep hand-written sources there (this repository's own bin/ocr.js, for one), so the false-exclusion risk outweighs the benefit.
Acceptance Criteria
- [ ] Patterns above are present in
default_exclude_patterns.json, with the redundantvendorjsonnet line removed - [ ] A nested path such as
extensions/frontend/node_modules/@babel/core/lib/index.jsis reported as excluded byIsExcludedPath - [ ] Test cases cover nesting at depth, plus at least one non-excluded lookalike (e.g.
src/distribution/index.jsmust NOT be excluded by**/dist/**) - [ ] Tests pass (
make test) - [ ] Code check passes (
make check)
Context
Found while reviewing a session that had 389 extensions/frontend/node_modules/** files in it.
internal/diff/git.go has a separate blocklist (providerDirIgnoreDirs) that drops these directories earlier, before diffs are even parsed. It only matches at the repository root, which is its own bug — out of scope here. This issue is about the configurable default list, which already has the right glob semantics for the job.
I'd like to work on this.
Can you merge #1491 first? I do have time to update the default exclude patterns again. Then one pull request author updates the new exclude patterns to the markdowns.