skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
mingdaocom/hap-skills124 installs

hap-cli-environments

当用户用 hap 命令行操作 HAP、且授权了多个环境或多个账号时,用本 skill 决定在“哪个环境/哪个账号”上执行。只要用户提到要换环境/换账号、说“在另一个环境里试”“用我另一个账号”“别动线上”“切到测试用的那个”,或一个操作具破坏性(删除应用/表/记录、发布、改权限)而当前环境/账号不明确时,都应触发,先确认再动手。不用于:只授权了一个环境、或纯粹查命令参数(那用 hap-cli)。

How do I install this agent skill?

npx skills add https://github.com/mingdaocom/hap-skills --skill hap-cli-environments
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    The skill provides guidelines and instructions for managing multiple environments and accounts using the `hap` CLI. It emphasizes security best practices, such as verifying the active account before execution and requiring user confirmation for destructive actions. No malicious patterns or security risks were identified.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

What does this agent skill do?

HAP 多环境 / 多账号操作守则

用户可能同时授权了多个 HAP 环境与账号,每个都已登录保存、各有一个名字(见 hap auth accounts)。 “在哪个环境、用哪个账号执行”和命令本身一样重要——选错可能在不该动的环境上造成不可逆后果。

每次操作前

  1. 先看现状:hap --json auth accounts,读出当前在用的是哪个(active),以及每个环境/账号的名字、登录地址、账号、组织。
  2. 把用户的措辞匹配到某个环境/账号:优先按用户说的名字;其次按登录地址/平台(Mingdao SaaS、Nocoly、用户给的私有部署域名)与账号匹配。匹配不唯一就走「停下来问」。
  3. 切换:整段会话用 hap auth use <名字>;只此一条命令用 hap --profile <名字> <命令>。

什么时候必须停下来问

  • 用户没指明用哪个环境/账号,且操作具破坏性(删除应用/工作表/字段/记录、发布、改角色权限、批量写入)。
  • 用户的话能匹配到多个环境/账号、或一个都匹配不上。

此时用问答卡片把候选环境/账号列给用户选,不要擅自挑一个执行,更不要默认用线上/正式的那个。

执行时

  • 每次跑命令前,在回显里点明「当前环境 / 账号 / 组织 / 登录地址」,让用户能一眼核对。
  • 破坏性命令再加一句确认当前不是误选的正式环境。

不该做

  • 不要替用户登录或登出(auth login / auth logout)——除非用户明确要求。
  • 不要把一个账号的 token 跨环境/账号复用——切换一律走 auth use / --profile,不手动搬运 token。

命令速查

hap auth accounts                 # 列出所有环境/账号,当前的带 *
hap --json auth accounts          # 同上,结构化输出供程序判断
hap auth use <名字>               # 切换当前使用的环境/账号
hap --profile <名字> <命令>       # 只让这一条命令临时用某个环境/账号
HAP_PROFILE=<名字> hap <命令>     # 整个终端会话默认用某个环境/账号
hap auth whoami                   # 确认当前用户 / 环境 / 组织

具体命令参数以 hap auth <子命令> --help 为准;要登录/登出或建应用、查数据等本身的操作,回到 hap-cli 及其指向的专门 skill。

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/mingdaocom/hap-skills/hap-cli-environments">View hap-cli-environments on skillZs</a>