Metadata-Version: 2.4
Name: cfmate
Version: 0.1.2
Summary: A Codeforces CLI tool — fetch, display, and test against problems.
Author: Saksham Tale
License: MIT License
        
        Copyright (c) 2026 Saksham Tale
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Repository, https://github.com/Saksham-cmd-tech/cf_tool.git
Keywords: codeforces,competitive-programming,cli
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer[all]>=0.12
Requires-Dist: rich>=13.7
Requires-Dist: cloudscraper>=1.2.71
Requires-Dist: beautifulsoup4>=4.12
Dynamic: license-file

## Disclaimer

This tool is not affiliated with Codeforces.

It fetches publicly available problem statements for personal use only.
Users must comply with Codeforces Terms of Service:
https://codeforces.com/terms

This tool does not store or redistribute problems beyond local caching.

# cf-tool

A fast, Codeforces CLI — fetch problems, display them cleanly, and test your solutions against sample cases, all from the terminal.

---

## Features

- **`cf get`** — fetch and display any Codeforces problem with clean Rich formatting
- **`cf run`** — run your solution against all sample tests, with pass/fail output and diffs
- **Local cache** — problems are saved to `.cf_cache/` so repeated fetches are instant
- **Multi-language** — Python, C++, C, Java, JavaScript, TypeScript, Ruby, Go, Rust
- **Smart ID inference** — name your file `1829A.py` and skip the `--problem` flag
- **Clean UX** — spinner for loading, no fake delays, no excessive color

---

## Installation

```bash
git clone https://github.com/yourname/cf-tool.git
cd cf-tool
pip install -e .
```

This registers the `cf` command globally.

---

## Usage

### Fetch a problem

```bash
cf get 1829A
cf get 2227D --no-cache   # bypass cache
```

### Run your solution

```bash
# Specify the problem explicitly
cf run solution.py --problem 1829A

# Or name your file after the problem — ID is inferred automatically
cf run 1829A.py
cf run 2227D.cpp

# Custom time limit (milliseconds)
cf run solution.py -p 1829A --time-limit 2000
```

### Manage the cache

```bash
cf cache list           # list cached problems
cf cache clear 1829A    # remove one problem
cf cache clear          # remove everything
```

---

## Supported Languages

| Extension | Language   | How it runs              |
|-----------|------------|--------------------------|
| `.py`     | Python 3   | `python3 file.py`        |
| `.cpp`    | C++17      | `g++ -O2` then run       |
| `.c`      | C          | `gcc -O2` then run       |
| `.java`   | Java       | `javac` then `java`      |
| `.js`     | JavaScript | `node file.js`           |
| `.ts`     | TypeScript | `ts-node file.ts`        |
| `.rb`     | Ruby       | `ruby file.rb`           |
| `.go`     | Go         | `go run file.go`         |
| `.rs`     | Rust       | `rustc -O` then run      |

---

## Project Structure

```
cf_tool/
├── cf_tool/
│   ├── __init__.py     # package version
│   ├── cli.py          # Typer CLI entry point
│   ├── scraper.py      # cloudscraper HTTP layer
│   ├── parser.py       # BeautifulSoup HTML → Problem
│   ├── runner.py       # subprocess test execution
│   ├── formatter.py    # Rich terminal output
│   ├── cache.py        # JSON local cache
│   ├── models.py       # Problem + TestCase dataclasses
│   └── utils.py        # LaTeX cleaning, ID parsing, normalization
├── pyproject.toml
├── requirements.txt
└── README.md
```

---

## Exit Codes

| Code | Meaning                        |
|------|--------------------------------|
| `0`  | All tests passed               |
| `1`  | One or more tests failed / error |

This makes `cf run` composable in shell scripts and CI pipelines.

---

## License

MIT
