feat(ce-setup): check for ast-grep CLI and agent skill (#653)
This commit is contained in:
@@ -24,7 +24,7 @@ If a version is found, pass it to the check script via `--version`. Otherwise om
|
||||
|
||||
Before running the script, display: "Compound Engineering -- checking your environment..."
|
||||
|
||||
Run the bundled check script. Do not perform manual dependency checks -- the script handles all CLI tools, repo-local CE file checks, and `.gitignore` guidance in one pass.
|
||||
Run the bundled check script. Do not perform manual dependency checks -- the script handles all CLI tools, agent skills, repo-local CE file checks, and `.gitignore` guidance in one pass.
|
||||
|
||||
```bash
|
||||
bash scripts/check-health --version VERSION
|
||||
@@ -48,17 +48,19 @@ If the line above resolved to `CLAUDE_CODE`, this is a Claude Code session and `
|
||||
|
||||
After the diagnostic report, check whether:
|
||||
|
||||
- any dependencies are missing (reported as yellow in the script output)
|
||||
- any CLI tools are missing (reported as yellow in the Tools section)
|
||||
- any agent skills are missing (reported as yellow in the Skills section)
|
||||
- `compound-engineering.local.md` is present and needs cleanup
|
||||
- `.compound-engineering/config.local.yaml` does not exist or is not safely gitignored
|
||||
- `.compound-engineering/config.local.example.yaml` is missing or outdated
|
||||
|
||||
If everything is installed, no repo-local cleanup is needed, and `.compound-engineering/config.local.yaml` already exists and is gitignored, display the tool list and completion message. Parse the tool names from the script output and list each with a green circle:
|
||||
If everything is installed, no repo-local cleanup is needed, and `.compound-engineering/config.local.yaml` already exists and is gitignored, display the tool and skill list and completion message. Parse the tool and skill names from the script output and list each with a green circle. Omit the Skills line if the Skills section is absent from the script output:
|
||||
|
||||
```
|
||||
✅ Compound Engineering setup complete
|
||||
|
||||
Tools: 🟢 agent-browser 🟢 gh 🟢 jq 🟢 vhs 🟢 silicon 🟢 ffmpeg
|
||||
Tools: 🟢 agent-browser 🟢 gh 🟢 jq 🟢 vhs 🟢 silicon 🟢 ffmpeg 🟢 ast-grep
|
||||
Skills: 🟢 ast-grep
|
||||
Config: ✅
|
||||
|
||||
Run /ce-setup anytime to re-check.
|
||||
@@ -103,22 +105,26 @@ If the local config already exists, check whether it is safely gitignored. If no
|
||||
|
||||
### Step 6: Offer Installation
|
||||
|
||||
Present the missing dependencies using a multiSelect question with all items pre-selected. Use the install commands and URLs from the script's diagnostic output.
|
||||
Present the missing tools and skills using a multiSelect question with all items pre-selected. Use the install commands and URLs from the script's diagnostic output. Group items under `Tools:` and `Skills:` so the user can see which runtime each item targets; omit a group whose items are all installed.
|
||||
|
||||
```
|
||||
The following tools are missing. Select which to install:
|
||||
The following items are missing. Select which to install:
|
||||
(All items are pre-selected)
|
||||
|
||||
Recommended:
|
||||
Tools:
|
||||
[x] agent-browser - Browser automation for testing and screenshots
|
||||
[x] gh - GitHub CLI for issues and PRs
|
||||
[x] jq - JSON processor
|
||||
[x] vhs (charmbracelet/vhs) - Create GIFs from CLI output
|
||||
[x] silicon (Aloxaf/silicon) - Generate code screenshots
|
||||
[x] ffmpeg - Video processing for feature demos
|
||||
[x] ast-grep - Structural code search using AST patterns
|
||||
|
||||
Skills:
|
||||
[x] ast-grep - Agent skill for structural code search with ast-grep
|
||||
```
|
||||
|
||||
Only show dependencies that are actually missing. Omit installed ones.
|
||||
Only show items that are actually missing. Omit installed ones.
|
||||
|
||||
### Step 7: Install Selected Dependencies
|
||||
|
||||
@@ -134,7 +140,9 @@ For each selected dependency, in order:
|
||||
2. Skip - I'll install it manually
|
||||
```
|
||||
|
||||
2. **If approved:** Run the install command using a shell execution tool. After the command completes, verify installation by running the dependency's check command (e.g., `command -v agent-browser`).
|
||||
2. **If approved:** Run the install command using a shell execution tool. After the command completes, verify installation:
|
||||
- For a CLI tool, run the dependency's check command (e.g., `command -v agent-browser`).
|
||||
- For an agent skill, prefer `npx --yes skills list --global --json | jq -r '.[].name' | grep -qx <skill-name>` when `npx` is available; otherwise fall back to checking that `~/.claude/skills/<skill-name>` exists (file, directory, or symlink).
|
||||
|
||||
3. **If verification succeeds:** Report success.
|
||||
|
||||
|
||||
@@ -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 ""
|
||||
|
||||
Reference in New Issue
Block a user