Install and use the NextJudge CLI to download problems, run tests locally and submit from the terminal.
The CLI lives in src/cli/. It is a Python package invoked as nextjudge. Use it for scripting problem sets, CI smoke tests or terminal-based workflows during practice and contests.
Install
Section titled “Install”Add the bin directory to your PATH (replace with your clone location):
export REPO_ROOT=/opt/nextjudgeexport PATH="$REPO_ROOT/src/cli/bin:$PATH"Add those lines to your shell profile if you use the CLI regularly.
Optional Python deps for uploads and extras:
pip install -r src/cli/requirements.txtCommands
Section titled “Commands”Download a problem
Section titled “Download a problem”nextjudge get 1Writes the prompt and public test cases into the current directory. Creates .nextjudge.env with the problem ID for later commands.
Test locally
Section titled “Test locally”Runs your solution against public tests in the same Docker environment as production judges. Requires Docker.
nextjudge test solution.pyIf local tests pass and remote submission fails, check environment drift first: wrong language ID, missing newline in output and similar issues.
Submit
Section titled “Submit”nextjudge submit solution.pyUses the problem ID from .nextjudge.env. Override with --id 42 when working outside that directory.
Configure credentials for the target instance. The CLI registers or logs in via POST /v1/basic_register and POST /v1/basic_login (see Authentication).
Typical loop
Section titled “Typical loop”nextjudge get 3# read prompt.md, edit solution.pynextjudge test solution.pynextjudge submit solution.pyTest locally until tests pass, then submit once to reduce queue load.
When to use the web editor instead
Section titled “When to use the web editor instead”The web editor supports live custom input runs, language switching and contest context. The CLI targets file-based workflows and automation rather than replacing the UI.