mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-01 19:25:10 +02:00
fix: gstack-team-init detects and removes vendored copies (#848)
* fix: gstack-team-init detects and removes vendored copies in team mode When running gstack-team-init inside a repo with a vendored .claude/skills/gstack/, the script now auto-detects and removes it: git rm --cached, add to .gitignore, rm -rf. Also adds team_mode config key to setup --team/--no-team, and makes gstack-upgrade Step 4.5 team-mode aware (remove instead of sync). Includes 5 new integration tests for the vendored copy migration. * chore: bump version and changelog (v0.15.14.0) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+21
-5
@@ -137,9 +137,9 @@ cd "$INSTALL_DIR" && ./setup
|
||||
rm -rf "$INSTALL_DIR.bak" "$TMP_DIR"
|
||||
```
|
||||
|
||||
### Step 4.5: Sync local vendored copy
|
||||
### Step 4.5: Handle local vendored copy
|
||||
|
||||
Use the install directory from Step 2. Check if there's also a local vendored copy that needs updating:
|
||||
Use the install directory from Step 2. Check if there's also a local vendored copy, and whether team mode is active:
|
||||
|
||||
```bash
|
||||
_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||
@@ -151,10 +151,24 @@ if [ -n "$_ROOT" ] && [ -d "$_ROOT/.claude/skills/gstack" ]; then
|
||||
LOCAL_GSTACK="$_ROOT/.claude/skills/gstack"
|
||||
fi
|
||||
fi
|
||||
_TEAM_MODE=$(~/.claude/skills/gstack/bin/gstack-config get team_mode 2>/dev/null || echo "false")
|
||||
echo "LOCAL_GSTACK=$LOCAL_GSTACK"
|
||||
echo "TEAM_MODE=$_TEAM_MODE"
|
||||
```
|
||||
|
||||
If `LOCAL_GSTACK` is non-empty, update it by copying from the freshly-upgraded primary install (same approach as README vendored install):
|
||||
**If `LOCAL_GSTACK` is non-empty AND `TEAM_MODE` is `true`:** Remove the vendored copy. Team mode uses the global install as the single source of truth.
|
||||
|
||||
```bash
|
||||
cd "$_ROOT"
|
||||
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"
|
||||
```
|
||||
Tell user: "Removed vendored copy at `$LOCAL_GSTACK` (team mode active — global install is the source of truth). Commit the `.gitignore` change when ready."
|
||||
|
||||
**If `LOCAL_GSTACK` is non-empty AND `TEAM_MODE` is NOT `true`:** Update it by copying from the freshly-upgraded primary install (same approach as README vendored install):
|
||||
```bash
|
||||
mv "$LOCAL_GSTACK" "$LOCAL_GSTACK.bak"
|
||||
cp -Rf "$INSTALL_DIR" "$LOCAL_GSTACK"
|
||||
@@ -243,11 +257,13 @@ Use the output to determine if an upgrade is available.
|
||||
|
||||
3. If no output (primary is up to date): check for a stale local vendored copy.
|
||||
|
||||
Run the Step 2 bash block above to detect the primary install type and directory (`INSTALL_TYPE` and `INSTALL_DIR`). Then run the Step 4.5 detection bash block above to check for a local vendored copy (`LOCAL_GSTACK`).
|
||||
Run the Step 2 bash block above to detect the primary install type and directory (`INSTALL_TYPE` and `INSTALL_DIR`). Then run the Step 4.5 detection bash block above to check for a local vendored copy (`LOCAL_GSTACK`) and team mode status (`TEAM_MODE`).
|
||||
|
||||
**If `LOCAL_GSTACK` is empty** (no local vendored copy): tell the user "You're already on the latest version (v{version})."
|
||||
|
||||
**If `LOCAL_GSTACK` is non-empty**, compare versions:
|
||||
**If `LOCAL_GSTACK` is non-empty AND `TEAM_MODE` is `true`:** Remove the vendored copy using the Step 4.5 team-mode removal bash block above. Tell user: "Global v{version} is up to date. Removed stale vendored copy (team mode active). Commit the `.gitignore` change when ready."
|
||||
|
||||
**If `LOCAL_GSTACK` is non-empty AND `TEAM_MODE` is NOT `true`**, compare versions:
|
||||
```bash
|
||||
PRIMARY_VER=$(cat "$INSTALL_DIR/VERSION" 2>/dev/null || echo "unknown")
|
||||
LOCAL_VER=$(cat "$LOCAL_GSTACK/VERSION" 2>/dev/null || echo "unknown")
|
||||
|
||||
@@ -139,9 +139,9 @@ cd "$INSTALL_DIR" && ./setup
|
||||
rm -rf "$INSTALL_DIR.bak" "$TMP_DIR"
|
||||
```
|
||||
|
||||
### Step 4.5: Sync local vendored copy
|
||||
### Step 4.5: Handle local vendored copy
|
||||
|
||||
Use the install directory from Step 2. Check if there's also a local vendored copy that needs updating:
|
||||
Use the install directory from Step 2. Check if there's also a local vendored copy, and whether team mode is active:
|
||||
|
||||
```bash
|
||||
_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||
@@ -153,10 +153,24 @@ if [ -n "$_ROOT" ] && [ -d "$_ROOT/.claude/skills/gstack" ]; then
|
||||
LOCAL_GSTACK="$_ROOT/.claude/skills/gstack"
|
||||
fi
|
||||
fi
|
||||
_TEAM_MODE=$(~/.claude/skills/gstack/bin/gstack-config get team_mode 2>/dev/null || echo "false")
|
||||
echo "LOCAL_GSTACK=$LOCAL_GSTACK"
|
||||
echo "TEAM_MODE=$_TEAM_MODE"
|
||||
```
|
||||
|
||||
If `LOCAL_GSTACK` is non-empty, update it by copying from the freshly-upgraded primary install (same approach as README vendored install):
|
||||
**If `LOCAL_GSTACK` is non-empty AND `TEAM_MODE` is `true`:** Remove the vendored copy. Team mode uses the global install as the single source of truth.
|
||||
|
||||
```bash
|
||||
cd "$_ROOT"
|
||||
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"
|
||||
```
|
||||
Tell user: "Removed vendored copy at `$LOCAL_GSTACK` (team mode active — global install is the source of truth). Commit the `.gitignore` change when ready."
|
||||
|
||||
**If `LOCAL_GSTACK` is non-empty AND `TEAM_MODE` is NOT `true`:** Update it by copying from the freshly-upgraded primary install (same approach as README vendored install):
|
||||
```bash
|
||||
mv "$LOCAL_GSTACK" "$LOCAL_GSTACK.bak"
|
||||
cp -Rf "$INSTALL_DIR" "$LOCAL_GSTACK"
|
||||
@@ -245,11 +259,13 @@ Use the output to determine if an upgrade is available.
|
||||
|
||||
3. If no output (primary is up to date): check for a stale local vendored copy.
|
||||
|
||||
Run the Step 2 bash block above to detect the primary install type and directory (`INSTALL_TYPE` and `INSTALL_DIR`). Then run the Step 4.5 detection bash block above to check for a local vendored copy (`LOCAL_GSTACK`).
|
||||
Run the Step 2 bash block above to detect the primary install type and directory (`INSTALL_TYPE` and `INSTALL_DIR`). Then run the Step 4.5 detection bash block above to check for a local vendored copy (`LOCAL_GSTACK`) and team mode status (`TEAM_MODE`).
|
||||
|
||||
**If `LOCAL_GSTACK` is empty** (no local vendored copy): tell the user "You're already on the latest version (v{version})."
|
||||
|
||||
**If `LOCAL_GSTACK` is non-empty**, compare versions:
|
||||
**If `LOCAL_GSTACK` is non-empty AND `TEAM_MODE` is `true`:** Remove the vendored copy using the Step 4.5 team-mode removal bash block above. Tell user: "Global v{version} is up to date. Removed stale vendored copy (team mode active). Commit the `.gitignore` change when ready."
|
||||
|
||||
**If `LOCAL_GSTACK` is non-empty AND `TEAM_MODE` is NOT `true`**, compare versions:
|
||||
```bash
|
||||
PRIMARY_VER=$(cat "$INSTALL_DIR/VERSION" 2>/dev/null || echo "unknown")
|
||||
LOCAL_VER=$(cat "$LOCAL_GSTACK/VERSION" 2>/dev/null || echo "unknown")
|
||||
|
||||
Reference in New Issue
Block a user