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/ownmy-app/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          # PyPI (coming soon)

# or run from source:
git clone https://github.com/ownmy-app/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.0.tar.gz (15.7 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.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for build_fix-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6d3ecd7ccfa174a22da8f2fb2000944f6aa8e5779874bf0f3f0e0307918e21aa
MD5 b701a8ced5caa89d7d064f9b110cbb62
BLAKE2b-256 bf405411151aba29d95d2f555bf5e939b01c3ed4b28decabfff41c6c6ce59fef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: build_fix-0.1.0-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.13.9

File hashes

Hashes for build_fix-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 654b8afa7bdb3425df2f6e65dabc63d041f7992d8a43a9f7011fd6620239c160
MD5 cba5f1538c3a61e3701f7f699289a5ae
BLAKE2b-256 1336e5ee1e46d3b9a5a50df1ce1d58d2a11cf3d9becb91c35473b83337f37d80

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