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

@kiyoshidainagon/diff-story

v0.1.0

Published

Unix filter that reorders a PR diff into AI-analyzed chapters — read your diff like a book.

Readme

diff-story

Every PR tells a story. Read your diff like a book.

diff-story reorders a pull-request diff into an ordered sequence of chapters so a reviewer reads the change like a narrative — earlier chapters set up the context that later ones build on.

It is a deterministic Unix filter that never calls a model. The agent driving it (Claude Code, Codex, Cursor, …) is the intelligence: the tool hands the agent a plan, the agent decides the chapters, and the tool renders them. No API key, no network, no cost inside the tool.

# ════════════════════════════════════════════════════════════
# 📖 Chapter 1/3 — API contract changes
#
# Synopsis: Adds the auth types and client the later chapters build on.
# ════════════════════════════════════════════════════════════

diff --git a/src/api/types.ts b/src/api/types.ts
...

Install

bun install -g diff-story    # or run from a clone: bun run start < diff.patch

Requires Bun — the executable runs under bun via its shebang.

Install the agent skill

This repo ships an Agent Skill at .github/skills/diff-story/SKILL.md that teaches your agent the protocol below. Install it with the GitHub CLI:

gh skill install iemong/diff-story

The skill is what makes an agent reach for diff-story when you ask it to summarize, group, or reorder a diff — the agent then decides the chapters and hands them back to the CLI for rendering.

How it works (the agent protocol)

# 1. Ask for the plan: the files to group + the JSON shape to produce.
git diff main..feature | diff-story

# 2. (the agent decides the chapters as JSON)

# 3. Render the story by handing the chapters back.
git diff main..feature | diff-story format \
  --chapters '{"chapters":[{"title":"Setup","synopsis":"…","files":["src/a.ts"]}]}'

Omitted files are appended as an "Appendix" chapter, so nothing is lost. Run diff-story --json-schema for the formal chapters schema.

Commands

| Command | Description | | ---------------------------------------- | -------------------------------------------- | | diff-story / diff-story plan | Print the plan: files + chapters to produce. | | diff-story format --chapters '<json>' | Render the story from inline chapters. | | diff-story format --chapters-json PATH | Render the story from a chapters file. | | diff-story parse | Parse the diff into files as JSON. | | diff-story doctor | Check git, parse-diff, and the runtime. |

Options

| Flag | Description | | ---------------------- | ------------------------------------------------ | | --chapters JSON | (format) Chapters as an inline JSON string. | | --chapters-json PATH | (format) Chapters from a JSON file. | | --json | (format) Emit JSON instead of an annotated diff. | | --json-schema | Print the chapters JSON schema and exit. | | -h, --help | Show help. -v, --version prints the version. |

stdout carries the result, stderr the diagnostics, and the exit code is 0 on success / 1 on any error. Errors print a stable code (DS_Exxx) plus a What / Why / How block.

Use as a library

The portable core is published to JSR with no model dependency:

import {
  parseUnifiedDiff,
  buildPlan,
  parseChaptersJson,
  reconcileChapters,
  formatStory,
} from "@iemong/diff-story";

const files = parseUnifiedDiff(rawDiff);
const plan = buildPlan(files); // hand this to your agent
const chapters = reconcileChapters(parseChaptersJson(agentJson), files);
const story = formatStory(files, chapters);

Development

bun install
bun test            # tests with a 100% coverage gate
bun run typecheck   # tsc --noEmit
bun run lint        # oxlint
bun run format      # oxfmt
bun run mutation    # Stryker mutation testing
bun run check       # everything above

Quality bars: 100% line + function coverage (enforced in bunfig.toml), mutation testing via Stryker, oxlint + oxfmt, and lefthook git hooks (format/lint/typecheck on commit, tests on push).

License

MIT