@deveco-test/deveco-cli-openharmony-arm64 0.4.0-TD.5.6 → 0.4.0-TD.5.8
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 +2 -0
- package/SKILL.md +50 -21
- package/dist/cli.js +131 -129
- package/dist/internal/telemetry-upload-background.js +6 -6
- package/index.zip +0 -0
- package/package.json +3 -3
- /package/{THIRD-PARTY-LICENSES → NOTICE} +0 -0
package/README.md
CHANGED
|
@@ -450,6 +450,8 @@ devecocli run --module <module> --device <device> --product <product> --build-mo
|
|
|
450
450
|
|
|
451
451
|
> **说明:** 在 OpenHarmony 平台上,未指定 `--device` 时:无设备连接且 `bm`/`aa` 可用则在本地运行;有设备连接时需用 `--device local` 显式指定本地运行,或 `--device <serial>` 指定设备。
|
|
452
452
|
|
|
453
|
+
真机运行调试时,建议先执行 `devecocli device list`,再使用目标设备的 Serial 执行 `devecocli run --device <serial>`。多台真机时需明确目标,后续增量部署继续使用该序列号。CLI 会先匹配序列号,命中后跳过设备名称查询。
|
|
454
|
+
|
|
453
455
|
**示例:**
|
|
454
456
|
|
|
455
457
|
```bash
|
package/SKILL.md
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: deveco-cli
|
|
3
3
|
description: >-
|
|
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
|
|
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
|
|
8
8
|
|
|
9
9
|
`devecocli` wraps DevEco Studio's `hvigor`, `ohpm`, `hdc`, and HarmonyOS-skills installer. **Prefer `devecocli` over invoking underlying tools directly.**
|
|
10
10
|
|
|
11
|
+
**Prerequisite — Developer mode (MANDATORY)**: Developer mode must be enabled before using `devecocli`. Enable it: **Settings → About this device → tap Software version 7 times in a row**.
|
|
12
|
+
|
|
13
|
+
**Error Handling Rule** (MANDATORY): If any `devecocli` command output contains `Permission denied`, `EACCES`, `SymLink Dir Failed`, or SELinux permission errors — these can appear in ANY location because Developer mode restricts the entire filesystem.
|
|
14
|
+
1. FIRST: tell the user to enable Developer mode (path above) and retry.
|
|
15
|
+
2. Do NOT delete cache, fix file permissions, modify code, clean builds, or try other workarounds first — this is a mandatory checklist step, not a diagnostic judgment. Your common-sense assessment of EACCES (e.g., "cache issue → delete cache") does not apply on HarmonyOS without Developer mode.
|
|
16
|
+
3. Only after the user confirms Developer mode is enabled and the error persists: proceed with other troubleshooting. For `Permission denied` on the `devecocli` binary only, use `sh <devecocli-path> <args>` (path from the error) as a fallback.
|
|
17
|
+
|
|
11
18
|
**Do NOT use these legacy commands** — use the `devecocli` equivalent instead:
|
|
12
19
|
- ❌ `deveco preview` / `hvigorw preview` → ✅ `devecocli run --device <product-name>` (launches DevEco Studio previewer; product name in `--device` triggers previewer mode)
|
|
13
20
|
- ❌ `hvigorw` directly → ✅ `devecocli build`
|
|
@@ -55,6 +62,8 @@ Search/read local HarmonyOS docs.
|
|
|
55
62
|
Build, install, and launch.
|
|
56
63
|
- `--module <module>`: Target module (auto-selected if only one runnable).
|
|
57
64
|
- `--device <name|serial|local>`: Target device. Use `local` to run on the local machine. Req if multiple connected.
|
|
65
|
+
- **Real-device run/debug**: First run `devecocli device list`, then use the selected real device's **Serial** in `run --device <serial>`. Select the unique real device, or ask the user to choose when several real devices are available. Reuse that serial for subsequent apply/hot-reload commands. Report device connection or deployment failures to the user.
|
|
66
|
+
- **Real-device names** use full-name matching that ignores case and whitespace. Use the Serial if multiple devices match.
|
|
58
67
|
- `--product <product>` / `--build-mode <mode>`: Defaults: `default` / `debug`.
|
|
59
68
|
- `--ability <ability>`: Default from `module.json5`.
|
|
60
69
|
- `--uninstall`: Uninstall existing app first (Fixes signing key issues).
|
|
@@ -66,12 +75,14 @@ Build, install, and launch.
|
|
|
66
75
|
*Ex*: `devecocli run` → edit code → write `.hvigor/changes.txt` → `devecocli run --apply changes.txt`
|
|
67
76
|
- **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.
|
|
68
77
|
- **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`.
|
|
69
|
-
- Single Previewer: `devecocli run --device "
|
|
70
|
-
- Multi Previewer: `devecocli run --device "
|
|
78
|
+
- Single Previewer: `devecocli run --device "Mate 90 Pro"`
|
|
79
|
+
- Multi Previewer: `devecocli run --device "Mate 90 Pro,MatePad Pro 13"` (HarmonyOS PC only)
|
|
80
|
+
- 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.
|
|
71
81
|
- Prerequisites:
|
|
72
82
|
1. DevEco Studio running (CLI throws if not — does NOT auto-start).
|
|
73
|
-
2. Device: wireless debugging
|
|
74
|
-
- Supported products: `
|
|
83
|
+
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.
|
|
84
|
+
- Supported products: `Mate 90 Pro`, `MatePad Pro 13`, `Mate X8`, `Pura X Max`, `Mate XT2`. Aliases: `phone`, `pad`/`tablet`, `fold`/`foldable`, `wide`/`widefold`, `triple`/`triplefold`.
|
|
85
|
+
- Previewer screenshots: capture with `ui screenshot --display <displayId>` — see **Previewer screenshots** under `devecocli ui`.
|
|
75
86
|
|
|
76
87
|
### `devecocli signature generate` `[Outside sandbox]`
|
|
77
88
|
Auto-generate HarmonyOS signing materials (local p12/csr + cloud cert + test profile) and write signing config to `build-profile.json5`.
|
|
@@ -97,26 +108,38 @@ Fetch hilog or crash logs. Req `--device <name|serial>` on multi-device hosts.
|
|
|
97
108
|
*Ex*: `devecocli log --crash --bundle-name com.example.app`, `devecocli log --level E --from 5m --tail 200`
|
|
98
109
|
|
|
99
110
|
### `devecocli ui`
|
|
100
|
-
Inspect UI on a connected
|
|
111
|
+
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).
|
|
101
112
|
|
|
102
113
|
| Subcommand | Description | Key Options |
|
|
103
114
|
|---|---|---|
|
|
104
115
|
| `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` |
|
|
105
116
|
| `window list` | List active windows | `--format default\|json`, `--all` (include system windows) |
|
|
106
|
-
| `display list` | List displays with id, width and height (px) — source of `--display <displayId>` values for `ui screenshot` | `--format default\|json`, `--all` (add screen id, refresh rate, VPR, rotation columns; unreported fields render as `-`, or `null` in json) |
|
|
107
|
-
| `screenshot` | Capture a screenshot of the device screen | `--display <displayId
|
|
108
|
-
| `click [x] [y]` | Tap at the specified coordinates or node | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
|
|
109
|
-
| `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
|
|
110
|
-
| `longclick [x] [y]` | Long-press at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
|
|
111
|
-
| `swipe <x1> <y1> <x2> <y2>` | Swipe
|
|
112
|
-
| `fling <x1> <y1> <x2> <y2>` | Fling
|
|
113
|
-
| `drag <x1> <y1> <x2> <y2>` | Drag
|
|
114
|
-
| `dircfling <direction>` |
|
|
115
|
-
| `text <text> [x] [y]` | Input text at a target location or the
|
|
116
|
-
|
|
117
|
+
| `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) |
|
|
118
|
+
| `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) |
|
|
119
|
+
| `click [x] [y]` | Tap at the specified coordinates or node, including targets on secondary displays | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id` or `x y`; display resolved automatically) |
|
|
120
|
+
| `doubleclick [x] [y]` | Double-tap at the specified coordinates or node, including targets on secondary displays | `--id <id>`, `--window <windowId>` (used with `--id` or `x y`) |
|
|
121
|
+
| `longclick [x] [y]` | Long-press at the specified coordinates or node, including targets on secondary displays | `--id <id>`, `--window <windowId>` (used with `--id` or `x y`) |
|
|
122
|
+
| `swipe <x1> <y1> <x2> <y2>` | Swipe between points on the primary or a secondary display | `--speed <n>` (200–40000, px/s), `--window <windowId>` (resolves target display) |
|
|
123
|
+
| `fling <x1> <y1> <x2> <y2>` | Fling between points on the primary or a secondary display | `--speed <n>` (200–40000, px/s), `--window <windowId>` (resolves target display) |
|
|
124
|
+
| `drag <x1> <y1> <x2> <y2>` | Drag between points on the primary or a secondary display | `--speed <n>` (200–40000, px/s), `--window <windowId>` (resolves target display) |
|
|
125
|
+
| `dircfling <direction>` | Fling in a direction on the primary or a secondary display | `direction`: `up`, `down`, `left`, `right`; `--window <windowId>` (resolves target display) |
|
|
126
|
+
| `text <text> [x] [y]` | Input text at a target location or focused field on the primary or a secondary display | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`, coordinates, or focused input) |
|
|
127
|
+
|
|
128
|
+
- **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>`.
|
|
129
|
+
- 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.
|
|
130
|
+
- `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.
|
|
131
|
+
- 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).
|
|
132
|
+
- `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>`.
|
|
133
|
+
- **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.
|
|
117
134
|
- **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.
|
|
118
|
-
- **`--window`**:
|
|
119
|
-
-
|
|
135
|
+
- **`--window`**: All input commands use this to resolve the target display automatically. `click`, `doubleclick`, and `longclick` accept it with `--id` or `x y`; `text` also accepts it with coordinates or by itself for focused input; `swipe`, `fling`, `drag`, and `dircfling` accept it for display selection. All of these commands support secondary displays.
|
|
136
|
+
- **Previewer input**: Find the app previewer window with `ui window list --all`, dump its nodes with `ui layout --window <windowId> --format json` when a node id is needed, then run the input command with `--window <windowId> --device <serial>`. For example, `ui click --id <nodeId> --window <windowId> --device <serial>`. The CLI resolves the window's display automatically; input commands have no `--display` option and do not require a manually supplied display id.
|
|
137
|
+
- Use explicit `--window` for multi-device previewers and whenever node ids may be ambiguous. Automatic cross-display lookup is only a convenience for a unique node.
|
|
138
|
+
- For raw coordinates, use a command such as `ui click <x> <y> --window <windowId> --device <serial>`. Coordinates must be device pixels in the target display's coordinate system, such as `ui layout` bounds or unscaled pixels from that display's screenshot. Host-window offsets and image scaling are not converted automatically.
|
|
139
|
+
- For focused text input on a secondary display, use `ui text <text> --window <windowId> --device <serial>`.
|
|
140
|
+
- For `swipe`, `fling`, `drag`, and `dircfling`, the CLI supplies the required default speed (`600`) and step length when routing to a secondary display; no extra parameters are needed from the user.
|
|
141
|
+
- Re-query the window id after every previewer restart.
|
|
142
|
+
- **`swipe` vs `dircfling`**: `swipe` requires exact start/end coordinates and supports `--speed`; `dircfling` only needs a direction (`up/down/left/right`) and uses the default speed of `600` (ideal for page/list scrolling). On secondary displays, the CLI explicitly supplies this speed and the required step length.
|
|
120
143
|
- **Text encoding**: Special characters in `text` are Base64-encoded internally to safely pass through device shell.
|
|
121
144
|
- `--format json` pairs well with `jq`.
|
|
122
145
|
- `--mode full`: full layout tree, no filtering.
|
|
@@ -163,8 +186,12 @@ Manage HarmonyOS skills in AI agents/projects.
|
|
|
163
186
|
## Recipes
|
|
164
187
|
|
|
165
188
|
- **Build and run**:
|
|
166
|
-
`devecocli build` -> `devecocli
|
|
167
|
-
- **Launch previewer**: `devecocli run --device "
|
|
189
|
+
`devecocli build` -> `devecocli device list` -> `devecocli run --device <serial>` (prefer the selected real device's Serial for run/debug; use `--device local` for local execution)
|
|
190
|
+
- **Launch previewer**: `devecocli run --device "Mate 90 Pro"` (single) or `devecocli run --device "Mate 90 Pro,Mate XT2"` (multi).
|
|
191
|
+
- **Previewer UI verification loop**:
|
|
192
|
+
`mkdir -p shots` (once — `--path` needs an existing directory) -> `devecocli run --device "Mate 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).
|
|
193
|
+
- **Device UI verification loop** (real-device rendering, or previewer unavailable):
|
|
194
|
+
`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`.
|
|
168
195
|
- **Diagnose crash**:
|
|
169
196
|
`devecocli log --crash --bundle-name <bundle>`
|
|
170
197
|
- **Release build**:
|
|
@@ -185,3 +212,5 @@ Manage HarmonyOS skills in AI agents/projects.
|
|
|
185
212
|
- **`skills add` agent not found**: Valid: `codebuddy`, `cursor`, `opencode`, `qoder`, `trae-cn`.
|
|
186
213
|
- **`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.
|
|
187
214
|
- **Previewer — "DevEco Studio is not running"**: Tell the user to start DevEco Studio manually first, then retry. Do NOT retry automatically.
|
|
215
|
+
- **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.
|
|
216
|
+
- **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).
|