pi-mono-auto-fix
Pi extension that runs language-appropriate fixers (eslint, black, prettier, ...) on files touched during a turn
Package details
Install pi-mono-auto-fix from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-mono-auto-fix- Package
pi-mono-auto-fix- Version
0.3.0- Published
- Apr 29, 2026
- Downloads
- 241/mo · 241/wk
- Author
- emanuelcasco
- License
- unknown
- Types
- extension
- Size
- 22.8 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-mono-auto-fix
End-of-turn formatter/linter dispatcher for pi. Collects every file written during a turn and applies language-appropriate fixers (eslint, black, prettier, …) in one batch once the agent stops talking.
What it does
- Subscribes to
tool_resultfor the built-ineditandwritetools, plus thecontext-guard:file-modifiedevent thatmulti-editand other writers emit. - Buffers absolute paths of touched files in a per-turn
Set. - On
agent_end, groups paths by matching fixer, runs each fixer once per group (parallel up toconcurrency). - After each run, re-emits
context-guard:file-modifiedfor any file whose mtime actually changed, so downstream read caches evict. - Emits a single notification at the end (
auto-fix: N/M files updated).
Fixers are invoked silently — stdout/stderr are swallowed. Failures are reported in the summary notification but never surfaced into the LLM context.
Built-in fixer rules
| Extensions | Command |
|---|---|
.ts .tsx .js .jsx .mjs .cjs |
npx --no-install eslint --fix --no-error-on-unmatched-pattern {files} |
.py |
black -q {files} |
.json .md .yml .yaml .css .scss .html |
npx --no-install prettier --write --log-level=warn {files} |
{files} is replaced with shell-quoted, space-separated absolute paths. If the token is missing, files are appended to the end of the command.
Commands run with shell: true, cwd = ctx.cwd, and a per-invocation timeout (default 60s).
Configuration
Resolution order (first hit wins):
PI_AUTO_FIX=0→ extension is fully disabled (no listeners registered)~/.pi/agent/auto-fix.json- built-in defaults
Example ~/.pi/agent/auto-fix.json:
{
"enabled": true,
"timeoutMs": 90000,
"concurrency": 2,
"ignore": ["node_modules/", "dist/", ".git/", "vendor/"],
"fixers": [
{
"label": "biome",
"extensions": [".ts", ".tsx", ".js", ".jsx"],
"command": "npx --no-install biome check --write --no-errors-on-unmatched {files}"
},
{
"label": "ruff",
"extensions": [".py"],
"command": "ruff check --fix {files} && ruff format {files}"
}
]
}
All fields are optional; anything omitted falls back to the built-in default.
Install
pi install npm:pi-mono-auto-fix
Or load directly for testing:
pi -e /path/to/pi-extensions/extensions/auto-fix/index.ts
Notes
- Paths outside
ctx.cwdare skipped for safety. - Paths matching any substring in
ignoreare skipped. - Files deleted during the turn are skipped (existence is re-checked at flush time).
- The mtime diff catches fixers that are no-ops on already-clean files, so the summary reflects real changes rather than just invocations.