Skip to content

Make the built-in plugins without UI dependencies forkable - #4180

Merged
SawyerHood merged 1 commit into
bb/forkable-02-registry-itemsfrom
bb/forkable-03-plugins-without-ui-deps
Sep 23, 2026
Merged

SawyerHood merged 1 commit into
bb/forkable-02-registry-itemsfrom
bb/forkable-03-plugins-without-ui-deps

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

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 Harden the plugin fork check for more built-ins #4178.

🤖 Generated with Claude Code

AGENT GENERATED

@SawyerHood
SawyerHood added this pull request to stack #4182 September 23, 2026 16:34
@SawyerHood
SawyerHood force-pushed the bb/forkable-03-plugins-without-ui-deps branch from 2775b37 to 6919002 Compare September 23, 2026 16:36
@SawyerHood
SawyerHood force-pushed the bb/forkable-03-plugins-without-ui-deps branch from 6919002 to e33b961 Compare September 23, 2026 16:47
@SawyerHood
SawyerHood force-pushed the bb/forkable-03-plugins-without-ui-deps branch from e33b961 to aca9afa Compare September 23, 2026 17:50
@SawyerHood
SawyerHood force-pushed the bb/forkable-03-plugins-without-ui-deps branch from aca9afa to 6398c85 Compare September 23, 2026 20:40
@SawyerHood
SawyerHood marked this pull request as ready for review September 23, 2026 21:07
@SawyerHood
SawyerHood removed this pull request from stack #4182 September 23, 2026 21:40
@SawyerHood
SawyerHood added this pull request to stack #4220 September 23, 2026 21:41
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
SawyerHood force-pushed the bb/forkable-03-plugins-without-ui-deps branch from 6398c85 to bea2d6d Compare September 23, 2026 22:10
@SawyerHood
SawyerHood merged commit ff678c6 into main Sep 23, 2026
11 of 22 checks passed
@SawyerHood
SawyerHood deleted the bb/forkable-03-plugins-without-ui-deps branch September 23, 2026 22:13
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
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.

1 participant