[PR #381] [MERGED] Lorebook folders #4595

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/381
Author: @kolacheee
Created: 5/3/2026
Status: ✅ Merged
Merged: 5/3/2026
Merged by: @SpicyMarinara

Base: main ← Head: lorebook-folders


📝 Commits (9)

📊 Changes

11 files changed (+3894 additions, -2648 deletions)

View changed files

📝 CHANGELOG.md (+371 -370)
📝 packages/client/src/components/lorebooks/LorebookEditor.tsx (+556 -83)
📝 packages/client/src/components/lorebooks/LorebookEntryRow.tsx (+746 -728)
➕ packages/client/src/components/lorebooks/LorebookFolderRow.tsx (+252 -0)
📝 packages/client/src/hooks/use-lorebooks.ts (+302 -219)
📝 packages/server/src/db/schema/lorebooks.ts (+119 -88)
📝 packages/server/src/routes/lorebooks.routes.ts (+406 -334)
📝 packages/server/src/services/import/marinara.importer.ts (+358 -322)
📝 packages/server/src/services/storage/lorebooks.storage.ts (+587 -376)
📝 packages/shared/src/schemas/lorebook.schema.ts (+153 -128)
📝 packages/shared/src/types/lorebook.ts (+44 -0)

📄 Description

Linked issue

Closes #380

Why this change

  • Large lorebooks can become difficult to navigate when long-lived or agent-managed entries sit in one vertical list.
  • Users need a way to organize entries into named groups, collapse stable entries out of view, and disable a whole group without losing each entry's own enabled state.
  • The feature should preserve existing inline lorebook editing while adding folder organization on top of it.

What changed

  • Added flat lorebook folders with persisted enable state, UI-only collapse state, ordering, rename, delete, and folder-level entry gating.
  • Added folder CRUD, reorder, export/import support, schema/types, and route handling for folderId on lorebook entries.
  • Updated the Lorebook editor to render folders plus root entries when sorting by Order with no active search, while falling back to the existing flat list for search and non-Order sorts.
  • Added entry folder pickers and drag-and-drop movement between root and folders, including empty-folder and empty-root drop zones.
  • Added folder-aware active-entry filtering so disabled folders exclude their contained entries without mutating the entries' individual enabled flags.

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

  • Ran pnpm check against the PR merged onto latest main; lint and production build completed successfully.
  • CI container-build-test passed on the PR.
  • Contributor verified opening an existing lorebook, adding/renaming/collapsing/enabling/disabling/deleting folders, and preserving entry state while gating disabled folders.
  • Contributor verified moving entries with folder dropdowns and drag-and-drop: root to folder, folder to folder, and folder back to root.
  • Contributor verified search and non-Order sorts fall back to a flat entry list with the folder-view-paused hint.
  • Contributor verified light mode, dark mode, mobile viewport behavior, empty folders, empty lorebooks, and export/import of lorebooks with folders.
  • AI lorebook maker/keeper was not manually exercised; entries default to root through the shared folderId: null behavior.

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)

Dark mode:

Lorebook folders in dark mode

Light mode:

Lorebook folders in light mode

Mobile:

Lorebook folders on mobile

Known limitations

  • Folder nesting is intentionally not implemented in this PR. parentFolderId is reserved as null so a follow-up can add nesting without another migration; the route layer rejects non-null values for now.
  • Drag-and-drop is disabled while search or non-Order sorting is active, matching previous ordering behavior. Folder dropdown movement remains available.
  • Entry order values can accumulate gaps across containers over time; this is harmless and gets renumbered within a container on the next drag reorder.

