Skip to content

rbx#

The rbx CLI is the main entry point for all operations. It provides a set of commands to manage problems, contests, and the environment.

Usage:

rbx [OPTIONS]

Name Type Description Default
-c, --cache CacheLevel Which degree of caching to use. CACHE_ALL
--sanitized, -s BOOLEAN Whether to compile and run testlib components with sanitizers enabled. If you want to run the solutions with sanitizers enabled, use the "-s" flag in the corresponding run command. False
--capture, -cp BOOLEAN Whether to save extra logs and outputs from interactive solutions. False
-p, --profile TEXT Which timing profile to use when running solutions. -
--profiling BOOLEAN Whether to profile (capture performance statistics) of the execution. False
-C, --contest TEXT Select a contest variant by id (when contest.rbx.yml has use_variants: true). Defaults to the RBX_CONTEST env var. -
--version, -v BOOLEAN - False

Commands#

Command Description
rbx each Run a command for each problem in the contest. Chain commands with :: to queue them.
rbx on Run a command in the context of a problem (or a set of problems) of a contest. Chain commands with :: to queue them.
rbx ui Show an UI for exploring testcases of the current problem.

each#

Runs a command for each problem in the contest, in a TUI with one tab per problem.

Chain several commands with :: to queue them all at once, in order:

rbx each build :: package build

Each problem runs its whole chain before the next problem starts. If a command in a chain fails, the rest of that problem's chain is skipped -- pass -k/--keep-going to run it anyway. Other problems are unaffected either way.

Commands you type into the TUI later are queued too, but they always run, even after a failure.

Pass -i/--inline to skip the TUI and run every problem's chain straight in your terminal, one after another. Nothing is interactive in that mode, and the command exits non-zero if any command failed, so it is the mode to reach for from a script.

Usage:

rbx each [OPTIONS]

Name Type Description Default
--keep-going, -k BOOLEAN Keep running the rest of a chain in a problem even after a command fails. Must come before the problem selector in rbx on. False
--inline, -i BOOLEAN Run the commands straight in this terminal, one after another, instead of opening the TUI. Must come before the problem selector in rbx on. False

on#

Runs a command in the context of one problem (or a set of problems) of a contest.

The problem selector is a comma-separated list. Each entry names a problem by its short name, by the name it declares in its problem.rbx.yml, by one of its aliases, or by the basename of its folder -- looked up in that order, so the letter always wins over another problem's alias.

Selector Selects
B the problem whose short name, name, alias or folder is B
A,C both problems
A..C every problem from A to C, in contest order
day1-* every problem matching the pattern (* and ? are wildcards)
* every problem in the contest
*,!C every problem but C
!C the same -- a selector of exclusions starts from every problem

Ranges are written with two dots: A-C is read as a literal name, since a problem may well be called two-sum. An entry that matches no problem is an error, so a typo never runs on a subset of what you meant.

Quote selectors that use * or !, which your shell would otherwise expand.

Like rbx each, commands can be chained with :::

rbx on A..C build :: run -s

A single command on a single problem runs directly in your terminal; anything else opens the TUI. Pass -i/--inline to keep everything in the terminal instead, running each problem's chain in turn and exiting non-zero if any command failed -- handy for a couple of problems, or for a script that cannot answer a TUI.

Since flags after the problem selector belong to the chained commands, -k/--keep-going and -i/--inline have to come first: rbx on -ik A build :: run.

Usage:

rbx on <PROBLEMS> [OPTIONS]

Arguments:

Name Description Required
PROBLEMS Problems to run on: short names, names, aliases or folders, comma-separated. Also A..C, *, globs and ! exclusions. Yes
Name Type Description Default
--keep-going, -k BOOLEAN Keep running the rest of a chain in a problem even after a command fails. Must come before the problem selector in rbx on. False
--inline, -i BOOLEAN Run the commands straight in this terminal, one after another, instead of opening the TUI. Must come before the problem selector in rbx on. False

ui#

Show an UI for exploring testcases of the current problem.

Usage:

rbx ui [OPTIONS]


Configuration#

Command Description
rbx config Manage setter configuration (sub-command).
rbx edit Open problem.rbx.yml in your default editor.
rbx environment Set or show the current box environment.
rbx header Generate the rbx.h header file.
rbx languages List the languages available in this environment
rbx presets Manage presets (sub-command).
rbx vars Show the expanded vars of this problem.

config (cfg)#

Manage setter configuration (sub-command).

Usage:

rbx config [OPTIONS]

Command Description
rbx config edit Open the setter config in an editor.
rbx config list Pretty print the config file.
rbx config path Show the path to the setter config.
rbx config reset Reset the config file to the default one.

edit#

Open the setter config in an editor.

Usage:

rbx config edit [OPTIONS]


list (ls)#

Pretty print the config file.

Usage:

rbx config list [OPTIONS]


path#

Show the path to the setter config.

Usage:

rbx config path [OPTIONS]


reset#

Reset the config file to the default one.

Usage:

rbx config reset [OPTIONS]


edit (e)#

Open problem.rbx.yml in your default editor.

Usage:

rbx edit [OPTIONS]


environment (env)#

Set or show the current box environment.

Usage:

rbx environment <ENV> [OPTIONS]

Arguments:

Name Description Required
ENV - No
Name Type Description Default
--install, -i TEXT Whether to install this environment from the given file. -

header#

Generate the rbx.h header file.

Usage:

rbx header [OPTIONS]


languages#

List the languages available in this environment

Usage:

rbx languages [OPTIONS]


presets#

Manage presets (sub-command).

Usage:

rbx presets [OPTIONS]

Command Description
rbx presets create Create a new preset.
rbx presets ls List details about the active preset.
rbx presets registry Manage the preset registry.
rbx presets sync Sync current package assets with those provided by the installed preset.
rbx presets update Update preset of current package

create#

Create a new preset.

Usage:

rbx presets create [OPTIONS]

