(Body Snatchers) Pass 1

This commit is contained in:
AlexKucera committed 2026-08-12 15:56:07 +02:00
1 parent 54946307fe
commit 0b20f1ae53
3 files changed
+1447

No files matched your search

+67
View File
@@ -0,0 +1,67 @@
#!/usr/bin/env bash
set -euo pipefail
MAX_RETRIES=3
run_phase() {
local phase=$1
local prompt=$2
local attempt=1
local output
while [ "$attempt" -le "$MAX_RETRIES" ]; do
echo "=== Phase $phase (attempt $attempt/$MAX_RETRIES) ==="
pi -p "$prompt" || true
if output=$(node verify.js "$phase" 2>&1); then
printf '%s\n' "$output"
echo "=== Phase $phase PASSED ==="
return 0
fi
printf '%s\n' "$output"
echo "=== Phase $phase FAILED (attempt $attempt) ==="
prompt="Phase $phase of Body Snatcher failed verification. Read AGENTS.md, verify.js, and the current index.html. Fix the current implementation in place; do not rewrite working systems or merely explain. The failing output is:
$output
Run node verify.js $phase yourself and keep fixing until it exits 0."
attempt=$((attempt + 1))
done
echo "=== Phase $phase exhausted retries; targeted fix ==="
pi -p "$prompt" || true
node verify.js "$phase"
echo "=== Phase $phase PASSED after targeted fix ==="
}
COMMON="Read AGENTS.md completely, then read verify.js and the current files. Body Snatcher must remain one dependency-free index.html with inline CSS/JavaScript. Directly edit files; do not only describe code. Preserve working prior phases. Keep window.GAME's test surface synchronized with live state. Canvas and AudioContext mocks must never crash. The page must wait for GAME.start() or a user key before starting."
run_phase 1 "$COMMON
Implement Phase 1 only: HTML5 Canvas skeleton; 25x18 tile grid plus HUD; title/start flow; game loop; ghost state and timer; WASD/arrow tile movement; wall collision; fog of war; HUD; static test dungeon. Expose GAME.state, player, enemies, grid, floor, essence, upgrades, log, start(), newRun(), input(key), and tick(n). Do not implement enemies, possession, or procedural generation yet. Run node verify.js 1 and fix every failure."
run_phase 2 "$COMMON
Implement Phase 2 only: possession with Space; Brute, Skitterer, and Sentinel as dual enemy/player kits; BFS or A* wall-aware enemy movement; host death/ejection; projectiles; combat; essence drops. Preserve Phase 1. Expose deterministic GAME.spawn(type,x,y), damageEnemy(enemy,amount), and findPath(sx,sy,tx,ty) used by verify.js. Enemy objects and possessed bodies must expose maxHp, damage, speed, and special/ability. Run node verify.js 2 and fix every failure."
run_phase 3 "$COMMON
Implement Phase 3 only: add Shielder, Bomber, Healer, Phaser, Turret, Charger, Siren, Mimic, and Leech with the complete enemy AI and possessed player kit from AGENTS.md. Preserve prior systems. All 12 types must instantiate, render with their required silhouettes, possess, fight, and execute specials without errors. Give every type a distinct maxHp/damage/speed tuple as verify.js requires while retaining the specified gameplay identity. Ensure findPath routes around walls on the current GAME.grid. Run node verify.js 3 and fix every failure."
run_phase 4 "$COMMON
Implement Phase 4 only: random-room-and-corridor procedural generation; different layouts each call; exits; chests; 10 escalating floors; between-floor shop with three choices; every prerequisite-gated upgrade in all three trees; gameplay effects; save/load/autosave using bodysnatcher_save; continue-run Y/N prompt. Preserve all combat. Expose generateFloor(floor), completeFloor(), shopChoices, buyUpgrade(index), save(), and load() exactly as verify.js exercises them. Run node verify.js 4 and fix every failure."
run_phase 5 "$COMMON
Implement Phase 5 and complete the full AGENTS.md spec: procedural Web Audio tones; screen shake; particles; hit flash; 150ms movement interpolation; all eight persistent achievements; floor-10 victory; ghost-timer loss with stats; pause and Save+Quit; all controls and game feel. Audit every completion criterion, not only the harness. Expose achievements, unlockAchievement(name), and sound(name). Make GAME.tick(n) deterministic enough for the 200-tick mock stress test. Run node verify.js 5 and fix every failure."
echo "=== ADVERSARIAL REVIEW ==="
pi -p "$COMMON
Act as an adversarial QA reviewer and fixer. Read the complete AGENTS.md, verify.js, and index.html. Inspect the full game for crashes, missing completion criteria, broken enemy AI or possessed kits, procgen connectivity, save/load edge cases, achievement tracking, fog, audio mocks, shop prerequisites, controls, win/loss, and 5-minute play stability. Fix every issue directly with the smallest safe changes. Run node verify.js 5 until it passes." || true
echo "=== FINAL VERIFICATION ==="
if ! output=$(node verify.js 5 2>&1); then
printf '%s\n' "$output"
pi -p "$COMMON
Final verification failed after QA. Fix only the concrete remaining failures in index.html and rerun node verify.js 5 until it exits 0. Failure output:
$output" || true
fi
node verify.js 5
echo "=== BUILD COMPLETE: ALL GATES PASSED ==="