tegwick 430c0e124c Refine evidence UX: sidebar capture form, inline edit, click highlight
Significant UX iteration:

Visual palette
- Debug text-layer overlay flips from yellow to light grey so it no
  longer collides with the evidence highlight colour.
- New highlight-styles.css matches the sidebar's #fff8d6/#e0c050
  palette so a passage marked in the document and its sidebar card
  speak the same visual language.
- Active (focused) evidence: same fill, thick #b78b1c outline on both
  the highlight and the sidebar card. Library's red --scrolledTo
  box-shadow is suppressed.

Activation model
- Click an evidence card in the sidebar → activates that item +
  scrolls the viewer to the passage + thickens the borders (existing
  behaviour, now visually clearer).
- Click a highlight in the document → activates the evidence that
  owns that annotation. New `findByAnnotationId()` on EvidenceService
  is the reverse lookup. Wired through a new `onHighlightClicked`
  prop on PdfSpikeViewer + `activeAnnotationId` prop that drives the
  data-ce-active attribute on the highlight wrapper.

Inline edit
- Each evidence card has a ✎ button that flips the card into an
  inline form with the citation (quote) and commentary fields.
- Saving calls a new `AnnotationService.updateQuote()` +
  existing `EvidenceService.updateCommentary()`. The selectors are
  untouched, so the marked passage in the document stays put — the
  inline hint says so explicitly.
- New `AnnotationUpdated` event added to the engine event vocabulary
  (SharedContracts.md §4 updated).

Capture form placement
- The yellow "New annotation" toolbar that lived above the viewer is
  gone. A new InlineCaptureForm component is now slotted into the
  sidebar between the cards that bracket the new selection in
  document flow (sorted by page + y of the first PdfRectSelector).
  If the new selection is before all existing evidence it appears at
  the top; if after all of them, at the bottom.
- The legacy AnnotationToolbar.tsx is removed; the public surface
  re-exports `InlineCaptureForm` instead.

Test updates
- tests/integration/citation-card-export-e2e.dom.test.tsx: switched
  to the seed-session helper (matches the other E2Es) since the
  fixture-button click path is gone.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 22:57:48 +02:00
2026-05-24 13:20:45 +00:00
2026-05-26 15:17:33 +02:00

citation-evidence

A document-centered evidence workspace for capturing, managing, presenting, and re-opening citations. The umbrella over the six-package design described in INTENT.md and wiki/ArchitectureOverview.md.

During the MVP all code lives here under src/ (see "Repository layout" below). Sister repos hold INTENT only — code migrates outward when each subsystem stabilises.

Documentation

Where What
INTENT.md Project intent, scope, the umbrella-first decision
wiki/ PRD, Architecture, SharedContracts, DependencyMap
docs/decisions/ ADRs (architecturally significant decisions)
workplans/ Ralph-driven workplans that implement the MVP slice
history/ Time-stamped assessments and post-mortems

The canonical contracts are in wiki/SharedContracts.md; the partition boundaries are in wiki/DependencyMap.md. Both are referenced from every workplan and from each sister repo's INTENT.md.

Repository layout

src/
  shared/   # vocabulary, types, pure helpers      → becomes part of citation-engine
  engine/   # services, repositories, event bus    → becomes part of citation-engine
  anchor/   # selector creation/resolution, viewer adapter contract → becomes evidence-anchor
  source/   # ingest, fingerprint, extraction, recovery → becomes evidence-source
  binder/   # evidence-to-target binding, visual guide → becomes evidence-binder
  work/     # review UI (sidebar, viewer shell)    → becomes citation-work
  app/      # the reference workspace shell        → stays in citation-evidence

The dependency-edge rules between partitions are enforced by ESLint via eslint-plugin-boundaries (see eslint.config.js). Extraction to a sister repo is intended to be a git mv plus a package.json cut — nothing more.

Sister repos

Peers under ~/; each holds INTENT.md only during MVP:

Dev workflow

Requirements: Node 20 LTS (see .nvmrc) and pnpm 9.

pnpm install
pnpm dev        # vite dev server (once src/app/ has a real entry)
pnpm test       # vitest one-shot
pnpm test:watch
pnpm lint       # eslint with boundary rules
pnpm typecheck  # tsc --noEmit
pnpm build      # production bundle

Workplans (Ralph)

Workplans drive incremental implementation through the ralph loop. The harness lives in ~/ralph-workplan/; see workplans/README.md for the active list and ordering.

/ralph-workplan workplans/CE-WP-0001-foundations.md

The loop self-retires when every task in the file has status: done and the workplan's frontmatter status: done.

Description
document-centered evidence workspace for capturing, managing, presenting, and re-opening citations
Readme MIT-0 960 KiB
Languages
TypeScript 98.9%
CSS 0.6%
JavaScript 0.4%