Name Type Description Default
--name TEXT The name of the preset to create. This will also be the name of the folder. A relative path may be given, in which case the preset name is its basename. -
--uri TEXT The URI of the new preset. -
--preset, -p TEXT The URI of the preset to init the new preset from. -
--local BOOLEAN Whether to fetch the init preset from the local version of rbx, instead of the remote one (not recommended). False

ls#

List details about the active preset.

Usage:

rbx presets ls [OPTIONS]


registry#

Manage the preset registry.

Usage:

rbx presets registry [OPTIONS]

Command Description
rbx presets registry add Add a preset to the user registry.
rbx presets registry ls List presets available in the registry.
rbx presets registry rm Remove a preset from the user registry.

add#

Add a preset to the user registry.

Usage:

rbx presets registry add <URI> [OPTIONS]

Arguments:

Name Description Required
URI URI of the preset to register (owner/repo, URL, or path). Yes
Name Type Description Default
--local BOOLEAN Resolve the preset from the local rbx version. False

ls#

List presets available in the registry.

Usage:

rbx presets registry ls [OPTIONS]


rm#

Remove a preset from the user registry.

Usage:

rbx presets registry rm <NAME> [OPTIONS]

Arguments:

Name Description Required
NAME Name of the preset to remove. Yes

sync#

Sync current package assets with those provided by the installed preset.

Usage:

rbx presets sync [OPTIONS]

Name Type Description Default
--update, -u BOOLEAN Whether to fetch an up-to-date version of the installed preset from remote, if available. False
--force, -f BOOLEAN Whether to forcefully overwrite the local assets with the preset assets, even if they have been modified. False
--symlinks, -s BOOLEAN Whether to update all symlinks in the preset to point to their right targets. False

update#

Update preset of current package

Usage:

rbx presets update [OPTIONS]


vars#

Show the expanded vars of this problem.

Usage:

rbx vars [OPTIONS]

Name Type Description Default
--json BOOLEAN Print the vars as a JSON object of dotted keys and string values. False
--render BOOLEAN Read statement expressions from stdin, one per line, and print a JSON object mapping each to what it renders to. False
--groups BOOLEAN Also show the resolved vars of each testcase group. Ignored with --render, which takes the group per expression. False
--target FilterTarget What the --render expressions are being formatted for. Ignored without --render. FilterTarget.TEXT

Deploying#

Command Description
rbx build Build all tests for the problem.
rbx package Build problem packages (sub-command).
rbx statements Manage statements (sub-command).
rbx tutorials Manage tutorials/editorials (sub-command).

build (b)#

Builds the problem package.

This command compiles all generators, validators, and checkers. Then it generates inputs using the generator script and validates them with the validator. Finally, it generates the outputs using the main solution.

It is recommended to run this command before packaging the problem to ensure everything is up-to-date.

Usage:

rbx build [OPTIONS]

Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--validate BOOLEAN Whether to validate outputs for tests. True
--visualize BOOLEAN Whether to build visualizations for inputs/outputs of tests. False

package (pkg)#

Build problem packages (sub-command).

Usage:

rbx package [OPTIONS]

Command Description
rbx package boca Build a package for BOCA.
rbx package domjudge Build a package for DOMjudge.
rbx package moj Build a package for MOJ.
rbx package pkg Build a package for PKG.
rbx package polygon Build a package for Polygon.

boca#

Build a package for BOCA.

Usage:

rbx package boca [OPTIONS]

Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--upload, -u BOOLEAN If set, will upload the package to BOCA. False
--language, -l TEXT If set, will use the given language as the main language. Leave unset if you want to use the language of the topmost statement. -

domjudge#

Build a package for DOMjudge.

Usage:

rbx package domjudge [OPTIONS]

Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--language, -l TEXT If set, will use the given language as the main language. Leave unset if you want to use the language of the topmost statement. -

moj#

Build a package for MOJ.

Usage:

rbx package moj [OPTIONS]

Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--upload, -u BOOLEAN If set, will upload the package to MOJ. False
--language, -l TEXT If set, will use the statement in the given language as the main one. Leave unset to use the Portuguese statement, or the topmost one without it. Every other en/es statement ships as a translation. -
--calibrate BOOLEAN If set, let MOJ calibrate the time limits on the judge machine instead of pinning the ones estimated by rbx time -p moj. False
--reference-only, -ro BOOLEAN If set, ship only the reference (main) solution, dropping the others. MOJ runs every solution in the package when it calibrates, so this makes an upload much faster -- at the cost of nothing verifying the dropped solutions on the judge. For iterating; package again without it before going live. False

pkg#

Build a package for PKG.

Usage:

rbx package pkg [OPTIONS]

Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4

polygon#

Build a package for Polygon.

Usage:

rbx package polygon [OPTIONS]

Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--upload, -u BOOLEAN If set, will upload the package to Polygon. False
--language, -l TEXT If set, will use the given language as the main language. Leave unset if your problem has no statements. -
--upload-as-english BOOLEAN If set, will force the main statement to be uploaded in English. False
--upload-only TEXT Only upload the following types of assets to Polygon. -
--upload-skip TEXT Skip uploading the following types of assets to Polygon. -
--upload-tests-raw BOOLEAN Upload built test inputs directly instead of relying on Polygon-side generators. Skips generator uploads and clears the test script. All test inputs must be < 1 MiB. Forces a full local build. Requires --upload. False
--validate-statement BOOLEAN If set, will validate the statement for Polygon. False

statements (st)#

Manage statements (sub-command).

Usage:

rbx statements [OPTIONS]

Command Description
rbx statements build Build statements.

build (b)#

Build statements.

Usage:

rbx statements build <NAMES> [OPTIONS]

Arguments:

Name Description Required
NAMES Variants of statements to build. No
Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--languages TEXT Languages to build statements for. If not specified, build statements for all available languages. -
--output StatementType Output type to be generated. PDF
--samples BOOLEAN Whether to build the statement with samples or not. True
--vars TEXT Variables to be used in the statements. -
--validate BOOLEAN Whether to validate outputs for testcases or not. True
-p, --profile TEXT Timing profile to render the statement against. Must exist in this problem. -

