Repository navigation
Releases: KNLCXY/dsh-github
Release list
v0.4.1 — 回退 linkWebsift 联动
回退 0.4.0 的 linkWebsift 联动(面板开关、探测逻辑、README 小节一并移除)。
为什么回退
与其让插件偷偷借另一个插件的代理配置,不如自己在设置里填一次 proxyUrl,或者直接把系统代理打开 —— 少一层隐式行为,出问题时也更容易定位。
现在的行为
| 项 | 值 |
|---|---|
| 代理来源 | 只有 proxyUrl(留空 = 直连) |
| 对 dsh-websift | 不探测、不复用、不依赖 |
| 面板 | 联动那一行已移除,回到「token / API 地址 / 代理」三项 |
安装
dsh plugin --profile <你的 profile> remove dsh-github
dsh plugin --profile <你的 profile> add "file:<下载路径>/dsh-github-0.4.1.tgz"已经装了 0.4.0 的,升级到 0.4.1 即可把联动配置去掉;旧的
linkWebsift字段会留在 settings.json 里,但已无人读取,可忽略。
v0.4.0 — linkWebsift 联动开关(先探测,不满足不执行)
按「单独可用、联动可选、先判断不执行」加的开关。
linkWebsift 三档
| 值 | 行为 |
|---|---|
off |
完全不看 dsh-websift,用自己设置里的 proxyUrl |
auto(默认) |
先探测 websift 是否装着:没装 → 静默跳过,行为与单装完全一致;装了 → 只有自己 proxyUrl 为空时才借用它的代理 |
on |
优先用 websift 的代理(统一管理) |
边界
- 探测只读
~/.dsh/storages/browser-kernel/settings.json,不调用它的工具、不启动它的内核 - 对方
proxyMode: never(一律直连)时不借 - 面板显示:是否检测到 websift、实际用的代理、来源(自己 / websift)
实测四档
off + 自己没配 → 实际代理=(空) 来源=none
auto + 自己没配 → http://127.0.0.1:7897 来源=websift
auto + 自己配了 → http://127.0.0.1:9999 来源=own
on + 自己配了 → http://127.0.0.1:7897 来源=websift
没装 websift + auto → peer.present=false,代理为空,静默跳过
安装
dsh plugin --profile <你的 profile> remove dsh-github
dsh plugin --profile <你的 profile> add "file:<下载路径>/dsh-github-0.4.0.tgz"v0.3.1 — 脚本内核路径自动探测
三个旁路脚本不再硬编码作者机器的内核路径。
改了什么
- 新增
lib/detect-chrome.mjs:多根目录有界扫描(%LOCALAPPDATA%/%APPDATA%/Program Files/(x86)/~/Desktop,深度 4–5)+icudtl.dat/*.pak特征校验 + 偏好排序(标准浏览器优先,豆包/夸克等应用内置排最后) - 三个脚本改为
DSH_CHROME→ 自动探测,找不到才报错退出 - 与独立仓库 dsh-github-scripts 内容对齐(那边也是同一份
lib/detect-chrome.mjs)
为什么拷贝而不是依赖
脚本要能单独 clone 下来就用,把插件当依赖反而抬高门槛。代价是改探测逻辑时两边同步 —— 两个文件顶部都写了这句提醒。
安装
dsh plugin --profile <你的 profile> remove dsh-github
dsh plugin --profile <你的 profile> add "file:<下载路径>/dsh-github-0.3.1.tgz"v0.3.0 — 一条命令发 Release(建 tag + 上传附件)
新增 github_release_create:一条命令替代「建 tag → 建 release → 传附件 → 校验」。
用法
github_release_create({
repo: "owner/name",
tag: "v1.0.0",
name: "v1.0.0 — 说明",
body: "markdown 说明",
assets: "dist/pkg.tgz, dist/SHA256SUMS.txt",
draft: false,
})tag不存在时按target(默认仓库默认分支)自动创建assets收本地路径(逗号分隔或 JSON 数组),按扩展名选 content-type:
.tgz/.gz→ gzip、.zip→ zip、其余 octet-streamdraft: true先存草稿不公开- 上传走
uploads.github.com,复用同一套 token 与代理隧道(配了proxyUrl就走 CONNECT) - 单个附件上限 2GB;同名附件会报错(先删旧的)
这个 Release 就是用它自己发的
附件里的 tgz 由同一条命令上传 —— 顺便当了一次端到端验证。
安装
dsh plugin --profile <你的 profile> remove dsh-github
dsh plugin --profile <你的 profile> add "file:<下载路径>/dsh-github-0.3.0.tgz"v0.2.1 — git 探测与生效值判断
承接 v0.2.0 的 github_fix_git_auth,修两个真问题:
① 在 DSH 里报「git 不可用」
DSH 的宿主进程不继承 shell 的 PATH,execFile('git') 直接 ENOENT。现在按顺序探测并缓存:
DSH_GIT 环境变量 → PATH → ~/.dsh/profiles/*/node_modules/@dsh-ops/bash-*/ucrt64/bin/git.exe → 常见安装路径
实测(把 PATH 清空模拟宿主):找到 git version 2.56.0.windows.2。
② 把已重置的 helper 当成生效值
credential.helper 是多层叠加的,空值会清空此前累积的列表。原来只看原始值,修好之后仍报「会弹框」。现在按 system → global → local 折叠:
原始配置:helper-selector / (空值/重置) / manager
生效的 helper:manager ← 以此判断
credentialStore:wincred
✅ 配置就绪,不会弹选择框
安装
dsh plugin --profile <你的 profile> remove dsh-github
dsh plugin --profile <你的 profile> add "file:<下载路径>/dsh-github-0.2.1.tgz"校验:同页 SHA256SUMS.txt。
v0.2.0 — 修掉 git 凭据助手弹窗
修一个反复打扰人的小东西:Windows 上每次 git 要凭据,都弹一个 Select a credential helper(CredentialHelperSelector)。
成因
git config --system --get-all credential.helper # → helper-selector
git config --global --get credential.credentialStore # → 空helper-selector 这个 helper 的职责就是弹选择框;同时 credentialStore 没配,GCM 不知道往哪存 —— 于是一次次问。
还有一个容易踩的点:credential.helper 是多层叠加的(system → global → local),在 global 里写一条 manager 顶不掉 system 里的 helper-selector,必须先在 global 写一条空值重置列表。
修法
git config --global credential.credentialStore wincred
git config --global --unset-all credential.helper
git config --global --add credential.helper "" # 空值 = 重置此前累积的清单
git config --global --add credential.helper manager修完各层长这样:
system : helper-selector ← 还在,但被下面重置掉了
global : (空) ← 重置
global : manager ← 实际生效
插件里怎么做
新增工具 github_fix_git_auth:
github_fix_git_auth({}) // 只检查,报告现状
github_fix_git_auth({ apply: true }) // 写 ~/.gitconfig 修掉或者打开 设置 → GitHub,卡片「git 凭据弹窗」里点 修复(写 ~/.gitconfig),状态行会显示当前 helper / store 和是否会弹。
边界
- 只改 git 自己的凭据存储配置,不读取、不修改、不打印你的 GitHub token
- store 按平台选:Windows
wincred、macOSosxkeychain、Linuxsecretservice - 第一次用仍会让你输入一次账号/token(之后按 store 记住),但不会再弹选择框
- 只动
~/.gitconfig,不碰 system 配置(那需要管理员,而且会被程序更新覆盖)
安装 / 升级
dsh plugin --profile <你的 profile> remove dsh-github
dsh plugin --profile <你的 profile> add "file:<下载路径>/dsh-github-0.2.0.tgz"校验:同页 SHA256SUMS.txt。冒烟测试 23 项(新增 4 项覆盖 git-auth 路由与新工具)。
v0.1.1 — GitHub 工具(token 在插件设置里,不进仓库)
给 DSH 的 GitHub 工具插件:调 REST API、一次提交多个文件(一个 commit)、建仓库、查 token 身份。
token 你自己填 —— 在 设置 → GitHub 里粘一次,之后每个会话都能用。设置里那格只有示例占位符,没有默认值;插件源码、cordis.patch.yml、任何工具输出里都不会出现你的 token。
四个工具
| 工具 | 作用 |
|---|---|
github_status |
token 是谁的、有什么权限、还剩多少配额(只回显 ghp_…9c31) |
github_api |
直接调 REST API,返回体按 max_chars 截断,401/403/404/422 翻译成人话 |
github_push_files |
一批文件 = 一个 commit(blob → tree → commit → 更新 ref),空仓库也能用 |
github_repo_create |
建仓库 + 顺手设 topics |
安装
# 附件包
dsh plugin --profile <你的 profile> add "file:<下载路径>/dsh-github-0.1.1.tgz"
# 或从 git
dsh plugin --profile <你的 profile> add github:KNLCXY/dsh-github装完重启 DSH,然后到 设置 → GitHub 把 token 粘进去。
token 要什么权限
| 用途 | 最小权限 |
|---|---|
| 读仓库 / issue | Contents: Read |
| 提交文件 | Contents: Read and write |
| 建仓库 / 设 topics | 再加 Administration: Read and write |
| 图省事 | classic token 勾一个 repo |
建议设过期时间(7–30 天),不用了就 Revoke。
安全边界
- token 只存在
~/.dsh/storages/dsh-github/settings.json - 设置接口只返回
hasToken/tokenHint(掩码)/ 占位符,没有 token 字段 - 仓库里的
cordis.patch.yml写的是token: '' - 工具输出里永远不出现明文 token
自测
node test/smoke.mjs # 19 项,不联网、不需要 DSH覆盖:4 个工具是否注册、设置接口校验(坏 token 400 / 好 token 200 且只回显首末 4 位 / 明文不出现 / 清除 / 坏代理 400)、没 token 时的提示、repo 格式校验。
旁路脚本(没有 token 时用)
| 脚本 | 作用 |
|---|---|
scripts/gh-web-commit.mjs |
用浏览器里已登录的 GitHub 会话提交单个文件(不依赖 token) |
scripts/gh-device-login.mjs |
走 OAuth 设备流换一个 gho_ token |
scripts/chrome-probe.mjs |
用指定启动参数起内核排查渲染问题 |
踩过的坑:GitHub 的文件编辑器在 navigator.webdriver === true 时整块不渲染,加 --disable-blink-features=AutomationControlled 才正常。
校验下载包:sha256sum -c SHA256SUMS.txt。
MIT © KNLCXY