Skip to main content

A powerful type-aware linter runner and Codex orchestrator that automatically fixes code issues using AI

Project description

CodexFix 🛠️

License: MIT Python Version Code style: black Mypy: Checked

A powerful type-aware linter runner and Codex orchestrator that automatically fixes code issues using AI. CodexFix combines static analysis with OpenAI's Codex to provide intelligent, automated code improvements while preserving behavior.

⚠️ Warning: This tool was mostly implemented by VibeCoding 😊

Features

  • 🔍 Integrated type checking and linting with mypy, pyright, and ESLint
  • 🎯 Support for Python, TypeScript, and Dart/Flutter analysis
  • 🤖 AI-powered automatic code fixes using OpenAI's Codex
  • ⚡ Fast and efficient analysis with parallel processing
  • 🔄 Iterative improvement with automatic re-analysis
  • 🎨 Beautiful console output with rich formatting
  • 📊 Comprehensive JSON reporting of fixed issues
  • 🔌 Shell completion for Bash, Zsh, and Fish (v0.3.3+)
  • 📦 Global installation support via Pix package manager

Installation

Prerequisites

OpenAI API Key

# You must have a valid OpenAI API key set in your environment
export OPENAI_API_KEY="your-openai-api-key"

# For Windows PowerShell
$env:OPENAI_API_KEY="your-openai-api-key"

# For Windows Command Prompt
set OPENAI_API_KEY=your-openai-api-key

Python Environment

# Install Python 3.13 or later
# macOS
brew install python@3.13

# Linux
sudo apt install python3.13 python3.13-venv python3.13-dev

# Create and activate a virtual environment
python3.13 -m venv venv
source venv/bin/activate

Install UV

# Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh

# Or on macOS with Homebrew
brew install astral/tap/uv

Install Pix

# Install Pix
curl -LsSf https://astral.sh/pix/install.sh | sh

# Or on macOS with Homebrew
brew install astral/tap/pix

UV vs Pix

  • UV: Fast dependency resolver and installer for project-level dependencies in virtual environments. Use UV for development work within specific projects.
  • Pix: Global package manager for Python. Use Pix when you want to install command-line tools globally and make them available from any terminal.

For CodexFix:

  • Use UV when working on CodexFix development or when you want to install it in a project-specific environment
  • Use Pix when you want to use CodexFix as a global command-line tool

Install Required Tools

# Install analysis tools using UV (for project environments)
uv pip install mypy==1.8.0 pyright==1.1.350

# Or install analysis tools globally using Pix
pix install mypy==1.8.0 pyright==1.1.350

# TypeScript analysis tools
npm install -g typescript
npm install -g eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin

# For Dart/Flutter analysis
# Install Flutter SDK from https://docs.flutter.dev/get-started/install

Install CodexFix

Install from PyPI
# Install the package using UV
uv pip install codexfix

# Install globally using Pix
pix install codexfix
Global Usage with Pix

Pix is a new package manager that provides a seamless global installation experience:

# Install CodexFix globally
pix install codexfix

# Run CodexFix from anywhere
codexfix --path /path/to/project

# Update to the latest version
pix update codexfix

# List globally installed packages
pix list

Note: Pix installs packages globally by default, making command-line tools like CodexFix available system-wide without virtual environments.

Install from Source
# Clone the repository
git clone https://github.com/yourusername/codexfix.git
cd codexfix

# Install in development mode using UV
uv pip install -e .
Building and Publishing

If you're a contributor or maintainer who wants to build and publish the package:

# Build the package
uv build

# Publish to PyPI (requires appropriate credentials)
uv publish

# Test installation of the published package
uv run --with codexfix --no-project -- python -c "import codexfix"

Note: For publishing to PyPI, you'll need to set up authentication using token:

# Set the PyPI token
export UV_PUBLISH_TOKEN="your-pypi-token"

Usage

# Run analysis only on current directory (without fixing)
codexfix

# Apply automatic fixes with Codex
codexfix --applyFix

# Run on specific path
codexfix --path /path/to/project

# Generate a comprehensive report
codexfix --applyFix --report issues_report.json

# Run with specific language
codexfix --language python  # or typescript, dart

# Different approval modes
codexfix --approval-mode suggest  # or auto-edit, full-auto

# Install shell completion (bash, zsh, or fish)
codexfix --install-completion bash

Shell Completion

CodexFix v0.3.0+ provides built-in shell completion scripts for Bash, Zsh, and Fish shells to make command-line usage more convenient:

# Install Bash completion
codexfix --install-completion bash

# Install Zsh completion
codexfix --install-completion zsh

# Install Fish completion
codexfix --install-completion fish

After installing shell completion, you can press Tab to complete CodexFix command-line options and arguments:

# Start typing and press Tab to see available options
codexfix --[TAB]

# Tab completion for option values
codexfix --language [TAB]  # Shows python, typescript, dart
codexfix --approval-mode [TAB]  # Shows suggest, auto-edit, full-auto

Configuration

CodexFix supports various configuration options:

  • --path: Path to analyze (default: current directory)
  • --language: Choose between 'python', 'typescript', or 'dart' analysis (default: python)
  • --approval-mode: Control how fixes are applied ('suggest', 'auto-edit', 'full-auto')
  • --max-iterations: Stop after N Codex rounds (default: 3)
  • --model: Specify custom Codex model
  • --verbose: Enable verbose debug output
  • --applyFix: Apply automatic fixes using Codex (default: only show diagnostics)
  • --analyze: Severity levels to analyze ('default' or 'all')
  • --report: Filename to save a comprehensive report of all fixed issues

Requirements

  • Python 3.13+
  • UV package manager (https://astral.sh/uv)
  • Pix package manager (https://astral.sh/pix)
  • OpenAI API key for Codex integration
  • CodexFix 0.3.3+ for shell completion support
  • For Python analysis:
    • mypy (uv pip install mypy)
    • pyright (uv pip install pyright)
  • For TypeScript analysis:
    • TypeScript (npm install -g typescript) - must be installed first
    • ESLint (npm install -g eslint)
    • TypeScript ESLint plugins (npm install -g @typescript-eslint/parser @typescript-eslint/eslint-plugin)
  • For Dart analysis:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

See CHANGELOG.md for a list of changes and version history.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codexfix-0.3.3.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codexfix-0.3.3-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file codexfix-0.3.3.tar.gz.

File metadata

  • Download URL: codexfix-0.3.3.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for codexfix-0.3.3.tar.gz
Algorithm Hash digest
SHA256 06304817396851565efb10639478c18574aa130fbfff56671aacd0af51d7ed8c
MD5 7595ff91b5722da509635b34107b4721
BLAKE2b-256 367101d28732d4612de0f3e8f0c6a7ac9d311ca85331868e346566a5dd4cdd2f

See more details on using hashes here.

File details

Details for the file codexfix-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: codexfix-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for codexfix-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ca3a76fc5f1cf3a879854399c8a6aa4bc1f1175b85389083557394eb6af66902
MD5 5930f83a860a5a46743eb8ebf6b73d58
BLAKE2b-256 1e5a2dc83ba7f44bf640645dcf2c40f30a00a87a8586919887211aeccd523eb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page