Repository navigation
feat: Dashboard 配置页极简化重构与双通道自动发布工作流 - #2
Conversation
… workflow
- Refactor Dashboard #/plugins/github into an out-of-the-box, 2-step flow while
keeping backend config.json 100% backward compatible and write-only secrets intact:
- Auto-detect local gh auth token on load (never exposing tokens to frontend),
displaying a green status card and defaulting to gh_cli, with PAT / GitHub App /
GHES apiBaseUrl collapsed under "切换其他鉴权方式" and one-click "测试连接".
- Apply "PR 自动拉群评审" preset to new repository rules with only 2 required
fields (owner/repo slug with validation and friendly Chinese Bot role selection
with auto-preselected creator bot & synced first-reviewer kickoff bot), collapsing
all low-frequency options into "高级过滤与模板设置" with a customized-count badge.
- Collapse global proxy, loopback webhook, port, poll interval, and hourly cap
settings into a bottom panel with a single-line summary, and clarify the top
overview (dormant vs active mode, enabled rules, latest sync, API quota, Sync Now).
- Upgrade .github/workflows/publish.yml into two independent parallel channels on
v* tags (after origin/main ancestor & package.json version verification):
- release-github: npm ci, npm test, npm pack (.tgz with package/dist/), Node crypto
SRI .tgz.sha512, and idempotent gh release create/upload with generated notes.
- publish-npm: upgrades npm@^11.5.1 for OIDC Trusted Publishing before running
npm ci, npm test, and npm publish --access public --provenance.
- Update README.md and add unit & integration tests covering minimalist Dashboard
rendering, gh-cli detection, 2-step rule creation, custom advanced backfill,
write-only secrets, publish.yml structure, and tarball dist/ + SRI verification.
Co-Authored-By: Claude Code <[email protected]>
…ion tests - Fix [P2 #8] webhook admission retry flake on slower CI runners by waiting deterministically for watcher queue drain (active=0, pending=0) and deliveryDedup.inFlightSize()=0 after unblock() instead of a fixed 80ms sleep. - Replace similar short setTimeout waits in dashboard-settings-cli.test.ts and review-round3-regressions.test.ts with bounded waitFor() checks. Co-Authored-By: Claude Code <[email protected]>
独立复审结论:暂不可合复审对象: 未发现密钥回显/日志泄漏,双通道发布工作流本体也符合约定;但仍有 1 个 P1、4 个 P2 需要处理。 P1 — SRI 校验失败不会阻止后续安装
test "${ACTUAL}" = "${EXPECTED}"
botmux plugin install "./botmux-ai-plugin-github-${VERSION}.tgz"普通 bash/zsh 未启用 建议将安装命令用 P2 — 未展开高级区保存也会改变既有规则
P2 — 分区保存会静默清空另一分区的未保存输入
复现场景:填写新 PAT 但尚未保存,再修改服务端口并点击“保存高级设置”;服务端只保存全局 patch,随后 PAT 输入被清空且不会落盘。反向操作也会丢失尚未保存的代理、Webhook、端口、轮询和限流输入。建议按分区 hydrate,或显式保留/提示另一分区的 dirty draft。 P2 — 过期的自动鉴权探测会覆盖新保存的鉴权状态
建议保存鉴权时使未完成探测失效,并只接收 generation 与配置签名均匹配的响应。 已通过的检查
非阻断测试建议
|
…rd state safety)
- [P1] Fail-closed chain README.md EN & ZH GitHub Release download, non-empty
SRI sha512 verification, and `botmux plugin install` using `&&` so a checksum
mismatch always blocks installation even in interactive shells without `set -e`.
- [P2-1] Preserve `creatorBotAppId` inside `memberBotAppIds` during `draftToRule()`
so editing/saving existing valid rules never drops a creator bot that also acts
as a member, while keeping `kickoffBotAppId !== creatorBotAppId` safe in
`toggleReviewerBot()` and `changeCreatorBot()`.
- [P2-2] Switch branch/author/label list fields in Dashboard rule drafts from
comma-split to newline-delimited (`splitLines` + `<textarea>`) so valid names
containing commas (e.g. `release,2026`, `priority,high`) round-trip losslessly
both collapsed and expanded.
- [P2-3] Scope `hydrateFromEnvelope` / `refresh` by section (`auth` / `global` /
`repos` / `status` / `all`) with per-section dirty tracking so saving one
section never wipes unsaved drafts or secret inputs in another section, while
still clearing write-only secret inputs for the saved section.
- [P2-4] Guard in-flight auth probes with a monotonic generation counter plus
canonical auth config signature (`getAuthConfigSignature`) and bump generation
on auth save so late `gh_cli` probe responses never overwrite newly saved auth.
- Add unit & integration regression tests for P2-1/P2-2 collapsed-save lossless
round-trip, P2-3 cross-section draft preservation, P2-4 stale probe rejection,
and strengthened `publish.yml` (`--clobber`, `--verify-tag`, `gh release view`,
`fetch-depth: 0`, `permissions: {}`) and README SRI gating assertions.
Co-Authored-By: Claude Code <[email protected]>
Replace the fixed 150ms setTimeout in review-round2-regressions.test.ts [P1-1] with an explicit commit hook triggered only after Step 2 asserts the fail-closed safety settle window, preventing slow CI runners from firing the timer early. Co-Authored-By: Claude Code <[email protected]>
增量复审结论:可合复审范围严格限定为
本地验证
未执行 merge、打 tag、发版或修改线上插件。 |
概述
基于
origin/main完成两项升级(保持后端config.json100% 向后兼容与密钥 write-only 安全边界不变):#/plugins/github配置页极简化重构:重构为「开箱即用、2 步配完、高级项全折叠」体验;.github/workflows/publish.yml):打v*tag 自动并行触发 GitHub Release(.tgz+.tgz.sha512) 与 npm OIDC Trusted Publishing(含npm@^11.5.1升级修复),并同步更新README.md。一、Dashboard 配置页极简化重构
改造前后对比
dormant休眠等待首条规则 vsactive监控中、已启用规则数、最近一次同步时间、API 额度余量)与「立即同步一次」主按钮gh auth token(不向前端暴露任何 token),已登录直接显示绿色状态卡「已自动识别本机 GitHub 账号@<login>(来自 gh),免配置可直接使用」并默认选用gh_cli;PAT / GitHub App / 自定义 GHESapiBaseUrl收纳至默认折叠的「切换其他鉴权方式」,保留一键「测试连接」与已配置摘要cli_...owner/repo,实时格式校验 +deepcoldy/botmux占位提示);② Bot 角色选择(中文 Bot 名称,建群 Bot 自动预选首个可用 Bot,评审 Bot 多选并自动联动首个评审 Bot 为首审触发 Bot、可下拉改选)。全部低频项默认折叠至「高级过滤与模板设置」,编辑已自定义规则时自动展示「已自定义 N 项」徽标maxGroupCreatesPerRepoPerHour;未展开时以单行摘要展示当前状态(如轮询 60s · Webhook 未开启 · 无代理)<details>诊断区,保留全部功能与 PR 编号严格校验安全与兼容性
config.jsonSchema、Control Server、Watcher 与 CLI 零破坏性变更;0600保存,前端永不回显且每次保存/刷新后清空输入框)。二、双通道自动发布工作流(
.github/workflows/publish.yml)push: tags: ['v*']触发,两个 job 均独立校验 tag 在origin/main祖先链上且vX.Y.Z与package.json的version一致;needs:依赖、并行互不阻塞 的 job:release-github(permissions: contents: write):运行npm ci --no-audit --no-fund、npm test、npm pack(校验包内包含package/package.json与package/dist/),用 Nodecrypto生成单行标准 SRI 格式<tarball>.sha512(sha512-<base64>),并通过gh release create(自动生成 release notes)或已存在时gh release upload --clobber幂等上传.tgz与.tgz.sha512;publish-npm(permissions: contents: read, id-token: write):补上npm install -g npm@^11.5.1修复 Node 22 自带 npm 10.x 不支持 OIDC Trusted Publishing 的问题,运行npm ci --no-audit --no-fund、npm test与npm publish --access public --provenance;npm 侧未完成首次绑定时也不阻塞 GitHub Release 产出,后续可单独重跑publish-npm。README.md(中英文):补充 GitHub Release 安装与 SRI 校验说明、简化后的 Dashboard 2 步配置指引。验证结果
npm test(typecheck+build+validate+test:unit+test:integration)全绿:30/30通过(新增test/unit/dashboard-helpers.test.ts覆盖 Bot 友好名称排序与去重、2 步预设生成合法RepoRule、自定义高级项计数与回填、鉴权与全局摘要计算);40/40通过(扩展test/integration/dashboard-settings-cli.test.ts覆盖极简渲染、默认gh-cli绿色状态卡、2 步建规落盘、编辑已有自定义规则回填、密钥 write-only 不回显;扩展test/integration/packaging.test.ts覆盖publish.yml双通道结构与npm pack产物含package/package.json+package/dist/+ SRIsha512-<base64>校验)。publish.yml的打包与 SRI 生成脚本验证通过,产出的botmux-ai-plugin-github-0.1.0.tgz(含完整package/dist/)与.tgz.sha512与npm pack自身 integrity 哈希逐字节一致。yaml.safe_load)通过。🤖 Generated with Claude Code