Introduction
clify is a modern, fast, and composable CLI toolkit designed for developers who want to build powerful command-line applications without the boilerplate. It provides a clean API, built-in plugin system, and first-class TypeScript support.
Fast
Composable
Extensible
Cross-Platform
Getting Started
Installation
npm
npm install -g clifyHomebrew
brew install clify/cli/clifycurl
curl -fsSL https://clify.dev/install.sh | shQuick Start
Initialize a new project and run your first command:
$ clify init my-app
$ cd my-app
$ clify runSystem Requirements
- -Node.js 18.0.0 or later
- -npm, yarn, or pnpm
- -macOS, Linux, or Windows (WSL recommended)
Commands Reference
clify initInitialize a new clify project in the current directory. Creates the project structure, configuration file, and installs default plugins.
clify init [project-name] [options]--template <name>Project template to use (default, typescript, minimal)--package-manager <pm>Package manager to use (npm, yarn, pnpm)--skip-installSkip dependency installation--forceOverwrite existing files$ clify init my-app --template typescript --package-manager pnpmclify runRun your CLI application in development mode with hot-reload. Watches for file changes and rebuilds automatically.
clify run [options]--port <port>Port to listen on (default: 3000)--no-hmrDisable hot module replacement--inspectEnable Node.js inspector$ clify run --port 8080 --inspectclify buildBuild your CLI application for production. Outputs optimized bundles in the configured output directory.
clify build [options]--target <target>Build target (node18, node20, browser)--format <format>Output format (esm, cjs, both)--no-minifyDisable minification--watchWatch for changes and rebuild$ clify build --target node20 --format esmclify deployDeploy your CLI application to the cloud. Supports multiple deployment targets.
clify deploy [target] [options]--region <region>Deployment region--no-cacheDisable build caching--dry-runPreview deployment without applying$ clify deploy aws --region us-east-1clify configView or modify your project configuration. Lists all current settings and allows targeted updates.
clify config [key] [value] [options]--listList all configuration values--jsonOutput as JSON--globalAccess global configuration$ clify config build.target node20clify helpDisplay help information for any command. Shows usage, flags, and examples.
clify help [command] [options]--allShow help for all commands--jsonOutput help as JSON$ clify help buildExamples
Creating a CLI tool with TypeScript
Initialize a TypeScript project and set up plugins for type-safe development.
# Create a new TypeScript project
$ clify init my-tool --template typescript
# Navigate into the project
$ cd my-tool
# Start development with hot-reload
$ clify run
# In another terminal, test your CLI
$ node dist/index.js --helpBuilding a multi-command application
Use the plugin system to create a feature-rich CLI with subcommands.
# Generate a command scaffold
$ clify init task-manager
$ cd task-manager
# Add custom commands via plugins
$ clify plugin add database
$ clify plugin add logging
# List available commands
$ clify help
# Use the task manager
$ clify task-manager add "Write docs" --priority high
$ clify task-manager list --status pendingContinuous deployment pipeline
Automate builds and deployments as part of your CI workflow.
# Build for production
$ clify build --target node20 --format esm --minify
# Run tests
$ clify test --coverage
# Deploy to production
$ clify deploy aws --region us-east-1 --no-cache
# Verify deployment
$ clify health --endpoint https://api.example.com/healthCustom plugin development
Extend clify with your own plugins for domain-specific functionality.
# Create a new plugin
$ clify plugin init my-plugin
$ cd my-plugin
# Edit the plugin handler
$ cat > src/index.ts << 'EOF'
export default {
name: "my-plugin",
hooks: {
"build:start": (ctx) => {
console.log("Build started!", ctx.config);
},
"build:end": (ctx) => {
console.log("Build completed in", ctx.duration, "ms");
},
},
};
EOF
# Test your plugin
$ clify build --plugin my-pluginConfiguration
clify is configured via a clify.config.js or clify.config.ts file at the root of your project.
export default {
// Project name used in logs and output
name: "my-app",
// Entry point for your CLI
entry: "./src/index.ts",
// Output directory for builds
output: "./dist",
// Plugins to extend functionality
plugins: [
"typescript",
"esbuild",
"testing"
],
// Build configuration
build: {
target: "node18",
format: "esm",
minify: true,
sourcemap: true,
},
// Development server settings
dev: {
port: 3000,
hotReload: true,
},
// Custom commands
commands: {
greet: {
description: "Greet a user",
handler: async (name) => {
console.log(`Hello, ${name}! Welcome to clify.`);
},
},
},
};Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
name | string | undefined | Project name used in logs and output |
entry | string | ./src/index.ts | Entry point for your CLI |
output | string | ./dist | Output directory for builds |
plugins | string[] | [] | Array of plugin names to use |
build.target | string | node18 | Node.js target version |
build.format | string | esm | Module format (esm, cjs, both) |
build.minify | boolean | true | Enable minification |
build.sourcemap | boolean | true | Generate sourcemaps |
dev.port | number | 3000 | Development server port |
dev.hotReload | boolean | true | Enable hot reload |
Contributing
We welcome contributions from the community! Whether you are fixing a bug, adding a feature, or improving documentation, your help makes clify better for everyone.
How to Contribute
Fork the repository
Create a branch
Make your changes
Run tests
Submit a pull request