A command-line interface tool for Aizu Online Judge (AOJ), inspired by atcoder-cli. This tool streamlines your competitive programming workflow by managing authentication, downloading problem sets, running tests locally, and submitting solutions directly from your terminal.
- 🔐 Secure Authentication: Login to AOJ with secure session management
- 📥 Problem Download: Fetch problem descriptions and test cases
- 🧪 Local Testing: Run your solutions against sample test cases locally
- 📤 Direct Submission: Submit your solutions to AOJ from the command line
- 🗂️ Project Organization: Automatically organize problems in a structured directory layout
- 🔄 Session Persistence: Maintains login sessions across multiple uses
- 🛡️ Secure Storage: Credentials stored securely in your local configuration
brew tap YuminosukeSato/aoj-cli
brew install aoj-cli- Go 1.21 or higher
- Git
# Clone the repository
git clone https://github.com/YuminosukeSato/AOJ-cli.git
cd AOJ-cli
# Build the binary
go build -o aoj ./cmd/aojcli
# Move to PATH (optional)
sudo mv aoj /usr/local/bin/go install github.com/YuminosukeSato/AOJ-cli/cmd/aojcli@latestaoj login
# Enter your username and password when prompted# Initialize a specific problem
aoj init ITP1_1_A
# Initialize with a custom directory name
aoj init ITP1_1_A --dir hello-world# Run tests for the current problem
aoj test main.cpp
# Run tests with custom input
aoj test main.py --case 1# Submit your solution
aoj submit main.cpp
# Submit with specific language
aoj submit solution.py --lang Python3Authenticate with AOJ and save your session locally.
aoj loginClear your local session.
aoj logoutInitialize a new problem directory with test cases.
aoj init ITP1_1_A
aoj init --contest ITP1 # Initialize all problems in a contestOptions:
--dir, -d: Custom directory name--contest, -c: Initialize entire contest
Run your solution against sample test cases.
aoj test main.cpp
aoj test solution.py --case 2Options:
--case, -c: Run specific test case--timeout, -t: Set execution timeout (default: 2s)
Submit your solution to AOJ.
aoj submit main.cpp
aoj submit solution.py --lang Python3Options:
--lang, -l: Specify programming language--wait, -w: Wait for judge result
Check submission status.
aoj status # Latest submission
aoj status --all # All recent submissionsManage configuration settings.
aoj config set default-lang cpp
aoj config get default-lang
aoj config listConfiguration file is stored at ~/.config/aoj/config.toml.
[user]
default_language = "cpp"
default_template = "~/.config/aoj/templates/main.cpp"
[test]
timeout = 2000 # milliseconds
diff_mode = "unified" # unified, split, or simple
[submit]
wait_result = true
open_browser = falseWhen you initialize a problem, AOJ CLI creates the following structure:
ITP1_1_A/
├── problem.md # Problem description
├── samples/ # Sample test cases
│ ├── 1.in
│ ├── 1.out
│ ├── 2.in
│ └── 2.out
└── main.cpp # Your solution file (from template)
Create custom templates for different languages:
# Create a template directory
mkdir -p ~/.config/aoj/templates
# Add your templates
cat > ~/.config/aoj/templates/main.cpp << 'EOF'
#include <iostream>
using namespace std;
int main() {
// Your code here
return 0;
}
EOF
# Set as default
aoj config set default-template ~/.config/aoj/templates/main.cpp- Go 1.21+
- Task (optional, for automation)
# Clone the repository
git clone https://github.com/YuminosukeSato/AOJ-cli.git
cd AOJ-cli
# Install dependencies
go mod download
# Run tests
go test ./...
# Build
go build -o aoj ./cmd/aojcli# Install Task
brew install go-task/tap/go-task
# Run common tasks
task build # Build the binary
task test # Run tests
task lint # Run linters
task dev # Run with hot reload.
├── cmd/aojcli/ # Entry point
├── internal/
│ ├── cli/ # Command implementations
│ ├── domain/ # Business logic
│ │ ├── entity/ # Domain entities
│ │ ├── model/ # Value objects
│ │ └── repository/ # Repository interfaces
│ ├── infrastructure/ # External services
│ │ └── repository/ # Repository implementations
│ └── usecase/ # Application logic
├── pkg/
│ ├── cerrors/ # Error handling
│ ├── config/ # Configuration management
│ └── logger/ # Logging utilities
└── test/ # Integration tests
We welcome contributions! Please see our Contributing Guidelines.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Write tests for new features
- Follow Go best practices
- Run
task lintbefore committing - Update documentation as needed
- Verify your username and password
- Check if AOJ website is accessible
- Clear session with
aoj logoutand try again
- Ensure the binary is in your PATH
- Try using the full path to the binary
- Restart your terminal session
- Check your internet connection
- Verify the problem ID is correct
- Try logging in again
Enable debug logging for troubleshooting:
AOJ_LOG_LEVEL=debug aoj test main.cppThis project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by atcoder-cli
- Thanks to Aizu Online Judge for providing the platform
- Built with Cobra for CLI framework
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Wiki: Project Wiki
- Support for more programming languages
- Interactive problem selector
- Contest mode with timer
- Performance statistics tracking
- Integration with code editors (VSCode, Vim)
- Parallel test execution
- Custom judge programs
- Problem recommendation system
Made with ❤️ by Yuminosuke Sato