@deveco-test/deveco-cli-openharmony-arm64 1.3.11-Test.1 → 1.3.12-Test.2

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/README.md CHANGED
@@ -52,7 +52,7 @@ devecocli log --level E
52
52
 
53
53
  ```bash
54
54
  devecocli docs search List
55
- devecocli docs read harmonyos-guides/application-models/arkts-page-start-overview
55
+ devecocli docs read 开发指南/harmonyos-guides/指南/NDK开发/代码开发/coding
56
56
  ```
57
57
 
58
58
  更多命令和参数可通过 `devecocli --help` 或各子命令的 `--help` 查看。
@@ -222,7 +222,7 @@ devecocli docs read <documentId>
222
222
  **示例:**
223
223
 
224
224
  ```bash
225
- devecocli docs read 开发指南/应用框架/UI_Design_Kit_UI设计套件/沉浸光感/ui-design-hds-component-material
225
+ devecocli docs read API参考/harmonyos-references/API参考/标准库/EGL/egl
226
226
  ```
227
227
 
228
228
  ### `docs catalog`
@@ -448,6 +448,8 @@ devecocli run --module <module> --device <device> --product <product> --build-mo
448
448
  | --skip-build | 可选,跳过构建操作,直接安装应用 。\*\*说明:\*\*使用该参数时,需确保对应模块已有构建产物 |
449
449
  | --apply \<fileName\> | 可选,**快速增量部署**:仅重编改动文件 → signed hqf → `bm quickfix -a -f -o` 安装 → 重启,比全量 `run` 快。`<fileName>` 是工程 `.hvigor/` 目录下的**纯文件名**(调用方把清单写到此目录,文件名做安全校验防穿越);内容为本轮改动的源文件路径清单(每行一个相对工程根路径;`#`/空行忽略;`.ets`/`.ts`/`.cpp`/资源文件;changeFileList 增量累积,只需列本轮改的,历史文件自动保留)。模块从清单路径自动识别(无需 `--module`)。**前提**:先 `devecocli run` 全量构建部署一次(生成 buildConfig.json 缓存);**没生效排查**:检查 `<module>/build/config/buildConfig.json` 有无内容(空/无 = 没跑过 `devecocli run`);**失败兜底**:直接 `devecocli run` |
450
450
 
451
+ > **说明:** 在 OpenHarmony 平台上,未指定 `--device` 时:无设备连接且 `bm`/`aa` 可用则在本地运行;有设备连接时需用 `--device local` 显式指定本地运行,或 `--device <serial>` 指定设备。
452
+
451
453
  **示例:**
452
454
 
