跳到正文
Skillpedia
部署与云(DevOps)16k · #10896

interactive-login

它能做什么

让助手为开发者命令行工具启动登录,并将结果保存到系统钥匙串中。适合需要为工具完成登录的开发者。

适用场景

  • ✓当 AWS 或 GitHub 等命令行工具需要你先登录时。
  • ✓当你希望保存登录信息,以便之后的命令可以安全地使用时。
  • ✓当需要通过设备代码或浏览器登录来完成设置时。

技能链接

https://github.com/yc-software/qm/blob/main/skills-seed/interactive-login/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/yc-software/qm/blob/main/skills-seed/interactive-login/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我登录 AWS 命令行工具,以便你检查我的部署情况。”

每周 5 个新技能,1 分钟读完。

工作原理

助手会在一个全新的临时文件夹中启动该工具的登录,向你显示网址和需要输入的代码,并将结果保存到钥匙串中。你平时的主文件夹永远不会被使用。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Interactive login

Nothing captures logins for you. Every login runs in a fresh temporary home and is saved to the keychain with the script shipped with this skill. Never log in against the real $HOME, and never treat a token or config already in $HOME as a usable login: only a keychain handle is. Use the same explicit sandbox_id for the skill read, login, and save-login commands so the temporary home and save script stay on one computer.

  1. Make a fresh directory and start the login with execute(background:true) with every config location pointed into it. Copy in any config the CLI needs first (for AWS, the [profile …]/[sso-session …] blocks in .aws/config); everything under that directory becomes the saved login.

    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
    

    Use the CLI's device-code mode (AWS needs --use-device-code); a browser flow only completes on the same machine.

  2. Relay the verification URL and code from the job output. Answer any prompt with background action send_input. Use its watch or poll action with the returned process_id; never stop the job while the person is approving.

  3. When it exits successfully, save the directory with the script under the absolute directory the skill read reported:

    node <skill dir>/scripts/save-login.mjs aws "$d" --label "work (123456789012)"
    

    The script uploads only the files under that directory, removes the directory, and prints the credential handle. It also removes a directory that holds no usable login. Never remove the directory yourself; if the save fails, run the script again. Saving the same service again replaces that entry in place: its id, handle, owner and grants stay the same.

  4. Use the login only by naming the handle in credentials on execute (including background:true), including to check that it works. The files are staged in a private home for that command or job, and refreshes the CLI writes are saved back when it ends.

Never print token files or paste their contents into the conversation. If the login fails or expires, start again from step 1 with a new directory.

常见问题

助手会看到我的密码吗?

你在浏览器中使用工具显示的代码自行完成登录。助手只转达链接和代码。

为什么要使用临时文件夹?

这样新的登录与你平常的电脑设置分开,避免意外复用已有的令牌。

如果登录没有完成怎么办?

只有在登录完成后才会保存登录信息,因此如果中途停止,你可以重新尝试。

详情

作者的原始描述

Log a CLI in with a browser/device-code flow (aws sso, gh, glab, gcloud, …) and save the result to the keychain so later commands can request it through execute.credentials.

repo: yc-software/qm

热度

GitHub 星标
16k
排名
#10896
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能