Skip to content

Improve --help: add detailed about/examples/color, snapshot test (clo…#371

Merged
serrrfirat merged 4 commits intonearai:mainfrom
BroccoliFin:feat/help-improvements
Feb 27, 2026
Merged

Improve --help: add detailed about/examples/color, snapshot test (clo…#371
serrrfirat merged 4 commits intonearai:mainfrom
BroccoliFin:feat/help-improvements

Conversation

@BroccoliFin
Copy link
Copy Markdown
Contributor

@BroccoliFin BroccoliFin commented Feb 25, 2026

Improved --help output:

Updated based on feedback:

  • Corrected the MCP example to include both required arguments (e.g., "ironclaw mcp add notion https://mcp.notion.com").
  • Updated the Pairing example to include full valid commands (list and approve with arguments).
  • Added a separate test snapshot for long help using render_long_help() to expose new long_about content.
  • Hide the Worker and ClaudeBridge internal command from the user help with #[command(hide = true)].
    All suggestions have been taken into account (moderate/low severity findings have been resolved). Ready for re-review! @serrrfirat

@github-actions github-actions bot added scope: channel/cli TUI / CLI channel scope: dependencies Dependency updates size: L 200-499 changed lines risk: medium Business logic, config, or moderate-risk modules contributor: experienced 6-19 merged PRs labels Feb 25, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @BroccoliFin, 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 refines the command-line interface's help system, making it more user-friendly and informative. By incorporating detailed descriptions and examples, users can more easily understand the functionality and usage of various commands. The addition of colored output further enhances the user experience, while a new snapshot test provides a robust mechanism to prevent regressions in the help documentation.

Highlights

  • Enhanced Help Output: The --help output for the ironclaw CLI has been significantly improved with detailed about and long_about descriptions, including usage examples for the main command and all subcommands.
  • Auto-Color Support: Automatic colorization has been enabled for the help output, improving readability in terminals that support it.
  • Snapshot Testing for Help Output: A new snapshot test using the insta crate has been added to ensure the consistency and correctness of the generated help messages over time.
  • Dependency Updates: Numerous Rust dependencies have been updated to their latest versions, including anyhow, rustix, syn, clap, chrono, and wasm-bindgen, along with the addition of new dependencies like insta and console.
Changelog
  • Cargo.lock
    • Updated anyhow from 1.0.101 to 1.0.102
    • Updated rustix from 1.1.3 to 1.1.4 (multiple instances)
    • Updated syn from 2.0.116 to 2.0.117 (multiple instances)
    • Updated bumpalo from 3.20.1 to 3.20.2
    • Updated chrono from 0.4.43 to 0.4.44
    • Updated clap from 4.5.59 to 4.5.60
    • Updated clap_builder from 4.5.59 to 4.5.60
    • Added new package console version 0.15.11
    • Updated deranged from 0.5.6 to 0.5.8
    • Added new package encode_unicode version 1.0.0
    • Updated home from 0.5.11 to 0.5.12
    • Updated html-to-markdown-rs from 2.25.0 to 2.25.1
    • Added new package insta version 1.46.3
    • Updated js-sys from 0.3.85 to 0.3.90
    • Updated redox_syscall from 0.7.1 to 0.7.2 (multiple instances)
    • Updated linux-raw-sys from 0.11.0 to 0.12.1
    • Updated memmap2 from 0.6.5 to 0.7.1
    • Updated num-conv from 0.1.0 to 0.2.0
    • Updated regex-syntax from 0.8.9 to 0.8.10
    • Updated rustls from 0.23.36 to 0.23.37
    • Updated security-framework from 3.6.0 to 3.7.0
    • Updated security-framework-sys from 2.16.0 to 2.17.0
    • Added new package sha1_smol version 1.0.1
    • Added new package similar version 2.7.0
    • Updated serde_with from 3.16.1 to 3.17.0
    • Updated serde_with_macros from 3.16.1 to 3.17.0
    • Updated tempfile from 3.25.0 to 3.26.0
    • Updated time from 0.3.45 to 0.3.47
    • Updated time-core from 0.1.7 to 0.1.8
    • Updated time-macros from 0.2.25 to 0.2.27
    • Updated wasip2 from 1.0.1+wasi-0.2.4 to 1.0.2+wasi-0.2.9
    • Removed wit-bindgen version 0.46.0 entry
    • Updated wasm-bindgen from 0.2.108 to 0.2.113
    • Updated wasm-bindgen-futures from 0.4.58 to 0.4.63
    • Updated wasm-bindgen-macro from 0.2.108 to 0.2.113
    • Updated wasm-bindgen-macro-support from 0.2.108 to 0.2.113
    • Updated wasm-bindgen-shared from 0.2.108 to 0.2.113
    • Updated web-sys from 0.3.85 to 0.3.90
  • Cargo.toml
    • Added insta = "1.46.3" as a development dependency.
  • src/cli/mod.rs
    • Imported ColorChoice from clap.
    • Updated the main Cli command with a long_about description and enabled ColorChoice::Auto for help output.
    • Added about and long_about attributes to Run, Onboard, Config, Tool, Registry, Mcp, Memory, Pairing, Service, Doctor, Status, and Completion subcommands.
    • Added a new test test_help_output that uses insta::assert_snapshot! to verify the help output.
  • src/cli/snapshots/ironclaw__cli__tests__help_output.snap
    • Added a new snapshot file containing the expected help output for the ironclaw CLI.
Activity
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.

Copy link
Copy Markdown
Contributor

@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 significantly improves the usability of the CLI by enhancing the --help output. The addition of detailed descriptions, usage examples, and automatic color support is a great enhancement for users. Introducing snapshot testing for the help output with insta is an excellent practice to ensure consistency and prevent regressions. The implementation is straightforward and well-executed. I have one minor suggestion for code consistency.

Comment thread src/cli/mod.rs Outdated
long_about = "IronClaw is a secure AI assistant. Use 'ironclaw <subcommand> --help' for details.\nExamples:\n ironclaw run # Start the agent\n ironclaw config list # List configs"
)]
#[command(version)]
#[command(color = ColorChoice::Auto)] // Включи авто-цвет для help (если терминал поддерживает)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with the rest of the codebase, which is in English, this comment should also be in English. This improves maintainability for all contributors.

