mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-28 07:32:14 +02:00
v1.91.2.0 fix: consolidate gstack reliability wave (#2959)
* fix(memory-ingest): --scan-secrets scans the rendered page and fails closed --scan-secrets ran gitleaks on the raw transcript .jsonl, then imported a page rendered from it. gitleaks' assignment rules don't match across a JSON-escaped quote (KEY=\"v\" on disk), so a secret the rendered page shows as KEY="v" was imported unflagged. And the gate skipped a file only on scanner "gitleaks" with findings, so a scan that errored (non-zero exit, 16MB maxBuffer overflow on a file with many findings, unparseable report) or could not run (gitleaks missing, slow-probe cooldown) imported the file unscanned. Scan the rendered page body, the exact bytes writeStaged() writes, via a new secretScanText() helper, and skip the file whenever the scan did not complete. Skipped files stay out of the state file, so the next run retries them. Reword the helper warnings and setup-gbrain/memory.md, which described the fail-open as intended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(test): reconcile Bun failure markers and footer counts * fix(sync-gbrain): verify source-scoped reads without mutation * fix(test): recognize grounded TTHW target choices structurally * fix(aside): make the readiness probe work under zsh and report why it failed The probe built its deadline into `_T` and expanded it unquoted, so `$_T aside repl …` only worked in a shell that word-splits. zsh does not: it looked for a command literally named "gtimeout 30", the probe answered ASIDE_NOT_RUNNING with Aside installed and ready, and every browsing skill fell back to the bundled Chromium in silence. zsh is the macOS default and Aside is macOS-only, so on a stock Mac the probe could never report READY. The deadline becomes a function, `_gs_d`. It receives the command as "$@", already split, so sh, bash and zsh all behave the same, and the gtimeout → timeout → perl alarm chain is unchanged. A 4th arm runs the call unbounded when none of the three is present, which is what the empty `_T` did before. Not `eval`: it re-parses the string, so the parens and `;` of the perl arm become syntax and that arm dies in bash *and* zsh — on a stock Mac, the arm that actually runs. On failure the probe now prints the CLI's reason after ASIDE_NOT_RUNNING:, the shape gstack-render already uses: the first line that starts with a capital letter, i.e. the CLI's own sentence or Node's `Error:` line below its loader frame. "Not running" covers states with different fixes — no window open for the profile, a NODE_OPTIONS preload that kills the CLI — and a bare verdict sent all of them to "open the Aside app". The BROWSER SETUP prose quotes that reason before asking the user to open the app. The text pin asserted the broken invocation verbatim, so it now pins the function and asserts neither `$_T aside repl` nor an eval form comes back. A second test executes the rendered probe in sh, bash and zsh on each of the four deadline arms with stubbed binaries on a narrowed PATH, plus two failing CLIs: one that prints its own sentence, one that crashes like Node with the useful line below the frame. The deadline function costs zero bytes against the lines it replaces; the reason costs 53 per copy of the probe (44 where the reworded BROWSER SETUP line gives 9 back). That moves four guards by the measured amount: plan-devex-review's skeleton cap to 68,550 (measured 68,544), plan-ceo-review's skeleton cap to 80,150 (measured 80,111) and union ratio to 1.081 (measured 1.0803), and plan-eng-review's union ratio to 1.151 (measured 1.1504). Fixes #2842, #2941. * Clarify engineering review startup and decision flow * Fix Windows readiness fixture PATH and command shim * fix(test): recognize grounded TTHW target choices structurally * Clarify engineering review startup and decision flow * fix(test): restrict QA-only fixture tools to its no-Edit contract * v1.90.0.0 fix(sync-gbrain): guard readiness verdicts and refresh metadata * fix(browse): validate canonical upload targets * fix(gbrain): classify structured PGLite busy response * fix(browse): preserve native extension runtime APIs * Fix displayless browser handoff ownership * Accept unique installed autoplan methodology aliases * fix(skills): preserve positional literals during installation * fix(browse): checksum installer contents through stdin * fix(test): normalize Windows checksum fixture paths * test: emulate unavailable shasum in Windows checksum fixture * fix(investigate): preserve owned freeze lifecycle * fix(review): preserve N+1 retry and Red Team completion * fix: bound Aside readiness and preserve safe fallback * test: exercise setup and Chromium on native ARM * fix: preserve install ownership and ARM browser selection * Fix gbrain ingest scan boundaries and seed observation * Refresh managed ship hooks and supervise expanded paid census * Reject resumed gbrain pages excluded by current policy * Recover zombie agent locks safely and enable CI Python venv * Repair paid actor declarations and Aside pitch assertions * Bump consolidated wave to next free minor release * Clarify CEO review admin choices and option tradeoffs * Preserve CEO mode handoff anchors in clarified workflow * Make Windows portability fixtures use shell-native paths * Restore ARM Bun alias and clarify ship review gates * Refresh ship workflow golden snapshots * Fix Windows DX documentation controls without piped stdin * Decode Codex child pipes without Bun's encoded-stream stall * Bound DX pre-review audit before product questions * Clarify trusted review-start read in paid revalidation * Bump consolidated wave to next free minor release * Clarify CEO review admin choices and option tradeoffs * Preserve CEO mode handoff anchors in clarified workflow * Make Windows portability fixtures use shell-native paths * Restore ARM Bun alias and clarify ship review gates * Refresh ship workflow golden snapshots * Fix Windows DX documentation controls without piped stdin * Decode Codex child pipes without Bun's encoded-stream stall * Bound DX pre-review audit before product questions * Clarify trusted review-start read in paid revalidation * Reconcile new main planning flow and paid judge census * fix: reconcile rebased planning and source-bound validation * test: pin cookie workflow judge to scored Sonnet model * fix: keep terminal agent boot out of module imports * fix: preserve pending-question uncertainty in engineering review * fix: stabilize Windows reliability-wave fixtures * fix: clarify design consultation research workflow * fix: preserve independent design consultation inputs * fix: resolve design taste scope and browser research guidance * fix: make consultation opt-in preflight unambiguous * test: await native Edge owner readiness or terminal result --------- Co-authored-by: Bruce Krysiak <brucek@alum.mit.edu> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Antonio Vitalic <antoninte99@gmail.com>
This commit is contained in:
co-authored by
Bruce Krysiak
Claude Opus 5.5
Antonio Vitalic
parent
2a113ae7e6
commit
01593aa67c
@@ -23,6 +23,7 @@ Options:
|
||||
--host <name> Install for a specific host (claude, codex, kiro, factory,
|
||||
opencode, openclaw, hermes, gbrain, auto). Default: claude.
|
||||
--model <id> Codex model profile override. Otherwise reads Codex config.
|
||||
--global Register Codex globally even from a project-vendored source.
|
||||
--prefix Install skills with the gstack- prefix (e.g. /gstack-review).
|
||||
--no-prefix Install skills with short names (e.g. /review). Default.
|
||||
--team Switch to team mode (per-repo gstack with auto-update).
|
||||
@@ -55,6 +56,7 @@ done
|
||||
HOST="claude"
|
||||
QUIET=0
|
||||
LOCAL_INSTALL=0
|
||||
GLOBAL_INSTALL=0
|
||||
SKILL_PREFIX=1
|
||||
SKILL_PREFIX_FLAG=0
|
||||
TEAM_MODE=0
|
||||
@@ -70,6 +72,7 @@ while [ $# -gt 0 ]; do
|
||||
--model) [ -z "$2" ] && echo "Missing value for --model" >&2 && exit 1; MODEL_OVERRIDE="$2"; MODEL_OVERRIDE_SET=1; shift 2 ;;
|
||||
--model=*) MODEL_OVERRIDE="${1#--model=}"; MODEL_OVERRIDE_SET=1; shift ;;
|
||||
--local) LOCAL_INSTALL=1; shift ;;
|
||||
--global) GLOBAL_INSTALL=1; shift ;;
|
||||
--prefix) SKILL_PREFIX=1; SKILL_PREFIX_FLAG=1; shift ;;
|
||||
--no-prefix) SKILL_PREFIX=0; SKILL_PREFIX_FLAG=1; shift ;;
|
||||
--team) TEAM_MODE=1; shift ;;
|
||||
@@ -176,6 +179,84 @@ CURSOR_SKILLS="$HOME/.cursor/skills"
|
||||
CURSOR_GSTACK="$CURSOR_SKILLS/gstack"
|
||||
KIRO_SKILLS="$HOME/.kiro/skills"
|
||||
|
||||
SKILLS_BASENAME="$(basename "$INSTALL_SKILLS_DIR")"
|
||||
SKILLS_PARENT_BASENAME="$(basename "$(dirname "$INSTALL_SKILLS_DIR")")"
|
||||
CODEX_REPO_LOCAL=0
|
||||
if [ "$(basename "$INSTALL_GSTACK_DIR")" = "gstack" ] && [ "$SKILLS_BASENAME" = "skills" ] \
|
||||
&& { [ "$SKILLS_PARENT_BASENAME" = ".agents" ] || [ "$SKILLS_PARENT_BASENAME" = ".claude" ]; } \
|
||||
&& [ "$INSTALL_SKILLS_DIR" != "$HOME/.agents/skills" ] \
|
||||
&& [ "$INSTALL_SKILLS_DIR" != "$HOME/.claude/skills" ] \
|
||||
&& [ "$INSTALL_SKILLS_DIR" != "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills" ]; then
|
||||
if [ "$GLOBAL_INSTALL" -eq 1 ]; then
|
||||
echo "Global Codex registration requested from project source: $INSTALL_GSTACK_DIR (resolved: $SOURCE_GSTACK_DIR)" >&2
|
||||
else
|
||||
CODEX_REPO_LOCAL=1
|
||||
if [ "$SKILLS_PARENT_BASENAME" = ".agents" ]; then
|
||||
CODEX_SKILLS="$INSTALL_SKILLS_DIR"
|
||||
CODEX_GSTACK="$INSTALL_GSTACK_DIR"
|
||||
else
|
||||
CODEX_SKILLS="$(dirname "$(dirname "$INSTALL_SKILLS_DIR")")/.agents/skills"
|
||||
CODEX_GSTACK="$CODEX_SKILLS/gstack"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CODEX_REPO_LOCAL" -eq 1 ]; then
|
||||
_resolve_codex_namespace() {
|
||||
local namespace="$1" label="$2" parent="$1" suffix="" physical
|
||||
while [ ! -d "$parent" ]; do
|
||||
if [ -L "$parent" ] || [ -e "$parent" ]; then
|
||||
echo "Refusing: project-local Codex $label contains an unresolvable directory: $parent. Use a separate project-local skills directory; setup will not relink it automatically." >&2
|
||||
return 1
|
||||
fi
|
||||
suffix="/$(basename "$parent")$suffix"
|
||||
parent="$(dirname "$parent")"
|
||||
done
|
||||
if ! physical="$(cd "$parent" && pwd -P)"; then
|
||||
echo "Refusing: project-local Codex $label contains an unresolvable directory: $namespace. Use a separate project-local skills directory; setup will not relink it automatically." >&2
|
||||
return 1
|
||||
fi
|
||||
printf '%s%s\n' "$physical" "$suffix"
|
||||
}
|
||||
_codex_project="$(cd "$(dirname "$(dirname "$INSTALL_SKILLS_DIR")")" && pwd -P)"
|
||||
_codex_parent="$(_resolve_codex_namespace "$CODEX_SKILLS" destination)" || exit 1
|
||||
case "$_codex_parent" in
|
||||
"$_codex_project"|"$_codex_project"/*) ;;
|
||||
*) echo "Refusing: project-local Codex destination resolves outside the project: $CODEX_SKILLS -> $_codex_parent. Use a separate project-local skills directory; setup will not relink it automatically." >&2; exit 1 ;;
|
||||
esac
|
||||
_codex_payload="$_codex_parent"
|
||||
while :; do
|
||||
if [ "$_codex_payload" = "$SOURCE_GSTACK_DIR" ] \
|
||||
|| { [ -f "$_codex_payload/setup" ] && [ -f "$_codex_payload/VERSION" ] && [ -f "$_codex_payload/bin/gstack-relink" ]; }; then
|
||||
echo "Refusing: project-local Codex destination overlaps the source tree at $_codex_payload: $CODEX_SKILLS -> $_codex_parent. Use a separate project-local skills directory; setup will not relink it automatically." >&2
|
||||
exit 1
|
||||
fi
|
||||
[ "$_codex_payload" = / ] && break
|
||||
_codex_payload="$(dirname "$_codex_payload")"
|
||||
done
|
||||
_codex_generation="$(_resolve_codex_namespace "$SOURCE_GSTACK_DIR/.agents/skills" 'generation namespace')" || exit 1
|
||||
case "$_codex_generation" in
|
||||
"$SOURCE_GSTACK_DIR"/*) ;;
|
||||
*) echo "Refusing: project-local Codex generation namespace resolves outside the source tree: $SOURCE_GSTACK_DIR/.agents/skills -> $_codex_generation. Use a separate project-local skills directory; setup will not relink it automatically." >&2; exit 1 ;;
|
||||
esac
|
||||
if [ -d "$CODEX_GSTACK" ] && [ "$(cd "$CODEX_GSTACK" && pwd -P)" != "$SOURCE_GSTACK_DIR" ] \
|
||||
&& { [ -e "$CODEX_GSTACK/.git" ] \
|
||||
|| { [ -f "$CODEX_GSTACK/setup" ] && [ -f "$CODEX_GSTACK/VERSION" ] && [ -f "$CODEX_GSTACK/bin/gstack-relink" ]; }; }; then
|
||||
echo "Refusing to replace existing source checkout at $CODEX_GSTACK. Run setup from that checkout or choose a separate project-local install location." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if { [ "$CODEX_REPO_LOCAL" -eq 1 ] || [ "$HOST" = codex ] || { [ "$HOST" = auto ] && command -v codex >/dev/null 2>&1; }; } \
|
||||
&& [ -d "$CODEX_GSTACK" ] && [ ! -L "$CODEX_GSTACK" ]; then
|
||||
_codex_runtime="$(cd "$CODEX_GSTACK" && pwd -P)"
|
||||
case "$SOURCE_GSTACK_DIR" in
|
||||
"$_codex_runtime"/*)
|
||||
echo "Refusing: Codex runtime directory contains the source checkout: $CODEX_GSTACK -> $_codex_runtime (source: $SOURCE_GSTACK_DIR). Use a separate skills directory; setup will not relocate or replace it automatically." >&2
|
||||
exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
IS_WINDOWS=0
|
||||
case "$(uname -s)" in
|
||||
MINGW*|MSYS*|CYGWIN*|Windows_NT) IS_WINDOWS=1 ;;
|
||||
@@ -538,6 +619,17 @@ _browser_hint() {
|
||||
fi
|
||||
}
|
||||
|
||||
_CODEX_PREFLIGHT_SELECTED=0
|
||||
if [ "$LOCAL_INSTALL" -eq 0 ]; then
|
||||
if [ "$HOST" = codex ] || { [ "$HOST" = auto ] && command -v codex >/dev/null 2>&1; }; then
|
||||
_CODEX_PREFLIGHT_SELECTED=1
|
||||
fi
|
||||
fi
|
||||
bun "$SOURCE_GSTACK_DIR/scripts/preflight-codex-overlap.ts" \
|
||||
--source "$SOURCE_GSTACK_DIR" --namespace "$CODEX_SKILLS" \
|
||||
--selected "$_CODEX_PREFLIGHT_SELECTED" --local "$CODEX_REPO_LOCAL" \
|
||||
--windows "$IS_WINDOWS" --relocation "$HOME/.gstack/repos/gstack" || exit 1
|
||||
|
||||
# ─── Resolve skill prefix preference ─────────────────────────
|
||||
# Priority: CLI flag > saved config > interactive prompt (or flat default for non-TTY)
|
||||
GSTACK_CONFIG="$SOURCE_GSTACK_DIR/bin/gstack-config"
|
||||
@@ -646,8 +738,8 @@ migrate_direct_codex_install() {
|
||||
local codex_gstack="$2"
|
||||
local migrated_dir="$HOME/.gstack/repos/gstack"
|
||||
|
||||
[ "$gstack_dir" = "$codex_gstack" ] || return 0
|
||||
[ -L "$gstack_dir" ] && return 0
|
||||
[ -L "$codex_gstack" ] && return 0
|
||||
[ -d "$codex_gstack" ] && [ "$(cd "$codex_gstack" && pwd -P)" = "$gstack_dir" ] || return 0
|
||||
|
||||
mkdir -p "$(dirname "$migrated_dir")"
|
||||
if [ -e "$migrated_dir" ] && [ "$migrated_dir" != "$gstack_dir" ]; then
|
||||
@@ -669,10 +761,13 @@ migrate_direct_codex_install() {
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$INSTALL_CODEX" -eq 1 ]; then
|
||||
if [ "$INSTALL_CODEX" -eq 1 ] && [ "$CODEX_REPO_LOCAL" -eq 0 ]; then
|
||||
migrate_direct_codex_install "$SOURCE_GSTACK_DIR" "$CODEX_GSTACK"
|
||||
fi
|
||||
|
||||
SKILLS_BASENAME="$(basename "$INSTALL_SKILLS_DIR")"
|
||||
SKILLS_PARENT_BASENAME="$(basename "$(dirname "$INSTALL_SKILLS_DIR")")"
|
||||
|
||||
# Kill an entire process tree rooted at $1, leaves first. Killing only the
|
||||
# backgrounded subshell orphans the wedged node/bun -> Chromium probe
|
||||
# processes underneath it — re-creating the #2136 stuck-process pile-up and
|
||||
@@ -731,7 +826,7 @@ ensure_playwright_browser() {
|
||||
# setup.
|
||||
local probe_cmd
|
||||
if command -v node >/dev/null 2>&1; then
|
||||
probe_cmd='node -e "const { chromium } = require((process.cwd()) + \"/node_modules/playwright\"); (async () => { const b = await chromium.launch(); await b.close(); })().then(() => process.exit(0), () => process.exit(1))"'
|
||||
probe_cmd='node -e "const { chromium } = require((process.cwd()) + \"/node_modules/playwright\"); (async () => { const b = await chromium.launch(); await b.close(); })().then(() => process.exit(0), error => { console.error(error.message); process.exit(1); })"'
|
||||
elif [ "$IS_WINDOWS" -eq 1 ]; then
|
||||
echo "gstack setup failed: Node.js is required on Windows" >&2
|
||||
return 1
|
||||
@@ -741,7 +836,7 @@ ensure_playwright_browser() {
|
||||
(
|
||||
cd "$SOURCE_GSTACK_DIR"
|
||||
eval "$probe_cmd"
|
||||
) >/dev/null 2>&1 &
|
||||
) >/dev/null &
|
||||
_wait_with_deadline $! 90
|
||||
}
|
||||
|
||||
@@ -977,9 +1072,9 @@ fi
|
||||
# --host all later. On success, normal generation may prune orphan old renders.
|
||||
export GSTACK_DEFER_CLAUDE_RENAME_PRUNE=1
|
||||
export GSTACK_CODEX_GENERATION_MODEL="$CODEX_GENERATION_MODEL"
|
||||
if GSTACK_RENAME_COPY="$IS_WINDOWS" bun_cmd "$SOURCE_GSTACK_DIR/bin/gstack-migrate-claude-code" \
|
||||
if CODEX_HOME="$(dirname "$CODEX_SKILLS")" GSTACK_RENAME_COPY="$IS_WINDOWS" bun_cmd "$SOURCE_GSTACK_DIR/bin/gstack-migrate-claude-code" \
|
||||
--install-dir "$SOURCE_GSTACK_DIR" --skills-dir "$INSTALL_SKILLS_DIR"; then
|
||||
unset GSTACK_DEFER_CLAUDE_RENAME_PRUNE
|
||||
if [ "$CODEX_REPO_LOCAL" -eq 0 ]; then unset GSTACK_DEFER_CLAUDE_RENAME_PRUNE; fi
|
||||
fi
|
||||
|
||||
# 1. Build browse binary if needed (smart rebuild: stale sources, package.json, lock).
|
||||
@@ -1186,17 +1281,21 @@ if [ "$INSTALL_CURSOR" -eq 1 ] && [ "$NEEDS_BUILD" -eq 0 ]; then
|
||||
fi
|
||||
|
||||
# 2. Ensure Playwright's Chromium is available
|
||||
# Detect Ubuntu 26.04: Playwright does not yet ship a native chromium build for
|
||||
# ubuntu26.04-x64. Override the platform to ubuntu24.04-x64 so the installer
|
||||
# picks the correct binary. This is safe because the ubuntu24.04 build runs
|
||||
# fine on ubuntu26.04 (same glibc lineage). See #2101.
|
||||
_PLAYWRIGHT_PLATFORM_OVERRIDE=""
|
||||
_PLAYWRIGHT_UNSUPPORTED_ARCH=""
|
||||
if [ -f /etc/os-release ]; then
|
||||
_os_id=$(grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"')
|
||||
_os_ver=$(grep '^VERSION_ID=' /etc/os-release | cut -d= -f2 | tr -d '"')
|
||||
if [ "$_os_id" = "ubuntu" ] && [ "$_os_ver" = "26.04" ]; then
|
||||
_PLAYWRIGHT_PLATFORM_OVERRIDE="ubuntu24.04-x64"
|
||||
echo "Ubuntu 26.04 detected — using PLAYWRIGHT_HOST_PLATFORM_OVERRIDE=$_PLAYWRIGHT_PLATFORM_OVERRIDE"
|
||||
_pw_arch="$(uname -m)"
|
||||
case "$_pw_arch" in
|
||||
x86_64) _PLAYWRIGHT_PLATFORM_OVERRIDE="ubuntu24.04-x64" ;;
|
||||
aarch64|arm64) _PLAYWRIGHT_PLATFORM_OVERRIDE="ubuntu24.04-arm64" ;;
|
||||
*) _PLAYWRIGHT_UNSUPPORTED_ARCH="$_pw_arch" ;;
|
||||
esac
|
||||
if [ -n "$_PLAYWRIGHT_PLATFORM_OVERRIDE" ]; then
|
||||
echo "Ubuntu 26.04 detected — using PLAYWRIGHT_HOST_PLATFORM_OVERRIDE=$_PLAYWRIGHT_PLATFORM_OVERRIDE"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1235,6 +1334,8 @@ _PW_INSTALL_TIMEOUT=$((10#$_PW_INSTALL_TIMEOUT))
|
||||
|
||||
if [ "${GSTACK_SKIP_PLAYWRIGHT:-0}" = "1" ]; then
|
||||
_pw_fail skipped "GSTACK_SKIP_PLAYWRIGHT=1 — Chromium install skipped by request (#913)"
|
||||
elif [ -n "${_PLAYWRIGHT_UNSUPPORTED_ARCH:-}" ]; then
|
||||
_pw_fail unsupported-platform "Ubuntu 26.04 architecture $_PLAYWRIGHT_UNSUPPORTED_ARCH has no supported Playwright Chromium fallback; no browser install attempted"
|
||||
elif ! ensure_playwright_browser; then
|
||||
echo "Installing Playwright Chromium..."
|
||||
# XProtect self-heal (#2554): the probe failure may be the OS killing the
|
||||
@@ -1351,7 +1452,7 @@ if [ -z "$_PW_FAIL_REASON" ] && ! ensure_playwright_browser; then
|
||||
if [ "$IS_WINDOWS" -eq 1 ]; then
|
||||
_pw_fail post-install-launch "Playwright Chromium could not be launched via Node.js (oven-sh/bun#4253) — ensure 'node -e \"require('playwright')\"' works, then re-run ./setup"
|
||||
else
|
||||
_pw_fail post-install-launch "Playwright Chromium installed but could not be launched — on Ubuntu 24.04+ (AppArmor blocks unprivileged user namespaces) try GSTACK_CHROMIUM_NO_SANDBOX=1 (#2157)"
|
||||
_pw_fail post-install-launch "Playwright Chromium installed but could not be launched — see the launch error above. For AppArmor/user-namespace errors on Ubuntu 24.04+, try GSTACK_CHROMIUM_NO_SANDBOX=1 (#2157)"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1767,6 +1868,7 @@ link_codex_skill_dirs() {
|
||||
# browse/), not a skill. Linking it would overwrite the root gstack
|
||||
# symlink that Step 5 already pointed at the repo root.
|
||||
[ "$skill_name" = "gstack" ] && continue
|
||||
if [ "${CODEX_REPO_LOCAL:-0}" -eq 1 ] && [ "$skill_name" = "gstack-claude" ]; then continue; fi
|
||||
target="$skills_dir/$skill_name"
|
||||
# Create or update symlink
|
||||
# #2444: on Windows the installed target is a REAL directory copy, so
|
||||
@@ -2263,13 +2365,6 @@ link_cursor_skill_dirs() {
|
||||
}
|
||||
|
||||
# 4. Install for Claude (default)
|
||||
SKILLS_BASENAME="$(basename "$INSTALL_SKILLS_DIR")"
|
||||
SKILLS_PARENT_BASENAME="$(basename "$(dirname "$INSTALL_SKILLS_DIR")")"
|
||||
CODEX_REPO_LOCAL=0
|
||||
if [ "$SKILLS_BASENAME" = "skills" ] && [ "$SKILLS_PARENT_BASENAME" = ".agents" ]; then
|
||||
CODEX_REPO_LOCAL=1
|
||||
fi
|
||||
|
||||
if [ "$INSTALL_CLAUDE" -eq 1 ]; then
|
||||
if [ "$SKILLS_BASENAME" = "skills" ]; then
|
||||
# Clean up stale symlinks from the opposite prefix mode
|
||||
@@ -2386,16 +2481,22 @@ fi
|
||||
|
||||
# 5. Install for Codex
|
||||
if [ "$INSTALL_CODEX" -eq 1 ]; then
|
||||
if [ "$CODEX_REPO_LOCAL" -eq 1 ]; then
|
||||
CODEX_SKILLS="$INSTALL_SKILLS_DIR"
|
||||
CODEX_GSTACK="$INSTALL_GSTACK_DIR"
|
||||
fi
|
||||
mkdir -p "$CODEX_SKILLS"
|
||||
|
||||
# Skip runtime root creation for repo-local installs — the checkout IS the runtime root.
|
||||
# create_codex_runtime_root would create self-referential symlinks (bin → bin, etc.).
|
||||
if [ "$CODEX_REPO_LOCAL" -eq 0 ]; then
|
||||
create_codex_runtime_root "$SOURCE_GSTACK_DIR" "$CODEX_GSTACK"
|
||||
CODEX_RUNTIME_IN_PLACE=0
|
||||
if [ "$CODEX_REPO_LOCAL" -eq 1 ] && [ -d "$CODEX_GSTACK" ]; then
|
||||
_codex_runtime="$(cd "$CODEX_GSTACK" && pwd -P)"
|
||||
_codex_render="$(cd "$SOURCE_GSTACK_DIR/.agents/skills/gstack" 2>/dev/null && pwd -P || true)"
|
||||
if [ "$_codex_runtime" = "$SOURCE_GSTACK_DIR" ] || [ "$_codex_runtime" = "$_codex_render" ]; then
|
||||
CODEX_RUNTIME_IN_PLACE=1
|
||||
fi
|
||||
fi
|
||||
if [ "$CODEX_RUNTIME_IN_PLACE" -eq 0 ]; then
|
||||
if [ "$CODEX_REPO_LOCAL" -eq 1 ] && _sidecar_root_user_owned "$CODEX_GSTACK"; then
|
||||
echo " left in place (existing dir not gstack-managed — no generated banner): $CODEX_GSTACK" >&2
|
||||
else
|
||||
create_codex_runtime_root "$SOURCE_GSTACK_DIR" "$CODEX_GSTACK"
|
||||
fi
|
||||
fi
|
||||
# Install generated Codex-format skills (not Claude source dirs)
|
||||
_prune_stale_generated "$SOURCE_GSTACK_DIR" "$SOURCE_GSTACK_DIR/.agents/skills" "$CODEX_SKILLS"
|
||||
@@ -2570,7 +2671,7 @@ if [ -d "$MIGRATIONS_DIR" ] && [ "$CURRENT_VERSION" != "unknown" ] && [ "$LAST_S
|
||||
# ~/.gstack state) default to ~/.claude/skills/gstack when unset —
|
||||
# a repo-local ./setup would silently no-op them against the wrong
|
||||
# tree without this.
|
||||
GSTACK_INSTALL_DIR="$SOURCE_GSTACK_DIR" bash "$migration" || echo " warning: migration $m_ver had errors (non-fatal)"
|
||||
CODEX_HOME="$(dirname "$CODEX_SKILLS")" GSTACK_INSTALL_DIR="$SOURCE_GSTACK_DIR" bash "$migration" || echo " warning: migration $m_ver had errors (non-fatal)"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user