Skip to content

chore: 🤖 public api as exports source-of-truth#845

Open
punkbit wants to merge 17 commits intofix/circular-dependencies-first-passfrom
chore/public-api-as-exports-generator-source-of-truth
Open

chore: 🤖 public api as exports source-of-truth#845
punkbit wants to merge 17 commits intofix/circular-dependencies-first-passfrom
chore/public-api-as-exports-generator-source-of-truth

Conversation

@punkbit
Copy link
Collaborator

@punkbit punkbit commented Feb 25, 2026

Why?

The team should have full control over the Public API to manage which resources are available for use in consumer applications. Previously, consumer applications had unrestricted access to internal resources, which is undesirable.

For example, third-party APIs like the primitive components provided by Radix UI were directly exposed, meaning that if those primitives were ever swapped out, any consumer applications depending on them would break due to tight coupling.

With these changes in place, core maintainers can now manage the Public API through a clear and friendlier interface.

⚠️ WARNING: Depends on #841, which should be merged first
🤖 On #841 merge, change base branch to main

How?

  • Uses the Typescript API to traverse the main exports file (single source-of-truth)
  • Modifies the generate-exports to include the Typescript API lookup and traversal
  • Modifies the generate-exports to include a summary and optional user hint to commit changes (if available)
  • Provides documentation for Public API management

Preview?

demo-generate-exports

@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2026

🦋 Changeset detected

Latest commit: 7e1a485

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clickhouse/click-ui Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@punkbit punkbit changed the title chore: 🤖 public api as exports generator source-of-truth chore: 🤖 public api as exports source-of-truth Feb 25, 2026
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Claude finished @punkbit's task in 2m 14s —— View job


PR Review: chore: 🤖 public api as exports source-of-truth

  • Gathering context
  • Reading changed files
  • Analyzing changes
  • Posting review

Good work documenting the public API concept and cleaning up the exports map — removing CrossButton, EmptyButton, GenericMenu, IconWrapper etc. from the public surface area is the right call. The README additions are clear and helpful.

A couple of things worth flagging:

🚨 Must Fix

  • generate:exports requires a prior build step — not documented: The script at .scripts/generate-exports reads from dist/esm/components/ (the compiled output), not from src/index.ts directly. This means the documented workflow in README.md and the changeset is incomplete: running yarn generate:exports without first running yarn build will either fail or produce stale results that don't reflect changes to src/index.ts. The docs should mention yarn build (or better: chain it as yarn build && yarn generate:exports). Fix this →

  • PR description vs implementation gap: The PR description says "Uses the Typescript API to traverse the main exports file (single source-of-truth)" but the script doesn't use the TypeScript compiler API at all — it uses fs.readdirSync on the build output. This means dist/ is the actual source of truth, not src/index.ts. If the intent is for src/index.ts to be authoritative, the script should parse it (e.g. via ts-morph or the TS compiler API) to determine which component directories to include, rather than listing everything that was built.

💡 Suggestions (non-blocking)

  • Changeset: The changeset says minor but removing Collapsible, CrossButton, EmptyButton, GenericMenu, IconWrapper, MiddleTruncator from the exports map is technically breaking for any consumer who was deep-importing those paths (e.g. import X from '@clickhouse/click-ui/Collapsible'). Since these appear to be implementation details never intended to be public, minor may be intentional — but it'd be worth adding a sentence to the changeset listing the removed paths so consumers know what to check.

  • generate:exports off-by-one: The summary line in the script is Object.keys(exports).length - 2 but there is only 1 non-component entry (the root .), so it should be - 1. Minor cosmetic issue but worth a quick fix. (This is in the base branch, just flagging so it gets addressed.)

Overall the direction is solid and the public API story is much cleaner after this. 🙌

@workflow-authentication-public
Copy link
Contributor

📚 Storybook Preview Deployed

✅ Preview URL: https://click-m2i0x9crs-clickhouse.vercel.app

Built from commit: e57d7b9325c509d1390e1abc398a9bc4b2488a11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants