Aventuras/guides
Ivan Kolos ca74352553
Prompt pack folder export: a usage guide, editor-ordered folders, and pack.yaml out of merges (#701)
## Summary

The prompt pack's "Folder of Markdown" export exists so a custom pack
can follow each release through git: shipped prompts on one branch, your
edits on another, a merge per release. Nothing told a user that, and
parts of the tree worked against the merge:

- `pack.yaml` carried the app version, and the shipped export's name
repeated it. git merges adjacent changed lines as one hunk, so
`pack.yaml` conflicted with a custom branch on every release.
- `_reference/template-variables.md` and `_reference/template-status.md`
changed on every edit.
- Group folders sorted alphabetically, not in the pack editor's order.

This PR adds a user guide, writes it into every export as `README.md`,
takes everything that varies per release out of `pack.yaml`, numbers the
folders in editor order, and moves the export confirmation and the pack
deletion onto the new modal shells.

## Changes

**The guide**
- `guides/prompt-packs-as-folders.md`: why the export exists, one-time
setup, each release's steps, resolving conflicts, migrating an older
export, and the format reference `ABOUT.md` used to hold. Linked from
the repository `README.md`.
- Every export writes it as `README.md`, imported with `?raw` and
normalised to line feeds so a CRLF checkout cannot change what a build
writes. `ABOUT.md` is no longer written.

**Directory format 2**
- `pack.yaml` records only `formatVersion`, `name`, `description`,
`author` and custom variables: no `appVersion`, no `source`. The shipped
export is named `Aventuras shipped prompts`, so its `pack.yaml` is
identical across releases and drops out of the merge.
- The app version moves to `_reference/version.md`, a file of its own:
when it does conflict, it is one isolated line whose answer is "take
theirs".
- `_reference/` keeps the two variable lists and `version.md`. The
template-to-variable index and the edit-status report are gone.
- Group folders are `01 Story Generation/` … `08 Other/`, numbered by
editor position. Import ignores folders, so nothing changes for it.
- Format 1 trees still import.

**Exporting into an existing folder**
- An older export is brought up to date: templates move to the numbered
folders, `ABOUT.md` and the dropped reference files go, and folders the
prune empties are removed.
- A `README.md` the export did not write, in an older export or a folder
the export does not recognise, is renamed to `README_user.md` (`_2`, …
when taken), never overwritten. Every case-insensitive spelling is.
- In a folder the export does not recognise, the plan names each file it
would overwrite.
- Refused: a folder written by a newer format, and a folder that cannot
be read.
- `fs:allow-rename` is added to the capability for the README rename.

**The confirmation** (`ExportIntoFolderDialog`, now on `ActionModal`)
- "Update this folder?" for a folder the export owns, "Export into this
folder?" for one it does not; plain Cancel and Export.
- One short description line per situation that applies, and lists
headed "Moved into new folders" (a count), "Kept under a new name",
"Replaced" and "Deleted". A migration no longer lists ~86 deletions:
moved prompts are counted apart from files that really go.

**Plain confirmations**
- `shared/ConfirmModal.svelte`: an action modal with no body, in the
discard question's shape, as wide as its buttons with the pair centred.
Documented in `docs/development/ui-components.md` as "A plain
confirmation".
- Deleting a prompt pack moves onto it. When stories use the pack,
Delete is disabled and the description says how many to remove first,
rather than a toast refusing after the click. It no longer suggests
reassigning stories, which the app cannot do.
- The lorebook's "Delete all entries" uses it too, and the pack card's
delete button takes the delete feature colour.

## Testing

- `npm run check`, `npm test` (3400 passed, 9 skipped) and `npm run
lint` pass.
- Unit tests cover format 1 and newer-format `pack.yaml`, folder
numbering and order, the reduced `_reference/`, the README matching the
guide byte for byte and naming every layout constant, the migration plan
(renames, moves, deletions, replaced files, emptied folders) and the
refusal cases.
- A release merge rehearsed in git with trees generated from this code:
two shipped exports differing only in version, merged into a branch with
an edited prompt. Only `_reference/version.md` changed upstream, the
edit survived, and `pack.yaml` did not conflict.
- Not yet checked in the running app: the new export confirmation in
each of its states, the compact pack deletion with and without a story
bound to the pack, and the README rename through the new capability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added a desktop guide to exporting and importing prompt packs as
Markdown folders, tracking shipped prompts separately from custom edits,
and resolving merge conflicts.
* Folder exports now use numbered template folders and include a guide
and app-version file. Older export formats remain supported.
* Export confirmations summarize moved, renamed, replaced, and deleted
files; existing files in unfamiliar folders are retained.
* Pack deletion is blocked while stories use the pack, and the
confirmation identifies stories to remove first.
* **Bug Fixes**
* Export cleanup now removes folders left with only recognized
operating-system clutter.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 01:48:59 +02:00
..
prompt-packs-as-folders.md Prompt pack folder export: a usage guide, editor-ordered folders, and pack.yaml out of merges (#701) 2026-11-07 01:48:59 +02:00
story-time.md Reconcile screen: restate boundaries as drafts, saved with the reconciliation (#654) 2026-10-25 15:01:34 -04:00