Lines 1-40javascript
5 * Runs under Node (≥ 14.18, ESM). Resolves a Bun binary in order:
6 * 1. PATH bun — if version ≥ MIN_BUN_VERSION (preferred; user-managed)
7 * 2. Managed cache — <XDG_CACHE_HOME|~/.cache>/doraval/bun/bin/bun (if ≥ min)
8 * 3. Neither / too old — prompt for consent, install/upgrade cache, then exec.
10 * Bun.YAML (used for config.yml and frontmatter) requires Bun ≥ 1.3.0.
11 * Older managed caches (e.g. 1.2.0) must not win over a newer PATH install.
13 * The Bun installer is scoped to the cache dir (BUN_INSTALL env var) so it
14 * never touches ~/.bun or shell rc files.
17 * DORAVAL_AUTO_INSTALL_BUN=1 — skip prompt, always install (CI / automation)
18 * DORAVAL_AUTO_INSTALL_BUN=0 — skip prompt, never install; print guidance + exit 1
21import { execSync, spawnSync } from 'node:child_process'
22import { fileURLToPath } from 'node:url'
23import { join, dirname } from 'node:path'
24import { existsSync, rmSync } from 'node:fs'
25import { homedir } from 'node:os'
26import { createInterface } from 'node:readline'
28// Pinned managed-install version; bump this to update the cached Bun.
29// Must be ≥ MIN_BUN_VERSION (Bun.YAML since 1.3.0).
30const BUN_VERSION = '1.3.14'
31/** Minimum Bun that exposes Bun.YAML — used by config / frontmatter / journal. */
32const MIN_BUN_VERSION = '1.3.0'
34const __dirname = dirname(fileURLToPath(import.meta.url))
36// ── helpers ────────────────────────────────────────────────────────────────
38function getCacheDir() {
39 const base = process.env.XDG_CACHE_HOME || join(homedir(), '.cache')
40 return join(base, 'doraval', 'bun')
HighSandbox Evasion Gated Capability
Source gates dangerous network, credential, or execution behavior behind CI, host, platform, time, or geo fingerprint checks.
bin/doraval-wrapper.jsView on unpkg · L20