Repository navigation
Read plugin imports from tokens, not raw source text - #5518
Merged
Merged
Conversation
experimental_scanPublicSdkOnly matched import specifiers with regexes over
the raw file, so method names (`{ import(x) {} }`), property calls
(`f.import(x)`), comments, strings, template literals, and JSX text were
reported as imports. A small dependency-free tokenizer now skips those and
reads only import/export declarations and import()/require() calls.
Fixes #5326
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Oct 14, 2026
…#4992) ## Human comments ## What was wrong BB command and plugin documentation was duplicated across guide chapters, shipped skills, and repository docs. Updating one surface could leave conflicting instructions elsewhere, while completed plans and historical audits obscured current references. ## What changed - Make `bb guide` the core CLI manual and reduce the `bb-cli` skill to chapter routing and agent guidance. - Move plugin-specific commands and settings into their owning skills, including ACP configuration, notifications, sidebar preferences, and workflows. - Remove the standalone automations chapter and route `bb guide automation` and `automations` to the plugins chapter. - Split the threads chapter by task so an agent reads only what it needs: `threads` (spawn, hand off, fork, edit), `thread-inspection` (list, inspect, wait, open), `thread-messaging` (tell, metadata, interactions, queue), and `thread-lifecycle` (stop, clear, compact, retry, archive, delete). Each is 90–175 lines instead of one 530-line page; aliases such as `queue`, `retry`, and `inspect` route to the right chapter. - Consolidate plugin API guidance and trim repository docs to living references, removing completed plans, obsolete audits, and unused assets. - Update documentation expectations and construct workflow test fixtures from the actual settings defaults. The branch is rebased onto `origin/main`, preserving its newer documentation. Runtime changes are limited to guide chapter routing and aliases; there are no daemon wire changes. ## How you verified - Rebased onto `origin/main` at 1859b76. Main's newer guidance went into the consolidated destinations, including: - Settings: `keepHistoryAfterContextClear`, onboarding replay and `bb project discover`, `bb settings cli-command`, `bb settings usage --refresh`, the `timelinePush` experiment, and the always-on navigation rail. - Plugins: `bb plugin prune`, background plugin updates, and `bb marketplace add --subdirectory`. - Threads and providers: `bb thread commands`/`options`, `usage.cost`, push-notification levels, `bb provider-retry explain`, and OpenCode agents as ACP modes. - Plugin API: `environment.removed`, `experimental_saveFile`, the tokenizer-based `experimental_scanPublicSdkOnly` (#5518), `experimental_optionLabels`, the provider bridge's 50 ms text batching, and its session-option state kinds. - Removed documentation of the sidebar navigation and header plugin APIs that main deleted (#5229). - Deduplicated `docs/configuration.md` (one statement per setting or plugin), folded the dated sections of `docs/ci-performance.md` into its topical sections, and restored the core-callers notes in `docs/api_to_audit.md` that AGENTS.md requires. - Built the CLI and ran `bb guide` with each new chapter, the `queue`/`retry`/`inspect`/`messaging` aliases, and an unknown chapter. - Checked that inbound anchor links to the rewritten docs still resolve. - `pnpm exec turbo run test --filter=@bb/templates --filter=@get-bb/plugin-sdk --filter=@bb/sdk --filter=bb-plugin-workflows`: passed. - `pnpm exec turbo run test --filter=@bb/cli --filter=@bb/server -- src/__tests__/command-output/guide.test.ts src/__tests__/plugin-guide-docs.test.ts test/services/plugins/plugin-authoring-docs.test.ts`: passed. - `oxfmt --check` on every changed Markdown file: clean. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: qa <qa@x>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
experimental_scanPublicSdkOnlyfound import specifiers with regular expressions over the raw file text (from "…",import(…),require(…)). The regexes could not tell code from strings, comments, or property names. So method definitions ({ import(x) {} }), property calls (f.import(x)), test titles (it("after a confirmed import", …)), comments, and source code stored in template literals were all reported as module imports. Valid plugin tests failed the public-SDK dependency gate, and authors had to rename methods and titles to get past it. See #5326 and the slop-cop report.What changed
New
packages/plugin-sdk/src/testing/module-references.ts. A small, dependency-free tokenizer that skips comments, strings, template literals, regex literals, and (in.tsx) JSX text. From the remaining tokens it reads:import … from "x",import "x", andexport … from "x"declarationsimport()andrequire()calls, except property accesses (.import,?.import,#import) and method definitionsIt needs no parser dependency. The earlier bot candidate pulled one in and broke the bundled ESM
testingentrypoint (Dynamic require of "fs").public-sdk-only.ts. The two regexes are replaced withmoduleReferences(). Classification is unchanged:private-package,outside-allowlist,outside-package,dynamic-specifier. Two caller-visible differences:dynamic-specifierentries last)docs/api_to_audit.md. Audit item 2 for this API now describes the tokenizer and its remaining heuristics: a/after)is read as division, and a<in.tsxis tried as JSX and falls back when no closing tag matches.Version bump. Plugin SDK 0.6.47, so the fix publishes to npm.
No wire, protocol, CLI, or data-model changes.
How you verified
dist/testing/index.js. The method, property-call, property-literal-call, and test-title cases now return[].realImportsstill reports@bb/db(private-package) andunapproved-package(outside-allowlist). Published 0.6.43 still shows all four false positives.public-sdk-only.test.ts.//. Against the old scanner it fails with 18 violations.import type, default plus named, namespace, side-effect,import = require,export … from,export * as,typeof import(), a ternaryimport(spec),import()inside a template substitution,requirein an array, andimport()/require()inside JSX attributes and children. Against the old scanner it fails only on result order.pnpm exec turbo run typecheck test build --filter=@get-bb/plugin-sdk --filter=bb-plugin-echo-providerpasses: SDK 371 tests, echo-provider 15 tests.String.rawextension source. None was a real import.import()/require()calls, now showing the full argument text.Fixes #5326
🤖 Generated with Claude Code