Adds a no-`cd` rule to the CRITICAL BASH RULES section: run git/gh/bazel
directly from the cwd (repo/workspace discovery walks up from a subdir;
the shell resets cwd after every command so a cd never persists; and
`cd <dir> && <cmd>` also trips the no-chaining rule and forces an
approval prompt every time).
Also fixes the no-`git -C` rule, which previously said "Instead, cd to
the repo root" — directly contradicting the new rule. It now points at
the no-`cd` rule instead.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Prevents Claude from combining bash commands with &&, ||, or ;.
Each command must be a separate tool call, which makes permission
rules work correctly per-command.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
- Add professionImage RawImage field
- Remove unused goButton field (whole row is now a button)
- Populate profession image using EagleCommonTextures
- Handle UnknownProfession by returning null (hides image)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Add WinBattlesQuest type (PR 1/3)
Adds a new quest type where a hero asks the player to win X battles
(where X is 2-4). This is a ComponentQuest that tracks progress.
- Proto: Add WinBattlesQuest message and field
- Quest.scala: Add WinBattlesQuest case class extending ComponentQuest
- QuestConverter: Handle WinBattlesQuest toProto/fromProto
- ResolveBattleAction: Increment quest counter when winning battles
- CheckForFulfilledQuestsAction: Quest is fulfilled via ComponentQuest
handling when componentsFulfilled >= componentCount
This quest never fails.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add WinBattlesQuest cases to prompt generators
The exhaustive pattern matching on Quest types requires adding cases
to all prompt generators when a new quest type is added.
Also updates CLAUDE.md to require running full test suite before pushing.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
User explicitly stated: "never ever ever ever merge a PR for me.
You create PRs. I merge them."
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Prevent future accidental pushes directly to main by putting
explicit rules at the very top of the file.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Migrate EndDiplomacyResolutionPhaseAction to protoless RandomStateSequencer
- Use ActionResultApplier instead of ActionResultTApplier
- Use RandomStateSequencer instead of LegacyRandomStateTSequencer
- All helper methods now accept GameState instead of GameStateProto
- Removed all proto converter calls
- Updated test to use ActionResultApplierImpl and provide a date
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Convert PerformUnaffiliatedHeroesAction to use protoless RandomStateSequencer
- Migrated from LegacyRandomStateTSequencer to RandomStateSequencer
- Changed from ActionResultTApplier to ActionResultApplier
- Updated RoundPhaseAdvancer to pass actionResultApplier
- Updated test to call .results() directly and convert to proto (matching other migrated action tests)
- Updated DEPROTO_PLAN.md to mark action as migrated
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Update PerformUnaffiliatedHeroesActionTest to use Scala types directly
- Use .results(SeededRandom(...)) instead of resultsOfExecute()
- Assert on ActionResultT types (HeroChangedResultType, ChangedHeroC, ChangedProvinceC)
- Use inside() pattern for safe type matching instead of asInstanceOf
- Add Scala testing patterns guidance to CLAUDE.md
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Refactor PerformUnaffiliatedHeroesActionTest to use Scala GameState directly
Instead of constructing proto GameState and converting to Scala,
the test now creates Scala GameState directly with all required fields.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Convert remaining RandomSequentialResultsAction subclasses to TRandomSequentialResultsAction
- Convert EndHandleRiotsPhaseAction to TRandomSequentialResultsAction
- Convert PerformVassalCommandsPhaseAction to TRandomSequentialResultsAction
- Convert PerformVassalDefenseDecisionsAction to TRandomSequentialResultsAction
- Add withRandomAction and withOptionalRandomAction to RandomStateTSequencer
- Create ActionResultProtoWrapper to wrap proto ActionResult as ActionResultT
- Update VigorXPApplier to skip proto-wrapped results
- Expose protoApplier on ActionResultTApplierImpl for sequencer access
This enables executing proto Actions from CommandFactory.makeCommand() within
the T-based sequencer by wrapping results in ActionResultProtoWrapper.
9/10 RandomSequentialResultsAction subclasses now converted. Only
PerformProvinceEventsAction remains (heavily proto-based internally).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Convert vassal command Actions to use T-type commands via TCommand sealed trait
- Create TCommand sealed trait unifying Simple, RandomSimple, and Sequential T-type actions
- Add makeTCommand method to CommandFactory returning T-type actions directly
- Add withTCommand/withOptionalTCommand helpers to RandomStateTSequencer
- Convert PerformVassalCommandsPhaseAction, PerformVassalDefenseDecisionsAction,
and EndHandleRiotsPhaseAction to use T-type commands
- Add executeProtolessAction helper in RoundPhaseAdvancer to bridge T-type actions
with proto-based engine interface
- Delete ActionResultProtoWrapper (no longer needed after T-type conversion)
- Add exports to action_result_trait for interface types to support ScalaMock mocking
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add VigorXPApplier.withVigorXp to test helper to match production behavior
Addresses Copilot review comment about test executeAction helper missing
vigor XP application that RoundPhaseAdvancer.executeProtolessAction does.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Remove actionResultProtoApplier from TRandomSequentialResultsAction.randomResults
TRandomSequentialResultsAction subclasses should only use ActionResultTApplier,
not both appliers. The execute() method creates the T-type applier internally.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add execute method to ProtolessRandomSequentialResultsAction
Move the duplicate executeAction/executeProtolessAction helper code
into a proper execute() method on ProtolessRandomSequentialResultsAction.
This eliminates code duplication between tests and RoundPhaseAdvancer.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add troubleshooting guidance for Scala MissingType errors
Document that MissingType errors are BUILD.bazel dependency issues,
not compiler crashes. Also note to never run bazel clean without asking.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
The previous hook ran gazelle but didn't check if it modified any files.
This meant commits could go through with non-canonical BUILD files, causing
gazelle_test to fail in CI.
The new wrapper script:
1. Runs gazelle
2. Checks if any BUILD files were modified
3. Fails with a helpful message if they were, instructing the user to stage changes
Also adds a Pre-Commit Checklist section to CLAUDE.md documenting this behavior.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* store the decision tree
* MCTS integration complete
* MCTSAI as a separate target
* still a little drunk but END_TURN is scoring correctly
* END_TURN not marked as terminal
* maybe kinda working
* revert AIScoreCalculator.cpp changes
* log sequence and look for player flip
* coords logging and use the correct gamestate
* didn't do what I hoped
* transposition detection
* Update AI_SCORING_SYSTEM.md with comprehensive MCTS configuration documentation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Use optimized ShardokEngine constructor with pre-computed critical tiles in MCTS
Eliminates 8.5% runtime overhead by computing critical tiles once and passing them to all
ShardokEngine constructor calls in MCTSAI instead of recomputing them each time.
Updated all relevant locations:
- Search method: compute once at beginning
- BuildMCTSTree: pass through as parameter
- MCTSExpansion: pass through as parameter
- All ShardokEngine(settings, state) calls now use ShardokEngine(settings, state, criticalTiles)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* correct default
* Add null pointer safety checks to prevent MCTS simulation crashes
Added null checks in multiple locations to prevent segmentation faults during MCTS simulation:
- AIScoreCalculator: Check for null units in AttackerUnitsScore loop
- AIScoreCalculator: Check for null attacking unit in RecursiveAttackerMultiplierForTargetDistance
- AIUnitScoreCalculator: Check for null unit at start of UnitValue
- AIAttackGroups: Check for null units in all EffectiveDistance overloads
These crashes were occurring when BEST_IMMEDIATE simulation policy tried to evaluate
game states with invalid or deleted units during MCTS rollouts.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix root cause of MCTS crash: uninitialized memory in Occupants function
The crash was caused by the Occupants function in HexMapUtils.hpp creating a vector
without initializing values. For coordinates without units, the vector contained
garbage values (random memory addresses) rather than nullptr, causing segmentation
faults when dereferenced.
Fixed by initializing both Occupants overloads with nullptr:
vector<const Unit *> positions(rowCount * columnCount, nullptr);
Removed the band-aid null checks added in the previous commit as they're no longer
necessary with the proper fix in place.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* remove cache eviction
* unnecessary changes
* unnecessary call
* remove some options
---------
Co-authored-by: Claude <noreply@anthropic.com>
* GameState scala model
* Complete GameState model with ShardokBattle, RunStatus, and ChronicleEntry
- Replace TODO comments with actual model references
- Add imports for the three new models we created:
- net.eagle0.eagle.model.state.shardok_battle.ShardokBattle
- net.eagle0.eagle.model.state.run_status.RunStatus
- net.eagle0.eagle.model.state.chronicle_entry.ChronicleEntry
- Update BUILD.bazel dependencies to include the new model packages
- All fields from game_state.proto are now represented in GameState.scala
The GameState model is now complete and ready for use. A proto converter
can be added in a future PR once converter dependencies are resolved.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Complete GameStateConverter implementation
- Add GameStateConverter with toProto and fromProto methods using pattern matching
- Fix dependencies and visibility in BUILD.bazel files for all required models
- Handle NotificationConverter's tuple return type correctly
- Add visibility for game_state converter to all dependent model packages
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add explicit type declarations to GameStateConverter pattern matching
- Add proper proto type imports for all converter types
- Include explicit type declarations in both toProto and fromProto pattern matches
- Follow user preference for compile-time safety with full type declarations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* run gazelle
* rename the converter
---------
Co-authored-by: Claude <noreply@anthropic.com>
* WIP: Partial conversion of ResolveTruceOfferCommand to Scala models
- Updated imports to use Scala model types
- Converted base class from SimpleAction to ProtolessSimpleAction
- Updated BUILD.bazel dependencies partially
- Hit integration issues with LLM generator still expecting protobuf types
Still needs work to fully convert the diplomatic text generation integration.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Revert ResolveTruceOfferCommand changes - too complex for first conversion
The LLM integration makes this command too complex for initial conversion.
Starting fresh with simpler commands without external dependencies.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Migrate ResolveTruceOfferCommand from protobuf to Scala domain models
- Convert ResolveTruceOfferCommand to use ProtolessSimpleAction base class
- Replace protobuf imports with Scala domain model imports (TruceOffer, Status types)
- Update make() method signature to take explicit parameters instead of protobuf wrappers
- Use ActionResultC, ChangedFactionC, NotificationC, and LLM domain models
- Implement LLM integration with TruceResolutionMessage and NotificationC
- Update BUILD.bazel dependencies to use Scala model targets instead of protobuf
- Migrate ResolveTruceOfferCommandTest to use protoless API with proper domain models
- Replace protobuf test patterns with inside() pattern matching on domain types
- Add comprehensive test coverage for accepted, rejected, and imprisoned scenarios
Note: CommandFactory integration pending - requires protobuf to domain model conversion
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Complete ResolveTruceOfferCommand migration to protoless architecture
- Update CommandFactory to integrate with new protoless API
- Convert protobuf types to domain models (DiplomacyOffer → TruceOffer, Status)
- Add necessary dependencies for converters (DiplomacyOfferConverter, StatusConverter)
- Remove redundant targetFactionId parameter from command signature
- Fix test compilation issues and simplify parameter structure
The command now uses the modern protoless architecture with proper type safety
and domain model integration while maintaining full LLM functionality.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* gazelle
---------
Co-authored-by: Claude <noreply@anthropic.com>