@deveco-test/deveco-cli 1.3.0-Test.7 → 1.3.0-Test.9
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 +351 -37
- package/SKILL.md +18 -14
- package/THIRD-PARTY-LICENSES +2 -2
- package/dist/cli.js +101 -101
- package/dist/internal/doc-init-background.js +8 -8
- package/index.zip +0 -0
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
<a href="https://www.npmjs.com/package/@deveco/deveco-cli"><img src="https://img.shields.io/npm/v/@deveco/deveco-cli.svg" alt="NPM Version" /></a>
|
|
6
6
|
<a href="https://www.npmjs.com/package/@deveco/deveco-cli"><img src="https://img.shields.io/npm/dm/@deveco/deveco-cli.svg" alt="NPM Downloads" /></a>
|
|
7
7
|
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-%3E%3D18-green.svg" alt="Node.js" /></a>
|
|
8
|
-
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows-blue.svg" alt="Platform" />
|
|
8
|
+
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-blue.svg" alt="Platform" />
|
|
9
9
|
<a href="https://developer.huawei.com/consumer/cn/download/"><img src="https://img.shields.io/badge/DevEco%20Studio-%3E%3D6.1.0-orange.svg" alt="DevEco Studio" /></a>
|
|
10
|
+
<img src="https://img.shields.io/badge/Command%20Line%20Tools-%3E%3D26.0.0-orange.svg" alt="Command Line Tools" />
|
|
10
11
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License" /></a>
|
|
11
12
|
</p>
|
|
12
13
|
</div>
|
|
@@ -18,9 +19,9 @@
|
|
|
18
19
|
|
|
19
20
|
### 前置要求
|
|
20
21
|
|
|
21
|
-
- 操作系统为 `macOS`
|
|
22
|
+
- 操作系统为 `macOS` 、 `Windows` 或 `Linux`(需配置对应环境变量)
|
|
22
23
|
- Node.js >= 18,推荐使用22及以上版本
|
|
23
|
-
- [DevEco Studio](https://developer.huawei.com/consumer/cn/download/) >= 6.1.0
|
|
24
|
+
- [DevEco Studio](https://developer.huawei.com/consumer/cn/download/) >= 6.1.0 或 [Command Line Tools](https://developer.huawei.com/consumer/cn/download/) >= 26.0.0
|
|
24
25
|
- **macOS**:必须安装在 `~/Applications` 或 `/Applications` 目录下。
|
|
25
26
|
|
|
26
27
|
### 安装
|
|
@@ -53,6 +54,41 @@ devecocli docs read harmonyos-guides/application-models/arkts-page-start-overvie
|
|
|
53
54
|
|
|
54
55
|
更多命令和参数可通过 `devecocli --help` 或各子命令的 `--help` 查看。
|
|
55
56
|
|
|
57
|
+
## 环境变量
|
|
58
|
+
|
|
59
|
+
`devecocli` 当需要使用非默认安装路径、多版本并存时固定选型,Command Line Tools或在Linux下运行时,可通过以下环境变量显式指定工具链根:
|
|
60
|
+
|
|
61
|
+
| 名称 | 说明 |
|
|
62
|
+
| ------------------------ | ------------------------------------------------------ |
|
|
63
|
+
| `DEVECO_CLI_STUDIO_PATH` | 显式指定 DevEco Studio 安装根,优先级最高 |
|
|
64
|
+
| `DEVECO_CLI_CLT_PATH` | 显式指定 Command Line Tools 安装根 |
|
|
65
|
+
|
|
66
|
+
完整优先级链:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
DEVECO_CLI_STUDIO_PATH > DEVECO_CLI_CLT_PATH > Auto_Detect
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 平台与版本约束
|
|
73
|
+
|
|
74
|
+
| 平台 | DevEco Studio Auto_Detect | Command Line Tools | 最低版本 |
|
|
75
|
+
| ------- | --------------------------------------------- | ------------------ | ----------------------------- |
|
|
76
|
+
| Windows | 支持 | 可选 | Studio `6.1.0` / CLT `26.0.0` |
|
|
77
|
+
| macOS | 支持 | 可选 | 同上 |
|
|
78
|
+
| Linux | 不支持 | 必选 | CLT `26.0.0` |
|
|
79
|
+
|
|
80
|
+
### 使用示例
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# 设置 DevEco Studio
|
|
84
|
+
export DEVECO_CLI_STUDIO_PATH="/Applications/DevEco-Studio.app" (可带或不带尾部 Contents)
|
|
85
|
+
devecocli device list
|
|
86
|
+
|
|
87
|
+
# 设置 CLT
|
|
88
|
+
export DEVECO_CLI_CLT_PATH=/opt/command-line-tools
|
|
89
|
+
devecocli device list
|
|
90
|
+
```
|
|
91
|
+
|
|
56
92
|
## AI Agent 集成
|
|
57
93
|
|
|
58
94
|
`DevEco CLI` 支持通过命令行将自身技能添加到 `Agent` 中。下面以 `opencode` 为例展示最短流程:
|
|
@@ -92,6 +128,9 @@ devecocli init --path D:\work\ARKTS\NewData
|
|
|
92
128
|
| `devecocli device list` | 查看当前连接设备 |
|
|
93
129
|
| `devecocli emulator list` | 查看本地模拟器实例 |
|
|
94
130
|
| `devecocli ui screenshot` | 对真机或模拟器执行 UI 截图 |
|
|
131
|
+
| `devecocli ui click` | 点击指定坐标或节点 ID |
|
|
132
|
+
| `devecocli ui swipe` | 自定义滑动(指定起点、终点和速度) |
|
|
133
|
+
| `devecocli ui text` | 输入文本到焦点或指定位置 |
|
|
95
134
|
| `devecocli log` | 查看 `hilog` 或崩溃日志 |
|
|
96
135
|
| `devecocli docs search` | 搜索本地 HarmonyOS 文档 |
|
|
97
136
|
| `devecocli init` | 安装内置技能或配置 `MCP` |
|
|
@@ -126,6 +165,7 @@ Commands:
|
|
|
126
165
|
update Update deveco-cli to the latest version
|
|
127
166
|
device Manage connected devices
|
|
128
167
|
emulator Manage emulator instances
|
|
168
|
+
auth Authentication commands (login, logout, status, team)
|
|
129
169
|
ui Inspect and interact with UI on a connected device
|
|
130
170
|
skills Manage HarmonyOS skills
|
|
131
171
|
log [options] Obtain device application logs
|
|
@@ -272,6 +312,56 @@ devecocli create --project-path ./MyApp --app-name MyApp --bundle-name com.acme.
|
|
|
272
312
|
devecocli create --app-name MyApp
|
|
273
313
|
```
|
|
274
314
|
|
|
315
|
+
### `auth login`
|
|
316
|
+
|
|
317
|
+
登录华为开发者账号,打开浏览器完成授权。
|
|
318
|
+
|
|
319
|
+
**命令格式:**
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
devecocli auth login
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**说明:**
|
|
326
|
+
|
|
327
|
+
- 海外账户暂不支持
|
|
328
|
+
|
|
329
|
+
### `auth logout`
|
|
330
|
+
|
|
331
|
+
登出并清除本地存储的凭据
|
|
332
|
+
|
|
333
|
+
**命令格式:**
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
devecocli auth logout
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### `auth status`
|
|
340
|
+
|
|
341
|
+
显示当前登录的用户
|
|
342
|
+
|
|
343
|
+
**命令格式:**
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
devecocli auth status
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### `auth team list`
|
|
350
|
+
|
|
351
|
+
列出当前用户已加入的团队
|
|
352
|
+
|
|
353
|
+
**命令格式:**
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
devecocli auth team list
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**示例:**
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
devecocli auth team list
|
|
363
|
+
```
|
|
364
|
+
|
|
275
365
|
### `build`
|
|
276
366
|
|
|
277
367
|
编译并打包 HarmonyOS 工程或工程中的模块
|
|
@@ -436,40 +526,6 @@ devecocli emulator sensor --target Phone --heartrate 80
|
|
|
436
526
|
校验以目标模拟器实际返回的 `deviceType` 为准。非上述三种设备类型以及不属于目标设备类型的状态会在命令下发前被拒绝。校验通过后,底层映射为 `Emulator -instance <name> -foldedState <state>`。
|
|
437
527
|
- 设置 `DEVECO_CLI_DEBUG=1` 可查看底层命令映射,例如 `Emulator -instance <name> -shake`。
|
|
438
528
|
|
|
439
|
-
### `ui screenshot`
|
|
440
|
-
|
|
441
|
-
对真机或模拟器执行 UI 截图。`devecocli ui` 当前只交付截图能力。
|
|
442
|
-
|
|
443
|
-
**命令格式:**
|
|
444
|
-
|
|
445
|
-
```bash
|
|
446
|
-
devecocli ui screenshot [--device <name|serial>] [--path <path>]
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
**参数:**
|
|
450
|
-
|
|
451
|
-
| 参数 | 说明 | 默认值 |
|
|
452
|
-
| ------------------------ | ------------------------ | ---------- |
|
|
453
|
-
| --device \<name\|serial> | 真机或模拟器名称/序列号;多设备时必填 | 单设备自动选择 |
|
|
454
|
-
| --display \<displayId> | 目标屏幕 ID,可选 | 默认屏幕 |
|
|
455
|
-
| --path \<path> | 截图输出路径,可选;目录或父目录必须已存在 | `./screenshot-<timestamp>.png` |
|
|
456
|
-
|
|
457
|
-
**示例:**
|
|
458
|
-
|
|
459
|
-
```bash
|
|
460
|
-
devecocli ui screenshot --device Phone
|
|
461
|
-
mkdir -p screenshots
|
|
462
|
-
devecocli ui screenshot --device Phone --path ./screenshots/phone.png
|
|
463
|
-
devecocli ui screenshot --device Phone --display 0 --path ./screenshots/phone.png
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
**说明:**
|
|
467
|
-
|
|
468
|
-
- `ui screenshot` 支持真机和模拟器。
|
|
469
|
-
- 仅有一个可用设备时可省略 `--device`,多个设备同时连接时必须指定。
|
|
470
|
-
- 截图能力统一通过 `ui screenshot` 提供,不放在模拟器场景操作命令中。
|
|
471
|
-
- 截图统一使用 `hdc shell snapshot_display` 和 `hdc file recv` 实现;设置 `DEVECO_CLI_DEBUG=1` 可查看实际执行命令。
|
|
472
|
-
|
|
473
529
|
### `emulator create`
|
|
474
530
|
|
|
475
531
|
创建模拟器
|
|
@@ -659,6 +715,264 @@ devecocli device view --target 127.0.0.1:5555
|
|
|
659
715
|
devecocli device view -t "My Device Name"
|
|
660
716
|
```
|
|
661
717
|
|
|
718
|
+
### `ui screenshot`
|
|
719
|
+
|
|
720
|
+
对真机或模拟器执行 UI 截图。
|
|
721
|
+
|
|
722
|
+
**命令格式:**
|
|
723
|
+
|
|
724
|
+
```bash
|
|
725
|
+
devecocli ui screenshot --device <name|serial> --display <displayId> --path <path>
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
**参数:**
|
|
729
|
+
|
|
730
|
+
| 参数 | 说明 | 默认值 |
|
|
731
|
+
| ------------------------ | ------------------------ | ---------- |
|
|
732
|
+
| --device \<name\|serial> | 真机或模拟器名称/序列号;多设备时必填 | 单设备自动选择 |
|
|
733
|
+
| --display \<displayId> | 目标屏幕 ID,可选 | 默认屏幕 |
|
|
734
|
+
| --path \<path> | 截图输出路径,可选;目录或父目录必须已存在 | `./screenshot-<timestamp>.png` |
|
|
735
|
+
|
|
736
|
+
**示例:**
|
|
737
|
+
|
|
738
|
+
```bash
|
|
739
|
+
devecocli ui screenshot --device Phone
|
|
740
|
+
mkdir -p screenshots
|
|
741
|
+
devecocli ui screenshot --device Phone --path ./screenshots/phone.png
|
|
742
|
+
devecocli ui screenshot --device Phone --display 0 --path ./screenshots/phone.png
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
**说明:**
|
|
746
|
+
|
|
747
|
+
- `ui screenshot` 支持真机和模拟器。
|
|
748
|
+
- 仅有一个可用设备时可省略 `--device`,多个设备同时连接时必须指定。
|
|
749
|
+
- 截图能力统一通过 `ui screenshot` 提供,不放在模拟器场景操作命令中。
|
|
750
|
+
- 截图统一使用 `hdc shell snapshot_display` 和 `hdc file recv` 实现;设置 `DEVECO_CLI_DEBUG=1` 可查看实际执行命令。
|
|
751
|
+
|
|
752
|
+
### `ui click`
|
|
753
|
+
|
|
754
|
+
点击指定坐标或节点 ID 的中心位置。
|
|
755
|
+
|
|
756
|
+
**命令格式:**
|
|
757
|
+
|
|
758
|
+
```bash
|
|
759
|
+
devecocli ui click [x] [y] --device <name|serial> --id <id> --window <windowId>
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
**参数:**
|
|
763
|
+
|
|
764
|
+
| 参数 | 说明 |
|
|
765
|
+
| --- | --- |
|
|
766
|
+
| `[x] [y]` | 可选,目标坐标。缺省时需配合 `--id` 使用 |
|
|
767
|
+
| --device \<name\|serial> | 目标设备,多设备时必填 |
|
|
768
|
+
| --id \<id> | 节点 ID,自动解析为中心坐标。不可与 `[x] [y]` 同时使用 |
|
|
769
|
+
| --window \<windowId> | 目标窗口 ID,需与 `--id` 配合使用 |
|
|
770
|
+
|
|
771
|
+
**示例:**
|
|
772
|
+
|
|
773
|
+
```bash
|
|
774
|
+
devecocli ui click 100 200
|
|
775
|
+
devecocli ui click 100 200 --device Phone
|
|
776
|
+
devecocli ui click --id submit_button
|
|
777
|
+
devecocli ui click --id submit_button --window main_window
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
### `ui doubleclick`
|
|
781
|
+
|
|
782
|
+
双击指定坐标或节点 ID 的中心位置。
|
|
783
|
+
|
|
784
|
+
**命令格式:**
|
|
785
|
+
|
|
786
|
+
```bash
|
|
787
|
+
devecocli ui doubleclick [x] [y] --device <name|serial> --id <id> --window <windowId>
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
**参数:**
|
|
791
|
+
|
|
792
|
+
| 参数 | 说明 |
|
|
793
|
+
| --- | --- |
|
|
794
|
+
| `[x] [y]` | 可选,目标坐标。缺省时需配合 `--id` 使用 |
|
|
795
|
+
| --device \<name\|serial> | 目标设备,多设备时必填 |
|
|
796
|
+
| --id \<id> | 节点 ID,自动解析为中心坐标。不可与 `[x] [y]` 同时使用 |
|
|
797
|
+
| --window \<windowId> | 目标窗口 ID,需与 `--id` 配合使用 |
|
|
798
|
+
|
|
799
|
+
**示例:**
|
|
800
|
+
|
|
801
|
+
```bash
|
|
802
|
+
devecocli ui doubleclick 100 200
|
|
803
|
+
devecocli ui doubleclick 100 200 --device Phone
|
|
804
|
+
devecocli ui doubleclick --id photo_thumb
|
|
805
|
+
devecocli ui doubleclick --id photo_thumb --window main_window
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
### `ui longclick`
|
|
809
|
+
|
|
810
|
+
长按指定坐标或节点 ID 的中心位置。
|
|
811
|
+
|
|
812
|
+
**命令格式:**
|
|
813
|
+
|
|
814
|
+
```bash
|
|
815
|
+
devecocli ui longclick [x] [y] --device <name|serial> --id <id> --window <windowId>
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
**参数:**
|
|
819
|
+
|
|
820
|
+
| 参数 | 说明 |
|
|
821
|
+
| --- | --- |
|
|
822
|
+
| `[x] [y]` | 可选,目标坐标。缺省时需配合 `--id` 使用 |
|
|
823
|
+
| --device \<name\|serial> | 目标设备,多设备时必填 |
|
|
824
|
+
| --id \<id> | 节点 ID,自动解析为中心坐标。不可与 `[x] [y]` 同时使用 |
|
|
825
|
+
| --window \<windowId> | 目标窗口 ID,需与 `--id` 配合使用 |
|
|
826
|
+
|
|
827
|
+
**示例:**
|
|
828
|
+
|
|
829
|
+
```bash
|
|
830
|
+
devecocli ui longclick 100 200
|
|
831
|
+
devecocli ui longclick 100 200 --device Phone
|
|
832
|
+
devecocli ui longclick --id menu_item
|
|
833
|
+
devecocli ui longclick --id menu_item --window main_window
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
### `ui swipe`
|
|
837
|
+
|
|
838
|
+
自定义滑动(指定起点、终点和速度)。
|
|
839
|
+
|
|
840
|
+
**命令格式:**
|
|
841
|
+
|
|
842
|
+
```bash
|
|
843
|
+
devecocli ui swipe <x1> <y1> <x2> <y2> --device <name|serial> --speed <n>
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
**参数:**
|
|
847
|
+
|
|
848
|
+
| 参数 | 说明 |
|
|
849
|
+
| --- | --- |
|
|
850
|
+
| `<x1> <y1> <x2> <y2>` | 必选,起点和终点坐标 |
|
|
851
|
+
| --device \<name\|serial> | 目标设备,多设备时必填 |
|
|
852
|
+
| --speed \<n> | 可选,滑动速度(像素/秒),范围 `200` ~ `40000` |
|
|
853
|
+
|
|
854
|
+
**示例:**
|
|
855
|
+
|
|
856
|
+
```bash
|
|
857
|
+
devecocli ui swipe 100 500 100 200
|
|
858
|
+
devecocli ui swipe 100 500 100 200 --device Phone
|
|
859
|
+
devecocli ui swipe 100 500 100 200 --speed 1000
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
### `ui fling`
|
|
863
|
+
|
|
864
|
+
快速滑动(Fling)。
|
|
865
|
+
|
|
866
|
+
**命令格式:**
|
|
867
|
+
|
|
868
|
+
```bash
|
|
869
|
+
devecocli ui fling <x1> <y1> <x2> <y2> --device <name|serial> --speed <n>
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
**参数:**
|
|
873
|
+
|
|
874
|
+
| 参数 | 说明 |
|
|
875
|
+
| --- | --- |
|
|
876
|
+
| `<x1> <y1> <x2> <y2>` | 必选,起点和终点坐标 |
|
|
877
|
+
| --device \<name\|serial> | 目标设备,多设备时必填 |
|
|
878
|
+
| --speed \<n> | 可选,滑动速度(像素/秒),范围 `200` ~ `40000` |
|
|
879
|
+
|
|
880
|
+
**示例:**
|
|
881
|
+
|
|
882
|
+
```bash
|
|
883
|
+
devecocli ui fling 100 800 100 200
|
|
884
|
+
devecocli ui fling 100 800 100 200 --device Phone
|
|
885
|
+
devecocli ui fling 100 800 100 200 --speed 3000
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
### `ui drag`
|
|
889
|
+
|
|
890
|
+
拖拽操作。
|
|
891
|
+
|
|
892
|
+
**命令格式:**
|
|
893
|
+
|
|
894
|
+
```bash
|
|
895
|
+
devecocli ui drag <x1> <y1> <x2> <y2> --device <name|serial> --speed <n>
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
**参数:**
|
|
899
|
+
|
|
900
|
+
| 参数 | 说明 |
|
|
901
|
+
| --- | --- |
|
|
902
|
+
| `<x1> <y1> <x2> <y2>` | 必选,起点和终点坐标 |
|
|
903
|
+
| --device \<name\|serial> | 目标设备,多设备时必填 |
|
|
904
|
+
| --speed \<n> | 可选,滑动速度(像素/秒),范围 `200` ~ `40000` |
|
|
905
|
+
|
|
906
|
+
**示例:**
|
|
907
|
+
|
|
908
|
+
```bash
|
|
909
|
+
# 拖拽操作
|
|
910
|
+
devecocli ui drag 100 500 100 200
|
|
911
|
+
devecocli ui drag 100 500 100 200 --device Phone
|
|
912
|
+
devecocli ui drag 100 500 100 200 --speed 1500
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
### `ui dircfling`
|
|
916
|
+
|
|
917
|
+
向指定方向快速滑动。
|
|
918
|
+
|
|
919
|
+
**命令格式:**
|
|
920
|
+
|
|
921
|
+
```bash
|
|
922
|
+
devecocli ui dircfling <direction> --device <name|serial>
|
|
923
|
+
```
|
|
924
|
+
|
|
925
|
+
**参数:**
|
|
926
|
+
|
|
927
|
+
| 参数 | 说明 |
|
|
928
|
+
| --- | --- |
|
|
929
|
+
| `<direction>` | 必选,方向,取值为 `up`, `down`, `left`, `right` |
|
|
930
|
+
| --device \<name\|serial> | 目标设备,多设备时必填 |
|
|
931
|
+
|
|
932
|
+
**示例:**
|
|
933
|
+
|
|
934
|
+
```bash
|
|
935
|
+
devecocli ui dircfling up
|
|
936
|
+
devecocli ui dircfling down --device Phone
|
|
937
|
+
devecocli ui dircfling left
|
|
938
|
+
devecocli ui dircfling right
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
**与 `ui swipe` 的区别:**
|
|
942
|
+
|
|
943
|
+
- `ui swipe` 需要指定精确的起点和终点坐标,支持自定义速度,适用于特定区域滑动。
|
|
944
|
+
- `ui dircfling` 仅需指定方向,使用系统默认速度,适用于页面滚动或列表快速滑动。
|
|
945
|
+
|
|
946
|
+
### `ui text`
|
|
947
|
+
|
|
948
|
+
输入文本到当前焦点、指定坐标或指定节点位置。
|
|
949
|
+
|
|
950
|
+
**命令格式:**
|
|
951
|
+
|
|
952
|
+
```bash
|
|
953
|
+
devecocli ui text <text> [x] [y] --device <name|serial> --id <id> --window <windowId>
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
**参数:**
|
|
957
|
+
|
|
958
|
+
| 参数 | 说明 |
|
|
959
|
+
| --- | --- |
|
|
960
|
+
| `<text>` | 必选,待输入的文本 |
|
|
961
|
+
| `[x] [y]` | 可选,目标坐标 |
|
|
962
|
+
| --device \<name\|serial> | 目标设备,多设备时必填 |
|
|
963
|
+
| --id \<id> | 节点 ID,自动解析为中心坐标。不可与 `[x] [y]`同时使用 |
|
|
964
|
+
| --window \<windowId> | 目标窗口 ID,需与 `--id` 配合使用 |
|
|
965
|
+
|
|
966
|
+
**示例:**
|
|
967
|
+
|
|
968
|
+
```bash
|
|
969
|
+
devecocli ui text "Hello World"
|
|
970
|
+
devecocli ui text "Hello World" --device Phone
|
|
971
|
+
devecocli ui text "Hello World" 100 200
|
|
972
|
+
devecocli ui text "Hello World" --id search_box
|
|
973
|
+
devecocli ui text "Hello World" --id search_box --window main_window
|
|
974
|
+
```
|
|
975
|
+
|
|
662
976
|
### `run`
|
|
663
977
|
|
|
664
978
|
构建应用后,将应用安装到真机设备或模拟器上,并启动执行
|
package/SKILL.md
CHANGED
|
@@ -8,7 +8,7 @@ description: >-
|
|
|
8
8
|
|
|
9
9
|
`devecocli` wraps DevEco Studio's `hvigor`, `ohpm`, `hdc`, emulator toolchain, and bundled skills installer. **Prefer `devecocli` over invoking underlying tools directly.**
|
|
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
|
|
|
@@ -88,7 +88,7 @@ Build, install, and launch.
|
|
|
88
88
|
|
|
89
89
|
### `devecocli signature generate` `[Outside sandbox]`
|
|
90
90
|
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.
|
|
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
92
|
- `--product <name>`: Product name for local p12/csr file naming (default: `default`).
|
|
93
93
|
- `--team-id <id>`: Specify the team-id (default: current user's id).
|
|
94
94
|
- `--force`: Force regenerate even if existing materials are valid.
|
|
@@ -119,15 +119,16 @@ Inspect UI on a connected device. All subcommands accept `--device <name|serial>
|
|
|
119
119
|
| `click [x] [y]` | Tap at the specified coordinates or node | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
|
|
120
120
|
| `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
|
|
121
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 | `--speed <n>` (200–40000, px/s) |
|
|
122
|
+
| `swipe <x1> <y1> <x2> <y2>` | Swipe from one point to another (precise coordinates, custom speed) | `--speed <n>` (200–40000, px/s) |
|
|
123
123
|
| `fling <x1> <y1> <x2> <y2>` | Fling from one point to another | `--speed <n>` (200–40000, px/s) |
|
|
124
124
|
| `drag <x1> <y1> <x2> <y2>` | Drag from one point to another | `--speed <n>` (200–40000, px/s) |
|
|
125
|
-
| `dircfling <direction>` |
|
|
125
|
+
| `dircfling <direction>` | Quick directional fling (system default speed, ideal for scrolling) | `direction`: `up`, `down`, `left`, `right` |
|
|
126
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
127
|
|
|
128
|
-
- Coordinates
|
|
129
|
-
-
|
|
130
|
-
-
|
|
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.
|
|
131
132
|
- `--format json` pairs well with `jq`.
|
|
132
133
|
- `--mode raw`: full layout tree, no filtering.
|
|
133
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.
|
|
@@ -146,16 +147,19 @@ MUTUALLY EXCLUSIVE modes for setup:
|
|
|
146
147
|
- `-f, --force`: Overwrite existing config.
|
|
147
148
|
*MCP Rules*: Global MCP (no `--project`) only supports `opencode` and `cursor`. Others require `--project`.
|
|
148
149
|
|
|
149
|
-
### `devecocli login`
|
|
150
|
+
### `devecocli auth login`
|
|
150
151
|
Sign in to your Huawei Developer account. Opens a browser for OAuth authentication. Required before `signature generate`.
|
|
151
|
-
*Ex*: `devecocli login`
|
|
152
|
+
*Ex*: `devecocli auth login`
|
|
152
153
|
|
|
153
|
-
### `devecocli logout`
|
|
154
|
+
### `devecocli auth logout`
|
|
154
155
|
Sign out and clear locally stored credentials.
|
|
155
156
|
|
|
156
|
-
### `devecocli
|
|
157
|
+
### `devecocli auth status`
|
|
157
158
|
Show the current logged-in user.
|
|
158
159
|
|
|
160
|
+
### `devecocli auth team list`
|
|
161
|
+
List team accounts the current user has joined.
|
|
162
|
+
|
|
159
163
|
### `devecocli skills`
|
|
160
164
|
Manage HarmonyOS skills in AI agents/projects.
|
|
161
165
|
- `list [-l|--long]` / `find <keyword>`: List or search skills.
|
|
@@ -191,7 +195,7 @@ Validation order: `files` + `--modules` mutually exclusive → `--source-version
|
|
|
191
195
|
- **Release build**:
|
|
192
196
|
`devecocli build --product oversea --build-mode release`
|
|
193
197
|
- **First-time signing setup**:
|
|
194
|
-
`devecocli login` -> `devecocli signature generate --product default` -> `devecocli build` -> `devecocli run`
|
|
198
|
+
`devecocli auth login` -> `devecocli signature generate --product default` -> `devecocli build` -> `devecocli run`
|
|
195
199
|
|
|
196
200
|
## Troubleshooting
|
|
197
201
|
|
|
@@ -199,9 +203,9 @@ Validation order: `files` + `--modules` mutually exclusive → `--source-version
|
|
|
199
203
|
- **"Multiple entry modules" / "No entry module"**: Pass `--modules` (build) or `--module` (run).
|
|
200
204
|
- **"No active devices" / "Multiple devices connected"**: Connect/start emulator. Pass `-t <serial>` (device view) or `--device <name|serial>` (run/log).
|
|
201
205
|
- **`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.
|
|
206
|
+
- **`Not logged in. Run devecocli auth login first`**: Run `devecocli auth login` to authenticate.
|
|
203
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`.
|
|
204
|
-
- **`Invalid AccessToken. Sign in and try again`**: Token expired. Run `devecocli login` again.
|
|
208
|
+
- **`Invalid AccessToken. Sign in and try again`**: Token expired. Run `devecocli auth login` again.
|
|
205
209
|
- **`skills add` agent not found**: Valid: `codebuddy`, `cursor`, `opencode`, `qoder`, `trae-cn`.
|
|
206
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.
|
|
207
211
|
- **`image download` failure / timeout**: Do NOT auto-retry. Give the command to the user to run manually in their terminal.
|
package/THIRD-PARTY-LICENSES
CHANGED
|
@@ -2763,7 +2763,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
2763
2763
|
|
|
2764
2764
|
The following npm packages may be included in this product:
|
|
2765
2765
|
|
|
2766
|
-
- @node-rs/jieba-
|
|
2766
|
+
- @node-rs/jieba-linux-x64-gnu@2.0.1
|
|
2767
2767
|
- agent-base@6.0.2
|
|
2768
2768
|
- https-proxy-agent@5.0.1
|
|
2769
2769
|
- isarray@0.0.1
|
|
@@ -4000,7 +4000,7 @@ The following npm packages may be included in this product:
|
|
|
4000
4000
|
- ini@1.3.8
|
|
4001
4001
|
- isexe@2.0.0
|
|
4002
4002
|
- once@1.4.0
|
|
4003
|
-
- semver@7.
|
|
4003
|
+
- semver@7.8.5
|
|
4004
4004
|
- which@2.0.2
|
|
4005
4005
|
- wrappy@1.0.2
|
|
4006
4006
|
|