oh-my-opencode 5.1.83 → 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 (442) 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/cli-program.d.ts +3 -0
  8. package/dist/cli/index.js +1197 -1008
  9. package/dist/cli/service-auth/devices.d.ts +5 -2
  10. package/dist/cli-node/index.js +1197 -1008
  11. package/dist/config/schema/agent-names.d.ts +1 -0
  12. package/dist/index.js +194 -213
  13. package/dist/skills/browser/SKILL.md +100 -91
  14. package/dist/skills/browser/references/commands.md +92 -27
  15. package/dist/skills/browser/references/desktop.md +22 -0
  16. package/dist/skills/browser/references/install.md +18 -0
  17. package/dist/skills/browser/references/owned-engine/README.md +7 -2
  18. package/dist/skills/browser/references/owned-engine/frames-and-humans.md +9 -2
  19. package/dist/skills/browser/references/owned-engine/network.md +13 -7
  20. package/dist/skills/browser/references/recipes/1password.md +6 -2
  21. package/dist/skills/browser/runtime/omowright/index.js +15 -15
  22. package/dist/skills/browser/runtime/omowright/manifest.json +4 -4
  23. package/dist/skills/debugging/SKILL.md +1 -1
  24. package/dist/skills/debugging/references/tools/browser-qa.md +1 -1
  25. package/dist/skills/git/SKILL.md +62 -0
  26. package/dist/skills/git/agents/openai.yaml +13 -0
  27. package/dist/skills/github/SKILL.md +94 -0
  28. package/dist/skills/github/references/branch-rules.md +129 -0
  29. package/dist/skills/github/references/evidence-attachments.md +16 -0
  30. package/dist/skills/github/references/repo-setup.md +152 -0
  31. package/dist/skills/github/references/waiting.md +52 -0
  32. package/dist/skills/github/references/workflows.md +161 -0
  33. package/dist/skills/github/scripts/cli.ts +8 -0
  34. package/dist/skills/github/scripts/package.json +12 -0
  35. package/dist/skills/github/scripts/sdk.ts +11 -0
  36. package/dist/skills/github/scripts/src/account.ts +243 -0
  37. package/dist/skills/github/scripts/src/actions-write.ts +86 -0
  38. package/dist/skills/github/scripts/src/actions.ts +210 -0
  39. package/dist/skills/github/scripts/src/attestations.ts +136 -0
  40. package/dist/skills/github/scripts/src/blake2b.ts +102 -0
  41. package/dist/skills/github/scripts/src/branch-protection.ts +192 -0
  42. package/dist/skills/github/scripts/src/caches.ts +105 -0
  43. package/dist/skills/github/scripts/src/checks.ts +107 -0
  44. package/dist/skills/github/scripts/src/codespaces.ts +230 -0
  45. package/dist/skills/github/scripts/src/conversation-lock.ts +50 -0
  46. package/dist/skills/github/scripts/src/discussion-list.ts +126 -0
  47. package/dist/skills/github/scripts/src/discussion-lookup.ts +127 -0
  48. package/dist/skills/github/scripts/src/discussions.ts +234 -0
  49. package/dist/skills/github/scripts/src/env.ts +100 -0
  50. package/dist/skills/github/scripts/src/errors.ts +79 -0
  51. package/dist/skills/github/scripts/src/fields.ts +27 -0
  52. package/dist/skills/github/scripts/src/gist-shape.ts +58 -0
  53. package/dist/skills/github/scripts/src/gists-write.ts +130 -0
  54. package/dist/skills/github/scripts/src/gists.ts +118 -0
  55. package/dist/skills/github/scripts/src/git-auth.ts +46 -0
  56. package/dist/skills/github/scripts/src/http.ts +159 -0
  57. package/dist/skills/github/scripts/src/issue-develop.ts +118 -0
  58. package/dist/skills/github/scripts/src/issues-extra.ts +135 -0
  59. package/dist/skills/github/scripts/src/issues-write.ts +174 -0
  60. package/dist/skills/github/scripts/src/issues.ts +156 -0
  61. package/dist/skills/github/scripts/src/keys.ts +176 -0
  62. package/dist/skills/github/scripts/src/labels.ts +209 -0
  63. package/dist/skills/github/scripts/src/merge.ts +115 -0
  64. package/dist/skills/github/scripts/src/poly1305.ts +22 -0
  65. package/dist/skills/github/scripts/src/pr-checkout.ts +92 -0
  66. package/dist/skills/github/scripts/src/pr-view.ts +106 -0
  67. package/dist/skills/github/scripts/src/project-fields.ts +144 -0
  68. package/dist/skills/github/scripts/src/project-item-edit.ts +153 -0
  69. package/dist/skills/github/scripts/src/project-items.ts +191 -0
  70. package/dist/skills/github/scripts/src/project-links.ts +104 -0
  71. package/dist/skills/github/scripts/src/project-ref.ts +145 -0
  72. package/dist/skills/github/scripts/src/project-state.ts +99 -0
  73. package/dist/skills/github/scripts/src/projects.ts +158 -0
  74. package/dist/skills/github/scripts/src/pulls-extra.ts +165 -0
  75. package/dist/skills/github/scripts/src/pulls-read.ts +176 -0
  76. package/dist/skills/github/scripts/src/pulls-review.ts +206 -0
  77. package/dist/skills/github/scripts/src/pulls-write.ts +187 -0
  78. package/dist/skills/github/scripts/src/raw.ts +78 -0
  79. package/dist/skills/github/scripts/src/read.ts +77 -0
  80. package/dist/skills/github/scripts/src/release-assets.ts +111 -0
  81. package/dist/skills/github/scripts/src/release-download.ts +151 -0
  82. package/dist/skills/github/scripts/src/release-write.ts +197 -0
  83. package/dist/skills/github/scripts/src/repo-admin.ts +112 -0
  84. package/dist/skills/github/scripts/src/repo-content.ts +187 -0
  85. package/dist/skills/github/scripts/src/repo-create.ts +139 -0
  86. package/dist/skills/github/scripts/src/repo-extras.ts +217 -0
  87. package/dist/skills/github/scripts/src/repo-list.ts +143 -0
  88. package/dist/skills/github/scripts/src/repo-settings.ts +176 -0
  89. package/dist/skills/github/scripts/src/repo-sync.ts +81 -0
  90. package/dist/skills/github/scripts/src/repo-url.ts +104 -0
  91. package/dist/skills/github/scripts/src/repos.ts +87 -0
  92. package/dist/skills/github/scripts/src/ruleset-shape.ts +96 -0
  93. package/dist/skills/github/scripts/src/rulesets-write.ts +124 -0
  94. package/dist/skills/github/scripts/src/rulesets.ts +80 -0
  95. package/dist/skills/github/scripts/src/run-download.ts +88 -0
  96. package/dist/skills/github/scripts/src/salsa20.ts +97 -0
  97. package/dist/skills/github/scripts/src/scopes.ts +165 -0
  98. package/dist/skills/github/scripts/src/sealed-box.ts +75 -0
  99. package/dist/skills/github/scripts/src/search-commits.ts +114 -0
  100. package/dist/skills/github/scripts/src/search.ts +116 -0
  101. package/dist/skills/github/scripts/src/secrets.ts +131 -0
  102. package/dist/skills/github/scripts/src/snappy.ts +57 -0
  103. package/dist/skills/github/scripts/src/status-search.ts +55 -0
  104. package/dist/skills/github/scripts/src/transfer.ts +97 -0
  105. package/dist/skills/github/scripts/src/types.ts +75 -0
  106. package/dist/skills/github/scripts/src/variables.ts +86 -0
  107. package/dist/skills/github/scripts/src/wait.ts +164 -0
  108. package/dist/skills/github/scripts/src/wire.ts +159 -0
  109. package/dist/skills/github/scripts/src/workflows.ts +144 -0
  110. package/dist/skills/github/scripts/src/zip.ts +104 -0
  111. package/dist/skills/github/scripts/surface.ts +106 -0
  112. package/dist/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
  113. package/dist/skills/github/scripts/vendor/surface/cli.ts +203 -0
  114. package/dist/skills/github/scripts/vendor/surface/flags.ts +195 -0
  115. package/dist/skills/github/scripts/vendor/surface/help.ts +89 -0
  116. package/dist/skills/github/scripts/vendor/surface/http.ts +180 -0
  117. package/dist/skills/github/scripts/vendor/surface/index.ts +44 -0
  118. package/dist/skills/github/scripts/vendor/surface/mcp.ts +241 -0
  119. package/dist/skills/github/scripts/vendor/surface/schema.ts +200 -0
  120. package/dist/skills/github/scripts/vendor/surface/stdio.ts +54 -0
  121. package/dist/skills/github/scripts/vendor/surface/surface.ts +250 -0
  122. package/dist/skills/github/scripts/vendor/surface/tools.ts +80 -0
  123. package/dist/skills/programming/SKILL.md +51 -320
  124. package/dist/skills/programming/references/go/README.md +1 -0
  125. package/dist/skills/programming/references/python/README.md +21 -3
  126. package/dist/skills/programming/references/python/error-handling.md +14 -0
  127. package/dist/skills/programming/references/rust/README.md +5 -1
  128. package/dist/skills/programming/references/typescript/README.md +9 -3
  129. package/dist/skills/programming/references/typescript/error-handling.md +18 -0
  130. package/dist/skills/ultimate-browsing/SKILL.md +1 -1
  131. package/dist/skills/ulw-execute/SKILL.md +1 -1
  132. package/dist/skills/visual-qa/references/browser-setup.md +5 -5
  133. package/dist/tui.js +32 -29
  134. package/package.json +28 -26
  135. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  136. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +2 -2
  137. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  138. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  139. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  140. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  141. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  142. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  143. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  144. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  145. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
  146. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  147. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  148. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  149. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  150. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  151. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  152. package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +8711 -172
  153. package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +8660 -121
  154. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  155. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  156. package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +5 -0
  157. package/packages/omo-codex/plugin/components/telemetry/tsconfig.json +2 -2
  158. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  159. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  160. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
  161. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  162. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
  163. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  164. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +1 -1
  165. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +3 -3
  166. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  167. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  168. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  169. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  170. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  171. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  172. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  173. package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
  174. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  175. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  176. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  177. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  178. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  179. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  180. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  181. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  182. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  183. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  184. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  185. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  186. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  187. package/packages/omo-codex/plugin/package-lock.json +12 -12
  188. package/packages/omo-codex/plugin/package.json +1 -1
  189. package/packages/omo-codex/plugin/shared/src/config-loader.ts +15 -1
  190. package/packages/omo-codex/plugin/skills/browser/SKILL.md +100 -91
  191. package/packages/omo-codex/plugin/skills/browser/references/commands.md +92 -27
  192. package/packages/omo-codex/plugin/skills/browser/references/desktop.md +22 -0
  193. package/packages/omo-codex/plugin/skills/browser/references/install.md +18 -0
  194. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/README.md +7 -2
  195. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +9 -2
  196. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/network.md +13 -7
  197. package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +6 -2
  198. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +15 -15
  199. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +4 -4
  200. package/packages/omo-codex/plugin/skills/debugging/SKILL.md +1 -1
  201. package/packages/omo-codex/plugin/skills/debugging/references/tools/browser-qa.md +1 -1
  202. package/packages/omo-codex/plugin/skills/git/SKILL.md +62 -0
  203. package/packages/omo-codex/plugin/skills/git/agents/openai.yaml +13 -0
  204. package/packages/omo-codex/plugin/skills/github/SKILL.md +94 -0
  205. package/packages/omo-codex/plugin/skills/github/agents/openai.yaml +2 -0
  206. package/packages/omo-codex/plugin/skills/github/references/branch-rules.md +129 -0
  207. package/packages/omo-codex/plugin/skills/github/references/evidence-attachments.md +16 -0
  208. package/packages/omo-codex/plugin/skills/github/references/repo-setup.md +152 -0
  209. package/packages/omo-codex/plugin/skills/github/references/waiting.md +52 -0
  210. package/packages/omo-codex/plugin/skills/github/references/workflows.md +161 -0
  211. package/packages/omo-codex/plugin/skills/github/scripts/cli.ts +8 -0
  212. package/packages/omo-codex/plugin/skills/github/scripts/package.json +12 -0
  213. package/packages/omo-codex/plugin/skills/github/scripts/sdk.ts +11 -0
  214. package/packages/omo-codex/plugin/skills/github/scripts/src/account.ts +243 -0
  215. package/packages/omo-codex/plugin/skills/github/scripts/src/actions-write.ts +86 -0
  216. package/packages/omo-codex/plugin/skills/github/scripts/src/actions.ts +210 -0
  217. package/packages/omo-codex/plugin/skills/github/scripts/src/attestations.ts +136 -0
  218. package/packages/omo-codex/plugin/skills/github/scripts/src/blake2b.ts +102 -0
  219. package/packages/omo-codex/plugin/skills/github/scripts/src/branch-protection.ts +192 -0
  220. package/packages/omo-codex/plugin/skills/github/scripts/src/caches.ts +105 -0
  221. package/packages/omo-codex/plugin/skills/github/scripts/src/checks.ts +107 -0
  222. package/packages/omo-codex/plugin/skills/github/scripts/src/codespaces.ts +230 -0
  223. package/packages/omo-codex/plugin/skills/github/scripts/src/conversation-lock.ts +50 -0
  224. package/packages/omo-codex/plugin/skills/github/scripts/src/discussion-list.ts +126 -0
  225. package/packages/omo-codex/plugin/skills/github/scripts/src/discussion-lookup.ts +127 -0
  226. package/packages/omo-codex/plugin/skills/github/scripts/src/discussions.ts +234 -0
  227. package/packages/omo-codex/plugin/skills/github/scripts/src/env.ts +100 -0
  228. package/packages/omo-codex/plugin/skills/github/scripts/src/errors.ts +79 -0
  229. package/packages/omo-codex/plugin/skills/github/scripts/src/fields.ts +27 -0
  230. package/packages/omo-codex/plugin/skills/github/scripts/src/gist-shape.ts +58 -0
  231. package/packages/omo-codex/plugin/skills/github/scripts/src/gists-write.ts +130 -0
  232. package/packages/omo-codex/plugin/skills/github/scripts/src/gists.ts +118 -0
  233. package/packages/omo-codex/plugin/skills/github/scripts/src/git-auth.ts +46 -0
  234. package/packages/omo-codex/plugin/skills/github/scripts/src/http.ts +159 -0
  235. package/packages/omo-codex/plugin/skills/github/scripts/src/issue-develop.ts +118 -0
  236. package/packages/omo-codex/plugin/skills/github/scripts/src/issues-extra.ts +135 -0
  237. package/packages/omo-codex/plugin/skills/github/scripts/src/issues-write.ts +174 -0
  238. package/packages/omo-codex/plugin/skills/github/scripts/src/issues.ts +156 -0
  239. package/packages/omo-codex/plugin/skills/github/scripts/src/keys.ts +176 -0
  240. package/packages/omo-codex/plugin/skills/github/scripts/src/labels.ts +209 -0
  241. package/packages/omo-codex/plugin/skills/github/scripts/src/merge.ts +115 -0
  242. package/packages/omo-codex/plugin/skills/github/scripts/src/poly1305.ts +22 -0
  243. package/packages/omo-codex/plugin/skills/github/scripts/src/pr-checkout.ts +92 -0
  244. package/packages/omo-codex/plugin/skills/github/scripts/src/pr-view.ts +106 -0
  245. package/packages/omo-codex/plugin/skills/github/scripts/src/project-fields.ts +144 -0
  246. package/packages/omo-codex/plugin/skills/github/scripts/src/project-item-edit.ts +153 -0
  247. package/packages/omo-codex/plugin/skills/github/scripts/src/project-items.ts +191 -0
  248. package/packages/omo-codex/plugin/skills/github/scripts/src/project-links.ts +104 -0
  249. package/packages/omo-codex/plugin/skills/github/scripts/src/project-ref.ts +145 -0
  250. package/packages/omo-codex/plugin/skills/github/scripts/src/project-state.ts +99 -0
  251. package/packages/omo-codex/plugin/skills/github/scripts/src/projects.ts +158 -0
  252. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-extra.ts +165 -0
  253. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-read.ts +176 -0
  254. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-review.ts +206 -0
  255. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-write.ts +187 -0
  256. package/packages/omo-codex/plugin/skills/github/scripts/src/raw.ts +78 -0
  257. package/packages/omo-codex/plugin/skills/github/scripts/src/read.ts +77 -0
  258. package/packages/omo-codex/plugin/skills/github/scripts/src/release-assets.ts +111 -0
  259. package/packages/omo-codex/plugin/skills/github/scripts/src/release-download.ts +151 -0
  260. package/packages/omo-codex/plugin/skills/github/scripts/src/release-write.ts +197 -0
  261. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-admin.ts +112 -0
  262. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-content.ts +187 -0
  263. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-create.ts +139 -0
  264. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-extras.ts +217 -0
  265. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-list.ts +143 -0
  266. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-settings.ts +176 -0
  267. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-sync.ts +81 -0
  268. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-url.ts +104 -0
  269. package/packages/omo-codex/plugin/skills/github/scripts/src/repos.ts +87 -0
  270. package/packages/omo-codex/plugin/skills/github/scripts/src/ruleset-shape.ts +96 -0
  271. package/packages/omo-codex/plugin/skills/github/scripts/src/rulesets-write.ts +124 -0
  272. package/packages/omo-codex/plugin/skills/github/scripts/src/rulesets.ts +80 -0
  273. package/packages/omo-codex/plugin/skills/github/scripts/src/run-download.ts +88 -0
  274. package/packages/omo-codex/plugin/skills/github/scripts/src/salsa20.ts +97 -0
  275. package/packages/omo-codex/plugin/skills/github/scripts/src/scopes.ts +165 -0
  276. package/packages/omo-codex/plugin/skills/github/scripts/src/sealed-box.ts +75 -0
  277. package/packages/omo-codex/plugin/skills/github/scripts/src/search-commits.ts +114 -0
  278. package/packages/omo-codex/plugin/skills/github/scripts/src/search.ts +116 -0
  279. package/packages/omo-codex/plugin/skills/github/scripts/src/secrets.ts +131 -0
  280. package/packages/omo-codex/plugin/skills/github/scripts/src/snappy.ts +57 -0
  281. package/packages/omo-codex/plugin/skills/github/scripts/src/status-search.ts +55 -0
  282. package/packages/omo-codex/plugin/skills/github/scripts/src/transfer.ts +97 -0
  283. package/packages/omo-codex/plugin/skills/github/scripts/src/types.ts +75 -0
  284. package/packages/omo-codex/plugin/skills/github/scripts/src/variables.ts +86 -0
  285. package/packages/omo-codex/plugin/skills/github/scripts/src/wait.ts +164 -0
  286. package/packages/omo-codex/plugin/skills/github/scripts/src/wire.ts +159 -0
  287. package/packages/omo-codex/plugin/skills/github/scripts/src/workflows.ts +144 -0
  288. package/packages/omo-codex/plugin/skills/github/scripts/src/zip.ts +104 -0
  289. package/packages/omo-codex/plugin/skills/github/scripts/surface.ts +106 -0
  290. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
  291. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/cli.ts +203 -0
  292. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/flags.ts +195 -0
  293. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/help.ts +89 -0
  294. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/http.ts +180 -0
  295. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/index.ts +44 -0
  296. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/mcp.ts +241 -0
  297. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/schema.ts +200 -0
  298. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/stdio.ts +54 -0
  299. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/surface.ts +250 -0
  300. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/tools.ts +80 -0
  301. package/packages/omo-codex/plugin/skills/programming/SKILL.md +51 -320
  302. package/packages/omo-codex/plugin/skills/programming/references/go/README.md +1 -0
  303. package/packages/omo-codex/plugin/skills/programming/references/python/README.md +21 -3
  304. package/packages/omo-codex/plugin/skills/programming/references/python/error-handling.md +14 -0
  305. package/packages/omo-codex/plugin/skills/programming/references/rust/README.md +5 -1
  306. package/packages/omo-codex/plugin/skills/programming/references/typescript/README.md +9 -3
  307. package/packages/omo-codex/plugin/skills/programming/references/typescript/error-handling.md +18 -0
  308. package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +1 -1
  309. package/packages/omo-codex/plugin/skills/ulw-execute/SKILL.md +1 -1
  310. package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +1 -1
  311. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +3 -3
  312. package/packages/omo-codex/plugin/skills/visual-qa/references/browser-setup.md +5 -5
  313. package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +1 -1
  314. package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +2 -1
  315. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +5 -5
  316. package/packages/omo-codex/scripts/install-dist/install-local.mjs +21279 -20738
  317. package/packages/shared-skills/skills/browser/SKILL.md +100 -91
  318. package/packages/shared-skills/skills/browser/references/commands.md +92 -27
  319. package/packages/shared-skills/skills/browser/references/desktop.md +22 -0
  320. package/packages/shared-skills/skills/browser/references/install.md +18 -0
  321. package/packages/shared-skills/skills/browser/references/owned-engine/README.md +7 -2
  322. package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +9 -2
  323. package/packages/shared-skills/skills/browser/references/owned-engine/network.md +13 -7
  324. package/packages/shared-skills/skills/browser/references/recipes/1password.md +6 -2
  325. package/packages/shared-skills/skills/browser/runtime/omowright/index.js +15 -15
  326. package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +4 -4
  327. package/packages/shared-skills/skills/debugging/SKILL.md +1 -1
  328. package/packages/shared-skills/skills/debugging/references/tools/browser-qa.md +1 -1
  329. package/packages/shared-skills/skills/git/SKILL.md +62 -0
  330. package/packages/shared-skills/skills/git/agents/openai.yaml +13 -0
  331. package/packages/shared-skills/skills/github/SKILL.md +94 -0
  332. package/packages/shared-skills/skills/github/references/branch-rules.md +129 -0
  333. package/packages/shared-skills/skills/github/references/evidence-attachments.md +16 -0
  334. package/packages/shared-skills/skills/github/references/repo-setup.md +152 -0
  335. package/packages/shared-skills/skills/github/references/waiting.md +52 -0
  336. package/packages/shared-skills/skills/github/references/workflows.md +161 -0
  337. package/packages/shared-skills/skills/github/scripts/cli.ts +8 -0
  338. package/packages/shared-skills/skills/github/scripts/package.json +12 -0
  339. package/packages/shared-skills/skills/github/scripts/sdk.ts +11 -0
  340. package/packages/shared-skills/skills/github/scripts/src/account.ts +243 -0
  341. package/packages/shared-skills/skills/github/scripts/src/actions-write.ts +86 -0
  342. package/packages/shared-skills/skills/github/scripts/src/actions.ts +210 -0
  343. package/packages/shared-skills/skills/github/scripts/src/attestations.ts +136 -0
  344. package/packages/shared-skills/skills/github/scripts/src/blake2b.ts +102 -0
  345. package/packages/shared-skills/skills/github/scripts/src/branch-protection.ts +192 -0
  346. package/packages/shared-skills/skills/github/scripts/src/caches.ts +105 -0
  347. package/packages/shared-skills/skills/github/scripts/src/checks.ts +107 -0
  348. package/packages/shared-skills/skills/github/scripts/src/codespaces.ts +230 -0
  349. package/packages/shared-skills/skills/github/scripts/src/conversation-lock.ts +50 -0
  350. package/packages/shared-skills/skills/github/scripts/src/discussion-list.ts +126 -0
  351. package/packages/shared-skills/skills/github/scripts/src/discussion-lookup.ts +127 -0
  352. package/packages/shared-skills/skills/github/scripts/src/discussions.ts +234 -0
  353. package/packages/shared-skills/skills/github/scripts/src/env.ts +100 -0
  354. package/packages/shared-skills/skills/github/scripts/src/errors.ts +79 -0
  355. package/packages/shared-skills/skills/github/scripts/src/fields.ts +27 -0
  356. package/packages/shared-skills/skills/github/scripts/src/gist-shape.ts +58 -0
  357. package/packages/shared-skills/skills/github/scripts/src/gists-write.ts +130 -0
  358. package/packages/shared-skills/skills/github/scripts/src/gists.ts +118 -0
  359. package/packages/shared-skills/skills/github/scripts/src/git-auth.ts +46 -0
  360. package/packages/shared-skills/skills/github/scripts/src/http.ts +159 -0
  361. package/packages/shared-skills/skills/github/scripts/src/issue-develop.ts +118 -0
  362. package/packages/shared-skills/skills/github/scripts/src/issues-extra.ts +135 -0
  363. package/packages/shared-skills/skills/github/scripts/src/issues-write.ts +174 -0
  364. package/packages/shared-skills/skills/github/scripts/src/issues.ts +156 -0
  365. package/packages/shared-skills/skills/github/scripts/src/keys.ts +176 -0
  366. package/packages/shared-skills/skills/github/scripts/src/labels.ts +209 -0
  367. package/packages/shared-skills/skills/github/scripts/src/merge.ts +115 -0
  368. package/packages/shared-skills/skills/github/scripts/src/poly1305.ts +22 -0
  369. package/packages/shared-skills/skills/github/scripts/src/pr-checkout.ts +92 -0
  370. package/packages/shared-skills/skills/github/scripts/src/pr-view.ts +106 -0
  371. package/packages/shared-skills/skills/github/scripts/src/project-fields.ts +144 -0
  372. package/packages/shared-skills/skills/github/scripts/src/project-item-edit.ts +153 -0
  373. package/packages/shared-skills/skills/github/scripts/src/project-items.ts +191 -0
  374. package/packages/shared-skills/skills/github/scripts/src/project-links.ts +104 -0
  375. package/packages/shared-skills/skills/github/scripts/src/project-ref.ts +145 -0
  376. package/packages/shared-skills/skills/github/scripts/src/project-state.ts +99 -0
  377. package/packages/shared-skills/skills/github/scripts/src/projects.ts +158 -0
  378. package/packages/shared-skills/skills/github/scripts/src/pulls-extra.ts +165 -0
  379. package/packages/shared-skills/skills/github/scripts/src/pulls-read.ts +176 -0
  380. package/packages/shared-skills/skills/github/scripts/src/pulls-review.ts +206 -0
  381. package/packages/shared-skills/skills/github/scripts/src/pulls-write.ts +187 -0
  382. package/packages/shared-skills/skills/github/scripts/src/raw.ts +78 -0
  383. package/packages/shared-skills/skills/github/scripts/src/read.ts +77 -0
  384. package/packages/shared-skills/skills/github/scripts/src/release-assets.ts +111 -0
  385. package/packages/shared-skills/skills/github/scripts/src/release-download.ts +151 -0
  386. package/packages/shared-skills/skills/github/scripts/src/release-write.ts +197 -0
  387. package/packages/shared-skills/skills/github/scripts/src/repo-admin.ts +112 -0
  388. package/packages/shared-skills/skills/github/scripts/src/repo-content.ts +187 -0
  389. package/packages/shared-skills/skills/github/scripts/src/repo-create.ts +139 -0
  390. package/packages/shared-skills/skills/github/scripts/src/repo-extras.ts +217 -0
  391. package/packages/shared-skills/skills/github/scripts/src/repo-list.ts +143 -0
  392. package/packages/shared-skills/skills/github/scripts/src/repo-settings.ts +176 -0
  393. package/packages/shared-skills/skills/github/scripts/src/repo-sync.ts +81 -0
  394. package/packages/shared-skills/skills/github/scripts/src/repo-url.ts +104 -0
  395. package/packages/shared-skills/skills/github/scripts/src/repos.ts +87 -0
  396. package/packages/shared-skills/skills/github/scripts/src/ruleset-shape.ts +96 -0
  397. package/packages/shared-skills/skills/github/scripts/src/rulesets-write.ts +124 -0
  398. package/packages/shared-skills/skills/github/scripts/src/rulesets.ts +80 -0
  399. package/packages/shared-skills/skills/github/scripts/src/run-download.ts +88 -0
  400. package/packages/shared-skills/skills/github/scripts/src/salsa20.ts +97 -0
  401. package/packages/shared-skills/skills/github/scripts/src/scopes.ts +165 -0
  402. package/packages/shared-skills/skills/github/scripts/src/sealed-box.ts +75 -0
  403. package/packages/shared-skills/skills/github/scripts/src/search-commits.ts +114 -0
  404. package/packages/shared-skills/skills/github/scripts/src/search.ts +116 -0
  405. package/packages/shared-skills/skills/github/scripts/src/secrets.ts +131 -0
  406. package/packages/shared-skills/skills/github/scripts/src/snappy.ts +57 -0
  407. package/packages/shared-skills/skills/github/scripts/src/status-search.ts +55 -0
  408. package/packages/shared-skills/skills/github/scripts/src/transfer.ts +97 -0
  409. package/packages/shared-skills/skills/github/scripts/src/types.ts +75 -0
  410. package/packages/shared-skills/skills/github/scripts/src/variables.ts +86 -0
  411. package/packages/shared-skills/skills/github/scripts/src/wait.ts +164 -0
  412. package/packages/shared-skills/skills/github/scripts/src/wire.ts +159 -0
  413. package/packages/shared-skills/skills/github/scripts/src/workflows.ts +144 -0
  414. package/packages/shared-skills/skills/github/scripts/src/zip.ts +104 -0
  415. package/packages/shared-skills/skills/github/scripts/surface.ts +106 -0
  416. package/packages/shared-skills/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
  417. package/packages/shared-skills/skills/github/scripts/vendor/surface/cli.ts +203 -0
  418. package/packages/shared-skills/skills/github/scripts/vendor/surface/flags.ts +195 -0
  419. package/packages/shared-skills/skills/github/scripts/vendor/surface/help.ts +89 -0
  420. package/packages/shared-skills/skills/github/scripts/vendor/surface/http.ts +180 -0
  421. package/packages/shared-skills/skills/github/scripts/vendor/surface/index.ts +44 -0
  422. package/packages/shared-skills/skills/github/scripts/vendor/surface/mcp.ts +241 -0
  423. package/packages/shared-skills/skills/github/scripts/vendor/surface/schema.ts +200 -0
  424. package/packages/shared-skills/skills/github/scripts/vendor/surface/stdio.ts +54 -0
  425. package/packages/shared-skills/skills/github/scripts/vendor/surface/surface.ts +250 -0
  426. package/packages/shared-skills/skills/github/scripts/vendor/surface/tools.ts +80 -0
  427. package/packages/shared-skills/skills/programming/SKILL.md +51 -320
  428. package/packages/shared-skills/skills/programming/references/go/README.md +1 -0
  429. package/packages/shared-skills/skills/programming/references/python/README.md +21 -3
  430. package/packages/shared-skills/skills/programming/references/python/error-handling.md +14 -0
  431. package/packages/shared-skills/skills/programming/references/rust/README.md +5 -1
  432. package/packages/shared-skills/skills/programming/references/typescript/README.md +9 -3
  433. package/packages/shared-skills/skills/programming/references/typescript/error-handling.md +18 -0
  434. package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +1 -1
  435. package/packages/shared-skills/skills/ulw-execute/SKILL.md +1 -1
  436. package/packages/shared-skills/skills/visual-qa/references/browser-setup.md +5 -5
  437. package/dist/skills/git-master/SKILL.md +0 -114
  438. package/dist/skills/git-master/agents/openai.yaml +0 -13
  439. package/packages/omo-codex/plugin/skills/git-master/SKILL.md +0 -114
  440. package/packages/omo-codex/plugin/skills/git-master/agents/openai.yaml +0 -13
  441. package/packages/shared-skills/skills/git-master/SKILL.md +0 -114
  442. package/packages/shared-skills/skills/git-master/agents/openai.yaml +0 -13
