skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
huaweicloud/huaweicloud-skills1.8k installs

huawei-cloud-devbridge-tunnel

Create and manage DevBridge development tunnels on Huawei Cloud to securely expose local development services to remote devices. Based on DevBridge CLI v0.2.x and API Key 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 API Keys. Triggers include: user mentions "DevBridge", "开发隧道", "开发者隧道", "dev tunnel", "tunnel", "host local service", "expose local port", "connect tunnel", "托管本地服务", "隧道端口", "devbridge", "DevSpace", "开发空间隧道"

How do I install this agent skill?

npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-devbridge-tunnel
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubfail

    This skill provides tools to manage Huawei Cloud DevBridge tunnels, including an automated installer for the official CLI. However, it uses unsafe command execution patterns in its script adaptation layer that could be exploited via malicious user input.

  • Socketwarn

    3 alerts: gptSecurity, gptAnomaly

  • Snykpass

    Risk: LOW · No issues

What does this agent skill do?

Huawei Cloud DevBridge Development Tunnel

Create and manage DevBridge development tunnels to securely expose local development services to remote devices via Huawei Cloud relay infrastructure.

Overview

DevBridge is a development tunnel service that allows developers to expose local services (web servers, APIs, debug endpoints) to remote devices without opening public inbound ports. The CLI tool (devbridge) manages tunnels, ports, host connections, and connect sessions. Host and Connect both initiate outbound connections to the relay service, so the hosting device does not need a public inbound port.

Architecture

  • Host device: a local service (for example localhost:8080) plus devbridge host for the tunnel.
  • Relay service (Huawei Cloud): holds the tunnel (id), port, credentials and access policy; the public address is https://<tunnelId>.<clusterId>.myhuaweicloud.com.
  • Connect device: devbridge connect maps the tunnel to a local address such as localhost:8080.
  • Host and Connect both open outbound connections to the relay, so no inbound port is opened on the hosting device.

2026-09-20 域名升级通知:DevBridge 隧道域名已切换,原 *.cn-north-4-bridge.myhuaweicloud.com 变更为新集群域名(如 *.devbridge-s2.hwtunnel.com)。旧版端侧(v0.1.x)已无法连接,必须使用 v0.2.x 并重新创建隧道。以 devbridge host 实际输出的 Tunnel URL 为准。

Use Cases

  • Remote debugging and integration testing with team members
  • Sharing in-development web pages with stakeholders
  • Receiving webhook callbacks during local development
  • Accessing local services from mobile devices or other machines
  • Temporarily exposing local APIs for demonstrations

Typical User Expressions

  • "Help me expose my local port 8080 to a remote device"
  • "Create a development tunnel for my frontend dev server"
  • "I need to share my local API with the team for testing"
  • "Connect to a tunnel from another machine"
  • "帮我把本地 8080 端口暴露给远程设备"

Version Support

ItemRequirement
CLI versionv0.2.x (installed from official channel, e.g. 0.2.1-release / 0.2.2-release)
AuthenticationAPI Key (devbridge auth login --api-key or env HW_API_KEY) or interactive login
Tunnel domainNew cluster domain (devbridge-s2.hwtunnel.com etc.), shown in devbridge host output
Old versionsv0.1.x is NOT supported — AK/SK auth flags removed, old domain no longer connects

Dynamic Command Adaptation Layer

CRITICAL — All tunnel/port/host operations MUST go through db_* wrapper functions (defined in scripts/devbridge_cmd.sh), NOT direct devbridge commands. Only devbridge auth and devbridge version are exempt.

The DevBridge CLI may change flags between releases. The adaptation layer dynamically discovers supported flags via devbridge <command> --help before executing, making the skill version-agnostic within v0.2.x. 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 run devbridge <command> --help.

Adaptation Layer Functions

