setup-browser-cookies
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
<!-- Regenerate: bun run gen:skill-docs -->
<!-- 自动生成自 SKILL.md.tmpl — 请勿直接编辑 -->
<!-- 重新生成:bun run gen:skill-docs -->
Preamble (run first)
前置步骤(请先运行)
bash
_UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
[ -n "$_UPD" ] && echo "$_UPD" || true
mkdir -p ~/.gstack/sessions
touch ~/.gstack/sessions/"$PPID"
_SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f 2>/dev/null | wc -l | tr -d ' ')
find ~/.gstack/sessions -mmin +120 -type f -delete 2>/dev/null || true
_CONTRIB=$(~/.claude/skills/gstack/bin/gstack-config get gstack_contributor 2>/dev/null || true)
_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
echo "BRANCH: $_BRANCH"If output shows : read and follow the "Inline upgrade flow" (auto-upgrade if configured, otherwise AskUserQuestion with 4 options, write snooze state if declined). If : tell user "Running gstack v{to} (just updated!)" and continue.
UPGRADE_AVAILABLE <old> <new>~/.claude/skills/gstack/gstack-upgrade/SKILL.mdJUST_UPGRADED <from> <to>bash
_UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
[ -n "$_UPD" ] && echo "$_UPD" || true
mkdir -p ~/.gstack/sessions
touch ~/.gstack/sessions/"$PPID"
_SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f 2>/dev/null | wc -l | tr -d ' ')
find ~/.gstack/sessions -mmin +120 -type f -delete 2>/dev/null || true
_CONTRIB=$(~/.claude/skills/gstack/bin/gstack-config get gstack_contributor 2>/dev/null || true)
_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
echo "BRANCH: $_BRANCH"如果输出显示:请阅读并遵循「在线升级流程」(若已配置则自动升级,否则通过AskUserQuestion提供4个选项,若用户拒绝则记录暂缓升级状态)。如果显示:告知用户「正在运行gstack v{新版本}(刚完成更新!)」并继续操作。
UPGRADE_AVAILABLE <旧版本> <新版本>~/.claude/skills/gstack/gstack-upgrade/SKILL.mdJUST_UPGRADED <旧版本> <新版本>AskUserQuestion Format
AskUserQuestion 格式
ALWAYS follow this structure for every AskUserQuestion call:
- Re-ground: State the project, the current branch (use the value printed by the preamble — NOT any branch from conversation history or gitStatus), and the current plan/task. (1-2 sentences)
_BRANCH - Simplify: Explain the problem in plain English a smart 16-year-old could follow. No raw function names, no internal jargon, no implementation details. Use concrete examples and analogies. Say what it DOES, not what it's called.
- Recommend:
RECOMMENDATION: Choose [X] because [one-line reason] - Options: Lettered options:
A) ... B) ... C) ...
Assume the user hasn't looked at this window in 20 minutes and doesn't have the code open. If you'd need to read the source to understand your own explanation, it's too complex.
Per-skill instructions may add additional formatting rules on top of this baseline.
每次调用AskUserQuestion时必须遵循以下结构:
- 重新说明背景: 说明项目、当前分支(使用前置步骤输出的值 — 不要使用对话历史或gitStatus中的分支)以及当前计划/任务。(1-2句话)
_BRANCH - 简化解释: 用16岁聪明人能理解的直白语言解释问题。不要使用原始函数名、内部行话或实现细节。使用具体示例和类比。说明功能是什么,而不是叫什么。
- 推荐选项:
RECOMMENDATION: 选择[X],因为[一句话理由] - 选项列表: 带字母的选项:
A) ... B) ... C) ...
假设用户已经20分钟没看这个窗口,且没有打开代码。如果您需要阅读源代码才能理解自己的解释,说明解释过于复杂。
针对特定技能的说明可能会在此基础格式上添加额外的格式规则。
Contributor Mode
贡献者模式
If is : you are in contributor mode. You're a gstack user who also helps make it better.
_CONTRIBtrueAt the end of each major workflow step (not after every single command), reflect on the gstack tooling you used. Rate your experience 0 to 10. If it wasn't a 10, think about why. If there is an obvious, actionable bug OR an insightful, interesting thing that could have been done better by gstack code or skill markdown — file a field report. Maybe our contributor will help make us better!
Calibration — this is the bar: For example, used to fail with because gstack didn't wrap expressions in async context. Small, but the input was reasonable and gstack should have handled it — that's the kind of thing worth filing. Things less consequential than this, ignore.
$B js "await fetch(...)"SyntaxError: await is only valid in async functionsNOT worth filing: user's app bugs, network errors to user's URL, auth failures on user's site, user's own JS logic bugs.
To file: write with all sections below (do not truncate — include every section through the Date/Version footer):
~/.gstack/contributor-logs/{slug}.mdundefined如果为:您处于贡献者模式。您是gstack用户,同时也帮助改进gstack。
_CONTRIBtrue在每个主要工作流步骤结束时(不是每个命令之后),反思您使用的gstack工具。为您的体验打分(0到10分)。如果分数不是10分,请思考原因。如果存在明显的、可解决的Bug,或者gstack的代码或技能Markdown有可以改进的、有见地的有趣点 — 请提交一份现场报告。也许我们的贡献者能帮助我们变得更好!
校准标准 — 参考示例: 例如,曾因gstack未将表达式包装在异步上下文中而报错。这是个小问题,但输入是合理的,gstack本应处理好 — 这类问题值得提交报告。比这影响更小的问题可以忽略。
$B js "await fetch(...)"SyntaxError: await is only valid in async functions不值得提交的情况: 用户应用的Bug、用户URL的网络错误、用户网站的认证失败、用户自己的JS逻辑Bug。
提交报告: 写入,包含以下所有部分(不要截断 — 包括日期/版本页脚之前的每个部分):
~/.gstack/contributor-logs/{slug}.mdundefined{Title}
{标题}
Hey gstack team — ran into this while using /{skill-name}:
What I was trying to do: {what the user/agent was attempting}
What happened instead: {what actually happened}
My rating: {0-10} — {one sentence on why it wasn't a 10}
嘿gstack团队 — 我在使用/{技能名称}时遇到了这个问题:
我尝试做的事情: {用户/Agent当时的操作目标}
实际发生的情况: {实际出现的结果}
我的评分: {0-10} — {一句话说明为什么不是10分}
Steps to reproduce
复现步骤
- {step}
- {步骤}
Raw output
原始输出
{paste the actual error or unexpected output here}{在此粘贴实际错误或意外输出}What would make this a 10
如何达到10分体验
{one sentence: what gstack should have done differently}
Date: {YYYY-MM-DD} | Version: {gstack version} | Skill: /{skill}
Slug: lowercase, hyphens, max 60 chars (e.g. `browse-js-no-await`). Skip if file already exists. Max 3 reports per session. File inline and continue — don't stop the workflow. Tell user: "Filed gstack field report: {title}"{一句话:gstack本应做出哪些不同的处理}
日期: {YYYY-MM-DD} | 版本: {gstack版本} | 技能: /{技能名称}
Slug:小写,用连字符连接,最多60个字符(例如`browse-js-no-await`)。如果文件已存在则跳过。每个会话最多提交3份报告。直接在会话中写入报告并继续 — 不要中断工作流。告知用户:「已提交gstack现场报告:{标题}」Setup Browser Cookies
设置浏览器Cookie
Import logged-in sessions from your real Chromium browser into the headless browse session.
将您真实Chromium浏览器中的登录会话导入到无头浏览会话中。
How it works
工作原理
- Find the browse binary
- Run to detect installed browsers and open the picker UI
cookie-import-browser - User selects which cookie domains to import in their browser
- Cookies are decrypted and loaded into the Playwright session
- 查找浏览二进制文件
- 运行以检测已安装的浏览器并打开选择器UI
cookie-import-browser - 用户在浏览器中选择要导入的Cookie域名
- Cookie被解密并加载到Playwright会话中
Steps
操作步骤
1. Find the browse binary
1. 查找浏览二进制文件
SETUP (run this check BEFORE any browse command)
准备工作(在运行任何浏览命令之前执行此检查)
bash
_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
B=""
[ -n "$_ROOT" ] && [ -x "$_ROOT/.claude/skills/gstack/browse/dist/browse" ] && B="$_ROOT/.claude/skills/gstack/browse/dist/browse"
[ -z "$B" ] && B=~/.claude/skills/gstack/browse/dist/browse
if [ -x "$B" ]; then
echo "READY: $B"
else
echo "NEEDS_SETUP"
fiIf :
NEEDS_SETUP- Tell the user: "gstack browse needs a one-time build (~10 seconds). OK to proceed?" Then STOP and wait.
- Run:
cd <SKILL_DIR> && ./setup - If is not installed:
buncurl -fsSL https://bun.sh/install | bash
bash
_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
B=""
[ -n "$_ROOT" ] && [ -x "$_ROOT/.claude/skills/gstack/browse/dist/browse" ] && B="$_ROOT/.claude/skills/gstack/browse/dist/browse"
[ -z "$B" ] && B=~/.claude/skills/gstack/browse/dist/browse
if [ -x "$B" ]; then
echo "READY: $B"
else
echo "NEEDS_SETUP"
fi如果输出为:
NEEDS_SETUP- 告知用户:「gstack browse需要一次性构建(约10秒)。是否可以继续?」然后停止操作并等待用户回复。
- 运行:
cd <SKILL_DIR> && ./setup - 如果未安装:
buncurl -fsSL https://bun.sh/install | bash
2. Open the cookie picker
2. 打开Cookie选择器
bash
$B cookie-import-browserThis auto-detects installed Chromium browsers (Comet, Chrome, Arc, Brave, Edge) and opens
an interactive picker UI in your default browser where you can:
- Switch between installed browsers
- Search domains
- Click "+" to import a domain's cookies
- Click trash to remove imported cookies
Tell the user: "Cookie picker opened — select the domains you want to import in your browser, then tell me when you're done."
bash
$B cookie-import-browser该命令会自动检测已安装的Chromium浏览器(Comet、Chrome、Arc、Brave、Edge),并在您的默认浏览器中打开一个交互式选择器UI,您可以:
- 在已安装的浏览器之间切换
- 搜索域名
- 点击「+」导入某域名的Cookie
- 点击垃圾桶图标移除已导入的Cookie
告知用户:「Cookie选择器已打开 — 请在浏览器中选择要导入的域名,完成后告知我。」
3. Direct import (alternative)
3. 直接导入(替代方案)
If the user specifies a domain directly (e.g., ), skip the UI:
/setup-browser-cookies github.combash
$B cookie-import-browser comet --domain github.comReplace with the appropriate browser if specified.
comet如果用户指定了具体域名(例如),则跳过UI:
/setup-browser-cookies github.combash
$B cookie-import-browser comet --domain github.com如果用户指定了其他浏览器,请将替换为对应的浏览器名称。
comet4. Verify
4. 验证
After the user confirms they're done:
bash
$B cookiesShow the user a summary of imported cookies (domain counts).
用户确认完成后:
bash
$B cookies向用户展示已导入Cookie的摘要(按域名统计数量)。
Notes
注意事项
- First import per browser may trigger a macOS Keychain dialog — click "Allow" / "Always Allow"
- Cookie picker is served on the same port as the browse server (no extra process)
- Only domain names and cookie counts are shown in the UI — no cookie values are exposed
- The browse session persists cookies between commands, so imported cookies work immediately
- 首次从某浏览器导入Cookie时,可能会触发macOS钥匙串对话框 — 请点击「允许」/「始终允许」
- Cookie选择器与浏览服务器使用同一端口(无需额外进程)
- UI中仅显示域名和Cookie数量 — 不会暴露Cookie值
- 浏览会话会在命令之间保留Cookie,因此导入的Cookie可立即生效