mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-31 22:14:25 +01:00
* docs(designs): gstack field wave plan (2026-10-12) and the shared simulated Capy host fixture Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * feat(doctor): --min-revision, a launch Bun found off PATH, planning-only pins SKIP gstack-doctor --check gains --min-revision <v>|unknown: below it the revision row FAILs with REVISION_BELOW_MINIMUM naming the Capy wrapper or bin/gstack-upgrade; unknown says so and never claims the minimum. The runtime and pins rows name a supported Bun found in $BUN_INSTALL/bin (not on PATH) with the export/GSTACK_LAUNCH fix (gstack_bun_launch_dir, one helper in bin/gstack-bun-version.sh). --for a planning-only workflow (autoplan, the plan reviews, office-hours) reports a repo test-pin mismatch as SKIP pins (planning-only; ...). New result codes UPGRADE_REFUSED, UPGRADE_FETCH_FAILED, REVISION_BELOW_MINIMUM, CAPY_WRAPPER_STALE, INSTALL_UNVERIFIED with troubleshooting anchors; REVISION_UNMET's fix names bin/gstack-upgrade. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * feat(install): install verdict and install admission at skill start bin/gstack-install-verdict.sh (Bash) and lib/install-verdict.ts (TypeScript) are the one reader of the install verdict gstack-capy-install writes to <state root>/install-verdicts/<sha256(checkout realpath)>.json (checkout, HEAD, workflow and required components, planning-only pins, trailer). The source checkout and capy/support.env resolve through gstack_source_root / sourceRoot, which follow an installed root's .source-path. gstack-skill-start, after SESSION_KIND: an unattended session (any host) refuses on a PATH Bun below the supported minimum; with GSTACK_CAPY=1 an unattended or explicit spawned session also refuses without a passing verdict for this checkout, HEAD and workflow (INSTALL_UNVERIFIED). A refusal prints the INSTALL: row, an install-refused instruction block bound to its SESSION_ID, GSTACK_RESULT ... status=refused run=- and exits 3. Ambient spawned sessions warn; GSTACK_ALLOW_UNSUPPORTED_RUNTIME=1 admits and says so. capy/support.env declares GSTACK_MIN_REVISION and GSTACK_CAPY_MIN_WRAPPER. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * feat(capy-install): launch PATH, Bun reuse and CI pins, setup skip on HEAD, verdict, --check The GSTACK_LAUNCH line carries PATH=<dir>:$PATH when the certified Bun is not first on PATH, plus GSTACK_CAPY=1 and GSTACK_INSTALL_VERDICT, and GSTACK_LAUNCH_PATH: <dir>; the doctor runs with that PATH. A supported Bun in $BUN_INSTALL/bin is reused instead of downloaded again. Project pins are read with bin/gstack-runtime-pins.ts (CI lanes included): when every exact pin is gstack's verified version the archive is installed alongside a different PATH Bun; any other exact pin is RUNTIME_PIN_CONFLICT. Both ./setup runs are skipped when this HEAD was set up with the same hosts, model and browser flag and the check passes (never after a fast-forward); a failed setup ends with gstack: fail setup and is retried next run. --check certifies only; GSTACK_CAPY_LOCK_HELD=1 accepts the bootstrapper's held lock; result anchors come from the generated components table; REV_NOTE names bin/gstack-upgrade. Intentional pin change: test/gstack-capy-install.test.ts --revision trailer now names <root>/bin/gstack-upgrade (the old text named a command that never existed). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * feat(upgrade): bin/gstack-upgrade, the unattended fast-forward every fix line names --check fetches and prints current|behind <installed> -> <remote> (<n> commits); the default fast-forwards to the remote default branch tip and reinstalls (bin/gstack-capy-install on a Capy install, else ./setup --refresh-registered), completing a pending reinstall on the next run. It refuses (UPGRADE_REFUSED, exit 3, nothing changed) a dirty tracked byte, a diverged commit, a pinned checkout, the incoming Bun floor and a held .setup-lock; never stashes or resets; an unreachable remote is UPGRADE_FETCH_FAILED. Fetches are receipted (fail-open). The unattended skill-end UPGRADE_AVAILABLE line is followed by UPGRADE_COMMAND naming it. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * feat(capy): vendored Capy skill, frozen bootstrapper and full wrapper bin/gstack-capy-session capy/skill/gstack/ is the Drive skill's source of truth. scripts/install.sh is a frozen bootstrapper: it prints gstack-capy-skill: wrapper <n> (<path>), clones or fetches under .gstack-capy-install.lock, reads the remote capy/support.env (FETCH_HEAD), fast-forwards a clean unpinned checkout below GSTACK_MIN_REVISION (refusing dirty, diverged or pinned checkouts with the exact commands; GSTACK_CAPY_AUTO_UPGRADE=0 disables), and execs the checkout's own bin/gstack-capy-session with GSTACK_CAPY_LOCK_HELD=1 so the held lock is never taken twice. Offline it says the remote minimum is unknown. A Drive copy older than GSTACK_CAPY_MIN_WRAPPER prints an owner action (CAPY_WRAPPER_STALE). SKILL.md: check at session start, install lazily before the first workflow, the GSTACK_LAUNCH line, the trailer rule, the subagent first-report line, gstack-pregate sealed before any push, and the autoplan/DRIVER.md pointer. The context-budget fixture gains the skill's entry. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: Capy install layers, lazy install, snapshot bake, forward-only recovery, raising the minimum docs/capy-install.md describes the three layers (Drive bootstrapper, full wrapper, installer), the lazy install, the GSTACK_LAUNCH line, install admission, baking gstack into a Capy snapshot, and that recovery after an interrupted fast-forward completes or refuses the pending install stages (checking out an older commit is not a rollback). docs/CHANGELOG_STYLE.md (the release doc; there is no docs/RELEASING.md) says when GSTACK_MIN_REVISION may be raised. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * refactor(capy): the stale-copy owner action moves from the frozen bootstrapper to bin/gstack-capy-session The checkout-owned full wrapper reads GSTACK_CAPY_MIN_WRAPPER through gstack_support_env_get(gstack_source_root) and compares it with the bootstrapper revision it was handed, so the rule can change without recopying the Drive skill. The bootstrapper keeps only what a stale checkout cannot do: clone, fetch, read the remote minimum, fast-forward, exec. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * v1.91.96.0: honest install and self-upgrade on Capy; supported minimum 1.91.96.0 Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test: drop the helper-only Capy host fixture test (test-of-test ratchet); lane tests exercise the helper Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test: bound the new sync spawns in the install-verdict and wrapper tests (spawnSync tripwire) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * ci(paid-pr-profile): the vendored Capy skill is free-only; free-only files are not prompts needing paid coverage Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * chore(harness): non-behavioral HARNESS_VERSION decision for the PR-profile free-only rule Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(doctor): lane A runtime and pins cases are platform-neutral (bash paths; a lane-free .bun-version pin) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs(designs): field wave plan with amendments and the gate rev 2-3 review record (ARTIFACT_VALID, 3 gate revisions) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(capy-install): follow a project's exact Bun pin above the minimum when gstack has its verified archive (adds Bun 1.4.3) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: the installer follows a verified exact project Bun pin (capy-install, troubleshooting, changelog) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(capy-install): the install reason names the project's pin and gstack's real minimum Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
129 lines
6.3 KiB
Bash
129 lines
6.3 KiB
Bash
# shellcheck shell=bash
|
|
# gstack-bun-version.sh — the one source for the Bun versions gstack needs.
|
|
# Sourced, never executed: ./setup refuses or warns from it before writing
|
|
# anything, and bin/gstack-session-update and /gstack-upgrade read the
|
|
# INCOMING release's floor (gstack_bun_incoming_hold) before advancing a
|
|
# live checkout. test/bun-version-drift.test.ts
|
|
# keeps it equal to package.json engines.bun, every CI pin, setup's install
|
|
# hint and README. Bash 3.2 builtins only.
|
|
#
|
|
# GSTACK_BUN_FLOOR is the security floor. Older Bun accepts
|
|
# --no-compile-autoload-dotenv/--no-compile-autoload-bunfig but ignores them,
|
|
# so gstack's compiled tools would read a project's .env. Verified by a
|
|
# compiled probe (a binary built with all four no-autoload flags, run beside a
|
|
# .env): Bun 1.3.2 loads it, 1.3.3 and 1.4.0 do not.
|
|
# GSTACK_BUN_TESTED is the supported minimum: the CI pin and engines.bun.
|
|
GSTACK_BUN_FLOOR="1.3.3"
|
|
GSTACK_BUN_TESTED="1.4.2"
|
|
|
|
# gstack_bun_archive_sha256 TARGET [VERSION] — the SHA-256 of
|
|
# https://github.com/oven-sh/bun/releases/download/bun-v$VERSION/bun-TARGET.zip
|
|
# (VERSION defaults to $GSTACK_BUN_TESTED) from that release's SHASUMS256.txt,
|
|
# for the targets bin/gstack-capy-install installs on Capy cloud machines (the
|
|
# same exact-archive recipe as .github/docker/Dockerfile.ci;
|
|
# test/bun-version-drift.test.ts keeps the $GSTACK_BUN_TESTED rows equal). A
|
|
# newer version is listed so the installer can follow a project's exact pin
|
|
# above the minimum. Prints nothing and returns 1 without a verified archive.
|
|
GSTACK_BUN_VERIFIED="1.4.2 1.4.3"
|
|
gstack_bun_archive_sha256() {
|
|
case "${2:-$GSTACK_BUN_TESTED}" in
|
|
1.4.2) case "$1" in
|
|
linux-x64) echo 36368faef7527875d5ffa52e53cd48021741f2a83eb6208a8dd64068d422a913 ;;
|
|
linux-x64-baseline) echo c678040f14fe0440eb839d37cbd0ce4c051a32da72806ac97de6a6aab6bf728f ;;
|
|
linux-aarch64) echo 54328bbc2d9c8e0c9f892c544d66c57a83b84139e34909e5ee81758f1ac8fda7 ;;
|
|
*) return 1 ;;
|
|
esac ;;
|
|
1.4.3) case "$1" in
|
|
linux-x64) echo 3e730528d89775f03f87f05c06787c4df4099d0a37f3f252e7b829cb23816e18 ;;
|
|
linux-x64-baseline) echo 1fc2edac843102909e3a1be1d8d9802cc6071cf074e67e88231f4ffe0f8b397b ;;
|
|
linux-aarch64) echo efa9813da5ed72423bf847f916e8d2c47c0d776add972354026a75e10da9aa21 ;;
|
|
*) return 1 ;;
|
|
esac ;;
|
|
*) return 1 ;;
|
|
esac
|
|
}
|
|
|
|
# _gstack_bun_parse <version> — sets _gb_core ("MAJOR MINOR PATCH" as decimal
|
|
# integers) and _gb_pre (prerelease, may be empty); returns 1 when malformed.
|
|
# A leading "v" and "+build" metadata are ignored.
|
|
_gstack_bun_parse() {
|
|
_gb_v="${1#v}"; _gb_v="${_gb_v%%+*}"; _gb_pre=""
|
|
case "$_gb_v" in
|
|
*-*) _gb_pre="${_gb_v#*-}"; _gb_v="${_gb_v%%-*}"; [ -n "$_gb_pre" ] || return 1 ;;
|
|
esac
|
|
case "$_gb_v" in *.*.*) ;; *) return 1 ;; esac
|
|
_gb_maj="${_gb_v%%.*}"; _gb_rest="${_gb_v#*.}"; _gb_min="${_gb_rest%%.*}"; _gb_pat="${_gb_rest#*.}"
|
|
case "$_gb_maj" in ''|*[!0-9]*) return 1 ;; esac
|
|
case "$_gb_min" in ''|*[!0-9]*) return 1 ;; esac
|
|
case "$_gb_pat" in ''|*[!0-9]*) return 1 ;; esac
|
|
case "$_gb_pre" in *[!0-9A-Za-z.-]*) return 1 ;; esac
|
|
_gb_core="$((10#$_gb_maj)) $((10#$_gb_min)) $((10#$_gb_pat))"
|
|
}
|
|
|
|
# _gstack_bun_below <version> <release> — true when version sorts below the
|
|
# release. Prerelease rule (semver): 1.3.3-canary.1 is below 1.3.3 and above
|
|
# 1.3.2, so a prerelease of the floor itself is refused.
|
|
_gstack_bun_below() {
|
|
_gstack_bun_parse "$2" || return 1
|
|
set -- "$1" $_gb_core
|
|
_gstack_bun_parse "$1" || return 1
|
|
set -- "$@" $_gb_core
|
|
[ "$5" -ne "$2" ] && { [ "$5" -lt "$2" ]; return; }
|
|
[ "$6" -ne "$3" ] && { [ "$6" -lt "$3" ]; return; }
|
|
[ "$7" -ne "$4" ] && { [ "$7" -lt "$4" ]; return; }
|
|
[ -n "$_gb_pre" ]
|
|
}
|
|
|
|
# gstack_bun_status <version> [floor] — prints too-old, untested, ok or
|
|
# malformed. The optional floor lets the auto-updater apply the incoming
|
|
# release's floor with this release's comparison rule.
|
|
gstack_bun_status() {
|
|
if ! _gstack_bun_parse "$1"; then echo malformed
|
|
elif _gstack_bun_below "$1" "${2:-$GSTACK_BUN_FLOOR}"; then echo too-old
|
|
elif _gstack_bun_below "$1" "$GSTACK_BUN_TESTED"; then echo untested
|
|
else echo ok
|
|
fi
|
|
}
|
|
|
|
# gstack_bun_incoming_hold <git-dir> <rev> — the pre-advance check shared by
|
|
# the auto-updater and /gstack-upgrade. Reads the floor from <rev>'s copy of
|
|
# this file and checks the `bun` setup will run (first on PATH). Below that
|
|
# floor it prints the held reason and returns 0; otherwise it prints nothing
|
|
# and returns 1 (no bun, no floor in <rev>, or an unparseable version, which
|
|
# setup only warns on). The comparison rule is this release's.
|
|
gstack_bun_incoming_hold() {
|
|
command -v bun >/dev/null 2>&1 || return 1
|
|
_gb_floor=$(git -C "$1" show "$2:bin/gstack-bun-version.sh" 2>/dev/null | sed -n 's/^GSTACK_BUN_FLOOR="\([0-9A-Za-z.+-]*\)".*/\1/p' | head -1)
|
|
[ -n "$_gb_floor" ] || return 1
|
|
_gb_found=$(bun --version 2>/dev/null | head -1)
|
|
[ "$(gstack_bun_status "$_gb_found" "$_gb_floor")" = too-old ] || return 1
|
|
_gb_ver=$(git -C "$1" show "$2:VERSION" 2>/dev/null | head -1)
|
|
echo "bun-too-old: found Bun $_gb_found at $(command -v bun); gstack ${_gb_ver:-update} needs $_gb_floor or newer"
|
|
}
|
|
|
|
# gstack_bun_launch_dir [exact] — the directory to put first on PATH so
|
|
# gstack's `#!/usr/bin/env bun` bins run a supported Bun: the first of
|
|
# $BUN_INSTALL/bin and $HOME/.bun/bin whose bun is ok (and equals <exact>
|
|
# when given), unless the bun already first on PATH qualifies. Prints the
|
|
# directory (callers read its version with "<dir>/bun --version"); prints
|
|
# nothing and returns 1 when PATH's bun suffices or no candidate qualifies. Shared by
|
|
# gstack-capy-install (the GSTACK_LAUNCH line) and gstack-doctor --check (the
|
|
# runtime row's `found at ... (not on PATH)`).
|
|
gstack_bun_launch_dir() {
|
|
_gb_path_bun=$(command -v bun 2>/dev/null || true)
|
|
if [ -n "$_gb_path_bun" ]; then
|
|
_gb_v=$(bun --version </dev/null 2>/dev/null | head -1)
|
|
if [ "$(gstack_bun_status "$_gb_v")" = ok ] && { [ -z "${1:-}" ] || [ "$_gb_v" = "$1" ]; }; then return 1; fi
|
|
fi
|
|
for _gb_dir in "${BUN_INSTALL:+$BUN_INSTALL/bin}" "${HOME:+$HOME/.bun/bin}"; do
|
|
[ -n "$_gb_dir" ] && [ -x "$_gb_dir/bun" ] || continue
|
|
[ "$_gb_dir/bun" = "$_gb_path_bun" ] && continue
|
|
_gb_v=$("$_gb_dir/bun" --version </dev/null 2>/dev/null | head -1)
|
|
[ "$(gstack_bun_status "$_gb_v")" = ok ] || continue
|
|
[ -z "${1:-}" ] || [ "$_gb_v" = "$1" ] || continue
|
|
printf '%s\n' "$_gb_dir"
|
|
return 0
|
|
done
|
|
return 1
|
|
}
|