Skip to content

feat(cli): unify check command input to positional args matching exec#96

Merged
fohte merged 5 commits intomainfrom
fohte/check-positional-command
Feb 25, 2026
Merged

feat(cli): unify check command input to positional args matching exec#96
fohte merged 5 commits intomainfrom
fohte/check-positional-command

Conversation

@fohte
Copy link
Owner

@fohte fohte commented Feb 24, 2026

Why

  • The check subcommand used a different command specification method from exec, causing inconsistent UX
    • exec accepts positional args (runok exec -- echo hello), but check required a named option (runok check --command "echo hello")

What

  • Unify check command input to the same trailing_var_arg format as exec
    • runok check -- echo hello is now supported
    • stdin fallback is preserved when no positional args are provided

Open with Devin

Replace `--command` named option with trailing_var_arg positional
arguments, matching the `exec` subcommand interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.93%. Comparing base (5fc9592) to head (2c7bb42).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #96   +/-   ##
=======================================
  Coverage   89.92%   89.93%           
=======================================
  Files          29       29           
  Lines        6164     6167    +3     
=======================================
+ Hits         5543     5546    +3     
  Misses        621      621           
Flag Coverage Δ
Linux 89.77% <100.00%> (+<0.01%) ⬆️
macOS 91.91% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gemini-code-assist
Copy link

Summary of Changes

Hello @fohte, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the check subcommand's command-line argument parsing to align with the exec subcommand. Previously, check required a --command flag, which created an inconsistent user experience. Now, commands can be passed directly as positional arguments after runok check --, enhancing usability and consistency across the CLI. The change ensures that the fallback mechanism for reading commands from standard input remains functional when no explicit command arguments are given.

Highlights

  • CLI Consistency: The check subcommand now accepts command arguments as positional arguments, mirroring the behavior of the exec subcommand for a more consistent user experience.
  • Removed --command option: The explicit --command flag for the check subcommand has been removed, simplifying the command-line interface.
  • Internal Argument Handling: Internal logic and test cases have been updated to process command arguments as a vector of strings, reflecting the new positional argument approach.
  • Stdin Fallback Preserved: The functionality to read commands from standard input is maintained when no positional arguments are provided to the check subcommand.
Changelog
  • src/adapter/check_adapter.rs
    • Updated documentation for the from_command method to reflect the use of positional command arguments.
  • src/cli/mod.rs
    • Modified the CheckArgs struct to use trailing_var_arg for the command field, changing it from an Option<String> to a Vec<String>.
    • Updated cli_parsing test cases to reflect the new positional argument syntax for the check command.
  • src/cli/route.rs
    • Adjusted the route_check function to process positional command arguments by joining the Vec<String> into a single command string.
    • Updated the CheckRoute enum comment to mention 'positional command' instead of '--command'.
    • Refactored the check_args helper function and all related test cases to handle command arguments as a vector of strings.
  • src/main.rs
    • Updated run_command_check test cases to instantiate CheckArgs with a Vec<String> for the command, aligning with the new argument structure.
  • tests/e2e/check_generic.rs
    • Refactored end-to-end tests, specifically check_command_arg, to use the new positional argument syntax (-- followed by command parts) for the check command.
    • Updated other end-to-end tests to use the new positional argument syntax where applicable.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

devin-ai-integration[bot]

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

…e argument boundaries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
devin-ai-integration[bot]

This comment was marked as resolved.

…serve compound command detection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

⚠️ 1 issue in files not directly in the diff

⚠️ E2E error-handling tests still use removed --command flag, silently testing wrong commands (tests/e2e/error_handling.rs:69)

The PR removed the --command named flag from CheckArgs and replaced it with trailing_var_arg positional args, but tests/e2e/error_handling.rs was not updated. Because CheckArgs now has #[arg(trailing_var_arg = true, allow_hyphen_values = true)], clap silently captures --command as a positional argument instead of erroring.

Detailed impact on each affected test

For example, ["check", "--command", "rm -rf /"] at line 69 is now parsed as command: vec!["--command", "rm -rf /"], which gets joined via shell_quote_join into "--command 'rm -rf /'". This string does not match the deny rule rm -rf /, so the decision becomes "ask" (default) instead of "deny". The test still passes (exit code 0) but no longer validates the deny path.

All four occurrences are affected:

  • Line 9: &["check", "--command", "git status"] — config is invalid, so exits 2 regardless. Test passes by coincidence.
  • Line 22: &["check", "--command", "rm -rf /"] — config validation error occurs before evaluation. Test passes by coincidence.
  • Line 69: &["check", "--command", "rm -rf /"]most impactful: the exit_codes::case_2_check_deny test intends to verify a denied command returns exit 0, but now tests a default/ask case. If the deny→exit-0 path breaks, this test won't catch it.
  • Line 89: &["check", "--command", "git status"] — expects "ask" decision; still gets "ask" since no rules match the mangled command. Passes by coincidence.

View 4 additional findings in Devin Review.

Open in Devin Review

…l-command

# Conflicts:
#	src/cli/mod.rs
#	src/cli/route.rs
#	src/main.rs
#	tests/e2e/check_generic.rs
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

⚠️ 1 issue in files not directly in the diff

⚠️ E2E error-handling tests still use removed --command flag, silently testing wrong commands (tests/e2e/error_handling.rs:69)

The PR removed the --command named flag from CheckArgs and replaced it with trailing_var_arg positional args, but tests/e2e/error_handling.rs was not updated. Because CheckArgs now has #[arg(trailing_var_arg = true, allow_hyphen_values = true)], clap silently captures --command as a positional argument instead of erroring.

Detailed impact on each affected test

For example, ["check", "--command", "rm -rf /"] at line 69 is now parsed as command: vec!["--command", "rm -rf /"], which gets joined via shell_quote_join into "--command 'rm -rf /'". This string does not match the deny rule rm -rf /, so the decision becomes "ask" (default) instead of "deny". The test still passes (exit code 0) but no longer validates the deny path.

All four occurrences are affected:

  • Line 9: &["check", "--command", "git status"] — config is invalid, so exits 2 regardless. Test passes by coincidence.
  • Line 22: &["check", "--command", "rm -rf /"] — config validation error occurs before evaluation. Test passes by coincidence.
  • Line 69: &["check", "--command", "rm -rf /"]most impactful: the exit_codes::case_2_check_deny test intends to verify a denied command returns exit 0, but now tests a default/ask case. If the deny→exit-0 path breaks, this test won't catch it.
  • Line 89: &["check", "--command", "git status"] — expects "ask" decision; still gets "ask" since no rules match the mangled command. Passes by coincidence.

View 5 additional findings in Devin Review.

Open in Devin Review

…tead of removed `--command` flag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fohte fohte merged commit e5a3f8f into main Feb 25, 2026
6 checks passed
@fohte fohte deleted the fohte/check-positional-command branch February 25, 2026 01:13
@fohte-bot fohte-bot bot mentioned this pull request Feb 25, 2026
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.

1 participant