@deveco-test/deveco-cli-openharmony-arm64 0.1.6 → 0.4.0-TD.3.6

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.
Files changed (42) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +837 -837
  3. package/SKILL.md +187 -186
  4. package/THIRD-PARTY-LICENSES +4 -4
  5. package/dist/cli.js +135 -126
  6. package/dist/internal/telemetry-upload-background.js +9 -0
  7. package/docs.zip +2 -2
  8. package/index.zip +0 -0
  9. package/package.json +108 -108
  10. package/scripts/install-better-sqlite3.mjs +51 -51
  11. package/scripts/install-jieba-wasm.mjs +47 -47
  12. package/scripts/lib/better-sqlite3-vendor.mjs +128 -128
  13. package/scripts/lib/cli-data-dir.mjs +44 -44
  14. package/scripts/lib/doc-init-log-path.mjs +15 -15
  15. package/scripts/lib/jieba-wasm-vendor.mjs +102 -102
  16. package/scripts/postinstall.mjs +64 -64
  17. package/src/resources/aclPermission/aclPermissionsInfo.json +310 -310
  18. package/templates/application/AppScope/app.json5 +10 -10
  19. package/templates/application/AppScope/resources/base/element/string.json +8 -8
  20. package/templates/application/AppScope/resources/base/media/layered_image.json +6 -6
  21. package/templates/application/build-profile.json5 +41 -41
  22. package/templates/application/code-linter.json5 +31 -31
  23. package/templates/application/entry/build-profile.json5 +32 -32
  24. package/templates/application/entry/gitignore.txt +5 -5
  25. package/templates/application/entry/hvigorfile.ts +7 -7
  26. package/templates/application/entry/obfuscation-rules.txt +19 -19
  27. package/templates/application/entry/oh-package.json5 +10 -10
  28. package/templates/application/entry/src/main/ets/entryability/EntryAbility.ets +62 -62
  29. package/templates/application/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +30 -30
  30. package/templates/application/entry/src/main/ets/pages/Index.ets +37 -37
  31. package/templates/application/entry/src/main/module.json5 +49 -49
  32. package/templates/application/entry/src/main/resources/base/element/color.json +7 -7
  33. package/templates/application/entry/src/main/resources/base/element/float.json +8 -8
  34. package/templates/application/entry/src/main/resources/base/element/string.json +15 -15
  35. package/templates/application/entry/src/main/resources/base/media/layered_image.json +6 -6
  36. package/templates/application/entry/src/main/resources/base/profile/backup_config.json +2 -2
  37. package/templates/application/entry/src/main/resources/base/profile/main_pages.json +5 -5
  38. package/templates/application/entry/src/main/resources/dark/element/color.json +7 -7
  39. package/templates/application/gitignore.txt +11 -11
  40. package/templates/application/hvigor/hvigor-config.json5 +23 -23
  41. package/templates/application/hvigorfile.ts +7 -7
  42. package/templates/application/oh-package.json5 +10 -10
