Files
ttrpg-initiative-tracker/scripts/README.md
T

53 lines
1.3 KiB
Markdown
Raw Normal View History

# scripts/
Manual tools. NOT unit tests. Math.random, non-deterministic.
Used to FIND bugs. Unit tests (in `*/tests/`) LOCK them.
## replay-combat.js
Drives full combat through live backend via ws adapter (same contract as App).
Player display live-updates. Use to watch UI react to state changes.
```bash
# start backend + frontend first (see docs/DEVELOPMENT.md)
node scripts/replay-combat.js [rounds] [delayMs]
# defaults: 100 rounds, 200ms/step
```
Coverage per round: damage, heal, all 22 conditions, toggleActive,
removeParticipant, addParticipant (reinforcements), updateParticipant,
pause/resume, reorderParticipants, endEncounter. Revives dead each round
to sustain full round count.
## audit-rotation.js
Pure turn.js simulation of replay op sequence. Detects rotation violations
(skip/dupe per round). Pinpointed BUG-1 (addParticipant + pause corrupts).
```bash
node scripts/audit-rotation.js
```
Bisect: comment/uncomment op blocks to isolate triggering combo.
## audit-state.js
Expanded invariant bug-finder. 9 check classes per round:
1. rotation integrity
2. HP bounds
3. isActive consistency
4. turnOrder no dup ids
5. turnOrder ids all active
6. currentTurn valid + active
7. deathSave range + reset on revive
8. removeParticipant orphans
9. undo support
```bash
node scripts/audit-state.js [rounds] # default 100
```
See TODO.md for bugs found.