30 lines
1.6 KiB
Markdown
30 lines
1.6 KiB
Markdown
# Tasks — Host Reserved-Prefix Contract
|
|
|
|
## 1. Implementation
|
|
|
|
- [x] 1.1 Add `src/reserved-prefix/reserved-prefix.types.ts` with `ReservedPrefix` branded type and `ReservedPrefixError<TCode>` shape.
|
|
- [x] 1.2 Add `src/reserved-prefix/reserved-prefix.ts` exporting:
|
|
- `HOST_RESERVED_PREFIXES: ReadonlyArray<string>` (frozen, deduped, lowercase, slash-normalised).
|
|
- `isReservedPrefix(prefix: string): boolean`.
|
|
- `normalisePrefix(prefix: string): string`.
|
|
- `assertPrefixAvailable<TCode extends string>(prefix: string, codeFactory: (collision: string) => Error): void`.
|
|
- [x] 1.3 Add sibling `reserved-prefix.md` (≥200 words, Purpose/Features/Usage:Basic/Usage:Advanced/API Reference/Implementation Notes).
|
|
- [x] 1.4 Add `src/reserved-prefix/index.ts` barrel (named re-exports only — rule 10).
|
|
- [x] 1.5 Wire `./reserved-prefix` subpath into `package.json` exports.
|
|
- [x] 1.6 Re-export from top-level barrel `src/index.ts`.
|
|
|
|
## 2. Tests
|
|
|
|
- [x] 2.1 Unit: `reserved-prefix.test.ts` — coverage of every predicate path (exact match, normalised match, child path, sibling path, unrelated prefix). 100% istanbul on touched modules.
|
|
- [x] 2.2 Conformance scenarios: prefix normalisation (`/Internal` ↔ `/internal`, trailing slash, missing leading slash), assertion throws when reserved, no-op when free.
|
|
|
|
## 3. Pre-publish gate
|
|
|
|
- [x] 3.1 `bunx turbo lint typecheck test --filter=@suaveplan/api-host` green.
|
|
- [x] 3.2 `bunx turbo test:coverage --filter=@suaveplan/api-host` 100% on touched modules.
|
|
|
|
## 4. Archive
|
|
|
|
- [x] 4.1 Fold delta into `openspec/specs/api-host/spec.md`.
|
|
- [x] 4.2 Move folder to `openspec/archive/2026-05-26-api-host-reserved-prefix/`.
|