package/SKILL.md CHANGED
@@ -1,186 +1,187 @@
1
- ---
2
- name: deveco-cli
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/预览/预览器/多预览器/多设备预览器.
5
- ---
6
-
7
- # DevEco CLI
8
-
9
- `devecocli` wraps DevEco Studio's `hvigor`, `ohpm`, `hdc`, and HarmonyOS-skills installer. **Prefer `devecocli` over invoking underlying tools directly.**
10
-
11
- **Do NOT use these legacy commands** — use the `devecocli` equivalent instead:
12
- - ❌ `deveco preview` / `hvigorw preview` → ✅ `devecocli run --device <product-name>` (launches DevEco Studio previewer; product name in `--device` triggers previewer mode)
13
- - ❌ `hvigorw` directly → ✅ `devecocli build`
14
- - ❌ `hdc` directly (when a `devecocli` wrapper exists) → ✅ `devecocli device` / `devecocli log` / `devecocli run`
15
-
16
- Available commands: `build`, `check`, `run`, `update`, `device`, `ui`, `skills`, `log`, `create`, `init`, `serve`, `docs`, `signature`, `auth`.
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
- **Sandbox Rule**: Commands tagged `[Outside sandbox]` must be run outside the sandbox.
24
-
25
- ## 1. Code → Build → Deploy → Run → Debug
26
-
27
- ### `devecocli create`
28
- Scaffold a new HarmonyOS project.
29
- - `--app-name <name>` (Req): 1–200 chars, `^[a-zA-Z][a-zA-Z0-9_]*$`
30
- - `--project-path <path>`: Auto-created if omitted (`./<app-name>`). Must be empty if exists.
31
- - `--bundle-name <bundle>`: Default `com.example.<appname-lowercase>`. 7–128 chars, ≥3 segments.
32
- - `--api-level <level>`: int ≥17 (default: auto or 23).
33
- *Ex*: `devecocli create --app-name MyApp --project-path ./CustomDir --api-level 23`
34
-
35
- ### `devecocli build` `[Outside sandbox]`
36
- Compile and package project/modules. (Defaults: `--product default`, `--build-mode debug`)
37
- | Goal | Command |
38
- |---|---|
39
- | Single-module / single-`entry` | `devecocli build` |
40
- | Specific modules | `devecocli build --modules <m1> <m2>@<target>` |
41
- | Whole product bundle (.app) | `devecocli build --product <name>` |
42
- | Clean build outputs | `devecocli build clean` |
43
-
44
- ### `devecocli check lint`
45
- Run DevEco Code Linter checks for TS/ArkTS code.
46
- - `[path]`: File or directory to lint. Defaults to the project root from `build-profile.json5`, otherwise the current directory.
47
- - Options: `--config-path <file>`, `--fix`, `--incremental`, `--product <name>`, `--format <default|json>`, `--output-path <path>`, `--limit <number>`.
48
-
49
- ### `devecocli docs`
50
- Search/read local HarmonyOS docs.
51
- - `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`).
53
- - `catalog`: List available catalogs.
54
-
55
- ### `devecocli device`
56
- - `list`: Show active real devices.
57
- - `view`: Detailed info. Req `-t <name|serial>` on multi-device hosts.
58
-
59
- ### `devecocli run` `[Outside sandbox]`
60
- Build, install, and launch.
61
- - `--module <module>`: Target module (auto-selected if only one runnable).
62
- - `--device <name|serial>`: Target device (Req if multiple connected).
63
- - `--product <product>` / `--build-mode <mode>`: Defaults: `default` / `debug`.
64
- - `--ability <ability>`: Default from `module.json5`.
65
- - `--uninstall`: Uninstall existing app first (Fixes signing key issues).
66
- - `--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).
68
- - `<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
- - **Prereq**: run `devecocli run` once first (full build + deploy + generates the `buildConfig.json` cache that `--apply` reuses).
70
- - **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
- *Ex*: `devecocli run` → edit code → write `.hvigor/changes.txt` → `devecocli run --apply changes.txt`
72
- - **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
- - Single Previewer: `devecocli run --device "Pura 90 Pro"`
74
- - Multi Previewer: `devecocli run --device "Pura 90 Pro,MatePad 11.5'S"`
75
- - 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).
78
- - Supported products: `Pura 90 Pro`, `MatePad 11.5'S`, `Mate X7`, `Pura X`, `Mate XT`. Aliases: `phone`, `pad`/`tablet`, `fold`/`foldable`.
79
-
80
- ### `devecocli signature generate` `[Outside sandbox]`
81
- Auto-generate HarmonyOS signing materials (local p12/csr + cloud cert + test profile) and write signing config to `build-profile.json5`.
82
- - **Prereq**: `devecocli auth login` first; run from a project directory (with `build-profile.json5`); a connected device is required for device registration.
83
- - `--product <name>`: Product name for local p12/csr file naming (default: `default`).
84
- - `--team-id <id>`: Specify the team-id (default: current user's id).
85
- - `--force`: Force regenerate even if existing materials are valid.
86
- - Generates under `~/.ohos/config/`: `.p12` keystore, `.csr`, downloaded `.cer` certificate, `.p7b` profile.
87
- - Writes `signingConfigs` + `products` entries to `build-profile.json5` with encrypted key/store passwords (AES-128-GCM).
88
- - Cloud cert name: `auto_debug_<teamId>.cer`. Local files: `<product>_<project>_<hash>=.{p12,csr,cer,p7b}`.
89
- - Error handling: 401→re-login, 403→no AGC permission, `205389872`→cert limit, `205389904`→not Harmony user, `205389938`→provision limit, invalid `.cer`→retry.
90
- *Ex*: `devecocli signature generate --product default`
91
-
92
- ### `devecocli log`
93
- Fetch hilog or crash logs. Req `--device <name|serial>` on multi-device hosts.
94
- - `--crash`: Dump crash logs.
95
- - `--level D|I|W|E|F`: Filter by level.
96
- - `--bundle-name` / `--keyword`: Filter output.
97
- - `--from <start>` / `--to <end>`: Relative offsets (`30s`, `5m`).
98
- - `--tail <num>` / `--follow`: Keep last N lines / stream real-time (no `--to`).
99
- *Ex*: `devecocli log --crash --bundle-name com.example.app`, `devecocli log --level E --from 5m --tail 200`
100
-
101
- ### `devecocli ui`
102
- Inspect UI on a connected device. All subcommands accept `--device <name|serial>` (Req on multi-device hosts).
103
-
104
- | Subcommand | Description | Key Options |
105
- |---|---|---|
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` |
107
- | `window list` | List active windows | `--format default\|json`, `--all` (include system windows) |
108
- | `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) |
109
- | `click [x] [y]` | Tap at the specified coordinates or node | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
110
- | `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
111
- | `longclick [x] [y]` | Long-press at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
112
- | `swipe <x1> <y1> <x2> <y2>` | Swipe from one point to another (precise coordinates, custom speed) | `--speed <n>` (200–40000, px/s) |
113
- | `fling <x1> <y1> <x2> <y2>` | Fling from one point to another | `--speed <n>` (200–40000, px/s) |
114
- | `drag <x1> <y1> <x2> <y2>` | Drag from one point to another | `--speed <n>` (200–40000, px/s) |
115
- | `dircfling <direction>` | Quick directional fling (system default speed, ideal for scrolling) | `direction`: `up`, `down`, `left`, `right` |
116
- | `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`) |
117
-
118
- - **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.
119
- - **`--window`**: May only be used together with `--id`. Default is focused window. Secondary display operations via `--id` + `--window` are not supported.
120
- - **`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).
121
- - **Text encoding**: Special characters in `text` are Base64-encoded internally to safely pass through device shell.
122
- - `--format json` pairs well with `jq`.
123
- - `--mode full`: full layout tree, no filtering.
124
- - `--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.
125
-
126
- ## 2. Setup
127
-
128
- ### `devecocli init`
129
- MUTUALLY EXCLUSIVE modes for setup:
130
- 1. `--skill` (Default): Install `deveco-cli` skill to AI agents.
131
- 2. `--mcp`: Configure `deveco-mcp` server (ArkTS/C++ syntax checking).
132
- *Options*:
133
- - `--agent <agents>`: Comma-separated (e.g. `opencode,cursor`). Omitting targets all.
134
- - `--project <path>`: Project-level config (Abs path for MCP).
135
- - `--path <path>`: Direct skill install path.
136
- - `-f, --force`: Overwrite existing config.
137
- *MCP Rules*: Global MCP (no `--project`) only supports `opencode` and `cursor`. Others require `--project`.
138
-
139
- ### `devecocli auth login`
140
- Sign in to your Huawei Developer account. Opens a browser for OAuth authentication. Required before `signature generate`.
141
- *Ex*: `devecocli auth login`
142
-
143
- ### `devecocli auth logout`
144
- Sign out and clear locally stored credentials.
145
-
146
- ### `devecocli auth status`
147
- Show the current logged-in user.
148
-
149
- ### `devecocli auth team list`
150
- List team accounts the current user has joined.
151
-
152
- ### `devecocli skills`
153
- Manage HarmonyOS skills in AI agents/projects.
154
- - `list [-l|--long]` / `find <keyword>`: List or search skills.
155
- - `add (--all | --skill <name>) [--agent <a,b…>] [--project <path>] [--path <path>] [-f]`: Install.
156
- - `remove --skill <name> [...]`: Uninstall.
157
-
158
- ## 3. Maintenance
159
-
160
- - **`devecocli update`** `[Outside sandbox]`: Update CLI to latest version.
161
- - **`devecocli serve mcp`**: Host stdio MCP server (`check` tool for `.ets`/C/C++). Used via `init --mcp`. (Env: `PROJECT_PATH`, `DEVECO_PATH`, `NODE_MAX_OLD_SPACE_SIZE`, `DEBUG=1`).
162
-
163
- ## Recipes
164
-
165
- - **Fresh checkout to real device**:
166
- `devecocli build` -> `devecocli device list` -> `devecocli run --device <serial>`
167
- - **Launch previewer**: `devecocli run --device "Pura 90 Pro"` (single) or `devecocli run --device "Pura 90 Pro,Mate XT"` (multi).
168
- - **Diagnose crash**:
169
- `devecocli log --crash --bundle-name <bundle>`
170
- - **Release build**:
171
- `devecocli build --product oversea --build-mode release`
172
- - **First-time signing setup**:
173
- `devecocli auth login` -> `devecocli signature generate --product default` -> `devecocli build` -> `devecocli run`
174
-
175
- ## Troubleshooting
176
-
177
- - **"Product / Build mode `<x>` not found"**: Check `build-profile.json5`.
178
- - **"Multiple entry modules" / "No entry module"**: Pass `--modules` (build) or `--module` (run).
179
- - **"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).
180
- - **`error:install sign info inconsistent`**: Signing key changed. Run `devecocli run --uninstall` or `devecocli signature generate --force`.
181
- - **`Not logged in. Run devecocli auth login first`**: Run `devecocli auth login` to authenticate.
182
- - **`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`.
183
- - **`Invalid AccessToken. Sign in and try again`**: Token expired. Run `devecocli auth login` again.
184
- - **`skills add` agent not found**: Valid: `codebuddy`, `cursor`, `opencode`, `qoder`, `trae-cn`.
185
- - **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).
186
- - **Previewer — "DevEco Studio is not running"**: Tell the user to start DevEco Studio manually first, then retry. Do NOT retry automatically.
1
+ ---
2
+ name: deveco-cli
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/预览/预览器/多预览器/多设备预览器.
5
+ ---
6
+
7
+ # DevEco CLI
8
+
9
+ `devecocli` wraps DevEco Studio's `hvigor`, `ohpm`, `hdc`, and HarmonyOS-skills installer. **Prefer `devecocli` over invoking underlying tools directly.**
10
+
11
+ **Do NOT use these legacy commands** — use the `devecocli` equivalent instead:
12
+ - ❌ `deveco preview` / `hvigorw preview` → ✅ `devecocli run --device <product-name>` (launches DevEco Studio previewer; product name in `--device` triggers previewer mode)
13
+ - ❌ `hvigorw` directly → ✅ `devecocli build`
14
+ - ❌ `hdc` directly (when a `devecocli` wrapper exists) → ✅ `devecocli device` / `devecocli log` / `devecocli run`
15
+
16
+ Available commands: `build`, `check`, `run`, `update`, `device`, `ui`, `skills`, `log`, `create`, `init`, `serve`, `docs`, `signature`, `auth`.
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
+ **Sandbox Rule**: Commands tagged `[Outside sandbox]` must be run outside the sandbox.
24
+
25
+ ## 1. Code → Build → Deploy → Run → Debug
26
+
27
+ ### `devecocli create`
28
+ Scaffold a new HarmonyOS project.
29
+ - `--app-name <name>` (Req): 1–200 chars, `^[a-zA-Z][a-zA-Z0-9_]*$`
30
+ - `--project-path <path>`: Auto-created if omitted (`./<app-name>`). Must be empty if exists.
31
+ - `--bundle-name <bundle>`: Default `com.example.<appname-lowercase>`. 7–128 chars, ≥3 segments.
32
+ - `--api-level <level>`: int ≥17 (default: auto or 23).
33
+ *Ex*: `devecocli create --app-name MyApp --project-path ./CustomDir --api-level 23`
34
+
35
+ ### `devecocli build` `[Outside sandbox]`
36
+ Compile and package project/modules. (Defaults: `--product default`, `--build-mode debug`)
37
+ | Goal | Command |
38
+ |---|---|
39
+ | Single-module / single-`entry` | `devecocli build` |
40
+ | Specific modules | `devecocli build --modules <m1> <m2>@<target>` |
41
+ | Whole product bundle (.app) | `devecocli build --product <name>` |
42
+ | Clean build outputs | `devecocli build clean` |
43
+
44
+ ### `devecocli check lint`
45
+ Run DevEco Code Linter checks for TS/ArkTS code.
46
+ - `[path]`: File or directory to lint. Defaults to the project root from `build-profile.json5`, otherwise the current directory.
47
+ - Options: `--config-path <file>`, `--fix`, `--incremental`, `--product <name>`, `--format <default|json>`, `--output-path <path>`, `--limit <number>`.
48
+
49
+ ### `devecocli docs`
50
+ Search/read local HarmonyOS docs.
51
+ - `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`).
53
+ - `catalog`: List available catalogs.
54
+
55
+ ### `devecocli device`
56
+ - `list`: Show active real devices.
57
+ - `view`: Detailed info. Req `-t <name|serial>` on multi-device hosts.
58
+
59
+ ### `devecocli run` `[Outside sandbox]`
60
+ Build, install, and launch.
61
+ - `--module <module>`: Target module (auto-selected if only one runnable).
62
+ - `--device <name|serial>`: Target device (Req if multiple connected).
63
+ - `--product <product>` / `--build-mode <mode>`: Defaults: `default` / `debug`.
64
+ - `--ability <ability>`: Default from `module.json5`.
65
+ - `--uninstall`: Uninstall existing app first (Fixes signing key issues).
66
+ - `--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).
68
+ - `<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
+ - **Prereq**: run `devecocli run` once first (full build + deploy + generates the `buildConfig.json` cache that `--apply` reuses).
70
+ - **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
+ *Ex*: `devecocli run` → edit code → write `.hvigor/changes.txt` → `devecocli run --apply changes.txt`
72
+ - **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
+ - Single Previewer: `devecocli run --device "Pura 90 Pro"`
74
+ - Multi Previewer: `devecocli run --device "Pura 90 Pro,MatePad 11.5'S"`
75
+ - 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).
78
+ - Supported products: `Pura 90 Pro`, `MatePad 11.5'S`, `Mate X7`, `Pura X`, `Mate XT`. Aliases: `phone`, `pad`/`tablet`, `fold`/`foldable`.
79
+
80
+ ### `devecocli signature generate` `[Outside sandbox]`
81
+ Auto-generate HarmonyOS signing materials (local p12/csr + cloud cert + test profile) and write signing config to `build-profile.json5`.
82
+ - **Prereq**: `devecocli auth login` first; run from a project directory (with `build-profile.json5`); a connected device is required for device registration.
83
+ - `--product <name>`: Product name for local p12/csr file naming (default: `default`).
84
+ - `--team-id <id>`: Specify the team-id (default: current user's id).
85
+ - `--force`: Force regenerate even if existing materials are valid.
86
+ - Generates under `~/.ohos/config/`: `.p12` keystore, `.csr`, downloaded `.cer` certificate, `.p7b` profile.
87
+ - Writes `signingConfigs` + `products` entries to `build-profile.json5` with encrypted key/store passwords (AES-128-GCM).
88
+ - Cloud cert name: `auto_debug_<teamId>.cer`. Local files: `<product>_<project>_<hash>=.{p12,csr,cer,p7b}`.
89
+ - Error handling: 401→re-login, 403→no AGC permission, `205389872`→cert limit, `205389904`→not Harmony user, `205389938`→provision limit, invalid `.cer`→retry.
90
+ *Ex*: `devecocli signature generate --product default`
91
+
92
+ ### `devecocli log`
93
+ Fetch hilog or crash logs. Req `--device <name|serial>` on multi-device hosts.
94
+ - `--crash`: Dump crash logs.
95
+ - `--level D|I|W|E|F`: Filter by level.
96
+ - `--bundle-name` / `--keyword`: Filter output.
97
+ - `--from <start>` / `--to <end>`: Relative offsets (`30s`, `5m`).
98
+ - `--tail <num>` / `--follow`: Keep last N lines / stream real-time (no `--to`).
99
+ *Ex*: `devecocli log --crash --bundle-name com.example.app`, `devecocli log --level E --from 5m --tail 200`
100
+
101
+ ### `devecocli ui`
102
+ Inspect UI on a connected device. All subcommands accept `--device <name|serial>` (Req on multi-device hosts).
103
+
104
+ | Subcommand | Description | Key Options |
105
+ |---|---|---|
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` |
107
+ | `window list` | List active windows | `--format default\|json`, `--all` (include system windows) |
108
+ | `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) |
109
+ | `click [x] [y]` | Tap at the specified coordinates or node | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
110
+ | `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
111
+ | `longclick [x] [y]` | Long-press at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
112
+ | `swipe <x1> <y1> <x2> <y2>` | Swipe from one point to another (precise coordinates, custom speed) | `--speed <n>` (200–40000, px/s) |
113
+ | `fling <x1> <y1> <x2> <y2>` | Fling from one point to another | `--speed <n>` (200–40000, px/s) |
114
+ | `drag <x1> <y1> <x2> <y2>` | Drag from one point to another | `--speed <n>` (200–40000, px/s) |
115
+ | `dircfling <direction>` | Quick directional fling (system default speed, ideal for scrolling) | `direction`: `up`, `down`, `left`, `right` |
116
+ | `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`) |
117
+
118
+ - **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.
119
+ - **`--window`**: May only be used together with `--id`. Default is focused window. Secondary display operations via `--id` + `--window` are not supported.
120
+ - **`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).
121
+ - **Text encoding**: Special characters in `text` are Base64-encoded internally to safely pass through device shell.
122
+ - `--format json` pairs well with `jq`.
123
+ - `--mode full`: full layout tree, no filtering.
124
+ - `--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.
125
+
126
+ ## 2. Setup
127
+
128
+ ### `devecocli init`
129
+ MUTUALLY EXCLUSIVE modes for setup:
130
+ 1. `--skill` (Default): Install `deveco-cli` skill to AI agents.
131
+ 2. `--mcp`: Configure `deveco-mcp` server (ArkTS/C++ syntax checking).
132
+ *Options*:
133
+ - `--agent <agents>`: Comma-separated (e.g. `opencode,cursor`). Omitting targets all.
134
+ - `--project <path>`: Project-level config (Abs path for MCP).
135
+ - `--path <path>`: Direct skill install path.
136
+ - `-f, --force`: Overwrite existing config.
137
+ *MCP Rules*: Global MCP (no `--project`) only supports `opencode` and `cursor`. Others require `--project`.
138
+
139
+ ### `devecocli auth login`
140
+ Sign in to your Huawei Developer account. Opens a browser for OAuth authentication. Required before `signature generate`.
141
+ - `--no-prompt`: Skip the interactive Enter confirmation and open the browser immediately. For AI agents / non-interactive terminals. Auto-skipped when stdin is not a TTY.
142
+ *Ex*: `devecocli auth login`
143
+
144
+ ### `devecocli auth logout`
145
+ Sign out and clear locally stored credentials.
146
+
147
+ ### `devecocli auth status`
148
+ Show the current logged-in user.
149
+
150
+ ### `devecocli auth team list`
151
+ List team accounts the current user has joined.
152
+
153
+ ### `devecocli skills`
154
+ Manage HarmonyOS skills in AI agents/projects.
155
+ - `list [-l|--long]` / `find <keyword>`: List or search skills.
156
+ - `add (--all | --skill <name>) [--agent <a,b…>] [--project <path>] [--path <path>] [-f]`: Install.
157
+ - `remove --skill <name> [...]`: Uninstall.
158
+
159
+ ## 3. Maintenance
160
+
161
+ - **`devecocli update`** `[Outside sandbox]`: Update CLI to latest version.
162
+ - **`devecocli serve mcp`**: Host stdio MCP server (`check` tool for `.ets`/C/C++). Used via `init --mcp`. (Env: `PROJECT_PATH`, `DEVECO_PATH`, `NODE_MAX_OLD_SPACE_SIZE`, `DEBUG=1`).
163
+
164
+ ## Recipes
165
+
166
+ - **Fresh checkout to real device**:
167
+ `devecocli build` -> `devecocli device list` -> `devecocli run --device <serial>`
168
+ - **Launch previewer**: `devecocli run --device "Pura 90 Pro"` (single) or `devecocli run --device "Pura 90 Pro,Mate XT"` (multi).
169
+ - **Diagnose crash**:
170
+ `devecocli log --crash --bundle-name <bundle>`
171
+ - **Release build**:
172
+ `devecocli build --product oversea --build-mode release`
173
+ - **First-time signing setup**:
174
+ `devecocli auth login` -> `devecocli signature generate --product default` -> `devecocli build` -> `devecocli run`
175
+
176
+ ## Troubleshooting
177
+
178
+ - **"Product / Build mode `<x>` not found"**: Check `build-profile.json5`.
179
+ - **"Multiple entry modules" / "No entry module"**: Pass `--modules` (build) or `--module` (run).
180
+ - **"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).
181
+ - **`error:install sign info inconsistent`**: Signing key changed. Run `devecocli run --uninstall` or `devecocli signature generate --force`.
182
+ - **`Not logged in. Run devecocli auth login first`**: Run `devecocli auth login` to authenticate.
183
+ - **`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`.
184
+ - **`Invalid AccessToken. Sign in and try again`**: Token expired. Run `devecocli auth login` again.
185
+ - **`skills add` agent not found**: Valid: `codebuddy`, `cursor`, `opencode`, `qoder`, `trae-cn`.
186
+ - **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).
187
+ - **Previewer — "DevEco Studio is not running"**: Tell the user to start DevEco Studio manually first, then retry. Do NOT retry automatically.
@@ -3126,7 +3126,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3126
3126
 
3127
3127
  The following npm packages may be included in this product:
3128
3128
 
3129
- - @node-rs/jieba-win32-x64-msvc@2.0.3
3129
+ - @node-rs/jieba-win32-x64-msvc@2.0.4
3130
3130
  - agent-base@6.0.2
3131
3131
  - https-proxy-agent@5.0.1
3132
3132
  - isarray@0.0.1
@@ -3292,7 +3292,7 @@ SOFTWARE.
3292
3292
 
3293
3293
  The following npm package may be included in this product:
3294
3294
 
3295
- - node-abi@3.96.0
3295
+ - node-abi@3.99.0
3296
3296
 
3297
3297
  This package contains the following license:
3298
3298
 
@@ -3597,7 +3597,7 @@ SOFTWARE.
3597
3597
 
3598
3598
  The following npm package may be included in this product:
3599
3599
 
3600
- - @node-rs/jieba@2.0.3
3600
+ - @node-rs/jieba@2.0.4
3601
3601
 
3602
3602
  This package contains the following license:
3603
3603
 
@@ -4123,7 +4123,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
4123
4123
  The following npm packages may be included in this product:
4124
4124
 
4125
4125
  - @sindresorhus/merge-streams@4.0.0
4126
- - ansi-regex@6.3.0
4126
+ - ansi-regex@6.4.0
4127
4127
  - chalk@5.6.2
4128
4128
  - cli-cursor@5.0.0
4129
4129
  - cli-spinners@2.9.2