Overview
Refactron provides a comprehensive CLI for code analysis, refactoring, AI features, and more.Core Commands
analyze
Analyze code for issues.--detailed- Show detailed analysis output--summary- Show summary only--config FILE- Use custom config file
refactor
Preview or apply refactoring suggestions.--preview- Preview changes without applying--type TYPE- Filter by operation type (can use multiple)--risk-level LEVEL- Filter by risk: safe, low, moderate, high--ai- Enable AI-powered refactoring--feedback- Enable interactive feedback
autofix
Apply automated fixes.--preview- Preview auto-fixes--apply- Apply auto-fixes--no-backup- Don’t create backups
report
Generate analysis reports.--format FORMAT- Output format: json, html, text-o FILE- Output file path
AI Commands
suggest
Get AI-powered suggestions for specific lines.--line N- Target specific line number--apply- Apply suggestion immediately
document
Generate AI-powered documentation.--apply- Apply generated docstrings
rag
Manage RAG (Retrieval-Augmented Generation) index.index- Index codebase for RAGsearch- Search indexed codestatus- Show index status
--summarize- Generate AI summaries when indexing--rerank- Use AI reranking for search--update- Incremental index update--force- Force full re-index
Pattern Learning Commands
feedback
Record feedback on refactoring operations.--action ACTION- accepted, rejected, or ignored--reason TEXT- Reason for feedback
patterns
Manage pattern learning system.analyze- Analyze project patternsrecommend- Get tuning recommendationstune- Apply pattern tuningprofile- View current pattern profile
--auto- Auto-apply recommendations (for tune command)
Authentication & Repository
auth
Manage authentication.status- Check authentication statuslogout- Log out from account
repo
Manage repository connections.list- List connected repositoriesconnect- Connect a repositorydisconnect- Disconnect a repository
--path PATH- Repository path (for connect)--delete-files- Delete local files (for disconnect)
Backup & Rollback
rollback
Rollback refactoring changes.--list- List available rollback sessions--session ID- Rollback specific session
CI/CD Integration
ci
Generate CI/CD configuration.github- GitHub Actions workflowgitlab- GitLab CI configurationpre-commit- Pre-commit hooks
Observability
metrics
View usage metrics.--format FORMAT- Output format: json, text
serve-metrics
Start Prometheus metrics server.--port N- Server port (default: 8000)
telemetry
Manage telemetry settings.enable- Enable telemetrydisable- Disable telemetrystatus- Show telemetry status
Configuration
init
Initialize Refactron configuration..refactron.yaml in current directory with default settings.
Global Options
Available for all commands:--help- Show help message--version- Show version--config FILE- Use custom config file--log-level LEVEL- Set log level (DEBUG, INFO, WARNING, ERROR)
Environment Variables
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success, no issues found |
| 1 | Issues found |
| 2 | Error during execution |
