Repository navigation
Make the built-in plugins without UI dependencies forkable - #4180
Merged
SawyerHood merged 1 commit intoSep 23, 2026
Merged
SawyerHood merged 1 commit into
SawyerHood merged 1 commit into
Conversation
SawyerHood
force-pushed
the
bb/forkable-03-plugins-without-ui-deps
branch
from
September 23, 2026 16:36
2775b37 to
6919002
Compare
This was referenced Sep 23, 2026
SawyerHood
force-pushed
the
bb/forkable-03-plugins-without-ui-deps
branch
from
September 23, 2026 16:47
6919002 to
e33b961
Compare
SawyerHood
force-pushed
the
bb/forkable-03-plugins-without-ui-deps
branch
from
September 23, 2026 17:50
e33b961 to
aca9afa
Compare
SawyerHood
force-pushed
the
bb/forkable-03-plugins-without-ui-deps
branch
from
September 23, 2026 20:40
aca9afa to
6398c85
Compare
SawyerHood
marked this pull request as ready for review
September 23, 2026 21:07
custom-instructions, drafts, environment-personal-workspace, pdf-preview, plugin-api-tester, provider-retry, and push-notifications import no workspace package, but a copy still failed: - Their vitest configs imported the repository's vitest.shared.ts. Each now uses defineConfig directly. - The fork installs without npm's peer resolution, so the SDK test harness's optional peers were missing: better-sqlite3, cron-parser, and hono for createFakePluginHost, @testing-library/dom and the React types for renderSlot. Each plugin declares what its tests load. Each plugin gets a lint script so the forkable import rule runs on it. That surfaced code comments in provider-retry, now removed, and a deliberate field-level dependency list in pdf-preview, now marked for the linter. push-notifications' public-sdk-only test is gone: the lint rule and the fork check enforce the same boundary, and the test's check that @bb/plugin-build is a dev dependency fails in a copy, which drops it. Its tsconfig no longer maps the SDK onto its bundled declarations, which the package's types condition already names. drafts drops an unused @bb/shared-ui dependency. Their turbo test tasks depend on the SDK build, because vitest now resolves the SDK's built entries. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
SawyerHood
force-pushed
the
bb/forkable-03-plugins-without-ui-deps
branch
from
September 23, 2026 22:10
6398c85 to
bea2d6d
Compare
SawyerHood
added a commit
that referenced
this pull request
Sep 23, 2026
## Human comments ## What was wrong Fourth PR in the forkable built-ins stack; it builds on #4180. A pending-interaction form shows bb's answer shortcuts (`question.select.1` and on, which users can remap) next to its options, and chooses an option when the person presses one. The host owns those bindings through a React context in `@bb/shared-ui`. The built-in Ask User Question and pi plugins reach that context by importing `@bb/shared-ui/question-form-host`, which `bb plugin build` swaps for the host's module. A copy of either plugin can't import that package, and the component registry has no question form to give it. Both plugins' PRs later in the stack need this, so it lands on its own first. ## What changed - **SDK 0.5.22:** `experimental_useQuestionFormHost()` in `@get-bb/plugin-sdk/app` returns `{ shortcuts, registerChoiceHandler }`. - The app backs it with the existing `ThreadQuestionFormHost` context. - `renderSlot` returns an empty host. - Documented in `docs/api_to_audit.md`, the Plugin Guide's in-thread forms surface, and the plugin authoring references. - **Registry:** gains `question-form`, with `question-form-state` and `question-form-host`. `question-form-host` is a plugin flavor that re-exports the SDK hook, the same way the registry's `icon` draws from the host. - **shared-ui:** `question-form.tsx` imports its siblings relatively so it can become a registry item. - **plugin-build:** routes shared-ui's own relative `./question-form-host` import to the host's module, as it already does for `./icon`. Built-in bundles keep a single context. No wire changes. It adds a new experimental SDK member, listed in `docs/api_to_audit.md`. ## How you verified - **plugin-build:** new tests check that shared-ui's relative `./question-form-host` resolves to the host runtime slot and a plugin's own file doesn't. They also check that a bundle never carries a second context. - **SDK facade:** a new test covers the hook's empty test-harness host. - **Bundle identity:** ask-user-question and provider-pi `app.js` were built before and after this PR. A token diff shows only the SDK facade's export list gaining the new name, and both bundles reference the host's `questionFormHost` slot as before. - **Turbo:** `pnpm exec turbo run build build:types typecheck test` for the plugin SDK, plugin-build, plugin-registry, plugin-api-map, shared-ui, ask-user-question, provider-pi, and bb-guide; `@bb/app` typecheck; the app's user-question, pending-interaction, and plugin lib tests. - **SDK version guards:** both pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
SawyerHood
added a commit
that referenced
this pull request
Sep 23, 2026
## Human comments ## What was wrong Sixth PR in the forkable built-ins stack; it builds on #4183. `plugins/monaco-editor`, the file opener that edits files in Monaco, couldn't be copied out of the repository: - It imported `cn` from `@bb/shared-ui/lib/utils`. - Its vitest config used `vitest.shared.ts`. - Its tests loaded SDK test-harness peers it didn't declare. pdf-preview, the other file opener, went in #4180. ## What changed - **Registry import:** `@/lib/utils`, the registry's utils item. thread-list's tsconfig paths, and `defineConfig` with tsconfig paths in vitest. `app.test.tsx` and `server.test.ts` join the tsconfig `include`, so tsc checks them. - **Declared peers:** `better-sqlite3`, `cron-parser`, and `hono` for `createFakePluginHost`; `@testing-library/dom` for `renderSlot`. - **Lint:** the new lint script surfaced code comments in the Monaco build script and bundle entries, now removed. The README keeps the one reason they gave that it didn't already cover: the icon webfont is inlined so the bundle stays three files. `bb plugin build` still leaves Monaco out of `app.js`; a copy installed from a path builds `dist/monaco` on first open with its own esbuild, the same way a source checkout does. ## How you verified - `pnpm exec turbo run typecheck test lint --filter=bb-plugin-monaco-editor`, plus `@bb/plugin-api-map` and `@bb/scripts` tests. - **Fork check:** `pnpm check:plugin-forks plugins/monaco-editor` passes in a copy. In the kept copy, the `assets` RPC built all three Monaco files byte-identical to the built-in's. - **Bundle identity:** - `server.js` and `app.css` are byte-identical. - `prepare:bundled` stages Monaco assets (`editor.js`, `editor.css`, `editor.worker.js`) with the same sha256 as before. 🤖 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
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:The failures:
vitest.config.tsimported the repository'svitest.shared.ts.--legacy-peer-deps, so the SDK test harness's optional peers never arrive:createFakePluginHostloadsbetter-sqlite3,cron-parser, andhono.renderSlotneeds@testing-library/dom. Without it,@testing-library/react's types losewaitFor,fireEvent, and every query onRenderedSlot.What changed
defineConfig, and each declares the dev dependencies its tests load.lintscript, so the forkable import rule runs on it. That surfaced two things:useMemo, now marked for the linter instead of changed.public-sdk-only.test.tsis gone. The lint rule and the fork check enforce the same boundary, and its assertion that@bb/plugin-buildis a dev dependency fails in a copy, which drops it.@get-bb/plugin-sdkonto the repository's bundled declarations, a path a copy doesn't have. The package'stypescondition already names them.@bb/shared-uidependency.testtask depends on@get-bb/plugin-sdk#build, because vitest now resolves the SDK's built entries.scripts/forkable-plugins.json.Behavior for users is unchanged; the built-ins' names are unchanged.
How you verified
pnpm exec turbo run typecheck test lintfor the seven plugins, including push-notifications' typecheck without the path mapping.pnpm check:plugin-forks: all eight listed plugins install, typecheck, test, andbb plugin buildin a copy, including environment-personal-workspace's host tests, which fail before Harden the plugin fork check for more built-ins #4178.🤖 Generated with Claude Code