js-github-ops-skill
面向 github.com 的只读 + 仅改浏览器 URL(location.assign)的 JS Eyes 扩展技能。READ 数据走官方 GitHub REST API(https://api.github.com):浏览器内 fetch 支持匿名访问公开仓库;与 GitHub 网页不同源,但 CORS 对只读公开 API 可用,且不携带浏览器 Cookie(credentials: 'omit')。登录态探测仅使用页面内 meta[name="user-login"]。
依赖
- Node.js 22+、JS Eyes 2.8.5+;JS Eyes Server 已启动且扩展已连接。
- 宿主设置
security.allowRawEval: true以允许 bridge 注入;JS Eyes 2.5+ 会同步到扩展,扩展侧显式false仅作为强制关闭覆盖。 - Chrome 要求 135+;Chrome 138+ 还需开启浏览器控制的 Allow User Scripts。
- 浏览器内至少打开一个 github.com tab(READ 默认不切走当前 tab;无 tab 时可
createIfMissing打开示例页)。 - 公开仓库读取无需登录;
github_session_state只检测现有登录态,本 Skill 不执行登录自动化。
安全档位
| 档位 | 说明 |
|---|---|
| READ | fetch api.github.com + JSON 解析;不改 DOM / URL |
| INTERACTIVE | 仅 location.assign 到 *.github.com |
| DESTRUCTIVE | 不做(不 star / comment / PR / 写 API) |
AI 工具(skill.definition.js)
| 工具 | 说明 |
|---|---|
github_session_state |
登录态(meta) |
github_get_repo |
仓库元数据 |
github_list_issues |
Issues 列表(默认排除 PR) |
github_get_issue |
单条 Issue |
github_navigate_* |
仅导航 |
CLI
cd skills/js-github-ops-skill && npm install
node index.js doctor
node index.js get-repo octocat/Hello-World --pretty
node index.js list-issues octocat/Hello-World --limit 10
node index.js get-issue octocat/Hello-World 1347
node index.js navigate-repo octocat/Hello-World
node index.js navigate-issues octocat/Hello-World
node index.js navigate-issue octocat/Hello-World 1347
node index.js dom-dump --anchors
node index.js xhr-log --filter 'github\\.com|api\\.github\\.com'
启用
js-eyes skills link /path/to/js-eyes/skills/js-github-ops-skill
js-eyes skills reload
Page profiles
| profile | bridge |
|---|---|
repo |
__jse_github_repo__ |
issues |
__jse_github_issues__ |
issue |
__jse_github_issue__ |
故障排查
| 现象 | 处理 |
|---|---|
E_NO_TAB |
打开任意 github.com 页面 |
RAW_EVAL_DISABLED |
在宿主启用 security.allowRawEval 并重新连接扩展;若扩展曾显式保存 false,清除该覆盖 |
fetch_failed 403/404 |
私有库或未授权;公开库请检查 owner/repo |
| 429 | API 速率限制;稍后重试 |
Recording
跟随 js-eyes 全局 recording 配置;落盘目录:~/.js-eyes/skill-records/js-github-ops-skill/。
合规
仅个人自动化用途;遵守 GitHub Terms of Service 与 REST API 文档。