Skip to content

Make the BB guide plugin forkable - #4193

Merged
SawyerHood merged 1 commit into
bb/forkable-11-tasksfrom
bb/forkable-12-bb-guide
Sep 23, 2026
Merged

SawyerHood merged 1 commit into
bb/forkable-11-tasksfrom
bb/forkable-12-bb-guide

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Eleventh PR in the forkable built-ins stack; it builds on #4192. bb-guide renders the standard introduction bb gives agents with renderTemplate from @bb/templates, a workspace package a copy can't install. No other code renders that template (standardAgentAppendInstructions). The plugin also used vitest.shared.ts and didn't declare the SDK harness's peers.

What changed

  • Introduction: the text moves into the plugin as introduction.ts. packages/templates drops the template file and its test, and the test moves into the plugin, where it checks the text the plugin contributes.
  • Bundle size: the built server.js shrinks from 316 KB to 3 KB, since it no longer bundles Handlebars and every bb template.
  • Test config: defineConfig, declared peers, a lint script, and a turbo test entry.

How you verified

  • Agent text unchanged: the text agents receive is byte-identical. Importing the built server.js from before and after with a fake bb produced the same instructions, configure() result, and settings for introduction on and off (same sha256).
  • Turbo: pnpm exec turbo run typecheck test lint --filter=bb-plugin-bb-guide --filter=@bb/templates, and typecheck of @bb/app, @bb/server, @bb/sdk, @bb/cli, and @bb/integration-tests.
  • Tests: @bb/cli tests (including bb-cli-skill-coverage) and the integration smoke lifecycle.test.ts, which loads the built-in bb-guide and checks the instructions.
  • Fork check: pnpm check:plugin-forks plugins/bb-guide passes in a copy.

🤖 Generated with Claude Code

AGENT GENERATED

@SawyerHood
SawyerHood added this pull request to stack #4182 September 23, 2026 17:22
@SawyerHood
SawyerHood force-pushed the bb/forkable-12-bb-guide branch 2 times, most recently from 249ab89 to 834a925 Compare September 23, 2026 17:53
@SawyerHood
SawyerHood force-pushed the bb/forkable-12-bb-guide branch from 834a925 to 8d3d6db 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
bb-guide rendered its introduction with renderTemplate from
@bb/templates, a workspace package a copy cannot install. No other code
rendered that template, standardAgentAppendInstructions. The text now
lives in the plugin as introduction.ts, and packages/templates drops the
template file and its test. The test moves into the plugin and checks
the text the plugin contributes. The template body was already trimmed
and had no Handlebars expressions, so the text agents receive is
byte-identical. The built server.js shrinks from 316 KB to 3 KB, since
it no longer bundles Handlebars and every bb template.

Its vitest config imported the repository's vitest.shared.ts and now
uses defineConfig directly. The fork installs without npm's peer
resolution, so the plugin declares better-sqlite3, cron-parser, and
hono, which createFakePluginHost loads. It gets a lint script so the
forkable import rule runs on it, and its turbo test task depends on the
SDK build.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@SawyerHood
SawyerHood force-pushed the bb/forkable-12-bb-guide branch from 8d3d6db to 2023ebb Compare September 23, 2026 22:10
@SawyerHood
SawyerHood merged commit 9512357 into main Sep 23, 2026
17 of 18 checks passed
@SawyerHood
SawyerHood deleted the bb/forkable-12-bb-guide branch September 23, 2026 22:13
SawyerHood added a commit that referenced this pull request Sep 23, 2026
## Human comments

## What was wrong

Twelfth PR in the forkable built-ins stack; it builds on #4193.
`plugins/plugin-api-docs`, the Plugin Guide, was a small shell around
`@bb/plugin-api-map`, a workspace package whose only consumer was this
plugin.

Through the map, the plugin also depended on `@bb/shared-ui/icon`,
`@bb/shared-ui/switch`, and `@bb/text-utils`. The map imported 31 other
plugins' `package.json` files by relative path, and some of its tests
read app source.

## What changed

- **The map moves into the plugin:** its source, tests, and
surface-entry scaffold live under `src/`, `test/`, and `scripts/`, and
`@bb/plugin-api-map` is gone.
  - Icons, the switch, and `cn` come through the registry aliases.
  - `escapeHtmlText` is copied in.
- **First-party table:** the 31 manifest imports become
`src/first-party-plugins.json`, a table of id, name, and icon. The Guide
still uses it for "Used by" links and fallback icons. `app.js` shrinks
by 33 KB because it no longer inlines every first-party `package.json`.
- **Checks that read files outside the plugin stay in the repository:**
- The anatomy-manifest source anchors are checked by `apps/app`'s
`docs-anatomy-manifest` test, which now reads the manifest from the
plugin.
- The ThreadDetailView tab-order source check moves into that same test.
- A new `@bb/scripts` test checks each first-party table row against the
plugin's manifest.
- **References:** `AGENTS.md`, the `plugin-guide-maintenance` skill, the
verify-bb recipes, and `turbo.json` point at the new paths.

## How you verified

- **Render comparison:** before and after produced 532 map-level entries
(14.9 MB) and 66 page-level entries, all identical. They cover SSR and
jsdom renders of every slide and card on desktop and mobile, the nav
panel at four sub-paths, the clipboard payload, and every server mention
resolution.
- **Turbo:** `pnpm exec turbo run typecheck test lint
--filter=bb-plugin-plugin-api-docs`, with every moved file's test count
unchanged; `@bb/scripts` (a mutated table row fails the new test);
`@bb/app` typecheck and tests.
- **Fork check:** `pnpm check:plugin-forks plugins/plugin-api-docs`
passes in a copy.
- **Bundle:** `app.css` gains 8 unused scoped rules from class names
that appear only in test assertions.

🤖 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