Skip to content

feat: zero-config indexing driven by .gitignore (#283)#285

Merged
colbymchenry merged 1 commit into
mainfrom
zero-config-gitignore
May 21, 2026
Merged

feat: zero-config indexing driven by .gitignore (#283)#285
colbymchenry merged 1 commit into
mainfrom
zero-config-gitignore

Conversation

@colbymchenry
Copy link
Copy Markdown
Owner

What & why

Closes #283. The issue asked us to document the config — but investigating it showed the config was mostly inert or broken, so we removed it entirely and made CodeGraph zero-config.

CodeGraph now indexes every file whose extension maps to a supported language and respects .gitignore everywhere:

  • git repos — via git itself (git ls-files --exclude-standard), already the case
  • non-git projects (e.g. a freshly-scaffolded Next.js app before git init) — by reading .gitignore files directly, root + nested, via the ignore library so negation/anchoring/nested rules behave exactly like git

There's no config file to write or keep in sync.

Changes

  • Removed .codegraph/config.json and the whole config surface. Every field was inert (languages, frameworks, extractDocstrings, trackCallSites, customPatterns were never consumed; languages validation was also broken — it rejected every language added after the original 8) or now redundant with .gitignore.
  • include → derived from EXTENSION_MAP (isSourceFile); exclude.gitignore; maxFileSize → a constant (1 MB).
  • Deleted src/config.ts, CodeGraphConfig/DEFAULT_CONFIG, the dead helpers (addCustomPattern/addIncludePatterns/addExcludePatterns/isSafeRegex), and the .codegraphignore marker.
  • Breaking (library API): the config option on CodeGraph.init(), getConfig(), updateConfig(), getConfigPath, and the CodeGraphConfig type are gone. Existing config.json files are simply ignored.

Behavior change ⚠️

Committed files that are not gitignored are now indexed even under vendor/, Pods/, or a committed dist/ — previously a hardcoded exclude list skipped those names. .gitignore is now the single source of truth. Documented in the README.

Validation

  • npm run build clean; 722/722 tests pass (config tests rewritten to cover the new .gitignore-based behavior, nested-.gitignore scoping, and isSourceFile).
  • End-to-end smoke test against the built library on real temp projects:
    • git repo + .gitignorenode_modules/dist excluded, src indexed, no config.json written ✅
    • non-git project + .gitignore → ignored dirs excluded via the new walk ✅
    • committed, non-gitignored node_modules → indexed (documented tradeoff) ✅

🤖 Generated with Claude Code

Remove .codegraph/config.json and the entire config surface. CodeGraph now
indexes every file whose extension maps to a supported language and respects
.gitignore everywhere — git repos via git itself, non-git projects via the
`ignore` library (root + nested .gitignore files, the same way git does).

- Remove CodeGraphConfig/DEFAULT_CONFIG, src/config.ts, and the public config
  API (the `config` option on init, getConfig/updateConfig/getConfigPath).
- Derive the source-file allowlist from EXTENSION_MAP (isSourceFile); maxFileSize
  is now a constant. Drop the .codegraphignore marker.
- Behavior change: committed, non-gitignored dirs (vendor/, a committed dist/)
  are now indexed — .gitignore is the single source of truth.

Earlier inert fields (languages, frameworks, extractDocstrings, trackCallSites,
customPatterns) and their dead helpers are removed as part of this.

Resolves #283.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document config or create a json schema for it

1 participant