@cloudbase/cli 2.9.8 → 2.9.10-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/bin/cloudbase.js +2 -1
  2. package/bin/tcb.js +35 -28
  3. package/cloudbase-cli-2.7.8.tgz +0 -0
  4. package/lib/auth/login.js +21 -13
  5. package/lib/commands/account/login.js +43 -42
  6. package/lib/commands/account/logout.js +3 -2
  7. package/lib/commands/ai/index.js +13 -12
  8. package/lib/commands/cloudfunction/base.js +24 -26
  9. package/lib/commands/cloudrun/base.js +87 -96
  10. package/lib/commands/common.js +11 -10
  11. package/lib/commands/config/delete.js +72 -0
  12. package/lib/commands/config/get.js +69 -0
  13. package/lib/commands/config/index.js +21 -0
  14. package/lib/commands/config/interface.js +24 -0
  15. package/lib/commands/config/list.js +72 -0
  16. package/lib/commands/config/set.js +89 -0
  17. package/lib/commands/db/base.js +33 -32
  18. package/lib/commands/env/base.js +12 -11
  19. package/lib/commands/env/domain.js +24 -23
  20. package/lib/commands/env/login.js +31 -30
  21. package/lib/commands/fun/base.js +37 -36
  22. package/lib/commands/functions/alias/getRoute.js +5 -4
  23. package/lib/commands/functions/alias/setRoute.js +7 -6
  24. package/lib/commands/functions/code-download.js +15 -11
  25. package/lib/commands/functions/code-update.js +8 -7
  26. package/lib/commands/functions/concurrency/delete.js +5 -4
  27. package/lib/commands/functions/concurrency/list.js +6 -5
  28. package/lib/commands/functions/concurrency/set.js +5 -4
  29. package/lib/commands/functions/config-update.js +8 -7
  30. package/lib/commands/functions/copy.js +7 -6
  31. package/lib/commands/functions/delete.js +8 -7
  32. package/lib/commands/functions/deploy.js +35 -34
  33. package/lib/commands/functions/detail.js +32 -31
  34. package/lib/commands/functions/invoke.js +16 -15
  35. package/lib/commands/functions/layer/bind.js +26 -25
  36. package/lib/commands/functions/layer/common.js +2 -1
  37. package/lib/commands/functions/layer/create.js +7 -6
  38. package/lib/commands/functions/layer/delete.js +9 -8
  39. package/lib/commands/functions/layer/download.js +10 -9
  40. package/lib/commands/functions/layer/list.js +10 -9
  41. package/lib/commands/functions/layer/sort.js +9 -8
  42. package/lib/commands/functions/list.js +9 -8
  43. package/lib/commands/functions/log.js +28 -27
  44. package/lib/commands/functions/run.js +21 -20
  45. package/lib/commands/functions/trigger-create.js +9 -8
  46. package/lib/commands/functions/trigger-delete.js +10 -9
  47. package/lib/commands/functions/version/list.js +9 -8
  48. package/lib/commands/functions/version/publish.js +5 -4
  49. package/lib/commands/gateway/create.js +14 -13
  50. package/lib/commands/gateway/delete.js +10 -9
  51. package/lib/commands/gateway/domain.js +25 -24
  52. package/lib/commands/gateway/list.js +11 -10
  53. package/lib/commands/gateway/switch.js +22 -19
  54. package/lib/commands/helpers/init.js +38 -37
  55. package/lib/commands/helpers/new.js +7 -6
  56. package/lib/commands/helpers/open.js +7 -6
  57. package/lib/commands/hosting/hosting.js +45 -44
  58. package/lib/commands/index.js +1 -0
  59. package/lib/commands/pull/pull.js +12 -11
  60. package/lib/commands/run/delete.js +16 -15
  61. package/lib/commands/run/image/common.js +2 -1
  62. package/lib/commands/run/image/delete.js +10 -9
  63. package/lib/commands/run/image/download.js +8 -7
  64. package/lib/commands/run/image/list.js +11 -10
  65. package/lib/commands/run/image/upload.js +9 -8
  66. package/lib/commands/run/list.js +10 -9
  67. package/lib/commands/run/service/config.js +13 -12
  68. package/lib/commands/run/service/deploy.js +24 -23
  69. package/lib/commands/run/service/list.js +10 -9
  70. package/lib/commands/run/service/update.js +22 -21
  71. package/lib/commands/run/standalonegateway/common.js +2 -1
  72. package/lib/commands/run/standalonegateway/create.js +14 -13
  73. package/lib/commands/run/standalonegateway/destroy.js +9 -8
  74. package/lib/commands/run/standalonegateway/list.js +7 -6
  75. package/lib/commands/run/standalonegateway/package.js +7 -6
  76. package/lib/commands/run/standalonegateway/turn.js +10 -9
  77. package/lib/commands/run/version/common.js +2 -1
  78. package/lib/commands/run/version/create.js +41 -40
  79. package/lib/commands/run/version/delete.js +10 -9
  80. package/lib/commands/run/version/list.js +13 -12
  81. package/lib/commands/run/version/modify.js +13 -12
  82. package/lib/commands/run/version/update.js +57 -54
  83. package/lib/commands/runf/base.js +42 -40
  84. package/lib/commands/self-update.js +11 -10
  85. package/lib/commands/smart.js +5 -4
  86. package/lib/commands/storage/storage.js +61 -56
  87. package/lib/commands/third/thirdAttach.js +6 -5
  88. package/lib/commands/utils.js +8 -5
  89. package/lib/constant.js +18 -17
  90. package/lib/decorators/deprecate.js +2 -1
  91. package/lib/function/alias.js +3 -2
  92. package/lib/function/base.js +9 -8
  93. package/lib/function/concurrency.js +4 -3
  94. package/lib/function/create.js +5 -4
  95. package/lib/function/delete.js +2 -1
  96. package/lib/function/layer/attach.js +2 -1
  97. package/lib/function/layer/create.js +2 -1
  98. package/lib/function/layer/download.js +2 -1
  99. package/lib/function/trigger.js +6 -5
  100. package/lib/function/update.js +3 -2
  101. package/lib/function/version.js +3 -2
  102. package/lib/help.js +22 -20
  103. package/lib/hosting.js +18 -17
  104. package/lib/i18n/index.js +81 -0
  105. package/lib/run/service/common.js +14 -13
  106. package/lib/run/service/config.js +4 -3
  107. package/lib/run/service/deployPackage.js +6 -5
  108. package/lib/run/service/showLogs.js +3 -2
  109. package/lib/run/service/update.js +7 -6
  110. package/lib/run/standalonegateway/list.js +5 -1
  111. package/lib/storage.js +2 -1
  112. package/lib/utils/ai/banner.js +12 -11
  113. package/lib/utils/ai/claudeWindows.js +5 -3
  114. package/lib/utils/ai/config.js +3 -2
  115. package/lib/utils/ai/const.js +4 -3
  116. package/lib/utils/ai/env.js +3 -2
  117. package/lib/utils/ai/envLocalManager.js +6 -5
  118. package/lib/utils/ai/nodeVersion.js +5 -1
  119. package/lib/utils/ai/router.js +129 -106
  120. package/lib/utils/ai/setup.js +95 -91
  121. package/lib/utils/checkTcbrEnv.js +22 -21
  122. package/lib/utils/cli-table.js +2 -1
  123. package/lib/utils/commonParamsCheck.js +4 -3
  124. package/lib/utils/debug-logger.js +2 -1
  125. package/lib/utils/dts.js +4 -3
  126. package/lib/utils/env.js +23 -21
  127. package/lib/utils/fs/index.js +5 -4
  128. package/lib/utils/function-packer.js +3 -2
  129. package/lib/utils/index.js +1 -0
  130. package/lib/utils/mcp-config-modifier.js +18 -17
  131. package/lib/utils/net/cloud-api-request.js +2 -1
  132. package/lib/utils/net/credential.js +2 -1
  133. package/lib/utils/net/http-request.js +2 -1
  134. package/lib/utils/progress-bar.js +2 -1
  135. package/lib/utils/prompt/select.js +8 -6
  136. package/lib/utils/store/auth.js +3 -2
  137. package/lib/utils/store/config.js +49 -0
  138. package/lib/utils/store/db.js +5 -0
  139. package/lib/utils/store/index.js +1 -1
  140. package/lib/utils/tcbrApi/callTcbrApi.js +2 -1
  141. package/lib/utils/template-manager.js +37 -36
  142. package/lib/utils/template.js +10 -9
  143. package/lib/utils/tools/common.js +3 -2
  144. package/lib/utils/url.js +19 -0
  145. package/lib/utils/validator.js +12 -4
  146. package/locales/README.md +160 -0
  147. package/locales/i18next-scanner.config.js +206 -0
  148. package/locales/langs/en.json +1235 -0
  149. package/locales/langs/zh.json +1235 -0
  150. package/locales/mapping.json +1235 -0
  151. package/package.json +10 -3
  152. package/types/commands/config/delete.d.ts +13 -0
  153. package/types/commands/config/get.d.ts +13 -0
  154. package/types/commands/config/index.d.ts +5 -0
  155. package/types/commands/config/interface.d.ts +17 -0
  156. package/types/commands/config/list.d.ts +13 -0
  157. package/types/commands/config/set.d.ts +13 -0
  158. package/types/commands/index.d.ts +1 -0
  159. package/types/i18n/index.d.ts +3 -0
  160. package/types/utils/ai/const.d.ts +1 -1
  161. package/types/utils/index.d.ts +1 -0
  162. package/types/utils/store/config.d.ts +8 -0
  163. package/types/utils/store/db.d.ts +2 -0
  164. package/types/utils/store/index.d.ts +1 -1
  165. package/types/utils/url.d.ts +18 -0
  166. package/dist/standalone/ccr.js +0 -78668
  167. package/dist/standalone/cli.js +0 -626422
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cli",
3
- "version": "2.9.8",
3
+ "version": "2.9.10-beta.0",
4
4
  "description": "cli tool for cloudbase",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -27,7 +27,9 @@
