69 lines
5.0 KiB
Markdown
69 lines
5.0 KiB
Markdown
# Tasks — migrate @suaveplan/macos-contacts
|
|
|
|
## 1. Spec authoring
|
|
|
|
- [x] 1.1 Read `../suaveplan/enterprise/macos-contacts.md` end-to-end
|
|
- [x] 1.2 Read upstream source under `../suaveplan/packages/universal/macos-contacts/src/`
|
|
- [x] 1.3 Read `openspec/AGENTS.md` Sections 0a, 0c, 6a, 7, 13, 13b, 14
|
|
- [x] 1.4 Draft `proposal.md` from `openspec/templates/proposal.md`
|
|
- [x] 1.5 Fill in `## Source mapping` table — every requirement cites a line range OR appears in the "no source line" table with justification
|
|
- [x] 1.6 Draft `specs/macos-contacts/spec.md` from `openspec/templates/spec-delta.md`
|
|
- [x] 1.7 Every requirement in the spec delta carries a `**Verified by:**` line naming concrete `it(...)` titles
|
|
|
|
## 2. Implementation
|
|
|
|
- [x] 2.1 Scaffold `packages/contacts/macos-contacts/` with `package.json`, `tsconfig.json`, `tsconfig.lib.json`, `vite.config.ts`, `vitest.config.ts`, `README.md`, `tests/setup/polyfills.ts`
|
|
- [x] 2.2 `src/error-codes/error-codes.ts` — `MACOS_CONTACTS_CODES` via `defineCodes`, `MacOSContactsError extends SuaveplanError<MacOSContactsErrorCode>` with `query` / `groupName` / `contactId` discriminants
|
|
- [x] 2.3 `src/otel/instruments.ts` — `getMacOSContactsInstruments` / `resetMacOSContactsInstruments` with six counters + two histograms
|
|
- [x] 2.4 `src/schemas/schemas.ts` — `macOSContactsConfigSchema`, `searchQuerySchema`, `groupNameSchema`, `contactIdSchema`, `parseOrThrow` helper
|
|
- [x] 2.5 `src/types/macos-contacts.types.ts` — entity types preserved verbatim
|
|
- [x] 2.6 `src/parser/parser.ts` — `parseContacts`, `parseGroups`, `normalizePhone` as free functions
|
|
- [x] 2.7 `src/applescript/applescript.ts` — four template builders preserved verbatim
|
|
- [x] 2.8 `src/executor/executor.ts` — `AppleScriptRunner` interface + `createDefaultAppleScriptRunner` `execFile`-based impl, threads `AbortSignal`
|
|
- [x] 2.9 `src/bridge/bridge.ts` — `MacOSContactsBridge` using injected runner + clock, error mapping, OTel emission
|
|
- [x] 2.10 `src/index.ts` — explicit named re-exports from every feature barrel; side-effect import of error-codes module
|
|
- [x] 2.11 Every feature `index.ts` uses explicit named re-exports (§6a)
|
|
- [x] 2.12 `package.json` subpath exports for every feature module
|
|
|
|
## 3. Tests
|
|
|
|
- [x] 3.1 `src/error-codes/error-codes.test.ts` — every code constructs; discriminants flow through
|
|
- [x] 3.2 `src/otel/instruments.test.ts` — every counter + histogram fires via real `MeterProvider`
|
|
- [x] 3.3 `src/schemas/schemas.test.ts` — every schema accepts canonical input, rejects malformed input with `MacOSContactsError(INVALID_INPUT)`
|
|
- [x] 3.4 `src/parser/parser.test.ts` — every parser branch including malformed-skip and empty-input
|
|
- [x] 3.5 `src/applescript/applescript.test.ts` — every template builder including `"` escape
|
|
- [x] 3.6 `src/executor/executor.test.ts` — failure path of `createDefaultAppleScriptRunner` via deliberately-failing script; conditionally runs the success path on platforms with `osascript`
|
|
- [x] 3.7 `src/bridge/bridge.test.ts` — every method with an injected fake runner; error mapping; sync swallows errors; isAvailable swallows errors
|
|
- [x] 3.8 `src/macos-contacts.spec-conformance.test.ts` — pins barrel shape, subpath exports, error-code wiring, no direct `vitest` imports
|
|
- [x] 3.9 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` under `## Modules`
|
|
- [x] 4.3 Update `MANIFEST.md` via `bun scripts/folder-reorg/generate-manifest.ts`
|
|
|
|
## 5. Pre-archive verification (the 5-gate triple)
|
|
|
|
- [x] 5.1 `bun run check` — Biome 0 errors / 0 warnings across the monorepo
|
|
- [x] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/macos-contacts` — green
|
|
- [x] 5.3 `bunx turbo test:coverage --filter=@suaveplan/macos-contacts` — 100/100/100/100
|
|
- [x] 5.4 `bun scripts/openspec-conformance.ts @suaveplan/macos-contacts` — exit 0
|
|
- [x] 5.5 `bunx turbo build --filter=@suaveplan/macos-contacts` — green
|
|
|
|
## 6. Pre-archive 7-row checklist
|
|
|
|
- [x] 6.1 Generics threaded; `MacOSContactsError extends SuaveplanError<MacOSContactsErrorCode>` narrows `code`
|
|
- [x] 6.2 Zod schemas wired at every declared boundary (bridge constructor + `searchContacts` + `getContactById` + `getGroupMembers`)
|
|
- [x] 6.3 Every error code in `error-codes.ts` thrown by at least one production path
|
|
- [x] 6.4 Strict-mode behaviors tested both on and off (default deduplicate-by-channel + opt-out, default clock + injected clock)
|
|
- [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 (instruments bundle cached across `getMacOSContactsInstruments` calls)
|
|
- [x] 6.7 No retroactive tick — every box above reflects work done in this change
|
|
|
|
## 7. Archive
|
|
|
|
- [x] 7.1 Fold spec delta into `openspec/specs/macos-contacts/spec.md`
|
|
- [x] 7.2 Move `openspec/changes/migrate-macos-contacts/` → `openspec/archive/2026-05-20-migrate-macos-contacts/`
|
|
- [x] 7.3 Refresh `MANIFEST.md`
|