huaweicloud-devkit 0.1.21 → 0.1.24

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 (67) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +169 -169
  4. package/bin/setup.cjs +7 -7
  5. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  6. package/integrations/opencode/opencode.json +14 -14
  7. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +30 -30
  8. package/package.json +43 -43
  9. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
  10. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
  11. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
  12. package/plugins/huaweicloud-core/.mcp.json +13 -13
  13. package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
  14. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +88 -88
  15. package/plugins/huaweicloud-core/safety/policy.json +85 -85
  16. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +144 -144
  17. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
  18. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
  19. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -101
  20. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +73 -73
  21. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +1 -1
  22. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
  23. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
  24. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
  25. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
  26. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
  27. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +131 -131
  28. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +98 -96
  29. package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
  30. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +28 -28
  31. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  32. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -132
  33. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
  34. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -71
  35. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
  36. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
  37. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
  38. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -65
  39. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
  40. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
  41. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +118 -118
  42. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -26
  43. package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
  44. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +181 -181
  45. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
  46. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +78 -78
  47. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +76 -76
  48. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -59
  49. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
  50. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
  51. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +47 -47
  52. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
  53. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +127 -127
  54. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
  55. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +93 -93
  56. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
  57. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +19 -19
  58. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
  59. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +46 -46
  60. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
  61. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
  62. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
  63. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
  64. package/plugins/huaweicloud-core/src/mcp-server.mjs +93 -93
  65. package/plugins/huaweicloud-core/src/safety-policy.mjs +289 -289
  66. package/plugins/huaweicloud-core/src/setup-cli.mjs +874 -869
  67. package/plugins/huaweicloud-core/src/tools.mjs +677 -677
