feat(cli): add update alias for upgrade command (#1125)

Register a `kimi update` alias for the existing `kimi upgrade` command via commander's .alias(), so both forms run the same upgrade flow. Document the alias in the command reference and add a routing test.
This commit is contained in:
Kai 2026-06-26 16:48:45 +08:00 committed by GitHub
parent e736349a7c
commit e9a3b7c83a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 32 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---
Add an `update` alias for the `kimi upgrade` command. Run `kimi update` to upgrade to the latest version.

View file

@ -96,6 +96,7 @@ export function createProgram(
registerMigrateCommand(program, onMigrate);
program
.command('upgrade')
.alias('update')
.description('Upgrade Kimi Code to the latest version.')
.action(async () => {
await onUpgrade();

View file

@ -347,6 +347,30 @@ describe('CLI options parsing', () => {
expect(upgradeCalls).toBe(1);
});
it('routes update alias to the upgrade handler', () => {
let upgradeCalls = 0;
const program = createProgram(
'0.0.0',
() => {
throw new Error('main action should not run');
},
() => {},
() => {},
() => {
upgradeCalls += 1;
},
);
program.exitOverride();
program.configureOutput({
writeOut: () => {},
writeErr: () => {},
});
program.parse(['node', 'kimi', 'update']);
expect(upgradeCalls).toBe(1);
});
it('registers the visible sub-commands', () => {
const program = createProgram(
'0.0.0',

View file

@ -274,7 +274,7 @@ For full migration instructions, see [Migrating from kimi-cli](../guides/migrati
### `kimi upgrade`
Immediately check for the latest version and display an update prompt; exits after you make a selection.
Immediately check for the latest version and display an update prompt; exits after you make a selection. `kimi update` is an alias for this command.
```sh
kimi upgrade

View file

@ -274,7 +274,7 @@ kimi migrate
### `kimi upgrade`
立即检查最新版本并展示更新提示,选择操作后退出。
立即检查最新版本并展示更新提示,选择操作后退出。也可以使用别名 `kimi update`
```sh
kimi upgrade