8000 feat(character): clarify class-aware spell progression by Mnehmos · Pull Request #107 · Mnehmos/mnehmos.rpg.mcp · GitHub
[go: up one dir, main page]

Skip to content

feat(character): clarify class-aware spell progression - #107

Merged
Mnehmos merged 2 commits into
mainfrom
codex/spell-preparation-contract
Aug 26, 2026
Merged

Mnehmos merged 2 commits into
mainfrom
codex/spell-preparation-contract

Conversation

@Mnehmos
@Mnehmos Mnehmos commented Aug 26, 2026 •
Copy link
Copy Markdown
Owner

Supports Mnehmos/rpg-mcp-live#301.

Risk

R1/R2 — character-tool schema and MCP discovery contract. The engine's existing authoritative progression and spell persistence remain the source of truth.

Scope

Make the character tool's level range and class-aware spellcasting fields explicit to the DM/model. The contract now documents known-spell, prepared-spell, and Wizard spellbook semantics, and the create/update/outer schemas describe the durable spell fields and enforce levels 1 through 20.

Acceptance criteria

  • character_manage advertises class-aware known/prepared/spellbook semantics.
  • Character levels are constrained to 1 through 20.
  • Durable spell-choice fields are discoverable in the MCP schema.
  • Existing authoritative level-up, spell validation, and slot consumption behavior remains covered.

Verification

  • npx vitest run tests/server/consolidated/character-manage.test.ts --pool=forks — 74 passed.
  • npm run build — passed.
  • npm run test:ci — 2,277 passed, 7 skipped.

Persistence or migration

None.

Rollback

Revert this PR; the prior schema descriptions and level lower-bound-only validation return.

Explicit deferrals

No new player-side rules or alternate spell database is introduced.

Summary by CodeRabbit

  • Enhancements
    • Character levels are now validated within the supported range of 1–20.
    • Added clearer guidance for class-specific spellcasting, including cantrips, known spells, prepared spells, and spell slots.
    • Improved discoverability for spell management capabilities.

@repowise-bot
repowise-bot Bot commented Aug 26, 2026 •
Copy link
Copy Markdown

⚠️ Health of changed files: 4.7 → 4.6 (-0.2)
⚠️ Change risk: moderate, riskier than 36% of this repo's commits.

📋 At a glance
1 file changed health · 4 hotspots touched · 1 new finding introduced · 3 files with recent fix history · 10 dead-code findings.

Files & modules (2)
  • src (3 files)
    • .../consolidated/contracts.ts
    • .../magic/spell-validator.ts
    • .../consolidated/character-manage.ts
  • tests (1 file)
    • .../consolidated/character-manage.test.ts

✅ Health gate: passed

📌 Before you merge

  • Run .../magic/spell-validator.test.ts, tests/server/llm-combat-patterns.test.ts, tests/server/spellcasting.test.ts, .../consolidated/character-origin.test.ts (+1 more): they import the changed files
🔎 More signals (3)

🗺️ Change map

flowchart LR
  subgraph PR ["Changed in this PR (3 with dependents)"]
    f_src_engine_magic_spell_validator_ts[".../magic/spell-validator.ts 🔥"]:::changed
    f_src_server_consolidated_character_manage_ts[".../consolidated/character-manage.ts 🔥"]:::changed
    f_src_server_consolidated_contracts_ts[".../consolidated/contracts.ts 🔥"]:::changed
  end
  f_src_engine_magic_spell_resolver_ts[".../magic/spell-resolver.ts"]
  f_src_engine_magic_spell_validator_ts --> f_src_engine_magic_spell_resolver_ts
  f_src_server_consolidated_rest_manage_ts[".../consolidated/rest-manage.ts"]
  f_src_engine_magic_spell_validator_ts --> f_src_server_consolidated_rest_manage_ts
  f_src_server_handlers_combat_handlers_ts[".../handlers/combat-handlers.ts"]
  f_src_engine_magic_spell_validator_ts --> f_src_server_handlers_combat_handlers_ts
  f_scripts_seed_bastion_ts["scripts/seed-bastion.ts"]
  f_src_server_consolidated_character_manage_ts --> f_scripts_seed_bastion_ts
  f_src_server_consolidated_batch_manage_ts[".../consolidated/batch-manage.ts"]
  f_src_server_consolidated_character_manage_ts --> f_src_server_consolidated_batch_manage_ts
  f_src_server_consolidated_index_ts[".../consolidated/index.ts"]
  f_src_server_consolidated_character_manage_ts --> f_src_server_consolidated_index_ts
  f_src_server_consolidated_npc_manage_ts[".../consolidated/npc-manage.ts"]
  f_src_server_consolidated_character_manage_ts --> f_src_server_consolidated_npc_manage_ts
  f_src_server_consolidated_contracts_ts --> f_src_server_consolidated_index_ts
  t_tests_engine_magic_spell_validator_test_ts(["✅ .../magic/spell-validator.test.ts"]):::guard
  t_tests_engine_magic_spell_validator_test_ts -.-> f_src_engine_magic_spell_validator_ts
  t_tests_server_consolidated_character_origin_test_ts(["✅ .../consolidated/character-origin.test.ts"]):::guard
  t_tests_server_consolidated_character_origin_test_ts -.-> f_src_server_consolidated_character_manage_ts
  classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
  classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
  classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Loading

