Skip to main content

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.

Metadata

Release files for codexfix 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codexfix 0.3.3
File Size Uploaded Provenance
codexfix-0.3.3.tar.gz 16.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for codexfix 0.3.3
File Interpreter ABI Platform
codexfix-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 33.7 kB

Release files / codexfix-0.3.3.tar.gz

Download URL codexfix-0.3.3.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
06304817396851565efb10639478c18574aa130fbfff56671aacd0af51d7ed8c
BLAKE2b-256 checksum
How to use checksums
367101d28732d4612de0f3e8f0c6a7ac9d311ca85331868e346566a5dd4cdd2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Release files / codexfix-0.3.3-py3-none-any.whl

Download URL codexfix-0.3.3-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca3a76fc5f1cf3a879854399c8a6aa4bc1f1175b85389083557394eb6af66902
BLAKE2b-256 checksum
How to use checksums
1e5a2dc83ba7f44bf640645dcf2c40f30a00a87a8586919887211aeccd523eb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Security for codexfix 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page