27
27
  "package:windows-x64": "OS=windows ARCH=x64 VERSION= node -e \"require('child_process').execSync('bash build/scripts/package.sh',{stdio:'inherit'})\"",
28
28
  "package:windows-arm64": "OS=windows ARCH=arm64 VERSION= node -e \"require('child_process').execSync('bash build/scripts/package.sh',{stdio:'inherit'})\"",
29
29
  "package:windows-all": "npm run -s node:fetch:win-x64 && npm run -s node:fetch:win-arm64 && npm run -s package:windows-x64 && npm run -s package:windows-arm64",
30
- "out:prune": "bash build/scripts/prune-out.sh"
30
+ "out:prune": "bash build/scripts/prune-out.sh",
31
+ "i18n:scan": "i18next-scanner --config locales/i18next-scanner.config.js && node locales/scripts/generate.js",
32
+ "i18n:sync": "node locales/scripts/sync.js sync"
31
33
  },
32
34
  "repository": {
33
35
  "type": "git",
@@ -53,7 +55,7 @@
53
55
  "@cloudbase/functions-framework": "1.16.0",
54
56
  "@cloudbase/iac-core": "0.0.3-alpha.11",
55
57
  "@cloudbase/lowcode-cli": "^0.22.2",
56
- "@cloudbase/manager-node": "4.6.3",
58
+ "@cloudbase/manager-node": "4.6.4",
57
59
  "@cloudbase/toolbox": "^0.7.9",
58
60
  "@dotenvx/dotenvx": "^1.48.3",
59
61
  "@musistudio/claude-code-router": "1.0.36",
@@ -82,6 +84,7 @@
82
84
  "npm": "^11.5.2",
83
85
  "open": "^7.0.0",
84
86
  "ora": "^4.0.2",
87
+ "os-locale": "5.0.0",
85
88
  "patch-package": "^8.0.0",
86
89
  "portfinder": "^1.0.28",
87
90
  "progress": "^2.0.3",
@@ -100,6 +103,9 @@
100
103
  "zod": "^4.0.13"
101
104
  },
