oh-my-opencode 5.1.84 → 5.1.86

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 (405) hide show
  1. package/.agents/command/remove-deadcode.md +1 -1
  2. package/.agents/skills/remove-deadcode/SKILL.md +1 -1
  3. package/.agents/skills/work-with-pr/SKILL.md +2 -2
  4. package/.opencode/command/remove-deadcode.md +1 -1
  5. package/.opencode/skills/work-with-pr/SKILL.md +2 -2
  6. package/THIRD-PARTY-NOTICES.md +9 -3
  7. package/dist/cli/index.js +1022 -842
  8. package/dist/cli/service-auth/devices.d.ts +5 -2
  9. package/dist/cli-node/index.js +1022 -842
  10. package/dist/config/schema/agent-names.d.ts +1 -0
  11. package/dist/index.js +180 -205
  12. package/dist/skills/browser/SKILL.md +4 -1
  13. package/dist/skills/browser/references/commands.md +5 -2
  14. package/dist/skills/browser/references/desktop.md +1 -0
  15. package/dist/skills/browser/references/owned-engine/README.md +2 -0
  16. package/dist/skills/browser/references/owned-engine/frames-and-humans.md +2 -0
  17. package/dist/skills/browser/references/owned-engine/network.md +10 -5
  18. package/dist/skills/browser/references/recipes/1password.md +2 -0
  19. package/dist/skills/browser/runtime/omowright/index.js +11 -11
  20. package/dist/skills/browser/runtime/omowright/manifest.json +4 -4
  21. package/dist/skills/debugging/SKILL.md +1 -1
  22. package/dist/skills/git/SKILL.md +62 -0
  23. package/dist/skills/git/agents/openai.yaml +13 -0
  24. package/dist/skills/github/SKILL.md +94 -0
  25. package/dist/skills/github/references/branch-rules.md +129 -0
  26. package/dist/skills/github/references/evidence-attachments.md +16 -0
  27. package/dist/skills/github/references/repo-setup.md +152 -0
  28. package/dist/skills/github/references/waiting.md +52 -0
  29. package/dist/skills/github/references/workflows.md +161 -0
  30. package/dist/skills/github/scripts/cli.ts +8 -0
  31. package/dist/skills/github/scripts/package.json +12 -0
  32. package/dist/skills/github/scripts/sdk.ts +11 -0
  33. package/dist/skills/github/scripts/src/account.ts +243 -0
  34. package/dist/skills/github/scripts/src/actions-write.ts +86 -0
  35. package/dist/skills/github/scripts/src/actions.ts +210 -0
  36. package/dist/skills/github/scripts/src/attestations.ts +136 -0
  37. package/dist/skills/github/scripts/src/blake2b.ts +102 -0
  38. package/dist/skills/github/scripts/src/branch-protection.ts +192 -0
  39. package/dist/skills/github/scripts/src/caches.ts +105 -0
  40. package/dist/skills/github/scripts/src/checks.ts +107 -0
  41. package/dist/skills/github/scripts/src/codespaces.ts +230 -0
  42. package/dist/skills/github/scripts/src/conversation-lock.ts +50 -0
  43. package/dist/skills/github/scripts/src/discussion-list.ts +126 -0
  44. package/dist/skills/github/scripts/src/discussion-lookup.ts +127 -0
  45. package/dist/skills/github/scripts/src/discussions.ts +234 -0
  46. package/dist/skills/github/scripts/src/env.ts +100 -0
  47. package/dist/skills/github/scripts/src/errors.ts +79 -0
  48. package/dist/skills/github/scripts/src/fields.ts +27 -0
  49. package/dist/skills/github/scripts/src/gist-shape.ts +58 -0
  50. package/dist/skills/github/scripts/src/gists-write.ts +130 -0
  51. package/dist/skills/github/scripts/src/gists.ts +118 -0
  52. package/dist/skills/github/scripts/src/git-auth.ts +46 -0
  53. package/dist/skills/github/scripts/src/http.ts +159 -0
  54. package/dist/skills/github/scripts/src/issue-develop.ts +118 -0
  55. package/dist/skills/github/scripts/src/issues-extra.ts +135 -0
  56. package/dist/skills/github/scripts/src/issues-write.ts +174 -0
  57. package/dist/skills/github/scripts/src/issues.ts +156 -0
  58. package/dist/skills/github/scripts/src/keys.ts +176 -0
  59. package/dist/skills/github/scripts/src/labels.ts +209 -0
  60. package/dist/skills/github/scripts/src/merge.ts +115 -0
  61. package/dist/skills/github/scripts/src/poly1305.ts +22 -0
  62. package/dist/skills/github/scripts/src/pr-checkout.ts +92 -0
  63. package/dist/skills/github/scripts/src/pr-view.ts +106 -0
  64. package/dist/skills/github/scripts/src/project-fields.ts +144 -0
  65. package/dist/skills/github/scripts/src/project-item-edit.ts +153 -0
  66. package/dist/skills/github/scripts/src/project-items.ts +191 -0
  67. package/dist/skills/github/scripts/src/project-links.ts +104 -0
  68. package/dist/skills/github/scripts/src/project-ref.ts +145 -0
  69. package/dist/skills/github/scripts/src/project-state.ts +99 -0
  70. package/dist/skills/github/scripts/src/projects.ts +158 -0
  71. package/dist/skills/github/scripts/src/pulls-extra.ts +165 -0
  72. package/dist/skills/github/scripts/src/pulls-read.ts +176 -0
  73. package/dist/skills/github/scripts/src/pulls-review.ts +206 -0
  74. package/dist/skills/github/scripts/src/pulls-write.ts +187 -0
  75. package/dist/skills/github/scripts/src/raw.ts +78 -0
  76. package/dist/skills/github/scripts/src/read.ts +77 -0
  77. package/dist/skills/github/scripts/src/release-assets.ts +111 -0
  78. package/dist/skills/github/scripts/src/release-download.ts +151 -0
  79. package/dist/skills/github/scripts/src/release-write.ts +197 -0
  80. package/dist/skills/github/scripts/src/repo-admin.ts +112 -0
  81. package/dist/skills/github/scripts/src/repo-content.ts +187 -0
  82. package/dist/skills/github/scripts/src/repo-create.ts +139 -0
  83. package/dist/skills/github/scripts/src/repo-extras.ts +217 -0
  84. package/dist/skills/github/scripts/src/repo-list.ts +143 -0
  85. package/dist/skills/github/scripts/src/repo-settings.ts +176 -0
  86. package/dist/skills/github/scripts/src/repo-sync.ts +81 -0
  87. package/dist/skills/github/scripts/src/repo-url.ts +104 -0
  88. package/dist/skills/github/scripts/src/repos.ts +87 -0
  89. package/dist/skills/github/scripts/src/ruleset-shape.ts +96 -0
  90. package/dist/skills/github/scripts/src/rulesets-write.ts +124 -0
  91. package/dist/skills/github/scripts/src/rulesets.ts +80 -0
  92. package/dist/skills/github/scripts/src/run-download.ts +88 -0
  93. package/dist/skills/github/scripts/src/salsa20.ts +97 -0
  94. package/dist/skills/github/scripts/src/scopes.ts +165 -0
  95. package/dist/skills/github/scripts/src/sealed-box.ts +75 -0
  96. package/dist/skills/github/scripts/src/search-commits.ts +114 -0
  97. package/dist/skills/github/scripts/src/search.ts +116 -0
  98. package/dist/skills/github/scripts/src/secrets.ts +131 -0
  99. package/dist/skills/github/scripts/src/snappy.ts +57 -0
  100. package/dist/skills/github/scripts/src/status-search.ts +55 -0
  101. package/dist/skills/github/scripts/src/transfer.ts +97 -0
  102. package/dist/skills/github/scripts/src/types.ts +75 -0
  103. package/dist/skills/github/scripts/src/variables.ts +86 -0
  104. package/dist/skills/github/scripts/src/wait.ts +164 -0
  105. package/dist/skills/github/scripts/src/wire.ts +159 -0
  106. package/dist/skills/github/scripts/src/workflows.ts +144 -0
  107. package/dist/skills/github/scripts/src/zip.ts +104 -0
  108. package/dist/skills/github/scripts/surface.ts +106 -0
  109. package/dist/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
  110. package/dist/skills/github/scripts/vendor/surface/cli.ts +203 -0
  111. package/dist/skills/github/scripts/vendor/surface/flags.ts +195 -0
  112. package/dist/skills/github/scripts/vendor/surface/help.ts +89 -0
  113. package/dist/skills/github/scripts/vendor/surface/http.ts +180 -0
  114. package/dist/skills/github/scripts/vendor/surface/index.ts +44 -0
  115. package/dist/skills/github/scripts/vendor/surface/mcp.ts +241 -0
  116. package/dist/skills/github/scripts/vendor/surface/schema.ts +200 -0
  117. package/dist/skills/github/scripts/vendor/surface/stdio.ts +54 -0
  118. package/dist/skills/github/scripts/vendor/surface/surface.ts +250 -0
  119. package/dist/skills/github/scripts/vendor/surface/tools.ts +80 -0
  120. package/dist/skills/programming/SKILL.md +1 -1
  121. package/dist/skills/ulw-execute/SKILL.md +1 -1
  122. package/dist/tui.js +30 -27
  123. package/package.json +28 -26
  124. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  125. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  126. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  127. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  128. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  129. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  130. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  131. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  132. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  133. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
  134. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  135. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  136. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  137. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  138. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  139. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  140. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  141. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  142. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  143. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  144. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
  145. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  146. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
  147. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  148. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +1 -1
  149. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +3 -3
  150. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  151. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  152. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  153. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  154. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  155. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  156. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  157. package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
  158. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  159. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  160. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  161. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  162. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  163. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  164. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  165. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  166. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  167. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  168. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  169. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  170. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  171. package/packages/omo-codex/plugin/package-lock.json +12 -12
  172. package/packages/omo-codex/plugin/package.json +1 -1
  173. package/packages/omo-codex/plugin/skills/browser/SKILL.md +4 -1
  174. package/packages/omo-codex/plugin/skills/browser/references/commands.md +5 -2
  175. package/packages/omo-codex/plugin/skills/browser/references/desktop.md +1 -0
  176. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/README.md +2 -0
  177. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +2 -0
  178. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/network.md +10 -5
  179. package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +2 -0
  180. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +11 -11
  181. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +4 -4
  182. package/packages/omo-codex/plugin/skills/debugging/SKILL.md +1 -1
  183. package/packages/omo-codex/plugin/skills/git/SKILL.md +62 -0
  184. package/packages/omo-codex/plugin/skills/git/agents/openai.yaml +13 -0
  185. package/packages/omo-codex/plugin/skills/github/SKILL.md +94 -0
  186. package/packages/omo-codex/plugin/skills/github/agents/openai.yaml +2 -0
  187. package/packages/omo-codex/plugin/skills/github/references/branch-rules.md +129 -0
  188. package/packages/omo-codex/plugin/skills/github/references/evidence-attachments.md +16 -0
  189. package/packages/omo-codex/plugin/skills/github/references/repo-setup.md +152 -0
  190. package/packages/omo-codex/plugin/skills/github/references/waiting.md +52 -0
  191. package/packages/omo-codex/plugin/skills/github/references/workflows.md +161 -0
  192. package/packages/omo-codex/plugin/skills/github/scripts/cli.ts +8 -0
  193. package/packages/omo-codex/plugin/skills/github/scripts/package.json +12 -0
  194. package/packages/omo-codex/plugin/skills/github/scripts/sdk.ts +11 -0
  195. package/packages/omo-codex/plugin/skills/github/scripts/src/account.ts +243 -0
  196. package/packages/omo-codex/plugin/skills/github/scripts/src/actions-write.ts +86 -0
  197. package/packages/omo-codex/plugin/skills/github/scripts/src/actions.ts +210 -0
  198. package/packages/omo-codex/plugin/skills/github/scripts/src/attestations.ts +136 -0
  199. package/packages/omo-codex/plugin/skills/github/scripts/src/blake2b.ts +102 -0
  200. package/packages/omo-codex/plugin/skills/github/scripts/src/branch-protection.ts +192 -0
  201. package/packages/omo-codex/plugin/skills/github/scripts/src/caches.ts +105 -0
  202. package/packages/omo-codex/plugin/skills/github/scripts/src/checks.ts +107 -0
  203. package/packages/omo-codex/plugin/skills/github/scripts/src/codespaces.ts +230 -0
  204. package/packages/omo-codex/plugin/skills/github/scripts/src/conversation-lock.ts +50 -0
  205. package/packages/omo-codex/plugin/skills/github/scripts/src/discussion-list.ts +126 -0
  206. package/packages/omo-codex/plugin/skills/github/scripts/src/discussion-lookup.ts +127 -0
  207. package/packages/omo-codex/plugin/skills/github/scripts/src/discussions.ts +234 -0
  208. package/packages/omo-codex/plugin/skills/github/scripts/src/env.ts +100 -0
  209. package/packages/omo-codex/plugin/skills/github/scripts/src/errors.ts +79 -0
  210. package/packages/omo-codex/plugin/skills/github/scripts/src/fields.ts +27 -0
  211. package/packages/omo-codex/plugin/skills/github/scripts/src/gist-shape.ts +58 -0
  212. package/packages/omo-codex/plugin/skills/github/scripts/src/gists-write.ts +130 -0
  213. package/packages/omo-codex/plugin/skills/github/scripts/src/gists.ts +118 -0
  214. package/packages/omo-codex/plugin/skills/github/scripts/src/git-auth.ts +46 -0
  215. package/packages/omo-codex/plugin/skills/github/scripts/src/http.ts +159 -0
  216. package/packages/omo-codex/plugin/skills/github/scripts/src/issue-develop.ts +118 -0
  217. package/packages/omo-codex/plugin/skills/github/scripts/src/issues-extra.ts +135 -0
  218. package/packages/omo-codex/plugin/skills/github/scripts/src/issues-write.ts +174 -0
  219. package/packages/omo-codex/plugin/skills/github/scripts/src/issues.ts +156 -0
  220. package/packages/omo-codex/plugin/skills/github/scripts/src/keys.ts +176 -0
  221. package/packages/omo-codex/plugin/skills/github/scripts/src/labels.ts +209 -0
  222. package/packages/omo-codex/plugin/skills/github/scripts/src/merge.ts +115 -0
  223. package/packages/omo-codex/plugin/skills/github/scripts/src/poly1305.ts +22 -0
  224. package/packages/omo-codex/plugin/skills/github/scripts/src/pr-checkout.ts +92 -0
  225. package/packages/omo-codex/plugin/skills/github/scripts/src/pr-view.ts +106 -0
  226. package/packages/omo-codex/plugin/skills/github/scripts/src/project-fields.ts +144 -0
  227. package/packages/omo-codex/plugin/skills/github/scripts/src/project-item-edit.ts +153 -0
  228. package/packages/omo-codex/plugin/skills/github/scripts/src/project-items.ts +191 -0
  229. package/packages/omo-codex/plugin/skills/github/scripts/src/project-links.ts +104 -0
  230. package/packages/omo-codex/plugin/skills/github/scripts/src/project-ref.ts +145 -0
  231. package/packages/omo-codex/plugin/skills/github/scripts/src/project-state.ts +99 -0
  232. package/packages/omo-codex/plugin/skills/github/scripts/src/projects.ts +158 -0
  233. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-extra.ts +165 -0
  234. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-read.ts +176 -0
  235. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-review.ts +206 -0
  236. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-write.ts +187 -0
  237. package/packages/omo-codex/plugin/skills/github/scripts/src/raw.ts +78 -0
  238. package/packages/omo-codex/plugin/skills/github/scripts/src/read.ts +77 -0
  239. package/packages/omo-codex/plugin/skills/github/scripts/src/release-assets.ts +111 -0
  240. package/packages/omo-codex/plugin/skills/github/scripts/src/release-download.ts +151 -0
  241. package/packages/omo-codex/plugin/skills/github/scripts/src/release-write.ts +197 -0
  242. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-admin.ts +112 -0
  243. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-content.ts +187 -0
  244. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-create.ts +139 -0
  245. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-extras.ts +217 -0
  246. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-list.ts +143 -0
  247. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-settings.ts +176 -0
  248. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-sync.ts +81 -0
  249. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-url.ts +104 -0
  250. package/packages/omo-codex/plugin/skills/github/scripts/src/repos.ts +87 -0
  251. package/packages/omo-codex/plugin/skills/github/scripts/src/ruleset-shape.ts +96 -0
  252. package/packages/omo-codex/plugin/skills/github/scripts/src/rulesets-write.ts +124 -0
  253. package/packages/omo-codex/plugin/skills/github/scripts/src/rulesets.ts +80 -0
  254. package/packages/omo-codex/plugin/skills/github/scripts/src/run-download.ts +88 -0
  255. package/packages/omo-codex/plugin/skills/github/scripts/src/salsa20.ts +97 -0
  256. package/packages/omo-codex/plugin/skills/github/scripts/src/scopes.ts +165 -0
  257. package/packages/omo-codex/plugin/skills/github/scripts/src/sealed-box.ts +75 -0
  258. package/packages/omo-codex/plugin/skills/github/scripts/src/search-commits.ts +114 -0
  259. package/packages/omo-codex/plugin/skills/github/scripts/src/search.ts +116 -0
  260. package/packages/omo-codex/plugin/skills/github/scripts/src/secrets.ts +131 -0
  261. package/packages/omo-codex/plugin/skills/github/scripts/src/snappy.ts +57 -0
  262. package/packages/omo-codex/plugin/skills/github/scripts/src/status-search.ts +55 -0
  263. package/packages/omo-codex/plugin/skills/github/scripts/src/transfer.ts +97 -0
  264. package/packages/omo-codex/plugin/skills/github/scripts/src/types.ts +75 -0
  265. package/packages/omo-codex/plugin/skills/github/scripts/src/variables.ts +86 -0
  266. package/packages/omo-codex/plugin/skills/github/scripts/src/wait.ts +164 -0
  267. package/packages/omo-codex/plugin/skills/github/scripts/src/wire.ts +159 -0
  268. package/packages/omo-codex/plugin/skills/github/scripts/src/workflows.ts +144 -0
  269. package/packages/omo-codex/plugin/skills/github/scripts/src/zip.ts +104 -0
  270. package/packages/omo-codex/plugin/skills/github/scripts/surface.ts +106 -0
  271. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
  272. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/cli.ts +203 -0
  273. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/flags.ts +195 -0
  274. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/help.ts +89 -0
  275. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/http.ts +180 -0
  276. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/index.ts +44 -0
  277. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/mcp.ts +241 -0
  278. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/schema.ts +200 -0
  279. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/stdio.ts +54 -0
  280. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/surface.ts +250 -0
  281. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/tools.ts +80 -0
  282. package/packages/omo-codex/plugin/skills/programming/SKILL.md +1 -1
  283. package/packages/omo-codex/plugin/skills/ulw-execute/SKILL.md +1 -1
  284. package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +1 -1
  285. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +3 -3
  286. package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +1 -1
  287. package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +2 -1
  288. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +5 -5
  289. package/packages/omo-codex/scripts/install-dist/install-local.mjs +20 -15
  290. package/packages/shared-skills/skills/browser/SKILL.md +4 -1
  291. package/packages/shared-skills/skills/browser/references/commands.md +5 -2
  292. package/packages/shared-skills/skills/browser/references/desktop.md +1 -0
  293. package/packages/shared-skills/skills/browser/references/owned-engine/README.md +2 -0
  294. package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +2 -0
  295. package/packages/shared-skills/skills/browser/references/owned-engine/network.md +10 -5
  296. package/packages/shared-skills/skills/browser/references/recipes/1password.md +2 -0
  297. package/packages/shared-skills/skills/browser/runtime/omowright/index.js +11 -11
  298. package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +4 -4
  299. package/packages/shared-skills/skills/debugging/SKILL.md +1 -1
  300. package/packages/shared-skills/skills/git/SKILL.md +62 -0
  301. package/packages/shared-skills/skills/git/agents/openai.yaml +13 -0
  302. package/packages/shared-skills/skills/github/SKILL.md +94 -0
  303. package/packages/shared-skills/skills/github/references/branch-rules.md +129 -0
  304. package/packages/shared-skills/skills/github/references/evidence-attachments.md +16 -0
  305. package/packages/shared-skills/skills/github/references/repo-setup.md +152 -0
  306. package/packages/shared-skills/skills/github/references/waiting.md +52 -0
  307. package/packages/shared-skills/skills/github/references/workflows.md +161 -0
  308. package/packages/shared-skills/skills/github/scripts/cli.ts +8 -0
  309. package/packages/shared-skills/skills/github/scripts/package.json +12 -0
  310. package/packages/shared-skills/skills/github/scripts/sdk.ts +11 -0
  311. package/packages/shared-skills/skills/github/scripts/src/account.ts +243 -0
  312. package/packages/shared-skills/skills/github/scripts/src/actions-write.ts +86 -0
  313. package/packages/shared-skills/skills/github/scripts/src/actions.ts +210 -0
  314. package/packages/shared-skills/skills/github/scripts/src/attestations.ts +136 -0
  315. package/packages/shared-skills/skills/github/scripts/src/blake2b.ts +102 -0
  316. package/packages/shared-skills/skills/github/scripts/src/branch-protection.ts +192 -0
  317. package/packages/shared-skills/skills/github/scripts/src/caches.ts +105 -0
  318. package/packages/shared-skills/skills/github/scripts/src/checks.ts +107 -0
  319. package/packages/shared-skills/skills/github/scripts/src/codespaces.ts +230 -0
  320. package/packages/shared-skills/skills/github/scripts/src/conversation-lock.ts +50 -0
  321. package/packages/shared-skills/skills/github/scripts/src/discussion-list.ts +126 -0
  322. package/packages/shared-skills/skills/github/scripts/src/discussion-lookup.ts +127 -0
  323. package/packages/shared-skills/skills/github/scripts/src/discussions.ts +234 -0
  324. package/packages/shared-skills/skills/github/scripts/src/env.ts +100 -0
  325. package/packages/shared-skills/skills/github/scripts/src/errors.ts +79 -0
  326. package/packages/shared-skills/skills/github/scripts/src/fields.ts +27 -0
  327. package/packages/shared-skills/skills/github/scripts/src/gist-shape.ts +58 -0
  328. package/packages/shared-skills/skills/github/scripts/src/gists-write.ts +130 -0
  329. package/packages/shared-skills/skills/github/scripts/src/gists.ts +118 -0
  330. package/packages/shared-skills/skills/github/scripts/src/git-auth.ts +46 -0
  331. package/packages/shared-skills/skills/github/scripts/src/http.ts +159 -0
  332. package/packages/shared-skills/skills/github/scripts/src/issue-develop.ts +118 -0
  333. package/packages/shared-skills/skills/github/scripts/src/issues-extra.ts +135 -0
  334. package/packages/shared-skills/skills/github/scripts/src/issues-write.ts +174 -0
  335. package/packages/shared-skills/skills/github/scripts/src/issues.ts +156 -0
  336. package/packages/shared-skills/skills/github/scripts/src/keys.ts +176 -0
  337. package/packages/shared-skills/skills/github/scripts/src/labels.ts +209 -0
  338. package/packages/shared-skills/skills/github/scripts/src/merge.ts +115 -0
  339. package/packages/shared-skills/skills/github/scripts/src/poly1305.ts +22 -0
  340. package/packages/shared-skills/skills/github/scripts/src/pr-checkout.ts +92 -0
  341. package/packages/shared-skills/skills/github/scripts/src/pr-view.ts +106 -0
  342. package/packages/shared-skills/skills/github/scripts/src/project-fields.ts +144 -0
  343. package/packages/shared-skills/skills/github/scripts/src/project-item-edit.ts +153 -0
  344. package/packages/shared-skills/skills/github/scripts/src/project-items.ts +191 -0
  345. package/packages/shared-skills/skills/github/scripts/src/project-links.ts +104 -0
  346. package/packages/shared-skills/skills/github/scripts/src/project-ref.ts +145 -0
  347. package/packages/shared-skills/skills/github/scripts/src/project-state.ts +99 -0
  348. package/packages/shared-skills/skills/github/scripts/src/projects.ts +158 -0
  349. package/packages/shared-skills/skills/github/scripts/src/pulls-extra.ts +165 -0
  350. package/packages/shared-skills/skills/github/scripts/src/pulls-read.ts +176 -0
  351. package/packages/shared-skills/skills/github/scripts/src/pulls-review.ts +206 -0
  352. package/packages/shared-skills/skills/github/scripts/src/pulls-write.ts +187 -0
  353. package/packages/shared-skills/skills/github/scripts/src/raw.ts +78 -0
  354. package/packages/shared-skills/skills/github/scripts/src/read.ts +77 -0
  355. package/packages/shared-skills/skills/github/scripts/src/release-assets.ts +111 -0
  356. package/packages/shared-skills/skills/github/scripts/src/release-download.ts +151 -0
  357. package/packages/shared-skills/skills/github/scripts/src/release-write.ts +197 -0
  358. package/packages/shared-skills/skills/github/scripts/src/repo-admin.ts +112 -0
  359. package/packages/shared-skills/skills/github/scripts/src/repo-content.ts +187 -0
  360. package/packages/shared-skills/skills/github/scripts/src/repo-create.ts +139 -0
  361. package/packages/shared-skills/skills/github/scripts/src/repo-extras.ts +217 -0
  362. package/packages/shared-skills/skills/github/scripts/src/repo-list.ts +143 -0
  363. package/packages/shared-skills/skills/github/scripts/src/repo-settings.ts +176 -0
  364. package/packages/shared-skills/skills/github/scripts/src/repo-sync.ts +81 -0
  365. package/packages/shared-skills/skills/github/scripts/src/repo-url.ts +104 -0
  366. package/packages/shared-skills/skills/github/scripts/src/repos.ts +87 -0
  367. package/packages/shared-skills/skills/github/scripts/src/ruleset-shape.ts +96 -0
  368. package/packages/shared-skills/skills/github/scripts/src/rulesets-write.ts +124 -0
  369. package/packages/shared-skills/skills/github/scripts/src/rulesets.ts +80 -0
  370. package/packages/shared-skills/skills/github/scripts/src/run-download.ts +88 -0
  371. package/packages/shared-skills/skills/github/scripts/src/salsa20.ts +97 -0
  372. package/packages/shared-skills/skills/github/scripts/src/scopes.ts +165 -0
  373. package/packages/shared-skills/skills/github/scripts/src/sealed-box.ts +75 -0
  374. package/packages/shared-skills/skills/github/scripts/src/search-commits.ts +114 -0
  375. package/packages/shared-skills/skills/github/scripts/src/search.ts +116 -0
  376. package/packages/shared-skills/skills/github/scripts/src/secrets.ts +131 -0
  377. package/packages/shared-skills/skills/github/scripts/src/snappy.ts +57 -0
  378. package/packages/shared-skills/skills/github/scripts/src/status-search.ts +55 -0
  379. package/packages/shared-skills/skills/github/scripts/src/transfer.ts +97 -0
  380. package/packages/shared-skills/skills/github/scripts/src/types.ts +75 -0
  381. package/packages/shared-skills/skills/github/scripts/src/variables.ts +86 -0
  382. package/packages/shared-skills/skills/github/scripts/src/wait.ts +164 -0
  383. package/packages/shared-skills/skills/github/scripts/src/wire.ts +159 -0
  384. package/packages/shared-skills/skills/github/scripts/src/workflows.ts +144 -0
  385. package/packages/shared-skills/skills/github/scripts/src/zip.ts +104 -0
  386. package/packages/shared-skills/skills/github/scripts/surface.ts +106 -0
  387. package/packages/shared-skills/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
  388. package/packages/shared-skills/skills/github/scripts/vendor/surface/cli.ts +203 -0
  389. package/packages/shared-skills/skills/github/scripts/vendor/surface/flags.ts +195 -0
  390. package/packages/shared-skills/skills/github/scripts/vendor/surface/help.ts +89 -0
  391. package/packages/shared-skills/skills/github/scripts/vendor/surface/http.ts +180 -0
  392. package/packages/shared-skills/skills/github/scripts/vendor/surface/index.ts +44 -0
  393. package/packages/shared-skills/skills/github/scripts/vendor/surface/mcp.ts +241 -0
  394. package/packages/shared-skills/skills/github/scripts/vendor/surface/schema.ts +200 -0
  395. package/packages/shared-skills/skills/github/scripts/vendor/surface/stdio.ts +54 -0
  396. package/packages/shared-skills/skills/github/scripts/vendor/surface/surface.ts +250 -0
  397. package/packages/shared-skills/skills/github/scripts/vendor/surface/tools.ts +80 -0
  398. package/packages/shared-skills/skills/programming/SKILL.md +1 -1
  399. package/packages/shared-skills/skills/ulw-execute/SKILL.md +1 -1
  400. package/dist/skills/git-master/SKILL.md +0 -114
  401. package/dist/skills/git-master/agents/openai.yaml +0 -13
  402. package/packages/omo-codex/plugin/skills/git-master/SKILL.md +0 -114
  403. package/packages/omo-codex/plugin/skills/git-master/agents/openai.yaml +0 -13
  404. package/packages/shared-skills/skills/git-master/SKILL.md +0 -114
  405. package/packages/shared-skills/skills/git-master/agents/openai.yaml +0 -13
