# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.6] - 2026-04-22

### Added

- `nxv dedupe` subcommand (feature-gated under `indexer`) that collapses
  duplicate `(attribute_path, version)` rows created by the pre-0.1.5
  incremental-indexer bug. For each pair with more than one row it keeps
  the earliest `first_commit_*` and the latest `last_commit_*` across the
  duplicates and deletes the rest, then optionally `VACUUM`s. Supports
  `--dry-run` for projected stats without mutation and `--no-vacuum` for
  faster runs when disk reclaim isn't needed. Verified against the
  currently-published bloated index: 1,745,607 → 195,071 rows (-89%),
  1.8GB → 310MB (-82%), `search firefox` ~15s → ~100ms. (#25)

## [0.1.5] - 2026-04-21

### Fixed

- Incremental indexer no longer creates a duplicate row per
  `(attribute_path, version)` on every run. Each run seeded a fresh
  `open_ranges` map and restamped every still-present package with a new
  `first_commit_hash`; `INSERT OR IGNORE` didn't catch it because the
  UNIQUE constraint includes `first_commit_hash`. Over ~480 CI runs this
  grew the published index to 1.8GB / 1.7M rows against only ~120k
  distinct `(attribute_path, version)` pairs (some duplicated 290×),
  making queries that used to be sub-second take ~15s. Fix seeds
  `open_ranges` from the last checkpoint, switches batch insert to
  `INSERT ... ON CONFLICT DO UPDATE` (with sticky `source_path`), flushes
  all open ranges at every periodic checkpoint so a hard kill still
  resumes correctly, and adds `idx_packages_last_commit_hash` to keep the
  resume-seed query fast on large DBs. Existing bloated DBs still need a
  full rebuild to actually remove the duplicate rows. (#24)
- `load_open_ranges_at_commit` collapses duplicate
  `(attribute_path, version)` pairs deterministically via
  `MIN(id) GROUP BY` so seeding from an already-bloated DB picks a stable
  row.

### Changed

- `IndexResult::ranges_created` renamed to `ranges_written`; CLI now
  reports "Range rows written" since the count now includes upsert
  updates, not only inserts.
- Flake modernized: migrated from `flake-utils` to `flake-parts`, added
  `numtide/devshell` with categorized commands and an motd, added
  `treefmt-nix` (`nixfmt` + `rustfmt`). Bumped all flake inputs, refreshed
  the Rust toolchain to `stable.latest` with `rust-src` /
  `rust-analyzer` / `rustfmt` / `clippy`. Added `cargo-outdated`,
  `cargo-audit`, and `cargo-llvm-cov` to the devshell. Fixed Darwin
  `libiconv` linking (`LIBRARY_PATH` + `NIX_LDFLAGS` in `commonArgs`) and
  replaced `pkgs.nodePackages.prettier` with `pkgs.prettier` (nodePackages
  removed upstream). All existing outputs preserved: `overlays.default`,
  `nixosModules.default`/`nxv`, packages, apps, checks. (#24)
- Migrated repository references from `jamesbrink/nxv` to `utensils/nxv`.
- `publish-index` workflow: deep-fallback recovery, improved error
  handling, and `errexit` fix around GitHub API calls.
- Bumped `actions/checkout` to v6 in the FlakeHub workflow.
- CLAUDE.md: documented the local vs. remote backend abstraction,
  enumerated `NXV_*` environment variables, clarified that the indexer
  lives at `src/index/` while the Cargo feature is named `indexer`, and
  added `cargo bench`.

### Added

- VitePress documentation site with GitHub Pages deploy. (#22)
- Documentation badge in the README.

## [0.1.4] - 2026-01-08

### Added

- Schema forward compatibility with `min_version` field in manifest
- MIT LICENSE file

### Changed

- `/release` skill replaces `/release-notes` with full release automation

### Fixed

- `--force` flag now properly bypasses schema validation during update
- Incremental indexing now handles merge commits and `pkgs/by-name` paths

## [0.1.3] - 2026-01-04

### Added

- Structured JSON logging for API server with `--log-format json`
- Request tracing with unique request IDs
- Graceful shutdown handling for API server

### Changed

- Improved error handling throughout API server
- Better error messages for database and network failures

### Fixed

- Blocking database calls now use `spawn_blocking` to prevent runtime starvation
- Rate limiting and security hardening for API endpoints

## [0.1.2] - 2026-01-03

### Added

- Dynamic tab completion for package names in bash, zsh, and fish
- `/release-notes` command for pre-release checks
- `last_indexed_date` field in stats output

### Changed

- Improved stats output clarity and formatting
- README reorganized with better installation instructions

### Fixed

- DevShell now uses `bashInteractive` for proper readline and completion support

## [0.1.1] - 2026-01-03

### Added

- Cross-platform release builds for Linux x86_64, Linux aarch64, macOS x86_64,
  and macOS ARM64
- Static musl binaries for Linux

### Fixed

- crates.io version check for first-time publish
- Excluded large files from crate package

## [0.1.0] - 2024-12-30

### Added

- Initial release of nxv (Nix Versions)

#### Search

- Search packages by name with prefix matching
- Exact name matching with `--exact` flag
- Version filtering with `--version` flag
- Description search using FTS5 with `--desc` flag
- License filtering with `--license` flag
- Multiple output formats: table (default), JSON, plain text
- Sort options: date, version, name
- Result limiting with `--limit`
- Platform display with `--show-platforms`

#### Version History

- View all versions of a package with `nxv history <package>`
- Show specific version availability with `nxv history <package> <version>`

#### Index Management

- Download pre-built index with `nxv update`
- Force full re-download with `nxv update --force`
- Delta update support (infrastructure ready)

#### Index Statistics

- View index info with `nxv stats`
- Shows database size, commit range, and package counts

#### Shell Completions

- Generate completions with `nxv completions <shell>`
- Supports bash, zsh, fish, powershell, and elvish

#### Bloom Filter

- Fast O(1) negative lookups for exact name searches
- Instant "package not found" response for typos

#### Indexer (feature-gated)

- Build index from local nixpkgs clone with `nxv index`
- Incremental indexing from last indexed commit
- Full rebuild with `--full` flag
- Checkpoint and resume support with Ctrl+C handling
- Progress bars during indexing

### Technical Details

- SQLite database with FTS5 for full-text search
- Zstd compression for index distribution
- SHA256 verification for downloads
- Rust 2024 edition
- 10 MB release binary size

[unreleased]: https://github.com/utensils/nxv/compare/v0.1.6...HEAD
[0.1.6]: https://github.com/utensils/nxv/compare/v0.1.5...v0.1.6
[0.1.5]: https://github.com/utensils/nxv/compare/v0.1.4...v0.1.5
[0.1.4]: https://github.com/utensils/nxv/compare/v0.1.3...v0.1.4
[0.1.3]: https://github.com/utensils/nxv/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/utensils/nxv/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/utensils/nxv/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/utensils/nxv/releases/tag/v0.1.0
