From 85aa6e91a6be508134ec7df16ff0714c7a2c9656 Mon Sep 17 00:00:00 2001 From: Satya Patel Date: Wed, 16 Sep 2026 16:32:32 -0700 Subject: [PATCH] fix(cli-framework,i18n): `bun run dev` runs the CLI instead of dying `cli-framework build` applies cli.config.ts's plugins; `dev` did not, so the Lingui macro reached the CLI's dev entrypoint untransformed and every invocation died on the macro's runtime shim. An agent (or anyone) could typecheck a CLI change but never run it, not even `--help`. Bun.plugin rejects the undefined that Bun.build takes as a pass-through, so the macro plugin now returns contents on every branch. Also: AGENTS.md told every agent it was in a git worktree. In a cloud workspace it is a plain clone at /workspace, and the sentence is force-loaded into every session there. Claude-Session: https://claude.ai/code/session_01FK6rLzBEUiHHXZWNmpQ2BP --- AGENTS.md | 4 +++- packages/cli-framework/src/dev.ts | 2 ++ packages/i18n/src/bun-plugin.ts | 16 +++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 99dd0131b65..ff847646234 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,9 @@ Superset is an agent-first development platform, with an Electron desktop IDE, Next.js web apps, and an Expo mobile app as the main customer-facing surfaces. It's a Turborepo monorepo, deployed apps are in apps/ and supporting packages are in packages/, and we use tRPC for the api. -You're working inside a Superset workspace, an isolated git-worktree copy of this repo. "Workspace" in a user message means that, not an editor workspace. +You're working inside a Superset workspace, an isolated checkout of this repo — a git worktree on a +machine someone owns, a plain clone at `/workspace` in a cloud workspace. "Workspace" in a user +message means that, not an editor workspace. ## Project Structure diff --git a/packages/cli-framework/src/dev.ts b/packages/cli-framework/src/dev.ts index ca837b2f8bd..4cda5c6bbca 100644 --- a/packages/cli-framework/src/dev.ts +++ b/packages/cli-framework/src/dev.ts @@ -9,6 +9,8 @@ export async function runDev(argv: string[]): Promise { const { config, root } = await loadConfig(process.cwd()); const commandsDir = resolve(root, config.commandsDir); + for (const plugin of config.plugins ?? []) Bun.plugin(plugin); + const commandFiles = Array.from( new Glob("**/command.ts").scanSync({ cwd: commandsDir, diff --git a/packages/i18n/src/bun-plugin.ts b/packages/i18n/src/bun-plugin.ts index 9ff61409d68..65dda3af255 100644 --- a/packages/i18n/src/bun-plugin.ts +++ b/packages/i18n/src/bun-plugin.ts @@ -9,9 +9,15 @@ export const linguiMacroPlugin: BunPlugin = { name: "lingui-macro", setup(build) { build.onLoad({ filter: /\.tsx?$/ }, async ({ path }) => { - if (path.includes("/node_modules/")) return undefined; + // Returning undefined is a pass-through for Bun.build but an error + // under Bun.plugin, so every branch hands back contents. + const loader = path.endsWith(".tsx") ? "tsx" : "ts"; const code = await Bun.file(path).text(); - if (!code.includes("@lingui/core/macro")) return undefined; + if ( + path.includes("/node_modules/") || + !code.includes("@lingui/core/macro") + ) + return { contents: code, loader }; const result = await transformAsync(code, { filename: path, babelrc: false, @@ -19,11 +25,7 @@ export const linguiMacroPlugin: BunPlugin = { parserOpts: { plugins: ["typescript"] }, plugins: [linguiMacro], }); - if (!result?.code) return undefined; - return { - contents: result.code, - loader: path.endsWith(".tsx") ? "tsx" : "ts", - }; + return { contents: result?.code ?? code, loader }; }); }, };