Metadata-Version: 2.4
Name: cannjudge
Version: 0.1.0
Summary: A python cli tool for cannjudge
Author-email: ieu <3384953140@qq.com>
Requires-Python: >=3.12
Requires-Dist: requests>=2.32
Requires-Dist: tomlkit>=0.15.0
Requires-Dist: typer>=0.12
Description-Content-Type: text/markdown

# CannJudge CLI

CLI tool for the [CannJudge](https://cannjudge.cn) coding platform — pull problems, submit solutions, and check results from the terminal.

## Install

```bash
uv tool install cannjudge
```

## Usage

```bash
# login (cookies cached by typer.get_app_dir)
cannjudge login

# pull a problem template
cannjudge pull addcmul

# edit source files, then submit (reads cannjudge.toml)
cd addcmul
cannjudge submit

# submit with auto-polling
cannjudge submit --watch

# refresh template files in current project
cannjudge pull

# check latest result
cannjudge result --watch
```

## Commands

| Command | Description |
|---------|-------------|
| `login` | Login and cache credentials locally |
| `logout` | Clear cached credentials |
| `whoami` | Show current user |
| `problems [-c CONTEST]` | List available problems |
| `pull [problem] [-c CONTEST] [-o DIR]` | Pull / refresh template, create `cannjudge.toml` |
| `submit [DIR] [--watch] [-i SEC]` | Submit code (reads `cannjudge.toml`) |
| `result [id] [--watch] [-i SEC]` | View / poll submission result |

## Workspace

After `pull`, the output directory contains:

```
addcmul/
├── cannjudge.toml        # [contest], [problem], [[files]]
├── operator.md           # problem description
├── CMakeLists.txt
├── op_host/
│   └── addcmul.cpp
└── op_kernel/
    ├── addcmul.cpp
    └── ...
```

## Development

```bash
git clone <repo> && cd cannjudge
uv sync
uv run pytest                  # 32 tests
uv run cannjudge --help
```
