feat(analyze): add .gitnexusignore support with --no-user-ignore override#203
feat(analyze): add .gitnexusignore support with --no-user-ignore override#203L1nusB wants to merge 1 commit into
Conversation
|
@L1nusB is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
xkonjin
left a comment
There was a problem hiding this comment.
Quick review pass:
- Main risk area here is data integrity, transaction boundaries, and backward-compatible persistence.
- Good to see test coverage move with the code; I’d still make sure it exercises the unhappy path around data integrity, transaction boundaries, and backward-compatible persistence rather than only the happy path.
- Before merge, I’d smoke-test the behavior touched by README.md, README.md, analyze.ts (+6 more) with malformed input / retry / rollback cases, since that’s where this class of change usually breaks.
reversTeam
left a comment
There was a problem hiding this comment.
Clean, well-implemented feature. The .gitnexusignore support follows familiar .gitignore semantics, which is great for user ergonomics.
Strengths:
- Solid parsing logic: supports comments, blank lines, directory patterns (trailing
/), negation (!), root-anchored patterns (leading/), and glob patterns. TheparseUserIgnoreRulefunction is well-thought-out. - Correct
.gitignore-like last-match-wins semantics inshouldIgnorePathByUserRules. - The
--no-user-ignoreCLI flag integrates cleanly via Commander's built-in--no-prefix convention. - Good error handling in
loadUserIgnoreRules— ENOENT/ENOTDIR are gracefully handled while unexpected errors are re-thrown. .gitnexusignoreitself is added to theIGNORED_FILESset so it won't be indexed.- Comprehensive test coverage: unit tests for parsing, negation, anchoring, bare patterns, and load error handling. Integration tests for filesystem-walker with both enabled and disabled ignore rules.
- Documentation updated in both README files with clear examples.
Minor note:
- The
--skip-embeddingsflag was replaced by--embeddings(opt-in instead of opt-out) in the README. This looks like a separate behavioral change bundled with this PR — if it was intentional, it might warrant a note in the PR description. Not a blocker.
LGTM!
feat(analyze): support .gitnexusignore with optional bypass Apply repo-level user ignore patterns during indexing by default. Add --no-user-ignore to keep built-in ignore behavior only. Cover parsing and walker behavior with unit/integration tests. Include analyzer-generated context files per workspace request. docs(readme): explain index scope control with .gitnexusignore Add a dedicated Index Scope Control section in both READMEs. Document --no-user-ignore behavior and add practical examples. Keep agent guidance minimal via ai-context template and regenerated files. chore(pr): revert auto-generated and non-feature docs churn Reset generated AGENTS/CLAUDE/.claude artifacts and package-lock noise to base state. Keep PR focused on .gitnexusignore feature code, tests, and README docs only. fix(ignore): cover directory matches and surface fs errors Expand user ignore rule parsing so bare and trailing-slash directory patterns match both the directory and descendants. Only treat missing .gitnexusignore as optional; rethrow other read errors to avoid silently hiding IO/permission failures. Add unit tests for bare-pattern directory behavior and non-ENOENT error propagation. fix(ignore): treat .gitnexusignore as metadata file Add USER_IGNORE_FILE to IGNORED_FILES so the control file is explicitly excluded as repository metadata. Keep behavior robust even if glob dotfile settings change by relying on ignore-service defaults. Extend unit coverage to assert .gitnexusignore is ignored by exact-name rules.
|
Resolve merge conflicts |
CI Report✅ All checks passed Pipeline Status
Test Results✅ 1152 passed Code CoverageCombined (Unit + Integration)
Coverage breakdown by test suiteUnit Tests
Integration Tests
Coverage thresholds are auto-ratcheted — they only go upVitest 📋 View full run · Generated by CI |
|
Hi @L1nusB! I opened PR #301 which addresses |
Summary
This PR adds repository-level user ignore support for
gitnexus analyzevia a new.gitnexusignorefile.By default, when
.gitnexusignoreexists in the analyzed repository root, its patterns are applied during file scanning in addition to GitNexus's built-in hardcoded ignore rules. A new CLI escape hatch,--no-user-ignore, allows users to disable this behavior and keep current built-in ignore logic only.Why
Many repositories include large non-core areas (for example:
data/, generated snapshots, imported datasets, domain artifacts) that are useful for the repo but noisy for code intelligence indexing.Today, users cannot control this in a repo-specific way without changing GitNexus source itself. This PR makes indexing more practical and intentional for real-world repos by giving users a simple, local ignore file.
What Changed
1. User ignore parsing + matching
Implemented
.gitnexusignoresupport in the ignore service layer.USER_IGNORE_FILE = '.gitnexusignore'loadUserIgnoreRules(...)parseUserIgnoreRules(...)shouldIgnorePathByUserRules(...)Supported rule behavior:
# ...)*,**)data/)/!(later rules override earlier rules)2. Scan pipeline integration
Threaded user-ignore options through ingestion scan path:
walkRepositoryPaths(...)now accepts options and applies user rules during filteringrunPipelineFromRepo(...)now accepts pipeline options and forwards them to the walkerThis keeps all existing hardcoded ignore behavior intact and adds user ignore as an additive layer.
3. Analyze CLI override flag
Added new analyze option:
--no-user-ignoreBehavior:
.gitnexusignoreis used if present--no-user-ignore:.gitnexusignoreis ignored, built-in rules onlyHow It Works
.gitnexusignorerules (if enabled and file exists).Examples
Example
.gitnexusignore:Default run:
Bypass user ignore file:
Testing
Added tests for both parsing/matching and end-to-end scan behavior:
ignore-service.test.ts)filesystem-walker.test.ts).gitnexusignoreapplied by defaultuseUserIgnoreFile: falsebypass pathValidation performed:
npm run build✅npm run test✅npm run test:integration✅ for test assertions; existing unrelated worker-module warnings/errors in integration environment remain unchanged by this PR.Backward Compatibility
Notes
This implementation intentionally focuses on practical glob-based repo-level control for indexing scope and avoids introducing a heavier full gitignore engine. It is designed to solve the high-value use case (excluding non-core directories/files from indexing) with minimal complexity.