Skip to content

feat(cli): add dio --version flag and dio check-config command - #31

Merged
nisaral merged 4 commits into
nisaral:mainfrom
Ptraaah:feat/cli-version-and-check-config
Nov 1, 2026
Merged

nisaral merged 4 commits into
nisaral:mainfrom
Ptraaah:feat/cli-version-and-check-config

Conversation

@Ptraaah

@Ptraaah Ptraaah commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Implements the CLI additions requested in #30.

dio --version

  • Eager --version option on the root callback, printing the same dio-serve <version> line as the existing dio version command (single source: dio.__version__).

dio check-config <file>

  • Validates a config file through the existing load_config_file without starting the gateway.
  • Exit codes: 0 = valid (prints backend count, strategy, port), 1 = file missing/unreadable, 2 = unparsable or unusable config (ConfigError, YAML/JSON syntax errors), each with a readable message.

Tests (dio-serve/tests/test_cli.py, 7 new tests)

  • --version output matches the package version and the version command.
  • check-config: valid file, missing file, unusable config, non-mapping top level, malformed YAML.

README: CLI Reference table gains the check-config row and the --version flag.

Verified locally: the new tests pass, and dio --version, dio check-config on the example config, a bad config, and a missing file all behave as above. One pre-existing failure is unrelated: tests/test_config_file.py::test_detect_local_backends_no_throw fails on the pristine tree as well (it probes localhost engine ports).

@nisaral

nisaral commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thanks @Ptraaah, this is really clean: exit codes, error messages, tests and README all match #30 🙌 One test (test_check_config_valid_file) was flaky because Rich wraps the output at 80 columns with long tmp paths, so I pushed a small fix to your branch that collapses whitespace before asserting. CI is green, merging now. Welcome aboard, and if you want another one, the other help wanted issues are open!

@nisaral
nisaral merged commit 91ccf69 into nisaral:main Nov 1, 2026
7 checks passed
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.

2 participants