
rustmas: Advent of Code entirely from the terminal, inputs to stars
Got super tired of going to the browser to grab inputs and paste answers, so I built a tool that does the whole loop from the CLI. You give it your session cookie once, in a .env:
cargo run fetch -y 2015 -d 1 # pull a puzzle into cache/
cargo run solve -y 2015 -d 1 # run your solution
cargo run solve -y 2015 -d 1 --validate # check against a third party solver
cargo run solve -y 2015 -d 1 --submit # check, then submit for the star
Year and day are filters, so omitting means all of them. Things it does that took real thought:
Solve fetches whatever is missing, so fetch is optional. A fully cached run works offline.
--submit only sends answers the independent solver agreed with first, because wrong answers to AOC cost an escalating cooldown as you continually submit. Checks with the solver are free (thanks fornwall). Submissions aren't.
When part one gets a star, it pulls part two's text in the same run instead of leaving it for next time.
Inputs are cached with a hash of the session that fetched them. Inputs are account specific, so if you swap accounts the tool notices and refetches rather than letting you submit an answer computed from the old account's input.
Puzzle text is cached per part as markdown.
Worth being clear about the approach: this isn't a binary you install and are done with. It's a repo you live in. You clone it, and the tool handles the fetching, checking, and submitting, but the solutions are yours to write, day by day, inside it. Solving a new day means copying the template, writing your parts, and adding one registry line, so the project grows as your event does. No solutions ship with main; mine are on a separate branch if you'd like examples.
Credit where owed:
- The answer checking leans on fornwall's independent solver (https://aoc.fornwall.net/, https://github.com/fornwall/advent-of-code), which answers the same question as many times as you ask.
- And Advent of Code itself is Eric Wastl's (https://adventofcode.com/about). The tool follows the site's asks: inputs cached rather than re-downloaded, puzzle text kept out of git, a reachable contact in the User-Agent.
On AI usage:
I use it as a working partner, and some code in this repo is generated. The hill that I stand on is understanding before allowing AI to iterate since generation without understanding of what you're asking for usually results in a black box that likely doesn't exactly do what was intended (this to me constitutes slop). I write the code I want to write, which is most of it, and hand off what I could write in my sleep: doc comment wording, README instructions, test scaffolding, and refactors I've already designed but don't want to push through by hand, like restructuring files and rewiring every import. It's also a brainstorming partner, where I'll ask for variations on an idea and then write my own from what I learned. Everything generated went through my eyeballs line by line, and the design decisions are recorded in context/design/, including the ones that got reversed and why.