Initial Commit

This commit is contained in:
2026-05-27 23:29:53 +01:00
commit fbc70f96e6
10000 changed files with 1102152 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
# Tasks — Add `@suaveplan/api-plugin-search`
## 1. Spec authoring
- [x] 1.1 Read `../suaveplan/enterprise/api-plugin-search.md` end-to-end
- [x] 1.2 Verify no prior `openspec/specs/api-plugin-search/spec.md` exists
- [x] 1.3 Read `openspec/AGENTS.md` Sections 13 and 14
- [x] 1.4 Draft `proposal.md` from `openspec/templates/proposal.md`
- [x] 1.5 Fill `## Source mapping` with line references to upstream
- [x] 1.6 Draft `specs/api-plugin-search/spec.md` from
`openspec/templates/spec-delta.md`
- [x] 1.7 Every requirement carries a `**Verified by:**` line naming concrete
`it(...)` titles
## 2. Implementation
- [x] 2.1 `error-codes/error-codes.ts` — 10 `SEARCH.*` codes + `SearchError` class
- [x] 2.2 `otel/instruments.ts` — meter + 5 instruments (counters + histogram)
- [x] 2.3 `schemas/schemas.ts` — all 13 Zod schemas (formerly upstream `types.ts`)
- [x] 2.4 `schemas/options.ts` — `SearchPluginOptionsSchema` factory-options schema
- [x] 2.5 `analyzer/analyzer.ts` — tokenize / stem / stop-words / 4 analyzers /
`getAnalyzer` / `listAnalyzers`
- [x] 2.6 `service/service.ts` — full in-memory engine (TF-IDF, facets, filters,
sort, highlights, suggest); throws `SearchError` and emits OTel
- [x] 2.7 `routes/build-routes.ts` — 9 OpenAPIHono routes
- [x] 2.8 `types/types.ts` carries the typed event payloads
(`SearchQueryExecutedEvent`, `SearchIndexUpdatedEvent`,
`SearchEventMap`); the `routes/build-routes.ts` `SearchRouteEvent`
discriminated union is the emitter contract — no `as any` casts
- [x] 2.9 `plugin/plugin.ts` — `createSearchPlugin` factory (`@suaveplan/api-plugin`-shaped)
- [x] 2.10 `services/registry-augmentation.ts` — `searchIndexes` slot on
canonical `ServiceRegistry`
- [x] 2.11 `types/types.ts` — internal types (`SearchIndex`, `IndexedDocument`,
`SearchPluginConfig`)
- [x] 2.12 `index.ts` — explicit named barrel + side-effect imports for the
error-codes registry and the registry augmentation
## 3. Tests
- [x] 3.1 Unit tests per feature module
- [x] 3.2 `api-plugin-search.spec-conformance.test.ts` — type-level + barrel pins
- [x] 3.3 Every `it(...)` carries `{ timeout: 5000 }`
## 4. Documentation
- [x] 4.1 Sibling `.md` for every implementation `.ts` (≥200 words, basic +
advanced examples, full API reference)
- [x] 4.2 README links every co-located `.md`
- [x] 4.3 STATUS.md row updated post-archival (other-session-owned; skipped per
guidance)
## 5. Pre-archive verification (the 5-gate triple)
- [x] 5.1 `bun run check` — Biome 0/0/0
- [x] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-search`
- [x] 5.3 `bunx turbo test:coverage --filter=@suaveplan/api-plugin-search`
- [x] 5.4 `bun scripts/openspec-conformance.ts @suaveplan/api-plugin-search`
- [x] 5.5 `bunx turbo build --filter=@suaveplan/api-plugin-search`
## 6. Pre-archive 9-row checklist
- [x] 6.1 Generics threaded; `expectTypeOf` assertions on every literal-type
claim
- [x] 6.2 Zod schemas wired at every declared boundary
- [x] 6.3 Every error code in `error-codes.ts` thrown by at least one production
path
- [x] 6.4 Strict-mode behaviours tested both on and off
- [x] 6.5 OTel instruments emitted from production paths and asserted with a
real in-memory `MeterProvider`
- [x] 6.6 Lifecycle dedup tested where claimed
- [x] 6.7 No retroactive tick
- [x] 6.8 No `export *` in any feature barrel
- [x] 6.9 No direct `vitest` / `bun:test` imports in any test file
## 7. Archive
- [ ] 7.1 Fold spec delta into `openspec/specs/api-plugin-search/spec.md`
- [ ] 7.2 Move `openspec/changes/add-api-plugin-search/` →
`openspec/archive/2026-05-18-add-api-plugin-search/`