FunctionReplacesPurpose
db_init—Ensure CLI installed (v0.2.x+), authenticated (auto-login via DEVBRIDGE_API_KEY/HW_API_KEY)
db_createdevbridge createCreate tunnel, returns just the tunnel ID (stdout)
db_port_createdevbridge port createCreate port (adapts port, protocol, anonymous flags)
db_hostdevbridge hostStart hosting in background, returns PID (stdout), tunnel URL (stderr)
db_host_bgdevbridge host in a background shell jobBackground host (legacy alias, use db_host instead)
db_connectdevbridge connectStart connect in background, returns PID (stdout)
db_listdevbridge listList tunnels
db_showdevbridge showShow tunnel details
db_updatedevbridge updateUpdate tunnel
db_deletedevbridge deleteDelete tunnel
db_delete_alldevbridge delete-allDelete all tunnels
db_port_listdevbridge port listList ports
db_port_deletedevbridge port deleteDelete port (adapts port flag)
db_limitsdevbridge limitsShow quota / usage / balance
db_echodevbridge echoStart diagnostic echo service
db_pingdevbridge pingPing a URI to test connectivity
db_versiondevbridge versionShow CLI version
db_auth_statusdevbridge auth statusCheck auth status
db_auth_logindevbridge auth loginLogin (interactive or --api-key)
db_tunnel_url—Get tunnel public URL from host log (authoritative, do not construct manually)
db_processes—List running host/connect processes
db_process_stop—Stop a host/connect process by PID
db_process_logs—Get process logs by PID

Prerequisites

Prerequisite checks need consent before changing the machine or the account. Read-only checks (devbridge version, devbridge auth status, db_list) run silently. Before db_init (1) installs the CLI, (2) upgrades a v0.1.x client, or (3) performs a login, tell the user what will change and get an explicit "yes". Credentials supplied out-of-band via DEVBRIDGE_API_KEY / HW_API_KEY count as consent for the login step. For approved automation only, set DEVBRIDGE_AUTO_SETUP=1 (or DEVBRIDGE_YES=1) to skip the interactive prompt; never enable it by default.

source <skill_directory>/scripts/devbridge_cmd.sh
db_init

v0.2.x 只支持 API Key:--access-key / --secret-key / --security-token(AK/SK)参数已移除,不要用 AK/SK 尝试登录(旧版 skill 的用法在 v0.2.x 无效)。API Key 在 DevBridge 管理页创建:https://devstation.connect.huaweicloud.com/space/devbridge/apikey。

For automation environments, use an API Key (see references/iam-policies.md). API Keys are created at the DevBridge management page: https://devstation.connect.huaweicloud.com/space/devbridge/apikey.

Install script note: in non-interactive / headless environments, always pass -s (silent) to the install script: ... | bash -s -- -s. Without it, the script may prompt "overwrite?" reading /dev/tty and fail where no terminal exists.

GitCode 私有仓库安装:npx skills add 不支持 GitCode 私有仓库认证。不要把访问令牌拼接进 clone URL(会留在 shell 历史、进程参数与日志中)。先配置系统凭证助手(如 git-credential-manager / osxkeychain / libsecret)并交互式输入凭据,再正常 clone 并复制:

git config --global credential.helper manager   # 或 osxkeychain / libsecret
git clone https://gitcode.com/<org>/<repo>.git /tmp/repo   # 由凭证助手弹出认证,URL 不含密钥
cp -r /tmp/repo/skills/devtools/devbridge/huawei-cloud-devbridge-tunnel/ "${SKILL_INSTALL_DIR:-$HOME/.agents}/skills/huawei-cloud-devbridge-tunnel/"

Permission / Auth Failure Handling

When any DevBridge command fails due to invalid or missing credentials:

  1. Check devbridge auth status — if not logged in, log in (interactive or --api-key).
  2. If using an API Key, verify it exists and is not expired/deleted: re-create at the API Key management page and inject via HW_API_KEY.
  3. Read references/iam-policies.md for guidance.
  4. Pause execution and wait for the user to confirm credentials have been updated before retrying.

