Get Started
llms.txtBunmagic is a script management tool that makes it easy to create and run shell scripts on Bun.
Everything Is Global
Section titled “Everything Is Global”In bunmagic scripts, utilities like $, arg(), flag(), args, flags, cd, files, prompts, and styling helpers are globally available.
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-world -
Write script logic
console.log(ansis.green('Hello from bunmagic'))await $`echo "Running shell commands is easy"`const input = arg(0).string().optional()if (input) {console.log(`You passed: ${input}`)}if (flags.verbose) {console.log('Verbose mode enabled')}if (await files.isDir('./src')) {const sourceFiles = await files.glob('src/*.ts')console.log(`Found ${sourceFiles.length} TypeScript files`)}const runFile = files.resolve('./tmp/run.json')const previous = await files.pathExists(runFile)? (JSON.parse(await files.readFile(runFile)) as { runs?: number }): {}await files.outputFile(runFile, `${JSON.stringify({runs: (previous.runs ?? 0) + 1,ranAt: new Date().toISOString(),args,}, null, 2)}\n`)const name = await ask("What's your name?")const confirmed = 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-world