feat: inject related-documents drawer into preview pages#62
Merged
Conversation
Phase 1 planning for a slide-in drawer injected into HTML preview pages:
- GET /api/sessions/{id}/peers returns same-category and same-project docs
- Floating button + right-side drawer injected via existing InjectMiddleware
- Lazy fetch on click, loading/error/empty states, non-invasive to source files
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a floating button to HTML preview pages that opens a right-side
drawer listing documents sharing the same category or project, plus a
back-to-home link. The drawer is injected by InjectMiddleware alongside
the existing live-reload script, so source files remain untouched.
- session: GetPeers(sessionID, limit) queries same-category/same-project
peers (excludes self + soft-deleted, ordered desc, capped at 20)
- server: GET /api/sessions/{id}/peers endpoint
- live: drawerCSS/drawerHTML/drawerJS constants; injectScript generalized
to variadic snippets; CSS namespaced with !important for isolation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the completed preview-drawer change to openspec/changes/archive/2026-06-13-preview-drawer and sync its delta specs into baseline capabilities under openspec/specs/ (peers-api, preview-drawer). No code changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
APIError: Authentication Fails, Your api key: ****3097 is invalid |
|
APIError: Authentication Fails, Your api key: ****3097 is invalid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a floating button to HTML preview pages (
/s/{id}/) that opens a right-side drawer listing documents that share the same category or project, plus a back-to-home link. Lets you jump between related docs without leaving the preview.The drawer is injected by the existing
InjectMiddlewarealongside the live-reload script, so source files are never modified — it only appears when a doc is served through/s/{id}/.Changes
session:GetPeers(sessionID, limit)— queries same-category and same-project peers (excludes self + soft-deleted, ordered by creation desc, capped at 20)server:GET /api/sessions/{id}/peersendpointlive:drawerCSS/drawerHTML/drawerJSconstants;injectScriptgeneralized to variadic snippets; CSS namespaced under#sth-drawer-*with!importantfor isolationBehavior
Verification
go vet ./...clean; fullgo test ./...greensession(peers found/empty/deleted/ordering/limit/not-found), 3 inserver(success/empty/not-found), 3 inlive(injected into HTML, skipped for CSS + non-preview paths)/peerscorrectly returned peers in bothbyCategoryandbyProject; on-disk source file confirmed to have 0 drawer markers while the served page has themOpenSpec
Planning artifacts under
openspec/changes/preview-drawer/(proposal, design, specs, tasks). This is a lighter-weight precursor to the planneddocument-relationshipschange (which adds explicit user-defined edges + a node page).🤖 Generated with Claude Code