Package Exports
- @technicalshree/auto-fix
- @technicalshree/auto-fix/dist/cli.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@technicalshree/auto-fix) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme


# auto-fix
auto-fix is a TypeScript CLI that detects local development environment issues and applies safe, explainable fixes for Node, Python, and Docker-based projects.
What it does
- Detects project stack (Node, Python, Docker Compose)
- Diagnoses common local setup problems
- Builds an explicit fix plan before execution
- Runs safe fixes by default
- Supports gated destructive cleanup (
--deep,--approve) - Writes run reports and snapshot metadata for rollback
- Supports best-effort
undofor snapshotted changes
Requirements
- Node.js 18+
- npm (or compatible Node package manager for development)
- Optional tools (used only when relevant to your project):
- Python +
pip/uv/poetry/pipenv - Docker + Docker Compose
- Python +
Installation
1) Install from npm (recommended)
Run directly without installing globally:
npx auto-fix doctorInstall globally:
npm install -g @technicalshree/auto-fix
auto-fix --help2) Install from source (development)
Clone and install dependencies:
git clone <your-repo-url>
cd ts-cli-tool
npm installBuild the CLI:
npm run buildRun locally:
npm startUse as a CLI command (auto-fix)
After build, the executable is exposed via:
- Bin name:
auto-fix - Entry point:
dist/cli.js
You can run it in either of these ways:
npm start -- doctornode dist/cli.js doctorTo install globally from this repo:
npm run build
npm linkThen use:
auto-fixTo remove global link:
npm unlink -g auto-fixPublish to npm
- Ensure you are logged in to npm:
npm login- Bump the version:
npm version patch- Build and validate the package contents:
npm run build
npm pack --dry-run --cache /tmp/npm-cache-autofix- Publish:
npm publishQuick start
Run safe fixes (default behavior):
auto-fixDiagnosis only (no changes):
auto-fix doctorPreview plan without executing:
auto-fix planShow latest report as JSON:
auto-fix report --jsonRollback latest run (best-effort):
auto-fix undoClear global package manager caches:
auto-fix clear-npm-cache
auto-fix clear-yarn-cache
auto-fix clear-pnpm-cacheCommands
auto-fix [command] [flags]
- Default command (
auto-fix): detect + execute safe fixes doctor: detection and diagnosis only (no modifications)plan: prints execution plan (same as dry-run)report: reads latest report (--runruns fresh first)undo: best-effort restore using latest run snapshotsclear-npm-cache: runsnpm cache clean --forceclear-yarn-cache: runsyarn cache cleanclear-pnpm-cache: runspnpm store prunehelp: show CLI help
Flags (all)
Safety and execution control
--dry-run: show actions, do not execute--deep: enable destructive cleanup steps (for example deletingnode_modules)--approve: skip interactive prompts and allow destructive steps--force-fresh: allow fresh rebuild actions (requires--deepor--approve)--focus <subsystem>: restrict execution to one subsystem- Allowed values:
node,python,docker,all
- Allowed values:
--checks <list>: checks phase selector- Comma-separated values from:
lint,test,format - Example:
--checks lint,test
- Comma-separated values from:
--kill-ports [ports]: enable port cleanup- Optional comma-separated ports
- If omitted, defaults are used from config
Output and reporting
--verbose: print commands and command outputs--quiet: minimal output, still prints final summary--no-color: disable ANSI colors--json: print machine-readable JSON report to stdout--report-path <path>: override report directory path--run: withreport, run a fresh execution instead of reading latest
Typical usage patterns
Safe default run:
auto-fixPlan before execution:
auto-fix planDeep cleanup with explicit approval:
auto-fix --deep --approveOnly Node subsystem:
auto-fix --focus nodeRun only lint + test checks:
auto-fix --checks lint,testKill default configured ports then execute:
auto-fix --kill-portsKill specific ports:
auto-fix --kill-ports 3000,5173,9229Read latest report:
auto-fix report --jsonTrigger run and emit JSON in one command:
auto-fix report --run --jsonClear npm global cache:
auto-fix clear-npm-cacheClear yarn global cache:
auto-fix clear-yarn-cacheClear pnpm global cache:
auto-fix clear-pnpm-cacheConfiguration
auto-fix works without config. To customize behavior, create .autofix.yml in project root.
The loader searches current directory upward until git root.
Example .autofix.yml
version: 1
ports:
default: [3000, 5173, 8000, 8080]
extra: [9229]
node:
package_manager: auto # auto | npm | pnpm | yarn
deep_cleanup:
remove_node_modules: true
remove_lockfile: false
caches:
next: true
vite: true
directories: [".turbo", ".cache"]
python:
venv_path: .venv
install:
prefer: uv # uv | pip | poetry | pipenv | auto
tools:
format: ["ruff format", "black ."]
lint: ["ruff check ."]
test: ["pytest -q"]
docker:
compose_file: auto
safe_down: true
rebuild: true
prune: false
checks:
default: [lint, format, test]
output:
report_dir: .autofix/reports
snapshot_dir: .autofix/snapshots
verbosity: normal # quiet | normal | verboseReports and artifacts
By default:
- Reports:
.autofix/reports/ - Latest report:
.autofix/reports/latest.json - Snapshots:
.autofix/snapshots/
auto-fix also ensures .autofix/ is in .gitignore.
If the configured snapshot directory is not writable, snapshots fall back to a temp directory:
- macOS/Linux pattern:
/tmp/autofix/<run_id>
Undo behavior (important)
auto-fix undo is best-effort and limited to steps that:
- Are marked undoable
- Have snapshot paths recorded in the report
- Still have snapshot files available
Undo cannot restore changes that were never snapshotted or are irreversible by nature.
Exit codes
0: successful run or expected non-error output1: runtime error, missing latest report forreport/undo, ordoctorfound issues
Development
Scripts
npm run dev: run CLI from source withtsx(src/cli.ts)npm run build: compile TypeScript todist/npm start: run built CLI (dist/cli.js)npm test: build silently and run Node test runnernpm run lint: TypeScript type-check only (tsc --noEmit)
Local development workflow
npm install
npm run lint
npm test
npm run dev -- doctor
npm run buildProject structure
src/cli.ts: CLI entrypoint and argument parsingsrc/core/: detection, planning, execution, safety, undosrc/config/: defaults and config loadingsrc/report/: summary and report writingsrc/subsystems/: subsystem-specific checks/fixessrc/ui/: terminal renderer and progress hooksdist/: compiled JavaScript outputdocs/: product requirement docs and notes
Troubleshooting
auto-fix command not found:
- Run
npm run buildfirst - Use
node dist/cli.js ...directly - If using global link, run
npm linkin project root
No report found for report or undo:
- Run
auto-fixonce first - Check custom
--report-pathusage - Verify
.autofix/reports/latest.jsonexists
Non-interactive environments behave conservatively:
- In polyglot projects (Node + Python + Docker), non-interactive mode without
--approvemay limit execution to a safe subset
License
ISC