Files
OpenNoodl/packages/noodl-editor/tests/io/index.ts
dishant-kumar-thakur 1e78b5e279 feat(phase-10): STRUCT-004 project format detection utility
Task: STRUCT-004
Branch: cline-dev-dishant
Cross-branch notes: none -- no shared dependencies with Richard phase 9/6 work

- ProjectFormatDetector class (injectable filesystem, fully testable)
- detect() async + detectSync() sync variants
- Detects legacy (project.json) vs v2 (nodegx.project.json + _registry.json)
- Returns { format, confidence, indicators } for transparent decision-making
- Scoring system: v2 needs score >= 2 to avoid false positives
- Errors in exists() treated as not-found (graceful degradation)
- V2_INDICATORS / LEGACY_INDICATORS sentinel constants exported
- createNodeDetector() factory for Node.js/test contexts
- Convenience methods: getFormat(), isV2(), isLegacy()
- 30 tests in tests/io/ProjectFormatDetector.test.ts
  - detect(): 12 cases (all combinations, async fs, error handling)
  - detectSync(): 4 cases (incl. throws on async fs)
  - Convenience methods: 7 cases
  - Constants: 3 cases
  - createNodeDetector() integration: 4 cases (real tmp dirs)
- Updated tests/io/index.ts to export detector tests
- Updated PROGRESS-dishant.md: STRUCT-001/002/003/004 all marked complete
2026-02-19 01:19:46 +05:30

4 lines
129 B
TypeScript

export * from './ProjectExporter.test';
export * from './ProjectImporter.test';
export * from './ProjectFormatDetector.test';