453
455
  ```bash
package/SKILL.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: deveco-cli
3
3
  description: >-
4
- **MUST** use 'devecocli' for HarmonyOS apps (scaffold, build, run, debug, devices, logs, docs, 鸿蒙开发文档, skills, multi-preview). **REQUIRED** and **MANDATORY** if workspace has build-profile.json5 or oh-package.json5, or user mentions HarmonyOS, 鸿蒙, DevEco, ArkTS, ArkUI, docs, 鸿蒙文档, 知识, 搜索, skills, or preview/预览/预览器/多预览器/多设备预览器.
4
+ **MUST** use 'devecocli' for HarmonyOS apps (scaffold, build, run, debug, device, logs, docs, 鸿蒙开发文档, skills, multi-preview). **REQUIRED** and **MANDATORY** if workspace has build-profile.json5 or oh-package.json5, or user mentions HarmonyOS, 鸿蒙, DevEco, ArkTS, ArkUI, docs, 鸿蒙文档, 知识, 搜索, skills, or preview/预览/预览器/多预览器/多设备预览器/截图/screenshot.
5
5
  ---
6
6
 
7
7
  # DevEco CLI
@@ -15,11 +15,6 @@ description: >-
15
15
 
16
16
  Available commands: `build`, `check`, `run`, `update`, `device`, `ui`, `skills`, `log`, `create`, `init`, `serve`, `docs`, `signature`, `auth`.
17
17
 
18
- **Platform awareness**: On HarmonyOS native PC (2in1), **emulator commands are NOT available** and must never be suggested. The `emulator` command does not exist on this platform. When `device list` shows no devices, instead of suggesting emulator startup, tell the user to:
19
- 1. Enable wireless debugging in Settings → System → Developer options → Wireless debugging
20
- 2. Note the port number
21
- 3. Run `hdc tconn 127.0.0.1:<port>`
22
-
23
18
  **Sandbox Rule**: Commands tagged `[Outside sandbox]` must be run outside the sandbox.
24
19
 
25
20
  ## 1. Code → Build → Deploy → Run → Debug
@@ -49,7 +44,7 @@ Run DevEco Code Linter checks for TS/ArkTS code.
49
44
  ### `devecocli docs`
50
45
  Search/read local HarmonyOS docs.
51
46
  - `search <keywords...>`: Match any keyword. Opts: `--catalog <name>`, `--format <default|json>`, `--limit <n>`.
52
- - `read <documentId>`: Read full content by ID (e.g. `devecocli docs read 开发指南/冷启动_Launch分析/Launch模板基本操作/ide-insight-session-launch`).
47
+ - `read <documentId>`: Read full content by ID (e.g. `devecocli docs read 开发指南/harmonyos-guides/指南/NDK开发/代码开发/coding`). IDs come from `search` output.
53
48
  - `catalog`: List available catalogs.
54
49
 
55
50
  ### `devecocli device`
@@ -59,23 +54,26 @@ Search/read local HarmonyOS docs.
59
54
  ### `devecocli run` `[Outside sandbox]`
60
55
  Build, install, and launch.
61
56
  - `--module <module>`: Target module (auto-selected if only one runnable).
62
- - `--device <name|serial>`: Target device (Req if multiple connected).
57
+ - `--device <name|serial|local>`: Target device. Use `local` to run on the local machine. Req if multiple connected.
63
58
  - `--product <product>` / `--build-mode <mode>`: Defaults: `default` / `debug`.
64
59
  - `--ability <ability>`: Default from `module.json5`.
65
60
  - `--uninstall`: Uninstall existing app first (Fixes signing key issues).
66
61
  - `--skip-build`: Deploy existing artifacts.
67
- - `--apply <fileName>`: **Fast incremental deploy** — rebuilds only changed files into a signed hqf, installs via `bm quickfix -a -f -o`, then restarts the app. Much faster than a full `devecocli run` for iterating on code changes. Modules are auto-detected from the file paths in `<fileName>` (no `--module` needed).
62
+ - `--apply <fileName>`: **Fast incremental deploy** — rebuilds only changed files into a signed hqf, installs via `bm quickfix`, then restarts the app. Much faster than a full `devecocli run` for iterating on code changes. Modules are auto-detected from the file paths in `<fileName>` (no `--module` needed).
68
63
  - `<fileName>`: a plain file name (no path separators) under the project's `.hvigor/` directory; the caller writes the changed-file list there. File name is sanitized to prevent path traversal. Content: list of **source file paths changed this round** (one per line, relative to project root or absolute; `#` comments and blank lines ignored; typically `.ets`/`.ts`/`.cpp`/resource files). The changeFileList is **incrementally merged** — only list files changed since the last apply; previously listed files are retained automatically.
69
64
  - **Prereq**: run `devecocli run` once first (full build + deploy + generates the `buildConfig.json` cache that `--apply` reuses).
70
65
  - **If changes don't take effect**: check `<module>/build/config/buildConfig.json` has content — empty/missing means `devecocli run` wasn't run; on any apply failure, fall back to a full `devecocli run`.
71
66
  *Ex*: `devecocli run` → edit code → write `.hvigor/changes.txt` → `devecocli run --apply changes.txt`