System Requirements

  • Bash and curl, or PowerShell 5.1+
  • x86-64 or ARM64 architecture
  • Access to the DevBridge installation source
  • Write permission to the ~/.huawei directory

Workflow

Creation exposes a service to the public network, so confirm before creating. Read-only steps (check CLI → load adaptation layer → check auth) may run silently. Before db_create / db_port_create / db_host, summarize the resolved parameters (tunnel name, port, protocol, expiration, anonymous access) and get an explicit "yes". Anonymous access (-a) stays denied by default and requires a separate explicit confirmation. If db_create reports that the name exists, present a yes/no choice (是否复用现有隧道?) before reusing it.

Default Parameters

ParameterDefault Value
Tunnel namedev-tunnel-<random> (e.g., dev-tunnel-3847)
Description开发隧道
Expiration72 (hours) — CLI default; range 1–720
Port8080
Protocolauto (options: http / https / auto)
Anonymous accessDenied (--deny-anonymous is the CLI default; use -a only when the user explicitly asks to allow anonymous access)

Security change: anonymous access defaults to deny. Unlike older skill versions, do NOT pass --anon allow by default. Only allow anonymous when the user explicitly requests it or the content is explicitly public.

Parameter Resolution

For each parameter, if the user explicitly specified a value, use it; otherwise use the default. Merge read-only values silently, but summarize the final set (tunnel name, port, protocol, expiration, anonymous access) and obtain confirmation before the first creating command.

  • Tunnel name: user mentions a name (e.g., "创建一个叫 my-api 的隧道" → my-api)
  • Port: user mentions a port number (e.g., "暴露 3000 端口" → 3000)
  • Description: user mentions a description (e.g., "描述是后端API" → 后端API)
  • Expiration: user mentions a time (e.g., "过期时间24小时" → 24); otherwise 72
  • Protocol: user mentions a protocol (e.g., "用https" → https); otherwise auto
  • Anonymous access: user says "允许匿名访问" or "公网直接访问" → -a; otherwise deny (default)

Quick Create Flow (when user says "创建隧道" without specifics)

source <skill_directory>/scripts/devbridge_cmd.sh
db_init
TUNNEL_NAME="dev-tunnel-$((RANDOM % 9000 + 1000))"
TUNNEL_ID=$(db_create "$TUNNEL_NAME" -d "开发隧道" -e 72)
db_port_create "$TUNNEL_ID" -p 8080 --protocol auto
db_host "$TUNNEL_ID"                  # 输出 PID 和 Tunnel URL 到 stdout
TUNNEL_URL=$(db_tunnel_url "$TUNNEL_ID")
echo "Tunnel ID: $TUNNEL_ID"
echo "Tunnel URL: $TUNNEL_URL"

注意:匿名访问默认禁止。 上述流程创建的隧道默认 --deny-anonymous,公网访问会返回 authentication required。如果需要公网直接访问(如暴露 Web 服务给外部用户),在 db_port_create 时加 -a:

db_port_create "$TUNNEL_ID" -p 8080 --protocol auto -a   # 允许匿名访问

Full Workflow (when user provides specific parameters)

Step 1: Install or Update DevBridge CLI

devbridge version
# 先向用户说明将安装/升级 CLI 并取得同意,再下载安装脚本到临时文件执行(避免管道直接执行)
curl -fsSL https://gitcode.com/CloudDeveloperDepartment/devbrige/releases/download/latest/install.sh -o /tmp/devbridge_install.sh
bash /tmp/devbridge_install.sh -s
devbridge version

Step 2: Load Adaptation Layer & Authenticate

export PATH="$HOME/.huawei/bin:$PATH"
source <skill_directory>/scripts/devbridge_cmd.sh
db_init                       # 只读检查自动执行;安装/升级/登录会先请求同意
devbridge auth status         # 已登录即可直接继续;未登录时按提示引导用户完成登录
devbridge auth login --api-key "$HW_API_KEY"   # 仅在取得同意、且密钥来自环境变量时使用

