One-Click Apply Fixes

Apply AI-suggested code improvements directly to your pull requests with a single click.

Overview

When Jasper identifies issues or improvements in your code, it provides actionable suggestions. With One-Click Apply, you can instantly commit these fixes to your branch without leaving the review interface or manually copying code.

How It Works

  1. Jasper reviews your PR and posts inline suggestions
  2. Click "Apply Fix" next to any suggestion
  3. A commit is created on your branch with the fix
  4. The PR is automatically updated

Using Apply Fixes in the Dashboard

When viewing a review in the Jasper dashboard, you'll see an "Apply Fix" button next to any suggestion that contains a code fix:

Consider using const instead of let since this variable is never reassigned.

- let userName = 'John';
+ const userName = 'John';

Using @jasper apply Command

You can also apply fixes directly from GitHub using the @jasper apply command in PR comments:

@jasper apply

Apply all pending suggestions from the most recent review.

@jasper apply 1

Apply a specific suggestion by its number.

@jasper apply all

Apply all applicable suggestions at once.

GitHub Native Suggestions

Jasper formats code suggestions using GitHub's native suggestion syntax, which means you can also apply fixes directly in GitHub's interface using the "Commit suggestion" button:

GitHub Suggestion Format:

```suggestion
const userName = 'John';
```

This means you have three ways to apply fixes:

  1. Jasper Dashboard - Click "Apply Fix" buttons
  2. GitHub Comments - Use @jasper apply commands
  3. GitHub UI - Use the native "Commit suggestion" button

Deep Links

Review comments include a "View in Jasper" link that takes you directly to the fix in the dashboard. These links are signed and valid for 7 days.

Direct Apply Links

Click "View in Jasper" links in GitHub comments to jump straight to the apply interface with the context pre-loaded.

CLI Auto-Fix

The Jasper CLI also supports applying fixes locally before you commit:

# Review and apply fixes interactively
jasper review --fix

# Apply all fixes without prompting
jasper review --fix --force

See CLI Tool documentation for more details.

How Fixes Are Applied

When you apply a fix, Jasper:

  1. Creates a new commit on the PR branch using the GitHub Git Data API
  2. The commit message references the suggestion being applied
  3. The PR is automatically updated with the new commit
  4. CI/CD pipelines are triggered as normal

Fix Status

Each fix goes through the following statuses:

Status Description
pending Fix is queued for processing
processing Fix is being applied
applied Fix was successfully committed
failed Fix could not be applied (see error message)
conflict The file has changed since the review

Handling Conflicts

If the file has been modified since the review was created, the fix may fail with a conflict status. In this case, you'll need to:

  1. Request a new review with @jasper review
  2. Apply the fix from the fresh review

Best Practice

Apply fixes soon after receiving a review to avoid conflicts from other changes to the branch.

Audit Trail

All applied fixes are logged in your organization's Audit Logs, including:

  • Who applied the fix
  • Which review it came from
  • The file and changes made
  • Timestamp of application