clawflowbang 1.0.0 → 1.0.2
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/.env.example +14 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- package/.github/pull_request_template.md +19 -0
- package/.github/workflows/publish.yml +46 -0
- package/.github/workflows/test.yml +31 -0
- package/CODE_OF_CONDUCT.md +29 -0
- package/LICENSE +21 -0
- package/README.md +151 -1
- package/SECURITY.md +20 -0
- package/SUPPORT.md +21 -0
- package/bin/clawflowhub.js +60 -64
- package/package.json +18 -16
- package/src/commands/cron.js +71 -36
- package/src/commands/init.js +23 -23
- package/src/commands/install.js +17 -17
- package/src/commands/list.js +27 -25
- package/src/commands/remove.js +4 -4
- package/src/commands/search.js +23 -20
- package/src/commands/status.js +19 -25
- package/src/core/ConfigManager.js +132 -132
- package/src/core/CronManager.js +245 -245
- package/src/core/Installer.js +53 -53
- package/src/core/OpenClawCLI.js +62 -17
- package/src/core/TerminalUI.js +332 -0
- package/.eslintrc.json +0 -38
- package/__tests__/config-manager.test.js +0 -52
- package/__tests__/cron-format.test.js +0 -26
- package/__tests__/cron-manager.local.test.js +0 -65
- package/__tests__/openclaw-cli.test.js +0 -51
- package/docs/clawhub-package-format.md +0 -179
- package/examples/npm-package-example/package.json +0 -53
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
# ClawFlow Package Format
|
|
2
|
-
|
|
3
|
-
Packages สำหรับ ClawFlow สามารถ publish ขึ้น npm registry ได้โดยมีรูปแบบดังนี้:
|
|
4
|
-
|
|
5
|
-
## 1. การระบุว่าเป็น ClawFlow Package
|
|
6
|
-
|
|
7
|
-
มี 3 วิธี:
|
|
8
|
-
|
|
9
|
-
### วิธีที่ 1: ใช้ Scope `@clawflow/`
|
|
10
|
-
```json
|
|
11
|
-
{
|
|
12
|
-
"name": "@clawflow/trading-kit"
|
|
13
|
-
}
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### วิธีที่ 2: ใช้ Keyword
|
|
17
|
-
```json
|
|
18
|
-
{
|
|
19
|
-
"name": "my-awesome-kit",
|
|
20
|
-
"keywords": ["clawflow", "trading", "crypto"]
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### วิธีที่ 3: ใช้ Field `clawflow` ใน package.json
|
|
25
|
-
```json
|
|
26
|
-
{
|
|
27
|
-
"name": "my-awesome-kit",
|
|
28
|
-
"clawflow": {
|
|
29
|
-
"skills": [...],
|
|
30
|
-
"crons": [...]
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## 2. Package Structure
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
my-package/
|
|
39
|
-
├── package.json # ต้องมี keyword "clawflow" หรือ field clawflow
|
|
40
|
-
├── clawflow.json # (optional) แยก config ออกมา
|
|
41
|
-
├── README.md
|
|
42
|
-
└── (other files)
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## 3. clawflow.json Format
|
|
46
|
-
|
|
47
|
-
```json
|
|
48
|
-
{
|
|
49
|
-
"$schema": "https://clawflowhub.dev/schema/v1.json",
|
|
50
|
-
"skills": [
|
|
51
|
-
{
|
|
52
|
-
"name": "binance-pro",
|
|
53
|
-
"version": "^1.0.0",
|
|
54
|
-
"source": "openclaw",
|
|
55
|
-
"repository": "https://github.com/owner/binance-pro-skill.git",
|
|
56
|
-
"description": "Binance trading skill"
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
|
-
"crons": [
|
|
60
|
-
{
|
|
61
|
-
"skill": "crypto-price",
|
|
62
|
-
"schedule": "*/5 * * * *",
|
|
63
|
-
"params": {
|
|
64
|
-
"symbols": ["BTC", "ETH", "SOL"]
|
|
65
|
-
},
|
|
66
|
-
"description": "เช็คราคาคริปโตทุก 5 นาที",
|
|
67
|
-
"enabled": true
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
"config": {
|
|
71
|
-
"binance-pro": {
|
|
72
|
-
"apiKey": {
|
|
73
|
-
"env": "BINANCE_API_KEY",
|
|
74
|
-
"required": true,
|
|
75
|
-
"description": "Binance API Key"
|
|
76
|
-
},
|
|
77
|
-
"secretKey": {
|
|
78
|
-
"env": "BINANCE_SECRET_KEY",
|
|
79
|
-
"required": true,
|
|
80
|
-
"description": "Binance Secret Key"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
"postInstall": "กรุณาตั้งค่า BINANCE_API_KEY และ BINANCE_SECRET_KEY ใน environment variables"
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## 4. Field Descriptions
|
|
89
|
-
|
|
90
|
-
### skills
|
|
91
|
-
รายการ skills ที่จะติดตั้ง
|
|
92
|
-
|
|
93
|
-
| Field | Type | Required | Description |
|
|
94
|
-
|-------|------|----------|-------------|
|
|
95
|
-
| `name` | string | Yes | ชื่อ skill |
|
|
96
|
-
| `version` | string | No | เวอร์ชัน (semver) |
|
|
97
|
-
| `source` | string | No | แหล่งที่มา (openclaw, npm, github) |
|
|
98
|
-
| `repository`/`repo`/`git` | string | No | Git URL สำหรับ fallback เมื่อหา skill ใน clawhub ไม่เจอ |
|
|
99
|
-
| `branch`/`tag`/`ref` | string | No | branch/tag/ref สำหรับ git clone |
|
|
100
|
-
| `description` | string | No | คำอธิบาย |
|
|
101
|
-
|
|
102
|
-
### crons
|
|
103
|
-
รายการ cronjobs ที่จะสร้าง
|
|
104
|
-
|
|
105
|
-
| Field | Type | Required | Description |
|
|
106
|
-
|-------|------|----------|-------------|
|
|
107
|
-
| `skill` | string | Yes | ชื่อ skill ที่จะรัน |
|
|
108
|
-
| `schedule` | string | Yes | Cron expression |
|
|
109
|
-
| `params` | object | No | Parameters ที่ส่งให้ skill |
|
|
110
|
-
| `description` | string | No | คำอธิบาย |
|
|
111
|
-
| `enabled` | boolean | No | เปิดใช้งานหรือไม่ (default: true) |
|
|
112
|
-
|
|
113
|
-
### config
|
|
114
|
-
Schema สำหรับการตั้งค่า package
|
|
115
|
-
|
|
116
|
-
| Field | Type | Required | Description |
|
|
117
|
-
|-------|------|----------|-------------|
|
|
118
|
-
| `env` | string | No | ชื่อ environment variable |
|
|
119
|
-
| `required` | boolean | No | บังคับต้องมีหรือไม่ |
|
|
120
|
-
| `default` | any | No | ค่า default |
|
|
121
|
-
| `description` | string | No | คำอธิบาย |
|
|
122
|
-
| `type` | string | No | ประเภท (string, number, array, object) |
|
|
123
|
-
|
|
124
|
-
## 5. ตัวอย่าง package.json สมบูรณ์
|
|
125
|
-
|
|
126
|
-
```json
|
|
127
|
-
{
|
|
128
|
-
"name": "@clawflowhub/trading-kit",
|
|
129
|
-
"version": "1.0.0",
|
|
130
|
-
"description": "ชุดเครื่องมือสำหรับเทรดคริปโต",
|
|
131
|
-
"keywords": ["clawflowhub", "trading", "crypto", "binance"],
|
|
132
|
-
"author": "Your Name",
|
|
133
|
-
"license": "MIT",
|
|
134
|
-
"clawflowhub": {
|
|
135
|
-
"skills": [
|
|
136
|
-
{ "name": "binance-pro", "version": "^1.0.0", "source": "openclaw" },
|
|
137
|
-
{ "name": "crypto-price", "version": "^1.0.0", "source": "openclaw" }
|
|
138
|
-
],
|
|
139
|
-
"crons": [
|
|
140
|
-
{
|
|
141
|
-
"skill": "crypto-price",
|
|
142
|
-
"schedule": "*/5 * * * *",
|
|
143
|
-
"params": { "symbols": ["BTC", "ETH"] },
|
|
144
|
-
"description": "เช็คราคาทุก 5 นาที"
|
|
145
|
-
}
|
|
146
|
-
],
|
|
147
|
-
"config": {
|
|
148
|
-
"binance-pro": {
|
|
149
|
-
"apiKey": { "env": "BINANCE_API_KEY", "required": true }
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## 6. Publishing
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
# Publish ขึ้น npm
|
|
160
|
-
npm publish --access public
|
|
161
|
-
|
|
162
|
-
# ถ้าเป็น scoped package (@clawflowhub/xxx)
|
|
163
|
-
npm publish --access public
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## 7. การติดตั้ง
|
|
167
|
-
|
|
168
|
-
หลังจาก publish แล้ว ผู้ใช้สามารถติดตั้งได้โดย:
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
# ติดตั้งจาก npm
|
|
172
|
-
clawflowhub install @clawflowhub/trading-kit
|
|
173
|
-
|
|
174
|
-
# หรือ
|
|
175
|
-
clawflowhub install my-awesome-kit
|
|
176
|
-
|
|
177
|
-
# ติดตั้งเวอร์ชันเฉพาะ
|
|
178
|
-
clawflowhub install @clawflowhub/trading-kit@1.0.0
|
|
179
|
-
```
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@clawflow/example-kit",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "ตัวอย่าง ClawFlow Package สำหรับ npm registry",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"clawflow",
|
|
7
|
-
"example",
|
|
8
|
-
"demo"
|
|
9
|
-
],
|
|
10
|
-
"author": "ClawFlow Team",
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/clawflow/example-kit.git"
|
|
15
|
-
},
|
|
16
|
-
"clawflow": {
|
|
17
|
-
"skills": [
|
|
18
|
-
{
|
|
19
|
-
"name": "hello-world",
|
|
20
|
-
"version": "^1.0.0",
|
|
21
|
-
"source": "openclaw",
|
|
22
|
-
"description": "พูดว่า Hello World"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "time-logger",
|
|
26
|
-
"version": "^1.0.0",
|
|
27
|
-
"source": "openclaw",
|
|
28
|
-
"description": "บันทึกเวลาปัจจุบัน"
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
"crons": [
|
|
32
|
-
{
|
|
33
|
-
"skill": "time-logger",
|
|
34
|
-
"schedule": "0 * * * *",
|
|
35
|
-
"params": {
|
|
36
|
-
"format": "ISO"
|
|
37
|
-
},
|
|
38
|
-
"description": "บันทึกเวลาทุกชั่วโมง",
|
|
39
|
-
"enabled": true
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"config": {
|
|
43
|
-
"time-logger": {
|
|
44
|
-
"timezone": {
|
|
45
|
-
"default": "Asia/Bangkok",
|
|
46
|
-
"type": "string",
|
|
47
|
-
"description": "Timezone สำหรับการบันทึกเวลา"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"postInstall": "ตัวอย่าง Package ติดตั้งสำเร็จแล้ว! ลองตั้งค่า timezone ได้ใน config"
|
|
52
|
-
}
|
|
53
|
-
}
|