tutorials (tut)#

Manage tutorials/editorials (sub-command).

Usage:

rbx tutorials [OPTIONS]

Command Description
rbx tutorials build Build tutorials (editorials).

build (b)#

Build tutorials (editorials).

Usage:

rbx tutorials build <NAMES> [OPTIONS]

Arguments:

Name Description Required
NAMES Variants of tutorials to build. No
Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--languages TEXT Languages to build tutorials for. If not specified, build tutorials for all available languages. -
--output StatementType Output type to be generated. PDF
--samples BOOLEAN Whether to build the tutorial with samples or not. True
--vars TEXT Variables to be used in the tutorials. -
--validate BOOLEAN Whether to validate outputs for testcases or not. True
-p, --profile TEXT Timing profile to render the tutorial against. Must exist in this problem. -

Testing#

Command Description
rbx compile Compile an asset given its path.
rbx irun Build and run solution(s) by passing testcases in the CLI.
rbx issues Show what is wrong with the problem, before and after a run.
rbx preship Estimate a time limit and check the whole package against it: every solution is run, and every one of them has to behave as problem.rbx.yml says it does.
rbx run Build and run solution(s).
rbx stress Run a stress test.
rbx summary Print a summary of the problem.
rbx time Estimate a time limit for the problem using the timings of its solutions and the estimation strategy configured in the environment.
rbx unit Run unit tests for the validator and checker.
rbx validate Run the validator in a one-off fashion, interactively.

compile#

Compile an asset given its path.

Usage:

rbx compile <PATH> <EXTRA_FLAGS> [OPTIONS]

Arguments:

Name Description Required
PATH Path to the asset to compile. No
EXTRA_FLAGS Extra flags to pass to the compiler, after a -- separator. No
Name Type Description Default
--sanitized, -s BOOLEAN Whether to compile the asset with sanitizers enabled. False
--warnings, -w BOOLEAN Whether to compile the asset with warnings enabled. False
--all, -a BOOLEAN Whether to compile all assets. False

irun (ir)#

Build and run solution(s) by passing testcases in the CLI.

Usage:

rbx irun <SOLUTIONS> [OPTIONS]

Arguments:

Name Description Required
SOLUTIONS Path to solutions to run. If not specified, will run all solutions. No
Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--benchmark, -b INTEGER Benchmark level: 0 (off), 1 (benchmark the solution run). 0
--outcome, -o TEXT Include only solutions whose expected outcomes intersect with this. -
--tag TEXT Include only solutions whose tags intersect with this. -
--check BOOLEAN Whether to not build outputs for tests and run checker. True
--validate BOOLEAN Whether to validate inputs. True
--generator, -g TEXT Generator call to use to generate a single test for execution. -
--testcase, --test, -tc, -t TEXT Testcase to run, in the format "[group]/[index]". If not specified, will run interactively. -
--output, -O BOOLEAN Whether to ask user for custom output. False
--visualize BOOLEAN Whether to generate visualizations for inputs and outputs. False
--print, -p BOOLEAN Whether to print outputs to terminal. False
--merge-stderr, -e BOOLEAN Interleave stderr with the solution output in true line order (colored distinctly). Requires -p. Default: stderr is shown in a separate section. False
--keep-checker-stderr BOOLEAN Also keep each testcase's full checker stderr, as a .checker.err file next to its output. Only the checker's last line reaches the verdict, so this is how to read whatever it printed before that. False
--sanitized, -s BOOLEAN Whether to compile the solutions with sanitizers enabled. False
--choice, --choose, -c BOOLEAN Whether to pick solutions interactively. False
--profile TEXT Timing profile to run the solutions against. Must exist in this problem. -

issues#

Show what is wrong with the problem, before and after a run.

Usage:

rbx issues [OPTIONS]

Name Type Description Default
--detailed, -d BOOLEAN Explain each issue instead of summarizing it in one line. False
--format IssuesFormat How to print the issues. Use json to consume them from a tool. IssuesFormat.RICH

preship#

Estimate a time limit and check the whole package against it: every solution is run, and every one of them has to behave as problem.rbx.yml says it does.

Usage:

rbx preship [OPTIONS]

Name Type Description Default
--benchmark, -b INTEGER Benchmark level: 0 (off), 1 (benchmark the solution run). 0
--check BOOLEAN Whether to not build outputs for tests and run checker. True
--validate BOOLEAN Whether to not validate outputs for tests. True
--detailed, -d BOOLEAN Whether to print a detailed view of the tests using tables. False
--runs, -r INTEGER Number of runs to perform for each solution. Zero means the config default. 0
--profile, -p TEXT Profile to use for time limit estimation. local
--runner TEXT Where to run the solutions being timed (local, moj, domjudge). local
--share TEXT Capture the time report (run report + limits table) and copy it to the clipboard. Pass a format: --share png or --share text. -
--skip-slow BOOLEAN Skip checking the estimated limit against the solutions expected to be too slow. The limit is written with its upper bound unchecked. False
--dry BOOLEAN Run the whole estimation but write nothing to the disk: the limits profile is printed instead of saved. False
--fail-fast, --ff BOOLEAN Whether to stop running a solution as soon as it gets a non-accepted verdict. Applies only to the solutions run after the estimation, and is only meant for quick experimentation, as the remaining tests are reported as failed. False
--keep-checker-stderr BOOLEAN Also keep each testcase's full checker stderr, as a .checker.err file next to its output. Only the checker's last line reaches the verdict, so this is how to read whatever it printed before that. False

run (r)#

Runs solutions against the testcases.

This is the primary way to test your solutions. You can run all solutions, a specific set of solutions, or only accepted solutions.

You can also filter which testcases to run against, by using the --outcome flag to only confirm that solutions match a certain expected outcome (e.g. TLE, WA).

Usage:

rbx run <SOLUTIONS> [OPTIONS]

Arguments:

Name Description Required
SOLUTIONS Path to solutions to run. If not specified, will run all solutions. No
Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--benchmark, -b INTEGER Benchmark level: 0 (off), 1 (benchmark the solution run). 0
--outcome, -o TEXT Include only solutions whose expected outcomes intersect with this. -
--tag TEXT Include only solutions whose tags intersect with this. -
--check BOOLEAN Whether to not build outputs for tests and run checker. True
--validate BOOLEAN Whether to not validate outputs for tests. True
--detailed, -d BOOLEAN Whether to print a detailed view of the tests using tables. False
--sanitized, -s BOOLEAN Whether to compile the solutions with sanitizers enabled. False
--choice, --choose, -c BOOLEAN Whether to pick solutions interactively. False
--share TEXT Capture the run report and copy it to the clipboard. Pass a format: --share png or --share text. -
--keep-checker-stderr BOOLEAN Also keep each testcase's full checker stderr, as a .checker.err file next to its output. Only the checker's last line reaches the verdict, so this is how to read whatever it printed before that. False
--fail-fast, --ff BOOLEAN Whether to stop running a solution as soon as it gets a non-accepted verdict. Only meant for quick experimentation, as the remaining tests are reported as failed. False
--runner TEXT Where to run the solutions (local, moj, domjudge). local
-p, --profile TEXT Timing profile to run the solutions against. Must exist in this problem. -

stress#

Runs stress testing on the current problem.

Stress testing allows you to find counter-examples where your solution fails (or where two solutions differ).

You usually provide a generator command (with random seed) and a reference solution (or validator/checker).

Usage:

rbx stress <NAME> [OPTIONS]

Arguments:

Name Description Required
NAME Name of the stress test to run (specified in problem.rbx.yml). No
Name Type Description Default
--generator, -g TEXT Generator call to use to generate a single test for execution. -
--finder, -f TEXT Run a stress with this finder expression. -
--timeout, --time, -t INTEGER For how many seconds to run the stress test. 10
--findings, -n INTEGER How many breaking tests to look for. 1
-v, --verbose BOOLEAN Whether to print verbose output for checkers and finders. False
--sanitized, -s BOOLEAN Whether to compile the solutions with sanitizers enabled. False
--description, -d TEXT Optional description of the stress test. -
--descriptors, -D BOOLEAN Whether to print descriptors of the stress test. False
--skip-invalid, --skip BOOLEAN Whether to skip invalid testcases. False
--timelimit, -T INTEGER Custom timelimit for the stress test. -
--double-tl BOOLEAN Whether to use 2*TL as the timelimit for the stress test. False
--slowest BOOLEAN Whether to find the slowest testcases. This removes the time limit of the solution executions and focus on finding the testcases that make them the slowest. False
--fuzz BOOLEAN Whether to fuzz generator calls from all testgroups. False
--fuzz-on TEXT Testgroups to fuzz generator calls from. -
--validate BOOLEAN Whether to validate inputs. True
--reference, -r TEXT Reference solution to use for the stress test. -

summary (sum)#

Print a summary of the problem.

Usage:

rbx summary [OPTIONS]

Name Type Description Default
--detailed, -d BOOLEAN Whether to print a detailed view of the tests using tables. False
--format SummaryFormat How to print the summary. Use json to consume it from a tool. SummaryFormat.RICH

time (t)#

Estimate a time limit for the problem using the timings of its solutions and the estimation strategy configured in the environment.

Usage:

rbx time [OPTIONS]

Name Type Description Default
--benchmark, -b INTEGER Benchmark level: 0 (off), 1 (benchmark the solution run). 0
--check BOOLEAN Whether to not build outputs for tests and run checker. True
--validate BOOLEAN Whether to not validate outputs for tests. True
--detailed, -d BOOLEAN Whether to print a detailed view of the tests using tables. False
--strategy, -s TEXT Strategy to use for time limit estimation (estimate, inherit, estimate_custom, custom). -
--auto, -a BOOLEAN Whether to automatically estimate the time limit. False
--runs, -r INTEGER Number of runs to perform for each solution. Zero means the config default. 0
--profile, -p TEXT Profile to use for time limit estimation. local
--integrate, -i BOOLEAN Integrate the given limits profile into the package. False
--runner TEXT Where to run the solutions being timed (local, moj, domjudge). local
--share TEXT Capture the time report (run report + limits table) and copy it to the clipboard. Pass a format: --share png or --share text. -
--skip-slow BOOLEAN Skip checking the estimated limit against the solutions expected to be too slow. The limit is written with its upper bound unchecked. False
--dry BOOLEAN Run the whole estimation but write nothing to the disk: the limits profile is printed instead of saved. False
--run-all BOOLEAN After the estimation, also run every solution it did not need -- the ones expected to be wrong, and any slow one that was never checked -- against the estimated time limit. False
--fail-fast, --ff BOOLEAN Whether to stop running a solution as soon as it gets a non-accepted verdict. Applies only to the solutions run after the estimation, and is only meant for quick experimentation, as the remaining tests are reported as failed. False
--keep-checker-stderr BOOLEAN Also keep each testcase's full checker stderr, as a .checker.err file next to its output. Only the checker's last line reaches the verdict, so this is how to read whatever it printed before that. False

unit#

Run unit tests for the validator and checker.

Usage:

rbx unit [OPTIONS]


validate#

Run the validator in a one-off fashion, interactively.

Usage:

rbx validate [OPTIONS]

Name Type Description Default
--path, -p TEXT Path to the testcase to validate. -

Management#

Command Description
rbx clear Clears cache and build directories.
rbx contest Manage contests (sub-command).
rbx create Create a new problem package.
rbx download Download an asset from supported repositories (sub-command).
rbx fix Format files of the current package.
rbx stats Show stats about current and related packages.
rbx testcases Manage testcases (sub-command).
rbx visualize Visualize a single testcase (sub-command).
rbx wizard Run the wizard.

clear (clean)#

Clears cache and build directories.

Usage:

rbx clear [OPTIONS]