🔄 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/381 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 5/3/2026 **Status:** ✅ Merged **Merged:** 5/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `lorebook-folders` --- ### 📝 Commits (9) - [`fbc1839`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fbc1839347537fdba44812ee1e5d741705441e46) Add files via upload - [`7f11026`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7f110265dc325f956104749741ebe56ac0612e11) Add files via upload - [`a9b9088`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a9b9088549f89f507b7d4c0a497844301036662c) Add files via upload - [`1d70a7f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1d70a7fad2869547a29d8e161ff3a09ed79f0976) Add files via upload - [`e5bfeb1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e5bfeb15253482339e32699fcd24c03d7345ce97) Add files via upload - [`d101501`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d10150139e3b4351a0b59923095c667048575cfc) Add files via upload - [`e705e0d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e705e0d894af0a944a5f15a3a1b24685d78cb235) Add files via upload - [`42f52da`](https://github.com/Pasta-Devs/Marinara-Engine/commit/42f52dac74afdfd3d95c05d3391aaa30240e1625) Add files via upload - [`64a17ab`](https://github.com/Pasta-Devs/Marinara-Engine/commit/64a17abb16aa5451fd2aa6c4b8282aa78c1bca55) Add files via upload ### 📊 Changes **11 files changed** (+3894 additions, -2648 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+371 -370) 📝 `packages/client/src/components/lorebooks/LorebookEditor.tsx` (+556 -83) 📝 `packages/client/src/components/lorebooks/LorebookEntryRow.tsx` (+746 -728) ➕ `packages/client/src/components/lorebooks/LorebookFolderRow.tsx` (+252 -0) 📝 `packages/client/src/hooks/use-lorebooks.ts` (+302 -219) 📝 `packages/server/src/db/schema/lorebooks.ts` (+119 -88) 📝 `packages/server/src/routes/lorebooks.routes.ts` (+406 -334) 📝 `packages/server/src/services/import/marinara.importer.ts` (+358 -322) 📝 `packages/server/src/services/storage/lorebooks.storage.ts` (+587 -376) 📝 `packages/shared/src/schemas/lorebook.schema.ts` (+153 -128) 📝 `packages/shared/src/types/lorebook.ts` (+44 -0) </details> ### 📄 Description ## Linked issue Closes #380 ## Why this change - Large lorebooks can become difficult to navigate when long-lived or agent-managed entries sit in one vertical list. - Users need a way to organize entries into named groups, collapse stable entries out of view, and disable a whole group without losing each entry's own enabled state. - The feature should preserve existing inline lorebook editing while adding folder organization on top of it. ## What changed - Added flat lorebook folders with persisted enable state, UI-only collapse state, ordering, rename, delete, and folder-level entry gating. - Added folder CRUD, reorder, export/import support, schema/types, and route handling for `folderId` on lorebook entries. - Updated the Lorebook editor to render folders plus root entries when sorting by Order with no active search, while falling back to the existing flat list for search and non-Order sorts. - Added entry folder pickers and drag-and-drop movement between root and folders, including empty-folder and empty-root drop zones. - Added folder-aware active-entry filtering so disabled folders exclude their contained entries without mutating the entries' individual enabled flags. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Ran `pnpm check` against the PR merged onto latest `main`; lint and production build completed successfully. - CI `container-build-test` passed on the PR. - Contributor verified opening an existing lorebook, adding/renaming/collapsing/enabling/disabling/deleting folders, and preserving entry state while gating disabled folders. - Contributor verified moving entries with folder dropdowns and drag-and-drop: root to folder, folder to folder, and folder back to root. - Contributor verified search and non-Order sorts fall back to a flat entry list with the folder-view-paused hint. - Contributor verified light mode, dark mode, mobile viewport behavior, empty folders, empty lorebooks, and export/import of lorebooks with folders. - AI lorebook maker/keeper was not manually exercised; entries default to root through the shared `folderId: null` behavior. ## Docs and release impact - [ ] No docs changes needed - [x] 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) Dark mode: <img width="2549" height="1259" alt="Lorebook folders in dark mode" src="https://github.com/user-attachments/assets/8e0ba438-5c6b-4887-8d1e-b91ab6e7ffc6" /> Light mode: <img width="2533" height="1201" alt="Lorebook folders in light mode" src="https://github.com/user-attachments/assets/ee1d7570-d436-4970-a394-fe68107c9187" /> Mobile: <img width="1262" height="1425" alt="Lorebook folders on mobile" src="https://github.com/user-attachments/assets/1154aa53-d59e-425b-9747-df277bfb781f" /> ## Known limitations - Folder nesting is intentionally not implemented in this PR. `parentFolderId` is reserved as `null` so a follow-up can add nesting without another migration; the route layer rejects non-null values for now. - Drag-and-drop is disabled while search or non-Order sorting is active, matching previous ordering behavior. Folder dropdown movement remains available. - Entry order values can accumulate gaps across containers over time; this is harmless and gets renumbered within a container on the next drag reorder. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:09:01 +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#4595
No description provided.