@huseynsnmz/pi-board 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/CHANGELOG.md +26 -4
  2. package/CONTRIBUTING.md +7 -0
  3. package/README.md +53 -419
  4. package/SECURITY.md +19 -0
  5. package/docs/how-it-works.md +31 -0
  6. package/docs/reference.md +276 -0
  7. package/package.json +18 -19
  8. package/src/index.ts +9 -1
  9. package/src/runtime/service.mjs +12 -0
  10. package/src/ui/dashboard.ts +14 -8
  11. package/src/ui/double-left.ts +5 -1
  12. package/src/ui/focus.ts +7 -1
  13. package/src/ui/waiting.ts +10 -5
  14. package/IMPLEMENTATION_PLAN.md +0 -920
  15. package/PRD.md +0 -484
  16. package/PROGRESS.md +0 -142
  17. package/VERIFY.md +0 -115
  18. package/docs/BATCH_SELECTION_READ_FLOW.md +0 -277
  19. package/docs/EXPLORATION.md +0 -187
  20. package/docs/PTY_ATTACH_IMPLEMENTATION_PLAN.md +0 -581
  21. package/docs/RELEASE.md +0 -148
  22. package/docs/superpowers/plans/2026-08-15-screenlog-gc.md +0 -704
  23. package/docs/superpowers/plans/2026-08-16-attach-double-cursor-jiggle-retry.md +0 -499
  24. package/docs/superpowers/plans/2026-08-21-attach-coldstart-jiggle-rearm.md +0 -797
  25. package/docs/superpowers/plans/2026-08-21-dashboard-keypress-lag.md +0 -366
  26. package/docs/superpowers/plans/2026-08-21-issue-14-needs-input-no-auto-done.md +0 -576
  27. package/docs/superpowers/plans/2026-08-22-jiggle-shrink-and-hold.md +0 -337
  28. package/docs/superpowers/plans/2026-08-22-launch-cwd-favorites.md +0 -916
  29. package/docs/superpowers/plans/2026-08-22-question-tool-grouping.md +0 -211
  30. package/docs/superpowers/plans/2026-08-22-rename-state-labels.md +0 -182
  31. package/docs/superpowers/plans/2026-08-22-stable-list-order.md +0 -51
  32. package/docs/superpowers/plans/2026-08-27-locks-acquirelock-spin.md +0 -614
  33. package/docs/superpowers/plans/2026-08-27-pty-runner-test-flaky.md +0 -32
  34. package/docs/superpowers/plans/2026-08-29-code-refs-badges.md +0 -223
  35. package/docs/superpowers/plans/2026-08-30-circular-navigation.md +0 -308
  36. package/docs/superpowers/plans/2026-08-30-post-exit-timing-fix.md +0 -37
  37. package/docs/superpowers/plans/2026-08-30-pty-attach-quality-debt.md +0 -311
  38. package/docs/superpowers/plans/2026-08-30-readme-v2.md +0 -294
  39. package/docs/superpowers/plans/2026-09-01-attach-detach-gate-cursor-anchor.md +0 -284
  40. package/docs/superpowers/plans/2026-09-02-attach-detach-editor-state.md +0 -722
  41. package/docs/superpowers/plans/2026-09-03-code-refs-pr-backlink-narrow.md +0 -551
  42. package/docs/superpowers/plans/2026-09-03-detach-gate-glyph-fallback.md +0 -146
  43. package/docs/superpowers/plans/2026-09-04-evidence-outputpreview.md +0 -209
  44. package/docs/superpowers/plans/2026-09-04-warm-host-reclaim.md +0 -796
  45. package/docs/superpowers/plans/2026-09-05-issue-13-drainnextfollowup-pty-probe.md +0 -114
  46. package/docs/superpowers/plans/2026-09-05-issue-38-windows-wezterm-ime-cursor.md +0 -73
  47. package/docs/superpowers/plans/2026-09-05-issue-39-truncate-codepoint-boundary.md +0 -143
  48. package/docs/superpowers/plans/2026-09-05-issue-61-mention-fallback-guards.md +0 -226
  49. package/docs/superpowers/plans/2026-09-05-issue-63-flaky-manual-completion.md +0 -87
  50. package/docs/superpowers/plans/2026-09-05-issue-64-changelog-release-helper.md +0 -53
  51. package/docs/superpowers/plans/2026-09-05-pty-host-stacking-sock-race.md +0 -731
  52. package/docs/superpowers/plans/2026-09-08-attach-ctrl-left-detach.md +0 -30
  53. package/docs/superpowers/plans/2026-09-08-dashboard-shrink-repaint.md +0 -68
  54. package/docs/superpowers/plans/2026-09-08-issue-11-attach-runtime-desync-heal.md +0 -917
  55. package/docs/superpowers/plans/2026-09-08-legacy-stale-host-recovery.md +0 -125
  56. package/docs/superpowers/plans/2026-09-08-spawn-async-error-swallow.md +0 -56
  57. package/docs/superpowers/plans/2026-09-08-stale-model-attach-guard.md +0 -96
  58. package/docs/superpowers/plans/2026-09-09-claimpid-blocks-replace.md +0 -267
  59. package/docs/superpowers/plans/2026-09-09-harden-runner-architecture.md +0 -603
  60. package/docs/superpowers/plans/2026-09-09-single-writer-completion.md +0 -252
  61. package/docs/superpowers/plans/2026-09-10-reader-consistency.md +0 -115
  62. package/docs/superpowers/plans/2026-09-14-attach-cursor-dectcem-gate.md +0 -469
  63. package/docs/superpowers/plans/2026-09-14-attach-snapshot.md +0 -92
  64. package/docs/superpowers/plans/2026-09-14-host-meta-orphan-lock.md +0 -771
  65. package/docs/superpowers/plans/2026-09-14-issue-106-terminal-frame-cognition.md +0 -299
  66. package/docs/superpowers/plans/2026-09-14-issue-113-foreground-preview-race.md +0 -609
  67. package/docs/superpowers/plans/2026-09-14-terminal-model.md +0 -145
  68. package/docs/superpowers/plans/2026-09-15-coordinator-pipe-root-normalize.md +0 -224
  69. package/docs/superpowers/plans/2026-09-15-lease-publish-eprem-reclaim.md +0 -341
  70. package/docs/superpowers/plans/2026-09-18-detach-anchor-reporter-endpoint.md +0 -875
  71. package/docs/superpowers/plans/2026-09-20-control-lifecycle.md +0 -116
  72. package/docs/superpowers/plans/2026-09-20-issue-121-perf-gate-out-of-coverage.md +0 -517
  73. package/docs/superpowers/plans/2026-09-23-a5-mid-stream-assertion.md +0 -25
  74. package/docs/superpowers/plans/2026-09-23-cwd-browse-tab-drill.md +0 -393
  75. package/docs/superpowers/plans/2026-09-23-terminal-query-forwarding.md +0 -51
  76. package/docs/superpowers/plans/2026-09-23-unconditional-detach-key.md +0 -58
  77. package/docs/superpowers/plans/2026-09-24-control-reconcile-flake.md +0 -698
  78. package/docs/superpowers/plans/2026-09-24-probe-attached-clients.md +0 -605
  79. package/docs/superpowers/plans/2026-09-29-issue-145-holding-semantic-state.md +0 -1183
  80. package/docs/superpowers/plans/2026-09-29-issue-145-user-verification.md +0 -66
  81. package/docs/superpowers/plans/2026-09-30-board-delete-key-x-y-confirm.md +0 -649
  82. package/docs/superpowers/plans/2026-09-30-issue-153-runner-stop-boot-window.md +0 -618
  83. package/docs/superpowers/plans/2026-09-30-issue-95-test-discipline.md +0 -555
  84. package/docs/superpowers/plans/2026-09-30-publish-dispatch-tag-check.md +0 -259
  85. package/docs/superpowers/plans/2026-10-06-attach-settle-scheme-delivery.md +0 -751
  86. package/docs/superpowers/plans/2026-10-09-issue-167-attach-middle-paste.md +0 -509
  87. package/docs/superpowers/plans/2026-10-09-issue-169-fullscreen-mouse-ownership.md +0 -346
  88. package/docs/superpowers/plans/2026-10-10-attach-delete-in-place.md +0 -832
  89. package/docs/superpowers/plans/2026-10-10-issue-174-selection-mirror-paste-source.md +0 -510
  90. package/docs/superpowers/plans/2026-10-14-issue-170-attach-reply-guard.md +0 -771
  91. package/docs/superpowers/plans/2026-10-14-issue-178-accept-registration-race.md +0 -1257
  92. package/docs/superpowers/plans/2026-10-14-issue-184-snapshot-window-contract.md +0 -657
  93. package/docs/superpowers/plans/2026-10-14-issue-185-attach-wheel-alt-screen.md +0 -47
  94. package/docs/superpowers/plans/2026-10-14-issue-187-motionless-drag.md +0 -931
  95. package/docs/superpowers/plans/2026-10-14-issue-189-mixed-input-segments.md +0 -823
  96. package/docs/superpowers/plans/2026-10-15-issue-188-x10-mouse-release.md +0 -526
  97. package/docs/superpowers/plans/2026-10-16-issue-198-attach-wheel-forward-fallback.md +0 -32
  98. package/docs/superpowers/plans/2026-10-18-attach-wheel-replay-pseudo-scrollback.md +0 -437
  99. package/docs/superpowers/plans/2026-10-19-issue-213-reply-guard-csi-key.md +0 -257
  100. package/docs/superpowers/plans/2026-10-19-issue-214-attach-forward-alt-modifier.md +0 -202
  101. package/docs/superpowers/plans/2026-10-21-issue-221-ask-user-question.md +0 -198
  102. package/docs/superpowers/plans/2026-10-23-issue-222-attach-ready.md +0 -290
  103. package/docs/superpowers/plans/2026-10-23-issue-225-monotonic-foreground-state.md +0 -450
  104. package/docs/superpowers/plans/2026-10-23-issue-229-vim-jkl.md +0 -449
  105. package/docs/superpowers/plans/2026-10-23-issue-232-attach-bg-only-cells.md +0 -153
  106. package/docs/superpowers/plans/2026-10-23-lease-heartbeat-staleness.md +0 -537
  107. package/docs/superpowers/plans/2026-10-23-selected-row-highlight.md +0 -405
  108. package/docs/superpowers/plans/2026-10-24-issue-217-windows-pid-reuse-stopping.md +0 -367
  109. package/docs/superpowers/plans/2026-10-24-issue-230-warm-host-background-runs.md +0 -806
  110. package/docs/superpowers/plans/2026-10-24-issue-238-windows-process-identity-token.md +0 -490
  111. package/docs/superpowers/plans/2026-10-24-issue-241-coordinator-root-exit.md +0 -461
  112. package/docs/superpowers/plans/2026-10-25-issue-239-coordinator-replacement-identity.md +0 -504
  113. package/docs/superpowers/plans/2026-10-26-issue-245-key-hints-doc-sync.md +0 -244
  114. package/docs/superpowers/plans/2026-10-27-issue-172-fullscreen-selection-clear.md +0 -344
  115. package/docs/superpowers/plans/2026-10-27-issue-252-select-key-hints.md +0 -209
  116. package/docs/superpowers/plans/2026-10-28-issue-255-coordinator-endpoint-zombie.md +0 -442
  117. package/docs/superpowers/plans/2026-10-28-issue-257-legacy-pty-runner-endpoint-cleanup.md +0 -256
  118. package/docs/superpowers/plans/2026-11-03-cwd-favorites-full-pool.md +0 -266
  119. package/docs/superpowers/specs/2026-08-15-screenlog-gc-design.md +0 -105
  120. package/docs/superpowers/specs/2026-08-16-attach-double-cursor-jiggle-retry-design.md +0 -142
  121. package/docs/superpowers/specs/2026-08-21-attach-coldstart-jiggle-rearm-design.md +0 -110
  122. package/docs/superpowers/specs/2026-08-21-dashboard-keypress-lag-design.md +0 -59
  123. package/docs/superpowers/specs/2026-08-21-issue-14-needs-input-no-auto-done-design.md +0 -109
  124. package/docs/superpowers/specs/2026-08-22-cwd-favorites-design.md +0 -131
  125. package/docs/superpowers/specs/2026-08-22-jiggle-shrink-and-hold-design.md +0 -111
  126. package/docs/superpowers/specs/2026-08-22-question-tool-grouping-design.md +0 -114
  127. package/docs/superpowers/specs/2026-08-22-rename-state-labels-design.md +0 -80
  128. package/docs/superpowers/specs/2026-08-27-locks-acquirelock-spin-design.md +0 -97
  129. package/docs/superpowers/specs/2026-08-27-pty-runner-test-flaky-design.md +0 -35
  130. package/docs/superpowers/specs/2026-08-29-code-refs-badges-design.md +0 -128
  131. package/docs/superpowers/specs/2026-08-30-circular-navigation-design.md +0 -47
  132. package/docs/superpowers/specs/2026-08-30-eprm-atomicwrite-race-design.md +0 -77
  133. package/docs/superpowers/specs/2026-08-30-post-exit-timing-fix-design.md +0 -80
  134. package/docs/superpowers/specs/2026-08-30-pty-attach-quality-debt-design.md +0 -105
  135. package/docs/superpowers/specs/2026-08-30-readme-v2-design.md +0 -115
  136. package/docs/superpowers/specs/2026-09-01-attach-detach-gate-cursor-anchor-design.md +0 -78
  137. package/docs/superpowers/specs/2026-09-02-attach-detach-editor-state-design.md +0 -120
  138. package/docs/superpowers/specs/2026-09-03-code-refs-pr-backlink-narrow-design.md +0 -92
  139. package/docs/superpowers/specs/2026-09-03-detach-gate-glyph-fallback-design.md +0 -99
  140. package/docs/superpowers/specs/2026-09-04-evidence-outputpreview-design.md +0 -50
  141. package/docs/superpowers/specs/2026-09-04-warm-host-reclaim-design.md +0 -106
  142. package/docs/superpowers/specs/2026-09-05-issue-13-drainnextfollowup-pty-probe-design.md +0 -64
  143. package/docs/superpowers/specs/2026-09-05-issue-38-windows-wezterm-ime-design.md +0 -48
  144. package/docs/superpowers/specs/2026-09-05-issue-39-truncate-codepoint-boundary-design.md +0 -64
  145. package/docs/superpowers/specs/2026-09-05-issue-61-mention-fallback-design.md +0 -71
  146. package/docs/superpowers/specs/2026-09-05-issue-63-flaky-manual-completion-design.md +0 -49
  147. package/docs/superpowers/specs/2026-09-05-issue-64-changelog-helper-design.md +0 -76
  148. package/docs/superpowers/specs/2026-09-05-pty-host-stacking-sock-race-design.md +0 -510
  149. package/docs/superpowers/specs/2026-09-07-issue-11-attach-runtime-desync-heal-design.md +0 -130
  150. package/docs/superpowers/specs/2026-09-08-attach-ctrl-left-detach-design.md +0 -58
  151. package/docs/superpowers/specs/2026-09-08-dashboard-shrink-repaint-design.md +0 -52
  152. package/docs/superpowers/specs/2026-09-08-legacy-stale-host-recovery-design.md +0 -87
  153. package/docs/superpowers/specs/2026-09-08-spawn-async-error-swallow-design.md +0 -56
  154. package/docs/superpowers/specs/2026-09-08-stale-model-attach-guard-design.md +0 -79
  155. package/docs/superpowers/specs/2026-09-09-claimpid-blocks-replace-design.md +0 -147
  156. package/docs/superpowers/specs/2026-09-09-harden-runner-architecture-design.md +0 -304
  157. package/docs/superpowers/specs/2026-09-14-attach-cursor-dectcem-gate-design.md +0 -114
  158. package/docs/superpowers/specs/2026-09-14-host-meta-orphan-lock-design.md +0 -120
  159. package/docs/superpowers/specs/2026-09-14-issue-106-terminal-frame-cognition-design.md +0 -146
  160. package/docs/superpowers/specs/2026-09-14-issue-113-foreground-preview-race-design.md +0 -116
  161. package/docs/superpowers/specs/2026-09-15-coordinator-pipe-root-normalize-design.md +0 -84
  162. package/docs/superpowers/specs/2026-09-15-lease-publish-eprem-reclaim-design.md +0 -92
  163. package/docs/superpowers/specs/2026-09-18-detach-anchor-reporter-endpoint-design.md +0 -123
  164. package/docs/superpowers/specs/2026-09-20-issue-121-perf-gate-out-of-coverage-design.md +0 -204
  165. package/docs/superpowers/specs/2026-09-23-a5-mid-stream-assertion-design.md +0 -43
  166. package/docs/superpowers/specs/2026-09-23-cwd-browse-tab-drill-design.md +0 -95
  167. package/docs/superpowers/specs/2026-09-23-terminal-query-forwarding-design.md +0 -63
  168. package/docs/superpowers/specs/2026-09-23-unconditional-detach-key-design.md +0 -57
  169. package/docs/superpowers/specs/2026-09-24-control-reconcile-flake-design.md +0 -98
  170. package/docs/superpowers/specs/2026-09-24-probe-attached-clients-design.md +0 -190
  171. package/docs/superpowers/specs/2026-09-29-issue-145-holding-semantic-state-design.md +0 -394
  172. package/docs/superpowers/specs/2026-09-30-board-delete-key-x-y-confirm-design.md +0 -86
  173. package/docs/superpowers/specs/2026-09-30-issue-153-runner-stop-boot-window-design.md +0 -75
  174. package/docs/superpowers/specs/2026-09-30-issue-95-test-discipline-design.md +0 -226
  175. package/docs/superpowers/specs/2026-09-30-publish-dispatch-tag-check-design.md +0 -129
  176. package/docs/superpowers/specs/2026-10-06-attach-settle-scheme-delivery-design.md +0 -196
  177. package/docs/superpowers/specs/2026-10-09-issue-167-attach-middle-paste-design.md +0 -125
  178. package/docs/superpowers/specs/2026-10-09-issue-169-fullscreen-mouse-ownership-design.md +0 -130
  179. package/docs/superpowers/specs/2026-10-10-attach-delete-in-place-design.md +0 -224
  180. package/docs/superpowers/specs/2026-10-10-issue-174-selection-mirror-paste-source-design.md +0 -154
  181. package/docs/superpowers/specs/2026-10-14-issue-170-attach-reply-guard-design.md +0 -195
  182. package/docs/superpowers/specs/2026-10-14-issue-178-accept-registration-race-design.md +0 -287
  183. package/docs/superpowers/specs/2026-10-14-issue-184-snapshot-window-contract-design.md +0 -288
  184. package/docs/superpowers/specs/2026-10-14-issue-185-attach-wheel-alt-screen-design.md +0 -126
  185. package/docs/superpowers/specs/2026-10-14-issue-187-motionless-drag-design.md +0 -269
  186. package/docs/superpowers/specs/2026-10-14-issue-189-mixed-input-segments-design.md +0 -369
  187. package/docs/superpowers/specs/2026-10-15-issue-188-x10-mouse-release-design.md +0 -252
  188. package/docs/superpowers/specs/2026-10-16-issue-198-attach-wheel-forward-fallback-design.md +0 -67
  189. package/docs/superpowers/specs/2026-10-18-attach-wheel-replay-pseudo-scrollback-design.md +0 -250
  190. package/docs/superpowers/specs/2026-10-19-issue-213-reply-guard-csi-key-design.md +0 -165
  191. package/docs/superpowers/specs/2026-10-19-issue-214-attach-forward-alt-modifier-design.md +0 -131
  192. package/docs/superpowers/specs/2026-10-20-issue-221-ask-user-question-design.md +0 -270
  193. package/docs/superpowers/specs/2026-10-22-issue-225-monotonic-foreground-state-design.md +0 -225
  194. package/docs/superpowers/specs/2026-10-23-issue-222-attach-ready-design.md +0 -204
  195. package/docs/superpowers/specs/2026-10-23-issue-229-vim-jkl-design.md +0 -90
  196. package/docs/superpowers/specs/2026-10-23-issue-232-attach-bg-only-cells-design.md +0 -146
  197. package/docs/superpowers/specs/2026-10-23-lease-heartbeat-staleness-design.md +0 -271
  198. package/docs/superpowers/specs/2026-10-23-selected-row-highlight-design.md +0 -191
  199. package/docs/superpowers/specs/2026-10-24-issue-217-windows-pid-reuse-stopping-design.md +0 -334
  200. package/docs/superpowers/specs/2026-10-24-issue-230-warm-host-background-runs-design.md +0 -283
  201. package/docs/superpowers/specs/2026-10-24-issue-238-windows-process-identity-token-design.md +0 -286
  202. package/docs/superpowers/specs/2026-10-24-issue-241-coordinator-root-exit-design.md +0 -381
  203. package/docs/superpowers/specs/2026-10-25-issue-239-coordinator-replacement-identity-design.md +0 -331
  204. package/docs/superpowers/specs/2026-10-26-issue-245-key-hints-doc-sync-design.md +0 -72
  205. package/docs/superpowers/specs/2026-10-27-issue-172-fullscreen-selection-clear-design.md +0 -248
  206. package/docs/superpowers/specs/2026-10-27-issue-252-select-key-hints-design.md +0 -95
  207. package/docs/superpowers/specs/2026-10-28-issue-255-coordinator-endpoint-zombie-design.md +0 -380
  208. package/docs/superpowers/specs/2026-10-28-issue-257-legacy-pty-runner-endpoint-cleanup-design.md +0 -197
  209. package/docs/superpowers/specs/2026-11-03-cwd-favorites-full-pool-design.md +0 -106
  210. package/scripts/budget-audit.mjs +0 -135
  211. package/scripts/patch-vulns.mjs +0 -59
  212. package/scripts/release.mjs +0 -446
  213. package/scripts/release_helper.mjs +0 -309
  214. package/scripts/run-perf-gate.mjs +0 -40
  215. package/scripts/run-tests.mjs +0 -375
