Skip to main content

Auto-repair TypeScript/JS build errors: duplicates, missing exports, spelling typos, unused imports.

Project description

build-fix

Auto-repair TypeScript / JavaScript build errors in one command.

Parses your build log and surgically patches source files. Zero config, zero dependencies.


Quick start

# Clone and install
git clone https://github.com/nometria/build-fix-agents
cd build-fix-agents
pip install -e .

# Scan current directory and apply fixes (verifies with npm run build)
build-fix .

# Provide a captured build log for more accurate fixes
npm run build 2>&1 | tee build.log
build-fix . --log build.log

# Run tests
pytest tests/ -v

What it fixes

Agent Trigger Fix
unused_import Import name never referenced in file Removes entire line or individual names
duplicate_var const X / function X declared twice Renames second occurrence to X_2
missing_export Build log: X is not exported Adds export keyword to the declaration
export_spelling Build log: expected X, found Y Fixes typo using Levenshtein distance ≤ 2

Safety: applies at most 5 edits per file and 10 edits total. Reverts everything if the build still fails after patching.


Install

pip install build-fix

# or run from source:
git clone https://github.com/nometria/build-fix-agents
cd build-fix-agents
pip install -e .

Usage

# Scan current directory, apply fixes, verify with `npm run build`
build-fix .

# Provide a captured build log for more accurate fixes
npm run build 2>&1 | tee build.log
build-fix . --log build.log

# Custom build command
build-fix . --cmd "pnpm build"

# Apply without running build verification
build-fix . --no-verify

# JSON output (for CI integration)
build-fix . --json

Extend with custom agents

from build_fix.agents.base import BaseAgent, AgentEdit, AgentResult
from pathlib import Path

class MyAgent(BaseAgent):
    name = "my_agent"
    description = "Fix something custom"

    def run(self, project_root: Path, context=None) -> AgentResult:
        # Find files, propose edits
        return AgentResult(success=True, edits=[...])

Register in src/agents/__init__.py → get_all_agents().


Immediate next steps (to productionise)

  1. Publish to PyPI: pip install build-fix
  2. Publish to npm as a wrapper: npx build-fix .
  3. Add a VS Code extension that runs on save-with-errors
  4. Add GitHub Action: auto-runs on failed CI builds and opens a PR with fixes

Commercial viability

  • VS Code extension marketplace: $5–9/mo subscription
  • GitHub App: auto-fix PR on CI failure — charge per repo/seat
  • Cursor / Windsurf plugin: native AI-fix integration

Example output

Running pytest tests/ -v:

============================= test session starts ==============================
platform darwin -- Python 3.13.9, pytest-9.0.2, pluggy-1.5.0
cachedir: .pytest_cache
rootdir: /tmp/ownmy-releases/build-fix-agents
configfile: pyproject.toml
plugins: anyio-4.12.1, cov-7.1.0
collecting ... collected 9 items

tests/test_agents.py::test_duplicate_var_detected PASSED                 [ 11%]
tests/test_agents.py::test_duplicate_var_no_false_positive PASSED        [ 22%]
tests/test_agents.py::test_missing_export_adds_keyword PASSED            [ 33%]
tests/test_agents.py::test_missing_export_skips_already_exported PASSED  [ 44%]
tests/test_agents.py::test_export_spelling_fixes_typo PASSED             [ 55%]
tests/test_agents.py::test_levenshtein_threshold PASSED                  [ 66%]
tests/test_agents.py::test_unused_import_whole_line_removed PASSED       [ 77%]
tests/test_agents.py::test_unused_import_partial_removal PASSED          [ 88%]
tests/test_agents.py::test_no_edits_on_clean_file PASSED                 [100%]

============================== 9 passed in 0.04s ===============================

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

build_fix-0.1.2.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

build_fix-0.1.2-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file build_fix-0.1.2.tar.gz.

File metadata

  • Download URL: build_fix-0.1.2.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for build_fix-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a966b2776932a1b1b591b9017a80c068e5b718f41a98de17ee6aedbf82ba4bf4
MD5 176657b5e2da1158ba29a22670390759
BLAKE2b-256 bec49df76b6fcea43dc4bfc1eabd672894d88ad82b1c9c20bdc57e29e45e33b2

See more details on using hashes here.

File details

Details for the file build_fix-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: build_fix-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for build_fix-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 94ee1de6122b619a32fad73986c6ca13320dd6bd09f118e0278e10a3d67d5b87
MD5 9c7431dff0e35f11f1200f2886e79d59
BLAKE2b-256 28543525d53ac6755b1ef623805ff7b4a47f030aa51c2589f60990cc8d945bef

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