@zacktt/test 0.0.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.
Files changed (29) hide show
  1. package/LICENSE +21 -0
  2. package/SKILL.md +116 -0
  3. package/THIRD-PARTY-LICENSES +3572 -0
  4. package/dist/cli.js +1264 -0
  5. package/docs.zip +0 -0
  6. package/package.json +76 -0
  7. package/templates/application/AppScope/app.json5 +10 -0
  8. package/templates/application/AppScope/resources/base/element/string.json +8 -0
  9. package/templates/application/AppScope/resources/base/media/layered_image.json +7 -0
  10. package/templates/application/build-profile.json5 +42 -0
  11. package/templates/application/code-linter.json5 +32 -0
  12. package/templates/application/entry/build-profile.json5 +33 -0
  13. package/templates/application/entry/hvigorfile.ts +7 -0
  14. package/templates/application/entry/obfuscation-rules.txt +20 -0
  15. package/templates/application/entry/oh-package.json5 +10 -0
  16. package/templates/application/entry/src/main/ets/entryability/EntryAbility.ets +63 -0
  17. package/templates/application/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +31 -0
  18. package/templates/application/entry/src/main/ets/pages/Index.ets +38 -0
  19. package/templates/application/entry/src/main/module.json5 +50 -0
  20. package/templates/application/entry/src/main/resources/base/element/color.json +8 -0
  21. package/templates/application/entry/src/main/resources/base/element/float.json +8 -0
  22. package/templates/application/entry/src/main/resources/base/element/string.json +16 -0
  23. package/templates/application/entry/src/main/resources/base/media/layered_image.json +7 -0
  24. package/templates/application/entry/src/main/resources/base/profile/backup_config.json +3 -0
  25. package/templates/application/entry/src/main/resources/base/profile/main_pages.json +5 -0
  26. package/templates/application/entry/src/main/resources/dark/element/color.json +8 -0
  27. package/templates/application/hvigor/hvigor-config.json5 +23 -0
  28. package/templates/application/hvigorfile.ts +7 -0
  29. package/templates/application/oh-package.json5 +10 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Huawei Device Co., Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/SKILL.md ADDED
