Search documentation of Ragex

# Ragex.Analysis.Suggestions.Actions (Ragex v0.4.0)

View Source

Generates actionable refactoring plans for suggestions.

Creates step-by-step instructions for executing refactoring operations using existing MCP tools and validated workflows.

Each action plan includes:

- Ordered list of steps with tool invocations
- Validation checks (syntax, tests)
- Rollback procedures
- Estimated time per step

## Usage

    alias Ragex.Analysis.Suggestions.Actions

    {:ok, plan} = Actions.generate_action_plan(suggestion)

    # Plan structure:
    # %{
    #   suggestion_id: "...",
    #   steps: [
    #     %{order: 1, action: "...", tool: "...", params: %{...}},
    #     ...
    #   ],
    #   validation: [...],
    #   rollback: [...]
    # }

## Summary

### Functions

estimate_effort_level(plan)

Estimates the effort level for executing an action plan.

format_plan(plan)

Formats an action plan for display.

generate_action_plan(suggestion)

Generates an action plan for a suggestion.

## Functions

# estimate_effort_level(plan)

Estimates the effort level for executing an action plan.

Returns one of: :trivial, :easy, :moderate, :significant, :major

# format_plan(plan)

Formats an action plan for display.

Returns a human-readable string representation of the plan.

# generate_action_plan(suggestion)

Generates an action plan for a suggestion.

## Parameters

- `suggestion` - Scored suggestion with pattern, target, and metrics

## Returns

- `{:ok, action_plan}` - Executable action plan
- `{:error, reason}` - Error if plan generation fails