Name Type Description Default
--global, -g BOOLEAN - False

contest#

Manage contests (sub-command).

Usage:

rbx contest [OPTIONS]

Name Type Description Default
-C, --contest TEXT Select a contest variant by id. -
Command Description
rbx contest add Add new problem to contest.
rbx contest add_variant Scaffold a new contest variant file.
rbx contest create Create a new contest package.
rbx contest each Run a command for each problem in the contest. Chain commands with :: to queue them.
rbx contest edit Open contest.rbx.yml in your default editor.
rbx contest init Initialize a new contest in the current directory.
rbx contest issues Show what is wrong with each problem, before and after a run.
rbx contest list List all contests in the current directory.
rbx contest on Run a command in the problem (or in a set of problems) of a context. Chain commands with :: to queue them.
rbx contest package Build contest-level packages.
rbx contest remove Remove problem from contest.
rbx contest statements Manage contest-level statements.
rbx contest summary Print a summary of the contest.
rbx contest tutorials Manage contest-level tutorials/editorials.

add (a)#

Add new problem to contest.

Usage:

rbx contest add [OPTIONS]

Name Type Description Default
--path TEXT Path (relative to the contest root) where to create the problem. The name part of the path will be used as the problem name (e.g. "problems/choco" creates a problem named "choco" in that directory). -
--short-name TEXT Short name of the problem. Will be used as the identifier in the contest. -
--preset TEXT Preset to use when creating the problem. If not specified, the active preset will be used. -
--variant, -v TEXT Which template variant of the preset to use. Omit to use the canonical template, or to be prompted when the preset offers variants. -
--yes, -y BOOLEAN Do not ask for confirmation when the edit lands in a fragment shared with other contests. False

add_variant (av)#

Scaffold a new contest variant file.

Usage:

rbx contest add_variant <VARIANT_ID> [OPTIONS]

Arguments:

Name Description Required
VARIANT_ID Id of the new variant. Must match ^[A-Za-z][A-Za-z0-9_-]*$. Yes
Name Type Description Default
--preset, -p TEXT Preset to scaffold the variant from. Defaults to the active preset in the current directory, then the default preset. -

create (c)#

Create a new contest package.

Usage:

rbx contest create [OPTIONS]

Name Type Description Default
--path TEXT Path (relative to the current directory) where to create the contest (e.g. "contests/ioi2024"). -
--preset, -p TEXT Which preset to use to create this package. Can be a named of an already installed preset, or an URI, in which case the preset will be downloaded.
If not provided, the default preset will be used, or the active preset if any. -
--variant, -v TEXT Which template variant of the preset to use. Omit to use the canonical template, or to be prompted when the preset offers variants. -
--local BOOLEAN Whether to use a preset from the local version of rbx, instead of the global one (not recommended). False

each#

Run a command for each problem in the contest. Chain commands with :: to queue them.

Usage:

rbx contest each [OPTIONS]

Name Type Description Default
--keep-going, -k BOOLEAN Keep running the rest of a chain in a problem even after a command fails. Must come before the problem selector in rbx on. False
--inline, -i BOOLEAN Run the commands straight in this terminal, one after another, instead of opening the TUI. Must come before the problem selector in rbx on. False

edit (e)#

Open contest.rbx.yml in your default editor.

Usage:

rbx contest edit [OPTIONS]


init (i)#

Initialize a new contest in the current directory.

Usage:

rbx contest init [OPTIONS]

Name Type Description Default
--preset, -p TEXT Which preset to use to create this package. Can be a named of an already installed preset, or an URI, in which case the preset will be downloaded.
If not provided, the default preset will be used, or the active preset if any. -

issues#

Show what is wrong with each problem, before and after a run.

Usage:

rbx contest issues [OPTIONS]

Name Type Description Default
--detailed, -d BOOLEAN Follow the table with every problem's issues in full. False
--format IssuesFormat How to print the issues. Use json to consume them from a tool. IssuesFormat.RICH

list (ls)#

List all contests in the current directory.

Usage:

rbx contest list [OPTIONS]


on#

Run a command in the problem (or in a set of problems) of a contest.

The problem selector is a comma-separated list. Each entry names a problem by its short name, by the name it declares in its problem.rbx.yml, by one of its aliases, or by the basename of its folder -- looked up in that order, so the letter always wins over another problem's alias.

Selector Selects
B the problem whose short name, name, alias or folder is B
A,C both problems
A..C every problem from A to C, in contest order
day1-* every problem matching the pattern (* and ? are wildcards)
* every problem in the contest
*,!C every problem but C
!C the same -- a selector of exclusions starts from every problem

Ranges are written with two dots: A-C is read as a literal name, since a problem may well be called two-sum. An entry that matches no problem is an error, so a typo never runs on a subset of what you meant.

Quote selectors that use * or !, which your shell would otherwise expand.

Chain commands with :: to queue them.

Usage:

rbx contest on <PROBLEMS> [OPTIONS]

Arguments:

Name Description Required
PROBLEMS Problems to run on: short names, names, aliases or folders, comma-separated. Also A..C, *, globs and ! exclusions. No
Name Type Description Default
--keep-going, -k BOOLEAN Keep running the rest of a chain in a problem even after a command fails. Must come before the problem selector in rbx on. False
--inline, -i BOOLEAN Run the commands straight in this terminal, one after another, instead of opening the TUI. Must come before the problem selector in rbx on. False

package (pkg)#

Build contest-level packages.

Usage:

rbx contest package [OPTIONS]

Command Description
rbx contest package boca Build a contest package for BOCA.
rbx contest package pkg Build a contest package for PKG.
rbx contest package polygon Build a contest package for Polygon.

boca#

Build a contest package for BOCA.

Usage:

rbx contest package boca [OPTIONS]

Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4

pkg#

Build a contest package for PKG.

Usage:

rbx contest package pkg [OPTIONS]

Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4

polygon#

Build a contest package for Polygon.

Usage:

rbx contest package polygon [OPTIONS]

Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--language, -l TEXT If set, will use the given language as the main language. -

