4.6 KiB
4.6 KiB
Tasks — Add @suaveplan/api-plugin-export
Every checkbox MUST reflect work actually done in this change.
1. Spec authoring
- 1.1 Read
../suaveplan/enterprise/api-plugin-export.mdend-to-end - 1.2 Read upstream
../suaveplan/packages/server/api-plugin-export/src/end-to-end - 1.3 Read
openspec/AGENTS.md§§ 2a, 6a, 7, 12, 13, 14 - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Fill
## Source mappingtable — every requirement cites a line range - 1.6 Draft
specs/api-plugin-export/spec.mdwith## ADDED Requirements - 1.7 Every requirement carries a
**Verified by:**line naming concreteit(...)titles
2. Implementation
- 2.1
src/error-codes/error-codes.ts—EXPORT_CODES(5 codes) +ExportErrorextendingSuaveplanError - 2.2
src/types/types.ts—ExportFormat,ExportStatus,ExportOptions,ExportResult,Exporter,DataProvider - 2.3
src/schemas/schemas.ts—ExportFormatSchema,ExportStatusSchema,ColumnDefinitionSchema,CreateExportJobSchema,ExportJobSchema,ExportJobListQuerySchema,ExportPluginConfigSchema - 2.4
src/otel/instruments.ts—getExportInstruments()+resetExportInstruments() - 2.5
src/exporters/csv/csv.ts—escapeCsvField,formatCellValue,convertToCsv,CsvExporter - 2.6
src/exporters/json/json.ts—projectRow,convertToJson,JsonExporter - 2.7
src/exporters/xlsx/xlsx.ts—escapeXml,columnIndexToLetter,formatXlsxCell,buildSpreadsheetXml,XlsxExporter - 2.8
src/services/export-service.ts—getExporter,inferColumns,runExport,DEFAULT_EXPORT_CONFIG,ExportServiceConfig - 2.9
src/routes/exports.ts—createExportRoutes(deps)mounting GET / POST / GET /:id / DELETE /:id - 2.10
src/plugin/plugin.ts—createExportPlugin,registerDataProvider - 2.11
src/services/registry-augmentation.ts— augmentServiceRegistrywithexportProviders/exportJobs/app - 2.12
src/events/event-augmentation.ts— augmentEventBusLikeevent topics (export:initialized, etc.) - 2.13
src/index.ts— explicit named re-exports of the full surface; subpath exports in package.json
3. Tests
- 3.1
src/exporters/csv/csv.test.ts - 3.2
src/exporters/json/json.test.ts - 3.3
src/exporters/xlsx/xlsx.test.ts - 3.4
src/services/export-service.test.ts - 3.5
src/routes/exports.test.ts— full Hono route exercise viaapp.request - 3.6
src/plugin/plugin.test.ts— lifecycle + service registration + event emission against a realPluginContextbuilt fromcreatePluginContext - 3.7
src/error-codes/error-codes.test.ts— every code thrown from a real production path - 3.8
src/otel/instruments.test.ts— real in-memoryMeterProvider, assert counter + histogram emission - 3.9
src/api-plugin-export.spec-conformance.test.ts—expectTypeOfon public surface - 3.10
src/schemas/schemas.test.ts— Zod-boundary assertions - 3.11 Every
it(...)carries{ timeout: 5000 }(or 30000 for async)
4. Documentation
- 4.1 Sibling
.mdfor every implementation.ts(≥200 words, basic + advanced examples, API reference) - 4.2 README links every co-located
.mdunder## Modules
5. Pre-archive verification (the 5-gate triple)
- 5.1
bun run check— Biome 0 errors / 0 warnings / 0 info - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-export— green - 5.3
bunx turbo test:coverage --filter=@suaveplan/api-plugin-export— 100/100/100/100 - 5.4
bun scripts/openspec-conformance.ts @suaveplan/api-plugin-export— exit 0 - 5.5
bunx turbo build --filter=@suaveplan/api-plugin-export— green
6. Pre-archive 9-row checklist
- 6.1 Generics threaded;
expectTypeOfassertions on every literal-type claim - 6.2 Zod schemas wired at every declared boundary
- 6.3 Every error code in
error-codes.tsthrown by at least one production path - 6.4 Strict-mode behaviors tested
- 6.5 OTel instruments emitted from production paths and asserted with real in-memory
MeterProvider - 6.6 Lifecycle dedup tested
- 6.7 No retroactive tick — every box above reflects work done in this change
- 6.8 No
export *in any feature-module barrel - 6.9 No direct
vitest/bun:testimports in test files (all via@suaveplan/testing/runner)
7. Archive
- 7.1 Fold spec delta into
openspec/specs/api-plugin-export/spec.md - 7.2 Move
openspec/changes/add-api-plugin-export/→openspec/archive/2026-05-18-add-api-plugin-export/