This release eliminates manual module maintenance. Previously, adding a new year required updating lib.rs in 4 different places. Now it's fully automatic.
registry_generated.rs- Auto-generated file containing all routing logicregistry-tool- Independent binary that scans file structure and rebuilds the registrynew-daynow handles all registry updates automatically
The registry system also handles deletions - if you remove a year folder, registry-tool detects it and cleans up all references in lib.rs and the generated registry.
registry-tool is standalone with zero dependencies on aoc-lib:
- Runs even when
aoc-libwon't compile - Fixes broken states from manually deleted year folders
- Scans actual directory structure and syncs everything
- Years must be between 2015 and 2099
- Catches typos:
35,2125,0035rejected - Enforces 4-digit years
- Actionable suggestions when solutions not found
- Directs users to
new-dayorregistry-toolcommands
- New file:
aoc-lib/src/registry_generated.rs(auto-generated, do not edit) - New crate:
registry-tool/(independent registry manager) - Modified:
aoc-lib/src/lib.rs(simplified from 50+ lines to 7 lines)
- None
- Added:
cargo run --bin registry-tool(fix broken registry states)
Your solution files are safe. This upgrade only changes tooling infrastructure.
Infrastructure files only:
lib.rs- Simplified from 50+ lines to 7 linesregistry_generated.rs- New auto-generated fileregistry-tool/- New standalone cratenew-daybinary - Updated to call registry-tool
Your aoc-lib/src/yearYYYY/dayDD.rs solution files are never touched.
- Pull v0.2.0 changes
- Run
cargo run --bin registry-tool - Verify with
cargo run --bin aoc list
v0.1: Creating a new year required manually editing lib.rs in 4 places:
- Add
pub mod yearYYYY; - Add year case to
get_solver() - Add year to
available_years() - Add year case to
available_days()
v0.2.0: Run cargo run --bin new-day 2024 1 and everything updates automatically.
Create and run solutions:
cargo run --bin new-day 2024 1
cargo run --bin aoc download 2024 1
cargo run --bin aoc run 2024 1Fix broken registry:
cargo run --bin registry-toolRegistry Architecture:
lib.rs- Module declarations only (auto-managed)registry_generated.rs- SolutionRegistry struct and routing logicyearYYYY/mod.rs- DAYS array mapping days to solvers
How new-day works:
- Creates solution file with template
- Updates year module to register the day
- Adds module declaration to
lib.rs(if new year) - Calls
registry-toolto regenerate routing - Creates input placeholder
How registry-tool works:
- Scans
aoc-lib/src/foryearYYYYdirectories - Verifies each year has
mod.rs - Syncs
lib.rsmodule declarations - Regenerates
registry_generated.rs
- Zero manual editing of
lib.rs - Self-healing when files are deleted
- Fail-safe (registry-tool works even when aoc-lib won't compile)
- Cleaner code (lib.rs: 50+ lines to 7 lines)
Full Changelog: v0.1.0...v0.2.0