Step 3: Create a Tunnel

# <name> = user-specified or "dev-tunnel", <description> = user-specified or "开发隧道", <expiration> = user-specified or 72
# 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. If db_create fails with "This tunnel name is already in use", confirm with the user before reusing anything:

  1. Run db_list to find the existing tunnel.
  2. Check usage status silently: db_port_list <tunnelId> (ports configured?), ps aux | grep "devbridge host <tunnelId>" | grep -v grep (active host?), ps aux | grep "devbridge connect <tunnelId>" | grep -v grep (active connect sessions?).
  3. 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).
  4. 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.

Step 4: Configure Ports

# <port> = user-specified or 8080, <protocol> = user-specified or auto
# Anonymous access: default deny; use -a only if user explicitly asks
db_port_create <tunnelId> -p <port> --protocol <protocol>

端口更新后需重启 host: 如果 host 进程已在运行,使用 devbridge port update 修改端口配置(如切换匿名访问策略)后,正在运行的 host 进程不会自动感知变化。需要先停止旧 host 进程(db_process_stop <pid>),再重新 db_host <tunnelId> 才能使新配置生效。

Step 5: Host Local Service

python3 -m http.server <port> > /tmp/devbridge-service.log 2>&1 &   # 本地服务在后台运行,PID 由 $! 获取
db_host <tunnelId>                   # 后台托管,输出 PID 和 Tunnel URL 到 stdout
TUNNEL_URL=$(db_tunnel_url <tunnelId>)  # 获取权威公网 URL
echo "$TUNNEL_URL"

Alternative one-shot temporary tunnel: devbridge host -p 8080 -e 8 (creates a temp tunnel and hosts immediately).

⚠️ 中继域名随集群变化,严禁按文档拼接 URL。一律用 db_tunnel_url <id> 读取权威地址。

Step 6: Connect from Remote Device

db_connect <tunnelId>

Access the service via http://localhost:8080 on the remote device.

Step 7: Cleanup

db_processes                    # List running processes
db_process_stop <pid>           # Stop host/connect process
db_delete <tunnelId>            # Delete tunnel (prompts for confirmation; --yes for approved automation)

Core Commands

NOTE: All commands show the db_* wrapper form. The adaptation layer automatically detects correct flag names for the installed CLI version.

Authentication

CommandDescription
devbridge auth loginInteractive login (opens browser).
devbridge auth login --api-key "$HW_API_KEY"Login with API Key read from an environment variable (never pass a literal key on the command line).
devbridge auth loginLogin using the API Key already exported in HW_API_KEY / DEVBRIDGE_API_KEY.
devbridge auth statusCheck current login status.
devbridge auth logoutClear local credentials.

Removed in v0.2.x: --access-key, --secret-key, --security-token (AK/SK) are no longer supported. Use API Key instead.

Tunnel Management

CommandDescription
db_create <name> -d <desc> -e <hours>Create a tunnel.
db_listList active tunnels in the current workspace.
db_show <tunnelId>Show tunnel details.
db_update <tunnelId> -n <name> -d <desc> -e <hours>Update tunnel name/description/expiration.
db_delete <tunnelId> [--yes]Delete a tunnel; confirms interactively unless --yes is passed by approved automation.
db_delete_all [--yes]Delete all tunnels in the current workspace; requires typing delete-all unless --yes is passed.
devbridge token <tunnelId> -s hostIssue a new Host token.
devbridge token <tunnelId> -s connectIssue a new Connect token.
devbridge set <tunnelId>Set the default tunnel for this machine.
devbridge unsetClear the default tunnel.
db_limitsShow account quota / usage / balance.

Port Management

