generated from coulomb/repo-seed
Per-evidence-item export: click Export → Copy as Markdown / Copy as HTML writes a portable citation card to the clipboard. Cmd/Ctrl+Shift+C exports the active evidence as Markdown. - ADR-0007 locks the Markdown + HTML output formats. - New shared types: CitationCard, openContextUrl(), resolveSourceLabel(). - Engine renderers under src/engine/rendering/: renderCitationCardMarkdown, renderCitationCardHtml — snapshot-tested, escape-safe, BEM classes for HTML. - src/work/useExportEvidence.ts wires engine + renderers + clipboard. - EvidenceSidebar gains an Export popover per row + auto-dismissing toast. - E2E test (tests/integration/citation-card-export-e2e.dom.test.tsx) walks PRD scenario steps 10-11 and asserts the clipboard payload. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
/**
|
|
* Engine composition root.
|
|
*
|
|
* `createEngine()` wires in-memory repos to the services and shares a single
|
|
* event bus. The app layer holds the returned `Engine` instance and passes
|
|
* its services into the UI.
|
|
*
|
|
* Swapping the repository implementation later (ADR-0005) is a matter of
|
|
* replacing `createInMemoryRepos()` here. The service signatures don't
|
|
* change.
|
|
*/
|
|
|
|
import { createEventBus, type EventBus } from "./events";
|
|
import {
|
|
createInMemoryRepos,
|
|
type InMemoryRepos,
|
|
} from "./repos";
|
|
import {
|
|
createAnnotationService,
|
|
createDocumentService,
|
|
createEvidenceService,
|
|
type AnnotationService,
|
|
type DocumentService,
|
|
type EvidenceService,
|
|
} from "./services";
|
|
|
|
export * from "./events";
|
|
export * from "./repos";
|
|
export * from "./services";
|
|
export * from "./rendering";
|
|
export {
|
|
SNAPSHOT_VERSION,
|
|
attachPersister,
|
|
captureSnapshot,
|
|
documentIdsIn,
|
|
restoreFromStorage,
|
|
restoreSnapshot,
|
|
type EngineSnapshot,
|
|
type PersisterOptions,
|
|
} from "./persistence";
|
|
|
|
export interface Engine {
|
|
readonly bus: EventBus;
|
|
readonly repos: InMemoryRepos;
|
|
readonly documents: DocumentService;
|
|
readonly annotations: AnnotationService;
|
|
readonly evidence: EvidenceService;
|
|
}
|
|
|
|
export function createEngine(): Engine {
|
|
const bus = createEventBus();
|
|
const repos = createInMemoryRepos();
|
|
const documents = createDocumentService(repos.documents, repos.representations, bus);
|
|
const annotations = createAnnotationService(repos.annotations, bus);
|
|
const evidence = createEvidenceService(
|
|
repos.evidenceItems,
|
|
(id) => repos.annotations.get(id),
|
|
bus,
|
|
);
|
|
return { bus, repos, documents, annotations, evidence };
|
|
}
|