Skip to content

Conversation

leynos
Copy link
Owner

@leynos leynos commented Sep 1, 2025

Summary

  • add Clap-based CLI and build script to emit wireframe.1
  • upload generated man page during release workflow
  • document CLI and man page generation

Testing

  • make fmt
  • make lint
  • make test
  • make markdownlint
  • make nixie (fails: KeyboardInterrupt)

https://chatgpt.com/codex/tasks/task_e_68b4f9934dc88322963a8e1ec67afe1d

Summary by Sourcery

Introduce a Clap-based CLI with optional name flag for the wireframe binary, generate a manual page via a build script, update documentation, and extend the release workflow to upload the generated man page.

New Features:

  • Introduce clap-based CLI for the wireframe binary with an optional --name flag

Enhancements:

  • Update main function to parse CLI arguments and print a greeting based on the provided name

Build:

  • Add build script and dependencies to generate a manual page from the CLI definition using clap_mangen

CI:

  • Add GitHub Actions release workflow to build and upload the generated man page as a release asset

Documentation:

  • Add CLI usage and man page generation guide and integrate it into the documentation contents

Tests:

  • Add unit test to verify parsing of the --name option in the CLI

Copy link
Contributor

sourcery-ai bot commented Sep 1, 2025

Reviewer's Guide

This PR integrates a Clap-based CLI into the wireframe binary, adds a build script to auto-generate a man page from the CLI definition, updates the release workflow to include the generated man page, and documents the new CLI and man-page process.

Class diagram for new CLI struct and usage

classDiagram
    class Cli {
        +Option<String> name
    }
    Cli : +parse_from(args)
    Cli : +parse()
    main --> Cli : uses
    build.rs --> Cli : imports
Loading

File-Level Changes

Change Details Files
Introduce Clap-based CLI parsing and tests
  • Refactor main to parse and handle an optional --name flag
  • Add a Cli struct with Clap derive and parse logic
  • Include a unit test for the name parsing behavior
  • Add Clap dependency with derive feature
src/main.rs
src/cli.rs
Cargo.toml
Add build script to generate manual pages
  • Implement build.rs using clap_mangen to render wireframe.1
  • Configure build-dependencies for Clap and clap_mangen
  • Ensure output directory target/generated-man is created and used
build.rs
Cargo.toml
Enhance release workflow to include man page
  • Define a GitHub Actions workflow triggered on release publish
  • Run the release build and produce wireframe.1 asset
  • Upload the generated man page as a release asset
.github/workflows/release.yml
Update documentation for CLI and man-page generation
  • Add CLI overview and man-page instructions in cli.md
  • Link the new CLI doc in the main contents index
docs/contents.md
docs/cli.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

coderabbitai bot commented Sep 1, 2025

Summary by CodeRabbit

  • New Features
    • Introduced a command-line interface with an optional --name flag to customise the greeting. Defaults to a generic greeting when not provided.
  • Documentation
    • Added a CLI usage guide and documented automatic man page generation. Updated the documentation contents index.
  • Chores
    • Implemented a release workflow that builds the project and attaches the generated man page to published releases.
  • Tests
    • Added a unit test to validate CLI argument parsing.

Walkthrough

Add a Clap-based CLI with an optional --name flag, integrate man page generation via build.rs, update Cargo dependencies and features, add docs, and introduce a GitHub Actions release workflow that builds in release mode and uploads the generated man page asset.

Changes

Cohort / File(s) Summary
Release workflow
.github/workflows/release.yml
Add release-triggered workflow that checks out code, sets up Rust, runs make release, and uploads target/generated-man/wireframe.1 to the GitHub Release.
Build tooling & dependencies
Cargo.toml, build.rs
Add clap (derive) as dependency and build-dependency, add clap_mangen, and introduce an advanced-tests feature. Implement build.rs to generate wireframe.1 man page into target/generated-man from the Clap command.
CLI implementation
src/cli.rs, src/main.rs
Introduce public Clap Parser struct Cli with optional -n/--name argument. Update main to parse CLI and print greeting with or without name. Add unit test for name parsing.
Documentation
docs/cli.md, docs/contents.md
Document CLI usage and man page generation; add CLI entry to docs contents.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant CLI as wireframe (main)
  participant Parser as Clap Parser
  Note over CLI,Parser: Runtime CLI flow
  User->>CLI: Run `wireframe [--name NAME]`
  CLI->>Parser: Cli::parse()
  Parser-->>CLI: Cli { name: Option<String> }
  alt name provided
    CLI->>User: Print "Hello, {name} from Wireframe!"
  else no name
    CLI->>User: Print "Hello from Wireframe!"
  end
