claude-code-best be82b71c3e feat: 补全 auto mode 分类器 prompt 模板,支持 FEATURE_* 环境变量注入
- 重建 yolo-classifier-prompts/ 三个缺失的 prompt 文件
- dev.ts/build.ts 扫描 FEATURE_* 环境变量注入 Bun --feature
- AUTO_MODE_ENABLED_DEFAULT 由 feature flag 决定,开 feature 即开 auto mode
- 补充 docs/safety/auto-mode.mdx prompt 模板章节

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 21:18:39 +08:00

32 lines
1011 B
TypeScript

#!/usr/bin/env bun
/**
* Dev entrypoint — launches cli.tsx with MACRO.* defines injected
* via Bun's -d flag (bunfig.toml [define] doesn't propagate to
* dynamically imported modules at runtime).
*/
import { getMacroDefines } from "./defines.ts";
const defines = getMacroDefines();
const defineArgs = Object.entries(defines).flatMap(([k, v]) => [
"-d",
`${k}:${v}`,
]);
// Bun --feature flags: enable feature() gates at runtime.
// Any env var matching FEATURE_<NAME>=1 will enable that feature.
// e.g. FEATURE_TRANSCRIPT_CLASSIFIER=1 bun run dev
const featureArgs: string[] = Object.entries(process.env)
.filter(([k]) => k.startsWith("FEATURE_"))
.flatMap(([k]) => {
const name = k.replace("FEATURE_", "");
return ["--feature", name];
});
const result = Bun.spawnSync(
["bun", "run", ...defineArgs, ...featureArgs, "src/entrypoints/cli.tsx", ...process.argv.slice(2)],
{ stdio: ["inherit", "inherit", "inherit"] },
);
process.exit(result.exitCode ?? 0);