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,135 @@
1
+ // Issue operations beyond create/edit/close: delete, locks, pins, transfer, linked branches and status.
2
+ import { op, s } from "../vendor/surface/index.ts";
3
+ import { lockOps } from "./conversation-lock.ts";
4
+ import {
5
+ irreversible,
6
+ limitField,
7
+ numberField,
8
+ reads,
9
+ repoField,
10
+ writes,
11
+ } from "./fields.ts";
12
+ import type { GitHub } from "./http.ts";
13
+ import { developOp } from "./issue-develop.ts";
14
+ import { at, bool, names, num, optStr, str } from "./read.ts";
15
+ import { byNumber, statusSearch } from "./status-search.ts";
16
+
17
+ const issueNodeId = async (gh: GitHub, full: string, number: number) =>
18
+ str(await gh.rest("GET", `repos/${full}/issues/${number}`), "node_id");
19
+
20
+ const statusIssue = (i: unknown) => ({
21
+ number: num(i, "number"),
22
+ title: str(i, "title"),
23
+ url: str(i, "url"),
24
+ state: str(i, "state"),
25
+ author: optStr(i, "author", "login"),
26
+ updatedAt: str(i, "updatedAt"),
27
+ labels: names(i, "name", "labels"),
28
+ });
29
+
30
+ const pinOp = (gh: GitHub, pin: boolean) => {
31
+ const mutation = pin ? "pinIssue" : "unpinIssue";
32
+ return op({
33
+ description: pin
34
+ ? "Pin an issue to the top of the repo's issue list (at most three are pinned). Replaces `gh issue pin`."
35
+ : "Unpin an issue. Replaces `gh issue unpin`.",
36
+ input: s.object({ repo: repoField, number: numberField }),
37
+ annotations: { ...writes, idempotent: true },
38
+ run: async ({ repo, number }) => {
39
+ const r = await gh.repo(repo);
40
+ const id = await issueNodeId(gh, r.full, number);
41
+ const data = await gh.graphql(
42
+ `mutation($id:ID!){${mutation}(input:{issueId:$id}){issue{isPinned}}}`,
43
+ { id },
44
+ );
45
+ return {
46
+ repo: r.full,
47
+ number,
48
+ pinned: bool(data, mutation, "issue", "isPinned"),
49
+ };
50
+ },
51
+ });
52
+ };
53
+
54
+ export const issueExtraOps = (gh: GitHub) => ({
55
+ delete: op({
56
+ description:
57
+ "Delete an issue permanently; needs admin rights and cannot be undone. Replaces `gh issue delete`.",
58
+ input: s.object({ repo: repoField, number: numberField }),
59
+ annotations: irreversible,
60
+ run: async ({ repo, number }) => {
61
+ const r = await gh.repo(repo);
62
+ const id = await issueNodeId(gh, r.full, number);
63
+ await gh.graphql(
64
+ "mutation($id:ID!){deleteIssue(input:{issueId:$id}){clientMutationId}}",
65
+ { id },
66
+ );
67
+ return { repo: r.full, number, deleted: true };
68
+ },
69
+ }),
70
+ ...lockOps(gh, "issue"),
71
+ pin: pinOp(gh, true),
72
+ unpin: pinOp(gh, false),
73
+ transfer: op({
74
+ description:
75
+ "Move an issue to another repository; it gets a new number there and the old url redirects. Returns the new repo, number and url. Replaces `gh issue transfer`.",
76
+ input: s.object({
77
+ repo: repoField,
78
+ number: numberField,
79
+ destination: s.string({ description: "owner/name to move it to." }),
80
+ createLabelsIfMissing: s.optional(
81
+ s.boolean({
82
+ description: "Create the issue's labels in the destination.",
83
+ }),
84
+ ),
85
+ }),
86
+ annotations: writes,
87
+ run: async ({ repo, number, destination, createLabelsIfMissing }) => {
88
+ const r = await gh.repo(repo);
89
+ const dest = await gh.repo(destination);
90
+ const [issueId, repositoryId] = await Promise.all([
91
+ issueNodeId(gh, r.full, number),
92
+ gh.rest("GET", `repos/${dest.full}`).then((d) => str(d, "node_id")),
93
+ ]);
94
+ const data = await gh.graphql(
95
+ `mutation($issue:ID!,$repo:ID!,$labels:Boolean){transferIssue(input:{issueId:$issue,repositoryId:$repo,createLabelsIfMissing:$labels}){issue{number url repository{nameWithOwner}}}}`,
96
+ {
97
+ issue: issueId,
98
+ repo: repositoryId,
99
+ ...(createLabelsIfMissing === undefined
100
+ ? {}
101
+ : { labels: createLabelsIfMissing }),
102
+ },
103
+ );
104
+ const moved = at(data, "transferIssue", "issue");
105
+ return {
106
+ from: r.full,
107
+ repo: str(moved, "repository", "nameWithOwner"),
108
+ number: num(moved, "number"),
109
+ url: str(moved, "url"),
110
+ };
111
+ },
112
+ }),
113
+ develop: developOp(gh),
114
+ status: op({
115
+ description:
116
+ "Open issues in the repo assigned to, mentioning or opened by the authenticated user, each with the reasons it matched. Replaces `gh issue status`.",
117
+ input: s.object({ repo: repoField, limit: limitField(30) }),
118
+ annotations: reads,
119
+ run: async ({ repo, limit }) => {
120
+ const r = await gh.repo(repo);
121
+ const scope = `repo:${r.full} is:issue is:open`;
122
+ const { user, hits } = await statusSearch(gh, {
123
+ groups: {
124
+ assigned: `${scope} assignee:@me`,
125
+ mentioned: `${scope} mentions:@me`,
126
+ opened: `${scope} author:@me`,
127
+ },
128
+ select:
129
+ "... on Issue{number title url state updatedAt author{login} labels(first:20){nodes{name}}}",
130
+ limit: limit ?? 30,
131
+ });
132
+ return { repo: r.full, user, items: byNumber(hits, statusIssue) };
133
+ },
134
+ }),
135
+ });
@@ -0,0 +1,174 @@
1
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
2
+ import { enc, numberField, repoField, writes } from "./fields.ts";
3
+ import type { GitHub } from "./http.ts";
4
+ import { issueFromRest, labelNames } from "./issues.ts";
5
+ import { num, str } from "./read.ts";
6
+
7
+ export const editLabels = async (
8
+ gh: GitHub,
9
+ full: string,
10
+ number: number,
11
+ add: readonly string[],
12
+ remove: readonly string[],
13
+ ): Promise<string[] | undefined> => {
14
+ let current: string[] | undefined;
15
+ if (add.length > 0)
16
+ current = labelNames(
17
+ await gh.rest("POST", `repos/${full}/issues/${number}/labels`, {
18
+ body: { labels: add },
19
+ }),
20
+ );
21
+ for (const name of remove) {
22
+ try {
23
+ current = labelNames(
24
+ await gh.rest(
25
+ "DELETE",
26
+ `repos/${full}/issues/${number}/labels/${enc(name)}`,
27
+ ),
28
+ );
29
+ } catch (error) {
30
+ if (!(error instanceof SurfaceError && error.kind === "not_found"))
31
+ throw error;
32
+ }
33
+ }
34
+ return current;
35
+ };
36
+
37
+ export const commentOp = (gh: GitHub, description: string) =>
38
+ op({
39
+ description,
40
+ input: s.object({
41
+ repo: repoField,
42
+ number: numberField,
43
+ body: s.string(),
44
+ editId: s.optional(
45
+ s.integer({
46
+ description: "Existing comment id to replace instead of adding.",
47
+ }),
48
+ ),
49
+ }),
50
+ annotations: writes,
51
+ run: async ({ repo, number, body, editId }) => {
52
+ const r = await gh.repo(repo);
53
+ const c =
54
+ editId === undefined
55
+ ? await gh.rest("POST", `repos/${r.full}/issues/${number}/comments`, {
56
+ body: { body },
57
+ })
58
+ : await gh.rest(
59
+ "PATCH",
60
+ `repos/${r.full}/issues/comments/${editId}`,
61
+ { body: { body } },
62
+ );
63
+ return { id: num(c, "id"), url: str(c, "html_url") };
64
+ },
65
+ });
66
+
67
+ export const issueWriteOps = (gh: GitHub) => ({
68
+ create: op({
69
+ description: "Open an issue. Replaces `gh issue create`.",
70
+ input: s.object({
71
+ repo: repoField,
72
+ title: s.string(),
73
+ body: s.optional(s.string()),
74
+ labels: s.optional(s.array(s.string())),
75
+ assignees: s.optional(s.array(s.string())),
76
+ }),
77
+ annotations: writes,
78
+ run: async ({ repo, title, body, labels, assignees }) => {
79
+ const r = await gh.repo(repo);
80
+ const i = await gh.rest("POST", `repos/${r.full}/issues`, {
81
+ body: {
82
+ title,
83
+ body: body ?? "",
84
+ labels: labels ?? [],
85
+ assignees: assignees ?? [],
86
+ },
87
+ });
88
+ return {
89
+ repo: r.full,
90
+ number: num(i, "number"),
91
+ url: str(i, "html_url"),
92
+ };
93
+ },
94
+ }),
95
+ edit: op({
96
+ description:
97
+ "Change an issue's title, body or state; add or remove labels and assignees. Replaces `gh issue edit` / `gh issue reopen`.",
98
+ input: s.object({
99
+ repo: repoField,
100
+ number: numberField,
101
+ title: s.optional(s.string()),
102
+ body: s.optional(s.string()),
103
+ state: s.optional(s.enum(["open", "closed"])),
104
+ addLabels: s.optional(s.array(s.string())),
105
+ removeLabels: s.optional(s.array(s.string())),
106
+ addAssignees: s.optional(s.array(s.string())),
107
+ removeAssignees: s.optional(s.array(s.string())),
108
+ }),
109
+ annotations: writes,
110
+ run: async ({
111
+ repo,
112
+ number,
113
+ title,
114
+ body,
115
+ state,
116
+ addLabels,
117
+ removeLabels,
118
+ addAssignees,
119
+ removeAssignees,
120
+ }) => {
121
+ const r = await gh.repo(repo);
122
+ const patch = Object.fromEntries(
123
+ Object.entries({ title, body, state }).filter(
124
+ ([, v]) => v !== undefined,
125
+ ),
126
+ );
127
+ if (Object.keys(patch).length > 0)
128
+ await gh.rest("PATCH", `repos/${r.full}/issues/${number}`, {
129
+ body: patch,
130
+ });
131
+ await editLabels(gh, r.full, number, addLabels ?? [], removeLabels ?? []);
132
+ if (addAssignees?.length)
133
+ await gh.rest("POST", `repos/${r.full}/issues/${number}/assignees`, {
134
+ body: { assignees: addAssignees },
135
+ });
136
+ if (removeAssignees?.length)
137
+ await gh.rest("DELETE", `repos/${r.full}/issues/${number}/assignees`, {
138
+ body: { assignees: removeAssignees },
139
+ });
140
+ return {
141
+ repo: r.full,
142
+ ...issueFromRest(
143
+ await gh.rest("GET", `repos/${r.full}/issues/${number}`),
144
+ ),
145
+ };
146
+ },
147
+ }),
148
+ comment: commentOp(
149
+ gh,
150
+ "Comment on an issue (or PR conversation), or edit an existing comment by id. Replaces `gh issue comment [--edit-last]`.",
151
+ ),
152
+ close: op({
153
+ description:
154
+ "Close an issue as completed or not_planned, optionally commenting first (e.g. naming the merged PR and SHA). Replaces `gh issue close --comment`.",
155
+ input: s.object({
156
+ repo: repoField,
157
+ number: numberField,
158
+ reason: s.optional(s.enum(["completed", "not_planned"])),
159
+ comment: s.optional(s.string()),
160
+ }),
161
+ annotations: writes,
162
+ run: async ({ repo, number, reason, comment }) => {
163
+ const r = await gh.repo(repo);
164
+ if (comment !== undefined)
165
+ await gh.rest("POST", `repos/${r.full}/issues/${number}/comments`, {
166
+ body: { body: comment },
167
+ });
168
+ const i = await gh.rest("PATCH", `repos/${r.full}/issues/${number}`, {
169
+ body: { state: "closed", state_reason: reason ?? "completed" },
170
+ });
171
+ return { repo: r.full, ...issueFromRest(i) };
172
+ },
173
+ }),
174
+ });
@@ -0,0 +1,156 @@
1
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
2
+ import { limitField, numberField, reads, repoField } from "./fields.ts";
3
+ import type { GitHub } from "./http.ts";
4
+ import { arr, at, names, nodes, num, optNum, optStr, str } from "./read.ts";
5
+ import { searchRaw } from "./search.ts";
6
+
7
+ const VIEW = `query($owner:String!,$name:String!,$number:Int!,$comments:Int!){repository(owner:$owner,name:$name){issue(number:$number){
8
+ id number title url state stateReason body createdAt updatedAt closedAt author{login} milestone{title}
9
+ labels(first:50){nodes{name}} assignees(first:20){nodes{login}}
10
+ comments(last:$comments){totalCount nodes{databaseId author{login} body createdAt url}}}}}`;
11
+
12
+ export const labelNames = (x: unknown): string[] =>
13
+ arr(x, "labels").map((l) => str(l, "name"));
14
+
15
+ export const issueFromRest = (i: unknown) => ({
16
+ number: num(i, "number"),
17
+ title: str(i, "title"),
18
+ state: str(i, "state"),
19
+ stateReason: optStr(i, "state_reason"),
20
+ labels: labelNames(at(i, "labels")),
21
+ author: optStr(i, "user", "login"),
22
+ comments: optNum(i, "comments") ?? 0,
23
+ url: str(i, "html_url"),
24
+ createdAt: optStr(i, "created_at"),
25
+ updatedAt: optStr(i, "updated_at"),
26
+ });
27
+
28
+ export const issueReadOps = (gh: GitHub) => ({
29
+ view: op({
30
+ description:
31
+ "One issue with labels, assignees, milestone, state reason, body and optionally its last N comments (with ids for editing). Replaces `gh issue view --comments`.",
32
+ input: s.object({
33
+ repo: repoField,
34
+ number: numberField,
35
+ comments: s.optional(
36
+ s.integer({
37
+ description: "Latest comments to include (default 0, max 100).",
38
+ }),
39
+ ),
40
+ body: s.optional(
41
+ s.boolean({ description: "Include the issue body (default true)." }),
42
+ ),
43
+ }),
44
+ annotations: reads,
45
+ run: async ({ repo, number, comments, body }) => {
46
+ const r = await gh.repo(repo);
47
+ const data = await gh.graphql(VIEW, {
48
+ owner: r.owner,
49
+ name: r.name,
50
+ number,
51
+ comments: Math.min(comments ?? 0, 100),
52
+ });
53
+ const i = at(data, "repository", "issue");
54
+ if (i === null || i === undefined)
55
+ throw new SurfaceError(
56
+ "not_found",
57
+ `no issue #${number} in ${r.full}`,
58
+ "a PR number is read with `pr view`",
59
+ );
60
+ return {
61
+ repo: r.full,
62
+ id: str(i, "id"),
63
+ number: num(i, "number"),
64
+ title: str(i, "title"),
65
+ url: str(i, "url"),
66
+ state: str(i, "state"),
67
+ stateReason: optStr(i, "stateReason"),
68
+ author: optStr(i, "author", "login"),
69
+ createdAt: str(i, "createdAt"),
70
+ updatedAt: str(i, "updatedAt"),
71
+ closedAt: optStr(i, "closedAt"),
72
+ milestone: optStr(i, "milestone", "title"),
73
+ labels: names(i, "name", "labels"),
74
+ assignees: names(i, "login", "assignees"),
75
+ ...(body === false ? {} : { body: optStr(i, "body") ?? "" }),
76
+ commentCount: optNum(i, "comments", "totalCount") ?? 0,
77
+ comments: nodes(i, "comments").map((c) => ({
78
+ id: optNum(c, "databaseId"),
79
+ author: optStr(c, "author", "login"),
80
+ at: str(c, "createdAt"),
81
+ url: str(c, "url"),
82
+ body: str(c, "body"),
83
+ })),
84
+ };
85
+ },
86
+ }),
87
+ list: op({
88
+ description:
89
+ "List issues (pull requests excluded). `search` switches to GitHub search syntax for anything the filters cannot say. Replaces `gh issue list`.",
90
+ input: s.object({
91
+ repo: repoField,
92
+ state: s.optional(s.enum(["open", "closed", "all"])),
93
+ labels: s.optional(
94
+ s.array(s.string(), { description: "All of these labels." }),
95
+ ),
96
+ assignee: s.optional(s.string()),
97
+ author: s.optional(s.string()),
98
+ since: s.optional(
99
+ s.string({ description: "ISO time; only issues updated after it." }),
100
+ ),
101
+ search: s.optional(s.string()),
102
+ limit: limitField(30),
103
+ }),
104
+ annotations: reads,
105
+ run: async ({
106
+ repo,
107
+ state,
108
+ labels,
109
+ assignee,
110
+ author,
111
+ since,
112
+ search,
113
+ limit,
114
+ }) => {
115
+ const r = await gh.repo(repo);
116
+ const max = limit ?? 30;
117
+ if (search !== undefined) {
118
+ const q = [
119
+ `repo:${r.full}`,
120
+ "is:issue",
121
+ state === "all" ? "" : `is:${state ?? "open"}`,
122
+ search,
123
+ ]
124
+ .filter(Boolean)
125
+ .join(" ");
126
+ return {
127
+ repo: r.full,
128
+ items: (await searchRaw(gh, q, max)).raw.map(issueFromRest),
129
+ };
130
+ }
131
+ const items: ReturnType<typeof issueFromRest>[] = [];
132
+ const query = {
133
+ state: state ?? "open",
134
+ labels: labels?.join(","),
135
+ assignee,
136
+ creator: author,
137
+ since,
138
+ sort: "updated",
139
+ };
140
+ for (let fetchLimit = max; items.length < max; fetchLimit *= 2) {
141
+ const raw = await gh.list(`repos/${r.full}/issues`, fetchLimit, {
142
+ query,
143
+ });
144
+ items.splice(
145
+ 0,
146
+ items.length,
147
+ ...raw
148
+ .filter((i) => at(i, "pull_request") === undefined)
149
+ .map(issueFromRest),
150
+ );
151
+ if (raw.length < fetchLimit) break;
152
+ }
153
+ return { repo: r.full, items: items.slice(0, max) };
154
+ },
155
+ }),
156
+ });
@@ -0,0 +1,176 @@
1
+ // The signed-in user's SSH keys (authentication and signing) and GPG keys: list, add and delete.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { irreversible, reads, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { arr, at, bool, num, optStr, str } from "./read.ts";
6
+
7
+ const SSH_PATH = {
8
+ authentication: "user/keys",
9
+ signing: "user/ssh_signing_keys",
10
+ } as const;
11
+ const SSH_SCOPE = {
12
+ authentication: "public_key",
13
+ signing: "ssh_signing_key",
14
+ } as const;
15
+
16
+ // Without the key scope GitHub answers these account endpoints with 404, not 403.
17
+ const scoped = async <T>(scope: string, run: () => Promise<T>): Promise<T> => {
18
+ try {
19
+ return await run();
20
+ } catch (error) {
21
+ if (
22
+ error instanceof SurfaceError &&
23
+ (error.kind === "not_found" || error.kind === "forbidden")
24
+ )
25
+ throw new SurfaceError(
26
+ "forbidden",
27
+ error.message,
28
+ `the token needs the \`${scope}\` scope (\`gh auth refresh -s ${scope}\`); for a delete, also check the id`,
29
+ );
30
+ throw error;
31
+ }
32
+ };
33
+ const sshType = s.enum(["authentication", "signing"], {
34
+ description: "Key kind (default authentication).",
35
+ });
36
+ const keyId = s.integer({ description: "Key id from `list`." });
37
+
38
+ const keyText = async (
39
+ text: string | undefined,
40
+ file: string | undefined,
41
+ what: string,
42
+ ): Promise<string> => {
43
+ if ((text === undefined) === (file === undefined))
44
+ throw new SurfaceError(
45
+ "usage",
46
+ `pass exactly one of key and file`,
47
+ `give the ${what} as key, or a path to it as file`,
48
+ );
49
+ if (text !== undefined) return text.trim();
50
+ const source = Bun.file(file ?? "");
51
+ if (!(await source.exists()))
52
+ throw new SurfaceError("usage", `no such file: ${file}`, "check the path");
53
+ return (await source.text()).trim();
54
+ };
55
+
56
+ const sshKey = (x: unknown, type: keyof typeof SSH_PATH) => ({
57
+ id: num(x, "id"),
58
+ type,
59
+ title: optStr(x, "title"),
60
+ key: str(x, "key"),
61
+ createdAt: optStr(x, "created_at"),
62
+ });
63
+
64
+ const gpgKey = (x: unknown) => ({
65
+ id: num(x, "id"),
66
+ keyId: str(x, "key_id"),
67
+ name: optStr(x, "name"),
68
+ emails: arr(at(x, "emails") ?? [], "emails").map((e) => ({
69
+ email: str(e, "email"),
70
+ verified: bool(e, "verified"),
71
+ })),
72
+ canSign: bool(x, "can_sign"),
73
+ createdAt: optStr(x, "created_at"),
74
+ expiresAt: optStr(x, "expires_at"),
75
+ });
76
+
77
+ const keyInput = (what: string) => ({
78
+ key: s.optional(s.string({ description: `The ${what} text.` })),
79
+ file: s.optional(s.string({ description: `Path of the ${what} file.` })),
80
+ title: s.optional(s.string()),
81
+ });
82
+
83
+ export const sshKeyOps = (gh: GitHub) => ({
84
+ list: op({
85
+ description:
86
+ "Your SSH keys of both kinds, each with a `type` of authentication or signing. Replaces `gh ssh-key list`.",
87
+ input: s.object({}),
88
+ annotations: reads,
89
+ run: async () => {
90
+ const kinds = ["authentication", "signing"] as const;
91
+ const lists = await Promise.all(
92
+ kinds.map(async (type) =>
93
+ (
94
+ await scoped(`read:${SSH_SCOPE[type]}`, () =>
95
+ gh.list(SSH_PATH[type], 1000),
96
+ )
97
+ ).map((x) => sshKey(x, type)),
98
+ ),
99
+ );
100
+ return { items: lists.flat() };
101
+ },
102
+ }),
103
+ add: op({
104
+ description:
105
+ "Add a public SSH key to your account for authentication or commit signing. Replaces `gh ssh-key add`.",
106
+ input: s.object({ ...keyInput("public key"), type: s.optional(sshType) }),
107
+ annotations: writes,
108
+ run: async ({ key, file, title, type }) => {
109
+ const kind = type ?? "authentication";
110
+ const text = await keyText(key, file, "public key");
111
+ const k = await scoped(`admin:${SSH_SCOPE[kind]}`, () =>
112
+ gh.rest("POST", SSH_PATH[kind], {
113
+ body: { key: text, ...(title === undefined ? {} : { title }) },
114
+ }),
115
+ );
116
+ return sshKey(k, kind);
117
+ },
118
+ }),
119
+ delete: op({
120
+ description:
121
+ "Delete an SSH key by id; pass type signing for a signing key, since the two kinds have separate ids. Replaces `gh ssh-key delete`.",
122
+ input: s.object({ id: keyId, type: s.optional(sshType) }),
123
+ annotations: irreversible,
124
+ run: async ({ id, type }) => {
125
+ const kind = type ?? "authentication";
126
+ await scoped(`admin:${SSH_SCOPE[kind]}`, () =>
127
+ gh.rest("DELETE", `${SSH_PATH[kind]}/${id}`),
128
+ );
129
+ return { id, type: kind, deleted: true };
130
+ },
131
+ }),
132
+ });
133
+
134
+ export const gpgKeyOps = (gh: GitHub) => ({
135
+ list: op({
136
+ description:
137
+ "Your GPG keys with their key ids, emails and expiry. Replaces `gh gpg-key list`.",
138
+ input: s.object({}),
139
+ annotations: reads,
140
+ run: async () => ({
141
+ items: (
142
+ await scoped("read:gpg_key", () => gh.list("user/gpg_keys", 1000))
143
+ ).map(gpgKey),
144
+ }),
145
+ }),
146
+ add: op({
147
+ description:
148
+ "Add an ASCII-armored public GPG key to your account. Replaces `gh gpg-key add`.",
149
+ input: s.object(keyInput("armored public key")),
150
+ annotations: writes,
151
+ run: async ({ key, file, title }) => {
152
+ const text = await keyText(key, file, "armored public key");
153
+ const k = await scoped("admin:gpg_key", () =>
154
+ gh.rest("POST", "user/gpg_keys", {
155
+ body: {
156
+ armored_public_key: text,
157
+ ...(title === undefined ? {} : { name: title }),
158
+ },
159
+ }),
160
+ );
161
+ return gpgKey(k);
162
+ },
163
+ }),
164
+ delete: op({
165
+ description:
166
+ "Delete a GPG key by its numeric id. Replaces `gh gpg-key delete`.",
167
+ input: s.object({ id: keyId }),
168
+ annotations: irreversible,
169
+ run: async ({ id }) => {
170
+ await scoped("admin:gpg_key", () =>
171
+ gh.rest("DELETE", `user/gpg_keys/${id}`),
172
+ );
173
+ return { id, deleted: true };
174
+ },
175
+ }),
176
+ });