@deveco-test/deveco-cli 1.3.0-Test.1 → 1.3.0-Test.10
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/LICENSE +21 -21
- package/README.md +1423 -788
- package/SKILL.md +214 -116
- package/THIRD-PARTY-LICENSES +4441 -3538
- package/dist/cli.js +207 -88
- package/dist/internal/doc-init-background.js +1 -0
- package/docs.zip +0 -0
- package/index.zip +0 -0
- package/package.json +22 -7
- package/scripts/postinstall.mjs +33 -0
- package/src/resources/aclPermission/aclPermissionsInfo.json +311 -0
- package/templates/application/AppScope/app.json5 +10 -10
- package/templates/application/AppScope/resources/base/element/string.json +8 -8
- package/templates/application/AppScope/resources/base/media/layered_image.json +6 -6
- package/templates/application/build-profile.json5 +41 -41
- package/templates/application/code-linter.json5 +31 -31
- package/templates/application/entry/build-profile.json5 +32 -32
- package/templates/application/entry/gitignore.txt +6 -0
- package/templates/application/entry/hvigorfile.ts +7 -7
- package/templates/application/entry/obfuscation-rules.txt +19 -19
- package/templates/application/entry/oh-package.json5 +10 -10
- package/templates/application/entry/src/main/ets/entryability/EntryAbility.ets +62 -62
- package/templates/application/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +30 -30
- package/templates/application/entry/src/main/ets/pages/Index.ets +37 -37
- package/templates/application/entry/src/main/module.json5 +49 -49
- package/templates/application/entry/src/main/resources/base/element/color.json +7 -7
- package/templates/application/entry/src/main/resources/base/element/float.json +8 -8
- package/templates/application/entry/src/main/resources/base/element/string.json +15 -15
- package/templates/application/entry/src/main/resources/base/media/layered_image.json +6 -6
- package/templates/application/entry/src/main/resources/base/profile/backup_config.json +2 -2
- package/templates/application/entry/src/main/resources/base/profile/main_pages.json +5 -5
- package/templates/application/entry/src/main/resources/dark/element/color.json +7 -7
- package/templates/application/gitignore.txt +12 -0
- package/templates/application/hvigor/hvigor-config.json5 +23 -23
- package/templates/application/hvigorfile.ts +7 -7
- package/templates/application/oh-package.json5 +10 -10
package/SKILL.md
CHANGED
|
@@ -1,116 +1,214 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: deveco-cli
|
|
3
|
-
description: >-
|
|
4
|
-
**MUST** use 'devecocli' for HarmonyOS apps (scaffold, build, run, debug, devices, emulators, logs, docs, 鸿蒙开发文档, skills). **REQUIRED** and **MANDATORY** if workspace has build-profile.json5 or oh-package.json5, or user mentions HarmonyOS, 鸿蒙, DevEco, ArkTS, ArkUI, docs, 鸿蒙文档, 知识, 搜索,
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# DevEco CLI
|
|
8
|
-
|
|
9
|
-
`devecocli` wraps DevEco Studio's `hvigor`, `ohpm`, `hdc`, emulator toolchain, and
|
|
10
|
-
|
|
11
|
-
Available commands: `build`, `run`, `update`, `device`, `emulator`, `skills`, `log`, `create`, `init`, `serve`, `docs`.
|
|
12
|
-
|
|
13
|
-
**Sandbox Rule**: Commands tagged `[Outside sandbox]` must be run outside the sandbox.
|
|
14
|
-
|
|
15
|
-
## 1. Code → Build → Deploy → Run → Debug
|
|
16
|
-
|
|
17
|
-
### `devecocli create`
|
|
18
|
-
Scaffold a new HarmonyOS project.
|
|
19
|
-
- `--app-name <name>` (Req): 1–200 chars, `^[a-zA-Z][a-zA-Z0-9_]*$`
|
|
20
|
-
- `--project-path <path>`: Auto-created if omitted (`./<app-name>`). Must be empty if exists.
|
|
21
|
-
- `--bundle-name <bundle>`: Default `com.example.<appname-lowercase>`. 7–128 chars, ≥3 segments.
|
|
22
|
-
- `--api-level <level>`: int ≥17 (default: auto or 23).
|
|
23
|
-
*Ex*: `devecocli create --app-name MyApp --project-path ./CustomDir --api-level 23`
|
|
24
|
-
|
|
25
|
-
### `devecocli build` `[Outside sandbox]`
|
|
26
|
-
Compile and package project/modules. (Defaults: `--product default`, `--build-mode debug`)
|
|
27
|
-
| Goal | Command |
|
|
28
|
-
|---|---|
|
|
29
|
-
| Single-module / single-`entry` | `devecocli build` |
|
|
30
|
-
| Specific modules | `devecocli build --modules <m1> <m2>@<target>` |
|
|
31
|
-
| Whole product bundle (.app) | `devecocli build --product <name>` |
|
|
32
|
-
| Clean build outputs | `devecocli build clean` |
|
|
33
|
-
|
|
34
|
-
### `devecocli
|
|
35
|
-
|
|
36
|
-
- `
|
|
37
|
-
-
|
|
38
|
-
- `
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- `
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- `
|
|
48
|
-
- `
|
|
49
|
-
- `
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- `
|
|
53
|
-
- `
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- `--
|
|
61
|
-
- `--
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- `--
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
### `devecocli
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
- `--
|
|
81
|
-
- `--
|
|
82
|
-
- `--
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
-
|
|
1
|
+
---
|
|
2
|
+
name: deveco-cli
|
|
3
|
+
description: >-
|
|
4
|
+
**MUST** use 'devecocli' for HarmonyOS apps (scaffold, build, run, debug, devices, emulators, logs, docs, UI inspection, 鸿蒙开发文档, skills). **REQUIRED** and **MANDATORY** if workspace has build-profile.json5 or oh-package.json5, or user mentions HarmonyOS, 鸿蒙, DevEco, ArkTS, ArkUI, docs, 鸿蒙文档, 知识, 搜索, skills, UI, UI测试, 组件调试.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# DevEco CLI
|
|
8
|
+
|
|
9
|
+
`devecocli` wraps DevEco Studio's `hvigor`, `ohpm`, `hdc`, emulator toolchain, and bundled skills installer. **Prefer `devecocli` over invoking underlying tools directly.**
|
|
10
|
+
|
|
11
|
+
Available commands: `build`, `check`, `run`, `update`, `device`, `emulator`, `ui`, `skills`, `log`, `create`, `init`, `serve`, `docs`, `signature`, `auth`.
|
|
12
|
+
|
|
13
|
+
**Sandbox Rule**: Commands tagged `[Outside sandbox]` must be run outside the sandbox.
|
|
14
|
+
|
|
15
|
+
## 1. Code → Build → Deploy → Run → Debug
|
|
16
|
+
|
|
17
|
+
### `devecocli create`
|
|
18
|
+
Scaffold a new HarmonyOS project.
|
|
19
|
+
- `--app-name <name>` (Req): 1–200 chars, `^[a-zA-Z][a-zA-Z0-9_]*$`
|
|
20
|
+
- `--project-path <path>`: Auto-created if omitted (`./<app-name>`). Must be empty if exists.
|
|
21
|
+
- `--bundle-name <bundle>`: Default `com.example.<appname-lowercase>`. 7–128 chars, ≥3 segments.
|
|
22
|
+
- `--api-level <level>`: int ≥17 (default: auto or 23).
|
|
23
|
+
*Ex*: `devecocli create --app-name MyApp --project-path ./CustomDir --api-level 23`
|
|
24
|
+
|
|
25
|
+
### `devecocli build` `[Outside sandbox]`
|
|
26
|
+
Compile and package project/modules. (Defaults: `--product default`, `--build-mode debug`)
|
|
27
|
+
| Goal | Command |
|
|
28
|
+
|---|---|
|
|
29
|
+
| Single-module / single-`entry` | `devecocli build` |
|
|
30
|
+
| Specific modules | `devecocli build --modules <m1> <m2>@<target>` |
|
|
31
|
+
| Whole product bundle (.app) | `devecocli build --product <name>` |
|
|
32
|
+
| Clean build outputs | `devecocli build clean` |
|
|
33
|
+
|
|
34
|
+
### `devecocli check lint`
|
|
35
|
+
Run DevEco Code Linter checks for TS/ArkTS code.
|
|
36
|
+
- `[path]`: File or directory to lint. Defaults to the project root from `build-profile.json5`, otherwise the current directory.
|
|
37
|
+
- Options: `--config-path <file>`, `--fix`, `--incremental`, `--product <name>`, `--format <default|json>`, `--output-path <path>`, `--limit <number>`.
|
|
38
|
+
- 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
|
+
### `devecocli emulator`
|
|
41
|
+
Manage local emulator instances and system images.
|
|
42
|
+
- `list`: Show instances (status, serial, device type).
|
|
43
|
+
- `start <names...>`: Start instances. Quote names with spaces. (See Troubleshooting if blocked).
|
|
44
|
+
- `stop <names...>`: Stop by name or serial (`127.0.0.1:<port>`).
|
|
45
|
+
- Scene control commands require Emulator 7.0 or later. Use `DEVECO_CLI_DEBUG=1` to inspect the underlying `Emulator` command mapping.
|
|
46
|
+
- `shake` / `power` / `rotate <left|right>` / `volume <up|down>` (Req: `--target <nameOrSerial>`): Basic emulator controls.
|
|
47
|
+
- `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.
|
|
49
|
+
- `geolocation` (Req: `--target`; one of `--longitude`, `--latitude`, `--altitude`, `--direction`): Inject GPS data.
|
|
50
|
+
- `scene <outdoorRunning|outdoorCycling|drivingNavigation>` (Req: `--target`): Start motion simulation.
|
|
51
|
+
- `sensor` (Req: `--target`; one of `--light-intensity`, `--humidity`, `--temperature`, `--steps`, `--heartrate`): Inject sensor data.
|
|
52
|
+
- `create <name>` (Req: `--device-type`, `--os-version`): Create instance. Optional: `--force`.
|
|
53
|
+
- `delete <name>`: Delete instance.
|
|
54
|
+
- `image list`: List downloaded images. Opts: `--device-type <type>`, `--all`, `--format <table|json>`.
|
|
55
|
+
- `image download` / `image remove` (Req: `--device-type`, `--os-version`): Download/remove image. (Takes 30+ min, set long timeout).
|
|
56
|
+
*Device types*: `phone`, `foldable`, `widefold`, `triplefold`, `tablet`, `2in1`, `2in1 foldable`, `wearable`, `tv`.
|
|
57
|
+
|
|
58
|
+
### `devecocli ui`
|
|
59
|
+
Inspect UI on a connected physical device or running emulator.
|
|
60
|
+
- `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>`, `--path <path>` (existing directory or PNG file path whose parent exists; create the directory first; default: `./screenshot-<timestamp>.png`).
|
|
62
|
+
- Implementation uses `hdc shell snapshot_display` and `hdc file recv`; set `DEVECO_CLI_DEBUG=1` to inspect the actual `hdc` commands.
|
|
63
|
+
*Ex*: `mkdir -p screenshots && devecocli ui screenshot --device Phone --path ./screenshots/phone.png`
|
|
64
|
+
|
|
65
|
+
### `devecocli docs`
|
|
66
|
+
Search/read local HarmonyOS docs.
|
|
67
|
+
- `search <keywords...>`: Match any keyword. Opts: `--catalog <name>`, `--format <default|json>`, `--limit <n>`.
|
|
68
|
+
- `read <documentId>`: Read full content by ID (e.g. `devecocli docs read 开发指南/冷启动_Launch分析/Launch模板基本操作/ide-insight-session-launch`).
|
|
69
|
+
- `catalog`: List available catalogs.
|
|
70
|
+
|
|
71
|
+
### `devecocli device`
|
|
72
|
+
- `list`: Show active real devices and running emulators.
|
|
73
|
+
- `view`: Detailed info. Req `-t <name|serial>` on multi-device hosts.
|
|
74
|
+
|
|
75
|
+
### `devecocli run` `[Outside sandbox]`
|
|
76
|
+
Build, install, and launch.
|
|
77
|
+
- `--module <module>`: Target module (auto-selected if only one runnable).
|
|
78
|
+
- `--device <name|serial>`: Target device (Req if multiple connected).
|
|
79
|
+
- `--product <product>` / `--build-mode <mode>`: Defaults: `default` / `debug`.
|
|
80
|
+
- `--ability <ability>`: Default from `module.json5`.
|
|
81
|
+
- `--uninstall`: Uninstall existing app first (Fixes signing key issues).
|
|
82
|
+
- `--skip-build`: Deploy existing artifacts.
|
|
83
|
+
- `--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).
|
|
84
|
+
- `<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.
|
|
85
|
+
- **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
|
+
- **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
|
+
*Ex*: `devecocli run` → edit code → write `.hvigor/changes.txt` → `devecocli run --apply changes.txt`
|
|
88
|
+
|
|
89
|
+
### `devecocli signature generate` `[Outside sandbox]`
|
|
90
|
+
Auto-generate HarmonyOS signing materials (local p12/csr + cloud cert + test profile) and write signing config to `build-profile.json5`.
|
|
91
|
+
- **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
|
+
- `--product <name>`: Product name for local p12/csr file naming (default: `default`).
|
|
93
|
+
- `--team-id <id>`: Specify the team-id (default: current user's id).
|
|
94
|
+
- `--force`: Force regenerate even if existing materials are valid.
|
|
95
|
+
- Generates under `~/.ohos/config/`: `.p12` keystore, `.csr`, downloaded `.cer` certificate, `.p7b` profile.
|
|
96
|
+
- Writes `signingConfigs` + `products` entries to `build-profile.json5` with encrypted key/store passwords (AES-128-GCM).
|
|
97
|
+
- Cloud cert name: `auto_debug_<teamId>.cer`. Local files: `<product>_<project>_<hash>=.{p12,csr,cer,p7b}`.
|
|
98
|
+
- Error handling (aligned with DevEco Studio JAR): 401→re-login, 403→no AGC permission, `205389872`→cert limit, `205389904`→not Harmony user, `205389938`→provision limit, invalid `.cer`→retry.
|
|
99
|
+
*Ex*: `devecocli signature generate --product default`
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
### `devecocli log`
|
|
103
|
+
Fetch hilog or crash logs. Req `--device <name|serial>` on multi-device hosts.
|
|
104
|
+
- `--crash`: Dump crash logs.
|
|
105
|
+
- `--level D|I|W|E|F`: Filter by level.
|
|
106
|
+
- `--bundle-name` / `--keyword`: Filter output.
|
|
107
|
+
- `--from <start>` / `--to <end>`: Relative offsets (`30s`, `5m`).
|
|
108
|
+
- `--tail <num>` / `--follow`: Keep last N lines / stream real-time (no `--to`).
|
|
109
|
+
*Ex*: `devecocli log --crash --bundle-name com.example.app`, `devecocli log --level E --from 5m --tail 200`
|
|
110
|
+
|
|
111
|
+
### `devecocli ui`
|
|
112
|
+
Inspect UI on a connected device. All subcommands accept `--device <name|serial>` (Req on multi-device hosts).
|
|
113
|
+
|
|
114
|
+
| Subcommand | Description | Key Options |
|
|
115
|
+
|---|---|---|
|
|
116
|
+
| `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 default\|json`, `--all` (include system windows) |
|
|
118
|
+
| `screenshot` | Capture a screenshot of the device screen | `--display <displayId>`, `--path <path>` (existing directory or PNG file path whose parent exists; default: `./screenshot-<timestamp>.png`) |
|
|
119
|
+
| `click [x] [y]` | Tap at the specified coordinates or node | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
|
|
120
|
+
| `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
|
|
121
|
+
| `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 (precise coordinates, custom speed) | `--speed <n>` (200–40000, px/s) |
|
|
123
|
+
| `fling <x1> <y1> <x2> <y2>` | Fling from one point to another | `--speed <n>` (200–40000, px/s) |
|
|
124
|
+
| `drag <x1> <y1> <x2> <y2>` | Drag from one point to another | `--speed <n>` (200–40000, px/s) |
|
|
125
|
+
| `dircfling <direction>` | Quick directional fling (system default speed, ideal for scrolling) | `direction`: `up`, `down`, `left`, `right` |
|
|
126
|
+
| `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
|
+
|
|
128
|
+
- **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.
|
|
129
|
+
- **`--window`**: May only be used together with `--id`. Default is focused window. Secondary display operations via `--id` + `--window` are not supported.
|
|
130
|
+
- **`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).
|
|
131
|
+
- **Text encoding**: Special characters in `text` are Base64-encoded internally to safely pass through device shell.
|
|
132
|
+
- `--format json` pairs well with `jq`.
|
|
133
|
+
- `--mode full`: full layout tree, no filtering.
|
|
134
|
+
- `--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.
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
## 2. Setup
|
|
138
|
+
|
|
139
|
+
### `devecocli init`
|
|
140
|
+
MUTUALLY EXCLUSIVE modes for setup:
|
|
141
|
+
1. `--skill` (Default): Install `deveco-cli` skill to AI agents.
|
|
142
|
+
2. `--mcp`: Configure `deveco-mcp` server (ArkTS/C++ syntax checking).
|
|
143
|
+
*Options*:
|
|
144
|
+
- `--agent <agents>`: Comma-separated (e.g. `opencode,cursor`). Omitting targets all.
|
|
145
|
+
- `--project <path>`: Project-level config (Abs path for MCP).
|
|
146
|
+
- `--path <path>`: Direct skill install path.
|
|
147
|
+
- `-f, --force`: Overwrite existing config.
|
|
148
|
+
*MCP Rules*: Global MCP (no `--project`) only supports `opencode` and `cursor`. Others require `--project`.
|
|
149
|
+
|
|
150
|
+
### `devecocli auth login`
|
|
151
|
+
Sign in to your Huawei Developer account. Opens a browser for OAuth authentication. Required before `signature generate`.
|
|
152
|
+
*Ex*: `devecocli auth login`
|
|
153
|
+
|
|
154
|
+
### `devecocli auth logout`
|
|
155
|
+
Sign out and clear locally stored credentials.
|
|
156
|
+
|
|
157
|
+
### `devecocli auth status`
|
|
158
|
+
Show the current logged-in user.
|
|
159
|
+
|
|
160
|
+
### `devecocli auth team list`
|
|
161
|
+
List team accounts the current user has joined.
|
|
162
|
+
|
|
163
|
+
### `devecocli skills`
|
|
164
|
+
Manage HarmonyOS skills in AI agents/projects.
|
|
165
|
+
- `list [-l|--long]` / `find <keyword>`: List or search skills.
|
|
166
|
+
- `add (--all | --skill <name>) [--agent <a,b…>] [--project <path>] [--path <path>] [-f]`: Install.
|
|
167
|
+
- `remove --skill <name> [...]`: Uninstall.
|
|
168
|
+
|
|
169
|
+
### `devecocli check compat` `[Outside sandbox]`
|
|
170
|
+
Scan source code for breaking API changes between two SDK versions. Built on top of DevEco Studio's `arkanalyzer-apiscan` plugin.
|
|
171
|
+
- `versions`: List available target SDK versions.
|
|
172
|
+
- Default (no args): project-level scan.
|
|
173
|
+
- `--modules <m1> [m2...]`: Module-level scan.
|
|
174
|
+
- `<file1> [file2...]`: File-level scan (`.ets`/`.c`/`.cpp` only).
|
|
175
|
+
- `--source-version <v>` (Req) / `--target-version <v>` (Req): SDK version pair. Run `devecocli check compat versions` first; on zsh, **quote the value** (e.g. `"<source_version>"`, `"<target_version>"`).
|
|
176
|
+
- `--format <default|csv|json>` (default: `default`): Console output accepts `default` (text) or `json`; file output (via `--output-path`) accepts `default` (csv), `csv`, or `json`. `csv` requires `--output-path`.
|
|
177
|
+
- `--output-path <path>`: Directory (writes `apiChange-*.csv`/`apiChange-*.json`) or explicit file (extension must match `--format`).
|
|
178
|
+
- `--limit <n>` (default `100`): Max records shown on console when no `--output-path`.
|
|
179
|
+
|
|
180
|
+
Validation order: `files` + `--modules` mutually exclusive → `--source-version`/`--target-version` required → `csv` requires `--output-path` → project dir valid → modules exist → files exist + extension valid → versions in catalog + `target > source` → format/extension match → output target writable.
|
|
181
|
+
|
|
182
|
+
*Ex*: `devecocli check compat --source-version "<source_version>" --target-version "<target_version>" --output-path ./report`
|
|
183
|
+
|
|
184
|
+
## 3. Maintenance
|
|
185
|
+
|
|
186
|
+
- **`devecocli update`** `[Outside sandbox]`: Update CLI to latest version.
|
|
187
|
+
- **`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`).
|
|
188
|
+
|
|
189
|
+
## Recipes
|
|
190
|
+
|
|
191
|
+
- **Fresh checkout to emulator**:
|
|
192
|
+
`devecocli build` -> `devecocli emulator list` -> `devecocli emulator start "Name"` -> `devecocli run`
|
|
193
|
+
- **Diagnose crash**:
|
|
194
|
+
`devecocli log --crash --bundle-name <bundle>`
|
|
195
|
+
- **Release build**:
|
|
196
|
+
`devecocli build --product oversea --build-mode release`
|
|
197
|
+
- **First-time signing setup**:
|
|
198
|
+
`devecocli auth login` -> `devecocli signature generate --product default` -> `devecocli build` -> `devecocli run`
|
|
199
|
+
|
|
200
|
+
## Troubleshooting
|
|
201
|
+
|
|
202
|
+
- **"Product / Build mode `<x>` not found"**: Check `build-profile.json5`.
|
|
203
|
+
- **"Multiple entry modules" / "No entry module"**: Pass `--modules` (build) or `--module` (run).
|
|
204
|
+
- **"No active devices" / "Multiple devices connected"**: Connect/start emulator. Pass `-t <serial>` (device view) or `--device <name|serial>` (run/log).
|
|
205
|
+
- **`error:install sign info inconsistent`**: Signing key changed. Run `devecocli run --uninstall` or `devecocli signature generate --force`.
|
|
206
|
+
- **`Not logged in. Run devecocli auth login first`**: Run `devecocli auth login` to authenticate.
|
|
207
|
+
- **`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`.
|
|
208
|
+
- **`Invalid AccessToken. Sign in and try again`**: Token expired. Run `devecocli auth login` again.
|
|
209
|
+
- **`skills add` agent not found**: Valid: `codebuddy`, `cursor`, `opencode`, `qoder`, `trae-cn`.
|
|
210
|
+
- **`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.
|
|
211
|
+
- **`image download` failure / timeout**: Do NOT auto-retry. Give the command to the user to run manually in their terminal.
|
|
212
|
+
- **`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.
|
|
213
|
+
- **`image list` duplicate OS rows**: `phone`/`foldable`/`widefold`/`triplefold` share the same image. Download/remove ONCE per OS version.
|
|
214
|
+
**`ui layout` missing expected node**: `layout` only returns on-screen nodes. The user must scroll the target into view on the device before retrying (no CLI input subcommands in this build).
|