Loading
sequenceDiagram
  autonumber
  participant GH as GitHub Release Event
  participant CI as Actions Job (build)
  participant Cargo as Cargo build.rs
  participant Gen as clap_mangen
  participant Rel as Release Upload

  Note over GH,CI: Release published -> Workflow
  GH->>CI: Trigger on release.published
  CI->>CI: Checkout, setup Rust, env BUILD_PROFILE=release
  CI->>CI: make release
  CI->>Cargo: Build (runs build.rs)
  Cargo->>Gen: Generate man from Cli::command()
  Gen-->>Cargo: wireframe.1 (buffer)
  Cargo->>CI: Write target/generated-man/wireframe.1
  CI->>Rel: Upload asset wireframe.1 to release
  Rel-->>CI: Asset attached
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A flag waves: “--name”, a greeting unfurls,
The parser awakes, shaping strings into swirls.
A man page is forged where binaries stand,
build.rs whispers, mangen lends a hand.
On release, the workflow ties a tidy bow—
Hello from Wireframe! Now properly on show.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/add-manpage-generation-to-release-workflow

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

- name: Build
run: make release
- name: Upload release assets
uses: softprops/action-gh-release@v2

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Release' step
Uses Step
uses 'softprops/action-gh-release' with ref 'v2', not a pinned commit hash
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

Blocking issues:

  • An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. (link)

General comments:

  • In build.rs, consider using the standard OUT_DIR environment variable instead of hard-coding "target/generated-man" so generated files end up in the normal build output path.
  • You’ve declared clap twice (in both [dependencies] and [build-dependencies]); consolidating or aligning them via a workspace dependency could prevent version drift.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In build.rs, consider using the standard OUT_DIR environment variable instead of hard-coding "target/generated-man" so generated files end up in the normal build output path.
- You’ve declared clap twice (in both [dependencies] and [build-dependencies]); consolidating or aligning them via a workspace dependency could prevent version drift.

## Individual Comments

### Comment 1
<location> `build.rs:8` </location>
<code_context>
+use clap::CommandFactory;
+use clap_mangen::Man;
+
+#[path = "src/cli.rs"]
+mod cli;
+
</code_context>

<issue_to_address>
Consider moving the CLI definition to the library and writing directly to the file to simplify build script logic.

Here’s one way to both remove the `#[path]` hack and simplify the write‐buffer dance, while keeping the exact same output:

1. Move your CLI definition into your library (`src/lib.rs`) so it can be used by both `main.rs` and `build.rs`:

```rust
// src/lib.rs

use clap::CommandFactory;

mod cli;
pub use cli::Cli;

/// convenience constructor for build.rs
pub fn build_cli() -> clap::Command {
    Cli::command()
}
```

2. In `build.rs`, import that function instead of shimming `src/cli.rs`, and write directly into the file:

```rust
// build.rs

use std::{fs, path::PathBuf};
use clap_mangen::Man;

// import your crate as a library
use mycrate::build_cli;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    println!("cargo:rerun-if-changed=src/cli.rs");

    let out_dir = PathBuf::from("target/generated-man");
    fs::create_dir_all(&out_dir)?;

    let mut file = fs::File::create(out_dir.join("wireframe.1"))?;
    Man::new(build_cli()).render(&mut file)?;

    Ok(())
}
```

Now you’ve

- eliminated the `#[path]` shim
- removed the intermediate `Vec<u8>`
- kept all functionality intact and still auto‐regenerate on CLI changes.
</issue_to_address>

