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,151 @@
1
+ // Finding a release by tag (drafts included) and downloading its assets or source archive.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { enc, repoField, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { arr, at, num, str } from "./read.ts";
6
+ import { safeJoin } from "./zip.ts";
7
+
8
+ // GET releases/tags/{tag} never returns a draft, so a miss falls back to scanning the release list.
9
+ export const findRelease = async (
10
+ gh: GitHub,
11
+ full: string,
12
+ tag: string,
13
+ ): Promise<unknown> => {
14
+ try {
15
+ return await gh.rest("GET", `repos/${full}/releases/tags/${enc(tag)}`);
16
+ } catch (error) {
17
+ if (!(error instanceof SurfaceError && error.kind === "not_found"))
18
+ throw error;
19
+ }
20
+ const draft = (await gh.list(`repos/${full}/releases`, 1000)).find(
21
+ (x) => str(x, "tag_name") === tag,
22
+ );
23
+ if (draft === undefined)
24
+ throw new SurfaceError(
25
+ "not_found",
26
+ `no release for tag ${tag} in ${full}`,
27
+ "list releases with `release list`",
28
+ );
29
+ return draft;
30
+ };
31
+
32
+ export const releaseAssets = (x: unknown) =>
33
+ arr(at(x, "assets") ?? [], "assets").map((a) => ({
34
+ id: num(a, "id"),
35
+ name: str(a, "name"),
36
+ }));
37
+
38
+ export const releaseDownloadOp = (gh: GitHub) =>
39
+ op({
40
+ description:
41
+ "Download release assets (all, or those matching glob patterns) and/or the source archive into a directory; returns the written paths and sizes. Existing files fail as `conflict` unless skipExisting or clobber is set. Replaces `gh release download`.",
42
+ input: s.object({
43
+ repo: repoField,
44
+ tag: s.optional(
45
+ s.string({
46
+ description:
47
+ "Release tag; the latest release when omitted (then patterns or archive is required).",
48
+ }),
49
+ ),
50
+ patterns: s.optional(
51
+ s.array(s.string(), {
52
+ description: "Glob patterns over asset names, e.g. *.tar.gz.",
53
+ }),
54
+ ),
55
+ archive: s.optional(
56
+ s.enum(["zip", "tar.gz"], {
57
+ description: "Also download the source code archive.",
58
+ }),
59
+ ),
60
+ dir: s.optional(
61
+ s.string({ description: "Target directory (default: cwd)." }),
62
+ ),
63
+ skipExisting: s.optional(s.boolean()),
64
+ clobber: s.optional(
65
+ s.boolean({ description: "Overwrite existing files." }),
66
+ ),
67
+ }),
68
+ annotations: writes,
69
+ run: async ({
70
+ repo,
71
+ tag,
72
+ patterns,
73
+ archive,
74
+ dir,
75
+ skipExisting,
76
+ clobber,
77
+ }) => {
78
+ if (skipExisting === true && clobber === true)
79
+ throw new SurfaceError(
80
+ "usage",
81
+ "skipExisting and clobber exclude each other",
82
+ "pass one of them",
83
+ );
84
+ if (tag === undefined && patterns === undefined && archive === undefined)
85
+ throw new SurfaceError(
86
+ "usage",
87
+ "downloading the latest release needs patterns or archive",
88
+ "pass patterns, archive, or a tag",
89
+ );
90
+ const r = await gh.repo(repo);
91
+ const rel =
92
+ tag === undefined
93
+ ? await gh.rest("GET", `repos/${r.full}/releases/latest`)
94
+ : await findRelease(gh, r.full, tag);
95
+ const relTag = str(rel, "tag_name");
96
+ const globs = (patterns ?? []).map((p) => new Bun.Glob(p));
97
+ const assets =
98
+ archive !== undefined && patterns === undefined
99
+ ? []
100
+ : releaseAssets(rel).filter(
101
+ (a) => globs.length === 0 || globs.some((g) => g.match(a.name)),
102
+ );
103
+ const wanted = [
104
+ ...assets.map((a) => ({
105
+ name: a.name,
106
+ path: `repos/${r.full}/releases/assets/${a.id}`,
107
+ accept: "application/octet-stream",
108
+ })),
109
+ ...(archive === undefined
110
+ ? []
111
+ : [
112
+ {
113
+ name: `${r.name}-${relTag.replace(/^v/, "")}.${archive}`,
114
+ path: `repos/${r.full}/${archive === "zip" ? "zipball" : "tarball"}/${enc(relTag)}`,
115
+ accept: undefined,
116
+ },
117
+ ]),
118
+ ];
119
+ if (wanted.length === 0)
120
+ throw new SurfaceError(
121
+ "not_found",
122
+ `no assets of ${relTag} match ${(patterns ?? []).join(", ")}`,
123
+ "see the asset names with `release view`",
124
+ );
125
+ const planned = await Promise.all(
126
+ wanted.map(async (w) => {
127
+ const target = safeJoin(dir ?? ".", w.name);
128
+ return { ...w, target, exists: await Bun.file(target).exists() };
129
+ }),
130
+ );
131
+ const clash = planned.find((p) => p.exists);
132
+ if (clash !== undefined && skipExisting !== true && clobber !== true)
133
+ throw new SurfaceError(
134
+ "conflict",
135
+ `${clash.target} already exists`,
136
+ "pass skipExisting or clobber",
137
+ );
138
+ const files: { readonly path: string; readonly size: number }[] = [];
139
+ const skipped: string[] = [];
140
+ for (const p of planned) {
141
+ if (p.exists && skipExisting === true) {
142
+ skipped.push(p.target);
143
+ continue;
144
+ }
145
+ const bytes = await gh.bytes(p.path, p.accept);
146
+ await Bun.write(p.target, bytes);
147
+ files.push({ path: p.target, size: bytes.length });
148
+ }
149
+ return { repo: r.full, tag: relTag, files, skipped };
150
+ },
151
+ });
@@ -0,0 +1,197 @@
1
+ // Creating, editing and deleting releases and their assets.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { enc, irreversible, repoField, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { bool, num, str } from "./read.ts";
6
+ import {
7
+ checkFiles,
8
+ filesField,
9
+ releaseAssetOps,
10
+ tagField,
11
+ uploadAll,
12
+ } from "./release-assets.ts";
13
+ import { findRelease, releaseDownloadOp } from "./release-download.ts";
14
+
15
+ const settings = {
16
+ title: s.optional(s.string()),
17
+ notes: s.optional(s.string({ description: "Release notes (markdown)." })),
18
+ target: s.optional(
19
+ s.string({
20
+ description:
21
+ "Branch or full commit SHA the tag is created from (default branch when omitted).",
22
+ }),
23
+ ),
24
+ draft: s.optional(s.boolean()),
25
+ prerelease: s.optional(s.boolean()),
26
+ latest: s.optional(
27
+ s.boolean({
28
+ description:
29
+ "true marks it Latest, false keeps it from being Latest; omitted lets GitHub decide by date and version.",
30
+ }),
31
+ ),
32
+ discussionCategory: s.optional(
33
+ s.string({ description: "Start a discussion in this category." }),
34
+ ),
35
+ verifyTag: s.optional(
36
+ s.boolean({ description: "Fail unless the tag already exists on GitHub." }),
37
+ ),
38
+ };
39
+
40
+ const defined = (o: Readonly<Record<string, unknown>>) =>
41
+ Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined));
42
+ const refPath = (tag: string) => tag.split("/").map(enc).join("/");
43
+ const latestFlag = (latest: boolean | undefined) =>
44
+ latest === undefined ? undefined : String(latest);
45
+
46
+ const summary = (repo: string, x: unknown) => ({
47
+ repo,
48
+ tag: str(x, "tag_name"),
49
+ id: num(x, "id"),
50
+ url: str(x, "html_url"),
51
+ draft: bool(x, "draft"),
52
+ prerelease: bool(x, "prerelease"),
53
+ });
54
+
55
+ const checkTag = async (gh: GitHub, full: string, tag: string) => {
56
+ try {
57
+ await gh.rest("GET", `repos/${full}/git/ref/tags/${refPath(tag)}`);
58
+ } catch (error) {
59
+ if (error instanceof SurfaceError && error.kind === "not_found")
60
+ throw new SurfaceError(
61
+ "not_found",
62
+ `tag ${tag} does not exist in ${full}`,
63
+ "push the tag first or drop verifyTag",
64
+ );
65
+ throw error;
66
+ }
67
+ };
68
+
69
+ export const releaseWriteOps = (gh: GitHub) => ({
70
+ create: op({
71
+ description:
72
+ "Create a release (or draft) for a tag, optionally with generated notes, then upload files as assets. Returns the tag, id, url and uploaded asset names. Replaces `gh release create`.",
73
+ input: s.object({
74
+ repo: repoField,
75
+ tag: tagField,
76
+ ...settings,
77
+ generateNotes: s.optional(
78
+ s.boolean({ description: "Let GitHub generate title and notes." }),
79
+ ),
80
+ notesStartTag: s.optional(
81
+ s.string({
82
+ description:
83
+ "Generate notes from this earlier tag onward (implies generateNotes).",
84
+ }),
85
+ ),
86
+ files: s.optional(filesField),
87
+ }),
88
+ annotations: writes,
89
+ run: async (input) => {
90
+ const r = await gh.repo(input.repo);
91
+ const files = input.files ?? [];
92
+ await checkFiles(files);
93
+ if (input.verifyTag === true) await checkTag(gh, r.full, input.tag);
94
+ let { title, notes } = input;
95
+ if (input.notesStartTag !== undefined) {
96
+ const g = await gh.rest(
97
+ "POST",
98
+ `repos/${r.full}/releases/generate-notes`,
99
+ {
100
+ body: defined({
101
+ tag_name: input.tag,
102
+ target_commitish: input.target,
103
+ previous_tag_name: input.notesStartTag,
104
+ }),
105
+ },
106
+ );
107
+ notes = [notes, str(g, "body")].filter(Boolean).join("\n\n");
108
+ title ??= str(g, "name");
109
+ }
110
+ const x = await gh.rest("POST", `repos/${r.full}/releases`, {
111
+ body: defined({
112
+ tag_name: input.tag,
113
+ target_commitish: input.target,
114
+ name: title,
115
+ body: notes,
116
+ draft: input.draft,
117
+ prerelease: input.prerelease,
118
+ make_latest: latestFlag(input.latest),
119
+ discussion_category_name: input.discussionCategory,
120
+ generate_release_notes:
121
+ input.notesStartTag === undefined ? input.generateNotes : undefined,
122
+ }),
123
+ });
124
+ return { ...summary(r.full, x), assets: await uploadAll(gh, x, files) };
125
+ },
126
+ }),
127
+ edit: op({
128
+ description:
129
+ "Change a release's tag, title, notes, target, draft/prerelease/latest state or discussion category; publishing a draft is draft: false. Replaces `gh release edit`.",
130
+ input: s.object({
131
+ repo: repoField,
132
+ tag: tagField,
133
+ newTag: s.optional(s.string({ description: "Rename the tag to this." })),
134
+ ...settings,
135
+ }),
136
+ annotations: writes,
137
+ run: async (input) => {
138
+ const patch = defined({
139
+ tag_name: input.newTag,
140
+ target_commitish: input.target,
141
+ name: input.title,
142
+ body: input.notes,
143
+ draft: input.draft,
144
+ prerelease: input.prerelease,
145
+ make_latest: latestFlag(input.latest),
146
+ discussion_category_name: input.discussionCategory,
147
+ });
148
+ if (Object.keys(patch).length === 0)
149
+ throw new SurfaceError(
150
+ "usage",
151
+ "nothing to edit",
152
+ "pass at least one field to change",
153
+ );
154
+ const r = await gh.repo(input.repo);
155
+ if (input.verifyTag === true)
156
+ await checkTag(gh, r.full, input.newTag ?? input.tag);
157
+ const cur = await findRelease(gh, r.full, input.tag);
158
+ const x = await gh.rest(
159
+ "PATCH",
160
+ `repos/${r.full}/releases/${num(cur, "id")}`,
161
+ { body: patch },
162
+ );
163
+ return summary(r.full, x);
164
+ },
165
+ }),
166
+ delete: op({
167
+ description:
168
+ "Delete a release; cleanupTag also deletes its git tag (a tag that is already gone is not an error). Replaces `gh release delete`.",
169
+ input: s.object({
170
+ repo: repoField,
171
+ tag: tagField,
172
+ cleanupTag: s.optional(s.boolean()),
173
+ }),
174
+ annotations: irreversible,
175
+ run: async ({ repo, tag, cleanupTag }) => {
176
+ const r = await gh.repo(repo);
177
+ const id = num(await findRelease(gh, r.full, tag), "id");
178
+ await gh.rest("DELETE", `repos/${r.full}/releases/${id}`);
179
+ let tagDeleted = false;
180
+ if (cleanupTag === true) {
181
+ try {
182
+ await gh.rest(
183
+ "DELETE",
184
+ `repos/${r.full}/git/refs/tags/${refPath(tag)}`,
185
+ );
186
+ tagDeleted = true;
187
+ } catch (error) {
188
+ if (!(error instanceof SurfaceError && error.kind === "not_found"))
189
+ throw error;
190
+ }
191
+ }
192
+ return { repo: r.full, tag, id, deleted: true, tagDeleted };
193
+ },
194
+ }),
195
+ ...releaseAssetOps(gh),
196
+ download: releaseDownloadOp(gh),
197
+ });
@@ -0,0 +1,112 @@
1
+ // Repository lifecycle on GitHub: create, edit, delete, archive, rename, fork, list, sync and URLs.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { irreversible, repoField, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { bool, str } from "./read.ts";
6
+ import { createOp } from "./repo-create.ts";
7
+ import { listOp } from "./repo-list.ts";
8
+ import { defined, editOp } from "./repo-settings.ts";
9
+ import { syncOp } from "./repo-sync.ts";
10
+ import { urlOp } from "./repo-url.ts";
11
+
12
+ const usage = (message: string, hint: string) =>
13
+ new SurfaceError("usage", message, hint);
14
+
15
+ const archiveOp = (gh: GitHub, archived: boolean, description: string) =>
16
+ op({
17
+ description,
18
+ input: s.object({ repo: repoField }),
19
+ annotations: writes,
20
+ run: async ({ repo }) => {
21
+ const r = await gh.repo(repo);
22
+ const x = await gh.rest("PATCH", `repos/${r.full}`, {
23
+ body: { archived },
24
+ });
25
+ return { repo: str(x, "full_name"), archived: bool(x, "archived") };
26
+ },
27
+ });
28
+
29
+ export const repoAdminOps = (gh: GitHub) => ({
30
+ create: createOp(gh),
31
+ edit: editOp(gh),
32
+ delete: op({
33
+ description:
34
+ "Delete a repository permanently, with its issues, pull requests and wiki. `confirm` must equal its owner/name. Needs the token's delete_repo scope. Replaces `gh repo delete --yes`.",
35
+ input: s.object({
36
+ repo: repoField,
37
+ confirm: s.string({
38
+ description: "The repository's owner/name, typed out to confirm.",
39
+ }),
40
+ }),
41
+ annotations: irreversible,
42
+ run: async ({ repo, confirm }) => {
43
+ const r = await gh.repo(repo);
44
+ if (confirm !== r.full)
45
+ throw usage(
46
+ `confirm must be ${r.full}`,
47
+ "pass the exact owner/name of the repository to delete",
48
+ );
49
+ await gh.rest("DELETE", `repos/${r.full}`);
50
+ return { repo: r.full, deleted: true };
51
+ },
52
+ }),
53
+ archive: archiveOp(
54
+ gh,
55
+ true,
56
+ "Archive a repository: it becomes read-only until unarchived. Replaces `gh repo archive --yes`.",
57
+ ),
58
+ unarchive: archiveOp(
59
+ gh,
60
+ false,
61
+ "Unarchive a repository so it accepts pushes, issues and pull requests again. Replaces `gh repo unarchive --yes`.",
62
+ ),
63
+ rename: op({
64
+ description:
65
+ "Rename a repository; GitHub redirects the old name. Returns the new owner/name. Replaces `gh repo rename --yes`.",
66
+ input: s.object({ repo: repoField, newName: s.string() }),
67
+ annotations: writes,
68
+ run: async ({ repo, newName }) => {
69
+ const r = await gh.repo(repo);
70
+ const x = await gh.rest("PATCH", `repos/${r.full}`, {
71
+ body: { name: newName },
72
+ });
73
+ return {
74
+ repo: r.full,
75
+ newRepo: str(x, "full_name"),
76
+ url: str(x, "html_url"),
77
+ };
78
+ },
79
+ }),
80
+ fork: op({
81
+ description:
82
+ "Fork a repository to your account or an organization. GitHub creates the fork asynchronously, so its contents can take a moment to appear. API-side only: no clone or git remote. Replaces `gh repo fork`.",
83
+ input: s.object({
84
+ repo: repoField,
85
+ org: s.optional(
86
+ s.string({ description: "Organization to own the fork." }),
87
+ ),
88
+ forkName: s.optional(s.string()),
89
+ defaultBranchOnly: s.optional(s.boolean()),
90
+ }),
91
+ annotations: writes,
92
+ run: async ({ repo, org, forkName, defaultBranchOnly }) => {
93
+ const r = await gh.repo(repo);
94
+ const x = await gh.rest("POST", `repos/${r.full}/forks`, {
95
+ body: defined({
96
+ organization: org,
97
+ name: forkName,
98
+ default_branch_only: defaultBranchOnly,
99
+ }),
100
+ });
101
+ return {
102
+ repo: r.full,
103
+ fork: str(x, "full_name"),
104
+ defaultBranch: str(x, "default_branch"),
105
+ url: str(x, "html_url"),
106
+ };
107
+ },
108
+ }),
109
+ list: listOp(gh),
110
+ sync: syncOp(gh),
111
+ url: urlOp(gh),
112
+ });
@@ -0,0 +1,187 @@
1
+ // Repository content without a checkout (directory listings and files through the contents API), and `repo clone`.
2
+ import { isAbsolute, resolve } from "node:path";
3
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
4
+ import { enc, reads, repoField, writes } from "./fields.ts";
5
+ import type { GitHub } from "./http.ts";
6
+ import { arr, at, num, optNum, optStr, str } from "./read.ts";
7
+
8
+ const segments = (path: string) =>
9
+ path.split("/").filter(Boolean).map(enc).join("/");
10
+
11
+ const contentsPath = (full: string, path: string | undefined) => {
12
+ const rel = segments(path ?? "");
13
+ return rel === ""
14
+ ? `repos/${full}/contents`
15
+ : `repos/${full}/contents/${rel}`;
16
+ };
17
+
18
+ const refField = s.optional(
19
+ s.string({
20
+ description: "Branch, tag or commit; default the default branch.",
21
+ }),
22
+ );
23
+
24
+ const textOf = (bytes: Uint8Array): string | undefined => {
25
+ if (bytes.includes(0)) return undefined;
26
+ try {
27
+ return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
28
+ } catch (error) {
29
+ if (error instanceof TypeError) return undefined;
30
+ throw error;
31
+ }
32
+ };
33
+
34
+ export const repoContentOps = (gh: GitHub) => ({
35
+ readDir: op({
36
+ description:
37
+ "Entries of a directory in a repository (root when path is omitted) with type, size and blob SHA. Replaces `gh repo read-dir`.",
38
+ input: s.object({
39
+ repo: repoField,
40
+ path: s.optional(s.string()),
41
+ ref: refField,
42
+ }),
43
+ annotations: reads,
44
+ run: async ({ repo, path, ref }) => {
45
+ const r = await gh.repo(repo);
46
+ const body = await gh.rest("GET", contentsPath(r.full, path), {
47
+ query: { ref },
48
+ });
49
+ if (!Array.isArray(body))
50
+ throw new SurfaceError(
51
+ "usage",
52
+ `${path ?? ""} is a ${optStr(body, "type") ?? "file"}, not a directory`,
53
+ "read it with `repo readFile`",
54
+ );
55
+ return {
56
+ repo: r.full,
57
+ path: path ?? "",
58
+ ref: ref ?? null,
59
+ items: arr(body, "entries").map((e) => ({
60
+ name: str(e, "name"),
61
+ path: str(e, "path"),
62
+ type: str(e, "type"),
63
+ size: optNum(e, "size"),
64
+ sha: str(e, "sha"),
65
+ })),
66
+ };
67
+ },
68
+ }),
69
+ readFile: op({
70
+ description:
71
+ "A file's text with its size and blob SHA. With output, or for binary content (which then requires output), the bytes are written to that local path instead and the path is returned; an existing file is kept unless clobber. Replaces `gh repo read-file`.",
72
+ input: s.object({
73
+ repo: repoField,
74
+ path: s.string(),
75
+ ref: refField,
76
+ output: s.optional(
77
+ s.string({ description: "Local path to write the bytes to." }),
78
+ ),
79
+ clobber: s.optional(
80
+ s.boolean({ description: "Overwrite output if it exists." }),
81
+ ),
82
+ }),
83
+ annotations: reads,
84
+ run: async ({ repo, path, ref, output, clobber }) => {
85
+ const r = await gh.repo(repo);
86
+ const where = contentsPath(r.full, path);
87
+ const meta = await gh.rest("GET", where, { query: { ref } });
88
+ if (Array.isArray(meta) || str(meta, "type") !== "file")
89
+ throw new SurfaceError(
90
+ "usage",
91
+ `${path} is ${Array.isArray(meta) ? "a directory" : `a ${str(meta, "type")}${optStr(meta, "target") === null ? "" : ` to ${optStr(meta, "target")}`}`}, not a file`,
92
+ "list a directory with `repo readDir`",
93
+ );
94
+ // Files over 1 MB come back with encoding "none" and no content; the raw media type returns them up to 100 MB.
95
+ const bytes =
96
+ optStr(meta, "encoding") === "base64"
97
+ ? new Uint8Array(Buffer.from(str(meta, "content"), "base64"))
98
+ : await gh.bytes(
99
+ ref === undefined ? where : `${where}?ref=${enc(ref)}`,
100
+ "application/vnd.github.raw+json",
101
+ );
102
+ const base = {
103
+ repo: r.full,
104
+ path,
105
+ ref: ref ?? null,
106
+ sha: str(meta, "sha"),
107
+ size: num(meta, "size"),
108
+ };
109
+ const text = output === undefined ? textOf(bytes) : undefined;
110
+ if (text !== undefined) return { ...base, content: text };
111
+ if (output === undefined)
112
+ throw new SurfaceError(
113
+ "usage",
114
+ `${path} is binary`,
115
+ "pass output to write it to a local file",
116
+ );
117
+ const target = resolve(output);
118
+ if (clobber !== true && (await Bun.file(target).exists()))
119
+ throw new SurfaceError(
120
+ "usage",
121
+ `${target} already exists`,
122
+ "pass clobber: true to overwrite it",
123
+ );
124
+ await Bun.write(target, bytes);
125
+ return { ...base, output: target };
126
+ },
127
+ }),
128
+ clone: op({
129
+ description:
130
+ "Clone a repository over https into a new local directory; when it is a fork, add the parent as a remote (`upstream` by default) and fetch it, as gh does. git authenticates through your own credential helper (e.g. `gh auth setup-git`); this SDK's token is not handed to git. Replaces `gh repo clone`.",
131
+ input: s.object({
132
+ repo: s.string({ description: "owner/name or a github.com URL." }),
133
+ dir: s.string({ description: "Absolute path of the new checkout." }),
134
+ gitFlags: s.optional(
135
+ s.array(s.string(), {
136
+ description: 'Extra `git clone` flags, e.g. ["--depth", "1"].',
137
+ }),
138
+ ),
139
+ upstreamRemoteName: s.optional(
140
+ s.string({
141
+ description: "Remote name for a fork's parent (default upstream).",
142
+ }),
143
+ ),
144
+ noUpstream: s.optional(
145
+ s.boolean({
146
+ description: "Do not add the parent of a fork as a remote.",
147
+ }),
148
+ ),
149
+ }),
150
+ annotations: writes,
151
+ run: async ({ repo, dir, gitFlags, upstreamRemoteName, noUpstream }) => {
152
+ if (!isAbsolute(dir))
153
+ throw new SurfaceError(
154
+ "usage",
155
+ `dir must be absolute: ${dir}`,
156
+ "pass the full path of the new checkout",
157
+ );
158
+ const r = await gh.repo(repo);
159
+ const x = await gh.rest("GET", `repos/${r.full}`);
160
+ const full = str(x, "full_name");
161
+ const https = (name: string) => `https://github.com/${name}.git`;
162
+ await gh.git(
163
+ ["clone", ...(gitFlags ?? []), "--", https(full), dir],
164
+ process.cwd(),
165
+ );
166
+ const parent = at(x, "parent");
167
+ if (parent === undefined || noUpstream === true)
168
+ return { repo: full, dir, upstream: null };
169
+ const remote = upstreamRemoteName ?? "upstream";
170
+ const parentFull = str(parent, "full_name");
171
+ await gh.git(
172
+ [
173
+ "remote",
174
+ "add",
175
+ "-t",
176
+ str(parent, "default_branch"),
177
+ remote,
178
+ https(parentFull),
179
+ ],
180
+ dir,
181
+ );
182
+ await gh.git(["fetch", remote], dir);
183
+ await gh.git(["config", `remote.${remote}.gh-resolved`, "base"], dir);
184
+ return { repo: full, dir, upstream: { remote, repo: parentFull } };
185
+ },
186
+ }),
187
+ });