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

@crewhaus/tool-text

v0.7.0

Published

Deterministic text tools: regex extraction, diffing, unified-diff parsing, budget truncation, log compaction, outlining, templating, rule classification, normalization, similarity, and escaping

Readme

@crewhaus/tool-text

Deterministic text tools. Every one is pure: no filesystem, no network, no clock, no randomness. The same input always produces the same bytes.

That property is the point. A harness spends a model call when it needs judgement; it should not spend one to count lines, pull a version string out of a log, or fill in a template. These nineteen tools cover the mechanical half so the model is left with the part that actually needs it.

tools:
  - all-text          # every tool below
  - -renderTemplate   # ...except this one

| Tool | What it does | |---|---| | CompactLog | Collapse a long log to distinct lines with repeat counts, failures first | | CountTokens | Characters, words, lines and an estimated token count | | DiffParse | Read a unified diff back into files, hunks and lines, each line numbered in the new file | | EscapeString | Quote text for a regex, shell word, JSON, URL, HTML, markdown, CSV or SQL LIKE | | ExtractEntities | Pull URLs, emails, IPs, UUIDs, semvers, tickets, amounts and more out of text | | ExtractKeywords | Rank a document's significant terms, stop words excluded | | FuzzyMatch | Rank candidates against a query by edit distance, Jaro-Winkler, trigram or token overlap | | GlossaryReplace | Apply a term mapping, longest term first, whole-word by default | | MarkdownOutline | List a document's headings, or return one section by title or slug | | MarkdownTable | Render records as an aligned GitHub-flavoured table | | NormalizeText | Canonicalize line endings, whitespace, Unicode form, ANSI codes, invisible characters | | RegexExtract | Every match with named groups, offsets and line numbers | | RenderTemplate | Fill {{placeholders}} from structured data, strict about missing keys | | RuleClassify | Label text against operator-written phrase and regex rules | | SortLines | Sort, de-duplicate, key by a delimited field | | TextDiff | Unified diff plus added/removed counts | | TextSimilarity | Score two texts 0..1, lexically | | TruncateToBudget | Cut to a character or estimated-token budget, keeping head, tail or both | | WrapText | Hard-wrap at a column width with an optional prefix |

What is deliberately not here

Anything whose core is judgement rather than mechanism: summarizing, translating, classifying by meaning, drafting prose, ranking by relevance beyond lexical scoring. RuleClassify labels by rules an operator wrote, not by understanding. ExtractEntities finds things that have a syntax, not things that have a meaning — it is regex, explicitly not named-entity recognition. TextSimilarity is lexical, with no embeddings.

Where a deterministic first pass exists, it belongs first and the model is the escalation path.

Layout

src/lib/ holds the pure functions and is where the behaviour is tested; src/index.ts wraps them as tools. A bug in levenshtein reads better as a failing unit than as a failing tool call.

Safety flags

All nineteen are readOnly, non-destructive, scope: "internal", and declare no io capability, because none of them crosses a process or network boundary. packages/tool-text/src/index.test.ts asserts that for every tool, so a future addition that reaches outside has to change the assertion deliberately.