bots-garden/razorbillpublic Fork
⑂ fe0695f
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

scripts/install.sh: build and install rzb under /usr/local

rzb and its resource bundles go to /usr/local/lib/razorbill; /usr/local/bin/rzb is a launcher
that execs it (rzb cannot be copied alone). --no-build, --prefix, --uninstall; sudo only when
the prefix is not writable. Docs EN + FR, release notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k33g committed 2026-11-26T06:21:31+01:00 Browse files
fe0695f parent: a218748
modified .memory/handoffs/2026-11-25-v0-2-server-foundation.md +5 -0
@@ -130,3 +130,8 @@ its bundles when started through a symlink (docs say: put the folder on PATH). N
130130 v0.4 TUI planned: #51 closed, tickets #53–#59 (start with #53 admin routes, then #54 foundation);
131131 open choices are listed inside the tickets (polling vs SSE, unload while busy, forms vs $EDITOR). v1.0.0
132132 signing #52. #47 leftovers have no milestone.
133+
134+## Update 2026-11-26 — v0.2.0 tagged locally, install.sh
135+User is now trying rzb themselves (installed with `scripts/install.sh`) before starting v0.3 (spike
136+#46). Expect feedback from that use first. Not run on the Mac by Claude: install.sh, release.sh,
137+compat.sh. Nothing pushed; tag v0.2.0 is local.
@@ -130,3 +130,8 @@ its bundles when started through a symlink (docs say: put the folder on PATH). N
130 v0.4 TUI planned: #51 closed, tickets #53–#59 (start with #53 admin routes, then #54 foundation);130 v0.4 TUI planned: #51 closed, tickets #53–#59 (start with #53 admin routes, then #54 foundation);
131 open choices are listed inside the tickets (polling vs SSE, unload while busy, forms vs $EDITOR). v1.0.0131 open choices are listed inside the tickets (polling vs SSE, unload while busy, forms vs $EDITOR). v1.0.0
132 signing #52. #47 leftovers have no milestone.132 signing #52. #47 leftovers have no milestone.
133+
134+## Update 2026-11-26 — v0.2.0 tagged locally, install.sh
135+User is now trying rzb themselves (installed with `scripts/install.sh`) before starting v0.3 (spike
136+#46). Expect feedback from that use first. Not run on the Mac by Claude: install.sh, release.sh,
137+compat.sh. Nothing pushed; tag v0.2.0 is local.
modified .memory/history.md +11 -0
@@ -337,3 +337,14 @@ config. Rejected: a server inside the TUI (double model memory), connecting to r
337337 Tickets: #53 local admin routes (status, unload, reload + SIGHUP, loopback only), #54 foundation
338338 (restore v0.1 terminal layer, 4 screens, HTTP client), #55 chat, #56 dashboard, #57 models, #58
339339 settings (open: forms lose YAML comments vs $EDITOR), #59 docs; #26/#28 moved into v0.4. No code.
340+
341+## 2026-11-26 — scripts/install.sh, v0.2.0 tagged
342+
343+User: "ok pour v0.2", merge on main, then wants to try rzb before v0.3; asked for an install.sh
344+that rebuilds and copies to /usr/local/bin. Done: `scripts/install.sh` — installs the folder under
345+/usr/local/lib/razorbill plus a launcher /usr/local/bin/rzb, because rzb needs its bundles next to
346+it (copying it alone was rejected; a symlink was rejected because bundle lookup through a symlink
347+is unverified). Tested on Linux with `--no-build --prefix` (install, reinstall, uninstall, refusal
348+on a foreign rzb); not yet run on the Mac. Docs EN+FR (build guide "Install", README, release
349+how-to, release notes). Gate PASS, links OK. main fast-forwarded, local tag v0.2.0. The Mac run of
350+scripts/release.sh and scripts/compat.sh was not reported by the user.
@@ -337,3 +337,14 @@ config. Rejected: a server inside the TUI (double model memory), connecting to r
337 Tickets: #53 local admin routes (status, unload, reload + SIGHUP, loopback only), #54 foundation337 Tickets: #53 local admin routes (status, unload, reload + SIGHUP, loopback only), #54 foundation
338 (restore v0.1 terminal layer, 4 screens, HTTP client), #55 chat, #56 dashboard, #57 models, #58338 (restore v0.1 terminal layer, 4 screens, HTTP client), #55 chat, #56 dashboard, #57 models, #58
339 settings (open: forms lose YAML comments vs $EDITOR), #59 docs; #26/#28 moved into v0.4. No code.339 settings (open: forms lose YAML comments vs $EDITOR), #59 docs; #26/#28 moved into v0.4. No code.
340+
341+## 2026-11-26 — scripts/install.sh, v0.2.0 tagged
342+
343+User: "ok pour v0.2", merge on main, then wants to try rzb before v0.3; asked for an install.sh
344+that rebuilds and copies to /usr/local/bin. Done: `scripts/install.sh` — installs the folder under
345+/usr/local/lib/razorbill plus a launcher /usr/local/bin/rzb, because rzb needs its bundles next to
346+it (copying it alone was rejected; a symlink was rejected because bundle lookup through a symlink
347+is unverified). Tested on Linux with `--no-build --prefix` (install, reinstall, uninstall, refusal
348+on a foreign rzb); not yet run on the Mac. Docs EN+FR (build guide "Install", README, release
349+how-to, release notes). Gate PASS, links OK. main fast-forwarded, local tag v0.2.0. The Mac run of
350+scripts/release.sh and scripts/compat.sh was not reported by the user.
modified .memory/summary.md +7 -3
@@ -91,8 +91,8 @@ server (tutorial, 10 how-to, 4 reference incl. `http-api.md` / `api-http.md`, 5
9191 `BAAI/bge-small-en-v1.5` are mapped to `chat` / `embed`): keep reference examples in that form, and
9292 only successful calls in ```bash blocks. v0.2 tickets #31–#45 closed; #47 (KV-cache spike)
9393 moved out of the milestone (no milestone, tasks 3–6 open). Release 0.2.0 prepared 2026-11-26: version
94-string `0.2.0`, milestone v0.2 closed, notes in `release-notes/v0.2.0.md` / `.fr.md`; not tagged yet
95-(the user builds the archive on the Mac first).
94+string `0.2.0`, milestone v0.2 closed, notes in `release-notes/v0.2.0.md` / `.fr.md`; tagged `v0.2.0`
95+(local tag, not pushed) on 2026-11-26 at the user's "ok pour v0.2".
9696
9797 KV cache (#47 spike, tasks 1–2 done, report = comment 1 on #47; implemented in #48): `MLXEngine`
9898 keeps one KV cache per loaded model (`PromptCache`, `Sources/RazorbillMLX/PromptCache.swift`) with
@@ -203,7 +203,11 @@ everything but MLX; Mac: `xcodebuild test -scheme razorbill`). Xcode scheme is `
203203 (keep it next to `mlx-swift_Cmlx.bundle`).
204204 **Release archive**: `scripts/release.sh` (Mac: Release build into `.build/release`, then
205205 `dist/razorbill-<version>-macos-arm64.tar.gz` + `.sha256` with `rzb` and every `*.bundle`; refuses a
206-dirty tree unless `--allow-dirty`; `--products <dir>` packages an existing build, also from Linux). From the sandbox: `tools/host-runner/host.sh build|test .
206+dirty tree unless `--allow-dirty`; `--products <dir>` packages an existing build, also from Linux).
207+**Install on the Mac**: `scripts/install.sh` (incremental Release build in `.build/xcode`, copies rzb +
208+bundles to `<prefix>/lib/razorbill`, writes a launcher `<prefix>/bin/rzb` that execs it — a copy of
209+rzb alone would not find its bundles; prefix `/usr/local`, sudo only if not writable; `--no-build`,
210+`--prefix`, `--uninstall`; never touches an rzb launcher without its marker line). From the sandbox: `tools/host-runner/host.sh build|test .
207211 razorbill`, `host.sh run . rzb <args>` (no TTY: `rzb run` only); host-runner tests run in Debug
208212 (`@testable import`). Sandbox started on the Mac with `sbx env run --force` (`sbxenv.yaml`).
209213 Lint: `swiftlint lint --quiet Sources Tests` and `swift-format` (4 spaces); keep wrapped
@@ -91,8 +91,8 @@ server (tutorial, 10 how-to, 4 reference incl. `http-api.md` / `api-http.md`, 5
91 `BAAI/bge-small-en-v1.5` are mapped to `chat` / `embed`): keep reference examples in that form, and91 `BAAI/bge-small-en-v1.5` are mapped to `chat` / `embed`): keep reference examples in that form, and
92 only successful calls in ```bash blocks. v0.2 tickets #31–#45 closed; #47 (KV-cache spike)92 only successful calls in ```bash blocks. v0.2 tickets #31–#45 closed; #47 (KV-cache spike)
93 moved out of the milestone (no milestone, tasks 3–6 open). Release 0.2.0 prepared 2026-11-26: version93 moved out of the milestone (no milestone, tasks 3–6 open). Release 0.2.0 prepared 2026-11-26: version
94-string `0.2.0`, milestone v0.2 closed, notes in `release-notes/v0.2.0.md` / `.fr.md`; not tagged yet94+string `0.2.0`, milestone v0.2 closed, notes in `release-notes/v0.2.0.md` / `.fr.md`; tagged `v0.2.0`
95-(the user builds the archive on the Mac first).95+(local tag, not pushed) on 2026-11-26 at the user's "ok pour v0.2".
96 96
97 KV cache (#47 spike, tasks 1–2 done, report = comment 1 on #47; implemented in #48): `MLXEngine`97 KV cache (#47 spike, tasks 1–2 done, report = comment 1 on #47; implemented in #48): `MLXEngine`
98 keeps one KV cache per loaded model (`PromptCache`, `Sources/RazorbillMLX/PromptCache.swift`) with98 keeps one KV cache per loaded model (`PromptCache`, `Sources/RazorbillMLX/PromptCache.swift`) with
@@ -203,7 +203,11 @@ everything but MLX; Mac: `xcodebuild test -scheme razorbill`). Xcode scheme is `
203 (keep it next to `mlx-swift_Cmlx.bundle`).203 (keep it next to `mlx-swift_Cmlx.bundle`).
204 **Release archive**: `scripts/release.sh` (Mac: Release build into `.build/release`, then204 **Release archive**: `scripts/release.sh` (Mac: Release build into `.build/release`, then
205 `dist/razorbill-<version>-macos-arm64.tar.gz` + `.sha256` with `rzb` and every `*.bundle`; refuses a205 `dist/razorbill-<version>-macos-arm64.tar.gz` + `.sha256` with `rzb` and every `*.bundle`; refuses a
206-dirty tree unless `--allow-dirty`; `--products <dir>` packages an existing build, also from Linux). From the sandbox: `tools/host-runner/host.sh build|test .206+dirty tree unless `--allow-dirty`; `--products <dir>` packages an existing build, also from Linux).
207+**Install on the Mac**: `scripts/install.sh` (incremental Release build in `.build/xcode`, copies rzb +
208+bundles to `<prefix>/lib/razorbill`, writes a launcher `<prefix>/bin/rzb` that execs it — a copy of
209+rzb alone would not find its bundles; prefix `/usr/local`, sudo only if not writable; `--no-build`,
210+`--prefix`, `--uninstall`; never touches an rzb launcher without its marker line). From the sandbox: `tools/host-runner/host.sh build|test .
207 razorbill`, `host.sh run . rzb <args>` (no TTY: `rzb run` only); host-runner tests run in Debug211 razorbill`, `host.sh run . rzb <args>` (no TTY: `rzb run` only); host-runner tests run in Debug
208 (`@testable import`). Sandbox started on the Mac with `sbx env run --force` (`sbxenv.yaml`).212 (`@testable import`). Sandbox started on the Mac with `sbx env run --force` (`sbxenv.yaml`).
209 Lint: `swiftlint lint --quiet Sources Tests` and `swift-format` (4 spaces); keep wrapped213 Lint: `swiftlint lint --quiet Sources Tests` and `swift-format` (4 spaces); keep wrapped
modified .quality/history.jsonl +1 -0
@@ -27,3 +27,4 @@
2727 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "a485576", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10665, "loc": 8489}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 27, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-25T22:01:44Z"}
2828 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "a485576", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10669, "loc": 8492}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 28, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-25T22:03:59Z"}
2929 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "17b9753", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10669, "loc": 8492}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 29, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T04:34:58Z"}
30+{"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "a218748", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10669, "loc": 8492}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 30, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T05:21:18Z"}
@@ -27,3 +27,4 @@
27 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "a485576", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10665, "loc": 8489}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 27, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-25T22:01:44Z"}27 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "a485576", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10665, "loc": 8489}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 27, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-25T22:01:44Z"}
28 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "a485576", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10669, "loc": 8492}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 28, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-25T22:03:59Z"}28 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "a485576", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10669, "loc": 8492}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 28, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-25T22:03:59Z"}
29 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "17b9753", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10669, "loc": 8492}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 29, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T04:34:58Z"}29 {"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "17b9753", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10669, "loc": 8492}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 29, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T04:34:58Z"}
30+{"branch": "feature/v0.2-openai-server", "breaches": [], "commit": "a218748", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 234, "complex": 546, "cyclo": 604, "fields": 1209, "funcs": 582, "lcom": 115, "lines": 10669, "loc": 8492}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 30, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T05:21:18Z"}
added .quality/report-20261126T052118Z.md +73 -0
new file mode 100644
@@ -0,0 +1,73 @@
1+# Quality report — 2026-11-26T05:21:18Z
2+
3+- **Gate**: ✅ **PASS**
4+- **Commit**: `a218748` on `feature/v0.2-openai-server`
5+- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6+- **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7+- **Run**: #30 (previous: 2026-11-26T04:34:58Z)
8+
9+## Lint issues (`qlty check`)
10+
11+_none_
12+
13+### Top rules
14+
15+_none_
16+
17+### Most affected files
18+
19+_none_
20+
21+## Code smells (`qlty smells`)
22+
23+Total: **0** (vs previous: ±0)
24+
25+_none_
26+
27+## Metrics (`qlty metrics`)
28+
29+| metric | total | vs previous |
30+|---|---|---|
31+| funcs | 582 | ±0 |
32+| classes | 234 | ±0 |
33+| fields | 1209 | ±0 |
34+| cyclo | 604 | ±0 |
35+| complex | 546 | ±0 |
36+| lcom | 115 | ±0 |
37+| lines | 10669 | ±0 |
38+| loc | 8492 | ±0 |
39+
40+### Most complex files
41+
42+| file | complex | cyclo | loc |
43+|---|---|---|---|
44+| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 242 |
45+| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
46+| samples/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
47+| Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 |
48+| tools/host-runner/host_runner.py | 22 | 22 | 141 |
49+| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
50+| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |
51+| Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 |
52+| Sources/RazorbillServer/Chat/ChatCompletionRequest.swift | 17 | 24 | 276 |
53+| Sources/RazorbillServer/Chat/ChatCompletionChunk.swift | 16 | 11 | 137 |
54+| Sources/RazorbillServer/ModelManager.swift | 16 | 22 | 220 |
55+| Sources/RazorbillCore/Config/OrderedJSONReader.swift | 15 | 24 | 140 |
56+| Sources/RazorbillCore/Config/GenerationOverrides.swift | 14 | 15 | 67 |
57+| Sources/RazorbillCLI/Commands/ModelsCommand.swift | 13 | 7 | 100 |
58+| Sources/RazorbillServer/EmbeddingsRoute.swift | 13 | 13 | 143 |
59+
60+## Trend
61+
62+| run | timestamp | error | warning | smells | complex | gate |
63+|---|---|---|---|---|---|---|
64+| 21 | 2026-11-25T19:12:45Z | 0 | 0 | 0 | 512 | PASS |
65+| 22 | 2026-11-25T21:27:49Z | 4 | 1 | 0 | 538 | FAIL |
66+| 23 | 2026-11-25T21:28:10Z | 0 | 0 | 0 | 538 | PASS |
67+| 24 | 2026-11-25T21:37:24Z | 0 | 1 | 1 | 559 | FAIL |
68+| 25 | 2026-11-25T21:37:51Z | 0 | 1 | 0 | 544 | FAIL |
69+| 26 | 2026-11-25T21:38:24Z | 0 | 0 | 0 | 544 | PASS |
70+| 27 | 2026-11-25T22:01:44Z | 0 | 0 | 0 | 546 | PASS |
71+| 28 | 2026-11-25T22:03:59Z | 0 | 0 | 0 | 546 | PASS |
72+| 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS |
73+| 30 | 2026-11-26T05:21:18Z | 0 | 0 | 0 | 546 | PASS |
new file mode 100644
@@ -0,0 +1,73 @@
1+# Quality report — 2026-11-26T05:21:18Z
2+
3+- **Gate**: ✅ **PASS**
4+- **Commit**: `a218748` on `feature/v0.2-openai-server`
5+- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6+- **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7+- **Run**: #30 (previous: 2026-11-26T04:34:58Z)
8+
9+## Lint issues (`qlty check`)
10+
11+_none_
12+
13+### Top rules
14+
15+_none_
16+
17+### Most affected files
18+
19+_none_
20+
21+## Code smells (`qlty smells`)
22+
23+Total: **0** (vs previous: ±0)
24+
25+_none_
26+
27+## Metrics (`qlty metrics`)
28+
29+| metric | total | vs previous |
30+|---|---|---|
31+| funcs | 582 | ±0 |
32+| classes | 234 | ±0 |
33+| fields | 1209 | ±0 |
34+| cyclo | 604 | ±0 |
35+| complex | 546 | ±0 |
36+| lcom | 115 | ±0 |
37+| lines | 10669 | ±0 |
38+| loc | 8492 | ±0 |
39+
40+### Most complex files
41+
42+| file | complex | cyclo | loc |
43+|---|---|---|---|
44+| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 242 |
45+| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
46+| samples/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
47+| Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 |
48+| tools/host-runner/host_runner.py | 22 | 22 | 141 |
49+| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
50+| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |
51+| Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 |
52+| Sources/RazorbillServer/Chat/ChatCompletionRequest.swift | 17 | 24 | 276 |
53+| Sources/RazorbillServer/Chat/ChatCompletionChunk.swift | 16 | 11 | 137 |
54+| Sources/RazorbillServer/ModelManager.swift | 16 | 22 | 220 |
55+| Sources/RazorbillCore/Config/OrderedJSONReader.swift | 15 | 24 | 140 |
56+| Sources/RazorbillCore/Config/GenerationOverrides.swift | 14 | 15 | 67 |
57+| Sources/RazorbillCLI/Commands/ModelsCommand.swift | 13 | 7 | 100 |
58+| Sources/RazorbillServer/EmbeddingsRoute.swift | 13 | 13 | 143 |
59+
60+## Trend
61+
62+| run | timestamp | error | warning | smells | complex | gate |
63+|---|---|---|---|---|---|---|
64+| 21 | 2026-11-25T19:12:45Z | 0 | 0 | 0 | 512 | PASS |
65+| 22 | 2026-11-25T21:27:49Z | 4 | 1 | 0 | 538 | FAIL |
66+| 23 | 2026-11-25T21:28:10Z | 0 | 0 | 0 | 538 | PASS |
67+| 24 | 2026-11-25T21:37:24Z | 0 | 1 | 1 | 559 | FAIL |
68+| 25 | 2026-11-25T21:37:51Z | 0 | 1 | 0 | 544 | FAIL |
69+| 26 | 2026-11-25T21:38:24Z | 0 | 0 | 0 | 544 | PASS |
70+| 27 | 2026-11-25T22:01:44Z | 0 | 0 | 0 | 546 | PASS |
71+| 28 | 2026-11-25T22:03:59Z | 0 | 0 | 0 | 546 | PASS |
72+| 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS |
73+| 30 | 2026-11-26T05:21:18Z | 0 | 0 | 0 | 546 | PASS |
modified .quality/report-latest.md +4 -4
@@ -1,10 +1,10 @@
1-# Quality report — 2026-11-26T04:34:58Z
1+# Quality report — 2026-11-26T05:21:18Z
22
33 - **Gate**: ✅ **PASS**
4-- **Commit**: `17b9753` on `feature/v0.2-openai-server`
4+- **Commit**: `a218748` on `feature/v0.2-openai-server`
55 - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
66 - **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7-- **Run**: #29 (previous: 2026-11-25T22:03:59Z)
7+- **Run**: #30 (previous: 2026-11-26T04:34:58Z)
88
99 ## Lint issues (`qlty check`)
1010
@@ -61,7 +61,6 @@ _none_
6161
6262 | run | timestamp | error | warning | smells | complex | gate |
6363 |---|---|---|---|---|---|---|
64-| 20 | 2026-11-25T18:44:58Z | 0 | 0 | 0 | 512 | PASS |
6564 | 21 | 2026-11-25T19:12:45Z | 0 | 0 | 0 | 512 | PASS |
6665 | 22 | 2026-11-25T21:27:49Z | 4 | 1 | 0 | 538 | FAIL |
6766 | 23 | 2026-11-25T21:28:10Z | 0 | 0 | 0 | 538 | PASS |
@@ -71,3 +70,4 @@ _none_
7170 | 27 | 2026-11-25T22:01:44Z | 0 | 0 | 0 | 546 | PASS |
7271 | 28 | 2026-11-25T22:03:59Z | 0 | 0 | 0 | 546 | PASS |
7372 | 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS |
73+| 30 | 2026-11-26T05:21:18Z | 0 | 0 | 0 | 546 | PASS |
@@ -1,10 +1,10 @@
1-# Quality report — 2026-11-26T04:34:58Z1+# Quality report — 2026-11-26T05:21:18Z
2 2
3 - **Gate**: ✅ **PASS**3 - **Gate**: ✅ **PASS**
4-- **Commit**: `17b9753` on `feature/v0.2-openai-server`4+- **Commit**: `a218748` on `feature/v0.2-openai-server`
5 - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)5 - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6 - **swiftlint**: 0.65.1 (run directly, merged into lint issues)6 - **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7-- **Run**: #29 (previous: 2026-11-25T22:03:59Z)7+- **Run**: #30 (previous: 2026-11-26T04:34:58Z)
8 8
9 ## Lint issues (`qlty check`)9 ## Lint issues (`qlty check`)
10 10
@@ -61,7 +61,6 @@ _none_
61 61
62 | run | timestamp | error | warning | smells | complex | gate |62 | run | timestamp | error | warning | smells | complex | gate |
63 |---|---|---|---|---|---|---|63 |---|---|---|---|---|---|---|
64-| 20 | 2026-11-25T18:44:58Z | 0 | 0 | 0 | 512 | PASS |
65 | 21 | 2026-11-25T19:12:45Z | 0 | 0 | 0 | 512 | PASS |64 | 21 | 2026-11-25T19:12:45Z | 0 | 0 | 0 | 512 | PASS |
66 | 22 | 2026-11-25T21:27:49Z | 4 | 1 | 0 | 538 | FAIL |65 | 22 | 2026-11-25T21:27:49Z | 4 | 1 | 0 | 538 | FAIL |
67 | 23 | 2026-11-25T21:28:10Z | 0 | 0 | 0 | 538 | PASS |66 | 23 | 2026-11-25T21:28:10Z | 0 | 0 | 0 | 538 | PASS |
@@ -71,3 +70,4 @@ _none_
71 | 27 | 2026-11-25T22:01:44Z | 0 | 0 | 0 | 546 | PASS |70 | 27 | 2026-11-25T22:01:44Z | 0 | 0 | 0 | 546 | PASS |
72 | 28 | 2026-11-25T22:03:59Z | 0 | 0 | 0 | 546 | PASS |71 | 28 | 2026-11-25T22:03:59Z | 0 | 0 | 0 | 546 | PASS |
73 | 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS |72 | 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS |
73+| 30 | 2026-11-26T05:21:18Z | 0 | 0 | 0 | 546 | PASS |
modified README.md +2 -0
@@ -89,6 +89,8 @@ xcodebuild build -scheme razorbill -destination 'platform=macOS' -configuration
8989
9090 The first build downloads and compiles the dependencies and takes several minutes. Run `rzb` from `Build/Products/Release`: the MLX Metal library (`mlx-swift_Cmlx.bundle`) sits next to it.
9191
92+`scripts/install.sh` builds and installs `rzb` under `/usr/local` (launcher in `/usr/local/bin`), so it runs from any folder: see [Build rzb on the Mac](docs/en/how-to/build-on-the-mac.md#install).
93+
9294 `scripts/release.sh` builds and packages a release archive (`dist/razorbill-<version>-macos-arm64.tar.gz`): see [Package a release](docs/en/how-to/package-a-release.md).
9395
9496 ## Run the tests
@@ -89,6 +89,8 @@ xcodebuild build -scheme razorbill -destination 'platform=macOS' -configuration
89 89
90 The first build downloads and compiles the dependencies and takes several minutes. Run `rzb` from `Build/Products/Release`: the MLX Metal library (`mlx-swift_Cmlx.bundle`) sits next to it.90 The first build downloads and compiles the dependencies and takes several minutes. Run `rzb` from `Build/Products/Release`: the MLX Metal library (`mlx-swift_Cmlx.bundle`) sits next to it.
91 91
92+`scripts/install.sh` builds and installs `rzb` under `/usr/local` (launcher in `/usr/local/bin`), so it runs from any folder: see [Build rzb on the Mac](docs/en/how-to/build-on-the-mac.md#install).
93+
92 `scripts/release.sh` builds and packages a release archive (`dist/razorbill-<version>-macos-arm64.tar.gz`): see [Package a release](docs/en/how-to/package-a-release.md).94 `scripts/release.sh` builds and packages a release archive (`dist/razorbill-<version>-macos-arm64.tar.gz`): see [Package a release](docs/en/how-to/package-a-release.md).
93 95
94 ## Run the tests96 ## Run the tests
modified docs/en/how-to/build-on-the-mac.md +19 -0
@@ -28,6 +28,25 @@ The executable is `.build/xcode/Build/Products/Release/rzb`. Keep it in that fol
2828 # rzb 0.2.0 (engines: fake, mlx)
2929 ```
3030
31+## Install
32+
33+To run `rzb` from any folder, build and install in one command:
34+
35+```bash
36+scripts/install.sh
37+rzb version
38+```
39+
40+It builds in Release (incrementally, in `.build/xcode`), copies `rzb` and its bundles to `/usr/local/lib/razorbill`, and writes `/usr/local/bin/rzb`, a two-line launcher that runs it from there; `rzb` cannot be copied alone into `/usr/local/bin` because it loads its bundles from its own folder. It asks for your password through `sudo` when `/usr/local` is not writable. Run it again after each `git pull` to update.
41+
42+| Option | Effect |
43+| --- | --- |
44+| `--no-build` | Install the last build without rebuilding. |
45+| `--prefix <dir>` | Install under `<dir>/lib/razorbill` and `<dir>/bin` instead of `/usr/local` (e.g. `~/.local`, no `sudo`). |
46+| `--uninstall` | Remove what the script installed. |
47+
48+The script never overwrites or removes an `rzb` launcher it did not write.
49+
3150 ## Variants
3251
3352 - **Debug build**: replace `-configuration Release` with `-configuration Debug`; the executable is then in `Build/Products/Debug`. Generation is much slower.
@@ -28,6 +28,25 @@ The executable is `.build/xcode/Build/Products/Release/rzb`. Keep it in that fol
28 # rzb 0.2.0 (engines: fake, mlx)28 # rzb 0.2.0 (engines: fake, mlx)
29 ```29 ```
30 30
31+## Install
32+
33+To run `rzb` from any folder, build and install in one command:
34+
35+```bash
36+scripts/install.sh
37+rzb version
38+```
39+
40+It builds in Release (incrementally, in `.build/xcode`), copies `rzb` and its bundles to `/usr/local/lib/razorbill`, and writes `/usr/local/bin/rzb`, a two-line launcher that runs it from there; `rzb` cannot be copied alone into `/usr/local/bin` because it loads its bundles from its own folder. It asks for your password through `sudo` when `/usr/local` is not writable. Run it again after each `git pull` to update.
41+
42+| Option | Effect |
43+| --- | --- |
44+| `--no-build` | Install the last build without rebuilding. |
45+| `--prefix <dir>` | Install under `<dir>/lib/razorbill` and `<dir>/bin` instead of `/usr/local` (e.g. `~/.local`, no `sudo`). |
46+| `--uninstall` | Remove what the script installed. |
47+
48+The script never overwrites or removes an `rzb` launcher it did not write.
49+
31 ## Variants50 ## Variants
32 51
33 - **Debug build**: replace `-configuration Release` with `-configuration Debug`; the executable is then in `Build/Products/Debug`. Generation is much slower.52 - **Debug build**: replace `-configuration Release` with `-configuration Debug`; the executable is then in `Build/Products/Debug`. Generation is much slower.
modified docs/en/how-to/package-a-release.md +1 -1
@@ -30,7 +30,7 @@ This guide builds the release archive of razorbill: `rzb` and the resource bundl
3030 | `swift-transformers_Hub.bundle`, `swift-nio_*.bundle`, `swift-crypto_Crypto.bundle` | The other resource bundles of the dependencies. The script copies every `*.bundle` of the build. |
3131 | `INSTALL.txt` | Where to put the folder, how to add it to `PATH`, how to clear the quarantine. |
3232
33-The bundles must stay next to `rzb`: put the whole folder on `PATH` rather than copying `rzb` alone into `/usr/local/bin`.
33+The bundles must stay next to `rzb`: put the whole folder on `PATH` rather than copying `rzb` alone into `/usr/local/bin`. On a Mac with the sources, `scripts/install.sh` does this for you ([Build rzb on the Mac](build-on-the-mac.md#install)).
3434
3535 ## Variants
3636
@@ -30,7 +30,7 @@ This guide builds the release archive of razorbill: `rzb` and the resource bundl
30 | `swift-transformers_Hub.bundle`, `swift-nio_*.bundle`, `swift-crypto_Crypto.bundle` | The other resource bundles of the dependencies. The script copies every `*.bundle` of the build. |30 | `swift-transformers_Hub.bundle`, `swift-nio_*.bundle`, `swift-crypto_Crypto.bundle` | The other resource bundles of the dependencies. The script copies every `*.bundle` of the build. |
31 | `INSTALL.txt` | Where to put the folder, how to add it to `PATH`, how to clear the quarantine. |31 | `INSTALL.txt` | Where to put the folder, how to add it to `PATH`, how to clear the quarantine. |
32 32
33-The bundles must stay next to `rzb`: put the whole folder on `PATH` rather than copying `rzb` alone into `/usr/local/bin`.33+The bundles must stay next to `rzb`: put the whole folder on `PATH` rather than copying `rzb` alone into `/usr/local/bin`. On a Mac with the sources, `scripts/install.sh` does this for you ([Build rzb on the Mac](build-on-the-mac.md#install)).
34 34
35 ## Variants35 ## Variants
36 36
modified docs/fr/how-to/compiler-sur-le-mac.md +19 -0
@@ -28,6 +28,25 @@ L'exécutable est `.build/xcode/Build/Products/Release/rzb`. Laissez-le dans ce
2828 # rzb 0.2.0 (engines: fake, mlx)
2929 ```
3030
31+## Installer
32+
33+Pour lancer `rzb` depuis n'importe quel dossier, compilez et installez en une commande :
34+
35+```bash
36+scripts/install.sh
37+rzb version
38+```
39+
40+Le script compile en Release (de façon incrémentale, dans `.build/xcode`), copie `rzb` et ses bundles dans `/usr/local/lib/razorbill`, et écrit `/usr/local/bin/rzb`, un lanceur de deux lignes qui l'exécute depuis ce dossier ; `rzb` ne peut pas être copié seul dans `/usr/local/bin`, car il charge ses bundles depuis son propre dossier. Il demande votre mot de passe via `sudo` quand `/usr/local` n'est pas accessible en écriture. Relancez-le après chaque `git pull` pour mettre à jour.
41+
42+| Option | Effet |
43+| --- | --- |
44+| `--no-build` | Installe la dernière compilation sans recompiler. |
45+| `--prefix <dossier>` | Installe dans `<dossier>/lib/razorbill` et `<dossier>/bin` au lieu de `/usr/local` (par exemple `~/.local`, sans `sudo`). |
46+| `--uninstall` | Retire ce que le script a installé. |
47+
48+Le script n'écrase ni ne supprime jamais un lanceur `rzb` qu'il n'a pas écrit.
49+
3150 ## Variantes
3251
3352 - **Compilation Debug** : remplacez `-configuration Release` par `-configuration Debug` ; l'exécutable est alors dans `Build/Products/Debug`. La génération est beaucoup plus lente.
@@ -28,6 +28,25 @@ L'exécutable est `.build/xcode/Build/Products/Release/rzb`. Laissez-le dans ce
28 # rzb 0.2.0 (engines: fake, mlx)28 # rzb 0.2.0 (engines: fake, mlx)
29 ```29 ```
30 30
31+## Installer
32+
33+Pour lancer `rzb` depuis n'importe quel dossier, compilez et installez en une commande :
34+
35+```bash
36+scripts/install.sh
37+rzb version
38+```
39+
40+Le script compile en Release (de façon incrémentale, dans `.build/xcode`), copie `rzb` et ses bundles dans `/usr/local/lib/razorbill`, et écrit `/usr/local/bin/rzb`, un lanceur de deux lignes qui l'exécute depuis ce dossier ; `rzb` ne peut pas être copié seul dans `/usr/local/bin`, car il charge ses bundles depuis son propre dossier. Il demande votre mot de passe via `sudo` quand `/usr/local` n'est pas accessible en écriture. Relancez-le après chaque `git pull` pour mettre à jour.
41+
42+| Option | Effet |
43+| --- | --- |
44+| `--no-build` | Installe la dernière compilation sans recompiler. |
45+| `--prefix <dossier>` | Installe dans `<dossier>/lib/razorbill` et `<dossier>/bin` au lieu de `/usr/local` (par exemple `~/.local`, sans `sudo`). |
46+| `--uninstall` | Retire ce que le script a installé. |
47+
48+Le script n'écrase ni ne supprime jamais un lanceur `rzb` qu'il n'a pas écrit.
49+
31 ## Variantes50 ## Variantes
32 51
33 - **Compilation Debug** : remplacez `-configuration Release` par `-configuration Debug` ; l'exécutable est alors dans `Build/Products/Debug`. La génération est beaucoup plus lente.52 - **Compilation Debug** : remplacez `-configuration Release` par `-configuration Debug` ; l'exécutable est alors dans `Build/Products/Debug`. La génération est beaucoup plus lente.
modified docs/fr/how-to/preparer-une-release.md +1 -1
@@ -30,7 +30,7 @@ Ce guide fabrique l'archive de release de razorbill : `rzb` et les bundles de re
3030 | `swift-transformers_Hub.bundle`, `swift-nio_*.bundle`, `swift-crypto_Crypto.bundle` | Les autres bundles de ressources des dépendances. Le script copie tous les `*.bundle` de la compilation. |
3131 | `INSTALL.txt` | Où placer le dossier, comment l'ajouter au `PATH`, comment lever la quarantaine. |
3232
33-Les bundles doivent rester à côté de `rzb` : mettez le dossier entier dans le `PATH` plutôt que de copier `rzb` seul dans `/usr/local/bin`.
33+Les bundles doivent rester à côté de `rzb` : mettez le dossier entier dans le `PATH` plutôt que de copier `rzb` seul dans `/usr/local/bin`. Sur un Mac avec les sources, `scripts/install.sh` le fait pour vous ([Compiler rzb sur le Mac](compiler-sur-le-mac.md#installer)).
3434
3535 ## Variantes
3636
@@ -30,7 +30,7 @@ Ce guide fabrique l'archive de release de razorbill : `rzb` et les bundles de re
30 | `swift-transformers_Hub.bundle`, `swift-nio_*.bundle`, `swift-crypto_Crypto.bundle` | Les autres bundles de ressources des dépendances. Le script copie tous les `*.bundle` de la compilation. |30 | `swift-transformers_Hub.bundle`, `swift-nio_*.bundle`, `swift-crypto_Crypto.bundle` | Les autres bundles de ressources des dépendances. Le script copie tous les `*.bundle` de la compilation. |
31 | `INSTALL.txt` | Où placer le dossier, comment l'ajouter au `PATH`, comment lever la quarantaine. |31 | `INSTALL.txt` | Où placer le dossier, comment l'ajouter au `PATH`, comment lever la quarantaine. |
32 32
33-Les bundles doivent rester à côté de `rzb` : mettez le dossier entier dans le `PATH` plutôt que de copier `rzb` seul dans `/usr/local/bin`.33+Les bundles doivent rester à côté de `rzb` : mettez le dossier entier dans le `PATH` plutôt que de copier `rzb` seul dans `/usr/local/bin`. Sur un Mac avec les sources, `scripts/install.sh` le fait pour vous ([Compiler rzb sur le Mac](compiler-sur-le-mac.md#installer)).
34 34
35 ## Variantes35 ## Variantes
36 36
modified release-notes/v0.2.0.fr.md +1 -1
@@ -14,7 +14,7 @@ razorbill devient un serveur de modèles pour Apple Silicon : `rzb serve` fait t
1414 - Le cache KV de la requête précédente est réutilisé quand le prompt suivant commence pareil (`usage.prompt_tokens_details.cached_tokens`) : une longue conversation ne relit plus tout son historique.
1515 - Échantillonnage : `top_k`, `min_p`, `repetition_penalty`, `repetition_context_size` en plus des champs d'OpenAI.
1616 - Suite de compatibilité OpenAI (`scripts/compat.sh` : bibliothèque `openai`, LangChain, `curl`).
17-- `scripts/release.sh` : archive de release avec empreinte.
17+- `scripts/release.sh` : archive de release avec empreinte ; `scripts/install.sh` : compilation et installation sous `/usr/local`.
1818
1919 ## Installation
2020
@@ -14,7 +14,7 @@ razorbill devient un serveur de modèles pour Apple Silicon : `rzb serve` fait t
14 - Le cache KV de la requête précédente est réutilisé quand le prompt suivant commence pareil (`usage.prompt_tokens_details.cached_tokens`) : une longue conversation ne relit plus tout son historique.14 - Le cache KV de la requête précédente est réutilisé quand le prompt suivant commence pareil (`usage.prompt_tokens_details.cached_tokens`) : une longue conversation ne relit plus tout son historique.
15 - Échantillonnage : `top_k`, `min_p`, `repetition_penalty`, `repetition_context_size` en plus des champs d'OpenAI.15 - Échantillonnage : `top_k`, `min_p`, `repetition_penalty`, `repetition_context_size` en plus des champs d'OpenAI.
16 - Suite de compatibilité OpenAI (`scripts/compat.sh` : bibliothèque `openai`, LangChain, `curl`).16 - Suite de compatibilité OpenAI (`scripts/compat.sh` : bibliothèque `openai`, LangChain, `curl`).
17-- `scripts/release.sh` : archive de release avec empreinte.17+- `scripts/release.sh` : archive de release avec empreinte ; `scripts/install.sh` : compilation et installation sous `/usr/local`.
18 18
19 ## Installation19 ## Installation
20 20
modified release-notes/v0.2.0.md +1 -1
@@ -14,7 +14,7 @@ razorbill becomes a model server for Apple Silicon: `rzb serve` runs MLX models
1414 - The KV cache of the previous request is reused when the next prompt starts the same way (`usage.prompt_tokens_details.cached_tokens`): long conversations no longer re-read their whole history.
1515 - Sampling: `top_k`, `min_p`, `repetition_penalty`, `repetition_context_size` besides OpenAI's fields.
1616 - OpenAI compatibility suite (`scripts/compat.sh`: `openai` library, LangChain, `curl`).
17-- `scripts/release.sh`: release archive with checksum.
17+- `scripts/release.sh`: release archive with checksum; `scripts/install.sh`: build and install under `/usr/local`.
1818
1919 ## Install
2020
@@ -14,7 +14,7 @@ razorbill becomes a model server for Apple Silicon: `rzb serve` runs MLX models
14 - The KV cache of the previous request is reused when the next prompt starts the same way (`usage.prompt_tokens_details.cached_tokens`): long conversations no longer re-read their whole history.14 - The KV cache of the previous request is reused when the next prompt starts the same way (`usage.prompt_tokens_details.cached_tokens`): long conversations no longer re-read their whole history.
15 - Sampling: `top_k`, `min_p`, `repetition_penalty`, `repetition_context_size` besides OpenAI's fields.15 - Sampling: `top_k`, `min_p`, `repetition_penalty`, `repetition_context_size` besides OpenAI's fields.
16 - OpenAI compatibility suite (`scripts/compat.sh`: `openai` library, LangChain, `curl`).16 - OpenAI compatibility suite (`scripts/compat.sh`: `openai` library, LangChain, `curl`).
17-- `scripts/release.sh`: release archive with checksum.17+- `scripts/release.sh`: release archive with checksum; `scripts/install.sh`: build and install under `/usr/local`.
18 18
19 ## Install19 ## Install
20 20
added scripts/install.sh +88 -0
new file mode 100755
@@ -0,0 +1,88 @@
1+#!/usr/bin/env bash
2+# Build rzb in Release and install it, so that `rzb` works from any folder.
3+#
4+# scripts/install.sh # build, then install under /usr/local
5+# scripts/install.sh --no-build # install the last build as is
6+# scripts/install.sh --prefix ~/.local # install elsewhere (no sudo needed)
7+# scripts/install.sh --uninstall # remove what this script installed
8+#
9+# rzb loads mlx-swift_Cmlx.bundle (the MLX Metal library) and its other resource bundles from
10+# its own folder, so it cannot be copied alone into bin/. The build goes to <prefix>/lib/razorbill
11+# and <prefix>/bin/rzb is a two-line launcher that runs it from there. sudo is used only when the
12+# prefix is not writable.
13+set -euo pipefail
14+cd "$(dirname "$0")/.."
15+
16+prefix=/usr/local
17+build=true
18+uninstall=false
19+while [[ $# -gt 0 ]]; do
20+ case "$1" in
21+ --prefix) prefix="${2:?--prefix needs a directory}"; shift 2 ;;
22+ --no-build) build=false; shift ;;
23+ --uninstall) uninstall=true; shift ;;
24+ -h|--help) sed -n '2,12p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
25+ *) echo "install.sh: unknown option $1 (see --help)" >&2; exit 2 ;;
26+ esac
27+done
28+
29+fail() { echo "install.sh: $*" >&2; exit 1; }
30+
31+products=.build/xcode/Build/Products/Release
32+home="$prefix/lib/razorbill"
33+launcher="$prefix/bin/rzb"
34+marker="# razorbill launcher (scripts/install.sh)"
35+
36+# Runs a command with sudo only when the prefix cannot be written as the current user.
37+as_owner() {
38+ if mkdir -p "$prefix" 2>/dev/null && [[ -w "$prefix" ]]; then "$@"; else sudo "$@"; fi
39+}
40+
41+# Refuses to overwrite or remove an rzb this script did not install.
42+check_launcher() {
43+ if [[ -e "$launcher" ]] && ! grep -qF "$marker" "$launcher" 2>/dev/null; then
44+ fail "$launcher exists and was not installed by this script: remove it first"
45+ fi
46+}
47+
48+if [[ "$uninstall" == true ]]; then
49+ check_launcher
50+ as_owner rm -rf "$home" "$launcher"
51+ echo "removed $home and $launcher"
52+ exit 0
53+fi
54+
55+if [[ "$build" == true ]]; then
56+ [[ "$(uname -s)" == Darwin && "$(uname -m)" == arm64 ]] \
57+ || fail "building needs a Mac with Apple Silicon (or pass --no-build)"
58+ # Same folder as the development build: incremental, so a reinstall only compiles what changed.
59+ xcodebuild build -scheme razorbill -destination 'platform=macOS' -configuration Release \
60+ -derivedDataPath .build/xcode -skipPackagePluginValidation -skipMacroValidation
61+fi
62+
63+[[ -x "$products/rzb" ]] || fail "$products/rzb not found: build first (drop --no-build)"
64+[[ -d "$products/mlx-swift_Cmlx.bundle" ]] \
65+ || fail "$products/mlx-swift_Cmlx.bundle not found (the MLX Metal library)"
66+check_launcher
67+
68+staging=$(mktemp -d)
69+trap 'rm -rf "$staging"' EXIT
70+cp "$products/rzb" "$staging/"
71+for bundle in "$products"/*.bundle; do
72+ cp -R "$bundle" "$staging/"
73+done
74+printf '#!/bin/sh\n%s\nexec "%s/rzb" "$@"\n' "$marker" "$home" > "$staging/launcher"
75+
76+as_owner mkdir -p "$prefix/lib" "$prefix/bin"
77+as_owner rm -rf "$home"
78+as_owner mkdir "$home"
79+as_owner cp -R "$staging"/rzb "$staging"/*.bundle "$home/"
80+as_owner install -m 755 "$staging/launcher" "$launcher"
81+
82+echo "installed $home, launcher $launcher"
83+if [[ "$(uname -s)" == Darwin ]]; then
84+ "$launcher" version
85+fi
86+if [[ "$(command -v rzb || true)" != "$launcher" ]]; then
87+ echo "note: \`rzb\` does not resolve to $launcher; check that $prefix/bin comes first in PATH"
88+fi
new file mode 100755
@@ -0,0 +1,88 @@
1+#!/usr/bin/env bash
2+# Build rzb in Release and install it, so that `rzb` works from any folder.
3+#
4+# scripts/install.sh # build, then install under /usr/local
5+# scripts/install.sh --no-build # install the last build as is
6+# scripts/install.sh --prefix ~/.local # install elsewhere (no sudo needed)
7+# scripts/install.sh --uninstall # remove what this script installed
8+#
9+# rzb loads mlx-swift_Cmlx.bundle (the MLX Metal library) and its other resource bundles from
10+# its own folder, so it cannot be copied alone into bin/. The build goes to <prefix>/lib/razorbill
11+# and <prefix>/bin/rzb is a two-line launcher that runs it from there. sudo is used only when the
12+# prefix is not writable.
13+set -euo pipefail
14+cd "$(dirname "$0")/.."
15+
16+prefix=/usr/local
17+build=true
18+uninstall=false
19+while [[ $# -gt 0 ]]; do
20+ case "$1" in
21+ --prefix) prefix="${2:?--prefix needs a directory}"; shift 2 ;;
22+ --no-build) build=false; shift ;;
23+ --uninstall) uninstall=true; shift ;;
24+ -h|--help) sed -n '2,12p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
25+ *) echo "install.sh: unknown option $1 (see --help)" >&2; exit 2 ;;
26+ esac
27+done
28+
29+fail() { echo "install.sh: $*" >&2; exit 1; }
30+
31+products=.build/xcode/Build/Products/Release
32+home="$prefix/lib/razorbill"
33+launcher="$prefix/bin/rzb"
34+marker="# razorbill launcher (scripts/install.sh)"
35+
36+# Runs a command with sudo only when the prefix cannot be written as the current user.
37+as_owner() {
38+ if mkdir -p "$prefix" 2>/dev/null && [[ -w "$prefix" ]]; then "$@"; else sudo "$@"; fi
39+}
40+
41+# Refuses to overwrite or remove an rzb this script did not install.
42+check_launcher() {
43+ if [[ -e "$launcher" ]] && ! grep -qF "$marker" "$launcher" 2>/dev/null; then
44+ fail "$launcher exists and was not installed by this script: remove it first"
45+ fi
46+}
47+
48+if [[ "$uninstall" == true ]]; then
49+ check_launcher
50+ as_owner rm -rf "$home" "$launcher"
51+ echo "removed $home and $launcher"
52+ exit 0
53+fi
54+
55+if [[ "$build" == true ]]; then
56+ [[ "$(uname -s)" == Darwin && "$(uname -m)" == arm64 ]] \
57+ || fail "building needs a Mac with Apple Silicon (or pass --no-build)"
58+ # Same folder as the development build: incremental, so a reinstall only compiles what changed.
59+ xcodebuild build -scheme razorbill -destination 'platform=macOS' -configuration Release \
60+ -derivedDataPath .build/xcode -skipPackagePluginValidation -skipMacroValidation
61+fi
62+
63+[[ -x "$products/rzb" ]] || fail "$products/rzb not found: build first (drop --no-build)"
64+[[ -d "$products/mlx-swift_Cmlx.bundle" ]] \
65+ || fail "$products/mlx-swift_Cmlx.bundle not found (the MLX Metal library)"
66+check_launcher
67+
68+staging=$(mktemp -d)
69+trap 'rm -rf "$staging"' EXIT
70+cp "$products/rzb" "$staging/"
71+for bundle in "$products"/*.bundle; do
72+ cp -R "$bundle" "$staging/"
73+done
74+printf '#!/bin/sh\n%s\nexec "%s/rzb" "$@"\n' "$marker" "$home" > "$staging/launcher"
75+
76+as_owner mkdir -p "$prefix/lib" "$prefix/bin"
77+as_owner rm -rf "$home"
78+as_owner mkdir "$home"
79+as_owner cp -R "$staging"/rzb "$staging"/*.bundle "$home/"
80+as_owner install -m 755 "$staging/launcher" "$launcher"
81+
82+echo "installed $home, launcher $launcher"
83+if [[ "$(uname -s)" == Darwin ]]; then
84+ "$launcher" version
85+fi
86+if [[ "$(command -v rzb || true)" != "$launcher" ]]; then
87+ echo "note: \`rzb\` does not resolve to $launcher; check that $prefix/bin comes first in PATH"
88+fi