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
npm install @mongez/copperyarn add @mongez/copperpnpm add @mongez/copperQuick 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
| Need | Use | Skill |
|---|---|---|
| Color/style text | colors.red("…"), colors.bold(…) | colors |
| Animated loading | spinner({ text }).start() | spinner |
| Known-total bar | progress({ total }) | progress |
| Themed CLI logs | log.info / warn / error / success | log |
| Boxed message | box("text", { borderStyle }) | box |
| Hyperlinks, ANSI strip, symbols | link, stripAnsi, symbols | utilities |
| Worked end-to-end examples | — | recipes |
Color-support detection
isColorSupported is a boolean that’s resolved at module load. Priority:
NO_COLORenv or--no-colorargv → off (per no-color.org).FORCE_COLOR=0/FORCE_COLOR=false→ off.FORCE_COLOR(any other value) or--colorargv → on.- Windows → on (cmd / pwsh / Windows Terminal all render ANSI on Win10+).
- TTY stdout with
TERM !== "dumb"→ on. - Any
CIenv var → on. - 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*, fixedFORCE_COLOR=0to actually disable, lazyttyimport for browser bundles, and the newspinner/progress/box/log/link/stripAnsi/symbolsAPIs.
Scope boundaries
- Need general string/array helpers? Use
@mongez/reinforcements. - Need a full prompt/input library? Pair
@mongez/copperwith@inquirer/promptsorprompts. - Need a file-system layer? Use
@mongez/fs.