Skip to content

Ignore System

Arham-Qureshi edited this page Jul 21, 2026 · 1 revision

Ignore System

codebase-vis uses a single source of truth for file filtering: the .agentignore file, with optional runtime additions via the --ignore flag.

Sources of Ignore Patterns

                    ┌──────────────────────┐
                    │  5-Layer Filter      │
                    │                      │
                    │  1. Hardcoded skips  │
                    │  2. Stack defaults   │
                    │  3. Non-code files   │
                    │  4. .agentignore     │
                    │  5. CLI --ignore     │
                    └──────────────────────┘
  1. Hardcoded skips — Symlinks are always skipped. Files > 2 MB are always skipped.
  2. Stack defaults — Already baked into what init generates for each tech stack.
  3. Non-code files — Only files with KNOWN_EXTENSIONS (13 extensions) are collected. .txt, .md, .json, .png, etc. never reach the ignore check.
  4. .agentignore file — User-editable, created by init with stack-appropriate defaults.
  5. CLI --ignore flag — Runtime additions passed to generate.

How File Discovery Works

discoverFiles(targetDir, ig) walks the target directory recursively:

async function discoverFiles(targetDir, ig) {
  // For each entry:
  //   1. lstat() check
  //   2. Skip symlinks
  //   3. Check ig.ignores(relPath) ← .agentignore + --ignore
  //   4. Skip files > 2MB
  //   5. Check KNOWN_EXTENSIONS
  //   6. Recurse into directories (concurrency: 32)
}

Traversal Process

readdir(dir)
    │
    ├── lstat(entry)
    │   ├── Is symlink? → SKIP
    │   ├── Is directory?
    │   │   ├── ig.ignores(relPath)? → SKIP (don't recurse)
    │   │   └── Not ignored → recurse (concurrency: 32)
    │   └── Is file?
    │       ├── ig.ignores(relPath)? → SKIP
    │       ├── size > 2MB? → SKIP
    │       ├── KNOWN_EXTENSIONS? → NO → SKIP
    │       └── Valid → ADD to files[]
    │
    ▼
Return { files[], ignoredCount }

Known Extensions

Only these file extensions are recognized as source code:

.js, .jsx, .ts, .tsx, .py, .cpp, .h, .hpp, .html, .css, .rs, .go, .java

Default Stack Ignores

When codebase-vis init detects your tech stack, it generates appropriate defaults:

Stack Common Ignores
Node / JS / TS node_modules/, dist/, build/, .next/, .nuxt/, out/, .cache/, coverage/
Python venv/, __pycache__/, *.pyc, .pytest_cache/, *.egg-info/, .eggs/
C / C++ build/, cmake-build-*/, *.o, *.obj, *.exe
Rust target/
Go vendor/
Java target/, *.class, *.jar, .gradle/, build/
PHP vendor/
Ruby vendor/bundle/, .bundle/

Stack Detection Priority

codebase-vis detects your tech stack by checking for marker files and dependencies. The priority order (most specific first):

nextjs > angular > react > vue > svelte > sveltekit > express > node >
django > flask > fastapi > python > cpp > rust > go > php > ruby > java

Detection uses STACK_MARKERS which include file checks (e.g., next.config.js for Next.js) and dependency checks (e.g., "react" in package.json for React).

Clone this wiki locally