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

pi-hashline-readmap

v0.14.0

Published

Unified pi extension: hash-anchored read/edit/grep, structural code maps, AST-grep, file exploration (ls/find), and bash output compression

Readme

pi-hashline-readmap

pi-hashline-readmap banner

License: MIT npm

Upgrade Pi's local coding workflow with hash-anchored reads and edits, structural navigation, safer file exploration, and quieter command output.

pi-hashline-readmap replaces Pi's read, edit, grep, write, ls, and find; adds enhanced ast_search; optionally adds nu; and post-processes bash.

Install

pi install npm:pi-hashline-readmap

Requires Pi extension support and Node.js 22.19 or newer. Start a new Pi session after installing; sessions do not hot-reload extensions.

Validated compatibility baseline

Development, schema validation, and extension-load testing use the exact Pi version resolved by package-lock.json, currently Pi 0.84.2, with TypeBox 1.3.7. Pi provides @earendil-works/pi-coding-agent, @earendil-works/pi-tui, and typebox to loaded extensions, so those host-bundled packages intentionally retain "*" peer ranges; the development dependencies and lockfile record the versions validated by this repository.

Run the compatibility coverage through the normal test suite or by itself:

npm test
npm test -- tests/pi-extension-load-compatibility.test.ts
npm run typecheck

The extension and the exact Pi host version resolved by package-lock.json share one Node.js engine baseline, currently Node.js 22.19 or newer. The loader compatibility test verifies that this package's engines.node declaration stays identical to the installed locked Pi host package's declaration.

To advance the compatibility baseline, update the Pi development dependency ranges in package.json and refresh package-lock.json with npm install, reviewing both changes together. Then run the focused compatibility test, the full npm test suite, and npm run typecheck before committing the update. Do not narrow the Pi-hosted wildcard peer ranges to encode the baseline.

# alternatives
pi install git:github.com/coctostan/pi-hashline-readmap

git clone https://github.com/coctostan/pi-hashline-readmap.git
cd pi-hashline-readmap
npm install
pi install .

30-second read/edit

Create a disposable file, read it, and copy the returned LINE:HASH anchor:

write({ path: "hashline-demo.txt", content: "hello, hashline!\n" })
read({ path: "hashline-demo.txt" })
1:f0c|hello, hashline!

Edit against that verified content:

edit({
  path: "hashline-demo.txt",
  edits: [{ set_line: { anchor: "1:f0c", new_text: "hello, anchored edits!" } }]
})

If the file changed between read and edit, the edit reports a mismatch instead of touching the wrong line. Delete hashline-demo.txt when finished.

Why use it?

  • Tie edits to content-derived anchors rather than fragile line numbers.
  • Jump to symbols, request maps, and include direct same-file support.
  • Turn grep and ast_search results into edit-ready anchors.
  • Read supported images through Pi attachments.
  • Create with write; explore with ls, find, or optional Nushell.
  • Compress noisy test, build, Git, Docker, linter, package-manager, and generic command output while retaining recovery paths.
  • Use one coordinated extension instead of stacking overlapping read, grep, edit, and Bash-output packages.

Common workflows

Edit safely

Get fresh anchors from read, grep, ast_search, or write, then use set_line, replace_lines, or insert_after. replace is an exact-text escape hatch. Deletion, overlap rejection, whole-symbol replacement, syntax checks, atomic writes, and structured diffs live in tool behavior and structured output.

Navigate large files

read({ path: "src/hashline.ts", map: true })
read({ path: "src/read.ts", symbol: "registerReadTool", limit: 80 })
read({ path: "tests/fixtures/small.ts", symbol: "createDemoDirectory", map: true })
read({ path: "tests/fixtures/small.ts", symbol: "createDemoDirectory", limit: 2, bundle: "local", map: true })

A symbol can combine with limit, map: true, and bundle: "local". symbol+offset is invalid, and bundle without symbol is invalid. Truncated full-file reads append a map when available. Dedicated mapper/runtime details are in configuration and dependencies.

Search and explore

grep({ pattern: "createDemoDirectory", path: "tests", literal: true })
grep({ pattern: "createDemoDirectory", path: "tests", summary: true })
grep({ pattern: "createDemoDirectory", path: "tests", scope: "symbol", scopeContext: 3 })
ast_search({ pattern: "console.log($$$ARGS)", lang: "typescript", path: "src", limit: 100 })
write({ path: "src/new-module.ts", content: "export const demo = 1;\n" })
ls({ path: "src", glob: "*.ts" })
find({ pattern: "*.test.ts", path: "tests", maxDepth: 2 })
nu({ command: "open package.json | get scripts" })

Normal grep output has anchors; summary mode has counts only. ls lists one directory, find recurses by basename and respects .gitignore, and nu registers only when Nushell is available.

Bash output

PI_RTK_BYPASS=1 skips route compression, but the default-on context guard can still trim oversized output. See Bash compression and recovery for routes, limits, snapshots, bypass behavior, and metadata.

Configuration

Most users need none. Global settings live at ~/.pi/agent/hashline-readmap/settings.json; project settings at .pi/hashline-readmap/settings.json; environment variables win. See configuration and local dependencies.

Structured output and integrations

Results retain readable text and additive details.ptcValue records. See structured output and PTC policy. Executors are announced through EventBus and globalThis; see integration surfaces.

Context hygiene

Hashline tracks file, symbol, and command resources, signals staleness forward-only, and keeps hard anchor checks at edit time. See context-hygiene metadata.

Provider-visible metadata

Compact descriptions, parameter descriptions, snippets, and guidelines are provider-visible; full prompt bodies are detailed references. See the constraint inventory and measured diagnosis.

Documentation

Advanced behavior and integration contracts are documented in the references below.

Development

npm install
npm test
npm run typecheck
npm pack --dry-run

Project layout:

index.ts                  # extension entry point
src/
  read.ts                 # hashlined reads and maps
  edit.ts                 # anchored edits
  grep.ts                 # anchored text search
  sg.ts                   # ast-grep wrapper
  write.ts                # complete writes
  ls.ts / find.ts / nu.ts # file exploration
  readmap/                # structural mapping and symbol lookup
  rtk/                    # Bash output compression
prompts/                  # detailed tool references
docs/                     # advanced user and integration references
tests/                    # Vitest suite

Restart Pi after source changes. See AGENTS.md.

Contributing

PRs are welcome. Update focused tests, prompt references, public docs, and mapper cache versions when contracts change.

Credits

License

MIT. See LICENSE.