This repository is a TypeScript console runner for Advent of Code practice. It uses ESM and tsx for a fast development workflow.
Quick commands (PowerShell)
# Quick usage
- One-shot dev run (recommended when you have autosave enabled):
npm run dev -- --day 1 --part 1
- Watch/dev loop (auto-reload) — explicit command:
npm run dev:watch -- --day 1 --part 1
Notes on npm argument forwarding: when running via `npm run` the underlying `tsx` binary may parse flags itself. If you find flags being consumed, either run `npx tsx advent-app.ts -- --day 1 --part 1` (direct) or pass an extra `--` through npm: `npm run dev -- -- --day 1 --part 1`.
# Run a single day's TypeScript file directly (no runner)
npx tsx day1/index.ts
# Build (compile to `dist`)
# Run compiled output
npm start
# Tests & lint
npm test
npm run lint
npm run formatProject layout
advent-app.ts— runner that readsdayN/input.txtand dynamically importsdayN/index.ts.dayN/index.ts— implementexport function Part1(input: string)andexport function Part2(input: string)for each day.dayN/input.txt— put puzzle input here.dayN/sample.txt— (optional) small sample inputs for tests.test/utils.ts— helper to load sample files in tests.
Notes
- Interactive prompts use
promptswhen available, with a fallback to Node'sreadline/promises. - CLI parsing uses
yargswhen available; the runner also accepts--day=1or-d 1style flags. - ESLint and Prettier are included for linting and formatting.
- CI:
.github/workflows/ci.ymlruns lint, build and tests on push/PR.
Parsing assumptions
- Day input parsing currently assumes non-negative integer tokens (no negatives or decimals). The parser trims blank lines and validates numeric tokens; malformed lines are ignored.
Dependabot & branch protection
- This repository uses Dependabot to propose dependency updates on a weekly schedule. Dependabot PRs will trigger CI so updates are validated automatically.
- The CI workflow includes a dependency-review step that fails the build if a PR introduces any known dependency vulnerabilities.
- For safer merges, enable branch protection on
master/mainto require passing status checks (CI) before merging.
Git ignore
- A
.gitignorefile is included; it ignoresnode_modules,dist,.vscode, and other local files.