|
1 | 1 | # Sandwich |
2 | 2 |
|
3 | | -A fail-loud Bun compatibility layer for systems that intentionally do not |
4 | | -install Node.js, npm, pnpm, or Yarn. |
| 3 | +An oven factory for JavaScript: a direct Node replacement that runs on |
| 4 | +delicious Bun only. |
5 | 5 |
|
6 | | -Sandwich makes Bun the canonical JavaScript runtime and package manager while |
7 | | -translating only the compatibility behavior it can represent honestly. |
8 | | -Ambiguous state-changing commands fail with an explanation instead of |
9 | | -pretending that Bun and another package manager have identical semantics. |
10 | | - |
11 | | -## Guarantees |
12 | | - |
13 | | -- `node` executes JavaScript with Bun and reports Bun's Node-compatible |
14 | | - `process.version`. Its preload also resolves generated base64 JavaScript data |
15 | | - modules used by Node-oriented test harnesses. Bun does not support general URL |
16 | | - imports; oversized generated modules should use an ordinary temporary ESM file. |
17 | | -- `npx` executes packages through `bun x --bun`. |
18 | | -- common npm, pnpm, and Yarn operations translate to tested Bun commands. |
19 | | -- `npm ci` requires `bun.lock` and uses `bun install --frozen-lockfile`. |
20 | | -- unsupported dependency semantics fail loudly. |
21 | | -- Bun telemetry and crash uploads are disabled. |
22 | | -- installation is user-scoped, previewable, idempotent, and does not restart |
23 | | - services. |
24 | | - |
25 | | -Sandwich does not install Bun and does not remove an existing Node runtime. |
26 | | -Install or update Bun through Bun's supported installer first, then let |
27 | | -Sandwich control command resolution at the user level. |
28 | | - |
29 | | -## Layout |
30 | | - |
31 | | -- `bin/`: the canonical `sandwich` command and compatibility façades |
32 | | -- `manifest.json`: versioned operations consumed by Diogenes |
33 | | -- `lib/`: shared Bun discovery and translation helpers |
34 | | -- `config/`: managed Bun and shell configuration |
35 | | -- `scripts/install-user.sh`: previewable user-level installer |
36 | | -- `scripts/apply-hermes-maintenance.sh`: guarded Hermes integration profile |
37 | | -- `scripts/refresh-hermes-artifacts.sh`: maintainer-only Hermes profile refresh |
38 | | -- `patches/` and `config/hermes.*`: version-pinned Hermes updater artifacts |
39 | | -- `tests/compat.sh`: offline compatibility contract |
40 | | - |
41 | | -## Install |
42 | | - |
43 | | -Preview all destinations without changing the system: |
| 6 | +Sandwich makes `node`, `npm`, `npx`, `pnpm`, `yarn`, and `corepack` resolve to |
| 7 | +tested Bun translations. It supports workspaces, global installs, lifecycle |
| 8 | +trust, frozen lockfiles, and the Hermes update/build path without installing a |
| 9 | +second JavaScript runtime. |
44 | 10 |
|
45 | 11 | ```bash |
46 | | -./scripts/install-user.sh --check |
47 | | -``` |
48 | | - |
49 | | -Apply the user-level configuration: |
50 | | - |
51 | | -```bash |
52 | | -./scripts/install-user.sh --apply |
| 12 | +git clone https://github.com/CommanderTurtle/sandwich.git |
| 13 | +cd sandwich |
| 14 | +./install.sh |
53 | 15 | source ~/.bashrc |
54 | 16 | sandwich doctor |
55 | 17 | ``` |
56 | 18 |
|
57 | | -The installer creates timestamped backups under |
58 | | -`~/.local/state/sandwich/backups`, installs user-owned links in |
59 | | -`~/.local/bin`, and replaces only the marked Sandwich block in `~/.bashrc`. |
60 | | -It preserves all unrelated PATH entries and shell |
61 | | -configuration. |
62 | | - |
63 | | -## Environment |
64 | | - |
65 | | -Sandwich recognizes: |
66 | | - |
67 | | -- `SANDWICH_BUN`: explicit Bun executable |
68 | | -- `SANDWICH_NPM_VERSION`: npm compatibility version reported to tooling |
69 | | -- `SANDWICH_PNPM_VERSION`: pnpm compatibility version |
70 | | -- `SANDWICH_YARN_VERSION`: Yarn compatibility version |
71 | | -- `BUN_INSTALL`: Bun installation root, normally `~/.bun` |
72 | | - |
73 | | -## Hermes integration profile |
74 | | - |
75 | | -Sandwich includes the tested Hermes updater repair. The profile keeps the |
76 | | -Hermes root, state directory, protected production roots, and upstream |
77 | | -reference configurable: |
78 | | - |
79 | | -- `HERMES_LIVE_DIR`, default `~/.hermes/hermes-agent` |
80 | | -- `HERMES_UPSTREAM_REF`, default `origin/main` |
81 | | -- `SANDWICH_STATE_ROOT`, default `~/.local/state/sandwich` |
82 | | -- `SANDWICH_PROTECTED_ROOTS`, a colon-separated list defaulting to |
83 | | - `~/Hermes:~/Odysseus` |
84 | | - |
85 | | -Previewing the profile is read-only and refuses while the Hermes worktree or a |
86 | | -protected Compose project is active: |
87 | | - |
88 | | -```bash |
89 | | -./scripts/apply-hermes-maintenance.sh --check |
90 | | -``` |
91 | | - |
92 | | -`--apply` is intentionally maintenance-window-only. It requires an exact |
93 | | -Hermes commit match, rejects unrelated tracked changes, backs up the files it |
94 | | -will replace, applies the pinned patch and Bun artifacts, performs frozen |
95 | | -workspace installs, and rebuilds the TUI and Web workspaces. It never restarts |
96 | | -Hermes or another service. `--allow-active` is an explicit human override, not |
97 | | -an automatic Diogenes action. |
98 | | - |
99 | | -After a reviewed upstream Hermes update, maintainers can refresh the profile |
100 | | -against an explicitly selected upstream reference: |
| 19 | +Preview with `./install.sh --check`. Update Bun with |
| 20 | +`./install.sh --upgrade-bun`. Existing user shims and shell configuration are |
| 21 | +backed up under `~/.local/state/sandwich`. |
101 | 22 |
|
102 | | -```bash |
103 | | -HERMES_UPSTREAM_REF=origin/main \ |
104 | | - ./scripts/refresh-hermes-artifacts.sh |
105 | | -``` |
106 | | - |
107 | | -## Contract |
108 | | - |
109 | | -Run the offline compatibility suite at any time: |
110 | | - |
111 | | -```bash |
112 | | -./tests/compat.sh |
113 | | -``` |
| 23 | +Hermes support is baked in. On a reviewed maintenance window, run |
| 24 | +`./install.sh --with-hermes`; afterwards the normal `hermes update` path uses |
| 25 | +the pinned Bun workspace and UI/TUI build integration. |
114 | 26 |
|
115 | | -Use `bun` and `bun x` directly when Bun-native behavior is desired. Add a |
116 | | -tested translation before relying on a package-manager command that Sandwich |
117 | | -currently rejects. |
| 27 | +Sandwich fails loudly when another package manager’s semantics cannot be |
| 28 | +represented honestly. Runtime state and backups never live in this repository. |
0 commit comments