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

@termless/peekaboo

v0.3.0

Published

Peekaboo backend for termless — OS-level terminal automation and testing via real terminal apps

Readme

@termless/peekaboo

Peekaboo backend for Termless -- OS-level terminal control via real terminal apps.

What is this?

A Termless backend that combines:

  1. Data layer: xterm.js headless backend for fast, accurate cell/text data
  2. Visual layer: Real terminal app (Ghostty, iTerm2, etc.) for screenshot-based visual verification

This enables tests to verify both programmatic output (via xterm.js) AND real terminal rendering (via screenshots of actual terminal apps).

Usage

import { createPeekabooBackend } from "@termless/peekaboo"
import { createTerminal } from "@termless/core"

// Data-only mode (no terminal app launched)
const backend = createPeekabooBackend()
const term = createTerminal({ backend })
await term.spawn(["bun", "my-tui-app"])
console.log(term.getText()) // from xterm.js

// Visual mode (launches a real terminal app)
const visualBackend = createPeekabooBackend({
  visual: true,
  app: "ghostty",
})
visualBackend.init({ cols: 80, rows: 24 })
await visualBackend.spawnCommand(["bun", "my-tui-app"])
const png = await visualBackend.takeScreenshot()

Supported terminal apps (macOS)

| App | ID | Notes | | ------------ | ---------- | ------------------------------ | | Ghostty | ghostty | Default. Uses --command flag | | iTerm2 | iterm2 | Uses AppleScript | | Terminal.app | terminal | Uses AppleScript | | WezTerm | wezterm | Uses wezterm start | | kitty | kitty | Uses open -a |

Architecture

PTY (Bun.spawn with terminal)
  |
  +--> xterm.js backend (headless) --> getText(), getCell(), getCursor(), ...
  |
  +--> Real terminal app (optional) --> takeScreenshot() --> PNG buffer

Known limitation: dual-process divergence

In visual mode, spawnCommand() starts two independent processes running the same command:

  1. A real terminal app process (for takeScreenshot())
  2. A separate PTY feeding xterm.js (for getText(), getCell(), etc.)

Because these are independent OS processes, their output can diverge at any time due to timing, randomness, or interleaving differences. This means:

  • getText() content may not match what appears in the screenshot
  • Use either data methods or screenshots for assertions, not both together
  • Visual mode is best for human-in-the-loop verification, not automated cross-referencing
  • Data-only mode (visual: false) uses a single PTY and is fully consistent

Requirements

  • macOS (uses screencapture and AppleScript for window management)
  • Bun runtime (for PTY support)
  • A terminal app installed (if using visual mode)