Provides a small Node.js utility to determine the stdout window width for CLI apps. It tries multiple fallbacks, including TTY, `output.columns`, a `CLI_WIDTH` environment variable, and then a configurable default, returning a width value useful for formatting terminal output.
Project status
- The repository appears to be maintained, with an upstream push on 2026-01-21. However, the provided update history shows no tagged
updatesafter v4.1.0 (2023-08-05). - Update cadence looks infrequent for published versions (v4.0.0 in 2022-03, v4.1.0 in 2023-08, then none shown through 2026-06), though there is evidence of activity in the repo via the 2026-01 upstream push.
AI summary generated
Recent updates
v4.1.0
This release adds TypeScript support and expands CI coverage to Node.js 18 and 20. The only functional code change visible in the diff is the introduction of a new TypeScript declaration file, along with packaging and build configuration adjustments.
Featuresv4.0.0
v4.0.0 primarily updates project configuration and tooling, and it also raises the minimum supported Node.js version. The runtime code change in index.js is minimal (mostly style and const usage), while package.json and the lockfile reflect dependency and engine updates.
Breakingv3.0.0
Release v3.0.0 was published on 2020-04-14, but no release notes were provided by the publisher. Because the release notes are missing, the changes in this version cannot be determined from the provided data, so there is no actionable information to assess upgrade impact.
v2.1.0
This release adds a new fallback to determine stdout width. The implementation now checks for an output stream width via `output.columns` in addition to the existing tty and `CLI_WIDTH` environment variable fallbacks.
BreakingFeaturesv2.0.0
This release changes how cli-width is configured, moving from a property-based default to an options object. The exported function now accepts configuration (default width, output stream, and tty module) while keeping the same general fallback order (stdout, tty, then environment/default).
BreakingFeaturesv1.1.1
This release updates the width-detection fallback logic so that when terminal width detection reports 0, the library falls back to the configurable defaultWidth. It also updates project tooling for test coverage reporting and ignores tests in the published npm package.
v1.1.0
Version v1.1.0 introduces support for overriding the computed CLI width via an environment variable. The runtime logic and accompanying tests were updated, and the README now documents a new fallback before the default width.
Featuresv1.0.0
This release is the initial launch of version v1.0.0. No release notes were provided, so there is no documented information about new features, fixes, or changes.
v1.0.1
This release (v1.0.1) adds a fix for the defaultWidth behavior and introduces automated tests. It also updates package tooling to run the new test suite and updates the README accordingly. No publisher release notes were provided, so the changes below are derived purely from the code diff.
Features