Skip to content

Future Enhancement: Automate duplicate type detection (Biome rule + pre-commit hook) #15

@WesleyMFrederick

Description

@WesleyMFrederick

Context

TypeScript migration Phase 2 (Epic 4) implements manual Checkpoint 8 validation to prevent duplicate type definitions outside types/ directory. This catches the Epic 4.3 failure pattern (MarkdownParser internal LinkObject).

Proposed Enhancements

Option A: Custom Biome Lint Rule (Build-time Prevention)

  • Custom Biome rule preventing interface/type definitions outside types/ directory
  • Provides live feedback during development (IDE integration)
  • Catches duplicates before they're written

Complexity: High - Biome custom rule ecosystem less mature than ESLint

Option B: Pre-commit Hook Automation (Commit-time Blocking)

  • Git pre-commit hook runs Checkpoint 8 validation automatically
  • Blocks commits if duplicate types detected
  • Zero reliance on manual checkpoint execution

Complexity: Medium - Standard git hook infrastructure

Current State (MVP)

Layer 2: Manual Checkpoint Validation (Implemented in Epic 4)

# Checkpoint 8: Duplicate type detection
grep -r "^interface LinkObject\|^type LinkObject" src/ --exclude-dir=types

Developer runs checkpoint manually before commits as part of 8-checkpoint framework.

Decision

Both enhancements deferred to post-migration:

  • Don't block TypeScript conversion progress
  • Manual checkpoint delivers 90% value with 10% effort
  • Can add automation after migration complete

Implementation Notes

  • Checkpoint 8 validation already proven effective
  • Choose Option A (Biome) for better DX, Option B (hook) for simplicity
  • Both options use same grep-based detection logic

References

  • Solution documented in: tools/citation-manager/design-docs/features/20251119-type-contract-restoration/2-design-phase/solutions-hypothesis.md
  • Epic 4.3 failure pattern: MarkdownParser internal LinkObject definition

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions