omp packages

pi-legible0.1.3

Makes code in pi legible: shell one step per line, code blocks and codemode scripts formatted, and asks the model to write it that way.

acoyfellow Published 10 days ago MIT ~659 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-legible

Your coding agent shows you what it is about to run. You should be able to read it.

Two pi sessions running the same task side by side, without and with pi-legible

WithoutWith
Without pi-legible: one long shell line, cramped Python and SQL With pi-legible: one shell step per line, formatted Python and SQL

This pi extension makes the code in your transcript legible:

  1. Shell calls show one step per line.
  2. Code blocks in replies and thinking traces are run through a real formatter.
  3. codemode scripts are formatted as JavaScript.
  4. The model is asked to write legible code in the first place.

Only the display changes. What runs is exactly what the model wrote.

Install

pi install git:github.com/acoyfellow/pi-legible

Then /reload or start a new session.

Languages

Fence tag Formatter
sh, bash, zsh, shell built-in splitter: top-level ; && || |
ts, js, tsx, jsx Biome
py, python Ruff
go gofmt
sql sqlformat
yaml, yml yamlfmt
json JSON.stringify

The formatters are WebAssembly builds from wasm-fmt, about 4 MB in total. No binaries, no network.

Safety

  • If a formatter fails, or its output does not keep the same tokens, the code is shown exactly as written.
  • Inputs over 20 KB are not formatted.
  • Streaming messages are formatted only when they finish.
  • The shell splitter never splits inside quotes, $( ), ( ), { } or heredoc bodies.

The writing rule

It appends a short rule to the system prompt: one shell step per line, a script file for more than three steps or any loop, no long inline Python or jq, name long paths once, tag code blocks with their language.

What it does not do

  • It does not change what runs.
  • It does not format untagged code blocks or languages not in the table.
  • It does not format inline code spans.

Related

pi-code-previews adds syntax highlighting to all built-in tools but keeps commands on one line. Both register tool renderers; the one loaded later draws bash calls.

Develop

npm install
bun test

Screenshots

The README images are real pi sessions in cmux, rebuilt with:

sh demo/shoot.sh before <window> <workspace>
sh demo/shoot.sh after <window> <workspace>

MIT