@fantasticit/sumi 0.13.0 → 0.14.1

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 (458) hide show
  1. package/README.md +7 -7
  2. package/dist/adapters.d.ts +3 -27
  3. package/dist/adapters.js +75 -134
  4. package/dist/adapters.js.map +1 -1
  5. package/dist/agent-hooks.d.ts +32 -11
  6. package/dist/agent-hooks.js +546 -194
  7. package/dist/agent-hooks.js.map +1 -1
  8. package/dist/agents.d.ts +1 -3
  9. package/dist/agents.js +12 -15
  10. package/dist/agents.js.map +1 -1
  11. package/dist/bin.js +14 -10
  12. package/dist/bin.js.map +1 -1
  13. package/dist/cli.d.ts +1 -1
  14. package/dist/cli.js +135 -7
  15. package/dist/cli.js.map +1 -1
  16. package/dist/compaction-marker.d.ts +4 -0
  17. package/dist/compaction-marker.js +37 -0
  18. package/dist/compaction-marker.js.map +1 -0
  19. package/dist/config-text.d.ts +1 -1
  20. package/dist/config-text.js +21 -13
  21. package/dist/config-text.js.map +1 -1
  22. package/dist/constraint-list.js +1 -1
  23. package/dist/constraint-list.js.map +1 -1
  24. package/dist/context-providers.js +12 -0
  25. package/dist/context-providers.js.map +1 -0
  26. package/dist/context.js +49 -51
  27. package/dist/context.js.map +1 -1
  28. package/dist/declared-hooks.d.ts +29 -0
  29. package/dist/declared-hooks.js +99 -0
  30. package/dist/declared-hooks.js.map +1 -0
  31. package/dist/hook-output.d.ts +3 -0
  32. package/dist/hook-output.js +5 -0
  33. package/dist/hook-output.js.map +1 -0
  34. package/dist/hook-routing.d.ts +29 -1
  35. package/dist/hook-routing.js +106 -15
  36. package/dist/hook-routing.js.map +1 -1
  37. package/dist/host-adapters.d.ts +32 -0
  38. package/dist/host-adapters.js +97 -0
  39. package/dist/host-adapters.js.map +1 -0
  40. package/dist/instructions.js +7 -5
  41. package/dist/instructions.js.map +1 -1
  42. package/dist/launcher.cjs +350 -158
  43. package/dist/launcher.js +13 -2
  44. package/dist/launcher.js.map +1 -1
  45. package/dist/run-stats.d.ts +6 -0
  46. package/dist/run-stats.js +44 -3
  47. package/dist/run-stats.js.map +1 -1
  48. package/dist/scaffold-commands.js +18 -7
  49. package/dist/scaffold-commands.js.map +1 -1
  50. package/dist/stop-hint.d.ts +4 -0
  51. package/dist/stop-hint.js +29 -0
  52. package/dist/stop-hint.js.map +1 -0
  53. package/dist/subagent-history.d.ts +2 -0
  54. package/dist/subagent-history.js +35 -0
  55. package/dist/subagent-history.js.map +1 -0
  56. package/dist/task.js +45 -37
  57. package/dist/task.js.map +1 -1
  58. package/dist/vendor.js +10 -4
  59. package/dist/vendor.js.map +1 -1
  60. package/dist/visualize-page.js +2 -25
  61. package/dist/visualize-page.js.map +1 -1
  62. package/node_modules/@sumi/create/dist/scaffold.js +5 -4
  63. package/node_modules/@sumi/create/dist/scaffold.js.map +1 -1
  64. package/node_modules/@sumi/create/package.json +2 -2
  65. package/node_modules/@sumi/create/template/AGENTS.md +1 -1
  66. package/node_modules/@sumi/create/template/control/config.yaml +3 -0
  67. package/node_modules/@sumi/create/template/control/flows/change.flow.yaml +8 -5
  68. package/node_modules/@sumi/create/template/control/flows/check.flow.yaml +7 -21
  69. package/node_modules/@sumi/create/template/control/rubrics/behavior.yaml +14 -1
  70. package/node_modules/@sumi/create/template/control/rubrics/omission.yaml +1 -1
  71. package/node_modules/@sumi/create/template/control/rubrics/{clean-code.yaml → quality.yaml} +12 -4
  72. package/node_modules/@sumi/create/template/control/rules/boundaries.md +25 -0
  73. package/node_modules/@sumi/create/template/control/rules/codecheck.md +1 -1
  74. package/node_modules/@sumi/create/template/control/rules/development.md +7 -2
  75. package/node_modules/@sumi/create/template/init/AGENTS.md +1 -1
  76. package/node_modules/@sumi/create/template/init/control/flows/change.flow.yaml +7 -4
  77. package/node_modules/@sumi/create/template/init/control/flows/check.flow.yaml +3 -0
  78. package/node_modules/@sumi/create/template/init/control/rubrics/behavior.yaml +30 -0
  79. package/node_modules/@sumi/create/template/init/control/rubrics/omission.yaml +13 -0
  80. package/node_modules/@sumi/create/template/init/control/rubrics/quality.yaml +22 -0
  81. package/node_modules/@sumi/create/template/init/control/rubrics/security.yaml +20 -0
  82. package/node_modules/@sumi/create/template/init/openspec/config.yaml +6 -0
  83. package/node_modules/@sumi/create/template/openspec/config.yaml +6 -0
  84. package/node_modules/@sumi/kernel/dist/config.d.ts +19 -0
  85. package/node_modules/@sumi/kernel/dist/config.js +72 -17
  86. package/node_modules/@sumi/kernel/dist/config.js.map +1 -1
  87. package/node_modules/@sumi/kernel/dist/context-providers.d.ts +17 -0
  88. package/node_modules/@sumi/kernel/dist/context-providers.js +74 -0
  89. package/node_modules/@sumi/kernel/dist/context-providers.js.map +1 -0
  90. package/node_modules/@sumi/kernel/dist/engine.js +119 -71
  91. package/node_modules/@sumi/kernel/dist/engine.js.map +1 -1
  92. package/node_modules/@sumi/kernel/dist/flow.d.ts +7 -0
  93. package/node_modules/@sumi/kernel/dist/flow.js +16 -0
  94. package/node_modules/@sumi/kernel/dist/flow.js.map +1 -1
  95. package/node_modules/@sumi/kernel/dist/index.d.ts +3 -0
  96. package/node_modules/@sumi/kernel/dist/index.js +3 -0
  97. package/node_modules/@sumi/kernel/dist/index.js.map +1 -1
  98. package/node_modules/@sumi/kernel/dist/plan.d.ts +12 -0
  99. package/node_modules/@sumi/kernel/dist/plan.js.map +1 -1
  100. package/node_modules/@sumi/kernel/dist/record.d.ts +10 -1
  101. package/node_modules/@sumi/kernel/dist/record.js +133 -3
  102. package/node_modules/@sumi/kernel/dist/record.js.map +1 -1
  103. package/node_modules/@sumi/kernel/dist/resume.d.ts +3 -1
  104. package/node_modules/@sumi/kernel/dist/resume.js +35 -27
  105. package/node_modules/@sumi/kernel/dist/resume.js.map +1 -1
  106. package/node_modules/@sumi/kernel/dist/runtime.d.ts +2 -0
  107. package/node_modules/@sumi/kernel/dist/runtime.js +30 -0
  108. package/node_modules/@sumi/kernel/dist/runtime.js.map +1 -0
  109. package/node_modules/@sumi/kernel/dist/scope.d.ts +2 -1
  110. package/node_modules/@sumi/kernel/dist/scope.js +2 -2
  111. package/node_modules/@sumi/kernel/dist/scope.js.map +1 -1
  112. package/node_modules/@sumi/kernel/dist/source-monitor.d.ts +20 -0
  113. package/node_modules/@sumi/kernel/dist/source-monitor.js +105 -0
  114. package/node_modules/@sumi/kernel/dist/source-monitor.js.map +1 -0
  115. package/node_modules/@sumi/kernel/dist/step-cache.d.ts +1 -1
  116. package/node_modules/@sumi/kernel/dist/step-cache.js +62 -51
  117. package/node_modules/@sumi/kernel/dist/step-cache.js.map +1 -1
  118. package/node_modules/@sumi/kernel/dist/step.d.ts +61 -0
  119. package/node_modules/@sumi/kernel/dist/step.js +55 -0
  120. package/node_modules/@sumi/kernel/dist/step.js.map +1 -0
  121. package/node_modules/@sumi/kernel/package.json +6 -2
  122. package/node_modules/@sumi/plugin-sdk/README.md +3 -3
  123. package/node_modules/@sumi/plugin-sdk/dist/context-delivery.d.ts +15 -0
  124. package/node_modules/@sumi/plugin-sdk/dist/context-delivery.js +28 -0
  125. package/node_modules/@sumi/plugin-sdk/dist/context-delivery.js.map +1 -0
  126. package/node_modules/@sumi/plugin-sdk/dist/context-scope.d.ts +2 -0
  127. package/node_modules/@sumi/plugin-sdk/dist/context-scope.js +49 -0
  128. package/node_modules/@sumi/plugin-sdk/dist/context-scope.js.map +1 -0
  129. package/node_modules/@sumi/plugin-sdk/dist/edit-paths.d.ts +2 -0
  130. package/node_modules/@sumi/plugin-sdk/dist/edit-paths.js +54 -0
  131. package/node_modules/@sumi/plugin-sdk/dist/edit-paths.js.map +1 -0
  132. package/node_modules/@sumi/plugin-sdk/dist/files.d.ts +1 -1
  133. package/node_modules/@sumi/plugin-sdk/dist/files.js +64 -13
  134. package/node_modules/@sumi/plugin-sdk/dist/files.js.map +1 -1
  135. package/node_modules/@sumi/plugin-sdk/dist/host-event.d.ts +9 -2
  136. package/node_modules/@sumi/plugin-sdk/dist/host-event.js +41 -16
  137. package/node_modules/@sumi/plugin-sdk/dist/host-event.js.map +1 -1
  138. package/node_modules/@sumi/plugin-sdk/dist/html-page.d.ts +5 -0
  139. package/node_modules/@sumi/plugin-sdk/dist/html-page.js +93 -0
  140. package/node_modules/@sumi/plugin-sdk/dist/html-page.js.map +1 -0
  141. package/node_modules/@sumi/plugin-sdk/dist/html-style.d.ts +1 -0
  142. package/node_modules/@sumi/plugin-sdk/dist/html-style.js +27 -0
  143. package/node_modules/@sumi/plugin-sdk/dist/html-style.js.map +1 -0
  144. package/node_modules/@sumi/plugin-sdk/dist/index.d.ts +7 -0
  145. package/node_modules/@sumi/plugin-sdk/dist/index.js +7 -0
  146. package/node_modules/@sumi/plugin-sdk/dist/index.js.map +1 -1
  147. package/node_modules/@sumi/plugin-sdk/dist/permissions.d.ts +7 -0
  148. package/node_modules/@sumi/plugin-sdk/dist/permissions.js +41 -0
  149. package/node_modules/@sumi/plugin-sdk/dist/permissions.js.map +1 -0
  150. package/node_modules/@sumi/plugin-sdk/dist/project.d.ts +2 -0
  151. package/node_modules/@sumi/plugin-sdk/dist/project.js +2 -0
  152. package/node_modules/@sumi/plugin-sdk/dist/project.js.map +1 -1
  153. package/node_modules/@sumi/plugin-sdk/dist/protocol.d.ts +39 -4
  154. package/node_modules/@sumi/plugin-sdk/dist/protocol.js +12 -4
  155. package/node_modules/@sumi/plugin-sdk/dist/protocol.js.map +1 -1
  156. package/node_modules/@sumi/plugin-sdk/dist/sdk.js +3 -1
  157. package/node_modules/@sumi/plugin-sdk/dist/sdk.js.map +1 -1
  158. package/node_modules/@sumi/plugin-sdk/dist/session-context.d.ts +26 -1
  159. package/node_modules/@sumi/plugin-sdk/dist/session-context.js +98 -17
  160. package/node_modules/@sumi/plugin-sdk/dist/session-context.js.map +1 -1
  161. package/node_modules/@sumi/plugin-sdk/dist/shell.js +2 -1
  162. package/node_modules/@sumi/plugin-sdk/dist/shell.js.map +1 -1
  163. package/node_modules/@sumi/plugin-sdk/dist/snapshot.d.ts +12 -0
  164. package/node_modules/@sumi/plugin-sdk/dist/snapshot.js +29 -5
  165. package/node_modules/@sumi/plugin-sdk/dist/snapshot.js.map +1 -1
  166. package/node_modules/@sumi/plugin-sdk/dist/trace.d.ts +7 -2
  167. package/node_modules/@sumi/plugin-sdk/dist/trace.js +21 -1
  168. package/node_modules/@sumi/plugin-sdk/dist/trace.js.map +1 -1
  169. package/node_modules/@sumi/plugin-sdk/dist/validate.js +25 -1
  170. package/node_modules/@sumi/plugin-sdk/dist/validate.js.map +1 -1
  171. package/node_modules/@sumi/plugin-sdk/dist/yaml-text.d.ts +7 -0
  172. package/node_modules/@sumi/plugin-sdk/dist/yaml-text.js +116 -0
  173. package/node_modules/@sumi/plugin-sdk/dist/yaml-text.js.map +1 -0
  174. package/node_modules/@sumi/plugin-sdk/package.json +3 -2
  175. package/node_modules/@sumi/plugins-core/dist/agent-rules.js +2 -2
  176. package/node_modules/@sumi/plugins-core/dist/agent-rules.js.map +1 -1
  177. package/node_modules/@sumi/plugins-core/dist/commands/adopt.js +7 -5
  178. package/node_modules/@sumi/plugins-core/dist/commands/adopt.js.map +1 -1
  179. package/node_modules/@sumi/plugins-core/dist/commands/context-impact.js +9 -21
  180. package/node_modules/@sumi/plugins-core/dist/commands/context-impact.js.map +1 -1
  181. package/node_modules/@sumi/plugins-core/dist/context-provider.d.ts +3 -0
  182. package/node_modules/@sumi/plugins-core/dist/context-provider.js +45 -0
  183. package/node_modules/@sumi/plugins-core/dist/context-provider.js.map +1 -0
  184. package/node_modules/@sumi/plugins-core/dist/plugins/coverage.js +110 -15
  185. package/node_modules/@sumi/plugins-core/dist/plugins/coverage.js.map +1 -1
  186. package/node_modules/@sumi/plugins-core/dist/plugins/test-affected.js +32 -5
  187. package/node_modules/@sumi/plugins-core/dist/plugins/test-affected.js.map +1 -1
  188. package/node_modules/@sumi/plugins-core/dist/vitest-runner.js +1 -0
  189. package/node_modules/@sumi/plugins-core/dist/vitest-runner.js.map +1 -1
  190. package/node_modules/@sumi/plugins-core/instructions/bugfix.md +4 -0
  191. package/node_modules/@sumi/plugins-core/instructions/feature.md +2 -0
  192. package/node_modules/@sumi/plugins-core/package.json +2 -2
  193. package/node_modules/@sumi/plugins-core/sumi-plugins.yaml +1 -0
  194. package/node_modules/@sumi/plugins-governance/assets/hook-bootstrap.cjs +195 -0
  195. package/node_modules/@sumi/plugins-governance/dist/boundary-hooks.d.ts +12 -0
  196. package/node_modules/@sumi/plugins-governance/dist/boundary-hooks.js +76 -0
  197. package/node_modules/@sumi/plugins-governance/dist/boundary-hooks.js.map +1 -0
  198. package/node_modules/@sumi/plugins-governance/dist/boundary.d.ts +42 -0
  199. package/node_modules/@sumi/plugins-governance/dist/boundary.js +206 -0
  200. package/node_modules/@sumi/plugins-governance/dist/boundary.js.map +1 -0
  201. package/node_modules/@sumi/plugins-governance/dist/checkout.d.ts +1 -0
  202. package/node_modules/@sumi/plugins-governance/dist/checkout.js +16 -6
  203. package/node_modules/@sumi/plugins-governance/dist/checkout.js.map +1 -1
  204. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-after-edit.js +14 -0
  205. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-after-edit.js.map +1 -0
  206. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-before-edit.js +22 -0
  207. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-before-edit.js.map +1 -0
  208. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-prompt.js +12 -0
  209. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-prompt.js.map +1 -0
  210. package/node_modules/@sumi/plugins-governance/dist/commands/boundary.d.ts +1 -0
  211. package/node_modules/@sumi/plugins-governance/dist/commands/boundary.js +48 -0
  212. package/node_modules/@sumi/plugins-governance/dist/commands/boundary.js.map +1 -0
  213. package/node_modules/@sumi/plugins-governance/dist/commands/context-state.d.ts +1 -0
  214. package/node_modules/@sumi/plugins-governance/dist/commands/context-state.js +4 -0
  215. package/node_modules/@sumi/plugins-governance/dist/commands/context-state.js.map +1 -0
  216. package/node_modules/@sumi/plugins-governance/dist/commands/gate.js +168 -24
  217. package/node_modules/@sumi/plugins-governance/dist/commands/gate.js.map +1 -1
  218. package/node_modules/@sumi/plugins-governance/dist/commands/pr-report-check.js +5 -2
  219. package/node_modules/@sumi/plugins-governance/dist/commands/pr-report-check.js.map +1 -1
  220. package/node_modules/@sumi/plugins-governance/dist/commands/pr-report.js +5 -1
  221. package/node_modules/@sumi/plugins-governance/dist/commands/pr-report.js.map +1 -1
  222. package/node_modules/@sumi/plugins-governance/dist/commands/resume-work.d.ts +1 -0
  223. package/node_modules/@sumi/plugins-governance/dist/commands/resume-work.js +6 -0
  224. package/node_modules/@sumi/plugins-governance/dist/commands/resume-work.js.map +1 -0
  225. package/node_modules/@sumi/plugins-governance/dist/commands/run-policy.d.ts +1 -0
  226. package/node_modules/@sumi/plugins-governance/dist/commands/run-policy.js +19 -0
  227. package/node_modules/@sumi/plugins-governance/dist/commands/run-policy.js.map +1 -0
  228. package/node_modules/@sumi/plugins-governance/dist/commands/stop-work.d.ts +1 -0
  229. package/node_modules/@sumi/plugins-governance/dist/commands/stop-work.js +12 -0
  230. package/node_modules/@sumi/plugins-governance/dist/commands/stop-work.js.map +1 -0
  231. package/node_modules/@sumi/plugins-governance/dist/commands/view.d.ts +1 -0
  232. package/node_modules/@sumi/plugins-governance/dist/commands/view.js +45 -0
  233. package/node_modules/@sumi/plugins-governance/dist/commands/view.js.map +1 -0
  234. package/node_modules/@sumi/plugins-governance/dist/config-recovery.d.ts +2 -0
  235. package/node_modules/@sumi/plugins-governance/dist/config-recovery.js +15 -0
  236. package/node_modules/@sumi/plugins-governance/dist/config-recovery.js.map +1 -0
  237. package/node_modules/@sumi/plugins-governance/dist/context-provider.d.ts +2 -0
  238. package/node_modules/@sumi/plugins-governance/dist/context-provider.js +22 -0
  239. package/node_modules/@sumi/plugins-governance/dist/context-provider.js.map +1 -0
  240. package/node_modules/@sumi/plugins-governance/dist/gate-cache.js +10 -2
  241. package/node_modules/@sumi/plugins-governance/dist/gate-cache.js.map +1 -1
  242. package/node_modules/@sumi/plugins-governance/dist/guard.js +4 -4
  243. package/node_modules/@sumi/plugins-governance/dist/guard.js.map +1 -1
  244. package/node_modules/@sumi/plugins-governance/dist/human-stop.d.ts +4 -0
  245. package/node_modules/@sumi/plugins-governance/dist/human-stop.js +39 -0
  246. package/node_modules/@sumi/plugins-governance/dist/human-stop.js.map +1 -0
  247. package/node_modules/@sumi/plugins-governance/dist/index.d.ts +5 -1
  248. package/node_modules/@sumi/plugins-governance/dist/index.js +5 -1
  249. package/node_modules/@sumi/plugins-governance/dist/index.js.map +1 -1
  250. package/node_modules/@sumi/plugins-governance/dist/plugins/state-writable.d.ts +1 -0
  251. package/node_modules/@sumi/plugins-governance/dist/plugins/state-writable.js +4 -0
  252. package/node_modules/@sumi/plugins-governance/dist/plugins/state-writable.js.map +1 -0
  253. package/node_modules/@sumi/plugins-governance/dist/pr-report-compose.d.ts +1 -1
  254. package/node_modules/@sumi/plugins-governance/dist/pr-report-compose.js +2 -1
  255. package/node_modules/@sumi/plugins-governance/dist/pr-report-compose.js.map +1 -1
  256. package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.d.ts +1 -0
  257. package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.js +1 -0
  258. package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.js.map +1 -1
  259. package/node_modules/@sumi/plugins-governance/dist/pr-report-sections.js +4 -1
  260. package/node_modules/@sumi/plugins-governance/dist/pr-report-sections.js.map +1 -1
  261. package/node_modules/@sumi/plugins-governance/dist/pr-report-status.d.ts +1 -1
  262. package/node_modules/@sumi/plugins-governance/dist/pr-report-status.js +22 -3
  263. package/node_modules/@sumi/plugins-governance/dist/pr-report-status.js.map +1 -1
  264. package/node_modules/@sumi/plugins-governance/dist/preflight.d.ts +18 -0
  265. package/node_modules/@sumi/plugins-governance/dist/preflight.js +120 -0
  266. package/node_modules/@sumi/plugins-governance/dist/preflight.js.map +1 -0
  267. package/node_modules/@sumi/plugins-governance/dist/protected.d.ts +1 -0
  268. package/node_modules/@sumi/plugins-governance/dist/protected.js +1 -0
  269. package/node_modules/@sumi/plugins-governance/dist/protected.js.map +1 -1
  270. package/node_modules/@sumi/plugins-governance/dist/report-view.d.ts +12 -0
  271. package/node_modules/@sumi/plugins-governance/dist/report-view.js +59 -0
  272. package/node_modules/@sumi/plugins-governance/dist/report-view.js.map +1 -0
  273. package/node_modules/@sumi/plugins-governance/dist/state-access.d.ts +3 -0
  274. package/node_modules/@sumi/plugins-governance/dist/state-access.js +35 -0
  275. package/node_modules/@sumi/plugins-governance/dist/state-access.js.map +1 -0
  276. package/node_modules/@sumi/plugins-governance/dist/state.js +1 -4
  277. package/node_modules/@sumi/plugins-governance/dist/state.js.map +1 -1
  278. package/node_modules/@sumi/plugins-governance/dist/upgrade-command.d.ts +1 -0
  279. package/node_modules/@sumi/plugins-governance/dist/upgrade-command.js +30 -0
  280. package/node_modules/@sumi/plugins-governance/dist/upgrade-command.js.map +1 -0
  281. package/node_modules/@sumi/plugins-governance/dist/view-page.d.ts +4 -0
  282. package/node_modules/@sumi/plugins-governance/dist/view-page.js +51 -0
  283. package/node_modules/@sumi/plugins-governance/dist/view-page.js.map +1 -0
  284. package/node_modules/@sumi/plugins-governance/instructions/boundary.md +35 -0
  285. package/node_modules/@sumi/plugins-governance/instructions/push.md +11 -8
  286. package/node_modules/@sumi/plugins-governance/package.json +6 -3
  287. package/node_modules/@sumi/plugins-governance/sumi-plugins.yaml +30 -1
  288. package/node_modules/@sumi/plugins-openspec/package.json +4 -4
  289. package/node_modules/@sumi/plugins-precedent/README.md +6 -4
  290. package/node_modules/@sumi/plugins-precedent/dist/after-edit-context.d.ts +6 -23
  291. package/node_modules/@sumi/plugins-precedent/dist/after-edit-context.js +48 -156
  292. package/node_modules/@sumi/plugins-precedent/dist/after-edit-context.js.map +1 -1
  293. package/node_modules/@sumi/plugins-precedent/dist/commands/before-edit-context.js +16 -13
  294. package/node_modules/@sumi/plugins-precedent/dist/commands/before-edit-context.js.map +1 -1
  295. package/node_modules/@sumi/plugins-precedent/dist/commands/context.js +3 -44
  296. package/node_modules/@sumi/plugins-precedent/dist/commands/context.js.map +1 -1
  297. package/node_modules/@sumi/plugins-precedent/dist/commands/impact-submit.js +2 -1
  298. package/node_modules/@sumi/plugins-precedent/dist/commands/impact-submit.js.map +1 -1
  299. package/node_modules/@sumi/plugins-precedent/dist/context-output.d.ts +65 -0
  300. package/node_modules/@sumi/plugins-precedent/dist/context-output.js +186 -0
  301. package/node_modules/@sumi/plugins-precedent/dist/context-output.js.map +1 -0
  302. package/node_modules/@sumi/plugins-precedent/dist/context-provider.d.ts +3 -0
  303. package/node_modules/@sumi/plugins-precedent/dist/context-provider.js +48 -0
  304. package/node_modules/@sumi/plugins-precedent/dist/context-provider.js.map +1 -0
  305. package/node_modules/@sumi/plugins-precedent/dist/impact-state.js +4 -6
  306. package/node_modules/@sumi/plugins-precedent/dist/impact-state.js.map +1 -1
  307. package/node_modules/@sumi/plugins-precedent/dist/impact.js +1 -2
  308. package/node_modules/@sumi/plugins-precedent/dist/impact.js.map +1 -1
  309. package/node_modules/@sumi/plugins-precedent/dist/index.d.ts +1 -0
  310. package/node_modules/@sumi/plugins-precedent/dist/index.js +1 -0
  311. package/node_modules/@sumi/plugins-precedent/dist/index.js.map +1 -1
  312. package/node_modules/@sumi/plugins-precedent/dist/model.d.ts +1 -0
  313. package/node_modules/@sumi/plugins-precedent/dist/model.js.map +1 -1
  314. package/node_modules/@sumi/plugins-precedent/dist/plugins/context-read.js +2 -1
  315. package/node_modules/@sumi/plugins-precedent/dist/plugins/context-read.js.map +1 -1
  316. package/node_modules/@sumi/plugins-precedent/package.json +3 -3
  317. package/node_modules/@sumi/plugins-precedent/sumi-plugins.yaml +3 -2
  318. package/node_modules/@sumi/plugins-review/README.md +17 -4
  319. package/node_modules/@sumi/plugins-review/dist/batch-request.d.ts +22 -0
  320. package/node_modules/@sumi/plugins-review/dist/batch-request.js +30 -0
  321. package/node_modules/@sumi/plugins-review/dist/batch-request.js.map +1 -0
  322. package/node_modules/@sumi/plugins-review/dist/claude-review-agent.d.ts +8 -0
  323. package/node_modules/@sumi/plugins-review/dist/claude-review-agent.js +51 -0
  324. package/node_modules/@sumi/plugins-review/dist/claude-review-agent.js.map +1 -0
  325. package/node_modules/@sumi/plugins-review/dist/command-hint.d.ts +7 -0
  326. package/node_modules/@sumi/plugins-review/dist/command-hint.js +21 -0
  327. package/node_modules/@sumi/plugins-review/dist/command-hint.js.map +1 -1
  328. package/node_modules/@sumi/plugins-review/dist/command-input.d.ts +3 -0
  329. package/node_modules/@sumi/plugins-review/dist/command-input.js +32 -0
  330. package/node_modules/@sumi/plugins-review/dist/command-input.js.map +1 -0
  331. package/node_modules/@sumi/plugins-review/dist/commands/context.js +3 -69
  332. package/node_modules/@sumi/plugins-review/dist/commands/context.js.map +1 -1
  333. package/node_modules/@sumi/plugins-review/dist/commands/host-model-hook.js +4 -3
  334. package/node_modules/@sumi/plugins-review/dist/commands/host-model-hook.js.map +1 -1
  335. package/node_modules/@sumi/plugins-review/dist/commands/model-recheck.js +37 -25
  336. package/node_modules/@sumi/plugins-review/dist/commands/model-recheck.js.map +1 -1
  337. package/node_modules/@sumi/plugins-review/dist/commands/preflight.d.ts +1 -0
  338. package/node_modules/@sumi/plugins-review/dist/commands/preflight.js +13 -0
  339. package/node_modules/@sumi/plugins-review/dist/commands/preflight.js.map +1 -0
  340. package/node_modules/@sumi/plugins-review/dist/commands/request-read.d.ts +1 -0
  341. package/node_modules/@sumi/plugins-review/dist/commands/request-read.js +6 -0
  342. package/node_modules/@sumi/plugins-review/dist/commands/request-read.js.map +1 -0
  343. package/node_modules/@sumi/plugins-review/dist/commands/review-batch.d.ts +1 -0
  344. package/node_modules/@sumi/plugins-review/dist/commands/review-batch.js +8 -0
  345. package/node_modules/@sumi/plugins-review/dist/commands/review-batch.js.map +1 -0
  346. package/node_modules/@sumi/plugins-review/dist/commands/startup-context.d.ts +1 -0
  347. package/node_modules/@sumi/plugins-review/dist/commands/startup-context.js +6 -0
  348. package/node_modules/@sumi/plugins-review/dist/commands/startup-context.js.map +1 -0
  349. package/node_modules/@sumi/plugins-review/dist/commands/stats.d.ts +1 -0
  350. package/node_modules/@sumi/plugins-review/dist/commands/stats.js +10 -0
  351. package/node_modules/@sumi/plugins-review/dist/commands/stats.js.map +1 -0
  352. package/node_modules/@sumi/plugins-review/dist/commands/submit.js +79 -32
  353. package/node_modules/@sumi/plugins-review/dist/commands/submit.js.map +1 -1
  354. package/node_modules/@sumi/plugins-review/dist/context-provider.d.ts +3 -0
  355. package/node_modules/@sumi/plugins-review/dist/context-provider.js +84 -0
  356. package/node_modules/@sumi/plugins-review/dist/context-provider.js.map +1 -0
  357. package/node_modules/@sumi/plugins-review/dist/convergence.d.ts +17 -0
  358. package/node_modules/@sumi/plugins-review/dist/convergence.js +114 -0
  359. package/node_modules/@sumi/plugins-review/dist/convergence.js.map +1 -0
  360. package/node_modules/@sumi/plugins-review/dist/cost-advice.d.ts +2 -0
  361. package/node_modules/@sumi/plugins-review/dist/cost-advice.js +35 -0
  362. package/node_modules/@sumi/plugins-review/dist/cost-advice.js.map +1 -0
  363. package/node_modules/@sumi/plugins-review/dist/dispatch.d.ts +38 -0
  364. package/node_modules/@sumi/plugins-review/dist/dispatch.js +235 -0
  365. package/node_modules/@sumi/plugins-review/dist/dispatch.js.map +1 -0
  366. package/node_modules/@sumi/plugins-review/dist/dispute.d.ts +4 -0
  367. package/node_modules/@sumi/plugins-review/dist/dispute.js +38 -4
  368. package/node_modules/@sumi/plugins-review/dist/dispute.js.map +1 -1
  369. package/node_modules/@sumi/plugins-review/dist/instructions.d.ts +1 -0
  370. package/node_modules/@sumi/plugins-review/dist/instructions.js +2 -0
  371. package/node_modules/@sumi/plugins-review/dist/instructions.js.map +1 -0
  372. package/node_modules/@sumi/plugins-review/dist/model-execution.d.ts +1 -0
  373. package/node_modules/@sumi/plugins-review/dist/model-execution.js +51 -46
  374. package/node_modules/@sumi/plugins-review/dist/model-execution.js.map +1 -1
  375. package/node_modules/@sumi/plugins-review/dist/plugins/dispatch.d.ts +1 -0
  376. package/node_modules/@sumi/plugins-review/dist/plugins/dispatch.js +41 -0
  377. package/node_modules/@sumi/plugins-review/dist/plugins/dispatch.js.map +1 -0
  378. package/node_modules/@sumi/plugins-review/dist/plugins/independent-recheck.js +62 -39
  379. package/node_modules/@sumi/plugins-review/dist/plugins/independent-recheck.js.map +1 -1
  380. package/node_modules/@sumi/plugins-review/dist/plugins/rubric.js +3 -337
  381. package/node_modules/@sumi/plugins-review/dist/plugins/rubric.js.map +1 -1
  382. package/node_modules/@sumi/plugins-review/dist/preflight.d.ts +31 -0
  383. package/node_modules/@sumi/plugins-review/dist/preflight.js +172 -0
  384. package/node_modules/@sumi/plugins-review/dist/preflight.js.map +1 -0
  385. package/node_modules/@sumi/plugins-review/dist/recheck-tickets.d.ts +26 -0
  386. package/node_modules/@sumi/plugins-review/dist/recheck-tickets.js +48 -0
  387. package/node_modules/@sumi/plugins-review/dist/recheck-tickets.js.map +1 -0
  388. package/node_modules/@sumi/plugins-review/dist/recheck.d.ts +15 -0
  389. package/node_modules/@sumi/plugins-review/dist/recheck.js +33 -16
  390. package/node_modules/@sumi/plugins-review/dist/recheck.js.map +1 -1
  391. package/node_modules/@sumi/plugins-review/dist/report.d.ts +5 -1
  392. package/node_modules/@sumi/plugins-review/dist/report.js +25 -5
  393. package/node_modules/@sumi/plugins-review/dist/report.js.map +1 -1
  394. package/node_modules/@sumi/plugins-review/dist/review-evidence.js +2 -2
  395. package/node_modules/@sumi/plugins-review/dist/review-evidence.js.map +1 -1
  396. package/node_modules/@sumi/plugins-review/dist/review.d.ts +53 -7
  397. package/node_modules/@sumi/plugins-review/dist/review.js +100 -38
  398. package/node_modules/@sumi/plugins-review/dist/review.js.map +1 -1
  399. package/node_modules/@sumi/plugins-review/dist/rubric-check.d.ts +4 -0
  400. package/node_modules/@sumi/plugins-review/dist/rubric-check.js +382 -0
  401. package/node_modules/@sumi/plugins-review/dist/rubric-check.js.map +1 -0
  402. package/node_modules/@sumi/plugins-review/dist/startup-context.d.ts +21 -0
  403. package/node_modules/@sumi/plugins-review/dist/startup-context.js +94 -0
  404. package/node_modules/@sumi/plugins-review/dist/startup-context.js.map +1 -0
  405. package/node_modules/@sumi/plugins-review/dist/stats.d.ts +19 -0
  406. package/node_modules/@sumi/plugins-review/dist/stats.js +99 -0
  407. package/node_modules/@sumi/plugins-review/dist/stats.js.map +1 -0
  408. package/node_modules/@sumi/plugins-review/dist/submission.js +34 -18
  409. package/node_modules/@sumi/plugins-review/dist/submission.js.map +1 -1
  410. package/node_modules/@sumi/plugins-review/dist/support-scope.d.ts +4 -0
  411. package/node_modules/@sumi/plugins-review/dist/support-scope.js +9 -0
  412. package/node_modules/@sumi/plugins-review/dist/support-scope.js.map +1 -0
  413. package/node_modules/@sumi/plugins-review/dist/tickets.d.ts +12 -0
  414. package/node_modules/@sumi/plugins-review/dist/tickets.js +98 -0
  415. package/node_modules/@sumi/plugins-review/dist/tickets.js.map +1 -0
  416. package/node_modules/@sumi/plugins-review/dist/upgrade-flow-plan.js +34 -9
  417. package/node_modules/@sumi/plugins-review/dist/upgrade-flow-plan.js.map +1 -1
  418. package/node_modules/@sumi/plugins-review/dist/upgrade-flow-render.js +2 -3
  419. package/node_modules/@sumi/plugins-review/dist/upgrade-flow-render.js.map +1 -1
  420. package/node_modules/@sumi/plugins-review/dist/upgrade.d.ts +2 -0
  421. package/node_modules/@sumi/plugins-review/dist/upgrade.js +12 -83
  422. package/node_modules/@sumi/plugins-review/dist/upgrade.js.map +1 -1
  423. package/node_modules/@sumi/plugins-review/package.json +6 -5
  424. package/node_modules/@sumi/plugins-review/sumi-plugins.yaml +22 -1
  425. package/package.json +10 -10
  426. package/dist/trace.d.ts +0 -16
  427. package/dist/trace.js +0 -30
  428. package/dist/trace.js.map +0 -1
  429. package/node_modules/@sumi/create/dist/bin.d.ts +0 -2
  430. package/node_modules/@sumi/create/dist/bin.js +0 -52
  431. package/node_modules/@sumi/create/dist/bin.js.map +0 -1
  432. package/node_modules/@sumi/create/template/control/rubrics/architecture.yaml +0 -15
  433. package/node_modules/@sumi/create/template/control/rubrics/business-impact.yaml +0 -6
  434. package/node_modules/@sumi/create/template/control/rubrics/device-acceptance.yaml +0 -10
  435. package/node_modules/@sumi/create/template/control/rubrics/domain.yaml +0 -9
  436. package/node_modules/@sumi/create/template/init/control/rubrics/architecture.yaml +0 -15
  437. package/node_modules/@sumi/create/template/init/control/rubrics/business-impact.yaml +0 -6
  438. package/node_modules/@sumi/plugins-core/dist/tool-batches.d.ts +0 -11
  439. package/node_modules/@sumi/plugins-core/dist/tool-batches.js +0 -41
  440. package/node_modules/@sumi/plugins-core/dist/tool-batches.js.map +0 -1
  441. package/node_modules/@sumi/plugins-governance/dist/commands/approve.js +0 -29
  442. package/node_modules/@sumi/plugins-governance/dist/commands/approve.js.map +0 -1
  443. package/node_modules/@sumi/plugins-governance/dist/commands/protected-after-shell.js +0 -20
  444. package/node_modules/@sumi/plugins-governance/dist/commands/protected-after-shell.js.map +0 -1
  445. package/node_modules/@sumi/plugins-governance/dist/commands/unlock.js +0 -23
  446. package/node_modules/@sumi/plugins-governance/dist/commands/unlock.js.map +0 -1
  447. package/node_modules/@sumi/plugins-governance/dist/hooks.d.ts +0 -2
  448. package/node_modules/@sumi/plugins-governance/dist/hooks.js +0 -4
  449. package/node_modules/@sumi/plugins-governance/dist/hooks.js.map +0 -1
  450. package/node_modules/@sumi/plugins-governance/dist/protected-shell.d.ts +0 -12
  451. package/node_modules/@sumi/plugins-governance/dist/protected-shell.js +0 -152
  452. package/node_modules/@sumi/plugins-governance/dist/protected-shell.js.map +0 -1
  453. package/node_modules/@sumi/plugins-precedent/dist/commands/session-start-context.js +0 -6
  454. package/node_modules/@sumi/plugins-precedent/dist/commands/session-start-context.js.map +0 -1
  455. /package/{node_modules/@sumi/plugins-governance/dist/commands/approve.d.ts → dist/context-providers.d.ts} +0 -0
  456. /package/node_modules/@sumi/plugins-governance/dist/commands/{protected-after-shell.d.ts → boundary-after-edit.d.ts} +0 -0
  457. /package/node_modules/@sumi/plugins-governance/dist/commands/{unlock.d.ts → boundary-before-edit.d.ts} +0 -0
  458. /package/node_modules/@sumi/{plugins-precedent/dist/commands/session-start-context.d.ts → plugins-governance/dist/commands/boundary-prompt.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import { REVIEW_NOTES_MARKER, REVIEW_ROWS_MARKER } from './pr-report-markers.js';
1
+ import { REVIEW_NOTES_MARKER, REVIEW_ROWS_MARKER, REVIEW_FOLLOW_UPS_MARKER } from './pr-report-markers.js';
2
2
  /** 各评审步骤的行合并为一张表,模型来源等说明按步骤列在表格下方。 */
3
3
  function reviewTable(steps) {
4
4
  const parts = steps.map((step) => {
@@ -27,6 +27,8 @@ function reviewTable(steps) {
27
27
  }
28
28
  /** 固定业务影响段落单独呈现;评审条目合并为一张表;其余步骤报告继续放入通用报告区。 */
29
29
  export function reportSections(steps) {
30
+ const followUps = new Set(steps.flatMap((step) => step.report?.split(REVIEW_FOLLOW_UPS_MARKER)[1]?.trim().split('\n') ?? []));
31
+ steps = steps.map((step) => ({ ...step, report: step.report?.split(REVIEW_FOLLOW_UPS_MARKER)[0]?.trim() }));
30
32
  const validation = steps.find((step) => step.use === 'review/validation' && step.report?.startsWith('### 关键验证'));
31
33
  const impactStep = steps.find((step) => (step.use === 'prec/impact' || (!step.use && step.id === 'prec/impact')) && step.report?.startsWith('### 业务约束变化'));
32
34
  const impact = impactStep?.report;
@@ -39,6 +41,7 @@ export function reportSections(steps) {
39
41
  ...(impact ? ['', impact] : []),
40
42
  ...(validation?.report ? ['', validation.report] : []),
41
43
  ...(reviews.length ? ['', ...reviewTable(reviews)] : []),
44
+ ...(followUps.size ? ['', '### 后续事项', '', ...followUps] : []),
42
45
  ...(others.length ? ['', '### 评审与报告', '', ...others.flatMap((report) => [report, ''])] : []),
43
46
  ];
44
47
  }
@@ -1 +1 @@
1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EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,UAAU,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SACtG,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAO,CAAC,CAAC;IAC/B,OAAO;QACL,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7F,CAAC;AACJ,CAAC"}
@@ -18,4 +18,4 @@ export interface PrReportStatus {
18
18
  * 分支还没有提交(unborn HEAD)、没有远端或远端都不是 GitHub 时不可能存在对应 PR,直接通过,
19
19
  * 避免停止 hook 产生代理无论如何都无法满足的阻断。
20
20
  */
21
- export declare function checkPrReportStatus(root: string, run?: CommandRunner): PrReportStatus;
21
+ export declare function checkPrReportStatus(root: string, run?: CommandRunner, session?: string | null): PrReportStatus;
@@ -1,4 +1,4 @@
1
- import { projectSumi, spawnCommandSync } from '@sumi/plugin-sdk';
1
+ import { projectSumi, spawnCommandSync, readSessionTrace, recordTrace, withFileLock, sessionEventsFile, sessionKey, } from '@sumi/plugin-sdk';
2
2
  import { isPrReport, prReportHead } from './pr-report-markers.js';
3
3
  const defaultRunner = (command, args, cwd) => {
4
4
  const result = spawnCommandSync(command, args, { cwd, encoding: 'utf8', windowsHide: true });
@@ -35,7 +35,7 @@ const NO_GITHUB_REMOTE = /none of the git remotes configured for this repository
35
35
  * 分支还没有提交(unborn HEAD)、没有远端或远端都不是 GitHub 时不可能存在对应 PR,直接通过,
36
36
  * 避免停止 hook 产生代理无论如何都无法满足的阻断。
37
37
  */
38
- export function checkPrReportStatus(root, run = defaultRunner) {
38
+ export function checkPrReportStatus(root, run = defaultRunner, session = null) {
39
39
  // symbolic-ref --quiet:退出码 1 表示 HEAD 不是符号引用(detached),其他非零表示 git 自身失败。
40
40
  const branchResult = run('git', ['symbolic-ref', '--quiet', '--short', 'HEAD'], root);
41
41
  if (branchResult.status === 1 && !branchResult.error)
@@ -56,8 +56,27 @@ export function checkPrReportStatus(root, run = defaultRunner) {
56
56
  if (!remotes.stdout.trim())
57
57
  return { pass: true };
58
58
  const auth = run('gh', ['auth', 'status'], root);
59
- if (auth.status !== 0)
59
+ if (auth.error?.code === 'ENOENT')
60
+ return { pass: true };
61
+ if (auth.status !== 0) {
62
+ if (session) {
63
+ const first = withFileLock(`${sessionEventsFile(root, sessionKey(session.split('#agent:')[0]))}.auth.lock`, () => {
64
+ if (readSessionTrace(root, session)?.some((event) => event.channel === 'stop:gh-auth'))
65
+ return false;
66
+ recordTrace(root, {
67
+ kind: 'injection',
68
+ session,
69
+ channel: 'stop:gh-auth',
70
+ method: 'tool-output',
71
+ content: 'GitHub 登录状态提醒已送达',
72
+ });
73
+ return true;
74
+ });
75
+ if (!first)
76
+ return { pass: true };
77
+ }
60
78
  return warn(`无法验证 GitHub 登录状态:${detail(auth)}。请人在终端运行 gh auth login 后重试 PR 报告检查`);
79
+ }
61
80
  const fields = 'number,headRefOid,url,comments,state';
62
81
  let view = run('gh', ['pr', 'view', '--json', fields], root);
63
82
  let pr = null;
@@ -1 +1 @@
1
- {"version":3,"file":"pr-report-status.js","sourceRoot":"","sources":["../src/pr-report-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAyBlE,MAAM,aAAa,GAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IAC1D,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7F,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;QAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,MAAM,CAAC,MAAqB;IACnC,OAAO,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,OAAO,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC;AAChH,CAAC;AAED,SAAS,IAAI,CAAI,MAAqB,EAAE,MAAc;IACpD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAM,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,aAAa,CAAC,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AAE,CAAC,MAAM,CACV,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,18 @@
1
+ export declare function gatePreflight(root: string, base: string | null, options?: {
2
+ gitHook?: boolean;
3
+ }): {
4
+ uncertain?: boolean | undefined;
5
+ flow: string;
6
+ tier: string;
7
+ base: string | null;
8
+ covered: string[];
9
+ missing: {
10
+ step: string;
11
+ summary: string;
12
+ }[];
13
+ unverified: {
14
+ step: string;
15
+ summary: string;
16
+ }[];
17
+ command: string[];
18
+ };
@@ -0,0 +1,120 @@
1
+ import { DEFAULT_GATE_FLOW } from './protected.js';
2
+ import { changedFiles, deletedFiles, deriveTier, loadConfig } from '@sumi/kernel';
3
+ import { cleanEnv, COMMAND_CAPABILITIES_ENV, projectSumiCommand, spawnCommandSync } from '@sumi/plugin-sdk';
4
+ import { delimiter } from 'node:path';
5
+ const ACTIVE_ENV = 'SUMI_GATE_PREFLIGHT_ACTIVE';
6
+ function recordOf(value) {
7
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
8
+ return null;
9
+ return value;
10
+ }
11
+ function providers() {
12
+ let value;
13
+ try {
14
+ value = JSON.parse(process.env[COMMAND_CAPABILITIES_ENV] ?? '');
15
+ }
16
+ catch {
17
+ throw new Error('命令能力元数据不可读取,请从项目 CLI 运行预检');
18
+ }
19
+ if (!Array.isArray(value))
20
+ throw new Error('命令能力元数据格式无效');
21
+ return value.flatMap((entry) => {
22
+ const row = recordOf(entry);
23
+ if (!row)
24
+ throw new Error('命令能力元数据格式无效');
25
+ if (typeof row.name !== 'string' || typeof row.plugin !== 'string' || typeof row.capability !== 'string')
26
+ throw new Error('命令能力元数据格式无效');
27
+ return row.capability === 'gate.preflight' ? [{ name: row.name, plugin: row.plugin }] : [];
28
+ });
29
+ }
30
+ function parseReport(text, provider, expected) {
31
+ const label = `预检提供者 ${provider.plugin} / ${provider.name}`;
32
+ let value;
33
+ try {
34
+ value = JSON.parse(text);
35
+ }
36
+ catch {
37
+ throw new Error(`${label} 返回无效 JSON`);
38
+ }
39
+ const row = recordOf(value);
40
+ if (!row)
41
+ throw new Error(`${label} 返回格式无效`);
42
+ if (row.flow !== expected.flow || row.tier !== expected.tier || row.base !== expected.base)
43
+ throw new Error(`${label} 返回范围不一致`);
44
+ if (!Array.isArray(row.covered) || !row.covered.every((entry) => typeof entry === 'string'))
45
+ throw new Error(`${label} 返回 covered 格式无效`);
46
+ if (!Array.isArray(row.missing))
47
+ throw new Error(`${label} 返回 missing 格式无效`);
48
+ const missing = row.missing.map((entry) => {
49
+ const item = recordOf(entry);
50
+ if (!item || typeof item.step !== 'string' || typeof item.summary !== 'string')
51
+ throw new Error(`${label} 返回缺失项格式无效`);
52
+ return { step: item.step, summary: item.summary };
53
+ });
54
+ if (row.unverified !== undefined && !Array.isArray(row.unverified))
55
+ throw new Error(`${label} 返回 unverified 格式无效`);
56
+ const unverified = (row.unverified ?? []);
57
+ const unverifiedItems = unverified.map((entry) => {
58
+ const item = recordOf(entry);
59
+ if (!item || typeof item.step !== 'string' || typeof item.summary !== 'string')
60
+ throw new Error(`${label} 返回待核验项格式无效`);
61
+ return { step: item.step, summary: item.summary };
62
+ });
63
+ if (row.uncertain !== undefined && typeof row.uncertain !== 'boolean')
64
+ throw new Error(`${label} 返回 uncertain 格式无效`);
65
+ return { ...expected, covered: row.covered, missing, unverified: unverifiedItems, ...(row.uncertain ? { uncertain: true } : {}) };
66
+ }
67
+ export function gatePreflight(root, base, options = {}) {
68
+ if (process.env[ACTIVE_ENV])
69
+ throw new Error('预检提供者不能递归调用门禁预检');
70
+ const config = loadConfig(root);
71
+ const rawGate = config.gate;
72
+ const gate = rawGate === undefined ? {} : recordOf(rawGate);
73
+ if (!gate)
74
+ throw new Error('门禁配置必须是对象');
75
+ const flow = gate.flow ?? DEFAULT_GATE_FLOW;
76
+ const requestedTier = gate.tier ?? config.tiers[0];
77
+ if (typeof flow !== 'string' || !flow)
78
+ throw new Error('门禁流程无效');
79
+ if (typeof requestedTier !== 'string' || !config.tiers.includes(requestedTier))
80
+ throw new Error('门禁档位无效');
81
+ const files = [...changedFiles(root, base), ...deletedFiles(root, base)];
82
+ const tier = deriveTier(config, files, requestedTier).tier;
83
+ const env = cleanEnv();
84
+ if (options.gitHook) {
85
+ // Git 在 hook 的 PATH 前添加自己的执行目录;剥离这一层,按工作区原环境核验检查回执。
86
+ const git = spawnCommandSync('git', ['--exec-path'], { cwd: root, encoding: 'utf8', windowsHide: true, env });
87
+ const pathKey = Object.keys(env).find((key) => key.toUpperCase() === 'PATH') ?? 'PATH';
88
+ const current = env[pathKey] ?? '';
89
+ const prefix = `${git.stdout?.trim()}${delimiter}`;
90
+ if (git.status === 0 && current.startsWith(prefix))
91
+ env[pathKey] = current.slice(prefix.length);
92
+ }
93
+ const reports = providers().map((provider) => {
94
+ const [bin, ...argv] = projectSumiCommand(provider.name);
95
+ const child = spawnCommandSync(bin, argv, {
96
+ cwd: root,
97
+ encoding: 'utf8',
98
+ windowsHide: true,
99
+ timeout: 60_000,
100
+ env: { ...env, [ACTIVE_ENV]: '1' },
101
+ input: JSON.stringify({ root, base, flow, tier }),
102
+ });
103
+ if (child.status !== 0)
104
+ throw new Error(`预检提供者 ${provider.plugin} / ${provider.name} 运行失败 ${child.stderr || child.error?.message || ''}`);
105
+ return parseReport(child.stdout, provider, { flow, tier, base });
106
+ });
107
+ const knownMissing = reports.some((report) => report.missing.length > 0);
108
+ const uncertain = !knownMissing && reports.some((report) => report.uncertain);
109
+ return {
110
+ flow,
111
+ tier,
112
+ base,
113
+ covered: [...new Set(reports.flatMap((report) => report.covered))],
114
+ missing: reports.flatMap((report) => report.missing),
115
+ unverified: reports.flatMap((report) => report.unverified ?? []),
116
+ command: projectSumiCommand('run', flow, '--tier', tier, ...(base ? ['--base', base] : ['--all'])),
117
+ ...(uncertain ? { uncertain: true } : {}),
118
+ };
119
+ }
120
+ //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AE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;QACpD,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAChE,OAAO,EAAE,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAClG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  /** 默认受保护路径:control 层、判例层、配置、入口文档、AI 工具适配、工具配置、包清单与锁文件。 */
2
2
  export declare const DEFAULT_PROTECTED: string[];
3
+ export declare const DEFAULT_GATE_FLOW = "check";
3
4
  export interface GovernanceConfig {
4
5
  protected?: string[];
5
6
  zones?: {
@@ -25,6 +25,7 @@ export const DEFAULT_PROTECTED = [
25
25
  'package-lock.json',
26
26
  'yarn.lock',
27
27
  ];
28
+ export const DEFAULT_GATE_FLOW = 'check';
28
29
  export function parseConfig(text) {
29
30
  if (text === null)
30
31
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"protected.js","sourceRoot":"","sources":["../src/protected.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B,0DAA0D;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG;IA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AI,CAAC,CAAC;QAC7B,OAAO,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACzE,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,oDAAoD;QACpD,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACzC,IAAI,IAAI,KAAK,IAAI;YAAE,SAAS;QAC5B,IAAI,CAAC;YACH,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,qBAAqB;QACvB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAA+B;IAC5D,2CAA2C;IAC3C,OAAO,CAAC,GAAG,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC;AACjG,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,gBAAgB,CAAC,GAAG,OAAoC;IACtE,OAAO,SAAS,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;AACjF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { CheckoutRun } from './checkout.js';
2
+ /** 与 PR 报告共用运行记录,页面从结构化步骤生成,不解释评审 HTML。 */
3
+ export declare function runMarkdown(run: Pick<CheckoutRun, 'record' | 'conclusion' | 'brief'>): string;
4
+ export declare function viewRun(root: string, id: string): string;
5
+ export interface PrViewData {
6
+ run: CheckoutRun;
7
+ url: string;
8
+ head: string;
9
+ boundary: string;
10
+ }
11
+ export declare function savePrView(root: string, number: string, data: PrViewData): void;
12
+ export declare function viewPr(root: string, number: string): string;
@@ -0,0 +1,59 @@
1
+ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { readRecords } from '@sumi/kernel';
4
+ import { stateDir } from './state.js';
5
+ import { REVIEW_FOLLOW_UPS_MARKER } from './pr-report-markers.js';
6
+ import { boundaryStatus } from './boundary.js';
7
+ import { writePage } from './view-page.js';
8
+ const cell = (text) => text.replace(/\|/g, '\\|').replace(/\r?\n/g, ' ');
9
+ /** 与 PR 报告共用运行记录,页面从结构化步骤生成,不解释评审 HTML。 */
10
+ export function runMarkdown(run) {
11
+ const steps = run.record?.steps ?? [];
12
+ const findings = steps.flatMap((step) => step.findings
13
+ .filter((finding) => finding.severity === 'error')
14
+ .map((finding) => `- ${step.id}:${finding.file ?? ''} ${finding.message}`));
15
+ const followUps = [...new Set(steps.flatMap((step) => step.report?.split(REVIEW_FOLLOW_UPS_MARKER)[1]?.trim().split('\n') ?? []))];
16
+ return [
17
+ `结论:${run.conclusion ?? 'blocked'}`,
18
+ '## 检查步骤',
19
+ '| 步骤 | 状态 | 耗时 | 结论 |',
20
+ '| --- | --- | --- | --- |',
21
+ ...steps.map((step) => `| ${cell(step.id)} | ${step.state} | ${step.reusedFrom ? '复用' : step.durationMs === undefined ? '—' : `${(step.durationMs / 1000).toFixed(1)}s`} | ${cell(step.summary)} |`),
22
+ '## 阻断发现',
23
+ ...(findings.length ? findings : ['无阻断发现。']),
24
+ '## 后续清单',
25
+ ...(followUps.length ? followUps : ['无后续事项。']),
26
+ ]
27
+ .join('\n\n')
28
+ .replace(/\n\n(?=\|)/g, '\n');
29
+ }
30
+ export function viewRun(root, id) {
31
+ if (id !== 'latest' && !/^r\d{17}-[a-f0-9]{6}$/.test(id))
32
+ throw new Error('运行 ID 无效');
33
+ const records = readRecords(root);
34
+ const record = id === 'latest' ? records.at(-1) : records.find((record) => record.runId === id);
35
+ if (!record)
36
+ throw new Error(`没有运行记录:${id}`);
37
+ return writePage(root, `run:${record.runId}`, `检查 · ${record.runId}`, `${boundaryStatus(root)}\n\n${runMarkdown({ record, conclusion: record.conclusion, brief: '' })}`);
38
+ }
39
+ const prFile = (root, number) => {
40
+ if (!/^\d+$/.test(number))
41
+ throw new Error('PR 编号无效');
42
+ return join(stateDir(root), 'pr-views', `${number}.json`);
43
+ };
44
+ export function savePrView(root, number, data) {
45
+ const dir = join(stateDir(root), 'pr-views');
46
+ mkdirSync(dir, { recursive: true });
47
+ writeFileSync(prFile(root, number), JSON.stringify(data));
48
+ }
49
+ export function viewPr(root, number) {
50
+ let data;
51
+ try {
52
+ data = JSON.parse(readFileSync(prFile(root, number), 'utf8'));
53
+ }
54
+ catch {
55
+ throw new Error(`没有 PR #${number} 的报告数据,请先运行 sumi pr-report ${number}`);
56
+ }
57
+ return writePage(root, `pr:${number}`, `PR #${number} · 检查报告`, `${data.boundary}\n\n[查看 PR](${data.url})\n\n提交:${data.head}\n\n${runMarkdown(data.run)}`);
58
+ }
59
+ //# sourceMappingURL=report-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-view.js","sourceRoot":"","sources":["../src/report-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC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真实创建、写入、改名和删除,不触碰其他会话状态。 */
3
+ export declare function probeStateAccess(root: string): PluginResult;
@@ -0,0 +1,35 @@
1
+ import { mkdirSync, mkdtempSync, renameSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { permissionFailure, result } from '@sumi/plugin-sdk';
4
+ import { stateDir } from './state.js';
5
+ /** 独占随机子目录,探测真实创建、写入、改名和删除,不触碰其他会话状态。 */
6
+ export function probeStateAccess(root) {
7
+ const directory = stateDir(root);
8
+ let probe;
9
+ try {
10
+ mkdirSync(directory, { recursive: true });
11
+ probe = mkdtempSync(join(directory, '.write-probe-'));
12
+ writeFileSync(join(probe, 'source'), 'probe', { flag: 'wx' });
13
+ renameSync(join(probe, 'source'), join(probe, 'target'));
14
+ rmSync(probe, { recursive: true });
15
+ probe = undefined;
16
+ return result({ status: 'pass', summary: `共享状态可写 ${directory}` });
17
+ }
18
+ catch (error) {
19
+ const failure = permissionFailure(error, directory, root);
20
+ if (!failure)
21
+ throw error;
22
+ return failure;
23
+ }
24
+ finally {
25
+ if (probe) {
26
+ try {
27
+ rmSync(probe, { recursive: true, force: true });
28
+ }
29
+ catch {
30
+ // 权限仍不足时保留独立探针,原始失败路径已进入诊断。
31
+ }
32
+ }
33
+ }
34
+ }
35
+ //# sourceMappingURL=state-access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-access.js","sourceRoot":"","sources":["../src/state-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAqB,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,yCAAyC;AACzC,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,MAAM,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一进程内 git 公共目录不变;评审遍历上千份历史结果时每次都启动 git 会让插件超时
5
4
  const commonDirs = new Map();
@@ -10,8 +9,6 @@ export function stateDir(root) {
10
9
  common = resolve(root, execFileSync('git', ['rev-parse', '--git-common-dir'], { cwd: root, encoding: 'utf8', windowsHide: true }).trim());
11
10
  commonDirs.set(root, common);
12
11
  }
13
- const dir = join(common, 'sumi');
14
- mkdirSync(dir, { recursive: true });
15
- return dir;
12
+ return join(common, 'sumi');
16
13
  }
17
14
  //# sourceMappingURL=state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,gDAAgD;AAChD,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE7C,wDAAwD;AACxD,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,IAAI,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,OAAO,CACd,IAAI,EACJ,YAAY,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,kBAAkB,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAClH,CAAC;QACF,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC"}
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,gDAAgD;AAChD,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE7C,wDAAwD;AACxD,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,IAAI,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,OAAO,CACd,IAAI,EACJ,YAAY,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,kBAAkB,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAClH,CAAC;QACF,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { existsSync, readFileSync, readdirSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { isMap, isSeq, parseDocument } from 'yaml';
4
+ import { withYamlChanges } from '@sumi/plugin-sdk';
5
+ import { TEMPLATE_DIR } from '@sumi/create';
6
+ const { root, config } = JSON.parse(readFileSync(0, 'utf8'));
7
+ const directory = join(root, config.flows);
8
+ const plan = [];
9
+ const boundaries = 'control/rules/boundaries.md';
10
+ if (!existsSync(join(root, boundaries)))
11
+ plan.push({ path: boundaries, content: readFileSync(join(TEMPLATE_DIR, boundaries), 'utf8') });
12
+ for (const name of existsSync(directory) ? readdirSync(directory).filter((file) => file.endsWith('.flow.yaml')) : []) {
13
+ const path = join(config.flows, name);
14
+ const original = readFileSync(join(root, path), 'utf8');
15
+ const document = parseDocument(original);
16
+ if (document.errors.length)
17
+ throw new Error(`无法升级流程 ${path}`);
18
+ const steps = document.get('steps', true);
19
+ if (!isSeq(steps))
20
+ continue;
21
+ const existing = steps.items.findIndex((step) => isMap(step) && step.get('use') === 'gov/state-writable');
22
+ if (existing === 0)
23
+ continue;
24
+ if (existing >= 0)
25
+ throw new Error(`${path} 的 gov/state-writable 必须放在最前面,请调整流程`);
26
+ steps.items.unshift(document.createNode({ use: 'gov/state-writable' }));
27
+ plan.push({ path, content: withYamlChanges(original, document) });
28
+ }
29
+ process.stdout.write(JSON.stringify(plan));
30
+ //# sourceMappingURL=upgrade-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade-command.js","sourceRoot":"","sources":["../src/upgrade-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAgD,CAAC;AAC5G,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3C,MAAM,IAAI,GAAwC,EAAE,CAAC;AACrD,MAAM,UAAU,GAAG,6BAA6B,CAAC;AACjD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAAE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UA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CAAC,CAAC;IACxE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;AACpE,CAAC;AACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function desktopAvailable(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
2
+ export declare function openPage(path: string, platform?: NodeJS.Platform): void;
3
+ export declare function writePage(root: string, name: string, title: string, markdown: string): string;
4
+ export declare function boundaryPage(root: string, name: string, markdown: string, status: string): string;
@@ -0,0 +1,51 @@
1
+ import { mkdirSync, writeFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { createHash } from 'node:crypto';
4
+ import { markdownHtml, renderHtmlPage, spawnCommandSync } from '@sumi/plugin-sdk';
5
+ import { BOUNDARY_HEADINGS, boundarySources, parseBoundary } from './boundary.js';
6
+ import { stateDir } from './state.js';
7
+ export function desktopAvailable(env = process.env, platform = process.platform) {
8
+ // 代理调用的 stdout 通常是管道,不能据此误判为无桌面。
9
+ if (env.CI || env.SSH_CONNECTION || env.SSH_TTY)
10
+ return false;
11
+ return platform === 'darwin' || platform === 'win32' || !!(env.DISPLAY || env.WAYLAND_DISPLAY);
12
+ }
13
+ export function openPage(path, platform = process.platform) {
14
+ const argv = platform === 'darwin' ? ['open', path] : platform === 'win32' ? ['cmd', '/c', 'start', '', path] : ['xdg-open', path];
15
+ const result = spawnCommandSync(argv[0], argv.slice(1), { stdio: 'ignore', windowsHide: true, timeout: 5000 });
16
+ if (result.status !== 0 || result.error)
17
+ throw new Error(`无法自动打开,请直接打开:${path}`);
18
+ }
19
+ export function writePage(root, name, title, markdown) {
20
+ const dir = join(stateDir(root), 'views');
21
+ mkdirSync(dir, { recursive: true });
22
+ const key = createHash('sha256').update(name).digest('hex').slice(0, 20);
23
+ const path = join(dir, `${key}.html`);
24
+ writeFileSync(path, renderHtmlPage(title, markdownHtml(markdown)));
25
+ return path;
26
+ }
27
+ export function boundaryPage(root, name, markdown, status) {
28
+ let content = `${status}\n\n按建议回复或逐条修改,确认由当前代理记录。\n\n`;
29
+ try {
30
+ const rows = parseBoundary(markdown);
31
+ const cell = (text) => text.replace(/\|/g, '\\|').replace(/\r?\n/g, ' ');
32
+ for (const section of BOUNDARY_HEADINGS) {
33
+ content += `## ${section}\n\n| 条目 | 建议默认答案 | 需要你拍板 |\n| --- | --- | --- |\n`;
34
+ content +=
35
+ rows
36
+ .filter((row) => row.section === section)
37
+ .map((row) => `| ${cell(row.text)} | ${cell(row.suggested)} | ${row.decision ? '是' : '否'} |`)
38
+ .join('\n') + '\n\n';
39
+ }
40
+ }
41
+ catch {
42
+ content += markdown;
43
+ }
44
+ const project = boundarySources(root, [])
45
+ .map((source) => source.text)
46
+ .join('\n\n');
47
+ if (project)
48
+ content += `\n\n## 项目常设边界\n\n${project}`;
49
+ return writePage(root, `boundary:${name}`, `边界约定 · ${name}`, content);
50
+ }
51
+ //# sourceMappingURL=view-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-page.js","sourceRoot":"","sources":["../src/view-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,gBAAgB,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,OA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tB,CAAC;IACD,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC;SACtC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;SAC5B,IAAI,CAAC,MAAM,CAAC,CAAC;IAChB,IAAI,OAAO;QAAE,OAAO,IAAI,oBAAoB,OAAO,EAAE,CAAC;IACtD,OAAO,SAAS,CAAC,IAAI,EAAE,YAAY,IAAI,EAAE,EAAE,UAAU,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;AACxE,CAAC"}
@@ -0,0 +1,35 @@
1
+ ---
2
+ description: 开发前与用户确认边界,非交互按保守默认记录
3
+ ---
4
+
5
+ # 先与用户确认边界
6
+
7
+ 需求开发、缺陷修复前 MUST 先套用 `control/rules/boundaries.md`,起草下面五节边界;只列与本任务相关、需要人拍板的条目,每条给建议默认答案。运行 `sumi boundary propose <草稿文件>`,CLI 生成并自动打开可视化确认页(无图形环境只打印路径,`--no-open` 可关闭)。按输出用宿主提问工具(如 AskUserQuestion)一次性问完,附页面路径;没有工具直接在对话提问。用户可一次回复“按建议”或逐条修改,不多轮追问。已有本任务的明确确认则直接记录,不重复提问。
8
+
9
+ ```markdown
10
+ ### 支持
11
+
12
+ - <本任务支持的真实入口>。建议默认:支持;需拍板:是。
13
+
14
+ ### 不处理
15
+
16
+ - <明确不实现的场景>。建议默认:不实现;需拍板:是。
17
+
18
+ ### 可接受的异常
19
+
20
+ - <异常发生时的保守行为>。建议默认:本轮 blocked 并提示;需拍板:是。
21
+
22
+ ### 兼容范围
23
+
24
+ - <版本、平台、旧数据>。建议默认:沿用项目声明;需拍板:是。
25
+
26
+ ### 人工兜底
27
+
28
+ - <超出范围由人处理的方式>。建议默认:补写约定或 sumi stop;需拍板:是。
29
+ ```
30
+
31
+ 回答后运行 `sumi boundary confirm <答案文件>`(答案沿用五节格式)或 `sumi boundary confirm --defaults`。关联 change 的结果同步写入 design,附“确认:用户,<日期>”;没有 change 的小缺陷在 PR 描述“边界约定”小节记录确认结果,共享会话账本保留原文。
32
+
33
+ `codex exec`、CI、编排方代派等非交互运行无法提问时,按常设边界和保守默认起草,用 `sumi boundary confirm --unconfirmed` 标注“确认:未经用户确认(非交互运行)”后继续。未确认只在简报和 pr-report 展示,不使检查 fail/blocked,不是审批。编辑前只要求已有记录;纯格式、文档等用 `sumi boundary skip --reason "原因"`。
34
+
35
+ 实现前读边界;约定外不实现,记入后续或请求人补充约定。人可随时 `sumi stop "原因"`,`sumi resume` 恢复。熔断后报告卡点与边界建议,保留人决定停或继续的权力。