|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Test script for Phase 1: Create opencode-core Repository |
| 3 | +# This verifies all completion criteria for Phase 1 |
| 4 | + |
| 5 | +set -e |
| 6 | + |
| 7 | +CORE_DIR="/tmp/opencode-core" |
| 8 | + |
| 9 | +echo "=== Phase 1 Completion Test ===" |
| 10 | + |
| 11 | +# Check 1: Repository initialized with proper structure |
| 12 | +echo -n "Checking directory structure... " |
| 13 | +if [[ ! -d "$CORE_DIR/agents" ]]; then |
| 14 | + echo "FAIL: agents/ directory missing" |
| 15 | + exit 1 |
| 16 | +fi |
| 17 | +if [[ ! -d "$CORE_DIR/commands" ]]; then |
| 18 | + echo "FAIL: commands/ directory missing" |
| 19 | + exit 1 |
| 20 | +fi |
| 21 | +echo "OK" |
| 22 | + |
| 23 | +# Check 2: All framework files copied from .opencode/ |
| 24 | +echo -n "Checking agent files (9 expected)... " |
| 25 | +AGENT_COUNT=$(ls -1 "$CORE_DIR/agents/"*.md 2>/dev/null | wc -l) |
| 26 | +if [[ "$AGENT_COUNT" -ne 9 ]]; then |
| 27 | + echo "FAIL: Expected 9 agent files, found $AGENT_COUNT" |
| 28 | + exit 1 |
| 29 | +fi |
| 30 | +echo "OK ($AGENT_COUNT files)" |
| 31 | + |
| 32 | +echo -n "Checking command files (13+ expected)... " |
| 33 | +COMMAND_COUNT=$(ls -1 "$CORE_DIR/commands/"*.md 2>/dev/null | wc -l) |
| 34 | +if [[ "$COMMAND_COUNT" -lt 13 ]]; then |
| 35 | + echo "FAIL: Expected 13+ command files, found $COMMAND_COUNT" |
| 36 | + exit 1 |
| 37 | +fi |
| 38 | +echo "OK ($COMMAND_COUNT files)" |
| 39 | + |
| 40 | +# Check 3: AGENTS.md relocated to instructions.md |
| 41 | +echo -n "Checking AGENTS.md → instructions.md relocation... " |
| 42 | +if [[ ! -f "$CORE_DIR/instructions.md" ]]; then |
| 43 | + echo "FAIL: instructions.md not found" |
| 44 | + exit 1 |
| 45 | +fi |
| 46 | +echo "OK" |
| 47 | + |
| 48 | +# Check 4: node_modules/ excluded from git (not in repo) |
| 49 | +echo -n "Checking node_modules/ git exclusion... " |
| 50 | +if [[ -d "$CORE_DIR/.git" ]] && [[ -d "$CORE_DIR/node_modules" ]]; then |
| 51 | + # Check if node_modules is tracked |
| 52 | + if git -C "$CORE_DIR" ls-files | grep -q "^node_modules"; then |
| 53 | + echo "FAIL: node_modules is tracked in git" |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | +fi |
| 57 | +echo "OK" |
| 58 | + |
| 59 | +# Check 5: Repository tagged with v2.0.0 |
| 60 | +echo -n "Checking v2.0.0 tag exists... " |
| 61 | +if [[ -d "$CORE_DIR/.git" ]]; then |
| 62 | + if ! git -C "$CORE_DIR" tag | grep -q "^v2.0.0$"; then |
| 63 | + echo "FAIL: v2.0.0 tag not found" |
| 64 | + exit 1 |
| 65 | + fi |
| 66 | + echo "OK" |
| 67 | +else |
| 68 | + echo "SKIP (no .git directory - local only)" |
| 69 | +fi |
| 70 | + |
| 71 | +# Check 6: README.md created |
| 72 | +echo -n "Checking README.md exists... " |
| 73 | +if [[ ! -f "$CORE_DIR/README.md" ]]; then |
| 74 | + echo "FAIL: README.md not found" |
| 75 | + exit 1 |
| 76 | +fi |
| 77 | +echo "OK" |
| 78 | + |
| 79 | +# Check 7: GitHub repository exists |
| 80 | +echo -n "Checking GitHub repository exists... " |
| 81 | +if ! gh repo view apiad/opencode-core &>/dev/null; then |
| 82 | + echo "FAIL: apiad/opencode-core repo not found on GitHub" |
| 83 | + exit 1 |
| 84 | +fi |
| 85 | +echo "OK" |
| 86 | + |
| 87 | +echo "" |
| 88 | +echo "=== All Phase 1 checks passed ===" |
0 commit comments