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

View File

@@ -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/",

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