remove (r)#

Remove problem from contest.

Usage:

rbx contest remove <PATH_OR_SHORT_NAME> [OPTIONS]

Arguments:

Name Description Required
PATH_OR_SHORT_NAME - Yes
Name Type Description Default
--yes, -y BOOLEAN Do not ask for confirmation when the edit lands in a fragment shared with other contests. False

statements (st)#

Manage contest-level statements.

Usage:

rbx contest statements [OPTIONS]

Command Description
rbx contest statements build Build statements.

build (b)#

Build statements.

Usage:

rbx contest statements build <NAMES> [OPTIONS]

Arguments:

Name Description Required
NAMES Names of statements or documents to build. No
Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--languages TEXT Languages to build statements for. If not specified, build statements for all available languages. -
--validate BOOLEAN Whether to validate outputs for testcases or not. True
--output StatementType Output type to be generated. PDF
--samples BOOLEAN Whether to build the statement with samples or not. True
--vars TEXT Variables to be used in the statements. -
--install-tex BOOLEAN Whether to install missing LaTeX packages. False
-p, --profile TEXT Timing profile to render statements against. Problems missing this profile are skipped with a warning. -
--partial BOOLEAN Build a statement even if some of its problems fail, omitting them. Without this, a problem that fails makes its statement fail. False

summary (sum)#

Print a summary of the contest.

Usage:

rbx contest summary [OPTIONS]


tutorials (tut)#

Manage contest-level tutorials/editorials.

Usage:

rbx contest tutorials [OPTIONS]

Command Description
rbx contest tutorials build Build tutorials (editorials).

build (b)#

Build tutorials (editorials).

Usage:

rbx contest tutorials build <NAMES> [OPTIONS]

Arguments:

Name Description Required
NAMES Names of tutorials to build. No
Name Type Description Default
--verification-level, --verification, -v INTEGER of VerificationLevel Verification level to use when building package. 4
--languages TEXT Languages to build tutorials for. If not specified, build tutorials for all available languages. -
--validate BOOLEAN Whether to validate outputs for testcases or not. True
--output StatementType Output type to be generated. PDF
--samples BOOLEAN Whether to build the tutorial with samples or not. True
--vars TEXT Variables to be used in the tutorials. -
--install-tex BOOLEAN Whether to install missing LaTeX packages. False
-p, --profile TEXT Timing profile to render tutorials against. Problems missing this profile are skipped with a warning. -
--partial BOOLEAN Build a statement even if some of its problems fail, omitting them. Without this, a problem that fails makes its statement fail. False

create (c)#

Create a new problem package.

Usage:

rbx create [OPTIONS]

Name Type Description Default
--name TEXT Name of the problem to create, which will be used as the name of the new folder. A path relative to the current directory may be given (e.g. "problems/my-problem"), in which case the problem name is the basename ("my-problem"). -
--preset TEXT Preset to use when creating the problem. -
--variant, -v TEXT Which template variant of the preset to use. Omit to use the canonical template, or to be prompted when the preset offers variants. -
--local BOOLEAN Whether to use a preset from the local version of rbx, instead of the global one (not recommended). False

download (down)#

Download an asset from supported repositories (sub-command).

Usage:

rbx download [OPTIONS]

Command Description
rbx download checker Download a built-in checker from testlib GH repo.
rbx download jngen Download the preset-declared jngen library.
rbx download lib Download preset-declared libraries (omit NAME for all).
rbx download remote Download a remote code.
rbx download testlib Download the preset-declared testlib library.
rbx download tgen Download the preset-declared tgen library.

checker#

Download a built-in checker from testlib GH repo.

Usage:

rbx download checker <NAME> [OPTIONS]

Arguments:

Name Description Required
NAME - Yes

jngen#

Download the preset-declared jngen library.

Usage:

rbx download jngen [OPTIONS]

Name Type Description Default
--into TEXT Path (relative to the package root) where the file should be placed. Parent directories are created automatically. If omitted, the file is written to the current directory. -

lib (library)#

Download preset-declared libraries (omit NAME for all).

Usage:

rbx download lib <NAME> [OPTIONS]

Arguments:

Name Description Required
NAME Library name; omit to (re)fetch all declared libraries. No
Name Type Description Default
--into TEXT Path (relative to the package root) where the file should be placed. Parent directories are created automatically. If omitted, the file is written to the current directory. -

remote (r)#

Download a remote code.

Usage:

rbx download remote <NAME> [OPTIONS]

Arguments:

Name Description Required
NAME - Yes
Name Type Description Default
-o, --output TEXT Whether to not build outputs for tests and run checker. -

testlib#

Download the preset-declared testlib library.

Usage:

rbx download testlib [OPTIONS]

Name Type Description Default
--into TEXT Path (relative to the package root) where the file should be placed. Parent directories are created automatically. If omitted, the file is written to the current directory. -

tgen#

Download the preset-declared tgen library.

Usage:

rbx download tgen [OPTIONS]

Name Type Description Default
--into TEXT Path (relative to the package root) where the file should be placed. Parent directories are created automatically. If omitted, the file is written to the current directory. -

fix#

Format files of the current package.

Usage:

rbx fix [OPTIONS]

Name Type Description Default
--print-diff, -p BOOLEAN - False

stats#

Show stats about current and related packages.

Usage:

rbx stats [OPTIONS]

Name Type Description Default
--transitive, -t BOOLEAN Show stats about all reachable packages. False

testcases (tc, t)#

Manage testcases (sub-command).

Usage:

rbx testcases [OPTIONS]

Command Description
rbx testcases info Show information about testcases.
rbx testcases promote Promote generated tests into a manual test group.
rbx testcases view View a testcase in your default editor.

info (i)#

Show information about testcases.

Usage:

rbx testcases info <PATTERN> [OPTIONS]

Arguments:

Name Description Required
PATTERN Testcases to detail, as a pattern. Might be a group, or a specific test in the format [group]/[index]. No

