Skip to content

Copper

@mongez/copper is a zero-dependency, TypeScript-first CLI toolkit. One install gives you colors, spinners, progress bars, boxed messages, a themed logger, and OSC-8 hyperlinks — without the maintenance burden of pulling in chalk + ora + cli-progress + boxen separately.

Install

Terminal window
npm install @mongez/copper

Quick peek

import { colors, spinner, log, box } from "@mongez/copper";
log.info("Starting build…");
const spin = spinner({ text: "Compiling sources" }).start();
await compile();
spin.succeed("Build complete");
console.log(box(colors.green.bold("✓ Ready to ship"), { borderStyle: "round" }));

Four of copper’s main pieces — themed log, animated spinner, chainable colors, bordered box — in one snippet. Every import is from the root, every formatter is just a function, and the whole thing is zero-dependency.

Import surface

Every export comes from the root:

import {
colors, createColors, type Colors, type ColorName, type ChainFormatter, type Formatter,
spinner, type SpinnerHandle, type SpinnerOptions,
progress, type ProgressHandle, type ProgressOptions,
box, type BoxOptions, type BoxStyle,
log, createLogger, type Logger, type LogLevel, type LoggerOptions,
link,
stripAnsi,
symbols, type SymbolName,
isColorSupported, detectColorSupport,
} from "@mongez/copper";

Where features live

NeedUseSkill
Color/style textcolors.red("…"), colors.bold(…)colors
Animated loadingspinner({ text }).start()spinner
Known-total barprogress({ total })progress
Themed CLI logslog.info / warn / error / successlog
Boxed messagebox("text", { borderStyle })box
Hyperlinks, ANSI strip, symbolslink, stripAnsi, symbolsutilities
Worked end-to-end examplesrecipes

Color-support detection

isColorSupported is a boolean that’s resolved at module load. Priority:

  1. NO_COLOR env or --no-color argv → off (per no-color.org).
  2. FORCE_COLOR=0 / FORCE_COLOR=false → off.
  3. FORCE_COLOR (any other value) or --color argv → on.
  4. Windows → on (cmd / pwsh / Windows Terminal all render ANSI on Win10+).
  5. TTY stdout with TERM !== "dumb" → on.
  6. Any CI env var → on.
  7. Otherwise → off.

createColors(false) short-circuits this — every formatter becomes the identity String, so colored builders can be re-run in test snapshots or piped output without ANSI noise.

Upgrading from v1? See the CHANGELOG for the full v2.0.0 breaking changes — renamed brown2*brown*, limeGreen*lime*, fixed FORCE_COLOR=0 to actually disable, lazy tty import for browser bundles, and the new spinner / progress / box / log / link / stripAnsi / symbols APIs.

Scope boundaries

  • Need general string/array helpers? Use @mongez/reinforcements.
  • Need a full prompt/input library? Pair @mongez/copper with @inquirer/prompts or prompts.
  • Need a file-system layer? Use @mongez/fs.