Skip to content

Make the nav panel plugins forkable - #4191

Merged
SawyerHood merged 2 commits into
bb/forkable-09-settingsfrom
bb/forkable-10-nav-panels
Sep 23, 2026
Merged

SawyerHood merged 2 commits into
bb/forkable-09-settingsfrom
bb/forkable-10-nav-panels

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Ninth PR in the forkable built-ins stack; it builds on #4190. Four nav-panel built-ins couldn't be copied out of the repository: workflows, github, docs (plugin id simple-notes), and theme-preview.

Beyond the shared-ui imports and vitest.shared.ts:

  • Undeclared test dependencies: github didn't declare jsdom, so in a copy every jsdom test worker died with "Failed to start forks worker".
  • Tests that reach outside the plugin:
    • workflows had a test that scanned the whole repository.
    • theme-preview's fixture-anatomy tests read apps/app/src files, which are assertions about host source.
  • SDK paths in tsconfig: workflows and theme-preview mapped the SDK onto bundled .d.ts files.
  • Lint: theme-preview had 187 code comments and had never been formatted.

What changed

  • Theme Preview cleanup (first commit): the comment autofix and oxfmt only, so the second commit stays readable. server.js is byte-identical after it.
  • Forkable conversion (second commit):
    • UI imports go through the registry alias with thread-list's tsconfig paths, and github's local @/components alias becomes relative imports.
    • Each plugin uses defineConfig, declares its test dependencies, and gets lint and turbo entries. The lint script surfaced two effect dependency lists in docs' editor that deliberately leave out values, now marked for the linter.
  • Tests:
    • workflows' removed-command test scans only the plugin. The repository-wide half moves to packages/scripts/test/workflows-removed-command.test.ts.
    • theme-preview's anatomy tests move to apps/app/src/components/plugin/theme-preview-fixture-anatomy.test.ts, next to the files they read. They still check that every mock view has a source contract, and @bb/app#test takes plugins/theme-preview/taxonomy.ts as an input so a change to the view list reruns them.
  • Tooling:
    • apps/cli's official-bundle tests anchor the copied plugin's tsconfig paths.
    • apps/app/.ladle resolves the plugins' @/ imports.