@@ -0,0 +1,116 @@
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, 鸿蒙文档, 知识, 搜索, or skills.
5
+ ---
6
+
7
+ # DevEco CLI
8
+
9
+ `devecocli` wraps DevEco Studio's `hvigor`, `ohpm`, `hdc`, emulator toolchain, and HarmonyOS-skills installer. **Prefer `devecocli` over invoking underlying tools directly.**
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 emulator`
35
+ Manage local emulator instances and system images.
36
+ - `list`: Show instances (status, serial, device type).
37
+ - `start <names...>`: Start instances. Quote names with spaces. (See Troubleshooting if blocked).
38
+ - `stop <names...>`: Stop by name or serial (`127.0.0.1:<port>`).
39
+ - `create <name>` (Req: `--device-type`, `--os-version`): Create instance. Optional: `--force`.
40
+ - `delete <name>`: Delete instance.
41
+ - `image list`: List downloaded images. Opts: `--device-type <type>`, `--all`, `--format <table|json>`.
42
+ - `image download` / `image remove` (Req: `--device-type`, `--os-version`): Download/remove image. (Takes 30+ min, set long timeout).
43
+ *Device types*: `phone`, `foldable`, `widefold`, `triplefold`, `tablet`, `2in1`, `2in1 foldable`, `wearable`, `tv`.
44
+
45
+ ### `devecocli docs`
46
+ Search/read local HarmonyOS docs.
47
+ - `search <keywords...>`: Match any keyword. Opts: `--catalog <name>`, `--format <default|json>`, `--limit <n>`.
48
+ - `read <documentId>`: Read full content by ID (e.g. `devecocli docs read 开发指南/冷启动_Launch分析/Launch模板基本操作/ide-insight-session-launch`).
49
+ - `catalog`: List available catalogs.
50
+
51
+ ### `devecocli device`
52
+ - `list`: Show active real devices and running emulators.
53
+ - `view`: Detailed info. Req `-t <name|serial>` on multi-device hosts.
54
+
55
+ ### `devecocli run` `[Outside sandbox]`
56
+ Build, install, and launch.
57
+ - `--module <module>`: Target module (auto-selected if only one runnable).
58
+ - `--device <name|serial>`: Target device (Req if multiple connected).
59
+ - `--product <product>` / `--build-mode <mode>`: Defaults: `default` / `debug`.
60
+ - `--ability <ability>`: Default from `module.json5`.
61
+ - `--uninstall`: Uninstall existing app first (Fixes signing key issues).
62
+ - `--skip-build`: Deploy existing artifacts.
63
+
64
+ ### `devecocli log`
65
+ Fetch hilog or crash logs. Req `--device <name|serial>` on multi-device hosts.
66
+ - `--crash`: Dump crash logs.
67
+ - `--level D|I|W|E|F`: Filter by level.
68
+ - `--bundle-name` / `--keyword`: Filter output.
69
+ - `--from <start>` / `--to <end>`: Relative offsets (`30s`, `5m`).
70
+ - `--tail <num>` / `--follow`: Keep last N lines / stream real-time (no `--to`).
71
+ *Ex*: `devecocli log --crash --bundle-name com.example.app`, `devecocli log --level E --from 5m --tail 200`
72
+
73
+ ## 2. Setup
74
+
75
+ ### `devecocli init`
76
+ MUTUALLY EXCLUSIVE modes for setup:
77
+ 1. `--skill` (Default): Install `deveco-cli` skill to AI agents.
78
+ 2. `--mcp`: Configure `deveco-mcp` server (ArkTS/C++ syntax checking).
79
+ *Options*:
80
+ - `--agent <agents>`: Comma-separated (e.g. `opencode,cursor`). Omitting targets all.
81
+ - `--project <path>`: Project-level config (Abs path for MCP).
82
+ - `--path <path>`: Direct skill install path.
83
+ - `-f, --force`: Overwrite existing config.
84
+ *MCP Rules*: Global MCP (no `--project`) only supports `opencode` and `cursor`. Others require `--project`.
85
+
86
+ ### `devecocli skills`
87
+ Manage HarmonyOS skills in AI agents/projects.
88
+ - `list [-l|--long]` / `find <keyword>`: List or search skills.
89
+ - `add (--all | --skill <name>) [--agent <a,b…>] [--project <path>] [--path <path>] [-f]`: Install.
90
+ - `remove --skill <name> [...]`: Uninstall.
91
+
92
+ ## 3. Maintenance
93
+
94
+ - **`devecocli update`** `[Outside sandbox]`: Update CLI to latest version.
95
+ - **`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`).
96
+
97
+ ## Recipes
98
+
99
+ - **Fresh checkout to emulator**:
100
+ `devecocli build` -> `devecocli emulator list` -> `devecocli emulator start "Name"` -> `devecocli run`
101
+ - **Diagnose crash**:
102
+ `devecocli log --crash --bundle-name <bundle>`
103
+ - **Release build**:
104
+ `devecocli build --product oversea --build-mode release`
105
+
106
+ ## Troubleshooting
107
+
108
+ - **"Product / Build mode `<x>` not found"**: Check `build-profile.json5`.
109
+ - **"Multiple entry modules" / "No entry module"**: Pass `--modules` (build) or `--module` (run).
110
+ - **"No active devices" / "Multiple devices connected"**: Connect/start emulator. Pass `-t <serial>` (device view) or `--device <name|serial>` (run/log).
111
+ - **`error:install sign info inconsistent`**: Signing key changed. Run `devecocli run --uninstall`.
112
+ - **`skills add` agent not found**: Valid: `codebuddy`, `cursor`, `opencode`, `qoder`, `trae-cn`.
113
+ - **`emulator start` / `image download` blocked on agreement**: User MUST run `devecocli emulator license accept` in interactive TTY. Agents cannot do this. Do not retry until accepted.
114
+ - **`image download` failure / timeout**: Do NOT auto-retry. Give the command to the user to run manually in their terminal.
115
+ - **`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.
116
+ - **`image list` duplicate OS rows**: `phone`/`foldable`/`widefold`/`triplefold` share the same image. Download/remove ONCE per OS version.