cli-builder

Build TypeScript command-line interfaces with Bun.

Updated Aug 30, 2024
One-click install
npx skills add https://github.com/minhtri2710/dotfiles --skill cli-builder-minhtri2710
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-builder
Source: https://github.com/minhtri2710/dotfiles/tree/main/dot_config/opencode/skill/cli-builder
Command: npx skills add https://github.com/minhtri2710/dotfiles --skill cli-builder-minhtri2710

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Guide for building TypeScript command-line tools with Bun. Learn argument parsing, subcommand patterns, output formatting, and distribution.

Core Features & Use Cases

  • Minimal CLI: Create simple CLIs quickly.
  • Argument parsing: Demonstrates how to parse flags and positional args.
  • Subcommands & formatting: Patterns for multi-command tools and colored/JSON outputs.

Quick Start

bun scripts/my-tool.ts hello

Frequently Asked Questions about cli-builder

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a command-line interface with TypeScript and Bun?

Build TypeScript CLIs with Bun by setting up argument parsing for flags and positional arguments, organizing commands into a subcommand registry pattern, and formatting output as JSON or colorized text. Bun's runtime executes your CLI scripts directly without compilation overhead.

What's the best way to structure a multi-command CLI tool?

Structure multi-command tools using subcommand patterns that register each command with consistent argument parsing and output formatting. This Skill demonstrates registry-based organization suitable for complex tooling and automation tasks.

Can I distribute a TypeScript CLI built with Bun as a standalone tool?

Yes. Bun CLIs support a plugin-friendly extension model and can be distributed as shell-executable scripts. The Skill covers patterns for building distributable command-line tools with consistent behavior across environments.

How do I parse command-line arguments and flags in a Bun project?

Parse arguments and flags by extracting values from the arguments array, validating flag patterns, and mapping them to command handlers. This Skill shows argument parsing techniques integrated with subcommand dispatch.

Do I need additional libraries to format CLI output as JSON or colored text?

Bun provides built-in capabilities for JSON serialization and string formatting. This Skill demonstrates how to implement both JSON and colorized output modes without external dependencies.

What file-system and shell execution utilities are available for Bun CLIs?

Bun CLIs can perform file-system operations and execute shell commands natively. This Skill covers file-system helpers and shell execution utilities designed for automation tasks and project-specific commands.