From eca57c93c67090f1a7b602e9aed2eaa5b02f43cc Mon Sep 17 00:00:00 2001 From: uroma Date: Fri, 16 Jan 2026 09:50:29 +0000 Subject: [PATCH] Add Ralph CLI verification to verify-claude-setup.sh Changes: - Add section #8: Ralph CLI Check (Advanced - Optional) - Verify Ralph CLI installation and version - Check Ralph auto-trigger hook existence and permissions - Verify hooks.json Ralph configuration - Check ralph-config.env environment file - Update Summary section number from #8 to #9 The verification script now covers all 3 auto-triggering systems: 1. PROACTIVELY agents (built-in to agent definitions) 2. Ralph CLI (optional autonomous looping) 3. Hooks-based event triggers Co-Authored-By: Claude Sonnet 4.5 --- verify-claude-setup.sh | 519 ++++++++++++++++++++++------------------- 1 file changed, 282 insertions(+), 237 deletions(-) diff --git a/verify-claude-setup.sh b/verify-claude-setup.sh index c07dcf5..08d1840 100755 --- a/verify-claude-setup.sh +++ b/verify-claude-setup.sh @@ -1,237 +1,282 @@ -#!/usr/bin/env bash -################################################################################ -# Claude Code Setup Verification Script -# Checks if all customizations are properly installed -################################################################################ - -set -e - -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - -CLAUDE_DIR="$HOME/.claude" -AGENTS_DIR="$CLAUDE_DIR/agents" -PLUGINS_DIR="$CLAUDE_DIR/plugins" - -PASSED=0 -FAILED=0 -WARNINGS=0 - -check_pass() { - echo -e "${GREEN}✓${NC} $1" - PASSED=$((PASSED+1)) -} - -check_fail() { - echo -e "${RED}✗${NC} $1" - FAILED=$((FAILED+1)) -} - -check_warn() { - echo -e "${YELLOW}⚠${NC} $1" - WARNINGS=$((WARNINGS+1)) -} - -check_info() { - echo -e "${BLUE}ℹ${NC} $1" -} - -echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}" -echo -e "${BLUE}║ Claude Code Customizations - Verification ║${NC}" -echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}" -echo "" - -# 1. Check directory structure -echo "═══════════════════════════════════════════════════════════" -echo "Directory Structure" -echo "═══════════════════════════════════════════════════════════" - -[ -d "$CLAUDE_DIR" ] && check_pass "Claude directory exists" || check_fail "Claude directory missing" -[ -d "$AGENTS_DIR" ] && check_pass "Agents directory exists" || check_fail "Agents directory missing" -[ -d "$PLUGINS_DIR" ] && check_pass "Plugins directory exists" || check_fail "Plugins directory missing" - -echo "" -echo "═══════════════════════════════════════════════════════════" -echo "Agent Categories" -echo "═══════════════════════════════════════════════════════════" - -CATEGORIES=("engineering" "marketing" "product" "studio-operations" "project-management" "testing" "design" "bonus") -AGENT_COUNT=0 - -for category in "${CATEGORIES[@]}"; do - if [ -d "$AGENTS_DIR/$category" ]; then - count=$(ls -1 "$AGENTS_DIR/$category"/*.md 2>/dev/null | wc -l) - if [ $count -gt 0 ]; then - echo -e "${GREEN}✓${NC} $category: $count agents" - AGENT_COUNT=$((AGENT_COUNT + count)) - else - check_warn "$category: directory exists but no agents" - fi - else - check_fail "$category: directory missing" - fi -done - -echo "" -check_info "Total agents: $AGENT_COUNT" - -# 2. Check configuration files -echo "" -echo "═══════════════════════════════════════════════════════════" -echo "Configuration Files" -echo "═══════════════════════════════════════════════════════════" - -[ -f "$CLAUDE_DIR/settings.json" ] && check_pass "settings.json exists" || check_fail "settings.json missing" -[ -f "$CLAUDE_DIR/settings.local.json" ] && check_pass "settings.local.json exists" || check_fail "settings.local.json missing" -[ -f "$PLUGINS_DIR/installed_plugins.json" ] && check_pass "installed_plugins.json exists" || check_fail "installed_plugins.json missing" -[ -f "$PLUGINS_DIR/known_marketplaces.json" ] && check_pass "known_marketplaces.json exists" || check_fail "known_marketplaces.json missing" - -# 3. Check MCP tools -echo "" -echo "═══════════════════════════════════════════════════════════" -echo "MCP Tools" -echo "═══════════════════════════════════════════════════════════" - -if command -v npx &> /dev/null; then - check_pass "npx available" - - # Check if @z_ai/mcp-server can be accessed - if npx -y @z_ai/mcp-server --help &> /dev/null; then - check_pass "@z_ai/mcp-server accessible" - else - check_warn "@z_ai/mcp-server not directly accessible (may download on first use)" - fi - - # Check if @z_ai/coding-helper can be accessed - if npx -y @z_ai/coding-helper --help &> /dev/null; then - check_pass "@z_ai/coding-helper accessible" - else - check_warn "@z_ai/coding-helper not directly accessible (may download on first use)" - fi -else - check_fail "npx not available - MCP tools may not work" -fi - -# 4. Check plugins -echo "" -echo "═══════════════════════════════════════════════════════════" -echo "Plugins" -echo "═══════════════════════════════════════════════════════════" - -if [ -f "$PLUGINS_DIR/installed_plugins.json" ]; then - # Check if GLM plugins are registered - if grep -q "glm-plan-bug" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then - check_pass "glm-plan-bug plugin registered" - else - check_warn "glm-plan-bug plugin not registered" - fi - - if grep -q "glm-plan-usage" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then - check_pass "glm-plan-usage plugin registered" - else - check_warn "glm-plan-usage plugin not registered" - fi -fi - -# 5. Sample agent check -echo "" -echo "═══════════════════════════════════════════════════════════" -echo "Agent Content Verification" -echo "═══════════════════════════════════════════════════════════" - -CRITICAL_AGENTS=( - "engineering/test-writer-fixer.md" - "engineering/frontend-developer.md" - "marketing/tiktok-strategist.md" - "product/sprint-prioritizer.md" - "project-management/studio-producer.md" - "project-management/project-shipper.md" - "project-management/experiment-tracker.md" - "design/whimsy-injector.md" - "bonus/studio-coach.md" - "bonus/agent-updater.md" -) - -for agent in "${CRITICAL_AGENTS[@]}"; do - if [ -f "$AGENTS_DIR/$agent" ]; then - # Check file has content - if [ -s "$AGENTS_DIR/$agent" ]; then - check_pass "$agent exists and has content" - else - check_warn "$agent exists but is empty" - fi - else - check_warn "$agent missing" - fi -done - -# 6. Settings validation -echo "" -echo "═══════════════════════════════════════════════════════════" -echo "Settings Validation" -echo "═══════════════════════════════════════════════════════════" - -if [ -f "$CLAUDE_DIR/settings.json" ]; then - # Check if JSON is valid - if python3 -m json.tool "$CLAUDE_DIR/settings.json" &> /dev/null; then - check_pass "settings.json is valid JSON" - - # Check for API token placeholder - if grep -q "YOUR_API_TOKEN_HERE\|YOUR_TOKEN_HERE" "$CLAUDE_DIR/settings.json" 2>/dev/null; then - check_warn "API token not configured (still placeholder)" - else - if grep -q "ANTHROPIC_AUTH_TOKEN" "$CLAUDE_DIR/settings.json" 2>/dev/null; then - check_pass "ANTHROPIC_AUTH_TOKEN is set" - fi - fi - else - check_fail "settings.json is not valid JSON" - fi -fi - -# 7. Sync Script Check -echo "" -echo "═══════════════════════════════════════════════════════════" -echo "Sync Script Check" -echo "═══════════════════════════════════════════════════════════" - -if [ -f "$CLAUDE_DIR/sync-agents.sh" ]; then - check_pass "sync-agents.sh script exists" - if [ -x "$CLAUDE_DIR/sync-agents.sh" ]; then - check_pass "sync-agents.sh is executable" - else - check_warn "sync-agents.sh exists but is not executable" - fi -else - check_warn "sync-agents.sh not found (optional, for updating agents)" -fi - -# 8. Summary -echo "" -echo "═══════════════════════════════════════════════════════════" -echo "Summary" -echo "═══════════════════════════════════════════════════════════" - -if [ $FAILED -eq 0 ]; then - echo -e "${GREEN}✓ All critical checks passed!${NC}" - echo "" - echo "Passed: $PASSED" - echo "Warnings: $WARNINGS" - echo "Failed: $FAILED" - echo "" - echo -e "${GREEN}Your Claude Code setup is ready to use!${NC}" - exit 0 -else - echo -e "${RED}✗ Some checks failed${NC}" - echo "" - echo "Passed: $PASSED" - echo "Warnings: $WARNINGS" - echo "Failed: $FAILED" - echo "" - echo "Please fix the failed checks above." - exit 1 -fi +#!/usr/bin/env bash +################################################################################ +# Claude Code Setup Verification Script +# Checks if all customizations are properly installed +################################################################################ + +set -e + +# Colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +CLAUDE_DIR="$HOME/.claude" +AGENTS_DIR="$CLAUDE_DIR/agents" +PLUGINS_DIR="$CLAUDE_DIR/plugins" + +PASSED=0 +FAILED=0 +WARNINGS=0 + +check_pass() { + echo -e "${GREEN}✓${NC} $1" + PASSED=$((PASSED+1)) +} + +check_fail() { + echo -e "${RED}✗${NC} $1" + FAILED=$((FAILED+1)) +} + +check_warn() { + echo -e "${YELLOW}⚠${NC} $1" + WARNINGS=$((WARNINGS+1)) +} + +check_info() { + echo -e "${BLUE}ℹ${NC} $1" +} + +echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}" +echo -e "${BLUE}║ Claude Code Customizations - Verification ║${NC}" +echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}" +echo "" + +# 1. Check directory structure +echo "═══════════════════════════════════════════════════════════" +echo "Directory Structure" +echo "═══════════════════════════════════════════════════════════" + +[ -d "$CLAUDE_DIR" ] && check_pass "Claude directory exists" || check_fail "Claude directory missing" +[ -d "$AGENTS_DIR" ] && check_pass "Agents directory exists" || check_fail "Agents directory missing" +[ -d "$PLUGINS_DIR" ] && check_pass "Plugins directory exists" || check_fail "Plugins directory missing" + +echo "" +echo "═══════════════════════════════════════════════════════════" +echo "Agent Categories" +echo "═══════════════════════════════════════════════════════════" + +CATEGORIES=("engineering" "marketing" "product" "studio-operations" "project-management" "testing" "design" "bonus") +AGENT_COUNT=0 + +for category in "${CATEGORIES[@]}"; do + if [ -d "$AGENTS_DIR/$category" ]; then + count=$(ls -1 "$AGENTS_DIR/$category"/*.md 2>/dev/null | wc -l) + if [ $count -gt 0 ]; then + echo -e "${GREEN}✓${NC} $category: $count agents" + AGENT_COUNT=$((AGENT_COUNT + count)) + else + check_warn "$category: directory exists but no agents" + fi + else + check_fail "$category: directory missing" + fi +done + +echo "" +check_info "Total agents: $AGENT_COUNT" + +# 2. Check configuration files +echo "" +echo "═══════════════════════════════════════════════════════════" +echo "Configuration Files" +echo "═══════════════════════════════════════════════════════════" + +[ -f "$CLAUDE_DIR/settings.json" ] && check_pass "settings.json exists" || check_fail "settings.json missing" +[ -f "$CLAUDE_DIR/settings.local.json" ] && check_pass "settings.local.json exists" || check_fail "settings.local.json missing" +[ -f "$PLUGINS_DIR/installed_plugins.json" ] && check_pass "installed_plugins.json exists" || check_fail "installed_plugins.json missing" +[ -f "$PLUGINS_DIR/known_marketplaces.json" ] && check_pass "known_marketplaces.json exists" || check_fail "known_marketplaces.json missing" + +# 3. Check MCP tools +echo "" +echo "═══════════════════════════════════════════════════════════" +echo "MCP Tools" +echo "═══════════════════════════════════════════════════════════" + +if command -v npx &> /dev/null; then + check_pass "npx available" + + # Check if @z_ai/mcp-server can be accessed + if npx -y @z_ai/mcp-server --help &> /dev/null; then + check_pass "@z_ai/mcp-server accessible" + else + check_warn "@z_ai/mcp-server not directly accessible (may download on first use)" + fi + + # Check if @z_ai/coding-helper can be accessed + if npx -y @z_ai/coding-helper --help &> /dev/null; then + check_pass "@z_ai/coding-helper accessible" + else + check_warn "@z_ai/coding-helper not directly accessible (may download on first use)" + fi +else + check_fail "npx not available - MCP tools may not work" +fi + +# 4. Check plugins +echo "" +echo "═══════════════════════════════════════════════════════════" +echo "Plugins" +echo "═══════════════════════════════════════════════════════════" + +if [ -f "$PLUGINS_DIR/installed_plugins.json" ]; then + # Check if GLM plugins are registered + if grep -q "glm-plan-bug" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then + check_pass "glm-plan-bug plugin registered" + else + check_warn "glm-plan-bug plugin not registered" + fi + + if grep -q "glm-plan-usage" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then + check_pass "glm-plan-usage plugin registered" + else + check_warn "glm-plan-usage plugin not registered" + fi +fi + +# 5. Sample agent check +echo "" +echo "═══════════════════════════════════════════════════════════" +echo "Agent Content Verification" +echo "═══════════════════════════════════════════════════════════" + +CRITICAL_AGENTS=( + "engineering/test-writer-fixer.md" + "engineering/frontend-developer.md" + "marketing/tiktok-strategist.md" + "product/sprint-prioritizer.md" + "project-management/studio-producer.md" + "project-management/project-shipper.md" + "project-management/experiment-tracker.md" + "design/whimsy-injector.md" + "bonus/studio-coach.md" + "bonus/agent-updater.md" +) + +for agent in "${CRITICAL_AGENTS[@]}"; do + if [ -f "$AGENTS_DIR/$agent" ]; then + # Check file has content + if [ -s "$AGENTS_DIR/$agent" ]; then + check_pass "$agent exists and has content" + else + check_warn "$agent exists but is empty" + fi + else + check_warn "$agent missing" + fi +done + +# 6. Settings validation +echo "" +echo "═══════════════════════════════════════════════════════════" +echo "Settings Validation" +echo "═══════════════════════════════════════════════════════════" + +if [ -f "$CLAUDE_DIR/settings.json" ]; then + # Check if JSON is valid + if python3 -m json.tool "$CLAUDE_DIR/settings.json" &> /dev/null; then + check_pass "settings.json is valid JSON" + + # Check for API token placeholder + if grep -q "YOUR_API_TOKEN_HERE\|YOUR_TOKEN_HERE" "$CLAUDE_DIR/settings.json" 2>/dev/null; then + check_warn "API token not configured (still placeholder)" + else + if grep -q "ANTHROPIC_AUTH_TOKEN" "$CLAUDE_DIR/settings.json" 2>/dev/null; then + check_pass "ANTHROPIC_AUTH_TOKEN is set" + fi + fi + else + check_fail "settings.json is not valid JSON" + fi +fi + +# 7. Sync Script Check +echo "" +echo "═══════════════════════════════════════════════════════════" +echo "Sync Script Check" +echo "═══════════════════════════════════════════════════════════" + +if [ -f "$CLAUDE_DIR/sync-agents.sh" ]; then + check_pass "sync-agents.sh script exists" + if [ -x "$CLAUDE_DIR/sync-agents.sh" ]; then + check_pass "sync-agents.sh is executable" + else + check_warn "sync-agents.sh exists but is not executable" + fi +else + check_warn "sync-agents.sh not found (optional, for updating agents)" +fi + +# 8. Ralph CLI Check (Advanced - Optional) +echo "" +echo "═══════════════════════════════════════════════════════════" +echo "Ralph CLI (Advanced - Optional)" +echo "═══════════════════════════════════════════════════════════" + +if command -v ralph &> /dev/null; then + check_pass "Ralph CLI is installed" + RALPH_VERSION=$(ralph --version 2>/dev/null || echo "unknown") + check_info "Ralph version: $RALPH_VERSION" + + # Check Ralph hook + if [ -f "$CLAUDE_DIR/hooks/ralph-auto-trigger.sh" ]; then + check_pass "Ralph auto-trigger hook exists" + if [ -x "$CLAUDE_DIR/hooks/ralph-auto-trigger.sh" ]; then + check_pass "Ralph hook is executable" + else + check_warn "Ralph hook exists but is not executable" + fi + else + check_warn "Ralph hook not found (auto-trigger not configured)" + fi + + # Check hooks.json + if [ -f "$CLAUDE_DIR/hooks.json" ]; then + if grep -q "ralph-auto-trigger" "$CLAUDE_DIR/hooks.json" 2>/dev/null; then + check_pass "hooks.json configured for Ralph" + else + check_warn "hooks.json exists but Ralph not configured" + fi + else + check_warn "hooks.json not found" + fi + + # Check Ralph config + if [ -f "$CLAUDE_DIR/ralph-config.env" ]; then + check_pass "Ralph configuration file exists" + else + check_warn "ralph-config.env not found (environment not configured)" + fi +else + check_info "Ralph CLI not installed (optional advanced feature)" + check_info "Install with: npm install -g @iannuttall/ralph" +fi + +# 9. Summary +echo "" +echo "═══════════════════════════════════════════════════════════" +echo "Summary" +echo "═══════════════════════════════════════════════════════════" + +if [ $FAILED -eq 0 ]; then + echo -e "${GREEN}✓ All critical checks passed!${NC}" + echo "" + echo "Passed: $PASSED" + echo "Warnings: $WARNINGS" + echo "Failed: $FAILED" + echo "" + echo -e "${GREEN}Your Claude Code setup is ready to use!${NC}" + exit 0 +else + echo -e "${RED}✗ Some checks failed${NC}" + echo "" + echo "Passed: $PASSED" + echo "Warnings: $WARNINGS" + echo "Failed: $FAILED" + echo "" + echo "Please fix the failed checks above." + exit 1 +fi