npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tduyng/pi-edit-path

v0.0.5

Published

Fuse the validation command into the edit that needs it, and name the region on disk a failed edit meant.

Readme

@tduyng/pi-edit-path

Two round trips on the edit path are avoidable. One follows a failed edit, the other follows a successful one.

After a failed edit

When pi's own edit cannot find the old text, or finds it more than once, it reports the miss and nothing else. The retry usually starts with a re-read, and often misses again because the old text was written from memory.

The hint appends the closest region as it reads on disk now, with line numbers and current text, so the retry copies real lines.

Matching is by line agreement, not character similarity. Every distinctive line of the old text is looked up in the file the way pi's own matcher would read it, counting only lines of four characters or more, so a lone } never votes. The window of the old text's height holding the most of them wins. Under half agreeing means no region is shown, because a weak guess invites an edit against the wrong lines.

Line agreement hides the commonest cause. On one miss every distinctive line of a doc comment was present, because the model had re-wrapped the paragraph and written one word from memory. A line search cannot see a re-wrap, so the hint also names the lines that are not on disk at all.

The hint reports and never repairs. A miss that survives pi's fuzzy matching is a real mismatch, and applying a guess would write code nobody asked for.

Fusing the check

The other round trip is the one after the write. Edit a file, call bash to run the test, and that is a whole provider request to learn something the edit already implied.

then_run is an optional parameter on edit and write. It runs after the mutation succeeds.

edit(path: "src/retry.ts", edits: [...], then_run: {command: "bun test src/retry", timeout: 120})

The first write or edit in a session that carries more than 2,000 characters of content gets a note on its result, once, and never again in that session: the same bytes built inside a codemode script cost a few hundred characters of arguments and stay out of the transcript after that. Content the model generates character by character is the largest single line in a long session's context, 119,000 tokens of it in the longest one recorded. A call a codemode script makes gets no note, since the script built the content and the model did not pay for it.

then_run takes {command, timeout} in seconds, or the command as a plain string. On success then_run appends the output after [then_run:succeeded]. On failure it reports the mutation output first, then [then_run:failed] and the error, inside one thrown error, so the edit result is never lost.

When the check follows from the file the edit just changed, pass then_run. Use a separate bash call when the check spans files not yet written, or when the edit result has to be read before deciding what to run.

then_run is a parameter rather than a tool because the built-in definition is spread into the extension's own. Every property pi had stays, and one optional field is added. A second tool would need its own schema, its own permission story, and a model deciding between two ways to change a file.

Cost and switches

The hint adds no tool, no schema and no prompt text. It reads one file pi already named in its own error.

edit gains four guideline bullets and write gains two. Those six bullets are the whole prompt cost of the fusion.

| Variable | Default | Effect | | --- | --- | --- | | PI_HINT_EDIT_HINT | 1 | 0, false, no or off disables the hint | | PI_ACTION_FUSION | 1 | 0 disables the then_run parameter |

then_run runs through the bash tool, so that tool has to be active.

Install

pi install npm:@tduyng/pi-edit-path

Local checkout: pi install /path/to/dotfiles/pi/agent/extensions/pi-edit-path

Limits

  • then_run output keeps the last 12,000 characters, and the result says it was cut.
  • The hint refuses files over 2 MB, lists at most 80 region lines and 10 match lines.
  • The hint reads the file as it is now, which is not always what it was when the edit failed.