DEV Community

GXY Gomi
GXY Gomi

Posted on

Supercharge Your Bun Workflow with bun-tasks

Supercharge Your Bun Workflow with bun-tasks

If you’ve ever wished Bun had a drop-in parallel runner like concurrently, meet bun-tasks—a Bun-first CLI that streamlines multi-command orchestration without leaving the Bun ecosystem.

Why bun-tasks?

  • Bun-native: Designed specifically for the Bun runtime—no Node shims, no compatibility hacks. Just run bun --version to make sure Bun is ready and you’re good to go.
  • Simple parallelism: Launch any combination of scripts or executables in a single line using the intuitive ::: separator. Quoting, environment variables, and script expansions are handled for you.
  • Smart env handling: Apply global flags with --args/-a, then fine-tune each command with its own variables. Local overrides always win, so tweaking command-specific settings is effortless.
  • Package-script aware: Referencing dev, serve, or another package script? bun-tasks automatically expands it to bun run <script>, keeping your commands DRY.
  • Safe programmatic API: Import the exported BunTasksCLI class for custom orchestration inside your own tools—nothing auto-executes on import.

Getting Started

Install the CLI (and make sure Bun is installed first):

bun add -D bun-tasks
Enter fullscreen mode Exit fullscreen mode

Add a script that fans out to multiple tasks:

{
  "scripts": {
    "dev": "bun-tasks --args NODE_ENV=dev api ::: docs --args PORT=4000"
  }
}
Enter fullscreen mode Exit fullscreen mode

Define your commands in package.json or point to executables directly:

{
  "scripts": {
    "api": "bun run src/api.ts",
    "docs": "bun run docs:watch"
  }
}
Enter fullscreen mode Exit fullscreen mode

Run it:

bun run dev
Enter fullscreen mode Exit fullscreen mode

bun-tasks merges your environment variables, launches both tasks in parallel, and prefixes their output—so you know exactly which command produced which logs.

Advanced Usage

Need fine-grained control? Import the CLI class:

import { BunTasksCLI } from "bun-tasks";

const cli = new BunTasksCLI();
await cli.run(["echo", "hello", ":::", "echo", "world"], {
  stdoutPrefix: (index) => `[job-${index}]`,
  mirrorStderrToStdout: true,
});
Enter fullscreen mode Exit fullscreen mode

Customize prefixes, control stream mirroring, or embed bun-tasks inside a larger automation script.

Built with Trust

The codebase ships with full Bun test coverage (coverage display is fully supported on Linux/WSL; Windows coverage is still maturing). The CLI lives at bin.ts, and build artifacts are carefully curated—no .d.ts.map clutter.

Acknowledgements

Portions of this project were authored with assistance from GPT-5-Codex.


Ready to simplify your Bun tooling? Dive into the docs and examples on GitHub:

Give bun-tasks a spin and keep your Bun workflow fast, clean, and parallel.

Top comments (0)