fix(doctor): guard gstack find against set -euo pipefail

doctor.sh exited at the gstack-skills-count step on machines where
~/.claude/skills/gstack does not contain a skills/ subdirectory (e.g.
when the gstack submodule layout puts skills directly at root). Under
set -o pipefail, find's non-zero exit propagated through wc | tr,
killing the script before it reached the prerequisites/plugins/budget
sections.

Wrap the find in a brace group with `|| true` so the pipe stays
zero-exit and downstream sections run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
bastien 2026-05-03 23:00:11 +02:00
parent 4d3fb6a661
commit 94b79d2ebb

View File

@ -87,8 +87,10 @@ if [ -L "$HOME/.claude/skills/gstack" ]; then
real=$(readlink -f "$HOME/.claude/skills/gstack" 2>/dev/null || readlink "$HOME/.claude/skills/gstack") real=$(readlink -f "$HOME/.claude/skills/gstack" 2>/dev/null || readlink "$HOME/.claude/skills/gstack")
if [ -d "$real" ]; then if [ -d "$real" ]; then
pass "Symlink OK → $real" pass "Symlink OK → $real"
# Check for skills/ subdirectory (referenced by plugin-advisor PHASE 1) # Check for skills/ subdirectory (referenced by plugin-advisor PHASE 1).
gstack_skills_count=$(find "$HOME/.claude/skills/gstack/skills/" -maxdepth 1 -mindepth 1 2>/dev/null | wc -l | tr -d ' ') # `|| echo 0` is required because under `set -o pipefail`, a missing
# gstack/skills/ dir makes find exit non-zero, killing the script.
gstack_skills_count=$( { find "$HOME/.claude/skills/gstack/skills/" -maxdepth 1 -mindepth 1 2>/dev/null || true; } | wc -l | tr -d ' ')
if [ "${gstack_skills_count:-0}" -gt 0 ]; then if [ "${gstack_skills_count:-0}" -gt 0 ]; then
pass "GStack: ${gstack_skills_count} skills available" pass "GStack: ${gstack_skills_count} skills available"
else else