Advent of Code Runner
npm install @nguyenhuu/adventofcode





A CLI tool to help you run and test your Advent of Code solutions across different programming languages.
- ๐ Run solutions in multiple languages (Python, JavaScript, Java, C++, Golang, Ruby)
- ๐ Watch mode for automatic re-runs
- ๐จ Beautiful terminal UI with spinners and colors
- ๐ก Auto-fetch puzzle inputs
- ๐งช Test your solutions with sample/real inputs
- ๐ Track your progress and performance
You can use the tool in two ways:
bash
Run directly without installation
npx @nguyenhuu/adventofcodeOr with specific command
npx @nguyenhuu/adventofcode --year 2024 --day 1 --part 1 --language python
`$3
`bash
Install globally
npm install -g @nguyenhuu/adventofcodeRun the tool
adventofcode
`Setup
Save your
session cookie into .env file in the root folder:
`
SESSION=f8fe3ed61...
`> The
session cookie can be found in Developer Tools > Application tab > Cookies > https://adventofcode.com (requires login)> The CLI requires your Advent of Code session token to:
> - Fetch puzzle inputs for your account
> - Display your username and star count
> - Submit your answers to the Advent of Code website
Usage
$3
`bash
Using npx
npx @nguyenhuu/adventofcode --year 2024 --day 1 --part 1 --language pythonOr with global installation
adventofcode --year 2024 --day 1 --part 1 --language python
`$3
`bash
Using npx
npx @nguyenhuu/adventofcodeOr with global installation
adventofcodeThe tool will prompt for missing information:
? Select programming language: (Use arrow keys)
โฏ Python
Javascript
Java
C++
Ruby
Golang
? Select year: 2024
? Select day: 1
? Select part: (Use arrow keys)
โฏ Part 1
Part 2
`$3
1. Run your solution
2. Press
u to submit the result
3. The tool will:
- Submit your answer
- Show if it's correct
- Display your progress$3
-
-y,--year: The year of the challenge (e.g., 2024)
- -d,--day: The day of the challenge (1-25)
- -p,--part: The part of the challenge (1 or 2)
- -l,--language: Programming language (python, javascript, java, cpp, golang, ruby)
- -t,--disable-telemetry: Disable anonymous usage tracking
- -h,--help: Show help information
- -v,--version: Show version of application$3
- s: Use sample.txt as input
- i: Use input.txt as input
- u: Submit the most recent result
- 1-9: Select part
- c: Clear terminal
- q: Quit program
- x: Terminate solution
- Enter: Re-run solution
- h: Show help
$3
`
current/
โโโ 2024/
โ โโโ day1/
โ โโโ sample.txt
โ โโโ part1.py
โโโ .env
`!demo
Telemetry
This application collects anonymous usage data to help improve the user experience. The data collected includes:
- Event types (execution, submission, input fetch, key press)
- Basic context (year, day, part, language, input mode)
- Application version and platform
No personal information is collected. The data is used to:
- Understand usage patterns
- Identify common issues
- Guide future improvements
$3
You can opt out of telemetry in two ways:
1. Using the command line option:
-t or --disable-telemetry2. Using an environment variable:
DISABLE_TELEMETRY=trueDevelopment
$3
- Node.js >= 20
- pnpm >= 10
$3
This project uses pnpm for package management. If you haven't installed pnpm yet, you can do so globally with:
`bash
npm install -g pnpm
`Then, install the project dependencies:
`bash
pnpm install
``bash
Clone the repository
git clone https://github.com/nguyenhuuit/adventofcode-runner.git
cd adventofcode-runnerInstall dependencies
pnpm installBuild the project
pnpm run build
`$3
-
pnpm start: Builds the project and runs the main script.
- pnpm start:dev: Runs the project in development mode.
- pnpm lint: Lints the source files.
- pnpm lint:fix: Lints and fixes issues in the source files.
- pnpm format: Formats the source files using Prettier.
- pnpm format:check: Checks if the source files are formatted correctly.
- pnpm test: Runs the tests using Jest.$3
`
src/
โโโ components/ # React components for UI
โโโ drivers/ # Language-specific drivers
โโโ hooks/ # React hooks
โโโ utils/ # Utility functions
`Contributing
1. Fork the repository
2. Create your feature branch (
git checkout -b feature/amazing-feature)
3. Commit your changes (git commit -m 'feat: add amazing feature')
4. Push to the branch (git push origin feature/amazing-feature`)This project is licensed under the MIT License - see the LICENSE file for details.