Get Started
Bunmagic is a script management tool that makes it incredibly easy to create and run shell scripts using Bun’s powerful runtime and APIs.
🌍 Everything is Global!
Section titled “🌍 Everything is Global!”This is the key feature of Bunmagic: All utilities are available as global variables in your scripts. No imports needed for $
, args
, flags
, cd
, ack
, select
, glob
, and all other Bunmagic utilities. They’re just there, ready to use!
Quick Start
Section titled “Quick Start”-
Install Bun:
Terminal window curl -fsSL https://bun.sh/install | bash -
Install Bunmagic:
Terminal window bunx bunmagic install -
Create Your First Script:
Terminal window bunmagic create hello-worldThis will create a new script and open it in your editor.
-
Write Your Script:
// No imports needed! All bunmagic utilities are global variables!console.log(ansis.green("Hello from bunmagic! 🪄"))// Run shell commands with $ (no import needed!)await $`echo "Running shell commands is easy!"`// Use args and flags directly (they're global!)if (args[0]) {console.log(`You passed: ${args[0]}`)}// File operations with global utilitiesif (await isDirectory("./src")) {const files = await glob("src/*.ts")console.log(`Found ${files.length} TypeScript files`)}// Interactive prompts - also global!const name = await ask("What's your name?")const confirmed = await ack(`Nice to meet you, ${name}! Continue?`, 'y')if (confirmed) {const choice = await select("Pick your favorite:", ["Bun", "Node", "Deno"])console.log(`Great choice: ${choice}!`)} -
Run Your Script:
Terminal window hello-worldThat’s it! Your script is now available as a command in your terminal.
What’s Next?
Section titled “What’s Next?”- Explore Bunmagic Commands to learn how to manage your scripts
- Check the Script Basics to understand arguments, flags, and shell execution
- Browse the Reference for all available APIs and utilities