Reliverse Docs

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 rempts
npm install -g rempts
pnpm add -g rempts

Features

  • ๐Ÿš€ Development Mode - Hot reload with Bun's --hot flag
  • ๐Ÿ—๏ธ 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.ts system
  • ๐Ÿ” 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-cli

Options:

  • --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 dev

Options:

  • --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 build

Options:

  • --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 only
  • darwin-arm64 - macOS Apple Silicon
  • darwin-x64 - macOS Intel
  • linux-arm64 - Linux ARM64
  • linux-x64 - Linux x64
  • windows-x64 - Windows x64
  • all - 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 generate

Options:

  • --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/commands

Type 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 test

Options:

  • --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 release

Options:

  • --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 --all

Configuration

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:

  1. --entry flag
  2. build.entry in dler.config.ts
  3. bin field in package.json
  4. Common patterns:
    • src/cli.ts
    • src/index.ts
    • src/main.ts
    • cli.ts
    • index.ts
    • main.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-x64

Output structure:

dist/
โ”œโ”€โ”€ darwin-arm64/
โ”‚   โ””โ”€โ”€ my-cli
โ”œโ”€โ”€ darwin-x64/
โ”‚   โ””โ”€โ”€ my-cli
โ”œโ”€โ”€ linux-x64/
โ”‚   โ””โ”€โ”€ my-cli
โ””โ”€โ”€ windows-x64/
    โ””โ”€โ”€ my-cli.exe

With compression enabled:

dist/
โ”œโ”€โ”€ darwin-arm64.tar.gz
โ”œโ”€โ”€ darwin-x64.tar.gz
โ”œโ”€โ”€ linux-x64.tar.gz
โ””โ”€โ”€ windows-x64.tar.gz

Workspace 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 dev

Configure 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 to development in dev mode, test in test mode, production in build mode
  • REMPTS_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 9230

Then 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.gz

Troubleshooting

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 --external for 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 --pattern to 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

On this page