Solid arrows: code that imports the changed files (7 direct dependents, from the last indexed snapshot). Dashed: history/tests.

🔥 Hotspots touched (4)

  • .../consolidated/contracts.ts: 1 commits/90d, 1 dependents
  • .../magic/spell-validator.ts: 1 commits/90d, 6 dependents
  • .../consolidated/character-manage.test.ts: 4 commits/90d, 0 dependents
1 more
  • .../consolidated/character-manage.ts: 10 commits/90d, 8 dependents

💀 Dead code (10 findings)

  • 💀 .../consolidated/contracts.ts TOOL_DESCRIPTORS (confidence 0.65)
  • 💀 .../magic/spell-validator.ts SPELLCASTING_CONFIG (confidence 0.65)
  • 💀 .../magic/spell-validator.ts FULL_CASTER_SLOTS (confidence 0.65)
7 more
  • 💀 .../magic/spell-validator.ts HALF_CASTER_SLOTS (confidence 0.65)
  • 💀 .../magic/spell-validator.ts WARLOCK_SLOTS (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts ACTIONS (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts CharacterTypeSchema (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts XP_TABLE (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts CLASS_SAVE_KEYS (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts StatsSchema (confidence 0.65)

📊 See the full report for this PR
Your repo map with this PR's blast radius lit up, every caller of the contracts it changes, and health before and after. No sign-in. · ⭐ Star Repowise · 📥 Install bot · Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot · Updated 2026-08-26 14:50 UTC (since the last push: health 3.6 to 4.6, 1 more file, 1 new finding)

@coderabbitai
coderabbitai Bot commented Aug 26, 2026 •
Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 49 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e73afa9f-7f61-4dfa-a5d6-4c960c239c01

📥 Commits

Reviewing files that changed from the base of the PR and between e3bd696 and 4f896b0.

📒 Files selected for processing (3)
  • src/engine/magic/spell-validator.ts
  • src/server/consolidated/character-manage.ts
  • tests/server/consolidated/character-manage.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a32adba-aaef-423e-b7d8-287f76a4cc43

📥 Commits

Reviewing files that changed from the base of the PR and between f2539dc and e3bd696.

📒 Files selected for processing (3)
  • src/server/consolidated/character-manage.ts
  • src/server/consolidated/contracts.ts
  • tests/server/consolidated/character-manage.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Character management now enforces levels from 1 through 20 and documents class-specific spell fields, wizard spellbooks, and spell-slot validation. Descriptor keywords and tests cover the new spell metadata and level boundaries.

Changes

Character management

Layer / File(s) Summary
Schema and tool metadata
src/server/consolidated/character-manage.ts
Creation, update, and top-level input schemas restrict levels to 1–20. Tool descriptions document persisted cantrips, known spells, wizard spellbooks, prepared spells, and spell-slot validation.
Descriptor keywords and validation coverage
src/server/consolidated/contracts.ts, tests/server/consolidated/character-manage.test.ts
The descriptor includes spell management and spell-slot capabilities. Tests verify spell documentation, the absence of daily preparation, and acceptance or rejection of levels 7 and 21.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to e3bd6

This PR clarifies character level and class-aware spell fields without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: documenting class-aware spell progression in the character management tool schema.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/spell-preparation-contract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3bd696dcb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Mnehmos commented Aug 26, 2026
Copy link
Copy Markdown
Owner Author

Addressed in 4f896b0d7ec346412dbb7ed2bf9a907adc6ca35f:

  • Removed Artificer from the consolidated character-tool contract because this engine's CLASS_DATA does not implement Artificer provisioning or slot progression.
  • Added Wizard preparation validation on character_manage.update, so every prepared spell must exist in the persisted knownSpells spellbook.
  • Added the same Wizard spellbook check to casting validation and a regression test confirming invalid preparation is rejected without changing the saved preparation.

Focused tests, build, and full engine CI pass locally; hosted Node checks are running on this head.

@Mnehmos
Mnehmos merged commit 8b88726 into main Aug 26, 2026
5 checks passed
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

0