oh-my-opencode 5.1.84 → 5.1.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. package/.agents/command/remove-deadcode.md +1 -1
  2. package/.agents/skills/remove-deadcode/SKILL.md +1 -1
  3. package/.agents/skills/work-with-pr/SKILL.md +2 -2
  4. package/.opencode/command/remove-deadcode.md +1 -1
  5. package/.opencode/skills/work-with-pr/SKILL.md +2 -2
  6. package/THIRD-PARTY-NOTICES.md +9 -3
  7. package/dist/cli/index.js +1022 -842
  8. package/dist/cli/service-auth/devices.d.ts +5 -2
  9. package/dist/cli-node/index.js +1022 -842
  10. package/dist/config/schema/agent-names.d.ts +1 -0
  11. package/dist/index.js +180 -205
  12. package/dist/skills/browser/SKILL.md +4 -1
  13. package/dist/skills/browser/references/commands.md +5 -2
  14. package/dist/skills/browser/references/desktop.md +1 -0
  15. package/dist/skills/browser/references/owned-engine/README.md +2 -0
  16. package/dist/skills/browser/references/owned-engine/frames-and-humans.md +2 -0
  17. package/dist/skills/browser/references/owned-engine/network.md +10 -5
  18. package/dist/skills/browser/references/recipes/1password.md +2 -0
  19. package/dist/skills/browser/runtime/omowright/index.js +11 -11
  20. package/dist/skills/browser/runtime/omowright/manifest.json +4 -4
  21. package/dist/skills/debugging/SKILL.md +1 -1
  22. package/dist/skills/git/SKILL.md +62 -0
  23. package/dist/skills/git/agents/openai.yaml +13 -0
  24. package/dist/skills/github/SKILL.md +94 -0
  25. package/dist/skills/github/references/branch-rules.md +129 -0
  26. package/dist/skills/github/references/evidence-attachments.md +16 -0
  27. package/dist/skills/github/references/repo-setup.md +152 -0
  28. package/dist/skills/github/references/waiting.md +52 -0
  29. package/dist/skills/github/references/workflows.md +161 -0
  30. package/dist/skills/github/scripts/cli.ts +8 -0
  31. package/dist/skills/github/scripts/package.json +12 -0
  32. package/dist/skills/github/scripts/sdk.ts +11 -0
  33. package/dist/skills/github/scripts/src/account.ts +243 -0
  34. package/dist/skills/github/scripts/src/actions-write.ts +86 -0
  35. package/dist/skills/github/scripts/src/actions.ts +210 -0
  36. package/dist/skills/github/scripts/src/attestations.ts +136 -0
  37. package/dist/skills/github/scripts/src/blake2b.ts +102 -0
  38. package/dist/skills/github/scripts/src/branch-protection.ts +192 -0
  39. package/dist/skills/github/scripts/src/caches.ts +105 -0
  40. package/dist/skills/github/scripts/src/checks.ts +107 -0
  41. package/dist/skills/github/scripts/src/codespaces.ts +230 -0
  42. package/dist/skills/github/scripts/src/conversation-lock.ts +50 -0
  43. package/dist/skills/github/scripts/src/discussion-list.ts +126 -0
  44. package/dist/skills/github/scripts/src/discussion-lookup.ts +127 -0
  45. package/dist/skills/github/scripts/src/discussions.ts +234 -0
  46. package/dist/skills/github/scripts/src/env.ts +100 -0
  47. package/dist/skills/github/scripts/src/errors.ts +79 -0
  48. package/dist/skills/github/scripts/src/fields.ts +27 -0
  49. package/dist/skills/github/scripts/src/gist-shape.ts +58 -0
  50. package/dist/skills/github/scripts/src/gists-write.ts +130 -0
  51. package/dist/skills/github/scripts/src/gists.ts +118 -0
  52. package/dist/skills/github/scripts/src/git-auth.ts +46 -0
  53. package/dist/skills/github/scripts/src/http.ts +159 -0
  54. package/dist/skills/github/scripts/src/issue-develop.ts +118 -0
  55. package/dist/skills/github/scripts/src/issues-extra.ts +135 -0
  56. package/dist/skills/github/scripts/src/issues-write.ts +174 -0
  57. package/dist/skills/github/scripts/src/issues.ts +156 -0
  58. package/dist/skills/github/scripts/src/keys.ts +176 -0
  59. package/dist/skills/github/scripts/src/labels.ts +209 -0
  60. package/dist/skills/github/scripts/src/merge.ts +115 -0
  61. package/dist/skills/github/scripts/src/poly1305.ts +22 -0
  62. package/dist/skills/github/scripts/src/pr-checkout.ts +92 -0
  63. package/dist/skills/github/scripts/src/pr-view.ts +106 -0
  64. package/dist/skills/github/scripts/src/project-fields.ts +144 -0
  65. package/dist/skills/github/scripts/src/project-item-edit.ts +153 -0
  66. package/dist/skills/github/scripts/src/project-items.ts +191 -0
  67. package/dist/skills/github/scripts/src/project-links.ts +104 -0
  68. package/dist/skills/github/scripts/src/project-ref.ts +145 -0
  69. package/dist/skills/github/scripts/src/project-state.ts +99 -0
  70. package/dist/skills/github/scripts/src/projects.ts +158 -0
  71. package/dist/skills/github/scripts/src/pulls-extra.ts +165 -0
  72. package/dist/skills/github/scripts/src/pulls-read.ts +176 -0
  73. package/dist/skills/github/scripts/src/pulls-review.ts +206 -0
  74. package/dist/skills/github/scripts/src/pulls-write.ts +187 -0
  75. package/dist/skills/github/scripts/src/raw.ts +78 -0
  76. package/dist/skills/github/scripts/src/read.ts +77 -0
  77. package/dist/skills/github/scripts/src/release-assets.ts +111 -0
  78. package/dist/skills/github/scripts/src/release-download.ts +151 -0
  79. package/dist/skills/github/scripts/src/release-write.ts +197 -0
  80. package/dist/skills/github/scripts/src/repo-admin.ts +112 -0
  81. package/dist/skills/github/scripts/src/repo-content.ts +187 -0
  82. package/dist/skills/github/scripts/src/repo-create.ts +139 -0
  83. package/dist/skills/github/scripts/src/repo-extras.ts +217 -0
  84. package/dist/skills/github/scripts/src/repo-list.ts +143 -0
  85. package/dist/skills/github/scripts/src/repo-settings.ts +176 -0
  86. package/dist/skills/github/scripts/src/repo-sync.ts +81 -0
  87. package/dist/skills/github/scripts/src/repo-url.ts +104 -0
  88. package/dist/skills/github/scripts/src/repos.ts +87 -0
  89. package/dist/skills/github/scripts/src/ruleset-shape.ts +96 -0
  90. package/dist/skills/github/scripts/src/rulesets-write.ts +124 -0
  91. package/dist/skills/github/scripts/src/rulesets.ts +80 -0
  92. package/dist/skills/github/scripts/src/run-download.ts +88 -0
  93. package/dist/skills/github/scripts/src/salsa20.ts +97 -0
  94. package/dist/skills/github/scripts/src/scopes.ts +165 -0
  95. package/dist/skills/github/scripts/src/sealed-box.ts +75 -0
  96. package/dist/skills/github/scripts/src/search-commits.ts +114 -0
  97. package/dist/skills/github/scripts/src/search.ts +116 -0
  98. package/dist/skills/github/scripts/src/secrets.ts +131 -0
  99. package/dist/skills/github/scripts/src/snappy.ts +57 -0
  100. package/dist/skills/github/scripts/src/status-search.ts +55 -0
  101. package/dist/skills/github/scripts/src/transfer.ts +97 -0
  102. package/dist/skills/github/scripts/src/types.ts +75 -0
  103. package/dist/skills/github/scripts/src/variables.ts +86 -0
  104. package/dist/skills/github/scripts/src/wait.ts +164 -0
  105. package/dist/skills/github/scripts/src/wire.ts +159 -0
  106. package/dist/skills/github/scripts/src/workflows.ts +144 -0
  107. package/dist/skills/github/scripts/src/zip.ts +104 -0
  108. package/dist/skills/github/scripts/surface.ts +106 -0
  109. package/dist/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
  110. package/dist/skills/github/scripts/vendor/surface/cli.ts +203 -0
  111. package/dist/skills/github/scripts/vendor/surface/flags.ts +195 -0
  112. package/dist/skills/github/scripts/vendor/surface/help.ts +89 -0
  113. package/dist/skills/github/scripts/vendor/surface/http.ts +180 -0
  114. package/dist/skills/github/scripts/vendor/surface/index.ts +44 -0
  115. package/dist/skills/github/scripts/vendor/surface/mcp.ts +241 -0
  116. package/dist/skills/github/scripts/vendor/surface/schema.ts +200 -0
  117. package/dist/skills/github/scripts/vendor/surface/stdio.ts +54 -0
  118. package/dist/skills/github/scripts/vendor/surface/surface.ts +250 -0
  119. package/dist/skills/github/scripts/vendor/surface/tools.ts +80 -0
  120. package/dist/skills/programming/SKILL.md +1 -1
  121. package/dist/skills/ulw-execute/SKILL.md +1 -1
  122. package/dist/tui.js +30 -27
  123. package/package.json +28 -26
  124. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  125. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  126. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  127. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  128. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  129. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  130. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  131. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  132. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  133. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
  134. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  135. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  136. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  137. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  138. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  139. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  140. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  141. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  142. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  143. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  144. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
  145. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  146. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
  147. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  148. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +1 -1
  149. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +3 -3
  150. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  151. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  152. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  153. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  154. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  155. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  156. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  157. package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
  158. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  159. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  160. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  161. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  162. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  163. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  164. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  165. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  166. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  167. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  168. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  169. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  170. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  171. package/packages/omo-codex/plugin/package-lock.json +12 -12
  172. package/packages/omo-codex/plugin/package.json +1 -1
  173. package/packages/omo-codex/plugin/skills/browser/SKILL.md +4 -1
  174. package/packages/omo-codex/plugin/skills/browser/references/commands.md +5 -2
  175. package/packages/omo-codex/plugin/skills/browser/references/desktop.md +1 -0
  176. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/README.md +2 -0
  177. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +2 -0
  178. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/network.md +10 -5
  179. package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +2 -0
  180. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +11 -11
  181. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +4 -4
  182. package/packages/omo-codex/plugin/skills/debugging/SKILL.md +1 -1
  183. package/packages/omo-codex/plugin/skills/git/SKILL.md +62 -0
  184. package/packages/omo-codex/plugin/skills/git/agents/openai.yaml +13 -0
  185. package/packages/omo-codex/plugin/skills/github/SKILL.md +94 -0
  186. package/packages/omo-codex/plugin/skills/github/agents/openai.yaml +2 -0
  187. package/packages/omo-codex/plugin/skills/github/references/branch-rules.md +129 -0
  188. package/packages/omo-codex/plugin/skills/github/references/evidence-attachments.md +16 -0
  189. package/packages/omo-codex/plugin/skills/github/references/repo-setup.md +152 -0
  190. package/packages/omo-codex/plugin/skills/github/references/waiting.md +52 -0
  191. package/packages/omo-codex/plugin/skills/github/references/workflows.md +161 -0
  192. package/packages/omo-codex/plugin/skills/github/scripts/cli.ts +8 -0
  193. package/packages/omo-codex/plugin/skills/github/scripts/package.json +12 -0
  194. package/packages/omo-codex/plugin/skills/github/scripts/sdk.ts +11 -0
  195. package/packages/omo-codex/plugin/skills/github/scripts/src/account.ts +243 -0
  196. package/packages/omo-codex/plugin/skills/github/scripts/src/actions-write.ts +86 -0
  197. package/packages/omo-codex/plugin/skills/github/scripts/src/actions.ts +210 -0
  198. package/packages/omo-codex/plugin/skills/github/scripts/src/attestations.ts +136 -0
  199. package/packages/omo-codex/plugin/skills/github/scripts/src/blake2b.ts +102 -0
  200. package/packages/omo-codex/plugin/skills/github/scripts/src/branch-protection.ts +192 -0
  201. package/packages/omo-codex/plugin/skills/github/scripts/src/caches.ts +105 -0
  202. package/packages/omo-codex/plugin/skills/github/scripts/src/checks.ts +107 -0
  203. package/packages/omo-codex/plugin/skills/github/scripts/src/codespaces.ts +230 -0
  204. package/packages/omo-codex/plugin/skills/github/scripts/src/conversation-lock.ts +50 -0
  205. package/packages/omo-codex/plugin/skills/github/scripts/src/discussion-list.ts +126 -0
  206. package/packages/omo-codex/plugin/skills/github/scripts/src/discussion-lookup.ts +127 -0
  207. package/packages/omo-codex/plugin/skills/github/scripts/src/discussions.ts +234 -0
  208. package/packages/omo-codex/plugin/skills/github/scripts/src/env.ts +100 -0
  209. package/packages/omo-codex/plugin/skills/github/scripts/src/errors.ts +79 -0
  210. package/packages/omo-codex/plugin/skills/github/scripts/src/fields.ts +27 -0
  211. package/packages/omo-codex/plugin/skills/github/scripts/src/gist-shape.ts +58 -0
  212. package/packages/omo-codex/plugin/skills/github/scripts/src/gists-write.ts +130 -0
  213. package/packages/omo-codex/plugin/skills/github/scripts/src/gists.ts +118 -0
  214. package/packages/omo-codex/plugin/skills/github/scripts/src/git-auth.ts +46 -0
  215. package/packages/omo-codex/plugin/skills/github/scripts/src/http.ts +159 -0
  216. package/packages/omo-codex/plugin/skills/github/scripts/src/issue-develop.ts +118 -0
  217. package/packages/omo-codex/plugin/skills/github/scripts/src/issues-extra.ts +135 -0
  218. package/packages/omo-codex/plugin/skills/github/scripts/src/issues-write.ts +174 -0
  219. package/packages/omo-codex/plugin/skills/github/scripts/src/issues.ts +156 -0
  220. package/packages/omo-codex/plugin/skills/github/scripts/src/keys.ts +176 -0
  221. package/packages/omo-codex/plugin/skills/github/scripts/src/labels.ts +209 -0
  222. package/packages/omo-codex/plugin/skills/github/scripts/src/merge.ts +115 -0
  223. package/packages/omo-codex/plugin/skills/github/scripts/src/poly1305.ts +22 -0
  224. package/packages/omo-codex/plugin/skills/github/scripts/src/pr-checkout.ts +92 -0
  225. package/packages/omo-codex/plugin/skills/github/scripts/src/pr-view.ts +106 -0
  226. package/packages/omo-codex/plugin/skills/github/scripts/src/project-fields.ts +144 -0
  227. package/packages/omo-codex/plugin/skills/github/scripts/src/project-item-edit.ts +153 -0
  228. package/packages/omo-codex/plugin/skills/github/scripts/src/project-items.ts +191 -0
  229. package/packages/omo-codex/plugin/skills/github/scripts/src/project-links.ts +104 -0
  230. package/packages/omo-codex/plugin/skills/github/scripts/src/project-ref.ts +145 -0
  231. package/packages/omo-codex/plugin/skills/github/scripts/src/project-state.ts +99 -0
  232. package/packages/omo-codex/plugin/skills/github/scripts/src/projects.ts +158 -0
  233. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-extra.ts +165 -0
  234. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-read.ts +176 -0
  235. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-review.ts +206 -0
  236. package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-write.ts +187 -0
  237. package/packages/omo-codex/plugin/skills/github/scripts/src/raw.ts +78 -0
  238. package/packages/omo-codex/plugin/skills/github/scripts/src/read.ts +77 -0
  239. package/packages/omo-codex/plugin/skills/github/scripts/src/release-assets.ts +111 -0
  240. package/packages/omo-codex/plugin/skills/github/scripts/src/release-download.ts +151 -0
  241. package/packages/omo-codex/plugin/skills/github/scripts/src/release-write.ts +197 -0
  242. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-admin.ts +112 -0
  243. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-content.ts +187 -0
  244. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-create.ts +139 -0
  245. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-extras.ts +217 -0
  246. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-list.ts +143 -0
  247. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-settings.ts +176 -0
  248. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-sync.ts +81 -0
  249. package/packages/omo-codex/plugin/skills/github/scripts/src/repo-url.ts +104 -0
  250. package/packages/omo-codex/plugin/skills/github/scripts/src/repos.ts +87 -0
  251. package/packages/omo-codex/plugin/skills/github/scripts/src/ruleset-shape.ts +96 -0
  252. package/packages/omo-codex/plugin/skills/github/scripts/src/rulesets-write.ts +124 -0
  253. package/packages/omo-codex/plugin/skills/github/scripts/src/rulesets.ts +80 -0
  254. package/packages/omo-codex/plugin/skills/github/scripts/src/run-download.ts +88 -0
  255. package/packages/omo-codex/plugin/skills/github/scripts/src/salsa20.ts +97 -0
  256. package/packages/omo-codex/plugin/skills/github/scripts/src/scopes.ts +165 -0
  257. package/packages/omo-codex/plugin/skills/github/scripts/src/sealed-box.ts +75 -0
  258. package/packages/omo-codex/plugin/skills/github/scripts/src/search-commits.ts +114 -0
  259. package/packages/omo-codex/plugin/skills/github/scripts/src/search.ts +116 -0
  260. package/packages/omo-codex/plugin/skills/github/scripts/src/secrets.ts +131 -0
  261. package/packages/omo-codex/plugin/skills/github/scripts/src/snappy.ts +57 -0
  262. package/packages/omo-codex/plugin/skills/github/scripts/src/status-search.ts +55 -0
  263. package/packages/omo-codex/plugin/skills/github/scripts/src/transfer.ts +97 -0
  264. package/packages/omo-codex/plugin/skills/github/scripts/src/types.ts +75 -0
  265. package/packages/omo-codex/plugin/skills/github/scripts/src/variables.ts +86 -0
  266. package/packages/omo-codex/plugin/skills/github/scripts/src/wait.ts +164 -0
  267. package/packages/omo-codex/plugin/skills/github/scripts/src/wire.ts +159 -0
  268. package/packages/omo-codex/plugin/skills/github/scripts/src/workflows.ts +144 -0
  269. package/packages/omo-codex/plugin/skills/github/scripts/src/zip.ts +104 -0
  270. package/packages/omo-codex/plugin/skills/github/scripts/surface.ts +106 -0
  271. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
  272. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/cli.ts +203 -0
  273. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/flags.ts +195 -0
  274. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/help.ts +89 -0
  275. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/http.ts +180 -0
  276. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/index.ts +44 -0
  277. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/mcp.ts +241 -0
  278. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/schema.ts +200 -0
  279. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/stdio.ts +54 -0
  280. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/surface.ts +250 -0
  281. package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/tools.ts +80 -0
  282. package/packages/omo-codex/plugin/skills/programming/SKILL.md +1 -1
  283. package/packages/omo-codex/plugin/skills/ulw-execute/SKILL.md +1 -1
  284. package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +1 -1
  285. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +3 -3
  286. package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +1 -1
  287. package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +2 -1
  288. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +5 -5
  289. package/packages/omo-codex/scripts/install-dist/install-local.mjs +20 -15
  290. package/packages/shared-skills/skills/browser/SKILL.md +4 -1
  291. package/packages/shared-skills/skills/browser/references/commands.md +5 -2
  292. package/packages/shared-skills/skills/browser/references/desktop.md +1 -0
  293. package/packages/shared-skills/skills/browser/references/owned-engine/README.md +2 -0
  294. package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +2 -0
  295. package/packages/shared-skills/skills/browser/references/owned-engine/network.md +10 -5
  296. package/packages/shared-skills/skills/browser/references/recipes/1password.md +2 -0
  297. package/packages/shared-skills/skills/browser/runtime/omowright/index.js +11 -11
  298. package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +4 -4
  299. package/packages/shared-skills/skills/debugging/SKILL.md +1 -1
  300. package/packages/shared-skills/skills/git/SKILL.md +62 -0
  301. package/packages/shared-skills/skills/git/agents/openai.yaml +13 -0
  302. package/packages/shared-skills/skills/github/SKILL.md +94 -0
  303. package/packages/shared-skills/skills/github/references/branch-rules.md +129 -0
  304. package/packages/shared-skills/skills/github/references/evidence-attachments.md +16 -0
  305. package/packages/shared-skills/skills/github/references/repo-setup.md +152 -0
  306. package/packages/shared-skills/skills/github/references/waiting.md +52 -0
  307. package/packages/shared-skills/skills/github/references/workflows.md +161 -0
  308. package/packages/shared-skills/skills/github/scripts/cli.ts +8 -0
  309. package/packages/shared-skills/skills/github/scripts/package.json +12 -0
  310. package/packages/shared-skills/skills/github/scripts/sdk.ts +11 -0
  311. package/packages/shared-skills/skills/github/scripts/src/account.ts +243 -0
  312. package/packages/shared-skills/skills/github/scripts/src/actions-write.ts +86 -0
  313. package/packages/shared-skills/skills/github/scripts/src/actions.ts +210 -0
  314. package/packages/shared-skills/skills/github/scripts/src/attestations.ts +136 -0
  315. package/packages/shared-skills/skills/github/scripts/src/blake2b.ts +102 -0
  316. package/packages/shared-skills/skills/github/scripts/src/branch-protection.ts +192 -0
  317. package/packages/shared-skills/skills/github/scripts/src/caches.ts +105 -0
  318. package/packages/shared-skills/skills/github/scripts/src/checks.ts +107 -0
  319. package/packages/shared-skills/skills/github/scripts/src/codespaces.ts +230 -0
  320. package/packages/shared-skills/skills/github/scripts/src/conversation-lock.ts +50 -0
  321. package/packages/shared-skills/skills/github/scripts/src/discussion-list.ts +126 -0
  322. package/packages/shared-skills/skills/github/scripts/src/discussion-lookup.ts +127 -0
  323. package/packages/shared-skills/skills/github/scripts/src/discussions.ts +234 -0
  324. package/packages/shared-skills/skills/github/scripts/src/env.ts +100 -0
  325. package/packages/shared-skills/skills/github/scripts/src/errors.ts +79 -0
  326. package/packages/shared-skills/skills/github/scripts/src/fields.ts +27 -0
  327. package/packages/shared-skills/skills/github/scripts/src/gist-shape.ts +58 -0
  328. package/packages/shared-skills/skills/github/scripts/src/gists-write.ts +130 -0
  329. package/packages/shared-skills/skills/github/scripts/src/gists.ts +118 -0
  330. package/packages/shared-skills/skills/github/scripts/src/git-auth.ts +46 -0
  331. package/packages/shared-skills/skills/github/scripts/src/http.ts +159 -0
  332. package/packages/shared-skills/skills/github/scripts/src/issue-develop.ts +118 -0
  333. package/packages/shared-skills/skills/github/scripts/src/issues-extra.ts +135 -0
  334. package/packages/shared-skills/skills/github/scripts/src/issues-write.ts +174 -0
  335. package/packages/shared-skills/skills/github/scripts/src/issues.ts +156 -0
  336. package/packages/shared-skills/skills/github/scripts/src/keys.ts +176 -0
  337. package/packages/shared-skills/skills/github/scripts/src/labels.ts +209 -0
  338. package/packages/shared-skills/skills/github/scripts/src/merge.ts +115 -0
  339. package/packages/shared-skills/skills/github/scripts/src/poly1305.ts +22 -0
  340. package/packages/shared-skills/skills/github/scripts/src/pr-checkout.ts +92 -0
  341. package/packages/shared-skills/skills/github/scripts/src/pr-view.ts +106 -0
  342. package/packages/shared-skills/skills/github/scripts/src/project-fields.ts +144 -0
  343. package/packages/shared-skills/skills/github/scripts/src/project-item-edit.ts +153 -0
  344. package/packages/shared-skills/skills/github/scripts/src/project-items.ts +191 -0
  345. package/packages/shared-skills/skills/github/scripts/src/project-links.ts +104 -0
  346. package/packages/shared-skills/skills/github/scripts/src/project-ref.ts +145 -0
  347. package/packages/shared-skills/skills/github/scripts/src/project-state.ts +99 -0
  348. package/packages/shared-skills/skills/github/scripts/src/projects.ts +158 -0
  349. package/packages/shared-skills/skills/github/scripts/src/pulls-extra.ts +165 -0
  350. package/packages/shared-skills/skills/github/scripts/src/pulls-read.ts +176 -0
  351. package/packages/shared-skills/skills/github/scripts/src/pulls-review.ts +206 -0
  352. package/packages/shared-skills/skills/github/scripts/src/pulls-write.ts +187 -0
  353. package/packages/shared-skills/skills/github/scripts/src/raw.ts +78 -0
  354. package/packages/shared-skills/skills/github/scripts/src/read.ts +77 -0
  355. package/packages/shared-skills/skills/github/scripts/src/release-assets.ts +111 -0
  356. package/packages/shared-skills/skills/github/scripts/src/release-download.ts +151 -0
  357. package/packages/shared-skills/skills/github/scripts/src/release-write.ts +197 -0
  358. package/packages/shared-skills/skills/github/scripts/src/repo-admin.ts +112 -0
  359. package/packages/shared-skills/skills/github/scripts/src/repo-content.ts +187 -0
  360. package/packages/shared-skills/skills/github/scripts/src/repo-create.ts +139 -0
  361. package/packages/shared-skills/skills/github/scripts/src/repo-extras.ts +217 -0
  362. package/packages/shared-skills/skills/github/scripts/src/repo-list.ts +143 -0
  363. package/packages/shared-skills/skills/github/scripts/src/repo-settings.ts +176 -0
  364. package/packages/shared-skills/skills/github/scripts/src/repo-sync.ts +81 -0
  365. package/packages/shared-skills/skills/github/scripts/src/repo-url.ts +104 -0
  366. package/packages/shared-skills/skills/github/scripts/src/repos.ts +87 -0
  367. package/packages/shared-skills/skills/github/scripts/src/ruleset-shape.ts +96 -0
  368. package/packages/shared-skills/skills/github/scripts/src/rulesets-write.ts +124 -0
  369. package/packages/shared-skills/skills/github/scripts/src/rulesets.ts +80 -0
  370. package/packages/shared-skills/skills/github/scripts/src/run-download.ts +88 -0
  371. package/packages/shared-skills/skills/github/scripts/src/salsa20.ts +97 -0
  372. package/packages/shared-skills/skills/github/scripts/src/scopes.ts +165 -0
  373. package/packages/shared-skills/skills/github/scripts/src/sealed-box.ts +75 -0
  374. package/packages/shared-skills/skills/github/scripts/src/search-commits.ts +114 -0
  375. package/packages/shared-skills/skills/github/scripts/src/search.ts +116 -0
  376. package/packages/shared-skills/skills/github/scripts/src/secrets.ts +131 -0
  377. package/packages/shared-skills/skills/github/scripts/src/snappy.ts +57 -0
  378. package/packages/shared-skills/skills/github/scripts/src/status-search.ts +55 -0
  379. package/packages/shared-skills/skills/github/scripts/src/transfer.ts +97 -0
  380. package/packages/shared-skills/skills/github/scripts/src/types.ts +75 -0
  381. package/packages/shared-skills/skills/github/scripts/src/variables.ts +86 -0
  382. package/packages/shared-skills/skills/github/scripts/src/wait.ts +164 -0
  383. package/packages/shared-skills/skills/github/scripts/src/wire.ts +159 -0
  384. package/packages/shared-skills/skills/github/scripts/src/workflows.ts +144 -0
  385. package/packages/shared-skills/skills/github/scripts/src/zip.ts +104 -0
  386. package/packages/shared-skills/skills/github/scripts/surface.ts +106 -0
  387. package/packages/shared-skills/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
  388. package/packages/shared-skills/skills/github/scripts/vendor/surface/cli.ts +203 -0
  389. package/packages/shared-skills/skills/github/scripts/vendor/surface/flags.ts +195 -0
  390. package/packages/shared-skills/skills/github/scripts/vendor/surface/help.ts +89 -0
  391. package/packages/shared-skills/skills/github/scripts/vendor/surface/http.ts +180 -0
  392. package/packages/shared-skills/skills/github/scripts/vendor/surface/index.ts +44 -0
  393. package/packages/shared-skills/skills/github/scripts/vendor/surface/mcp.ts +241 -0
  394. package/packages/shared-skills/skills/github/scripts/vendor/surface/schema.ts +200 -0
  395. package/packages/shared-skills/skills/github/scripts/vendor/surface/stdio.ts +54 -0
  396. package/packages/shared-skills/skills/github/scripts/vendor/surface/surface.ts +250 -0
  397. package/packages/shared-skills/skills/github/scripts/vendor/surface/tools.ts +80 -0
  398. package/packages/shared-skills/skills/programming/SKILL.md +1 -1
  399. package/packages/shared-skills/skills/ulw-execute/SKILL.md +1 -1
  400. package/dist/skills/git-master/SKILL.md +0 -114
  401. package/dist/skills/git-master/agents/openai.yaml +0 -13
  402. package/packages/omo-codex/plugin/skills/git-master/SKILL.md +0 -114
  403. package/packages/omo-codex/plugin/skills/git-master/agents/openai.yaml +0 -13
  404. package/packages/shared-skills/skills/git-master/SKILL.md +0 -114
  405. package/packages/shared-skills/skills/git-master/agents/openai.yaml +0 -13
@@ -0,0 +1,153 @@
1
+ // Editing one project item: set or clear one field value, and retitle or rewrite a draft issue.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import {
6
+ itemIdField,
7
+ missing,
8
+ mutate,
9
+ ownerField,
10
+ projectGraphql,
11
+ projectNumberField,
12
+ projectQuery,
13
+ } from "./project-ref.ts";
14
+ import { at, optStr, str } from "./read.ts";
15
+
16
+ const usage = (message: string, hint: string) =>
17
+ new SurfaceError("usage", message, hint);
18
+
19
+ const resolveField = async (
20
+ gh: GitHub,
21
+ owner: string,
22
+ number: number,
23
+ name: string | undefined,
24
+ ) => {
25
+ const { project } = await projectQuery(
26
+ gh,
27
+ owner,
28
+ number,
29
+ name === undefined
30
+ ? ""
31
+ : "field(name: $field) { ... on ProjectV2FieldCommon { id } }",
32
+ name === undefined
33
+ ? {}
34
+ : { decl: "$field: String!", vars: { field: name } },
35
+ );
36
+ return {
37
+ projectId: str(project, "id"),
38
+ fieldId: optStr(project, "field", "id"),
39
+ };
40
+ };
41
+
42
+ const draftIssueId = async (gh: GitHub, itemId: string) => {
43
+ const data = await projectGraphql(
44
+ gh,
45
+ "query($id: ID!) { node(id: $id) { ... on ProjectV2Item { content { ... on DraftIssue { id } } } } }",
46
+ { id: itemId },
47
+ );
48
+ const id = optStr(data, "node", "content", "id");
49
+ if (id === null)
50
+ throw usage(
51
+ `item ${itemId} is not a draft issue`,
52
+ "title and body only apply to draft issue items; edit an issue or PR with issue.edit / pr.edit",
53
+ );
54
+ return id;
55
+ };
56
+
57
+ export const itemEditOp = (gh: GitHub) =>
58
+ op({
59
+ description:
60
+ "Set one field value on a project item (by field name or id), clear it, or change a draft issue's title/body. Replaces `gh project item-edit`.",
61
+ input: s.object({
62
+ owner: ownerField,
63
+ number: projectNumberField,
64
+ id: itemIdField,
65
+ field: s.optional(s.string({ description: "Field name to update." })),
66
+ fieldId: s.optional(s.string({ description: "Field id (PVTF_...)." })),
67
+ text: s.optional(s.string()),
68
+ numberValue: s.optional(
69
+ s.number({ description: "Value for a NUMBER field." }),
70
+ ),
71
+ date: s.optional(s.string({ description: "YYYY-MM-DD." })),
72
+ singleSelectOptionId: s.optional(s.string()),
73
+ iterationId: s.optional(s.string()),
74
+ clear: s.optional(s.boolean({ description: "Remove the field value." })),
75
+ title: s.optional(s.string({ description: "Draft issue title." })),
76
+ body: s.optional(s.string({ description: "Draft issue body." })),
77
+ }),
78
+ annotations: writes,
79
+ run: async (input) => {
80
+ const { owner, number, id, field, fieldId, clear, title, body } = input;
81
+ const value = Object.fromEntries(
82
+ Object.entries({
83
+ text: input.text,
84
+ number: input.numberValue,
85
+ date: input.date,
86
+ singleSelectOptionId: input.singleSelectOptionId,
87
+ iterationId: input.iterationId,
88
+ }).filter(([, v]) => v !== undefined),
89
+ );
90
+ const changes = Object.keys(value).length + (clear === true ? 1 : 0);
91
+ const named = field !== undefined || fieldId !== undefined;
92
+ const draft = title !== undefined || body !== undefined;
93
+ if (field !== undefined && fieldId !== undefined)
94
+ throw usage("pass field or fieldId, not both", "name the field once");
95
+ if (changes > 1)
96
+ throw usage("one field value per call", "pass a single value or clear");
97
+ if (named !== (changes === 1))
98
+ throw usage(
99
+ named
100
+ ? "a field needs a value or clear"
101
+ : "a value needs field or fieldId",
102
+ "pass field (or fieldId) together with one value or clear",
103
+ );
104
+ if (!named && !draft)
105
+ throw usage(
106
+ "nothing to change",
107
+ "pass a field value, clear, title or body",
108
+ );
109
+
110
+ const result: Record<string, unknown> = { id };
111
+ if (named) {
112
+ const ref = await resolveField(gh, owner, number, field);
113
+ const target = fieldId ?? ref.fieldId;
114
+ if (target === null) throw missing(`field "${field ?? ""}"`);
115
+ const keys = { projectId: ref.projectId, itemId: id, fieldId: target };
116
+ await (clear === true
117
+ ? mutate(
118
+ gh,
119
+ "clearProjectV2ItemFieldValue",
120
+ keys,
121
+ "projectV2Item { id }",
122
+ )
123
+ : mutate(
124
+ gh,
125
+ "updateProjectV2ItemFieldValue",
126
+ { ...keys, value },
127
+ "projectV2Item { id }",
128
+ ));
129
+ Object.assign(result, {
130
+ fieldId: target,
131
+ value: clear === true ? null : value,
132
+ });
133
+ }
134
+ if (draft) {
135
+ const draftId = await draftIssueId(gh, id);
136
+ const d = await mutate(
137
+ gh,
138
+ "updateProjectV2DraftIssue",
139
+ {
140
+ draftIssueId: draftId,
141
+ ...(title === undefined ? {} : { title }),
142
+ ...(body === undefined ? {} : { body }),
143
+ },
144
+ "draftIssue { id title body }",
145
+ );
146
+ Object.assign(result, {
147
+ title: str(d, "draftIssue", "title"),
148
+ body: optStr(at(d, "draftIssue"), "body"),
149
+ });
150
+ }
151
+ return result;
152
+ },
153
+ });
@@ -0,0 +1,191 @@
1
+ // Project (v2) items: list with field values, add issues/PRs, create drafts, archive and delete.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { irreversible, limitField, reads, writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import { itemEditOp } from "./project-item-edit.ts";
6
+ import {
7
+ collect,
8
+ itemIdField,
9
+ mutate,
10
+ ownerField,
11
+ pageInfo,
12
+ projectGraphql,
13
+ projectNumberField,
14
+ projectQuery,
15
+ resolveProject,
16
+ } from "./project-ref.ts";
17
+ import { at, bool, nodes, optNum, optStr, str } from "./read.ts";
18
+
19
+ const NAME = "field { ... on ProjectV2FieldCommon { name } }";
20
+ // Issue.state and PullRequest.state are different enums, so they need distinct response names.
21
+ const ITEM = `id type isArchived
22
+ content {
23
+ ... on DraftIssue { id title body }
24
+ ... on Issue { id number title url issueState: state repository { nameWithOwner } }
25
+ ... on PullRequest { id number title url prState: state repository { nameWithOwner } }
26
+ }
27
+ fieldValues(first: 30) { nodes {
28
+ ... on ProjectV2ItemFieldTextValue { text ${NAME} }
29
+ ... on ProjectV2ItemFieldNumberValue { number ${NAME} }
30
+ ... on ProjectV2ItemFieldDateValue { date ${NAME} }
31
+ ... on ProjectV2ItemFieldSingleSelectValue { name optionId ${NAME} }
32
+ ... on ProjectV2ItemFieldIterationValue { title iterationId ${NAME} }
33
+ } }`;
34
+
35
+ const fieldValue = (v: unknown): string | number | null =>
36
+ optStr(v, "text") ??
37
+ optNum(v, "number") ??
38
+ optStr(v, "date") ??
39
+ optStr(v, "name") ??
40
+ optStr(v, "title");
41
+
42
+ const item = (x: unknown) => {
43
+ const c = at(x, "content");
44
+ return {
45
+ id: str(x, "id"),
46
+ type: str(x, "type"),
47
+ archived: bool(x, "isArchived"),
48
+ contentId: optStr(c, "id"),
49
+ title: optStr(c, "title"),
50
+ number: optNum(c, "number"),
51
+ state: optStr(c, "issueState") ?? optStr(c, "prState"),
52
+ repo: optStr(c, "repository", "nameWithOwner"),
53
+ url: optStr(c, "url"),
54
+ fields: Object.fromEntries(
55
+ nodes(x, "fieldValues").flatMap((v) => {
56
+ const name = optStr(v, "field", "name");
57
+ const value = fieldValue(v);
58
+ return name === null || value === null ? [] : [[name, value]];
59
+ }),
60
+ ),
61
+ };
62
+ };
63
+
64
+ const itemInput = { owner: ownerField, number: projectNumberField };
65
+
66
+ export const projectItemOps = (gh: GitHub) => ({
67
+ itemList: op({
68
+ description:
69
+ "Items of a project with their issue/PR/draft content and field values by field name. Replaces `gh project item-list`.",
70
+ input: s.object({
71
+ ...itemInput,
72
+ query: s.optional(
73
+ s.string({
74
+ description:
75
+ 'Projects filter syntax, e.g. "assignee:octocat -status:Done".',
76
+ }),
77
+ ),
78
+ limit: limitField(30),
79
+ }),
80
+ annotations: reads,
81
+ run: async ({ owner, number, query, limit }) => {
82
+ let login = owner;
83
+ const raw = await collect(limit ?? 30, async (first, after) => {
84
+ const r = await projectQuery(
85
+ gh,
86
+ owner,
87
+ number,
88
+ `items(first: $first, after: $after, query: $query) { nodes { ${ITEM} } ${pageInfo} }`,
89
+ {
90
+ decl: "$first: Int!, $after: String, $query: String",
91
+ vars: { first, after, query: query ?? null },
92
+ },
93
+ );
94
+ login = r.login;
95
+ return at(r.project, "items");
96
+ });
97
+ return { owner: login, number, items: raw.map(item) };
98
+ },
99
+ }),
100
+ itemAdd: op({
101
+ description:
102
+ "Add an issue or pull request to a project by its URL; adding one already there returns the existing item. Replaces `gh project item-add`.",
103
+ input: s.object({
104
+ ...itemInput,
105
+ url: s.string({ description: "Issue or pull request URL." }),
106
+ }),
107
+ annotations: writes,
108
+ run: async ({ owner, number, url }) => {
109
+ const data = await projectGraphql(
110
+ gh,
111
+ "query($url: URI!) { resource(url: $url) { ... on Issue { id } ... on PullRequest { id } } }",
112
+ { url },
113
+ );
114
+ const contentId = optStr(data, "resource", "id");
115
+ if (contentId === null)
116
+ throw new SurfaceError(
117
+ "not_found",
118
+ `${url} is not an issue or pull request this token can see`,
119
+ "pass the full github.com URL of an issue or pull request",
120
+ );
121
+ const { id } = await resolveProject(gh, owner, number);
122
+ const result = await mutate(
123
+ gh,
124
+ "addProjectV2ItemById",
125
+ { projectId: id, contentId },
126
+ `item { ${ITEM} }`,
127
+ );
128
+ return item(at(result, "item"));
129
+ },
130
+ }),
131
+ itemCreate: op({
132
+ description:
133
+ "Create a draft issue item in a project. Replaces `gh project item-create`.",
134
+ input: s.object({
135
+ ...itemInput,
136
+ title: s.string(),
137
+ body: s.optional(s.string()),
138
+ }),
139
+ annotations: writes,
140
+ run: async ({ owner, number, title, body }) => {
141
+ const { id } = await resolveProject(gh, owner, number);
142
+ const result = await mutate(
143
+ gh,
144
+ "addProjectV2DraftIssue",
145
+ { projectId: id, title, ...(body === undefined ? {} : { body }) },
146
+ `projectItem { ${ITEM} }`,
147
+ );
148
+ return item(at(result, "projectItem"));
149
+ },
150
+ }),
151
+ itemEdit: itemEditOp(gh),
152
+ itemArchive: op({
153
+ description:
154
+ "Archive a project item, or restore it with `undo`. Replaces `gh project item-archive [--undo]`.",
155
+ input: s.object({
156
+ ...itemInput,
157
+ id: itemIdField,
158
+ undo: s.optional(s.boolean({ description: "true to unarchive." })),
159
+ }),
160
+ annotations: writes,
161
+ run: async ({ owner, number, id, undo }) => {
162
+ const p = await resolveProject(gh, owner, number);
163
+ const result = await mutate(
164
+ gh,
165
+ undo === true ? "unarchiveProjectV2Item" : "archiveProjectV2Item",
166
+ { projectId: p.id, itemId: id },
167
+ "item { id isArchived }",
168
+ );
169
+ return {
170
+ id: str(result, "item", "id"),
171
+ archived: bool(result, "item", "isArchived"),
172
+ };
173
+ },
174
+ }),
175
+ itemDelete: op({
176
+ description:
177
+ "Remove an item from a project (a draft issue is destroyed; an issue or PR itself stays). Replaces `gh project item-delete`.",
178
+ input: s.object({ ...itemInput, id: itemIdField }),
179
+ annotations: irreversible,
180
+ run: async ({ owner, number, id }) => {
181
+ const p = await resolveProject(gh, owner, number);
182
+ const result = await mutate(
183
+ gh,
184
+ "deleteProjectV2Item",
185
+ { projectId: p.id, itemId: id },
186
+ "deletedItemId",
187
+ );
188
+ return { id: str(result, "deletedItemId"), deleted: true };
189
+ },
190
+ }),
191
+ });
@@ -0,0 +1,104 @@
1
+ // Linking a project to a repository or an organization team, and undoing it.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import {
6
+ mutate,
7
+ ownerField,
8
+ projectGraphql,
9
+ projectNumberField,
10
+ resolveProject,
11
+ } from "./project-ref.ts";
12
+ import { at, str } from "./read.ts";
13
+
14
+ const target = async (
15
+ gh: GitHub,
16
+ owner: string,
17
+ repo: string | undefined,
18
+ team: string | undefined,
19
+ ) => {
20
+ if (repo !== undefined && team !== undefined)
21
+ throw new SurfaceError(
22
+ "usage",
23
+ "pass repo or team, not both",
24
+ "link one target per call",
25
+ );
26
+ if (team !== undefined) {
27
+ if (owner === "@me")
28
+ throw new SurfaceError(
29
+ "usage",
30
+ "teams belong to organizations; @me has none",
31
+ "pass the organization login as owner",
32
+ );
33
+ const data = await projectGraphql(
34
+ gh,
35
+ "query($org: String!, $slug: String!) { organization(login: $org) { team(slug: $slug) { id slug } } }",
36
+ { org: owner, slug: team },
37
+ );
38
+ if (at(data, "organization", "team") == null)
39
+ throw new SurfaceError(
40
+ "not_found",
41
+ `team ${owner}/${team} not found`,
42
+ "pass the team slug of the project's organization",
43
+ );
44
+ return {
45
+ kind: "team",
46
+ id: str(data, "organization", "team", "id"),
47
+ name: `${owner}/${team}`,
48
+ } as const;
49
+ }
50
+ const r = await gh.repo(repo);
51
+ const data = await projectGraphql(
52
+ gh,
53
+ "query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { id } }",
54
+ { owner: r.owner, name: r.name },
55
+ );
56
+ return {
57
+ kind: "repo",
58
+ id: str(data, "repository", "id"),
59
+ name: r.full,
60
+ } as const;
61
+ };
62
+
63
+ export const linkOp = (gh: GitHub, action: "link" | "unlink") =>
64
+ op({
65
+ description:
66
+ action === "link"
67
+ ? "Link a project to a repository (default: the current repo) or to an organization team. Replaces `gh project link`."
68
+ : "Unlink a project from a repository (default: the current repo) or from an organization team. Replaces `gh project unlink`.",
69
+ input: s.object({
70
+ owner: ownerField,
71
+ number: projectNumberField,
72
+ repo: s.optional(
73
+ s.string({
74
+ description:
75
+ "owner/name to link. Defaults to the git origin of the current directory.",
76
+ }),
77
+ ),
78
+ team: s.optional(
79
+ s.string({ description: "Team slug in the owner organization." }),
80
+ ),
81
+ }),
82
+ annotations: writes,
83
+ run: async ({ owner, number, repo, team }) => {
84
+ const to = await target(gh, owner, repo, team);
85
+ const project = await resolveProject(gh, owner, number);
86
+ const verb =
87
+ action === "link" ? "linkProjectV2To" : "unlinkProjectV2From";
88
+ const noun = to.kind === "team" ? "Team" : "Repository";
89
+ await mutate(
90
+ gh,
91
+ `${verb}${noun}`,
92
+ {
93
+ projectId: project.id,
94
+ [to.kind === "team" ? "teamId" : "repositoryId"]: to.id,
95
+ },
96
+ to.kind === "team" ? "team { id }" : "repository { id }",
97
+ );
98
+ return {
99
+ projectId: project.id,
100
+ [to.kind === "team" ? "team" : "repo"]: to.name,
101
+ linked: action === "link",
102
+ };
103
+ },
104
+ });
@@ -0,0 +1,145 @@
1
+ // Shared plumbing for Projects (v2): owner/number addressing, the project node id lookup, paging and the scope hint.
2
+ import { s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import type { GitHub } from "./http.ts";
4
+ import { at, bool, nodes, num, optStr, str, type Json } from "./read.ts";
5
+
6
+ export const ownerField = s.string({
7
+ description:
8
+ 'Project owner: a user or organization login, or "@me" for the authenticated user.',
9
+ });
10
+ export const projectNumberField = s.integer({
11
+ description: "Project number (the one in the project URL).",
12
+ });
13
+ export const itemIdField = s.string({
14
+ description: "Project item node id (PVTI_...), as returned by itemList.",
15
+ });
16
+
17
+ const scopeHint =
18
+ "the token needs the `project` scope (`read:project` for reads): run `gh auth refresh -s project` or mint a token with it";
19
+
20
+ // GitHub's INSUFFICIENT_SCOPES arrives from gh.graphql as a plain `graphql` error with a "fix the query" hint.
21
+ export const projectGraphql = async (
22
+ gh: GitHub,
23
+ query: string,
24
+ variables: Json,
25
+ ): Promise<Json> => {
26
+ try {
27
+ return await gh.graphql(query, variables);
28
+ } catch (error) {
29
+ if (
30
+ error instanceof SurfaceError &&
31
+ error.kind === "graphql" &&
32
+ /required scopes/.test(error.message)
33
+ )
34
+ throw new SurfaceError("forbidden", error.message, scopeHint);
35
+ throw error;
36
+ }
37
+ };
38
+
39
+ export const ownerRoot = (owner: string) =>
40
+ owner === "@me"
41
+ ? { root: "viewer", decl: "", vars: {} }
42
+ : {
43
+ root: "repositoryOwner(login: $login)",
44
+ decl: "$login: String!",
45
+ vars: { login: owner },
46
+ };
47
+
48
+ export const declare = (...decls: readonly string[]): string => {
49
+ const list = decls.filter(Boolean).join(", ");
50
+ return list === "" ? "" : `(${list})`;
51
+ };
52
+
53
+ export const missing = (what: string): SurfaceError =>
54
+ new SurfaceError(
55
+ "not_found",
56
+ `${what} not found`,
57
+ 'check owner (a login or "@me") and the project number',
58
+ );
59
+
60
+ export const resolveOwner = async (gh: GitHub, owner: string) => {
61
+ const o = ownerRoot(owner);
62
+ const data = await projectGraphql(
63
+ gh,
64
+ `query${declare(o.decl)} { owner: ${o.root} { id login } }`,
65
+ o.vars,
66
+ );
67
+ if (at(data, "owner") == null) throw missing(`owner ${owner}`);
68
+ return { id: str(data, "owner", "id"), login: str(data, "owner", "login") };
69
+ };
70
+
71
+ export const projectQuery = async (
72
+ gh: GitHub,
73
+ owner: string,
74
+ number: number,
75
+ selection = "",
76
+ extra: { readonly decl?: string; readonly vars?: Json } = {},
77
+ ) => {
78
+ const o = ownerRoot(owner);
79
+ const data = await projectGraphql(
80
+ gh,
81
+ `query${declare("$number: Int!", o.decl, extra.decl ?? "")} { owner: ${o.root} { login ... on ProjectV2Owner { projectV2(number: $number) { id title ${selection} } } } }`,
82
+ { number, ...o.vars, ...extra.vars },
83
+ );
84
+ const project = at(data, "owner", "projectV2");
85
+ if (project == null) throw missing(`project ${owner}/${number}`);
86
+ return { login: str(data, "owner", "login"), project };
87
+ };
88
+
89
+ export const resolveProject = async (
90
+ gh: GitHub,
91
+ owner: string,
92
+ number: number,
93
+ ) => {
94
+ const { project } = await projectQuery(gh, owner, number);
95
+ return { id: str(project, "id"), title: str(project, "title") };
96
+ };
97
+
98
+ export const collect = async (
99
+ limit: number,
100
+ page: (first: number, after: string | null) => Promise<unknown>,
101
+ keep: (node: unknown) => boolean = () => true,
102
+ ): Promise<unknown[]> => {
103
+ const out: unknown[] = [];
104
+ let after: string | null = null;
105
+ while (out.length < limit) {
106
+ const conn = await page(Math.min(100, limit - out.length), after);
107
+ out.push(...nodes(conn).filter(keep));
108
+ after = optStr(conn, "pageInfo", "endCursor");
109
+ if (!bool(conn, "pageInfo", "hasNextPage") || after === null) break;
110
+ }
111
+ return out.slice(0, limit);
112
+ };
113
+
114
+ export const mutate = async (
115
+ gh: GitHub,
116
+ name: string,
117
+ input: Json,
118
+ selection: string,
119
+ ): Promise<unknown> => {
120
+ const inputType = `${name.charAt(0).toUpperCase()}${name.slice(1)}Input`;
121
+ const data = await projectGraphql(
122
+ gh,
123
+ `mutation($input: ${inputType}!) { result: ${name}(input: $input) { ${selection} } }`,
124
+ { input },
125
+ );
126
+ return at(data, "result");
127
+ };
128
+
129
+ export const pageInfo = "pageInfo { hasNextPage endCursor }";
130
+
131
+ export const PROJECT_FIELDS =
132
+ "id number title shortDescription public closed template url createdAt updatedAt";
133
+
134
+ export const projectSummary = (x: unknown) => ({
135
+ id: str(x, "id"),
136
+ number: num(x, "number"),
137
+ title: str(x, "title"),
138
+ description: optStr(x, "shortDescription"),
139
+ public: bool(x, "public"),
140
+ closed: bool(x, "closed"),
141
+ template: bool(x, "template"),
142
+ url: str(x, "url"),
143
+ createdAt: optStr(x, "createdAt"),
144
+ updatedAt: optStr(x, "updatedAt"),
145
+ });
@@ -0,0 +1,99 @@
1
+ // Changing an existing project: title, description, readme and visibility; closed; template mark.
2
+ import { op, s, SurfaceError } from "../vendor/surface/index.ts";
3
+ import { writes } from "./fields.ts";
4
+ import type { GitHub } from "./http.ts";
5
+ import {
6
+ mutate,
7
+ ownerField,
8
+ PROJECT_FIELDS,
9
+ projectNumberField,
10
+ projectSummary,
11
+ resolveProject,
12
+ } from "./project-ref.ts";
13
+ import { at } from "./read.ts";
14
+
15
+ const update = async (
16
+ gh: GitHub,
17
+ owner: string,
18
+ number: number,
19
+ patch: Readonly<Record<string, string | boolean | undefined>>,
20
+ ) => {
21
+ const { id } = await resolveProject(gh, owner, number);
22
+ const input = Object.fromEntries(
23
+ Object.entries(patch).filter(([, v]) => v !== undefined),
24
+ );
25
+ const result = await mutate(
26
+ gh,
27
+ "updateProjectV2",
28
+ { projectId: id, ...input },
29
+ `projectV2 { ${PROJECT_FIELDS} }`,
30
+ );
31
+ return projectSummary(at(result, "projectV2"));
32
+ };
33
+
34
+ const undoField = (what: string) =>
35
+ s.optional(s.boolean({ description: `true to ${what} instead.` }));
36
+
37
+ export const projectStateOps = (gh: GitHub) => ({
38
+ edit: op({
39
+ description:
40
+ "Change a project's title, short description, readme or visibility. Replaces `gh project edit`.",
41
+ input: s.object({
42
+ owner: ownerField,
43
+ number: projectNumberField,
44
+ title: s.optional(s.string()),
45
+ description: s.optional(s.string()),
46
+ readme: s.optional(s.string()),
47
+ visibility: s.optional(s.enum(["PUBLIC", "PRIVATE"])),
48
+ }),
49
+ annotations: writes,
50
+ run: async ({ owner, number, title, description, readme, visibility }) => {
51
+ if (
52
+ [title, description, readme, visibility].every((v) => v === undefined)
53
+ )
54
+ throw new SurfaceError(
55
+ "usage",
56
+ "nothing to change",
57
+ "pass title, description, readme or visibility",
58
+ );
59
+ return update(gh, owner, number, {
60
+ title,
61
+ shortDescription: description,
62
+ readme,
63
+ public: visibility === undefined ? undefined : visibility === "PUBLIC",
64
+ });
65
+ },
66
+ }),
67
+ close: op({
68
+ description:
69
+ "Close a project, or reopen it with `undo`. Replaces `gh project close [--undo]`.",
70
+ input: s.object({
71
+ owner: ownerField,
72
+ number: projectNumberField,
73
+ undo: undoField("reopen"),
74
+ }),
75
+ annotations: writes,
76
+ run: ({ owner, number, undo }) =>
77
+ update(gh, owner, number, { closed: undo !== true }),
78
+ }),
79
+ markTemplate: op({
80
+ description:
81
+ "Mark an organization project as a template, or unmark it with `undo`. Replaces `gh project mark-template [--undo]`.",
82
+ input: s.object({
83
+ owner: ownerField,
84
+ number: projectNumberField,
85
+ undo: undoField("unmark it"),
86
+ }),
87
+ annotations: writes,
88
+ run: async ({ owner, number, undo }) => {
89
+ const { id } = await resolveProject(gh, owner, number);
90
+ const result = await mutate(
91
+ gh,
92
+ undo === true ? "unmarkProjectV2AsTemplate" : "markProjectV2AsTemplate",
93
+ { projectId: id },
94
+ `projectV2 { ${PROJECT_FIELDS} }`,
95
+ );
96
+ return projectSummary(at(result, "projectV2"));
97
+ },
98
+ }),
99
+ });