| name | stacks-repl |
| description | Use when working with the Stacks REPL — interactive TypeScript sessions, tinker sessions, debugging, or exploring the framework interactively. Covers @stacksjs/repl and @stacksjs/tinker. |
| license | MIT |
| compatibility | Bun >= 1.3.0, TypeScript |
| allowed-tools | Read Edit Write Bash Grep Glob |
Stacks REPL / Tinker
Key Paths
- REPL package:
storage/framework/core/repl/src/
- Tinker package:
storage/framework/core/tinker/src/
- Packages:
@stacksjs/repl, @stacksjs/tinker
API
import { startRepl } from '@stacksjs/repl'
interface ReplConfig extends TinkerConfig {
loadFile?: string
}
async function startRepl(config: ReplConfig): Promise<{ exitCode: number }>
How It Works
- If
config.loadFile is specified, reads the file content
- Merges file content into
config.eval for evaluation
- Starts an interactive Bun REPL session with all framework modules available
- Returns the process exit code when the session ends
Re-exports from @stacksjs/tinker
import {
startTinker,
tinkerEval,
tinkerPrint,
getHistoryPath,
readHistory,
appendHistory,
clearHistory,
} from '@stacksjs/repl'
import type { TinkerConfig } from '@stacksjs/repl'
CLI Commands
buddy tinker
buddy tinker --load file.ts
Usage
Inside the REPL, all framework modules are available:
const users = await db.selectFrom('users').get()
const post = await Post.find(1)
console.log(config.app.name)
const email = faker.internet.email()
Gotchas
- Tinker is the user-facing command, REPL is the engine —
buddy tinker calls startRepl() under the hood
- All framework imports available — models, database, config, faker, etc. are preloaded
- History is persisted — REPL history is saved to disk via
getHistoryPath()
- File preloading — use
loadFile to run setup code before entering interactive mode
- Bun runtime — the REPL runs in Bun's JavaScript runtime, not Node.js