mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 17:11:28 +01:00
Codex skills no longer stop on temp-file cleanup, which Codex refuses as rm -f (GST-3364) (#4612)
Skills that clean up temp files now run on Codex: Codex CLI refuses any `rm` with a force flag, and 67 of the 1,239 shell blocks in gstack's Codex skills used one. This unblocks gstack on Codex (office-hours, review, ship, the plan reviews, spec and gstack-upgrade all hit it). Nothing to do after merging. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=state-machines Review-Finding: gstack-upgrade/SKILL.md.tmpl:363:posix-sh-brace-expansion reader=core
This commit is contained in:
1 parent
43c9c201e3
commit
bd77c8ccaa
86 files changed
+337
-204
No files matched your search
+13
-16
@@ -208,28 +208,26 @@ If `$STASH_OUTPUT` contains "Saved working directory", warn the user: "Note: loc
|
||||
**For vendored installs** (vendored, vendored-global):
|
||||
```bash
|
||||
(cd -- "${INSTALL_DIR:?INSTALL_DIR is not set: re-run Step 2 and substitute the printed path}" && [ -f VERSION ] && [ -f setup ] && [ -f bin/gstack-config ]) || { echo "ERROR: INSTALL_DIR=${INSTALL_DIR:-} is not a gstack install; nothing was changed. Re-run Step 2." >&2; exit 1; }
|
||||
# A stale .bak from a previously crashed upgrade would make the mv below NEST
|
||||
# the live install inside it and the failure-restore arm would "restore" the
|
||||
# stale backup. It may also be the only good copy from that crashed run —
|
||||
# abort and let the human inspect, never delete it silently.
|
||||
# A stale .bak (a crashed upgrade's) would NEST the live install in the mv
|
||||
# below, and may be the only good copy: abort for the human, never delete it.
|
||||
[ -e "$INSTALL_DIR.bak" ] && { echo "ERROR: stale backup exists at $INSTALL_DIR.bak (from a previous failed upgrade?) — inspect it, salvage/remove it, then re-run." >&2; exit 1; }
|
||||
TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/gstack-upgrade.XXXXXX") || { echo "ERROR: mktemp failed — aborting upgrade (install untouched)." >&2; exit 1; }
|
||||
git clone --depth 1 https://github.com/garrytan/gstack.git "$TMP_DIR/gstack" || { echo "ERROR: clone failed — aborting upgrade (install untouched)." >&2; rm -rf "$TMP_DIR"; exit 1; }
|
||||
mv "$INSTALL_DIR" "$INSTALL_DIR.bak" || { rm -rf "$TMP_DIR"; exit 1; }
|
||||
git clone --depth 1 https://github.com/garrytan/gstack.git "$TMP_DIR/gstack" || { echo "ERROR: clone failed — aborting upgrade (install untouched)." >&2; rm -r "$TMP_DIR" </dev/null; exit 1; }
|
||||
mv "$INSTALL_DIR" "$INSTALL_DIR.bak" || { rm -r "$TMP_DIR" </dev/null; exit 1; }
|
||||
if mv "$TMP_DIR/gstack" "$INSTALL_DIR"; then
|
||||
if (cd "$INSTALL_DIR" && ./setup --refresh-registered); then
|
||||
rm -rf "$INSTALL_DIR.bak" "$TMP_DIR"
|
||||
rm -r "$INSTALL_DIR.bak" "$TMP_DIR" </dev/null
|
||||
else
|
||||
rm -rf "$INSTALL_DIR"
|
||||
rm -r "$INSTALL_DIR" </dev/null
|
||||
mv "$INSTALL_DIR.bak" "$INSTALL_DIR" || { echo "ERROR: restore failed; backup retained." >&2; exit 1; }
|
||||
rm -rf "$TMP_DIR"
|
||||
rm -r "$TMP_DIR" </dev/null
|
||||
echo "ERROR: setup failed; previous install restored." >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
mv "$INSTALL_DIR.bak" "$INSTALL_DIR"
|
||||
echo "ERROR: swap failed — previous install restored; upgrade aborted." >&2
|
||||
rm -rf "$TMP_DIR"
|
||||
rm -r "$TMP_DIR" </dev/null
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
@@ -263,7 +261,7 @@ git rm -r --cached .claude/skills/gstack/ 2>/dev/null || true
|
||||
if ! grep -qF '.claude/skills/gstack/' .gitignore 2>/dev/null; then
|
||||
echo '.claude/skills/gstack/' >> .gitignore
|
||||
fi
|
||||
rm -rf "$LOCAL_GSTACK"
|
||||
rm -r "$LOCAL_GSTACK" </dev/null
|
||||
```
|
||||
Tell user: "Removed vendored copy at `$LOCAL_GSTACK` (team mode active — global install is the source of truth). Commit the `.gitignore` change when ready."
|
||||
|
||||
@@ -273,11 +271,11 @@ Tell user: "Removed vendored copy at `$LOCAL_GSTACK` (team mode active — globa
|
||||
(cd -- "${LOCAL_GSTACK:?LOCAL_GSTACK is not set: re-run the detection block above and substitute the printed path}" && [ -f VERSION ] && [ -f setup ] && [ -f bin/gstack-config ]) || { echo "ERROR: LOCAL_GSTACK=${LOCAL_GSTACK:-} is not a gstack copy; nothing was changed." >&2; exit 1; }
|
||||
[ -e "$LOCAL_GSTACK.bak" ] && { echo "ERROR: stale vendored backup; inspect it before retrying." >&2; exit 1; }
|
||||
mv "$LOCAL_GSTACK" "$LOCAL_GSTACK.bak" || exit 1
|
||||
if cp -Rf "$INSTALL_DIR" "$LOCAL_GSTACK" && rm -rf "$LOCAL_GSTACK/.git" && (cd "$LOCAL_GSTACK" && ./setup --refresh-registered); then
|
||||
rm -rf "$LOCAL_GSTACK.bak"
|
||||
if cp -Rf "$INSTALL_DIR" "$LOCAL_GSTACK" && { [ ! -e "$LOCAL_GSTACK/.git" ] || rm -r "$LOCAL_GSTACK/.git" </dev/null; } && (cd "$LOCAL_GSTACK" && ./setup --refresh-registered); then
|
||||
rm -r "$LOCAL_GSTACK.bak" </dev/null
|
||||
echo "LOCAL_SYNC_OK"
|
||||
else
|
||||
rm -rf "$LOCAL_GSTACK"
|
||||
rm -r "$LOCAL_GSTACK" </dev/null
|
||||
mv "$LOCAL_GSTACK.bak" "$LOCAL_GSTACK" || { echo "ERROR: restore failed; backup retained." >&2; exit 1; }
|
||||
echo "ERROR: sync failed; previous vendored copy restored." >&2
|
||||
exit 1
|
||||
@@ -354,8 +352,7 @@ Substitute the install directory from Step 2, then act on `DAEMON_CHECK`:
|
||||
GSTACK_STATE_ROOT=$(~/.claude/skills/gstack/bin/gstack-paths --get GSTACK_STATE_ROOT); : "${GSTACK_STATE_ROOT:?gstack-paths failed; reinstall with ./setup or /gstack-upgrade}"
|
||||
mkdir -p "$GSTACK_STATE_ROOT"
|
||||
echo "$OLD_VERSION" > "$GSTACK_STATE_ROOT"/just-upgraded-from
|
||||
rm -f "$GSTACK_STATE_ROOT"/last-update-check
|
||||
rm -f "$GSTACK_STATE_ROOT"/update-snoozed
|
||||
rm "$GSTACK_STATE_ROOT/last-update-check" "$GSTACK_STATE_ROOT/update-snoozed" 2>/dev/null || :
|
||||
```
|
||||
|
||||
### Step 6: Show What's New
|
||||
|
||||
@@ -214,28 +214,26 @@ If `$STASH_OUTPUT` contains "Saved working directory", warn the user: "Note: loc
|
||||
**For vendored installs** (vendored, vendored-global):
|
||||
```bash
|
||||
(cd -- "${INSTALL_DIR:?INSTALL_DIR is not set: re-run Step 2 and substitute the printed path}" && [ -f VERSION ] && [ -f setup ] && [ -f bin/gstack-config ]) || { echo "ERROR: INSTALL_DIR=${INSTALL_DIR:-} is not a gstack install; nothing was changed. Re-run Step 2." >&2; exit 1; }
|
||||
# A stale .bak from a previously crashed upgrade would make the mv below NEST
|
||||
# the live install inside it and the failure-restore arm would "restore" the
|
||||
# stale backup. It may also be the only good copy from that crashed run —
|
||||
# abort and let the human inspect, never delete it silently.
|
||||
# A stale .bak (a crashed upgrade's) would NEST the live install in the mv
|
||||
# below, and may be the only good copy: abort for the human, never delete it.
|
||||
[ -e "$INSTALL_DIR.bak" ] && { echo "ERROR: stale backup exists at $INSTALL_DIR.bak (from a previous failed upgrade?) — inspect it, salvage/remove it, then re-run." >&2; exit 1; }
|
||||
TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/gstack-upgrade.XXXXXX") || { echo "ERROR: mktemp failed — aborting upgrade (install untouched)." >&2; exit 1; }
|
||||
git clone --depth 1 https://github.com/garrytan/gstack.git "$TMP_DIR/gstack" || { echo "ERROR: clone failed — aborting upgrade (install untouched)." >&2; rm -rf "$TMP_DIR"; exit 1; }
|
||||
mv "$INSTALL_DIR" "$INSTALL_DIR.bak" || { rm -rf "$TMP_DIR"; exit 1; }
|
||||
git clone --depth 1 https://github.com/garrytan/gstack.git "$TMP_DIR/gstack" || { echo "ERROR: clone failed — aborting upgrade (install untouched)." >&2; rm -r "$TMP_DIR" </dev/null; exit 1; }
|
||||
mv "$INSTALL_DIR" "$INSTALL_DIR.bak" || { rm -r "$TMP_DIR" </dev/null; exit 1; }
|
||||
if mv "$TMP_DIR/gstack" "$INSTALL_DIR"; then
|
||||
if (cd "$INSTALL_DIR" && {{SETUP_COMMAND}} --refresh-registered); then
|
||||
rm -rf "$INSTALL_DIR.bak" "$TMP_DIR"
|
||||
rm -r "$INSTALL_DIR.bak" "$TMP_DIR" </dev/null
|
||||
else
|
||||
rm -rf "$INSTALL_DIR"
|
||||
rm -r "$INSTALL_DIR" </dev/null
|
||||
mv "$INSTALL_DIR.bak" "$INSTALL_DIR" || { echo "ERROR: restore failed; backup retained." >&2; exit 1; }
|
||||
rm -rf "$TMP_DIR"
|
||||
rm -r "$TMP_DIR" </dev/null
|
||||
echo "ERROR: setup failed; previous install restored." >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
mv "$INSTALL_DIR.bak" "$INSTALL_DIR"
|
||||
echo "ERROR: swap failed — previous install restored; upgrade aborted." >&2
|
||||
rm -rf "$TMP_DIR"
|
||||
rm -r "$TMP_DIR" </dev/null
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
@@ -269,7 +267,7 @@ git rm -r --cached .claude/skills/gstack/ 2>/dev/null || true
|
||||
if ! grep -qF '.claude/skills/gstack/' .gitignore 2>/dev/null; then
|
||||
echo '.claude/skills/gstack/' >> .gitignore
|
||||
fi
|
||||
rm -rf "$LOCAL_GSTACK"
|
||||
rm -r "$LOCAL_GSTACK" </dev/null
|
||||
```
|
||||
Tell user: "Removed vendored copy at `$LOCAL_GSTACK` (team mode active — global install is the source of truth). Commit the `.gitignore` change when ready."
|
||||
|
||||
@@ -279,11 +277,11 @@ Tell user: "Removed vendored copy at `$LOCAL_GSTACK` (team mode active — globa
|
||||
(cd -- "${LOCAL_GSTACK:?LOCAL_GSTACK is not set: re-run the detection block above and substitute the printed path}" && [ -f VERSION ] && [ -f setup ] && [ -f bin/gstack-config ]) || { echo "ERROR: LOCAL_GSTACK=${LOCAL_GSTACK:-} is not a gstack copy; nothing was changed." >&2; exit 1; }
|
||||
[ -e "$LOCAL_GSTACK.bak" ] && { echo "ERROR: stale vendored backup; inspect it before retrying." >&2; exit 1; }
|
||||
mv "$LOCAL_GSTACK" "$LOCAL_GSTACK.bak" || exit 1
|
||||
if cp -Rf "$INSTALL_DIR" "$LOCAL_GSTACK" && rm -rf "$LOCAL_GSTACK/.git" && (cd "$LOCAL_GSTACK" && {{SETUP_COMMAND}} --refresh-registered); then
|
||||
rm -rf "$LOCAL_GSTACK.bak"
|
||||
if cp -Rf "$INSTALL_DIR" "$LOCAL_GSTACK" && { [ ! -e "$LOCAL_GSTACK/.git" ] || rm -r "$LOCAL_GSTACK/.git" </dev/null; } && (cd "$LOCAL_GSTACK" && {{SETUP_COMMAND}} --refresh-registered); then
|
||||
rm -r "$LOCAL_GSTACK.bak" </dev/null
|
||||
echo "LOCAL_SYNC_OK"
|
||||
else
|
||||
rm -rf "$LOCAL_GSTACK"
|
||||
rm -r "$LOCAL_GSTACK" </dev/null
|
||||
mv "$LOCAL_GSTACK.bak" "$LOCAL_GSTACK" || { echo "ERROR: restore failed; backup retained." >&2; exit 1; }
|
||||
echo "ERROR: sync failed; previous vendored copy restored." >&2
|
||||
exit 1
|
||||
@@ -360,8 +358,7 @@ Substitute the install directory from Step 2, then act on `DAEMON_CHECK`:
|
||||
GSTACK_STATE_ROOT=$(~/.claude/skills/gstack/bin/gstack-paths --get GSTACK_STATE_ROOT); : "${GSTACK_STATE_ROOT:?gstack-paths failed; reinstall with ./setup or /gstack-upgrade}"
|
||||
mkdir -p "$GSTACK_STATE_ROOT"
|
||||
echo "$OLD_VERSION" > "$GSTACK_STATE_ROOT"/just-upgraded-from
|
||||
rm -f "$GSTACK_STATE_ROOT"/last-update-check
|
||||
rm -f "$GSTACK_STATE_ROOT"/update-snoozed
|
||||
rm "$GSTACK_STATE_ROOT/last-update-check" "$GSTACK_STATE_ROOT/update-snoozed" 2>/dev/null || :
|
||||
```
|
||||
|
||||
### Step 6: Show What's New
|
||||
|
||||
Reference in new issue
Block a user