Repository navigation
Harden the plugin fork check for more built-ins - #4178
Merged
Merged
Conversation
SawyerHood
force-pushed
the
bb/forkable-01-fork-check
branch
from
September 23, 2026 16:36
9bfd804 to
5d929e8
Compare
This was referenced Sep 23, 2026
SawyerHood
force-pushed
the
bb/forkable-01-fork-check
branch
from
September 23, 2026 16:47
5d929e8 to
8824a26
Compare
SawyerHood
force-pushed
the
bb/forkable-01-fork-check
branch
2 times, most recently
from
September 23, 2026 20:40
b8f73f7 to
a5cc98e
Compare
SawyerHood
marked this pull request as ready for review
September 23, 2026 21:07
The fork check and the published SDK had gaps that every built-in plugin after thread-list hits: - The SDK's `host` and `provider-bridge` entries inlined cross-spawn, CommonJS that requires Node builtins, so importing them under plain Node threw "Dynamic require of child_process". A plugin's own host tests do exactly that once it installs the SDK from npm. cross-spawn now stays external and is a dependency of the package. The entry list and esbuild options move to scripts/runtime-entries.mjs so a test can build and import them, and plugin-build's simulated SDK install copies the SDK's dependencies the way npm does. SDK 0.5.21. - The fork check took registry package versions from the app manifest only, so items the app does not depend on directly (collapsible, tabs, label, radio-group, cmdk) failed. It now reads the registry package's own manifest first. - The lint rule caught `@bb/*` imports only; `bb-environment-provider-host` and other workspace packages without the scope passed. It now rejects every workspace package except the SDK, and the SDK's internal/* modules, which bb can change in any release. - `prepare:bundled` did not list the registry's plugin flavors as inputs, so changing the host-backed icon left forkable plugins' bundles cached. The fork check also runs plugins concurrently (default up to 4) and reports every failure instead of stopping at the first, so the CI job stays inside its timeout as the list grows. It prints a line when each plugin starts and the plugin's steps when it finishes. docs/forkable-plugins.md describes what a listed plugin looks like. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
SawyerHood
force-pushed
the
bb/forkable-01-fork-check
branch
from
September 23, 2026 22:10
a5cc98e to
70df93e
Compare
SawyerHood
added a commit
that referenced
this pull request
Sep 23, 2026
…ms (#4179) ## Human comments ## What was wrong Second PR in the forkable built-ins stack; it builds on #4178. Built-in plugins import nine shared-ui components that the component registry doesn't provide, so a fork can't write them into its copy: - activity-row-styles - branch-picker-primitives - coarse-pointer-visibility - delayed-loading - option-display - plugin-icon - resource-list - resource-pagination - workflow-progress The app uses each of them too, so they belong in the registry rather than in plugin copies. The generator had a second problem: it flattened every `components/ui` file to `components/ui/<basename>` and named the item after the bare basename. resource-list re-exports seven files under `components/ui/resource/`. Flattened, their relative imports broke, and they would have been published as items named `row`, `toolbar`, and `atoms`. ## What changed - `registry.json` lists the nine components. Their import closures add `resource-route-label` and the seven `resource-*` files. - `build-registry.mjs` keeps a component's subdirectory in its target, so `components/ui/resource/row.tsx` stays at that path. The item name carries the directory: `resource-row`, `resource-toolbar`, and so on. No existing item changes. ## How you verified - `vendor-all-items.test.ts` vendors every item into one plugin and runs `bb plugin build`. With the old flattened targets it fails (`Could not resolve "./resource/atoms"`); with this change it passes. - `pnpm exec turbo run typecheck test --filter=@bb/plugin-registry`, which includes `build-registry.mjs --check`. - The `plugin-forks.test.mjs` suite passes against the new items. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED
SawyerHood
added a commit
that referenced
this pull request
Sep 23, 2026
## Human comments ## What was wrong Third PR in the forkable built-ins stack; it builds on #4179. Seven built-ins import no workspace package, but a copy of each still failed `pnpm check:plugin-forks`: - custom-instructions - drafts - environment-personal-workspace - pdf-preview - plugin-api-tester - provider-retry - push-notifications The failures: - **Shared vitest config.** Their `vitest.config.ts` imported the repository's `vitest.shared.ts`. - **Missing test peers.** The fork installs with `--legacy-peer-deps`, so the SDK test harness's optional peers never arrive: - `createFakePluginHost` loads `better-sqlite3`, `cron-parser`, and `hono`. - `renderSlot` needs `@testing-library/dom`. Without it, `@testing-library/react`'s types lose `waitFor`, `fireEvent`, and every query on `RenderedSlot`. ## What changed - **Test config:** each plugin's vitest config uses `defineConfig`, and each declares the dev dependencies its tests load. - **Lint scripts:** each plugin gets a `lint` script, so the forkable import rule runs on it. That surfaced two things: - code comments in provider-retry, now removed; - a deliberate field-level dependency list in pdf-preview's `useMemo`, now marked for the linter instead of changed. - **Removed test:** push-notifications' `public-sdk-only.test.ts` is gone. The lint rule and the fork check enforce the same boundary, and its assertion that `@bb/plugin-build` is a dev dependency fails in a copy, which drops it. - **SDK types:** push-notifications' tsconfig no longer maps `@get-bb/plugin-sdk` onto the repository's bundled declarations, a path a copy doesn't have. The package's `types` condition already names them. - **Cleanup:** drafts drops an unused `@bb/shared-ui` dependency. - **Turbo:** each plugin's `test` task depends on `@get-bb/plugin-sdk#build`, because vitest now resolves the SDK's built entries. - **List:** all seven go into `scripts/forkable-plugins.json`. Behavior for users is unchanged; the built-ins' names are unchanged. ## How you verified - `pnpm exec turbo run typecheck test lint` for the seven plugins, including push-notifications' typecheck without the path mapping. - `pnpm check:plugin-forks`: all eight listed plugins install, typecheck, test, and `bb plugin build` in a copy, including environment-personal-workspace's host tests, which fail before #4178. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED
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.
Human comments
What was wrong
First PR in a stack that makes bb's other built-in plugins forkable, the way #4140 did for the sidebar. Auditing the other 36 built-ins against
pnpm check:plugin-forksshowed gaps in the machinery itself that every one of them hits after thread-list:@get-bb/plugin-sdk/hostand/provider-bridgeentries inlined cross-spawn. cross-spawn is CommonJS that requires Node builtins, so importing either entry outside a bundler threwDynamic require of "child_process" is not supported. A plugin's ownhost.test.tsdoes exactly that once it installs the SDK from npm.apps/app/package.jsonalone, so items the app doesn't depend on directly (collapsible, tabs, label, radio-group, cmdk) aborted the check.@bb/*.bb/forkable-plugin-importslet through workspace packages without the scope, such asbb-environment-provider-host, and the SDK'sinternal/*modules, which bb can change in any release.What changed
dist/host.jsanddist/provider-bridge.jsimport it the way Node loads CommonJS. The entry list and esbuild options move frombuild-runtime.mjstoscripts/runtime-entries.mjsso a test can build the entries and import them. plugin-build'szod-resolutiontest simulates an npm install of the SDK, and it now copies the SDK's dependencies too.packages/plugin-registry/package.json, and the app's pinned versions win where the app declares one.--concurrency=<n>, default up to 4. It printsChecking <plugin> …when each plugin starts, so a hung step still shows which plugin it was in, and the plugin's steps when it finishes. All failures are reported at the end.@get-bb/plugin-sdk. It also rejects the SDK'sinternal/*modules.prepare:bundledlistspackages/plugin-registry/flavors/**as an input, so a change to the host-backed icon rebuilds forkable plugins' bundles.docs/forkable-plugins.mddescribes the list, the checks, and what a listed plugin looks like: registry alias, its own vitest config, declared test peers, portable tests, turbo entries, names unchanged from the built-in, andengines.bbPluginSdkas the SDK floor. The thread-list doc links to it.No wire changes.
How you verified
runtime-entries.test.mjs: builds every published entry. It asserts that none inlines a CommonJS require shim, that every external is a dependency or peer, and that./hostand./provider-bridgeimport under plain Node. Against the old externals list, 3 of its 4 tests fail with theDynamic requireerror.plugin-forks.test.mjscases rejectbb-environment-provider-host/git,bb-plugin-tasks, and@get-bb/plugin-sdk/internal/plugin-app-collector, and still allow the SDK's public entries (/host,/testing/app) and npm packages. Theinternal/case fails without the new check.pnpm exec turbo run build build:types typecheck test lint --filter=@get-bb/plugin-sdk --filter=@bb/scripts --filter=bb-plugin-thread-list, plus the tests for@bb/plugin-build,@bb/templates, and@bb/cli.pnpm check:plugin-forkspasses for thread-list.node .github/workflows/check-plugin-sdk-version.mjsandnode packages/plugin-sdk/scripts/check-npm-version-guard.mjs.🤖 Generated with Claude Code