Suggested change
#[command(color = ColorChoice::Auto)] // Включи авто-цвет для help (если терминал поддерживает)
#[command(color = ColorChoice::Auto)] // Enable auto-color for help (if the terminal supports it)

Copy link
Copy Markdown
Collaborator

@serrrfirat serrrfirat left a comment

Choose a reason for hiding this comment

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

Summary

This is a straightforward, low-risk PR that improves CLI help text by adding long_about descriptions with usage examples and a snapshot test. No security concerns, no runtime behavior changes beyond help output. Two findings warrant attention before merge: (1) the MCP example in long_about is incorrect — mcp add requires two positional args but the example only provides one, and (2) the snapshot test uses render_help() (short help) rather than render_long_help(), so the primary new content (the long_about strings) is not actually tested. The pairing example has a similar issue. The rest are minor: internal commands should be hidden from help, redundant doc comments create divergence risk, and the explicit ColorChoice::Auto is a no-op.

Comment thread src/cli/mod.rs
#[command(subcommand)]
#[command(
subcommand,
about = "Manage MCP servers",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

MCP long_about example is incorrect — missing required argument

The long_about for the Mcp variant contains the example ironclaw mcp add my-server-url, but McpCommand::Add requires TWO positional arguments: name: String and url: String. Running this example will fail with a missing argument error. The example treats my-server-url as a single positional arg (the name), leaving url unprovided.

Suggested fix:

Change the example to include both arguments, e.g.:
`long_about = "Add, auth, list, or test MCP servers.\nExample: ironclaw mcp add notion https://mcp.notion.com"`

Severity: medium · Confidence: high

Comment thread src/cli/mod.rs
#[command(subcommand)]
#[command(
subcommand,
about = "Manage DM pairing",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Pairing long_about example is incomplete — missing required arguments

