mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-08-25 00:28:24 +00:00
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:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: headless-cli
|
||||
description: "无头模式 AI CLI 调用技能:支持 Gemini/Claude/Codex 等 CLI 的无交互批量调用,包含 YOLO 模式和安全模式。用于批量翻译、代码审查、多模型编排等场景。"
|
||||
description: "无头模式 AI CLI 调用技能:支持 Gemini/Claude/Codex CLI 的无交互批量调用,包含 YOLO 模式和安全模式。用于批量翻译、代码审查、多模型编排等场景。"
|
||||
---
|
||||
|
||||
# Headless CLI 技能
|
||||
@@ -31,9 +31,10 @@ description: "无头模式 AI CLI 调用技能:支持 Gemini/Claude/Codex 等
|
||||
|
||||
### 🔴 YOLO 模式(全权限,跳过确认)
|
||||
|
||||
**Codex CLI (GPT-5.1)**
|
||||
**Codex CLI**
|
||||
```bash
|
||||
alias c='codex --enable web_search_request -m gpt-5.1-codex-max -c model_reasoning_effort="high" --dangerously-bypass-approvals-and-sandbox'
|
||||
# --yolo 是 --dangerously-bypass-approvals-and-sandbox 的别名
|
||||
alias c='codex --enable web_search_request -m gpt-5.1-codex-max -c model_reasoning_effort="high" --yolo'
|
||||
```
|
||||
|
||||
**Claude Code**
|
||||
@@ -43,24 +44,39 @@ alias cc='claude --dangerously-skip-permissions'
|
||||
|
||||
**Gemini CLI**
|
||||
```bash
|
||||
# --yolo 或 --approval-mode yolo
|
||||
alias g='gemini --yolo'
|
||||
```
|
||||
|
||||
**Kiro CLI**
|
||||
### 🟡 Full-Auto 模式(推荐的自动化方式)
|
||||
|
||||
**Codex CLI**
|
||||
```bash
|
||||
alias k='kiro --dangerously-skip-permissions'
|
||||
# workspace-write 沙箱 + 失败时才审批
|
||||
codex --full-auto "Your prompt"
|
||||
```
|
||||
|
||||
**Gemini CLI**
|
||||
```bash
|
||||
# 自动批准编辑工具
|
||||
gemini --approval-mode auto_edit "Your prompt"
|
||||
```
|
||||
|
||||
### 🟢 安全模式(无头但有限制)
|
||||
|
||||
**Gemini CLI(禁用工具调用)**
|
||||
```bash
|
||||
cat input.md | gemini -m gemini-2.5-flash --output-format text --allowed-tools '' "prompt" > output.md
|
||||
cat input.md | gemini -p "prompt" --output-format text --allowed-tools '' > output.md
|
||||
```
|
||||
|
||||
**Claude Code(指定模型)**
|
||||
**Claude Code(Print 模式)**
|
||||
```bash
|
||||
cat input.md | claude -m claude-sonnet-4 --output-format text "prompt" > output.md
|
||||
cat input.md | claude -p "prompt" --output-format text > output.md
|
||||
```
|
||||
|
||||
**Codex CLI(非交互执行)**
|
||||
```bash
|
||||
codex exec "prompt" --json -o result.txt
|
||||
```
|
||||
|
||||
### 📋 常用命令模板
|
||||
@@ -72,34 +88,33 @@ export http_proxy=http://127.0.0.1:9910
|
||||
export https_proxy=http://127.0.0.1:9910
|
||||
|
||||
# Gemini 翻译
|
||||
cat zh.md | gemini -m gemini-2.5-flash --output-format text --allowed-tools '' \
|
||||
"Translate to English. Keep code/links unchanged." > en.md
|
||||
cat zh.md | gemini -p "Translate to English. Keep code/links unchanged." \
|
||||
--output-format text --allowed-tools '' > en.md
|
||||
```
|
||||
|
||||
**代码审查**
|
||||
```bash
|
||||
cat code.py | claude --dangerously-skip-permissions \
|
||||
cat code.py | claude --dangerously-skip-permissions -p \
|
||||
"Review this code for bugs and security issues. Output markdown." > review.md
|
||||
```
|
||||
|
||||
**多模型编排**
|
||||
```bash
|
||||
# 模型 A 生成 → 模型 B 审查
|
||||
cat spec.md | gemini -m gemini-2.5-flash --output-format text "Generate code" | \
|
||||
claude -m claude-sonnet-4 "Review and improve this code" > result.md
|
||||
cat spec.md | gemini -p "Generate code" --output-format text | \
|
||||
claude -p "Review and improve this code" --output-format text > result.md
|
||||
```
|
||||
|
||||
### ⚙️ 关键参数说明
|
||||
### ⚙️ 关键参数对照表
|
||||
|
||||
| CLI | 参数 | 说明 |
|
||||
|:---|:---|:---|
|
||||
| gemini | `--yolo` | 跳过所有确认 |
|
||||
| gemini | `--allowed-tools ''` | 禁用工具调用(纯文本输出) |
|
||||
| gemini | `--output-format text` | 输出纯文本 |
|
||||
| gemini | `-m <model>` | 指定模型 |
|
||||
| claude | `--dangerously-skip-permissions` | 跳过权限确认 |
|
||||
| codex | `--dangerously-bypass-approvals-and-sandbox` | 跳过审批和沙箱 |
|
||||
| codex | `-c model_reasoning_effort="high"` | 高推理强度 |
|
||||
| 功能 | Gemini CLI | Claude Code | Codex CLI |
|
||||
|:---|:---|:---|:---|
|
||||
| YOLO 模式 | `--yolo` | `--dangerously-skip-permissions` | `--yolo` |
|
||||
| 指定模型 | `-m <model>` | `--model <model>` | `-m <model>` |
|
||||
| 非交互 | `-p "prompt"` | `-p "prompt"` | `exec "prompt"` |
|
||||
| 输出格式 | `--output-format text` | `--output-format text` | `--json` |
|
||||
| 禁用工具 | `--allowed-tools ''` | `--disallowedTools` | N/A |
|
||||
| 继续对话 | N/A | `-c` / `--continue` | `resume --last` |
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -112,8 +127,9 @@ export http_proxy=http://127.0.0.1:9910
|
||||
export https_proxy=http://127.0.0.1:9910
|
||||
|
||||
for f in docs/*.md; do
|
||||
cat "$f" | timeout 120 gemini -m gemini-2.5-flash --output-format text --allowed-tools '' \
|
||||
"Translate to English. Keep code fences unchanged." 2>/dev/null > "en_$(basename $f)"
|
||||
cat "$f" | timeout 120 gemini -p \
|
||||
"Translate to English. Keep code fences unchanged." \
|
||||
--output-format text --allowed-tools '' 2>/dev/null > "en_$(basename $f)"
|
||||
done
|
||||
```
|
||||
**预期输出**: 翻译后的英文文件
|
||||
@@ -123,7 +139,7 @@ done
|
||||
**输入**: Python 代码文件
|
||||
**步骤**:
|
||||
```bash
|
||||
cat src/*.py | claude --dangerously-skip-permissions \
|
||||
cat src/*.py | claude --dangerously-skip-permissions -p \
|
||||
"Review for: 1) Bugs 2) Security 3) Performance. Output markdown table." > review.md
|
||||
```
|
||||
**预期输出**: Markdown 格式的审查报告
|
||||
@@ -135,11 +151,11 @@ cat src/*.py | claude --dangerously-skip-permissions \
|
||||
```bash
|
||||
question="How to implement rate limiting in Python?"
|
||||
|
||||
echo "$question" | gemini -m gemini-2.5-flash --output-format text > gemini_answer.md
|
||||
echo "$question" | claude -m claude-sonnet-4 --output-format text > claude_answer.md
|
||||
echo "$question" | gemini -p "$question" --output-format text > gemini_answer.md
|
||||
echo "$question" | claude -p "$question" --output-format text > claude_answer.md
|
||||
|
||||
# 对比两个答案
|
||||
paste gemini_answer.md claude_answer.md | diff -y --suppress-common-lines
|
||||
diff gemini_answer.md claude_answer.md
|
||||
```
|
||||
**预期输出**: 两个模型答案的对比
|
||||
|
||||
@@ -148,8 +164,9 @@ paste gemini_answer.md claude_answer.md | diff -y --suppress-common-lines
|
||||
- `references/gemini-cli.md` - Gemini CLI 完整参数
|
||||
- `references/claude-cli.md` - Claude Code CLI 参数
|
||||
- `references/codex-cli.md` - Codex CLI 参数
|
||||
- [Gemini CLI 官方文档](https://github.com/google-gemini/gemini-cli)
|
||||
- [Claude Code 官方文档](https://docs.anthropic.com/claude-code)
|
||||
- [Gemini CLI 官方文档](https://geminicli.com/docs/)
|
||||
- [Claude Code 官方文档](https://docs.anthropic.com/en/docs/claude-code/)
|
||||
- [Codex CLI 官方文档](https://developers.openai.com/codex/cli/reference)
|
||||
|
||||
## Maintenance
|
||||
|
||||
|
||||
Reference in New Issue
Block a user