strip-ansi

Strips ANSI escape codes from strings — the small, fast utility Node.js later built directly into its own core API.

Library
npm
v7.2.0
498 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
50 /100 Fair
Development Activity 36
Maintenance 24
Community 60
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
65 /100 Good
Architecture 70
Code Quality 90
Innovation 55
Learning Curve 45

strip-ansi is a minimal, dependency-light JavaScript utility that removes ANSI escape codes — the invisible control sequences terminals use for color, cursor movement, and hyperlinks — from a string. Maintained by Sindre Sorhus as part of the chalk organization’s suite of terminal utilities, it pairs with ansi-regex to match the full range of ANSI sequences, including OSC hyperlinks and 8-bit CSI introducers.

The package ships ESM-only with bundled TypeScript types and no build step. It underpins the broader terminal-color ecosystem (chalk, has-ansi, and countless CLI tools), and its behavior was influential enough that Node.js adopted the same logic directly into its own core util.stripVTControlCharacters API.

What You Get

  • A single default-exported stripAnsi() function with zero configuration
  • Bundled TypeScript type declarations (index.d.ts) with no separate @types package needed
  • A fast-path optimization that skips the regex entirely when no escape/CSI bytes are present
  • Support for both 7-bit ESC and 8-bit CSI introducers, plus OSC hyperlink sequences

Common Use Cases

  • Stripping color codes from captured CLI output before logging, diffing, or storing it
  • Sanitizing terminal output for length calculations (e.g. computing visible string width)
  • Cleaning subprocess stdout/stderr before writing to log files or test snapshots
  • Feeding plain text to non-terminal consumers such as web UIs or CI output parsers

Under The Hood

Architecture

strip-ansi has no internal architecture to speak of by design: it’s a single-file module (index.js) exporting one function that validates its input, applies a fast-path bail-out when no escape-sequence bytes are present, and otherwise runs a single .replace() call against a precompiled regex sourced from the ansi-regex package. There are no layers, no internal abstractions, and nothing to break beyond that one function — which is appropriate for its scope: a single-purpose string transform, not an application.

Tech Stack

The package is plain JavaScript published as an ES module ("type": "module"), targeting Node.js 12+, with a single runtime dependency on ansi-regex for pattern matching. It ships hand-written TypeScript declarations (index.d.ts) rather than being authored in TypeScript, has no build step, and is tested with ava, type-checked with tsd, and linted with xo.

Code Quality

Test coverage in test.js runs a focused but comprehensive set of cases through ava — color codes, mixed reset/set sequences, terminal hyperlinks, OSC sequences terminated by BEL, and 8-bit CSI introducers — plus an explicit test that plain strings pass through untouched. Type correctness is enforced separately via tsd against index.test-d.ts. Error handling is explicit: non-string input throws a descriptive TypeError rather than failing silently. Linting is enforced via xo, and CI runs via GitHub Actions workflows in .github/.

API Design The public API is about as low-friction as a package can get: one default export, one argument, one return value, no configuration object, no instantiation. The accompanying index.d.ts doc comment includes runnable usage examples inline, so editors surface real examples on hover. The tradeoff for this simplicity is that stripping behavior is fixed — there’s no way to opt out of stripping OSC hyperlinks specifically, for example — but for a package this narrowly scoped, that’s a reasonable design choice rather than a limitation.

Used by 31 apps in this directory

TypeScript
99%
MIT

GraphQL Hive

Developer Tools · Devops · Monitoring

483

Open-source GraphQL schema registry and observability platform with breaking change detection, federation support, and CI/CD integration for teams of any size.

View details
90
Repo Health
81
Technical
68
Dependency
Built with
TypeScript 99%
Updated yesterday
TypeScript
97%
MIT

HyperDX

Analytics · Developer Tools · Monitoring

9,963

Open source observability platform that unifies logs, traces, metrics, and session replays on ClickHouse — now the core of ClickStack.

View details
89
Repo Health
83
Technical
64
Dependency
Built with
TypeScript 97%
Updated today
TypeScript
77%
Other

Joplin

Note Taking

56,853

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
60
Dependency
Built with
TypeScript 77%
JavaScript 14%
Updated yesterday
TypeScript
98%
Other

Kibana

Analytics · Monitoring

21,338

Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.

View details
98
Repo Health
87
Technical
63
Dependency
Built with
TypeScript 98%
Updated today
TypeScript
98%
Apache 2.0

letta-code

AI Assistants · AI Code Assistants

3,697

A memory-first coding agent harness that learns from experience, maintains identity across models, and works across Claude, GPT, Gemini, and dozens more LLMs.

View details
86
Repo Health
84
Technical
74
Dependency
Built with
TypeScript 98%
Updated today
TypeScript
98%
Other

LobeHub

AI Assistants · Automation · Productivity

83,455

Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.

View details
92
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 98%
Updated today
Clojure
71%
AGPL 3.0

Logseq

Knowledge Management · Note Taking

45,349

A privacy-first, open-source knowledge graph platform combining Markdown, Org-mode, bidirectional linking, and local-first storage for building your second brain.

View details
92
Repo Health
82
Technical
65
Dependency
Built with
Clojure 71%
OCaml 12%
Updated yesterday
TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

29,041

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
90
Repo Health
73
Technical
65
Dependency
Built with
TypeScript 99%
Updated today
TypeScript
51%
Other

Mattermost

Collaboration · Devops · Team Chat

39,418

Open core, self-hosted team collaboration with chat, AI agents, voice calling, and deep DevOps integrations — all under your control.

View details
96
Repo Health
87
Technical
65
Dependency
Built with
TypeScript 51%
Go 40%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers