#!/usr/bin/env bash # Smoke test: simulate init-team output for each profile and verify expected files. # Does NOT actually run Claude — it creates the expected file structure and validates # that DB tools and CLIs are functional. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" KIT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" PASS=0 FAIL=0 ERRORS=() pass() { PASS=$((PASS + 1)) echo " PASS: $1" } fail() { FAIL=$((FAIL + 1)) ERRORS+=("$1") echo " FAIL: $1" } check_file() { local dir="$1" file="$2" label="$3" if [[ -f "$dir/$file" ]]; then pass "$label: $file exists" else fail "$label: $file missing" fi } check_dir() { local dir="$1" subdir="$2" label="$3" if [[ -d "$dir/$subdir" ]]; then pass "$label: $subdir/ exists" else fail "$label: $subdir/ missing" fi } cleanup() { echo "" echo "Cleaning up temp directories..." rm -rf "$TMPDIR_MINIMAL" "$TMPDIR_STANDARD" "$TMPDIR_FULL" 2>/dev/null || true } trap cleanup EXIT # Create temp directories TMPDIR_MINIMAL=$(mktemp -d -t whatsinagame-minimal-XXXXXX) TMPDIR_STANDARD=$(mktemp -d -t whatsinagame-standard-XXXXXX) TMPDIR_FULL=$(mktemp -d -t whatsinagame-full-XXXXXX) echo "=== whatsinagame install smoke test ===" echo "" echo "Kit directory: $KIT_DIR" echo "Temp dirs:" echo " minimal: $TMPDIR_MINIMAL" echo " standard: $TMPDIR_STANDARD" echo " full: $TMPDIR_FULL" echo "" # --- Test 1: Minimal profile expected files --- echo "--- Test 1: Minimal profile file structure ---" MINIMAL_FILES=( "CLAUDE.md" ".claude/settings.json" ".claude/agents/architect.md" ".claude/agents/project-manager.md" ".claude/agents/qa-engineer.md" ".claude/skills/git-commit/SKILL.md" ".claude/skills/skill-create/SKILL.md" ) # Create the expected structure mkdir -p "$TMPDIR_MINIMAL/.claude/agents" mkdir -p "$TMPDIR_MINIMAL/.claude/skills/git-commit" mkdir -p "$TMPDIR_MINIMAL/.claude/skills/skill-create" touch "$TMPDIR_MINIMAL/CLAUDE.md" touch "$TMPDIR_MINIMAL/.claude/settings.json" touch "$TMPDIR_MINIMAL/.claude/agents/architect.md" touch "$TMPDIR_MINIMAL/.claude/agents/project-manager.md" touch "$TMPDIR_MINIMAL/.claude/agents/qa-engineer.md" touch "$TMPDIR_MINIMAL/.claude/skills/git-commit/SKILL.md" touch "$TMPDIR_MINIMAL/.claude/skills/skill-create/SKILL.md" for f in "${MINIMAL_FILES[@]}"; do check_file "$TMPDIR_MINIMAL" "$f" "minimal" done echo "" # --- Test 2: Standard profile expected files --- echo "--- Test 2: Standard profile file structure ---" STANDARD_FILES=( "CLAUDE.md" "TEAM.md" ".claude/settings.json" ".claude/agents/architect.md" ".claude/agents/project-manager.md" ".claude/agents/qa-engineer.md" ".claude/agents/designer.md" ".claude/agents/developer-backend.md" ".claude/agents/content-author.md" ".claude/skills/git-commit/SKILL.md" ".claude/skills/skill-create/SKILL.md" ".claude/skills/ticket/SKILL.md" ".claude/skills/pr-push/SKILL.md" ".claude/skills/pr-review/SKILL.md" ".claude/skills/sprint-retro/SKILL.md" ".claude/skills/release-notes/SKILL.md" "decisions/README.md" "decisions/architecture.md" "decisions/scope.md" "decisions/process.md" "db/schema.sql" "tooling/db/config.json" ) # Create the expected structure mkdir -p "$TMPDIR_STANDARD/.claude/agents" mkdir -p "$TMPDIR_STANDARD/.claude/skills/git-commit" mkdir -p "$TMPDIR_STANDARD/.claude/skills/skill-create" mkdir -p "$TMPDIR_STANDARD/.claude/skills/ticket" mkdir -p "$TMPDIR_STANDARD/.claude/skills/pr-push" mkdir -p "$TMPDIR_STANDARD/.claude/skills/pr-review" mkdir -p "$TMPDIR_STANDARD/.claude/skills/sprint-retro" mkdir -p "$TMPDIR_STANDARD/.claude/skills/release-notes" mkdir -p "$TMPDIR_STANDARD/decisions" mkdir -p "$TMPDIR_STANDARD/tooling/db" for f in "${STANDARD_FILES[@]}"; do mkdir -p "$TMPDIR_STANDARD/$(dirname "$f")" touch "$TMPDIR_STANDARD/$f" done for f in "${STANDARD_FILES[@]}"; do check_file "$TMPDIR_STANDARD" "$f" "standard" done echo "" # --- Test 3: Full profile expected files --- echo "--- Test 3: Full profile file structure ---" FULL_FILES=( "CLAUDE.md" "TEAM.md" ".claude/settings.json" ".claude/agents/architect.md" ".claude/agents/project-manager.md" ".claude/agents/qa-engineer.md" ".claude/agents/designer.md" ".claude/agents/developer-backend.md" ".claude/agents/content-author.md" ".claude/agents/consultant.md" ".claude/agents/visual-designer.md" ".claude/agents/audio-designer.md" ".claude/agents/developer-frontend.md" ".claude/agents/librarian.md" ".claude/skills/git-commit/SKILL.md" ".claude/skills/sprint-start/SKILL.md" ".claude/skills/sprint-plan/SKILL.md" ".claude/skills/workshop-start/SKILL.md" ".claude/skills/docs-search/SKILL.md" ".claude/skills/team-standup/SKILL.md" ".claude/skills/health-check/SKILL.md" ".claude/skills/dep-audit/SKILL.md" ".claude/skills/team-onboard/SKILL.md" ".claude/skills/debt-scan/SKILL.md" "decisions/README.md" "db/schema.sql" "tooling/db/config.json" ) # Create the expected structure for f in "${FULL_FILES[@]}"; do mkdir -p "$TMPDIR_FULL/$(dirname "$f")" touch "$TMPDIR_FULL/$f" done mkdir -p "$TMPDIR_FULL/docs/briefings" mkdir -p "$TMPDIR_FULL/docs/sprints" mkdir -p "$TMPDIR_FULL/docs/workshops" for f in "${FULL_FILES[@]}"; do check_file "$TMPDIR_FULL" "$f" "full" done check_dir "$TMPDIR_FULL" "docs/briefings" "full" check_dir "$TMPDIR_FULL" "docs/sprints" "full" check_dir "$TMPDIR_FULL" "docs/workshops" "full" echo "" # --- Test 4: DB initialization --- echo "--- Test 4: Database tools ---" if [[ -f "$KIT_DIR/static/db/schema.sql" ]]; then pass "static/db/schema.sql exists" else fail "static/db/schema.sql missing" fi # Test that sqlite_connector.py exists and is parseable if [[ -f "$KIT_DIR/static/tooling/db/sqlite_connector.py" ]]; then if python3 -c "import ast; ast.parse(open('$KIT_DIR/static/tooling/db/sqlite_connector.py').read())" 2>/dev/null; then pass "sqlite_connector.py is valid Python" else fail "sqlite_connector.py has syntax errors" fi else fail "sqlite_connector.py missing" fi echo "" # --- Test 5: CLI tools --- echo "--- Test 5: CLI tools respond to --help ---" if [[ -f "$KIT_DIR/static/tooling/db/ticket" ]]; then if "$KIT_DIR/static/tooling/db/ticket" --help >/dev/null 2>&1; then pass "ticket --help succeeds" else # Some CLIs exit non-zero on --help but still work if "$KIT_DIR/static/tooling/db/ticket" --help 2>&1 | head -1 | grep -qi "usage\|ticket\|help"; then pass "ticket --help produces output" else fail "ticket --help failed" fi fi else fail "ticket CLI missing" fi if [[ -f "$KIT_DIR/static/tooling/db/sprint" ]]; then if "$KIT_DIR/static/tooling/db/sprint" --help >/dev/null 2>&1; then pass "sprint --help succeeds" else if "$KIT_DIR/static/tooling/db/sprint" --help 2>&1 | head -1 | grep -qi "usage\|sprint\|help"; then pass "sprint --help produces output" else fail "sprint --help failed" fi fi else fail "sprint CLI missing" fi echo "" # --- Summary --- echo "=== Results ===" echo " Passed: $PASS" echo " Failed: $FAIL" if [[ ${#ERRORS[@]} -gt 0 ]]; then echo "" echo "Failures:" for e in "${ERRORS[@]}"; do echo " - $e" done fi echo "" if [[ $FAIL -eq 0 ]]; then echo "All tests passed." exit 0 else echo "Some tests failed." exit 1 fi