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

agent-pretty-print

v2.0.0

Published

Parse and format JSONL log files with TUI and file output

Downloads

97

Readme

Agent Log Pretty-Printer

Parse and format JSONL log files (e.g. Cursor/agent session logs) into a human-readable terminal UI or markdown output. Sessions, messages, tool calls, and results are grouped and displayed in a clear, navigable way.

Prerequisites

  • Node.js (v18+)

Install

As a global CLI (recommended):

npm install -g agent-pretty-print

As a project dependency:

npm install agent-pretty-print
npx agent-pretty-print [options] [file]

From source (development):

git clone https://github.com/Chizbro/agent-pretty-print.git && cd agent-pretty-print
npm install
npm run build
npm start -- [options] [file]

Usage

Run the CLI:

agent-pretty-print [options] [file]

Or with npx if installed locally:

npx agent-pretty-print [options] [file]

Input

  • File: Path to a JSONL file (one JSON object per line).
  • Stdin: Omit the file (or use -) and pipe JSONL in:
    cat agent.log | npm run parse --

Output modes

| Scenario | Result | |----------|--------| | parse-log <file> (TTY) | Interactive TUI — browse sessions, messages, tool calls. Press q to quit. | | parse-log <file> -o out.md | Write markdown to out.md (no TUI). | | parse-log <file> -w | Watch the file; TUI updates as new lines are appended. | | command \| parse-log | Read from stdin; TUI renders (non-interactive), then exits. | | command \| parse-log -o out.md | Stdin → markdown file. |

When stdout is not a TTY (e.g. in a pipe or CI), TUI is disabled unless you pass -t. Use -o <path> to write markdown instead.

Options

| Option | Description | |--------|-------------| | -o, --output <path> | Write formatted output as markdown to this file. | | -r, --raw <path> | Tee each raw JSONL line to a file (useful for debugging). | | -t, --tui | Force TUI mode even when stdout is not a TTY. | | -w, --watch | Watch the log file for new lines and refresh (use with TUI or -o). | | -s, --session-id <id> | Show only the session with this ID. | | -e, --errors-only | Show only sessions that contain errors (tool or result errors). |

Examples

# Interactive TUI for a log file
npm run parse -- logs/readme

# Write markdown report
npm run parse -- logs/readme -o report.md

# Watch a live log (e.g. while an agent runs)
npm run parse -- /path/to/live.log -w

# Only sessions with errors
npm run parse -- logs/readme -e -o errors.md

# Single session
npm run parse -- logs/readme -s 5a5c2d32-6863-47f6-ac2e-c55f5143938d

# From stdin to markdown
cat agent.jsonl | npm run parse -- -o report.md

Input format (JSONL)

Each line must be a JSON object (log event). The parser expects events with at least:

  • type: one of system, user, assistant, tool_call, result, thinking
  • session_id: string (groups events into sessions)
  • Optional: timestamp_ms, model_call_id, call_id, message, tool_call, result, text, model, cwd, is_error, etc.

See logs/readme in this repo for an example JSONL stream (Cursor-style agent transcript).

Project structure

  • parse-log.ts — CLI entry (Commander); wires parser, TUI, and markdown formatter.
  • src/parser.ts — Reads JSONL (file/stdin/watch), aggregates by session.
  • src/session.ts — Builds sessions, tool calls, and messages from events.
  • src/formatters/tui.tsx — Interactive terminal UI (ink/React).
  • src/formatters/markdown.ts — Markdown output for reports.
  • src/types.ts — Shared types for events, sessions, tool calls, messages.

License

Use and modify as needed for your environment.