From 98652fd3a6c8d2d3c6b5440a218edfce3e17f770 Mon Sep 17 00:00:00 2001 From: Yash Raj Pandey Date: Fri, 12 Jun 2026 17:37:44 -0400 Subject: [PATCH] fix(core): resolve TS2308 duplicate exports in @proof/core barrel The @proof/core barrel re-exports both formats/marks and formats/provenance-sidecar with `export *`. Both modules export `createComment`, `getUnresolvedComments`, and `CommentReply`, so under TypeScript 5 the barrel fails to compile: src/index.ts: error TS2308: Module './formats/marks.js' has already exported a member named 'createComment'. Consider explicitly re-exporting to resolve the ambiguity. (same for getUnresolvedComments and CommentReply). This makes @proof/core unimportable from any consumer compiled under modern TS. Replace the `export *` from provenance-sidecar with explicit named re-exports of its non-colliding symbols, letting marks.js own the three shared bare names (the marks-based API supersedes the legacy comment helpers). The three colliding sidecar helpers are still re-exported under Sidecar-prefixed aliases (createSidecarComment, getUnresolvedSidecarComments, SidecarCommentReply) so existing sidecar consumers keep a working path instead of silently resolving to the marks API. Signed-off-by: Yash Raj Pandey Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/doc-core/src/index.ts | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/packages/doc-core/src/index.ts b/packages/doc-core/src/index.ts index 84dde8d5..b90c071b 100644 --- a/packages/doc-core/src/index.ts +++ b/packages/doc-core/src/index.ts @@ -1,4 +1,36 @@ export * from '../../../src/formats/marks.js'; -export * from '../../../src/formats/provenance-sidecar.js'; +// Explicit re-export of provenance-sidecar to avoid name collisions with marks.js: +// marks.js owns the bare createComment, getUnresolvedComments, and CommentReply +// names in the new marks-based API. The provenance-sidecar versions are still +// re-exported here under Sidecar-prefixed aliases so legacy sidecar consumers +// keep a working path. +export type { + AttestationLevel, + TextOrigin, + ProvenanceSpan, + AttentionData, + AttentionEventType, + AttentionEvent, + ProvenanceMetadata, + CommentSelector, + Comment, + ProvenanceData, + CommentReply as SidecarCommentReply, +} from '../../../src/formats/provenance-sidecar.js'; +export { + migrateLegacyProvenance, + isLegacyFormat, + extractEmbeddedProvenance, + generateCommentId, + generateReplyId, + createReply, + addComment, + addReplyToComment, + setCommentResolved, + deleteComment, + ensureCommentsArray, + createComment as createSidecarComment, + getUnresolvedComments as getUnresolvedSidecarComments, +} from '../../../src/formats/provenance-sidecar.js'; export * from '../../../src/formats/remark-proof-marks.js'; export * from '../../../src/shared/agent-identity.js';