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,81 @@
1
+ // `repo sync` in its remote form: bring a branch of a repository up to date with its upstream or another repository.
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 { optStr, str } from "./read.ts";
6
+
7
+ // Reading one ref is git/ref/... (git/refs/... lists every ref with that prefix); updating it is git/refs/....
8
+ const refPath = (kind: "ref" | "refs", branch: string) =>
9
+ `git/${kind}/heads/${branch.split("/").map(enc).join("/")}`;
10
+
11
+ export const syncOp = (gh: GitHub) =>
12
+ op({
13
+ description:
14
+ "Update a branch of a repository on GitHub: without source, merge it from the fork's upstream (falling back to a forced reset to the parent when force is set and the merge conflicts); with source, move it to the source branch's head, fast-forward only unless force. No local checkout is touched. Replaces `gh repo sync` for a remote repository.",
15
+ input: s.object({
16
+ repo: repoField,
17
+ branch: s.optional(
18
+ s.string({
19
+ description:
20
+ "Branch to sync; default the destination's default branch (with source: the source's).",
21
+ }),
22
+ ),
23
+ source: s.optional(
24
+ s.string({ description: "Source repository owner/name." }),
25
+ ),
26
+ force: s.optional(
27
+ s.boolean({
28
+ description:
29
+ "Hard reset the branch to the source, discarding its own commits.",
30
+ }),
31
+ ),
32
+ }),
33
+ annotations: writes,
34
+ run: async ({ repo, branch, source, force }) => {
35
+ const r = await gh.repo(repo);
36
+ const fromSource = async (src: string) => {
37
+ const name =
38
+ branch ?? str(await gh.rest("GET", `repos/${src}`), "default_branch");
39
+ const sha = str(
40
+ await gh.rest("GET", `repos/${src}/${refPath("ref", name)}`),
41
+ "object",
42
+ "sha",
43
+ );
44
+ await gh.rest("PATCH", `repos/${r.full}/${refPath("refs", name)}`, {
45
+ body: { sha, force: force === true },
46
+ });
47
+ return {
48
+ repo: r.full,
49
+ branch: name,
50
+ source: src,
51
+ sha,
52
+ mergeType: force === true ? "reset" : "fast-forward",
53
+ };
54
+ };
55
+ if (source !== undefined) return fromSource((await gh.repo(source)).full);
56
+ const dest = await gh.rest("GET", `repos/${r.full}`);
57
+ const name = branch ?? str(dest, "default_branch");
58
+ try {
59
+ const m = await gh.rest("POST", `repos/${r.full}/merge-upstream`, {
60
+ body: { branch: name },
61
+ });
62
+ return {
63
+ repo: r.full,
64
+ branch: name,
65
+ source: optStr(dest, "parent", "full_name"),
66
+ sha: null,
67
+ mergeType: optStr(m, "merge_type"),
68
+ };
69
+ } catch (error) {
70
+ const parent = optStr(dest, "parent", "full_name");
71
+ if (
72
+ force === true &&
73
+ parent !== null &&
74
+ error instanceof SurfaceError &&
75
+ error.kind === "conflict"
76
+ )
77
+ return fromSource(parent);
78
+ throw error;
79
+ }
80
+ },
81
+ });
@@ -0,0 +1,104 @@
1
+ // `repo url`: the github.com address `gh browse -n` prints, built locally; only a bare path asks GitHub for the default branch.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { enc, reads, repoField } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { str } from "./read.ts";
6
+
7
+ const segments = (path: string) =>
8
+ path.split("/").filter(Boolean).map(enc).join("/");
9
+
10
+ const usage = (message: string) =>
11
+ new SurfaceError(
12
+ "usage",
13
+ message,
14
+ "see the field descriptions of `repo url`",
15
+ );
16
+
17
+ export const urlOp = (gh: GitHub) =>
18
+ op({
19
+ description:
20
+ "The github.com URL of a repository, an issue or pull request, a file or directory (optionally at a branch or commit and line), a commit, or a repository page. Opens nothing. Replaces `gh browse -n`.",
21
+ input: s.object({
22
+ repo: repoField,
23
+ number: s.optional(
24
+ s.integer({ description: "Issue or pull request number." }),
25
+ ),
26
+ path: s.optional(
27
+ s.string({
28
+ description: "File or directory path from the repository root.",
29
+ }),
30
+ ),
31
+ line: s.optional(s.integer({ description: "Line to point at in path." })),
32
+ endLine: s.optional(
33
+ s.integer({ description: "Last line of a range starting at line." }),
34
+ ),
35
+ blame: s.optional(s.boolean({ description: "Blame view of path." })),
36
+ branch: s.optional(
37
+ s.string({
38
+ description: "Branch for path, or the branch's tree alone.",
39
+ }),
40
+ ),
41
+ commit: s.optional(
42
+ s.string({
43
+ description:
44
+ "Commit SHA: the version of path, or the commit page alone.",
45
+ }),
46
+ ),
47
+ page: s.optional(
48
+ s.enum(["settings", "wiki", "releases", "actions", "projects"]),
49
+ ),
50
+ }),
51
+ annotations: reads,
52
+ run: async ({
53
+ repo,
54
+ number,
55
+ path,
56
+ line,
57
+ endLine,
58
+ blame,
59
+ branch,
60
+ commit,
61
+ page,
62
+ }) => {
63
+ const located =
64
+ path !== undefined || branch !== undefined || commit !== undefined;
65
+ if (
66
+ [number !== undefined, page !== undefined, located].filter(Boolean)
67
+ .length > 1
68
+ )
69
+ throw usage("pass only one of number, page, or path/branch/commit");
70
+ if (branch !== undefined && commit !== undefined)
71
+ throw usage("pass branch or commit, not both");
72
+ if (path === undefined && (line !== undefined || blame === true))
73
+ throw usage("line and blame need a path");
74
+ if (endLine !== undefined && line === undefined)
75
+ throw usage("endLine needs line");
76
+ const r = await gh.repo(repo);
77
+ const base = `https://github.com/${r.full}`;
78
+ const at = (suffix: string) => ({
79
+ repo: r.full,
80
+ url: `${base}/${suffix}`,
81
+ });
82
+ if (number !== undefined) return at(`issues/${number}`);
83
+ if (page !== undefined) return at(page);
84
+ if (path === undefined) {
85
+ if (commit !== undefined) return at(`commit/${enc(commit)}`);
86
+ if (branch !== undefined) return at(`tree/${segments(branch)}`);
87
+ return { repo: r.full, url: base };
88
+ }
89
+ const ref =
90
+ branch ??
91
+ commit ??
92
+ str(await gh.rest("GET", `repos/${r.full}`), "default_branch");
93
+ const view =
94
+ blame === true ? "blame" : line === undefined ? "tree" : "blob";
95
+ // Markdown renders by default, and a rendered page has no line anchors.
96
+ const plain =
97
+ view === "blob" && /\.(md|markdown)$/i.test(path) ? "?plain=1" : "";
98
+ const anchor =
99
+ line === undefined
100
+ ? ""
101
+ : `#L${line}${endLine === undefined ? "" : `-L${endLine}`}`;
102
+ return at(`${view}/${segments(ref)}/${segments(path)}${plain}${anchor}`);
103
+ },
104
+ });
@@ -0,0 +1,87 @@
1
+ import { op, s } from "../vendor/surface/index.ts";
2
+ import { enc, limitField, reads, repoField } from "./fields.ts";
3
+ import type { GitHub } from "./http.ts";
4
+ import { arr, at, bool, num, optNum, optStr, str } from "./read.ts";
5
+
6
+ const release = (x: unknown) => ({
7
+ tag: str(x, "tag_name"),
8
+ name: optStr(x, "name"),
9
+ draft: bool(x, "draft"),
10
+ prerelease: bool(x, "prerelease"),
11
+ target: optStr(x, "target_commitish"),
12
+ publishedAt: optStr(x, "published_at"),
13
+ url: str(x, "html_url"),
14
+ });
15
+
16
+ export const repoOps = (gh: GitHub) => ({
17
+ view: op({
18
+ description:
19
+ "Repository facts: default branch, visibility, archived, description, counts, topics. Replaces `gh repo view --json`.",
20
+ input: s.object({ repo: repoField }),
21
+ annotations: reads,
22
+ run: async ({ repo }) => {
23
+ const r = await gh.repo(repo);
24
+ const x = await gh.rest("GET", `repos/${r.full}`);
25
+ return {
26
+ repo: str(x, "full_name"),
27
+ description: optStr(x, "description"),
28
+ defaultBranch: str(x, "default_branch"),
29
+ visibility: optStr(x, "visibility"),
30
+ private: bool(x, "private"),
31
+ archived: bool(x, "archived"),
32
+ fork: bool(x, "fork"),
33
+ stars: optNum(x, "stargazers_count"),
34
+ openIssues: optNum(x, "open_issues_count"),
35
+ topics: arr(at(x, "topics") ?? [], "topics").filter(
36
+ (t) => typeof t === "string",
37
+ ),
38
+ pushedAt: optStr(x, "pushed_at"),
39
+ url: str(x, "html_url"),
40
+ };
41
+ },
42
+ }),
43
+ });
44
+
45
+ export const releaseOps = (gh: GitHub) => ({
46
+ list: op({
47
+ description:
48
+ "Releases, newest first, drafts included when the token can see them. Replaces `gh release list`.",
49
+ input: s.object({ repo: repoField, limit: limitField(20) }),
50
+ annotations: reads,
51
+ run: async ({ repo, limit }) => {
52
+ const r = await gh.repo(repo);
53
+ return {
54
+ repo: r.full,
55
+ releases: (await gh.list(`repos/${r.full}/releases`, limit ?? 20)).map(
56
+ release,
57
+ ),
58
+ };
59
+ },
60
+ }),
61
+ view: op({
62
+ description:
63
+ "One release by tag (latest when omitted) with notes and assets. Replaces `gh release view`.",
64
+ input: s.object({ repo: repoField, tag: s.optional(s.string()) }),
65
+ annotations: reads,
66
+ run: async ({ repo, tag }) => {
67
+ const r = await gh.repo(repo);
68
+ const x = await gh.rest(
69
+ "GET",
70
+ tag === undefined
71
+ ? `repos/${r.full}/releases/latest`
72
+ : `repos/${r.full}/releases/tags/${enc(tag)}`,
73
+ );
74
+ return {
75
+ repo: r.full,
76
+ ...release(x),
77
+ body: optStr(x, "body") ?? "",
78
+ assets: arr(at(x, "assets") ?? [], "assets").map((a) => ({
79
+ name: str(a, "name"),
80
+ size: num(a, "size"),
81
+ downloads: num(a, "download_count"),
82
+ url: str(a, "browser_download_url"),
83
+ })),
84
+ };
85
+ },
86
+ }),
87
+ });
@@ -0,0 +1,96 @@
1
+ // How a ruleset is scoped (repository or org), its input fields, and how GitHub's ruleset JSON is trimmed.
2
+ import { s } from "../vendor/surface/index.ts";
3
+ import { enc } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { arr, at, isObj, num, optNum, optStr, str } from "./read.ts";
6
+
7
+ export const repoOrg = {
8
+ repo: s.optional(
9
+ s.string({
10
+ description:
11
+ "owner/name (a github.com URL works too). Defaults to the git origin of the current directory; ignored with org.",
12
+ }),
13
+ ),
14
+ org: s.optional(
15
+ s.string({ description: "Organization, for an org-level ruleset." }),
16
+ ),
17
+ };
18
+ export const idField = s.integer({ description: "Ruleset id." });
19
+ const rule = s.object({
20
+ type: s.string(),
21
+ parameters: s.optional(s.record(s.unknown())),
22
+ });
23
+ const bypassActor = s.object({
24
+ actorId: s.optional(
25
+ s.integer({ description: "Omit for OrganizationAdmin / DeployKey." }),
26
+ ),
27
+ actorType: s.enum([
28
+ "Integration",
29
+ "OrganizationAdmin",
30
+ "RepositoryRole",
31
+ "Team",
32
+ "DeployKey",
33
+ ]),
34
+ bypassMode: s.optional(s.enum(["always", "pull_request", "exempt"])),
35
+ });
36
+ export const fields = {
37
+ target: s.enum(["branch", "tag", "push"]),
38
+ enforcement: s.enum(["active", "disabled", "evaluate"]),
39
+ include: s.optional(
40
+ s.array(s.string(), {
41
+ description:
42
+ 'Ref name patterns, e.g. "~DEFAULT_BRANCH", "refs/heads/main", "~ALL".',
43
+ }),
44
+ ),
45
+ exclude: s.optional(s.array(s.string())),
46
+ conditions: s.optional(
47
+ s.record(s.unknown(), {
48
+ description:
49
+ "Other GitHub condition objects set beside ref_name, e.g. repository_name for an org ruleset.",
50
+ }),
51
+ ),
52
+ bypassActors: s.optional(s.array(bypassActor)),
53
+ rules: s.optional(
54
+ s.array(rule, {
55
+ description:
56
+ "GitHub rule objects ({ type, parameters }), sent unchanged.",
57
+ }),
58
+ ),
59
+ };
60
+
61
+ type Scope = {
62
+ readonly path: string;
63
+ readonly out: { readonly repo: string } | { readonly org: string };
64
+ };
65
+
66
+ export const scopeOf = async (
67
+ gh: GitHub,
68
+ repo: string | undefined,
69
+ org: string | undefined,
70
+ ): Promise<Scope> => {
71
+ if (org !== undefined) return { path: `orgs/${enc(org)}`, out: { org } };
72
+ const r = await gh.repo(repo);
73
+ return { path: `repos/${r.full}`, out: { repo: r.full } };
74
+ };
75
+
76
+ export const summary = (x: unknown) => ({
77
+ id: num(x, "id"),
78
+ name: str(x, "name"),
79
+ target: optStr(x, "target"),
80
+ enforcement: str(x, "enforcement"),
81
+ source: optStr(x, "source"),
82
+ sourceType: optStr(x, "source_type"),
83
+ updatedAt: optStr(x, "updated_at"),
84
+ url: optStr(x, "_links", "html", "href"),
85
+ });
86
+
87
+ export const detail = (x: unknown) => ({
88
+ ...summary(x),
89
+ conditions: isObj(at(x, "conditions")) ? at(x, "conditions") : null,
90
+ bypassActors: arr(at(x, "bypass_actors") ?? [], "bypass_actors").map((a) => ({
91
+ actorId: optNum(a, "actor_id"),
92
+ actorType: str(a, "actor_type"),
93
+ bypassMode: optStr(a, "bypass_mode"),
94
+ })),
95
+ rules: arr(at(x, "rules") ?? [], "rules"),
96
+ });
@@ -0,0 +1,124 @@
1
+ // Ruleset writes: create, edit and delete (gh has no writer for these).
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { irreversible, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { arr, at, isObj } from "./read.ts";
6
+ import { detail, fields, idField, repoOrg, scopeOf } from "./ruleset-shape.ts";
7
+
8
+ type Fields = {
9
+ readonly name?: string | undefined;
10
+ readonly target?: string | undefined;
11
+ readonly enforcement?: string | undefined;
12
+ readonly include?: readonly string[] | undefined;
13
+ readonly exclude?: readonly string[] | undefined;
14
+ readonly conditions?: Readonly<Record<string, unknown>> | undefined;
15
+ readonly bypassActors?:
16
+ | readonly {
17
+ readonly actorId?: number | undefined;
18
+ readonly actorType: string;
19
+ readonly bypassMode?: string | undefined;
20
+ }[]
21
+ | undefined;
22
+ readonly rules?: readonly unknown[] | undefined;
23
+ };
24
+
25
+ // PUT replaces conditions whole, so an edit that names only one side keeps the other from `current`.
26
+ const body = (f: Fields, current: unknown) => {
27
+ const existing = at(current, "conditions");
28
+ const refName = at(existing, "ref_name");
29
+ const keepList = (key: string): unknown[] => [
30
+ ...arr(at(refName, key) ?? [], key),
31
+ ];
32
+ const touchesRefs = f.include !== undefined || f.exclude !== undefined;
33
+ const conditions =
34
+ touchesRefs || f.conditions !== undefined
35
+ ? {
36
+ ...(isObj(existing) ? existing : {}),
37
+ ...f.conditions,
38
+ ...(touchesRefs
39
+ ? {
40
+ ref_name: {
41
+ include: f.include ?? keepList("include"),
42
+ exclude: f.exclude ?? keepList("exclude"),
43
+ },
44
+ }
45
+ : {}),
46
+ }
47
+ : undefined;
48
+ const entries = {
49
+ name: f.name,
50
+ target: f.target,
51
+ enforcement: f.enforcement,
52
+ conditions,
53
+ bypass_actors: f.bypassActors?.map((a) => ({
54
+ actor_id: a.actorId ?? null,
55
+ actor_type: a.actorType,
56
+ bypass_mode: a.bypassMode ?? "always",
57
+ })),
58
+ rules: f.rules,
59
+ };
60
+ return Object.fromEntries(
61
+ Object.entries(entries).filter(([, v]) => v !== undefined),
62
+ );
63
+ };
64
+
65
+ export const rulesetWriteOps = (gh: GitHub) => ({
66
+ create: op({
67
+ description:
68
+ "Create a ruleset on a repository, or on an org with `org`. gh has no equivalent.",
69
+ input: s.object({ ...repoOrg, name: s.string(), ...fields }),
70
+ annotations: writes,
71
+ run: async ({ repo, org, ...f }) => {
72
+ const sc = await scopeOf(gh, repo, org);
73
+ const x = await gh.rest("POST", `${sc.path}/rulesets`, {
74
+ body: body(f, undefined),
75
+ });
76
+ return { ...sc.out, ...detail(x) };
77
+ },
78
+ }),
79
+ edit: op({
80
+ description:
81
+ "Change any field of a ruleset; `include` or `exclude` alone keeps the other side, `rules` and `bypassActors` replace the whole list. gh has no equivalent.",
82
+ input: s.object({
83
+ ...repoOrg,
84
+ id: idField,
85
+ name: s.optional(s.string()),
86
+ target: s.optional(fields.target),
87
+ enforcement: s.optional(fields.enforcement),
88
+ include: fields.include,
89
+ exclude: fields.exclude,
90
+ conditions: fields.conditions,
91
+ bypassActors: fields.bypassActors,
92
+ rules: fields.rules,
93
+ }),
94
+ annotations: writes,
95
+ run: async ({ repo, org, id, ...f }) => {
96
+ const sc = await scopeOf(gh, repo, org);
97
+ if (Object.values(f).every((v) => v === undefined))
98
+ throw new SurfaceError(
99
+ "usage",
100
+ "nothing to change",
101
+ "pass at least one ruleset field",
102
+ );
103
+ const path = `${sc.path}/rulesets/${id}`;
104
+ const needsCurrent =
105
+ f.include !== undefined ||
106
+ f.exclude !== undefined ||
107
+ f.conditions !== undefined;
108
+ const current = needsCurrent ? await gh.rest("GET", path) : undefined;
109
+ const x = await gh.rest("PUT", path, { body: body(f, current) });
110
+ return { ...sc.out, ...detail(x) };
111
+ },
112
+ }),
113
+ delete: op({
114
+ description:
115
+ "Delete a ruleset; its rules stop applying at once. gh has no equivalent.",
116
+ input: s.object({ ...repoOrg, id: idField }),
117
+ annotations: irreversible,
118
+ run: async ({ repo, org, id }) => {
119
+ const sc = await scopeOf(gh, repo, org);
120
+ await gh.rest("DELETE", `${sc.path}/rulesets/${id}`);
121
+ return { ...sc.out, id, deleted: true };
122
+ },
123
+ }),
124
+ });
@@ -0,0 +1,80 @@
1
+ // Repository and organization rulesets: list, view and the rules that apply to a branch; writes in rulesets-write.ts.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { enc, limitField, reads, repoField } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { at, num, optStr, str } from "./read.ts";
6
+ import { detail, idField, repoOrg, scopeOf, summary } from "./ruleset-shape.ts";
7
+ import { rulesetWriteOps } from "./rulesets-write.ts";
8
+
9
+ export const rulesetOps = (gh: GitHub) => ({
10
+ list: op({
11
+ description:
12
+ "Rulesets of a repository (with those inherited from its org unless `parents: false`) or of an org. Replaces `gh ruleset list`.",
13
+ input: s.object({
14
+ ...repoOrg,
15
+ parents: s.optional(s.boolean()),
16
+ limit: limitField(30),
17
+ }),
18
+ annotations: reads,
19
+ run: async ({ repo, org, parents, limit }) => {
20
+ const sc = await scopeOf(gh, repo, org);
21
+ const raw = await gh.list(`${sc.path}/rulesets`, limit ?? 30, {
22
+ query: org === undefined ? { includes_parents: parents ?? true } : {},
23
+ });
24
+ return { ...sc.out, items: raw.map(summary) };
25
+ },
26
+ }),
27
+ view: op({
28
+ description:
29
+ "One ruleset: name, target, enforcement, conditions, bypass actors and rules with their parameters. Replaces `gh ruleset view`.",
30
+ input: s.object({ ...repoOrg, id: idField }),
31
+ annotations: reads,
32
+ run: async ({ repo, org, id }) => {
33
+ const sc = await scopeOf(gh, repo, org);
34
+ return {
35
+ ...sc.out,
36
+ ...detail(await gh.rest("GET", `${sc.path}/rulesets/${id}`)),
37
+ };
38
+ },
39
+ }),
40
+ check: op({
41
+ description:
42
+ "The rules that apply to a branch, each with the ruleset it comes from. Replaces `gh ruleset check`.",
43
+ input: s.object({
44
+ repo: repoField,
45
+ branch: s.optional(s.string()),
46
+ default: s.optional(
47
+ s.boolean({ description: "Check the default branch." }),
48
+ ),
49
+ }),
50
+ annotations: reads,
51
+ run: async ({ repo, branch, default: useDefault }) => {
52
+ if ((branch === undefined) === (useDefault !== true))
53
+ throw new SurfaceError(
54
+ "usage",
55
+ "pass exactly one of branch or default: true",
56
+ "name the branch to check",
57
+ );
58
+ const r = await gh.repo(repo);
59
+ const name =
60
+ branch ??
61
+ str(await gh.rest("GET", `repos/${r.full}`), "default_branch");
62
+ const raw = await gh.list(
63
+ `repos/${r.full}/rules/branches/${enc(name)}`,
64
+ 1000,
65
+ );
66
+ return {
67
+ repo: r.full,
68
+ branch: name,
69
+ items: raw.map((x) => ({
70
+ type: str(x, "type"),
71
+ parameters: at(x, "parameters") ?? null,
72
+ rulesetId: num(x, "ruleset_id"),
73
+ rulesetSource: optStr(x, "ruleset_source"),
74
+ rulesetSourceType: optStr(x, "ruleset_source_type"),
75
+ })),
76
+ };
77
+ },
78
+ }),
79
+ ...rulesetWriteOps(gh),
80
+ });
@@ -0,0 +1,88 @@
1
+ // Downloading a workflow run's artifacts and extracting each zip into a directory.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { repoField, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { bool, num, str } from "./read.ts";
6
+ import { safeJoin, unzip } from "./zip.ts";
7
+
8
+ export const runDownloadOp = (gh: GitHub) =>
9
+ op({
10
+ description:
11
+ "Download a run's unexpired artifacts (all, or those matching names or glob patterns) and extract them: into dir itself when exactly one name is given, else into dir/<artifact name>/. An existing file fails as `conflict` before anything is written. Replaces `gh run download`.",
12
+ input: s.object({
13
+ repo: repoField,
14
+ runId: s.integer({
15
+ description:
16
+ "Workflow run id (databaseId; the number in .../actions/runs/<id>).",
17
+ }),
18
+ names: s.optional(
19
+ s.array(s.string(), { description: "Artifact names to download." }),
20
+ ),
21
+ patterns: s.optional(
22
+ s.array(s.string(), {
23
+ description: "Glob patterns over artifact names.",
24
+ }),
25
+ ),
26
+ dir: s.optional(
27
+ s.string({ description: "Target directory (default: cwd)." }),
28
+ ),
29
+ }),
30
+ annotations: writes,
31
+ run: async ({ repo, runId, names, patterns, dir }) => {
32
+ const r = await gh.repo(repo);
33
+ const globs = (patterns ?? []).map((p) => new Bun.Glob(p));
34
+ const filtered = names !== undefined || patterns !== undefined;
35
+ const chosen = (
36
+ await gh.list(`repos/${r.full}/actions/runs/${runId}/artifacts`, 1000, {
37
+ key: "artifacts",
38
+ })
39
+ )
40
+ .filter((a) => !bool(a, "expired"))
41
+ .map((a) => ({ id: num(a, "id"), name: str(a, "name") }))
42
+ .filter(
43
+ (a) =>
44
+ !filtered ||
45
+ (names ?? []).includes(a.name) ||
46
+ globs.some((g) => g.match(a.name)),
47
+ );
48
+ if (chosen.length === 0)
49
+ throw new SurfaceError(
50
+ "not_found",
51
+ `run ${runId} has no unexpired artifacts${filtered ? " matching the filter" : ""}`,
52
+ "artifacts expire after the retention window; check names with `api rest`",
53
+ );
54
+ const flat = names?.length === 1 && patterns === undefined;
55
+ const root = dir ?? ".";
56
+ const planned = [];
57
+ for (const a of chosen) {
58
+ const base = flat ? root : safeJoin(root, a.name);
59
+ const zip = await gh.bytes(
60
+ `repos/${r.full}/actions/artifacts/${a.id}/zip`,
61
+ );
62
+ const entries = unzip(zip).map((e) => ({
63
+ target: safeJoin(base, e.path),
64
+ data: e.data,
65
+ }));
66
+ planned.push({ ...a, dir: base, entries });
67
+ }
68
+ for (const e of planned.flatMap((a) => a.entries))
69
+ if (await Bun.file(e.target).exists())
70
+ throw new SurfaceError(
71
+ "conflict",
72
+ `${e.target} already exists`,
73
+ "download into an empty dir or remove the file",
74
+ );
75
+ for (const e of planned.flatMap((a) => a.entries))
76
+ await Bun.write(e.target, e.data);
77
+ return {
78
+ repo: r.full,
79
+ runId,
80
+ artifacts: planned.map((a) => ({
81
+ id: a.id,
82
+ name: a.name,
83
+ dir: a.dir,
84
+ files: a.entries.map((e) => e.target),
85
+ })),
86
+ };
87
+ },
88
+ });