Skip to content

Make the sidebar navigation plugin forkable - #4183

Merged
SawyerHood merged 1 commit into
bb/forkable-04-question-form-hostfrom
bb/forkable-05-navigation
Sep 23, 2026
Merged

SawyerHood merged 1 commit into
bb/forkable-04-question-form-hostfrom
bb/forkable-05-navigation

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Fifth PR in the forkable built-ins stack; it builds on #4181. plugins/navigation replaces bb's whole sidebar navigation region, which makes it the cleanest fork after the sidebar thread list (#4140). A copy of its directory still couldn't build on its own:

  • It imported ten @bb/shared-ui components and helpers. All ten have registry items.
  • Its vitest config imported the repository's vitest.shared.ts.
  • A copy installed without npm's peer resolution lacked @testing-library/dom and @types/react-dom.

What changed

  • Registry imports: the plugin follows thread-list's conventions and imports UI through the registry alias (@/components/ui/button, @/lib/utils, …).
  • tsconfig: maps @/* onto packages/shared-ui/src and @/components/ui/icon onto the registry's host-backed icon. customConditions: ["source"] is gone. app.test.tsx is now typechecked.
  • vitest config: defineConfig with tsconfig paths.
  • Tooling: the package gets a lint script, and turbo gives its typecheck and test tasks the registry flavors as inputs and the SDK build as a test dependency.
  • App test fixture: apps/app/src/test/fixtures/navigation-plugin.ts imported the plugin's app.tsx by a literal path. That pulled the plugin into @bb/app's typecheck, where @/ means the app's own source. The fixture now loads the module by a resolved path and checks the export, as the sidebar bench already does for thread-list.

How you verified

  • pnpm exec turbo run typecheck test lint --filter=bb-plugin-navigation, @bb/app typecheck, and the three app test files that load the plugin: NavigationPlugin, SidebarNavigationRegion, plugin-slot-mounts. @bb/plugin-api-map tests pass; it anchors Navigation.tsx.
  • pnpm check:plugin-forks plugins/navigation: install, typecheck, test, and bb plugin build pass in a copy.
  • Bundle identity: app.css and server.js are byte-identical before and after. An unminified app.js differs only in module order and names. The plugin's own icons now render through the SDK's experimental_Icon, which the host binds to the same Icon component that the old @bb/shared-ui/icon shim provided.

🤖 Generated with Claude Code

AGENT GENERATED

@SawyerHood
SawyerHood added this pull request to stack #4182 September 23, 2026 16:40
@SawyerHood
SawyerHood force-pushed the bb/forkable-05-navigation branch from 5a4f3aa to 0ce5069 Compare September 23, 2026 16:47
@SawyerHood
SawyerHood force-pushed the bb/forkable-05-navigation branch from 0ce5069 to be459c3 Compare September 23, 2026 17:50
@SawyerHood
SawyerHood force-pushed the bb/forkable-05-navigation branch from be459c3 to 388bb8d 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
plugins/navigation replaces bb's whole sidebar navigation region, but a
copy of its directory could not build on its own. It imported ten
@bb/shared-ui components and helpers, its vitest config imported the
repository's vitest.shared.ts, and a copy installed without npm's peer
resolution was missing @testing-library/dom and @types/react-dom, which
renderSlot and the test's typecheck load.

The plugin now follows thread-list's conventions. It imports every
component through the registry alias (@/components/ui/button,
@/lib/utils, and so on; all ten are registry items), and its tsconfig
maps @/* onto packages/shared-ui/src and @/components/ui/icon onto the
registry's host-backed icon. The tsconfig now covers app.test.tsx. The
vitest config uses defineConfig with tsconfig paths, the package gets a
lint script, and turbo gives its typecheck and test tasks the registry
flavors as inputs and the SDK build as a test dependency.

The app's navigation test fixture imported the plugin's app.tsx by a
literal path, which pulled the plugin's files into @bb/app's typecheck,
where @/ means the app's own source. It now loads the module by a
resolved path and checks the export, as the sidebar bench does for
thread-list.

The built bundle is unchanged apart from module order and names:
app.css and server.js are byte-identical, and in app.js the plugin's
own icons render through the SDK's experimental_Icon, which the host
binds to the same Icon component the @bb/shared-ui/icon shim provides.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@SawyerHood
SawyerHood force-pushed the bb/forkable-05-navigation branch from 388bb8d to 4b867be Compare September 23, 2026 22:10
@SawyerHood
SawyerHood merged commit eff9e5a into main Sep 23, 2026
18 checks passed
@SawyerHood
SawyerHood deleted the bb/forkable-05-navigation branch September 23, 2026 22:13
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