plgg-cli
A toolkit for building command-line program wrappers, built from scratch on plgg. Declare a program's commands and options as typed data, parse process.argv into a validated Invocation, dispatch to a handler, and fold the handler's Result into a shell outcome — stdout on Ok, stderr + a non-zero exit code on Err — with an auto-generated usage banner. Its only runtime dependency is plgg.
Why it exists
Everywhere else in this monorepo "CLI" means a package's own argv → exit-code entrypoint. plgg-cli is the toolkit those entrypoints are built on — it wraps your program as a command-line program:
plgg ── plgg-cli ── your program's binIt does not spawn external programs — a spawn/exec library is a separate concern. process is touched at exactly one seam, so the command model itself stays pure plgg data.
How it's organized
- model —
program/command/option/flagconstructors build the command tree as typed data, and argv parses into anInvocation. - usecase —
optionOf/hasFlagread an invocation's values asOption, andrunCliruns the matched handler and folds itsResultto a shell outcome.
A handler returns its outcome as a value rather than writing to the console itself, so the effectful edge (stdout / stderr / exit code) lives in one place. The exact constructor and combinator list lives in the plgg-cli source.