CommandDescription
db_port_create <tunnelId> -p <port> --protocol <protocol>Create a port (anonymous access denied by default; add -a to allow).
db_port_list <tunnelId>List tunnel ports.
devbridge port show <tunnelId> -p <port>Show port details.
devbridge port update <tunnelId> -p <port> -aUpdate port anonymous access policy (allow).
devbridge port update <tunnelId> -p <port> --deny-anonymousUpdate port anonymous access policy (deny).
db_port_delete <tunnelId> -p <port> [--yes]Delete a port; confirms interactively unless --yes is passed.

Host and Connect

CommandDescription
db_host <tunnelId>Host all configured ports of an existing tunnel.
devbridge host -p 8080 -e 8Create a temporary tunnel and host immediately.
devbridge host <tunnelId> --api-key "$HW_API_KEY"Host using an API Key taken from an environment variable.
devbridge host <tunnelId> --token "$DEVBRIDGE_TOKEN"Host using a JWT taken from an environment variable.
db_connect <tunnelId>Connect to a tunnel and establish local port mapping.
devbridge connect <tunnelId> --api-key "$HW_API_KEY"Connect using an API Key taken from an environment variable.

Diagnostics

CommandDescription
db_echoStart an HTTP echo service on a local port (default random, 127.0.0.1) to verify tunnel links.
db_ping <uri>Send HTTP ping to a URI, print status code and latency. 默认 3 秒限时(devbridge ping 是持续命令,避免脚本挂起);DB_PING_SECONDS=0 时直通持续观测。
devbridge -v <command>Enable debug logging for any command.

Parameter Confirmation

Confirm the resolved values (tunnel name, port, protocol, expiration, anonymous access) before the first creating command. Destructive commands (db_delete, db_delete_all, db_port_delete) always prompt for confirmation; --yes is accepted only for approved automation.

ParameterCLI FlagDefaultRange / ConstraintDescription
<name>db_createdev-tunnel-<random>Max 128 charsTunnel name.
-ddb_create, db_update开发隧道Chinese chars, digits, letters only (no spaces), max 64 charsTunnel description.
-edb_create, db_update, host72 (hours)1–720 hoursExpiration time.
-ndb_updateNone—New tunnel name.
-stokenRequiredhost or connectToken scope.
-pdb_port_create, db_port_delete80801–65535Port number (--port-number in CLI).
--protocoldb_port_createautohttp, https, autoProtocol.
-a / --allow-anonymousdb_port_createNot set (deny)—Allow anonymous access.
--deny-anonymousdb_port_createdefault—Deny anonymous access (CLI default).
-k / --api-keyhost, connectNone—API Key auth, skip token issuance.
-t / --tokenhost, connectNone—JWT token auth.
-v / --verboseglobalfalse—Enable debug logging.

Destructive operations (db_delete, db_delete_all, db_port_delete) always require explicit confirmation: list the affected tunnel/port first, then wait for the user to type yes (or pass --yes only in approved automation via DEVBRIDGE_YES=1). db_delete_all additionally requires typing the phrase delete-all.

Credential handling: pass secrets through environment variables (HW_API_KEY, DEVBRIDGE_API_KEY, DEVBRIDGE_TOKEN). Command-line flags are visible in process argv and shell history, so avoid literal keys/tokens in --api-key / --token.

Output Format

Tunnel Creation Output (db_create)

Returns just the tunnel ID on stdout (extracted from CLI text output):

noh56s7x

Host Output (db_host)

Returns PID and tunnel URL on stdout (labeled format, one per line):

PID: 3519475
Tunnel URL: https://noh56s7x-8080.devbridge-s2.hwtunnel.com

Parse with grep: PID=$(db_host <id> | grep -oP 'PID: \K\d+')

Use db_tunnel_url <tunnelId> to get the authoritative URL (do not construct manually — domain may change across clusters).

Port Creation Output

Port added: TunnelId=noh56s7x, Port=8080

Token Output

