You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: expose save metadata via Story API (#97) (#99)
## Summary
- **`save(slot?, custom?)`**: Extended to accept custom metadata (e.g.
`{ day: 3, phase: 'morning' }`) that is stored alongside the save and
merged on overwrite
- **`getSaveInfo(slot?)`**: New async method returning `SaveInfo` (slot,
title, passage, createdAt, updatedAt, custom) for a specific slot
- **`listSaves()`**: New async method returning `SaveInfo[]` for all
known saves (default + named)
- **`deleteSave(slot?)`**: New method to delete a save and update
`knownSaves` cache
- **`SaveInfo`** type added to `types/index.d.ts` and
`pkg/types/index.d.ts`
Games building custom save/load UIs can now display slot metadata like
"Day 12 — Work Phase — saved 3:42 PM" without maintaining a parallel
persistence layer.
## Test plan
- [x] All 891 tests pass (12 new, no regressions)
- [x] New tests: getSlotSaveInfo (null/default/named/custom),
listSlotSaves (empty/all), deleteSlotSave
(named/default/populate-cleanup/no-op), quickSave custom metadata
(new/merge)
- [x] TypeScript compiles cleanly (`tsc --noEmit`)
Closes#97
release-npm
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Copy file name to clipboardExpand all lines: docs/story-api.md
+41-4Lines changed: 41 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -174,13 +174,14 @@ Set a one-shot transition for the next navigation only. Consumed automatically w
174
174
{/do}
175
175
```
176
176
177
-
### `Story.save(slot?)`
177
+
### `Story.save(slot?, custom?)`
178
178
179
-
Perform a quick save. When `slot` is provided, saves to a named slot instead of the default autosave slot.
179
+
Perform a save. When `slot` is provided, saves to a named slot instead of the default autosave slot. Pass `custom` to attach metadata that can be retrieved later via `getSaveInfo()`.
180
180
181
181
```javascript
182
-
Story.save(); // save to default slot
183
-
Story.save('my-slot'); // save to named slot
182
+
Story.save(); // default slot
183
+
Story.save('my-slot'); // named slot
184
+
Story.save('day-3', { day:3, phase:'morning' }); // with custom metadata
0 commit comments