Repository navigation
fix(cli): export B4Config so config() typechecks under pnpm - #810
Merged
Merged
Conversation
`export default config({})` in b4.config.ts infers `B4Config` from
`@b4run/core`. Under pnpm's isolated node_modules an app depends only on
`@b4run/cli`, so declaration emit could not name the type and tsc failed
with TS2883. This broke typecheck for pnpm users of the research template.
`@b4run/cli` now re-exports the `B4Config` type, which TypeScript uses to
name the inferred type. The basic template's b4.config.ts switches to
`config({})` to match the docs. A cli test builds a pnpm-style `.pnpm`
store layout and typechecks `config({})` against it; it reproduces the
exact TS2883 without the re-export.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
blove
enabled auto-merge (squash)
September 23, 2026 15:26
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
blove
temporarily deployed
to
vercel-preview
September 23, 2026 15:30 — with
GitHub Actions
Inactive
This was referenced Sep 23, 2026
blove
added a commit
that referenced
this pull request
Sep 23, 2026
#815) #810 re-exports B4Config next to config from @b4run/cli, so the built index.ts line now reads `export { type B4Config, config } from "@b4run/core"` and the drafter end-to-end test's exact-line assertion fails in sandbox-docker. Co-authored-by: Claude Opus 5.5 <[email protected]>
Merged
This branch was successfully deployed
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.
Problem
b4.config.tswritten asimport { config } from "@b4run/cli"+export default config({})failedtsc --noEmitin a pnpm-installed app:@b4run/clire-exportedconfigfrom@b4run/corebut not theB4Configtype. Under pnpm's isolated layout the app can resolve only@b4run/cli, so declaration emit had no way to name the inferred type. npm's hoisted layout hid the problem. I reproduced it withcreate-b4-app --mode internalunder pnpm in two places:server/, which already usesconfig(), so pnpm users of that template got a failingtypecheckconfig({})swapped inFix
packages/cli/src/index.ts:export { type B4Config, config } from "@b4run/core". TypeScript then names the inferred type through@b4run/cli. Checked under real pnpm installs of both scaffolds.b4.config.tsnow usesimport { config } from "@b4run/cli"+export default config({}), which was the original plan and matches the docs.apps/web/content/docs/api/cli.mdx: documents the newB4Configexport (required bycheck-docs).@b4run/cliand@b4run/devkit.The code-fixer blueprint guide is unchanged. It is pinned to 0.10.0 and says nothing about what the scaffold's
b4.config.tscontains. No generated.b4files, harness overlays orbasic.expected.jsonchanged. The overlays write their own config, andrenderedBytesstayed the same.Regression test
packages/cli/test/config-type-portability.test.tsbuilds a pnpm-style.pnpmstore in a temp dir outside the repo:@b4run/cliand@b4run/coredeclarations are copied in@b4run/cliIt then typechecks
export default config({})and aB4Config-annotated file withdeclaration: true. Without the re-export it fails with the exact TS2883 above and TS2724. With the re-export it passes. A plain symlink topackages/clidoes not reproduce the bug: TS resolves core to a real path outsidenode_modules, where TS2883 never fires. That is why the test copies the declarations.Test plan
create-b4-app --mode internal): basic withconfig({})and researchserver/both failpnpm typecheckbefore the fix and pass after. The new basic scaffold also passespnpm testandb4 check.pnpm lint,pnpm typecheck,node scripts/check-docs.mjsapi-reference-inventory+docs-anchorstestspnpm verify:harness:frameworkpassed🤖 Generated with Claude Code