Runtime Support
dreamcli runs on Node.js, Bun, and Deno without code changes. A thin RuntimeAdapter interface abstracts the platform-specific edges.
Supported Runtimes
| Runtime | Status | Package |
|---|---|---|
| Node.js >= 22.22.2 | Supported | @kjanat/dreamcli (npm) |
| Bun >= 1.3 | Supported | @kjanat/dreamcli (npm) |
| Deno >= 2.6.0 | Supported | @kjanat/dreamcli (JSR) |
Adapters validate these minimum versions during creation. Unsupported runtimes fail fast with a descriptive error before command execution starts.
How It Works
The core framework never imports platform-specific APIs directly. Instead, a RuntimeAdapter provides:
argv— command-line argumentsenv— environment variablescwd— current working directorystdin— line reader for interactive promptsreadStdin— full piped stdin reader for.stdin()argumentsexit— process exitisTTY— terminal detectionstdinIsTTY— interactive stdin detectionreadFile/homedir/configDir— filesystem access
Runtime detection is automatic — dreamcli picks the right adapter at startup.
Explicit Adapter
import {
createAdapter,
createNodeAdapter,
} from '@kjanat/dreamcli/runtime';
const adapter = createAdapter(); // auto-detect
const nodeAdapter = createNodeAdapter(); // explicitDeno Permissions
On Deno, the adapter handles permission-safe access to the Deno namespace. If permissions are missing, features degrade gracefully with clear error messages.
deno run --allow-read --allow-env mycli.ts deployTesting Runtime Seams
For command behavior tests, runCommand() is process-free and injects runtime state directly:
import { runCommand } from '@kjanat/dreamcli/testkit';
const result = await runCommand(regionCmd, [], {
env: { MY_REGION: 'test' },
});When you need adapter-level control (argv, filesystem reads, exit behavior), use createTestAdapter() with cli().run({ adapter }).
What's Next?
- Testing — in-process test harness
- Getting Started — installation per runtime