问题
当前所有命令都接受 `--api-key sk-xxx`,会进入:
- Shell 历史(`
/.bash_history` / `/.zsh_history`)
- `ps aux` 输出(同机用户可见)
- 脚本日志/CI 日志
agent-cli-guide P2 明确要求 "密码禁止通过标志传递"。
目标
- 新增 `--api-key-file `:从文件读取 key,优先级高于环境变量
- `--api-key -` 表示从 stdin 读取(一行)
- 保留 `--api-key ` 但:
- 在 help 中加 `(not recommended: shell history leak)`
- 非 TTY 且值看起来像真实 key 时(正则 `^sk-|^AIza|^ant-`),向 stderr 打印一次 warning
- 更新 README / init 生成的 config.yaml 注释,推荐顺序:
- 环境变量 > 配置文件 > `--api-key-file` > `--api-key`(不推荐)
实现要点
- 在 `flexllm/cli/_common.py` 抽一个 `resolve_api_key(key, key_file)` helper 统一处理
- ask/chat/batch/serve/mock/test/models/credits 都切过来
验收
问题
当前所有命令都接受 `--api-key sk-xxx`,会进入:
/.bash_history` / `/.zsh_history`)agent-cli-guide P2 明确要求 "密码禁止通过标志传递"。
目标
实现要点
验收