## Security Issues

### Issue 1
<location> `.github/workflows/release.yml:22` </location>

<issue_to_address>
**security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha):** An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

*Source: opengrep*
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

use clap::CommandFactory;
use clap_mangen::Man;

#[path = "src/cli.rs"]
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (complexity): Consider moving the CLI definition to the library and writing directly to the file to simplify build script logic.

Here’s one way to both remove the #[path] hack and simplify the write‐buffer dance, while keeping the exact same output:

  1. Move your CLI definition into your library (src/lib.rs) so it can be used by both main.rs and build.rs:
// src/lib.rs

use clap::CommandFactory;

mod cli;
pub use cli::Cli;

/// convenience constructor for build.rs
pub fn build_cli() -> clap::Command {
    Cli::command()
}
  1. In build.rs, import that function instead of shimming src/cli.rs, and write directly into the file:
// build.rs

use std::{fs, path::PathBuf};
use clap_mangen::Man;

// import your crate as a library
use mycrate::build_cli;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    println!("cargo:rerun-if-changed=src/cli.rs");

    let out_dir = PathBuf::from("target/generated-man");
    fs::create_dir_all(&out_dir)?;

    let mut file = fs::File::create(out_dir.join("wireframe.1"))?;
    Man::new(build_cli()).render(&mut file)?;

    Ok(())
}

Now you’ve

  • eliminated the #[path] shim
  • removed the intermediate Vec<u8>
  • kept all functionality intact and still auto‐regenerate on CLI changes.

- name: Build
run: make release
- name: Upload release assets
uses: softprops/action-gh-release@v2
Copy link
Contributor

Choose a reason for hiding this comment

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

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +14 to +20
let out_dir = PathBuf::from("target/generated-man");
fs::create_dir_all(&out_dir)?;

let cmd = cli::Cli::command();
let man = Man::new(cmd);
let mut buf: Vec<u8> = Vec::new();
man.render(&mut buf)?;

Choose a reason for hiding this comment

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

[P1] Avoid writing build output into crate sources

The build script writes the generated man page to target/generated-man under the crate root. That path is writable in this repo, but build scripts also run when the crate is compiled as a dependency from crates.io, where the source directory is read-only. Creating or writing files there will fail and prevent dependent builds from succeeding. Build scripts should use the OUT_DIR provided by Cargo (and copy the resulting file in the release workflow if a stable path is required) so compilation works in all environments.

Useful? React with 👍 / 👎.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1233ddf and bb221c9.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • .github/workflows/release.yml (1 hunks)
  • Cargo.toml (2 hunks)
  • build.rs (1 hunks)
  • docs/cli.md (1 hunks)
  • docs/contents.md (1 hunks)
  • src/cli.rs (1 hunks)
  • src/main.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
Cargo.toml

📄 CodeRabbit inference engine (AGENTS.md)

Cargo.toml: Use explicit version ranges in Cargo.toml; keep dependencies up to date
All dependencies in Cargo.toml must use caret (^) SemVer-compatible requirements (e.g., "1.2.3")
Forbid wildcard (*) and open-ended (>=) versions; use ~ only with a specific documented reason

Files:

  • Cargo.toml
docs/**/*.md

📄 CodeRabbit inference engine (docs/documentation-style-guide.md)