67
+ - **Local execution**: Only `run` can execute on the local machine without a hdc connection. Other commands (`log`, `ui`, `device`) still require a connected device. `run` without `--device` auto-selects when only one target is available; use `--device local` for the local machine or `--device <serial>` for a specific device when multiple targets exist. If `run` or `--device local` fails, enable wireless debugging (Settings → System → Developer options → Wireless debugging) to connect the local machine via hdc.
72
68
  - **Previewer mode**: Pass a product name to `--device` to launch the DevEco Studio previewer. If `--device` matches a connected real device (name or serial), it takes priority over previewer mode — check device names with `devecocli device list`.
73
69
  - Single Previewer: `devecocli run --device "Pura 90 Pro"`
74
- - Multi Previewer: `devecocli run --device "Pura 90 Pro,MatePad 11.5'S"`
70
+ - Multi Previewer: `devecocli run --device "Pura 90 Pro,MatePad 11.5'S"` (HarmonyOS PC only)
71
+ - Iterating on code: re-run the same command — it rebuilds and relaunches the previewer on a **new virtual display**; re-query display ids before the next screenshot.
75
72
  - Prerequisites:
76
- 1. Device connected: enable wireless debugging (Settings → System → Developer options → Wireless debugging) and run `hdc tconn 127.0.0.1:<port>` (or set `DEVECO_HDC_PORT=<port>` env var).
77
- 2. DevEco Studio running (CLI throws if not — does NOT auto-start).
73
+ 1. DevEco Studio running (CLI throws if not — does NOT auto-start).
74
+ 2. Device: wireless debugging must be enabled (Settings → System → Developer options → Wireless debugging) — the previewer requires it, and `run` auto-connects the local machine via `hdc tconn 127.0.0.1:<port>` (port from the wireless debugging screen). If `ui` commands later report no active devices (connection dropped), re-run that `hdc tconn` once — `ui` does not auto-reconnect.
78
75
  - Supported products: `Pura 90 Pro`, `MatePad 11.5'S`, `Mate X7`, `Pura X`, `Mate XT`. Aliases: `phone`, `pad`/`tablet`, `fold`/`foldable`.
76
+ - Previewer screenshots: capture with `ui screenshot --display <displayId>` — see **Previewer screenshots** under `devecocli ui`.
79
77
 
80
78
  ### `devecocli signature generate` `[Outside sandbox]`
81
79
  Auto-generate HarmonyOS signing materials (local p12/csr + cloud cert + test profile) and write signing config to `build-profile.json5`.
@@ -101,13 +99,14 @@ Fetch hilog or crash logs. Req `--device <name|serial>` on multi-device hosts.
101
99
  *Ex*: `devecocli log --crash --bundle-name com.example.app`, `devecocli log --level E --from 5m --tail 200`
102
100
 
103
101
  ### `devecocli ui`
104
- Inspect UI on a connected device. All subcommands accept `--device <name|serial>` (Req on multi-device hosts).
102
+ Inspect UI on the selected connected device (candidates: `devecocli device list`) — windows/displays you list belong to that device: a connected phone shows its own screen; the self-connected local machine shows the PC's main screen plus previewer virtual displays (previewer screens never appear on external devices). All subcommands accept `--device <name|serial>` (Req on multi-device hosts).
105
103
 
106
104
  | Subcommand | Description | Key Options |
107
105
  |---|---|---|
108
106
  | `layout` | Dump ArkUI accessibility layout tree — **visible area only** (on-screen nodes) | `--id <id>`, `--window <windowId>`, `--all-windows`, `--depth <n>` (0=unlimited, 1=root only, 2=root+children), `--format default\|json`, `--mode full\|simplified` |
109
107
  | `window list` | List active windows | `--format default\|json`, `--all` (include system windows) |
