Skip to content

Make the Modal sandbox plugin forkable - #4196

Merged
SawyerHood merged 1 commit into
bb/forkable-13-plugin-guidefrom
bb/forkable-15-environment-plugins
Sep 23, 2026
Merged

SawyerHood merged 1 commit into
bb/forkable-13-plugin-guidefrom
bb/forkable-15-environment-plugins

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Thirteenth PR in the forkable built-ins stack; it builds on #4194. plugins/environment-modal-sandbox couldn't be copied out of the repository:

  • Shared UI: its app imported seven @bb/shared-ui modules.
  • Test config: its vitest config used vitest.shared.ts.
  • SDK paths: its tsconfig mapped @get-bb/plugin-sdk and its testing entry onto the bundled .d.ts files. Once vitest follows tsconfig paths, that loads the declaration files as the SDK at runtime.
  • Test peers: the SDK test harness's cron-parser, hono, and better-sqlite3 types, and the react-dom types the registry's responsive overlay needs, were undeclared.

The Worktree and Project checkout plugins stay as they are: they share host helpers with the daemon through bb-environment-provider-host, and isolating them would mean copying those helpers into each plugin.

What changed

  • Imports: button, coarse-pointer-sizing, dropdown-menu, icon, input, option-display, and lib/utils come from the registry through @/, with thread-list's tsconfig paths.
  • Config: the two SDK path entries are gone; the package's types condition already points tsc at the same files. The vitest config uses defineConfig, and the plugin declares its test peers.
  • Lint and turbo: the lint script ignores node_modules and dist like the other listed plugins, and the turbo tasks take the registry flavors as inputs and build the SDK before tests.
  • List: the plugin joins scripts/forkable-plugins.json.

How you verified

  • pnpm exec turbo run typecheck test lint --filter=bb-plugin-environment-modal-sandbox.
  • pnpm check:plugin-forks plugins/environment-modal-sandbox passes in a copy.
  • Whole-repo turbo run typecheck lint at the top of the stack.

🤖 Generated with Claude Code

AGENT GENERATED

@SawyerHood
SawyerHood added this pull request to stack #4182 September 23, 2026 17:22
@SawyerHood SawyerHood changed the title bb/forkable 15 environment plugins Make the environment plugins forkable Sep 23, 2026
@SawyerHood
SawyerHood force-pushed the bb/forkable-15-environment-plugins branch from 2ac0093 to 429513e Compare September 23, 2026 17:51
@SawyerHood
SawyerHood force-pushed the bb/forkable-15-environment-plugins branch 2 times, most recently from b875adf to c79b2c6 Compare September 23, 2026 20:40
@SawyerHood
SawyerHood marked this pull request as ready for review September 23, 2026 21:07
@SawyerHood
SawyerHood force-pushed the bb/forkable-15-environment-plugins branch from c79b2c6 to 9c4eeda Compare September 23, 2026 21:31
@SawyerHood SawyerHood changed the title Make the environment plugins forkable Make the Modal sandbox plugin forkable Sep 23, 2026
@SawyerHood
SawyerHood removed this pull request from stack #4182 September 23, 2026 21:40
@SawyerHood
SawyerHood changed the base branch from bb/forkable-14-environment-host-helpers to bb/forkable-13-plugin-guide September 23, 2026 21:40
@SawyerHood
SawyerHood added this pull request to stack #4220 September 23, 2026 21:41
environment-modal-sandbox's app imported seven @bb/shared-ui modules,
so a copy could not install. They now come from the component registry
through @/: button, coarse-pointer-sizing, dropdown-menu, icon, input,
option-display, and lib/utils. The tsconfig maps @/ the way
thread-list's does, and vitest follows it.

The tsconfig also mapped @get-bb/plugin-sdk and its testing entry onto
the bundled .d.ts files. The package's types condition already points
there, and once vitest follows tsconfig paths the mapping made it load
the declaration files as the SDK at runtime, so those two entries are
gone.

A copy's tests failed too:

- The vitest config imported the repository's vitest.shared.ts. It now
  uses defineConfig directly.
- The fork installs without npm's peer resolution, so the SDK test
  harness's cron-parser, hono, and better-sqlite3 types were missing,
  and the registry's responsive overlay needs the react-dom types. The
  plugin declares them.

The lint script now ignores node_modules and dist like the other
listed plugins, and the turbo tasks take the registry flavors as
inputs and build the SDK before tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@SawyerHood
SawyerHood force-pushed the bb/forkable-15-environment-plugins branch from 9c4eeda to 580a6be Compare September 23, 2026 22:10
@SawyerHood
SawyerHood merged commit 44e2187 into main Sep 23, 2026
22 of 34 checks passed
@SawyerHood
SawyerHood deleted the bb/forkable-15-environment-plugins branch September 23, 2026 22:13
SawyerHood added a commit that referenced this pull request Sep 23, 2026
## Human comments

## What was wrong

Fourteenth PR in the forkable built-ins stack; it builds on #4196.
ask-user-question and secrets render bb's in-thread forms (the
`pendingInteraction` slot). A copy of either couldn't build on its own:

- Both imported `@bb/shared-ui` and `@bb/plugin-interaction-contracts`,
a workspace package holding their payload and response schemas.
- ask-user-question rendered shared-ui's question form, which reaches
the host's answer shortcuts through a module only `bb plugin build` can
swap.
- Their tsconfigs mapped the SDK onto its bundled `.d.ts` files, and
their vitest configs used `vitest.shared.ts`.

## What changed

- **Contracts:** each plugin owns its contract (`src/contracts.ts`,
`src/secret-request.ts`) with its half of the old tests. Nothing else
imported `@bb/plugin-interaction-contracts`, so it is deleted.
- **UI:** components come through the registry alias. ask-user-question
uses the registry's `question-form`, whose `question-form-host` flavor
calls `experimental_useQuestionFormHost` (#4181), so its
`engines.bbPluginSdk` is `>=0.5.22`. The built-in bundle still takes the
question form host from the app's runtime, so it keeps bb's answer
shortcuts and a single React context.
- **Config:**
- The SDK path entries are gone; the package's `types` condition already
points tsc at the same files.
- ask-user-question's tsconfig maps only `@/*` and the icon flavor. It
never imports `question-form-host` itself, so it doesn't map it.
  - `app.test.tsx` and the vitest configs join the tsconfig `include`.
- Each plugin declares its test peers and gets a lint script and turbo
entries.
- **Stories:** ask-user-question's Ladle story rendered through app
source, so it moves into `apps/app` beside the other pending-interaction
stories, with `origin="plugin"` replacing a stale prop. Both stories
load their plugin through `import.meta.glob`
(`apps/app/.ladle/plugin-app-module.ts`), which keeps the plugins' `@/`
imports out of `@bb/app`'s type program.
- **Docs:** `docs/forkable-plugins.md` records both rules: a listed
plugin maps nothing onto `@get-bb/plugin-sdk`, and Ladle stories load a
listed plugin with `import.meta.glob`.

## How you verified

- `pnpm exec turbo run typecheck test lint` for both plugins.
- `pnpm check:plugin-forks` passes for both. In a kept copy, `app.js`
calls `experimental_useQuestionFormHost` and never calls
`createContext`.
- `@bb/app` typecheck and tests, `@bb/scripts`,
`bb-plugin-plugin-api-docs`, and the server's built-in plugin tests.
- Both Ladle stories render in the dev server with no console errors.
- **Bundle identity:** `app.css` is byte-identical. `app.js` differs
only in module paths and in dropping the other plugin's schemas, which
the shared package's index had pulled into both bundles. Both bundles
take the question form host from `runtime.questionFormHost`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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