Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
60dfa8d
feat(core): extract RULE_KINDS constant for type safety
aridyckovsky Nov 7, 2025
89a5e72
feat(core): add normalized schema with documentation improvements
aridyckovsky Nov 7, 2025
eea8183
feat(core): implement deduplication normalizer with stable keys
aridyckovsky Nov 7, 2025
6de8185
feat(core): integrate normalizer into audit writing
aridyckovsky Nov 7, 2025
fe36785
feat(core): export normalizer utilities from public API
aridyckovsky Nov 7, 2025
7cc74d5
test(core): add comprehensive normalizer test suite
aridyckovsky Nov 7, 2025
2fd90d7
docs: add normalized schema plan and review
aridyckovsky Nov 7, 2025
f22c2dd
chore: add changeset for normalized schema breaking change
aridyckovsky Nov 7, 2025
b174aac
chore: add changeset for normalized schema
aridyckovsky Nov 7, 2025
dd97271
feat(core): bump schema version to 0.2.0 for normalized structure
aridyckovsky Nov 7, 2025
e89e21a
docs: add PR draft for normalized audit schema
aridyckovsky Nov 7, 2025
806c1ec
test/docs: update SCHEMA_VERSION references to 0.2.0
aridyckovsky Nov 7, 2025
34c40ef
feat(core): add separate info counter to FindingsSummary
aridyckovsky Nov 7, 2025
468f8e9
fix(core): use properly typed RuleDef in normalizer tests
aridyckovsky Nov 7, 2025
05d8c54
fix: handle optional group typing
aridyckovsky Nov 7, 2025
f20113f
fix(core): fix remaining rule defs and add groups to test fixtures
aridyckovsky Nov 7, 2025
98b052d
build(core): implement TypeScript Project References for test type ch…
aridyckovsky Nov 7, 2025
2d02d68
test(core): fix imports for NodeNext module resolution
aridyckovsky Nov 7, 2025
6f0161a
test(core): remove redundant rules.test.ts and document helpers test
aridyckovsky Nov 7, 2025
432695e
style: apply dprint formatting via eslint --fix
aridyckovsky Nov 7, 2025
6b186f6
feat(core): move config and preset business logic from CLI to core
aridyckovsky Nov 7, 2025
5a6650a
refactor(cli): make CLI thin orchestrator using core services
aridyckovsky Nov 7, 2025
d7f2281
test: consolidate test organization and fix schemas
aridyckovsky Nov 7, 2025
1c0cc95
fix: apply Oracle post-migration improvements
aridyckovsky Nov 7, 2025
c0ad50a
docs: document loaders-to-core migration
aridyckovsky Nov 7, 2025
61de068
build: complete TypeScript project references and fix import paths
aridyckovsky Nov 7, 2025
d9fc4ea
docs: add comprehensive JSDoc to new modules
aridyckovsky Nov 7, 2025
969a3d1
refactor(core): extract package metadata utilities to shared module
aridyckovsky Nov 8, 2025
e015aa3
feat(core): enhance schema with revision tracking and info severity
aridyckovsky Nov 8, 2025
29273a4
feat(core): implement auto-thread detection and enhanced Amp context …
aridyckovsky Nov 8, 2025
c4289ee
feat(cli): update formatters and commands for info severity and new s…
aridyckovsky Nov 8, 2025
3f71085
test: update tests for new schema and auto-thread behavior
aridyckovsky Nov 8, 2025
ba1fc77
docs: update all READMEs to reflect current architecture and publishe…
aridyckovsky Nov 8, 2025
cbd8eb9
chore: add changeset for README updates
aridyckovsky Nov 8, 2025
7697e3b
chore: fix format
aridyckovsky Nov 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .changeset/normalized-audit-schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
"@effect-migrate/core": minor
"@effect-migrate/cli": minor
---

Add normalized schema for 40-70% audit.json size reduction and move business logic to core

**Breaking Changes:**

1. **Schema version 0.1.0 → 0.2.0** (audit.json - no backwards compatibility)
- Replace `byFile`/`byRule` with deduplicated `rules[]`, `files[]`, `results[]` arrays
- Add index-based groupings in `groups` field for O(1) lookup
- Implement deterministic ordering (sorted rules/files) for reproducible output
- Add stable content-based keys for cross-checkpoint delta computation
- Compact range representation using tuples instead of objects
- Add separate `info` counter to FindingsSummary (previously counted as warnings)

