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

@ghostty-webgpu/line-editor

v0.0.4

Published

Readline-style editing for ghostty-webgpu local shells

Readme

ghostty-webgpu-line-editor

Readline-style editing for local shells hosted by ghostty-webgpu. Working package name and current version 0.0.3.

The package provides a browser-independent model, keymap, history, read lifecycle and a readline() terminal extension. The extension owns input while a read is active, renders the prompt through the terminal API, and exposes print() for output that arrives during editing.

The terminal peer dependency is optional for users of the standalone editing model and history. The readline() extension attaches to a ghostty-webgpu terminal supplied by the host.

Editing model

EditModel edits grapheme boundaries and exposes a snapshot containing text, a UTF16 cursor offset, revision and reverse-search state. keyCommand() maps keyboard keys and modifiers to typed editing commands. Displayed cell widths and wrapping belong to the terminal's native API; this model computes neither.

ReadSession accepts SessionOptions and an event callback. read({ prompt, secondaryPrompt, signal }) allows one active read. dispatch() processes editing commands and resolves a typed result on submission, interruption or end-of-input. Abort and disposal reject with structured errors. Completion and completeness callbacks receive an abort signal; their stale results are discarded after edits, later requests and read cancellation.

import { ReadSession } from '@ghostty-webgpu/line-editor'

const session = new ReadSession({
  complete: (text, cursor, signal) => host.complete(text, cursor, signal),
  isComplete: (text) => host.isComplete(text),
})
const pending = session.read({ prompt: '$ ', signal })
await session.dispatch({ kind: 'insert', text: 'echo hello' })
await session.dispatch({ kind: 'submit' })
const result = await pending

To attach the editor to a ghostty-webgpu terminal, load the extension and start a read when the terminal is open:

import { Terminal } from 'ghostty-webgpu'
import { readline } from '@ghostty-webgpu/line-editor'

const terminal = await Terminal.create()
await terminal.open(container)
const editor = terminal.use(readline({ complete: completeCommand }))
const result = await editor.api.read({ prompt: '$ ' })

Call editor.api.print(text) for shell output while the prompt is active. The extension clears and restores the prompt so output does not corrupt the line being edited.

Completion candidates are replacements for the whitespace-delimited token before the cursor. A common grapheme prefix extends that token. A second Tab at the same revision emits the candidate list. Hosts that need shell-aware quoting can implement candidate formatting in their callback.

History keeps the most recent 100 entries by default. Sessions may share entries and persistence; each EditModel owns its navigation snapshot, saved draft and reverse-search position. Navigation restores the draft after the newest entry, and Down before browsing preserves the current draft. A host can provide a HistoryStore with load() and save(entries), call history.load() before reading, and use history.flush() to await saves. Snapshots passed to the store are frozen, bounded arrays. The package chooses no browser storage key.

Verification

Build the terminal from the family root with bun run build, then run bun run verify from this directory. Tests run in Node through Vitest. From the repository root, the package is included in build:workspaces, workspace lint/typecheck/test commands and the Ghostty CI job.