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-stats

v0.2.0

Published

Token/cost usage aggregator for pi coding agent — /usage command with per-model breakdown, specific-date and date-range filters

Readme

pi-stats

pi coding agent 세션의 토큰/비용 사용량을 집계하는 확장. ~/.pi/agent/sessions/** 의 세션 JSONL을 읽어 모델별·일자별로 합산해 /stats 커맨드로 보여준다.

설치

pi install npm:pi-stats          # npm
pi install git:github.com/preinpost/pi-stats   # git
pi install /absolute/path/to/pi-stats         # 로컬 경로

임시로 써보기:

pi -e npm:pi-stats

사용법

/stats                        오늘 (전체 프로젝트)
/stats 2026-08-21             특정 날짜 하루
/stats 2026-08-01..2026-08-07 기간 (양끝 포함)
/stats 2026-08-20..           특정일부터 지금까지
/stats ..2026-08-20           처음부터 특정일까지
/stats --project              현재 프로젝트(cwd) 세션만
/stats --daily                일자별 집계 추가
/stats --json                 JSON 출력 (스크립트 연동용)
/stats --help                 도움말

플래그는 조합 가능: /stats 2026-08-01.. --project --daily

날짜 경계는 단말 로컬 타임존 기준.

집계 대상

  • 어시스턴트 메시지 usage (provider/model 기준 그룹핑)
  • toolResult 안의 중첩 LLM usage → (tools) 행
  • compaction / branch_summary 요약 생성 usage → (summary) 행
  • 서브에이전트 실행 기록 (subagent-artifacts/*_worker_*_transcript.jsonl, type 필드 없이 중첩 message.usage만 있는 레코드 포함)
  • compaction retainedTail 복사본은 중복이라 제외

환경변수

  • PI_STATS_SESSIONS_DIR — 세션 디렉터리 override (기본 ~/.pi/agent/sessions)

개발

npm install          # devDeps (typescript, @types/node)
npm run selftest     # 합성 fixture 기반 테스트 (31 케이스 — 파싱/집계/엔드투엔드)
npm run typecheck    # tsc --noEmit

selftest는 실제 ~/.pi/agent/sessions에 의존하지 않고 합성 fixture만 쓰므로 CI 등 어느 환경에서든 결정적으로 동작한다.

릴리스

GitHub Actions(.github/workflows/bump-and-release.yml)가 자동 처리한다:

  1. main에 push → typecheck + selftest 게이트 통과 시 커밋 메시지 기반 버전 범프 (fix: → patch, feat: → minor, BREAKING CHANGE/!: → major)
  2. 태그 + GitHub Release 생성 후 npm publish

수동 릴리스: Actions 탭 → Bump & Release → Run workflow → 버전 타입 선택.

필요한 시크릿 (1회): gh secret set NPM_TOKEN -R preinpost/pi-stats