102
105
  "devDependencies": {
106
+ "@babel/parser": "^7.28.4",
107
+ "@babel/traverse": "^7.28.4",
108
+ "@babel/types": "^7.28.4",
103
109
  "@types/fs-extra": "^11.0.4",
104
110
  "@types/jest": "^27",
105
111
  "@types/koa__router": "^8.0.11",
@@ -116,6 +122,7 @@
116
122
  "eslint": "^7.14.0",
117
123
  "eslint-config-alloy": "^3.8.2",
118
124
  "husky": "^3.0.9",
125
+ "i18next-scanner": "^4.6.0",
119
126
  "jest": "^27",
120
127
  "rimraf": "^3.0.2",
121
128
  "ts-jest": "^27",
@@ -0,0 +1,13 @@
1
+ import { Command } from '../common';
2
+ import { Logger } from '../../decorators';
3
+ export declare class ConfigDeleteCommand extends Command {
4
+ get options(): {
5
+ cmd: string;
6
+ childCmd: string;
7
+ options: any[];
8
+ desc: string;
9
+ requiredEnvId: boolean;
10
+ withoutAuth: boolean;
11
+ };
12
+ execute(params: any[], log: Logger): Promise<void>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { Command } from '../common';
2
+ import { Logger } from '../../decorators';
3
+ export declare class ConfigGetCommand extends Command {
4
+ get options(): {
5
+ cmd: string;
6
+ childCmd: string;
7
+ options: any[];
8
+ desc: string;
9
+ requiredEnvId: boolean;
10
+ withoutAuth: boolean;
11
+ };
12
+ execute(params: any[], log: Logger): Promise<void>;
13
+ }
@@ -0,0 +1,5 @@
1
+ export * from './set';
2
+ export * from './get';
3
+ export * from './delete';
4
+ export * from './list';
5
+ export * from './interface';
@@ -0,0 +1,17 @@
1
+ export type IConfigItem = {
2
+ key: string;
3
+ description?: string;
4
+ envKey?: string;
5
+ } & ({
6
+ type: 'string';
7
+ value: string;
8
+ } | {
9
+ type: 'number';
10
+ value: number;
11
+ } | {
12
+ type: 'boolean';
13
+ value: boolean;
14
+ });
15
+ export declare const CONFIGS: Record<string, IConfigItem>;
16
+ export declare const DEFAULT_CONFIGS: any;
17
+ export type ConfigAction = 'set' | 'get' | 'delete' | 'list';
@@ -0,0 +1,13 @@
1
+ import { Command } from '../common';
2
+ import { Logger } from '../../decorators';
3
+ export declare class ConfigListCommand extends Command {
4
+ get options(): {
5
+ cmd: string;
6
+ childCmd: string;
7
+ options: any[];
8
+ desc: string;
9
+ requiredEnvId: boolean;
10
+ withoutAuth: boolean;
11
+ };
12
+ execute(log: Logger): Promise<void>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { Command } from '../common';
2
+ import { Logger } from '../../decorators';
3
+ export declare class ConfigSetCommand extends Command {
4
+ get options(): {
5
+ cmd: string;
6
+ childCmd: string;
7
+ options: any[];
8
+ desc: string;
9
+ requiredEnvId: boolean;
10
+ withoutAuth: boolean;
11
+ };
12
+ execute(params: any[], log: Logger): Promise<void>;
13
+ }
@@ -19,3 +19,4 @@ export * from './cloudrun';
19
19
  export * from './ai';
20
20
  export * from './pull';
21
21
  export * from './self-update';
22
+ export * from './config';
@@ -0,0 +1,3 @@
1
+ export declare function t(key: string, options?: any): string;
2
+ export declare function getLanguage(): "zh" | "en";
3
+ export declare function isIntl(): boolean;
@@ -398,4 +398,4 @@ export declare const BASE_URL_MODEL_MAPPING: {
398
398
  };
399
399
  export declare function getDefaultModelByBaseUrl(baseUrl: string): string;
400
400
  export declare function getBooleanHint(defaultValue?: boolean): string;
401
- export declare const LIST_HINT = "\u4F7F\u7528\u4E0A\u4E0B\u952E\u9009\u62E9\uFF0C\u6309\u4E0B Enter \u952E\u786E\u8BA4\u9009\u9879";
401
+ export declare const LIST_HINT: string;
@@ -16,6 +16,7 @@ export * from './auth';
16
16
  export * from './store';
17
17
  export * from './notice';
18
18
  export * from './parallel';
19
+ export * from './url';
19
20
  export * from './tcbrApi';
20
21
  export * from './checkTcbrEnv';
21
22
  export * from './commonParamsCheck';
@@ -0,0 +1,8 @@
1
+ import { LocalStore } from './db';
2
+ declare class ConfigStore extends LocalStore {
3
+ constructor();
4
+ get(key: string): Promise<any>;
5
+ getSync(key: string): any;
6
+ }
7
+ export declare const configStore: ConfigStore;
8
+ export {};
@@ -4,10 +4,12 @@ export declare function getAsyncDB(file: string): Promise<low.LowdbAsync<any>>;
4
4
  export declare function getSyncDB(file: string): low.LowdbSync<any>;
5
5
  export declare class LocalStore {
6
6
  db: any;
7
+ dbSync: low.LowdbSync<any>;
7
8
  dbKey: string;
8
9
  defaults: any;
9
10
  constructor(defaults: any, dbKey?: string);
10
11
  getDB(): Promise<any>;
12
+ getSyncDB(): low.LowdbSync<any>;
11
13
  get(key: string): Promise<any>;
12
14
  set(key: string, value: any): Promise<void>;
13
15
  push(key: string, value: any): Promise<void>;
@@ -1,5 +1,5 @@
1
- export * from './auth';
2
1
  export * from './db';
2
+ export * from './config';
3
3
  export * from './auth';
4
4
  export * from './usage';
5
5
  export * from './common';
@@ -0,0 +1,18 @@
1
+ export declare const EDomain: {
2
+ readonly Console: "console.tencentcloud.com" | "console.cloud.tencent.com";
3
+ readonly Official: "www.tencentcloud.com" | "cloud.tencent.com";
4
+ readonly Gateway: "api.intl.tcloudbasegateway.com" | "api.tcloudbasegateway.com";
5
+ readonly Tcb: "tcb.tencentcloud.com" | "tcb.cloud.tencent.com";
6
+ readonly Docs: "docs.cloudbase.net";
7
+ };
8
+ export declare const EUrl: {
9
+ readonly Docs: string;
10
+ readonly DevPlatform: "https://tcb.cloud.tencent.com/dev" | "https://tcb.tencentcloud.com/dev";
11
+ readonly TcbConsole: "https://console.tencentcloud.com/tcb" | "https://console.cloud.tencent.com/tcb";
12
+ readonly CloudAdmin: "https://tcb.tencentcloud.com/cloud-admin" | "https://tcb.cloud.tencent.com/cloud-admin";
13
+ readonly Console: "https://console.tencentcloud.com" | "https://console.cloud.tencent.com";
14
+ readonly Official: "https://www.tencentcloud.com" | "https://cloud.tencent.com";
15
+ readonly Gateway: "https://api.intl.tcloudbasegateway.com" | "https://api.tcloudbasegateway.com";
16
+ readonly Tcb: "https://tcb.tencentcloud.com" | "https://tcb.cloud.tencent.com";
17
+ };
18
+ export declare function getGatewayUrl(envId: string): `https://${string}.api.intl.tcloudbasegateway.com` | `https://${string}.api.tcloudbasegateway.com`;