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

@aryrabelo/planqueue-core

v0.3.0

Published

Pure logic for PlanQueue — AI agent session notes with a markdown prompt queue. Designed for Bun, bundler-compatible with Node.js. Path scheme, persistence, queue state machine, line rendering, and a generic stats line.

Readme

@aryrabelo/planqueue-core

npm license CI bun

Pure logic for PlanQueue — AI agent session notes with a markdown prompt queue. Designed for Bun, bundler-compatible with Node.js. Path scheme, persistence, markdown prompt-queue parsing, widget rendering, and a stats line. Used by the PlanQueue plugin for Oh My Pi (@aryrabelo/planqueue); runtime-agnostic so another harness build can reuse the same behavior without duplicating it.

Requirements

Bun ≥ 1.0.0 — the package ships TypeScript source (src/*.ts). Bun transpiles it natively at import time with no extra config. Node.js consumers need a bundler (esbuild, Vite, tsup) configured to handle .ts source imports.

Install

bun add @aryrabelo/planqueue-core

Modules

| Module | What it provides | |---|---| | paths | Derive safe filesystem paths for notes, history, config, and the current.md session pointer | | store | Async read / write / append-history / cross-session list, plus a coalescing debounced writer | | queue | Parse and mutate a markdown checkbox prompt queue: find head, mark inflight, complete, append | | widget | Render the notes widget as a styled string array (OMP HUD-style, with continuation lines) | | stats | Context bar + model + +adds/-dels + elapsed as a plain or injected-style string | | config | Parse and validate config.json shortcut overrides; humanize key strings for display | | editor | Decide whether an editor close should save, discard, or ask — no silent data loss |

All modules are re-exported from the package root:

import { findHead, markInflight, notePathFor, renderStatsLine } from "@aryrabelo/planqueue-core";

Usage

Prompt queue — the core use case

import {
  appendTask,
  findHead,
  markInflight,
  completeInflight,
  appendQueue,
  type QueueStep,
} from "@aryrabelo/planqueue-core";

// Start with a plain note — loose bullets are normalized automatically
let note = "- Refactor auth module\n- Write tests";

// Append a structured plan
const steps: QueueStep[] = [
  { prompt: "Set up CI", details: ["Add .github/workflows/ci.yml"] },
  { prompt: "Review PR", barrierAfter: true },   // pauses queue until human clears barrier
  { prompt: "Ship to npm" },
];
note = appendQueue(note, steps);

// Find and dispatch the first pending item
const head = findHead(note);
// { kind: "prompt", line: 0, text: "Refactor auth module" }

note = markInflight(note, head.line);
// "- [>] Refactor auth module\n..."

// After the agent completes it:
note = completeInflight(note);
// "- [x] Refactor auth module\n..."

Persist a note with debounced saves

import {
  resolveLocation,
  notePathFor,
  loadNote,
  saveNote,
  createDebouncedSaver,
} from "@aryrabelo/planqueue-core";

const loc = resolveLocation({ cwd: "/path/to/my-repo", repoToplevel: "/path/to/my-repo", branch: "main", sessionId: "abc123" });
const path = notePathFor(loc);              // ~/.planqueue/my-repo/main/abc123.md

const content = await loadNote(path);       // "" when file doesn't exist yet

const saver = createDebouncedSaver((c) => saveNote(path, c));
saver.schedule(content + "\n- [ ] New task");  // coalesces rapid updates
await saver.flush();

Reading legacy notes

New notes always write under ~/.planqueue/. To keep notes from before the rename visible, read through the legacy roots in order (~/.free-text/ first, then ~/.omp-free-text/):

import { legacyNotePathsFor, loadNoteWithFallback, notePathFor } from "@aryrabelo/planqueue-core";

const content = await loadNoteWithFallback(
  notePathFor(loc),           // new root: ~/.planqueue/...
  legacyNotePathsFor(loc),    // read-only fallback chain: ~/.free-text, then ~/.omp-free-text
);

Stats line

import { renderStatsLine } from "@aryrabelo/planqueue-core";

const line = renderStatsLine({
  modelName: "claude-sonnet-4-5",
  contextRemainingPct: 42,
  linesAdded: 120,
  linesRemoved: 30,
  durationMs: 185_000,
});
// "▓▓▓▓▓▓░░░░ 69% | claude-sonnet-4-5 | +120/-30 | 3m 05s"

Widget rendering

import { renderWidgetLines, PLAIN_STYLE } from "@aryrabelo/planqueue-core";

const note = "- [x] Done task\n- [>] In-flight task\n- [ ] Pending task";
const lines = renderWidgetLines(note, { maxLines: 6, style: PLAIN_STYLE });
// ["  └ ✓ Done task", "  └ ▸ In-flight task", "  └ ☐ Pending task", "(Ctrl+N)"]

Path scheme

Notes live under ~/.planqueue/<repo>/<branch>/<sessionId>.md. For back-compat, reads fall back through the legacy roots ~/.free-text/ then ~/.omp-free-text/ when the new path does not exist yet; writes always go to the new root.

~/.planqueue/
  my-repo/
    main/
      current.md          ← pointer to the active session id
      abc123.md           ← session note
      abc123.history.md   ← append-only history log

API

Full TSDoc on every export. Key functions and types:

paths — ROOT_DIR_NAME, LEGACY_ROOT_DIR_NAMES, resolveLocation, notePathFor, historyPathFor, sessionsDirFor, configPathFor, legacyNotePathsFor, legacySessionsDirsFor, legacyConfigPathsFor, currentPointerPathFor · Types: RawLocation, ResolvedLocation

store — loadNote, loadConfigText, saveNote, listNotes, appendHistory, createDebouncedSaver, writeCurrentPointer, readCurrentPointer, loadNoteWithFallback · Types: DebouncedSaver, NoteSummary

queue — parseTaskLine, findHead, markInflight, completeInflight, normalizeQueue, appendTask, appendQueue, prependQueue, removeBarrier, hasHeading, hasDoneTask, isEmptyOrHeadingOnly, isQueueSpent, deriveHeading, ensureHeadingFromMessage · Types: QueueStep, QueueHead, TaskState

stats — computeContext, contextLevel, formatDuration, buildContextBar, renderStatsLine · Types: StatsSnapshot, StatsStyle, ContextLevel

widget — renderWidgetLines, PLAIN_STYLE, SHORTCUT_HINT, EMPTY_HINT · Types: WidgetStyle, WidgetOptions

config — parseShortcutConfig, humanizeKey, queueHint · Types: ShortcutConfig, ParsedShortcuts, DEFAULT_SHORTCUTS

editor — resolveCloseAction · Types: CloseAction

Ecosystem

| Package | Description | |---|---| | @aryrabelo/planqueue | Oh My Pi plugin — session notes + prompt queue in the OMP HUD |

Contributing

git clone https://github.com/aryrabelo/planqueue-core.git
cd planqueue-core
bun install

bun test          # run tests
bun run typecheck # type check
bun run lint      # lint (biome)
bun run format    # auto-fix formatting

PRs welcome. Please include tests for new behavior and TSDoc on any new exports.

Changelog

See CHANGELOG.md.

License

MIT — Ary Rabelo