mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-09 17:29:12 +00:00
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:
parent
e736349a7c
commit
e9a3b7c83a
5 changed files with 32 additions and 2 deletions
5
.changeset/add-update-alias.md
Normal file
5
.changeset/add-update-alias.md
Normal 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.
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ kimi migrate
|
|||
|
||||
### `kimi upgrade`
|
||||
|
||||
立即检查最新版本并展示更新提示,选择操作后退出。
|
||||
立即检查最新版本并展示更新提示,选择操作后退出。也可以使用别名 `kimi update`。
|
||||
|
||||
```sh
|
||||
kimi upgrade
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue