The command line

The cocco command pulls a challenge or an exercise set down to your computer as a folder, and pushes it back after you edit it. The statement becomes a Markdown file you can keep in git, reordering test cases is moving a few lines in a text file, and a hundred test files go up in one push instead of a hundred uploads.

API tokens

The command line signs in with an API token, not with your browser. Make one under API tokens on your profile page: type what it is for in What is it for? (say, "laptop") and press Create.

The token is shown once, right after you create it. Copy it then: cocco keeps only a fingerprint of it, so nobody can show it to you again. If you lose it, revoke it and create another.

A token acts as you, on everything you can reach. Keep it as you would a password, and don't put it in a file you share or commit. The list shows when each token was created and last used, so a token marked "never" or unused for months is probably safe to remove. Revoke stops it working immediately.

Give the token to the command line through the environment:

export COCCO_TOKEN=…

The command line can only change challenges and exercise sets on courses where you are staff. Anything else is refused, whatever the token.

Installing and setting up

cocco comes with cocco's own Python package (Python 3.13 or later). Install that package with a tool such as uv tool install or pipx install, pointing it at a copy of cocco's source; ask whoever runs your server where to find it. Inside a copy of the source, uv run cocco works without installing anything.

Tell it which server to talk to, and the token from API tokens:

export COCCO_URL=https://cocco.example.org
export COCCO_TOKEN=…
cocco ls

Both can also be given on each command as --url and --token, but the environment keeps the token out of your shell history. To avoid retyping the address, put url = "https://cocco.example.org" in ~/.config/cocco/cli.toml. Without any of these, cocco talks to http://localhost:8000.

"Not signed in" means the token is missing, wrong or revoked.

Pulling and pushing

cocco ls lists, course by course, the challenges and exercise sets you can edit, with their ids. Hidden, scheduled and archived ones are listed too, with a note.

cocco pull 12 downloads challenge 12 into a new folder named after it, such as challenge-12-two-sum/. Edit the files (see The challenge folder), then, inside the folder:

cocco push

The folder remembers which server and challenge it came from, so inside it neither command needs the id. cocco pull there brings in what changed on the web since. A file you changed and the web didn't is kept, a file the web changed and you didn't is updated, and a file changed on both sides stops the pull with nothing written.

A push is refused if the challenge changed on the web since your last pull or push, so you can't overwrite a colleague's edit by accident. Pull first, then push again. --force overrides either refusal: on a pull it takes the server's copy and moves yours into .cocco/discarded/, and on a push it overwrites what is on the server.

Exercise sets work the same way with --set: cocco pull --set 5 gives you a folder holding exercises.md. Pushing it imports a new version, and cocco push waits for the judge to build it and prints the problems it found (up to a minute; --no-wait skips the wait).

A few more:

The challenge folder

A pulled challenge is a folder, and the zip --zip gives you holds the same files:

challenge.toml looks like this:

title = "Two sum"
ranking = "total_score"
score_threshold = 10.0
max_time_s = 2.0
max_memory_mb = 256.0
max_threads = 1
visible_from = 2026-11-09T09:00:00+01:00
evaluator = "evaluator/check.py"

[[testcase]]
input = "tests/sample.in"
expected_output = "tests/sample.out"
is_sample = true
is_active = true

[[testcase]]
input = "tests/big.in"
expected_output = "tests/big.out"
is_sample = false
is_active = true

[[reference]]
file = "references/dijkstra.cpp"
label = "Teacher's Dijkstra"
visibility = "results"

A test case is known by its input file name. Renaming the input replaces the test case with a new one. Deleting a block retires the test case if any submission has been graded on it, and deletes it otherwise, so a push never throws away a score.

Each [[reference]] block is one reference solution. Only file is required: label defaults to the file name and visibility to hidden, which is what the web's Add does. visibility is hidden (Staff only), results (Leaderboard) or source (Leaderboard and source). A reference is known by its file name. Change the code in the file and the push replaces the reference with a new one, which is graded again; change only the label or visibility and it is updated in place. Deleting a block deletes the reference and its results. A push queues new and replaced references and returns without waiting; their results appear on the Reference solutions card. A push is refused while a reference it would replace or delete is being graded: push again when it has finished. A checkout that rewrites line endings (git's autocrlf) changes every file's code, so its next push replaces every reference.

Other files at the top of the folder, such as a script that generates the test files, stay on your computer: a push doesn't send them and a pull leaves them alone. The challenge-writing skill writes a whole folder this way, generator included.

Everything is checked before anything changes. If the push is refused, for a missing file, a bad limit or a name used twice, the challenge stays exactly as it was. A push can carry up to 256 MB, counted before compression. Pushing changes no recorded scores; use Regrade all for that.