Skip to content

feat: GitHub token settings card in the Plugins settings page - #6

Merged
PerryLink merged 1 commit into
PerryLink:mainfrom
AraragiEro:feat/github-token-settings-card
Aug 22, 2026
Merged

feat: GitHub token settings card in the Plugins settings page#6
PerryLink merged 1 commit into
PerryLink:mainfrom
AraragiEro:feat/github-token-settings-card

Conversation

@AraragiEro

Copy link
Copy Markdown
Contributor

feat: GitHub token settings card in the Plugins settings page

在「设置 → 插件」页新增 GitHub Token 配置卡

给 dsh-github 加了一张可折叠的 GitHub 配置卡(设置 → 插件 → 插件配置),可以直接在页面上填写 GitHub Token。

特性

  • 可折叠:默认只占一行(标题 + 描述 + 箭头),点击展开表单,与内置插件卡 / 插件市场卡风格一致(镜像宿主 PluginCard 的设计 token,按钮与图标使用共享 primitives 组件)
  • Token 直接填写:密码框 + 「已配置 / 未配置」状态徽章 + 保存/放弃按钮
  • 立即生效:token 写入凭证库(credentials domain,默认引用 GITHUB_TOKEN),不进设置文件;宿主每次操作实时解析,保存后无需重启即可用
  • 保存时带 loading 图标,失败保留草稿供修正

实现

  • 宿主半apply 中通过可选 settings 服务注册 dsh-github 命名空间(tokenRef / tokenSource schema,与 Config 对齐;token 字面量永不进设置文档)
  • 浏览器半src/client.ts(源码)→ lib/client.js__ModuleLoader__ bundle,提交产物),注册 settings.plugin.item 卡片(key = dsh-github),读取凭证域状态并写 token
  • package.json:新增 exports[./client]dsh.client(platform web),peer/dev 依赖补充 @deepseek-ai/dsh-settings

验证

  • pnpm build(tsc)通过
  • pnpm typecheck 通过
  • pnpm verify:self-contained 通过
  • 本地 vitest 因沙箱限制(esbuild 二进制无法安装)未能运行,需 CI 跑测试

在本地 0.6.2 上已实测:卡片正常渲染、token 保存后 GitHub 工具立即可用。

Adds a collapsible 'GitHub' card to the settings -> Plugins section where the
GitHub token can be filled directly. The token literal is written through the
credentials domain (default ref GITHUB_TOKEN), never into the settings
document, and is resolved per operation — so it takes effect immediately,
without a restart.

Host half registers the 'dsh-github' settings namespace (tokenRef/tokenSource
schema) through the optional settings service. Browser half ships a
__ModuleLoader__ bundle (lib/client.js, source in src/client.ts) that
contributes a settings.plugin.item card mirroring the host PluginCard chrome
and using the shared primitives (Button, IconChevronDownOutline14), matching
the style of the other plugin cards and the market card.
@PerryLink

Copy link
Copy Markdown
Owner

感谢这个 PR,功能完整,设计很克制——token 走 credentials 域、绝不进 settings 文档,与仓库现有的审批模型一致。

我已本地复核(head c028ae8 / base f440c5f):pnpm install --frozen-lockfiletypecheckbuildverify:self-containedlint 全部通过,构建产物与提交的 lib/ 完全一致;vitesttest/action-contract.test.ts 2 个用例失败,已确认是 Windows 检出的 CRLF 行尾导致的正则失配(仓库索引为 LF,Linux CI 通过),与本次改动无关;e2e 用例无 key 自动跳过。

目前 fork PR 的 CI 停在 action_required(首次贡献需批准 workflow 运行)——我已批准运行,CI 全绿后合并,并随下一版本发布、在 release notes 中鸣谢。

@PerryLink
PerryLink merged commit 8f0486b into PerryLink:main Aug 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants