From 6b68aa85e2a58cfdaacba5580f66a6a74550ccf6 Mon Sep 17 00:00:00 2001 From: liruifengv Date: Tue, 23 Jun 2026 13:53:31 +0800 Subject: [PATCH] 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. --- .changeset/add-lowercase-continue-shorthand.md | 5 +++++ apps/kimi-code/src/cli/commands.ts | 5 +++-- apps/kimi-code/test/cli/options.test.ts | 4 ++++ docs/en/configuration/overrides.md | 2 +- docs/en/guides/getting-started.md | 4 ++-- docs/en/reference/kimi-command.md | 2 +- docs/zh/configuration/overrides.md | 2 +- docs/zh/guides/getting-started.md | 4 ++-- docs/zh/reference/kimi-command.md | 2 +- 9 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 .changeset/add-lowercase-continue-shorthand.md diff --git a/.changeset/add-lowercase-continue-shorthand.md b/.changeset/add-lowercase-continue-shorthand.md new file mode 100644 index 000000000..179c1c3c4 --- /dev/null +++ b/.changeset/add-lowercase-continue-shorthand.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Add `-c` as a shorthand for `--continue`. diff --git a/apps/kimi-code/src/cli/commands.ts b/apps/kimi-code/src/cli/commands.ts index 3614eb217..2ca5dadd7 100644 --- a/apps/kimi-code/src/cli/commands.ts +++ b/apps/kimi-code/src/cli/commands.ts @@ -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, diff --git a/apps/kimi-code/test/cli/options.test.ts b/apps/kimi-code/test/cli/options.test.ts index ad46d5dde..c82281932 100644 --- a/apps/kimi-code/test/cli/options.test.ts +++ b/apps/kimi-code/test/cli/options.test.ts @@ -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); diff --git a/docs/en/configuration/overrides.md b/docs/en/configuration/overrides.md index f217e1f59..0e7e34ca9 100644 --- a/docs/en/configuration/overrides.md +++ b/docs/en/configuration/overrides.md @@ -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 ` | Use a specific model alias for this session | diff --git a/docs/en/guides/getting-started.md b/docs/en/guides/getting-started.md index d2ee52a6b..7a1dddda4 100644 --- a/docs/en/guides/getting-started.md +++ b/docs/en/guides/getting-started.md @@ -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: diff --git a/docs/en/reference/kimi-command.md b/docs/en/reference/kimi-command.md index cc38781b7..54b139a0c 100644 --- a/docs/en/reference/kimi-command.md +++ b/docs/en/reference/kimi-command.md @@ -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 ` | `-m` | Specify a model alias for this launch. When omitted, new sessions use `default_model` from the config file | | `--prompt ` | `-p` | Run a single prompt non-interactively and stream the Assistant output to stdout. This mode does not open the TUI | | `--output-format ` | | Set the non-interactive output format; supports `text` and `stream-json`. Can only be used with `--prompt`; defaults to `text` | diff --git a/docs/zh/configuration/overrides.md b/docs/zh/configuration/overrides.md index 8bb7a511f..92eb0b138 100644 --- a/docs/zh/configuration/overrides.md +++ b/docs/zh/configuration/overrides.md @@ -54,7 +54,7 @@ Kimi Code CLI 有三个地方可以影响运行参数:配置文件、命令行 | 选项 | 作用 | | --- | --- | | `-S, --session [id]` | 恢复指定会话;不带 id 时进入交互式选择 | -| `-C, --continue` | 续上当前目录的上一次会话 | +| `-c, --continue` | 续上当前目录的上一次会话 | | `-y, --yolo` | 自动批准所有工具调用 | | `--plan` | 以 Plan 模式启动 | | `-m, --model ` | 指定本次使用的模型别名 | diff --git a/docs/zh/guides/getting-started.md b/docs/zh/guides/getting-started.md index 229bde7db..c2e0e75e2 100644 --- a/docs/zh/guides/getting-started.md +++ b/docs/zh/guides/getting-started.md @@ -88,10 +88,10 @@ kimi kimi -p "帮我看一下这个项目的目录结构" ``` -继续上一次会话加 `-C`: +继续上一次会话加 `-c`: ```sh -kimi -C +kimi -c ``` 首次启动时需要配置 API 来源。在交互界面中输入 `/login` 进入登录流程: diff --git a/docs/zh/reference/kimi-command.md b/docs/zh/reference/kimi-command.md index 5cec0fa35..b410844d8 100644 --- a/docs/zh/reference/kimi-command.md +++ b/docs/zh/reference/kimi-command.md @@ -16,7 +16,7 @@ kimi [options] | `--version` | `-V` | 打印版本号并退出 | | `--help` | `-h` | 显示帮助信息并退出 | | `--session [id]` | `-S` | 恢复一个会话。带 ID 时直接打开指定会话;不带 ID 时进入交互式选择器 | -| `--continue` | `-C` | 继续当前工作目录下最近一次的会话,无需手动指定 ID | +| `--continue` | `-c` | 继续当前工作目录下最近一次的会话,无需手动指定 ID | | `--model ` | `-m` | 为本次启动指定模型别名。省略时新会话使用配置文件中的 `default_model` | | `--prompt ` | `-p` | 非交互执行单次 prompt,并把 Assistant 输出流式写到 stdout。该模式不会打开 TUI | | `--output-format ` | | 设置非交互输出格式,支持 `text` 与 `stream-json`。仅可与 `--prompt` 一起使用,默认 `text` |