Skip to content

feat(cli): add --output-format option and rename --format to --input-format#95

Merged
fohte merged 1 commit intomainfrom
fohte/check-output-format
Feb 24, 2026
Merged

feat(cli): add --output-format option and rename --format to --input-format#95
fohte merged 1 commit intomainfrom
fohte/check-output-format

Conversation

@fohte
Copy link
Owner

@fohte fohte commented Feb 24, 2026

Why

  • runok check always outputs JSON, which is hard to read when run directly by humans
  • The existing --format option specifies the input format, but the name is ambiguous about whether it controls input or output

What

  • Add --output-format json|text option with text as the default
    • Text output uses a simple, human-readable format like allow, deny: reason
    • Claude Code Hook mode always outputs JSON (protocol requirement)
  • Rename --format to --input-format for symmetry between input/output format options

Open with Devin

…nput-format`

Add `--output-format json|text` option to `check` subcommand with `text`
as the default, making output human-readable. Rename `--format` to
`--input-format` for symmetry between input/output format options.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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 enhances the runok check command by providing more control over its output. Previously, the command always produced JSON, which was not ideal for direct human consumption. The changes introduce a new --output-format option, defaulting to a human-readable text format, while also clarifying the existing --format option by renaming it to --input-format. This improves the user experience by making the command's output more accessible and its options more intuitive.

Highlights

  • New CLI Option: --output-format: Introduced a new --output-format CLI option for the runok check command, allowing users to specify output as json or text. The default output format is now text for human readability.
  • Renamed CLI Option: --input-format: The existing --format CLI option has been renamed to --input-format to explicitly clarify its purpose of specifying the input data format, improving symmetry with the new output format option.
  • Human-Readable Text Output: Implemented a human-readable text output format for runok check results, displaying decisions like allow or deny: reason directly, which is easier to parse for human users than raw JSON.
  • Claude Code Hook Consistency: Ensured that the Claude Code Hook mode continues to output results exclusively in JSON format, adhering to its protocol requirements, regardless of the --output-format setting.
Changelog
  • src/adapter/check_adapter.rs
    • Added OutputFormat enum to define JSON and Text output types, with Text as the default.
    • Included output_format field in CheckAdapter and updated constructors to initialize it.
    • Implemented with_output_format method for CheckAdapter to allow setting the output format.
    • Provided fmt::Display implementation for CheckOutput to enable human-readable text formatting.
    • Refactored output handling in handle_action and handle_no_match to use a new print_output method, which dispatches based on the configured output_format.
  • src/cli/mod.rs
    • Renamed the format argument in CheckArgs to input_format.
    • Added a new output_format argument to CheckArgs, defaulting to OutputFormat::Text.
    • Defined a clap::ValueEnum for OutputFormat to integrate with the CLI parsing library.
    • Updated test cases to reflect the renamed input_format and the new output_format arguments.
  • src/cli/route.rs
    • Introduced to_adapter_output_format helper function to map CLI output format to adapter's OutputFormat.
    • Modified route_check and route_json functions to retrieve and pass the output_format to CheckAdapter instances.
    • Updated error messages to reference --input-format instead of --format.
    • Adjusted internal test helper check_args to correctly handle input_format and output_format.
  • src/main.rs
    • Updated CheckArgs initialization in test functions to use input_format and output_format.
  • tests/e2e/check_claude_code_hook.rs
    • Updated all test commands to use --input-format instead of --format.
  • tests/e2e/check_format_auto_detect.rs
    • Modified a test case to explicitly specify --output-format json when checking generic JSON input.
  • tests/e2e/check_generic.rs
    • Added new test cases (check_command_arg_text) to verify the human-readable text output for CLI arguments.
    • Updated existing test cases (check_command_arg_json, check_stdin_json_deny, etc.) to explicitly use --output-format json for JSON output validation.
  • tests/e2e/error_handling.rs
    • Updated test commands to use --input-format and explicitly set --output-format json where appropriate.
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.

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 96.55172% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.06%. Comparing base (beacb7f) to head (0870c49).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/adapter/check_adapter.rs 93.93% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #95      +/-   ##
==========================================
+ Coverage   89.03%   89.06%   +0.03%     
==========================================
  Files          29       29              
  Lines        5880     5915      +35     
==========================================
+ Hits         5235     5268      +33     
- Misses        645      647       +2     
Flag Coverage Δ
Linux 88.89% <96.55%> (+0.03%) ⬆️
macOS 91.09% <96.55%> (+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.

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: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an output format option to the runok check command, allowing users to specify whether the output should be in JSON or human-readable text format. The changes include adding an OutputFormat enum to represent the output format, modifying the CheckAdapter struct to include an output_format field, and implementing the fmt::Display trait for the CheckOutput struct to format the output as text. The CLI is updated to include an --output-format argument, and the route_check function is modified to handle the new output format option. Tests are updated to reflect the changes.

@fohte fohte merged commit 5fc9592 into main Feb 24, 2026
6 checks passed
@fohte fohte deleted the fohte/check-output-format branch February 24, 2026 17:22
@fohte-bot fohte-bot bot mentioned this pull request Feb 24, 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