Skip to content

Commit dc6252d

Browse files
garrytanclaude
andauthored
v1.33.2.0 fix: setup guards against Conductor worktree pollution of global install (garrytan#1446)
* fix(setup): skip Claude skill registration when run from a worktree of the global install Add a guard before `ln -snf "$SOURCE_GSTACK_DIR" "$HOME/.claude/skills/gstack"` that detects whether the target already exists as a separate real directory. On macOS/BSD, `ln -snf SRC DST` does not replace a real DST — it creates DST/$(basename SRC) → SRC inside it. Running ./setup from each Conductor worktree of the gstack repo was leaking per-worktree child symlinks into the global install, which Claude Code then picked up as separate top-level skills. The guard uses `cd ... && pwd -P` to resolve the existing real dir and compare against the source (mirroring setup's own `SOURCE_GSTACK_DIR` resolution). When they differ, prints a four-line remediation hint naming both paths and exits the Claude registration branch cleanly. Binaries still build locally. The four other code paths through this branch are unchanged: fresh install, retarget an existing symlink, self-rerun where the existing dir resolves to the same source, and --local installs. Includes 8 tests covering static guard placement, `pwd -P` resolution, the remediation message, a behavioral reproduction of the BSD `ln -snf` child- symlink bug, and every branch of the guard (skip on real-dir-elsewhere, allow on fresh, allow on existing symlink, allow on self-rerun). * chore: bump version and changelog (v1.33.2.0) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 1a4f0c9 commit dc6252d

5 files changed

Lines changed: 302 additions & 27 deletions

File tree

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
11
# Changelog
22

3+
## [1.33.2.0] - 2026-05-11
4+
5+
## **`./setup` no longer pollutes the global install when run from a Conductor worktree.**
6+
## **Six-line bash guard catches the BSD `ln -snf` footgun that was leaking per-worktree symlinks into `~/.claude/skills/gstack/`.**
7+
8+
When you ran `./setup` from a Conductor worktree of the gstack repo itself (e.g. `~/conductor/workspaces/gstack/dublin-v1`), it would silently corrupt your global install. The "register this checkout as the active gstack" branch did `ln -snf "$SOURCE_GSTACK_DIR" "$HOME/.claude/skills/gstack"`. On macOS and BSD, when the destination is an existing real directory (your global git clone), `ln -snf` does NOT replace it. It creates a child symlink INSIDE: `~/.claude/skills/gstack/dublin-v1 → ~/conductor/workspaces/gstack/dublin-v1`. Claude Code reads every directory in `~/.claude/skills/` that contains a `SKILL.md`, so each leaked worktree showed up as its own top-level skill: `/dublin-v1`, `/wellington`, `/santiago-v1`, etc. The skill picker filled with noise.
9+
10+
The fix in `setup` checks whether `~/.claude/skills/gstack` is already a real (non-symlink) directory whose resolved `pwd -P` differs from `$SOURCE_GSTACK_DIR`. If so, refuse the `ln -snf`, print a four-line remediation hint, and exit the Claude registration branch cleanly. Binaries (`browse`, `design`, `make-pdf`, `find-browse`) still build locally for dev. The four other code paths through the same branch (fresh install, retarget existing symlink, self-rerun pointing to the same dir, `--local`) are unchanged.
11+
12+
### The numbers that matter
13+
14+
Source: `bun test test/setup-conductor-worktree.test.ts` — 8 tests covering every branch of the new guard plus a behavioral reproduction of the BSD `ln -snf` bug itself.
15+
16+
| Scenario | Before | After |
17+
|---|---|---|
18+
| `./setup` from worktree A with global install present | Leaks `~/.claude/skills/gstack/A → workspaces/gstack/A` | Skipped with remediation hint |
19+
| `./setup` from N sibling worktrees over a week | N child symlinks accumulate inside global install | 0 leaks |
20+
| Claude Code skill picker shows extra entries | Yes: `dublin-v1`, `wellington`, `santiago-v1`, etc. | No |
21+
| Fresh install (no existing global) | Worked | Worked (unchanged path) |
22+
| Re-running `./setup` from inside the global install | Worked | Worked (unchanged path) |
23+
| Test coverage of the guard | 0 tests | 8 tests, all branches |
24+
25+
The behavioral test in `test/setup-conductor-worktree.test.ts` actually invokes `ln -snf SRC DST` against a real tmpdir to prove the macOS/BSD child-symlink behavior happens, then re-runs with the new guard to prove the leak doesn't. The bug is now documented in the test suite, not just the patch.
26+
27+
### What this means for builders
28+
29+
If you've been seeing extra top-level skills (`/dublin-v1`, `/wellington`, etc.) in Claude Code, that's the leak. Run `/gstack-upgrade` to pick up this fix, then manually remove the existing child symlinks: `cd ~/.claude/skills/gstack && find . -maxdepth 1 -type l -delete`. The guard prevents new leaks from `./setup` runs in any Conductor worktree of the gstack repo. If you actually want to register a worktree as the active gstack (rare, usually only when dogfooding a big in-progress change), remove the global install first: `rm -rf ~/.claude/skills/gstack && cd <your-worktree> && ./setup`.
30+
31+
### Itemized changes
32+
33+
#### Fixed
34+
35+
- **`setup`** — added Conductor worktree guard before `ln -snf "$SOURCE_GSTACK_DIR" "$CLAUDE_GSTACK_LINK"`. Checks `[ -d "$CLAUDE_GSTACK_LINK" ] && [ ! -L "$CLAUDE_GSTACK_LINK" ]` for a real directory, then `cd ... && pwd -P` to compare against the source. If they differ, sets `_SKIP_CLAUDE_REGISTER=1`, prints a remediation message naming both paths, and exits the Claude registration branch without touching the global install.
36+
37+
#### Added
38+
39+
- **`test/setup-conductor-worktree.test.ts`** — 8 tests (27 expect calls) covering: guard placement in `setup` before `ln -snf`, `pwd -P` resolution against `$SOURCE_GSTACK_DIR`, the skip-branch's remediation message, BSD `ln -snf` reproducer (proves the bug shape exists), guard skips when dest is real-dir-elsewhere, guard allows ln when dest doesn't exist, guard allows ln when dest is an existing symlink (upgrade-in-place), guard allows ln when dest already resolves to source (self-rerun).
40+
41+
#### For contributors
42+
43+
- The guard intentionally does NOT clean up pre-existing pollution inside `~/.claude/skills/gstack/`. Users must remove leaked symlinks manually (see "What this means for builders" above). Retroactive cleanup would require a separate migration script, filed for a future release if the manual remediation friction becomes noticeable.
44+
345
## [1.33.1.0] - 2026-05-11
446

547
## **Long skills stop drifting away from their starting context.**

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.33.1.0
1+
1.33.2.0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gstack",
3-
"version": "1.33.1.0",
3+
"version": "1.33.2.0",
44
"description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.",
55
"license": "MIT",
66
"type": "module",

setup

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -806,35 +806,68 @@ if [ "$INSTALL_CLAUDE" -eq 1 ]; then
806806
fi
807807
log " browse: $BROWSE_BIN"
808808
else
809-
# Not inside a skills/ directory — symlink into ~/.claude/skills/ and retry
809+
# Not inside a skills/ directory — would symlink the source into
810+
# ~/.claude/skills/gstack/ and register from there.
810811
CLAUDE_SKILLS_DIR="$HOME/.claude/skills"
811812
CLAUDE_GSTACK_LINK="$CLAUDE_SKILLS_DIR/gstack"
812-
mkdir -p "$CLAUDE_SKILLS_DIR"
813-
ln -snf "$SOURCE_GSTACK_DIR" "$CLAUDE_GSTACK_LINK"
814-
log " symlinked $CLAUDE_GSTACK_LINK -> $SOURCE_GSTACK_DIR"
815-
INSTALL_SKILLS_DIR="$CLAUDE_SKILLS_DIR"
816-
INSTALL_GSTACK_DIR="$CLAUDE_GSTACK_LINK"
817-
# Clean up stale symlinks from the opposite prefix mode
818-
if [ "$SKILL_PREFIX" -eq 1 ]; then
819-
cleanup_old_claude_symlinks "$SOURCE_GSTACK_DIR" "$INSTALL_SKILLS_DIR"
820-
else
821-
cleanup_prefixed_claude_symlinks "$SOURCE_GSTACK_DIR" "$INSTALL_SKILLS_DIR"
822-
fi
823-
"$SOURCE_GSTACK_DIR/bin/gstack-patch-names" "$SOURCE_GSTACK_DIR" "$SKILL_PREFIX"
824-
link_claude_skill_dirs "$SOURCE_GSTACK_DIR" "$INSTALL_SKILLS_DIR"
825-
GSTACK_RELINK="$SOURCE_GSTACK_DIR/bin/gstack-relink"
826-
if [ -x "$GSTACK_RELINK" ]; then
827-
GSTACK_SKILLS_DIR="$INSTALL_SKILLS_DIR" GSTACK_INSTALL_DIR="$SOURCE_GSTACK_DIR" "$GSTACK_RELINK" >/dev/null 2>&1 || true
828-
fi
829-
_OGB_LINK="$INSTALL_SKILLS_DIR/connect-chrome"
830-
if [ "$SKILL_PREFIX" -eq 1 ]; then
831-
_OGB_LINK="$INSTALL_SKILLS_DIR/gstack-connect-chrome"
813+
814+
# Conductor worktree guard: if ~/.claude/skills/gstack is already a real
815+
# (non-symlink) directory pointing to a *different* install, refuse to plant
816+
# a symlink there. On macOS/BSD, `ln -snf SRC DST` won't replace a real DST;
817+
# it creates DST/$(basename SRC) → SRC inside it. The result is per-worktree
818+
# symlinks leaking into the global install that Claude Code picks up as
819+
# separate top-level skills (dublin-v1, lincoln-v2, ...). Typical trigger:
820+
# running ./setup from a Conductor worktree of the gstack repo itself.
821+
_SKIP_CLAUDE_REGISTER=0
822+
if [ -d "$CLAUDE_GSTACK_LINK" ] && [ ! -L "$CLAUDE_GSTACK_LINK" ]; then
823+
_EXISTING_REAL=$(cd "$CLAUDE_GSTACK_LINK" 2>/dev/null && pwd -P || echo "")
824+
if [ -n "$_EXISTING_REAL" ] && [ "$_EXISTING_REAL" != "$SOURCE_GSTACK_DIR" ]; then
825+
_SKIP_CLAUDE_REGISTER=1
826+
fi
832827
fi
833-
if [ -L "$_OGB_LINK" ] || [ ! -e "$_OGB_LINK" ]; then
834-
ln -snf "gstack/open-gstack-browser" "$_OGB_LINK"
828+
829+
if [ "$_SKIP_CLAUDE_REGISTER" -eq 1 ]; then
830+
log ""
831+
log " $CLAUDE_GSTACK_LINK already exists as a separate global install."
832+
log " Skipping Claude skill registration to avoid polluting it with"
833+
log " per-worktree symlinks. (Binaries still built locally for dev.)"
834+
log ""
835+
log " Global install: $CLAUDE_GSTACK_LINK"
836+
log " This worktree: $SOURCE_GSTACK_DIR"
837+
log ""
838+
log " To register this worktree as the active gstack, remove the global"
839+
log " install first: rm -rf $CLAUDE_GSTACK_LINK"
840+
log ""
841+
log "gstack built (claude registration skipped)."
842+
log " browse: $BROWSE_BIN"
843+
else
844+
mkdir -p "$CLAUDE_SKILLS_DIR"
845+
ln -snf "$SOURCE_GSTACK_DIR" "$CLAUDE_GSTACK_LINK"
846+
log " symlinked $CLAUDE_GSTACK_LINK -> $SOURCE_GSTACK_DIR"
847+
INSTALL_SKILLS_DIR="$CLAUDE_SKILLS_DIR"
848+
INSTALL_GSTACK_DIR="$CLAUDE_GSTACK_LINK"
849+
# Clean up stale symlinks from the opposite prefix mode
850+
if [ "$SKILL_PREFIX" -eq 1 ]; then
851+
cleanup_old_claude_symlinks "$SOURCE_GSTACK_DIR" "$INSTALL_SKILLS_DIR"
852+
else
853+
cleanup_prefixed_claude_symlinks "$SOURCE_GSTACK_DIR" "$INSTALL_SKILLS_DIR"
854+
fi
855+
"$SOURCE_GSTACK_DIR/bin/gstack-patch-names" "$SOURCE_GSTACK_DIR" "$SKILL_PREFIX"
856+
link_claude_skill_dirs "$SOURCE_GSTACK_DIR" "$INSTALL_SKILLS_DIR"
857+
GSTACK_RELINK="$SOURCE_GSTACK_DIR/bin/gstack-relink"
858+
if [ -x "$GSTACK_RELINK" ]; then
859+
GSTACK_SKILLS_DIR="$INSTALL_SKILLS_DIR" GSTACK_INSTALL_DIR="$SOURCE_GSTACK_DIR" "$GSTACK_RELINK" >/dev/null 2>&1 || true
860+
fi
861+
_OGB_LINK="$INSTALL_SKILLS_DIR/connect-chrome"
862+
if [ "$SKILL_PREFIX" -eq 1 ]; then
863+
_OGB_LINK="$INSTALL_SKILLS_DIR/gstack-connect-chrome"
864+
fi
865+
if [ -L "$_OGB_LINK" ] || [ ! -e "$_OGB_LINK" ]; then
866+
ln -snf "gstack/open-gstack-browser" "$_OGB_LINK"
867+
fi
868+
log "gstack ready (claude)."
869+
log " browse: $BROWSE_BIN"
835870
fi
836-
log "gstack ready (claude)."
837-
log " browse: $BROWSE_BIN"
838871
fi
839872
fi
840873

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
import { describe, test, expect } from 'bun:test';
2+
import { spawnSync } from 'child_process';
3+
import * as path from 'path';
4+
import * as fs from 'fs';
5+
import * as os from 'os';
6+
7+
const ROOT = path.resolve(import.meta.dir, '..');
8+
const SETUP_SCRIPT = path.join(ROOT, 'setup');
9+
10+
describe('setup: Conductor worktree guard', () => {
11+
test('setup contains the real-dir guard before the ln -snf into ~/.claude/skills/', () => {
12+
const content = fs.readFileSync(SETUP_SCRIPT, 'utf-8');
13+
const guardIdx = content.indexOf('_SKIP_CLAUDE_REGISTER=0');
14+
const lnIdx = content.indexOf('ln -snf "$SOURCE_GSTACK_DIR" "$CLAUDE_GSTACK_LINK"');
15+
expect(guardIdx).toBeGreaterThan(-1);
16+
expect(lnIdx).toBeGreaterThan(-1);
17+
expect(guardIdx).toBeLessThan(lnIdx);
18+
});
19+
20+
test('guard resolves the existing real dir with `pwd -P` and compares against source', () => {
21+
const content = fs.readFileSync(SETUP_SCRIPT, 'utf-8');
22+
expect(content).toContain('[ -d "$CLAUDE_GSTACK_LINK" ] && [ ! -L "$CLAUDE_GSTACK_LINK" ]');
23+
expect(content).toContain('cd "$CLAUDE_GSTACK_LINK" 2>/dev/null && pwd -P');
24+
expect(content).toContain('"$_EXISTING_REAL" != "$SOURCE_GSTACK_DIR"');
25+
});
26+
27+
test('skip branch prints "registration skipped" + remediation hint', () => {
28+
const content = fs.readFileSync(SETUP_SCRIPT, 'utf-8');
29+
expect(content).toContain('Skipping Claude skill registration');
30+
expect(content).toContain('claude registration skipped');
31+
expect(content).toContain('rm -rf $CLAUDE_GSTACK_LINK');
32+
});
33+
34+
// Reproduce the BSD/macOS `ln -snf` behavior that caused the bug, then
35+
// confirm the guard avoids it. This is a behavioral test of the guard logic
36+
// running in an isolated tmpdir — not the full setup script.
37+
test('BSD ln -snf into an existing real dir creates a child symlink (bug reproduces)', () => {
38+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-setup-guard-'));
39+
try {
40+
const source = path.join(tmp, 'source-worktree');
41+
const dest = path.join(tmp, 'dest-real-dir');
42+
fs.mkdirSync(source);
43+
fs.mkdirSync(dest);
44+
// The buggy invocation: target dest is an existing real dir.
45+
const result = spawnSync('ln', ['-snf', source, dest], { encoding: 'utf-8' });
46+
expect(result.status).toBe(0);
47+
// Child symlink leaked inside dest.
48+
const leaked = path.join(dest, path.basename(source));
49+
expect(fs.existsSync(leaked)).toBe(true);
50+
expect(fs.lstatSync(leaked).isSymbolicLink()).toBe(true);
51+
expect(fs.readlinkSync(leaked)).toBe(source);
52+
// dest itself stayed a real directory (not replaced).
53+
expect(fs.lstatSync(dest).isSymbolicLink()).toBe(false);
54+
expect(fs.lstatSync(dest).isDirectory()).toBe(true);
55+
} finally {
56+
fs.rmSync(tmp, { recursive: true, force: true });
57+
}
58+
});
59+
60+
test('guard logic refuses to ln when dest is a real dir pointing elsewhere', () => {
61+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-setup-guard-'));
62+
try {
63+
const source = path.join(tmp, 'source-worktree');
64+
const dest = path.join(tmp, 'dest-real-dir');
65+
fs.mkdirSync(source);
66+
fs.mkdirSync(dest);
67+
// Inline the guard logic from setup. If it triggers, $_SKIP=1 is echoed
68+
// and no ln is performed; otherwise ln runs and we'd see the leak.
69+
const script = `
70+
set -e
71+
SOURCE_GSTACK_DIR='${source}'
72+
CLAUDE_GSTACK_LINK='${dest}'
73+
_SKIP_CLAUDE_REGISTER=0
74+
if [ -d "$CLAUDE_GSTACK_LINK" ] && [ ! -L "$CLAUDE_GSTACK_LINK" ]; then
75+
_EXISTING_REAL=$(cd "$CLAUDE_GSTACK_LINK" 2>/dev/null && pwd -P || echo "")
76+
if [ -n "$_EXISTING_REAL" ] && [ "$_EXISTING_REAL" != "$SOURCE_GSTACK_DIR" ]; then
77+
_SKIP_CLAUDE_REGISTER=1
78+
fi
79+
fi
80+
if [ "$_SKIP_CLAUDE_REGISTER" -eq 1 ]; then
81+
echo "SKIP"
82+
else
83+
ln -snf "$SOURCE_GSTACK_DIR" "$CLAUDE_GSTACK_LINK"
84+
echo "LINKED"
85+
fi
86+
`;
87+
const result = spawnSync('bash', ['-c', script], { encoding: 'utf-8' });
88+
expect(result.status).toBe(0);
89+
expect(result.stdout.trim()).toBe('SKIP');
90+
// No child symlink leaked.
91+
const leaked = path.join(dest, path.basename(source));
92+
expect(fs.existsSync(leaked)).toBe(false);
93+
} finally {
94+
fs.rmSync(tmp, { recursive: true, force: true });
95+
}
96+
});
97+
98+
test('guard allows ln when dest does not exist (fresh install path)', () => {
99+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-setup-guard-'));
100+
try {
101+
const source = path.join(tmp, 'source-worktree');
102+
const dest = path.join(tmp, 'fresh-dest');
103+
fs.mkdirSync(source);
104+
const script = `
105+
set -e
106+
SOURCE_GSTACK_DIR='${source}'
107+
CLAUDE_GSTACK_LINK='${dest}'
108+
_SKIP_CLAUDE_REGISTER=0
109+
if [ -d "$CLAUDE_GSTACK_LINK" ] && [ ! -L "$CLAUDE_GSTACK_LINK" ]; then
110+
_EXISTING_REAL=$(cd "$CLAUDE_GSTACK_LINK" 2>/dev/null && pwd -P || echo "")
111+
if [ -n "$_EXISTING_REAL" ] && [ "$_EXISTING_REAL" != "$SOURCE_GSTACK_DIR" ]; then
112+
_SKIP_CLAUDE_REGISTER=1
113+
fi
114+
fi
115+
if [ "$_SKIP_CLAUDE_REGISTER" -eq 1 ]; then
116+
echo "SKIP"
117+
else
118+
ln -snf "$SOURCE_GSTACK_DIR" "$CLAUDE_GSTACK_LINK"
119+
echo "LINKED"
120+
fi
121+
`;
122+
const result = spawnSync('bash', ['-c', script], { encoding: 'utf-8' });
123+
expect(result.status).toBe(0);
124+
expect(result.stdout.trim()).toBe('LINKED');
125+
expect(fs.lstatSync(dest).isSymbolicLink()).toBe(true);
126+
expect(fs.readlinkSync(dest)).toBe(source);
127+
} finally {
128+
fs.rmSync(tmp, { recursive: true, force: true });
129+
}
130+
});
131+
132+
test('guard allows ln when dest is an existing symlink (upgrade-in-place path)', () => {
133+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-setup-guard-'));
134+
try {
135+
const source = path.join(tmp, 'new-source');
136+
const oldSource = path.join(tmp, 'old-source');
137+
const dest = path.join(tmp, 'dest-symlink');
138+
fs.mkdirSync(source);
139+
fs.mkdirSync(oldSource);
140+
fs.symlinkSync(oldSource, dest);
141+
// Existing symlink: -L is true, so the guard does NOT trigger. ln -snf
142+
// should atomically retarget the symlink to the new source.
143+
const script = `
144+
set -e
145+
SOURCE_GSTACK_DIR='${source}'
146+
CLAUDE_GSTACK_LINK='${dest}'
147+
_SKIP_CLAUDE_REGISTER=0
148+
if [ -d "$CLAUDE_GSTACK_LINK" ] && [ ! -L "$CLAUDE_GSTACK_LINK" ]; then
149+
_EXISTING_REAL=$(cd "$CLAUDE_GSTACK_LINK" 2>/dev/null && pwd -P || echo "")
150+
if [ -n "$_EXISTING_REAL" ] && [ "$_EXISTING_REAL" != "$SOURCE_GSTACK_DIR" ]; then
151+
_SKIP_CLAUDE_REGISTER=1
152+
fi
153+
fi
154+
if [ "$_SKIP_CLAUDE_REGISTER" -eq 1 ]; then
155+
echo "SKIP"
156+
else
157+
ln -snf "$SOURCE_GSTACK_DIR" "$CLAUDE_GSTACK_LINK"
158+
echo "LINKED"
159+
fi
160+
`;
161+
const result = spawnSync('bash', ['-c', script], { encoding: 'utf-8' });
162+
expect(result.status).toBe(0);
163+
expect(result.stdout.trim()).toBe('LINKED');
164+
expect(fs.readlinkSync(dest)).toBe(source);
165+
} finally {
166+
fs.rmSync(tmp, { recursive: true, force: true });
167+
}
168+
});
169+
170+
test('guard allows ln when dest is a real dir already pointing to source (self-rerun)', () => {
171+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-setup-guard-'));
172+
try {
173+
const source = path.join(tmp, 'source-worktree');
174+
fs.mkdirSync(source);
175+
// Mirror setup's SOURCE_GSTACK_DIR resolution (`pwd -P`) so the comparison
176+
// is fair on macOS where /tmp itself is a symlink to /private/tmp.
177+
const resolvedSource = fs.realpathSync(source);
178+
// Degenerate case: existing real dir IS the source.
179+
const dest = source;
180+
const script = `
181+
set -e
182+
SOURCE_GSTACK_DIR='${resolvedSource}'
183+
CLAUDE_GSTACK_LINK='${dest}'
184+
_SKIP_CLAUDE_REGISTER=0
185+
if [ -d "$CLAUDE_GSTACK_LINK" ] && [ ! -L "$CLAUDE_GSTACK_LINK" ]; then
186+
_EXISTING_REAL=$(cd "$CLAUDE_GSTACK_LINK" 2>/dev/null && pwd -P || echo "")
187+
if [ -n "$_EXISTING_REAL" ] && [ "$_EXISTING_REAL" != "$SOURCE_GSTACK_DIR" ]; then
188+
_SKIP_CLAUDE_REGISTER=1
189+
fi
190+
fi
191+
echo "skip=$_SKIP_CLAUDE_REGISTER"
192+
`;
193+
const result = spawnSync('bash', ['-c', script], { encoding: 'utf-8' });
194+
expect(result.status).toBe(0);
195+
expect(result.stdout.trim()).toBe('skip=0');
196+
} finally {
197+
fs.rmSync(tmp, { recursive: true, force: true });
198+
}
199+
});
200+
});

0 commit comments

Comments
 (0)