7 Commits

Author SHA1 Message Date
31984bbd9d Consolidate all .allium specs into specs/
- Move .pi/specs/ files into specs/ (healing, factions, merged magical-objects)
- Move src/*.allium files into specs/ (levels, changing-level)
- Delete .pi/specs/ directory
- Document specs/ convention in AGENTS.md
2026-06-15 08:16:12 +01:00
39839dc594 fix Allium specs syntax + implement Changing Level story
- Fix Allium spec syntax: type→value, enum for Status, remove implies chaining
- Fix factions.spec: add missing type declarations (Health, Level, Status)
- Fix magical-objects.spec: add type declarations, use .value for Health access,
  remove entity inheritance syntax, remove invalid invariants
- Implement Changing Level: add totalDamageTaken + factionsJoined to Character
- Add level-up logic in dealDamage() and joinFaction()
- Add Level.damageThresholdForLevel() static method
- Fix changing-level.spec.ts properties: handle target survival, compute
  expected level from threshold crossings
2026-06-15 07:55:39 +01:00
1c9d4ad66b create magical objects spec 2026-06-14 14:05:28 +01:00
4cdb048dfc refactor(story2): immutable dealDamage, reference guard, negative damage validation, spec precision
- dealDamage returns new Character instead of mutating in-place
- SelfDamageForbidden uses reference equality (this === target)
- Negative damage throws at the boundary
- Removed duplicate Health.maxHealthForLevel (Level.ts is source of truth)
- Allium spec uses max(0, ...) for health floor precision
- New property: NegativeDamageForbidden (11 total properties)
2026-06-13 15:44:46 +01:00
fc2cf73b34 feat: story 2 — Characters can Deal Damage to Characters
- Allium spec: damage-and-health.allium
- 5 fast-check properties: damage reduces health, health non-negative,
  death at zero, self-damage forbidden, dead cannot take damage
- Character.createWithHealth factory for testing with arbitrary health
- Character.dealDamage(target, damage) method
2026-06-13 15:28:34 +01:00
e267c35e55 refactor(story1): clean story boundaries, introduce CharacterState record type, tighten ESLint
- Introduce CharacterState value object to group character properties
  → Character constructor reduced from 5 to 1 parameter
- Introduce Faction value type (previously bare string)
- Remove cross-story methods: isAllyOf, isAlive, isDead, add, isMax, next, diff
- Remove misleading level parameter from Health.create
- Remove trivial invariant tests (dead-code paths on fresh characters)
- Move cross-cutting invariants out of character-creation.allium
- ESLint: forbid unused params (remove argsIgnorePattern), max-params=5
- null parameters enforced by TypeScript strictNullChecks (tsconfig)
2026-06-12 20:32:44 +01:00
d3cc48c0f7 feat: Character Creation user story — ADTs, properties, and Allium spec
- Level value object (1..10, level-capped health)
- Health value object (non-negative, pure sub/add)
- Status discriminated union (alive | dead)
- Character entity with private constructor and static factory
- 9 fast-check properties covering creation invariants
- Allium spec with entities, rules, and invariants
2026-06-12 20:23:48 +01:00