docs/**/*.md: Use British English based on the Oxford English Dictionary (en-oxendict) for documentation text.
The word "outwith" is acceptable in documentation.
Keep US spelling when used in an API, for example color.
Use the Oxford comma in documentation text.
Treat company names as collective nouns in documentation (e.g., "Lille Industries are expanding").
Write headings in sentence case in documentation.
Use Markdown headings (#, ##, ###, etc.) in order without skipping levels.
Follow markdownlint recommendations for Markdown files.
Provide code blocks and lists using standard Markdown syntax.
Always provide a language identifier for fenced code blocks; use plaintext for non-code text.
Use - as the first level bullet and renumber lists when items change.
Prefer inline links using [text](url) or angle brackets around the URL; avoid reference-style links like [foo][bar].
Ensure blank lines before and after bulleted lists and fenced blocks in Markdown.
Ensure tables have a delimiter line below the header row in Markdown.
Expand any uncommon acronym on first use, for example, Continuous Integration (CI).
Wrap paragraphs at 80 columns in documentation.
Wrap code at 120 columns in documentation.
Do not wrap tables in documentation.
Use sequentially numbered footnotes referenced with [^1] and place definitions at the end of the file.
Where it adds clarity, include Mermaid diagrams in documentation.
When embedding figures, use ![alt text](path/to/image) and provide concise alt text describing the content.
Add a brief description before each Mermaid diagram in documentation for screen readers.

Document examples showing how to deprecate old message versions gracefully

docs/**/*.md: Use docs/ markdown as the source of truth for requirements and decisions
Proactively update docs/ when requirements, dependencies, or architecture change
Documentation must use en-GB-oxendict spelling and grammar (LICENSE name exempt)

When long lines are warranted in ...

Files:

  • docs/cli.md
  • docs/contents.md
**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

**/*.md: Markdown paragraphs and bullet points must be wrapped at 80 columns
Markdown code blocks must be wrapped at 120 columns
Do not wrap tables and headings in Markdown
Use dashes (-) for list bullets in Markdown
Use GitHub-flavoured Markdown footnotes ([^1])

Files:

  • docs/cli.md
  • docs/contents.md

⚙️ CodeRabbit configuration file

**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • Headings must not be wrapped.
  • Documents must start with a level 1 heading
  • Headings must correctly increase or decrease by no more than one level at a time
  • Use GitHub-flavoured Markdown style for footnotes and endnotes.
  • Numbered footnotes must be numbered by order of appearance in the document.

Files:

  • docs/cli.md
  • docs/contents.md
docs/**

📄 CodeRabbit inference engine (docs/wireframe-1-0-detailed-development-roadmap.md)

docs/**: Document async-stream as the canonical way to create streams imperatively
Write comprehensive user guides for Duplex Messaging & Pushes, Streaming Responses, and Message Fragmentation with runnable examples

Files:

  • docs/cli.md
  • docs/contents.md
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Use precise names; boolean names should start with is/has/should
Use en-GB-oxendict spelling and grammar in comments
Function documentation must include clear examples; test documentation should omit redundant examples
Keep code files ≤ 400 lines; split long switch/dispatch logic by feature; move large test data to external files
Disallow Clippy warnings
Fix warnings emitted during tests in code rather than silencing them
Extract helper functions for long functions; adhere to separation of concerns and CQRS
Group related parameters into meaningful structs when functions have many parameters
Consider using Arc for large error returns to reduce data size
Each Rust module must begin with a module-level //! comment describing purpose and utility
Document public APIs with Rustdoc /// comments to enable cargo doc generation
Prefer immutable data; avoid unnecessary mut
Handle errors with Result instead of panicking where feasible
Avoid unsafe code unless necessary and document any usage clearly
Place function attributes after doc comments
Do not use return in single-line functions
Use predicate functions for conditional criteria with more than two branches
Do not silence lints except as a last resort
Lint suppressions must be tightly scoped and include a clear reason
Prefer #[expect(..)] over #[allow(..)] for lints
Prefer .expect() over .unwrap()
Use concat!() to combine long string literals rather than escaping newlines
Prefer single-line function bodies where appropriate (e.g., pub fn new(id: u64) -> Self { Self(id) })
Prefer semantic error enums deriving std::error::Error via thiserror for inspectable conditions

Files:

  • src/main.rs
  • build.rs
  • src/cli.rs

⚙️ CodeRabbit configuration file

**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.

  • Adhere to single responsibility and CQRS

  • Place function attributes after doc comments.

  • Do not use return in single-line functions.

  • Move conditionals with >2 branches into a predicate function.

  • Avoid unsafe unless absolutely necessary.

  • Every module must begin with a //! doc comment that explains the module's purpose and utility.

  • Comments and docs must follow en-GB-oxendict (-ize / -our) spelling and grammar

  • Lints must not be silenced except as a last resort.

    • #[allow] is forbidden.
    • Only narrowly scoped #[expect(lint, reason = "...")] is allowed.
    • No lint groups, no blanket or file-wide suppression.
    • Include FIXME: with link if a fix is expected.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • Use rstest fixtures for shared setup and to avoid repetition between tests.

  • Replace duplicated tests with #[rstest(...)] parameterised cases.

  • Prefer mockall for mocks/stubs.

  • Prefer .expect() over .unwrap()

  • Ensure that any API or behavioural changes are reflected in the documentation in docs/

  • Ensure that any completed roadmap steps are recorded in the appropriate roadmap in docs/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
  • Environment access (env::set_var and env::remove_var) are always unsafe in Rust 2024 and MUST be marked as such

    • For testing of functionality depending upon environment variables, dependency injection and the mockable crate are the preferred option.
    • If mockable cannot be used, env mutations in tests ...

Files:

  • src/main.rs
  • build.rs
  • src/cli.rs
{src,tests}/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Write unit and behavioural tests for new functionality

Files:

  • src/main.rs
  • src/cli.rs
{src/main.rs,src/bin/**/*.rs}

