mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 03:35:09 +02:00
fix(context-skills): respect GSTACK_HOME in storage path
The skill templates hardcoded CHECKPOINT_DIR="\$HOME/.gstack/projects/\$SLUG/checkpoints"
which ignored any GSTACK_HOME override. Tests setting GSTACK_HOME
via env were writing to the test's expected path but the skill was
writing to the real user's ~/.gstack. The files existed — just not
where the assertion looked. 0/8 pass despite Skill tool routing
working correctly in the 3rd paid run.
Fix: \${GSTACK_HOME:-\$HOME/.gstack} in all three call sites
(context-save save flow, context-save list flow, context-restore
restore flow). Default behavior unchanged for real users (no
GSTACK_HOME set). Tests can now redirect storage to a tmp dir by
setting GSTACK_HOME via env: (added to runSkillTest in 5f316e0e).
Also follows the existing convention from the preamble, which already
uses \${GSTACK_HOME:-\$HOME/.gstack} for the learnings file lookup.
Inconsistency between preamble and skill body was the real bug —
two different storage-root resolutions in the same skill.
All SKILL.md files regenerated. Golden fixtures updated.
This commit is contained in:
@@ -755,7 +755,7 @@ Parse the user's input:
|
||||
|
||||
```bash
|
||||
eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null)" && mkdir -p ~/.gstack/projects/$SLUG
|
||||
CHECKPOINT_DIR="$HOME/.gstack/projects/$SLUG/checkpoints"
|
||||
CHECKPOINT_DIR="${GSTACK_HOME:-$HOME/.gstack}/projects/$SLUG/checkpoints"
|
||||
if [ ! -d "$CHECKPOINT_DIR" ]; then
|
||||
echo "NO_CHECKPOINTS"
|
||||
else
|
||||
|
||||
@@ -62,7 +62,7 @@ Parse the user's input:
|
||||
|
||||
```bash
|
||||
{{SLUG_SETUP}}
|
||||
CHECKPOINT_DIR="$HOME/.gstack/projects/$SLUG/checkpoints"
|
||||
CHECKPOINT_DIR="${GSTACK_HOME:-$HOME/.gstack}/projects/$SLUG/checkpoints"
|
||||
if [ ! -d "$CHECKPOINT_DIR" ]; then
|
||||
echo "NO_CHECKPOINTS"
|
||||
else
|
||||
|
||||
@@ -811,7 +811,7 @@ allowlist: only `a-z 0-9 - .` survive.
|
||||
|
||||
```bash
|
||||
eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null)" && mkdir -p ~/.gstack/projects/$SLUG
|
||||
CHECKPOINT_DIR="$HOME/.gstack/projects/$SLUG/checkpoints"
|
||||
CHECKPOINT_DIR="${GSTACK_HOME:-$HOME/.gstack}/projects/$SLUG/checkpoints"
|
||||
mkdir -p "$CHECKPOINT_DIR"
|
||||
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
|
||||
# Bash-side title sanitize. Pass the raw title as $1 when running this block.
|
||||
@@ -897,7 +897,7 @@ Restore later with /context-restore.
|
||||
|
||||
```bash
|
||||
eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null)" && mkdir -p ~/.gstack/projects/$SLUG
|
||||
CHECKPOINT_DIR="$HOME/.gstack/projects/$SLUG/checkpoints"
|
||||
CHECKPOINT_DIR="${GSTACK_HOME:-$HOME/.gstack}/projects/$SLUG/checkpoints"
|
||||
if [ -d "$CHECKPOINT_DIR" ]; then
|
||||
echo "CHECKPOINT_DIR=$CHECKPOINT_DIR"
|
||||
# Use find + sort instead of ls -1t: filename YYYYMMDD-HHMMSS prefix is the
|
||||
|
||||
@@ -118,7 +118,7 @@ allowlist: only `a-z 0-9 - .` survive.
|
||||
|
||||
```bash
|
||||
{{SLUG_SETUP}}
|
||||
CHECKPOINT_DIR="$HOME/.gstack/projects/$SLUG/checkpoints"
|
||||
CHECKPOINT_DIR="${GSTACK_HOME:-$HOME/.gstack}/projects/$SLUG/checkpoints"
|
||||
mkdir -p "$CHECKPOINT_DIR"
|
||||
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
|
||||
# Bash-side title sanitize. Pass the raw title as $1 when running this block.
|
||||
@@ -204,7 +204,7 @@ Restore later with /context-restore.
|
||||
|
||||
```bash
|
||||
{{SLUG_SETUP}}
|
||||
CHECKPOINT_DIR="$HOME/.gstack/projects/$SLUG/checkpoints"
|
||||
CHECKPOINT_DIR="${GSTACK_HOME:-$HOME/.gstack}/projects/$SLUG/checkpoints"
|
||||
if [ -d "$CHECKPOINT_DIR" ]; then
|
||||
echo "CHECKPOINT_DIR=$CHECKPOINT_DIR"
|
||||
# Use find + sort instead of ls -1t: filename YYYYMMDD-HHMMSS prefix is the
|
||||
|
||||
Reference in New Issue
Block a user