5.0 KiB
5.0 KiB
Tasks — migrate @suaveplan/macos-contacts
1. Spec authoring
- 1.1 Read
../suaveplan/enterprise/macos-contacts.mdend-to-end - 1.2 Read upstream source under
../suaveplan/packages/universal/macos-contacts/src/ - 1.3 Read
openspec/AGENTS.mdSections 0a, 0c, 6a, 7, 13, 13b, 14 - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Fill in
## Source mappingtable — every requirement cites a line range OR appears in the "no source line" table with justification - 1.6 Draft
specs/macos-contacts/spec.mdfromopenspec/templates/spec-delta.md - 1.7 Every requirement in the spec delta carries a
**Verified by:**line naming concreteit(...)titles
2. Implementation
- 2.1 Scaffold
packages/contacts/macos-contacts/withpackage.json,tsconfig.json,tsconfig.lib.json,vite.config.ts,vitest.config.ts,README.md,tests/setup/polyfills.ts - 2.2
src/error-codes/error-codes.ts—MACOS_CONTACTS_CODESviadefineCodes,MacOSContactsError extends SuaveplanError<MacOSContactsErrorCode>withquery/groupName/contactIddiscriminants - 2.3
src/otel/instruments.ts—getMacOSContactsInstruments/resetMacOSContactsInstrumentswith six counters + two histograms - 2.4
src/schemas/schemas.ts—macOSContactsConfigSchema,searchQuerySchema,groupNameSchema,contactIdSchema,parseOrThrowhelper - 2.5
src/types/macos-contacts.types.ts— entity types preserved verbatim - 2.6
src/parser/parser.ts—parseContacts,parseGroups,normalizePhoneas free functions - 2.7
src/applescript/applescript.ts— four template builders preserved verbatim - 2.8
src/executor/executor.ts—AppleScriptRunnerinterface +createDefaultAppleScriptRunnerexecFile-based impl, threadsAbortSignal - 2.9
src/bridge/bridge.ts—MacOSContactsBridgeusing injected runner + clock, error mapping, OTel emission - 2.10
src/index.ts— explicit named re-exports from every feature barrel; side-effect import of error-codes module - 2.11 Every feature
index.tsuses explicit named re-exports (§6a) - 2.12
package.jsonsubpath exports for every feature module
3. Tests
- 3.1
src/error-codes/error-codes.test.ts— every code constructs; discriminants flow through - 3.2
src/otel/instruments.test.ts— every counter + histogram fires via realMeterProvider - 3.3
src/schemas/schemas.test.ts— every schema accepts canonical input, rejects malformed input withMacOSContactsError(INVALID_INPUT) - 3.4
src/parser/parser.test.ts— every parser branch including malformed-skip and empty-input - 3.5
src/applescript/applescript.test.ts— every template builder including"escape - 3.6
src/executor/executor.test.ts— failure path ofcreateDefaultAppleScriptRunnervia deliberately-failing script; conditionally runs the success path on platforms withosascript - 3.7
src/bridge/bridge.test.ts— every method with an injected fake runner; error mapping; sync swallows errors; isAvailable swallows errors - 3.8
src/macos-contacts.spec-conformance.test.ts— pins barrel shape, subpath exports, error-code wiring, no directvitestimports - 3.9 Every
it(...)carries{ timeout: 5000 }
4. Documentation
- 4.1 Sibling
.mdfor every implementation.ts(≥200 words, basic + advanced examples, full API reference) - 4.2 README links every co-located
.mdunder## Modules - 4.3 Update
MANIFEST.mdviabun scripts/folder-reorg/generate-manifest.ts
5. Pre-archive verification (the 5-gate triple)
- 5.1
bun run check— Biome 0 errors / 0 warnings across the monorepo - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/macos-contacts— green - 5.3
bunx turbo test:coverage --filter=@suaveplan/macos-contacts— 100/100/100/100 - 5.4
bun scripts/openspec-conformance.ts @suaveplan/macos-contacts— exit 0 - 5.5
bunx turbo build --filter=@suaveplan/macos-contacts— green
6. Pre-archive 7-row checklist
- 6.1 Generics threaded;
MacOSContactsError extends SuaveplanError<MacOSContactsErrorCode>narrowscode - 6.2 Zod schemas wired at every declared boundary (bridge constructor +
searchContacts+getContactById+getGroupMembers) - 6.3 Every error code in
error-codes.tsthrown by at least one production path - 6.4 Strict-mode behaviors tested both on and off (default deduplicate-by-channel + opt-out, default clock + injected clock)
- 6.5 OTel instruments emitted from production paths and asserted with a real in-memory
MeterProvider - 6.6 Lifecycle dedup tested where claimed (instruments bundle cached across
getMacOSContactsInstrumentscalls) - 6.7 No retroactive tick — every box above reflects work done in this change
7. Archive
- 7.1 Fold spec delta into
openspec/specs/macos-contacts/spec.md - 7.2 Move
openspec/changes/migrate-macos-contacts/→openspec/archive/2026-05-20-migrate-macos-contacts/ - 7.3 Refresh
MANIFEST.md