promote#

Promote generated tests into a manual test group.

Usage:

rbx testcases promote <SELECTORS> [OPTIONS]

Arguments:

Name Description Required
SELECTORS Tests to promote, as [group]/[index] selectors. If omitted, tests are selected interactively. No
Name Type Description Default
--group, -G TEXT Destination manual test group. -
--name, -n TEXT Filename stem for the promoted test. Only meaningful when promoting exactly one test. -

view (v)#

View a testcase in your default editor.

Usage:

rbx testcases view <TC> [OPTIONS]

Arguments:

Name Description Required
TC Testcase to view. Format: [group]/[index]. Yes
Name Type Description Default
--input, -i BOOLEAN Whether to open only the input file in the editor. False
--output, -o BOOLEAN Whether to open only the output file in the editor. False

visualize (viz)#

Visualize a single testcase (sub-command).

Usage:

rbx visualize [OPTIONS]

Command Description
rbx visualize input Visualize a testcase input.
rbx visualize output Visualize a solution's output for a testcase.

input#

Run the input visualizer for one testcase and print where it landed.

Addressing is by path: --input is the testcase's input file, and the optional --output is an output to hand the visualizer alongside it.

Usage:

rbx visualize input [OPTIONS]

Name Type Description Default
--input PATH Path to the testcase input to visualize. -
--output PATH Optional output to pass to the visualizer. -
--dest PATH Where to write the visualization, WITHOUT an extension. The visualizer decides the extension, and the final path is printed. -
--use-stderr BOOLEAN Shorthand for passing the sibling '.err' file instead of the output. False

output#

Run the solution visualizer for one testcase's output.

--output is the output to visualize -- a solution's output from a run, or the testset's expected answer, or any other file. --answer is an optional second output to compare it against.

Usage:

rbx visualize output [OPTIONS]

Name Type Description Default
--input PATH Path to the testcase input. -
--output PATH Path to the output to visualize. -
--answer PATH Optional answer to compare the output against. -
--dest PATH Where to write the visualization, WITHOUT an extension. The visualizer decides the extension, and the final path is printed. -
--use-stderr BOOLEAN Shorthand for visualizing the sibling '.err' file instead. Prefer passing the stderr file to --output directly: on a communication task the solution's stderr is '.sol.err', which this cannot name. False

wizard#

Run the wizard.

Usage:

rbx wizard [OPTIONS]


Misc#

Command Description
rbx tool Manage tooling (sub-command).
rbx vscode Manage the rbx editor extension (sub-command).

tool (tooling)#

Manage tooling (sub-command).

Usage:

rbx tool [OPTIONS]

Command Description
rbx tool boca -
rbx tool convert -
rbx tool domjudge Configure a DOMjudge server from this environment.
rbx tool moj Inspect MOJ packaging for a contest.

boca#

Usage:

rbx tool boca [OPTIONS]

Command Description
rbx tool boca scrape Scrape runs from BOCA.
rbx tool boca submit Submit solutions to BOCA.
rbx tool boca view Open Textual UI to visualize BOCA submissions.

scrape#

Scrape runs from BOCA.

Usage:

rbx tool boca scrape [OPTIONS]


submit#

Submit solutions to BOCA.

Usage:

rbx tool boca submit [OPTIONS]


view#

Open Textual UI to visualize BOCA submissions.

Usage:

rbx tool boca view [OPTIONS]

Name Type Description Default
--contest-id, -c TEXT Contest identifier to load (stored under app data). -

convert#

Usage:

rbx tool convert <PKG> [OPTIONS]

Arguments:

Name Description Required
PKG The package to convert. Yes
Name Type Description Default
-s, --source TEXT The format to convert from. -
-d, --dest TEXT The format to convert to. -
-o, --output TEXT The output path. -
--language, -l TEXT The main language of the problem. -

domjudge#

Configure a DOMjudge server from this environment.

Usage:

rbx tool domjudge [OPTIONS]

Command Description
rbx tool domjudge configure Configure a DOMjudge server from the languages and limits in env.rbx.yml.

configure (config)#

Push the environment's languages, compilation flags and limits to the DOMjudge instance named by RBX_DOMJUDGE_SERVER, RBX_DOMJUDGE_USERNAME and RBX_DOMJUDGE_PASSWORD.

DOMjudge has no contest-scoped equivalent for any of this, so every change is instance-wide and needs an admin account. What is changed:

  • Which languages accept submissions, and which file extensions they accept. Languages the server has enabled that rbx does not manage stay enabled.
  • The compile script of every rbx language whose compilation command translates to DOMjudge's one-command compile wrapper.
  • The limits set under extensions.domjudge in env.rbx.yml.

Usage:

rbx tool domjudge configure [OPTIONS]


moj#

Inspect MOJ packaging for a contest.

Usage:

rbx tool moj [OPTIONS]

Command Description
rbx tool moj summary List the problems this contest would upload to MOJ, with their MOJ ids.

summary (sum)#

List the problems this contest would upload to MOJ, with their MOJ ids.

Usage:

rbx tool moj summary [OPTIONS]

Name Type Description Default
--language, -l TEXT If set, will report the title of the statement in the given language. Leave unset to use the Portuguese statement, or the topmost one without it -- the one rbx package moj would upload as the main statement. -
--porcelain BOOLEAN Print one tab-separated line per problem instead of a table, and send every warning to stderr. Meant for copying and for scripts. False

vscode#

Manage the rbx editor extension (sub-command).

Usage:

rbx vscode [OPTIONS]

Command Description
rbx vscode install Install the rbx extension into VS Code (or Cursor, Windsurf, VSCodium).

install#

Install the rbx extension into VS Code (or Cursor, Windsurf, VSCodium).

Usage:

rbx vscode install [OPTIONS]

Name Type Description Default
--editor, -e TEXT Editor to install into: cursor, windsurf, codium, code-insiders, code. -

Generic Types#

CacheLevel #

Bases: AutoEnum