@@ -1,259 +0,0 @@
1
- # publish.yml dispatch 恢复后门 tag 来源修复 Implementation Plan
2
-
3
- > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
-
5
- **Goal:** 让 `publish.yml` 的 tag 自检步骤从事件负载 / dispatch 输入取 tag(而非 ref 名),使 `docs/RELEASE.md` 记载的手动恢复路径按字面操作即可成功。
6
-
7
- **Architecture:** 三行 YAML 改动(自检步骤经 `env:` 接收与 checkout 同源的表达式)+ 一个新静态测试锁定不变量「publish.yml 不得从 ref 名派生 tag」。行为验证靠真实 `workflow_dispatch` run(正向 + 护栏负向),因为本仓无 YAML 级测试设施。
8
-
9
- **Tech Stack:** GitHub Actions workflow YAML(`workflow_dispatch` + `release: published` 双触发)、`node:test` + `assert/strict`、`gh` CLI。
10
-
11
- **Spec:** `docs/superpowers/specs/2026-09-30-publish-dispatch-tag-check-design.md`
12
-
13
- **Worktree:** `/home/elling/work/git-repo/pi-agent-board/.pi/worktrees/issue-154-publish-workflow-dispatch-tag-check`(分支 `issue-154-publish-workflow-dispatch-tag-check`,基线 `444199d`)。下文所有路径以 `$WT` 代指该 worktree 根。
14
-
15
- ## Global Constraints
16
-
17
- - 只改 `.github/workflows/publish.yml` 的自检步骤(`:54-59`)与新增 `test/publish-workflow.test.mjs`;**不改** checkout 表达式、`scripts/release.mjs`、`docs/RELEASE.md`、release 事件路径行为。
18
- - 表达式必须经 `env:` 中转,不得把 `${{ }}` 直接写进 `run` 脚本(避免表达式拼接进 shell)。
19
- - tag 派生表达式逐字使用:`${{ github.event.release.tag_name || inputs.tag }}`;去 `v` 前缀方式保持 `${RELEASE_TAG#v}`。
20
- - 测试文件遵循既有约定:`node:test` + `assert/strict`、**Tab 缩进**、文件名 `test/*.test.mjs`、仓库根用 `fileURLToPath(new URL("..", import.meta.url))`。
21
- - 静态测试只断言「否定式不变量(剥整行注释后不得出现 `GITHUB_REF_NAME`)+ 正向表达式计数 ≥2」,不断言 YAML 结构 / 步骤名(避免重构假红)。
22
- - TDD:Task 1 的测试必须在当前未修复文件上先红,Task 2 修完再绿。
23
- - 提交按文件 `git add <file>`,不用 `git add -A`;commit message 用英文 conventional 格式。
24
- - push / 开 PR 前必须获得用户明确许可(用户 AGENTS.md 硬规则)。
25
- - 探针 tag 不得使用 `v*` 前缀(`release.mjs:207` / `release_helper.mjs:182` 以 `git describe --tags --match v*` 定 changelog 基线,`v*` 探针泄漏会污染下一次发版)。
26
-
27
- ## Review Focus
28
-
29
- 本改动的输入类别与失败模式,按最可能踩到的顺序:
30
-
31
- 1. **dispatch 的 ref 是分支、而 tag 输入是 tag**(原始 bug 形状)→ 期望:自检通过。由 Task 3 的 A1 覆盖(`--ref issue-154-...` + `-f tag=v0.9.0`)。
32
- 2. **tag 输入与 checkout 出来的 `package.json` 不一致** → 期望:自检 fail-closed,不得静默发布。由 Task 3 的 A2 覆盖(探针 tag `issue-154-mismatch-probe`——checkout 跟随 `inputs.tag`,错配只能人为制造)。
33
- 3. **回归:有人把 tag 来源重新写成 ref 名派生** → 期望:静态测试红。由 Task 1 的 A3 覆盖。
34
- 4. **release 事件自动路径被改坏** → 期望:行为不变(原 `GITHUB_REF_NAME` 在该路径恰好等于 tag)。本 fix 不改变该路径的输入来源,但**无法在本地验证**,只能由下一次真实发版观察(Task 3 的 U1,标注 pending)。
35
- 5. **`-f tag=` 传了不带 `v` 前缀的值**(如 `0.9.0`):`${RELEASE_TAG#v}` 成为空操作。期望:因本仓所有 tag 均带 `v` 前缀,checkout 无法解析该 ref 而 fail-closed,不会走到自检或发布。此行为**不由本 fix 引入也不受其影响**,故不新增测试,记录于此以免被误认为遗漏。
36
-
37
- ---
38
-
39
- ### Task 1: 静态守卫测试(A3 · 先红)
40
-
41
- **Files:**
42
- - Create: `$WT/test/publish-workflow.test.mjs`
43
-
44
- **Interfaces:**
45
- - Consumes: 无(直接读仓库文件)
46
- - Produces: 无(测试文件内部 helper,不被其他任务消费)
47
-
48
- - [ ] **Step 1: 写测试文件**
49
-
50
- 创建 `$WT/test/publish-workflow.test.mjs`(注意 Tab 缩进):
51
-
52
- ```js
53
- import assert from "node:assert/strict";
54
- import { readFileSync } from "node:fs";
55
- import { join } from "node:path";
56
- import { test } from "node:test";
57
- import { fileURLToPath } from "node:url";
58
-
59
- const PACKAGE_ROOT = fileURLToPath(new URL("..", import.meta.url));
60
-
61
- /**
62
- * The tag a publish run works on comes from the trigger, not from the ref the
63
- * run was started on: a published GitHub Release carries it in
64
- * `github.event.release.tag_name`, a manual `workflow_dispatch` recovery run
65
- * carries it in `inputs.tag`. Deriving it from `GITHUB_REF_NAME` breaks every
66
- * manual recovery run, because that variable holds the *branch* the run was
67
- * dispatched from (issue #154).
68
- *
69
- * The expression must appear in BOTH the checkout step and the tag-check
70
- * step: deleting the check step's `env:` block must fail this suite, so the
71
- * count is asserted, not just presence.
72
- */
73
- const TAG_SOURCE = /github\.event\.release\.tag_name\s*\|\|\s*inputs\.tag/g;
74
-
75
- /**
76
- * Read a workflow file as text -- the only side effect in this file. Full-line
77
- * comments are stripped so prose about this invariant (e.g. a comment warning
78
- * against ref-name derivation) cannot trip the guard.
79
- */
80
- function readWorkflowSource(name) {
81
- const raw = readFileSync(join(PACKAGE_ROOT, ".github", "workflows", name), "utf8");
82
- return raw
83
- .split("\n")
84
- .filter((line) => !line.trimStart().startsWith("#"))
85
- .join("\n");
86
- }
87
-
88
- test("publish.yml never derives the release tag from the run's ref", () => {
89
- const source = readWorkflowSource("publish.yml");
90
- assert.equal(
91
- source.includes("GITHUB_REF_NAME"),
92
- false,
93
- "publish.yml must not use GITHUB_REF_NAME: on a workflow_dispatch run it holds the branch name, not the tag (issue #154)",
94
- );
95
- });
96
-
97
- test("publish.yml derives the release tag from the event payload or dispatch input in both places", () => {
98
- const source = readWorkflowSource("publish.yml");
99
- const uses = source.match(TAG_SOURCE)?.length ?? 0;
100
- assert.ok(
101
- uses >= 2,
102
- `expected the tag source in both the checkout step and the tag-check step (>= 2 occurrences), found ${uses}`,
103
- );
104
- });
105
- ```
106
-
107
- - [ ] **Step 2: 运行,确认第一个测试红、第二个绿**
108
-
109
- Run:
110
- ```bash
111
- cd $WT && node --test test/publish-workflow.test.mjs
112
- ```
113
- Expected: `pass 0` / `fail 2` —— 两条断言都红:`GITHUB_REF_NAME` 仍在 `:57`;表达式当前只在 checkout(`:32`)出现 1 次,不满足 ≥2。两条都转绿只能发生在 Task 2 修复之后。
114
-
115
- - [ ] **Step 3: 提交(红态)**
116
-
117
- ```bash
118
- cd $WT && git add test/publish-workflow.test.mjs && git commit -m "test(ci): pin publish.yml tag source invariant (issue #154)"
119
- ```
120
-
121
- ---
122
-
123
- ### Task 2: 修自检步骤的 tag 来源(A1 核心 · 转绿)
124
-
125
- **Files:**
126
- - Modify: `$WT/.github/workflows/publish.yml:54-59`
127
-
128
- **Interfaces:**
129
- - Consumes: Task 1 的静态测试(作为绿灯判据)
130
- - Produces: 环境变量 `RELEASE_TAG`(仅该 step 内可见),值来自 `github.event.release.tag_name || inputs.tag`
131
-
132
- - [ ] **Step 1: 改自检步骤**
133
-
134
- 把 `.github/workflows/publish.yml` 的自检步骤替换为(原文 6 行 → 新文 8 行,新增 `env:` 块、`GITHUB_REF_NAME` 换成 `RELEASE_TAG`):
135
-
136
- ```yaml
137
- - name: Check the tag matches package.json
138
- env:
139
- RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
140
- run: |
141
- PKG_VERSION=$(node -p "require('./package.json').version")
142
- TAG_VERSION="${RELEASE_TAG#v}"
143
- echo "package.json: ${PKG_VERSION}, tag: ${TAG_VERSION}"
144
- [ "${PKG_VERSION}" = "${TAG_VERSION}" ]
145
- ```
146
-
147
- - [ ] **Step 2: 单独跑静态测试,确认双绿**
148
-
149
- Run:
150
- ```bash
151
- cd $WT && node --test test/publish-workflow.test.mjs
152
- ```
153
- Expected: `pass 2` / `fail 0`。
154
-
155
- - [ ] **Step 3: 跑全量测试,确认无回归**
156
-
157
- Run:
158
- ```bash
159
- cd $WT && npm test
160
- ```
161
- Expected: 全绿(含既有 13 个 release-flow 测试)。
162
-
163
- - [ ] **Step 4: 目视确认 diff 只碰这两处**
164
-
165
- Run:
166
- ```bash
167
- cd $WT && git diff --stat && git diff .github/workflows/publish.yml
168
- ```
169
- Expected: 只有 `publish.yml` 一处改动(另加 Task 1 已提交的测试文件不在本次 diff 内);diff 中除 `env:` 块与 `${RELEASE_TAG#v}` 外无其他变化。
170
-
171
- - [ ] **Step 5: 提交**
172
-
173
- ```bash
174
- cd $WT && git add .github/workflows/publish.yml && git commit -m "fix(ci): read the dispatch recovery tag from inputs, not the ref name (issue #154)"
175
- ```
176
-
177
- ---
178
-
179
- ### Task 3: 验收取证(A4 · A1a · A2 · U1,A1b 合并后补验)
180
-
181
- **Files:**
182
- - 不修改任何文件;产出证据记录(写入 issue 评论,必要时追加到 spec 的验收结论段)
183
-
184
- **Interfaces:**
185
- - Consumes: Task 2 的分支状态(`--ref` 必须指向本分支,才能跑到修好的 workflow 定义)
186
- - Produces: 每个验收 ID 的实际命令与结果字符串
187
-
188
- > **机制说明(决定命令怎么写)**:`gh workflow run --ref <ref>` 运行的**是该 ref 上的 workflow 定义**(ref 在远端解析,本地分支不可见),而 checkout 用的是 `inputs.tag`。所以验收 dispatch 必须 `--ref issue-154-publish-workflow-dispatch-tag-check`(本分支,含修复);这正是原始 bug 的形状——ref 是分支、tag 来自输入。
189
-
190
- - [ ] **Step 0: 推分支到 origin(用户许可门禁)**
191
-
192
- ```bash
193
- cd $WT && git push -u origin issue-154-publish-workflow-dispatch-tag-check
194
- ```
195
- Expected: 远端出现同名分支。**没有这一步,后续 `--ref issue-154-...` 会因远端无此 ref 报「workflow/ref not found」类错误。** 此 push 与后续开 PR 共用同一次用户许可。
196
-
197
- - [ ] **Step 1: A4 —— 完整校验**
198
-
199
- Run:
200
- ```bash
201
- cd $WT && npm run verify
202
- ```
203
- Expected: typecheck + perf gate + 全量测试 + 覆盖率阈值 + pack dry-run 全绿。记录覆盖率三行数字。
204
-
205
- - [ ] **Step 2: A1a —— 正向:从分支 ref 触发、tag=v0.9.0 应通过并走 skip 分支**
206
-
207
- Run:
208
- ```bash
209
- cd $WT && gh workflow run publish.yml -f tag=v0.9.0 --ref issue-154-publish-workflow-dispatch-tag-check
210
- sleep 8 && gh run list --workflow=publish.yml --limit 4
211
- ```
212
- Expected: 新 run 出现;随后取该 run 的日志:
213
- ```bash
214
- gh run view <run-id> --log | grep -E "package.json:|already published|Publishing to"
215
- ```
216
- Expected: `package.json: 0.9.0, tag: 0.9.0`;`@zhuxixi/pi-agent-board@0.9.0 is already published — skipping the publish step`;**无** `Publishing to https://registry.npmjs.org`(证明零发布风险)。整 run `success`。注意:本条只证明修复生效 + skip 分支,**恢复路径的 `npm publish` 环节本次不执行**(与 release 路径共用、未改动,见 spec §5 A1a 行注记)。
217
-
218
- - [ ] **Step 3: A2 —— 负向:护栏仍然会对不一致的 tag fail-closed**
219
-
220
- 先建探针 tag(指向分支 HEAD:该提交的 `package.json` 是 0.9.0,而 tag 名不是版本号,二者必然不一致;**tag 名不带 `v` 前缀**,避免落入 release 工具链的 `v*` 基线通配):
221
-
222
- ```bash
223
- cd $WT && git tag issue-154-mismatch-probe && git push origin issue-154-mismatch-probe
224
- ```
225
- > ⚠️ 此 push 需要用户许可;与 Step 0 的分支 push 共用同一次许可。
226
-
227
- ```bash
228
- cd $WT && gh workflow run publish.yml -f tag=issue-154-mismatch-probe --ref issue-154-publish-workflow-dispatch-tag-check
229
- sleep 8 && gh run list --workflow=publish.yml --limit 4
230
- gh run view <run-id> --log-failed | grep -E "package.json:|error|exit code"
231
- ```
232
- Expected: 自检步骤 `package.json: 0.9.0, tag: issue-154-mismatch-probe`(`${RELEASE_TAG#v}` 对无 `v` 前缀的 tag 名是空操作)→ `##[error]Process completed with exit code 1`;run `failure`。**证明护栏没被改成「永远通过」。**
233
-
234
- 清理探针 tag(本地 + 远端,远端以 ls-remote 为准):
235
-
236
- ```bash
237
- cd $WT && git push origin --delete issue-154-mismatch-probe && git tag -d issue-154-mismatch-probe
238
- git ls-remote --tags origin | grep issue-154-mismatch-probe
239
- ```
240
- Expected: 第二条 grep **无输出**(远端已删);`git tag --list 'issue-154-*'` 本地为空。
241
-
242
- - [ ] **Step 4: U1 —— release 事件路径(本任务不执行,标注 pending)**
243
-
244
- 记录:release 事件路径的输入来源未被本 fix 改变(仍为 `github.event.release.tag_name`),但**无法在不真实发版的前提下验证**。因此 U1 在 PR 描述与 issue 评论中标记为 `pending`,由下一个版本(0.10.0)的真实发版观察 `tag: 0.10.0` 且 publish 成功。**不得宣称 U1 已通过。**
245
-
246
- - [ ] **Step 5: 证据登记**
247
-
248
- 把 Step 0–4 的实际命令与结果(含 run id、run URL、关键日志行)评论到 issue #154,并对每个验收 ID 标注 `passed` / `pending`。
249
-
250
- - [ ] **Step 6: A1b —— 合并后按文档字面路径复跑一次(post-merge)**
251
-
252
- PR 合并进 main 后(`git checkout main && git pull`),按 `docs/RELEASE.md:117-118` 的字面操作跑一遍:
253
-
254
- ```bash
255
- gh workflow run publish.yml -f tag=v0.9.0 --ref main
256
- sleep 8 && gh run list --workflow=publish.yml --limit 4
257
- gh run view <run-id> --log | grep -E "package.json:|already published"
258
- ```
259
- Expected: `package.json: 0.9.0, tag: 0.9.0`;命中 skip 分支;run `success`。这一步验证的不是修复本身,而是**文档承诺的路径从用户视角成立**(ref=main、只填 tag)。结果同样登记到 issue #154。