110
- | `screenshot` | Capture a screenshot of the device screen | `--display <displayId>`, required `--path <path>` (existing directory or PNG file path; relative paths supported; writable destination; no overwrite) |
108
+ | `display list` | List displays with id, width and height (px) — source of `--display <displayId>` values for `ui screenshot` (previewer virtual displays appear only when targeting the local machine) | `--format default\|json`, `--all` (add screen id, refresh rate, VPR, rotation columns; unreported fields render as `-`, or `null` in json) |
109
+ | `screenshot` | Capture a screenshot of the device screen | `--display <displayId>` (omit = default screen, not the previewer), required `--path <path>` (existing directory or PNG file path; relative paths supported; writable destination; no overwrite) |
111
110
  | `click [x] [y]` | Tap at the specified coordinates or node | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
112
111
  | `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
113
112
  | `longclick [x] [y]` | Long-press at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
@@ -117,6 +116,12 @@ Inspect UI on a connected device. All subcommands accept `--device <name|serial>
117
116
  | `dircfling <direction>` | Quick directional fling (system default speed, ideal for scrolling) | `direction`: `up`, `down`, `left`, `right` |
118
117
  | `text <text> [x] [y]` | Input text at a target location or the currently focused field | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
119
118
 
119
+ - **Previewer screenshots**: Each previewer window renders on its own virtual display; `ui screenshot` without `--display` captures the default (main) screen, not the previewer. Always pass the id: `devecocli ui display list` -> `devecocli ui screenshot --display <displayId> --path <dir|png>`.
120
+ - Display ids are assigned at previewer launch, and relaunches leave stale virtual displays behind — re-query after every previewer (re)start instead of reusing an earlier id.
121
+ - `display list` reports ids and resolutions only, no names. A single previewer is the lone non-main display only in a fresh session with no leftovers; with multi-device previewer (HarmonyOS PC only — one virtual display per previewer) or after any relaunch, resolutions cannot tell the live previewer from stale ones.
122
+ - To identify the right display in the multi/ambiguous case, use `ui window list --all`: take the DisplayId of the app's previewer window (named after the app; newest Pid when several — IDE windows like `devecostudio0` sit on the main display).
123
+ - `ui` commands run against the local hdc target and do NOT accept `--device local` (`run`-only value): on multi-target hosts pass the local serial `127.0.0.1:<port>`.
124
+ - **Real-device screenshots**: Target the phone with `--device <name|serial>` and omit `--display` — a single-screen device has only its own screen, so the default capture is the device screen; the virtual-display workflow above is previewer-only.
120
125
  - **Coordinates vs `--id`**: Mutually exclusive. Provide either `x y` or `--id <id>`. For `text`, if neither is given, text goes to the currently focused field.
121
126
  - **`--window`**: May only be used together with `--id`. Default is focused window. Secondary display operations via `--id` + `--window` are not supported.
122
127
  - **`swipe` vs `dircfling`**: `swipe` requires exact start/end coordinates and supports `--speed`; `dircfling` only needs a direction (`up/down/left/right`) and uses system default speed (ideal for page/list scrolling).
@@ -165,9 +170,13 @@ Manage HarmonyOS skills in AI agents/projects.
165
170
 
166
171
  ## Recipes
167
172
 
168
- - **Fresh checkout to real device**:
169
- `devecocli build` -> `devecocli device list` -> `devecocli run --device <serial>`
173
+ - **Build and run**:
174
+ `devecocli build` -> `devecocli run` (auto-selects when only one target; use `--device local` or `--device <serial>` when multiple targets exist)
170
175
  - **Launch previewer**: `devecocli run --device "Pura 90 Pro"` (single) or `devecocli run --device "Pura 90 Pro,Mate XT"` (multi).
