rempts
CLI toolchain for developing, building, testing, and distributing Rempts applications
rempts
The official Rempts CLI toolchain provides a complete development environment for building, testing, and distributing CLI applications. It includes commands for development, building standalone executables, testing, project initialization, and automated releases.
Installation
bun add -g remptsnpm install -g remptspnpm add -g remptsFeatures
- ๐ Development Mode - Hot reload with Bun's
--hotflag - ๐๏ธ Build System - Create standalone executables or traditional JS builds
- ๐งช Test Runner - Integrated testing with coverage support
- ๐ฆ Release Automation - Version bumping, git tags, and npm publishing
- ๐ฏ Multi-Platform - Build for macOS, Linux, and Windows from any platform
- โ๏ธ Configuration - Flexible
dler.config.tssystem - ๐ Debugging - Built-in debugger support
- ๐ Workspace Support - Monorepo-friendly commands
Commands
@reliverse/rempts init
Initialize a new Rempts CLI project. This is an alias for rempts.
rempts init my-cli
cd my-cliOptions:
--name, -n- Project name--template, -t- Project template (basic,advanced,monorepo)--dir, -d- Directory to create project in--git, -g- Initialize git repository (default: true)--install- Install dependencies (default: true)--package-manager, -p- Package manager to use (bun,pnpm,yarn,npm)
@reliverse/rempts dev
rempts devOptions:
--entry, -e- Entry file (defaults to auto-detect)--watch, -w- Watch for changes (default: true)--inspect, -i- Enable debugger--port, -p- Debugger port (default: 9229)
Features:
- Debugger support for breakpoint debugging
- Auto-detection of entry point from package.json or common patterns
- Pass-through arguments to your CLI
Example:
# Run with debugger
rempts dev --inspect
# Run with custom entry and arguments
rempts dev --entry src/cli.ts -- --verbose
# Disable watch mode
rempts dev --no-watch@reliverse/rempts build
Build your CLI for production, either as standalone executables or traditional JavaScript.
rempts buildOptions:
--entry, -e- Entry file (defaults to auto-detect)--outdir, -o- Output directory (default:./dist)--outfile- Output filename (for single executable)--targets, -t- Target platforms for compilation (comma-separated)--minify, -m- Minify output--sourcemap, -s- Generate sourcemaps--bytecode- Enable bytecode compilation (experimental)--runtime, -r- Runtime target (bun,node)--watch, -w- Watch for changes
Target Platforms:
native- Current platform onlydarwin-arm64- macOS Apple Silicondarwin-x64- macOS Intellinux-arm64- Linux ARM64linux-x64- Linux x64windows-x64- Windows x64all- All supported platforms
Examples:
# Build traditional JS (requires Bun runtime)
rempts build
# Build standalone executable for current platform
rempts build --targets native
# Build for specific platforms
rempts build --targets darwin-arm64,linux-x64
# Build for all platforms
rempts build --targets all
# Custom output directory
rempts build --outdir ./bin
# Watch mode
rempts build --watch@reliverse/rempts generate
Generate TypeScript type definitions for your commands.
rempts generateOptions:
--cmdsDir- Commands directory (defaults to config or./commands)--watch, -w- Watch for changes and regenerate
Examples:
# Generate types once
rempts generate
# Generate with custom output location
rempts generate --output ./types/commands.ts
# Watch for changes
rempts generate --watch
# Use custom commands directory
rempts generate --cmdsDir ./src/commandsType generation is automatically run during rempts dev and rempts build. You typically only need to run this manually for one-off generation or when using watch mode.
@reliverse/rempts test
Run tests for your CLI using Bun's native test runner.
rempts testOptions:
--pattern, -p- Test file patterns (default:**/*.test.ts)--watch, -w- Watch for changes--coverage, -c- Generate coverage report--bail, -b- Stop on first failure--timeout- Test timeout in milliseconds--all- Run tests in all packages (workspace mode)
Examples:
# Run all tests
rempts test
# Run with coverage
rempts test --coverage
# Run specific test files
rempts test --pattern "src/**/*.test.ts"
# Run tests in all workspace packages
rempts test --all
# Watch mode for TDD
rempts test --watch@reliverse/rempts release
Create a release of your CLI with automated version bumping, git tagging, and publishing.
rempts releaseOptions:
--version, -v- Version to release (patch/minor/major/x.y.z)--tag, -t- Git tag format--npm- Publish to npm (default: true)--github- Create GitHub release--dry, -d- Dry run - show what would be done--all- Release all packages (workspace mode)
Features:
- Interactive version selection
- Automated version bumping following semver
- Git tag creation and pushing
- npm publishing with proper build step
- GitHub release creation with assets
- Workspace support for monorepos
- Dry run mode for testing
Examples:
# Interactive release
rempts release
# Specific version bump
rempts release --version patch
# Major version with GitHub release
rempts release --version major --github
# Dry run to preview changes
rempts release --dry
# Release all workspace packages
rempts release --allConfiguration
Create a dler.config.ts file in your project root to configure the CLI behavior:
import { defineConfig } from '@reliverse/rempts-core'
export default defineConfig({
name: 'my-cli',
version: '1.0.0',
description: 'My awesome CLI',
// Command configuration
commands: {
manifest: './src/commands/manifest.js',
directory: './src/commands'
},
// Build configuration
build: {
entry: './src/cli.ts',
outdir: './dist',
targets: ['darwin-arm64', 'linux-x64', 'windows-x64'],
compress: true,
external: ['@aws-sdk/*'],
minify: true,
sourcemap: false
},
// Development configuration
dev: {
watch: true,
inspect: false,
port: 9229
},
// Test configuration
test: {
pattern: ['**/*.test.ts', '**/*.spec.ts'],
coverage: false,
watch: false
},
// Release configuration
release: {
npm: true,
github: true,
tagFormat: 'v${version}',
conventionalCommits: true
},
// Workspace configuration (monorepos)
workspace: {
packages: ['packages/*'],
versionStrategy: 'independent'
}
})Entry Point Detection
The CLI automatically detects your entry point in this order:
--entryflagbuild.entryin dler.config.tsbinfield in package.json- Common patterns:
src/cli.tssrc/index.tssrc/main.tscli.tsindex.tsmain.ts
Standalone Executables
Build standalone executables that bundle your CLI with the Bun runtime:
# Build for current platform
rempts build --targets native
# Build for all platforms
rempts build --targets all
# Build for specific platforms
rempts build --targets darwin-arm64,linux-x64,windows-x64Output structure:
dist/
โโโ darwin-arm64/
โ โโโ my-cli
โโโ darwin-x64/
โ โโโ my-cli
โโโ linux-x64/
โ โโโ my-cli
โโโ windows-x64/
โโโ my-cli.exeWith compression enabled:
dist/
โโโ darwin-arm64.tar.gz
โโโ darwin-x64.tar.gz
โโโ linux-x64.tar.gz
โโโ windows-x64.tar.gzWorkspace Support
For monorepos, the CLI supports workspace-aware commands:
# Run tests in all packages
rempts test --all
# Build all packages
rempts build --all
# Release all packages
rempts release --all
# Run dev in specific package
cd packages/my-package && @reliverse/rempts devConfigure workspaces in dler.config.ts:
export default defineConfig({
workspace: {
packages: ['packages/*'],
shared: {
// Shared configuration for all packages
build: {
minify: true
}
},
versionStrategy: 'independent' // or 'fixed'
}
})Environment Variables
The CLI sets these environment variables:
NODE_ENV- Set todevelopmentin dev mode,testin test mode,productionin build modeREMPTS_VERSION- The version of the @reliverse/rempts CLI- Standard Bun environment variables
Advanced Usage
Debug Mode
Enable debugging for your CLI during development:
# Start with debugger
rempts dev --inspect
# Custom debugger port
rempts dev --inspect --port 9230Then attach your debugger (VS Code, Chrome DevTools, etc.) to the specified port.
Custom Build Pipeline
Extend the build process with pre/post hooks:
// dler.config.ts
export default defineConfig({
build: {
onBeforeBuild: async () => {
// Generate types, clean directories, etc.
},
onAfterBuild: async (result) => {
// Copy additional files, generate docs, etc.
}
}
})Cross-Platform Considerations
When building for multiple platforms:
// dler.config.ts
export default defineConfig({
build: {
targets: ['darwin-arm64', 'linux-x64', 'windows-x64'],
external: process.platform === 'win32'
? ['node-pty']
: ['windows-specific-module']
}
})Continuous Integration
Example GitHub Actions workflow:
name: Build and Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Run tests
run: @reliverse/rempts test --coverage
- name: Build for all platforms
run: @reliverse/rempts build --targets all
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: builds
path: dist/*.tar.gzTroubleshooting
Command not found: If rempts is not found after installation, ensure your global bin directory is in PATH. Alternatively, use bunx rempts to run without global installation.
Common Issues
Build fails with module errors:
- Check that all dependencies are installed
- Verify entry point exists
- Use
--externalfor native modules - Check TypeScript configuration
Hot reload not working:
- Ensure you're using
rempts dev - Check that Bun version supports
--hot - Some file changes may require manual restart
Tests not found:
- Verify test file pattern matches your test files
- Default pattern is
**/*.test.ts - Use
--patternto specify custom patterns
API Reference
CLI Options
All commands support these global options:
--help, -h- Show help for command--version, -v- Show CLI version--config, -c- Path to config file (default: ./dler.config.ts)--verbose- Enable verbose logging--quiet, -q- Suppress non-error output
Configuration Schema
The configuration is validated using Zod. See the Configuration guide for the complete schema.
See Also
- Getting Started - Quick start guide
- Configuration - Detailed configuration options
- Distribution Guide - Publishing and distribution strategies
- @reliverse/rempts-test - Testing utilities for CLI applications