@@ -1,118 +1,118 @@
1
- ---
2
- name: huawei-obs
3
- description: "Use when creating, configuring, or managing OBS buckets and objects on Huawei Cloud. Covers bucket creation, lifecycle policies, versioning, static website hosting, CORS, access control (IAM/bucket policy/ACL), cross-region replication, event notifications, and presigned URLs. Triggers on: OBS, bucket, object storage, lifecycle, versioning, static website, CORS, presigned, replication. NOT for: EVS block storage (use huawei-ecs), SFS file storage, CBR backup (use huawei-cbr)."
4
- version: 1
5
- ---
6
-
7
- # Huawei Cloud OBS
8
-
9
- **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
-
11
- ## Critical: OBS Command Syntax
12
-
13
- KooCLI OBS uses **obsutil-style** commands, NOT API-style operations. Always run `hcloud OBS help` (no `--`) before constructing commands:
14
-
15
- ```bash
16
- hcloud OBS help # NOT --help
17
- hcloud OBS help <command> # e.g. hcloud OBS help mb
18
- ```
19
-
20
- | Wrong (API-style) | Correct (obsutil-style) |
21
- |-------------------|-------------------------|
22
- | `OBS CreateBucket` | `OBS mb obs://<bucket>` |
23
- | `OBS PutObject` | `OBS cp <file> obs://<bucket>/` |
24
- | `OBS DeleteBucket` | `OBS rm obs://<bucket> -r` |
25
-
26
- ## Overview
27
-
28
- Domain expertise for Huawei Cloud Object Storage Service (OBS). Covers bucket/object lifecycle, access control, static website hosting, and presigned URLs.
29
-
30
- ## Critical Warnings
31
-
32
- | Trap | Why |
33
- |------|-----|
34
- | Bucket name is global | All users share bucket namespace |
35
- | Three-layer permissions | IAM > Bucket Policy > ACL. Most restrictive wins |
36
- | Versioning is irreversible | Once enabled, cannot be disabled, only suspended |
37
- | OBS uses AK/SK directly | NOT IAM tokens. Auth errors mean check AK/SK validity |
38
- | Static website via CLI missing | KooCLI OBS lacks website config. Use REST API or console |
39
- | **OBS needs separate cred config** | `hcloud configure` is NOT enough for OBS. Run `hcloud OBS config -i` (interactive) to create `~/.obsutilconfig`. This must be done OUTSIDE agent chat. |
40
- | **obsutil interactive prompts** | `cp`/`rm` without `-f` causes "Please input (y/n)" → Agent hangs (TIMEOUT). Always use `-f` for non-interactive. |
41
- | **Directory upload adds prefix** | `cp <dir>/ obs://<bucket>/ -r` puts files under `bucket/<dir>/...`. Use `-flat` for root-level files (static sites). Preview with `-dryRun` first. |
42
-
43
- ## OBS Credential Setup (Required Before First Use)
44
-
45
- KooCLI OBS uses a separate config file (`~/.obsutilconfig`), NOT `~/.hcloud/config.json`. Use the **same AK/SK** that you configured for hcloud. Run once outside agent chat:
46
-
47
- ```bash
48
- # Preferred: interactive (safe, no AK/SK in shell history)
49
- hcloud OBS config -i
50
- # Follow prompts: AK, SK, endpoint (e.g. obs.cn-north-4.myhuaweicloud.com)
51
-
52
- # Alternative: non-interactive (use with caution — AK/SK in shell history)
53
- hcloud OBS config -e=<endpoint> -i=<AK> -k=<SK>
54
- ```
55
-
56
- ## Common Workflows
57
-
58
- | Task | Command |
59
- |------|---------|
60
- | Create bucket | `hcloud OBS mb obs://<bucket> -location=<region>` |
61
- | List buckets/objects | `hcloud OBS ls [obs://<bucket>]` |
62
- | Upload file | `hcloud OBS cp <file> obs://<bucket>/<key>` |
63
- | Upload directory (recursive) | `hcloud OBS cp <dir>/ obs://<bucket>/ -r -f -flat` |
64
- | Download object | `hcloud OBS cp obs://<bucket>/<key> <local-path>` |
65
- | Set bucket ACL | `hcloud OBS chattri obs://<bucket> -acl=public-read` |
66
- | Set object ACL | `hcloud OBS chattri obs://<bucket>/<key> -acl=public-read` | Bucket ACL does NOT cascade — anonymous reads need both |
67
- | Set lifecycle | `hcloud OBS lifecycle obs://<bucket> -method=put -localfile=<json>` |
68
- | Set bucket policy | `hcloud OBS bucketpolicy obs://<bucket> -method=put -localfile=<json>` |
69
- | Set CORS | `hcloud OBS cors obs://<bucket> -method=put -localfile=<json>` |
70
- | Delete bucket | `hcloud OBS rm obs://<bucket> -r` (must be empty) |
71
- | Presigned URL | `hcloud OBS sign obs://<bucket>/<key> -e=<seconds>` |
72
- | Object metadata | `hcloud OBS stat obs://<bucket>/<key>` |
73
-
74
- ## Static Website Deployment Workflow
75
-
76
- See `references/static-website.md` for the full end-to-end workflow:
77
- Build → Create bucket → Upload → Set bucket ACL → Set object ACL → Configure website (REST API/console)
78
-
79
- > KooCLI OBS does NOT support `SetBucketWebsite`. Configure static website hosting via REST API (`PUT /?website`) or the Huawei Cloud console.
80
-
81
- ## Storage Classes
82
-
83
- | Class | Use Case | Min Storage | Retrieval Fee |
84
- |-------|----------|-------------|---------------|
85
- | STANDARD | Frequently accessed | None | No |
86
- | STANDARD_IA | Infrequent access | 30 days | Yes |
87
- | ARCHIVE | Long-term archive | 90 days | Yes (hours) |
88
-
89
- ## Troubleshooting
90
-
91
- | Error | Root Cause -> Fix |
92
- |-------|------------------|
93
- | AccessDenied on bucket | IAM/bucket policy/ACL conflict -> Check all three layers |
94
- | BucketAlreadyExists | Name taken globally -> Choose different name |
95
- | NoSuchKey | Object doesn't exist or wrong region -> Verify key and region |
96
- | InvalidAccessKeyId | OBS uses AK/SK directly -> Verify AK/SK validity, OBS endpoint, OBS permissions |
97
- | EntityTooLarge | Single PUT limit 5GB -> Use multipart upload |
98
- | OBS --help fails | KooCLI OBS uses `help` not `--help` -> Run `hcloud OBS help` |
99
-
100
- ## Security Considerations
101
-
102
- - MUST block public access by default
103
- - MUST use HTTPS-only for buckets
104
- - SHOULD enable access logging for audit
105
- - SHOULD rotate presigned URL expiry (max 7 days)
106
- - MUST NOT store AK/SK in bucket policies
107
-
108
- ## Cross-Skill References
109
-
110
- - **EIP**: See `huawei-vpc` for public network access
111
- - **DEW**: See `huawei-dew` for secret management
112
-
113
- ## References
114
-
115
- - OBS Docs: https://support.huaweicloud.com/obs/
116
- - Static website: references/static-website.md
117
- - Lifecycle: references/bucket-lifecycle.md
118
- - Replication: references/replication.md
1
+ ---
2
+ name: huawei-obs
3
+ description: "Use when creating, configuring, or managing OBS buckets and objects on Huawei Cloud. Covers bucket creation, lifecycle policies, versioning, static website hosting, CORS, access control (IAM/bucket policy/ACL), cross-region replication, event notifications, and presigned URLs. Triggers on: OBS, bucket, object storage, lifecycle, versioning, static website, CORS, presigned, replication. NOT for: EVS block storage (use huawei-ecs), SFS file storage, CBR backup (use huawei-cbr)."
4
+ version: 1
5
+ ---
6
+
7
+ # Huawei Cloud OBS
8
+
9
+ **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
+
11
+ ## Critical: OBS Command Syntax
12
+
13
+ KooCLI OBS uses **obsutil-style** commands, NOT API-style operations. Always run `hcloud OBS help` (no `--`) before constructing commands:
14
+
15
+ ```bash
16
+ hcloud OBS help # NOT --help
17
+ hcloud OBS help <command> # e.g. hcloud OBS help mb
18
+ ```
19
+
20
+ | Wrong (API-style) | Correct (obsutil-style) |
21
+ |-------------------|-------------------------|
22
+ | `OBS CreateBucket` | `OBS mb obs://<bucket>` |
23
+ | `OBS PutObject` | `OBS cp <file> obs://<bucket>/` |
24
+ | `OBS DeleteBucket` | `OBS rm obs://<bucket> -r` |
25
+
26
+ ## Overview
27
+
28
+ Domain expertise for Huawei Cloud Object Storage Service (OBS). Covers bucket/object lifecycle, access control, static website hosting, and presigned URLs.
29
+
30
+ ## Critical Warnings
31
+
32
+ | Trap | Why |
33
+ |------|-----|
34
+ | Bucket name is global | All users share bucket namespace |
35
+ | Three-layer permissions | IAM > Bucket Policy > ACL. Most restrictive wins |
36
+ | Versioning is irreversible | Once enabled, cannot be disabled, only suspended |
37
+ | OBS uses AK/SK directly | NOT IAM tokens. Auth errors mean check AK/SK validity |
38
+ | Static website via CLI missing | KooCLI OBS lacks website config. Use REST API or console |
39
+ | **OBS needs separate cred config** | `hcloud configure` is NOT enough for OBS. Run `hcloud OBS config -i` (interactive) to create `~/.obsutilconfig`. This must be done OUTSIDE agent chat. |
40
+ | **obsutil interactive prompts** | `cp`/`rm` without `-f` causes "Please input (y/n)" → Agent hangs (TIMEOUT). Always use `-f` for non-interactive. |
41
+ | **Directory upload adds prefix** | `cp <dir>/ obs://<bucket>/ -r` puts files under `bucket/<dir>/...`. Use `-flat` for root-level files (static sites). Preview with `-dryRun` first. |
42
+
43
+ ## OBS Credential Setup (Required Before First Use)
44
+
45
+ KooCLI OBS uses a separate config file (`~/.obsutilconfig`), NOT `~/.hcloud/config.json`. Use the **same AK/SK** that you configured for hcloud. Run once outside agent chat:
46
+
47
+ ```bash
48
+ # Preferred: interactive (safe, no AK/SK in shell history)
49
+ hcloud OBS config -i
50
+ # Follow prompts: AK, SK, endpoint (e.g. obs.cn-north-4.myhuaweicloud.com)
51
+
52
+ # Alternative: non-interactive (use with caution — AK/SK in shell history)
53
+ hcloud OBS config -e=<endpoint> -i=<AK> -k=<SK>
54
+ ```
55
+
56
+ ## Common Workflows
57
+
58
+ | Task | Command |
59
+ |------|---------|
60
+ | Create bucket | `hcloud OBS mb obs://<bucket> -location=<region>` |
61
+ | List buckets/objects | `hcloud OBS ls [obs://<bucket>]` |
62
+ | Upload file | `hcloud OBS cp <file> obs://<bucket>/<key>` |
63
+ | Upload directory (recursive) | `hcloud OBS cp <dir>/ obs://<bucket>/ -r -f -flat` |
64
+ | Download object | `hcloud OBS cp obs://<bucket>/<key> <local-path>` |
65
+ | Set bucket ACL | `hcloud OBS chattri obs://<bucket> -acl=public-read` |
66
+ | Set object ACL | `hcloud OBS chattri obs://<bucket>/<key> -acl=public-read` | Bucket ACL does NOT cascade — anonymous reads need both |
67
+ | Set lifecycle | `hcloud OBS lifecycle obs://<bucket> -method=put -localfile=<json>` |
68
+ | Set bucket policy | `hcloud OBS bucketpolicy obs://<bucket> -method=put -localfile=<json>` |
69
+ | Set CORS | `hcloud OBS cors obs://<bucket> -method=put -localfile=<json>` |
70
+ | Delete bucket | `hcloud OBS rm obs://<bucket> -r` (must be empty) |
71
+ | Presigned URL | `hcloud OBS sign obs://<bucket>/<key> -e=<seconds>` |
72
+ | Object metadata | `hcloud OBS stat obs://<bucket>/<key>` |
73
+
74
+ ## Static Website Deployment Workflow
75
+
76
+ See `references/static-website.md` for the full end-to-end workflow:
77
+ Build → Create bucket → Upload → Set bucket ACL → Set object ACL → Configure website (REST API/console)
78
+
79
+ > KooCLI OBS does NOT support `SetBucketWebsite`. Configure static website hosting via REST API (`PUT /?website`) or the Huawei Cloud console.
80
+
81
+ ## Storage Classes
82
+
83
+ | Class | Use Case | Min Storage | Retrieval Fee |
84
+ |-------|----------|-------------|---------------|
85
+ | STANDARD | Frequently accessed | None | No |
86
+ | STANDARD_IA | Infrequent access | 30 days | Yes |
87
+ | ARCHIVE | Long-term archive | 90 days | Yes (hours) |
88
+
89
+ ## Troubleshooting
90
+
91
+ | Error | Root Cause -> Fix |
92
+ |-------|------------------|
93
+ | AccessDenied on bucket | IAM/bucket policy/ACL conflict -> Check all three layers |
94
+ | BucketAlreadyExists | Name taken globally -> Choose different name |
95
+ | NoSuchKey | Object doesn't exist or wrong region -> Verify key and region |
96
+ | InvalidAccessKeyId | OBS uses AK/SK directly -> Verify AK/SK validity, OBS endpoint, OBS permissions |
97
+ | EntityTooLarge | Single PUT limit 5GB -> Use multipart upload |
98
+ | OBS --help fails | KooCLI OBS uses `help` not `--help` -> Run `hcloud OBS help` |
99
+
100
+ ## Security Considerations
101
+
102
+ - MUST block public access by default
103
+ - MUST use HTTPS-only for buckets
104
+ - SHOULD enable access logging for audit
105
+ - SHOULD rotate presigned URL expiry (max 7 days)
106
+ - MUST NOT store AK/SK in bucket policies
107
+
108
+ ## Cross-Skill References
109
+
110
+ - **EIP**: See `huawei-vpc` for public network access
111
+ - **DEW**: See `huawei-dew` for secret management
112
+
113
+ ## References
114
+
115
+ - OBS Docs: https://support.huaweicloud.com/obs/
116
+ - Static website: references/static-website.md
117
+ - Lifecycle: references/bucket-lifecycle.md
118
+ - Replication: references/replication.md
@@ -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,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.