@moondeck/station 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/images/standard/Dockerfile +29 -1
- package/images/standard/README.md +7 -2
- package/images/standard/container/uai-create-node-data +15 -1
- package/images/standard/container/uai-init +45 -0
- package/images/standard/container/uai-materialize-runtimes +109 -6
- package/images/standard/container/uai-repair-node-data.py +188 -74
- package/images/standard/container/uai-write-node-data +71 -0
- package/lib/agent-cli.ts +2 -2
- package/lib/browser-testing.ts +31 -26
- package/lib/codex-auth.ts +89 -92
- package/lib/docker-exec.ts +1 -1
- package/lib/engine-accounts.ts +102 -64
- package/lib/git-identity.ts +49 -20
- package/lib/node-home.fixture.ts +155 -0
- package/lib/node-state.ts +68 -0
- package/lib/orchestrator.ts +17 -12
- package/lib/runtime-archive.ts +1 -0
- package/lib/runtime-authority.ts +98 -1
- package/lib/standard-image.ts +3 -2
- package/lib/task-container-cli.ts +1 -1
- package/lib/task-environment/self.ts +59 -16
- package/lib/task-project-ops.ts +28 -6
- package/package.json +1 -1
- package/scripts/agent/task-up.sh +136 -76
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
#
|
|
10
10
|
# Design points:
|
|
11
11
|
# - Debian bookworm-slim base, non-root `node` user (home /home/node).
|
|
12
|
-
# - asdf at /opt/asdf with plugins for nodejs/python/golang/ruby/rust.
|
|
12
|
+
# - asdf at /opt/asdf with plugins for nodejs/python/golang/ruby/rust/bun.
|
|
13
13
|
# Before Compose starts a task, a host-controlled maintenance container
|
|
14
14
|
# materializes its declared versions into the host-wide /opt/asdf-data
|
|
15
15
|
# volume. uai-init only installs task-local dependencies afterward.
|
|
@@ -29,6 +29,8 @@ FROM debian:bookworm-slim
|
|
|
29
29
|
|
|
30
30
|
# asdf release to clone. Pinned for reproducible builds; bump deliberately.
|
|
31
31
|
ENV ASDF_VERSION=v0.14.1
|
|
32
|
+
ENV ASDF_BUN_PLUGIN_COMMIT=804d9603c473ea616fa078f851fa8380246e2c7a
|
|
33
|
+
ENV MISE_VERSION=2026.11.1
|
|
32
34
|
|
|
33
35
|
# Qualified agent builds. These are execution-contract pins: per-command env
|
|
34
36
|
# freshness is requalified before any of them moves.
|
|
@@ -74,6 +76,7 @@ RUN apt-get update \
|
|
|
74
76
|
procps \
|
|
75
77
|
python3-minimal \
|
|
76
78
|
ripgrep \
|
|
79
|
+
sqlite3 \
|
|
77
80
|
tk-dev \
|
|
78
81
|
tmux \
|
|
79
82
|
unzip \
|
|
@@ -112,6 +115,30 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
|
|
112
115
|
# Installed system-wide so both root and node can run it.
|
|
113
116
|
RUN curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh
|
|
114
117
|
|
|
118
|
+
# mise is opt-in: install its binary on the system PATH, with no activation
|
|
119
|
+
# hook or mise shims. asdf shims retain priority for every managed runtime.
|
|
120
|
+
# Published hashes: https://github.com/jdx/mise/releases/download/v2026.11.1/SHASUMS256.txt
|
|
121
|
+
RUN set -eu; \
|
|
122
|
+
case "$(dpkg --print-architecture)" in \
|
|
123
|
+
amd64) mise_arch=x64; mise_sha256=9c3f740597f5e5815ecb50ec6fafa080e94472d0780220bcb214eb98bd902dca ;; \
|
|
124
|
+
arm64) mise_arch=arm64; mise_sha256=6b54d9223f8bce04f9168ef482d9ee27f219c1ea11f4903569660049e5dec5aa ;; \
|
|
125
|
+
*) echo "unsupported mise architecture" >&2; exit 1 ;; \
|
|
126
|
+
esac; \
|
|
127
|
+
curl -fsSL "https://github.com/jdx/mise/releases/download/v${MISE_VERSION}/mise-v${MISE_VERSION}-linux-${mise_arch}.tar.gz" -o /tmp/mise.tar.gz; \
|
|
128
|
+
echo "$mise_sha256 /tmp/mise.tar.gz" | sha256sum -c -; \
|
|
129
|
+
tar -xzf /tmp/mise.tar.gz -C /tmp mise/bin/mise; \
|
|
130
|
+
install -m 0755 /tmp/mise/bin/mise /usr/local/bin/mise; \
|
|
131
|
+
rm -rf /tmp/mise /tmp/mise.tar.gz; \
|
|
132
|
+
mise --version
|
|
133
|
+
|
|
134
|
+
# Keep an image-local pinned Bun plugin for volumes created before Bun support.
|
|
135
|
+
# Give node ownership so Git permits its local clone (safe-directory ownership
|
|
136
|
+
# checks reject a root-owned source). Apple task edits affect only its overlay.
|
|
137
|
+
RUN git clone https://github.com/cometkim/asdf-bun.git /usr/local/share/uai/asdf-bun \
|
|
138
|
+
&& git -C /usr/local/share/uai/asdf-bun checkout --detach "$ASDF_BUN_PLUGIN_COMMIT" \
|
|
139
|
+
&& test "$(git -C /usr/local/share/uai/asdf-bun rev-parse HEAD)" = "$ASDF_BUN_PLUGIN_COMMIT" \
|
|
140
|
+
&& chown -R 1000:1000 /usr/local/share/uai/asdf-bun
|
|
141
|
+
|
|
115
142
|
# ---------------------------------------------------------------------------
|
|
116
143
|
# 2. Non-root `node` user.
|
|
117
144
|
#
|
|
@@ -232,6 +259,7 @@ RUN bash -lc '\
|
|
|
232
259
|
asdf plugin add golang https://github.com/asdf-community/asdf-golang.git; \
|
|
233
260
|
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git; \
|
|
234
261
|
asdf plugin add rust https://github.com/asdf-community/asdf-rust.git; \
|
|
262
|
+
asdf plugin add bun /usr/local/share/uai/asdf-bun; \
|
|
235
263
|
cd /home/node && asdf install nodejs && asdf install python; \
|
|
236
264
|
'
|
|
237
265
|
|
|
@@ -14,11 +14,16 @@ See [`docs/runtime.md`](../../../docs/runtime.md) for the authoritative spec.
|
|
|
14
14
|
expect `/home/node`.
|
|
15
15
|
- **asdf** at `/opt/asdf`, data dir `/opt/asdf-data` (the host-wide
|
|
16
16
|
`moondeck-asdf-data` volume mounts there read-only in task apps). Plugins
|
|
17
|
-
pre-added for `nodejs`, `python`, `golang`, `ruby`, `rust
|
|
18
|
-
defaults are installed at build time; after worktree resolution, a
|
|
17
|
+
pre-added for `nodejs`, `python`, `golang`, `ruby`, `rust`, `bun` (pinned
|
|
18
|
+
plugin). Only the root defaults are installed at build time; after worktree resolution, a
|
|
19
19
|
host-controlled pre-start maintenance container is the bounded, locked
|
|
20
20
|
read-write user that installs and proves other versions before the task app
|
|
21
21
|
exists.
|
|
22
|
+
- **mise** 2026.11.1 at `/usr/local/bin/mise`, checksum-verified for amd64/arm64.
|
|
23
|
+
It is not activated globally and adds no shims ahead of asdf. Use
|
|
24
|
+
`mise install <tool>@<version>`, then `mise exec -- <cmd>` for skipped tools;
|
|
25
|
+
repositories with `mise.toml` need `mise trust` first.
|
|
26
|
+
- **sqlite3**, the Debian command-line client, alongside `libsqlite3-dev`.
|
|
22
27
|
- **Default `~/.tool-versions`** (asdf's global fallback, at `/home/node`)
|
|
23
28
|
pinning a default Node + Python. The `tool-versions` file in this directory is
|
|
24
29
|
the authoritative source for the numbers; the `Dockerfile` `COPY`s it to
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
# Run only as node.
|
|
2
|
+
# Run only as node. Root never transfers ownership of a directory it finds
|
|
3
|
+
# here (uai-repair-node-data.py): its provenance cannot be proven. A share,
|
|
4
|
+
# OpenCode or state directory an older root-run step left owned by someone
|
|
5
|
+
# else is moved aside by node within its node-owned parent, keeping its owner
|
|
6
|
+
# and mode (nothing inside becomes readable), then recreated node-owned.
|
|
7
|
+
# ~/.local itself holds installed tools and is never moved.
|
|
3
8
|
umask 077
|
|
9
|
+
node_owns() { [ -O "$1" ]; }
|
|
4
10
|
for path in /home/node/.local /home/node/.local/share /home/node/.local/share/opencode /home/node/.local/state; do
|
|
11
|
+
if [ "$path" != /home/node/.local ] && [ -d "$path" ] && [ ! -L "$path" ] && ! node_owns "$path"; then
|
|
12
|
+
aside=$path.uai-not-node-owned.$$.$(/bin/date +%s)
|
|
13
|
+
if /bin/mv -T -- "$path" "$aside"; then
|
|
14
|
+
printf 'node data setup: moved %s aside to %s (not owned by node; root never transfers ownership)\n' "$path" "$aside" >&2
|
|
15
|
+
else
|
|
16
|
+
printf 'node data setup: %s is not owned by node and could not be moved aside; operator inspection required\n' "$path" >&2
|
|
17
|
+
fi
|
|
18
|
+
fi
|
|
5
19
|
/bin/mkdir -p -m 0700 -- "$path" || printf 'node data setup: could not create %s; checking existing directory metadata\n' "$path" >&2
|
|
6
20
|
done
|
|
@@ -99,6 +99,7 @@ export ASDF_PYTHON_VERSION=
|
|
|
99
99
|
export ASDF_GOLANG_VERSION=
|
|
100
100
|
export ASDF_RUBY_VERSION=
|
|
101
101
|
export ASDF_RUST_VERSION=
|
|
102
|
+
export ASDF_BUN_VERSION=
|
|
102
103
|
export ASDF_SKIP_RESHIM=1
|
|
103
104
|
export COREPACK_HOME=/opt/asdf-data/corepack
|
|
104
105
|
export COREPACK_DEFAULT_TO_LATEST=0
|
|
@@ -507,6 +508,49 @@ run_workspace_installs() {
|
|
|
507
508
|
return 0
|
|
508
509
|
}
|
|
509
510
|
|
|
511
|
+
# Synchronous, bounded runtime notes, separate from repository install output.
|
|
512
|
+
# Materialization has a read-only workspace and can only log to Station.
|
|
513
|
+
# Read only safe allowlisted worktrees; never discover extra runtime inputs.
|
|
514
|
+
log_skipped_runtime_tools() {
|
|
515
|
+
local slug manifest line tool shown hint count=0
|
|
516
|
+
local notes_file="$deps_state_dir/runtime-notes" staging
|
|
517
|
+
local -a fields=()
|
|
518
|
+
local -A seen=()
|
|
519
|
+
staging=$(mktemp "$deps_state_dir/.runtime-notes.XXXXXX") || return 0
|
|
520
|
+
# At most 16 entries, each with a 64-character slug and a 128-character
|
|
521
|
+
# tool name: under 8 KiB, regardless of repository install output or reruns.
|
|
522
|
+
while IFS= read -r slug || [ -n "$slug" ]; do
|
|
523
|
+
[[ "$slug" =~ ^[a-z0-9-]{1,64}$ ]] || continue
|
|
524
|
+
[ ! -L "$WORKSPACE/$slug" ] && [ -d "$WORKSPACE/$slug" ] || continue
|
|
525
|
+
manifest="$WORKSPACE/$slug/.tool-versions"
|
|
526
|
+
[ ! -L "$manifest" ] && [ -f "$manifest" ] || continue
|
|
527
|
+
while IFS= read -r line || [ -n "$line" ]; do
|
|
528
|
+
line=${line%%#*}
|
|
529
|
+
read -r -a fields <<< "$line" || true
|
|
530
|
+
[ "${#fields[@]}" -ge 2 ] || continue
|
|
531
|
+
tool=${fields[0]}
|
|
532
|
+
[[ "$tool" =~ ^[a-z0-9][a-z0-9_-]*$ ]] || continue
|
|
533
|
+
case "$tool" in
|
|
534
|
+
nodejs|python|golang|ruby|rust|bun|pnpm|yarn) continue ;;
|
|
535
|
+
esac
|
|
536
|
+
[ -z "${seen[$slug/$tool]:-}" ] || continue
|
|
537
|
+
seen[$slug/$tool]=1
|
|
538
|
+
shown=${tool:0:128}
|
|
539
|
+
[ "${#tool}" -le 128 ] || shown="$shown..."
|
|
540
|
+
hint=""
|
|
541
|
+
case "$tool" in node) hint=" Did you mean nodejs?" ;; go) hint=" Did you mean golang?" ;; esac
|
|
542
|
+
printf '%s\n' "$slug: skipped unsupported tool '$shown'; use mise install <tool>@<version>, then mise exec -- <cmd> (or its vendor installer).$hint" >>"$staging"
|
|
543
|
+
count=$((count + 1))
|
|
544
|
+
[ "$count" -lt 16 ] || break 2
|
|
545
|
+
done < "$manifest"
|
|
546
|
+
done < "$RUNTIME_PROJECTS"
|
|
547
|
+
if [ -s "$staging" ]; then
|
|
548
|
+
mv -fT -- "$staging" "$notes_file"
|
|
549
|
+
else
|
|
550
|
+
rm -f -- "$staging" "$notes_file"
|
|
551
|
+
fi
|
|
552
|
+
}
|
|
553
|
+
|
|
510
554
|
# The detached worker is the only uai-init role that receives project env.
|
|
511
555
|
# Its caller has already used uai-env-exec to perform one authenticated
|
|
512
556
|
# refresh; this role does no editor or Git-control-plane work and exits after
|
|
@@ -526,6 +570,7 @@ if [ -d "$WORKSPACE" ] && [ -f "$RUNTIME_PROJECTS" ] \
|
|
|
526
570
|
deps_log_file="$deps_state_dir/deps.log"
|
|
527
571
|
deps_lock_dir="$deps_state_dir/deps.lock.d"
|
|
528
572
|
mkdir -p "$deps_state_dir"
|
|
573
|
+
log_skipped_runtime_tools
|
|
529
574
|
|
|
530
575
|
# One runner at a time. uai-init is re-runnable (task-up retry, recovery),
|
|
531
576
|
# and each re-run SHOULD refresh dependencies — but never concurrently.
|
|
@@ -27,6 +27,9 @@ readonly PROJECT_ALLOWLIST=/run/uai/runtime-projects
|
|
|
27
27
|
readonly COREPACK_VERSION_FILE=/usr/local/share/uai/corepack-version
|
|
28
28
|
readonly ASDF_SH=/opt/asdf/asdf.sh
|
|
29
29
|
readonly ASDF_DATA=/opt/asdf-data
|
|
30
|
+
# Pin bumps rely on ensure_bun_plugin replacing older cached checkouts under
|
|
31
|
+
# the maintenance lock; verify-only must escalate rather than mutate them.
|
|
32
|
+
readonly BUN_PLUGIN_COMMIT=804d9603c473ea616fa078f851fa8380246e2c7a
|
|
30
33
|
readonly LOCK_PATH="$ASDF_DATA/.uai-maintenance.lock"
|
|
31
34
|
readonly CONTROL_PATH=/opt/asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
32
35
|
readonly APP_PATH="$ASDF_DATA/shims:$CONTROL_PATH"
|
|
@@ -249,6 +252,13 @@ validate_version() {
|
|
|
249
252
|
reject_dot_segments "$version" "$manifest" "$line_number"
|
|
250
253
|
}
|
|
251
254
|
|
|
255
|
+
supported_runtime() {
|
|
256
|
+
case "$1" in
|
|
257
|
+
nodejs|python|golang|ruby|rust|bun) return 0 ;;
|
|
258
|
+
*) return 1 ;;
|
|
259
|
+
esac
|
|
260
|
+
}
|
|
261
|
+
|
|
252
262
|
# Parse and validate the complete manifest before passing any field to asdf.
|
|
253
263
|
# ASDF remains the resolution authority; this parser only rejects shapes that
|
|
254
264
|
# are ambiguous or could be interpreted as command/path injection.
|
|
@@ -277,7 +287,7 @@ validate_manifest() {
|
|
|
277
287
|
[[ "$tool" =~ ^[a-z0-9][a-z0-9_-]*$ ]] \
|
|
278
288
|
|| fail "$manifest:$line_number has a malformed tool name '$tool'"
|
|
279
289
|
case "$tool" in
|
|
280
|
-
nodejs|python|golang|ruby|rust) ;;
|
|
290
|
+
nodejs|python|golang|ruby|rust|bun) ;;
|
|
281
291
|
pnpm|yarn)
|
|
282
292
|
# Not asdf plugins here: package managers are Corepack's domain
|
|
283
293
|
# (live 2026-08-17 — the asdf-pnpm convention is common enough that
|
|
@@ -288,7 +298,7 @@ validate_manifest() {
|
|
|
288
298
|
[[ "${fields[1]}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] \
|
|
289
299
|
|| fail "$manifest:$line_number must pin an exact $tool version (Corepack manages package managers)"
|
|
290
300
|
;;
|
|
291
|
-
*)
|
|
301
|
+
*) ;; # Valid unknown tools are ignored after full syntax validation.
|
|
292
302
|
esac
|
|
293
303
|
[ -z "${seen_tools[$tool]:-}" ] \
|
|
294
304
|
|| fail "$manifest:$line_number declares '$tool' more than once"
|
|
@@ -339,7 +349,7 @@ unset_tool_override() {
|
|
|
339
349
|
unset "$variable"
|
|
340
350
|
}
|
|
341
351
|
|
|
342
|
-
for baked_tool in nodejs python golang ruby rust; do
|
|
352
|
+
for baked_tool in nodejs python golang ruby rust bun; do
|
|
343
353
|
unset_tool_override "$baked_tool"
|
|
344
354
|
done
|
|
345
355
|
|
|
@@ -416,6 +426,7 @@ tool_executable() {
|
|
|
416
426
|
golang) printf go ;;
|
|
417
427
|
ruby) printf ruby ;;
|
|
418
428
|
rust) printf rustc ;;
|
|
429
|
+
bun) printf bun ;;
|
|
419
430
|
*) return 1 ;;
|
|
420
431
|
esac
|
|
421
432
|
}
|
|
@@ -541,6 +552,10 @@ normalize_tool_version_output() {
|
|
|
541
552
|
[[ "$output" =~ ^rustc[[:space:]]+([^[:space:]]+) ]] || return 1
|
|
542
553
|
NORMALIZED_TOOL_VERSION=${BASH_REMATCH[1]}
|
|
543
554
|
;;
|
|
555
|
+
bun)
|
|
556
|
+
[[ "$output" =~ ^([0-9]+\.[0-9]+\.[0-9]+)([[:space:]]|$) ]] || return 1
|
|
557
|
+
NORMALIZED_TOOL_VERSION=${BASH_REMATCH[1]}
|
|
558
|
+
;;
|
|
544
559
|
*) return 1 ;;
|
|
545
560
|
esac
|
|
546
561
|
}
|
|
@@ -560,7 +575,7 @@ tool_selection_requires_exact_output() {
|
|
|
560
575
|
ruby)
|
|
561
576
|
[[ "$version" =~ ^${numeric}(-(preview|rc)[0-9]+)?$ ]]
|
|
562
577
|
;;
|
|
563
|
-
golang|rust)
|
|
578
|
+
golang|rust|bun)
|
|
564
579
|
[[ "$version" =~ ^${numeric}$ ]]
|
|
565
580
|
;;
|
|
566
581
|
*) return 1 ;;
|
|
@@ -674,7 +689,7 @@ managed_install_location() {
|
|
|
674
689
|
local root lexical_root real_root candidate lexical_candidate real_candidate
|
|
675
690
|
|
|
676
691
|
case "$tool" in
|
|
677
|
-
nodejs|python|golang|ruby|rust) ;;
|
|
692
|
+
nodejs|python|golang|ruby|rust|bun) ;;
|
|
678
693
|
*) fail "refusing to repair unsupported asdf plugin '$tool'" ;;
|
|
679
694
|
esac
|
|
680
695
|
case "$version" in
|
|
@@ -1066,8 +1081,84 @@ prepare_package_manager() {
|
|
|
1066
1081
|
}
|
|
1067
1082
|
# END UAI_MANAGED_COREPACK_REPAIR
|
|
1068
1083
|
|
|
1084
|
+
# An interrupted clone can have HEAD/bin but lack lib files or a full checkout.
|
|
1085
|
+
# Every validation operation is read-only, including Git's optional lock policy.
|
|
1086
|
+
bun_plugin_is_valid() {
|
|
1087
|
+
local plugin=$1 head
|
|
1088
|
+
BUN_PLUGIN_ERROR="bun plugin is incomplete at $plugin (needs .git, bin/download, bin/install, lib/utils.bash and lib/semver.bash)"
|
|
1089
|
+
[ ! -L "$plugin" ] && [ -d "$plugin/.git" ] && [ ! -L "$plugin/.git" ] \
|
|
1090
|
+
&& [ -f "$plugin/bin/download" ] && [ -x "$plugin/bin/download" ] \
|
|
1091
|
+
&& [ -f "$plugin/bin/install" ] && [ -x "$plugin/bin/install" ] \
|
|
1092
|
+
&& [ -f "$plugin/lib/utils.bash" ] && [ -r "$plugin/lib/utils.bash" ] \
|
|
1093
|
+
&& [ -f "$plugin/lib/semver.bash" ] && [ -r "$plugin/lib/semver.bash" ] \
|
|
1094
|
+
|| return 1
|
|
1095
|
+
BUN_PLUGIN_ERROR="bun plugin commit cannot be verified at $plugin"
|
|
1096
|
+
head=$(GIT_OPTIONAL_LOCKS=0 git -C "$plugin" rev-parse HEAD 2>/dev/null) || return 1
|
|
1097
|
+
BUN_PLUGIN_ERROR="bun plugin commit mismatch at $plugin (expected $BUN_PLUGIN_COMMIT)"
|
|
1098
|
+
[ "$head" = "$BUN_PLUGIN_COMMIT" ] || return 1
|
|
1099
|
+
BUN_PLUGIN_ERROR="bun plugin checkout is dirty or incomplete at $plugin"
|
|
1100
|
+
GIT_OPTIONAL_LOCKS=0 git -c core.fsmonitor=false -C "$plugin" diff --quiet HEAD -- \
|
|
1101
|
+
|| return 1
|
|
1102
|
+
BUN_PLUGIN_ERROR=""
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
ensure_bun_plugin() {
|
|
1106
|
+
local plugins_root="$ASDF_DATA/plugins" plugin="$ASDF_DATA/plugins/bun" lexical resolved
|
|
1107
|
+
if bun_plugin_is_valid "$plugin"; then return 0; fi
|
|
1108
|
+
[ "$VERIFY_ONLY" != 1 ] \
|
|
1109
|
+
|| fail "$BUN_PLUGIN_ERROR; verify-only pass makes no installs or repairs; retry with a writable maintenance pass"
|
|
1110
|
+
[ -d /usr/local/share/uai/asdf-bun ] \
|
|
1111
|
+
|| fail "bun needs an updated standard image with the pinned asdf-bun plugin"
|
|
1112
|
+
# Keep all rename/delete targets in this exact real plugins directory, never
|
|
1113
|
+
# through an existing symlink. The caller already holds the maintenance lock.
|
|
1114
|
+
[ ! -L "$plugins_root" ] && [ -d "$plugins_root" ] \
|
|
1115
|
+
|| fail "shared asdf plugins root is not a real directory"
|
|
1116
|
+
lexical=$("$REALPATH_BIN" -m -s -- "$plugins_root") \
|
|
1117
|
+
|| fail "could not normalize shared asdf plugins root"
|
|
1118
|
+
resolved=$("$REALPATH_BIN" -e -- "$plugins_root") \
|
|
1119
|
+
|| fail "could not resolve shared asdf plugins root"
|
|
1120
|
+
[ "$lexical" = "$resolved" ] \
|
|
1121
|
+
|| fail "shared asdf plugins root traverses a symbolic link"
|
|
1122
|
+
log "$BUN_PLUGIN_ERROR; replacing bun plugin from the pinned image copy"
|
|
1123
|
+
(
|
|
1124
|
+
# asdf ignores dot directories. Clone/validate in staging even on the first
|
|
1125
|
+
# seed, so a killed clone cannot publish a half-written plugins/bun.
|
|
1126
|
+
staging=$(mktemp -d "$plugins_root/.bun-replace.XXXXXX") \
|
|
1127
|
+
|| fail "could not stage bun plugin replacement"
|
|
1128
|
+
promoted=0
|
|
1129
|
+
cleanup_bun_replacement() {
|
|
1130
|
+
local status=$?
|
|
1131
|
+
trap - EXIT HUP INT TERM
|
|
1132
|
+
if [ "$promoted" != 1 ] && { [ -e "$staging/old" ] || [ -L "$staging/old" ]; }; then
|
|
1133
|
+
if [ -e "$plugin" ] || [ -L "$plugin" ] \
|
|
1134
|
+
|| ! mv -T -- "$staging/old" "$plugin"; then
|
|
1135
|
+
log "could not restore old bun plugin; preserved at $staging/old"
|
|
1136
|
+
return 1
|
|
1137
|
+
fi
|
|
1138
|
+
fi
|
|
1139
|
+
if ! "$RM_BIN" -rf --one-file-system -- "$staging"; then
|
|
1140
|
+
log "could not remove bun plugin staging directory $staging"
|
|
1141
|
+
exit 1
|
|
1142
|
+
fi
|
|
1143
|
+
return "$status"
|
|
1144
|
+
}
|
|
1145
|
+
trap cleanup_bun_replacement EXIT
|
|
1146
|
+
trap 'exit 129' HUP
|
|
1147
|
+
trap 'exit 130' INT
|
|
1148
|
+
trap 'exit 143' TERM
|
|
1149
|
+
git clone --quiet -- /usr/local/share/uai/asdf-bun "$staging/new" \
|
|
1150
|
+
|| fail "could not clone the image's bun plugin"
|
|
1151
|
+
bun_plugin_is_valid "$staging/new" || fail "$BUN_PLUGIN_ERROR"
|
|
1152
|
+
if [ -e "$plugin" ] || [ -L "$plugin" ]; then
|
|
1153
|
+
mv -T -- "$plugin" "$staging/old" || fail "could not move old bun plugin aside"
|
|
1154
|
+
fi
|
|
1155
|
+
mv -T -- "$staging/new" "$plugin" || fail "could not publish the validated bun plugin"
|
|
1156
|
+
promoted=1
|
|
1157
|
+
) || fail "bun plugin replacement failed; retry runtime materialization"
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1069
1160
|
materialize_manifest() {
|
|
1070
|
-
local manifest=$1 project line tool version line_number=0
|
|
1161
|
+
local manifest=$1 project line tool version hint line_number=0
|
|
1071
1162
|
local -a fields=()
|
|
1072
1163
|
|
|
1073
1164
|
project=$(dirname "$manifest")
|
|
@@ -1082,7 +1173,15 @@ materialize_manifest() {
|
|
|
1082
1173
|
case "$tool" in
|
|
1083
1174
|
pnpm|yarn) continue ;; # Corepack-managed; see project_package_manager.
|
|
1084
1175
|
esac
|
|
1176
|
+
if ! supported_runtime "$tool"; then
|
|
1177
|
+
hint=""
|
|
1178
|
+
case "$tool" in node) hint=" Did you mean nodejs?" ;; go) hint=" Did you mean golang?" ;; esac
|
|
1179
|
+
log "$manifest:$line_number: skipped unsupported tool '$tool'; use mise install <tool>@<version>, then mise exec -- <cmd> (or its vendor installer).$hint"
|
|
1180
|
+
continue
|
|
1181
|
+
fi
|
|
1085
1182
|
unset_tool_override "$tool"
|
|
1183
|
+
# Seed only this allowlisted plugin under the existing maintenance lock.
|
|
1184
|
+
[ "$tool" != bun ] || ensure_bun_plugin
|
|
1086
1185
|
asdf plugin list | grep -Fqx -- "$tool" \
|
|
1087
1186
|
|| fail "$manifest:$line_number requests unsupported asdf plugin '$tool'"
|
|
1088
1187
|
|
|
@@ -1156,9 +1255,11 @@ materialize_fallback_runtimes() {
|
|
|
1156
1255
|
[ -n "$line" ] || continue
|
|
1157
1256
|
read -r -a fields <<< "$line"
|
|
1158
1257
|
tool=${fields[0]}
|
|
1258
|
+
supported_runtime "$tool" || continue
|
|
1159
1259
|
if manifest_declares_tool "$manifest" "$tool"; then
|
|
1160
1260
|
continue
|
|
1161
1261
|
fi
|
|
1262
|
+
[ "$tool" != bun ] || ensure_bun_plugin
|
|
1162
1263
|
asdf plugin list | grep -Fqx -- "$tool" \
|
|
1163
1264
|
|| fail "$defaults requests unavailable fallback plugin '$tool'"
|
|
1164
1265
|
for version in "${fields[@]:1}"; do
|
|
@@ -1345,6 +1446,7 @@ prove_fallback_runtimes() {
|
|
|
1345
1446
|
[ -n "$line" ] || continue
|
|
1346
1447
|
read -r -a fields <<< "$line"
|
|
1347
1448
|
tool=${fields[0]}
|
|
1449
|
+
supported_runtime "$tool" || continue
|
|
1348
1450
|
if manifest_declares_tool "$manifest" "$tool"; then
|
|
1349
1451
|
continue
|
|
1350
1452
|
fi
|
|
@@ -1508,6 +1610,7 @@ for manifest in "${manifests[@]}"; do
|
|
|
1508
1610
|
case "${fields[0]}" in
|
|
1509
1611
|
pnpm|yarn) continue ;; # proven via prove_project_package_manager below
|
|
1510
1612
|
esac
|
|
1613
|
+
supported_runtime "${fields[0]}" || continue
|
|
1511
1614
|
unset_tool_override "${fields[0]}"
|
|
1512
1615
|
for version in "${fields[@]:1}"; do
|
|
1513
1616
|
prove_selection "${fields[0]}" "$version" "$project" "$manifest"
|