mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-17 23:52:36 +00:00
* feat(ingestion): GITNEXUS_INDEX_TEST_DIRS opt-in for __tests__ / __mocks__ (#771) The DEFAULT_IGNORE_LIST hardcodes __tests__ and __mocks__ as auto-filtered directory names. The comment at ignore-service.ts:273 explicitly documents this as intentional — .gitnexusignore negation cannot override hardcoded entries. That default is right for the majority of users, but for Quality Engineering workflows where test files are the primary index target (tracing coverage via CALLS edges), there was no escape hatch short of patching the installed package. Add an opt-in env var mirroring the GITNEXUS_NO_GITIGNORE / GITNEXUS_MAX_FILE_SIZE precedent: `GITNEXUS_INDEX_TEST_DIRS=1` removes __tests__ / __mocks__ from the effective ignore set. Scope is deliberately limited to these two names — the issue asked for these specifically, and other test-adjacent entries (__snapshots__, snapshots, fixtures, .jest) remain auto-filtered unchanged. .gitnexusignore negation semantics are not touched; the env var is the orthogonal escape hatch. Implementation: new `isEffectivelyIgnoredDirectory` helper in ignore-service.ts wraps the `DEFAULT_IGNORE_LIST.has(name)` check with the env-var opt-out. Two call-sites swap: shouldIgnorePath (affects filesystem walker and wiki generator) and createIgnoreFilter.childrenIgnored (affects directory pruning during traversal). `isHardcodedIgnoredDirectory` export unchanged — its contract is "is in the raw list", which remains true for __tests__ / __mocks__ regardless of env var state (locked in by a test). Default behaviour is byte-identical for users who don't set the env var. 9 new unit tests cover default-unset, opt-in-set, scoped scope (other hardcoded entries unaffected), and the scope-discipline guard (future expansion beyond the two named dirs fails loudly). Env state restored by afterEach to prevent leakage. Closes #771. * feat(ingestion): .gitnexusignore negation overrides hardcoded DEFAULT_IGNORE_LIST (#771) Per @magyargergo's review feedback: rather than add a special-case GITNEXUS_INDEX_TEST_DIRS env var to unlock __tests__ / __mocks__, let .gitnexusignore use !pattern negation to override the hardcoded DEFAULT_IGNORE_LIST — mirroring the .gitignore mental model users already know. Implementation: - New private hasExplicitUnignore(ig, rel) helper that walks ancestor segments and uses ignore.test(path)'s `unignored` flag to detect explicit negation. Ancestor-walk is required because .gitignore negation propagates — !__tests__/ implicitly unignores every descendant, but ignore.test() only reports unignored: true on the directly-matched path. - createIgnoreFilter.ignored() and .childrenIgnored() now check hasExplicitUnignore BEFORE applying the hardcoded DEFAULT_IGNORE_LIST. If any ancestor (or the path itself) was explicitly unignored in .gitnexusignore, the hardcoded block is bypassed. - shouldIgnorePath stays pure hardcoded-list — the wiki generator and other callers without per-repo config context keep deterministic behavior. The #771 override lives only inside createIgnoreFilter, which IS called with config. Dropped: - GITNEXUS_INDEX_TEST_DIRS env var (superseded by the more general negation mechanism) - isEffectivelyIgnoredDirectory helper - Associated env-var help text and unit tests Added: - Tip in analyze --help pointing users at .gitnexusignore with !__tests__/ as the example - 8 new unit tests covering default behaviour, directory-level negation, selective overrides, generalisation (!node_modules/), non-leakage across hardcoded entries, standard non-negation rules still layering on top, and preservation of shouldIgnorePath / isHardcodedIgnoredDirectory contracts Default behaviour (no .gitnexusignore or no negation pattern) is byte-identical to pre-#771. Users who want to index an auto-filtered directory add a single !pattern line — no env var, no flag, no re-install. Closes #771. * fix(ingestion): honour re-ignore rules after .gitnexusignore negation (#771) When .gitnexusignore contains both `!__tests__/` and `__tests__/generated/`, the parent negation previously short-circuited and allowed the re-ignored child through. Consult `ig.ignores(rel)` after `hasExplicitUnignore` so a more-specific rule in the same file correctly re-ignores a subset — matching .gitignore's last-match-wins semantics. Adds a compound-pattern test locking this in. |
||
|---|---|---|
| .. | ||
| fixtures | ||
| helpers | ||
| integration | ||
| unit | ||
| utils | ||
| global-setup.ts | ||
| vitest.d.ts | ||