chore: initial scaffold + design spec + implementation plan

Skeleton for Osteo Report MVP. Build passes, 7 smoke tests green, real
Horse.svg + Horse_head.svg in public/species/equine/. Zod schemas are
the contract; store/anatomy/pdf modules are typed stubs throwing
"not implemented" awaiting implementation.

Spec: docs/superpowers/specs/2026-05-18-osteo-report-mvp-design.md
Plan: docs/superpowers/plans/2026-05-18-osteo-report-mvp.md (23 phases, ~70 TDD tasks)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bastien ChanotandClaude Opus 4.7 committed 2026-05-18 20:55:10 +02:00
1 parent 12a3e48fdf
commit 8ca36b5ccd
104 files changed
+12448

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import type { PDFDocument } from 'pdf-lib'
import type { Report } from '@/domain/schema/report'
/**
* Attaches the serialized Report JSON to the PDF document as a native
* embedded file with afRelationship 'Data'.
* Filename: 'osteo-report.json', mimeType: 'application/json'.
*/
export async function attachReportJson(
_pdfDoc: PDFDocument,
_report: Report,
): Promise<void> {
throw new Error('not implemented')
}
/**
* Extracts and parses the first embedded file named 'osteo-report*'
* with mime 'application/json' from the PDF document.
* Throws ImportError if not found or invalid.
*/
export async function extractReportJson(_pdfDoc: PDFDocument): Promise<Report> {
throw new Error('not implemented')
}
+10
View File
@@ -0,0 +1,10 @@
import type { Report } from '@/domain/schema/report'
/**
* Generates a self-contained A4 PDF for the given report.
* The full report JSON is attached as a native PDF embedded file.
* Returns a Uint8Array of the PDF bytes for download.
*/
export async function exportReportToPdf(_report: Report): Promise<Uint8Array> {
throw new Error('not implemented')
}
+18
View File
@@ -0,0 +1,18 @@
import type { PDFDocument, PDFFont } from 'pdf-lib'
export interface EmbeddedFonts {
bodyRegular: PDFFont
bodyBold: PDFFont
headingRegular: PDFFont
}
/**
* Embeds Inter (body) and Fraunces (headings) into the PDF document.
* Font files are fetched from /fonts/ in the public directory.
* Both fonts must be TTF (pdf-lib does not support woff2 directly).
*/
export async function embedFonts(
_pdfDoc: PDFDocument,
): Promise<EmbeddedFonts> {
throw new Error('not implemented')
}
+25
View File
@@ -0,0 +1,25 @@
import type { Report } from '@/domain/schema/report'
/**
* Raised when the PDF does not contain a valid osteo-report JSON attachment.
* The message is the French user-facing error string.
*/
export class ImportError extends Error {
constructor() {
super(
"Ce PDF n'a pas été généré par Osteo Report (pas de données détectées).",
)
this.name = 'ImportError'
}
}
/**
* Loads a PDF from bytes, extracts the attached report JSON, validates it
* with Zod, and returns a hydrated Report.
* Throws ImportError on any failure.
*/
export async function importReportFromPdf(
_pdfBytes: Uint8Array,
): Promise<Report> {
throw new Error('not implemented')
}
+15
View File
@@ -0,0 +1,15 @@
import type { PDFDocument } from 'pdf-lib'
import type { EmbeddedFonts } from '@/pdf/fonts'
import type { Report } from '@/domain/schema/report'
/**
* Appends the final page to the PDF: conclusion, recommendations,
* next appointment.
*/
export async function addConclusionPage(
_pdfDoc: PDFDocument,
_report: Report,
_fonts: EmbeddedFonts,
): Promise<void> {
throw new Error('not implemented')
}
+15
View File
@@ -0,0 +1,15 @@
import type { PDFPage } from 'pdf-lib'
import type { EmbeddedFonts } from '@/pdf/fonts'
/**
* Draws the page footer: brand name (from config), export date, page x/y.
* Brand name comes from env-driven appConfig — never hardcoded.
*/
export function drawFooter(
_page: PDFPage,
_fonts: EmbeddedFonts,
_pageNumber: number,
_totalPages: number,
): void {
throw new Error('not implemented')
}
+14
View File
@@ -0,0 +1,14 @@
import type { PDFPage } from 'pdf-lib'
import type { EmbeddedFonts } from '@/pdf/fonts'
import type { Report } from '@/domain/schema/report'
/**
* Draws the page header: practitioner block (left) + animal/owner/date (right).
*/
export function drawHeader(
_page: PDFPage,
_report: Report,
_fonts: EmbeddedFonts,
): void {
throw new Error('not implemented')
}
+19
View File
@@ -0,0 +1,19 @@
import type { PDFDocument } from 'pdf-lib'
import type { EmbeddedFonts } from '@/pdf/fonts'
import type { Report } from '@/domain/schema/report'
import type { Observation } from '@/domain/schema/observation'
/**
* Appends one page per observation to the PDF document.
* Each page includes: rasterized main SVG, optional detail SVG raster,
* zones block, pathologies + severity + comment, abbreviated citations.
*/
export async function addObservationPage(
_pdfDoc: PDFDocument,
_report: Report,
_observation: Observation,
_obsIndex: number,
_fonts: EmbeddedFonts,
): Promise<void> {
throw new Error('not implemented')
}
+11
View File
@@ -0,0 +1,11 @@
/**
* Rasterizes an SVG string to a PNG Uint8Array using canvg.
* Scale factor 2 = A4 print quality.
* Returns raw PNG bytes suitable for pdf-lib embedPng().
*/
export async function rasterizeSvg(
_svgString: string,
_scale: number,
): Promise<Uint8Array> {
throw new Error('not implemented')
}