@deveco-test/deveco-code 1.10.14 → 1.10.16

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,66 +1,5 @@
1
1
  # Changelog
2
2
 
3
- ## v0.1.7 (2026-08-03)
4
-
5
- ### DevEco Code 核心
6
-
7
- #### 新特性
8
-
9
- - 地区访问策略新增 UTC+8 偏移回退与系统区域检测,扩展中国时区白名单(`bc637c8`)
10
-
11
- ### TUI 终端界面
12
-
13
- #### 缺陷修复
14
-
15
- - 修复流式编辑/写入字数统计因 JSON 转义未解码导致计数虚高(`a6e432e`)
16
- - 修复启动时布局竞争导致的偶现启动失败问题(`c17c895`)
17
-
18
- ## v0.1.6 (2026-08-01)
19
-
20
- ### DevEco Code 核心
21
-
22
- #### 新特性
23
-
24
- - 新增地区访问策略,基于时区与实名国籍限制中国大陆区域使用(`5810c71`、`2e408b5`)
25
- - 集成 Magpie 埋点:采集工具调用链路,复用端点配置,过滤非 DevEco 事件,优化归因精度与统一同意管理(`8a0413a`、`6e6043e`、`1776688`、`766509a`、`fbfd228`、`4a888ee`)
26
- - 新增 GitCode CI/CD 工作流,涵盖发版、类型检查与测试(`7df5df8`)
27
-
28
- #### 缺陷修复
29
-
30
- - 安全加固:密码采用恒定时间比对、登录 URL 防命令注入、工具参数限制为 JSON(`20e4567`、`9fb4045`、`273b7d7`)
31
-
32
- ### TUI 终端界面
33
-
34
- #### 新特性
35
-
36
- - 编辑流式输出时实时显示字数统计(`af0d72d`)
37
-
38
- #### 优化
39
-
40
- - 移除 `/btw` 命令说明文本(`c0191d1`)
41
-
42
- ## v0.1.5 (2026-07-27)
43
-
44
- ### DevEco Code 核心
45
-
46
- #### 新特性
47
-
48
- - 启动前弹出工作区信任确认,防止在不受信目录下误执行(`e4c18b6`)
49
-
50
- ### TUI 终端界面
51
-
52
- #### 新特性
53
-
54
- - 新增通知设置对话框,支持全局开关、音量调节及 6 类事件的独立音效选择(`c3f91a6`)
55
-
56
- #### 优化
57
-
58
- - 移除日志收集菜单与崩溃后自动上报弹窗(`0483e25`)
59
-
60
- #### 缺陷修复
61
-
62
- - 规范化 btw 浮层错误展示:按错误码映射 i18n 文案,修复出错时提示键误显示(`1f0e98e`)
63
-
64
3
  ## v0.1.4 (2026-07-24)
65
4
 
66
5
  ### DevEco Code 核心
package/README.md CHANGED
@@ -241,7 +241,6 @@ DevEco Code 集成了常用 HarmonyOS 开发工具能力:
241
241
  | `hdc_log` | 收集/清理设备日志/查看连接模拟器 |
242
242
  | `verify_ui` | 执行 UI 操作验证功能是否正确 |
243
243
  | `arkts_check` | ArkTS 静态语法检查 |
244
- | `arkts_knowledge_search` | HarmonyOS 知识搜索 |
245
244
  | `switch_cwd` | 切换构建项目路径 |
246
245
 
247
246
  常见场景包括:从零到一创建 HarmonyOS 工程、增量开发页面、修复编译报错、真机调试。
