feat(ce-setup): check for ast-grep CLI and agent skill (#653)
Some checks failed
CI / pr-title (push) Has been cancelled
CI / test (push) Has been cancelled
Release PR / release-pr (push) Has been cancelled
Release PR / publish-cli (push) Has been cancelled

This commit is contained in:
Trevin Chow
2026-04-22 11:29:20 -07:00
committed by GitHub
parent fdf5fe4af5
commit 23dc11b95a
3 changed files with 98 additions and 11 deletions

View File

@@ -18,6 +18,17 @@ deps=(
"vhs|recommended|NONINTERACTIVE=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install -q vhs|https://github.com/charmbracelet/vhs"
"silicon|recommended|NONINTERACTIVE=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install -q silicon|https://github.com/Aloxaf/silicon"
"ffmpeg|recommended|NONINTERACTIVE=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install -q ffmpeg|https://ffmpeg.org/download.html"
"ast-grep|recommended|NONINTERACTIVE=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install -q ast-grep|https://ast-grep.github.io"
)
# Agent skills installed via the `skills` CLI (vercel-labs/skills).
# Format: name|tier|install_cmd|url
# Presence is resolved authoritatively via `npx --yes skills list --global --json`
# when npx and jq are available; otherwise falls back to a Claude Code path
# probe at ~/.claude/skills/<name>.
skills=(
"ast-grep|recommended|npx skills add ast-grep/agent-skill -g -y|https://github.com/ast-grep/agent-skill"
)
# =====================================================
@@ -65,6 +76,44 @@ for entry in "${deps[@]}"; do
fi
done
# =====================================================
# Check skills
# =====================================================
has_npx="no"
has_jq="no"
command -v npx >/dev/null 2>&1 && has_npx="yes"
command -v jq >/dev/null 2>&1 && has_jq="yes"
installed_skill_names=""
if [ "$has_npx" = "yes" ] && [ "$has_jq" = "yes" ]; then
installed_skill_names=$(npx --yes skills list --global --json 2>/dev/null | jq -r '.[].name' 2>/dev/null)
fi
skill_ok=0; skill_total=0
skill_results=()
skills_root="$HOME/.claude/skills"
for entry in "${skills[@]}"; do
IFS='|' read -r name tier install_cmd url <<< "$entry"
skill_total=$((skill_total + 1))
is_installed="no"
if [ -n "$installed_skill_names" ]; then
if printf '%s\n' "$installed_skill_names" | grep -qx "$name"; then
is_installed="yes"
fi
elif [ -e "$skills_root/$name" ]; then
is_installed="yes"
fi
if [ "$is_installed" = "yes" ]; then
skill_ok=$((skill_ok + 1))
skill_results+=("$name|$tier|ok|$install_cmd|$url")
else
skill_results+=("$name|$tier|missing|$install_cmd|$url")
fi
done
# =====================================================
# Project checks (repo only)
# =====================================================
@@ -129,6 +178,24 @@ for result in "${results[@]}"; do
fi
done
# --- Skills ---
if [ "${#skills[@]}" -gt 0 ]; then
section "Skills ${skill_ok}/${skill_total}"
for result in "${skill_results[@]}"; do
IFS='|' read -r name tier status install_cmd url <<< "$result"
if [ "$status" = "ok" ]; then
ok "$name"
else
warn "$name"
issues=$((issues + 1))
detail "$install_cmd"
detail "$url"
fi
done
fi
# --- Project ---
if [ "$in_repo" = "yes" ]; then
@@ -171,9 +238,9 @@ fi
echo ""
if [ "$issues" -eq 0 ]; then
echo " ✅ All clear ${cli_ok}/${cli_total} tools"
echo " ✅ All clear ${cli_ok}/${cli_total} tools ${skill_ok}/${skill_total} skills"
else
echo " ⚠️ ${issues} issue(s) found ${cli_ok}/${cli_total} tools"
echo " ⚠️ ${issues} issue(s) found ${cli_ok}/${cli_total} tools ${skill_ok}/${skill_total} skills"
fi
echo ""