An Advent of Code command-line tool developed using Node.js.
For the command-line tool:
# β¨ Auto-detect
npx nypm install -g @bryan-hoang/aoc-cli
# npm
npm install -g @bryan-hoang/aoc-cli
# yarn
yarn add -g @bryan-hoang/aoc-cli
# pnpm
pnpm install -g @bryan-hoang/aoc-cli
# bun
bun install -g @bryan-hoang/aoc-cli
# deno
deno install -g @bryan-hoang/aoc-cli
# Running the tool
aoc <args>
# or
aoc-cli <args>
or
# npm
npx @bryan-hoang/aoc-cli@latest <args>
# pnpm
pnpm dlx @bryan-hoang/aoc-cli@latest <args>
# bun
bunx @bryan-hoang/aoc-cli@latest <args>
# deno
deno run -A npm:@bryan-hoang/aoc-cli@latest <args>
For the client library:
# β¨ Auto-detect
npx nypm install @bryan-hoang/aoc-client
# npm
npm install @bryan-hoang/aoc-client
# yarn
yarn add @bryan-hoang/aoc-client
# pnpm
pnpm install @bryan-hoang/aoc-client
# bun
bun install @bryan-hoang/aoc-client
# deno
deno install @bryan-hoang/aoc-client
For the command-line tool:
$ aoc help
An Advent of Code command-line tool
USAGE aoc [OPTIONS] submit|download|help
COMMANDS
submit Submit puzzle answer
download Save puzzle description and input to files
help Print this message or the help of the given subcommand(s)
OPTIONS
-d, --day <DAY> Puzzle day [default: last unlocked day (during Advent of Code month)]
-y, --year <YEAR> Puzzle year [default: year of current or last Advent of Code event]
-s, --session-file <PATH> Path to session cookie file [default: /home/bryan/.config/advent-of-code/session-cookie.txt]
-h, --help Print help information
--version Print version information
For the client library:
ESM (Node.js, Bun, Deno)
import { AocClientBuilder, AocClient } from "@bryan-hoang/aoc-client";
CommonJS (Legacy Node.js)
const { AocClientBuilder, AocClient } = require("@bryan-hoang/aoc-client");
CDN (Deno, Bun and Browsers)
import {
AocClientBuilder,
AocClient,
} from "https://esm.sh/@bryan-hoang/aoc-client";
- buildClient
- #validateBuild
- getSessionCookieFromDefaultLocations
- getSessionCookieFromFile
- getDefaultSessionCookieFile
- sessionCookie
- year
- day
- latestPuzzleDay
- latestEventYear
- overwriteFiles
Method | Type |
---|---|
buildClient |
() => AocClient |
Method | Type |
---|---|
#validateBuild |
() => asserts this is this and { _sessionCookie: string; _year: number; _day: number; } |
Method | Type |
---|---|
getSessionCookieFromDefaultLocations |
() => AocClientBuilder |
Method | Type |
---|---|
getSessionCookieFromFile |
(file: string) => AocClientBuilder |
Method | Type |
---|---|
getDefaultSessionCookieFile |
() => string |
Method | Type |
---|---|
sessionCookie |
(sessionCookie: string) => AocClientBuilder |
Method | Type |
---|---|
year |
(year: number) => AocClientBuilder |
Method | Type |
---|---|
day |
(day: number) => AocClientBuilder |
Method | Type |
---|---|
latestPuzzleDay |
() => AocClientBuilder |
Method | Type |
---|---|
latestEventYear |
() => AocClientBuilder |
Method | Type |
---|---|
overwriteFiles |
(overwriteFiles: boolean) => AocClientBuilder |
Method | Type |
---|---|
getBuilder |
() => AocClientBuilder |
Method | Type |
---|---|
ensureDayUnlocked |
() => void |
Method | Type |
---|---|
isDayUnlocked |
() => boolean |
PRs accepted.
Small note: if editing the README, please conform to the standard-readme specification.
MIT Β© 2024 Bryan Hoang
Functionality is inspired by scarvalhojr/aoc-cli. Project structure is inspired by nuxt/cli.
π€ auto updated with automd