Source code in rbx/grading/grading_context.py
class CacheLevel(AutoEnum):
    NO_CACHE = alias('none')
    CACHE_TRANSIENTLY = alias('transient')
    CACHE_COMPILATION = alias('compilation')
    CACHE_ALL = alias('all')

FilterTarget #

Bases: Enum

What a filter is formatting for.

The rules a filter applies -- when sci abbreviates, when it declines -- are a property of the value and never vary. Only the spelling does: a PDF wants 2 \times 10^{5}, a VS Code inlay hint wants 2×10⁵ because it cannot typeset maths.

MARKDOWN maps to the LaTeX formatter and is not redundant: a Markdown statement puts its constraints in $...$ math, so LaTeX is what sci and rsci should emit there. Naming it separately means the day that stops being correct is a one-line change rather than an archaeology exercise.

That claim covers sci/rsci only. The target also picks escape, and under MARKDOWN that is still the inherited LaTeX escaping (a_b -> a\_b, a backslash -> \textbackslash{}), which nobody has examined against a Markdown body outside math. Whether it is right there is out of scope here.

Source code in rbx/box/statements/latex_jinja.py
class FilterTarget(enum.Enum):
    """What a filter is formatting for.

    The *rules* a filter applies -- when `sci` abbreviates, when it declines --
    are a property of the value and never vary. Only the spelling does: a PDF
    wants `2 \\times 10^{5}`, a VS Code inlay hint wants `2×10⁵` because it
    cannot typeset maths.

    MARKDOWN maps to the LaTeX formatter and is not redundant: a Markdown
    statement puts its constraints in `$...$` math, so LaTeX is what `sci` and
    `rsci` should emit there. Naming it separately means the day that stops
    being correct is a one-line change rather than an archaeology exercise.

    That claim covers `sci`/`rsci` only. The target also picks `escape`, and
    under MARKDOWN that is still the inherited LaTeX escaping (`a_b` -> `a\\_b`,
    a backslash -> `\\textbackslash{}`), which nobody has examined against a
    Markdown body outside math. Whether it is right there is out of scope here.
    """

    LATEX = 'latex'
    MARKDOWN = 'markdown'
    TEXT = 'text'

IssuesFormat #

Bases: str, Enum

How to print issues.

Lives here rather than in either command so the problem-level and contest-level flags cannot drift into accepting different spellings.

Source code in rbx/box/issues/rendering.py
class IssuesFormat(str, Enum):
    """How to print issues.

    Lives here rather than in either command so the problem-level and
    contest-level flags cannot drift into accepting different spellings.
    """

    RICH = 'rich'
    JSON = 'json'

StatementType #

Bases: AutoEnum

Source code in rbx/box/statements/schema.py
class StatementType(AutoEnum):
    rbxTeX = alias('rbx-tex')  # type: ignore
    """Statement written in rbxTeX format."""

    rbxMarkdown = alias('rbxMd', 'rbx-markdown', 'rbx-md')  # type: ignore
    """Statement written in rbxMarkdown format."""

    TeX = alias('tex')  # type: ignore
    """Statement written in pure LaTeX format."""

    Markdown = alias('md', 'markdown')  # type: ignore
    """Statement written in pure Markdown format."""

    JinjaTeX = alias('jinja-tex')  # type: ignore
    """Statement written in LaTeX format with Jinja2 expressions."""

    JinjaMarkdown = alias('jinja-md', 'jinja-markdown')  # type: ignore
    """Statement written in Markdown format with Jinja2 expressions."""

    PDF = alias('pdf')  # type: ignore
    """Statement is a PDF."""

    def get_file_suffix(self) -> str:
        if self == StatementType.TeX:
            return '.tex'
        if self == StatementType.Markdown:
            return '.md'
        if self == StatementType.rbxTeX:
            return '.rbx.tex'
        if self == StatementType.rbxMarkdown:
            return '.rbx.md'
        if self == StatementType.JinjaTeX:
            return '.jinja.tex'
        if self == StatementType.JinjaMarkdown:
            return '.jinja.md'
        if self == StatementType.PDF:
            return '.pdf'
        raise ValueError(f'Unknown statement type: {self}')

    def is_rbx(self) -> bool:
        """rbx* types are the only ones that can JOIN problems into a contest."""
        return self in (StatementType.rbxTeX, StatementType.rbxMarkdown)

rbxTeX = alias('rbx-tex') #

Statement written in rbxTeX format.

rbxMarkdown = alias('rbxMd', 'rbx-markdown', 'rbx-md') #

Statement written in rbxMarkdown format.

TeX = alias('tex') #

Statement written in pure LaTeX format.

Markdown = alias('md', 'markdown') #

Statement written in pure Markdown format.

JinjaTeX = alias('jinja-tex') #

Statement written in LaTeX format with Jinja2 expressions.

JinjaMarkdown = alias('jinja-md', 'jinja-markdown') #

Statement written in Markdown format with Jinja2 expressions.

PDF = alias('pdf') #

Statement is a PDF.

is_rbx() #

rbx* types are the only ones that can JOIN problems into a contest.

Source code in rbx/box/statements/schema.py
def is_rbx(self) -> bool:
    """rbx* types are the only ones that can JOIN problems into a contest."""
    return self in (StatementType.rbxTeX, StatementType.rbxMarkdown)

SummaryFormat #

Bases: str, Enum

How to print a summary.

Spelled the way IssuesFormat is, so a reader who learned --format json on one command does not have to learn it again on the other.

Source code in rbx/box/summary.py
class SummaryFormat(str, Enum):
    """How to print a summary.

    Spelled the way `IssuesFormat` is, so a reader who learned `--format json`
    on one command does not have to learn it again on the other.
    """

    RICH = 'rich'
    JSON = 'json'

VerificationLevel #

Bases: Enum

Source code in rbx/box/environment.py
class VerificationLevel(Enum):
    NONE = 0
    VALIDATE = 1
    FAST_SOLUTIONS = 2
    ALL_SOLUTIONS = 3
    FULL = 4