Loading...
Loading...
Create and manage DevBridge development tunnels on Huawei Cloud to securely expose local development services to remote devices. Based on DevBridge CLI v0.1.12+ and Huawei Cloud IAM authentication. Use this skill when the user wants to: (1) install and configure the DevBridge CLI, (2) create/list/update/delete tunnels, (3) manage tunnel ports and protocols, (4) host local services through tunnels, (5) connect to remote tunnels from another device, (6) manage authentication and tokens. Trigger: user mentions "DevBridge", "开发隧道", "开发者隧道", "dev tunnel", "tunnel", "host local service", "expose local port", "connect tunnel", "托管本地服务", "隧道端口", "devbridge", "DevSpace", "开发空间隧道"
npx skill4agent add huaweicloud/huaweicloud-skills huawei-cloud-devbridge-tunneldevbridgeDeveloper Device (Host) Remote Device (Connect)
┌──────────────────────┐ ┌──────────────────────┐
│ Local Service :8080 │ │ localhost:8080 │
│ │ │ │ ▲ │
│ devbridge host │ │ devbridge connect │
│ │ │ │ │ │
└─────────┼────────────┘ └─────────┼────────────┘
│ Outbound connection │ Outbound connection
▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ DevBridge Relay Service (Huawei Cloud) │
│ │
│ Tunnel (id: aaaadysa) ── Port ── Token ── Access Policy │
│ Address: https://<tunnelId>-<port>.<region>-bridge.myhuaweicloud.com │
└─────────────────────────────────────────────────────────────────┘CRITICAL — All tunnel/port/host operations MUST go throughwrapper functions (defined indb_*), NOT directscripts/devbridge_cmd.shcommands. Onlydevbridgeanddevbridge authare exempt.devbridge versionThe DevBridge CLI auto-updates on every use, which may rename flags or change parameters. The adaptation layer dynamically discovers supported flags viabefore executing, making the skill version-agnostic. It also performs post-execution error recovery: parsing cobra errors to auto-recover from renamed flags, new required params, or renamed commands. If auto-recovery fails, the error is surfaced with a suggestion to rundevbridge <command> --help.devbridge <command> --help
| Function | Replaces | Purpose |
|---|---|---|
| — | Verify devbridge CLI is available |
| | Create tunnel (adapts |
| | Create port (adapts port, protocol, anonymous flags) |
| | Host local service |
| | Connect to tunnel |
| | List tunnels (adapts JSON flag) |
| | Show tunnel details |
| | Update tunnel |
| | Delete tunnel |
| | Delete all tunnels |
| | List ports |
| | Delete port (adapts port flag) |
| | Show CLI version |
| | Check auth status |
| | Login |
CRITICAL — Do NOT ask the user for confirmation during prerequisite checks. Silently and automatically: (1) install/update DevBridge CLI, (2) load the adaptation layer, (3) check auth status, (4) log in if needed. Only surface output if a check fails.
# 1. Install/update CLI to latest version
devbridge version
curl -fsSL https://res-hd.hc-cdn.cn/sharedata/hdspace/devbridge/install.sh | bash
devbridge version
# 2. Load adaptation layer
export PATH="$HOME/.huawei/bin:$PATH"
source <skill_directory>/scripts/devbridge_cmd.sh
db_init
# 3. Check auth, login if needed
devbridge auth status 2>/dev/null || devbridge auth logincurl~/.huaweiCRITICAL — Zero confirmation during tunnel creation. Execute the entire flow (check CLI → load adaptation layer → check auth → create tunnel → configure port → start hosting) fully automatically with ZERO user interaction. Do NOT ask the user to confirm parameters or pause between steps. Only surface output after everything is done. The ONLY exception is tunnel name conflict — iffails because the name exists, present a yes/no choice (是否复用现有隧道?) before proceeding.db_create
| Parameter | Default Value |
|---|---|
| Tunnel name | |
| Description | |
| Expiration | |
| Port | |
| Protocol | |
| Anonymous access | Allowed ( |
my-api3000后端API24https--anon deny--anon allow# One-shot: update CLI → load adaptation layer → check auth → create tunnel → add port → start hosting
curl -fsSL https://res-hd.hc-cdn.cn/sharedata/hdspace/devbridge/install.sh | bash 2>/dev/null; \
export PATH="$HOME/.huawei/bin:$PATH"; \
source <skill_directory>/scripts/devbridge_cmd.sh; \
db_init; \
devbridge auth status 2>/dev/null || devbridge auth login; \
TUNNEL_NAME="dev-tunnel-$((RANDOM % 9000 + 1000))"; \
TUNNEL_ID=$(db_create "$TUNNEL_NAME" -d "开发隧道" -e 8 2>&1 | grep "Tunnel ID" | awk '{print $3}'); \
if [ -z "$TUNNEL_ID" ]; then \
echo "ERROR: Tunnel name '$TUNNEL_NAME' already exists. Asking user for confirmation..."; \
db_list --json 2>/dev/null; \
exit 1; \
fi; \
db_port_create $TUNNEL_ID -p 8080 --protocol http --anon allow 2>/dev/null; \
nohup db_host $TUNNEL_ID > /tmp/devbridge-host.log 2>&1 & \
echo "Tunnel ID: $TUNNEL_ID"devbridge version
curl -fsSL https://res-hd.hc-cdn.cn/sharedata/hdspace/devbridge/install.sh | bash
devbridge versionexport PATH="$HOME/.huawei/bin:$PATH"
source <skill_directory>/scripts/devbridge_cmd.sh
db_init
devbridge auth status 2>/dev/null || devbridge auth login# <name> = user-specified or "dev-tunnel", <description> = user-specified or "开发隧道", <expiration> = user-specified or 8
# Note: description only allows Chinese characters, digits, and letters (no spaces), max 64 characters
db_create <name> -d "<description>" -e <expiration>Tunnel name conflict handling — the ONLY exception to zero confirmation. Iffails with "This tunnel name is already in use":db_create
- Run
to find the existing tunnel.db_list --json- Check usage status silently:
(ports configured?),db_port_list <tunnelId>(active host?),ps aux | grep "devbridge host <tunnelId>" | grep -v grep(active connect sessions?).ps aux | grep "devbridge connect <tunnelId>" | grep -v grep- Display tunnel details and usage status: active (host running/sessions active — reusing may conflict), idle (ports configured but no active process — safe to reuse), or empty (no ports — needs setup).
- Present yes/no choice: "隧道名称已存在,当前状态为 <active/idle/empty>,是否复用现有隧道?"
- yes — reuse existing tunnel, continue to Step 4 (skip Step 5 if already active).
- no — ask for a new tunnel name and retry.
# <port> = user-specified or 8080, <protocol> = user-specified or http
db_port_create <tunnelId> -p <port> --protocol <protocol> --anon allownohup python3 -m http.server <port> > /tmp/devbridge-service.log 2>&1 &
nohup db_host <tunnelId> > /tmp/devbridge-host.log 2>&1 &db_connect <tunnelId>http://localhost:8080# Stop Host/Connect processes with Ctrl+C
db_delete <tunnelId>NOTE: All commands show thewrapper form. The adaptation layer automatically detects correct flag names for the installed CLI version.db_*
| Command | Description |
|---|---|
| Interactive login. |
| Login with AK/SK. |
| Login with temporary AK/SK. |
| Check current login status. |
| Clear local credentials. |
| Command | Description |
|---|---|
| Create a tunnel. |
| List active tunnels in the current workspace. |
| List tunnels in JSON format. |
| Show tunnel details. |
| Update tunnel name/description/expiration. |
| Delete a tunnel. |
| Delete all tunnels in the current workspace. |
| Issue a new Host token. |
| Issue a new Connect token. |
| Set the default tunnel for this machine. |
| Clear the default tunnel. |
| Command | Description |
|---|---|
| `db_port_create <tunnelId> -p <port> --protocol <protocol> --anon <allow | deny>` |
| List tunnel ports. |
| Show port details. |
| Update port anonymous access policy. |
| Delete a port. |
| Command | Description |
|---|---|
| Host all configured ports of an existing tunnel. |
| Connect to a tunnel and establish local port mapping. |
| Parameter | CLI Flag | Default | Range / Constraint | Description |
|---|---|---|---|---|
| | | Max 128 chars | Tunnel name. |
| | | Chinese chars, digits, letters only (no spaces), max 64 chars | Tunnel description. |
| | | 1–720 hours | Expiration time. |
| | None | — | New tunnel name. |
| | false | — | Output in JSON format. |
| | Required | | Token scope. |
| | | 1–65535 | Port number. |
| | | | Protocol. |
| | | | Anonymous access. |
Destructive operations (,db_delete,db_delete_all) should be executed directly without asking for confirmation.db_port_delete
Tunnel ID: noh56s7x
Name: frontend-dev
Description: 前端开发环境
Tunnel Expiration: 8 hoursHosting port: 8080
Tunnel URL: https://noh56s7x-8080.cn-north-4-bridge.myhuaweicloud.com
Ready to accept connections
Auto reconnect: enabledPort added: TunnelId=noh56s7x, Port=8080Tunnel ID: noh56s7x
Scope: host
Lifetime: 24:00:00
Expires At: 2026-08-09 06:57:10 UTC
Token: <token-value>--json[
{
"name": "frontend-dev",
"tunnelId": "noh56s7x",
"tunnelExpiration": "8 hours",
"description": "前端开发环境",
"portCount": 2
}
]devbridge version # CLI installed
db_init # Adaptation layer loaded
devbridge auth status # Authenticated
db_list # Tunnel created
db_port_list <tunnelId> # Port configureddb_host <tunnelId>devbridge set <tunnelId>devbridge auth logindelete-all-dCtrl+Ccurl~/.huawei/bin~/.huawei/devbridge~/.huawei/devbridgescripts/devbridge_cmd.sh--help