|
| 1 | +--- |
| 2 | +"@effect-migrate/core": minor |
| 3 | +"@effect-migrate/cli": minor |
| 4 | +--- |
| 5 | + |
| 6 | +Add normalized schema for 40-70% audit.json size reduction and move business logic to core |
| 7 | + |
| 8 | +**Breaking Changes:** |
| 9 | + |
| 10 | +1. **Schema version 0.1.0 → 0.2.0** (audit.json - no backwards compatibility) |
| 11 | + - Replace `byFile`/`byRule` with deduplicated `rules[]`, `files[]`, `results[]` arrays |
| 12 | + - Add index-based groupings in `groups` field for O(1) lookup |
| 13 | + - Implement deterministic ordering (sorted rules/files) for reproducible output |
| 14 | + - Add stable content-based keys for cross-checkpoint delta computation |
| 15 | + - Compact range representation using tuples instead of objects |
| 16 | + - Add separate `info` counter to FindingsSummary (previously counted as warnings) |
| 17 | + |
| 18 | +2. **CLI loaders removed** - business logic moved to @effect-migrate/core |
| 19 | + - ❌ Removed `@effect-migrate/cli/loaders/config` - use `@effect-migrate/core` exports instead |
| 20 | + - ❌ Removed `@effect-migrate/cli/loaders/presets` - use `PresetLoader` service instead |
| 21 | + |
| 22 | +**New @effect-migrate/core exports:** |
| 23 | + |
| 24 | +Config utilities: |
| 25 | + |
| 26 | +- `mergeConfig(defaults, userConfig)` - Merge preset defaults with user config |
| 27 | +- `deepMerge(target, source)` - Deep merge plain objects (arrays replaced, not concatenated) |
| 28 | +- `isPlainObject(value)` - Type guard for plain objects |
| 29 | + |
| 30 | +Preset loading: |
| 31 | + |
| 32 | +- `PresetLoader` - Context.Tag for preset loading service |
| 33 | +- `PresetLoaderService` - Service interface |
| 34 | +- `PresetLoaderNpmLive` - Default Layer for npm-based preset resolution |
| 35 | +- `PresetLoadError` - Tagged error for preset loading failures |
| 36 | +- `Preset` - Preset type (rules + optional defaults) |
| 37 | +- `LoadPresetsResult` - Result of loading multiple presets |
| 38 | + |
| 39 | +Rule construction: |
| 40 | + |
| 41 | +- `rulesFromConfig(config)` - Build rules from config (pattern + boundary) |
| 42 | + |
| 43 | +Schema enhancements: |
| 44 | + |
| 45 | +- Config now supports `presets?: string[]` field for preset names |
| 46 | + |
| 47 | +Normalizer utilities: |
| 48 | + |
| 49 | +- `normalizeResults(results, config, threads?)` - Convert to normalized schema |
| 50 | +- `expandResult(normalized)` - Convert back to flat format |
| 51 | +- `deriveResultKey(result)` - Generate stable content-based key |
| 52 | + |
| 53 | +**@effect-migrate/cli changes:** |
| 54 | + |
| 55 | +New workspace-aware preset resolution: |
| 56 | + |
| 57 | +- `PresetLoaderWorkspaceLive` - Layer that tries workspace path first, falls back to npm |
| 58 | +- Supports monorepo development with automatic workspace preset detection |
| 59 | +- Windows-compatible file URL handling with `pathToFileURL()` |
| 60 | + |
| 61 | +Refactored loaders: |
| 62 | + |
| 63 | +- `loadRulesAndConfig()` now orchestrates core services instead of implementing logic |
| 64 | +- Uses `Effect.catchTag("PresetLoadError")` for precise error handling |
| 65 | +- Reduced CLI code by ~1291 lines (60% reduction in loaders) |
| 66 | + |
| 67 | +**Build improvements:** |
| 68 | + |
| 69 | +- Implement TypeScript Project References (src/test separation) for proper type checking |
| 70 | +- Fix NodeNext module resolution (.js extension requirements) |
| 71 | +- Consolidate test organization (all tests in `test/` directories) |
| 72 | +- Fix barrel import violations (use direct imports from @effect/platform) |
| 73 | +- Remove duplicate utils folder (merged util/ into utils/) |
| 74 | + |
| 75 | +**Migration guide:** |
| 76 | + |
| 77 | +If you were importing from CLI loaders: |
| 78 | + |
| 79 | +```typescript |
| 80 | +// Before |
| 81 | +import { loadConfig } from "@effect-migrate/cli/loaders/config" |
| 82 | +import { loadPresets } from "@effect-migrate/cli/loaders/presets" |
| 83 | + |
| 84 | +// After |
| 85 | +import { loadConfig, PresetLoader } from "@effect-migrate/core" |
| 86 | + |
| 87 | +const config = yield * loadConfig(configPath) |
| 88 | +const loader = yield * PresetLoader |
| 89 | +const { rules, defaults } = yield * loader.loadPresets(config.presets ?? []) |
| 90 | +``` |
| 91 | + |
| 92 | +**Test coverage:** |
| 93 | + |
| 94 | +- 50 new tests for core utilities (config merge, preset loading, rule builders) |
| 95 | +- 6 new tests for CLI workspace preset resolution |
| 96 | +- 40+ tests for normalized schema |
| 97 | +- Total: 308 tests passing |
0 commit comments