fix(preamble): make .pending-* glob pattern zsh-compatible (fixes #313)#332
Open
hnshah wants to merge 1 commit intogarrytan:mainfrom
Open
fix(preamble): make .pending-* glob pattern zsh-compatible (fixes #313)#332hnshah wants to merge 1 commit intogarrytan:mainfrom
hnshah wants to merge 1 commit intogarrytan:mainfrom
Conversation
…rytan#313) **Problem:** When running gstack skills in zsh, users see this error: (eval):22: no matches found: /Users/.../.gstack/analytics/.pending-* **Root Cause:** The Preamble code in gen-skill-docs.ts (line 167) contains: for _PF in ~/.gstack/analytics/.pending-*; do ... In zsh, glob patterns that don't match any files cause an error: 'no matches found: pattern' In bash, the loop simply iterates zero times. This breaks all gstack skills for zsh users (common on macOS). **Solution:** Check if any .pending-* files exist BEFORE attempting the for loop: [ -n "$(ls ~/.gstack/analytics/.pending-* 2>/dev/null)" ] && for ... This approach: - ✅ Works in both bash and zsh - ✅ Silently skips the loop when no pending files exist (normal case) - ✅ Executes the loop when pending files are present - ✅ Uses ls with error suppression (2>/dev/null) for portability **Testing:** - ✅ No pending files: loop skipped, no error - ✅ Pending files exist: loop runs normally - ✅ Compatible with bash and zsh - ✅ TypeScript syntax check passes **Impact:** Fixes all gstack skills for zsh users (macOS default shell). Fixes garrytan#313
d3300d4 to
734d30a
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When running gstack skills in zsh, users see this error:
(eval):22: no matches found: /Users/.../.gstack/analytics/.pending-*This breaks all gstack skills for zsh users (macOS default shell).
Root Cause
The Preamble code in
scripts/gen-skill-docs.tsline 167 contains:In zsh, glob patterns that don't match any files cause an error:
In bash, the loop simply iterates zero times.
Since
.pending-*files rarely exist (they're temporary), this breaks all skills for zsh users on every run.Solution
Check if any
.pending-*files exist before attempting the for loop:This approach:
lswith error suppression (2>/dev/null) for portabilityTesting
✅ No pending files: loop skipped, no error
✅ Pending files exist: loop runs normally
✅ bash compatibility: works as before
✅ zsh compatibility: no "no matches found" error
✅ TypeScript syntax check: passes
Impact
Environment Tested
.pending-*files present (normal case)Fixes #313