huaweicloud-devkit 1.0.2-next.3 → 1.0.3-dev.0

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 (97) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +139 -163
  4. package/README.zh-CN.md +139 -161
  5. package/bin/setup.cjs +8 -8
  6. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  7. package/integrations/opencode/opencode.json +14 -14
  8. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
  9. package/package.json +44 -47
  10. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +44 -44
  11. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +43 -43
  12. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +44 -44
  13. package/plugins/huaweicloud-core/.mcp.json +15 -15
  14. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +44 -44
  15. package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
  16. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +136 -136
  17. package/plugins/huaweicloud-core/safety/policy.json +99 -99
  18. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +199 -199
  19. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +164 -164
  20. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
  21. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
  22. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -101
  23. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
  24. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +190 -190
  25. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +124 -124
  26. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
  27. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
  28. package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +56 -56
  29. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
  30. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
  31. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
  32. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +185 -185
  33. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +133 -133
  34. package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
  35. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +55 -55
  36. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  37. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +131 -131
  38. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
  39. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -71
  40. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
  41. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
  42. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
  43. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -65
  44. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
  45. package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +122 -122
  46. package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -56
  47. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
  48. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +127 -133
  49. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
  50. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -26
  51. package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +100 -100
  52. package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -40
  53. package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
  54. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +224 -224
  55. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +134 -139
  56. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
  57. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +84 -84
  58. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +76 -76
  59. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -59
  60. package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -50
  61. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
  62. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -56
  63. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
  64. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +47 -51
  65. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
  66. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +128 -128
  67. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
  68. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +95 -110
  69. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
  70. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +19 -19
  71. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
  72. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +60 -60
  73. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
  74. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
  75. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
  76. package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +87 -105
  77. package/plugins/huaweicloud-core/src/auth/credentials.mjs +95 -95
  78. package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
  79. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
  80. package/plugins/huaweicloud-core/src/mcp-server.mjs +129 -129
  81. package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +137 -137
  82. package/plugins/huaweicloud-core/src/safety-policy.mjs +302 -302
  83. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +87 -91
  84. package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +153 -162
  85. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +105 -112
  86. package/plugins/huaweicloud-core/src/search-market.mjs +169 -174
  87. package/plugins/huaweicloud-core/src/setup-cli.mjs +1594 -2017
  88. package/plugins/huaweicloud-core/src/tools.mjs +993 -1008
  89. package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +427 -427
  90. package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +132 -132
  91. package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +227 -227
  92. package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +202 -202
  93. package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +158 -158
  94. package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
  95. package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
  96. package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +0 -155
  97. package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +0 -87
@@ -1,190 +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`)
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`)
@@ -1,124 +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();
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();