The long_about for Pairing contains ironclaw pairing approve, but PairingCommand::Approve requires two positional arguments: channel: String (e.g. 'telegram') and code: String (e.g. 'ABC12345'). Running this example will produce a missing-argument error. While approve is a valid subcommand name, the example is misleading as presented — it implies it can be run as-is.

Suggested fix:

Change the example to something valid, e.g.:
`long_about = "Approve or manage pairing requests.\nExamples:\n  ironclaw pairing list telegram\n  ironclaw pairing approve telegram ABC12345"`

Severity: low · Confidence: high

Comment thread src/cli/mod.rs

#[test]
fn test_help_output() {
let mut cmd = Cli::command();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Snapshot test only captures short help — long_about content is untested

The new test_help_output test calls cmd.render_help() which returns the SHORT help text (triggered by -h). The long_about strings — which are the primary new feature of this PR — are only displayed via --help (the long form) and would be rendered by cmd.render_long_help(). As a result, the main new content (detailed descriptions with usage examples) is not covered by any test. If someone introduces a typo or removes a long_about, the snapshot test will not catch it.

Suggested fix:

Add a second snapshot test for long help:
```rust
#[test]
fn test_long_help_output() {
    let mut cmd = Cli::command();
    let help = cmd.render_long_help().to_string();
    assert_snapshot!(help);
}
```

Severity: medium · Confidence: high

Comment thread src/cli/mod.rs
long_about = "Generates shell completion scripts.\nExample: ironclaw completion --shell bash > ironclaw.bash"
)]
Completion(Completion),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Internal commands (Worker, ClaudeBridge) visible in user-facing help

The Worker and ClaudeBridge variants are explicitly documented as internal-use (This is invoked automatically by the orchestrator, not by users directly), yet they appear in the --help output visible to all users. The snapshot confirms they're listed alongside user-facing commands. This is a pre-existing issue, but since this PR specifically aims to improve user-facing help quality, it's a missed opportunity to hide internal commands.

Suggested fix:

Add `#[command(hide = true)]` to both `Worker` and `ClaudeBridge` variants:
```rust
/// Run as a sandboxed worker (internal use).
#[command(hide = true)]
Worker { ... },

/// Run as a Claude Code bridge (internal use).
#[command(hide = true)]
ClaudeBridge { ... },
```

Severity: low · Confidence: high

serrrfirat
serrrfirat previously approved these changes Feb 27, 2026
@serrrfirat
Copy link
Copy Markdown
Collaborator

@BroccoliFin if you resolve the conflict we can merge after CI pass

@serrrfirat serrrfirat merged commit a89c5f7 into nearai:main Feb 27, 2026
13 checks passed
BroccoliFin added a commit to BroccoliFin/ironclaw that referenced this pull request Mar 21, 2026
- Add --grep/-g flag for regex filtering (conflicts with --follow)
- Add --ignore-case for case-insensitive matching
- Add --context N to show lines around matches
- Implement filter_lines() with regex crate
- Add 6 comprehensive tests
- Update documentation with examples

Branching from staging as suggested in nearai#371.
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
serrrfirat pushed a commit that referenced this pull request Apr 17, 2026
* feat(cli/logs): add --grep support for filtering log output

- Add --grep/-g flag for regex filtering (conflicts with --follow)
- Add --ignore-case for case-insensitive matching
- Add --context N to show lines around matches
- Implement filter_lines() with regex crate
- Add 6 comprehensive tests
- Update documentation with examples

Branching from staging as suggested in #371.

* refactor(cli/logs): simplify regex compilation per bot feedback

- Use RegexBuilder::new().case_insensitive(ignore_case) instead of if/else
- Fix test assertion to avoid move issue (single unwrap_err() call)
- Apply cargo fmt formatting

* fix(cli/logs): address maintainer feedback

- Use saturating_add to prevent integer overflow in context calculation
- Add test_filter_lines_with_non_overlapping_context to verify BTreeSet dedup logic

Addresses review comments on PR #1533.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: experienced 6-19 merged PRs risk: medium Business logic, config, or moderate-risk modules scope: channel/cli TUI / CLI channel scope: dependencies Dependency updates size: L 200-499 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants