claude-code/DEV-LOG.md

54 lines
2.8 KiB
Markdown
Raw Normal View History

# DEV-LOG
2026-04-02 21:41:19 +08:00
## Buddy 命令合入 + Feature Flag 规范修正 (2026-04-02)
合入 `pr/smallflyingpig/36` 分支(支持 buddy 命令 + 修复 rehatch并修正 feature flag 使用方式。
**合入内容(来自 PR**
- `src/commands/buddy/buddy.ts` — 新增 `/buddy` 命令,支持 hatch / rehatch / pet / mute / unmute 子命令
- `src/commands/buddy/index.ts` — 从 stub 改为正确的 `Command` 类型导出
- `src/buddy/companion.ts` — 新增 `generateSeed()``getCompanion()` 支持 seed 驱动的可复现 rolling
- `src/buddy/types.ts``CompanionSoul` 增加 `seed?` 字段
**合并后修正:**
- `src/entrypoints/cli.tsx` — PR 硬编码了 `const feature = (name) => name === "BUDDY"`,违反 feature flag 规范,恢复为标准 `import { feature } from 'bun:bundle'`
- `src/commands.ts` — PR 用静态 `import buddy` 绕过了 feature gate恢复为 `feature('BUDDY') ? require(...) : null` + 条件展开
- `src/commands/buddy/buddy.ts` — 删除未使用的 `companionInfoText` 函数和多余的 `Roll`/`SPECIES` import
- `CLAUDE.md` — 重写 Feature Flag System 章节,明确规范:代码中统一用 `import { feature } from 'bun:bundle'`,启用走环境变量 `FEATURE_<NAME>=1`
**用法:** `FEATURE_BUDDY=1 bun run dev`
---
## Auto Mode 补全 (2026-04-02)
反编译丢失了 auto mode 分类器的三个 prompt 模板文件,代码逻辑完整但无法运行。
**新增:**
- `yolo-classifier-prompts/auto_mode_system_prompt.txt` — 主系统提示词
- `yolo-classifier-prompts/permissions_external.txt` — 外部权限模板(用户规则替换默认值)
- `yolo-classifier-prompts/permissions_anthropic.txt` — 内部权限模板(用户规则追加)
**改动:**
- `scripts/dev.ts` + `build.ts` — 扫描 `FEATURE_*` 环境变量注入 Bun `--feature`
- `cli.tsx` — 启动时打印已启用的 feature
- `permissionSetup.ts``AUTO_MODE_ENABLED_DEFAULT``feature('TRANSCRIPT_CLASSIFIER')` 决定,开 feature 即开 auto mode
- `docs/safety/auto-mode.mdx` — 补充 prompt 模板章节
**用法:** `FEATURE_TRANSCRIPT_CLASSIFIER=1 bun run dev`
**注意:** prompt 模板为重建产物。
---
## USER_TYPE=ant TUI 修复 (2026-04-02)
`global.d.ts` 声明的全局函数在反编译版本运行时未定义,导致 `USER_TYPE=ant` 时 TUI 崩溃。
修复方式:显式 import / 本地 stub / 全局 stub / 新建 stub 文件。涉及文件:
`cli.tsx`, `model.ts`, `context.ts`, `effort.ts`, `thinking.ts`, `undercover.ts`, `Spinner.tsx`, `AntModelSwitchCallout.tsx`(新建), `UndercoverAutoCallout.tsx`(新建)
注意:
- `USER_TYPE=ant` 启用 alt-screen 全屏模式,中心区域满屏是预期行为
- `global.d.ts` 中剩余未 stub 的全局函数(`getAntModels` 等)遇到 `X is not defined` 时按同样模式处理