package/bin/deveco.exe ADDED
@@ -0,0 +1,10 @@
1
+ echo "Error: deveco-ai's postinstall script was not run." >&2
2
+ echo "" >&2
3
+ echo "This occurs when using --ignore-scripts during installation, or when using a" >&2
4
+ echo "package manager like pnpm that does not run postinstall scripts by default." >&2
5
+ echo "" >&2
6
+ echo "To fix this, run the postinstall script manually:" >&2
7
+ echo " cd node_modules/deveco-ai && node postinstall.mjs" >&2
8
+ echo "" >&2
9
+ echo "Or reinstall deveco-ai without the --ignore-scripts flag." >&2
10
+ exit 1
package/package.json CHANGED
@@ -1,13 +1,22 @@
1
1
  {
2
2
  "name": "@deveco-test/deveco-code",
3
3
  "bin": {
4
- "deveco": "./bin/deveco"
4
+ "deveco": "./bin/deveco.exe"
5
5
  },
6
6
  "scripts": {
7
- "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
7
+ "postinstall": "node ./postinstall.mjs"
8
8
  },
9
- "version": "1.10.14",
9
+ "version": "1.10.16",
10
10
  "license": "MIT",
11
+ "os": [
12
+ "darwin",
13
+ "linux",
14
+ "win32"
15
+ ],
16
+ "cpu": [
17
+ "arm64",
18
+ "x64"
19
+ ],
11
20
  "files": [
12
21
  "bin/**/*",
13
22
  "postinstall.mjs",
@@ -16,9 +25,12 @@
16
25
  "CHANGELOG.md"
17
26
  ],
18
27
  "optionalDependencies": {
19
- "@deveco-test/deveco-code-darwin-arm64": "1.10.14",
20
- "@deveco-test/deveco-code-windows-x64-baseline": "1.10.14",
21
- "@deveco-test/deveco-code-darwin-x64": "1.10.14",
22
- "@deveco-test/deveco-code-windows-x64": "1.10.14"
28
+ "@deveco-test/deveco-code-darwin-x64": "1.10.16",
29
+ "@deveco-test/deveco-code-darwin-arm64": "1.10.16",
30
+ "@deveco-test/deveco-code-windows-x64-baseline": "1.10.16",
31
+ "@deveco-test/deveco-code-windows-x64": "1.10.16"
32
+ },
33
+ "dependencies": {
34
+ "@deveco/deveco-cli": "npm:@deveco-test/deveco-cli@1.3.0-Test.12"
23
35
  }
24
36
  }
package/postinstall.mjs CHANGED
@@ -28,6 +28,20 @@ const scope = packageJson.name && packageJson.name.includes("/") ? packageJson.n
28
28
  const base = `${scope}/deveco-code-${platform}-${arch}`
29
29
  const sourceBinary = platform === "windows" ? "deveco.exe" : "deveco"
30
30
  const targetBinary = path.join(__dirname, "bin", "deveco.exe")
31
+ const devecoCliEntryMarker = path.join(__dirname, "vendor", ".deveco-cli-entry")
32
+ const devecoCliPackageName = "@deveco/deveco-cli"
33
+
34
+ function resolveLocalDevecoCliEntry() {
35
+ const packageJsonPath = require.resolve(`${devecoCliPackageName}/package.json`)
36
+ const entry = path.join(path.dirname(packageJsonPath), "dist", "cli.js")
37
+ if (fs.existsSync(entry)) return entry
38
+ throw new Error(`Local dependency "${devecoCliPackageName}" has no CLI entry at ${entry}.`)
39
+ }
40
+
41
+ function writeDevecoCliEntryMarker() {
42
+ fs.mkdirSync(path.dirname(devecoCliEntryMarker), { recursive: true })
43
+ fs.writeFileSync(devecoCliEntryMarker, `${resolveLocalDevecoCliEntry()}\n`, "utf8")
44
+ }
31
45
 
32
46
  function supportsAvx2() {
33
47
  if (arch !== "x64") return false
@@ -137,6 +151,9 @@ function copyDir(src, dst) {
137
151
  copyDir(srcPath, dstPath)
138
152
  } else {
139
153
  fs.copyFileSync(srcPath, dstPath)
154
+ if (process.platform !== "win32") {
155
+ fs.chmodSync(dstPath, fs.statSync(srcPath).mode)
156
+ }
140
157
  }
141
158
  }
