@zerothrow/zt-cli
v0.1.3
Published
ZeroThrow CLI tool for repo-wide workflows
Readme
@zerothrow/zt-cli
🧠 ZeroThrow Layers
• ZT – primitives (try,tryAsync,ok,err)
• Result – combinators (map,andThen,match)
• ZeroThrow – utilities (collect,enhanceAsync)
• @zerothrow/* – ecosystem packages (resilience, jest, etc)
ZeroThrow Ecosystem · Packages ⇢
ZeroThrow CLI tool for repo-wide workflows and package management automation.
Installation
As a dev dependency in your project
npm install --save-dev @zerothrow/zt-cli
# or: pnpm add -D @zerothrow/zt-cliGlobal installation
npm install -g @zerothrow/zt-cli
# or: pnpm add -g @zerothrow/zt-cliQuick Start
The zt CLI provides a unified interface for managing ZeroThrow packages and development workflows:
# List all packages in the monorepo
zt list
# Check if packages are ready for publishing
zt package ready
# Run all validation checks
zt validate
# Generate documentation from templates
zt docs generateCommands
zt list (alias: zt ls)
Lists all packages in the monorepo with their versions and metadata.
zt list
# or
zt lsOutput:
📦 ZeroThrow Packages
@zerothrow/core v0.2.3
@zerothrow/resilience v0.2.0
@zerothrow/jest v1.1.0
...
Total: 8 packageszt package
Package management utilities with multiple subcommands.
zt package ready
Checks if packages meet all requirements for publishing to npm.
# Interactive package selection
zt package ready
# Check all packages
zt package ready --all
# Check specific package
zt package ready --package core
# Show detailed check results
zt package ready --all --verbose
# Auto-fix issues where possible
zt package ready --fix
# Fix all packages
zt package ready --all --fixExit Codes:
0- All selected packages are ready1- One or more packages are not ready2- Command error
Output Modes:
--verbose- Shows every check with ✓ or ✗--fix- Auto-fix issues and prompt for manual fixes- Default - Only shows failures (silence is golden)
The command checks:
- Accurate package description
- Correct package naming (
@zerothrow/*) - Required package.json fields (type, exports, main, module, types, etc.)
- Proper configuration (sideEffects, publishConfig, engines)
- Required files (README.md, CHANGELOG.md, LICENSE)
- Mascot image in marketing/brand directory
- README content requirements (badges, ecosystem links, install instructions)
- ECOSYSTEM.md inclusion and version accuracy
zt package init
Creates a new package from template.
# Interactive mode
zt package init
# With options
zt package init --name my-package --description "My awesome package"zt validate
Runs all validation checks across the monorepo.
# Run all checks
zt validate
# Auto-fix issues where possible
zt validate --fix
# Only validate staged files
zt validate --stagedChecks performed:
- Build (TypeScript compilation)
- Lint (ESLint)
- Type check
- Tests (via turbo)
- Format (Prettier)
zt ecosystem
Manages the ECOSYSTEM.md file that documents all packages.
zt ecosystem sync
Updates ECOSYSTEM.md with current package information.
zt ecosystem synczt ecosystem check
Verifies ECOSYSTEM.md is up to date (useful for CI).
zt ecosystem checkzt docs
Documentation generation utilities using markdown transclusion.
zt docs generate
Generates all documentation from templates, ensuring consistency across packages.
zt docs generateThis command:
- Extracts package information (versions, descriptions)
- Processes ECOSYSTEM.md from template
- Processes all package READMEs from templates
- Supports custom README templates per package
- Uses markdown-transclusion for composable documentation
External Commands
The CLI supports external commands via the zt-{command} naming convention. When you run zt foo, it will look for:
- Built-in command named
foo - External command
zt-fooin your PATH
This allows extending the CLI with custom commands.
Development
The CLI is built with:
- Commander.js for CLI framework
- Chalk for terminal colors
- Ora for spinners
- Inquirer for interactive prompts
- Markdown Transclusion for documentation generation
Examples
Pre-publish Workflow
# Check all packages
zt package ready --all --verbose
# Fix issues automatically
zt package ready --all --fix
# Sync documentation
zt docs generate
# Run validation
zt validate
# Final check
zt ecosystem checkDevelopment Workflow
# List current packages
zt list
# Create new package
zt package init --name my-feature
# Check readiness
zt package ready --package my-feature
# Fix issues
zt package ready --package my-feature --fixCI Workflow
# Validate everything
zt validate
# Check ecosystem is in sync
zt ecosystem check
# Check all packages are ready
zt package ready --allContributing
See the main repository for contribution guidelines.
License
MIT