📄 CodeRabbit inference engine (AGENTS.md)

Use an opaque error (eyre::Report) only at the app boundary (main entrypoints/top-level tasks) for human-readable logs

Files:

  • src/main.rs
🧬 Code graph analysis (2)
src/main.rs (1)
build.rs (1)
  • main (11-24)
build.rs (1)
src/main.rs (1)
  • main (9-20)
🪛 LanguageTool
docs/cli.md

[style] ~4-~4: Would you like to use the Oxford spelling “customizing”? The spelling ‘customising’ is also correct.
Context: ...ments. An optional --name flag allows customising the greeting printed by the wireframe...

(OXFORD_SPELLING_Z_NOT_S)

🪛 GitHub Check: CodeQL
.github/workflows/release.yml

[warning] 22-22: Unpinned tag for a non-immutable Action in workflow
Unpinned 3rd party Action 'Release' step Uses Step uses 'softprops/action-gh-release' with ref 'v2', not a pinned commit hash

🔍 Remote MCP

Here are a few concrete references to help validate the new man‐page generation and release steps:

• The build script’s use of clap_mangen::Man to generate a ROFF man page follows the crate’s documented pattern:

let man = clap_mangen::Man::new(cmd);
let mut buffer = Vec::new();
man.render(&mut buffer)?;
std::fs::write("target/generated-man/wireframe.1", buffer)?;

– this matches the example in the clap_mangen docs
Version 0.2.x (latest 0.2.29) is the current release series for clap_mangen

• Uploading the generated man page via softprops/action-gh-release@v2 with:

with:
  files: target/generated-man/wireframe.1

is consistent with the action’s single-asset example, which accepts a newline-delimited glob or filename

• The action requires permissions: contents: write. Note the docs’ caution that on release events (on: release: types: [published]), the default GITHUB_TOKEN won’t trigger follow-on workflows, so if you need downstream workflows, a personal access token would be required

• The Rust setup step uses a composite “Setup Rust” action from leynos/shared-actions pinned to commit 8470c10… (v1). Reviewing that action will confirm which toolchain version, caching behavior, and Cargo config it applies

⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-test
🔇 Additional comments (5)
docs/contents.md (1)

64-65: Add CLI entry — LGTM

Entry reads well, follows list style and en‑GB spelling.

Run the checks to ensure the linked document exists, starts with a level‑1 heading, and mentions man‑page generation.

#!/bin/bash
set -euo pipefail

# 1) Verify target file exists
fd -t f '^cli\.md$' docs

# 2) Verify it starts with a level-1 heading
rg -n "^# " docs/cli.md | sed -n '1p'

# 3) Verify it references man page/gen
rg -n -i 'man page|man-page|manual page|clap_mangen' docs/cli.md

