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,57 @@
1
+ // Snappy block-format decompression (github.com/google/snappy format_description.txt), for attestation bundles
2
+ // GitHub serves from bundle_url as application/x-snappy. No runtime dependency, so it is decoded here.
3
+ import { SurfaceError } from "../vendor/surface/index.ts";
4
+
5
+ const corrupt = (why: string) =>
6
+ new SurfaceError(
7
+ "invalid_response",
8
+ `snappy data is corrupt: ${why}`,
9
+ "retry; the blob may be truncated",
10
+ );
11
+
12
+ export const unsnappy = (src: Uint8Array): Uint8Array => {
13
+ let pos = 0;
14
+ const byte = (): number => {
15
+ const b = src[pos++];
16
+ if (b === undefined) throw corrupt("unexpected end");
17
+ return b;
18
+ };
19
+ const littleEndian = (n: number): number => {
20
+ let v = 0;
21
+ for (let i = 0; i < n; i++) v += byte() * 2 ** (8 * i);
22
+ return v;
23
+ };
24
+ let size = 0;
25
+ for (let shift = 0; ; shift += 7) {
26
+ const b = byte();
27
+ size += (b & 0x7f) * 2 ** shift;
28
+ if (b < 0x80) break;
29
+ }
30
+ const out = new Uint8Array(size);
31
+ let at = 0;
32
+ while (pos < src.length) {
33
+ const tag = byte();
34
+ const kind = tag & 3;
35
+ if (kind === 0) {
36
+ const short = tag >> 2;
37
+ const length = (short < 60 ? short : littleEndian(short - 59)) + 1;
38
+ if (pos + length > src.length || at + length > size)
39
+ throw corrupt("literal overruns");
40
+ out.set(src.subarray(pos, pos + length), at);
41
+ pos += length;
42
+ at += length;
43
+ continue;
44
+ }
45
+ const length = kind === 1 ? ((tag >> 2) & 7) + 4 : (tag >> 2) + 1;
46
+ const offset =
47
+ kind === 1
48
+ ? ((tag >> 5) << 8) | byte()
49
+ : littleEndian(kind === 2 ? 2 : 4);
50
+ if (offset === 0 || offset > at || at + length > size)
51
+ throw corrupt("copy out of range");
52
+ // A copy may overlap its own output (offset < length), so it must go byte by byte.
53
+ for (let i = 0; i < length; i++, at++) out[at] = out[at - offset] ?? 0;
54
+ }
55
+ if (at !== size) throw corrupt("length mismatch");
56
+ return out;
57
+ };
@@ -0,0 +1,55 @@
1
+ // The `status` views: several @me searches in one GraphQL call, merged by number with the reasons each item matched.
2
+ import type { GitHub } from "./http.ts";
3
+ import { at, nodes, str, type Json } from "./read.ts";
4
+
5
+ export type Hit = { readonly reason: string; readonly node: unknown };
6
+
7
+ export type StatusQuery = {
8
+ /** Search alias (the reason reported on each item) -> GitHub search query. */
9
+ readonly groups: Readonly<Record<string, string>>;
10
+ readonly select: string;
11
+ readonly limit: number;
12
+ readonly declare?: string;
13
+ readonly extra?: string;
14
+ readonly fragments?: string;
15
+ readonly variables?: Json;
16
+ };
17
+
18
+ export const statusSearch = async (gh: GitHub, q: StatusQuery) => {
19
+ const groups = Object.entries(q.groups);
20
+ const vars = groups.map((_, i) => `,$q${i}:String!`).join("");
21
+ const searches = groups
22
+ .map(
23
+ ([reason], i) =>
24
+ `${reason}:search(query:$q${i},type:ISSUE,first:$limit){nodes{${q.select}}}`,
25
+ )
26
+ .join(" ");
27
+ const data = await gh.graphql(
28
+ `query($limit:Int!${vars}${q.declare ?? ""}){viewer{login} ${searches} ${q.extra ?? ""}} ${q.fragments ?? ""}`,
29
+ {
30
+ ...q.variables,
31
+ limit: Math.min(Math.max(q.limit, 1), 100),
32
+ ...Object.fromEntries(groups.map(([, query], i) => [`q${i}`, query])),
33
+ },
34
+ );
35
+ const hits: Hit[] = groups.flatMap(([reason]) =>
36
+ nodes(data, reason).map((node) => ({ reason, node })),
37
+ );
38
+ return { data, user: str(data, "viewer", "login"), hits };
39
+ };
40
+
41
+ export const byNumber = <T extends { readonly number: number }>(
42
+ hits: readonly Hit[],
43
+ parse: (node: unknown) => T,
44
+ ) => {
45
+ const seen = new Map<number, { item: T; reasons: string[] }>();
46
+ for (const { reason, node } of hits) {
47
+ // A search node of another type comes back as an empty object.
48
+ if (typeof at(node, "number") !== "number") continue;
49
+ const item = parse(node);
50
+ const prior = seen.get(item.number);
51
+ if (prior === undefined) seen.set(item.number, { item, reasons: [reason] });
52
+ else prior.reasons.push(reason);
53
+ }
54
+ return [...seen.values()].map(({ item, reasons }) => ({ ...item, reasons }));
55
+ };
@@ -0,0 +1,97 @@
1
+ // Downloads and uploads: bodies that are not JSON and hosts that are not the API.
2
+ import { SurfaceError } from "../vendor/surface/index.ts";
3
+ import type { Deps, GitHub } from "./types.ts";
4
+ import { UPLOAD_ORIGIN, type Wire } from "./wire.ts";
5
+
6
+ export const createTransfer = (
7
+ deps: Deps,
8
+ wire: Wire,
9
+ ): Pick<GitHub, "logs" | "bytes" | "content" | "upload"> => {
10
+ // GitHub answers a download with a redirect to blob storage; that second request must not carry the token.
11
+ const follow = async (
12
+ path: string,
13
+ accept: string | undefined,
14
+ what: string,
15
+ expiry: string,
16
+ ): Promise<Response> => {
17
+ const target = wire.url(path, undefined);
18
+ const res = await wire.send(
19
+ "GET",
20
+ target,
21
+ accept === undefined ? {} : { accept },
22
+ );
23
+ if (res.status >= 300 && res.status < 400) {
24
+ const location = res.headers.get("location");
25
+ if (!location)
26
+ throw new SurfaceError(
27
+ "invalid_response",
28
+ `${what} redirect had no location`,
29
+ "retry",
30
+ );
31
+ const blob = await deps.fetch(location, { method: "GET" });
32
+ if (!blob.ok)
33
+ throw new SurfaceError(
34
+ blob.status === 404 || blob.status === 410 ? "not_found" : "http",
35
+ `${what} download ${blob.status}`,
36
+ expiry,
37
+ );
38
+ return blob;
39
+ }
40
+ if (!res.ok) return wire.fail("GET", target, res);
41
+ return res;
42
+ };
43
+
44
+ return {
45
+ logs: async (path) =>
46
+ (
47
+ await follow(
48
+ path,
49
+ undefined,
50
+ "log",
51
+ "logs expire after the retention window",
52
+ )
53
+ ).text(),
54
+ bytes: async (path, accept) =>
55
+ new Uint8Array(
56
+ await (
57
+ await follow(
58
+ path,
59
+ accept,
60
+ "file",
61
+ "it was deleted or expired (artifacts expire after the retention window)",
62
+ )
63
+ ).arrayBuffer(),
64
+ ),
65
+ content: async (from) => {
66
+ const target = new URL(from);
67
+ if (target.protocol !== "https:")
68
+ throw new SurfaceError(
69
+ "usage",
70
+ `not an https URL: ${target.origin}`,
71
+ "pass the URL GitHub returned (raw_url, bundle_url)",
72
+ );
73
+ const res = await deps.fetch(target.href, { method: "GET" });
74
+ if (!res.ok)
75
+ throw new SurfaceError(
76
+ res.status === 404 || res.status === 410 ? "not_found" : "http",
77
+ `content download ${res.status}`,
78
+ "read the resource again for a fresh URL; signed URLs expire",
79
+ );
80
+ return new Uint8Array(await res.arrayBuffer());
81
+ },
82
+ upload: async (to, body, contentType) => {
83
+ const target = new URL(to);
84
+ if (target.origin !== UPLOAD_ORIGIN)
85
+ throw new SurfaceError(
86
+ "usage",
87
+ `not a GitHub upload URL: ${target.origin}`,
88
+ "pass the upload_url GitHub returned for the release",
89
+ );
90
+ const res = await wire.send("POST", target, {
91
+ raw: { bytes: body, contentType },
92
+ });
93
+ if (!res.ok) return wire.fail("POST", target, res);
94
+ return wire.decode(res);
95
+ },
96
+ };
97
+ };
@@ -0,0 +1,75 @@
1
+ import type { Json } from "./read.ts";
2
+
3
+ export type Fetch = (url: string, init: RequestInit) => Promise<Response>;
4
+ export type Method = "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
5
+ export type GitResult = {
6
+ readonly code: number;
7
+ readonly stdout: string;
8
+ readonly stderr: string;
9
+ };
10
+ export type Deps = {
11
+ readonly fetch: Fetch;
12
+ /** Runs git with exactly `env` as its environment. */
13
+ readonly git: (
14
+ args: readonly string[],
15
+ cwd: string,
16
+ env: Readonly<Record<string, string>>,
17
+ ) => Promise<GitResult>;
18
+ /** The environment child processes start from. */
19
+ readonly env: () => Readonly<Record<string, string | undefined>>;
20
+ readonly token: () => Promise<string>;
21
+ readonly originRepo: () => Promise<string | undefined>;
22
+ readonly sleep: (ms: number) => Promise<void>;
23
+ readonly now: () => number;
24
+ readonly apiUrl: string;
25
+ };
26
+ export type Repo = {
27
+ readonly owner: string;
28
+ readonly name: string;
29
+ readonly full: string;
30
+ };
31
+ export type Request = {
32
+ readonly query?: Readonly<
33
+ Record<string, string | number | boolean | undefined>
34
+ >;
35
+ readonly body?: unknown;
36
+ readonly accept?: string;
37
+ readonly raw?: {
38
+ readonly bytes: Uint8Array;
39
+ readonly contentType: string;
40
+ };
41
+ };
42
+ export type GitHub = {
43
+ readonly rest: (
44
+ method: Method,
45
+ path: string,
46
+ req?: Request,
47
+ ) => Promise<unknown>;
48
+ readonly list: (
49
+ path: string,
50
+ limit: number,
51
+ req?: Request & { readonly key?: string },
52
+ ) => Promise<unknown[]>;
53
+ readonly text: (path: string, accept: string) => Promise<string>;
54
+ readonly logs: (path: string) => Promise<string>;
55
+ /** A binary download (release asset, artifact zip, raw file); a redirect is followed without the token. */
56
+ readonly bytes: (path: string, accept?: string) => Promise<Uint8Array>;
57
+ /** GET an https URL GitHub returned in a response (`raw_url`, `bundle_url`); the token is never sent there. */
58
+ readonly content: (url: string) => Promise<Uint8Array>;
59
+ /** POST raw bytes to an `upload_url` GitHub returned (uploads.github.com only). */
60
+ readonly upload: (
61
+ url: string,
62
+ body: Uint8Array,
63
+ contentType: string,
64
+ ) => Promise<unknown>;
65
+ /** Response headers of a GET, for facts GitHub reports only there (token scopes). */
66
+ readonly headers: (path: string) => Promise<Headers>;
67
+ /** Run git in `cwd` and return stdout; `clone` and `fetch` authenticate to github.com with this SDK's token; no git child inherits GH_TOKEN or GITHUB_TOKEN. A non-zero exit fails as kind `git`. */
68
+ readonly git: (args: readonly string[], cwd: string) => Promise<string>;
69
+ readonly graphql: (query: string, variables: Json) => Promise<Json>;
70
+ readonly repo: (given: string | undefined) => Promise<Repo>;
71
+ /** The text with the token removed. */
72
+ readonly redact: (text: string) => Promise<string>;
73
+ readonly now: () => number;
74
+ readonly sleep: (ms: number) => Promise<void>;
75
+ };
@@ -0,0 +1,86 @@
1
+ // GitHub Actions variables at repository, environment and organization scope: list, get, set (create or update) and delete.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { enc, irreversible, reads, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { optStr, str } from "./read.ts";
6
+ import {
7
+ accessBody,
8
+ accessFields,
9
+ resolveScope,
10
+ scopeFields,
11
+ } from "./scopes.ts";
12
+
13
+ const variable = (x: unknown) => ({
14
+ name: str(x, "name"),
15
+ value: str(x, "value"),
16
+ createdAt: optStr(x, "created_at"),
17
+ updatedAt: optStr(x, "updated_at"),
18
+ visibility: optStr(x, "visibility"),
19
+ });
20
+
21
+ export const variableOps = (gh: GitHub) => {
22
+ const scopeOf = (w: Parameters<typeof resolveScope>[1]) =>
23
+ resolveScope(gh, w, "actions", "variables");
24
+ return {
25
+ list: op({
26
+ description:
27
+ "Variables with their values, and visibility at org scope. Replaces `gh variable list`.",
28
+ input: s.object(scopeFields),
29
+ annotations: reads,
30
+ run: async (input) => {
31
+ const scope = await scopeOf(input);
32
+ const raw = await gh.list(scope.base, 1000, { key: "variables" });
33
+ return { ...scope.fields, items: raw.map(variable) };
34
+ },
35
+ }),
36
+ get: op({
37
+ description: "One variable with its value. Replaces `gh variable get`.",
38
+ input: s.object({ name: s.string(), ...scopeFields }),
39
+ annotations: reads,
40
+ run: async ({ name, ...rest }) => {
41
+ const scope = await scopeOf(rest);
42
+ const v = await gh.rest("GET", `${scope.base}/${enc(name)}`);
43
+ return { ...scope.fields, ...variable(v) };
44
+ },
45
+ }),
46
+ set: op({
47
+ description:
48
+ "Create a variable, or update it when it already exists; `created` says which. Replaces `gh variable set`.",
49
+ input: s.object({
50
+ name: s.string(),
51
+ value: s.string(),
52
+ ...scopeFields,
53
+ ...accessFields,
54
+ }),
55
+ annotations: writes,
56
+ run: async ({ name, value, visibility, repos, ...rest }) => {
57
+ const scope = await scopeOf(rest);
58
+ const body = {
59
+ name,
60
+ value,
61
+ ...(await accessBody(gh, scope, visibility, repos)),
62
+ };
63
+ let created = false;
64
+ try {
65
+ await gh.rest("PATCH", `${scope.base}/${enc(name)}`, { body });
66
+ } catch (error) {
67
+ if (!(error instanceof SurfaceError && error.kind === "not_found"))
68
+ throw error;
69
+ await gh.rest("POST", scope.base, { body });
70
+ created = true;
71
+ }
72
+ return { ...scope.fields, name, value, created };
73
+ },
74
+ }),
75
+ delete: op({
76
+ description: "Delete a variable. Replaces `gh variable delete`.",
77
+ input: s.object({ name: s.string(), ...scopeFields }),
78
+ annotations: irreversible,
79
+ run: async ({ name, ...rest }) => {
80
+ const scope = await scopeOf(rest);
81
+ await gh.rest("DELETE", `${scope.base}/${enc(name)}`);
82
+ return { ...scope.fields, name, deleted: true };
83
+ },
84
+ }),
85
+ };
86
+ };
@@ -0,0 +1,164 @@
1
+ // Blocking waits for CI: poll on the injected clock until checks or a run settle, then return one verdict.
2
+ // Each poll of pr.wait is a single GraphQL call; run.wait is one REST GET (plus one jobs read at the end).
3
+ import { op, s } from "../vendor/surface/index.ts";
4
+ import { runJobs, runSummary } from "./actions.ts";
5
+ import { fetchChecks, type Check } from "./checks.ts";
6
+ import { numberField, reads, repoField } from "./fields.ts";
7
+ import type { GitHub } from "./http.ts";
8
+
9
+ const MIN_INTERVAL_S = 10;
10
+ const interval = s.optional(
11
+ s.integer({
12
+ description: `Seconds between polls (default 30, min ${MIN_INTERVAL_S}).`,
13
+ }),
14
+ );
15
+ const timeout = s.optional(
16
+ s.integer({
17
+ description:
18
+ "Give up after this many minutes and return verdict timeout (default 60).",
19
+ }),
20
+ );
21
+ const pace = (seconds: number | undefined) =>
22
+ Math.max(seconds ?? 30, MIN_INTERVAL_S) * 1000;
23
+
24
+ type PrVerdict = "pass" | "fail" | "timeout" | "no_checks" | "head_moved";
25
+
26
+ export const waitOps = (gh: GitHub) => ({
27
+ pr: op({
28
+ description:
29
+ "Block until a PR's checks settle and return verdict pass | fail | timeout | no_checks | head_moved with the failing checks. Fails fast on the first failure unless failFast is false. Replaces `gh pr checks --watch`. For waits longer than a few minutes, run it from a monitor (references/waiting.md).",
30
+ input: s.object({
31
+ repo: repoField,
32
+ number: numberField,
33
+ headSha: s.optional(
34
+ s.string({
35
+ description:
36
+ "Expected head; returns head_moved when the PR head still differs after graceSeconds (a just-pushed head takes a moment to show on the PR).",
37
+ }),
38
+ ),
39
+ requiredOnly: s.optional(
40
+ s.boolean({
41
+ description:
42
+ "Judge only required checks (default false: every check).",
43
+ }),
44
+ ),
45
+ failFast: s.optional(
46
+ s.boolean({
47
+ description: "Return on the first failed check (default true).",
48
+ }),
49
+ ),
50
+ graceSeconds: s.optional(
51
+ s.integer({
52
+ description:
53
+ "How long zero checks, or a head not yet matching headSha, counts as still starting (default 120).",
54
+ }),
55
+ ),
56
+ intervalSeconds: interval,
57
+ timeoutMinutes: timeout,
58
+ }),
59
+ annotations: reads,
60
+ run: async ({
61
+ repo,
62
+ number,
63
+ headSha,
64
+ requiredOnly,
65
+ failFast,
66
+ graceSeconds,
67
+ intervalSeconds,
68
+ timeoutMinutes,
69
+ }) => {
70
+ const r = await gh.repo(repo);
71
+ const started = gh.now();
72
+ const deadline = started + (timeoutMinutes ?? 60) * 60_000;
73
+ for (let polls = 1; ; polls++) {
74
+ const state = await fetchChecks(gh, r, number);
75
+ const judged = state.checks.filter(
76
+ (c) => requiredOnly !== true || c.required,
77
+ );
78
+ const failing = judged.filter(
79
+ (c) => c.bucket === "fail" || c.bucket === "cancel",
80
+ );
81
+ const pending = judged.filter((c) => c.bucket === "pending");
82
+ const elapsed = gh.now() - started;
83
+ const done = (
84
+ verdict: PrVerdict,
85
+ extra: { readonly pending?: readonly Check[] } = {},
86
+ ) => ({
87
+ repo: r.full,
88
+ number,
89
+ verdict,
90
+ headSha: state.headSha,
91
+ counts: state.counts,
92
+ failing: failing.map((c) => ({
93
+ name: c.name,
94
+ state: c.state,
95
+ runId: c.runId,
96
+ url: c.url,
97
+ })),
98
+ pending: (extra.pending ?? []).map((c) => c.name),
99
+ polls,
100
+ waitedSeconds: Math.round(elapsed / 1000),
101
+ });
102
+ const grace = (graceSeconds ?? 120) * 1000;
103
+ if (headSha !== undefined && state.headSha !== headSha) {
104
+ if (elapsed >= grace) return done("head_moved");
105
+ await gh.sleep(pace(intervalSeconds));
106
+ continue;
107
+ }
108
+ if (failing.length > 0 && (failFast !== false || pending.length === 0))
109
+ return done("fail", { pending });
110
+ if (judged.length === 0 && elapsed >= grace) return done("no_checks");
111
+ if (judged.length > 0 && pending.length === 0) return done("pass");
112
+ if (gh.now() >= deadline) return done("timeout", { pending });
113
+ await gh.sleep(pace(intervalSeconds));
114
+ }
115
+ },
116
+ }),
117
+ run: op({
118
+ description:
119
+ "Block until one workflow run completes and return its conclusion and failed jobs (verdict timeout when it does not finish in time). Replaces `gh run watch`.",
120
+ input: s.object({
121
+ repo: repoField,
122
+ runId: s.integer({ description: "Workflow run id." }),
123
+ intervalSeconds: interval,
124
+ timeoutMinutes: timeout,
125
+ }),
126
+ annotations: reads,
127
+ run: async ({ repo, runId, intervalSeconds, timeoutMinutes }) => {
128
+ const r = await gh.repo(repo);
129
+ const started = gh.now();
130
+ const deadline = started + (timeoutMinutes ?? 60) * 60_000;
131
+ for (let polls = 1; ; polls++) {
132
+ const run = runSummary(
133
+ await gh.rest("GET", `repos/${r.full}/actions/runs/${runId}`),
134
+ );
135
+ const finished = run.status === "completed";
136
+ if (finished || gh.now() >= deadline) {
137
+ const jobs = finished
138
+ ? (await runJobs(gh, r.full, runId)).filter(
139
+ (j) => j.conclusion !== "success" && j.conclusion !== "skipped",
140
+ )
141
+ : [];
142
+ return {
143
+ repo: r.full,
144
+ verdict: finished
145
+ ? run.conclusion === "success"
146
+ ? "pass"
147
+ : "fail"
148
+ : "timeout",
149
+ run,
150
+ failedJobs: jobs.map((j) => ({
151
+ id: j.id,
152
+ name: j.name,
153
+ conclusion: j.conclusion,
154
+ failedSteps: j.failedSteps,
155
+ })),
156
+ polls,
157
+ waitedSeconds: Math.round((gh.now() - started) / 1000),
158
+ };
159
+ }
160
+ await gh.sleep(pace(intervalSeconds));
161
+ }
162
+ },
163
+ }),
164
+ });
@@ -0,0 +1,159 @@
1
+ // The request loop every GitHub call goes through: the bearer token, rate-limit waits, GET retries and error kinds.
2
+ // The token lives only in this process; every error message passes through `redact` before it leaves.
3
+ import { SurfaceError } from "../vendor/surface/index.ts";
4
+ import { errorMessage, kindFor, rateLimit } from "./errors.ts";
5
+ import type { Deps, Method, Request } from "./types.ts";
6
+
7
+ const MAX_RATE_WAIT_MS = 60_000;
8
+ const RETRIES = 3;
9
+ const MAX_REDIRECTS = 3;
10
+ export const UPLOAD_ORIGIN = "https://uploads.github.com";
11
+
12
+ export type Wire = ReturnType<typeof createWire>;
13
+
14
+ export const createWire = (deps: Deps) => {
15
+ const redact = async (text: string): Promise<string> => {
16
+ const token = await deps.token().catch(() => "");
17
+ return token ? text.split(token).join("[redacted]") : text;
18
+ };
19
+
20
+ const api = new URL(
21
+ deps.apiUrl.endsWith("/") ? deps.apiUrl : `${deps.apiUrl}/`,
22
+ );
23
+ // Parsed origins are compared, never string prefixes: api.github.com.evil.example begins with api.github.com.
24
+ const inApi = (u: URL): boolean =>
25
+ u.origin === api.origin && u.pathname.startsWith(api.pathname);
26
+
27
+ const url = (path: string, query: Request["query"]): URL => {
28
+ const u = new URL(path.replace(/^\/+/, ""), api);
29
+ if (!inApi(u))
30
+ throw new SurfaceError(
31
+ "usage",
32
+ `path leaves the API: ${path}`,
33
+ "pass a path like repos/owner/name/pulls",
34
+ );
35
+ for (const [k, v] of Object.entries(query ?? {}))
36
+ if (v !== undefined) u.searchParams.set(k, String(v));
37
+ return u;
38
+ };
39
+
40
+ const payload = (
41
+ req: Request,
42
+ ): {
43
+ readonly type: Readonly<Record<string, string>>;
44
+ readonly body: { readonly body?: string | Uint8Array };
45
+ } => {
46
+ if (req.raw !== undefined)
47
+ return {
48
+ type: { "content-type": req.raw.contentType },
49
+ body: { body: req.raw.bytes },
50
+ };
51
+ if (req.body === undefined) return { type: {}, body: {} };
52
+ return {
53
+ type: { "content-type": "application/json" },
54
+ body: { body: JSON.stringify(req.body) },
55
+ };
56
+ };
57
+
58
+ const send = async (
59
+ method: Method,
60
+ target: URL,
61
+ req: Request,
62
+ ): Promise<Response> => {
63
+ const token = await deps.token();
64
+ const { type, body } = payload(req);
65
+ let at = target;
66
+ let redirects = 0;
67
+ for (let attempt = 0; ; attempt++) {
68
+ // The one place the token is attached. A page link or redirect GitHub hands back is not trusted to
69
+ // name the destination: the token goes to the API and the upload host, and nowhere else.
70
+ if (!inApi(at) && at.origin !== UPLOAD_ORIGIN)
71
+ throw new SurfaceError(
72
+ "invalid_response",
73
+ `refusing to send the token to ${at.origin}`,
74
+ "a page link or redirect pointed outside the GitHub API; inspect the response with `api rest`",
75
+ );
76
+ const res = await deps
77
+ .fetch(at.href, {
78
+ method,
79
+ redirect: "manual",
80
+ headers: {
81
+ authorization: `Bearer ${token}`,
82
+ accept: req.accept ?? "application/vnd.github+json",
83
+ "x-github-api-version": "2022-11-28",
84
+ "user-agent": "github-skill",
85
+ ...type,
86
+ },
87
+ ...body,
88
+ })
89
+ .catch(async (error: unknown) => {
90
+ throw new SurfaceError(
91
+ "network",
92
+ await redact(
93
+ error instanceof Error ? error.message : String(error),
94
+ ),
95
+ "check connectivity and retry",
96
+ );
97
+ });
98
+ const limit = rateLimit(res, deps.now());
99
+ if (limit) {
100
+ if (limit.waitMs <= MAX_RATE_WAIT_MS && attempt < RETRIES) {
101
+ await deps.sleep(Math.max(limit.waitMs, 1000));
102
+ continue;
103
+ }
104
+ throw new SurfaceError(
105
+ "rate_limited",
106
+ `GitHub rate limit hit on ${method} ${target.pathname}`,
107
+ `resets ${limit.when}; check with \`api rate\``,
108
+ );
109
+ }
110
+ // A renamed or transferred repo answers with a redirect to another API path. Only that is followed:
111
+ // a redirect that leaves the API (a log or asset download) goes back to the caller, who drops the token.
112
+ const location = res.headers.get("location");
113
+ const next = location === null ? null : URL.parse(location);
114
+ if (
115
+ res.status >= 300 &&
116
+ res.status < 400 &&
117
+ next !== null &&
118
+ inApi(next) &&
119
+ (method === "GET" || res.status === 307 || res.status === 308) &&
120
+ redirects < MAX_REDIRECTS
121
+ ) {
122
+ at = next;
123
+ redirects++;
124
+ continue;
125
+ }
126
+ if (res.status >= 500 && method === "GET" && attempt < RETRIES) {
127
+ await deps.sleep(1000 * 2 ** attempt);
128
+ continue;
129
+ }
130
+ return res;
131
+ }
132
+ };
133
+
134
+ const fail = async (
135
+ method: Method,
136
+ target: URL,
137
+ res: Response,
138
+ ): Promise<never> => {
139
+ const message = errorMessage(await res.text().catch(() => ""));
140
+ const [kind, hint] = kindFor(res.status, message);
141
+ throw new SurfaceError(
142
+ kind,
143
+ await redact(`${method} ${target.pathname} ${res.status}: ${message}`),
144
+ hint,
145
+ );
146
+ };
147
+
148
+ const decode = async (res: Response): Promise<unknown> => {
149
+ const text = await res.text();
150
+ if (text === "") return {};
151
+ try {
152
+ return JSON.parse(text);
153
+ } catch {
154
+ return text;
155
+ }
156
+ };
157
+
158
+ return { redact, url, send, fail, decode };
159
+ };