smartfuzzy/readme.plan.md

3.5 KiB

SmartFuzzy Improvement Plan

Current Status

  • ESM imports/exports fixed with .js extensions
  • Basic fuzzy matching functionality works
  • Tests run individually with tsx but fail with pnpm test
  • Using older versions of dependencies

Improvement Plan

1. Fix Testing Infrastructure

1.1 Fix Test Runner Configuration

  • Investigate why pnpm test fails while individual tests run with tsx succeed
  • Check if tsrun command is properly installed and available (current error shows "tsrun: command not found")
  • Examine the tstest configuration in package.json and update if needed
  • Verify that @git.zone/tstest dependency is properly installed and configured
  • Consider updating the test script to use tsx directly if tstest continues to be problematic

1.2 Update Test Syntax and Standards

  • Convert all tests from chai-style syntax (expect().to.be) to SmartExpect syntax (expect().toBeInstanceOf())
  • Implement consistent test structure across all test files
  • Add proper setup and teardown patterns where needed
  • Replace console.log statements with proper assertions to validate results
  • Add descriptive error messages to assertions to improve test debugging

1.3 Expand Test Coverage

  • Add tests for empty dictionaries and edge cases
  • Test with extremely large dictionaries to verify performance
  • Add tests for unicode/special character handling
  • Test with very similar strings to validate fuzzy matching accuracy
  • Add tests for error conditions and input validation
  • Implement tests for all public APIs and features

1.4 Test Automation and CI

  • Add test coverage reporting
  • Set up continuous integration for automated testing
  • Add performance regression tests
  • Create test fixtures for consistent test data
  • Add browser-based tests for web compatibility

2. Code Quality Improvements

  • Add proper TypeScript documentation comments to all public methods
  • Implement consistent error handling
  • Add input validation for all public methods
  • Standardize method naming conventions (e.g., get* vs find*)

3. Feature Enhancements

  • Add configurable threshold options for matching
  • Implement stemming/lemmatization support for better text matching
  • Add language-specific matching options
  • Support for weighted matching across multiple fields
  • Add batch processing capabilities for large datasets

4. Performance Optimizations

  • Implement caching for repeated searches
  • Optimize indexing for large dictionaries
  • Add benchmarking tests to measure performance improvements

5. Dependencies and Build System

  • Update to latest versions of dependencies
  • Ensure proper tree-shaking for browser bundle
  • Add browser-specific build configuration
  • Implement proper ES module / CommonJS dual package setup

6. Documentation

  • Create comprehensive API documentation
  • Add usage examples for common scenarios
  • Create benchmarks comparing to other fuzzy matching libraries
  • Document performance characteristics and optimization strategies

7. Developer Experience

  • Add VS Code debugging configuration
  • Implement changelog generation
  • Set up automated release process
  • Add contribution guidelines

Priority Order

  1. Fix testing infrastructure (critical)
  2. Code quality improvements (high)
  3. Documentation (high)
  4. Feature enhancements (medium)
  5. Performance optimizations (medium)
  6. Dependencies and build system (medium)
  7. Developer experience (low)