Tunnel ID:     noh56s7x
Scope:         host
Lifetime:      24:00:00
Expires At:    2026-08-09 06:57:10 UTC
Token:         <token-value>

List Output

Tunnel ID  Name             Description  Tunnel Expiration  Port Count
dwskt2pg   dev-tunnel-5941  开发隧道     3 days             1

Note: v0.2.x removed the --json output flag from list and port list. Use the text table output; parse with awk/grep if needed.

Verification

For detailed verification steps, see references/verification-method.md.

Quick verification:

db_init                  # CLI installed + authenticated
db_version               # v0.2.x+
db_auth_status           # Logged in
db_list                  # Tunnels listed
db_port_list <tunnelId>  # Ports listed
db_processes             # Host process running
db_tunnel_url <tunnelId> # Public URL accessible

Best Practices

  1. Check auth read-only, then ask before login — devbridge auth status is safe to run silently; guide the user through login only when needed. API Key via HW_API_KEY is recommended for automation.
  2. Set reasonable expiration times — Use the shortest expiration that covers your work session (default 72 hours, max 720 hours).
  3. Deny anonymous access by default — Only allow (-a) when the user explicitly requests it or content is explicitly public.
  4. Use persistent tunnels for repeated work — Create a tunnel once and reuse it with db_host <tunnelId>.
  5. Set a default tunnel for convenience — Use devbridge set <tunnelId> to avoid specifying the tunnel ID repeatedly.
  6. Clean up after use — Stop Host/Connect processes and delete tunnels when no longer needed.
  7. Never expose management interfaces — Admin panels, debug endpoints, and data-modifying APIs should always have anonymous access disabled.
  8. Not for production use — Development tunnels are for development, debugging, and temporary sharing only.
  9. Keep CLI upgraded to v0.2.x — The 2026-09-20 domain switch invalidated old clients; older versions can no longer connect.

Reference Documents

Notes

Security

  • Never hardcode an API Key in scripts, logs, or config files. Read it from HW_API_KEY / DEVBRIDGE_API_KEY at runtime; avoid literal --api-key values because argv is visible to other local processes.
  • Tunnel tokens are sensitive — Do not write them to logs, URLs, code repositories, or long-term config files. Pass them via DEVBRIDGE_TOKEN when a JWT is required.
  • Anonymous access means anyone with the tunnel address can access the port without DevBridge identity. It stays denied by default; enabling -a requires an explicit, separate confirmation and is only for intentionally public content.
  • delete-all is destructive — It removes every tunnel in the current workspace. List tunnels with db_list first, then require the user to type delete-all (or pass --yes only in approved automation). 共享/复用工作区时尤其要避免连带删除他人隧道。

Limitations

  • Maximum 10 active tunnels per workspace (default quota).
  • Tunnel expiration: 1-720 hours (default 72 hours).
  • Port range: 1-65535, ports cannot be duplicated within the same tunnel.
  • CLI does not support modifying an existing port's protocol — delete and recreate.
  • Port commands do not support the -d (description) parameter.
  • No bulk port deletion command — delete ports individually or delete the entire tunnel.
  • Host and Connect are managed background processes — use db_process_stop <pid> to stop.
  • list / port list no longer support --json output in v0.2.x.

Compatibility

  • DevBridge CLI v0.2.x supports x86-64 and ARM64 architectures.
  • Linux/macOS requires Bash and curl; Windows requires PowerShell 5.1+.
  • CLI installs to ~/.huawei/bin; configuration and state are stored in ~/.huawei/devbridge.
  • Never commit ~/.huawei/devbridge to version control or share between users.
  • Dynamic command adaptation — The scripts/devbridge_cmd.sh adaptation layer makes this skill compatible with any DevBridge CLI v0.2.x version by dynamically discovering supported flags via --help. No version pinning required.

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/huaweicloud/huaweicloud-skills/huawei-cloud-devbridge-tunnel">View huawei-cloud-devbridge-tunnel on skillZs</a>