@harmonyos-arkts/opencode-plugin 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.
- package/README.md +75 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +30627 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# opencode-harmonyos-code
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
**opencode-harmonyos-code**是一个opencode插件,可以作为HarmonyOS全生命周期开发助手。专注于HarmonyOS应用的完整开发生命周期,包括项目创建、UI开发、状态管理、网络请求、数据存储、权限请求、性能优化、测试和发布。
|
|
5
|
+
|
|
6
|
+
## 功能特性
|
|
7
|
+
|
|
8
|
+
- **HarmonyOS设计专家**:为HarmonyOS应用和原子化服务创建详细的PRD设计文档
|
|
9
|
+
- **HarmonyOS开发专家**:根据设计文档遵循HarmonyOS规范实现功能
|
|
10
|
+
- **HarmonyOS构建**:使用harmonyos-hvigor技能构建项目并确保编译成功
|
|
11
|
+
|
|
12
|
+
## 快速开始
|
|
13
|
+
|
|
14
|
+
### 环境要求
|
|
15
|
+
|
|
16
|
+
- Node.js 18+
|
|
17
|
+
- 安装opencode CLI工具,参考官方文档:<https://opencode.ai/docs/zh-cn/#安装>
|
|
18
|
+
|
|
19
|
+
### 安装步骤
|
|
20
|
+
|
|
21
|
+
#### 1. 安装所需Skills
|
|
22
|
+
|
|
23
|
+
本项目依赖以下三个skill,需要先安装到opencode中:
|
|
24
|
+
|
|
25
|
+
- `harmonyos-atomic-dev` - HarmonyOS原子化服务开发专家
|
|
26
|
+
- `harmonyos-hvigor` - Hvigor构建工具使用指南
|
|
27
|
+
- `harmonyos-prd-design` - HarmonyOS PRD设计生成专家
|
|
28
|
+
|
|
29
|
+
#### 2. 编译项目
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 安装依赖
|
|
33
|
+
npm install
|
|
34
|
+
|
|
35
|
+
# 构建项目
|
|
36
|
+
npm run build
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### 3. 配置当前插件到opencode配置文件
|
|
40
|
+
|
|
41
|
+
##### 3.1 将编译后的插件添加到opencode配置文件中:
|
|
42
|
+
|
|
43
|
+
````
|
|
44
|
+
```bash
|
|
45
|
+
# 查看配置文件
|
|
46
|
+
cat ~/.config/opencode/opencode.json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
配置示例:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"$schema": "https://opencode.ai/config.json",
|
|
54
|
+
"plugin": ["$PWD"]
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
*$PWD* 替换为本项目的实际路径。
|
|
58
|
+
````
|
|
59
|
+
|
|
60
|
+
##### 3.2 重启opencode
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
参考:<https://opencode.ai/docs/zh-cn/plugins/#%E4%BD%BF%E7%94%A8%E6%8F%92%E4%BB%B6>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 体验
|
|
67
|
+
|
|
68
|
+
安装成功后,你的opencode中将会多出3个Agent,分别是harmonyos-plugin,harmoyos-dev,harmonyos-design,多出3个skill ,接下来就可以进行鸿蒙开发了。
|
|
69
|
+
|
|
70
|
+
!\[Agent架构]\(doc/agents.png null)
|
|
71
|
+
!\[Agent使用流程]\(doc/use-agent.png null)
|
|
72
|
+
|
|
73
|
+
## 许可证
|
|
74
|
+
|
|
75
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Plugin } from "@opencode-ai/plugin";
|
|
2
|
+
/**
|
|
3
|
+
* HM Plugin - OpenCode Plugin Development Framework
|
|
4
|
+
*
|
|
5
|
+
* This plugin provides a framework for developing OpenCode plugins with:
|
|
6
|
+
* - Agent system with registry and factory
|
|
7
|
+
* - Tool system with registry and filtering
|
|
8
|
+
* - Session management with LRU cache
|
|
9
|
+
* - Configuration management with layered loading
|
|
10
|
+
* - Hook system for various lifecycle events
|
|
11
|
+
*/
|
|
12
|
+
export declare const HMPlugin: Plugin;
|