@@ -0,0 +1,210 @@
1
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
2
+ import { enc, limitField, reads, repoField, writes } from "./fields.ts";
3
+ import type { GitHub } from "./http.ts";
4
+ import { arr, at, num, optNum, optStr, str } from "./read.ts";
5
+
6
+ const runIdField = s.integer({
7
+ description:
8
+ "Workflow run id (databaseId; the number in .../actions/runs/<id>).",
9
+ });
10
+ const FAILED = new Set([
11
+ "failure",
12
+ "timed_out",
13
+ "startup_failure",
14
+ "cancelled",
15
+ ]);
16
+ const STAMP = /^\d{4}-\d\d-\d\dT[\d:.]+Z /;
17
+
18
+ export const runSummary = (w: unknown) => ({
19
+ id: num(w, "id"),
20
+ workflow: optStr(w, "name"),
21
+ title: optStr(w, "display_title"),
22
+ status: str(w, "status"),
23
+ conclusion: optStr(w, "conclusion"),
24
+ event: str(w, "event"),
25
+ branch: optStr(w, "head_branch"),
26
+ sha: str(w, "head_sha"),
27
+ attempt: optNum(w, "run_attempt") ?? 1,
28
+ createdAt: str(w, "created_at"),
29
+ updatedAt: optStr(w, "updated_at"),
30
+ url: str(w, "html_url"),
31
+ });
32
+
33
+ const jobSummary = (j: unknown) => ({
34
+ id: num(j, "id"),
35
+ name: str(j, "name"),
36
+ status: str(j, "status"),
37
+ conclusion: optStr(j, "conclusion"),
38
+ startedAt: optStr(j, "started_at"),
39
+ completedAt: optStr(j, "completed_at"),
40
+ url: optStr(j, "html_url"),
41
+ failedSteps: arr(at(j, "steps") ?? [], "steps").flatMap((st) =>
42
+ FAILED.has(optStr(st, "conclusion") ?? "") ? [str(st, "name")] : [],
43
+ ),
44
+ });
45
+
46
+ export const runJobs = async (gh: GitHub, full: string, runId: number) =>
47
+ (
48
+ await gh.list(`repos/${full}/actions/runs/${runId}/jobs`, 300, {
49
+ query: { filter: "latest" },
50
+ key: "jobs",
51
+ })
52
+ ).map(jobSummary);
53
+
54
+ export const actionOps = (gh: GitHub) => ({
55
+ list: op({
56
+ description:
57
+ "Recent workflow runs, filterable by workflow file/name, branch, commit SHA, event or status. Replaces `gh run list`.",
58
+ input: s.object({
59
+ repo: repoField,
60
+ workflow: s.optional(
61
+ s.string({ description: "Workflow file name (ci.yml) or id." }),
62
+ ),
63
+ branch: s.optional(s.string()),
64
+ sha: s.optional(s.string({ description: "Head commit SHA." })),
65
+ event: s.optional(s.string()),
66
+ status: s.optional(
67
+ s.enum([
68
+ "queued",
69
+ "in_progress",
70
+ "completed",
71
+ "success",
72
+ "failure",
73
+ "cancelled",
74
+ "waiting",
75
+ "requested",
76
+ "pending",
77
+ ]),
78
+ ),
79
+ limit: limitField(20),
80
+ }),
81
+ annotations: reads,
82
+ run: async ({ repo, workflow, branch, sha, event, status, limit }) => {
83
+ const r = await gh.repo(repo);
84
+ const path =
85
+ workflow === undefined
86
+ ? `repos/${r.full}/actions/runs`
87
+ : `repos/${r.full}/actions/workflows/${enc(workflow)}/runs`;
88
+ const raw = await gh.list(path, limit ?? 20, {
89
+ query: { branch, head_sha: sha, event, status },
90
+ key: "workflow_runs",
91
+ });
92
+ return { repo: r.full, runs: raw.map(runSummary) };
93
+ },
94
+ }),
95
+ view: op({
96
+ description:
97
+ "One workflow run with its latest-attempt jobs and the names of failed steps. Replaces `gh run view`.",
98
+ input: s.object({ repo: repoField, runId: runIdField }),
99
+ annotations: reads,
100
+ run: async ({ repo, runId }) => {
101
+ const r = await gh.repo(repo);
102
+ const run = runSummary(
103
+ await gh.rest("GET", `repos/${r.full}/actions/runs/${runId}`),
104
+ );
105
+ return { repo: r.full, ...run, jobs: await runJobs(gh, r.full, runId) };
106
+ },
107
+ }),
108
+ logs: op({
109
+ description:
110
+ "Log tails of a run's failed jobs (or one job), timestamps stripped, optionally only lines matching a regex. Replaces `gh run view --log-failed`.",
111
+ input: s.object({
112
+ repo: repoField,
113
+ runId: s.optional(runIdField),
114
+ jobId: s.optional(
115
+ s.integer({ description: "One job id; overrides runId." }),
116
+ ),
117
+ allJobs: s.optional(
118
+ s.boolean({ description: "Include jobs that did not fail." }),
119
+ ),
120
+ tail: s.optional(
121
+ s.integer({ description: "Last N lines per job (default 150)." }),
122
+ ),
123
+ grep: s.optional(
124
+ s.string({
125
+ description:
126
+ "Case-insensitive regex; keep only matching lines (applied before tail).",
127
+ }),
128
+ ),
129
+ }),
130
+ annotations: reads,
131
+ run: async ({ repo, runId, jobId, allJobs, tail, grep }) => {
132
+ const r = await gh.repo(repo);
133
+ const pattern = grep === undefined ? undefined : new RegExp(grep, "i");
134
+ let jobs: {
135
+ readonly id: number;
136
+ readonly name: string;
137
+ readonly conclusion: string | null;
138
+ }[];
139
+ if (jobId !== undefined) {
140
+ const j = await gh.rest("GET", `repos/${r.full}/actions/jobs/${jobId}`);
141
+ jobs = [
142
+ {
143
+ id: jobId,
144
+ name: str(j, "name"),
145
+ conclusion: optStr(j, "conclusion"),
146
+ },
147
+ ];
148
+ } else if (runId !== undefined) {
149
+ jobs = (await runJobs(gh, r.full, runId)).filter(
150
+ (j) => allJobs === true || FAILED.has(j.conclusion ?? ""),
151
+ );
152
+ } else {
153
+ throw new SurfaceError(
154
+ "usage",
155
+ "pass runId or jobId",
156
+ "find run ids with `run list` or `pr checks`",
157
+ );
158
+ }
159
+ return Promise.all(
160
+ jobs.map(async (j) => {
161
+ const lines = (
162
+ await gh.logs(`repos/${r.full}/actions/jobs/${j.id}/logs`)
163
+ )
164
+ .trimEnd()
165
+ .split(/\r?\n/)
166
+ .map((l) => l.replace(STAMP, ""));
167
+ const kept =
168
+ pattern === undefined
169
+ ? lines
170
+ : lines.filter((l) => pattern.test(l));
171
+ return {
172
+ jobId: j.id,
173
+ name: j.name,
174
+ conclusion: j.conclusion,
175
+ totalLines: lines.length,
176
+ lines: kept.slice(-(tail ?? 150)),
177
+ };
178
+ }),
179
+ );
180
+ },
181
+ }),
182
+ dispatch: op({
183
+ description:
184
+ "Trigger a workflow_dispatch workflow on a ref with inputs. Replaces `gh workflow run`.",
185
+ input: s.object({
186
+ repo: repoField,
187
+ workflow: s.string({
188
+ description: "Workflow file name (release.yml) or id.",
189
+ }),
190
+ ref: s.optional(
191
+ s.string({
192
+ description: "Branch or tag; default branch when omitted.",
193
+ }),
194
+ ),
195
+ inputs: s.optional(s.record(s.string())),
196
+ }),
197
+ annotations: writes,
198
+ run: async ({ repo, workflow, ref, inputs }) => {
199
+ const r = await gh.repo(repo);
200
+ const target =
201
+ ref ?? str(await gh.rest("GET", `repos/${r.full}`), "default_branch");
202
+ await gh.rest(
203
+ "POST",
204
+ `repos/${r.full}/actions/workflows/${enc(workflow)}/dispatches`,
205
+ { body: { ref: target, inputs: inputs ?? {} } },
206
+ );
207
+ return { repo: r.full, workflow, ref: target, dispatched: true };
208
+ },
209
+ }),
210
+ });
@@ -0,0 +1,136 @@
1
+ // Artifact attestations: fetch the Sigstore bundles GitHub stores for an artifact digest (no verification).
2
+ import { join } from "node:path";
3
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
4
+ import { enc, limitField, reads } from "./fields.ts";
5
+ import type { GitHub } from "./http.ts";
6
+ import { at, isObj, num, optStr, str } from "./read.ts";
7
+ import { unsnappy } from "./snappy.ts";
8
+
9
+ const DIGEST = /^(sha256|sha512):[0-9a-f]+$/;
10
+
11
+ const fileDigest = async (path: string, alg: "sha256" | "sha512") => {
12
+ const file = Bun.file(path);
13
+ if (!(await file.exists()))
14
+ throw new SurfaceError(
15
+ "usage",
16
+ `no such file: ${path}`,
17
+ "pass a local artifact path or digest",
18
+ );
19
+ const hasher = new Bun.CryptoHasher(alg);
20
+ for await (const chunk of file.stream()) hasher.update(chunk);
21
+ return `${alg}:${hasher.digest("hex")}`;
22
+ };
23
+
24
+ export const attestationOps = (gh: GitHub) => ({
25
+ list: op({
26
+ description:
27
+ "Fetch the attestations (Sigstore bundles) stored for an artifact, by a local file whose digest is computed here or by a ready digest, scoped to a repository or an owner; with dir, also write <digest>.jsonl there. This fetches attestations and does NOT verify them. Replaces `gh attestation download`.",
28
+ input: s.object({
29
+ file: s.optional(
30
+ s.string({ description: "Local artifact path to digest." }),
31
+ ),
32
+ digest: s.optional(
33
+ s.string({ description: "sha256:<hex> or sha512:<hex>." }),
34
+ ),
35
+ digestAlg: s.optional(s.enum(["sha256", "sha512"])),
36
+ repo: s.optional(
37
+ s.string({
38
+ description:
39
+ "owner/name; defaults to the git origin when owner is not given.",
40
+ }),
41
+ ),
42
+ owner: s.optional(
43
+ s.string({
44
+ description: "Organization or user login instead of repo.",
45
+ }),
46
+ ),
47
+ predicateType: s.optional(
48
+ s.string({ description: "e.g. https://slsa.dev/provenance/v1" }),
49
+ ),
50
+ limit: limitField(30),
51
+ dir: s.optional(
52
+ s.string({ description: "Directory to write <digest>.jsonl into." }),
53
+ ),
54
+ }),
55
+ annotations: reads,
56
+ run: async (input) => {
57
+ if ((input.file === undefined) === (input.digest === undefined))
58
+ throw new SurfaceError(
59
+ "usage",
60
+ "pass exactly one of file or digest",
61
+ "digest looks like sha256:<hex>",
62
+ );
63
+ if (input.repo !== undefined && input.owner !== undefined)
64
+ throw new SurfaceError(
65
+ "usage",
66
+ "pass repo or owner, not both",
67
+ "owner covers every repository it owns",
68
+ );
69
+ const digest =
70
+ input.file === undefined
71
+ ? (input.digest ?? "").toLowerCase()
72
+ : await fileDigest(input.file, input.digestAlg ?? "sha256");
73
+ if (!DIGEST.test(digest))
74
+ throw new SurfaceError(
75
+ "usage",
76
+ `not a digest: ${digest}`,
77
+ "use sha256:<hex> or sha512:<hex>",
78
+ );
79
+ let scope: { readonly repo: string } | { readonly owner: string };
80
+ let path: string;
81
+ if (input.owner === undefined) {
82
+ const r = await gh.repo(input.repo);
83
+ scope = { repo: r.full };
84
+ path = `repos/${r.full}/attestations/${enc(digest)}`;
85
+ } else {
86
+ const kind = str(
87
+ await gh.rest("GET", `users/${enc(input.owner)}`),
88
+ "type",
89
+ );
90
+ scope = { owner: input.owner };
91
+ path = `${kind === "Organization" ? "orgs" : "users"}/${enc(input.owner)}/attestations/${enc(digest)}`;
92
+ }
93
+ const raw = await gh.list(path, input.limit ?? 30, {
94
+ query: { predicate_type: input.predicateType },
95
+ key: "attestations",
96
+ });
97
+ const items = await Promise.all(
98
+ raw.map(async (a) => {
99
+ const inline = at(a, "bundle");
100
+ const url = optStr(a, "bundle_url");
101
+ const bundle: unknown =
102
+ isObj(inline) || url === null
103
+ ? inline
104
+ : JSON.parse(
105
+ new TextDecoder().decode(unsnappy(await gh.content(url))),
106
+ );
107
+ if (!isObj(bundle))
108
+ throw new SurfaceError(
109
+ "invalid_response",
110
+ "attestation has no bundle",
111
+ "inspect it with `api rest`",
112
+ );
113
+ return { repositoryId: num(a, "repository_id"), bundle };
114
+ }),
115
+ );
116
+ const out =
117
+ input.dir === undefined
118
+ ? undefined
119
+ : join(
120
+ input.dir,
121
+ `${process.platform === "win32" ? digest.replace(":", "-") : digest}.jsonl`,
122
+ );
123
+ if (out !== undefined)
124
+ await Bun.write(
125
+ out,
126
+ items.map((i) => `${JSON.stringify(i.bundle)}\n`).join(""),
127
+ );
128
+ return {
129
+ ...scope,
130
+ digest,
131
+ items,
132
+ ...(out === undefined ? {} : { path: out }),
133
+ };
134
+ },
135
+ }),
136
+ });
@@ -0,0 +1,102 @@
1
+ // Unkeyed BLAKE2b (RFC 7693) with any digest length up to 64 bytes; node:crypto under Bun only produces the 64-byte digest.
2
+ const IV = new BigUint64Array([
3
+ 0x6a09e667f3bcc908n,
4
+ 0xbb67ae8584caa73bn,
5
+ 0x3c6ef372fe94f82bn,
6
+ 0xa54ff53a5f1d36f1n,
7
+ 0x510e527fade682d1n,
8
+ 0x9b05688c2b3e6c1fn,
9
+ 0x1f83d9abfb41bd6bn,
10
+ 0x5be0cd19137e2179n,
11
+ ]);
12
+
13
+ const SIGMA = [
14
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
15
+ [14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3],
16
+ [11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4],
17
+ [7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8],
18
+ [9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13],
19
+ [2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9],
20
+ [12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11],
21
+ [13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10],
22
+ [6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5],
23
+ [10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0],
24
+ ] as const;
25
+
26
+ const BLOCK = 128;
27
+ const MASK = (1n << 64n) - 1n;
28
+
29
+ const word = (a: BigUint64Array, i: number): bigint => a[i] ?? 0n;
30
+ const rotr = (x: bigint, n: bigint): bigint =>
31
+ ((x >> n) | (x << (64n - n))) & MASK;
32
+
33
+ const mix = (
34
+ v: BigUint64Array,
35
+ [a, b, c, d]: readonly [number, number, number, number],
36
+ x: bigint,
37
+ y: bigint,
38
+ ): void => {
39
+ v[a] = word(v, a) + word(v, b) + x;
40
+ v[d] = rotr(word(v, d) ^ word(v, a), 32n);
41
+ v[c] = word(v, c) + word(v, d);
42
+ v[b] = rotr(word(v, b) ^ word(v, c), 24n);
43
+ v[a] = word(v, a) + word(v, b) + y;
44
+ v[d] = rotr(word(v, d) ^ word(v, a), 16n);
45
+ v[c] = word(v, c) + word(v, d);
46
+ v[b] = rotr(word(v, b) ^ word(v, c), 63n);
47
+ };
48
+
49
+ const LANES = [
50
+ [0, 4, 8, 12],
51
+ [1, 5, 9, 13],
52
+ [2, 6, 10, 14],
53
+ [3, 7, 11, 15],
54
+ [0, 5, 10, 15],
55
+ [1, 6, 11, 12],
56
+ [2, 7, 8, 13],
57
+ [3, 4, 9, 14],
58
+ ] as const;
59
+
60
+ const compress = (
61
+ h: BigUint64Array,
62
+ block: Uint8Array,
63
+ counter: bigint,
64
+ last: boolean,
65
+ ): void => {
66
+ const view = new DataView(block.buffer, block.byteOffset, BLOCK);
67
+ const m = BigUint64Array.from({ length: 16 }, (_, i) =>
68
+ view.getBigUint64(i * 8, true),
69
+ );
70
+ const v = new BigUint64Array(16);
71
+ v.set(h);
72
+ v.set(IV, 8);
73
+ v[12] = word(v, 12) ^ (counter & MASK);
74
+ v[13] = word(v, 13) ^ (counter >> 64n);
75
+ if (last) v[14] = word(v, 14) ^ MASK;
76
+ for (let round = 0; round < 12; round++) {
77
+ const s = SIGMA[round % 10] ?? SIGMA[0];
78
+ LANES.forEach((lane, i) =>
79
+ mix(v, lane, word(m, s[2 * i] ?? 0), word(m, s[2 * i + 1] ?? 0)),
80
+ );
81
+ }
82
+ for (let i = 0; i < 8; i++) h[i] = word(h, i) ^ word(v, i) ^ word(v, i + 8);
83
+ };
84
+
85
+ export const blake2b = (data: Uint8Array, outLength: number): Uint8Array => {
86
+ if (!Number.isInteger(outLength) || outLength < 1 || outLength > 64)
87
+ throw new RangeError("BLAKE2b digest length must be 1-64 bytes");
88
+ const h = new BigUint64Array(IV);
89
+ h[0] = word(h, 0) ^ (0x01010000n | BigInt(outLength));
90
+ const blocks = Math.max(1, Math.ceil(data.length / BLOCK));
91
+ for (let i = 0; i < blocks; i++) {
92
+ const block = new Uint8Array(BLOCK);
93
+ const chunk = data.subarray(i * BLOCK, (i + 1) * BLOCK);
94
+ block.set(chunk);
95
+ const last = i === blocks - 1;
96
+ compress(h, block, BigInt(i * BLOCK + chunk.length), last);
97
+ }
98
+ const out = new Uint8Array(64);
99
+ const view = new DataView(out.buffer);
100
+ h.forEach((x, i) => view.setBigUint64(i * 8, x, true));
101
+ return out.slice(0, outLength);
102
+ };
@@ -0,0 +1,192 @@
1
+ // Classic branch protection (repos/{o}/{n}/branches/{branch}/protection): view, set and delete.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { enc, irreversible, reads, repoField, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { arr, at, bool, isObj, optNum, str } from "./read.ts";
6
+
7
+ const branchField = s.string({ description: "Branch name." });
8
+ const check = s.object({
9
+ context: s.string(),
10
+ appId: s.optional(
11
+ s.integer({
12
+ description:
13
+ "Only this GitHub App may report the check (15368 = Actions).",
14
+ }),
15
+ ),
16
+ });
17
+
18
+ const enabled = (x: unknown, key: string): boolean => bool(x, key, "enabled");
19
+ const names = (x: unknown, key: string, field: string): string[] =>
20
+ arr(at(x, key) ?? [], key).map((n) => str(n, field));
21
+
22
+ const trim = (x: unknown) => {
23
+ const checks = at(x, "required_status_checks");
24
+ const reviews = at(x, "required_pull_request_reviews");
25
+ const restrictions = at(x, "restrictions");
26
+ return {
27
+ protected: true,
28
+ requiredChecks: isObj(checks)
29
+ ? {
30
+ strict: bool(checks, "strict"),
31
+ checks: arr(at(checks, "checks") ?? [], "checks").map((c) => ({
32
+ context: str(c, "context"),
33
+ appId: optNum(c, "app_id"),
34
+ })),
35
+ }
36
+ : null,
37
+ requiredApprovingReviewCount: isObj(reviews)
38
+ ? (optNum(reviews, "required_approving_review_count") ?? 0)
39
+ : null,
40
+ dismissStaleReviews: isObj(reviews)
41
+ ? bool(reviews, "dismiss_stale_reviews")
42
+ : null,
43
+ requireCodeOwnerReviews: isObj(reviews)
44
+ ? bool(reviews, "require_code_owner_reviews")
45
+ : null,
46
+ enforceAdmins: enabled(x, "enforce_admins"),
47
+ requiredLinearHistory: enabled(x, "required_linear_history"),
48
+ allowForcePushes: enabled(x, "allow_force_pushes"),
49
+ allowDeletions: enabled(x, "allow_deletions"),
50
+ requiredConversationResolution: enabled(
51
+ x,
52
+ "required_conversation_resolution",
53
+ ),
54
+ restrictions: isObj(restrictions)
55
+ ? {
56
+ users: names(restrictions, "users", "login"),
57
+ teams: names(restrictions, "teams", "slug"),
58
+ apps: names(restrictions, "apps", "slug"),
59
+ }
60
+ : null,
61
+ };
62
+ };
63
+
64
+ const notProtected = (error: unknown): boolean =>
65
+ error instanceof SurfaceError &&
66
+ error.kind === "not_found" &&
67
+ /not protected/i.test(error.message);
68
+
69
+ export const branchProtectionOps = (gh: GitHub) => ({
70
+ view: op({
71
+ description:
72
+ "A branch's classic protection settings, or `{ protected: false }` when it has none (rulesets are separate: see `ruleset check`). Needs admin access.",
73
+ input: s.object({ repo: repoField, branch: branchField }),
74
+ annotations: reads,
75
+ run: async ({ repo, branch }) => {
76
+ const r = await gh.repo(repo);
77
+ try {
78
+ const x = await gh.rest(
79
+ "GET",
80
+ `repos/${r.full}/branches/${enc(branch)}/protection`,
81
+ );
82
+ return { repo: r.full, branch, ...trim(x) };
83
+ } catch (error) {
84
+ if (notProtected(error))
85
+ return { repo: r.full, branch, protected: false };
86
+ throw error;
87
+ }
88
+ },
89
+ }),
90
+ set: op({
91
+ description:
92
+ "Replace a branch's classic protection with the given settings; anything not passed is turned off. Needs admin access.",
93
+ input: s.object({
94
+ repo: repoField,
95
+ branch: branchField,
96
+ requiredChecks: s.optional(
97
+ s.object({
98
+ strict: s.optional(
99
+ s.boolean({ description: "Branch must be up to date first." }),
100
+ ),
101
+ checks: s.array(check),
102
+ }),
103
+ ),
104
+ requiredApprovingReviewCount: s.optional(s.integer()),
105
+ dismissStaleReviews: s.optional(s.boolean()),
106
+ requireCodeOwnerReviews: s.optional(s.boolean()),
107
+ enforceAdmins: s.optional(s.boolean()),
108
+ requiredLinearHistory: s.optional(s.boolean()),
109
+ allowForcePushes: s.optional(s.boolean()),
110
+ allowDeletions: s.optional(s.boolean()),
111
+ requiredConversationResolution: s.optional(s.boolean()),
112
+ restrictions: s.optional(
113
+ s.object(
114
+ {
115
+ users: s.array(s.string()),
116
+ teams: s.array(s.string()),
117
+ apps: s.optional(s.array(s.string())),
118
+ },
119
+ { description: "Who may push (org repositories only)." },
120
+ ),
121
+ ),
122
+ }),
123
+ annotations: writes,
124
+ run: async ({ repo, branch, requiredChecks, restrictions, ...f }) => {
125
+ const r = await gh.repo(repo);
126
+ const wantsReviews =
127
+ f.requiredApprovingReviewCount !== undefined ||
128
+ f.dismissStaleReviews !== undefined ||
129
+ f.requireCodeOwnerReviews !== undefined;
130
+ const optional = {
131
+ required_linear_history: f.requiredLinearHistory,
132
+ allow_force_pushes: f.allowForcePushes,
133
+ allow_deletions: f.allowDeletions,
134
+ required_conversation_resolution: f.requiredConversationResolution,
135
+ };
136
+ const x = await gh.rest(
137
+ "PUT",
138
+ `repos/${r.full}/branches/${enc(branch)}/protection`,
139
+ {
140
+ body: {
141
+ required_status_checks:
142
+ requiredChecks === undefined
143
+ ? null
144
+ : {
145
+ strict: requiredChecks.strict ?? false,
146
+ checks: requiredChecks.checks.map((c) => ({
147
+ context: c.context,
148
+ ...(c.appId === undefined ? {} : { app_id: c.appId }),
149
+ })),
150
+ },
151
+ enforce_admins: f.enforceAdmins ?? null,
152
+ required_pull_request_reviews: wantsReviews
153
+ ? {
154
+ required_approving_review_count:
155
+ f.requiredApprovingReviewCount ?? 1,
156
+ dismiss_stale_reviews: f.dismissStaleReviews ?? false,
157
+ require_code_owner_reviews:
158
+ f.requireCodeOwnerReviews ?? false,
159
+ }
160
+ : null,
161
+ restrictions:
162
+ restrictions === undefined
163
+ ? null
164
+ : {
165
+ users: restrictions.users,
166
+ teams: restrictions.teams,
167
+ apps: restrictions.apps ?? [],
168
+ },
169
+ ...Object.fromEntries(
170
+ Object.entries(optional).filter(([, v]) => v !== undefined),
171
+ ),
172
+ },
173
+ },
174
+ );
175
+ return { repo: r.full, branch, ...trim(x) };
176
+ },
177
+ }),
178
+ delete: op({
179
+ description:
180
+ "Remove a branch's classic protection entirely (rulesets stay). Needs admin access.",
181
+ input: s.object({ repo: repoField, branch: branchField }),
182
+ annotations: irreversible,
183
+ run: async ({ repo, branch }) => {
184
+ const r = await gh.repo(repo);
185
+ await gh.rest(
186
+ "DELETE",
187
+ `repos/${r.full}/branches/${enc(branch)}/protection`,
188
+ );
189
+ return { repo: r.full, branch, protected: false };
190
+ },
191
+ }),
192
+ });