Skip to content

Commit f4e7f2a

Browse files
authored
feat(cli): remove --query, add --prompt cli option (#612)
Signed-off-by: Richard Chien <stdrc@outlook.com>
1 parent ebad487 commit f4e7f2a

13 files changed

Lines changed: 69 additions & 42 deletions

File tree

.kimi/prompts/pr.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
如果当前分支有 dirty change,什么都不要做,直接停止。
2+
如果是干净的,确保当前分支是一个不同于 main 的独立分支。然后,根据当前分支相对于 main 分支的修改,push 并提交一个 PR(利用 gh 命令),用英文编写 PR 标题和 description,描述所做的更改。PR title 要符合先前的 commit message 规范(PR title 就是 squash merge 之后的 commit message)。

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Only write entries that are worth mentioning to users.
1414
- Shell: Use `/model` to toggle thinking mode instead of Tab key
1515
- Config: Add `default_thinking` config option (auto-migrated from metadata)
1616
- LLM: Add `always_thinking` capability for models that always use thinking mode
17+
- CLI: Rename `--command`/`-c` to `--prompt`/`-p`, keep `--command`/`-c` as alias, remove `--query`/`-q`
1718

1819
## 0.76 (2026-01-12)
1920

docs/en/customization/print-mode.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Print mode lets Kimi CLI run non-interactively, suitable for scripting and autom
77
Use the `--print` flag to enable print mode:
88

99
```sh
10-
# Pass instructions via -c
11-
kimi --print -c "List all Python files in the current directory"
10+
# Pass instructions via -p (or -c)
11+
kimi --print -p "List all Python files in the current directory"
1212

1313
# Pass instructions via stdin
1414
echo "Explain what this code does" | kimi --print
@@ -20,15 +20,15 @@ Print mode characteristics:
2020
- **Auto-approval**: Implicitly enables `--yolo` mode, all operations are auto-approved
2121
- **Text output**: AI responses are output to stdout
2222

23-
<!-- TODO: Enable this example after supporting reading content from stdin and instructions from -c simultaneously
23+
<!-- TODO: Enable this example after supporting reading content from stdin and instructions from -p simultaneously
2424
**Pipeline examples**
2525
2626
```sh
2727
# Analyze git diff and generate commit message
28-
git diff --staged | kimi --print -c "Generate a Conventional Commits compliant commit message based on this diff"
28+
git diff --staged | kimi --print -p "Generate a Conventional Commits compliant commit message based on this diff"
2929
3030
# Read file and generate documentation
31-
cat src/api.py | kimi --print -c "Generate API documentation for this Python module"
31+
cat src/api.py | kimi --print -p "Generate API documentation for this Python module"
3232
```
3333
-->
3434

@@ -37,13 +37,13 @@ cat src/api.py | kimi --print -c "Generate API documentation for this Python mod
3737
Use the `--final-message-only` option to only output the final assistant message, skipping intermediate tool call processes:
3838

3939
```sh
40-
kimi --print -c "Give me a Git commit message based on the current changes" --final-message-only
40+
kimi --print -p "Give me a Git commit message based on the current changes" --final-message-only
4141
```
4242

4343
`--quiet` is a shortcut for `--print --output-format text --final-message-only`, suitable for scenarios where only the final result is needed:
4444

4545
```sh
46-
kimi --quiet -c "Give me a Git commit message based on the current changes"
46+
kimi --quiet -p "Give me a Git commit message based on the current changes"
4747
```
4848

4949
## JSON format
@@ -55,7 +55,7 @@ Print mode supports JSON format for input and output, convenient for programmati
5555
Use `--output-format=stream-json` to output in JSONL (one JSON per line) format:
5656

5757
```sh
58-
kimi --print -c "Hello" --output-format=stream-json
58+
kimi --print -p "Hello" --output-format=stream-json
5959
```
6060

6161
Example output:
@@ -136,7 +136,7 @@ Assistant message with tool calls:
136136
Auto-generate code or perform checks in CI workflows:
137137

138138
```sh
139-
kimi --print -c "Check if there are any obvious security issues in the src/ directory, output a JSON format report"
139+
kimi --print -p "Check if there are any obvious security issues in the src/ directory, output a JSON format report"
140140
```
141141

142142
**Batch processing**
@@ -145,7 +145,7 @@ Combine with shell loops for batch file processing:
145145

146146
```sh
147147
for file in src/*.py; do
148-
kimi --print -c "Add type annotations to $file"
148+
kimi --print -p "Add type annotations to $file"
149149
done
150150
```
151151

docs/en/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Correct input format example:
112112

113113
If there's no output in `--print` mode, it may be:
114114

115-
- **No input provided**: You need to provide input via `--command` or stdin. For example: `kimi --print --command "Hello"`.
115+
- **No input provided**: You need to provide input via `--prompt` (or `--command`) or stdin. For example: `kimi --print --prompt "Hello"`.
116116
- **Output is buffered**: Try using `--output-format stream-json` for streaming output.
117117
- **Configuration incomplete**: Ensure API key and model are configured via `/setup`.
118118

docs/en/reference/kimi-command.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ The working directory determines the root directory for file operations. The age
6060

6161
| Option | Short | Description |
6262
|--------|-------|-------------|
63-
| `--command TEXT` | `-c` | Pass user query, doesn't enter interactive mode |
64-
| `--query TEXT` | `-q` | Alias for `--command` |
63+
| `--prompt TEXT` | `-p` | Pass user prompt, doesn't enter interactive mode |
64+
| `--command TEXT` | `-c` | Alias for `--prompt` |
6565

66-
When using `--command`, Kimi CLI exits after processing the query (unless `--print` is specified, results are still displayed in interactive mode).
66+
When using `--prompt` (or `--command`), Kimi CLI exits after processing the query (unless `--print` is specified, results are still displayed in interactive mode).
6767

6868
## Loop control
6969

docs/en/release-notes/breaking-changes.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
This page documents breaking changes in Kimi CLI releases and provides migration guidance.
44

5+
## Unreleased
6+
7+
### `--query` option removed
8+
9+
The `--query` (`-q`) option has been removed. Use `--prompt` as the primary option, with `--command` as an alias.
10+
11+
- **Affected**: Scripts and automation using `--query` or `-q`
12+
- **Migration**:
13+
- `--query` / `-q``--prompt` / `-p`
14+
- Or continue using `--command` / `-c`
15+
516
## 0.74 - ACP command change
617

718
### `--acp` option deprecated

docs/en/release-notes/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This page documents the changes in each Kimi CLI release.
77
- Shell: Use `/model` to toggle thinking mode instead of Tab key
88
- Config: Add `default_thinking` config option (auto-migrated from metadata)
99
- LLM: Add `always_thinking` capability for models that always use thinking mode
10+
- CLI: Rename `--command`/`-c` to `--prompt`/`-p`, keep `--command`/`-c` as alias, remove `--query`/`-q`
1011

1112
## 0.76 (2026-01-12)
1213

docs/zh/customization/print-mode.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Print 模式让 Kimi CLI 以非交互方式运行,适合脚本调用和自动
77
使用 `--print` 参数启用 Print 模式:
88

99
```sh
10-
# 通过 -c 传入指令
11-
kimi --print -c "列出当前目录的所有 Python 文件"
10+
# 通过 -p 传入指令(或 -c)
11+
kimi --print -p "列出当前目录的所有 Python 文件"
1212

1313
# 通过 stdin 传入指令
1414
echo "解释这段代码的作用" | kimi --print
@@ -20,15 +20,15 @@ Print 模式的特点:
2020
- **自动审批**:隐式启用 `--yolo` 模式,所有操作自动批准
2121
- **文本输出**:AI 的回复输出到 stdout
2222

23-
<!-- TODO: 支持同时从 stdin 读取内容和 -c 读取指令后启用此示例
23+
<!-- TODO: 支持同时从 stdin 读取内容和 -p 读取指令后启用此示例
2424
**管道组合示例**
2525
2626
```sh
2727
# 分析 git diff 并生成提交信息
28-
git diff --staged | kimi --print -c "根据这个 diff 生成一个符合 Conventional Commits 规范的提交信息"
28+
git diff --staged | kimi --print -p "根据这个 diff 生成一个符合 Conventional Commits 规范的提交信息"
2929
3030
# 读取文件并生成文档
31-
cat src/api.py | kimi --print -c "为这个 Python 模块生成 API 文档"
31+
cat src/api.py | kimi --print -p "为这个 Python 模块生成 API 文档"
3232
```
3333
-->
3434

@@ -37,13 +37,13 @@ cat src/api.py | kimi --print -c "为这个 Python 模块生成 API 文档"
3737
使用 `--final-message-only` 选项可以只输出最终的 assistant 消息,跳过中间的工具调用过程:
3838

3939
```sh
40-
kimi --print -c "根据当前变更给我一个 Git commit message" --final-message-only
40+
kimi --print -p "根据当前变更给我一个 Git commit message" --final-message-only
4141
```
4242

4343
`--quiet``--print --output-format text --final-message-only` 的快捷方式,适合只需要最终结果的场景:
4444

4545
```sh
46-
kimi --quiet -c "根据当前变更给我一个 Git commit message"
46+
kimi --quiet -p "根据当前变更给我一个 Git commit message"
4747
```
4848

4949
## JSON 格式
@@ -55,7 +55,7 @@ Print 模式支持 JSON 格式的输入和输出,方便程序化处理。输
5555
使用 `--output-format=stream-json` 以 JSONL(每行一个 JSON)格式输出:
5656

5757
```sh
58-
kimi --print -c "你好" --output-format=stream-json
58+
kimi --print -p "你好" --output-format=stream-json
5959
```
6060

6161
输出示例:
@@ -136,7 +136,7 @@ echo '{"role":"user","content":"你好"}' | kimi --print --input-format=stream-j
136136
在 CI 流程中自动生成代码或执行检查:
137137

138138
```sh
139-
kimi --print -c "检查 src/ 目录下是否有明显的安全问题,输出 JSON 格式的报告"
139+
kimi --print -p "检查 src/ 目录下是否有明显的安全问题,输出 JSON 格式的报告"
140140
```
141141

142142
**批量处理**
@@ -145,7 +145,7 @@ kimi --print -c "检查 src/ 目录下是否有明显的安全问题,输出 JS
145145

146146
```sh
147147
for file in src/*.py; do
148-
kimi --print -c "$file 添加类型注解"
148+
kimi --print -p "$file 添加类型注解"
149149
done
150150
```
151151

docs/zh/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ kimi mcp add --transport http context7 https://mcp.context7.com/mcp --header "CO
112112

113113
如果 `--print` 模式下没有输出,可能是:
114114

115-
- **未提供输入**:需要通过 `--command` 或 stdin 提供输入。例如:`kimi --print --command "你好"`
115+
- **未提供输入**:需要通过 `--prompt`(或 `--command`或 stdin 提供输入。例如:`kimi --print --prompt "你好"`
116116
- **输出被缓冲**:尝试使用 `--output-format stream-json` 获取流式输出。
117117
- **配置未完成**:确保已通过 `/setup` 配置 API 密钥和模型。
118118

docs/zh/reference/kimi-command.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ kimi [OPTIONS] COMMAND [ARGS]
6060

6161
| 选项 | 简写 | 说明 |
6262
|------|------|------|
63-
| `--command TEXT` | `-c` | 传入用户查询,不进入交互模式 |
64-
| `--query TEXT` | `-q` | `--command` 的别名 |
63+
| `--prompt TEXT` | `-p` | 传入用户提示,不进入交互模式 |
64+
| `--command TEXT` | `-c` | `--prompt` 的别名 |
6565

66-
使用 `--command` 时,Kimi CLI 会处理完查询后退出(除非指定 `--print`,否则仍以交互模式显示结果)。
66+
使用 `--prompt`(或 `--command`时,Kimi CLI 会处理完查询后退出(除非指定 `--print`,否则仍以交互模式显示结果)。
6767

6868
## 循环控制
6969

0 commit comments

Comments
 (0)