AI handoff
Architecture
This Cloudflare Pages build is a static port of Sniplets desktop 0.1.8. Serve the directory containing index.html as the Pages output directory. Scripts load in order from the vendored Markdown renderer to sniplets.js and then renderer.js.
renderer.jsis based on the desktop renderer and adds the web slash-command index and keyboard entry point. When refreshing it from desktop, carry those changes forward and check the HTML for every element the renderer selects.sniplets.jsimplements the desktop bridge in the browser. It owns list, save, cascade delete, clipboard, JSON backup and restore, display presets, and draft state.style.csscontains the desktop theme and browser layout rules. The Help link and Library menu connect both guides.
Data and storage
The bridge returns { items, shortcutRegistered, palettePreset, buildInfo }. Each item has a numeric id, a kind of folder or snippet, a name, string content, and nullable parentId. The browser stores items in sniplets.library and display settings in sniplets.meta.
Seed only when the library key is absent. An empty array represents an intentionally empty library. Validate a restore before writing it. JSON exports wrap the item array in { app, version, items }. Desktop backups are SQLite. Convert only the needed item fields for web import, and keep personal libraries outside the Pages output directory.
Slash commands are derived from titles and any stored shortcut when the library loads. The versionless title is shown in results and the complete title remains searchable. Slash mode ranks exact names first and searches across all folders. Changing a title or restoring a backup rebuilds the command index.
Verify and prepare a release
- Serve the deploy root over local HTTP, for example with
python -m http.server 8765. Openhttp://localhost:8765/. - In a fresh browser profile, verify the starter data, both help links, search, Markdown, copy, and folder navigation.
- Create and edit a snippet, reload, and verify it persists. Test JSON download, valid restore, and rejection of invalid folder relationships.
- Check the narrow layout and desktop size presets. Upload only the static output directory. Keep any browser profile or private export separate.
See the Cloudflare Pages Direct Upload guide for the upload workflow.