Files
ttrpg-initiative-tracker/scripts/README.md
T
david raistrick 7bcf01dcf9 fix: custom conditions apply on add; correct server WS env docs
Custom conditions (per-campaign freeform) previously only persisted to the
campaign palette — Add button did NOT apply them to the targeted participant,
and badges rendered via CONDITIONS (missing custom ids) so applied custom
conditions did not display. Now:

- addCustomCondition(label, participantId) persists to palette AND toggles
  onto the participant in one step. Enter + Add button both pass p.id.
- Admin badge lookup uses allConditions (built-ins + custom), not CONDITIONS.

Shared contract: toggleCondition accepts ANY string. Prove it in tests:
- turn.combat.test.js adds CUSTOM_CONDITIONS ('hexed','rager',
  'marked_for_death','🛡️blessed') to the seeded queue + random pool, asserts
  condition-not-string invariant, and a dedicated add/remove round-trip test.
- replay-combat.js mirrors the same CUSTOM_CONDITIONS through the live backend.

Server-mode docs/env: REACT_APP_BACKEND_WS (stale pre-rename) -> correct
REACT_APP_BACKEND_REALTIME_URL=ws://.../ws in README, env.example,
docker/Dockerfile (STORAGE=ws -> server). DEVELOPMENT.md + scripts/README.md
now point to ./scripts/dev-start.sh as the primary dev entrypoint.

133 shared tests green.
2026-07-04 20:41:34 -04:00

1.1 KiB

scripts/

Dev orchestration + manual demo tool. NOT test.

dev-start.sh / dev-stop.sh

Local dev stack: backend (:4001, sqlite) + frontend (:3999, server mode). One command. Writes env vars for you. Logs to tmp/server.log, tmp/fe.log.

./scripts/dev-start.sh   # start (idempotent: leaves running ports as-is)
./scripts/dev-stop.sh    # stop both

replay-combat.js

Live backend demo. Drives full combat via server adapter (same contract as App). Player display live-updates. Watch UI react to state changes.

# 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.

See also

  • tests/audit/ — exploratory bug-finders (manual run, non-deterministic)
  • {shared,server,src}/tests/ — jest unit/integration/characterization
  • scratch/ — gitignored throwaway