huaweicloud-devkit 0.1.17
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/.agents/plugins/marketplace.json +20 -0
- package/LICENSE +201 -0
- package/README.md +148 -0
- package/bin/setup.cjs +8 -0
- package/integrations/opencode/commands/huaweicloud-doctor.md +14 -0
- package/integrations/opencode/opencode.json +14 -0
- package/integrations/opencode/skills/huaweicloud-core/SKILL.md +30 -0
- package/package.json +43 -0
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +44 -0
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +43 -0
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +44 -0
- package/plugins/huaweicloud-core/.mcp.json +13 -0
- package/plugins/huaweicloud-core/hooks/hooks.json +26 -0
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +88 -0
- package/plugins/huaweicloud-core/safety/policy.json +86 -0
- package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +144 -0
- package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -0
- package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -0
- package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -0
- package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +73 -0
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +190 -0
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +124 -0
- package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -0
- package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -0
- package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +56 -0
- package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -0
- package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -0
- package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -0
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +131 -0
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +92 -0
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -0
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +28 -0
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -0
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -0
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -0
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -0
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -0
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -0
- package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -0
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -0
- package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -0
- package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +122 -0
- package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -0
- package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -0
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +118 -0
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -0
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -0
- package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +100 -0
- package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -0
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +181 -0
- package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -0
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +77 -0
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +52 -0
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -0
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -0
- package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +47 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +125 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +94 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +20 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +28 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +46 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -0
- package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -0
- package/plugins/huaweicloud-core/src/mcp-server.mjs +93 -0
- package/plugins/huaweicloud-core/src/safety-policy.mjs +289 -0
- package/plugins/huaweicloud-core/src/search-market.mjs +169 -0
- package/plugins/huaweicloud-core/src/setup-cli.mjs +628 -0
- package/plugins/huaweicloud-core/src/tools.mjs +672 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: huawei-cloud-find-skills
|
|
3
|
+
description: |
|
|
4
|
+
Invoke this skill to search, discover, browse, find and install any Huawei Cloud (华为云) agent skill.Triggers include: "华为云","华为云有什么skill","华为云相关skill","华为云agent skill 市场","华为云skill类目","explore Huawei Cloud skills","show Huawei Cloud skill categories","does a Huawei Cloud skill exist for...","which Huawei Cloud skills exist","搜索华为云技能","有没有管理ECS/OBS/RDS的skill","帮我找 XX 华为云skill","介绍 XX Skill 内容","华为云 XX Skill 具体做什么","安装华为云Skill".
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
> [!IMPORTANT]
|
|
8
|
+
> **For any Huawei Cloud query or management task:**
|
|
9
|
+
> 1. **Search** — use this skill (`huawei-cloud-find-skills`) to find the relevant Skill.
|
|
10
|
+
> 2. **Install** — install the matched Skill (see [Step 3](#step-3-install-skill)).
|
|
11
|
+
> 3. **Execute** — follow the installed Skill's instructions to fulfill the request.
|
|
12
|
+
|
|
13
|
+
# Huawei Cloud Agent Skills Search and Discovery
|
|
14
|
+
|
|
15
|
+
This skill enables users to efficiently search, discover, and install Huawei Cloud skills.
|
|
16
|
+
|
|
17
|
+
## Scenario Description
|
|
18
|
+
|
|
19
|
+
This skill enables users to:
|
|
20
|
+
|
|
21
|
+
- **Search Skills**: Find skills by keyword, category, or both (matched against name, description, and triggers)
|
|
22
|
+
- **Browse Categories**: Explore available skill categories
|
|
23
|
+
- **View Skill Details**: Fetch full SKILL.md content from GitHub for specific skills
|
|
24
|
+
- **Install Skills**: Guide users through skill installation via `npx skills add` (GitCode default), `npx clawhub install`, or fallback GitHub method
|
|
25
|
+
|
|
26
|
+
**Architecture**: GitCode API v5 (`index.json` + `cn-en-map.json`) → HTTP GET (base64 decode) → In-memory search → GitHub raw fetch for details → Install
|
|
27
|
+
|
|
28
|
+
### Use Cases
|
|
29
|
+
|
|
30
|
+
- "Find a skill for managing ECS instances"
|
|
31
|
+
- "What Huawei Cloud skills are available for OBS?"
|
|
32
|
+
- "华为云有哪些 VPC 相关的 skill?"
|
|
33
|
+
- "Browse all available Huawei Cloud skills"
|
|
34
|
+
- "Install a skill for RDS management"
|
|
35
|
+
- "帮我找一个华为云网络相关的skill"
|
|
36
|
+
|
|
37
|
+
## Prerequisites
|
|
38
|
+
|
|
39
|
+
- **Node.js >= 20** must be installed
|
|
40
|
+
- **Network access** to `gitcode.com` (API v5 for index) and `github.com` / `raw.githubusercontent.com` (for skill details)
|
|
41
|
+
|
|
42
|
+
### Step 0: Check Python Environment
|
|
43
|
+
|
|
44
|
+
> **MANDATORY**: Before running any script command, verify Python is available.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Check Python availability
|
|
48
|
+
python --version # or: python3 --version
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If the command fails or returns Python 2.x:
|
|
52
|
+
|
|
53
|
+
1. **Install Python 3**: Download from [python.org](https://www.python.org/downloads/) or use a package manager:
|
|
54
|
+
```bash
|
|
55
|
+
# macOS
|
|
56
|
+
brew install python3
|
|
57
|
+
# Ubuntu/Debian
|
|
58
|
+
sudo apt-get install python3
|
|
59
|
+
# Windows — download installer from python.org, check "Add Python to PATH"
|
|
60
|
+
```
|
|
61
|
+
2. **Verify after install**: Run `python --version` again to confirm Python 3.6+ is available
|
|
62
|
+
3. **If `python` points to Python 2**: Use `python3` instead of `python` in all commands below
|
|
63
|
+
|
|
64
|
+
## Repository Info
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
INDEX_REPO=2501_91318609/skills-for-index
|
|
68
|
+
INDEX_BRANCH=main
|
|
69
|
+
SKILLS_REPO=huaweicloud/huaweicloud-skills
|
|
70
|
+
SKILLS_BRANCH=master
|
|
71
|
+
RAW_BASE=https://raw.githubusercontent.com/$SKILLS_REPO/$SKILLS_BRANCH
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Index Source
|
|
75
|
+
|
|
76
|
+
The search script fetches the skill index from GitCode API v5 via HTTP GET (base64 auto-decoded):
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
SKILLS_INDEX_URL=https://gitcode.com/api/v5/repos/2501_91318609/skills-for-index/contents/skills-index/index.json?ref=main
|
|
80
|
+
SKILLS_CN_EN_MAP_URL=https://gitcode.com/api/v5/repos/2501_91318609/skills-for-index/contents/skills-index/cn-en-map.json?ref=main
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## Core Workflow
|
|
85
|
+
|
|
86
|
+
### Step 1: Search Skills
|
|
87
|
+
|
|
88
|
+
> **MANDATORY**: The agent MUST execute the search script to search the skill index. Do NOT read the JSON file directly — always use the script.
|
|
89
|
+
|
|
90
|
+
Given `keyword` (from AI-understood user intent) and optional `category`, run the search script:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
node scripts/search-skills.mjs <keyword>
|
|
94
|
+
node scripts/search-skills.mjs <keyword> -c <category>
|
|
95
|
+
node scripts/search-skills.mjs -c <category>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
→ [scripts/search-skills.mjs](scripts/search-skills.mjs) (Node.js — cross-platform)
|
|
99
|
+
|
|
100
|
+
**What the script does**:
|
|
101
|
+
1. Fetches `index.json` and `cn-en-map.json` via HTTP GET from GitCode API v5 (auto-decodes base64 content)
|
|
102
|
+
2. Expands keywords via `cn-en-map.json` (bidirectional CN↔EN, e.g., "ECS" → "ECS, 弹性云服务器, 云服务器")
|
|
103
|
+
3. Scores each skill: name match **+10**, trigger match **+8**, description match **+5**, service match **+3**
|
|
104
|
+
4. Sorts by score descending, outputs formatted results with matched keywords
|
|
105
|
+
|
|
106
|
+
**Fallback iteration** (if no results): 1) Switch CN↔EN keywords 2) Expand keywords 3) Remove category filter 4) Try synonyms 5) List all skills
|
|
107
|
+
|
|
108
|
+
The process should persist until the skill is found or its absence is confirmed. In the event of total failure, notify the user of the specific steps that were attempted.
|
|
109
|
+
|
|
110
|
+
### Step 2: View Skill Details (optional)
|
|
111
|
+
|
|
112
|
+
Fetch the full SKILL.md content from GitHub for intent validation. Skip this step if the search results from Step 1 are sufficiently informative.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# URL pattern — use the skill's category, service, and name from index
|
|
116
|
+
DETAIL_URL="https://raw.githubusercontent.com/huaweicloud/huaweicloud-skills/master/skills/${category}/${service}/${name}/SKILL.md"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The agent can fetch this URL using `curl` or its web-fetch tool, then present the skill's full documentation to the user.
|
|
120
|
+
|
|
121
|
+
### Step 3: Install Skill
|
|
122
|
+
|
|
123
|
+
> **MANDATORY**: Use one of the commands below. Option A is the default; Option C is a fallback when Option A is unavailable.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Option A: npx skills add from GitCode (default)
|
|
127
|
+
npx skills add https://gitcode.com/huaweicloud/huaweicloud-skills.git#master --skill <skill-name> -y
|
|
128
|
+
|
|
129
|
+
# Option B: npx clawhub install (OpenClaw ecosystem)
|
|
130
|
+
npx clawhub install <skill-name> -y
|
|
131
|
+
|
|
132
|
+
# Option C (fallback): npx skills add from GitHub
|
|
133
|
+
npx skills add huaweicloud/huaweicloud-skills --skill <skill-name> -y
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
If all installation attempts fail, report the error message to the user. Do NOT attempt any method outside the commands above.
|
|
137
|
+
|
|
138
|
+
## Parameters
|
|
139
|
+
|
|
140
|
+
| Parameter | Required/Optional | Description | Default |
|
|
141
|
+
|-----------|-------------------|-------------|---------|
|
|
142
|
+
| `Keyword` | Optional | Search keyword (matched against name, description, triggers, service) | None |
|
|
143
|
+
| `Category` | Optional | Category code for filtering (e.g., "computing", "storage", "network") | None |
|
|
144
|
+
| `skill-name` | Required (Step 3) | Exact skill name for installing | None |
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
## Reference Documentation
|
|
148
|
+
|
|
149
|
+
| Document | Description |
|
|
150
|
+
|----------|-------------|
|
|
151
|
+
| GitCode API v5 `index.json` | Skill index fetched via HTTP GET (base64 decoded) |
|
|
152
|
+
| GitCode API v5 `cn-en-map.json` | Chinese-English keyword mapping fetched via HTTP GET (base64 decoded) |
|
|
153
|
+
| [scripts/search-skills.py](scripts/search-skills.py) | Search script (Python) — fetches from GitCode API v5, expands keywords, scores, sorts |
|
|
154
|
+
|
|
155
|
+
## Search Heuristics
|
|
156
|
+
|
|
157
|
+
> Optional reference for keyword-to-category hints. The agent can infer categories from `index.json` without these.
|
|
158
|
+
|
|
159
|
+
- Cloud infrastructure keywords (ecs, bms, vpc, obs, rds, ...) → likely `computing`, `network`, `storage`, etc.
|
|
160
|
+
- Tool keywords (cli, terraform, koo) → likely `devtools`
|
|
161
|
+
- Management keywords (monitoring, alarm, log) → likely `monitoring`
|
|
162
|
+
|
|
163
|
+
## Troubleshooting
|
|
164
|
+
|
|
165
|
+
### Issue: Script fails with "Failed to fetch index.json"
|
|
166
|
+
|
|
167
|
+
**Cause**: GitCode API v5 URL unreachable
|
|
168
|
+
**Solution**: Verify network connectivity to `gitcode.com`
|
|
169
|
+
|
|
170
|
+
### Issue: GitCode API v5 returns 404
|
|
171
|
+
|
|
172
|
+
**Cause**: File path incorrect or default branch is not `main`
|
|
173
|
+
**Solution**: Verify the skill's `category`, `service`, and `name` from search results
|
|
174
|
+
|
|
175
|
+
### Issue: Search returns no results
|
|
176
|
+
|
|
177
|
+
**Cause**: Keywords don't match any skill
|
|
178
|
+
**Solution**:
|
|
179
|
+
1. Try broader keywords
|
|
180
|
+
2. Switch between Chinese and English keywords (e.g., "对象存储" → "obs")
|
|
181
|
+
3. List all skills: `python scripts/search-skills.py -c "computing"`
|
|
182
|
+
|
|
183
|
+
## Notes
|
|
184
|
+
|
|
185
|
+
- This skill is **read-only** and does not create any cloud resources
|
|
186
|
+
- **No cache management needed** — index is fetched fresh from GitCode API v5 each run
|
|
187
|
+
- **Network required** — index data is hosted on GitCode, fetched via HTTP GET (base64 decoded)
|
|
188
|
+
- **MUST use script to search** — do not read index.json directly
|
|
189
|
+
- Index repo: `https://gitcode.com/2501_91318609/skills-for-index` (branch: `main`)
|
|
190
|
+
- Skills repo: `https://github.com/huaweicloud/huaweicloud-skills` (branch: `master`)
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Buffer } from 'node:buffer';
|
|
3
|
+
|
|
4
|
+
const INDEX_URL = 'https://gitcode.com/api/v5/repos/2501_91318609/skills-for-index/contents/skills-index/index.json?ref=main';
|
|
5
|
+
const CN_EN_MAP_URL = 'https://gitcode.com/api/v5/repos/2501_91318609/skills-for-index/contents/skills-index/cn-en-map.json?ref=main';
|
|
6
|
+
|
|
7
|
+
const GENERIC_KEYWORDS = new Set([
|
|
8
|
+
'华为云', 'huawei', 'huawei cloud', '云', 'cloud', '技能', 'skill', 'skills',
|
|
9
|
+
'所有', 'all', '全部', '有什么', '有哪些', '相关', '列表', 'list',
|
|
10
|
+
'查找', '搜索', '发现', '浏览', 'find', 'search', 'discover', 'browse',
|
|
11
|
+
'show', 'explore', 'agent', '市场', 'market', '类目', 'category', '安装', 'install',
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
async function fetchJson(url, label) {
|
|
15
|
+
const resp = await fetch(url, { headers: { 'User-Agent': 'huaweicloud-devkit/1.0' } });
|
|
16
|
+
const data = await resp.json();
|
|
17
|
+
if (data?.encoding === 'base64' && data.content) {
|
|
18
|
+
return JSON.parse(Buffer.from(data.content, 'base64').toString('utf8'));
|
|
19
|
+
}
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function isGeneric(kw) {
|
|
24
|
+
const k = kw.toLowerCase().trim();
|
|
25
|
+
return GENERIC_KEYWORDS.has(k) || /华为云|huawei/i.test(k);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function expandKeywords(raw, cnEnMap) {
|
|
29
|
+
if (!raw) return [[], []];
|
|
30
|
+
const parts = raw.replace(/[,;]/g, ' ').split(/\s+/).filter(Boolean);
|
|
31
|
+
const expanded = [...parts];
|
|
32
|
+
for (const p of parts) {
|
|
33
|
+
const lower = p.toLowerCase();
|
|
34
|
+
if (cnEnMap[p]) expanded.push(cnEnMap[p]);
|
|
35
|
+
for (const [cn, en] of Object.entries(cnEnMap)) {
|
|
36
|
+
if (en === lower) expanded.push(cn);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const unique = [...new Set(expanded)].sort();
|
|
40
|
+
return [unique.filter((kw) => !isGeneric(kw)), unique.filter((kw) => isGeneric(kw))];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function scoreSkill(skill, specificKws, genericKws) {
|
|
44
|
+
if (!specificKws.length && !genericKws.length) return [1, []];
|
|
45
|
+
let total = 0;
|
|
46
|
+
const matched = [];
|
|
47
|
+
const nl = (skill.name || '').toLowerCase();
|
|
48
|
+
const dl = (skill.description || '').toLowerCase();
|
|
49
|
+
const sl = (skill.service || '').toLowerCase();
|
|
50
|
+
const tl = (skill.triggers || []).map((t) => (t || '').toLowerCase());
|
|
51
|
+
|
|
52
|
+
for (const kw of specificKws) {
|
|
53
|
+
const k = kw.toLowerCase();
|
|
54
|
+
let s = 0;
|
|
55
|
+
if (nl.includes(k)) s += 10;
|
|
56
|
+
else if (tl.some((t) => t.includes(k))) s += 8;
|
|
57
|
+
else if (dl.includes(k)) s += 5;
|
|
58
|
+
else if (sl.includes(k)) s += 3;
|
|
59
|
+
if (s > 0) { total += s; matched.push(kw); }
|
|
60
|
+
}
|
|
61
|
+
for (const kw of genericKws) {
|
|
62
|
+
const k = kw.toLowerCase();
|
|
63
|
+
let s = 0;
|
|
64
|
+
if (nl.includes(k)) s += 10;
|
|
65
|
+
else if (tl.some((t) => t.includes(k))) s += 4;
|
|
66
|
+
else if (dl.includes(k)) s += 2;
|
|
67
|
+
else if (sl.includes(k)) s += 1;
|
|
68
|
+
if (s > 0) { total += s; matched.push(kw); }
|
|
69
|
+
}
|
|
70
|
+
if (!specificKws.length && total === 0) {
|
|
71
|
+
total = 1;
|
|
72
|
+
if (dl.length > 20) total += 1;
|
|
73
|
+
if (tl.length) total += 1;
|
|
74
|
+
}
|
|
75
|
+
return [total, matched];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function main() {
|
|
79
|
+
const keyword = process.argv.slice(2).filter((a) => !a.startsWith('-')).join(' ') || '';
|
|
80
|
+
const catIdx = process.argv.indexOf('-c');
|
|
81
|
+
const category = catIdx >= 0 ? process.argv[catIdx + 1] || '' : '';
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
const [idx, cnEnMap] = await Promise.all([
|
|
85
|
+
fetchJson(INDEX_URL, 'index'),
|
|
86
|
+
fetchJson(CN_EN_MAP_URL, 'cn-en-map'),
|
|
87
|
+
]);
|
|
88
|
+
|
|
89
|
+
if (!keyword && !category) {
|
|
90
|
+
console.log(`Categories: ${(idx.categories || []).join(', ')}`);
|
|
91
|
+
console.log('Usage: node search-skills.mjs <keyword> [-c <category>]');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const [specificKws, genericKws] = expandKeywords(keyword, cnEnMap);
|
|
96
|
+
const hasSpecific = specificKws.length > 0;
|
|
97
|
+
|
|
98
|
+
const results = [];
|
|
99
|
+
for (const skill of idx.skills || []) {
|
|
100
|
+
if (category && skill.category !== category) continue;
|
|
101
|
+
const [score, matched] = scoreSkill(skill, specificKws, genericKws);
|
|
102
|
+
if (hasSpecific && score === 0) continue;
|
|
103
|
+
const desc = (skill.description || '').slice(0, 150);
|
|
104
|
+
results.push({ score, name: skill.name, category: skill.category, service: skill.service, description: desc + (skill.description?.length > 150 ? '...' : ''), triggers: (skill.triggers || []).slice(0, 5), matched });
|
|
105
|
+
}
|
|
106
|
+
results.sort((a, b) => b.score - a.score);
|
|
107
|
+
|
|
108
|
+
if (!results.length) {
|
|
109
|
+
console.log(`No results. Try broader keywords, remove category filter, or switch CN↔EN.`);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
console.log(`Found ${results.length} skill(s):`);
|
|
114
|
+
for (const r of results) {
|
|
115
|
+
console.log(` [${r.score}pts] ${r.name} (${r.category}/${r.service})${r.matched.length ? ' matched: ' + r.matched.join(',') : ''}`);
|
|
116
|
+
console.log(` ${r.description}`);
|
|
117
|
+
}
|
|
118
|
+
} catch (e) {
|
|
119
|
+
console.error(`Error: ${e.message}`);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
main();
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: huawei-cts
|
|
3
|
+
description: "Use when managing Cloud Trace Service (CTS) audit logs, trackers, and traces on Huawei Cloud. Triggers: CTS, Cloud Trace, audit log, tracker, trace, operation record. NOT for: CES monitoring alarms (use huawei-cloud-eye), log analysis (use LTS)."
|
|
4
|
+
version: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Huawei Cloud CTS
|
|
8
|
+
|
|
9
|
+
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
+
|
|
11
|
+
Always run `hcloud CTS <Operation> --help` before constructing commands to discover exact parameter names and requirements.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Domain expertise for Cloud Trace Service. Covers trackers, traces, notifications, and resource tags.
|
|
16
|
+
|
|
17
|
+
## Critical Warnings
|
|
18
|
+
|
|
19
|
+
| Trap | Why |
|
|
20
|
+
|------|-----|
|
|
21
|
+
| Tracker required for traces | Must create a tracker before traces are recorded |
|
|
22
|
+
| OBS bucket prerequisite | Tracker needs an OBS bucket for log delivery |
|
|
23
|
+
| 7-day retention default | Trace data retained 7 days by default. Create LTS tracker for longer retention |
|
|
24
|
+
| Organization tracker | Cross-account auditing requires organization tracker |
|
|
25
|
+
|
|
26
|
+
## Common Workflows
|
|
27
|
+
|
|
28
|
+
| Task | Operation |
|
|
29
|
+
|------|-----------|
|
|
30
|
+
| List operations | `ListOperations --cli-region=<r> --project_id=<p>` |
|
|
31
|
+
| List traces | `ListTraces --cli-region=<r> --project_id=<p>` |
|
|
32
|
+
| Create tracker | `CreateTracker --cli-region=<r> --project_id=<p>` |
|
|
33
|
+
| List trackers | `ListTrackers --cli-region=<r> --project_id=<p>` |
|
|
34
|
+
| Delete tracker | `DeleteTracker --cli-region=<r> --project_id=<p>` |
|
|
35
|
+
| Create notification | `CreateNotification --cli-region=<r> --project_id=<p>` |
|
|
36
|
+
| List notifications | `ListNotifications --cli-region=<r> --project_id=<p>` |
|
|
37
|
+
| List trace resources | `ListTraceResources --cli-region=<r> --project_id=<p>` |
|
|
38
|
+
|
|
39
|
+
Discover exact parameters with `--help` before executing any command.
|
|
40
|
+
|
|
41
|
+
## Troubleshooting
|
|
42
|
+
|
|
43
|
+
| Error | Fix |
|
|
44
|
+
|-------|-----|
|
|
45
|
+
| No traces found | Check tracker is created and enabled. Filter by time range |
|
|
46
|
+
| Tracker creation fails | Ensure OBS bucket exists and has correct permissions |
|
|
47
|
+
|
|
48
|
+
## Security
|
|
49
|
+
|
|
50
|
+
- SHOULD enable CTS for all production accounts
|
|
51
|
+
- MUST use OBS server-side encryption for trace logs
|
|
52
|
+
|
|
53
|
+
## Cross-Skill References
|
|
54
|
+
|
|
55
|
+
- **OBS**: See `huawei-obs` for tracker log delivery bucket
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: huawei-dds-dcs
|
|
3
|
+
description: "Use when creating or managing Document Database Service (DDS/MongoDB-compatible) or Distributed Cache Service (DCS/Redis/Memcached) on Huawei Cloud. Triggers: DDS, DCS, MongoDB, Redis, Memcached, document DB, cache, replica set, sharding. NOT for: RDS (use huawei-rds), GaussDB (use huawei-gaussdb)."
|
|
4
|
+
version: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Huawei Cloud DDS / DCS
|
|
8
|
+
|
|
9
|
+
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
+
|
|
11
|
+
Always run `hcloud DDS <Operation> --help` or `hcloud DCS <Operation> --help` before constructing commands.
|
|
12
|
+
|
|
13
|
+
## DDS (Document Database Service — MongoDB Compatible)
|
|
14
|
+
|
|
15
|
+
## Critical Warnings
|
|
16
|
+
|
|
17
|
+
| Trap | Why |
|
|
18
|
+
|------|-----|
|
|
19
|
+
| Requires 3-node replica | Minimum production deployment needs 3 nodes |
|
|
20
|
+
| Shard key permanent | Once selected, shard key cannot be changed |
|
|
21
|
+
| Storage auto-scaling off | Enable before storage fills |
|
|
22
|
+
|
|
23
|
+
### Common Workflows
|
|
24
|
+
|
|
25
|
+
| Task | Operation |
|
|
26
|
+
|------|-----------|
|
|
27
|
+
| List instances | `ListInstances --cli-region=<r> --project_id=<p>` |
|
|
28
|
+
| Create instance | `CreateInstance --cli-region=<r> --project_id=<p>` |
|
|
29
|
+
| Delete instance | `DeleteInstance --cli-region=<r> --project_id=<p>` |
|
|
30
|
+
| Add readonly node | `AddReadonlyNode --cli-region=<r> --project_id=<p>` |
|
|
31
|
+
| Add shard | `AddShardingNode --cli-region=<r> --project_id=<p>` |
|
|
32
|
+
| Create backup | `CreateBackup --cli-region=<r> --project_id=<p>` |
|
|
33
|
+
|
|
34
|
+
Discover exact parameters with `--help` before executing any command.
|
|
35
|
+
|
|
36
|
+
## DCS (Distributed Cache Service — Redis/Memcached)
|
|
37
|
+
|
|
38
|
+
## Critical Warnings
|
|
39
|
+
|
|
40
|
+
| Trap | Why |
|
|
41
|
+
|------|-----|
|
|
42
|
+
| Redis password required | Cannot create Redis instance without password |
|
|
43
|
+
| Memcached no password | Memcached has no auth — only accessible within VPC |
|
|
44
|
+
| Cache persistence costs | AOF/RDB persistence uses additional storage |
|
|
45
|
+
|
|
46
|
+
### Common Workflows
|
|
47
|
+
|
|
48
|
+
| Task | Operation |
|
|
49
|
+
|------|-----------|
|
|
50
|
+
| List instances | `ListInstances --cli-region=<r> --project_id=<p>` |
|
|
51
|
+
| Create Redis instance | `CreateInstance --cli-region=<r> --project_id=<p>` |
|
|
52
|
+
| Delete instance | `DeleteInstances --cli-region=<r> --project_id=<p>` |
|
|
53
|
+
| Restart instance | `RestartInstance --cli-region=<r> --project_id=<p>` |
|
|
54
|
+
| Show node information | `BatchShowNodesInformation --cli-region=<r> --project_id=<p>` |
|
|
55
|
+
| Create custom template | `CreateCustomTemplate --cli-region=<r> --project_id=<p>` |
|
|
56
|
+
|
|
57
|
+
Discover exact parameters with `--help` before executing any command.
|
|
58
|
+
|
|
59
|
+
## Troubleshooting
|
|
60
|
+
|
|
61
|
+
| Error | Fix |
|
|
62
|
+
|-------|-----|
|
|
63
|
+
| DDS instance creation fails | Check 3-node minimum, VPC/subnet availability |
|
|
64
|
+
| DCS connection refused | Redis instances need password. Memcached only accessible within VPC |
|
|
65
|
+
| DCS auto-expire not working | Enable auto-expire scan task for Redis |
|
|
66
|
+
|
|
67
|
+
## Cross-Skill References
|
|
68
|
+
|
|
69
|
+
- **VPC/Subnet**: See `huawei-vpc` for instance networking
|
|
70
|
+
- **Backup/CBR**: See `huawei-cbr` for backup management
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: huawei-deployment
|
|
3
|
+
description: "Use when creating, managing, or running deployment tasks and pipelines on Huawei Cloud CloudDeploy. Triggers: CloudDeploy, deployment, CI/CD, pipeline, release, artifact deployment, deploy task. NOT for: CodeArts Build (build pipeline), SWR container registry."
|
|
4
|
+
version: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Huawei Cloud CloudDeploy
|
|
8
|
+
|
|
9
|
+
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
+
|
|
11
|
+
Always run `hcloud <Service> <Operation> --help` before constructing commands to discover exact parameter names and requirements.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Domain expertise for Huawei Cloud CloudDeploy. Covers application creation, deployment task management, pipeline execution, and artifact configuration.
|
|
16
|
+
|
|
17
|
+
## Critical Warnings
|
|
18
|
+
|
|
19
|
+
| Trap | Why |
|
|
20
|
+
|------|-----|
|
|
21
|
+
| Service name may be `CodeArtsDeploy` | hcloud service name for deployment may be `CodeArtsDeploy` instead of `CloudDeploy`. Run `hcloud --help` to verify |
|
|
22
|
+
| Deployment hosts need agent | Install CloudDeploy agent on target hosts first |
|
|
23
|
+
| Task must reference application first | Create application before task |
|
|
24
|
+
| Artifact source defaults to OBS | Most deployment tasks pull artifacts from OBS. Ensure bucket and object exist |
|
|
25
|
+
| Parallel deployments may conflict | Lock resources or use deployment groups |
|
|
26
|
+
|
|
27
|
+
## Common Workflows
|
|
28
|
+
|
|
29
|
+
| Task | Operation |
|
|
30
|
+
|------|-----------|
|
|
31
|
+
| Create application | `CreateApp --name=<n> --platform=<p> --cli-region=<r>` |
|
|
32
|
+
| Create deployment task | `CreateTask --name=<n> --app_id=<id> --artifact_source_type=OBS` |
|
|
33
|
+
| Start deployment | `StartTask --task_id=<id>` |
|
|
34
|
+
| List tasks | `ListTasks --app_id=<id>` |
|
|
35
|
+
| Delete task | `DeleteTask --task_id=<id>` |
|
|
36
|
+
|
|
37
|
+
## Troubleshooting
|
|
38
|
+
|
|
39
|
+
| Error | Fix |
|
|
40
|
+
|-------|-----|
|
|
41
|
+
| Agent offline | Check agent service on target host, network connectivity, firewall rules |
|
|
42
|
+
| Deployment timeout | Check artifact size, increase task timeout, verify target host resources |
|
|
43
|
+
| Artifact not found | Verify OBS bucket and object path, check artifact permissions |
|
|
44
|
+
| Permission denied | Verify IAM roles for deployment: `CodeArtsDeploy FullAccess` or custom policy |
|
|
45
|
+
|
|
46
|
+
## Security
|
|
47
|
+
|
|
48
|
+
- MUST use IAM roles for deployment permissions
|
|
49
|
+
- MUST verify artifact integrity before deployment
|
|
50
|
+
- MUST not store credentials in deployment scripts
|
|
51
|
+
|
|
52
|
+
## Cross-Skill References
|
|
53
|
+
|
|
54
|
+
- **OBS artifact storage**: See `huawei-obs`
|
|
55
|
+
- **ECS deployment target**: See `huawei-ecs`
|
|
56
|
+
- **IAM permissions**: See `huawei-iam`
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: huawei-dew
|
|
3
|
+
description: "Use when managing secrets, credentials, encryption keys, certificates, or any sensitive data on Huawei Cloud. Covers CSMS (Cloud Secret Management Service) for secrets, KMS for encryption keys, and credential rotation. Triggers on: secret, credential, API key, token, password, encrypt, decrypt, KMS, CSMS, DEW, certificate, CSR, rotation. Activates for ANY task involving secrets or credentials — load this skill first before touching secrets."
|
|
4
|
+
version: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Huawei Cloud DEW (Data Encryption Workshop)
|
|
8
|
+
|
|
9
|
+
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
+
|
|
11
|
+
Always run `hcloud <Service> <Operation> --help` before constructing commands to discover exact parameter names and requirements.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Domain expertise for Huawei Cloud Data Encryption Workshop (DEW). Covers CSMS for secret lifecycle management, KMS for encryption key management, credential rotation, and secure application integration patterns.
|
|
16
|
+
|
|
17
|
+
## Critical Warnings
|
|
18
|
+
|
|
19
|
+
| Trap | Why |
|
|
20
|
+
|------|-----|
|
|
21
|
+
| NEVER fetch secret values into agent context | Use {{resolve:csms:secret-id:SecretString:key}} runtime injection |
|
|
22
|
+
| NEVER echo credentials in conversation | AK/SK, passwords, tokens must never appear in chat |
|
|
23
|
+
| KMS key deletion is irreversible | 7-30 day pending deletion window. Once gone, data is unrecoverable |
|
|
24
|
+
| Secret rotation requires automation | Manual rotation risks stale credentials |
|
|
25
|
+
| Cross-account KMS needs grants | KMS keys are regional. Cross-region data needs grant setup |
|
|
26
|
+
|
|
27
|
+
## CSMS Operations
|
|
28
|
+
|
|
29
|
+
### Read-only (safe — metadata only)
|
|
30
|
+
| Operation | Description |
|
|
31
|
+
|-----------|-------------|
|
|
32
|
+
| ListSecrets | List all secrets (names only, no values) |
|
|
33
|
+
| DescribeSecret | Get secret metadata (rotation config, KMS key, status) |
|
|
34
|
+
| ListSecretVersions | List version IDs and stages (no values) |
|
|
35
|
+
|
|
36
|
+
### Secret Value (blocked by policy — use runtime injection)
|
|
37
|
+
| Operation | Safe Alternative |
|
|
38
|
+
|-----------|-----------------|
|
|
39
|
+
| DownloadSecret | Use {{resolve:csms:secret-id}} in IaC or SDK |
|
|
40
|
+
| ShowSecretVersion | Use runtime injection, never in agent context |
|
|
41
|
+
| GetSecretValue | Blocked. Use MCP proxy resolve pattern |
|
|
42
|
+
|
|
43
|
+
## KMS Operations
|
|
44
|
+
|
|
45
|
+
| Task | Command | Notes |
|
|
46
|
+
|------|---------|-------|
|
|
47
|
+
| List keys | hcloud KMS ListKeys | Read-only |
|
|
48
|
+
| Create key | hcloud KMS CreateKey --key_alias=<name> | Requires write approval |
|
|
49
|
+
| Encrypt | hcloud KMS EncryptData --key_id=<id> --plaintext=<b64> | Prefer SDK offline encrypt |
|
|
50
|
+
| Decrypt | hcloud KMS DecryptData (**BLOCKED**) | Use runtime injection |
|
|
51
|
+
|
|
52
|
+
## Runtime Injection Pattern
|
|
53
|
+
|
|
54
|
+
`ash
|
|
55
|
+
# Terraform / IaC
|
|
56
|
+
resource "huaweicloud_csms_secret" "db_password" {
|
|
57
|
+
secret_string = var.db_password # NEVER hardcode
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
# SDK
|
|
61
|
+
secret_value = client.get_secret(secret_id="my-secret")
|
|
62
|
+
# Use immediately, never print or store in context
|
|
63
|
+
|
|
64
|
+
# hcloud (for approved automation only)
|
|
65
|
+
hcloud CSMS DownloadSecret --secret_name=<name>
|
|
66
|
+
# WARNING: Output goes to stdout. Pipe directly, never capture in agent.
|
|
67
|
+
`
|
|
68
|
+
|
|
69
|
+
## Troubleshooting
|
|
70
|
+
|
|
71
|
+
| Error | Root Cause -> Fix |
|
|
72
|
+
|-------|------------------|
|
|
73
|
+
| Secret not found | Wrong region or project -> Verify secret ARN includes region/project |
|
|
74
|
+
| AccessDenied on CSMS | Missing IAM CSMS policy -> Add csms:DescribeSecret + kms:Decrypt |
|
|
75
|
+
| KMS key disabled | Key scheduled for deletion or manually disabled -> Enable or create new key |
|
|
76
|
+
| Rotation stuck | Lambda/Python function error -> Check rotation function logs |
|
|
77
|
+
|
|
78
|
+
## Security Considerations
|
|
79
|
+
|
|
80
|
+
- MUST use runtime injection. NEVER fetch secrets into agent context
|
|
81
|
+
- MUST rotate credentials every 90 days
|
|
82
|
+
- MUST enable automatic rotation for CSMS secrets
|
|
83
|
+
- MUST audit KMS key usage via CTS
|
|
84
|
+
- SHOULD use customer-managed keys (CMK) for sensitive data
|
|
85
|
+
- MUST NOT use default KMS keys for production workloads
|
|
86
|
+
|
|
87
|
+
## MCP Tools
|
|
88
|
+
|
|
89
|
+
- huaweicloud_list_operations service=DEW or CSMS or KMS
|
|
90
|
+
- huaweicloud_run_readonly_command for ListSecrets/ListKeys (metadata only)
|
|
91
|
+
- huaweicloud_safety policy blocks all secret value reads
|
|
92
|
+
|
|
93
|
+
## References
|
|
94
|
+
|
|
95
|
+
- DEW Docs: https://support.huaweicloud.com/dew/
|
|
96
|
+
- CSMS usage: references/csms-usage.md
|
|
97
|
+
- KMS usage: references/kms-usage.md
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# CSMS Usage Guide
|
|
2
|
+
|
|
3
|
+
## Create Secret
|
|
4
|
+
hcloud CSMS CreateSecret --secret_name=prod-db-password --secret_string='{"password":"CHANGE_ME"}'
|
|
5
|
+
|
|
6
|
+
## List Secrets (metadata only)
|
|
7
|
+
hcloud CSMS ListSecrets
|
|
8
|
+
|
|
9
|
+
## Describe Secret
|
|
10
|
+
hcloud CSMS DescribeSecret --secret_name=prod-db-password
|
|
11
|
+
|
|
12
|
+
## List Versions
|
|
13
|
+
hcloud CSMS ListSecretVersions --secret_name=prod-db-password
|
|
14
|
+
|
|
15
|
+
## Runtime Injection (Terraform)
|
|
16
|
+
data "huaweicloud_csms_secret" "db" {
|
|
17
|
+
secret_name = "prod-db-password"
|
|
18
|
+
}
|
|
19
|
+
Use: data.huaweicloud_csms_secret.db.secret_string
|
|
20
|
+
|
|
21
|
+
## Rotation
|
|
22
|
+
- Enable auto-rotation: hcloud CSMS EnableSecretRotation --secret_name=<name> --rotation_interval=30
|
|
23
|
+
- Rotation function ARN: provide Lambda to generate new secret value
|
|
24
|
+
|
|
25
|
+
## Policy Rules
|
|
26
|
+
- hcloud CSMS DownloadSecret -> BLOCKED (use runtime injection)
|
|
27
|
+
- hcloud CSMS ShowSecretVersion -> BLOCKED
|
|
28
|
+
- hcloud CSMS ListSecrets -> ALLOWED (metadata only)
|
|
29
|
+
- hcloud CSMS DescribeSecret -> ALLOWED (metadata only)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# KMS Usage Guide
|
|
2
|
+
|
|
3
|
+
## Create Key
|
|
4
|
+
hcloud KMS CreateKey --key_alias=app-encryption-key --key_description="Application data encryption"
|
|
5
|
+
|
|
6
|
+
## List Keys (metadata only)
|
|
7
|
+
hcloud KMS ListKeys
|
|
8
|
+
|
|
9
|
+
## Encrypt (offline preferred)
|
|
10
|
+
hcloud KMS EncryptData --key_id=<key-id> --plaintext=<base64-data>
|
|
11
|
+
|
|
12
|
+
## Decrypt (BLOCKED - use runtime)
|
|
13
|
+
DO NOT use hcloud KMS DecryptData directly.
|
|
14
|
+
Use SDK with KMS client in application runtime.
|
|
15
|
+
|
|
16
|
+
## Key Rotation
|
|
17
|
+
- Enable: hcloud KMS EnableKeyRotation --key_id=<key-id>
|
|
18
|
+
- Rotation period: 365 days (default)
|
|
19
|
+
|
|
20
|
+
## Key Deletion
|
|
21
|
+
- Schedule: hcloud KMS ScheduleKeyDeletion --key_id=<key-id> --pending_days=7
|
|
22
|
+
- Cancel during pending window: hcloud KMS CancelKeyDeletion --key_id=<key-id>
|
|
23
|
+
- WARNING: After deletion window passes, data encrypted with this key is UNRECOVERABLE
|