@lazycatcloud/lzc-cli 1.3.9 → 1.3.11

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.
package/changelog.md CHANGED
@@ -1,92 +1,108 @@
1
- # 1.3.9
1
+ # Changelog
2
+
3
+ ## [1.3.11](https://gitee.com/linakesi/lzc-cli/compare/v1.3.10...v1.3.11) (2025-10-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * support setting token through environment variables ([4a25f84](https://gitee.com/linakesi/lzc-cli/commits/4a25f84fe4df938cb3d85f6391e27772dae5b071))
9
+ * the copy-image command adds the `trace-level` parameter ([cd4d4c3](https://gitee.com/linakesi/lzc-cli/commits/cd4d4c351d4bd43bffcfe5f67087c6bffd65d3f4))
10
+
11
+ ## [1.3.10](https://gitee.com/linakesi/lzc-cli/compare/v0.0.8...v1.3.10) (2025-08-15)
12
+
13
+ ### Bug Fixes
14
+
15
+ - `copy-image --arch` attributes are changed to optional values ([d9bfd45](https://gitee.com/linakesi/lzc-cli/commits/d9bfd45e78d24303e6e225b85bb08cba9e5a9c78))
16
+
17
+ ## 1.3.9
2
18
 
3
19
  1. copy-image 支持 `arch` 参数
4
20
 
5
- # 1.3.8
21
+ ## 1.3.8
6
22
 
7
23
  1. 修复hellowrold路由路径不对
8
24
 
9
- # 1.3.7
25
+ ## 1.3.7
10
26
 
11
27
  1. 修复错误的 lzc-manifest 字段读取匹配
12
28
 
13
- # 1.3.6
29
+ ## 1.3.6
14
30
 
15
31
  1. 处理创建的应用模板 `routes` 字段命名错误问题
16
32
  2. 支持 lzc-manifest 模板语法解析
17
33
  3. 调整开发者 ssh key 授权用户提示文案
18
34
 
19
- # 1.3.5
35
+ ## 1.3.5
20
36
 
21
37
  1. 支持自定义的公钥
22
38
 
23
- # 1.3.4
39
+ ## 1.3.4
24
40
 
25
41
  1. 添加算力舱和浏览器插件打包
26
42
 
27
- # 1.3.3
43
+ ## 1.3.3
28
44
 
29
45
  1. 拷贝镜像过程中显示进度
30
46
  2. 支持查看已经拷贝的镜像记录
31
47
 
32
- # 1.3.2
48
+ ## 1.3.2
33
49
 
34
50
  1. 增加用户友好的上传 LPK 错误提示
35
51
 
36
- # 1.3.1
52
+ ## 1.3.1
37
53
 
38
54
  1. 升级 lzc-cli 1.3.1 版本
39
55
 
40
- # 1.2.65
56
+ ## 1.2.65
41
57
 
42
58
  1. 适配新版本开发者平台接口
43
59
 
44
- # 1.2.64
60
+ ## 1.2.64
45
61
 
46
62
  1. 升级 dozzle,支持查看所有容器日志
47
63
  2. 修复 devshell ssh 多路复用错误
48
64
 
49
- # 1.2.63
65
+ ## 1.2.63
50
66
 
51
67
  1. 处理开发者账号无法登陆问题
52
68
 
53
- # 1.2.62
69
+ ## 1.2.62
54
70
 
55
71
  1. 修复部分 windows 机器无法登陆开发者账号问题
56
72
 
57
- # 1.2.61
73
+ ## 1.2.61
58
74
 
59
75
  1. 修复 lzc-build 文件配置 `compose.override` 字段不生效问题
60
76
 
61
- # 1.2.60
77
+ ## 1.2.60
62
78
 
63
79
  1. 添加用户登录友好提示
64
80
  2. 移除已弃用模版
65
81
  3. 支持 lzc-build 文件配置 `compose.override` 字段
66
82
 
67
- # 1.2.59
83
+ ## 1.2.59
68
84
 
69
85
  1. 修复 copy-image 网关超时
70
86
  2. 当解析 manifest 失败的时候,继续安装
71
87
  3. 修复盒子 ingress 错误的时候,获取不到本地的默认盒子
72
88
 
73
- # 1.2.58
89
+ ## 1.2.58
74
90
 
75
91
  1. 使用 127.0.0.1 替代 localhost 避免解析错误
76
92
  2. 修复最新版本检测
77
93
 
78
- # 1.2.57
94
+ ## 1.2.57
79
95
 
80
96
  1. 支持独立添加公钥到开发者工具中去 `lzc-cli box add-public-key`
81
97
  2. 支持选择使用公钥类型,不再优先使用 id_ed25519
82
98
  3. 添加 nodejs 版本检测, 要求最低版本 >=18
83
99
  4. 添加 dns 解析错误提示
84
100
 
85
- # 1.2.56
101
+ ## 1.2.56
86
102
 
87
103
  1. 修复没有写权限的lpk文件,不能通过 lzc-cli app install 安装
88
104
 
89
- # 1.2.55
105
+ ## 1.2.55
90
106
 
91
107
  1. 添加 lzc-docker 命令
92
108
  2. 添加 lzc-docker-compose 命令
@@ -95,90 +111,90 @@
95
111
  5. 修复 lzc-cli zsh/bash 补全错误
96
112
  6. 隐藏 triggerApk 错误
97
113
 
98
- # 1.2.54
114
+ ## 1.2.54
99
115
 
100
116
  1. 添加 lzc-cli docker 命令
101
117
  2. 添加 lzc-cli docker-compose 命令
102
118
  3. 修复其他同步卡顿问题
103
119
 
104
- # 1.2.53
120
+ ## 1.2.53
105
121
 
106
122
  1. 修复 devshell 模型下,环境变量中有空格导致export错误
107
123
  2. 优化生成 apk shell 错误提示
108
124
 
109
- # 1.2.52
125
+ ## 1.2.52
110
126
 
111
127
  1. appstore api 变更
112
128
 
113
- # 1.2.51
129
+ ## 1.2.51
114
130
 
115
131
  1. 添加 lzc-cli 版本信息到缓存 hash 中,当 lzc-cli 升级后,devshell 需要重新部署
116
132
 
117
- # 1.2.50
133
+ ## 1.2.50
118
134
 
119
135
  1. 添加 lzc-cli appstore copy-image <image-name> 命令
120
136
 
121
- # 1.2.49
137
+ ## 1.2.49
122
138
 
123
139
  1. 修复 nc 命令没有发现
124
140
 
125
- # 1.2.48
141
+ ## 1.2.48
126
142
 
127
143
  1. 添加 rsync 版本限制
128
144
  2. 修复触发生成 apk-shell api 变更
129
145
 
130
- # 1.2.46
146
+ ## 1.2.46
131
147
 
132
148
  1. 修复拉取构建的镜像dns错误
133
149
 
134
- # 1.2.45
150
+ ## 1.2.45
135
151
 
136
152
  1. 修复 helloworld 404 错误
137
153
 
138
- # 1.2.44
154
+ ## 1.2.44
139
155
 
140
156
  1. 修复查询状态等接口没有使用ipv6地址
141
157
  2. 修复 rsync 进程没有系统环境变量
142
158
 
143
- # 1.2.43
159
+ ## 1.2.43
144
160
 
145
161
  1. 支持通过命令行注册应用,新上架的应用不再需要通过界面配置
146
162
 
147
- # 1.2.42
163
+ ## 1.2.42
148
164
 
149
165
  1. 限制 subdomain 为空时,构建和安装失败
150
166
  2. 修复创建的模板中没有带上 .gitingore 文件
151
167
 
152
- # 1.2.41
168
+ ## 1.2.41
153
169
 
154
170
  1. 使用 rsync daemon 修复 Windows 系统下 rsync 无法使用本机原生 ssh 传输
155
171
 
156
- # 1.2.39
172
+ ## 1.2.39
157
173
 
158
174
  1. 修复 Windows 系统下,无法构建和安装问题
159
175
 
160
- # 1.2.38
176
+ ## 1.2.38
161
177
 
162
178
  1. 修复 Windows 系统下,buildscript 脚本执行错误,导致无法构建
163
179
 
164
- # 1.2.37
180
+ ## 1.2.37
165
181
 
166
182
  1. 修复 Windows 系统下,构建包时获取 LocalIP 错误
167
183
 
168
- # 1.2.34
184
+ ## 1.2.34
169
185
 
170
186
  1. devshell 模式下,默认打开后台常驻
171
187
 
172
- # 1.2.29
188
+ ## 1.2.29
173
189
 
174
190
  1. 修复开发者第一次devshelll需要填写密码,需要安装最新开发者工具(0.1.6)
175
191
  2. 调整文案,移除不必要的日志
176
192
 
177
- # 1.2.28
193
+ ## 1.2.28
178
194
 
179
195
  1. 简化创建项目流程
180
196
  2. 支持自动请求生成安卓所需要apk包
181
197
 
182
- # 1.2.27
198
+ ## 1.2.27
183
199
 
184
200
  1. 修复第一次使用开发者 `dns` 生效慢的问题
@@ -68,20 +68,39 @@ export function appstoreCommand(program) {
68
68
  }
69
69
  },
70
70
  {
71
- command: "copy-image <img> <arch>",
72
- desc: `复制镜像至懒猫微服官方源\n - <img> NAME[:TAG]\n - <arch>: 'amd64', 'arm64' [字符串] [默认值: "amd64"]`,
73
- handler: async ({ img: imageName, arch: platform }) => {
71
+ command: "copy-image <img>",
72
+ desc: `复制镜像至懒猫微服官方源`,
73
+ builder: (yargs) => {
74
+ yargs.option("arch", {
75
+ describe: "image arch 'amd64', 'arm64'",
76
+ default: "amd64",
77
+ type: "string"
78
+ })
79
+ // 出于 CI 目的增加控制是否打印进度选项
80
+ yargs.option("trace-level", {
81
+ describe: "trace level 'verbose', 'quiet'",
82
+ default: "verbose",
83
+ type: "string"
84
+ })
85
+ return yargs
86
+ },
87
+ handler: async ({ img: imageName, arch: platform, traceLevel }) => {
74
88
  const uploadUrl = `${appStoreServerUrl}/api/v3/developer/app/docker/image/push/v3/copy?image=${imageName}&platform=${platform}`
75
89
  const progressUrl = `${appStoreServerUrl}/api/v3/developer/app/docker/image/push/v3/progress?image=${imageName}&platform=${platform}`
76
- logger.info(
77
- `Waiting ... ( copy ${imageName} (${platform}) to lazycat offical registry)`
90
+
91
+ const useCI = traceLevel === "quiet"
92
+ const _logger = logger
93
+ _logger.setLevel(useCI ? _logger.levels.ERROR : _logger.levels.INFO)
94
+
95
+ _logger.info(
96
+ `Waiting ... ( copy ${imageName} (${platform}) to lazycat offical registry)`
78
97
  )
79
98
  try {
80
99
  const resp = await request(uploadUrl)
81
100
  if (resp.ok) {
82
- logger.info("uploading")
101
+ _logger.info("uploading")
83
102
  } else {
84
- logger.error("error: ", resp, await resp.text())
103
+ _logger.error("error: ", resp, await resp.text())
85
104
  return
86
105
  }
87
106
  sleep(1000)
@@ -89,6 +108,10 @@ export function appstoreCommand(program) {
89
108
  let layers = []
90
109
 
91
110
  let refreshProgress = (lys) => {
111
+ if (useCI) {
112
+ // 日志级别为 quiet 时不输出进度(用于 CI 目的)
113
+ return
114
+ }
92
115
  // 关键修改:动态回退多行
93
116
  process.stdout.write("\x1B[?25l") // 隐藏光标
94
117
  if (prevLineCount > 0) {
@@ -122,30 +145,30 @@ export function appstoreCommand(program) {
122
145
  ;(layers ? layers : [])?.forEach((v) => {
123
146
  v.progress = 100
124
147
  })
125
- refreshProgress(layers)
126
- process.stdout.write("\n")
127
148
  if (pgs.errmsg) {
128
- logger.error(
129
- "failed to copyimage ",
130
- imageName,
131
- " err:",
132
- pgs.errmsg
149
+ throw Error(
150
+ `failed to copyimage ${imageName} err: ${pgs.errmsg}`
133
151
  )
134
- break
135
152
  }
136
- logger.info("uploaded: ", pgs.lzc_image)
153
+ if (!useCI) {
154
+ refreshProgress(layers)
155
+ process.stdout.write("\n")
156
+ _logger.info("uploaded: ", pgs.lzc_image)
157
+ } else {
158
+ // 日志级别为 quiet 时仅输出结果(用于 CI 目的)
159
+ console.log(pgs.lzc_image)
160
+ }
137
161
  break
138
162
  }
139
163
  layers = pgs?.layers
140
164
  refreshProgress(layers)
141
165
  await sleep(1000)
142
166
  } else {
143
- logger.error("error: ", await resp.text())
144
- break
167
+ throw Error(`error: ${await resp.text()}`)
145
168
  }
146
169
  }
147
170
  } catch (err) {
148
- console.error(err)
171
+ _logger.error(err?.message ?? "unknown exception")
149
172
  }
150
173
  }
151
174
  },
package/lib/config/env.js CHANGED
@@ -4,6 +4,8 @@ import { ensureDir } from "../utils.js"
4
4
  import logger from "loglevel"
5
5
  import os from "node:os"
6
6
 
7
+ const _SYSTEM_ENV_PREFIX = "LZC_CLI_"
8
+
7
9
  export const GLOBAL_CONFIG_DIR = path.join(
8
10
  os.homedir(),
9
11
  "/.config/lazycat/box-config.json"
@@ -23,6 +25,11 @@ class Env {
23
25
  }
24
26
 
25
27
  get(key) {
28
+ // 优先通过环境变量获取 (支持 CI/CD)
29
+ const _env_key = `${_SYSTEM_ENV_PREFIX}${(key ?? "").toUpperCase()}`
30
+ if (process.env[_env_key]) {
31
+ return process.env[_env_key]
32
+ }
26
33
  return this.allEnv[key]
27
34
  }
28
35
 
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-cli",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "description": "lazycat cloud developer kit",
5
5
  "scripts": {
6
+ "release": "release-it patch",
6
7
  "prepublishOnly": "node check-changelog.js"
7
8
  },
8
9
  "files": [
@@ -55,8 +56,10 @@
55
56
  "yargs": "^17.7.2"
56
57
  },
57
58
  "devDependencies": {
59
+ "@release-it/conventional-changelog": "^10.0.1",
58
60
  "@types/command-exists": "^1.2.3",
59
- "prettier": "^3.3.3"
61
+ "prettier": "^3.3.3",
62
+ "release-it": "^19.0.4"
60
63
  },
61
64
  "prettier": {
62
65
  "bracketSameLine": true,
@@ -64,6 +67,24 @@
64
67
  "semi": false,
65
68
  "trailingComma": "none"
66
69
  },
70
+ "release-it": {
71
+ "git": {
72
+ "requireCleanWorkingDir": false,
73
+ "commitMessage": "chore: release v${version}",
74
+ "commit": true,
75
+ "tag": true,
76
+ "push": false
77
+ },
78
+ "npm": {
79
+ "publish": false
80
+ },
81
+ "plugins": {
82
+ "@release-it/conventional-changelog": {
83
+ "preset": "angular",
84
+ "infile": "changelog.md"
85
+ }
86
+ }
87
+ },
67
88
  "publishConfig": {
68
89
  "registry": "https://registry.npmjs.org",
69
90
  "access": "public"