176
+ - **Previewer UI verification loop**:
177
+ `mkdir -p shots` (once — `--path` needs an existing directory) -> `devecocli run --device "Pura 90 Pro"` (rebuild + relaunch previewer) -> `devecocli ui display list` -> `devecocli ui screenshot --display <displayId> --path shots/` -> inspect the screenshot; repeat the chain after each code change (a relaunched previewer gets a new display id).
178
+ - **Device UI verification loop** (real-device rendering, or previewer unavailable):
179
+ `mkdir -p shots` (once — `--path` needs an existing directory) -> `devecocli run --device <serial>` (build + install + launch on the connected device) -> `devecocli ui screenshot --device <serial> --path shots/` -> inspect the screenshot; repeat per code change. Single-screen devices need no `--display`.
171
180
  - **Diagnose crash**:
172
181
  `devecocli log --crash --bundle-name <bundle>`
173
182
  - **Release build**:
@@ -179,12 +188,14 @@ Manage HarmonyOS skills in AI agents/projects.
179
188
 
180
189
  - **"Product / Build mode `<x>` not found"**: Check `build-profile.json5`.
181
190
  - **"Multiple entry modules" / "No entry module"**: Pass `--modules` (build) or `--module` (run).
182
- - **"No active devices" / "Multiple devices connected"**: Connect a real device (or self-connect via wireless debugging on HarmonyOS native PC). Pass `-t <serial>` (device view) or `--device <name|serial>` (run/log).
191
+ - **"No active devices" / "Multiple devices connected"**: Use `--device <serial>` to target a connected device, or `--device local` to run on the local machine.
183
192
  - **`error:install sign info inconsistent`**: Signing key changed. Run `devecocli run --uninstall` or `devecocli signature generate --force`.
184
193
  - **`Not logged in. Run devecocli auth login first`**: Run `devecocli auth login` to authenticate.
185
194
  - **`Provision number exceeds limit`**: Test provision quota is full. Delete old test provisions in DevEco Studio (Signing Configs) or AGC console, then retry `devecocli signature generate`.
186
195
  - **`Unable to create the profile file due to missing devices`**: No device is connected and the AGC cloud device list is empty. Connect a device, or sign for a device you don't have on hand via `devecocli signature generate --udid <64-hex-udid>`.
187
196
  - **`Invalid AccessToken. Sign in and try again`**: Token expired. Run `devecocli auth login` again.
188
197
  - **`skills add` agent not found**: Valid: `codebuddy`, `cursor`, `opencode`, `qoder`, `trae-cn`.
189
- - **HarmonyOS native (2in1 PC) — `hdc list targets` shows `[Empty]`**: hdc on HarmonyOS does NOT auto-discover the local device. Open "Settings → System → Developer options → Wireless debugging", note the port, then `hdc tconn 127.0.0.1:<port>`. For normal run: pass `--device 127.0.0.1:<port>`. For previewer mode: set `DEVECO_HDC_PORT=<port>` env var (previewer mode uses `--device` for product name, not hdc target).
198
+ - **`hdc list targets` shows `[Empty]`**: `devecocli run` can run on the local machine without a connected device, or enable wireless debugging (Settings → System → Developer options → Wireless debugging) to connect the local machine via hdc.
190
199
  - **Previewer — "DevEco Studio is not running"**: Tell the user to start DevEco Studio manually first, then retry. Do NOT retry automatically.
200
+ - **Previewer — "No active devices" / "Local device not found in hdc targets" / "Wireless debugging is not enabled"**: The previewer detects DevEco Studio via `hdc shell ps` on the local machine, so the local target must be hdc-connected — same error text as a plain `run` device failure, but the fix differs. Enable wireless debugging (Settings → System → Developer options → Wireless debugging), run `hdc tconn 127.0.0.1:<port>` once, then retry; `run` also self-connects automatically once `persist.hdc.mode` is set.
201
+ - **Previewer screenshot shows the desktop or a stale screen**: `ui screenshot` without `--display` captures the main screen, and previewer display ids change on every relaunch (stale virtual displays linger). Re-run `ui display list` and use the app window's DisplayId from `ui window list --all` (newest-Pid window named after the app; not the IDE's `devecostudio*` windows).