interactive-login
通过浏览器/设备码流程让 CLI 登录(aws sso、gh、glab、gcloud 等),并把结果保存到密钥链,以便之后的命令通过 execute.credentials 请求使用。
- License 许可
- MIT
- 所属仓库
- irisfeng/moqi
- 最近更新
- 2026-11-05
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- interactive-login
- description
- 通过浏览器/设备码流程让 CLI 登录(aws sso、gh、glab、gcloud 等),并把结果保存到密钥链,以便之后的命令通过 execute.credentials 请求使用。
02 资源文件 1
- 脚本scripts/save-login.mjs2.1 KB
03 SKILL.md 正文
交互式登录
没有任何东西会替你捕获登录。每次登录都在全新的临时主目录中运行,并用本技能附带的脚本
保存到密钥链。绝不要对真实的
$HOME 执行登录,也绝不要把 $HOME 中已有的令牌或配置当作可用的登录:只有
密钥链句柄才算。技能读取、登录
和保存登录的命令都使用同一个明确的 sandbox_id,这样临时主目录和保存脚本都在同一台计算机上。
-
新建一个目录,用
execute(background:true)启动登录,并把每个配置 位置都指向该目录。先复制进 CLI 需要的任何配置(对 AWS 而言,是.aws/config中的[profile …]/[sso-session …]块);该 目录下的所有内容都会成为保存的登录。d=$(mktemp -d) && echo "$d" in_d() { env HOME="$d" XDG_CONFIG_HOME="$d/.config" XDG_DATA_HOME="$d/.local/share" XDG_STATE_HOME="$d/.local/state" XDG_CACHE_HOME="$d/.cache" "$@"; } in_d aws sso login --profile work --use-device-code --no-browser in_d gh auth login --hostname github.com --git-protocol https --web in_d glab auth login --hostname gitlab.com --web in_d gcloud auth login --no-launch-browser使用 CLI 的设备码模式(AWS 需要
--use-device-code);浏览器流程只有 在同一台机器上才能完成。 -
从任务输出中转交验证 URL 和验证码。用
background动作send_input回答任何提示。配合返回的process_id使用它的watch或poll动作;在对方还在批准期间,绝不要停止该任务。 -
任务成功退出后,使用技能读取时所报告的绝对目录下的脚本 保存该目录:
node <skill dir>/scripts/save-login.mjs aws "$d" --label "work (123456789012)"该脚本只上传该目录下的文件,删除该目录,并 打印凭据句柄。它也会删除不含可用登录的目录。 绝不要自己删除该目录;如果保存失败,再次运行该脚本。 再次保存同一个服务会就地替换该条目:它的 id、句柄、所有者和 授权都保持不变。
-
使用该登录的唯一方式,是在
execute(包括background:true)的credentials中写明句柄,包括用来检查它是否可用时。这些文件会暂存在该命令或任务专用的私有主目录中, CLI 写入的刷新内容会在其结束时保存回去。
绝不要打印令牌文件,也不要把其内容粘贴到会话中。如果登录失败 或过期,用新的目录从第 1 步重新开始。
04 同仓库更多 Skills
use-shared-credential
When you need to call a service the org has a SHARED credential for (a SERP/search key, a paid-API key, a data-vendor feed, a Git remote) — and the platform has told you that credential is available to this conversation — make the call BY PROXY through the credential broker. You never see the secret; the core stamps it onto the outbound request for you.
ui-state
See what the person is looking at in the QM web UI right now — the whole page (sidebar, every multiview pane, open dialogs) as raw HTML, the app's state as JSON, optionally the CSS and a screenshot. Use when they ask about something on their screen, want help with the UI, or you need to check what a canvas you wrote actually rendered.
ui-canvas
Draw your own HTML/CSS/JS as a full-window overlay on top of the QM web UI — a dashboard, a form, a visualization, controls that message you back. Write, update, replace, pin or dismiss it. Use when an interactive or visual result beats a chat reply.
taste-skill
Design taste and process for anything a person will look at in a browser — landing page, dashboard, prototype, deck. The default design driver for a browsable artifact, with an anti-slop playbook for the visual language.
slack-drafts
Create Slack message drafts in the user's own composer, as the user, through their per-user Slack OAuth. Drafting only — the user reviews and sends from Slack.
send
Make a PR, wait for CI with bounded transport retries, independently review, and merge only when all gates pass.