huaweicloud-devkit 1.1.0-next.10 → 1.1.0-next.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.0-next.10",
3
+ "version": "1.1.0-next.11",
4
4
  "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
5
5
  "type": "module",
6
6
  "files": [
@@ -17,7 +17,7 @@
17
17
  "mcpServers": "./.mcp.json",
18
18
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
19
19
  "skills": "./skills/",
20
- "version": "1.1.0-next.10",
20
+ "version": "1.1.0-next.11",
21
21
  "author": {
22
22
  "name": "HuaweiCloud Mate",
23
23
  "url": "https://github.com/huaweicloud"
@@ -20,7 +20,7 @@
20
20
  "mcpServers": "./.mcp.json",
21
21
  "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
22
22
  "skills": "./skills/",
23
- "version": "1.1.0-next.10",
23
+ "version": "1.1.0-next.11",
24
24
  "author": {
25
25
  "name": "HuaweiCloud Mate",
26
26
  "url": "https://github.com/huaweicloud"
@@ -17,7 +17,7 @@
17
17
  "mcpServers": "./.mcp.json",
18
18
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
19
19
  "skills": "./skills/",
20
- "version": "1.1.0-next.10",
20
+ "version": "1.1.0-next.11",
21
21
  "author": {
22
22
  "name": "HuaweiCloud Mate",
23
23
  "url": "https://github.com/huaweicloud"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.0-next.10",
3
+ "version": "1.1.0-next.11",
4
4
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
5
5
  "author": {
6
6
  "name": "HuaweiCloud Mate",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.0-next.10",
3
+ "version": "1.1.0-next.11",
4
4
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
5
5
  "author": {
6
6
  "name": "HuaweiCloud Mate",
@@ -2,7 +2,7 @@
2
2
  "name": "huaweicloud-devkit",
3
3
  "id": "huaweicloud-devkit",
4
4
  "displayName": "HuaweiCloud DevKit",
5
- "version": "1.1.0-next.10",
5
+ "version": "1.1.0-next.11",
6
6
  "family": "bundle-plugin",
7
7
  "bundleFormat": "codex",
8
8
  "description": "Guide coding agents to use Huawei Cloud safely — KooCLI, APIs, SDKs, 28 MCP tools, skills, and safety guardrails.",
@@ -2070,26 +2070,19 @@ function removeHermesHooksConfigBlock() {
2070
2070
  const configPath = hermesConfigFile();
2071
2071
  if (!existsSync(configPath)) return;
2072
2072
  const lines = readFileSync(configPath, 'utf8').split(/\r?\n/);
2073
+ let inHooksBlock = false;
2073
2074
  const out = [];
2074
- let skip = false;
2075
2075
  for (const line of lines) {
2076
- if (/^\s*huaweicloud-safety\.py/.test(line.trim())) {
2077
- skip = true;
2078
- continue;
2079
- }
2080
- if (skip) {
2081
- if (line.trim() === '') continue;
2082
- if (/^\s{2,}/.test(line) && line.trim() !== '') continue;
2083
- skip = false;
2084
- }
2085
- if (line.trim() === 'hooks:') {
2086
- continue;
2087
- }
2088
- if (line.trim() === 'pre_tool_call:') {
2076
+ const trimmed = line.trim();
2077
+ if (trimmed === 'hooks:' && !inHooksBlock) {
2078
+ inHooksBlock = true;
2089
2079
  continue;
2090
2080
  }
2091
- if (/^\s*- matcher:\s*"terminal"/.test(line)) {
2092
- continue;
2081
+ if (inHooksBlock) {
2082
+ if (trimmed === '' || line.startsWith(' ') || line.startsWith('\t')) {
2083
+ continue;
2084
+ }
2085
+ inHooksBlock = false;
2093
2086
  }
2094
2087
  out.push(line);
2095
2088
  }
@@ -2186,6 +2179,36 @@ async function updateHermes() {
2186
2179
  function uninstallHermes() {
2187
2180
  const skillsDir = hermesSkillsDir();
2188
2181
  let removed = 0;
2182
+
2183
+ // 1. Remove hook config from config.yaml (before deleting script files)
2184
+ removeHermesHooksConfigBlock();
2185
+ console.log(' Hooks config removed');
2186
+
2187
+ // 2. Clean shell-hooks-allowlist.json (remove approved hook references)
2188
+ const hermesHome = hermesHomeDir();
2189
+ const allowlistPath = join(hermesHome, 'shell-hooks-allowlist.json');
2190
+ if (existsSync(allowlistPath)) {
2191
+ try {
2192
+ const allowlist = JSON.parse(readFileSync(allowlistPath, 'utf8'));
2193
+ const before = (allowlist.approvals || []).length;
2194
+ allowlist.approvals = (allowlist.approvals || []).filter((a) =>
2195
+ typeof a === 'string' ? !a.includes('huaweicloud-safety.py') : true,
2196
+ );
2197
+ if (allowlist.approvals.length < before) {
2198
+ writeFileSync(allowlistPath, JSON.stringify(allowlist, null, 2));
2199
+ console.log(` Removed ${before - allowlist.approvals.length} hook approvals from allowlist`);
2200
+ }
2201
+ } catch {
2202
+ removeIfExists(allowlistPath);
2203
+ console.log(' Removed hook allowlist file');
2204
+ }
2205
+ }
2206
+
2207
+ // 3. Remove MCP config from config.yaml
2208
+ removeHermesMcpConfigBlock();
2209
+ console.log(' MCP config removed');
2210
+
2211
+ // 4. Remove skills (file deletion comes after config cleanup)
2189
2212
  if (existsSync(skillsDir)) {
2190
2213
  for (const entry of readdirSync(skillsDir, { withFileTypes: true })) {
2191
2214
  if (entry.name.startsWith('huawei')) {
@@ -2202,11 +2225,10 @@ function uninstallHermes() {
2202
2225
  } catch {}
2203
2226
  }
2204
2227
 
2228
+ // 5. Remove plugin directory (hook script files deleted last)
2205
2229
  if (removeIfExists(hermesPluginsDir())) {
2206
2230
  console.log(' Removed MCP server, safety policy and hooks');
2207
2231
  }
2208
- removeHermesMcpConfigBlock();
2209
- removeHermesHooksConfigBlock();
2210
2232
  }
2211
2233
 
2212
2234
  function hermesStatus() {