From c9c14c816f03173a312975e1cb5d8917a03e692d Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Fri, 3 Apr 2026 16:47:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=AE=80=E5=8C=96=20debug=20=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- scripts/dev-debug.ts | 2 ++ scripts/dev.ts | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 scripts/dev-debug.ts diff --git a/package.json b/package.json index 5da348ea2..8b9831c0a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "scripts": { "build": "bun run build.ts", "dev": "bun run scripts/dev.ts", - "dev:inspect": "bun --inspect-wait=localhost:8888/2dc3gzl5xot run -d 'MACRO.VERSION:\"2.1.888\"' -d 'MACRO.BUILD_TIME:\"\"' -d 'MACRO.FEEDBACK_CHANNEL:\"\"' -d 'MACRO.ISSUES_EXPLAINER:\"\"' -d 'MACRO.NATIVE_PACKAGE_URL:\"\"' -d 'MACRO.PACKAGE_URL:\"\"' -d 'MACRO.VERSION_CHANGELOG:\"\"' --feature BUDDY --feature TRANSCRIPT_CLASSIFIER src/entrypoints/cli.tsx", + "dev:inspect": "bun run scripts/dev-debug.ts", "prepublishOnly": "bun run build", "lint": "biome lint src/", "lint:fix": "biome lint --fix src/", diff --git a/scripts/dev-debug.ts b/scripts/dev-debug.ts new file mode 100644 index 000000000..9a0dfaf32 --- /dev/null +++ b/scripts/dev-debug.ts @@ -0,0 +1,2 @@ +process.env.BUN_INSPECT="localhost:8888/2dc3gzl5xot" +await import("./dev") diff --git a/scripts/dev.ts b/scripts/dev.ts index 40fa6ff60..cb8fac377 100644 --- a/scripts/dev.ts +++ b/scripts/dev.ts @@ -26,8 +26,13 @@ const envFeatures = Object.entries(process.env) const allFeatures = [...new Set([...DEFAULT_FEATURES, ...envFeatures])]; const featureArgs = allFeatures.flatMap((name) => ["--feature", name]); +// If BUN_INSPECT is set, pass --inspect-wait to the child process +const inspectArgs = process.env.BUN_INSPECT + ? ["--inspect-wait=" + process.env.BUN_INSPECT] + : []; + const result = Bun.spawnSync( - ["bun", "run", ...defineArgs, ...featureArgs, "src/entrypoints/cli.tsx", ...process.argv.slice(2)], + ["bun", ...inspectArgs, "run", ...defineArgs, ...featureArgs, "src/entrypoints/cli.tsx", ...process.argv.slice(2)], { stdio: ["inherit", "inherit", "inherit"] }, );