[PR #4019] [MERGED] Add optional character sheet references #6206

Closed
opened 2026-10-23 04:08:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4019
Author: @thetopham
Created: 7/23/2026
Status: ✅ Merged
Merged: 8/9/2026
Merged by: @thetopham

Base: staging ← Head: feature/4018-character-sheet-reference


📝 Commits (10+)

  • b5568ec Add optional character sheet references
  • d5de8fd Address character sheet review findings
  • f0c9597 Restore character sheet creation under metadata
  • 638aec5 feat: simplify character sheet controls and add persona parity
  • cdd114e Move character sheets into Sprites editors
  • 04779d4 Merge remote-tracking branch 'origin/staging' into codex/pr4019-sprites-placement
  • 20222df fix: address character sheet review findings
  • 1f36917 fix: keep sheet reference cleanup consistent
  • 10f159f fix: serialize sheet ownership validation
  • 558cb04 fix: use shared logger for sheet generation

📊 Changes

22 files changed (+1644 additions, -134 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 e2e/core-flows.e2e.ts (+322 -0)
📝 packages/client/src/components/characters/CharacterEditor.tsx (+224 -2)
📝 packages/client/src/components/personas/PersonaEditor.tsx (+231 -4)
📝 packages/client/src/components/ui/AvatarGenerationModal.tsx (+85 -12)
📝 packages/client/src/hooks/use-characters.ts (+4 -0)
➕ packages/client/src/lib/data-image-file.ts (+33 -0)
📝 packages/client/src/localization/locales/en.json (+29 -1)
📝 packages/server/src/db/schema/characters.ts (+4 -0)
📝 packages/server/src/routes/characters.routes.ts (+214 -38)
📝 packages/server/src/routes/gallery.routes.ts (+1 -0)
📝 packages/server/src/routes/game.routes.ts (+93 -56)
📝 packages/server/src/routes/generate.routes.ts (+5 -0)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+14 -2)
📝 packages/server/src/services/generation/conversation-selfie-command-runtime.ts (+1 -0)
📝 packages/server/src/services/image/illustrator-references.ts (+157 -6)
📝 packages/server/src/services/import/marinara.importer.ts (+72 -13)
📝 packages/server/src/services/personas/persona-projector.ts (+2 -0)
📝 packages/server/src/services/storage/characters.storage.ts (+31 -0)
📝 packages/shared/src/types/character.ts (+6 -0)

...and 2 more files

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #4786

Supersedes the earlier closed request in #4018.

Why this change

  • Avatars are profile images, but Characters and Personas also need an optional full design sheet for consistent visual generation.
  • A sheet must never silently replace the avatar. Each card needs an explicit opt-in and a safe fallback.
  • Machine-local gallery IDs must not break native export/import, duplication, or deletion.

What changed

  • Added a Character Sheet section under Character and Persona Sprites with Create with AI, upload/replace, preview, remove, and an explicit Use as reference image switch.
  • Kept gallery browsing in Gallery instead of duplicating its image grid under Sprites, and added the same Create with AI entrypoint to Character Gallery and Persona Gallery.
  • Restored a dedicated landscape character-sheet generation prompt while allowing the current avatar to guide likeness.
  • Persisted Character and Persona sheet selection independently from the avatar. Disabled, missing, deleted, or invalid sheets safely fall back to existing likeness art.
  • Applied the preference to Illustrator and retry reference resolution plus Game/Storyboard character context.
  • Validated gallery ownership and image bytes before loading references, and cleared invalid selections during updates or gallery deletion.
  • Preserved native Character and Persona export/import by marking and remapping the selected gallery image. Compatible exports and duplicates clear machine-local selections.
  • Added localized UI copy, an Unreleased changelog entry, prompt regression coverage, and a desktop/mobile Playwright flow.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated evidence at 558cb0429c75cce19f853ad8c37a6f934740856c:

  • GitHub pnpm-validate: passed.
  • GitHub container-build-test: passed.
  • Local pnpm check: passed.
  • Local pnpm localization:check: passed.
  • Local pnpm regression:prompt: passed, including Character and Persona opt-in plus avatar/sprite fallback parity.
  • Focused Playwright flow: passed on desktop Chromium and mobile Chromium, including dimension rejection, safe Persona creation/clearing, deletion cleanup, and native export/import round-trip.
  • Local git diff --check: passed.

Manual verification notes

Still required in a real browser/app:

  1. Open a Character and a Persona's Sprites and confirm the sheet section contains only preview/status, Create with AI, upload/replace, and Use as reference image controls.
  2. Confirm Metadata no longer shows the sheet section, Sprites does not duplicate the Gallery grid, and both Character Gallery and Persona Gallery expose Create with AI on the Images view.
  3. Generate and save a sheet from both entrypoints, then confirm it becomes selected without replacing the avatar.
  4. Save and reopen each card, then confirm the selected sheet and reference preference persist.
  5. Disable, remove, or delete the sheet and confirm generation falls back to existing likeness art.
  6. Export/import and duplicate both card types, then confirm machine-local gallery IDs are remapped or safely cleared.
  7. Trigger representative Illustrator and Game/Storyboard image paths and confirm the sheet is used only when explicitly enabled.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] <paths> follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

