feat: 简化 debug 方式

This commit is contained in:
claude-code-best
2026-04-03 16:47:24 +08:00
parent 7935bfb4b8
commit c9c14c816f
3 changed files with 9 additions and 2 deletions

2
scripts/dev-debug.ts Normal file
View File

@@ -0,0 +1,2 @@
process.env.BUN_INSPECT="localhost:8888/2dc3gzl5xot"
await import("./dev")

View File

@@ -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"] },
);