Files
breakpilot-compliance/breakpilot-compliance-sdk
Sharang Parnerkar 5cb91e88d2 refactor(compliance-sdk): split client/provider/embed/state under 500 LOC
Phase 4 continuation. All touched files now under the file-size cap, and
drive-by fixes unblock the types/core/react/vanilla builds which were broken
at baseline.

Splits
- packages/types/src/state 505 -> 31 LOC barrel + state-flow/-assessment/-core
- packages/core/src/client 521 -> 395 LOC + client-http 187 LOC (HTTP transport)
- packages/react/src/provider 539 -> 460 LOC + provider-context 101 LOC
- packages/vanilla/src/embed 611 -> 290 LOC + embed-banner 321 + embed-translations 78

Drive-by fixes (pre-existing typecheck/build failures)
- types/rag.ts: rename colliding LegalDocument export to RagLegalDocument
  (the `export *` chain in index.ts was ambiguous; two consumers updated
  - core/modules/rag.ts drops unused import, vue/composables/useRAG.ts
  switches to the renamed symbol).
- core/modules/rag.ts: wrap client searchRAG response to add the missing
  `query` field so the declared SearchResponse return type is satisfied.
- react/provider.tsx: re-export useCompliance so ComplianceDashboard /
  ConsentBanner / DSRPortal legacy `from '../provider'` imports resolve.
- vanilla/embed.ts + web-components/base.ts: default tenantId to ''
  so ComplianceClient construction typechecks.
- vanilla/web-components/consent-banner.ts: tighten categories literal to
  `as const` so t.categories indexing narrows correctly.

Verification: packages/types + core + react + vanilla all `pnpm build`
clean with DTS emission. consent-sdk unaffected (still green).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:39:47 +02:00
..

breakpilot-compliance-sdk

TypeScript SDK monorepo providing React, Angular, Vue, vanilla JS, and core bindings for the BreakPilot Compliance backend. Published as npm packages.

Stack: TypeScript, workspaces (packages/core, packages/react, packages/angular, packages/vanilla, packages/types).

Layout

packages/
├── core/       # Framework-agnostic client + state
├── types/      # Shared type definitions
├── react/      # React Provider + hooks
├── angular/    # Angular service
└── vanilla/    # Vanilla-JS embed script

Architecture

Follow ../AGENTS.typescript.md. No framework-specific code in core/.

Build + test

npm install
npm run build     # per-workspace build
npm test          # Vitest (Phase 4 adds coverage — currently 0 tests)

Known debt (Phase 4)

  • packages/vanilla/src/embed.ts (611), packages/react/src/provider.tsx (539), packages/core/src/client.ts (521), packages/react/src/hooks.ts (474) — split.
  • Zero test coverage. Priority Phase 4 target.

Don't touch

Public API surface of core without bumping package major version and updating consumers.