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,195 @@
1
+ // Command-line flags from an input schema: each top-level property is `--kebab-name`, typed by
2
+ // its schema. `--json '{...}'` (or `--input file`, `-` for stdin) supplies the whole input, and
3
+ // flags given beside it override its fields. A field its schema marks `writeOnly` is a secret: other
4
+ // processes can read an argument list, so it is accepted only through `--input`.
5
+ import { SurfaceError } from "./surface.ts";
6
+ import type { JsonSchema } from "./schema.ts";
7
+
8
+ export type Property = {
9
+ readonly name: string;
10
+ readonly flag: string;
11
+ readonly schema: JsonSchema;
12
+ readonly required: boolean;
13
+ };
14
+
15
+ const isObject = (
16
+ value: unknown,
17
+ ): value is { readonly [key: string]: unknown } =>
18
+ typeof value === "object" && value !== null && !Array.isArray(value);
19
+
20
+ export const kebab = (name: string): string =>
21
+ name
22
+ .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
23
+ .replaceAll("_", "-")
24
+ .toLowerCase();
25
+
26
+ export const propertiesOf = (schema: JsonSchema): readonly Property[] => {
27
+ const properties = isObject(schema["properties"]) ? schema["properties"] : {};
28
+ const required = Array.isArray(schema["required"]) ? schema["required"] : [];
29
+ return Object.entries(properties).map(([name, value]) => ({
30
+ name,
31
+ flag: kebab(name),
32
+ schema: isObject(value) ? value : {},
33
+ required: required.includes(name),
34
+ }));
35
+ };
36
+
37
+ const kindOf = (schema: JsonSchema): string => {
38
+ const kind = schema["type"];
39
+ if (typeof kind === "string") return kind;
40
+ if (Array.isArray(kind))
41
+ return kind.find((each) => each !== "null") ?? "json";
42
+ return Array.isArray(schema["enum"]) ? "string" : "json";
43
+ };
44
+
45
+ export const typeLabel = (schema: JsonSchema): string => {
46
+ if (Array.isArray(schema["enum"]))
47
+ return schema["enum"].map(String).join("|");
48
+ const kind = kindOf(schema);
49
+ if (kind === "array")
50
+ return `${typeLabel(isObject(schema["items"]) ? schema["items"] : {})}...`;
51
+ return kind === "object" ? "json" : kind;
52
+ };
53
+
54
+ const parseJson = (text: string, what: string): unknown => {
55
+ try {
56
+ return JSON.parse(text);
57
+ } catch {
58
+ throw new SurfaceError(
59
+ "usage",
60
+ `${what} is not valid JSON (${text.length} characters given)`,
61
+ "check the quoting, or pass the input with --input <file|->",
62
+ );
63
+ }
64
+ };
65
+
66
+ const secretInArgv = (flag: string): SurfaceError =>
67
+ new SurfaceError(
68
+ "usage",
69
+ `--${flag} is a secret and cannot be passed as an argument`,
70
+ "pass the whole input on stdin with --input -, or from a file with --input <file>",
71
+ );
72
+
73
+ const scalar = (schema: JsonSchema, raw: string, flag: string): unknown => {
74
+ const kind = kindOf(schema);
75
+ if (kind === "string") return raw;
76
+ if (kind === "boolean") {
77
+ if (raw === "true" || raw === "false") return raw === "true";
78
+ throw new SurfaceError(
79
+ "usage",
80
+ `--${flag} takes true or false, not ${raw}`,
81
+ );
82
+ }
83
+ if (kind === "number" || kind === "integer") {
84
+ const value = Number(raw);
85
+ if (raw.trim() === "" || !Number.isFinite(value)) {
86
+ throw new SurfaceError("usage", `--${flag} takes a number, not ${raw}`);
87
+ }
88
+ return value;
89
+ }
90
+ return parseJson(raw, `--${flag}`);
91
+ };
92
+
93
+ export type Parsed = {
94
+ readonly input: Readonly<Record<string, unknown>>;
95
+ readonly help: boolean;
96
+ };
97
+
98
+ export const parseFlags = async (
99
+ schema: JsonSchema,
100
+ argv: readonly string[],
101
+ readStdin: () => Promise<string>,
102
+ ): Promise<Parsed> => {
103
+ const properties = propertiesOf(schema);
104
+ const byFlag = new Map(properties.map((each) => [each.flag, each]));
105
+ const secrets = properties.filter(
106
+ (each) => each.schema["writeOnly"] === true,
107
+ );
108
+ let base: Readonly<Record<string, unknown>> = {};
109
+ const given: Record<string, unknown> = {};
110
+ let help = false;
111
+ for (let at = 0; at < argv.length; at += 1) {
112
+ const token = argv[at] ?? "";
113
+ if (token === "--help" || token === "-h") {
114
+ help = true;
115
+ continue;
116
+ }
117
+ if (!token.startsWith("--")) {
118
+ throw new SurfaceError(
119
+ "usage",
120
+ `unexpected argument ${token}`,
121
+ "inputs are --flags",
122
+ );
123
+ }
124
+ const [name = "", inline] = token.slice(2).split(/=(.*)/s, 2);
125
+ const next = (): string => {
126
+ if (inline !== undefined) return inline;
127
+ const value = argv[at + 1];
128
+ if (value === undefined)
129
+ throw new SurfaceError("usage", `--${name} needs a value`);
130
+ at += 1;
131
+ return value;
132
+ };
133
+ if (name === "json" || name === "input") {
134
+ const source = next();
135
+ const text =
136
+ name === "json"
137
+ ? source
138
+ : source === "-"
139
+ ? await readStdin()
140
+ : await Bun.file(source).text();
141
+ const value = parseJson(text, `--${name}`);
142
+ if (!isObject(value))
143
+ throw new SurfaceError("usage", `--${name} must be a JSON object`);
144
+ const carried = secrets.find((each) => each.name in value);
145
+ if (name === "json" && carried !== undefined)
146
+ throw secretInArgv(carried.flag);
147
+ base = value;
148
+ continue;
149
+ }
150
+ const negated = name.startsWith("no-")
151
+ ? byFlag.get(name.slice(3))
152
+ : undefined;
153
+ if (
154
+ negated !== undefined &&
155
+ kindOf(negated.schema) === "boolean" &&
156
+ inline === undefined
157
+ ) {
158
+ given[negated.name] = false;
159
+ continue;
160
+ }
161
+ const property = byFlag.get(name);
162
+ if (property === undefined) {
163
+ const known =
164
+ [...byFlag.keys()].map((flag) => `--${flag}`).join(", ") || "none";
165
+ throw new SurfaceError(
166
+ "usage",
167
+ `unknown flag --${name}`,
168
+ `flags: ${known}, --json, --input`,
169
+ );
170
+ }
171
+ if (secrets.includes(property)) throw secretInArgv(property.flag);
172
+ const kind = kindOf(property.schema);
173
+ if (
174
+ kind === "boolean" &&
175
+ inline === undefined &&
176
+ !["true", "false"].includes(argv[at + 1] ?? "")
177
+ ) {
178
+ given[property.name] = true;
179
+ continue;
180
+ }
181
+ if (kind === "array") {
182
+ const items = isObject(property.schema["items"])
183
+ ? property.schema["items"]
184
+ : {};
185
+ const previous = given[property.name];
186
+ given[property.name] = [
187
+ ...(Array.isArray(previous) ? previous : []),
188
+ scalar(items, next(), name),
189
+ ];
190
+ continue;
191
+ }
192
+ given[property.name] = scalar(property.schema, next(), name);
193
+ }
194
+ return { input: { ...base, ...given }, help };
195
+ };
@@ -0,0 +1,89 @@
1
+ // The text `--help` prints: the overview of a surface or a group, one operation's flags, and the
2
+ // `mcp` command. It is built from the surface definition and the caller's label, and the command
3
+ // line prints it through its redactor like everything else.
4
+ import { propertiesOf, typeLabel } from "./flags.ts";
5
+ import { toolName } from "./mcp.ts";
6
+ import {
7
+ isOp,
8
+ type AnyOp,
9
+ type Ops,
10
+ type SurfaceDefinition,
11
+ } from "./surface.ts";
12
+
13
+ const firstLine = (text: string): string => text.split("\n")[0] ?? "";
14
+
15
+ const listing = (
16
+ ops: Ops,
17
+ prefix: readonly string[],
18
+ depth: number,
19
+ ): string[] =>
20
+ Object.entries(ops).flatMap(([name, value]) => {
21
+ const path = [...prefix, name].join(" ");
22
+ return isOp(value)
23
+ ? [` ${path.padEnd(28)} ${firstLine(value.description)}`]
24
+ : depth > 0
25
+ ? listing(value, [...prefix, name], depth - 1)
26
+ : [
27
+ ` ${path.padEnd(28)} (${Object.keys(value).length} commands: ${path} --help)`,
28
+ ];
29
+ });
30
+
31
+ export const overview = (
32
+ surface: SurfaceDefinition<Ops>,
33
+ cli: string,
34
+ ops: Ops,
35
+ prefix: readonly string[],
36
+ ): string =>
37
+ [
38
+ prefix.length === 0
39
+ ? `${surface.name} ${surface.version}${surface.description === undefined ? "" : `: ${surface.description}`}`
40
+ : `${cli} ${prefix.join(" ")}`,
41
+ "",
42
+ `usage: ${cli} ${[...prefix, "<command>"].join(" ")} [--flags | --json '{...}' | --input file]`,
43
+ "",
44
+ "commands:",
45
+ ...listing(ops, prefix, prefix.length === 0 ? 0 : 1),
46
+ ...(prefix.length === 0
47
+ ? [
48
+ ` ${"mcp".padEnd(28)} serve every command as an MCP server (mcp --help)`,
49
+ ]
50
+ : []),
51
+ ].join("\n");
52
+
53
+ export const opHelp = (
54
+ cli: string,
55
+ path: readonly string[],
56
+ op: AnyOp,
57
+ ): string => {
58
+ const flags = propertiesOf(op.input.json).map((each) => {
59
+ const said =
60
+ typeof each.schema["description"] === "string"
61
+ ? each.schema["description"]
62
+ : "";
63
+ const secret =
64
+ each.schema["writeOnly"] === true ? "(secret: --input only) " : "";
65
+ return ` --${`${each.flag} <${typeLabel(each.schema)}>`.padEnd(34)} ${each.required ? "(required) " : ""}${secret}${firstLine(said)}`;
66
+ });
67
+ const hints = Object.entries(op.annotations ?? {})
68
+ .filter(([, on]) => on)
69
+ .map(([hint]) => hint);
70
+ return [
71
+ `${cli} ${path.join(" ")}: ${op.description}`,
72
+ "",
73
+ ...(flags.length === 0 ? ["takes no input"] : ["flags:", ...flags]),
74
+ " --json <object>, --input <file|-> the whole input as JSON; flags override its fields",
75
+ "",
76
+ `mcp tool: ${toolName(path)}${hints.length === 0 ? "" : ` (${hints.join(", ")})`}`,
77
+ ].join("\n");
78
+ };
79
+
80
+ export const mcpHelp = (cli: string): string =>
81
+ [
82
+ `usage: ${cli} mcp [--http --token-env NAME] [--host 127.0.0.1] [--port 0] [--path /mcp]`,
83
+ " [--read-only] [--only pattern,...] [--exclude pattern,...]",
84
+ "",
85
+ "stdio by default (one JSON-RPC message per line). --http serves Streamable HTTP and prints",
86
+ "its URL on stderr. It is plain HTTP, so it serves loopback only and every request must carry",
87
+ "`Authorization: Bearer <the value of $NAME>` (--token-env NAME is required with --http).",
88
+ "Speaks MCP 2026-07-28 (stateless) and the initialize-based revisions back to 2024-11-05.",
89
+ ].join("\n");
@@ -0,0 +1,180 @@
1
+ // The Streamable HTTP binding, JSON responses only (no operation streams). Modern requests are
2
+ // checked against the MCP-Protocol-Version, Mcp-Method and Mcp-Name headers; a request without
3
+ // modern `_meta` is served under legacy semantics with no session, which those revisions allow.
4
+ // It speaks plain HTTP, so it binds to loopback only, refuses a foreign Origin (DNS rebinding) and
5
+ // requires a bearer token on every request: without one, any local process, another user's
6
+ // included, could run the surface's operations with this process's credentials.
7
+ import { createHash, timingSafeEqual } from "node:crypto";
8
+ import { ERRORS, type McpHandler, type Reply } from "./mcp.ts";
9
+ import { SurfaceError } from "./surface.ts";
10
+
11
+ export type HttpOptions = {
12
+ readonly hostname?: string;
13
+ readonly port?: number;
14
+ readonly path?: string;
15
+ /** Required on every request as `Authorization: Bearer <token>`. */
16
+ readonly token: string;
17
+ };
18
+
19
+ export type HttpServer = {
20
+ readonly url: string;
21
+ readonly stop: () => Promise<void>;
22
+ };
23
+
24
+ const LOOPBACK = new Set(["127.0.0.1", "::1", "localhost"]);
25
+ const META_VERSION = "io.modelcontextprotocol/protocolVersion";
26
+
27
+ const isObject = (
28
+ value: unknown,
29
+ ): value is { readonly [key: string]: unknown } =>
30
+ typeof value === "object" && value !== null && !Array.isArray(value);
31
+
32
+ const decoded = (header: string): string => {
33
+ const match = /^=\?base64\?(.*)\?=$/s.exec(header);
34
+ return match === null
35
+ ? header
36
+ : Buffer.from(match[1] ?? "", "base64").toString("utf8");
37
+ };
38
+
39
+ const json = (body: unknown, status: number): Response =>
40
+ Response.json(body, { status, headers: { "cache-control": "no-store" } });
41
+
42
+ const refuse = (
43
+ id: unknown,
44
+ status: number,
45
+ code: number,
46
+ message: string,
47
+ ): Response =>
48
+ json({ jsonrpc: "2.0", id: id ?? null, error: { code, message } }, status);
49
+
50
+ const statusOf = (reply: Reply, modern: boolean): number => {
51
+ const error = reply["error"];
52
+ if (!modern || !isObject(error)) return 200;
53
+ if (error["code"] === ERRORS.methodNotFound) return 404;
54
+ const malformed = [
55
+ ERRORS.invalidParams,
56
+ ERRORS.unsupportedVersion,
57
+ ERRORS.headerMismatch,
58
+ ];
59
+ return malformed.some((code) => code === error["code"]) ? 400 : 200;
60
+ };
61
+
62
+ const headerProblem = (
63
+ request: Request,
64
+ message: { readonly [key: string]: unknown },
65
+ ): string | undefined => {
66
+ const params = isObject(message["params"]) ? message["params"] : {};
67
+ const meta = isObject(params["_meta"]) ? params["_meta"] : {};
68
+ const version = request.headers.get("mcp-protocol-version");
69
+ if (version !== meta[META_VERSION])
70
+ return "MCP-Protocol-Version header does not match _meta";
71
+ if (request.headers.get("mcp-method") !== message["method"])
72
+ return "Mcp-Method header does not match the body";
73
+ const named = message["method"] === "tools/call";
74
+ const name = request.headers.get("mcp-name");
75
+ if (named && (name === null || decoded(name) !== params["name"]))
76
+ return "Mcp-Name header does not match params.name";
77
+ return undefined;
78
+ };
79
+
80
+ const originAllowed = (request: Request): boolean => {
81
+ const origin = request.headers.get("origin");
82
+ if (origin === null) return true;
83
+ try {
84
+ return LOOPBACK.has(new URL(origin).hostname.replace(/^\[|\]$/g, ""));
85
+ } catch {
86
+ return false;
87
+ }
88
+ };
89
+
90
+ const digest = (text: string): Buffer =>
91
+ createHash("sha256").update(text).digest();
92
+
93
+ export const serveHttp = (
94
+ handler: McpHandler,
95
+ options: HttpOptions,
96
+ ): HttpServer => {
97
+ const hostname = options.hostname ?? "127.0.0.1";
98
+ const path = options.path ?? "/mcp";
99
+ if (!LOOPBACK.has(hostname)) {
100
+ throw new SurfaceError(
101
+ "usage",
102
+ `serving on ${hostname} is refused: only loopback is served, because this is plain HTTP`,
103
+ "bind 127.0.0.1 and reach it through an SSH tunnel or a proxy that terminates TLS",
104
+ );
105
+ }
106
+ // Checked at run time as well: a caller without the types must not end up serving "Bearer undefined".
107
+ const token: unknown = options.token;
108
+ if (typeof token !== "string" || token === "") {
109
+ throw new SurfaceError(
110
+ "usage",
111
+ "the HTTP server needs a bearer token",
112
+ "set one with --token-env NAME",
113
+ );
114
+ }
115
+ const expected = digest(`Bearer ${token}`);
116
+ const authorized = (request: Request): boolean =>
117
+ timingSafeEqual(
118
+ digest(request.headers.get("authorization") ?? ""),
119
+ expected,
120
+ );
121
+ const server = Bun.serve({
122
+ hostname,
123
+ port: options.port ?? 0,
124
+ // Whatever a handler throws stays in this process: the default error page would print it.
125
+ error: () => refuse(null, 500, ERRORS.internal, "Internal error"),
126
+ fetch: async (request) => {
127
+ if (new URL(request.url).pathname !== path)
128
+ return new Response("not found", { status: 404 });
129
+ if (!originAllowed(request))
130
+ return refuse(null, 403, ERRORS.invalidRequest, "Origin not allowed");
131
+ if (!authorized(request)) {
132
+ return new Response("unauthorized", {
133
+ status: 401,
134
+ headers: { "www-authenticate": "Bearer" },
135
+ });
136
+ }
137
+ if (request.method !== "POST")
138
+ return new Response("method not allowed", {
139
+ status: 405,
140
+ headers: { allow: "POST" },
141
+ });
142
+ let message: unknown;
143
+ try {
144
+ message = await request.json();
145
+ } catch {
146
+ return refuse(null, 400, ERRORS.parse, "Parse error");
147
+ }
148
+ if (!isObject(message))
149
+ return refuse(null, 400, ERRORS.invalidRequest, "Invalid Request");
150
+ const params = isObject(message["params"]) ? message["params"] : {};
151
+ const modern =
152
+ isObject(params["_meta"]) && META_VERSION in params["_meta"];
153
+ if (modern) {
154
+ const problem = headerProblem(request, message);
155
+ // This reply echoes the caller's id and never reaches the handler, so it is redacted here.
156
+ if (problem !== undefined)
157
+ return json(
158
+ await handler.redact({
159
+ jsonrpc: "2.0",
160
+ id: message["id"] ?? null,
161
+ error: {
162
+ code: ERRORS.headerMismatch,
163
+ message: `Header mismatch: ${problem}`,
164
+ },
165
+ }),
166
+ 400,
167
+ );
168
+ }
169
+ const reply = await handler.handle(message, {
170
+ legacy: modern ? undefined : "stateless",
171
+ });
172
+ if (reply === undefined) return new Response(null, { status: 202 });
173
+ return json(reply, statusOf(reply, modern));
174
+ },
175
+ });
176
+ return {
177
+ url: `http://${hostname.includes(":") ? `[${hostname}]` : hostname}:${server.port}${path}`,
178
+ stop: () => server.stop(true),
179
+ };
180
+ };
@@ -0,0 +1,44 @@
1
+ export { s, problems, conforms } from "./schema.ts";
2
+ export type {
3
+ Doc,
4
+ Infer,
5
+ JsonSchema,
6
+ ObjectOf,
7
+ Schema,
8
+ Shape,
9
+ } from "./schema.ts";
10
+ export {
11
+ bind,
12
+ defineSurface,
13
+ describeError,
14
+ entries,
15
+ internalError,
16
+ isOp,
17
+ op,
18
+ secretTally,
19
+ SurfaceError,
20
+ } from "./surface.ts";
21
+ export type {
22
+ Annotations,
23
+ AnyOp,
24
+ Client,
25
+ Described,
26
+ Entry,
27
+ Op,
28
+ Ops,
29
+ SurfaceDefinition,
30
+ } from "./surface.ts";
31
+ export { runCli } from "./cli.ts";
32
+ export type { CliIo } from "./cli.ts";
33
+ export {
34
+ ERRORS,
35
+ LEGACY_VERSIONS,
36
+ MODERN_VERSIONS,
37
+ mcpHandler,
38
+ toolName,
39
+ } from "./mcp.ts";
40
+ export type { Connection, McpHandler, McpOptions, Reply, Tool } from "./mcp.ts";
41
+ export { serveStdio } from "./stdio.ts";
42
+ export type { StdioStreams } from "./stdio.ts";
43
+ export { serveHttp } from "./http.ts";
44
+ export type { HttpOptions, HttpServer } from "./http.ts";