Files
suaveplan/openspec/archive/2026-05-25-enterprise-clipboard/tasks.md
2026-05-27 23:29:53 +01:00

65 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Tasks — enterprise-clipboard
> Implementation checklist for migrating `@suaveplan/clipboard` from
> `../suaveplan/packages/browser/clipboard` (1.0.3) into
> `packages/foundation/data/clipboard/` at 0.1.0 with enterprise surface.
## Spec-inventory checklist
Spec delta contains 17 `### Requirement` blocks. Each item below maps 1:1 to a spec
requirement and is checked off as the implementation lands.
- [x] R1 Stable error code registry — `src/errors/errors.ts`
- [x] R2 ClipboardError extends SuaveplanError — `src/errors/errors.ts`
- [x] R3 Secure-context guard — `src/security/security.ts`
- [x] R4 AsyncQueue serialization — `src/queue/queue.ts`
- [x] R5 Permission state probe — `src/permissions/permissions.ts`
- [x] R6 Permission change subscription — `src/permissions/permissions.ts`
- [x] R7 Plain-text copy via Clipboard API — `src/manager/manager.ts`
- [x] R8 Plain-text copy fallback — `src/manager/manager.ts` + `src/fallback/fallback.ts`
- [x] R9 Rich-content copy with image and blobs — `src/manager/manager.ts`
- [x] R10 Rich-content read with image and blobs — `src/manager/manager.ts`
- [x] R11 HTML sanitizer hook — `src/manager/manager.ts` + `src/sanitizer/sanitizer.ts`
- [x] R12 Paste-event read fallback — `src/fallback/fallback.ts`
- [x] R13 Async queue serializes manager calls — `src/manager/manager.ts`
- [x] R14 Secure-context gate on copy — `src/manager/manager.ts`
- [x] R15 OpenTelemetry instrumentation — `src/observability/observability.ts`
- [x] R16 Injectable navigator and options bag — `src/manager/manager.ts`
- [x] R17 Tree-shakeable subpath exports — `package.json`
## Steps
1. Scaffold `packages/foundation/data/clipboard/` with `package.json`, `vite.config.ts`,
`vitest.config.ts`, `tsconfig.lib.json`, `README.md`.
2. Author shared types in `src/types/clipboard.types.ts`.
3. Implement `src/errors/errors.ts` with `CLIPBOARD_CODES`, metadata,
`ClipboardError`. Add `errors.md` + `errors.test.ts`.
4. Implement `src/security/security.ts` (`isSecure`, `requireSecureContext`).
5. Implement `src/queue/queue.ts` (`AsyncQueue`).
6. Implement `src/sanitizer/sanitizer.ts` (default identity + interface).
7. Implement `src/observability/observability.ts` —
`createClipboardObservability` + types module.
8. Implement `src/permissions/permissions.ts` — probe + change subscription.
9. Implement `src/fallback/fallback.ts` — textarea+execCommand copy + paste-event
read fallback.
10. Implement `src/manager/manager.ts` — `ClipboardManager` orchestrating queue,
secure-context, observability, permissions, fallback, sanitizer.
11. Wire `src/index.ts` with explicit named re-exports.
12. Write co-located `.md` for every implementation file (≥200 words, six required
sections, with simple + advanced examples that compile).
13. Write tests at 100% line/branch/function/statement coverage in
`vitest.config.ts` (`provider: 'istanbul'`, `environment: 'happy-dom'`,
`pool: 'forks'`).
14. Add `src/index.test.ts` covering package-level invariants (subpath exports
present, no node imports).
15. Add subpath exports for every feature module in `package.json` `exports` map.
16. Update `scripts/folder-reorg/assignment.yml` to list `clipboard` under the
`data` plugin.
17. Run `bun scripts/folder-reorg/generate-manifest.ts` to refresh `MANIFEST.md`.
18. Run gates: `bunx turbo lint typecheck test build --filter=@suaveplan/clipboard`
and `bunx turbo test:coverage --filter=@suaveplan/clipboard`.
19. Flip `@suaveplan/clipboard` `–` → `✅` in `STATUS.md`.
20. Fold `specs/clipboard/spec.md` into `openspec/specs/clipboard/spec.md`.
21. Move `openspec/changes/enterprise-clipboard/` →
`openspec/archive/2026-05-25-enterprise-clipboard/`.