Skip to content

Codeforces CLI Tool: Simplify your Codeforces experience with easy submission, real-time status tracking, and insightful contest statistics.

License

Notifications You must be signed in to change notification settings

regular-life/Codeforces-CLI-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codeforces CLI Tool (cftool)

A high-quality, professional CLI tool for interacting with Codeforces. Engineered for performance, maintainability, and extensibility.

Features

  • Secure Authentication: Safely stores your Codeforces credentials using system keyring.
  • Smart Submission: Auto-detects contest ID, problem index, and language from your source file.
  • Contest Management: View upcoming and recent contests in a rich table.
  • Live Status: Check your recent submission verdicts with color-coded results.
  • User Stats: View detailed user profiles, ratings, and ranks.
  • Blogs: Keep up with the latest Codeforces blog entries and actions.
  • Configuration: Customizable preferences (e.g., default language, headless browser).

Installation

# Clone the repository
git clone https://github.com/regular-life/Codeforces-CLI-Tool
cd Codeforces-CLI-Tool

# Set up a virtual environment (Recommended)
python3 -m venv .venv
source .venv/bin/activate

# Install the package in editable mode
pip install -e .

Usage Guide

The tool uses a subcommand structure: cftool [COMMAND] [OPTIONS].

1. Authentication

Manage your login session securely.

# Login (Prompts for username/password)
cftool auth login

# Check current login status
cftool auth status

# Logout (Removes credentials from keyring)
cftool auth logout

2. Contests

List active and upcoming contests.

# List contests (Shows top 20 upcoming/recent)
cftool contest list

# List Gym contests
cftool contest list --gym

3. Submissions

Submit solutions directly from your terminal.

Smart Detection:

  • If you name your file 1234A.cpp, the tool automatically submits to Contest 1234, Problem A, using C++17 (detected from extension).
# Simple submission (Infers details from filename)
cftool submit solution 1234A.cpp

# Explicit submission (Overrides detection)
cftool submit solution Main.cpp --contest-id 1234 --problem-index A

# Force a specific language (e.g., Python 3)
cftool submit solution script.py --language 31

4. Submission Status

Check recent verdicts.

# Show your recent submissions (requires login)
cftool status

# Show submissions for specific user (e.g., tourist)
cftool status --handle tourist --count 5

5. User Statistics

View profile information.

# View your own stats
cftool user

# View another user's stats
cftool user --handle tourist

6. Blogs & Actions

View recent activity on Codeforces.

# List recent blogs and comments
cftool blog --count 15

7. Configuration

Manage tool settings.

# Show current configuration
cftool config show

# Set a value (e.g., disable headless mode for debugging)
cftool config set headless_mode false

Architecture

This project is rebuilt as a modular Python package:

  • cftool/core: Backend business logic, API client, and Selenium automation.
  • cftool/cli: Typer-based CLI presentation layer with Rich formatting.
  • cftool/core/models.py: Pydantic data models for type safety.
  • cftool/core/config.py: TOML-based configuration and Keyring integration.

License

MIT

About

Codeforces CLI Tool: Simplify your Codeforces experience with easy submission, real-time status tracking, and insightful contest statistics.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published