# 4) Check for lines >80 cols (MD013 exceptions aside)
awk 'length($0)>80{print FILENAME ":" NR ":" length($0) " cols"; exit 0}' docs/cli.md || echo "OK: <=80 cols"
build.rs (1)

1-24: Man‑page generation script — LGTM

Correctly reuses CLI definition, sets rerun trigger, and writes to a stable path for release uploads.

src/cli.rs (1)

17-28: Unit test — LGTM

Test is clear and minimal; no redundancy.

src/main.rs (1)

3-19: CLI integration — LGTM

Entry point initialises logging, parses args, and prints deterministically.

.github/workflows/release.yml (1)

22-25: Pin softprops/action-gh-release to immutable commit

-      - uses: softprops/action-gh-release@v2
+      - uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8

CARGO_TERM_COLOR: always
BUILD_PROFILE: release
steps:
- uses: actions/checkout@v5
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Pin actions/checkout to a commit SHA.

Apply the same immutability policy to first‑party actions.

-      - uses: actions/checkout@v5
+      - uses: actions/checkout@<COMMIT_SHA_FOR_V5>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v5
- uses: actions/checkout@<COMMIT_SHA_FOR_V5>
🤖 Prompt for AI Agents
In .github/workflows/release.yml at line 16, the workflow uses
actions/checkout@v5 which is a floating tag; replace it with an immutable commit
SHA for that action. Update the uses entry to the specific full commit SHA of
actions/checkout (e.g., actions/checkout@<commit-sha>) so the workflow is pinned
to a fixed version, ensuring immutability and reproducible runs.

Comment on lines +19 to +25
- name: Build
run: make release
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
target/generated-man/wireframe.1
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Fail fast if the man page was not generated.

Add an existence check before the upload to surface build.rs or Makefile
issues early.

       - name: Build
         run: make release
+      - name: Verify generated man page exists
+        run: |
+          test -s target/generated-man/wireframe.1 \
+            || { echo "wireframe.1 missing"; exit 1; }
       - name: Upload release assets
         uses: softprops/action-gh-release@v2
         with:
           files: |
             target/generated-man/wireframe.1

#!/bin/bash
# Search for man page references
rg -n 'wireframe\.1' -n .
# Search for generated-man directory usage
rg -n 'generated-man' -n .
# Show Makefile rules for man page generation
fd '^Makefile$' -x sed -n '1,200p' Makefile
# Inspect build.rs if present for man page creation logic
fd 'build.rs' -x sed -n '1,200p' build.rs

🏁 Script executed:

#!/usr/bin/env bash
# Locate references to the generated man page
rg -n 'wireframe\.1' .
rg -n 'generated-man' .
# Inspect Makefile for man page generation rules
if [ -f Makefile ]; then
  sed -n '1,200p' Makefile
fi
# Inspect build.rs for man page creation logic
if [ -f build.rs ]; then
  sed -n '1,200p' build.rs
fi

Length of output: 2719


Fail fast if generated man page is missing
Add a check after the build step to abort if target/generated-man/wireframe.1 is absent or empty.

       - name: Build
         run: make release
+      - name: Verify generated man page exists
+        run: |
+          test -s target/generated-man/wireframe.1 \
+            || { echo "wireframe.1 missing"; exit 1; }
       - name: Upload release assets
         uses: softprops/action-gh-release@v2
         with:
           files: |
             target/generated-man/wireframe.1
🧰 Tools
🪛 GitHub Check: CodeQL

[warning] 22-22: Unpinned tag for a non-immutable Action in workflow
Unpinned 3rd party Action 'Release' step Uses Step uses 'softprops/action-gh-release' with ref 'v2', not a pinned commit hash

🤖 Prompt for AI Agents
.github/workflows/release.yml around lines 19 to 25: the workflow proceeds to
upload the generated man page without verifying it exists or is non-empty; add a
new step immediately after the Build step that runs a shell check to fail-fast
if target/generated-man/wireframe.1 is missing or zero-length (use test -s or
equivalent) and exit with a clear error message so the workflow aborts before
the upload step.

Comment on lines +14 to +22
let out_dir = PathBuf::from("target/generated-man");
fs::create_dir_all(&out_dir)?;