How you verified

  • pnpm exec turbo run typecheck test lint for the four plugins (theme-preview's anatomy tests now run in @bb/app).
  • pnpm check:plugin-forks: all four pass in a copy.
  • @bb/app and @bb/cli typecheck, the moved anatomy test, and the CLI official-bundle tests; @bb/scripts and @bb/plugin-api-map.
  • Removed-command scan: appending bb workflows catalog to packages/templates/src/templates/bb-guide-plugins.md fails the new @bb/scripts test, while the plugin's own scan still passes.
  • Turbo input: without the new input, turbo --dry=json reported the same @bb/app#test hash after a change to taxonomy.ts; with it, the hash changes.
  • Bundle identity:
    • app.js differs only in module order, the registry icon (the same host component), and theme-preview JSX text that oxfmt split around {" "}, which renders the same text.
    • theme-preview's app.css loses four utilities that Tailwind picked up from deleted comments and anchor strings; no element uses them.

🤖 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 10 nav panels Make the nav panel plugins forkable Sep 23, 2026
@SawyerHood
SawyerHood force-pushed the bb/forkable-10-nav-panels branch from f3ef877 to 80ca7f6 Compare September 23, 2026 17:50
@SawyerHood
SawyerHood force-pushed the bb/forkable-10-nav-panels branch from 80ca7f6 to 116c02b Compare September 23, 2026 17:53
@SawyerHood
SawyerHood force-pushed the bb/forkable-10-nav-panels branch from 116c02b to 11ba4c9 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
Theme Preview was the only plugin in its group with code comments and
unformatted source. Making it forkable gives it a lint script, which runs
the repository's bb/no-comments rule, so this commit removes the
comments with that rule's autofix and formats the files it touched with
oxfmt, before the forkability change, which then reads as its own diff.

Nothing else changes. The built server bundle is byte-identical. The
app bundle differs only where oxfmt moved spaces at JSX line breaks into
{" "} children, which render the same text, and its CSS drops a `static`
utility that Tailwind had generated from a word in a removed test
comment; no element uses it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
workflows, github, docs, and theme-preview could not be copied out of
the monorepo and built on their own:

- They imported @bb/shared-ui by package name. Their components now come
  through the registry alias (@/components/ui/*, @/lib/*), which their
  tsconfigs map onto packages/shared-ui/src and the registry's
  host-backed icon, as thread-list does. github's own @/components alias
  becomes relative imports. workflows and theme-preview drop their
  tsconfig paths onto the SDK's bundled types: the package's types
  condition resolves the same files, and vitest, which now follows
  tsconfig paths, would otherwise load the declaration files at runtime.
- Their vitest configs imported the repository's vitest.shared.ts. Each
  now uses defineConfig directly.
- Their tests loaded packages they did not declare. In a copy, github's
  jsdom test files failed with "Failed to start forks worker" because
  jsdom came from the workspace. Each plugin now declares the SDK test
  harness peers its tests load.
- workflows' documentation test scanned the whole repository for a
  removed command. It now scans the plugin, and a @bb/scripts test keeps
  scanning the rest of the repository. theme-preview's fixture-anatomy
  test read apps/app source files that a copy does not have. Those
  assertions move to an apps/app test, which loads the plugin's view
  list so every mock view stays covered; the app's test task takes the
  plugin's taxonomy as an input.

Each plugin gets a lint script so the forkable import rule runs on it.
That surfaced two effect dependency lists in docs' editor that
deliberately leave out values, now marked for the linter. Ladle's Vite
config applies the forkable plugin paths, so the workflows
stories keep resolving the registry alias. The CLI's official-bundle
tests build github and docs from a copy in a temporary directory, so
they now anchor the copy's tsconfig paths at the repository.

Their turbo tasks take the registry flavors as inputs, and their test
tasks depend on the SDK build, because vitest resolves the SDK's built
entries.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@SawyerHood
SawyerHood force-pushed the bb/forkable-10-nav-panels branch from 11ba4c9 to 62352a2 Compare September 23, 2026 22:10
@SawyerHood
SawyerHood merged commit 2b56c65 into main Sep 23, 2026
23 of 34 checks passed
@SawyerHood
SawyerHood deleted the bb/forkable-10-nav-panels branch September 23, 2026 22:13
SawyerHood added a commit that referenced this pull request Sep 23, 2026
## Human comments

## What was wrong

Tenth PR in the forkable built-ins stack; it builds on #4191. bb Tasks
is the biggest shared-ui-only built-in: about 110 files and 34k lines.

A copy couldn't install or run its tests:

- 17 `@bb/shared-ui` imports.
- A test that counted SQL statements through bb's own database
connection (`packages/db`).
- `vitest.shared.ts`.
- A tsconfig that included only a few entry points. Vite applies
tsconfig paths only to included files, so every view test in a copy
failed to resolve `@/`.

## What changed

- UI imports go through the registry alias.
- The SQL-count test runs on the SDK harness's plugin database with the
same `prepare()` wrapper, so it proves the same statement counts and
index plan.
- `defineConfig` keeps the tippy alias, setup file, timeout, and inlined
dependency.
- The tsconfig includes every file, which brings the tests under tsc;
their RPC handlers read `unknown` input through a plugin-local helper.
- Test peers are declared.
- Lint: two comments removed, two lists memoized, and one deliberate
effect marked for the linter.
- The `@bb/scripts` test that checks the lint rule ignores unlisted
plugins used tasks as its example; it now uses a name that isn't in the
repository.

Dropping `sharedWorkerProjects` did not slow the suite. Under load it
ran in 7.9–9.0s, down from 10.3–11.8s at the base, because the SDK now
resolves to its built entries and the icon no longer pulls in
shared-ui's glyph map.

## How you verified

- `pnpm exec turbo run typecheck test lint --filter=bb-plugin-tasks`.
- `pnpm check:plugin-forks plugins/tasks` passes in a copy.
- `@bb/app` typecheck; `@bb/scripts` and `@bb/plugin-api-map` tests.
- **Bundle identity:** `app.css` and `server.js` are byte-identical.
`app.js` differs only in where the icon shim sits, the registry icon
(the same host component), and the two memoized lists.

🤖 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