142
159
  }
@@ -146,6 +163,41 @@ function copyVendor(packageDir) {
146
163
  const vendorDst = path.join(__dirname, "vendor")
147
164
  if (fs.existsSync(vendorSrc)) {
148
165
  copyDir(vendorSrc, vendorDst)
166
+ // Windows packs often drop Unix +x; force it back on macOS/Linux install.
167
+ ensureVendorExecutables(vendorDst)
168
+ ensureVendorExecutables(path.join(packageDir, "vendor"))
169
+ }
170
+ }
171
+
172
+ /** Restore execute bits lost when packages are built/published from Windows. */
173
+ function ensureVendorExecutables(vendorRoot) {
174
+ if (process.platform === "win32" || !fs.existsSync(vendorRoot)) return
175
+
176
+ const stack = [vendorRoot]
177
+ while (stack.length > 0) {
178
+ const dir = stack.pop()
179
+ let entries
180
+ try {
181
+ entries = fs.readdirSync(dir, { withFileTypes: true })
182
+ } catch {
183
+ continue
184
+ }
185
+ for (const entry of entries) {
186
+ const full = path.join(dir, entry.name)
187
+ if (entry.isDirectory()) {
188
+ stack.push(full)
189
+ continue
190
+ }
191
+ if (!entry.isFile()) continue
192
+ // Top-level vendor/ripgrep/rg and nested @vscode/ripgrep*/**/rg
193
+ if (entry.name === "rg") {
194
+ try {
195
+ fs.chmodSync(full, 0o755)
196
+ } catch {
197
+ // Best-effort; ignore files we cannot chmod.
198
+ }
199
+ }
200
+ }
149
201
  }
150
202
  }
151
203
 
@@ -192,6 +244,8 @@ function verifyBinary() {
192
244
  }
193
245
 
