8000 Support cantrip selection in character management by Mnehmos · Pull Request #96 · Mnehmos/mnehmos.rpg.mcp · GitHub
[go: up one dir, main page]

Skip to content

Support cantrip selection in character management - #96

Merged
Mnehmos merged 1 commit into
mainfrom
codex/spellbook-cantrip-selection
Aug 14, 2026
Merged

Mnehmos merged 1 commit into
mainfrom
codex/spellbook-cantrip-selection

Conversation

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

What changed

  • add cantripsKnown to character_manage create and update schemas
  • preserve explicit cantrips through starting-equipment provisioning
  • add regression coverage for create and update persistence

Why

The hosted spellbook editor needs an authoritative engine write path for player-selected cantrips. The engine already persisted cantrips, but its consolidated API silently dropped create/update selections.

Validation

  • npm run build
  • npx vitest run tests/server/consolidated/character-manage.test.ts --pool=forks (71 passed)

Closes the engine-side dependency for rpg-mcp-live issue #254.

Summary by CodeRabbit

  • New Features

    • Character creation now supports specifying known cantrips.
    • Character updates can replace a character’s known cantrips.
    • Provided cantrips are preserved during creation; defaults are used when none are supplied.
  • Bug Fixes

    • Fixed character creation and updates so cantrip selections are saved correctly.

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

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f0f324e9-383e-4c64-bbf5-f5df78d803e7

📥 Commits

Reviewing files that changed from the base of the PR and between 3c476f1 and 0cc877e.

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

📝 Walkthrough

Walkthrough

Character creation and update schemas now support cantripsKnown. Creation preserves explicit cantrips over provisioned values, and updates persist replacements. An integration test verifies the behavior. The top-level tool input schema does not expose the new creation field.

Changes

Cantrip persistence

Layer / File(s) Summary
Creation cantrip handling
src/server/consolidated/character-manage.ts
Character creation accepts cantripsKnown, persists supplied cantrips, and uses provisioned cantrips only when no explicit values are supplied.
Update handling and regression coverage
src/server/consolidated/character-manage.ts, tests/server/consolidated/character-manage.test.ts
Character updates persist supplied cantripsKnown values. The integration test verifies replacement from Fire Bolt to Ray of Frost.

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

✨ 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/spellbook-cantrip-selection

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.

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

✅ Health of changed files: 4.8 (unchanged)

📋 At a glance
2 hotspots touched · 2 files with recent fix history · 10 dead-code findings.

Files & modules (2)
  • src (1 file)
    • .../consolidated/character-manage.ts
  • tests (1 file)
    • .../consolidated/character-manage.test.ts

✅ Health gate: passed

📌 Before you merge

  • Run .../consolidated/character-origin.test.ts, .../consolidated/open5e-authority.test.ts: they import the changed files
🔎 More signals (3)

🗺️ Change map

flowchart LR
  subgraph PR ["Changed in this PR (1 with dependents)"]
    f_src_server_consolidated_character_manage_ts[".../consolidated/character-manage.ts 🔥"]:::changed
  end
  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
  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 (4 direct dependents, from the last indexed snapshot). Dashed: history/tests.

🔥 Hotspots touched (2)

  • .../consolidated/character-manage.ts: 7 commits/90d, 8 dependents
  • .../consolidated/character-manage.test.ts: 1 commits/90d, 0 dependents

💀 Dead code (10 findings)

  • 💀 .../consolidated/character-manage.ts ACTIONS (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts XP_TABLE (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts CLASS_SAVE_KEYS (confidence 0.65)
7 more
  • 💀 .../consolidated/character-manage.ts handleGet (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts handleUpdate (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts handleList (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts handleDelete (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts handleAddXp (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts handleGetProgression (confidence 0.65)
  • 💀 .../consolidated/character-manage.ts handleLevelUp (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-14 20:05 UTC

@Mnehmos
Mnehmos marked this pull request as ready for review August 14, 2026 20:13
@Mnehmos
Mnehmos merged commit ff94baa into main Aug 14, 2026
5 checks passed
@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: 0cc877e914

ℹ️ 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".

characterType: CharacterTypeSchema.optional().default('pc'),
factionId: z.string().optional(),
behavior: z.string().optional(),
cantripsKnown: z.array(z.string()).optional().default([]),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add cantrips to the registered input schema

When character_manage is invoked through the MCP server, withSession first parses arguments with CharacterManageTool.inputSchema, which does not declare cantripsKnown; Zod therefore strips the field before the router reaches this action-specific schema. Consequently, both create and update selections are silently ignored in production even though the direct-handler test passes. Add cantripsKnown to the shared registered input schema as well.

Useful? React with 👍 / 👎.

Comment on lines +384 to +386
character.cantripsKnown = args.cantripsKnown?.length
? [...new Set(args.cantripsKnown)]
: provisioningResult.cantripsGranted || [];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Pass selected cantrips into provisioning

When a caster is created with provisioning enabled and explicit cantrips, the provisioning call receives customSpells but not customCantrips, so provisioningResult.cantripsGranted still contains the class defaults. These lines persist the explicit selection, but the same response reports the defaults under _provisioning.cantripsGranted, giving downstream consumers a contradictory provisioning receipt. Pass the selection as customCantrips so the result and persisted character agree.

Useful? React with 👍 / 👎.

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