docs: update headless-cli references with official documentation

- gemini-cli.md: added --approval-mode, settings.json config
- claude-cli.md: added slash commands, CLAUDE.md, permissions config
- codex-cli.md: added exec command, config.toml, full-auto mode
- SKILL.md: added full-auto mode, parameter comparison table

Sources:
- https://geminicli.com/docs/get-started/configuration/
- https://docs.anthropic.com/en/docs/claude-code/
- https://developers.openai.com/codex/cli/reference
This commit is contained in:
tukuaiai
2025-12-19 16:10:37 +08:00
parent 3fa7b6bfed
commit 8595bdc12f
4 changed files with 243 additions and 81 deletions
@@ -1,46 +1,70 @@
# Gemini CLI 参数参考
> 来源: [官方文档](https://geminicli.com/docs/get-started/configuration/)
## 安装
```bash
npm install -g @anthropic-ai/gemini-cli
# 或
npx https://github.com/anthropics/anthropic-quickstarts/tree/main/gemini-cli
```
> ⚠️ 请以 [官方文档](https://github.com/google-gemini/gemini-cli) 为准
## 认证
首次运行会引导 Google 账号登录
首次运行会引导 Google 账号登录,或设置环境变量:
```bash
export GEMINI_API_KEY="YOUR_API_KEY"
```
## 核心参数
## 核心命令行参数
| 参数 | 说明 | 示例 |
|:---|:---|:---|
| `-m, --model` | 指定模型 | `-m gemini-2.5-flash` |
| `--output-format` | 输出格式 (text/json) | `--output-format text` |
| `--allowed-tools` | 允许的工具 | `--allowed-tools ''` (禁用所有) |
| `--yolo` | YOLO 模式,跳过所有确认 | `--yolo` |
| `--sandbox` | 沙箱模式 | `--sandbox` |
| `--model <model>` | 指定模型 | `--model gemini-2.5-flash` |
| `--yolo` | YOLO 模式,自动批准所有工具调用 | `gemini --yolo` |
| `--approval-mode <mode>` | 审批模式: `default`/`auto_edit`/`yolo` | `--approval-mode auto_edit` |
| `--allowed-tools <tools>` | 允许的工具列表(逗号分隔) | `--allowed-tools ''` (禁用所有) |
| `--output-format <format>` | 输出格式: `text`/`json`/`stream-json` | `--output-format text` |
| `--sandbox` / `-s` | 启用沙箱模式 | `gemini -s` |
| `--prompt <prompt>` / `-p` | 非交互模式,直接传入提示词 | `gemini -p "query"` |
| `--prompt-interactive <prompt>` / `-i` | 交互模式,带初始提示词 | `gemini -i "explain"` |
| `--debug` / `-d` | 启用调试模式 | `gemini -d` |
## 可用模型
- `gemini-2.5-flash` - 快速模型
- `gemini-2.5-pro` - 高级模型
- `gemini-3.0-pro` - 最新模型
- `gemini-3-flash-preview` - 最新 Flash
- `gemini-3-pro-preview` - 最新 Pro
## 无头模式用法
```bash
# 基础无头调用
cat input.txt | gemini -m gemini-2.5-flash --output-format text "Your prompt"
# 基础无头调用(管道输入)
cat input.txt | gemini -p "Your prompt" --output-format text
# 禁用工具调用(纯文本输出)
cat input.txt | gemini -m gemini-2.5-flash --output-format text --allowed-tools '' "Your prompt"
cat input.txt | gemini -p "Your prompt" --output-format text --allowed-tools ''
# YOLO 模式(跳过所有确认)
gemini --yolo "Your prompt"
# 或使用 approval-mode
gemini --approval-mode yolo "Your prompt"
```
## 配置文件
配置存储在 `~/.gemini/settings.json` 或项目 `.gemini/settings.json`
```json
{
"security": {
"disableYoloMode": false
},
"model": {
"name": "gemini-2.5-flash"
}
}
```
## 代理配置