@@ -0,0 +1,127 @@
1
+ // Discussion node ids, category and label ids resolved in one GraphQL round trip, and the shared summary shape.
2
+ import { s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import type { GitHub, Repo } from "./http.ts";
4
+ import { at, bool, names, nodes, num, optNum, optStr, str } from "./read.ts";
5
+
6
+ export const categoryField = s.string({
7
+ description: "Category name or slug.",
8
+ });
9
+
10
+ export const DISCUSSION = `id number title url closed stateReason isAnswered createdAt updatedAt
11
+ author{login} category{name slug} labels(first:20){nodes{name}} comments{totalCount}`;
12
+
13
+ export const discussionSummary = (d: unknown) => ({
14
+ id: str(d, "id"),
15
+ number: num(d, "number"),
16
+ title: str(d, "title"),
17
+ url: str(d, "url"),
18
+ author: optStr(d, "author", "login"),
19
+ category: optStr(d, "category", "name"),
20
+ closed: bool(d, "closed"),
21
+ stateReason: optStr(d, "stateReason"),
22
+ answered: bool(d, "isAnswered"),
23
+ labels: names(d, "name", "labels"),
24
+ comments: optNum(d, "comments", "totalCount") ?? 0,
25
+ createdAt: str(d, "createdAt"),
26
+ updatedAt: str(d, "updatedAt"),
27
+ });
28
+
29
+ export type Category = {
30
+ readonly id: string;
31
+ readonly name: string;
32
+ readonly slug: string;
33
+ };
34
+
35
+ type Want = {
36
+ readonly number?: number;
37
+ readonly category?: string;
38
+ readonly labels?: readonly string[];
39
+ };
40
+
41
+ export const lookup = async (gh: GitHub, r: Repo, want: Want) => {
42
+ const labels = want.labels ?? [];
43
+ const vars = labels.map((_, i) => `$l${i}:String!`).join("");
44
+ const query = `query($owner:String!,$name:String!,$number:Int!,$byNumber:Boolean!,$categories:Boolean!${vars}){
45
+ repository(owner:$owner,name:$name){id
46
+ discussion(number:$number) @include(if:$byNumber){id}
47
+ discussionCategories(first:100) @include(if:$categories){nodes{id name slug}}
48
+ ${labels.map((_, i) => `l${i}:label(name:$l${i}){id}`).join(" ")}}}`;
49
+ const data = await gh.graphql(query, {
50
+ owner: r.owner,
51
+ name: r.name,
52
+ number: want.number ?? 0,
53
+ byNumber: want.number !== undefined,
54
+ categories: want.category !== undefined,
55
+ ...Object.fromEntries(labels.map((l, i) => [`l${i}`, l])),
56
+ });
57
+ const repo = at(data, "repository");
58
+ const discussionId = optStr(repo, "discussion", "id");
59
+ if (want.number !== undefined && discussionId === null)
60
+ throw new SurfaceError(
61
+ "not_found",
62
+ `no discussion #${want.number} in ${r.full}`,
63
+ "check the number",
64
+ );
65
+ const labelIds = labels.map((label, i) => {
66
+ const id = optStr(repo, `l${i}`, "id");
67
+ if (id === null)
68
+ throw new SurfaceError(
69
+ "not_found",
70
+ `no label "${label}" in ${r.full}`,
71
+ "create it first or check the spelling",
72
+ );
73
+ return id;
74
+ });
75
+ return {
76
+ repoId: str(repo, "id"),
77
+ discussionId: discussionId ?? "",
78
+ category:
79
+ want.category === undefined
80
+ ? undefined
81
+ : pickCategory(r, want.category, categoryList(repo)),
82
+ labelIds,
83
+ };
84
+ };
85
+
86
+ const categoryList = (repo: unknown): Category[] =>
87
+ nodes(repo, "discussionCategories").map((c) => ({
88
+ id: str(c, "id"),
89
+ name: str(c, "name"),
90
+ slug: str(c, "slug"),
91
+ }));
92
+
93
+ export const pickCategory = (
94
+ r: Repo,
95
+ given: string,
96
+ all: readonly Category[],
97
+ ): Category => {
98
+ const want = given.toLowerCase();
99
+ const hit = all.find(
100
+ (c) => c.name.toLowerCase() === want || c.slug.toLowerCase() === want,
101
+ );
102
+ if (hit === undefined)
103
+ throw new SurfaceError(
104
+ "not_found",
105
+ `no discussion category "${given}" in ${r.full}`,
106
+ `use one of: ${all.map((c) => c.name).join(", ") || "(discussions may be disabled)"}`,
107
+ );
108
+ return hit;
109
+ };
110
+
111
+ export const setLabels = async (
112
+ gh: GitHub,
113
+ id: string,
114
+ add: readonly string[],
115
+ remove: readonly string[],
116
+ ) => {
117
+ if (add.length > 0)
118
+ await gh.graphql(
119
+ "mutation($id:ID!,$labels:[ID!]!){addLabelsToLabelable(input:{labelableId:$id,labelIds:$labels}){clientMutationId}}",
120
+ { id, labels: add },
121
+ );
122
+ if (remove.length > 0)
123
+ await gh.graphql(
124
+ "mutation($id:ID!,$labels:[ID!]!){removeLabelsFromLabelable(input:{labelableId:$id,labelIds:$labels}){clientMutationId}}",
125
+ { id, labels: remove },
126
+ );
127
+ };
@@ -0,0 +1,234 @@
1
+ // GitHub Discussions over GraphQL: view, create, edit and comment; list lives in discussion-list.ts.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { discussionListOp } from "./discussion-list.ts";
4
+ import {
5
+ categoryField,
6
+ DISCUSSION,
7
+ discussionSummary,
8
+ lookup,
9
+ setLabels,
10
+ } from "./discussion-lookup.ts";
11
+ import { reads, repoField, writes } from "./fields.ts";
12
+ import type { GitHub, Repo } from "./http.ts";
13
+ import { at, bool, nodes, num, optNum, optStr, str } from "./read.ts";
14
+
15
+ const numberField = s.integer({ description: "Discussion number." });
16
+
17
+ const VIEW = `query($owner:String!,$name:String!,$number:Int!,$comments:Int!){repository(owner:$owner,name:$name){discussion(number:$number){
18
+ ${DISCUSSION} body answer{id url} latest:comments(last:$comments){nodes{id databaseId url body createdAt isAnswer upvoteCount author{login} replies{totalCount}}}}}}`;
19
+ const SUMMARY = `query($owner:String!,$name:String!,$number:Int!){repository(owner:$owner,name:$name){discussion(number:$number){${DISCUSSION}}}}`;
20
+
21
+ const read = async (gh: GitHub, r: Repo, number: number) => {
22
+ const d = at(
23
+ await gh.graphql(SUMMARY, { owner: r.owner, name: r.name, number }),
24
+ "repository",
25
+ "discussion",
26
+ );
27
+ return { repo: r.full, ...discussionSummary(d) };
28
+ };
29
+
30
+ export const discussionOps = (gh: GitHub) => ({
31
+ list: discussionListOp(gh),
32
+ view: op({
33
+ description:
34
+ "One discussion with its body, answer and optionally its latest N top-level comments (each with its reply count). Replaces `gh discussion view`.",
35
+ input: s.object({
36
+ repo: repoField,
37
+ number: numberField,
38
+ comments: s.optional(
39
+ s.integer({
40
+ description:
41
+ "Latest top-level comments to include (default 0, max 100).",
42
+ }),
43
+ ),
44
+ }),
45
+ annotations: reads,
46
+ run: async ({ repo, number, comments }) => {
47
+ const r = await gh.repo(repo);
48
+ const d = at(
49
+ await gh.graphql(VIEW, {
50
+ owner: r.owner,
51
+ name: r.name,
52
+ number,
53
+ comments: Math.min(comments ?? 0, 100),
54
+ }),
55
+ "repository",
56
+ "discussion",
57
+ );
58
+ if (d === null || d === undefined)
59
+ throw new SurfaceError(
60
+ "not_found",
61
+ `no discussion #${number} in ${r.full}`,
62
+ "check the number",
63
+ );
64
+ return {
65
+ repo: r.full,
66
+ ...discussionSummary(d),
67
+ body: optStr(d, "body") ?? "",
68
+ answer: optStr(d, "answer", "url"),
69
+ latestComments: nodes(d, "latest").map((c) => ({
70
+ id: str(c, "id"),
71
+ databaseId: optNum(c, "databaseId"),
72
+ author: optStr(c, "author", "login"),
73
+ createdAt: str(c, "createdAt"),
74
+ isAnswer: bool(c, "isAnswer"),
75
+ upvotes: optNum(c, "upvoteCount") ?? 0,
76
+ replies: optNum(c, "replies", "totalCount") ?? 0,
77
+ url: str(c, "url"),
78
+ body: str(c, "body"),
79
+ })),
80
+ };
81
+ },
82
+ }),
83
+ create: op({
84
+ description:
85
+ "Open a discussion in a category (name or slug), optionally labelled. Replaces `gh discussion create`.",
86
+ input: s.object({
87
+ repo: repoField,
88
+ title: s.string(),
89
+ body: s.optional(s.string()),
90
+ category: categoryField,
91
+ labels: s.optional(s.array(s.string())),
92
+ }),
93
+ annotations: writes,
94
+ run: async ({ repo, title, body, category, labels }) => {
95
+ const r = await gh.repo(repo);
96
+ const ids = await lookup(gh, r, { category, labels: labels ?? [] });
97
+ const d = at(
98
+ await gh.graphql(
99
+ "mutation($input:CreateDiscussionInput!){createDiscussion(input:$input){discussion{id number url}}}",
100
+ {
101
+ input: {
102
+ repositoryId: ids.repoId,
103
+ categoryId: ids.category?.id ?? "",
104
+ title,
105
+ body: body ?? "",
106
+ },
107
+ },
108
+ ),
109
+ "createDiscussion",
110
+ "discussion",
111
+ );
112
+ await setLabels(gh, str(d, "id"), ids.labelIds, []);
113
+ return {
114
+ repo: r.full,
115
+ id: str(d, "id"),
116
+ number: num(d, "number"),
117
+ url: str(d, "url"),
118
+ labels: labels ?? [],
119
+ };
120
+ },
121
+ }),
122
+ edit: op({
123
+ description:
124
+ "Change a discussion's title, body or category, and add or remove labels. Returns the discussion as it stands afterwards. Replaces `gh discussion edit`.",
125
+ input: s.object({
126
+ repo: repoField,
127
+ number: numberField,
128
+ title: s.optional(s.string()),
129
+ body: s.optional(s.string()),
130
+ category: s.optional(categoryField),
131
+ addLabels: s.optional(s.array(s.string())),
132
+ removeLabels: s.optional(s.array(s.string())),
133
+ }),
134
+ annotations: writes,
135
+ run: async (input) => {
136
+ const add = input.addLabels ?? [];
137
+ const remove = input.removeLabels ?? [];
138
+ const update = { title: input.title, body: input.body };
139
+ if (
140
+ Object.values(update).every((v) => v === undefined) &&
141
+ input.category === undefined &&
142
+ add.length + remove.length === 0
143
+ )
144
+ throw new SurfaceError(
145
+ "usage",
146
+ "nothing to change",
147
+ "pass title, body, category, addLabels or removeLabels",
148
+ );
149
+ const r = await gh.repo(input.repo);
150
+ const ids = await lookup(gh, r, {
151
+ number: input.number,
152
+ ...(input.category === undefined ? {} : { category: input.category }),
153
+ labels: [...add, ...remove],
154
+ });
155
+ const fields = Object.fromEntries(
156
+ Object.entries({ ...update, categoryId: ids.category?.id }).filter(
157
+ ([, v]) => v !== undefined,
158
+ ),
159
+ );
160
+ if (Object.keys(fields).length > 0)
161
+ await gh.graphql(
162
+ "mutation($input:UpdateDiscussionInput!){updateDiscussion(input:$input){discussion{id}}}",
163
+ { input: { discussionId: ids.discussionId, ...fields } },
164
+ );
165
+ await setLabels(
166
+ gh,
167
+ ids.discussionId,
168
+ ids.labelIds.slice(0, add.length),
169
+ ids.labelIds.slice(add.length),
170
+ );
171
+ return read(gh, r, input.number);
172
+ },
173
+ }),
174
+ comment: op({
175
+ description:
176
+ "Comment on a discussion, reply in a comment's thread (replyTo), or replace an existing comment's body (editId). Replaces `gh discussion comment`.",
177
+ input: s.object({
178
+ repo: repoField,
179
+ number: s.optional(numberField),
180
+ body: s.string(),
181
+ replyTo: s.optional(
182
+ s.string({
183
+ description: "Node id of the top-level comment to reply under.",
184
+ }),
185
+ ),
186
+ editId: s.optional(
187
+ s.string({ description: "Node id of an existing comment to replace." }),
188
+ ),
189
+ }),
190
+ annotations: writes,
191
+ run: async ({ repo, number, body, replyTo, editId }) => {
192
+ if (editId !== undefined) {
193
+ if (replyTo !== undefined)
194
+ throw new SurfaceError(
195
+ "usage",
196
+ "pass replyTo or editId, not both",
197
+ "editId replaces a comment; replyTo adds one",
198
+ );
199
+ const c = at(
200
+ await gh.graphql(
201
+ "mutation($input:UpdateDiscussionCommentInput!){updateDiscussionComment(input:$input){comment{id url}}}",
202
+ { input: { commentId: editId, body } },
203
+ ),
204
+ "updateDiscussionComment",
205
+ "comment",
206
+ );
207
+ return { id: str(c, "id"), url: str(c, "url") };
208
+ }
209
+ if (number === undefined)
210
+ throw new SurfaceError(
211
+ "usage",
212
+ "pass the discussion number",
213
+ "number is optional only together with editId",
214
+ );
215
+ const r = await gh.repo(repo);
216
+ const { discussionId } = await lookup(gh, r, { number });
217
+ const c = at(
218
+ await gh.graphql(
219
+ "mutation($input:AddDiscussionCommentInput!){addDiscussionComment(input:$input){comment{id url}}}",
220
+ {
221
+ input: {
222
+ discussionId,
223
+ body,
224
+ ...(replyTo === undefined ? {} : { replyToId: replyTo }),
225
+ },
226
+ },
227
+ ),
228
+ "addDiscussionComment",
229
+ "comment",
230
+ );
231
+ return { repo: r.full, id: str(c, "id"), url: str(c, "url") };
232
+ },
233
+ }),
234
+ });
@@ -0,0 +1,100 @@
1
+ // Where the transport's inputs come from by default: the token (GH_TOKEN, GITHUB_TOKEN, else the gh login read once
2
+ // in-process) and the repo (the git origin of the working directory).
3
+ import { SurfaceError } from "../vendor/surface/index.ts";
4
+ import { gitChildEnv } from "./git-auth.ts";
5
+ import type { Deps, GitResult, Repo } from "./http.ts";
6
+
7
+ const spawnText = async (
8
+ cmd: readonly string[],
9
+ env: Readonly<Record<string, string | undefined>> = process.env,
10
+ ): Promise<string | undefined> => {
11
+ try {
12
+ const proc = Bun.spawn([...cmd], {
13
+ env,
14
+ stdout: "pipe",
15
+ stderr: "ignore",
16
+ stdin: "ignore",
17
+ });
18
+ const [out, code] = await Promise.all([
19
+ new Response(proc.stdout).text(),
20
+ proc.exited,
21
+ ]);
22
+ return code === 0 ? out.trim() : undefined;
23
+ } catch {
24
+ return undefined;
25
+ }
26
+ };
27
+
28
+ const runGit = async (
29
+ args: readonly string[],
30
+ cwd: string,
31
+ env: Readonly<Record<string, string>>,
32
+ ): Promise<GitResult> => {
33
+ try {
34
+ const proc = Bun.spawn(["git", ...args], {
35
+ cwd,
36
+ env,
37
+ stdout: "pipe",
38
+ stderr: "pipe",
39
+ stdin: "ignore",
40
+ });
41
+ const [stdout, stderr, code] = await Promise.all([
42
+ new Response(proc.stdout).text(),
43
+ new Response(proc.stderr).text(),
44
+ proc.exited,
45
+ ]);
46
+ return { code, stdout, stderr };
47
+ } catch (error) {
48
+ return {
49
+ code: 127,
50
+ stdout: "",
51
+ stderr: error instanceof Error ? error.message : String(error),
52
+ };
53
+ }
54
+ };
55
+
56
+ export const defaultToken = (): (() => Promise<string>) => {
57
+ let cached: Promise<string> | undefined;
58
+ return () =>
59
+ (cached ??= (async () => {
60
+ const env = process.env["GH_TOKEN"] ?? process.env["GITHUB_TOKEN"];
61
+ if (env) return env;
62
+ const fromGh = await spawnText([
63
+ "gh",
64
+ "auth",
65
+ "token",
66
+ "--hostname",
67
+ "github.com",
68
+ ]);
69
+ if (fromGh) return fromGh;
70
+ throw new SurfaceError(
71
+ "auth",
72
+ "no GitHub token",
73
+ "set GH_TOKEN, or log in once with `gh auth login`",
74
+ );
75
+ })());
76
+ };
77
+
78
+ export const parseRepo = (text: string): Repo | undefined => {
79
+ const m =
80
+ /^(?:https?:\/\/github\.com\/|git@github\.com:|ssh:\/\/git@github\.com\/)?([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/.exec(
81
+ text.trim(),
82
+ );
83
+ if (!m?.[1] || !m[2]) return undefined;
84
+ return { owner: m[1], name: m[2], full: `${m[1]}/${m[2]}` };
85
+ };
86
+
87
+ export const defaultDeps = (): Deps => ({
88
+ fetch: (url, init) => fetch(url, init),
89
+ git: runGit,
90
+ env: () => process.env,
91
+ token: defaultToken(),
92
+ originRepo: () =>
93
+ spawnText(
94
+ ["git", "remote", "get-url", "origin"],
95
+ gitChildEnv(process.env, {}),
96
+ ),
97
+ sleep: (ms) => Bun.sleep(ms),
98
+ now: () => Date.now(),
99
+ apiUrl: "https://api.github.com/",
100
+ });
@@ -0,0 +1,79 @@
1
+ // How a failed GitHub response is classified: rate limits (primary and secondary) and the error kind and message.
2
+ import { at, optStr } from "./read.ts";
3
+
4
+ export const rateLimit = (
5
+ res: Response,
6
+ now: number,
7
+ ): { readonly waitMs: number; readonly when: string } | undefined => {
8
+ const limited =
9
+ res.status === 429 ||
10
+ (res.status === 403 &&
11
+ (res.headers.get("x-ratelimit-remaining") === "0" ||
12
+ res.headers.has("retry-after")));
13
+ if (!limited) return undefined;
14
+ const after = Number(res.headers.get("retry-after") ?? "NaN");
15
+ const reset = Number(res.headers.get("x-ratelimit-reset") ?? "NaN") * 1000;
16
+ const waitMs = Number.isFinite(after)
17
+ ? after * 1000
18
+ : Number.isFinite(reset)
19
+ ? reset - now
20
+ : 60_000;
21
+ const when = Number.isFinite(reset)
22
+ ? new Date(reset).toISOString()
23
+ : `in ${Math.ceil(waitMs / 1000)} s`;
24
+ return { waitMs, when };
25
+ };
26
+
27
+ export const errorMessage = (text: string): string => {
28
+ try {
29
+ const body: unknown = JSON.parse(text);
30
+ const errors = at(body, "errors");
31
+ const detail = Array.isArray(errors)
32
+ ? errors
33
+ .map((e) =>
34
+ typeof e === "string"
35
+ ? e
36
+ : (optStr(e, "message") ?? optStr(e, "code") ?? ""),
37
+ )
38
+ .filter(Boolean)
39
+ .join("; ")
40
+ : "";
41
+ return [optStr(body, "message") ?? "", detail].filter(Boolean).join(": ");
42
+ } catch {
43
+ return text.slice(0, 300);
44
+ }
45
+ };
46
+
47
+ export const kindFor = (status: number, message: string): [string, string] => {
48
+ if (status === 401)
49
+ return [
50
+ "auth",
51
+ "the token is invalid or expired; refresh GH_TOKEN or `gh auth login`",
52
+ ];
53
+ if (status === 404)
54
+ return [
55
+ "not_found",
56
+ "check owner/name and number; a private repo also answers 404 without access",
57
+ ];
58
+ if (status === 403)
59
+ return [
60
+ "forbidden",
61
+ message.includes("Upgrade to GitHub")
62
+ ? "the account's plan does not offer this on a private repository; no token change fixes it"
63
+ : "the token lacks a scope or the repo blocks this action",
64
+ ];
65
+ if (status === 405 || status === 409)
66
+ return [
67
+ "conflict",
68
+ "the target state forbids this (not mergeable, head moved, or already done)",
69
+ ];
70
+ if (status === 422)
71
+ return [
72
+ "invalid",
73
+ message.includes("already exists")
74
+ ? "it already exists"
75
+ : "fix the fields named in the message",
76
+ ];
77
+ if (status >= 500) return ["server", "GitHub failed; retry later"];
78
+ return ["http", "see the message"];
79
+ };
@@ -0,0 +1,27 @@
1
+ import { s, type Annotations } from "../vendor/surface/index.ts";
2
+
3
+ export const repoField = s.optional(
4
+ s.string({
5
+ description:
6
+ "owner/name (a github.com URL works too). Defaults to the git origin of the current directory.",
7
+ }),
8
+ );
9
+ export const numberField = s.integer({
10
+ description: "Pull request or issue number.",
11
+ });
12
+ export const limitField = (fallback: number) =>
13
+ s.optional(
14
+ s.integer({
15
+ description: `Maximum items to return (default ${fallback}).`,
16
+ }),
17
+ );
18
+
19
+ export const reads: Annotations = {
20
+ readOnly: true,
21
+ idempotent: true,
22
+ openWorld: true,
23
+ };
24
+ export const writes: Annotations = { destructive: false, openWorld: true };
25
+ export const irreversible: Annotations = { destructive: true, openWorld: true };
26
+
27
+ export const enc = encodeURIComponent;
@@ -0,0 +1,58 @@
1
+ // How a gist is addressed (id or URL) and how GitHub's gist JSON is trimmed for results.
2
+ import { basename } from "node:path";
3
+ import { s, SurfaceError } from "../vendor/surface/index.ts";
4
+ import { at, bool, isObj, obj, optStr, str } from "./read.ts";
5
+
6
+ export const gistField = s.string({
7
+ description: "Gist id or its gist.github.com URL.",
8
+ });
9
+
10
+ export const gistId = (given: string): string => {
11
+ const last = given
12
+ .trim()
13
+ .replace(/[?#].*$/, "")
14
+ .replace(/\/+$/, "")
15
+ .split("/")
16
+ .pop();
17
+ const id = last?.replace(/\.git$/, "") ?? "";
18
+ if (!/^[\da-f]+$/i.test(id))
19
+ throw new SurfaceError(
20
+ "usage",
21
+ `not a gist id or URL: ${given}`,
22
+ "pass the id from `gist list` or a https://gist.github.com/<user>/<id> URL",
23
+ );
24
+ return id;
25
+ };
26
+
27
+ export const fileList = (g: unknown) =>
28
+ Object.values(obj(at(g, "files"), "files")).flatMap((f) =>
29
+ isObj(f) ? [f] : [],
30
+ );
31
+
32
+ export const gistSummary = (g: unknown) => ({
33
+ id: str(g, "id"),
34
+ description: optStr(g, "description"),
35
+ public: bool(g, "public"),
36
+ url: str(g, "html_url"),
37
+ updatedAt: optStr(g, "updated_at"),
38
+ });
39
+
40
+ export const gistWritten = (g: unknown) => ({
41
+ ...gistSummary(g),
42
+ files: fileList(g).map((f) => str(f, "filename")),
43
+ });
44
+
45
+ export const readPaths = async (paths: readonly string[]) =>
46
+ Object.fromEntries(
47
+ await Promise.all(
48
+ paths.map(async (p) => [
49
+ basename(p),
50
+ { content: await Bun.file(p).text() },
51
+ ]),
52
+ ),
53
+ );
54
+
55
+ export const contentsOf = (files: Readonly<Record<string, string>>) =>
56
+ Object.fromEntries(
57
+ Object.entries(files).map(([name, content]) => [name, { content }]),
58
+ );