Skip to content

Replace robot/rebot CLI parsing with confargs and add config file support - #5773

Draft
bhirsz wants to merge 1 commit into
robotframework:masterfrom
bhirsz:feat/confargs-cli
Draft

bhirsz wants to merge 1 commit into
robotframework:masterfrom
bhirsz:feat/confargs-cli

Conversation

@bhirsz

@bhirsz bhirsz commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Replaces the hand-rolled getopt-based command-line parsing of the robot
and rebot tools with the declarative confargs
library, and adds configuration-file support (closes #5337).

Behaviour of the parsed options is preserved — the downstream
RobotSettings / RebotSettings defaulting is unchanged — and, thanks to
confargs' opt-in lenient name matching, the command-line syntax stays
backwards compatible too (case- and hyphen-insensitive long names,
unique-prefix abbreviation, --no<flag> negation). See Compatibility below.

Draft: opened for discussion of the approach before polishing docs/acceptance
tests.

What changed

Area Change
robot.conf.arguments New. Explicit confargs ArgConfig subclasses RobotArgs / RebotArgs (shared base _CommonArgs) declaring every option as a plain, pass-through confargs option. This is the single source of truth for the CLI. Both enable cli_case_insensitive / ignore_hyphens / cli_allow_abbrev.
robot.utils.confargsparser New. ConfargsParser — a thin adapter exposing the same surface Application expects (name, version, parse_args(args) -> (opts, datasources)), raising Information for --help/--version and DataError on failure.
robot.utils.application Application.__init__ gained an optional config= param; when set it builds a ConfargsParser, otherwise the legacy ArgumentParser.
robot.run / robot.rebot Pass config=RobotArgs / config=RebotArgs.
robot.utils.argumentparser Unchanged. libdoc / testdoc keep using the legacy parser.
setup.py Adds confargs>=0.12 dependency.

No dynamic class generation and no pre-processing/normalisation of argv on the
Robot Framework side — options are handed to confargs directly, mirroring the
tests/robot_cli.py
reference fixture. The legacy leniencies that RF users rely on (case/hyphen
insensitivity, joined negation, unique-prefix abbreviation) are restored via
confargs' own opt-in features rather than a robot-side canonicalisation layer.

Configuration file support (#5337)

Sources are merged with precedence:

command line  >  environment variables  >  config file  >  option default
  • Discovery. Walking up from the working directory (stopping at .git), the
    first matching file is used — files are never merged. robot looks for
    robot.toml, then pyproject.toml; rebot for rebot.toml, robot.toml,
    pyproject.toml. To share settings between files, use extends = "path.toml".
  • Layout. Options live in a [tool.robot] / [tool.rebot] table. In the
    dedicated robot.toml / rebot.toml they may instead be at the top level
    (the robotcode layout); a file mixing both is an error.
  • Per-user config (%APPDATA%\robot\robot.toml, ~/.config/robot/robot.toml)
    is a lower-priority layer that fills in options the project file does not set.
    It is skipped when --config is given.
  • confargs built-ins drive the feature: --config PATH, --no-config,
    --profile NAME, --ignore-git. Named profiles ([profiles.ci] /
    [tool.robot.profiles.ci]) are supported out of the box.
  • ROBOT_OPTIONS / REBOT_OPTIONS are still honoured (read by confargs).
# robot.toml (top-level layout; [tool.robot] works too, and is required in pyproject.toml)
paths = ["tests"]
name = "My Suite"
loglevel = "DEBUG"
output-dir = "results"
listener = ["MyListener", "tools/listener.py:arg"]

[variable]
BROWSER = "chrome"

[profiles.ci]
include = ["smoke"]

robot (with no paths) now runs tests/ with that config — from any
subdirectory; robot --name Other tests/a.robot overrides the name and the
paths; robot --no-config tests/ ignores the file.

Config keys.

  • Keys ignore hyphens and underscores (outputdir = output-dir = output_dir)
    but are case-sensitive (OutputDir is rejected) and never abbreviated.
  • Strict: an unknown key is an error, with a hint —
    invalid configuration keys in robot.toml: 'includes' (unknown option; did you mean 'include'?).
    Command-line-only options (argumentfile, help, version, …) are rejected too.
    The same option given twice under different spellings in one table is an error.
  • paths lists the data sources (robot only; rebot's output files are
    command-line only). Paths given on the command line replace it.
  • Key/value options (variable, metadata, tagdoc, tagstatlink) accept either a list
    (variable = ["NAME:value"]) or a TOML table ([variable] / NAME = "value"),
    which is flattened to NAME:value items.

Relative paths in a config file are relative to that file (each extends-ed
file uses its own directory), so the same config works from any directory:

  • always resolved: paths, outputdir, pythonpath;
  • resolved only if they exist there (so module names stay untouched, :args
    suffix kept): variablefile, listener, prerunmodifier, prerebotmodifier;
  • output/log/report/… are unchanged — RF already treats them as relative
    to outputdir. Command-line/env values are never rewritten.

A comparison with robotcode's robot.toml is in
#5773 (comment)
(updated for what is now resolved).

Supported option forms (with examples)

Form Example
Long + separate value --name My Suite
Long + = value --name=My Suite
Case-insensitive long name --Name, --OutputDir
Hyphen-insensitive long name --variable-file (= --variablefile)
Unique-prefix abbreviation --variab (= --variablefile, if unambiguous)
Short + separate value -N My Suite
Short + attached value -NMy Suite
Repeated (multi) option -i tag1 -i tag2 / --include tag1 --include tag2
Boolean flag --dryrun, -X
Combined short flags -XT (= --exitonfailure --timestampoutputs)
Flag negation --no-dryrun, --nostatusrc, --no-statusrc
Options terminator -- --not-an-option.robot
Argument file (eager) -A args.txt, --argumentfile STDIN

Short options stay case-sensitive by design (matching the legacy parser):
-V is --variablefile and -v is --variable; leniency applies to long
names only.

Compatibility with the legacy parser

Restored via confargs' opt-in features, so these keep working:

Legacy leniency Example Status
Case-insensitive long names --Name, --OutputDir ✅ cli_case_insensitive
Hyphen-insensitive long names --tag-stat-link, --pre-run-modifier ✅ ignore_hyphens
Unique-prefix abbreviation --outp, --variab, --removek ✅ cli_allow_abbrev (confargs 0.7; ambiguous prefixes raise)
--no<flag> negation (no dash) --nostatusrc ✅ (both --nostatusrc and --no-statusrc)
Abbreviated joined negation --nostat (= --nostatusrc) ✅ (cli_allow_abbrev + ignore_hyphens, confargs 0.8)

Still intentionally dropped (the only user-visible behaviour changes):

Legacy leniency Old New
Second help alias -? -? use -h / --help

Everything else — option names, short flags (incl. -. for --dotted),
value/multi/flag semantics, defaults, --help text (the full USAGE is passed
through verbatim, footer included), --version, exit codes, data-source
globbing, ROBOT_OPTIONS — is unchanged.

Tests

  • Legacy utest/utils/test_argumentparser.py kept pristine (libdoc/testdoc
    path unchanged).
  • New utest/utils/test_confargsparser.py (49 tests) covers value/multi/flag
    parsing, = syntax, shorts, --no- negation, case-/hyphen-insensitive long
    names, joined/cased negation (--nostatusrc, --No-DryRun), case-sensitive
    shorts, --help/--version → Information, arg-limit errors,
    unknown-option → DataError, internal keys not leaking, validator hook, and
    rebot-specific options, and config files (discovery, top-level vs
    [tool.robot] layout, paths, relative path resolution, key spellings and
    case-sensitivity, strict unknown-key hints, tables for key/value options).
  • Full unit suite green against confargs 0.12.0 from PyPI.
  • Acceptance tests (atest/robot/cli, 460 tests) run against confargs 0.8:
    456 pass, 4 fail. All 4 remaining failures are environmental, not
    caused by this change (Console.Non Ascii.* and Argument File.Argument file with non-ASCII characters — Windows-console mojibake on a non-UTF-8 codepage;
    they pass on the Linux CI runners). The argument-file BOM, # expandvars:
    pragma and abbreviated-joined-negation failures were all fixed by confargs
    0.8 (MarketSquare/confargs#40), and the obsolete
    Shortening --argumentfile is not possible atest was removed.
  • Manual smoke tests: robot/rebot --version/--help, real suite
    execution, config-only vs CLI-override vs --no-config, -A argument files.
  • Lint/format: ruff + isort + black applied to changed files.

TODO / open questions

  • Python floor raised to 3.10. confargs requires Python 3.10+, so
    python_requires, the trove classifiers and the CI matrices (unit +
    acceptance) were updated to drop 3.8/3.9. confargs was also added to
    utest/requirements.txt and atest/requirements-run.txt (used by the test
    workflows, which run from source without pip install .). This floor bump is
    a required consequence of adopting confargs and needs project sign-off.
  • Case-/hyphen-insensitive long names and unique-prefix abbreviation
    restored
    via confargs' opt-in cli_case_insensitive / ignore_hyphens
    (0.6) and cli_allow_abbrev (0.7) toggles, so the CLI stays backwards
    compatible without any robot-side canonicalisation.
  • libdoc / testdoc still use the legacy ArgumentParser. Migrate them
    too, or keep the two parsers side by side long-term?
  • Argument-file BOM handling. confargs 0.8 reads argument files as
    utf-8-sig, so a leading UTF-8 BOM is stripped
    (MarketSquare/confargs#40).
  • Argument-file # expandvars: pragma is now supported by confargs 0.8
    (${VAR} / ${VAR=default} expansion with RF-compatible error messages when
    the pragma is present).
  • Abbreviated joined negation (--nostat for --nostatusrc) now works:
    confargs 0.8 composes cli_allow_abbrev with the joined --no<flag> form.
  • Shortening --argumentfile is not possible atest removed — abbreviation
    makes shortening work, so the test's premise is obsolete.
  • Programmatic API (robot.run() / rebot()) keyword names are unchanged
    (e.g. outputdir, loglevel, variablefile), matching the user guide — a
    readability rename was considered but rejected to avoid breaking that API.
  • Strict config by default, robotcode-style top-level layout in
    robot.toml, hyphen-lenient (case-sensitive) config keys, paths in
    config and config-relative paths (confargs 0.12).
  • Per-user config layering — kept as a lower-priority layer under the
    project file (skipped with --config). Confirm this, or make it a fallback
    used only when no project file exists?
  • Rebot paths are command-line only (robotcode has no rebot paths either).
  • pythonpath = ["lib1:lib2"] (a single :-joined item) resolves only as a
    whole; list separate items instead.
  • Decide whether config discovery should also consider RF's existing
    conventions / documented search paths.
  • User Guide section for configuration files.

Copilot AI lite review requested due to automatic review settings August 31, 2026 08:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This draft replaces Robot Framework’s internal getopt-based CLI parsing with the confargs resolution engine, enabling TOML-based configuration file support (e.g., robot.toml / pyproject.toml) while aiming to preserve existing CLI behavior and output.

Changes:

  • Swapped the core argument parsing/resolution to confargs.ConfigurationProcessor, keeping Robot’s usage-string-driven option introspection intact.
  • Added TOML configuration file discovery/processing and precedence (CLI > env > config > defaults).
  • Added unit tests covering basic config-file behavior and added a runtime dependency on confargs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/robot/utils/argumentparser.py Replaces getopt parsing with confargs + canonicalization layer and config-file support.
utest/utils/test_argumentparser.py Adds unit tests for configuration file reading and precedence.
setup.py Adds confargs>=0.5 as a runtime dependency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread setup.py Resolved
Comment thread utest/utils/test_argumentparser.py Resolved
Copilot AI review requested due to automatic review settings August 31, 2026 09:37
@bhirsz
bhirsz force-pushed the feat/confargs-cli branch from e257632 to 3fbf694 Compare August 31, 2026 09:37
@bhirsz bhirsz changed the title Replace CLI parsing with confargs and add configuration file support Replace robot/rebot CLI parsing with confargs and add config file support Aug 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Comment thread setup.py Resolved
Comment thread src/robot/conf/arguments.py Resolved
Comment thread src/robot/run.py Resolved
Comment thread src/robot/utils/confargsparser.py Resolved
Comment thread utest/utils/test_confargsparser.py Resolved
Copilot AI review requested due to automatic review settings August 31, 2026 09:48
@bhirsz
bhirsz force-pushed the feat/confargs-cli branch from 3fbf694 to d72036f Compare August 31, 2026 09:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Suppressed comments (1)

src/robot/utils/confargsparser.py:76

  • env_options is accepted (and always passed from Application) but currently ignored, which makes Application(env_options=...) a no-op when using ConfargsParser. To preserve the legacy contract and avoid silent mismatches, wire env_options into the confargs config (or validate it).
        self._config = config
        self._usage = usage
        self.name = name or usage.splitlines()[0].split(" -- ")[0].strip()
        self.version = version or get_full_version()
        self._arg_limit_validator = ArgLimitValidator(arg_limits)

Comment thread src/robot/utils/confargsparser.py Resolved
Comment thread src/robot/conf/arguments.py Resolved
Comment thread utest/utils/test_confargsparser.py Resolved
Copilot AI review requested due to automatic review settings August 31, 2026 09:54
@bhirsz
bhirsz force-pushed the feat/confargs-cli branch from d72036f to 97c392a Compare August 31, 2026 09:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Suppressed comments (1)

src/robot/utils/confargsparser.py:69

  • env_options is accepted (and passed from Application) but not actually used by ConfargsParser (it’s only mentioned in a comment). This is easy to misconfigure for any future Application(..., config=...) consumers who expect env_options= to have an effect. Consider either (1) removing env_options from ConfargsParser and not passing it from Application, or (2) validating that env_options matches the config’s options_env_var and raising a clear error if not.
    def __init__(
        self,
        config,
        usage,
        name=None,
        version=None,
        arg_limits=None,
        validator=None,
        env_options=None,
    ):

Comment thread src/robot/utils/application.py Resolved
Comment thread src/robot/utils/confargsparser.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Suppressed comments (1)

src/robot/utils/confargsparser.py:96

  • New functionality here relies on confargs merging sources (CLI > env var > config file). There are currently no unit tests exercising (1) ROBOT_OPTIONS/REBOT_OPTIONS env var ingestion/precedence and (2) config-file discovery/precedence (robot.toml/pyproject.toml, --no-config, --config, profiles). Adding focused tests would help ensure the behavior stays compatible with the legacy parser and matches the PR’s precedence guarantees.
        args = [system_decode(a) for a in args]
        try:
            namespace = ConfigurationProcessor(
                self._config,
                argv=args,
                environ=None,
                cwd=Path.cwd(),
            ).process()

Comment thread src/robot/conf/arguments.py Resolved
Comment thread setup.py Resolved
Copilot AI review requested due to automatic review settings August 31, 2026 13:31
@bhirsz
bhirsz force-pushed the feat/confargs-cli branch from 4bcfd3b to 6a4175f Compare August 31, 2026 13:31
@bhirsz
bhirsz force-pushed the feat/confargs-cli branch from 6a4175f to 035c99e Compare August 31, 2026 13:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

src/robot/utils/confargsparser.py:95

  • ConfigurationProcessor is currently called with environ=None, while Application still passes env_options and the PR description says ROBOT_OPTIONS/REBOT_OPTIONS remain supported. To make env-var handling unambiguous (and avoid accidentally disabling it if None means "no environment" in confargs), pass os.environ explicitly (or drop the override) and consider either using env_options or removing it from the constructor to avoid a misleading API.
            namespace = ConfigurationProcessor(
                self._config,
                argv=args,
                environ=None,
                cwd=Path.cwd(),

src/robot/conf/arguments.py:183

  • cli_allow_abbrev is enabled for rebot as well. This conflicts with the PR description's statement that unique-prefix long-option abbreviations are intentionally dropped; please align the implementation and the documented compatibility expectations.
    cli_case_insensitive = True
    cli_ignore_hyphens = True
    cli_allow_abbrev = True

Comment thread src/robot/conf/arguments.py Resolved
Copilot AI review requested due to automatic review settings August 31, 2026 13:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

src/robot/utils/confargsparser.py:69

  • ConfargsParser.__init__() accepts env_options (and Application passes it), but the value is currently ignored. This creates a silent mismatch risk if the config’s options_env_var differs (or isn’t set), and it diverges from ArgumentParser where env_options directly controls env var parsing.
        arg_limits=None,
        validator=None,
        env_options=None,
    ):

Comment thread src/robot/conf/arguments.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved moderate issues affect documentation, help output, error handling, profile loading, and test coverage.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
Resolved since last review (5)

Comment thread src/robot/utils/confargsparser.py Resolved
Copilot AI lite review requested due to automatic review settings September 30, 2026 13:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Rebot invocations currently fail due to an incorrectly shared option, with additional parser compatibility and dependency documentation issues unresolved.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)

Comment thread src/robot/conf/arguments.py Resolved
Copilot AI lite review requested due to automatic review settings September 30, 2026 16:46
@bhirsz

bhirsz commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

[Unofficial] How this PR's TOML config differs from robotcode's robot.toml

Status: draft for review, not official documentation. This note compares the config-file support added in this PR with robotcode's robot.toml. Where the two differ, we still need to decide whether to align, document the difference, or reject.
Every behaviour claimed for this PR was checked with a script against confargs==0.12.0.
Updated for confargs 0.12: top-level layout, strict keys with hints, hyphen-lenient keys, paths, config-relative paths.

TL;DR

Area This PR (RF + confargs) robotcode
Section Top-level keys in robot.toml or [tool.robot]; [tool.robot] in pyproject.toml Top-level keys in robot.toml/.robot.toml; [tool.robot] in pyproject.toml
Key names RF option names; hyphens/underscores ignored (output-dir = outputdir), case-sensitive, singular (include, variable) kebab-case, often plural: output-dir, variable-files, includes
Unknown keys Error with a "did you mean" hint Validated (schema)
Files merged Only the first project file found (extends for explicit inheritance), plus the user-dir file underneath user → pyproject.toml → robot.toml → .robot.toml, all merged
Relative paths Resolved against the config file (paths, outputdir, pythonpath; variablefile/listener/modifiers if they exist there) Resolved against the project root
Dict values variable, metadata, tagdoc, tagstatlink Also listeners, parsers, pre-run-modifiers, pre-rebot-modifiers, env
Extending lists Not supported; lists are replaced extend-* keys
Data sources paths = [...] (robot only); CLI paths replace them paths = [...]
Profiles inherits, precedence, boolean enabled, --profile with globs Same, plus description, hidden, detached, conditional enabled.if, default-profiles
Extras extends = "other.toml" (file inheritance) env, args, wrapper, {expr = ...} expressions, rebot/libdoc/testdoc/analyzer sections

Most important consequence: both tools now read the same layout, but a typical robotcode robot.toml makes robot fail with a clear error rather than being silently ignored. Examples: plural keys (includes), [variables], no-status-rc, [rebot], [env], default-profiles, a profile description. Every error names the offending key, usually with a hint:

invalid configuration keys in robot.toml: 'includes' (unknown option; did you mean 'include'?)

The [tool.robotcode-*] tables are ignored, because the top-level tool key is skipped.


1. Files and sections

This PR

  • robot looks for robot.toml, then pyproject.toml.
  • rebot looks for rebot.toml, then robot.toml, then pyproject.toml.
  • Top-level keys are allowed only in the tool's own dedicated file: robot.toml for robot, rebot.toml for rebot.
    • Otherwise the section is [tool.robot] / [tool.rebot]. rebot does not read robot's keys.
    • A file with both a section and top-level keys is an error.
  • Discovery walks up from the cwd and uses the first file that has config for the tool. It stops at a directory containing .git (--ignore-git disables that stop).
    • Files are never merged. With both robot.toml and pyproject.toml [tool.robot] present, only robot.toml is used.
    • An empty robot.toml, or a pyproject.toml without [tool.robot], is skipped.
  • A per-user file is layered underneath the project file and fills in options the project file doesn't set:
    • Windows: %APPDATA%\robot\robot.toml
    • Linux/macOS: $XDG_CONFIG_HOME/robot/ or ~/.config/robot/
    • rebot uses .../rebot/
    • It is skipped with --config.
  • --config PATH uses only that file. --no-config disables config files.
  • extends = "base.toml" (or a list) merges another file first, and the file's own keys win.

robotcode

  • Reads top-level keys in robot.toml, and [tool.robot] in pyproject.toml.
  • Rebot/libdoc/testdoc settings go in [rebot], [libdoc], [testdoc] sub-tables of the same file.
  • Loading order, all merged: user robot.toml (%LOCALAPPDATA%\robotcode\, ~/.config/robotcode/, macOS Application Support) → pyproject.toml → robot.toml → .robot.toml (a personal file, meant for gitignore).

Differences to decide on

  1. Rebot config location: rebot.toml / [tool.rebot] versus a [rebot] sub-table (currently an error in robot.toml).
  2. Nearest file only (+ extends) versus merging all project files. There's also no .robot.toml personal override; it is ignored.
  3. The user-dir folder name (robot/rebot vs robotcode) and base directory (APPDATA vs LOCALAPPDATA).

2. Key naming

  • CLI: RF's lenient spellings: --outputdir, --output-dir, --OutputDir, unique prefixes such as --outputd, and --no/--no- negation.
  • Config files:
    • Hyphens and underscores are ignored: outputdir, output-dir and output_dir are the same key.
    • Keys are case-sensitive: OutputDir is rejected with a hint.
    • Keys are never abbreviated.
    • Two spellings of one option in the same table is an error.

So robotcode's kebab-case keys now work whenever only the hyphens differ:

console-colors, console-links, console-markers, console-width, debug-file, dry-run, exit-on-error, exit-on-failure, expand-keywords, flatten-keywords, remove-keywords, python-path, parse-include, run-empty-suite, skip-on-failure, skip-teardown-on-exit, split-log, timestamp-outputs, legacy-output, log-level, log-title, report-title, report-background, output-dir, max-error-lines, max-assign-length, suite-stat-level, set-tag, tag-doc, tag-stat-include, tag-stat-exclude, tag-stat-combine, tag-stat-link, pre-run-modifier, paths.

Keys that still differ (all rejected, with a hint pointing at the RF name):

robotcode this PR robotcode this PR
includes include languages language
excludes exclude extensions extension
tests test listeners listener
tasks task parsers parser
suites suite pre-run-modifiers prerunmodifier
variables variable pre-rebot-modifiers prerebotmodifier
variable-files variablefile re-run-failed rerunfailed
no-status-rc = true statusrc = false re-run-failed-suites rerunfailedsuites

These keys are the same in both: name, doc, metadata, output, log, report, xunit, rpa, console, dotted, quiet, randomize, skip.
Rebot-only keys in this PR: merge, processemptysuite, starttime, endtime.

3. Value shapes

Option(s) This PR robotcode
variable, metadata, tagdoc, tagstatlink A list ["NAME:value"] or a table {NAME = "value"}. Tables are flattened to NAME:value, and non-string values are stringified (B = 2 → B:2) Table only
listener, parser, prerunmodifier, prerebotmodifier A list of RF CLI strings: ["a.py:arg1:arg2", "MyListener"]. A table is rejected with Expected a list, got a table Table {"a.py" = ["arg1", "arg2"]}
tagstatcombine A list of "tag1ANDtag2:Name" strings; a table is rejected A list of strings or {pattern = name} tables
list options generally A list, or a single string (include = "smoke" → ["smoke"]) A list
consolewidth, maxassignlength, suitestatlevel TOML int or string, both accepted int
consolecolors, consolemarkers, … Case-insensitive values ("on" → ON) lowercase literals
flags dryrun = true; negate with false (statusrc = false) dry-run = true, no-status-rc = true
relative paths Relative to the config file (see the TL;DR row) Relative to the project root

We agreed earlier that the table form for listeners/parsers/modifiers isn't needed.

4. Merging and precedence

  • This PR: CLI > ROBOT_OPTIONS/REBOT_OPTIONS > selected profiles (by precedence) > config file (+ extends) > user-dir config > default.
  • A list given on the CLI or in a profile replaces the config list: config include = ["a"] plus -i b gives ["b"]. CLI data sources replace config paths in the same way.
  • robotcode: extend-<key> appends/merges instead of replacing (extend-variables, extend-includes, …). These are rejected here as unknown keys.

5. Profiles

Feature This PR robotcode
Location [profiles.<name>] (top-level layout) or [tool.robot.profiles.<name>] [profiles.<name>]
Selection --profile NAME (repeatable, globs such as dev*) robotcode -p NAME
inherits, precedence ✅ ✅
enabled Boolean only; a table such as enabled = {if = "..."} is an error Boolean or {if = "python expr"}
description, hidden, detached Error (unknown key) ✅
default-profiles Error (unknown key) ✅
Unknown profile name Error listing the available profiles Error

6. robotcode-only features (no equivalent in this PR)

  • env / extend-env, args / extend-args, wrapper, {expr = "..."} values: all errors (unknown keys).
  • extend-paths and the other extend-* keys.
  • [rebot] inside the robot config (an error), plus [libdoc] and [testdoc].
  • [tool.robotcode-*] tables are ignored.

7. Features in this PR that robotcode doesn't have

  • extends = "file.toml" (config-file inheritance).
  • --config, --no-config, --ignore-git on the robot/rebot CLI itself.
  • The same option names and lenient CLI spelling as plain robot, with no extra tool needed.

8. The same config in both formats

robotcode (robot.toml):

paths = ["tests"]
output-dir = "results"
log-level = "DEBUG"
python-path = ["lib"]
includes = ["smoke"]
listeners = { "MyListener.py" = ["arg1"] }

[variables]
BROWSER = "chrome"
TIMEOUT = "20s"

[profiles.ci]
extend-includes = ["regression"]

This PR (robot.toml). Only the marked lines differ:

paths = ["tests"]
output-dir = "results"
log-level = "DEBUG"
python-path = ["lib"]
include = ["smoke"]                     # singular
listener = ["MyListener.py:arg1"]       # RF CLI syntax

[variable]                              # singular
BROWSER = "chrome"
TIMEOUT = "20s"

[profiles.ci]
include = ["smoke", "regression"]       # no extend-*, so repeat the base list

Open questions

  1. Top-level keys in robot.toml? ✅ Supported.
  2. Config keys with CLI spellings / unknown keys? ✅ Hyphens ignored, case-sensitive, unknown keys are errors with hints.
  3. Should we accept robotcode's plural names (includes, variables, listeners, …) and no-status-rc as aliases?
  4. A shared robot.toml with robotcode-only keys ([rebot], [env], default-profiles, profile description, extend-*) now errors. Should we tolerate or ignore known robotcode keys, support some of them, or leave this as a deliberate incompatibility?
  5. Merge all discovered files and add a .robot.toml personal override, or keep "nearest file + extends"?
  6. Do we want extend-* / additive list merging?
  7. Should rebot read a [rebot] sub-table of the robot config?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved critical dependency-import concerns and moderate parser, filtering, and dependency-version issues remain.

Review effort: Lite
Findings: 2 High severity · 1 Medium severity

Open (3)

Comment thread src/robot/utils/application.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Isolate REBOT_OPTIONS in the test fixture and update the user-facing CLI documentation.

3 open findings

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI lite review requested due to automatic review settings October 8, 2026 10:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Address the two moderate issues and add the requested CLI integration regression coverage.

3 open findings

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI lite review requested due to automatic review settings October 8, 2026 10:35
@bhirsz
bhirsz force-pushed the feat/confargs-cli branch from cd0c913 to 971f48e Compare October 8, 2026 10:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A critical parser issue and a moderate Rebot option issue remain unresolved, with configuration documentation also needed.

4 open findings

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread src/robot/utils/confargsparser.py Resolved
…port

Replace the getopt-based command-line parsing of the `robot` and `rebot`
tools with the declarative confargs library, and add configuration-file
support (the long-requested config-file feature).

The option set of each tool is now declared explicitly as a confargs
ArgConfig subclass (RobotArgs / RebotArgs in robot.conf.arguments), and a thin
ConfargsParser (robot.utils.confargsparser) adapts confargs to the existing
Application parsing contract (parse_args -> options dict + globbed data
sources, Information for --help/--version, DataError on failure). Application
gained an optional config= parameter selecting the new parser;
libdoc/testdoc keep using the legacy ArgumentParser.

Configuration is merged with precedence:
command line > environment variables > config file > option default.
The first robot.toml / pyproject.toml (rebot: rebot.toml first) found upward
from the working directory is used, layered over the user config dir, with
--config, --no-config, --profile and --ignore-git controls provided by
confargs. Options live in a [tool.robot] / [tool.rebot] table, or at the top
level of robot.toml / rebot.toml. Config keys ignore hyphens and underscores
but are case-sensitive, unknown keys are errors with a "did you mean" hint,
data sources can be given as `paths`, key/value options accept TOML tables,
and relative paths are resolved against the config file.

Behaviour of value/multi/flag options and their defaults is preserved so the
downstream RobotSettings/RebotSettings defaulting is unchanged. Legacy CLI
leniency is retained through confargs' opt-in toggles: long names stay case-
and hyphen-insensitive (cli_case_insensitive / ignore_hyphens) and keep
unique-prefix abbreviation (cli_allow_abbrev), and boolean flags negate with
both --no-<name> and the joined --no<name> forms. See the pull request
description for the full migration notes and remaining TODOs.

Co-authored-by: Copilot <[email protected]>
Copilot AI lite review requested due to automatic review settings October 8, 2026 10:57
@bhirsz
bhirsz force-pushed the feat/confargs-cli branch from 971f48e to b9fd5dc Compare October 8, 2026 10:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Windows acceptance jobs still have known failures, and configuration tests need user-config isolation.

0 open findings

4 resolved since last review

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configuration file support

2 participants