---
tags: cli, feature
author: Oliver.W
---
# CLI Auto Update
Build the similar auto update features for users in China to allow them update the CLI automatically.
> https://github.com/serverless/serverless/blob/d0eee6a782379da3dac2c174e6b5d80f59d47eb5/lib/plugins/interactiveCli/autoUpdate.js
> https://github.com/serverless/serverless/blob/ab77a11e135ec879b3309205d8bfe010ceb68e9e/lib/utils/eventuallyUpdate.js
The auto update should be work with the following process.
## Set Auto Update Config
- After user execute the `sls`, `sls init`, `sls info`, `sls remove` commands.
- if [user has no global auto update enabled configuration]:
- Pop a question `是否开启CLI自动升级(y/n)`, and update the global update config.
- show warnning message for user to turn off the auto udpate. `你可以通过 "sls config --no-autoupdate" 来关闭自动升级`
- if [user has global auto update config]:
- pass the process.
## Auto Update
- When init the serverless instance, check the auto update config.
- if [user has no global auto update config] || [user set the global auto update to false]:
- skip the process.
- if [user has global auto update to true]:
- Do the auto update logic same to `eventuallyUpdate.js` above.
- When user send a request with a components version that not support auto update. (if we can get the CLI version info from request.)
- return a warning message ask user to udpate to the latest version. `serverless CLI 工具发布了新版本,请使用 npm i serverless -g 升级到最新版。` with `sls deploy`
- record the notification for each user, and only send the udpate message 1 time a day.
## Dev Design
## Note