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-ci-status

v0.2.0

Published

Lightweight CI status for the Pi coding agent: zero-token footer badge, on-demand ci_status tool, and edge-triggered one-line context injection on CI state changes. Zero LLM calls.

Readme

pi-ci-status

Lightweight CI status for the Pi coding agent: keeps you and the model aware of GitHub Actions state on the current branch without burning tokens on per-turn status text. This extension makes zero LLM calls — it only spawns throttled gh/git processes.

The three-layer design

  1. Footer badge — zero tokens. ctx.ui.setStatus("ci", "CI: ✓ / ✗ test / ⟳ deploy") shows a compact indicator, refreshed on session start and after each agent run.
  2. Tool ci_status. The model pulls full detail on demand (latest run + which of the last 5 runs are failing, with URLs). Guidelines tell it when: before claiming a fix works, after pushing, when CI is red.
  3. Edge-triggered delta. ONLY when the CI signature changes (green→red, red→green, none→red…) does the extension append one line to the next turn's system prompt and show one notification. A persisted lastInjectKey per repo|branch ensures /reload never re-injects.

Install

# install from npm
pi install npm:pi-ci-status

# or copy the single file into your global extensions dir
cp src/ci-status.ts ~/.pi/agent/extensions/

Then /reload (or restart).

Requires the GitHub CLI, authenticated:

gh auth login      # once

If gh is missing or unauthenticated, the extension shows a single warning and recovers automatically: it re-probes with capped backoff (default 5s → 5min) until gh is available again, and the ci_status tool and /ci force a fresh probe on demand. Failures are never latched — a transient at startup can't disable the badge for the whole session. It never crashes or prompts.

Usage

  • /ci — show the current status (badge + latest workflow)
  • /ci refresh — force a fresh check, bypassing the throttle
  • /ci badge [on|off|activity|reset] — set the footer badge mode at runtime (persisted); reset returns to the env var
  • The ci_status tool (refresh: true to bypass the throttle) is available to the model

Footer badge options

The footer badge can be gated or disabled via env var and/or the /ci badge runtime toggle (which wins and is persisted) — the ci_status tool, /ci command, and context injection are unaffected:

| Value | Behavior | | --- | --- | | always (default) | Show whenever a snapshot exists (current behavior) | | activity | Show only when the branch has CI activity (≥ 1 run); hides the "CI: –" placeholder on repos with no runs yet | | off | Never show the footer badge |

export CI_STATUS_BADGE=activity    # badge only appears once CI has run
# or: export CI_STATUS_BADGE=off   # badge disabled, everything else keeps working

At runtime (no restart needed):

/ci badge              → show current mode (override or env default)
/ci badge activity     → activity mode, persisted
/ci badge on           → always show, persisted
/ci badge off          → badge disabled, persisted
/ci badge reset        → back to the CI_STATUS_BADGE env var

The override is stored in ~/.pi/agent/ci-status/badge-mode.json (override the path with CI_STATUS_BADGE_FILE).

Cost / behavior notes

  • Throttle: at most one gh run list per 90 s (CI_STATUS_TTL_MS env override) and per new HEAD — a run completing with no new commits still gets re-checked at the TTL; no redundant spawns otherwise.
  • gh gate: gh --version + gh auth status probe, cached in a freshness window (default 60s, CI_STATUS_GH_PROBE_TTL_MS). On failure the extension retries with capped backoff (CI_STATUS_GH_RETRY_BASE_MS → CI_STATUS_GH_RETRY_MAX_MS, defaults 5s → 5min) until gh works again, and the ci_status tool / /ci re-probe on demand. No permanent failure latch — a transient at pi startup can't leave the badge disabled for the whole session.
  • State: ~/.pi/agent/ci-status/state.json (override with CI_STATUS_STATE), keyed repo|branch → last fetch time, HEAD sha, snapshot, and inject key.
  • All I/O is error-swallowed — the extension can never break the agent loop.
  • It reports the latest run (status/conclusion + workflow name) and which of the last 5 runs are failing.

Development / tests

The core logic is exported for testing. Tests use a fake gh shim (tests/gh-shim.mjs) — no network, no auth:

npm ci
npm test
npm run typecheck

Covers: gate ok · initial fetch · HEAD-unchanged skip (no extra spawn) · new-commit refetch · green→red transition fires once · red→active · no re-fire on same signature · badge/line/format derivation · badge visibility modes (CI_STATUS_BADGE: always/activity/off) · badge-mode override persistence (/ci badge) · gh-missing and unauthenticated no-ops · gate-recovery after failure · extension-registration wiring (tool, command, handlers). 78 assertions across the 5 runs.

Requirements

  • Pi coding agent (extension API; tested against 1.0.0)
  • GitHub CLI (gh) installed and authenticated
  • git on PATH

License

MIT — see LICENSE.