feat(cli): add -c as shorthand for --continue (#999)

The lowercase -c now maps to --continue, shown in help as the primary short flag. The uppercase -C still works as a hidden alias since commander does not allow two short flags on a single option.
This commit is contained in:
liruifengv 2026-06-23 13:53:31 +08:00 committed by GitHub
parent 3e4793d611
commit 6b68aa85e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 20 additions and 10 deletions

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---
Add `-c` as a shorthand for `--continue`.

View file

@ -44,7 +44,8 @@ export function createProgram(
.hideHelp()
.argParser((val: string | boolean) => (val === true ? '' : (val as string))),
)
.option('-C, --continue', 'Continue the previous session for the working directory.', false)
.option('-c, --continue', 'Continue the previous session for the working directory.', false)
.addOption(new Option('-C').hideHelp().default(false))
.option('-y, --yolo', 'Automatically approve all actions.', false)
.option('--auto', 'Start in auto permission mode.', false)
.addOption(
@ -123,7 +124,7 @@ export function createProgram(
const opts: CLIOptions = {
session: sessionValue,
continue: raw['continue'] as boolean,
continue: raw['continue'] === true || raw['C'] === true,
yolo: yoloValue,
auto: autoValue,
plan: raw['plan'] as boolean,

View file

@ -155,6 +155,10 @@ describe('CLI options parsing', () => {
expect(parse(['-C']).continue).toBe(true);
});
it('-c is an alias for --continue', () => {
expect(parse(['-c']).continue).toBe(true);
});
it('--continue and --session combined raises a conflict', () => {
const opts = parse(['--continue', '--session', 'abc123']);
expect(() => validateOptions(opts)).toThrow(OptionConflictError);

View file

@ -54,7 +54,7 @@ Options passed at startup have the highest priority and apply only to the curren
| Option | Effect |
| --- | --- |
| `-S, --session [id]` | Resume a specific session; enters interactive selection when no id is given |
| `-C, --continue` | Resume the last session for the current working directory |
| `-c, --continue` | Resume the last session for the current working directory |
| `-y, --yolo` | Auto-approve all tool calls |
| `--plan` | Start in Plan mode |
| `-m, --model <model>` | Use a specific model alias for this session |

View file

@ -88,10 +88,10 @@ To run a single instruction without entering the interactive UI, use `-p`:
kimi -p "Take a look at this project's directory structure"
```
To resume the previous session, add `-C`:
To resume the previous session, add `-c`:
```sh
kimi -C
kimi -c
```
On first launch you need to configure an API source. In the interactive UI, enter `/login` to begin the login flow:

View file

@ -16,7 +16,7 @@ All flags are optional — run `kimi` directly to enter an interactive session:
| `--version` | `-V` | Print the version number and exit |
| `--help` | `-h` | Show help information and exit |
| `--session [id]` | `-S` | Resume a session. With an ID, opens that session directly; without an ID, enters an interactive selector |
| `--continue` | `-C` | Continue the most recent session in the current working directory, without specifying an ID manually |
| `--continue` | `-c` | Continue the most recent session in the current working directory, without specifying an ID manually |
| `--model <model>` | `-m` | Specify a model alias for this launch. When omitted, new sessions use `default_model` from the config file |
| `--prompt <prompt>` | `-p` | Run a single prompt non-interactively and stream the Assistant output to stdout. This mode does not open the TUI |
| `--output-format <format>` | | Set the non-interactive output format; supports `text` and `stream-json`. Can only be used with `--prompt`; defaults to `text` |

View file

@ -54,7 +54,7 @@ Kimi Code CLI 有三个地方可以影响运行参数:配置文件、命令行
| 选项 | 作用 |
| --- | --- |
| `-S, --session [id]` | 恢复指定会话;不带 id 时进入交互式选择 |
| `-C, --continue` | 续上当前目录的上一次会话 |
| `-c, --continue` | 续上当前目录的上一次会话 |
| `-y, --yolo` | 自动批准所有工具调用 |
| `--plan` | 以 Plan 模式启动 |
| `-m, --model <model>` | 指定本次使用的模型别名 |

View file

@ -88,10 +88,10 @@ kimi
kimi -p "帮我看一下这个项目的目录结构"
```
继续上一次会话加 `-C`
继续上一次会话加 `-c`
```sh
kimi -C
kimi -c
```
首次启动时需要配置 API 来源。在交互界面中输入 `/login` 进入登录流程:

View file

@ -16,7 +16,7 @@ kimi <subcommand> [options]
| `--version` | `-V` | 打印版本号并退出 |
| `--help` | `-h` | 显示帮助信息并退出 |
| `--session [id]` | `-S` | 恢复一个会话。带 ID 时直接打开指定会话;不带 ID 时进入交互式选择器 |
| `--continue` | `-C` | 继续当前工作目录下最近一次的会话,无需手动指定 ID |
| `--continue` | `-c` | 继续当前工作目录下最近一次的会话,无需手动指定 ID |
| `--model <model>` | `-m` | 为本次启动指定模型别名。省略时新会话使用配置文件中的 `default_model` |
| `--prompt <prompt>` | `-p` | 非交互执行单次 prompt并把 Assistant 输出流式写到 stdout。该模式不会打开 TUI |
| `--output-format <format>` | | 设置非交互输出格式,支持 `text``stream-json`。仅可与 `--prompt` 一起使用,默认 `text` |