194
246
  function main() {
247
+ writeDevecoCliEntryMarker()
248
+
195
249
  for (const name of packageNames()) {
196
250
  try {
197
251
  copyBinary(resolveBinary(name), targetBinary)
package/bin/deveco DELETED
@@ -1,206 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const childProcess = require("child_process")
4
- const fs = require("fs")
5
- const path = require("path")
6
- const os = require("os")
7
-
8
- const forwardedSignals = ["SIGINT", "SIGTERM", "SIGHUP"]
9
-
10
- function run(target) {
11
- const child = childProcess.spawn(target, process.argv.slice(2), {
12
- stdio: "inherit",
13
- })
14
-
15
- child.on("error", (error) => {
16
- console.error(error.message)
17
- process.exit(1)
18
- })
19
-
20
- const forwarders = {}
21
- for (const signal of forwardedSignals) {
22
- forwarders[signal] = () => {
23
- try {
24
- child.kill(signal)
25
- } catch {
26
- // The child may have already exited.
27
- }
28
- }
29
- process.on(signal, forwarders[signal])
30
- }
31
-
32
- child.on("exit", (code, signal) => {
33
- for (const forwardedSignal of forwardedSignals) {
34
- process.removeListener(forwardedSignal, forwarders[forwardedSignal])
35
- }
36
-
37
- if (signal) {
38
- process.kill(process.pid, signal)
39
- return
40
- }
41
-
42
- process.exit(typeof code === "number" ? code : 0)
43
- })
44
- }
45
-
46
- const envPath = process.env.DEVECO_BIN_PATH
47
-
48
- const scriptPath = fs.realpathSync(__filename)
49
- const scriptDir = path.dirname(scriptPath)
50
-
51
- //
52
- const cached = path.join(scriptDir, ".deveco")
53
-
54
- const platformMap = {
55
- darwin: "darwin",
56
- linux: "linux",
57
- win32: "windows",
58
- }
59
- const archMap = {
60
- x64: "x64",
61
- arm64: "arm64",
62
- arm: "arm",
63
- }
64
-
65
- let platform = platformMap[os.platform()]
66
- if (!platform) {
67
- platform = os.platform()
68
- }
69
- let arch = archMap[os.arch()]
70
- if (!arch) {
71
- arch = os.arch()
72
- }
73
- let mainPkg = {}
74
- try {
75
- mainPkg = JSON.parse(fs.readFileSync(path.join(scriptDir, "..", "package.json"), "utf8"))
76
- } catch {
77
- // dev mode or missing package.json
78
- }
79
- const scope = mainPkg.name && mainPkg.name.includes("/") ? mainPkg.name.split("/")[0] : "@deveco"
80
- const base = scope + "/deveco-code-" + platform + "-" + arch
81
- const binary = platform === "windows" ? "deveco.exe" : "deveco"
82
-
83
- function supportsAvx2() {
84
- if (arch !== "x64") return false
85
-
86
- if (platform === "linux") {
87
- try {
88
- return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
89
- } catch {
90
- return false
91
- }
92
- }
93
-
94
- if (platform === "darwin") {
95
- try {
96
- const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
97
- encoding: "utf8",
98
- timeout: 1500,
99
- })
100
- if (result.status !== 0) return false
101
- return (result.stdout || "").trim() === "1"
102
- } catch {
103
- return false
104
- }
105
- }
106
-
107
- if (platform === "windows") {
108
- const cmd =
109
- '(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
110
-
111
- for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
112
- try {
113
- const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
114
- encoding: "utf8",
115
- timeout: 3000,
116
- windowsHide: true,
117
- })
118
- if (result.status !== 0) continue
119
- const out = (result.stdout || "").trim().toLowerCase()
120
- if (out === "true" || out === "1") return true
121
- if (out === "false" || out === "0") return false
122
- } catch {
123
- continue
124
- }
125
- }
126
-
127
- return false
128
- }
129
-
130
- return false
131
- }
132
-
133
- const names = (() => {
134
- const avx2 = supportsAvx2()
135
- const baseline = arch === "x64" && !avx2
136
-
137
- if (platform === "linux") {
138
- const musl = (() => {
139
- try {
140
- if (fs.existsSync("/etc/alpine-release")) return true
141
- } catch {
142
- // ignore
143
- }
144
-
145
- try {
146
- const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
147
- const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
148
- if (text.includes("musl")) return true
149
- } catch {
150
- // ignore
151
- }
152
-
153
- return false
154
- })()
155
-
156
- if (musl) {
157
- if (arch === "x64") {
158
- if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
159
- return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
160
- }
161
- return [`${base}-musl`, base]
162
- }
163
-
164
- if (arch === "x64") {
165
- if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
166
- return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
167
- }
168
- return [base, `${base}-musl`]
169
- }
170
-
171
- if (arch === "x64") {
172
- if (baseline) return [`${base}-baseline`, base]
173
- return [base, `${base}-baseline`]
174
- }
175
- return [base]
176
- })()
177
-
178
- function findBinary(startDir) {
179
- let current = startDir
180
- for (;;) {
181
- const modules = path.join(current, "node_modules")
182
- if (fs.existsSync(modules)) {
183
- for (const name of names) {
184
- const candidate = path.join(modules, name, "bin", binary)
185
- if (fs.existsSync(candidate)) return candidate
186
- }
187
- }
188
- const parent = path.dirname(current)
189
- if (parent === current) {
190
- return
191
- }
192
- current = parent
193
- }
194
- }
195
-
196
- const resolved = envPath || (fs.existsSync(cached) ? cached : findBinary(scriptDir))
197
- if (!resolved) {
198
- console.error(
199
- "It seems that your package manager failed to install the right version of the deveco CLI for your platform. You can try manually installing " +
200
- names.map((n) => `\"${n}\"`).join(" or ") +
201
- " package",
202
- )
203
- process.exit(1)
204
- }
205
-
206
- run(resolved)