Skip to content

fix: zsh glob compatibility in skill preamble (v0.11.7.0)#386

Merged
garrytan merged 8 commits intomainfrom
garrytan/zsh-glob-fix
Mar 23, 2026
Merged

fix: zsh glob compatibility in skill preamble (v0.11.7.0)#386
garrytan merged 8 commits intomainfrom
garrytan/zsh-glob-fix

Conversation

@garrytan
Copy link
Owner

Summary

  • zsh users no longer see "no matches found" errors when running any gstack skill. The .pending-* telemetry glob in every skill preamble has been replaced with find to avoid zsh's NOMATCH behavior entirely.
  • Regression test added to verify all generated SKILL.md files use find instead of bare shell globs.
  • Based on community fix from @hnshah in PR fix(preamble): make .pending-* glob pattern zsh-compatible (fixes #313) #332 — improved after Codex adversarial review caught that the original ls-based guard still triggered zsh glob expansion.

Fixes #313

Test Coverage

All new code paths have test coverage.

  • Test verifies no SKILL.md contains a bare .pending-* glob
  • Test verifies all SKILL.md files use find for pattern matching

Pre-Landing Review

No issues found.

Adversarial Review

Codex adversarial (medium tier) caught that the original $(ls .pending-* 2>/dev/null) fix still triggered zsh NOMATCH. Fixed by switching to find which avoids shell glob expansion entirely. Verified in actual zsh.

TODOS

No TODO items completed in this PR.

Test plan

  • All gen-skill-docs tests pass (162 tests, 0 failures)
  • Verified fix works in actual zsh (no error message)
  • Verified fix works in bash (backward compatible)

🤖 Generated with Claude Code

hnshah and others added 8 commits March 23, 2026 06:46
**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 #313
Adds a test verifying the .pending-* glob in preamble is guarded by
an ls check (zsh-compatible). Regenerates all SKILL.md files to
propagate the fix from the previous commit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	.agents/skills/gstack-browse/SKILL.md
#	.agents/skills/gstack-design-consultation/SKILL.md
#	.agents/skills/gstack-design-review/SKILL.md
#	.agents/skills/gstack-document-release/SKILL.md
#	.agents/skills/gstack-investigate/SKILL.md
#	.agents/skills/gstack-office-hours/SKILL.md
#	.agents/skills/gstack-plan-ceo-review/SKILL.md
#	.agents/skills/gstack-plan-design-review/SKILL.md
#	.agents/skills/gstack-plan-eng-review/SKILL.md
#	.agents/skills/gstack-qa-only/SKILL.md
#	.agents/skills/gstack-qa/SKILL.md
#	.agents/skills/gstack-retro/SKILL.md
#	.agents/skills/gstack-review/SKILL.md
#	.agents/skills/gstack-setup-browser-cookies/SKILL.md
#	.agents/skills/gstack-ship/SKILL.md
#	.agents/skills/gstack/SKILL.md
New skills from main (benchmark, autoplan, canary, cso, land-and-deploy,
setup-deploy) now include the zsh-compatible .pending-* glob guard.
Codex adversarial review caught that $(ls .pending-* 2>/dev/null) still
triggers zsh NOMATCH error because the shell expands the glob before ls
runs. Using find avoids shell glob expansion entirely.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolved CHANGELOG.md conflict (bumped to v0.11.8.0 since main took v0.11.7.0).
Resolved SKILL.md conflict via regeneration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@garrytan garrytan merged commit 8a4afd8 into main Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zsh glob error: 'no matches found' for .pending-* pattern

2 participants