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,206 @@
1
+ // Reviews: submit one, read reviews and their line threads, reply in a thread, resolve it, dismiss a review.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { numberField, reads, repoField, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { at, bool, nodes, num, optNum, optStr, str } from "./read.ts";
6
+
7
+ const REVIEWS = `query($owner:String!,$name:String!,$number:Int!){repository(owner:$owner,name:$name){pullRequest(number:$number){
8
+ reviewDecision
9
+ reviews(first:100){nodes{id author{login} state body submittedAt url}}
10
+ reviewThreads(first:100){nodes{id path line startLine isOutdated isResolved resolvedBy{login}
11
+ comments(first:50){nodes{id author{login} body createdAt url}}}}}}}`;
12
+
13
+ const threadIdField = s.string({
14
+ description: "Review thread id from `pr reviews` (threads[].id).",
15
+ });
16
+
17
+ const comment = (c: unknown) => ({
18
+ id: str(c, "id"),
19
+ author: optStr(c, "author", "login"),
20
+ body: str(c, "body"),
21
+ createdAt: str(c, "createdAt"),
22
+ url: str(c, "url"),
23
+ });
24
+
25
+ export const pullReviewOps = (gh: GitHub) => ({
26
+ review: op({
27
+ description:
28
+ "Submit a review on a PR: approve, request changes or comment, optionally with comments on lines of the diff. `body` is required unless approving or sending line comments with a comment review. Replaces `gh pr review`.",
29
+ input: s.object({
30
+ repo: repoField,
31
+ number: numberField,
32
+ event: s.enum(["approve", "request_changes", "comment"]),
33
+ body: s.optional(s.string()),
34
+ comments: s.optional(
35
+ s.array(
36
+ s.object({
37
+ path: s.string(),
38
+ line: s.integer({
39
+ description: "Line in the file (the last one of a range).",
40
+ }),
41
+ startLine: s.optional(s.integer()),
42
+ side: s.optional(
43
+ s.enum(["LEFT", "RIGHT"], {
44
+ description: "RIGHT (default) is the new version.",
45
+ }),
46
+ ),
47
+ body: s.string(),
48
+ }),
49
+ ),
50
+ ),
51
+ }),
52
+ annotations: writes,
53
+ run: async ({ repo, number, event, body, comments }) => {
54
+ const lineComments = comments ?? [];
55
+ const needsBody =
56
+ event === "request_changes" ||
57
+ (event === "comment" && lineComments.length === 0);
58
+ if (needsBody && (body === undefined || body === ""))
59
+ throw new SurfaceError(
60
+ "usage",
61
+ `a ${event} review needs a body`,
62
+ "pass body",
63
+ );
64
+ const r = await gh.repo(repo);
65
+ const v = await gh.rest(
66
+ "POST",
67
+ `repos/${r.full}/pulls/${number}/reviews`,
68
+ {
69
+ body: {
70
+ event: event.toUpperCase(),
71
+ ...(body === undefined ? {} : { body }),
72
+ ...(lineComments.length === 0
73
+ ? {}
74
+ : {
75
+ comments: lineComments.map((c) => ({
76
+ path: c.path,
77
+ line: c.line,
78
+ side: c.side ?? "RIGHT",
79
+ body: c.body,
80
+ ...(c.startLine === undefined
81
+ ? {}
82
+ : { start_line: c.startLine }),
83
+ })),
84
+ }),
85
+ },
86
+ },
87
+ );
88
+ return {
89
+ repo: r.full,
90
+ number,
91
+ id: num(v, "id"),
92
+ state: str(v, "state"),
93
+ url: str(v, "html_url"),
94
+ };
95
+ },
96
+ }),
97
+ reviews: op({
98
+ description:
99
+ "A PR's reviews with their bodies, and its line-comment threads with path, line, resolved and outdated flags and every comment (first 100 reviews and threads). `unresolvedOnly` keeps the threads still open. Replaces `gh pr view --json reviews` plus the review threads gh does not show.",
100
+ input: s.object({
101
+ repo: repoField,
102
+ number: numberField,
103
+ unresolvedOnly: s.optional(s.boolean()),
104
+ }),
105
+ annotations: reads,
106
+ run: async ({ repo, number, unresolvedOnly }) => {
107
+ const r = await gh.repo(repo);
108
+ const pr = at(
109
+ await gh.graphql(REVIEWS, { owner: r.owner, name: r.name, number }),
110
+ "repository",
111
+ "pullRequest",
112
+ );
113
+ const threads = nodes(pr, "reviewThreads").map((t) => ({
114
+ id: str(t, "id"),
115
+ path: str(t, "path"),
116
+ line: optNum(t, "line"),
117
+ // GitHub reports a one-line thread with startLine equal to line; only a real range keeps it.
118
+ startLine:
119
+ optNum(t, "startLine") === optNum(t, "line")
120
+ ? null
121
+ : optNum(t, "startLine"),
122
+ resolved: bool(t, "isResolved"),
123
+ resolvedBy: optStr(t, "resolvedBy", "login"),
124
+ outdated: bool(t, "isOutdated"),
125
+ comments: nodes(t, "comments").map(comment),
126
+ }));
127
+ return {
128
+ repo: r.full,
129
+ number,
130
+ reviewDecision: optStr(pr, "reviewDecision"),
131
+ reviews: nodes(pr, "reviews").map((v) => ({
132
+ id: str(v, "id"),
133
+ author: optStr(v, "author", "login"),
134
+ state: str(v, "state"),
135
+ body: str(v, "body"),
136
+ submittedAt: optStr(v, "submittedAt"),
137
+ url: str(v, "url"),
138
+ })),
139
+ threads:
140
+ unresolvedOnly === true
141
+ ? threads.filter((t) => !t.resolved)
142
+ : threads,
143
+ };
144
+ },
145
+ }),
146
+ replyToThread: op({
147
+ description:
148
+ "Reply inside a review thread (the line-comment conversation), for example to say what the fix was.",
149
+ input: s.object({ threadId: threadIdField, body: s.string() }),
150
+ annotations: writes,
151
+ run: async ({ threadId, body }) => {
152
+ const data = await gh.graphql(
153
+ `mutation($id:ID!,$body:String!){addPullRequestReviewThreadReply(input:{pullRequestReviewThreadId:$id,body:$body}){comment{id author{login} body createdAt url}}}`,
154
+ { id: threadId, body },
155
+ );
156
+ return {
157
+ threadId,
158
+ ...comment(at(data, "addPullRequestReviewThreadReply", "comment")),
159
+ };
160
+ },
161
+ }),
162
+ resolveThread: op({
163
+ description:
164
+ "Mark a review thread resolved, or with undo reopen it. Resolve only after the reply or the fix it asks for is in.",
165
+ input: s.object({
166
+ threadId: threadIdField,
167
+ undo: s.optional(s.boolean()),
168
+ }),
169
+ annotations: writes,
170
+ run: async ({ threadId, undo }) => {
171
+ const field =
172
+ undo === true ? "unresolveReviewThread" : "resolveReviewThread";
173
+ const data = await gh.graphql(
174
+ `mutation($id:ID!){${field}(input:{threadId:$id}){thread{id isResolved}}}`,
175
+ { id: threadId },
176
+ );
177
+ return { threadId, resolved: bool(data, field, "thread", "isResolved") };
178
+ },
179
+ }),
180
+ dismissReview: op({
181
+ description:
182
+ "Dismiss an approving or change-requesting review with a message, so it no longer counts toward the review decision.",
183
+ input: s.object({
184
+ reviewId: s.string({
185
+ description: "Review id from `pr reviews` (reviews[].id).",
186
+ }),
187
+ message: s.string(),
188
+ }),
189
+ annotations: writes,
190
+ run: async ({ reviewId, message }) => {
191
+ const data = await gh.graphql(
192
+ `mutation($id:ID!,$message:String!){dismissPullRequestReview(input:{pullRequestReviewId:$id,message:$message}){pullRequestReview{id state}}}`,
193
+ { id: reviewId, message },
194
+ );
195
+ return {
196
+ reviewId,
197
+ state: str(
198
+ data,
199
+ "dismissPullRequestReview",
200
+ "pullRequestReview",
201
+ "state",
202
+ ),
203
+ };
204
+ },
205
+ }),
206
+ });
@@ -0,0 +1,187 @@
1
+ import { op, s } from "../vendor/surface/index.ts";
2
+ import { irreversible, numberField, repoField, writes } from "./fields.ts";
3
+ import type { GitHub } from "./http.ts";
4
+ import { commentOp, editLabels } from "./issues-write.ts";
5
+ import { deleteHead, mergeOp } from "./merge.ts";
6
+ import { pullNodeId } from "./pulls-read.ts";
7
+ import { at, bool, num, optStr, str } from "./read.ts";
8
+
9
+ const created = (p: unknown) => ({
10
+ number: num(p, "number"),
11
+ url: str(p, "html_url"),
12
+ state: str(p, "state"),
13
+ draft: bool(p, "draft"),
14
+ });
15
+
16
+ export const pullWriteOps = (gh: GitHub) => ({
17
+ create: op({
18
+ description:
19
+ "Open a pull request. `base` defaults to the repo's default branch. Replaces `gh pr create`.",
20
+ input: s.object({
21
+ repo: repoField,
22
+ title: s.string(),
23
+ head: s.string({
24
+ description: "Branch with the changes (owner:branch for a fork).",
25
+ }),
26
+ base: s.optional(s.string()),
27
+ body: s.optional(s.string()),
28
+ draft: s.optional(s.boolean()),
29
+ labels: s.optional(s.array(s.string())),
30
+ reviewers: s.optional(s.array(s.string())),
31
+ }),
32
+ annotations: writes,
33
+ run: async ({
34
+ repo,
35
+ title,
36
+ head,
37
+ base,
38
+ body,
39
+ draft,
40
+ labels,
41
+ reviewers,
42
+ }) => {
43
+ const r = await gh.repo(repo);
44
+ const target =
45
+ base ?? str(await gh.rest("GET", `repos/${r.full}`), "default_branch");
46
+ const p = await gh.rest("POST", `repos/${r.full}/pulls`, {
47
+ body: {
48
+ title,
49
+ head,
50
+ base: target,
51
+ body: body ?? "",
52
+ draft: draft ?? false,
53
+ },
54
+ });
55
+ const number = num(p, "number");
56
+ if (labels?.length) await editLabels(gh, r.full, number, labels, []);
57
+ if (reviewers?.length)
58
+ await gh.rest(
59
+ "POST",
60
+ `repos/${r.full}/pulls/${number}/requested_reviewers`,
61
+ { body: { reviewers } },
62
+ );
63
+ return { repo: r.full, ...created(p), base: target };
64
+ },
65
+ }),
66
+ edit: op({
67
+ description:
68
+ "Change a PR's title, body, base or open/closed state; add or remove labels; request reviewers. Replaces `gh pr edit` / `gh pr reopen`.",
69
+ input: s.object({
70
+ repo: repoField,
71
+ number: numberField,
72
+ title: s.optional(s.string()),
73
+ body: s.optional(s.string()),
74
+ base: s.optional(s.string()),
75
+ state: s.optional(s.enum(["open", "closed"])),
76
+ addLabels: s.optional(s.array(s.string())),
77
+ removeLabels: s.optional(s.array(s.string())),
78
+ addReviewers: s.optional(s.array(s.string())),
79
+ }),
80
+ annotations: writes,
81
+ run: async ({
82
+ repo,
83
+ number,
84
+ title,
85
+ body,
86
+ base,
87
+ state,
88
+ addLabels,
89
+ removeLabels,
90
+ addReviewers,
91
+ }) => {
92
+ const r = await gh.repo(repo);
93
+ const patch = Object.fromEntries(
94
+ Object.entries({ title, body, base, state }).filter(
95
+ ([, v]) => v !== undefined,
96
+ ),
97
+ );
98
+ const p =
99
+ Object.keys(patch).length > 0
100
+ ? await gh.rest("PATCH", `repos/${r.full}/pulls/${number}`, {
101
+ body: patch,
102
+ })
103
+ : await gh.rest("GET", `repos/${r.full}/pulls/${number}`);
104
+ const labels = await editLabels(
105
+ gh,
106
+ r.full,
107
+ number,
108
+ addLabels ?? [],
109
+ removeLabels ?? [],
110
+ );
111
+ if (addReviewers?.length)
112
+ await gh.rest(
113
+ "POST",
114
+ `repos/${r.full}/pulls/${number}/requested_reviewers`,
115
+ { body: { reviewers: addReviewers } },
116
+ );
117
+ return {
118
+ repo: r.full,
119
+ ...created(p),
120
+ ...(labels === undefined ? {} : { labels }),
121
+ };
122
+ },
123
+ }),
124
+ comment: commentOp(
125
+ gh,
126
+ "Add a conversation comment to a PR, or edit one of yours by id. Replaces `gh pr comment`.",
127
+ ),
128
+ merge: mergeOp(gh),
129
+ ready: op({
130
+ description:
131
+ "Mark a draft PR ready for review, or with undo turn it back into a draft. Replaces `gh pr ready [--undo]`.",
132
+ input: s.object({
133
+ repo: repoField,
134
+ number: numberField,
135
+ undo: s.optional(s.boolean()),
136
+ }),
137
+ annotations: { ...writes, idempotent: true },
138
+ run: async ({ repo, number, undo }) => {
139
+ const r = await gh.repo(repo);
140
+ const pr = await pullNodeId(gh, r.full, number);
141
+ const mutation =
142
+ undo === true
143
+ ? "convertPullRequestToDraft"
144
+ : "markPullRequestReadyForReview";
145
+ const data = await gh.graphql(
146
+ `mutation($id:ID!){${mutation}(input:{pullRequestId:$id}){pullRequest{isDraft}}}`,
147
+ { id: pr.id },
148
+ );
149
+ return {
150
+ repo: r.full,
151
+ number,
152
+ draft: at(data, mutation, "pullRequest", "isDraft") === true,
153
+ };
154
+ },
155
+ }),
156
+ close: op({
157
+ description:
158
+ "Close a PR without merging, optionally leaving a comment first and deleting its same-repo head branch. Replaces `gh pr close`.",
159
+ input: s.object({
160
+ repo: repoField,
161
+ number: numberField,
162
+ comment: s.optional(s.string()),
163
+ deleteBranch: s.optional(s.boolean()),
164
+ }),
165
+ annotations: irreversible,
166
+ run: async ({ repo, number, comment, deleteBranch }) => {
167
+ const r = await gh.repo(repo);
168
+ if (comment !== undefined)
169
+ await gh.rest("POST", `repos/${r.full}/issues/${number}/comments`, {
170
+ body: { body: comment },
171
+ });
172
+ const p = await gh.rest("PATCH", `repos/${r.full}/pulls/${number}`, {
173
+ body: { state: "closed" },
174
+ });
175
+ const branchDeleted =
176
+ deleteBranch === true
177
+ ? await deleteHead(
178
+ gh,
179
+ r,
180
+ str(p, "head", "ref"),
181
+ optStr(p, "head", "repo", "full_name"),
182
+ )
183
+ : false;
184
+ return { repo: r.full, ...created(p), branchDeleted };
185
+ },
186
+ }),
187
+ });
@@ -0,0 +1,78 @@
1
+ import { op, s } from "../vendor/surface/index.ts";
2
+ import { reads } from "./fields.ts";
3
+ import type { GitHub, Method } from "./http.ts";
4
+ import { at, isObj, num } from "./read.ts";
5
+
6
+ const bucket = (x: unknown) => ({
7
+ limit: num(x, "limit"),
8
+ remaining: num(x, "remaining"),
9
+ used: num(x, "used"),
10
+ resetsAt: new Date(num(x, "reset") * 1000).toISOString(),
11
+ });
12
+
13
+ export const rawOps = (gh: GitHub) => ({
14
+ rest: op({
15
+ description:
16
+ "Any REST call for what the typed operations do not cover. Path is relative to api.github.com (repos/o/n/...). `paginate` follows Link headers up to limit; `key` names the list inside a wrapped page (workflow_runs, items). Replaces `gh api`.",
17
+ input: s.object({
18
+ path: s.string(),
19
+ method: s.optional(s.enum(["GET", "POST", "PATCH", "PUT", "DELETE"])),
20
+ query: s.optional(s.record(s.string())),
21
+ body: s.optional(s.unknown({ description: "JSON request body." })),
22
+ accept: s.optional(s.string()),
23
+ paginate: s.optional(s.boolean()),
24
+ key: s.optional(s.string()),
25
+ limit: s.optional(
26
+ s.integer({ description: "Max items when paginating (default 1000)." }),
27
+ ),
28
+ }),
29
+ annotations: { destructive: true, openWorld: true },
30
+ run: async ({
31
+ path,
32
+ method,
33
+ query,
34
+ body,
35
+ accept,
36
+ paginate,
37
+ key,
38
+ limit,
39
+ }) => {
40
+ const verb: Method = method ?? "GET";
41
+ const req = {
42
+ ...(query === undefined ? {} : { query }),
43
+ ...(body === undefined ? {} : { body }),
44
+ ...(accept === undefined ? {} : { accept }),
45
+ };
46
+ if (paginate === true && verb === "GET")
47
+ return gh.list(path, limit ?? 1000, {
48
+ ...req,
49
+ ...(key === undefined ? {} : { key }),
50
+ });
51
+ return gh.rest(verb, path, req);
52
+ },
53
+ }),
54
+ graphql: op({
55
+ description:
56
+ "Any GraphQL query or mutation; returns `data`. Errors come back as kinds (not_found, forbidden, graphql). Replaces `gh api graphql`.",
57
+ input: s.object({
58
+ query: s.string(),
59
+ variables: s.optional(s.record(s.unknown())),
60
+ }),
61
+ annotations: { destructive: true, openWorld: true },
62
+ run: ({ query, variables }) => gh.graphql(query, variables ?? {}),
63
+ }),
64
+ rate: op({
65
+ description:
66
+ "Remaining quota for core REST, GraphQL and search, with reset times. Replaces `gh api rate_limit`.",
67
+ input: s.object({}),
68
+ annotations: reads,
69
+ run: async () => {
70
+ const res = at(await gh.rest("GET", "rate_limit"), "resources");
71
+ return Object.fromEntries(
72
+ ["core", "graphql", "search", "code_search"].flatMap((k) =>
73
+ isObj(at(res, k)) ? [[k, bucket(at(res, k))]] : [],
74
+ ),
75
+ );
76
+ },
77
+ }),
78
+ });
@@ -0,0 +1,77 @@
1
+ // Narrow GitHub's JSON without type assertions: every field an operation returns is read through one of these,
2
+ // so a changed or wrong endpoint fails as `invalid_response` instead of leaking `undefined` downstream.
3
+ import { SurfaceError } from "../vendor/surface/index.ts";
4
+
5
+ export type Json = Readonly<Record<string, unknown>>;
6
+
7
+ export const isObj = (x: unknown): x is Json =>
8
+ typeof x === "object" && x !== null && !Array.isArray(x);
9
+
10
+ const bad = (what: string): SurfaceError =>
11
+ new SurfaceError(
12
+ "invalid_response",
13
+ `GitHub response has no ${what}`,
14
+ "inspect the raw body with `api rest`; the endpoint or its shape may differ",
15
+ );
16
+
17
+ export const obj = (x: unknown, what: string): Json => {
18
+ if (!isObj(x)) throw bad(what);
19
+ return x;
20
+ };
21
+
22
+ export const arr = (x: unknown, what: string): readonly unknown[] => {
23
+ if (!Array.isArray(x)) throw bad(what);
24
+ return x;
25
+ };
26
+
27
+ export const at = (x: unknown, ...keys: readonly string[]): unknown =>
28
+ keys.reduce<unknown>((cur, k) => (isObj(cur) ? cur[k] : undefined), x);
29
+
30
+ export const str = (x: unknown, ...keys: readonly string[]): string => {
31
+ const v = at(x, ...keys);
32
+ if (typeof v !== "string") throw bad(keys.join("."));
33
+ return v;
34
+ };
35
+
36
+ export const optStr = (
37
+ x: unknown,
38
+ ...keys: readonly string[]
39
+ ): string | null => {
40
+ const v = at(x, ...keys);
41
+ return typeof v === "string" ? v : null;
42
+ };
43
+
44
+ export const num = (x: unknown, ...keys: readonly string[]): number => {
45
+ const v = at(x, ...keys);
46
+ if (typeof v !== "number") throw bad(keys.join("."));
47
+ return v;
48
+ };
49
+
50
+ export const optNum = (
51
+ x: unknown,
52
+ ...keys: readonly string[]
53
+ ): number | null => {
54
+ const v = at(x, ...keys);
55
+ return typeof v === "number" ? v : null;
56
+ };
57
+
58
+ export const bool = (x: unknown, ...keys: readonly string[]): boolean =>
59
+ at(x, ...keys) === true;
60
+
61
+ export const nodes = (
62
+ x: unknown,
63
+ ...keys: readonly string[]
64
+ ): readonly unknown[] => {
65
+ const v = at(x, ...keys, "nodes");
66
+ return Array.isArray(v) ? v : [];
67
+ };
68
+
69
+ export const names = (
70
+ x: unknown,
71
+ key: string,
72
+ ...keys: readonly string[]
73
+ ): string[] =>
74
+ nodes(x, ...keys).flatMap((n) => {
75
+ const v = at(n, key);
76
+ return typeof v === "string" ? [v] : [];
77
+ });
@@ -0,0 +1,111 @@
1
+ // Uploading and deleting the assets of a release.
2
+ import { basename } from "node:path";
3
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
4
+ import type { Infer } from "../vendor/surface/index.ts";
5
+ import { irreversible, repoField, writes } from "./fields.ts";
6
+ import type { GitHub } from "./http.ts";
7
+ import { str } from "./read.ts";
8
+ import { findRelease, releaseAssets } from "./release-download.ts";
9
+
10
+ export const tagField = s.string({ description: "Release tag, e.g. v1.2.0." });
11
+ export const filesField = s.array(
12
+ s.object({
13
+ path: s.string({ description: "Local file to upload." }),
14
+ name: s.optional(
15
+ s.string({ description: "Asset name (default: the file's base name)." }),
16
+ ),
17
+ label: s.optional(s.string({ description: "Display label." })),
18
+ contentType: s.optional(
19
+ s.string({ description: "MIME type (default: from the extension)." }),
20
+ ),
21
+ }),
22
+ );
23
+ type Files = Infer<typeof filesField>;
24
+
25
+ const assetName = (f: Files[number]) => f.name ?? basename(f.path);
26
+
27
+ export const checkFiles = async (files: Files) => {
28
+ for (const f of files)
29
+ if (!(await Bun.file(f.path).exists()))
30
+ throw new SurfaceError(
31
+ "usage",
32
+ `no such file: ${f.path}`,
33
+ "pass paths to existing local files",
34
+ );
35
+ };
36
+
37
+ export const uploadAll = async (gh: GitHub, release: unknown, files: Files) => {
38
+ const base = str(release, "upload_url").replace(/\{[^}]*\}$/, "");
39
+ const names: string[] = [];
40
+ for (const f of files) {
41
+ const file = Bun.file(f.path);
42
+ const query = new URLSearchParams({
43
+ name: assetName(f),
44
+ ...(f.label === undefined ? {} : { label: f.label }),
45
+ });
46
+ const asset = await gh.upload(
47
+ `${base}?${query.toString()}`,
48
+ await file.bytes(),
49
+ f.contentType ?? file.type,
50
+ );
51
+ names.push(str(asset, "name"));
52
+ }
53
+ return names;
54
+ };
55
+
56
+ export const releaseAssetOps = (gh: GitHub) => ({
57
+ deleteAsset: op({
58
+ description:
59
+ "Delete one asset of a release by its name. Replaces `gh release delete-asset`.",
60
+ input: s.object({ repo: repoField, tag: tagField, name: s.string() }),
61
+ annotations: irreversible,
62
+ run: async ({ repo, tag, name }) => {
63
+ const r = await gh.repo(repo);
64
+ const asset = releaseAssets(await findRelease(gh, r.full, tag)).find(
65
+ (a) => a.name === name,
66
+ );
67
+ if (asset === undefined)
68
+ throw new SurfaceError(
69
+ "not_found",
70
+ `release ${tag} has no asset ${name}`,
71
+ "see the asset names with `release view`",
72
+ );
73
+ await gh.rest("DELETE", `repos/${r.full}/releases/assets/${asset.id}`);
74
+ return { repo: r.full, tag, name, id: asset.id, deleted: true };
75
+ },
76
+ }),
77
+ upload: op({
78
+ description:
79
+ "Upload files as assets of an existing release. A same-named asset fails as `conflict` before anything uploads, unless clobber replaces it. Replaces `gh release upload`.",
80
+ input: s.object({
81
+ repo: repoField,
82
+ tag: tagField,
83
+ files: filesField,
84
+ clobber: s.optional(
85
+ s.boolean({ description: "Delete same-named assets first." }),
86
+ ),
87
+ }),
88
+ annotations: writes,
89
+ run: async ({ repo, tag, files, clobber }) => {
90
+ const r = await gh.repo(repo);
91
+ await checkFiles(files);
92
+ const rel = await findRelease(gh, r.full, tag);
93
+ const wanted = new Set(files.map(assetName));
94
+ const clashes = releaseAssets(rel).filter((a) => wanted.has(a.name));
95
+ if (clashes.length > 0 && clobber !== true)
96
+ throw new SurfaceError(
97
+ "conflict",
98
+ `release ${tag} already has ${clashes.map((a) => a.name).join(", ")}`,
99
+ "pass clobber: true to replace them",
100
+ );
101
+ for (const a of clashes)
102
+ await gh.rest("DELETE", `repos/${r.full}/releases/assets/${a.id}`);
103
+ return {
104
+ repo: r.full,
105
+ tag,
106
+ assets: await uploadAll(gh, rel, files),
107
+ replaced: clashes.map((a) => a.name),
108
+ };
109
+ },
110
+ }),
111
+ });