用 TS 写命令行工具,比你想的简单多了

Everything ships a CLI these days — especially now that AI tooling lives in the terminal. So how do you build a good one? This episode takes the contrarian route: skip C/Go/Rust and build a distributable CLI in TypeScript with Bun. Scaffold with bun init, handle command parsing with citty, and render the UI with Ink (yes — React for your TUI). Then bun build --compile --target spits out a single-file binary. It's 57MB because the runtime ships with it… but hey, it works. The painful part — signing & notarization — is where goreleaser saves you. Since 2.6 it treats bun as a first-class citizen, handling checksums, changelogs, packaging, notarization, and Homebrew distribution for you. Heads up: the Apple Developer cert is $99/year and there's no way around it for Mac. Next episode: how to automate this entire build pipeline. What's the most interesting CLI you've built or used? Drop it in the comments 👇 ⏱️ Chapters 00:00 Why CLIs are having a moment 01:02 CLI pros: precise, fast, cross-platform 02:30 The cons & why CLIs are hard to build 03:09 Picking a language (and why TypeScript?) 04:00 Scaffolding with Bun + citty + Ink 05:54 Compiling to a binary: Node SEA vs Bun 07:54 Signing & notarization explained 09:46 goreleaser does it all 11:00 Homebrew distribution + the $99 catch 11:40 Next episode preview Tags: CLI command line tools TypeScript Bun Ink React goreleaser Node.js developer tools Claude Code web development AsyncTalk