This project is not covered by Drupal’s security advisory policy.

Welcome to AIRefactor — Your Intelligent Code Refactoring Companion!

Transform the way you maintain and enhance your codebase with AIRefactor, the smart assistant that leverages AI to analyze, refactor, and optimize your PHP methods directly within Drupal. No more tedious code reviews or manual optimizations—let AIRefactor handle the heavy lifting and bring your code into the modern age!

Why Choose AIRefactor?

  • AI-Powered Insights – Harness the power of AI to detect code improvements and automatically refactor methods, enhancing readability and performance.
  • Instant Code Analysis – With just a Drush command, analyze and refactor entire files, all while receiving helpful code comparisons and suggested optimizations.
  • Drupal 10 Ready – Built to integrate seamlessly with Drupal 10, AIRefactor updates your code to align with the latest standards and practices.
  • Easy Confirmation Process – Preview refactored code side-by-side with the original, so you stay in control of every change.

🔐 Authentication Requirement

To use AIRefactor, you must provide a valid OpenAI API key. This key should be created at OpenAI's API Key Settings page.

Once you have your key, add it in the following locations within your Drupal admin:

  • System Keys: /admin/config/system/keys – Create a key entry named openai_api_key (or as configured).
  • OpenAI Provider Settings: /admin/config/ai/providers/openai – Select the appropriate key and model settings to enable the integration.

🚀 How It Works 🚀

Using AIRefactor is as easy as a Drush command:

drush ai_refactor:analyze path/to/your/file.php

AIRefactor analyzes each method in the specified file, identifies opportunities for improvement, and presents you with optimized alternatives using OpenAI's capabilities.

Project information

Releases