feat(core-analytics): add withAnalytics wrapper and Analyzed brand export

Adds `withAnalytics(analytics, factory)` to packages/core-analytics —
mirrors the `withAudit` pattern: thin forwarding closure that attaches
the `__analyzed` brand via `attachBrand` from `@repo/core-shared/conformance`
without mutating the original factory.  Exports `Analyzed<F>` type and
`withAnalytics` from the `@repo/core-analytics` root barrel.

Adds `with-analytics.test.ts` asserting brand is present after wrapping,
absent on the original fn, output passes through unchanged, and errors
propagate.  Adds `@repo/core-shared` as a production dependency.

Also fixes `scripts/library-decisions/check.mjs` to exempt workspace-protocol
entries (`workspace:*`) from the library trace requirement — internal monorepo
packages are not third-party libraries and were incorrectly gated.  Adds a
regression test in `check.test.mjs` covering the exemption.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 11:52:44 +00:00
parent a5ab698b41
commit c7bdf7cf3b
8 changed files with 135 additions and 18 deletions

View File

@@ -1,18 +1,18 @@
{
"generatedAt": "2026-05-18T11:31:45.093Z",
"commit": "80c702e",
"generatedAt": "2026-05-18T11:50:20.112Z",
"commit": "a5ab698",
"repo": {
"statements": 95.87,
"branches": 89.02,
"statements": 95.89,
"branches": 89.07,
"functions": 100,
"lines": 95.87,
"lines": 95.89,
"counts": {
"lf": 3121,
"lh": 2992,
"brf": 492,
"brh": 438,
"fnf": 147,
"fnh": 147
"lf": 3140,
"lh": 3011,
"brf": 494,
"brh": 440,
"fnf": 149,
"fnh": 149
}
},
"byPackage": {
@@ -50,12 +50,12 @@
"functions": 100,
"lines": 100,
"counts": {
"lf": 8,
"lh": 8,
"brf": 5,
"brh": 5,
"fnf": 5,
"fnh": 5
"lf": 27,
"lh": 27,
"brf": 7,
"brh": 7,
"fnf": 7,
"fnh": 7
}
},
"@repo/marketing-pages": {