huaweicloud-devkit 1.0.2-dev.9 → 1.0.2-next.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 +163 -138
  4. package/README.zh-CN.md +161 -138
  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 +46 -44
  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 +133 -127
  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 +135 -134
  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 +51 -47
  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 +110 -95
  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 +105 -87
  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/proxy/proxy-agent.mjs +155 -0
  82. package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +87 -0
  83. package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +137 -137
  84. package/plugins/huaweicloud-core/src/safety-policy.mjs +302 -302
  85. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +91 -87
  86. package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +162 -153
  87. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +112 -105
  88. package/plugins/huaweicloud-core/src/search-market.mjs +174 -169
  89. package/plugins/huaweicloud-core/src/setup-cli.mjs +2017 -1594
  90. package/plugins/huaweicloud-core/src/tools.mjs +1008 -993
  91. package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +427 -427
  92. package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +132 -132
  93. package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +227 -227
  94. package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +202 -202
  95. package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +158 -158
  96. package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
  97. package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
@@ -1,26 +1,26 @@
1
- # OBS Bucket Lifecycle
2
-
3
- > KooCLI OBS uses obsutil-style commands. `OBS CreateBucket` → `OBS mb`. `SetBucketWebsite` is NOT supported in KooCLI OBS (use API/SDK).
4
-
5
- ## Create Bucket
6
- hcloud OBS mb obs://<bucket> -location=<region>
7
-
8
- ## Lifecycle Rules (JSON)
9
- {
10
- "Rules": [{
11
- "ID": "move-to-ia-after-30d",
12
- "Status": "Enabled",
13
- "Filter": {"Prefix": ""},
14
- "Transitions": [{"Days": 30, "StorageClass": "STANDARD_IA"}],
15
- "Expiration": {"Days": 365}
16
- }]
17
- }
18
-
19
- ## Apply
20
- hcloud OBS lifecycle obs://<bucket> -method=put -localfile=<lifecycle.json>
21
-
22
- ## Static Website
23
- Not available via KooCLI OBS CLI. Use `hcloud OBS chattri obs://<bucket> -acl=public-read` for bucket ACL, or use API/SDK for website configuration.
24
-
25
- ## Cross-Region Replication
26
- Requires: source bucket versioning enabled, destination bucket in different region, replication IAM role.
1
+ # OBS Bucket Lifecycle
2
+
3
+ > KooCLI OBS uses obsutil-style commands. `OBS CreateBucket` → `OBS mb`. `SetBucketWebsite` is NOT supported in KooCLI OBS (use API/SDK).
4
+
5
+ ## Create Bucket
6
+ hcloud OBS mb obs://<bucket> -location=<region>
7
+
8
+ ## Lifecycle Rules (JSON)
9
+ {
10
+ "Rules": [{
11
+ "ID": "move-to-ia-after-30d",
12
+ "Status": "Enabled",
13
+ "Filter": {"Prefix": ""},
14
+ "Transitions": [{"Days": 30, "StorageClass": "STANDARD_IA"}],
15
+ "Expiration": {"Days": 365}
16
+ }]
17
+ }
18
+
19
+ ## Apply
20
+ hcloud OBS lifecycle obs://<bucket> -method=put -localfile=<lifecycle.json>
21
+
22
+ ## Static Website
23
+ Not available via KooCLI OBS CLI. Use `hcloud OBS chattri obs://<bucket> -acl=public-read` for bucket ACL, or use API/SDK for website configuration.
24
+
25
+ ## Cross-Region Replication
26
+ Requires: source bucket versioning enabled, destination bucket in different region, replication IAM role.
@@ -1,100 +1,100 @@
1
- # OBS Common Pitfalls
2
-
3
- 基于真实测试暴露的陷阱和避坑方法。
4
-
5
- ## OBS 命令格式陷阱
6
-
7
- OBS 使用 **obsutil-style** 子命令,不是 API-style 操作名:
8
-
9
- | 错误写法(API-style) | 正确写法(obsutil-style) |
10
- |----------------------|--------------------------|
11
- | `OBS --help` | `hcloud OBS help`(无 `--`,`help` 是子命令) |
12
- | `OBS CreateBucket` | `hcloud OBS mb obs://<bucket>` |
13
- | `OBS PutObject` | `hcloud OBS cp <file> obs://<bucket>/` |
14
- | `OBS DeleteBucket` | `hcloud OBS rm obs://<bucket> -r` |
15
- | `OBS ListBuckets` | `hcloud OBS ls` |
16
-
17
- ## 独立凭证配置
18
-
19
- KooCLI OBS 使用独立的凭证文件 `~/.obsutilconfig`,**不是** `~/.hcloud/config.json`。
20
-
21
- ```bash
22
- # OBS 命令报 "Please set ak, sk and endpoint" 时运行:
23
- hcloud OBS config -i
24
- # 交互式输入:AK、SK、endpoint(如 obs.cn-north-4.myhuaweicloud.com)
25
- # 这必须由用户在 agent 对话外手动执行
26
- ```
27
-
28
- ## 目录上传语义
29
-
30
- `hcloud OBS cp <dir>/ obs://bucket/ -r` 将本地**文件夹名作为对象前缀**:
31
-
32
- ```
33
- 本地结构:
34
- devkit/
35
- index.html
36
- assets/app.js
37
-
38
- 上传后 OBS 结构:
39
- obs://bucket/devkit/index.html ← 多了 devkit/ 前缀
40
- obs://bucket/devkit/assets/app.js
41
-
42
- 预期结构:
43
- obs://bucket/index.html
44
- obs://bucket/assets/app.js
45
- ```
46
-
47
- **规避方法**:
48
- 1. 先 `-dryRun` 预览实际键名,再执行真实上传
49
- 2. 或先将本地目录重命名为目标前缀名,如 `mv devkit/ root/` 后上传 `root/`
50
- 3. 或使用 `-flat` 参数(如支持)
51
-
52
- ## 静态网站托管
53
-
54
- KooCLI OBS **不支持** `SetBucketWebsite` 命令。配置静态网站托管需要:
55
-
56
- 1. **REST API**: `PUT /?website` 到桶的 endpoint
57
- 2. **控制台**: OBS 控制台 → 桶 → 静态网站托管 → 开启
58
-
59
- 插件只能完成"上传文件 + 设置 ACL",静态托管开关需用户手动完成。
60
-
61
- ## 权限模型(三层)
62
-
63
- | 层级 | 作用域 | 优先级 |
64
- |------|--------|--------|
65
- | IAM Policy | 用户/用户组 | 最高 |
66
- | Bucket Policy | 桶级 | 中 |
67
- | ACL | 对象级 | 最低 |
68
-
69
- **关键规则**:三层中**最严格**的生效。Bucket Policy 设为 public-read,但 IAM deny 了 → 结果是 deny。
70
-
71
- **静态网站场景**:必须同时设置桶级 AND 对象级 `-acl=public-read`,因为 ACL 不级联。
72
-
73
- ```bash
74
- # 桶级
75
- hcloud OBS chattri obs://<bucket> -acl=public-read
76
- # 对象级(必须单独执行)
77
- hcloud OBS chattri obs://<bucket>/index.html -acl=public-read
78
- ```
79
-
80
- ## 桶命名约束
81
-
82
- - 全局唯一,所有用户共享命名空间
83
- - 小写字母、数字、连字符
84
- - 3-63 字符
85
- - 不能以连字符开头或结尾
86
- - 不能是 IP 地址格式
87
-
88
- ## 版本控制陷阱
89
-
90
- - 开启后**无法关闭**,只能暂停
91
- - 删除桶前必须清空所有版本和删除标记
92
- - 版本存储按对象大小计费
93
-
94
- ## 安全注意事项
95
-
96
- - MUST 默认阻止公网访问
97
- - MUST 启用 HTTPS-only
98
- - SHOULD 开启访问日志
99
- - 预签名 URL 最大 7 天有效期
100
- - AK/SK 绝对不能写入 Bucket Policy
1
+ # OBS Common Pitfalls
2
+
3
+ 基于真实测试暴露的陷阱和避坑方法。
4
+
5
+ ## OBS 命令格式陷阱
6
+
7
+ OBS 使用 **obsutil-style** 子命令,不是 API-style 操作名:
8
+
9
+ | 错误写法(API-style) | 正确写法(obsutil-style) |
10
+ |----------------------|--------------------------|
11
+ | `OBS --help` | `hcloud OBS help`(无 `--`,`help` 是子命令) |
12
+ | `OBS CreateBucket` | `hcloud OBS mb obs://<bucket>` |
13
+ | `OBS PutObject` | `hcloud OBS cp <file> obs://<bucket>/` |
14
+ | `OBS DeleteBucket` | `hcloud OBS rm obs://<bucket> -r` |
15
+ | `OBS ListBuckets` | `hcloud OBS ls` |
16
+
17
+ ## 独立凭证配置
18
+
19
+ KooCLI OBS 使用独立的凭证文件 `~/.obsutilconfig`,**不是** `~/.hcloud/config.json`。
20
+
21
+ ```bash
22
+ # OBS 命令报 "Please set ak, sk and endpoint" 时运行:
23
+ hcloud OBS config -i
24
+ # 交互式输入:AK、SK、endpoint(如 obs.cn-north-4.myhuaweicloud.com)
25
+ # 这必须由用户在 agent 对话外手动执行
26
+ ```
27
+
28
+ ## 目录上传语义
29
+
30
+ `hcloud OBS cp <dir>/ obs://bucket/ -r` 将本地**文件夹名作为对象前缀**:
31
+
32
+ ```
33
+ 本地结构:
34
+ devkit/
35
+ index.html
36
+ assets/app.js
37
+
38
+ 上传后 OBS 结构:
39
+ obs://bucket/devkit/index.html ← 多了 devkit/ 前缀
40
+ obs://bucket/devkit/assets/app.js
41
+
42
+ 预期结构:
43
+ obs://bucket/index.html
44
+ obs://bucket/assets/app.js
45
+ ```
46
+
47
+ **规避方法**:
48
+ 1. 先 `-dryRun` 预览实际键名,再执行真实上传
49
+ 2. 或先将本地目录重命名为目标前缀名,如 `mv devkit/ root/` 后上传 `root/`
50
+ 3. 或使用 `-flat` 参数(如支持)
51
+
52
+ ## 静态网站托管
53
+
54
+ KooCLI OBS **不支持** `SetBucketWebsite` 命令。配置静态网站托管需要:
55
+
56
+ 1. **REST API**: `PUT /?website` 到桶的 endpoint
57
+ 2. **控制台**: OBS 控制台 → 桶 → 静态网站托管 → 开启
58
+
59
+ 插件只能完成"上传文件 + 设置 ACL",静态托管开关需用户手动完成。
60
+
61
+ ## 权限模型(三层)
62
+
63
+ | 层级 | 作用域 | 优先级 |
64
+ |------|--------|--------|
65
+ | IAM Policy | 用户/用户组 | 最高 |
66
+ | Bucket Policy | 桶级 | 中 |
67
+ | ACL | 对象级 | 最低 |
68
+
69
+ **关键规则**:三层中**最严格**的生效。Bucket Policy 设为 public-read,但 IAM deny 了 → 结果是 deny。
70
+
71
+ **静态网站场景**:必须同时设置桶级 AND 对象级 `-acl=public-read`,因为 ACL 不级联。
72
+
73
+ ```bash
74
+ # 桶级
75
+ hcloud OBS chattri obs://<bucket> -acl=public-read
76
+ # 对象级(必须单独执行)
77
+ hcloud OBS chattri obs://<bucket>/index.html -acl=public-read
78
+ ```
79
+
80
+ ## 桶命名约束
81
+
82
+ - 全局唯一,所有用户共享命名空间
83
+ - 小写字母、数字、连字符
84
+ - 3-63 字符
85
+ - 不能以连字符开头或结尾
86
+ - 不能是 IP 地址格式
87
+
88
+ ## 版本控制陷阱
89
+
90
+ - 开启后**无法关闭**,只能暂停
91
+ - 删除桶前必须清空所有版本和删除标记
92
+ - 版本存储按对象大小计费
93
+
94
+ ## 安全注意事项
95
+
96
+ - MUST 默认阻止公网访问
97
+ - MUST 启用 HTTPS-only
98
+ - SHOULD 开启访问日志
99
+ - 预签名 URL 最大 7 天有效期
100
+ - AK/SK 绝对不能写入 Bucket Policy
@@ -1,40 +1,40 @@
1
- # OBS Single-File Quick Share
2
-
3
- Host one file and get a shareable link in seconds. Two options:
4
-
5
- | Option | Link type | Bucket/object visibility | Expiry |
6
- |--------|-----------|--------------------------|--------|
7
- | Presigned URL | Time-limited private link | Keep private | `-e=<seconds>`, max 7 days |
8
- | Public URL | Permanent public link | Set object `-acl=public-read` | None |
9
-
10
- ## Option 1: Presigned URL (private, time-limited)
11
-
12
- No ACL change needed. The object stays private; the link grants temporary access.
13
-
14
- ```bash
15
- hcloud OBS cp <file> obs://<bucket>/<key> -f
16
- hcloud OBS sign obs://<bucket>/<key> -e=3600 # valid 1 hour, max 604800 (7 days)
17
- ```
18
-
19
- The `sign` command prints the full presigned URL directly — share it as-is.
20
-
21
- ## Option 2: Public URL (permanent, public-read)
22
-
23
- ```bash
24
- hcloud OBS cp <file> obs://<bucket>/<key> -f
25
- hcloud OBS chattri obs://<bucket>/<key> -acl=public-read
26
- ```
27
-
28
- The shareable public URL follows the OBS endpoint format (NOT the `obs-website` static-site endpoint):
29
-
30
- ```
31
- https://<bucket>.obs.<region>.myhuaweicloud.com/<key>
32
- ```
33
-
34
- ## Key Gotchas
35
-
36
- - **Bucket ACL does NOT cascade**: `chattri obs://<bucket> -acl=public-read` alone does not make objects public. Set the object-level ACL explicitly.
37
- - **`-f` is mandatory**: `cp` without `-f` prompts "Please input (y/n)" on overwrite → agent hangs (TIMEOUT).
38
- - **Public-read means anyone with the link can access**: use presigned URLs when the file is sensitive.
39
- - **Presigned URL max expiry is 7 days** (`-e=604800`). For longer-lived public access, use the public-read option.
40
- - **Credential setup**: OBS uses a separate config (`~/.obsutilconfig`). Call `huaweicloud_setup_obs_config` before first use.
1
+ # OBS Single-File Quick Share
2
+
3
+ Host one file and get a shareable link in seconds. Two options:
4
+
5
+ | Option | Link type | Bucket/object visibility | Expiry |
6
+ |--------|-----------|--------------------------|--------|
7
+ | Presigned URL | Time-limited private link | Keep private | `-e=<seconds>`, max 7 days |
8
+ | Public URL | Permanent public link | Set object `-acl=public-read` | None |
9
+
10
+ ## Option 1: Presigned URL (private, time-limited)
11
+
12
+ No ACL change needed. The object stays private; the link grants temporary access.
13
+
14
+ ```bash
15
+ hcloud OBS cp <file> obs://<bucket>/<key> -f
16
+ hcloud OBS sign obs://<bucket>/<key> -e=3600 # valid 1 hour, max 604800 (7 days)
17
+ ```
18
+
19
+ The `sign` command prints the full presigned URL directly — share it as-is.
20
+
21
+ ## Option 2: Public URL (permanent, public-read)
22
+
23
+ ```bash
24
+ hcloud OBS cp <file> obs://<bucket>/<key> -f
25
+ hcloud OBS chattri obs://<bucket>/<key> -acl=public-read
26
+ ```
27
+
28
+ The shareable public URL follows the OBS endpoint format (NOT the `obs-website` static-site endpoint):
29
+
30
+ ```
31
+ https://<bucket>.obs.<region>.myhuaweicloud.com/<key>
32
+ ```
33
+
34
+ ## Key Gotchas
35
+
36
+ - **Bucket ACL does NOT cascade**: `chattri obs://<bucket> -acl=public-read` alone does not make objects public. Set the object-level ACL explicitly.
37
+ - **`-f` is mandatory**: `cp` without `-f` prompts "Please input (y/n)" on overwrite → agent hangs (TIMEOUT).
38
+ - **Public-read means anyone with the link can access**: use presigned URLs when the file is sensitive.
39
+ - **Presigned URL max expiry is 7 days** (`-e=604800`). For longer-lived public access, use the public-read option.
40
+ - **Credential setup**: OBS uses a separate config (`~/.obsutilconfig`). Call `huaweicloud_setup_obs_config` before first use.
@@ -1,56 +1,56 @@
1
- # OBS Static Website Deployment
2
-
3
- ## Workflow
4
-
5
- ```
6
- 1. Build project → npm run build / yarn build
7
- 2. Create OBS bucket → hcloud OBS mb obs://<bucket> -location=<region>
8
- 3. Bulk upload → hcloud OBS cp <build-dir>/ obs://<bucket>/ -r -f -flat -acl=public-read
9
- 4. Set bucket ACL → hcloud OBS chattri obs://<bucket> -acl=public-read
10
- 5. Set object ACLs → hcloud OBS chattri obs://<bucket>/ -r -f -acl=public-read
11
- 6. Configure website → REST API (KooCLI OBS lacks this feature)
12
- 7. Verify → curl http://<bucket>.obs-website.<region>.myhuaweicloud.com
13
- ```
14
-
15
- ## Step-by-Step (Vue/Vite Example)
16
-
17
- ```bash
18
- # 1. Build
19
- npm run build # outputs to dist/
20
-
21
- # 2. Create bucket in target region
22
- hcloud OBS mb obs://my-static-site -location=cn-north-4
23
-
24
- # 3. Upload entire build directory (recursive, force, flatten, public ACL)
25
- hcloud OBS cp dist/ obs://my-static-site/ -r -f -flat -acl=public-read
26
-
27
- # 4. Set bucket ACL (required for static website access)
28
- hcloud OBS chattri obs://my-static-site -acl=public-read
29
-
30
- # 5. Set object ACLs recursively (objects don't inherit bucket ACL automatically)
31
- hcloud OBS chattri obs://my-static-site/ -r -f -acl=public-read
32
-
33
- # 5. Configure static website hosting
34
- # KooCLI OBS does NOT support this. Use one of:
35
- # Option A — REST API:
36
- # PUT /?website HTTP/1.1
37
- # Host: my-static-site.obs.cn-north-4.myhuaweicloud.com
38
- # Body: {"IndexDocument": {"Suffix": "index.html"}, "ErrorDocument": {"Key": "error.html"}}
39
- # (requires AK/SK signature)
40
- # Option B — Huawei Cloud Console:
41
- # Console → OBS → Bucket → Basic Settings → Static Website Hosting
42
-
43
- # 6. Verify
44
- curl http://my-static-site.obs-website.cn-north-4.myhuaweicloud.com
45
- ```
46
-
47
- ## Key Gotchas
48
-
49
- - **Build output dir varies**: `dist/` (Vite), `build/` (CRA), `out/` (Next.js). Check `package.json` scripts.
50
- - **Bucket name must be DNS-compliant**: lowercase, numbers, hyphens only. No underscores or uppercase.
51
- - **Region matters**: Website endpoint depends on bucket region. `obs-website.<region>.myhuaweicloud.com`.
52
- - **Index.html routing**: For SPA apps (Vue Router, React Router), set `ErrorDocument` to `index.html` as well.
53
- - **Cache invalidation**: New uploads don't clear CDN cache. Add `?v=<timestamp>` to asset references or use OBS versioning.
54
- - **Always use `-f`**: Without `-f`, obsutil prompts "Please input (y/n)" on large uploads — Agent hangs (TIMEOUT).
55
- - **Use `-flat` for root files**: Without `-flat`, `dist/` becomes `bucket/dist/` prefix. Static sites need files at bucket root.
56
- - **Objects don't inherit bucket ACL**: Setting bucket to public-read does NOT make individual objects public. You must also set object-level ACL with `chattri obs://<bucket>/ -r -f -acl=public-read` or use `-acl=public-read` during upload.
1
+ # OBS Static Website Deployment
2
+
3
+ ## Workflow
4
+
5
+ ```
6
+ 1. Build project → npm run build / yarn build
7
+ 2. Create OBS bucket → hcloud OBS mb obs://<bucket> -location=<region>
8
+ 3. Bulk upload → hcloud OBS cp <build-dir>/ obs://<bucket>/ -r -f -flat -acl=public-read
9
+ 4. Set bucket ACL → hcloud OBS chattri obs://<bucket> -acl=public-read
10
+ 5. Set object ACLs → hcloud OBS chattri obs://<bucket>/ -r -f -acl=public-read
11
+ 6. Configure website → REST API (KooCLI OBS lacks this feature)
12
+ 7. Verify → curl http://<bucket>.obs-website.<region>.myhuaweicloud.com
13
+ ```
14
+
15
+ ## Step-by-Step (Vue/Vite Example)
16
+
17
+ ```bash
18
+ # 1. Build
19
+ npm run build # outputs to dist/
20
+
21
+ # 2. Create bucket in target region
22
+ hcloud OBS mb obs://my-static-site -location=cn-north-4
23
+
24
+ # 3. Upload entire build directory (recursive, force, flatten, public ACL)
25
+ hcloud OBS cp dist/ obs://my-static-site/ -r -f -flat -acl=public-read
26
+
27
+ # 4. Set bucket ACL (required for static website access)
28
+ hcloud OBS chattri obs://my-static-site -acl=public-read
29
+
30
+ # 5. Set object ACLs recursively (objects don't inherit bucket ACL automatically)
31
+ hcloud OBS chattri obs://my-static-site/ -r -f -acl=public-read
32
+
33
+ # 5. Configure static website hosting
34
+ # KooCLI OBS does NOT support this. Use one of:
35
+ # Option A — REST API:
36
+ # PUT /?website HTTP/1.1
37
+ # Host: my-static-site.obs.cn-north-4.myhuaweicloud.com
38
+ # Body: {"IndexDocument": {"Suffix": "index.html"}, "ErrorDocument": {"Key": "error.html"}}
39
+ # (requires AK/SK signature)
40
+ # Option B — Huawei Cloud Console:
41
+ # Console → OBS → Bucket → Basic Settings → Static Website Hosting
42
+
43
+ # 6. Verify
44
+ curl http://my-static-site.obs-website.cn-north-4.myhuaweicloud.com
45
+ ```
46
+
47
+ ## Key Gotchas
48
+
49
+ - **Build output dir varies**: `dist/` (Vite), `build/` (CRA), `out/` (Next.js). Check `package.json` scripts.
50
+ - **Bucket name must be DNS-compliant**: lowercase, numbers, hyphens only. No underscores or uppercase.
51
+ - **Region matters**: Website endpoint depends on bucket region. `obs-website.<region>.myhuaweicloud.com`.
52
+ - **Index.html routing**: For SPA apps (Vue Router, React Router), set `ErrorDocument` to `index.html` as well.
53
+ - **Cache invalidation**: New uploads don't clear CDN cache. Add `?v=<timestamp>` to asset references or use OBS versioning.
54
+ - **Always use `-f`**: Without `-f`, obsutil prompts "Please input (y/n)" on large uploads — Agent hangs (TIMEOUT).
55
+ - **Use `-flat` for root files**: Without `-flat`, `dist/` becomes `bucket/dist/` prefix. Static sites need files at bucket root.
56
+ - **Objects don't inherit bucket ACL**: Setting bucket to public-read does NOT make individual objects public. You must also set object-level ACL with `chattri obs://<bucket>/ -r -f -acl=public-read` or use `-acl=public-read` during upload.