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

@tforgach/axi-fetch

v0.3.0

Published

Fetch a URL and get a token-efficient, agent-ready TOON response (AXI-conformant CLI + library)

Readme

@tforgach/axi-fetch

Token-efficient web fetching for AI agents. axi-fetch fetches a URL, extracts the meaningful content, and returns a compact TOON (Token-Oriented Object Notation) response following AXI (Agent eXperience Interface) principles — instead of raw HTML or even clean markdown.

On real content pages it delivers a large token reduction vs a readable-markdown reader tool (median ~80% in-repo benchmark), by combining aggressive extraction, structured code/table lifting, sensible truncation, and TOON encoding.

Built as an AXI CLI on top of axi-sdk-js (TOON output, structured errors, exit codes, self-update).

Install

npm install -g @tforgach/axi-fetch   # CLI
# or as a library:
npm install @tforgach/axi-fetch

Requires Node 20+.

CLI

axi-fetch <url> [flags]

--find <terms>    Only the passages matching these keywords (fastest way to a specific fact)
--section <name>  One section by heading (see the sections list)
--full            Everything, in pages of 16k chars
--page <n>        Page of --full / --section output
--max <chars>     Opening content length (default 3000)
--links           Include outbound links
--code            Include code blocks (a count is shown otherwise)
--no-cache        Bypass the on-disk response cache
--timeout <ms>    Network timeout (default 10000)

Works on HTML pages, JSON APIs (--find searches field paths like owner.login) and plain-text or Markdown files (RFC-style and # headings work with --section).

Looking for a specific fact? Pass --find on the first call and get only the matching passages, each with its section:

axi-fetch https://en.wikipedia.org/wiki/Token_bucket --find "leaky bucket meter"
url: "https://en.wikipedia.org/wiki/Token_bucket"
title: Token bucket
type: article
contentLength: 7799
passages[8]{section,text}:
  "","The token bucket is an algorithm used in packet-switched and telecommunications networks. …"
  …
  Comparison to leaky bucket,"… the leaky bucket algorithm as a meter. This is a mirror image of the token bucket, …"
  …

Without --find you get the opening content (3000 chars), the sections list, and next-step hints (--find, --section, --full, --page).

Failures print a structured error and use a non-zero exit code (2 for bad input/flags, 1 otherwise).

Library

import { axiFetch, extractFromHtml } from "@tforgach/axi-fetch";

const { axiResponse, toonOutput } = await axiFetch("https://example.com/article");
console.log(toonOutput);        // TOON string (agent-facing)
console.log(axiResponse.type);  // "article" | "documentation" | "generic"

// Or run the pipeline on HTML you already have (no network):
const result = extractFromHtml(html, "https://example.com/article");

How it works

URL → fetch (native, redirects + meta-refresh + charset) → detect type (rules)
    → extract (Readability / cheerio) → lift sections/code/tables/links
    → truncate + next-steps → TOON encode

License

MIT