An Unreleased changelog entry is included. No version files changed.

UI evidence (if applicable)

No screenshots or recordings are attached yet. Desktop/mobile and light/dark visual evidence remains a manual PR follow-up.

Summary by CodeRabbit

  • New Features

    • Added optional character-sheet references for characters and personas.
    • Upload, select, preview, remove, or generate character sheets with AI from both galleries.
    • Added controls to choose sheets as likeness references.
    • Added avatar and sprite fallbacks when sheets are unavailable.
    • Preserved references through exports, imports, duplication, and version restoration.
  • Bug Fixes

    • Improved validation, cleanup, and error handling for missing or deleted reference images.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4019 **Author:** [@thetopham](https://github.com/thetopham) **Created:** 7/23/2026 **Status:** ✅ Merged **Merged:** 8/9/2026 **Merged by:** [@thetopham](https://github.com/thetopham) **Base:** `staging` ← **Head:** `feature/4018-character-sheet-reference` --- ### 📝 Commits (10+) - [`b5568ec`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b5568ecada3dc2d691d50b2f21675b7561aff1b1) Add optional character sheet references - [`d5de8fd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d5de8fd2e84b2a550cb8124fc365b7a87938bba9) Address character sheet review findings - [`f0c9597`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f0c95976e0f439185cecba83a06a40d6cb77648a) Restore character sheet creation under metadata - [`638aec5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/638aec5c03904bc6658f3146ebb4f940b9a0a856) feat: simplify character sheet controls and add persona parity - [`cdd114e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cdd114e8a466c8273f261916b3b4bb5506874cc1) Move character sheets into Sprites editors - [`04779d4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/04779d45f67076d81748a0fa76b05301d5f1781e) Merge remote-tracking branch 'origin/staging' into codex/pr4019-sprites-placement - [`20222df`](https://github.com/Pasta-Devs/Marinara-Engine/commit/20222df3ec4482a2e322ee83dac6771423d50620) fix: address character sheet review findings - [`1f36917`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1f36917a247d39abb5e3e888765b03aff16326ef) fix: keep sheet reference cleanup consistent - [`10f159f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/10f159f3ab370a054b215dcae665c41e1b8fdf2a) fix: serialize sheet ownership validation - [`558cb04`](https://github.com/Pasta-Devs/Marinara-Engine/commit/558cb0429c75cce19f853ad8c37a6f934740856c) fix: use shared logger for sheet generation ### 📊 Changes **22 files changed** (+1644 additions, -134 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `e2e/core-flows.e2e.ts` (+322 -0) 📝 `packages/client/src/components/characters/CharacterEditor.tsx` (+224 -2) 📝 `packages/client/src/components/personas/PersonaEditor.tsx` (+231 -4) 📝 `packages/client/src/components/ui/AvatarGenerationModal.tsx` (+85 -12) 📝 `packages/client/src/hooks/use-characters.ts` (+4 -0) ➕ `packages/client/src/lib/data-image-file.ts` (+33 -0) 📝 `packages/client/src/localization/locales/en.json` (+29 -1) 📝 `packages/server/src/db/schema/characters.ts` (+4 -0) 📝 `packages/server/src/routes/characters.routes.ts` (+214 -38) 📝 `packages/server/src/routes/gallery.routes.ts` (+1 -0) 📝 `packages/server/src/routes/game.routes.ts` (+93 -56) 📝 `packages/server/src/routes/generate.routes.ts` (+5 -0) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+14 -2) 📝 `packages/server/src/services/generation/conversation-selfie-command-runtime.ts` (+1 -0) 📝 `packages/server/src/services/image/illustrator-references.ts` (+157 -6) 📝 `packages/server/src/services/import/marinara.importer.ts` (+72 -13) 📝 `packages/server/src/services/personas/persona-projector.ts` (+2 -0) 📝 `packages/server/src/services/storage/characters.storage.ts` (+31 -0) 📝 `packages/shared/src/types/character.ts` (+6 -0) _...and 2 more files_ </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #4786 Supersedes the earlier closed request in #4018. ## Why this change - Avatars are profile images, but Characters and Personas also need an optional full design sheet for consistent visual generation. - A sheet must never silently replace the avatar. Each card needs an explicit opt-in and a safe fallback. - Machine-local gallery IDs must not break native export/import, duplication, or deletion. ## What changed - Added a **Character Sheet** section under Character and Persona **Sprites** with **Create with AI**, upload/replace, preview, remove, and an explicit **Use as reference image** switch. - Kept gallery browsing in **Gallery** instead of duplicating its image grid under Sprites, and added the same **Create with AI** entrypoint to Character Gallery and Persona Gallery. - Restored a dedicated landscape character-sheet generation prompt while allowing the current avatar to guide likeness. - Persisted Character and Persona sheet selection independently from the avatar. Disabled, missing, deleted, or invalid sheets safely fall back to existing likeness art. - Applied the preference to Illustrator and retry reference resolution plus Game/Storyboard character context. - Validated gallery ownership and image bytes before loading references, and cleared invalid selections during updates or gallery deletion. - Preserved native Character and Persona export/import by marking and remapping the selected gallery image. Compatible exports and duplicates clear machine-local selections. - Added localized UI copy, an Unreleased changelog entry, prompt regression coverage, and a desktop/mobile Playwright flow. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Automated evidence at `558cb0429c75cce19f853ad8c37a6f934740856c`: - GitHub `pnpm-validate`: passed. - GitHub `container-build-test`: passed. - Local `pnpm check`: passed. - Local `pnpm localization:check`: passed. - Local `pnpm regression:prompt`: passed, including Character and Persona opt-in plus avatar/sprite fallback parity. - Focused Playwright flow: passed on desktop Chromium and mobile Chromium, including dimension rejection, safe Persona creation/clearing, deletion cleanup, and native export/import round-trip. - Local `git diff --check`: passed. ### Manual verification notes Still required in a real browser/app: 1. Open a Character and a Persona's **Sprites** and confirm the sheet section contains only preview/status, **Create with AI**, upload/replace, and **Use as reference image** controls. 2. Confirm Metadata no longer shows the sheet section, Sprites does not duplicate the Gallery grid, and both Character Gallery and Persona Gallery expose **Create with AI** on the Images view. 3. Generate and save a sheet from both entrypoints, then confirm it becomes selected without replacing the avatar. 4. Save and reopen each card, then confirm the selected sheet and reference preference persist. 5. Disable, remove, or delete the sheet and confirm generation falls back to existing likeness art. 6. Export/import and duplicate both card types, then confirm machine-local gallery IDs are remapped or safely cleared. 7. Trigger representative Illustrator and Game/Storyboard image paths and confirm the sheet is used only when explicitly enabled. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n] <paths>` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) An Unreleased changelog entry is included. No version files changed. ## UI evidence (if applicable) No screenshots or recordings are attached yet. Desktop/mobile and light/dark visual evidence remains a manual PR follow-up. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added optional character-sheet references for characters and personas. * Upload, select, preview, remove, or generate character sheets with AI from both galleries. * Added controls to choose sheets as likeness references. * Added avatar and sprite fallbacks when sheets are unavailable. * Preserved references through exports, imports, duplication, and version restoration. * **Bug Fixes** * Improved validation, cleanup, and error handling for missing or deleted reference images. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:08:10 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6206
No description provided.