feat: installer boots nvim once and restores the lazy-lock pins
A first nvim start cloned the later-round plugins (claudecode, mini.*, nvim-lint, friendly-snippets, ...) at branch tip and rewrote the seeded lazy-lock.json with the tips. The install pipeline now ends with a headless first boot, puts the seeded lockfile back, and runs `Lazy! restore`. It runs only where lazy has never installed a plugin, so a lockfile the user has moved on is never touched, and a second run does nothing.
This commit is contained in:
1 parent
4e2452e994
commit
e0c78a3ffa
5 files changed
+121
No files matched your search
@@ -814,6 +814,56 @@ else
|
||||
hasnt "with no herdr the step says nothing" "herdr" "$out"
|
||||
fi
|
||||
|
||||
printf '\n\033[1mnvim first boot keeps the lazy-lock.json pins\033[0m\n'
|
||||
# A real first boot clones some plugins at branch tip and rewrites the lockfile
|
||||
# with the tips; the fake nvim does the same rewrite. The step has to undo it:
|
||||
# boot, put the seed back, then restore against the seed. Once only, and never
|
||||
# over a lockfile lazy has already managed.
|
||||
seedlock() {
|
||||
mkdir -p "$SB/.config/nvim"
|
||||
printf '{ "plugin": "pinned" }\n' > "$SB/.config/nvim/lazy-lock.json"
|
||||
}
|
||||
newbox; sh ./seal.sh "$SB/seal" --with nvim >/dev/null; BOXPATH=$SB/seal
|
||||
seedlock; pick core/ripgrep
|
||||
out=$(box install 2>&1 | plain || true)
|
||||
is "a fresh box boots nvim, then restores" "boot restore" \
|
||||
"$(awk '$1=="nvim" {print (/Lazy! restore/ ? "restore" : "boot")}' "$LOG" | tr '\n' ' ' | sed 's/ $//')"
|
||||
is "…against the SEEDED lockfile, not the one the boot rewrote" '{ "plugin": "pinned" }' \
|
||||
"$(cat "$SB/.nvim-restored-from" 2>/dev/null)"
|
||||
is "…and leaves the seed in place" '{ "plugin": "pinned" }' \
|
||||
"$(cat "$SB/.config/nvim/lazy-lock.json")"
|
||||
: > "$LOG"; out=$(box install 2>&1 | plain || true)
|
||||
is "a second run starts no nvim" "0" "$(grep -c '^nvim ' "$LOG" || true)"
|
||||
hasnt "…and prints no nvim section" "pinned to lazy-lock.json" "$out"
|
||||
newbox; sh ./seal.sh "$SB/seal" --with nvim >/dev/null; BOXPATH=$SB/seal
|
||||
printf '{ "plugin": "updated-by-user" }\n' > "$SB/lock.user"
|
||||
seedlock; cp "$SB/lock.user" "$SB/.config/nvim/lazy-lock.json"
|
||||
mkdir -p "$SB/.local/share/nvim/lazy/lazy.nvim"; pick core/ripgrep
|
||||
box install >/dev/null 2>&1 || true
|
||||
is "a lockfile lazy already manages is left alone" "$(cat "$SB/lock.user")" \
|
||||
"$(cat "$SB/.config/nvim/lazy-lock.json")"
|
||||
is "…and nvim is not started" "0" "$(grep -c '^nvim ' "$LOG" || true)"
|
||||
newbox; sh ./seal.sh "$SB/seal" --with nvim >/dev/null; BOXPATH=$SB/seal; pick core/ripgrep
|
||||
box install >/dev/null 2>&1 || true
|
||||
is "with no nvim config there is nothing to pin" "0" "$(grep -c '^nvim ' "$LOG" || true)"
|
||||
newbox; sh ./seal.sh "$SB/seal" --with nvim >/dev/null; BOXPATH=$SB/seal
|
||||
seedlock; pick core/ripgrep; BOXENV='FAKE_FAIL=nvim:restore'
|
||||
rc=0; box install >"$SB/out" 2>&1 || rc=$?; out=$(plain < "$SB/out")
|
||||
has "a failed restore says how to retry" "nvim --headless '+Lazy! restore' +qa" "$out"
|
||||
is "…without failing the install" "0" "$rc"
|
||||
newbox; sh ./seal.sh "$SB/seal" --with nvim >/dev/null; BOXPATH=$SB/seal
|
||||
seedlock; pick core/ripgrep; BOXENV='FAKE_FAIL=nvim:boot'
|
||||
box install >/dev/null 2>&1 || true
|
||||
is "a failed first boot still restores the seed" '{ "plugin": "pinned" }' \
|
||||
"$(cat "$SB/.nvim-restored-from" 2>/dev/null)"
|
||||
newbox
|
||||
if holed nvim; then
|
||||
seedlock; pick core/ripgrep
|
||||
hasnt "with no nvim the step says nothing" "lazy-lock" "$(box install 2>&1 | plain || true)"
|
||||
else
|
||||
printf ' \033[33mskip\033[0m nvim sits at an absolute path find_tool probes\n'
|
||||
fi
|
||||
|
||||
printf '\n\033[1mclaude desktop trusts only Anthropic'"'"'s key\033[0m\n'
|
||||
# A vendor apt repository is a key apt will trust for root-installed packages,
|
||||
# so the key is checked against the published fingerprint before it is placed.
|
||||
|
||||
Reference in new issue
Block a user