let cmd = cli::Cli::command();
let man = Man::new(cmd);
let mut buf: Vec<u8> = Vec::new();
man.render(&mut buf)?;
fs::write(out_dir.join("wireframe.1"), buf)?;

Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Verify release workflow builds before upload

Ensure the release workflow compiles the crate (thus running build.rs) and uploads the expected artefact path.

Execute:

#!/bin/bash
set -euo pipefail

# Find release workflows
fd -t f -g ".github/workflows/*.yml" -x sh -c '
  echo "== {} ==";
  rg -n "cargo build" {} || true;
  rg -n "files:\s*target/generated-man/wireframe\.1" {} || true;
  rg -n "permissions:\s*[\r\n]+(\s*)contents:\s*write" {} || true
'

If the upload happens in a matrix or multi‑job workflow, gate the upload with needs: build and a path existence check to fail fast when the man page is missing.

🤖 Prompt for AI Agents
In build.rs around lines 14 to 22 the build script writes a generated man page
to target/generated-man/wireframe.1 but the release workflow may not run cargo
build (so build.rs won't execute) or may upload the wrong artifact path; update
the release workflow(s) to run cargo build (or cargo build --release) before the
upload step, ensure the upload 'files:' entry references
target/generated-man/wireframe.1 exactly, grant the workflow job
permissions.contents: write if using the actions/upload-release-asset action,
and if uploads run in a matrix or separate job, add needs: build and a
pre-upload check (fail-fast) that the file exists at
target/generated-man/wireframe.1 so the release job is skipped/failed if the man
page is missing.

metrics-exporter-prometheus = { version = "0.17.2", optional = true, features = ["http-listener"] }
thiserror = "2.0.16"
static_assertions = "1"
clap = { version = "4.5", features = ["derive"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Use caret requirements per dependency policy

Adopt caret SemVer ranges for new deps per repository rules.

Apply:

-clap = { version = "4.5", features = ["derive"] }
+clap = { version = "^4.5", features = ["derive"] }
-[build-dependencies]
-clap = { version = "4.5", features = ["derive"] }
-clap_mangen = "0.2"
+[build-dependencies]
+clap = { version = "^4.5", features = ["derive"] }
+clap_mangen = "^0.2"

Also applies to: 67-70

🤖 Prompt for AI Agents
In Cargo.toml around line 41 (and also lines 67-70), the dependency entries use
exact version strings; update them to use caret SemVer ranges per repo policy
(e.g., change version = "4.5" to version = "^4.5" or "^4.5.0" and apply the same
caret style to the dependencies on lines 67-70), keeping existing feature flags
intact.

Comment on lines +3 to +5
Wireframe includes a small command line interface for demonstration. The CLI
uses `clap` to parse arguments. An optional `--name` flag allows customising
the greeting printed by the `wireframe` binary.
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Adopt Oxford -ize spelling and wrap to 80 columns.

Replace -ise with -ize and reflow to respect the docs wrapping rule.

- Wireframe includes a small command line interface for demonstration. The CLI
- uses `clap` to parse arguments. An optional `--name` flag allows customising
- the greeting printed by the `wireframe` binary.
+ Wireframe includes a small command line interface for demonstration. The
+ CLI uses `clap` to parse arguments. An optional `--name` flag allows
+ customizing the greeting printed by the `wireframe` binary.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Wireframe includes a small command line interface for demonstration. The CLI
uses `clap` to parse arguments. An optional `--name` flag allows customising
the greeting printed by the `wireframe` binary.
Wireframe includes a small command line interface for demonstration. The
CLI uses `clap` to parse arguments. An optional `--name` flag allows
customizing the greeting printed by the `wireframe` binary.
🧰 Tools
🪛 LanguageTool

[style] ~4-~4: Would you like to use the Oxford spelling “customizing”? The spelling ‘customising’ is also correct.
Context: ...ments. An optional --name flag allows customising the greeting printed by the wireframe...

(OXFORD_SPELLING_Z_NOT_S)

🤖 Prompt for AI Agents
In docs/cli.md around lines 3 to 5, the text uses British -ise spelling and
exceeds the 80-column docs wrap rule; update occurrences of "-ise" to "-ize"
(e.g., "customising" → "customizing") and reflow the paragraph so no line
exceeds 80 characters while preserving sentence structure and punctuation.

Comment on lines +7 to +9
Manual pages are generated during the build via `clap_mangen`. The `build.rs`
script writes `wireframe.1` to `target/generated-man`, and the `release` GitHub
workflow uploads this file.
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Link libraries inline and keep lines ≤80 chars.

Add inline links and reflow.

- Manual pages are generated during the build via `clap_mangen`. The `build.rs`
- script writes `wireframe.1` to `target/generated-man`, and the `release` GitHub
- workflow uploads this file.
+ Manual pages are generated during the build via
+ [`clap_mangen`](https://crates.io/crates/clap_mangen). The `build.rs` script
+ writes `wireframe.1` to `target/generated-man`, and the `release` GitHub
+ workflow uploads this file.

Add a minimal usage block after this paragraph:

```sh
# Run the CLI
cargo run -- -n Alice

# View the generated man page locally
man -l target/generated-man/wireframe.1

<details>
<summary>🤖 Prompt for AI Agents</summary>

In docs/cli.md around lines 7-9, the paragraph about manual page generation
needs inline links and reflow to 80 chars or less; replace bare clap_mangen
and release references with inline Markdown links to their respective
docs/repos, rewrap the sentence to keep each line ≤80 chars, and then insert a
minimal usage block immediately after the paragraph containing the
two-shell-command example that shows running the CLI (cargo run -- -n Alice) and
viewing the generated man page (man -l target/generated-man/wireframe.1).


</details>

<!-- fingerprinting:phantom:triton:chinchilla -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment on lines +1 to +5
//! Command line interface for the wireframe example binary.
//!
//! Provides a tiny CLI to demonstrate argument parsing and man page
//! generation.
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Tighten module docs to en‑GB hyphenation

Hyphenate “command‑line” in line with house style.

-//! Command line interface for the wireframe example binary.
+//! Command‑line interface for the Wireframe example binary.
 //!
-//! Provides a tiny CLI to demonstrate argument parsing and man page
-//! generation.
+//! Provides a tiny CLI to demonstrate argument parsing and man‑page generation.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//! Command line interface for the wireframe example binary.
//!
//! Provides a tiny CLI to demonstrate argument parsing and man page
//! generation.
//! Command-line interface for the Wireframe example binary.
//
//! Provides a tiny CLI to demonstrate argument parsing and man-page generation.
🤖 Prompt for AI Agents
In src/cli.rs around lines 1 to 5, the module doc comment uses "Command line"
but our house style requires the en‑GB hyphenated form "Command-line"; update
the top doc line to read "Command-line interface for the wireframe example
binary." and ensure any other instances in this doc block follow the same
hyphenation.

Comment on lines +8 to +15
/// Command line arguments for the `wireframe` binary.
#[derive(Debug, Parser)]
#[command(name = "wireframe", version, about = "Example Wireframe binary")]
pub struct Cli {
/// Name to greet.
#[arg(short, long)]
pub name: Option<String>,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Document a usage example in Rustdoc

Add a minimal example to aid cargo doc readers.

 /// Command line arguments for the `wireframe` binary.
 #[derive(Debug, Parser)]
 #[command(name = "wireframe", version, about = "Example Wireframe binary")]
 pub struct Cli {
@@
     pub name: Option<String>,
 }
+
+/// # Examples
+/// Run with a name:
+/// ```shell
+/// wireframe --name Sam
+/// ```
🤖 Prompt for AI Agents
In src/cli.rs around lines 8 to 15, add a Rustdoc usage example above the Cli
struct: include a short Examples section with a fenced shell code block showing
the command invocation (e.g., wireframe --name Sam) so cargo doc renders a
minimal usage example; ensure the example is in Rustdoc comment form (///) and
uses a ```sh fenced block.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant