Skip to content

feat: add --preview flag to preview aviator remediations before applying - #1076

Draft
dhanwanthp wants to merge 1 commit into
feat/v3.x/aviator/26.4from
dhanwanthp/feat/auto_remediations_preview
Draft

feat: add --preview flag to preview aviator remediations before applying#1076
dhanwanthp wants to merge 1 commit into
feat/v3.x/aviator/26.4from
dhanwanthp/feat/auto_remediations_preview

Conversation

@dhanwanthp

Copy link
Copy Markdown

This MR adds a new --preview flag to the fcli aviator ssc apply-remediations and fcli fod aviator apply-remediations commands, enabling users to preview what changes would be applied to their source code without actually modifying files.

Features:

  • Added --preview option to both SSC and FoD apply-remediations commands
  • When enabled, the tool performs full validation and processing without modifying source files
  • Returns detailed JSON output containing:
    • All proposed code changes per issue ID
    • File paths and encodings
    • Line numbers and code snippets (before/after)
    • Context metadata for fuzzy matching
    • Skip reasons for any failed remediations

Usage:

# Preview changes without applying them
fcli aviator ssc apply-remediations --appversion myapp --preview

# Preview specific issues only
fcli aviator ssc apply-remediations --appversion myapp --preview --issue-ids ISSUE-123,ISSUE-456

# Apply changes (existing behavior, no --preview flag)
fcli aviator ssc apply-remediations --appversion myapp

Output format:-

{
  "previewMode": true,
  "totalRemediation": 10,
  "appliedRemediation": 8,
  "previewDetails": [
    {
      "issueId": "ISSUE-123",
      "status": "available",
      "files": {
        "src/Example.java": {
          "filename": "src/Example.java",
          "path": "src/Example.java",
          "encoding": "UTF-8",
          "changes": [
            {
              "changeIndex": 1,
              "lineFrom": 42,
              "lineTo": 44,
              "originalCode": "...",
              "newCode": "...",
              "context": { "linesBefore": 2, "linesAfter": 2, "content": "..." },
              "fuzzyMatched": false
            }
          ]
        }
      }
    }
  ]
}

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