This directory contains example Rempts CLI applications demonstrating various features and patterns, organized from simple to complex.
The absolute simplest possible Rempts CLI with a single command. Perfect starting point to understand the basics.
- Basic command definition
- Simple flag handling
- Minimal configuration
- Type generation for enhanced DX
A practical task automation CLI showcasing validation and interactivity patterns.
- Schema validation with Zod
- Interactive prompts and confirmations
- Progress indicators and spinners
- Build, test, deploy, and setup workflows
- Conditional flows based on options
A Git workflow helper demonstrating command organization and external tool integration.
- Nested command structure
- Command aliases
- Integration with external tools (git)
- Shell command execution
- Colored output for status
A development server CLI showcasing advanced plugin system and configuration management.
- Plugin system with lifecycle hooks
- Type-safe plugin context
- Configuration management
- Long-running processes
- Real-time updates and log following
Each example demonstrates the recommended Rempts development workflow:
# Navigate to an example
cd hello-world
# Install dependencies (includes @reliverse/dler rempts CLI)
bun install
# Generate types (creates .dler/commands.gen.ts)
bun run generate
# Start development with hot reload
bun run dev
# Build for production
bun run build
# Run the built executable
bun run start
# Or run directly (without hot reload)
bun cli.tsAll examples include:
dler.config.ts- Configuration with requiredcommands.directorycommands/directory - All command definitions (REQUIRED structure).dler/commands.gen.ts- Generated TypeScript definitions (auto-created)- Development scripts using
rempts devfor hot reload - Build scripts using
rempts buildfor production - Type generation for enhanced developer experience
Follow this learning path to master Rempts:
- hello-world (5 min) - Learn the absolute basics
- task-runner (15 min) - Validation and interactivity
- git-tool (15 min) - Command structure and organization
- dev-server (20 min) - Plugins and advanced patterns
Each example builds on the previous concepts and introduces new patterns.
Rempts uses Standard Schema for validation, allowing you to use any compatible validation library:
import { defineCommand, option } from '@reliverse/rempts'
import { type } from 'arktype'
export default defineCommand({
options: {
port: option(
type("number", { min: 1000, max: 65535 }),
{ short: 'p', description: 'Port number' }
)
}
})For larger CLIs, organize commands in a clear structure:
// commands/mod.ts
export const commands = [
buildCommand,
testCommand,
deployCommand
]Create engaging CLI experiences with built-in prompts:
const name = await prompt.text('What is your name?')
const color = await prompt.select('Favorite color?', ['red', 'green', 'blue'])
const confirmed = await prompt.confirm('Continue?')Extend functionality with type-safe plugins:
import { createPlugin } from '@reliverse/rempts/plugin'
export const myPlugin = createPlugin({
name: 'my-plugin',
store: { count: 0 },
beforeCommand({ store }) {
store.count++
}
})All examples use dler.config.ts for build configuration:
// dler.config.ts
import { defineConfig } from '@reliverse/rempts'
export default defineConfig({
name: 'my-cli',
version: '1.0.0',
description: 'My awesome CLI',
// REQUIRED: commands directory
commands: {
directory: './commands'
},
// REQUIRED: plugins array (can be empty)
plugins: [],
build: {
entry: './cli.ts',
outdir: './dist',
targets: ['native'], // Default target
compress: false, // Default: false
minify: false, // Default: false
sourcemap: true // Default: true
},
dev: {
watch: true,
inspect: false
}
})Build commands:
# Build for current platform
bun run build
# Build for specific platforms
rempts build --targets darwin-arm64,linux-x64
# Build for all platforms
rempts build --targets all
# Build with custom settings
rempts build --minify --sourcemapThe Rempts CLI handles:
- Hot reload in development (
rempts dev) - Standalone executable creation with Bun's
--compileflag - Multi-platform builds
- Automatic compression for releases
MIT