2. **CLI loaders removed** - business logic moved to @effect-migrate/core
- ❌ Removed `@effect-migrate/cli/loaders/config` - use `@effect-migrate/core` exports instead
- ❌ Removed `@effect-migrate/cli/loaders/presets` - use `PresetLoader` service instead

**New @effect-migrate/core exports:**

Config utilities:

- `mergeConfig(defaults, userConfig)` - Merge preset defaults with user config
- `deepMerge(target, source)` - Deep merge plain objects (arrays replaced, not concatenated)
- `isPlainObject(value)` - Type guard for plain objects

Preset loading:

- `PresetLoader` - Context.Tag for preset loading service
- `PresetLoaderService` - Service interface
- `PresetLoaderNpmLive` - Default Layer for npm-based preset resolution
- `PresetLoadError` - Tagged error for preset loading failures
- `Preset` - Preset type (rules + optional defaults)
- `LoadPresetsResult` - Result of loading multiple presets

Rule construction:

- `rulesFromConfig(config)` - Build rules from config (pattern + boundary)

Schema enhancements:

- Config now supports `presets?: string[]` field for preset names

Normalizer utilities:

- `normalizeResults(results, config, threads?)` - Convert to normalized schema
- `expandResult(normalized)` - Convert back to flat format
- `deriveResultKey(result)` - Generate stable content-based key

**@effect-migrate/cli changes:**

New workspace-aware preset resolution:

- `PresetLoaderWorkspaceLive` - Layer that tries workspace path first, falls back to npm
- Supports monorepo development with automatic workspace preset detection
- Windows-compatible file URL handling with `pathToFileURL()`

Refactored loaders:

- `loadRulesAndConfig()` now orchestrates core services instead of implementing logic
- Uses `Effect.catchTag("PresetLoadError")` for precise error handling
- Reduced CLI code by ~1291 lines (60% reduction in loaders)

**Build improvements:**

- Implement TypeScript Project References (src/test separation) for proper type checking
- Fix NodeNext module resolution (.js extension requirements)
- Consolidate test organization (all tests in `test/` directories)
- Fix barrel import violations (use direct imports from @effect/platform)
- Remove duplicate utils folder (merged util/ into utils/)

**Migration guide:**

If you were importing from CLI loaders:

```typescript
// Before
import { loadConfig } from "@effect-migrate/cli/loaders/config"
import { loadPresets } from "@effect-migrate/cli/loaders/presets"

// After
import { loadConfig, PresetLoader } from "@effect-migrate/core"

const config = yield * loadConfig(configPath)
const loader = yield * PresetLoader
const { rules, defaults } = yield * loader.loadPresets(config.presets ?? [])
```

**Test coverage:**

- 50 new tests for core utilities (config merge, preset loading, rule builders)
- 6 new tests for CLI workspace preset resolution
- 40+ tests for normalized schema
- Total: 308 tests passing
22 changes: 22 additions & 0 deletions .changeset/update-readmes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
"@effect-migrate/core": patch
"@effect-migrate/cli": patch
---

Update all READMEs to reflect current architecture and published usage

**Documentation improvements:**

- Root README: Accurate CLI commands, output schemas (index.json, audit.json, metrics.json, threads.json), real rule examples, proper roadmap
- CLI README: Complete options documentation (--strict, --log-level, --amp-out), troubleshooting guide, local development instructions
- Core README: Comprehensive exported API documentation, service architecture, Layer patterns, real rule examples from preset-basic

**Key updates:**

- Reflect dogfooding status and unstable API warnings across all packages
- Document complementary relationship with @effect/language-service
- Add proper roadmap with planned features (SQLite, Polars, OpenTelemetry, MCP server, workflow orchestration)
- User-focused: Published npm usage as primary, local development as secondary
- Real examples from actual codebase (patterns.ts, boundaries.ts)

Resolves #24
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Build TypeScript declarations
run: pnpm build:types

Expand All @@ -53,8 +56,5 @@ jobs:
- name: Lint
run: pnpm lint

- name: Build
run: pnpm build

- name: Test
run: pnpm test:ci
Loading