[PR #1256] [CLOSED] refactor(magic-rewrite): prepare V1 for review #5008

Closed
opened 2026-10-22 04:12:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1256
Author: @cha1latte
Created: 5/26/2026
Status: ❌ Closed

Base: staging ← Head: prep/pr-1238-magic-rewrite-staging


📝 Commits (3)

  • af6e151 feat(magic-rewrite): V1 — instruction + diff rewrite for editors
  • 4747a1f Refactor Magic Rewrite seams
  • 277993c Add Magic Rewrite PR evidence

📊 Changes

9 files changed (+488 additions, -41 deletions)

View changed files

➕ docs/pr-evidence/pr-1256/character-magic-rewrite.png (+0 -0)
➕ docs/pr-evidence/pr-1256/lorebook-magic-rewrite.png (+0 -0)
📝 packages/client/src/components/lorebooks/LorebookFormFields.tsx (+78 -24)
📝 packages/client/src/components/ui/ExpandedTextarea.tsx (+84 -17)
➕ packages/client/src/components/ui/MagicRewritePanel.tsx (+133 -0)
➕ packages/client/src/hooks/use-magic-rewrite.ts (+59 -0)
📝 packages/server/src/routes/index.ts (+2 -0)
➕ packages/server/src/routes/magic-rewrite.routes.ts (+34 -0)
➕ packages/server/src/services/magic-rewrite/magic-rewrite.service.ts (+98 -0)

📄 Description

Linked issue

Refs #1183
Refs #1238

Why this change

PR #1238 contains the Magic Rewrite V1 feature, but the branch was based on main while targeting staging, which pulls unrelated tracker/composer/changelog work into the review diff.

This cleanup branch replays the Magic Rewrite work onto staging and separates the first server/client seams so the feature is easier to review and refactor without changing the intended V1 behavior.

What changed

  • Replayed the Magic Rewrite V1 surface onto upstream/staging.
  • Kept the editor integrations for expanded textareas and lorebook entry content.
  • Moved Magic Rewrite generation logic into packages/server/src/services/magic-rewrite/magic-rewrite.service.ts.
  • Kept packages/server/src/routes/magic-rewrite.routes.ts focused on request validation and HTTP response handling.
  • Moved Magic Rewrite client request/localStorage/loading/error state into packages/client/src/hooks/use-magic-rewrite.ts.
  • Preserved existing config-error behavior as 400 responses.

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

Manual verification notes

  • Codex ran pnpm check successfully in C:\tmp\marinara-pr-1238.
  • Codex ran git diff --check successfully.
  • Codex ran a Bunny maintainer-equivalent pass for branch/base, scope, logging, and proof quality.
  • Codex smoke-tested the Magic Rewrite UI locally in browser from the expanded character description editor.
  • Codex smoke-tested the Magic Rewrite UI locally in browser from a lorebook entry content editor.
  • Provider-runtime verification is still pending: test Generate Rewrite with a configured text LLM connection.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Character editor Magic Rewrite panel:

Character editor Magic Rewrite panel

Lorebook entry Magic Rewrite panel:

Lorebook entry Magic Rewrite panel


🔄 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/1256 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/26/2026 **Status:** ❌ Closed **Base:** `staging` ← **Head:** `prep/pr-1238-magic-rewrite-staging` --- ### 📝 Commits (3) - [`af6e151`](https://github.com/Pasta-Devs/Marinara-Engine/commit/af6e151b9eefa93725e4268696d3124c179273b4) feat(magic-rewrite): V1 — instruction + diff rewrite for editors - [`4747a1f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4747a1f0ce110712c432ec7fbc548f6cab19c128) Refactor Magic Rewrite seams - [`277993c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/277993cf415710e97c950a0c9eed95eceeeda8c8) Add Magic Rewrite PR evidence ### 📊 Changes **9 files changed** (+488 additions, -41 deletions) <details> <summary>View changed files</summary> ➕ `docs/pr-evidence/pr-1256/character-magic-rewrite.png` (+0 -0) ➕ `docs/pr-evidence/pr-1256/lorebook-magic-rewrite.png` (+0 -0) 📝 `packages/client/src/components/lorebooks/LorebookFormFields.tsx` (+78 -24) 📝 `packages/client/src/components/ui/ExpandedTextarea.tsx` (+84 -17) ➕ `packages/client/src/components/ui/MagicRewritePanel.tsx` (+133 -0) ➕ `packages/client/src/hooks/use-magic-rewrite.ts` (+59 -0) 📝 `packages/server/src/routes/index.ts` (+2 -0) ➕ `packages/server/src/routes/magic-rewrite.routes.ts` (+34 -0) ➕ `packages/server/src/services/magic-rewrite/magic-rewrite.service.ts` (+98 -0) </details> ### 📄 Description ## Linked issue Refs #1183 Refs #1238 ## Why this change PR #1238 contains the Magic Rewrite V1 feature, but the branch was based on `main` while targeting `staging`, which pulls unrelated tracker/composer/changelog work into the review diff. This cleanup branch replays the Magic Rewrite work onto `staging` and separates the first server/client seams so the feature is easier to review and refactor without changing the intended V1 behavior. ## What changed - Replayed the Magic Rewrite V1 surface onto `upstream/staging`. - Kept the editor integrations for expanded textareas and lorebook entry content. - Moved Magic Rewrite generation logic into `packages/server/src/services/magic-rewrite/magic-rewrite.service.ts`. - Kept `packages/server/src/routes/magic-rewrite.routes.ts` focused on request validation and HTTP response handling. - Moved Magic Rewrite client request/localStorage/loading/error state into `packages/client/src/hooks/use-magic-rewrite.ts`. - Preserved existing config-error behavior as 400 responses. ## 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` ### Manual verification notes - Codex ran `pnpm check` successfully in `C:\tmp\marinara-pr-1238`. - Codex ran `git diff --check` successfully. - Codex ran a Bunny maintainer-equivalent pass for branch/base, scope, logging, and proof quality. - Codex smoke-tested the Magic Rewrite UI locally in browser from the expanded character description editor. - Codex smoke-tested the Magic Rewrite UI locally in browser from a lorebook entry content editor. - Provider-runtime verification is still pending: test `Generate Rewrite` with a configured text LLM connection. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Character editor Magic Rewrite panel: ![Character editor Magic Rewrite panel](https://github.com/cha1latte/Marinara-Engine/blob/prep/pr-1238-magic-rewrite-staging/docs/pr-evidence/pr-1256/character-magic-rewrite.png?raw=1) Lorebook entry Magic Rewrite panel: ![Lorebook entry Magic Rewrite panel](https://github.com/cha1latte/Marinara-Engine/blob/prep/pr-1238-magic-rewrite-staging/docs/pr-evidence/pr-1256/lorebook-magic-rewrite.png?raw=1) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:12:25 +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#5008
No description provided.