@deveco-test/deveco-cli 1.3.0-Test.8 → 1.3.1-Test.1
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 +668 -110
- package/SKILL.md +41 -27
- package/THIRD-PARTY-LICENSES +246 -1029
- package/dist/cli.js +134 -122
- package/dist/internal/doc-init-background.js +1 -65
- package/dist/internal/telemetry-upload-background.js +9 -0
- package/docs.zip +0 -0
- package/index.zip +0 -0
- package/package.json +17 -20
- package/scripts/postinstall.mjs +1 -22
- package/scripts/install-better-sqlite3.mjs +0 -51
- package/scripts/install-jieba-wasm.mjs +0 -47
- package/scripts/lib/better-sqlite3-vendor.mjs +0 -129
- package/scripts/lib/cli-data-dir.mjs +0 -44
- package/scripts/lib/doc-init-log-path.mjs +0 -15
- package/scripts/lib/jieba-wasm-vendor.mjs +0 -102
package/SKILL.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: deveco-cli
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
4
|
+
Use 'devecocli' for HarmonyOS apps (scaffold, build, run, debug, devices, emulators, logs, docs, UI inspection, 鸿蒙开发文档, skills). Use it if workspace has build-profile.json5 or oh-package.json5, or user mentions HarmonyOS, 鸿蒙, DevEco, ArkTS, ArkUI, docs, 鸿蒙文档, 知识, 搜索, skills, UI, UI测试, 组件调试. If user explicitly specifies another tool, skill, or workflow, follow that choice; otherwise use 'devecocli'.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# DevEco CLI
|
|
8
8
|
|
|
9
|
-
`devecocli` wraps DevEco Studio's `hvigor`, `ohpm`, `hdc`, emulator toolchain, and bundled skills installer.
|
|
9
|
+
`devecocli` wraps DevEco Studio's `hvigor`, `ohpm`, `hdc`, emulator toolchain, and bundled skills installer.
|
|
10
10
|
|
|
11
|
-
Available commands: `build`, `check`, `run`, `update`, `device`, `emulator`, `ui`, `skills`, `log`, `create`, `init`, `serve`, `docs`, `signature`, `
|
|
11
|
+
Available commands: `build`, `check`, `run`, `update`, `device`, `emulator`, `ui`, `skills`, `log`, `create`, `init`, `serve`, `docs`, `signature`, `auth`.
|
|
12
12
|
|
|
13
13
|
**Sandbox Rule**: Commands tagged `[Outside sandbox]` must be run outside the sandbox.
|
|
14
14
|
|
|
@@ -33,19 +33,21 @@ Compile and package project/modules. (Defaults: `--product default`, `--build-mo
|
|
|
33
33
|
|
|
34
34
|
### `devecocli check lint`
|
|
35
35
|
Run DevEco Code Linter checks for TS/ArkTS code.
|
|
36
|
+
- **Studio requirement**: Default lint checks and `--fix`, `--incremental`, `--product`, `--config-path`, and `--limit` support DevEco Studio `>= 6.0.0`; explicitly using `--format` or `--output-path` requires DevEco Studio `>= 6.1.0`. Command Line Tools mode follows the CLT `>= 26.0.0` baseline.
|
|
36
37
|
- `[path]`: File or directory to lint. Defaults to the project root from `build-profile.json5`, otherwise the current directory.
|
|
37
38
|
- Options: `--config-path <file>`, `--fix`, `--incremental`, `--product <name>`, `--format <default|json>`, `--output-path <path>`, `--limit <number>`.
|
|
38
39
|
- Set `DEVECO_CLI_CLT_PATH` to the Command Line Tools root when DevEco Studio is not installed; CLT is not discovered automatically from PATH or default installation directories.
|
|
39
40
|
|
|
40
41
|
### `devecocli emulator`
|
|
41
42
|
Manage local emulator instances and system images.
|
|
42
|
-
-
|
|
43
|
+
- **Studio requirement**: DevEco Studio `>= 6.1.0`.
|
|
44
|
+
- `list`: Show instances (status, serial, device type). Opt: `--format <table|json>` (default: `table`).
|
|
43
45
|
- `start <names...>`: Start instances. Quote names with spaces. (See Troubleshooting if blocked).
|
|
44
46
|
- `stop <names...>`: Stop by name or serial (`127.0.0.1:<port>`).
|
|
45
47
|
- Scene control commands require Emulator 7.0 or later. Use `DEVECO_CLI_DEBUG=1` to inspect the underlying `Emulator` command mapping.
|
|
46
48
|
- `shake` / `power` / `rotate <left|right>` / `volume <up|down>` (Req: `--target <nameOrSerial>`): Basic emulator controls.
|
|
47
49
|
- `fold <state>` (Req: `--target <nameOrSerial>`): Set foldable display state, matched against the target emulator's reported `deviceType`. `foldable` uses `open|half-open|close`; `2in1_foldable` uses `open|vertical-open|half-open|close`; `triplefold` uses `single|double|triple` or one of its six left/right folded-state combinations. Other device types and cross-device states are rejected before execution.
|
|
48
|
-
- `battery` (Req: `--target`; one of `--level <0-100>` or `--status <charging|discharging>`): Set battery state.
|
|
50
|
+
- `battery` (Req: `--target`; one of `--level <0-100>` or `--status <charging|discharging>`): Set battery state. `--level` checks the current emulator charging state automatically (`0-100` while charging, `1-100` otherwise).
|
|
49
51
|
- `geolocation` (Req: `--target`; one of `--longitude`, `--latitude`, `--altitude`, `--direction`): Inject GPS data.
|
|
50
52
|
- `scene <outdoorRunning|outdoorCycling|drivingNavigation>` (Req: `--target`): Start motion simulation.
|
|
51
53
|
- `sensor` (Req: `--target`; one of `--light-intensity`, `--humidity`, `--temperature`, `--steps`, `--heartrate`): Inject sensor data.
|
|
@@ -58,9 +60,9 @@ Manage local emulator instances and system images.
|
|
|
58
60
|
### `devecocli ui`
|
|
59
61
|
Inspect UI on a connected physical device or running emulator.
|
|
60
62
|
- `screenshot`: Capture a screenshot from a physical device or running emulator. `--device <name|serial>` is optional when exactly one device is connected, and required when multiple devices are connected.
|
|
61
|
-
- Optional: `--display <displayId
|
|
63
|
+
- Optional: `--display <displayId>`. Required: `--path <path>` (existing directory or PNG file path, including paths relative to the current directory; writable destination; no overwrite).
|
|
62
64
|
- Implementation uses `hdc shell snapshot_display` and `hdc file recv`; set `DEVECO_CLI_DEBUG=1` to inspect the actual `hdc` commands.
|
|
63
|
-
*Ex*: `
|
|
65
|
+
*Ex*: `devecocli ui screenshot --device Phone --path ./screenshots/phone.png`
|
|
64
66
|
|
|
65
67
|
### `devecocli docs`
|
|
66
68
|
Search/read local HarmonyOS docs.
|
|
@@ -69,8 +71,8 @@ Search/read local HarmonyOS docs.
|
|
|
69
71
|
- `catalog`: List available catalogs.
|
|
70
72
|
|
|
71
73
|
### `devecocli device`
|
|
72
|
-
- `list`: Show active real devices and running emulators.
|
|
73
|
-
- `view`: Detailed info. Req `-t <name|serial>` on multi-device hosts.
|
|
74
|
+
- `list`: Show active real devices and running emulators. Opt: `--format <table|json>` (default: `table`).
|
|
75
|
+
- `view`: Detailed info. Req `-t <name|serial>` on multi-device hosts. Opt: `--format <table|json>` (default: `table`).
|
|
74
76
|
|
|
75
77
|
### `devecocli run` `[Outside sandbox]`
|
|
76
78
|
Build, install, and launch.
|
|
@@ -85,10 +87,18 @@ Build, install, and launch.
|
|
|
85
87
|
- **Prereq**: DevEco Studio ≥6.1.1 (hvigor `assembleDevHqf` support; below is rejected with an upgrade hint); run `devecocli run` once first (full build + deploy + generates the `buildConfig.json` cache that `--apply` reuses).
|
|
86
88
|
- **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`.
|
|
87
89
|
*Ex*: `devecocli run` → edit code → write `.hvigor/changes.txt` → `devecocli run --apply changes.txt`
|
|
90
|
+
- `--hotreload [action]`: **Hot-reload watch session** — must be started as a **background process** (the process holds a persistent socket to the hvigor daemon). It builds the hap in hot-reload mode (`hotReload=true debuggable=true`), deploys+launches the app, then the process itself connects a socket to the daemon and sends `CommonBuild assembleHap --hot-reload-build --watch`, **staying connected** so the daemon's watch worker (rollup watch) stays alive for `--hotreload-apply` to reuse. The process stays alive (onBuildOutput streams to its stdout). **Must be stopped (kill the background process) when the hot-reload debug session ends** — otherwise the watch worker/daemon leaks. `--hotreload stop` additionally stops the hvigor daemon.
|
|
91
|
+
- **Usage**: start `devecocli run --module <m> --hotreload` as a background process; wait for the `.hotreload-mode` marker (or "watch session active" on its stdout) = ready; then run `devecocli run --module <m> --hotreload-apply <file>` (foreground). When done: kill the background process + `devecocli run --hotreload stop`.
|
|
92
|
+
- `--hotreload-apply <fileName>`: **Hot reload without app restart** — reads the changed-file list from `.hvigor/<fileName>` (same format/merge rules as `--apply`), opens a **short socket** to the daemon (kept alive by the background `--hotreload` process) and sends `CommonBuild assembleDevHqf --hot-compile` → the watch worker incrementally hot-compiles changed `.ets`/`.ts` into abc (HotReloadArkTS; output/errors streamed live via WatchLog), then **manually** packs + signs a hqf from that abc (`app_packing_tool.jar` + `hap-sign-tool.jar`, DevEco material password decrypted via `DecipherUtil`), and installs it via `bm quickfix -a -f -o`. The app is **not restarted** — changes take effect immediately.
|
|
93
|
+
- **Prereq**: the background `devecocli run --hotreload` process must be running (holds the watch session). If `--hotreload-apply` times out, the watch session isn't alive — (re)start the background `--hotreload`.
|
|
94
|
+
- **Scope (important)**: hot reload targets a **single module** (`--module` required; the target can be entry/hsp/feature; `har` deps are folded in and fine). **`har` dependency changes are auto-routed** to the dependent main module's (entry/feature/hsp) `hotReload/changedFileList.json` — so editing a har's `.ets` and listing it hot-reloads via the target module. Changes in **`feature`/`hsp` dependency modules** (not the target) are NOT hot-reloadable — they're detected and warned (run a full `devecocli run` to redeploy those). `@State`/state-decorator changes are **not** hot-reloadable (state isn't re-initialized); hot-reloadable changes are non-state code: UI property values (`.fontColor`/`.fontSize`), `Text`/`Button` literal labels, method bodies, expressions. Resources/native changes need a full run.
|
|
95
|
+
- **Compile errors**: ArkTS compile errors from the hot compile are routed (via WatchLog) to the **background `--hotreload` process**, which writes them to **`.hvigor/hotreload-watch.log`** (and its stdout). On failure, `--hotreload-apply` reads that file and prints the errors inline (fast-fail, ~15s timeout if the watch session is dead).
|
|
96
|
+
- **Artifacts under `.hvigor/`** (shared with `--apply`): `.hvigor/<fileName>` = the changed-file list you write; `.hvigor/hotreload-watch.log` = the watch session's onBuildOutput/compile-errors (written by the background `--hotreload` process; safe to read/delete). The hot-reload marker is `<module>/build/<product>/.hotreload-mode`.
|
|
97
|
+
*Ex*: background `devecocli run --module entry --hotreload` → (ready) → edit `.fontColor` in `entry/src/main/ets/pages/Index.ets` → write path to `.hvigor/changes.txt` → `devecocli run --module entry --hotreload-apply changes.txt` (UI updates without restart). When done: kill the background process + `devecocli run --hotreload stop`.
|
|
88
98
|
|
|
89
99
|
### `devecocli signature generate` `[Outside sandbox]`
|
|
90
100
|
Auto-generate HarmonyOS signing materials (local p12/csr + cloud cert + test profile) and write signing config to `build-profile.json5`.
|
|
91
|
-
- **Prereq**: `devecocli login` first; run from a project directory (with `build-profile.json5`); a connected device or emulator is required for device registration.
|
|
101
|
+
- **Prereq**: `devecocli auth login` first; run from a project directory (with `build-profile.json5`); a connected device or emulator is required for device registration.
|
|
92
102
|
- `--product <name>`: Product name for local p12/csr file naming (default: `default`).
|
|
93
103
|
- `--team-id <id>`: Specify the team-id (default: current user's id).
|
|
94
104
|
- `--force`: Force regenerate even if existing materials are valid.
|
|
@@ -114,22 +124,23 @@ Inspect UI on a connected device. All subcommands accept `--device <name|serial>
|
|
|
114
124
|
| Subcommand | Description | Key Options |
|
|
115
125
|
|---|---|---|
|
|
116
126
|
| `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` |
|
|
117
|
-
| `window list` | List active windows | `--format
|
|
118
|
-
| `screenshot` | Capture a screenshot of the device screen | `--display <displayId>`, `--path <path>` (existing directory or PNG file path
|
|
127
|
+
| `window list` | List active windows | `--format default\|json`, `--all` (include system windows) |
|
|
128
|
+
| `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) |
|
|
119
129
|
| `click [x] [y]` | Tap at the specified coordinates or node | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
|
|
120
130
|
| `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
|
|
121
131
|
| `longclick [x] [y]` | Long-press at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
|
|
122
|
-
| `swipe <x1> <y1> <x2> <y2>` | Swipe from one point to another | `--speed <n>` (200–40000, px/s) |
|
|
132
|
+
| `swipe <x1> <y1> <x2> <y2>` | Swipe from one point to another (precise coordinates, custom speed) | `--speed <n>` (200–40000, px/s) |
|
|
123
133
|
| `fling <x1> <y1> <x2> <y2>` | Fling from one point to another | `--speed <n>` (200–40000, px/s) |
|
|
124
134
|
| `drag <x1> <y1> <x2> <y2>` | Drag from one point to another | `--speed <n>` (200–40000, px/s) |
|
|
125
|
-
| `dircfling <direction>` |
|
|
135
|
+
| `dircfling <direction>` | Quick directional fling (system default speed, ideal for scrolling) | `direction`: `up`, `down`, `left`, `right` |
|
|
126
136
|
| `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`) |
|
|
127
137
|
|
|
128
|
-
- Coordinates
|
|
129
|
-
-
|
|
130
|
-
-
|
|
138
|
+
- **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.
|
|
139
|
+
- **`--window`**: May only be used together with `--id`. Default is focused window. Secondary display operations via `--id` + `--window` are not supported.
|
|
140
|
+
- **`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).
|
|
141
|
+
- **Text encoding**: Special characters in `text` are Base64-encoded internally to safely pass through device shell.
|
|
131
142
|
- `--format json` pairs well with `jq`.
|
|
132
|
-
- `--mode
|
|
143
|
+
- `--mode full`: full layout tree, no filtering.
|
|
133
144
|
- `--mode simplified` (default): folds meaningless wrapper containers (non-root, no `id`, no text, not interactive) by lifting their surviving children up. `--depth` truncates after folding.
|
|
134
145
|
|
|
135
146
|
|
|
@@ -146,16 +157,19 @@ MUTUALLY EXCLUSIVE modes for setup:
|
|
|
146
157
|
- `-f, --force`: Overwrite existing config.
|
|
147
158
|
*MCP Rules*: Global MCP (no `--project`) only supports `opencode` and `cursor`. Others require `--project`.
|
|
148
159
|
|
|
149
|
-
### `devecocli login`
|
|
160
|
+
### `devecocli auth login`
|
|
150
161
|
Sign in to your Huawei Developer account. Opens a browser for OAuth authentication. Required before `signature generate`.
|
|
151
|
-
*Ex*: `devecocli login`
|
|
162
|
+
*Ex*: `devecocli auth login`
|
|
152
163
|
|
|
153
|
-
### `devecocli logout`
|
|
164
|
+
### `devecocli auth logout`
|
|
154
165
|
Sign out and clear locally stored credentials.
|
|
155
166
|
|
|
156
|
-
### `devecocli
|
|
167
|
+
### `devecocli auth status`
|
|
157
168
|
Show the current logged-in user.
|
|
158
169
|
|
|
170
|
+
### `devecocli auth team list`
|
|
171
|
+
List team accounts the current user has joined.
|
|
172
|
+
|
|
159
173
|
### `devecocli skills`
|
|
160
174
|
Manage HarmonyOS skills in AI agents/projects.
|
|
161
175
|
- `list [-l|--long]` / `find <keyword>`: List or search skills.
|
|
@@ -164,7 +178,7 @@ Manage HarmonyOS skills in AI agents/projects.
|
|
|
164
178
|
|
|
165
179
|
### `devecocli check compat` `[Outside sandbox]`
|
|
166
180
|
Scan source code for breaking API changes between two SDK versions. Built on top of DevEco Studio's `arkanalyzer-apiscan` plugin.
|
|
167
|
-
- `versions`: List available target SDK versions.
|
|
181
|
+
- `versions`: List available target SDK versions. Opts: `--format <default|json>` (default: `default`).
|
|
168
182
|
- Default (no args): project-level scan.
|
|
169
183
|
- `--modules <m1> [m2...]`: Module-level scan.
|
|
170
184
|
- `<file1> [file2...]`: File-level scan (`.ets`/`.c`/`.cpp` only).
|
|
@@ -191,7 +205,7 @@ Validation order: `files` + `--modules` mutually exclusive → `--source-version
|
|
|
191
205
|
- **Release build**:
|
|
192
206
|
`devecocli build --product oversea --build-mode release`
|
|
193
207
|
- **First-time signing setup**:
|
|
194
|
-
`devecocli login` -> `devecocli signature generate --product default` -> `devecocli build` -> `devecocli run`
|
|
208
|
+
`devecocli auth login` -> `devecocli signature generate --product default` -> `devecocli build` -> `devecocli run`
|
|
195
209
|
|
|
196
210
|
## Troubleshooting
|
|
197
211
|
|
|
@@ -199,10 +213,10 @@ Validation order: `files` + `--modules` mutually exclusive → `--source-version
|
|
|
199
213
|
- **"Multiple entry modules" / "No entry module"**: Pass `--modules` (build) or `--module` (run).
|
|
200
214
|
- **"No active devices" / "Multiple devices connected"**: Connect/start emulator. Pass `-t <serial>` (device view) or `--device <name|serial>` (run/log).
|
|
201
215
|
- **`error:install sign info inconsistent`**: Signing key changed. Run `devecocli run --uninstall` or `devecocli signature generate --force`.
|
|
202
|
-
- **`Not logged in. Run devecocli login first`**: Run `devecocli login` to authenticate.
|
|
216
|
+
- **`Not logged in. Run devecocli auth login first`**: Run `devecocli auth login` to authenticate.
|
|
203
217
|
- **`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`.
|
|
204
|
-
- **`Invalid AccessToken. Sign in and try again`**: Token expired. Run `devecocli login` again.
|
|
205
|
-
- **`skills add` agent not found**: Valid: `codebuddy`, `cursor`, `opencode`, `qoder`, `trae-cn`.
|
|
218
|
+
- **`Invalid AccessToken. Sign in and try again`**: Token expired. Run `devecocli auth login` again.
|
|
219
|
+
- **`skills add` agent not found**: Valid: `atomcode`, `codebuddy`, `cursor`, `opencode`, `qoder`, `trae-cn`.
|
|
206
220
|
- **`emulator start` / `image download` blocked on agreement**: User MUST accept agreements. Interactive: `devecocli emulator license` (requires TTY). Non-interactive (CI/scripts): `devecocli emulator license accept`. Agents cannot run the interactive form; suggest the user run it, or use `license accept` if a non-TTY flow is acceptable. Do not retry until accepted.
|
|
207
221
|
- **`image download` failure / timeout**: Do NOT auto-retry. Give the command to the user to run manually in their terminal.
|
|
208
222
|
- **`emulator create` timeout**: Treat as user-action step. Ask user to open DevEco Studio -> Device Manager. Check `emulator list` after user confirms. Do NOT auto-retry or edit SDK files.
|