AOC Toolkit
A developer toolkit for Advent of Code, built in Rust and designed to support multiple solution languages through a unified CLI.
Alpha.3 documentation: Rust is currently the only implemented adapter. This version supports project initialization, day scaffolding, solution execution, secure session storage, account-specific global input caching, and calendar-aware input fetching. Progress tracking, benchmarking, an interactive terminal UI, and other language adapters remain planned. The alpha.3 release candidate may be ahead of the latest published version; see GitHub Releases.
Installation
Once alpha.3 is published, install it with Cargo:
For alpha releases, explicitly select the version listed in GitHub Releases. Keep the global CLI and the project's runner dependency on compatible versions.
Alternatively, obtain a prebuilt executable from GitHub Releases. The release pipeline targets Linux and macOS (x86_64 and ARM64), and Windows (x86_64). Running Rust solutions requires a compatible Rust toolchain and Cargo even when the global CLI is installed from a prebuilt binary.
Getting started
After installing AOC Toolkit, run:
To authenticate without automatically opening your browser:
For manual authentication instructions, run:
Your Advent of Code session is stored in the system credential store.
Check the effective session or remove the stored credential:
Browser extension integration is currently experimental and is not required to use AOC Toolkit.
Authentication support and headless use
| Platform | Credential backend | Manual verification |
|---|---|---|
| macOS | Keychain | Verified during development on macOS ARM64; final release smoke test pending |
| Windows | Native credential store | Not yet manually verified |
| Linux desktop | Native credential backend (requires an available credential service) | Not yet manually verified |
| Headless / CI | Explicit SESSION_ID environment override |
Synthetic offline integration tests; live headless authentication not yet verified |
Cross-platform CI tests compilation and synthetic workflows, not real desktop credential-store integration. Login/logout manage stored credentials only. An explicit session override avoids accessing the credential store for input acquisition and status. Browser registration is experimental and macOS-specific. Never put secrets into command arguments, logs, or version control.
Creating a project
# Implement the generated solver in src/2025/day1.rs.
Use a puzzle that has already unlocked.
Using an existing Rust project
The global CLI searches the current directory and its ancestors for an aoc.toml file. Configure a Rust project that exposes a local runner binary.
Example for a single-package project:
= 1
[]
= "rust"
= "src"
[]
= "Cargo.toml"
= "release"
Set runner.binary if Cargo needs an explicit binary target. Paths are relative to the project root. For a workspace, point runner.manifest to the solution package's manifest.
In the solution package, use the same toolkit version with the runner feature:
[]
= "=0.1.0-alpha.3" # Match the installed CLI version
= false
= ["runner"]
Implement the aoc_toolkit::core::Day trait for each solver, register your solvers in a static Registry, and pass that registry to aoc_toolkit::runner::run from your local binary. The global CLI delegates execution to that binary through Cargo. Use aoc init and aoc new to generate and register solvers automatically.
Upgrading from 0.1.0-alpha.2 to 0.1.0-alpha.3
After alpha.3 is published, update the global CLI with cargo install aoc-toolkit --version 0.1.0-alpha.3 --locked (or replace the prebuilt binary). Update the existing solution package's toolkit dependency to version = "=0.1.0-alpha.3", retaining default-features = false and features = ["runner"]. Remove any old git/rev or path override if switching to the published crate, and run cargo update -p aoc-toolkit in the solution workspace to refresh its lockfile. Do not regenerate the project or overwrite solvers.
The new runner protocol is not compatible with alpha.2 runners. Inputs are now acquired in the account-specific global cache, without a project-local fallback or automatic migration. Existing project-local input files are not used; the toolkit obtains missing inputs on demand. A previously stored valid session can be reused. Verify authentication, fetch an unlocked puzzle, and run an implemented solver after upgrading.
Run solutions
Puzzle inputs
The global CLI downloads inputs on demand and stores them outside the project. Inputs are shared across projects and isolated by Advent of Code account identity.
| Platform | Default input cache |
|---|---|
| macOS | ~/Library/Caches/kyrboforge/aoc-toolkit/inputs |
| Linux | $XDG_CACHE_HOME/kyrboforge/aoc-toolkit/inputs (defaults to ~/.cache/...) |
| Windows | %LOCALAPPDATA%/kyrboforge/aoc-toolkit/inputs |
Input files are stored under inputs/<account-id>/<year>/<day>.txt. The toolkit remembers verified session-to-account associations using SHA-256 fingerprints, not raw session tokens, in a separate cache directory. Rotating a session token does not invalidate input files once the new session is associated with the same account.
The global CLI manages authentication and prepares inputs before launching the local runner. The runner receives the account-specific input directory, not the session token, and does not depend on the HTTP client or credential store. Known session associations and cached inputs can be used without a network request. A configured session token is still needed to select the account; a known cached binding does not prove that the token remains valid remotely.
All session-consuming commands (run, fetch, auth status, and setup) resolve the same effective session: environment SESSION_ID, then SESSION_ID in the nearest .env, then the system credential store. Invalid overrides fail closed rather than falling back to another account. The status command identifies the session source without displaying the token. Login and logout manage the credential store only; overrides remain active until removed or changed. An absolute AOC_TOOLKIT_CACHE_DIR can override the toolkit cache root for development and testing.
Fetch inputs without a project:
The command uses the Advent of Code unlock calendar (midnight UTC-5 in December). Editions 2015–2024 have 25 days; the current policy for 2025 onward is 12 days. Before the current year's event, specify an earlier year. Bulk fetching runs sequentially and stops on the first acquisition error, returning a nonzero exit status. The command reports whether each attempted input was cached or downloaded. Input downloads and settings verification share a cross-process request lock within the same cache root. A two-second cooldown follows each acquisition or verification attempt before the lock is released; cache hits do not wait for the lock. Keep inputs and credentials private; never publish them in version control.
Cargo features
| Feature | Purpose |
|---|---|
| No default features | Minimal Rust solver contracts and registry |
client |
Authentication, HTTP and account-specific global input caching |
runner |
Local Rust solution execution, independent of authentication and HTTP |
cli (default) |
Global aoc executable, project configuration and adapters |
Development roadmap
- Rust solver contracts and registry
- Local Rust runner and global CLI delegation
- Cross-platform build and test matrix
- Project initialization and day scaffolding
- Desktop authentication, global input caching and fetch (manual platform limits above)
- Progress tracking and benchmarking
- Interactive terminal UI
- Additional language adapters
Contributing
See CONTRIBUTING.md, architecture and language support. Release history is available in GitHub Releases.
This is an independent community project, not affiliated with Advent of Code.
License
MIT.