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,105 @@
1
+ // Listing and deleting GitHub Actions caches.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { irreversible, limitField, reads, repoField } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { arr, at, num, optStr, str } from "./read.ts";
6
+
7
+ const refField = s.optional(
8
+ s.string({
9
+ description: "refs/heads/<branch> or refs/pull/<number>/merge.",
10
+ }),
11
+ );
12
+
13
+ const cache = (c: unknown) => ({
14
+ id: num(c, "id"),
15
+ key: str(c, "key"),
16
+ ref: str(c, "ref"),
17
+ sizeInBytes: num(c, "size_in_bytes"),
18
+ createdAt: optStr(c, "created_at"),
19
+ lastAccessedAt: optStr(c, "last_accessed_at"),
20
+ });
21
+
22
+ const listCaches = async (
23
+ gh: GitHub,
24
+ full: string,
25
+ limit: number,
26
+ query: Readonly<Record<string, string | undefined>>,
27
+ ) =>
28
+ (
29
+ await gh.list(`repos/${full}/actions/caches`, limit, {
30
+ query,
31
+ key: "actions_caches",
32
+ })
33
+ ).map(cache);
34
+
35
+ export const cacheOps = (gh: GitHub) => ({
36
+ list: op({
37
+ description:
38
+ "Actions caches with key, ref, size and access times, filterable by key prefix and ref. Replaces `gh cache list`.",
39
+ input: s.object({
40
+ repo: repoField,
41
+ key: s.optional(s.string({ description: "Cache key prefix." })),
42
+ ref: refField,
43
+ sort: s.optional(
44
+ s.enum(["created_at", "last_accessed_at", "size_in_bytes"]),
45
+ ),
46
+ order: s.optional(s.enum(["asc", "desc"])),
47
+ limit: limitField(30),
48
+ }),
49
+ annotations: reads,
50
+ run: async ({ repo, key, ref, sort, order, limit }) => {
51
+ const r = await gh.repo(repo);
52
+ return {
53
+ repo: r.full,
54
+ items: await listCaches(gh, r.full, limit ?? 30, {
55
+ key,
56
+ ref,
57
+ sort,
58
+ direction: order,
59
+ }),
60
+ };
61
+ },
62
+ }),
63
+ delete: op({
64
+ description:
65
+ "Delete caches by id, by exact key (optionally only on one ref), or all of them (optionally only on one ref); returns how many were deleted. Replaces `gh cache delete`.",
66
+ input: s.object({
67
+ repo: repoField,
68
+ id: s.optional(s.integer({ description: "Cache id." })),
69
+ key: s.optional(s.string({ description: "Exact cache key." })),
70
+ all: s.optional(s.boolean()),
71
+ ref: refField,
72
+ }),
73
+ annotations: irreversible,
74
+ run: async ({ repo, id, key, all, ref }) => {
75
+ const modes = [id !== undefined, key !== undefined, all === true];
76
+ if (
77
+ modes.filter(Boolean).length !== 1 ||
78
+ (id !== undefined && ref !== undefined)
79
+ )
80
+ throw new SurfaceError(
81
+ "usage",
82
+ "pass exactly one of id, key or all (ref only with key or all)",
83
+ "find ids and keys with `cache list`",
84
+ );
85
+ const r = await gh.repo(repo);
86
+ let ids: number[];
87
+ if (id !== undefined) {
88
+ await gh.rest("DELETE", `repos/${r.full}/actions/caches/${id}`);
89
+ ids = [id];
90
+ } else if (key !== undefined) {
91
+ const x = await gh.rest("DELETE", `repos/${r.full}/actions/caches`, {
92
+ query: { key, ref },
93
+ });
94
+ ids = arr(at(x, "actions_caches"), "actions_caches").map((c) =>
95
+ num(c, "id"),
96
+ );
97
+ } else {
98
+ ids = (await listCaches(gh, r.full, 100_000, { ref })).map((c) => c.id);
99
+ for (const each of ids)
100
+ await gh.rest("DELETE", `repos/${r.full}/actions/caches/${each}`);
101
+ }
102
+ return { repo: r.full, deleted: ids.length, ids };
103
+ },
104
+ }),
105
+ });
@@ -0,0 +1,107 @@
1
+ // `pr checks`: one GraphQL rollup of check runs and commit statuses, bucketed the way `gh pr checks` buckets them.
2
+ import { SurfaceError } from "../vendor/surface/index.ts";
3
+ import type { GitHub, Repo } from "./http.ts";
4
+ import { at, nodes, optNum, optStr, str } from "./read.ts";
5
+
6
+ export type Bucket = "pass" | "fail" | "pending" | "skipping" | "cancel";
7
+ export type Check = {
8
+ readonly name: string;
9
+ readonly bucket: Bucket;
10
+ readonly state: string;
11
+ readonly required: boolean;
12
+ readonly url: string | null;
13
+ readonly workflow: string | null;
14
+ readonly runId: number | null;
15
+ readonly startedAt: string | null;
16
+ readonly completedAt: string | null;
17
+ };
18
+
19
+ const QUERY = `query($owner:String!,$name:String!,$number:Int!,$after:String){repository(owner:$owner,name:$name){pullRequest(number:$number){
20
+ headRefOid commits(last:1){nodes{commit{statusCheckRollup{state contexts(first:100,after:$after){pageInfo{hasNextPage endCursor}
21
+ nodes{__typename
22
+ ... on CheckRun{name status conclusion detailsUrl startedAt completedAt isRequired(pullRequestNumber:$number) checkSuite{workflowRun{databaseId workflow{name}}}}
23
+ ... on StatusContext{context state targetUrl createdAt isRequired(pullRequestNumber:$number)}}}}}}}}}}`;
24
+
25
+ const runBucket = (status: string, conclusion: string): Bucket => {
26
+ if (status !== "COMPLETED") return "pending";
27
+ if (conclusion === "SUCCESS") return "pass";
28
+ if (conclusion === "CANCELLED") return "cancel";
29
+ if (conclusion === "SKIPPED" || conclusion === "NEUTRAL") return "skipping";
30
+ return "fail";
31
+ };
32
+
33
+ const statusBucket = (state: string): Bucket =>
34
+ state === "SUCCESS"
35
+ ? "pass"
36
+ : state === "PENDING" || state === "EXPECTED"
37
+ ? "pending"
38
+ : "fail";
39
+
40
+ const toCheck = (n: unknown): Check => {
41
+ if (at(n, "__typename") === "CheckRun") {
42
+ const status = str(n, "status");
43
+ const conclusion = optStr(n, "conclusion") ?? "";
44
+ return {
45
+ name: str(n, "name"),
46
+ bucket: runBucket(status, conclusion),
47
+ state: conclusion || status,
48
+ required: at(n, "isRequired") === true,
49
+ url: optStr(n, "detailsUrl"),
50
+ workflow: optStr(n, "checkSuite", "workflowRun", "workflow", "name"),
51
+ runId: optNum(n, "checkSuite", "workflowRun", "databaseId"),
52
+ startedAt: optStr(n, "startedAt"),
53
+ completedAt: optStr(n, "completedAt"),
54
+ };
55
+ }
56
+ const state = str(n, "state");
57
+ return {
58
+ name: str(n, "context"),
59
+ bucket: statusBucket(state),
60
+ state,
61
+ required: at(n, "isRequired") === true,
62
+ url: optStr(n, "targetUrl"),
63
+ workflow: null,
64
+ runId: null,
65
+ startedAt: optStr(n, "createdAt"),
66
+ completedAt: null,
67
+ };
68
+ };
69
+
70
+ export const fetchChecks = async (gh: GitHub, repo: Repo, number: number) => {
71
+ const checks: Check[] = [];
72
+ let after: string | null = null;
73
+ let headSha = "";
74
+ let rollup: string | null = null;
75
+ do {
76
+ const data = await gh.graphql(QUERY, {
77
+ owner: repo.owner,
78
+ name: repo.name,
79
+ number,
80
+ after,
81
+ });
82
+ const pr = at(data, "repository", "pullRequest");
83
+ if (pr === null || pr === undefined)
84
+ throw new SurfaceError(
85
+ "not_found",
86
+ `no pull request #${number} in ${repo.full}`,
87
+ "check the number",
88
+ );
89
+ headSha = str(pr, "headRefOid");
90
+ const commit = at(nodes(pr, "commits")[0], "commit", "statusCheckRollup");
91
+ rollup = optStr(commit, "state");
92
+ checks.push(...nodes(commit, "contexts").map(toCheck));
93
+ after =
94
+ at(commit, "contexts", "pageInfo", "hasNextPage") === true
95
+ ? optStr(commit, "contexts", "pageInfo", "endCursor")
96
+ : null;
97
+ } while (after !== null);
98
+ const counts: Record<Bucket, number> = {
99
+ pass: 0,
100
+ fail: 0,
101
+ pending: 0,
102
+ skipping: 0,
103
+ cancel: 0,
104
+ };
105
+ for (const c of checks) counts[c.bucket] += 1;
106
+ return { headSha, rollup, counts, checks };
107
+ };
@@ -0,0 +1,230 @@
1
+ // Codespaces over REST: the user's own (user/codespaces), per repository, and org-admin views of members' codespaces.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import {
4
+ enc,
5
+ irreversible,
6
+ limitField,
7
+ reads,
8
+ repoField,
9
+ writes,
10
+ } from "./fields.ts";
11
+ import type { GitHub } from "./http.ts";
12
+ import { bool, optNum, optStr, str } from "./read.ts";
13
+
14
+ const nameField = s.string({
15
+ description: "Codespace name (not its display name).",
16
+ });
17
+ const orgField = s.optional(
18
+ s.string({ description: "Organization login; org admins only, with user." }),
19
+ );
20
+ const userField = s.optional(
21
+ s.string({ description: "Member whose codespace it is; used with org." }),
22
+ );
23
+
24
+ export const codespaceSummary = (c: unknown) => ({
25
+ name: str(c, "name"),
26
+ displayName: optStr(c, "display_name"),
27
+ state: str(c, "state"),
28
+ owner: optStr(c, "owner", "login"),
29
+ repo: str(c, "repository", "full_name"),
30
+ branch: optStr(c, "git_status", "ref"),
31
+ ahead: optNum(c, "git_status", "ahead"),
32
+ behind: optNum(c, "git_status", "behind"),
33
+ unpushedChanges: bool(c, "git_status", "has_unpushed_changes"),
34
+ uncommittedChanges: bool(c, "git_status", "has_uncommitted_changes"),
35
+ machine: optStr(c, "machine", "name"),
36
+ location: str(c, "location"),
37
+ devcontainerPath: optStr(c, "devcontainer_path"),
38
+ idleTimeoutMinutes: optNum(c, "idle_timeout_minutes"),
39
+ retentionExpiresAt: optStr(c, "retention_expires_at"),
40
+ createdAt: str(c, "created_at"),
41
+ lastUsedAt: str(c, "last_used_at"),
42
+ webUrl: str(c, "web_url"),
43
+ });
44
+
45
+ // Without the `codespace` scope GitHub answers 403 or 404, which reads like a missing codespace.
46
+ const scoped = <T>(call: Promise<T>): Promise<T> =>
47
+ call.catch((error: unknown) => {
48
+ if (
49
+ error instanceof SurfaceError &&
50
+ (error.kind === "forbidden" || error.kind === "not_found")
51
+ )
52
+ throw new SurfaceError(
53
+ error.kind,
54
+ error.message,
55
+ "the token needs the `codespace` scope (`gh auth refresh -s codespace`); otherwise check the codespace name",
56
+ );
57
+ throw error;
58
+ });
59
+
60
+ const memberPath = (
61
+ name: string,
62
+ org: string | undefined,
63
+ user: string | undefined,
64
+ ): string => {
65
+ if (org === undefined && user === undefined)
66
+ return `user/codespaces/${enc(name)}`;
67
+ if (org === undefined || user === undefined)
68
+ throw new SurfaceError(
69
+ "usage",
70
+ "org and user go together",
71
+ "pass both to act on a member's codespace as an org admin, or neither for your own",
72
+ );
73
+ return `orgs/${enc(org)}/members/${enc(user)}/codespaces/${enc(name)}`;
74
+ };
75
+
76
+ export const codespaceOps = (gh: GitHub) => ({
77
+ list: op({
78
+ description:
79
+ "Your codespaces, optionally only one repository's; org admins can list an organization's or one member's. Replaces `gh codespace list`.",
80
+ input: s.object({
81
+ repo: s.optional(
82
+ s.string({ description: "Only codespaces of owner/name." }),
83
+ ),
84
+ org: orgField,
85
+ user: userField,
86
+ limit: limitField(30),
87
+ }),
88
+ annotations: reads,
89
+ run: async ({ repo, org, user, limit }) => {
90
+ if (user !== undefined && org === undefined)
91
+ throw new SurfaceError(
92
+ "usage",
93
+ "user needs org",
94
+ "pass the organization login too",
95
+ );
96
+ const r = repo === undefined ? undefined : await gh.repo(repo);
97
+ const path =
98
+ org !== undefined
99
+ ? user === undefined
100
+ ? `orgs/${enc(org)}/codespaces`
101
+ : `orgs/${enc(org)}/members/${enc(user)}/codespaces`
102
+ : r === undefined
103
+ ? "user/codespaces"
104
+ : `repos/${r.full}/codespaces`;
105
+ const all = (
106
+ await scoped(gh.list(path, limit ?? 30, { key: "codespaces" }))
107
+ ).map(codespaceSummary);
108
+ return {
109
+ ...(r === undefined ? {} : { repo: r.full }),
110
+ ...(org === undefined ? {} : { org }),
111
+ ...(user === undefined ? {} : { user }),
112
+ items:
113
+ org !== undefined && r !== undefined
114
+ ? all.filter((c) => c.repo === r.full)
115
+ : all,
116
+ };
117
+ },
118
+ }),
119
+ view: op({
120
+ description:
121
+ "One of your codespaces by name: state, branch with ahead/behind and unpushed changes, machine, timeouts. Replaces `gh codespace view`.",
122
+ input: s.object({ name: nameField }),
123
+ annotations: reads,
124
+ run: async ({ name }) =>
125
+ codespaceSummary(
126
+ await scoped(gh.rest("GET", `user/codespaces/${enc(name)}`)),
127
+ ),
128
+ }),
129
+ create: op({
130
+ description:
131
+ "Create a codespace for a repository branch; it may still be provisioning (state Queued or Provisioning) when this returns. Replaces `gh codespace create`.",
132
+ input: s.object({
133
+ repo: repoField,
134
+ branch: s.optional(
135
+ s.string({ description: "Default branch when omitted." }),
136
+ ),
137
+ machine: s.optional(
138
+ s.string({ description: "Machine type name, e.g. standardLinux32gb." }),
139
+ ),
140
+ location: s.optional(
141
+ s.string({
142
+ description: "EastUs, SouthEastAsia, WestEurope or WestUs2.",
143
+ }),
144
+ ),
145
+ devcontainerPath: s.optional(s.string()),
146
+ idleTimeoutMinutes: s.optional(s.integer()),
147
+ retentionPeriodMinutes: s.optional(
148
+ s.integer({
149
+ description: "Minutes after stopping before auto-delete (max 43200).",
150
+ }),
151
+ ),
152
+ displayName: s.optional(
153
+ s.string({ description: "48 characters or less." }),
154
+ ),
155
+ defaultPermissions: s.optional(
156
+ s.boolean({
157
+ description:
158
+ "Skip extra repository permissions the devcontainer requests.",
159
+ }),
160
+ ),
161
+ }),
162
+ annotations: writes,
163
+ run: async (input) => {
164
+ const r = await gh.repo(input.repo);
165
+ const body = Object.fromEntries(
166
+ Object.entries({
167
+ ref: input.branch,
168
+ machine: input.machine,
169
+ location: input.location,
170
+ devcontainer_path: input.devcontainerPath,
171
+ idle_timeout_minutes: input.idleTimeoutMinutes,
172
+ retention_period_minutes: input.retentionPeriodMinutes,
173
+ display_name: input.displayName,
174
+ multi_repo_permissions_opt_out: input.defaultPermissions,
175
+ }).filter(([, v]) => v !== undefined),
176
+ );
177
+ return codespaceSummary(
178
+ await scoped(gh.rest("POST", `repos/${r.full}/codespaces`, { body })),
179
+ );
180
+ },
181
+ }),
182
+ delete: op({
183
+ description:
184
+ "Delete a codespace (yours, or a member's as org admin). Irreversible: uncommitted and unpushed changes in it are lost, so check unpushedChanges with view first. Replaces `gh codespace delete`.",
185
+ input: s.object({ name: nameField, org: orgField, user: userField }),
186
+ annotations: irreversible,
187
+ run: async ({ name, org, user }) => {
188
+ await scoped(gh.rest("DELETE", memberPath(name, org, user)));
189
+ return { name, deleted: true };
190
+ },
191
+ }),
192
+ edit: op({
193
+ description:
194
+ "Rename a codespace or change its machine type (a machine change applies at the next start). Replaces `gh codespace edit`.",
195
+ input: s.object({
196
+ name: nameField,
197
+ displayName: s.optional(s.string()),
198
+ machine: s.optional(s.string()),
199
+ }),
200
+ annotations: writes,
201
+ run: async ({ name, displayName, machine }) => {
202
+ if (displayName === undefined && machine === undefined)
203
+ throw new SurfaceError(
204
+ "usage",
205
+ "nothing to change",
206
+ "pass displayName or machine",
207
+ );
208
+ const body = Object.fromEntries(
209
+ Object.entries({ display_name: displayName, machine }).filter(
210
+ ([, v]) => v !== undefined,
211
+ ),
212
+ );
213
+ return codespaceSummary(
214
+ await scoped(
215
+ gh.rest("PATCH", `user/codespaces/${enc(name)}`, { body }),
216
+ ),
217
+ );
218
+ },
219
+ }),
220
+ stop: op({
221
+ description:
222
+ "Stop a running codespace (yours, or a member's as org admin); its files are kept. Replaces `gh codespace stop`.",
223
+ input: s.object({ name: nameField, org: orgField, user: userField }),
224
+ annotations: writes,
225
+ run: async ({ name, org, user }) =>
226
+ codespaceSummary(
227
+ await scoped(gh.rest("POST", `${memberPath(name, org, user)}/stop`)),
228
+ ),
229
+ }),
230
+ });
@@ -0,0 +1,50 @@
1
+ // Locking a conversation: issues and pull requests share the issues lock endpoint.
2
+ import { op, s } from "../vendor/surface/index.ts";
3
+ import { numberField, repoField, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+
6
+ // The REST endpoint spells reasons with a hyphen and a space, unlike gh's flag values.
7
+ const restReason = {
8
+ off_topic: "off-topic",
9
+ too_heated: "too heated",
10
+ resolved: "resolved",
11
+ spam: "spam",
12
+ } as const;
13
+
14
+ export const lockOps = (gh: GitHub, noun: "pr" | "issue") => {
15
+ const what = noun === "pr" ? "a pull request" : "an issue";
16
+ return {
17
+ lock: op({
18
+ description: `Lock the conversation of ${what} so only collaborators can comment, with an optional reason. Replaces \`gh ${noun} lock\`.`,
19
+ input: s.object({
20
+ repo: repoField,
21
+ number: numberField,
22
+ reason: s.optional(
23
+ s.enum(["off_topic", "too_heated", "resolved", "spam"]),
24
+ ),
25
+ }),
26
+ annotations: { ...writes, idempotent: true },
27
+ run: async ({ repo, number, reason }) => {
28
+ const r = await gh.repo(repo);
29
+ await gh.rest(
30
+ "PUT",
31
+ `repos/${r.full}/issues/${number}/lock`,
32
+ reason === undefined
33
+ ? {}
34
+ : { body: { lock_reason: restReason[reason] } },
35
+ );
36
+ return { repo: r.full, number, locked: true, reason: reason ?? null };
37
+ },
38
+ }),
39
+ unlock: op({
40
+ description: `Unlock the conversation of ${what}. Replaces \`gh ${noun} unlock\`.`,
41
+ input: s.object({ repo: repoField, number: numberField }),
42
+ annotations: { ...writes, idempotent: true },
43
+ run: async ({ repo, number }) => {
44
+ const r = await gh.repo(repo);
45
+ await gh.rest("DELETE", `repos/${r.full}/issues/${number}/lock`);
46
+ return { repo: r.full, number, locked: false };
47
+ },
48
+ }),
49
+ };
50
+ };
@@ -0,0 +1,126 @@
1
+ // Listing discussions: the repository connection, or GitHub search when author, label or text filters are given.
2
+ import { op, s } from "../vendor/surface/index.ts";
3
+ import {
4
+ categoryField,
5
+ DISCUSSION,
6
+ discussionSummary,
7
+ lookup,
8
+ } from "./discussion-lookup.ts";
9
+ import { limitField, reads, repoField } from "./fields.ts";
10
+ import type { GitHub } from "./http.ts";
11
+ import { at, bool, nodes, optStr } from "./read.ts";
12
+
13
+ const LIST = `query($owner:String!,$name:String!,$first:Int!,$after:String,$states:[DiscussionState!],$categoryId:ID,$answered:Boolean,$orderBy:DiscussionOrder){
14
+ repository(owner:$owner,name:$name){discussions(first:$first,after:$after,states:$states,categoryId:$categoryId,answered:$answered,orderBy:$orderBy){
15
+ pageInfo{endCursor hasNextPage} nodes{${DISCUSSION}}}}}`;
16
+ const SEARCH = `query($q:String!,$first:Int!,$after:String){search(type:DISCUSSION,query:$q,first:$first,after:$after){
17
+ pageInfo{endCursor hasNextPage} nodes{... on Discussion{${DISCUSSION}}}}}`;
18
+
19
+ type Page = {
20
+ readonly items: readonly unknown[];
21
+ readonly next: string | null;
22
+ };
23
+
24
+ const pages = async (
25
+ limit: number,
26
+ after: string | undefined,
27
+ fetch: (first: number, after: string | null) => Promise<unknown>,
28
+ ) => {
29
+ const items: unknown[] = [];
30
+ let cursor = after ?? null;
31
+ let next: string | null = cursor;
32
+ do {
33
+ const conn = await fetch(Math.min(100, limit - items.length), cursor);
34
+ const page: Page = {
35
+ items: nodes(conn),
36
+ next: bool(conn, "pageInfo", "hasNextPage")
37
+ ? optStr(conn, "pageInfo", "endCursor")
38
+ : null,
39
+ };
40
+ items.push(...page.items);
41
+ next = page.next;
42
+ cursor = next;
43
+ } while (next !== null && items.length < limit);
44
+ return { items, endCursor: next };
45
+ };
46
+
47
+ const quote = (v: string) => `"${v.replaceAll('"', "")}"`;
48
+
49
+ export const discussionListOp = (gh: GitHub) =>
50
+ op({
51
+ description:
52
+ "Discussions in a repository, newest activity first, with the cursor for the next page in endCursor. Author, label and search filters go through GitHub search. Replaces `gh discussion list`.",
53
+ input: s.object({
54
+ repo: repoField,
55
+ state: s.optional(s.enum(["open", "closed", "all"])),
56
+ category: s.optional(categoryField),
57
+ author: s.optional(s.string()),
58
+ labels: s.optional(s.array(s.string())),
59
+ answered: s.optional(s.boolean()),
60
+ search: s.optional(s.string({ description: "Search query text." })),
61
+ sort: s.optional(s.enum(["created", "updated"])),
62
+ order: s.optional(s.enum(["asc", "desc"])),
63
+ limit: limitField(30),
64
+ after: s.optional(
65
+ s.string({ description: "endCursor of a previous page." }),
66
+ ),
67
+ }),
68
+ annotations: reads,
69
+ run: async (input) => {
70
+ const r = await gh.repo(input.repo);
71
+ const state = input.state ?? "open";
72
+ const sort = input.sort ?? "updated";
73
+ const order = input.order ?? "desc";
74
+ const category =
75
+ input.category === undefined
76
+ ? undefined
77
+ : (await lookup(gh, r, { category: input.category })).category;
78
+ const viaSearch =
79
+ input.author !== undefined ||
80
+ (input.labels?.length ?? 0) > 0 ||
81
+ input.search !== undefined;
82
+ const { items, endCursor } = await pages(
83
+ input.limit ?? 30,
84
+ input.after,
85
+ async (first, after) => {
86
+ if (!viaSearch)
87
+ return at(
88
+ await gh.graphql(LIST, {
89
+ owner: r.owner,
90
+ name: r.name,
91
+ first,
92
+ after,
93
+ states: state === "all" ? null : [state.toUpperCase()],
94
+ categoryId: category?.id ?? null,
95
+ answered: input.answered ?? null,
96
+ orderBy: {
97
+ field: sort === "created" ? "CREATED_AT" : "UPDATED_AT",
98
+ direction: order.toUpperCase(),
99
+ },
100
+ }),
101
+ "repository",
102
+ "discussions",
103
+ );
104
+ const q = [
105
+ `repo:${r.full}`,
106
+ state === "all" ? "" : `is:${state}`,
107
+ input.author === undefined ? "" : `author:${input.author}`,
108
+ ...(input.labels ?? []).map((l) => `label:${quote(l)}`),
109
+ category === undefined ? "" : `category:${quote(category.name)}`,
110
+ input.answered === undefined
111
+ ? ""
112
+ : input.answered
113
+ ? "is:answered"
114
+ : "is:unanswered",
115
+ `sort:${sort}-${order}`,
116
+ input.search ?? "",
117
+ ].filter(Boolean);
118
+ return at(
119
+ await gh.graphql(SEARCH, { q: q.join(" "), first, after }),
120
+ "search",
121
+ );
122
+ },
123
+ );
124
+ return { repo: r.full, items: items.map(discussionSummary), endCursor };
125
+ },
126
+ });