Skip to content

feat(review): add --copy flag for AI-agent-friendly output#37

Merged
Meru143 merged 3 commits intomainfrom
issue/34-copy-issues
Feb 24, 2026
Merged

feat(review): add --copy flag for AI-agent-friendly output#37
Meru143 merged 3 commits intomainfrom
issue/34-copy-issues

Conversation

@Meru143
Copy link
Copy Markdown
Owner

@Meru143 Meru143 commented Feb 24, 2026

Summary

Adds a flag to that outputs issues in a format easy to copy and paste back to AI agents for fixing.

Output format

Issues to fix:

1. [WARNING] src/main.rs:42
   Don\'t use unwrap() in production
   Fix: Use ? or match instead

2. [BUG] src/lib.rs:10
   Missing null check
   Fix: Add if let Some(x) = ... before accessing

Usage

git diff | argus review --repo . --copy

Closes #34

Summary by CodeRabbit

  • New Features

    • Added a CLI flag to produce a copy-ready, structured export of review issues (includes severity, file/line, message, optional suggestions and diffs) for easy integration with external agents.
  • Chores

    • Removed the automated PR code-review workflow that previously ran reviews on pull requests.

Outputs issues in a format easy to copy and paste back to AI agents
for fixing. Includes severity, file:line, message, suggestion, and patch.
Copilot AI review requested due to automatic review settings February 24, 2026 07:00
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 24, 2026

Warning

Rate limit exceeded

@Meru143 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between eb90f37 and a5a938b.

📒 Files selected for processing (1)
  • src/main.rs
📝 Walkthrough

Walkthrough

Adds a --copy flag to the Review CLI command and a helper to serialize ReviewComment items into an AI-agent-friendly, copy-ready string; also removes the GitHub Actions workflow .github/workflows/argus-review.yml.

Changes

