Skip to content

Codebase Maintenance and Refactoring#71

Merged
b0x1 merged 4 commits intomainfrom
chore/codebase-maintenance-17801901258963431048
Apr 18, 2026
Merged

Codebase Maintenance and Refactoring#71
b0x1 merged 4 commits intomainfrom
chore/codebase-maintenance-17801901258963431048

Conversation

@b0x1
Copy link
Copy Markdown
Owner

@b0x1 b0x1 commented Apr 18, 2026

This maintenance patch improves code quality by applying DRY principles and reducing complexity in the state and interaction layers.

Key changes include:

  1. Logic Centralization: The logic to determine if a unit is "available" for selection (not working in a building or field) was duplicated across several UI and state components. This is now centralized in TraversalUtils.isUnitAvailable.
  2. Domain Logic Extraction: Unit movement between the global map and settlement containers was previously inlined in Zustand slices. These operations are now handled by UnitSystem.enterSettlement and UnitSystem.exitSettlement, making the state layer thinner and more maintainable.
  3. Type Safety & Cleanup: Removed several any and as unknown as import(...) assertions in interactionSlice.ts and unitSlice.ts, replacing them with proper imports and safe type guards. Fixed indentation and removed redundant parentheses in combat resolution logic.
  4. Tooling Consistency: Removed package-lock.json to ensure pnpm remains the single source of truth for dependencies.

All changes have been verified with the full test suite and ESLint.


PR created automatically by Jules for task 17801901258963431048 started by @b0x1

- Centralize unit availability logic in `TraversalUtils.isUnitAvailable`
- Extract unit-settlement transition logic to `UnitSystem.enterSettlement` and `UnitSystem.exitSettlement`
- Refactor `InputHandler.ts` and state slices to use centralized traversal utilities
- Improve type safety in `interactionSlice.ts` and `unitSlice.ts` by removing `any` casts and improving imports
- Fix inconsistent indentation and minor formatting issues
- Remove redundant `package-lock.json` in favor of `pnpm-lock.yaml`

Co-authored-by: b0x1 <21123655+b0x1@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 3 commits April 18, 2026 07:44
- Centralize unit availability logic in `TraversalUtils.isUnitAvailable`
- Extract unit-settlement transition logic to `UnitSystem.enterSettlement` and `UnitSystem.exitSettlement`
- Refactor `InputHandler.ts` and state slices to use centralized traversal utilities
- Improve type safety in `interactionSlice.ts` and `unitSlice.ts` by removing `any` casts and improving imports
- Fix inconsistent indentation and minor formatting issues in `interactionSlice.ts`
- Migrate CI workflow to use `pnpm` and replace `package-lock.json` with `pnpm-lock.yaml`
- Fix missing `Player` import in `UnitSystem.ts`

Co-authored-by: b0x1 <21123655+b0x1@users.noreply.github.com>
- Centralize unit availability logic in `TraversalUtils.isUnitAvailable`
- Extract unit-settlement transition logic to `UnitSystem.enterSettlement` and `UnitSystem.exitSettlement`
- Refactor `InputHandler.ts` and state slices to use centralized traversal utilities
- Improve type safety in `interactionSlice.ts` and `unitSlice.ts` by removing `any` casts and improving imports
- Fix inconsistent indentation and minor formatting issues in `interactionSlice.ts`
- Migrate CI workflow to use `pnpm` and replace `package-lock.json` with `pnpm-lock.yaml`
- Fix missing `Player` import in `UnitSystem.ts`
- Resolve merge conflicts with main and incorporate upstream fixes for settlement population and UnitPanel ambiguity logic.

Co-authored-by: b0x1 <21123655+b0x1@users.noreply.github.com>
@b0x1 b0x1 merged commit 46e70c9 into main Apr 18, 2026
2 checks passed
@b0x1 b0x1 deleted the chore/codebase-maintenance-17801901258963431048 branch April 18, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant