Skip to content

Replace chalk with Node's built-in util.styleText #330

Closed

Description

@riglar

What

chalk is imported in one file only, src/utils/styling.ts, which is already where all the CLI's colours come from. Node 22 (our minimum, per engines) has util.styleText built in, so we could drop the dependency.

Why

  • One fewer runtime dependency, and a slightly smaller standalone binary.
  • styleText respects NO_COLOR, FORCE_COLOR and whether the stream is a TTY, like chalk does.

Things to check

  • Every chalk style used in styling.ts has a styleText format (gray, red, bold, …). Chained styles become an array: styleText(['red', 'bold'], s).
  • Colour detection: chalk checks stdout, but styleText checks process.stdout by default, or the stream passed in options.stream. Output that goes to stderr (device command progress, the MCP server's logging) should pass { stream: process.stderr }.
  • styleText has validateStream turned on by default. Confirm that piped output and --json runs stay free of colour codes.
  • The bun-compiled binaries should behave the same way.

Priority

Low. This is tidy-up, not a fix.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions