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

hashline-opencode-plugin

v0.1.13

Published

Hashline plugin for OpenCode — thin wrapper that shells out to the hashline binary

Downloads

1,958

Readme

hashline-opencode-plugin

Hashline plugin for OpenCode — a thin wrapper that shells out to the hashline binary. It does not reimplement hashing, staleness detection, or merge recovery: the Rust binary (crates/core, >= 0.9.12) is the single source of truth.

The plugin registers six tools covering the full file lifecycle:

| Tool | Purpose | |------|---------| | hashline_read | Read a file rendered as N:hh|content lines (binary-native format). | | hashline_edit | Edit via N:hh anchors; batched ops validated atomically; stale anchors rejected. Supports tree-sitter block ops (replace_block, delete_block, insert_block_after). | | hashline_write | Create a new file or fully replace one (pass force). Response includes fresh anchors. | | hashline_find_block | Show the syntactic block around a line — pair with block ops. | | hashline_remove_file | Delete a file (explicit, auditable). | | hashline_rename_file | Move/rename a file (force overwrites). |

hashline_grep is deferred — search is owned by the sibling ffs repo, not hashline.

Install

Requires the hashline binary on PATH (or HASHLINE_BIN), version >= 0.9.12 (agent-first compact output):

curl -fsSL "https://raw.githubusercontent.com/quangdang46/hashline/main/install.sh" | bash   # macOS / Linux
irm "https://raw.githubusercontent.com/quangdang46/hashline/main/install.ps1" | iex          # Windows
cargo install hashline                                                                       # or via cargo

opencode.jsonOpenCode 2.x uses the plugins array (the plugin auto-registers all six tools and the hashline system prompt); disable the built-in edit so the model is routed through hashline_edit. OpenCode 1.x keeps the singular plugin form:

{
  "plugins": ["hashline-opencode-plugin"],
  "agent": {
    "build": { "tools": { "edit": false } }
  }
}
{
  "plugin": ["hashline-opencode-plugin"],
  "agent": {
    "build": {
      "tools": { "edit": false },
      "prompt": "Always use hashline_read to inspect and hashline_edit to modify files. Anchors are N:hh."
    }
  }
}

Local development:

npm install hashline-opencode-plugin        # then reference ./node_modules/... in config

Binary discovery

Resolution order:

  1. HASHLINE_BIN env var (absolute path) — highest precedence.
  2. hashline / hashline.exe on PATH.

If the binary cannot be spawned, the tools return an install hint (hashline --help / add to PATH / set HASHLINE_BIN). On plugin load the package probes hashline --version and shows a one-line warning in tool output when the binary is missing or older than 0.9.1.

Anchor format

Hashline's format is N:hh|content — N is the 1-based line number, hh is a 2-char hex content hash computed by the binary (xxh32 low byte). Anchors are N:hh. This matches exactly what hashline read prints and what hashline patch parses. The binary hashes all lines with content-derived hashes; blank/symbol-only lines are position-seeded.

CLI wrappers

The package also ships two thin bin wrappers over the same spawn logic:

hread <file> [--offset <n>] [--limit <n>] [--json]   # hashline_read for the shell
hedit <file> --json '<edits>' [--dry-run]            # hashline_edit for the shell

Development

bun install
bun run typecheck     # tsc --noEmit
bun run build:all     # bun build + build:cli + tsc --emitDeclarationOnly
bun test src/tests/   # bun test (spawn-seam + translation + golden fixtures)

The test suite uses an injectable spawn seam and golden fixtures from integration/fixtures/ (captured from the release binary). The e2e test (src/tests/e2e.test.ts) runs against a real hashline when one is reachable and skips otherwise.

Deferred / out of scope

  • hashline_grep — not hashline's job; would spawn ffs and re-hash via hashline read --json. Not implemented in v0.1.0.
  • Structured stale-anchor recovery (remaps map) — the binary does not emit one today; wrappers surface the binary's message verbatim.