GitNexus/gitnexus/src
Christian C. Berclaz 7f8b01d506
refactor(ingestion): consolidate per-language patterns into LanguageProvider (#1279)
* refactor(ingestion): consolidate per-language patterns into LanguageProvider

Move entry-point name patterns and AST framework detection patterns from
shared maps in entry-point-scoring.ts and framework-detection.ts into each
LanguageProvider. The shared files now build their lookup tables dynamically
from the provider registry at module load.

This aligns with the architecture principle that shared pipeline code must
not name languages. Adding a new language no longer requires modifying
entry-point-scoring.ts or framework-detection.ts — the provider file is
the single source of truth for all language-specific data.

New LanguageProvider fields:
  - entryPointPatterns: RegExp[] (default: [])
  - astFrameworkPatterns: AstFrameworkPatternConfig[] (default: [])

* test(ingestion): add provider-registry, multiplier/reason, and Kotlin/Dart/Ruby entry-point coverage

Addresses review feedback on the per-language pattern consolidation:

- Runtime guard that providers map covers every SupportedLanguages member,
  catching enum/registry drift that the compile-time `satisfies` cannot.
- Multiplier/reason parity assertions for nestjs (3.2/nestjs-decorator),
  spring (3.2/spring-annotation), and fastapi (3.0/fastapi-decorator) so a
  silent value change during future relocations would fail loudly.
- Entry-point pattern coverage for Kotlin (Android lifecycle, ViewModel,
  Service), Dart (Flutter widget lifecycle), and Ruby (call/perform/execute)
  — the three providers whose patterns moved without representative tests.

* refactor(ingestion): apply satisfies AstFrameworkPatternConfig[] to remaining providers

The c-cpp, dart, php, ruby, and swift providers imported AstFrameworkPatternConfig
but never used it, which the root ESLint config flagged as a hard error in the
quality / lint CI gate.

Use the type the same way csharp/go/java/kotlin/python/rust/typescript already do —
as a satisfies assertion on the astFrameworkPatterns array. This both clears the
unused-import error and gives every provider compile-time validation of pattern
shape, narrowing the gap that the original review flagged about lost exhaustiveness
on the optional astFrameworkPatterns field.

---------

Co-authored-by: Gergo Magyar <gergomagyar@icloud.com>
2026-05-03 10:34:00 +01:00
..
cli fix(cli): keep GitNexus ignores inside .gitnexus (#1248) 2026-05-01 16:46:05 +01:00
config feat(ingestion): GITNEXUS_INDEX_TEST_DIRS opt-in for __tests__ / __mocks__ (#771) (#1046) 2026-04-23 13:49:06 +01:00
core refactor(ingestion): consolidate per-language patterns into LanguageProvider (#1279) 2026-05-03 10:34:00 +01:00
lib feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
mcp feat(mcp): add tool safety annotations (#1127) 2026-05-03 09:06:41 +01:00
server fix(serve): serve web UI at root path instead of 404 (#1048) 2026-04-27 13:17:40 +01:00
storage fix(mcp): avoid git from non-repo cwd in sibling cwd match (#1138) (#1293) 2026-05-03 09:17:12 +01:00
types feat(ingestion): language-agnostic heritage extractor with config+factory pattern (#890) 2026-04-17 17:51:17 +01:00