Add shell completions and test script

New files:
- completions.bash: Bash completions and aliases for automation scripts
- completions.zsh: Zsh completions and aliases
- test-scripts.sh: Test suite for Python and Bash scripts

Test coverage:
- Automation scripts (validate-setup, memory-add, memory-list)
- Skill scripts (gmail, gcal, usage)
- Bash scripts (quick-status, health-check, k8s)

All 12 tests pass.

Usage:
  source ~/.claude/automation/completions.bash  # or .zsh
  ~/.claude/automation/test-scripts.sh

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OpenCode Test
2026-01-01 12:25:24 -08:00
parent 55327c2e05
commit 86baab7e96
5 changed files with 227 additions and 0 deletions

114
automation/test-scripts.sh Executable file
View File

@@ -0,0 +1,114 @@
#!/bin/bash
# Test automation scripts
# Run: ./test-scripts.sh
set -euo pipefail
CLAUDE_DIR="${HOME}/.claude"
AUTOMATION_DIR="${CLAUDE_DIR}/automation"
SKILLS_DIR="${CLAUDE_DIR}/skills"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
PASS=0
FAIL=0
pass() { echo -e "${GREEN}${NC} $1"; PASS=$((PASS + 1)); }
fail() { echo -e "${RED}${NC} $1"; FAIL=$((FAIL + 1)); }
skip() { echo -e "${YELLOW}${NC} $1 (skipped)"; }
echo "🧪 Testing Claude Code Scripts"
echo ""
# Test 1: validate-setup.sh
echo "=== Automation Scripts ==="
if "${AUTOMATION_DIR}/validate-setup.sh" > /dev/null 2>&1; then
pass "validate-setup.sh runs successfully"
else
fail "validate-setup.sh failed"
fi
# Test 2: quick-status.sh (may fail without kubectl)
# Skip in automated testing - requires live connections
skip "quick-status.sh (requires live connections)"
# Test 3: memory-add.py (test syntax only)
if python3 -m py_compile "${AUTOMATION_DIR}/memory-add.py" 2>/dev/null; then
pass "memory-add.py syntax valid"
else
fail "memory-add.py syntax error"
fi
# Test 4: memory-list.py (test syntax only)
if python3 -m py_compile "${AUTOMATION_DIR}/memory-list.py" 2>/dev/null; then
pass "memory-list.py syntax valid"
else
fail "memory-list.py syntax error"
fi
# Test 5: usage_report.py (test syntax only)
if python3 -m py_compile "${SKILLS_DIR}/usage/scripts/usage_report.py" 2>/dev/null; then
pass "usage_report.py syntax valid"
else
fail "usage_report.py syntax error"
fi
echo ""
echo "=== Skill Scripts ==="
# Test Gmail scripts (syntax only - need credentials to run)
for script in check_unread.py check_urgent.py search.py; do
if python3 -m py_compile "${SKILLS_DIR}/gmail/scripts/${script}" 2>/dev/null; then
pass "gmail/${script} syntax valid"
else
fail "gmail/${script} syntax error"
fi
done
# Test GCal scripts
for script in agenda.py next_event.py; do
if python3 -m py_compile "${SKILLS_DIR}/gcal/scripts/${script}" 2>/dev/null; then
pass "gcal/${script} syntax valid"
else
fail "gcal/${script} syntax error"
fi
done
# Test bash scripts (syntax check with bash -n)
echo ""
echo "=== Bash Scripts ==="
for script in quick-status.sh health-check.sh; do
script_path=$(find "${CLAUDE_DIR}" -name "${script}" -type f | head -1)
if [[ -n "${script_path}" ]]; then
if bash -n "${script_path}" 2>/dev/null; then
pass "${script} syntax valid"
else
fail "${script} syntax error"
fi
fi
done
# Test k8s quick-status
if bash -n "${SKILLS_DIR}/k8s-quick-status/scripts/quick-status.sh" 2>/dev/null; then
pass "k8s/quick-status.sh syntax valid"
else
fail "k8s/quick-status.sh syntax error"
fi
echo ""
echo "=== Summary ==="
echo -e "Passed: ${GREEN}${PASS}${NC}"
echo -e "Failed: ${RED}${FAIL}${NC}"
if [[ ${FAIL} -eq 0 ]]; then
echo -e "\n${GREEN}All tests passed!${NC}"
exit 0
else
echo -e "\n${RED}${FAIL} test(s) failed${NC}"
exit 1
fi