Scope widget SDK to widgetContract; drop unused schema from bundle (~36 KB)#203
Merged
Conversation
…used schema from bundle - Replace src/sdk/routes.ts + schema.ts monolith mirrors with sync-generated contract.ts + contracts/* scoped to widgetContract (8 procedures) - Repoint index.ts to widgetContract; add named re-exports for all widget-consumed types and runtime schemas (WidgetEventSchema, WidgetSettingsDataSchema) - Add sideEffects:false to package.json to unlock tree-shaking - Fix all intra-package imports from sdk/schema → sdk barrel - sdk/* attributed bytes: 7531 (entities 5906, common 1232, index 393) vs old schema.ts ~37-41 KB; schema.ts row is GONE from bundle Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the old structural-diff gate (check-contract-drift.mjs comparing routes.ts + schema.ts) with the generator in --check mode. The gate now sparse-checkouts contracts/, sdk/, and scripts/sync-consumers.mjs from Marketrix-ai/api@dev and runs: node .api-src/scripts/sync-consumers.mjs widget --check --dest src/sdk. Trigger path updated to src/sdk/**. Delete scripts/check-contract-drift.mjs (superseded). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #204
Summary
Repoints
widget/src/sdkto its scoped audience contract (widgetContract, the 8 procedures the widget calls) from the restructured api (Marketrix-ai/api#598). Internal-only — no wire/API-surface change.contract.ts+contracts/*(generated by api'ssync-consumers.mjs), replacing theroutes.ts/schema.tsmonolith; client typedContractRouterClient<typeof widgetContract>.sideEffects:falseadded.schema.tsno longer shipped; tree-shaking now reaches the contract closure.contract-drift.ymlCI gate reworked tosync-consumers widget --check.Deploy ordering
Independent of api/app (no wire change). Published
@marketrix.ai/widgetAPI surface unchanged — republish optional.Test Plan
npm run type-check,npm run test:run(225),npm run build;needs_healingno longer leaking app/QA schema🤖 Generated with Claude Code