Cohort / File(s) Summary
CLI: Review command
src/main.rs
Added copy: bool to Command::Review, imported ReviewComment, added format_issues_for_copy(&[ReviewComment]) -> String, and wired --copy handling to print copy-ready issue output before normal formatting.
CI workflow removed
.github/workflows/argus-review.yml
Deleted CI workflow that ran Argus reviews on PRs (checkout, Rust setup, build, generate .argus.toml, run review with Gemini and post-comments). Reviewers should verify intended CI behavior remains covered elsewhere.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I nibbled through lines, found each little gripe,
I packed them in order, neat as a type,
Copy-ready bundle, for bots to befriend,
Paste, fix, and repeat — hop, repair, and mend! 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes an out-of-scope deletion of the .github/workflows/argus-review.yml file that is unrelated to adding the --copy flag feature. Remove the .github/workflows/argus-review.yml deletion from this PR and address it in a separate PR focused on workflow changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and concisely describes the main change: adding a --copy flag to the review command for AI-agent-friendly output formatting.
Linked Issues check ✅ Passed The changes implement the core requirement from #34: a --copy flag that outputs issues in a structured format ready for AI agents to consume.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue/34-copy-issues

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main.rs`:
- Around line 207-209: The help text for the CLI flag `copy` (the struct field
`copy` annotated with #[arg(long)]) is misleading because it says “Copy issues
to clipboard” while the implementation prints to stdout; update the doc/help
string for that flag to accurately reflect behavior—e.g., change the field's doc
comment or the #[arg(help = "...")] text to something like “Output issues in
AI-agent-friendly format (for copy/paste)” so the flag description matches the
actual stdout output.
- Around line 354-393: The formatted output in format_issues_for_copy breaks
numbered list indentation when ReviewComment.message or .suggestion contain
newlines; update format_issues_for_copy to normalize multi-line fields by
splitting message and suggestion on '\n' and writing each line prefixed with the
same indentation used for the list entry (e.g., "   ") so the numbered item
remains visually nested, and apply the same per-line prefix when iterating
patch.lines() for consistency.
- Around line 1298-1302: The current early return when the copy flag is set
causes side-effects (apply_patches, post_comments, state saving used by `argus
feedback`, and `--fail-on` CI exit behavior) to be skipped; instead of returning
in the `if copy { ... }` block, call `print!("{}",
format_issues_for_copy(&result.comments));` but allow execution to continue so
later code that handles `apply_patches`, `post_comments`, state persistence, and
`--fail-on` runs normally; locate the block around the `copy` flag check in
main.rs (references: `copy`, `format_issues_for_copy`, `result.comments`) and
remove the `return Ok(())` (or replace it with a no-op) so output is emitted but
the rest of the function proceeds unchanged.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b65424 and 7905896.

📒 Files selected for processing (1)
  • src/main.rs

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a --copy flag to the argus review command that outputs review findings in a simplified, AI-agent-friendly format for easy copy-pasting back to AI assistants for automated fixes. This addresses issue #34 which requested a one-click way to copy flagged issues.

Changes:

  • Added a new --copy boolean flag to the Review command
  • Implemented format_issues_for_copy function that formats ReviewComments with numbered issues, severity labels, file locations, and optional suggestions/patches
  • Added early-return logic in the review command handler to output the copy-friendly format and exit before other output formats are processed
Comments suppressed due to low confidence (1)

src/main.rs:1302

  • The verbose output (lines 1262-1296) is printed to stderr before the copy flag check. This means when --verbose and --copy are used together, the verbose stats will be mixed with the AI-agent-friendly output on stderr/stdout. Consider either skipping the verbose output when --copy is enabled, or clarifying in documentation that --verbose should not be used with --copy for clean output.
            if copy {
                print!("{}", format_issues_for_copy(&result.comments));
                return Ok(());
            }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

src/main.rs Outdated
/// Base commit SHA for incremental review (overrides saved state)
#[arg(long)]
base_sha: Option<String>,
/// Copy issues to clipboard in AI-agent-friendly format
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

The flag description says "Copy issues to clipboard" but the implementation only prints to stdout, it doesn't actually copy to clipboard. Consider either renaming the flag to better reflect what it does (e.g., '--ai-format' or '--copy-format') or updating the description to say something like "Output issues in AI-agent-friendly format for easy copying".

Suggested change
/// Copy issues to clipboard in AI-agent-friendly format
/// Output issues in AI-agent-friendly format for easy copying

Copilot uses AI. Check for mistakes.
src/main.rs Outdated
// Handle --copy flag: output issues in AI-agent-friendly format
if copy {
print!("{}", format_issues_for_copy(&result.comments));
return Ok(());
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

The early return when the copy flag is enabled bypasses important functionality like applying patches (--apply-patches), posting comments to GitHub (--post-comments), saving review state for incremental reviews, and handling the fail-on exit code. This means users cannot combine --copy with these other flags, which may be unexpected behavior. Consider documenting this limitation in the flag description or restructuring the code to allow combining flags.

Suggested change
return Ok(());

Copilot uses AI. Check for mistakes.
Comment on lines +354 to +393
fn format_issues_for_copy(comments: &[ReviewComment]) -> String {
if comments.is_empty() {
return "No issues found.".to_string();
}

let mut output = String::new();
output.push_str("Issues to fix:\n\n");

for (i, c) in comments.iter().enumerate() {
let severity = match c.severity {
Severity::Bug => "BUG",
Severity::Warning => "WARNING",
Severity::Suggestion => "SUGGESTION",
Severity::Info => "INFO",
};

output.push_str(&format!(
"{}. [{}] {}:{}\n",
i + 1,
severity,
c.file_path.display(),
c.line
));
output.push_str(&format!(" {}\n", c.message));

if let Some(suggestion) = &c.suggestion {
output.push_str(&format!(" Fix: {}\n", suggestion));
}
if let Some(patch) = &c.patch {
output.push_str(" ```diff\n");
for line in patch.lines() {
output.push_str(&format!(" {}\n", line));
}
output.push_str(" ```\n");
}
output.push('\n');
}

output
}
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

The format_issues_for_copy function lacks unit tests, which is inconsistent with the codebase pattern where similar formatting functions have comprehensive tests. Consider adding tests to verify the function works correctly with empty comments, single comment, multiple comments with and without suggestions/patches, and different severity levels.

Copilot uses AI. Check for mistakes.
- Update --copy help text to say 'output' instead of 'clipboard'
- Handle multi-line message/suggestion/patch with proper indentation
- Remove early return so apply_patches, post_comments, state saving, and --fail-on still run
@Meru143 Meru143 merged commit 086e970 into main Feb 24, 2026
2 checks passed
@Meru143 Meru143 deleted the issue/34-copy-issues branch February 24, 2026 07:22
@Meru143 Meru143 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.

feat: Add copy issues button

2 participants