@lovrozagar/honey-clients 0.0.0 → 1.0.0-rc.3

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 (533) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +438 -0
  3. package/bin/honey-clients.js +94 -0
  4. package/dist/cli.d.ts +44 -0
  5. package/dist/cli.js +204 -0
  6. package/dist/emit/cli/commands.d.ts +27 -0
  7. package/dist/emit/cli/commands.js +187 -0
  8. package/dist/emit/cli/discovery.d.ts +35 -0
  9. package/dist/emit/cli/discovery.js +202 -0
  10. package/dist/emit/cli/flags.d.ts +59 -0
  11. package/dist/emit/cli/flags.js +186 -0
  12. package/dist/emit/cli/index.d.ts +1 -0
  13. package/dist/emit/cli/index.js +1 -0
  14. package/dist/emit/cli/install-ps1.d.ts +8 -0
  15. package/dist/emit/cli/install-ps1.js +111 -0
  16. package/dist/emit/cli/install.d.ts +32 -0
  17. package/dist/emit/cli/install.js +216 -0
  18. package/dist/emit/cli/layout.d.ts +23 -0
  19. package/dist/emit/cli/layout.js +118 -0
  20. package/dist/emit/cli/module.d.ts +24 -0
  21. package/dist/emit/cli/module.js +184 -0
  22. package/dist/emit/cli/release.d.ts +25 -0
  23. package/dist/emit/cli/release.js +114 -0
  24. package/dist/emit/cli/skills.d.ts +11 -0
  25. package/dist/emit/cli/skills.js +56 -0
  26. package/dist/emit/csharp/errors.d.ts +7 -0
  27. package/dist/emit/csharp/errors.js +69 -0
  28. package/dist/emit/csharp/index.d.ts +1 -0
  29. package/dist/emit/csharp/index.js +1 -0
  30. package/dist/emit/csharp/json.d.ts +13 -0
  31. package/dist/emit/csharp/json.js +113 -0
  32. package/dist/emit/csharp/realtime.d.ts +10 -0
  33. package/dist/emit/csharp/realtime.js +33 -0
  34. package/dist/emit/csharp/sdk-answer.d.ts +48 -0
  35. package/dist/emit/csharp/sdk-answer.js +85 -0
  36. package/dist/emit/csharp/sdk-body.d.ts +10 -0
  37. package/dist/emit/csharp/sdk-body.js +87 -0
  38. package/dist/emit/csharp/sdk-client.d.ts +32 -0
  39. package/dist/emit/csharp/sdk-client.js +177 -0
  40. package/dist/emit/csharp/sdk-csproj.d.ts +20 -0
  41. package/dist/emit/csharp/sdk-csproj.js +67 -0
  42. package/dist/emit/csharp/sdk-doc.d.ts +12 -0
  43. package/dist/emit/csharp/sdk-doc.js +35 -0
  44. package/dist/emit/csharp/sdk-method.d.ts +26 -0
  45. package/dist/emit/csharp/sdk-method.js +187 -0
  46. package/dist/emit/csharp/sdk-plan.d.ts +38 -0
  47. package/dist/emit/csharp/sdk-plan.js +1 -0
  48. package/dist/emit/csharp/sdk.d.ts +23 -0
  49. package/dist/emit/csharp/sdk.js +97 -0
  50. package/dist/emit/csharp/sse.d.ts +18 -0
  51. package/dist/emit/csharp/sse.js +29 -0
  52. package/dist/emit/csharp/transport.d.ts +11 -0
  53. package/dist/emit/csharp/transport.js +67 -0
  54. package/dist/emit/csharp/types-enum.d.ts +19 -0
  55. package/dist/emit/csharp/types-enum.js +63 -0
  56. package/dist/emit/csharp/types-names.d.ts +33 -0
  57. package/dist/emit/csharp/types-names.js +182 -0
  58. package/dist/emit/csharp/types-record.d.ts +25 -0
  59. package/dist/emit/csharp/types-record.js +65 -0
  60. package/dist/emit/csharp/types-union.d.ts +27 -0
  61. package/dist/emit/csharp/types-union.js +113 -0
  62. package/dist/emit/csharp/types.d.ts +36 -0
  63. package/dist/emit/csharp/types.js +126 -0
  64. package/dist/emit/csharp/ws.d.ts +20 -0
  65. package/dist/emit/csharp/ws.js +14 -0
  66. package/dist/emit/go/errors.d.ts +7 -0
  67. package/dist/emit/go/errors.js +44 -0
  68. package/dist/emit/go/http.d.ts +11 -0
  69. package/dist/emit/go/http.js +50 -0
  70. package/dist/emit/go/index.d.ts +1 -0
  71. package/dist/emit/go/index.js +1 -0
  72. package/dist/emit/go/sdk-answer.d.ts +28 -0
  73. package/dist/emit/go/sdk-answer.js +41 -0
  74. package/dist/emit/go/sdk-body.d.ts +24 -0
  75. package/dist/emit/go/sdk-body.js +76 -0
  76. package/dist/emit/go/sdk-client.d.ts +29 -0
  77. package/dist/emit/go/sdk-client.js +141 -0
  78. package/dist/emit/go/sdk-method.d.ts +68 -0
  79. package/dist/emit/go/sdk-method.js +172 -0
  80. package/dist/emit/go/sdk-mirror.d.ts +23 -0
  81. package/dist/emit/go/sdk-mirror.js +97 -0
  82. package/dist/emit/go/sdk-opts.d.ts +55 -0
  83. package/dist/emit/go/sdk-opts.js +100 -0
  84. package/dist/emit/go/sdk.d.ts +21 -0
  85. package/dist/emit/go/sdk.js +107 -0
  86. package/dist/emit/go/sse.d.ts +16 -0
  87. package/dist/emit/go/sse.js +26 -0
  88. package/dist/emit/go/types-codec.d.ts +15 -0
  89. package/dist/emit/go/types-codec.js +171 -0
  90. package/dist/emit/go/types-names.d.ts +14 -0
  91. package/dist/emit/go/types-names.js +64 -0
  92. package/dist/emit/go/types-struct.d.ts +29 -0
  93. package/dist/emit/go/types-struct.js +65 -0
  94. package/dist/emit/go/types-union.d.ts +17 -0
  95. package/dist/emit/go/types-union.js +84 -0
  96. package/dist/emit/go/types.d.ts +32 -0
  97. package/dist/emit/go/types.js +177 -0
  98. package/dist/emit/go/ws.d.ts +12 -0
  99. package/dist/emit/go/ws.js +70 -0
  100. package/dist/emit/java/gradle.d.ts +35 -0
  101. package/dist/emit/java/gradle.js +154 -0
  102. package/dist/emit/java/index.d.ts +2 -0
  103. package/dist/emit/java/index.js +2 -0
  104. package/dist/emit/java/json.d.ts +13 -0
  105. package/dist/emit/java/json.js +84 -0
  106. package/dist/emit/java/layout-ast.d.ts +146 -0
  107. package/dist/emit/java/layout-ast.js +102 -0
  108. package/dist/emit/java/layout-decl.d.ts +20 -0
  109. package/dist/emit/java/layout-decl.js +155 -0
  110. package/dist/emit/java/layout-doc.d.ts +55 -0
  111. package/dist/emit/java/layout-doc.js +166 -0
  112. package/dist/emit/java/layout-dot.d.ts +18 -0
  113. package/dist/emit/java/layout-dot.js +127 -0
  114. package/dist/emit/java/layout-strings.d.ts +8 -0
  115. package/dist/emit/java/layout-strings.js +76 -0
  116. package/dist/emit/java/layout-types.d.ts +11 -0
  117. package/dist/emit/java/layout-types.js +95 -0
  118. package/dist/emit/java/layout-visitor.d.ts +38 -0
  119. package/dist/emit/java/layout-visitor.js +232 -0
  120. package/dist/emit/java/layout.d.ts +61 -0
  121. package/dist/emit/java/layout.js +121 -0
  122. package/dist/emit/java/models-enum.d.ts +17 -0
  123. package/dist/emit/java/models-enum.js +51 -0
  124. package/dist/emit/java/models-names.d.ts +29 -0
  125. package/dist/emit/java/models-names.js +97 -0
  126. package/dist/emit/java/models-record.d.ts +24 -0
  127. package/dist/emit/java/models-record.js +79 -0
  128. package/dist/emit/java/models-union.d.ts +27 -0
  129. package/dist/emit/java/models-union.js +86 -0
  130. package/dist/emit/java/models.d.ts +28 -0
  131. package/dist/emit/java/models.js +118 -0
  132. package/dist/emit/java/realtime.d.ts +50 -0
  133. package/dist/emit/java/realtime.js +69 -0
  134. package/dist/emit/java/sdk-client.d.ts +66 -0
  135. package/dist/emit/java/sdk-client.js +207 -0
  136. package/dist/emit/java/sdk-decl.d.ts +11 -0
  137. package/dist/emit/java/sdk-decl.js +63 -0
  138. package/dist/emit/java/sdk-errors.d.ts +13 -0
  139. package/dist/emit/java/sdk-errors.js +141 -0
  140. package/dist/emit/java/sdk-headers.d.ts +12 -0
  141. package/dist/emit/java/sdk-headers.js +74 -0
  142. package/dist/emit/java/sdk-mirror.d.ts +14 -0
  143. package/dist/emit/java/sdk-mirror.js +107 -0
  144. package/dist/emit/java/sdk-models.d.ts +16 -0
  145. package/dist/emit/java/sdk-models.js +68 -0
  146. package/dist/emit/java/sdk-op.d.ts +57 -0
  147. package/dist/emit/java/sdk-op.js +216 -0
  148. package/dist/emit/java/sdk-params.d.ts +38 -0
  149. package/dist/emit/java/sdk-params.js +133 -0
  150. package/dist/emit/java/sdk-plan.d.ts +52 -0
  151. package/dist/emit/java/sdk-plan.js +1 -0
  152. package/dist/emit/java/sdk-record.d.ts +16 -0
  153. package/dist/emit/java/sdk-record.js +99 -0
  154. package/dist/emit/java/sdk.d.ts +44 -0
  155. package/dist/emit/java/sdk.js +213 -0
  156. package/dist/emit/java/sse.d.ts +35 -0
  157. package/dist/emit/java/sse.js +57 -0
  158. package/dist/emit/java/ws.d.ts +27 -0
  159. package/dist/emit/java/ws.js +31 -0
  160. package/dist/emit/mcp/annotations.d.ts +15 -0
  161. package/dist/emit/mcp/annotations.js +15 -0
  162. package/dist/emit/mcp/files.d.ts +18 -0
  163. package/dist/emit/mcp/files.js +42 -0
  164. package/dist/emit/mcp/index.d.ts +3 -0
  165. package/dist/emit/mcp/index.js +3 -0
  166. package/dist/emit/mcp/literal.d.ts +2 -0
  167. package/dist/emit/mcp/literal.js +33 -0
  168. package/dist/emit/mcp/mounted.d.ts +16 -0
  169. package/dist/emit/mcp/mounted.js +89 -0
  170. package/dist/emit/mcp/output-schema.d.ts +18 -0
  171. package/dist/emit/mcp/output-schema.js +38 -0
  172. package/dist/emit/mcp/runtime.d.ts +10 -0
  173. package/dist/emit/mcp/runtime.js +47 -0
  174. package/dist/emit/mcp/schema.d.ts +19 -0
  175. package/dist/emit/mcp/schema.js +88 -0
  176. package/dist/emit/mcp/server.d.ts +20 -0
  177. package/dist/emit/mcp/server.js +219 -0
  178. package/dist/emit/mcp/tools.d.ts +51 -0
  179. package/dist/emit/mcp/tools.js +153 -0
  180. package/dist/emit/python/errors.d.ts +8 -0
  181. package/dist/emit/python/errors.js +68 -0
  182. package/dist/emit/python/index.d.ts +1 -0
  183. package/dist/emit/python/index.js +1 -0
  184. package/dist/emit/python/realtime.d.ts +10 -0
  185. package/dist/emit/python/realtime.js +33 -0
  186. package/dist/emit/python/sdk-answer.d.ts +49 -0
  187. package/dist/emit/python/sdk-answer.js +89 -0
  188. package/dist/emit/python/sdk-body.d.ts +11 -0
  189. package/dist/emit/python/sdk-body.js +40 -0
  190. package/dist/emit/python/sdk-client.d.ts +36 -0
  191. package/dist/emit/python/sdk-client.js +163 -0
  192. package/dist/emit/python/sdk-doc.d.ts +9 -0
  193. package/dist/emit/python/sdk-doc.js +32 -0
  194. package/dist/emit/python/sdk-imports.d.ts +14 -0
  195. package/dist/emit/python/sdk-imports.js +38 -0
  196. package/dist/emit/python/sdk-method.d.ts +29 -0
  197. package/dist/emit/python/sdk-method.js +183 -0
  198. package/dist/emit/python/sdk-plan.d.ts +33 -0
  199. package/dist/emit/python/sdk-plan.js +1 -0
  200. package/dist/emit/python/sdk-pyproject.d.ts +20 -0
  201. package/dist/emit/python/sdk-pyproject.js +47 -0
  202. package/dist/emit/python/sdk.d.ts +19 -0
  203. package/dist/emit/python/sdk.js +153 -0
  204. package/dist/emit/python/sse.d.ts +12 -0
  205. package/dist/emit/python/sse.js +23 -0
  206. package/dist/emit/python/transport.d.ts +15 -0
  207. package/dist/emit/python/transport.js +60 -0
  208. package/dist/emit/python/types-dict.d.ts +31 -0
  209. package/dist/emit/python/types-dict.js +45 -0
  210. package/dist/emit/python/types-names.d.ts +16 -0
  211. package/dist/emit/python/types-names.js +52 -0
  212. package/dist/emit/python/types-union.d.ts +32 -0
  213. package/dist/emit/python/types-union.js +46 -0
  214. package/dist/emit/python/types.d.ts +36 -0
  215. package/dist/emit/python/types.js +128 -0
  216. package/dist/emit/python/ws.d.ts +14 -0
  217. package/dist/emit/python/ws.js +16 -0
  218. package/dist/emit/rust/errors.d.ts +7 -0
  219. package/dist/emit/rust/errors.js +107 -0
  220. package/dist/emit/rust/http.d.ts +13 -0
  221. package/dist/emit/rust/http.js +67 -0
  222. package/dist/emit/rust/index.d.ts +1 -0
  223. package/dist/emit/rust/index.js +1 -0
  224. package/dist/emit/rust/realtime.d.ts +11 -0
  225. package/dist/emit/rust/realtime.js +29 -0
  226. package/dist/emit/rust/sdk-body.d.ts +19 -0
  227. package/dist/emit/rust/sdk-body.js +53 -0
  228. package/dist/emit/rust/sdk-cargo.d.ts +27 -0
  229. package/dist/emit/rust/sdk-cargo.js +138 -0
  230. package/dist/emit/rust/sdk-client.d.ts +25 -0
  231. package/dist/emit/rust/sdk-client.js +108 -0
  232. package/dist/emit/rust/sdk-method.d.ts +15 -0
  233. package/dist/emit/rust/sdk-method.js +119 -0
  234. package/dist/emit/rust/sdk-opts.d.ts +58 -0
  235. package/dist/emit/rust/sdk-opts.js +117 -0
  236. package/dist/emit/rust/sdk-plan.d.ts +33 -0
  237. package/dist/emit/rust/sdk-plan.js +1 -0
  238. package/dist/emit/rust/sdk.d.ts +25 -0
  239. package/dist/emit/rust/sdk.js +127 -0
  240. package/dist/emit/rust/sse.d.ts +19 -0
  241. package/dist/emit/rust/sse.js +20 -0
  242. package/dist/emit/rust/types-enum.d.ts +13 -0
  243. package/dist/emit/rust/types-enum.js +62 -0
  244. package/dist/emit/rust/types-names.d.ts +19 -0
  245. package/dist/emit/rust/types-names.js +66 -0
  246. package/dist/emit/rust/types-struct.d.ts +21 -0
  247. package/dist/emit/rust/types-struct.js +59 -0
  248. package/dist/emit/rust/types-union.d.ts +24 -0
  249. package/dist/emit/rust/types-union.js +97 -0
  250. package/dist/emit/rust/types.d.ts +34 -0
  251. package/dist/emit/rust/types.js +105 -0
  252. package/dist/emit/rust/ws.d.ts +21 -0
  253. package/dist/emit/rust/ws.js +20 -0
  254. package/dist/emit/shared/escape.d.ts +55 -0
  255. package/dist/emit/shared/escape.js +144 -0
  256. package/dist/emit/shared/format.d.ts +24 -0
  257. package/dist/emit/shared/format.js +23 -0
  258. package/dist/emit/shared/gofmt.d.ts +3 -0
  259. package/dist/emit/shared/gofmt.js +26 -0
  260. package/dist/emit/shared/lang.d.ts +60 -0
  261. package/dist/emit/shared/lang.js +233 -0
  262. package/dist/emit/shared/literals.d.ts +4 -0
  263. package/dist/emit/shared/literals.js +31 -0
  264. package/dist/emit/shared/mirror.d.ts +22 -0
  265. package/dist/emit/shared/mirror.js +26 -0
  266. package/dist/emit/shared/ruff.d.ts +3 -0
  267. package/dist/emit/shared/ruff.js +31 -0
  268. package/dist/emit/shared/rustfmt.d.ts +3 -0
  269. package/dist/emit/shared/rustfmt.js +32 -0
  270. package/dist/emit/shared/status-keys.d.ts +7 -0
  271. package/dist/emit/shared/status-keys.js +67 -0
  272. package/dist/emit/shared/type-emitter.d.ts +19 -0
  273. package/dist/emit/shared/type-emitter.js +100 -0
  274. package/dist/emit/shared/webhooks.d.ts +20 -0
  275. package/dist/emit/shared/webhooks.js +171 -0
  276. package/dist/emit/ts/app-client.d.ts +4 -0
  277. package/dist/emit/ts/app-client.js +68 -0
  278. package/dist/emit/ts/http.d.ts +4 -0
  279. package/dist/emit/ts/http.js +40 -0
  280. package/dist/emit/ts/route-tree.d.ts +33 -0
  281. package/dist/emit/ts/route-tree.js +228 -0
  282. package/dist/emit/ts/sdk-types.d.ts +13 -0
  283. package/dist/emit/ts/sdk-types.js +282 -0
  284. package/dist/emit/ts/sdk.d.ts +15 -0
  285. package/dist/emit/ts/sdk.js +129 -0
  286. package/dist/emit/ts/service-map.d.ts +40 -0
  287. package/dist/emit/ts/service-map.js +141 -0
  288. package/dist/emit/ts/type-gen.d.ts +22 -0
  289. package/dist/emit/ts/type-gen.js +238 -0
  290. package/dist/extract/chain.d.ts +30 -0
  291. package/dist/extract/chain.js +84 -0
  292. package/dist/extract/extract.d.ts +29 -0
  293. package/dist/extract/extract.js +188 -0
  294. package/dist/extract/serialize.d.ts +32 -0
  295. package/dist/extract/serialize.js +280 -0
  296. package/dist/extract/walk.d.ts +35 -0
  297. package/dist/extract/walk.js +92 -0
  298. package/dist/gen/args.d.ts +40 -0
  299. package/dist/gen/args.js +129 -0
  300. package/dist/gen/process.d.ts +13 -0
  301. package/dist/gen/process.js +35 -0
  302. package/dist/gen/write.d.ts +17 -0
  303. package/dist/gen/write.js +101 -0
  304. package/dist/index.d.ts +12 -0
  305. package/dist/index.js +11 -0
  306. package/dist/ir/build.d.ts +37 -0
  307. package/dist/ir/build.js +152 -0
  308. package/dist/ir/load.d.ts +11 -0
  309. package/dist/ir/load.js +102 -0
  310. package/dist/ir/model.d.ts +208 -0
  311. package/dist/ir/model.js +5 -0
  312. package/dist/ir/resolve-refs.d.ts +11 -0
  313. package/dist/ir/resolve-refs.js +66 -0
  314. package/dist/ir/resource-tree.d.ts +9 -0
  315. package/dist/ir/resource-tree.js +53 -0
  316. package/dist/ir/route-tree-intern.d.ts +18 -0
  317. package/dist/ir/route-tree-intern.js +174 -0
  318. package/dist/ir/schema.d.ts +11 -0
  319. package/dist/ir/schema.js +180 -0
  320. package/dist/ir/sdk-model.d.ts +86 -0
  321. package/dist/ir/sdk-model.js +204 -0
  322. package/dist/ir/slots.d.ts +42 -0
  323. package/dist/ir/slots.js +245 -0
  324. package/dist/runtime/cli/body.go +176 -0
  325. package/dist/runtime/cli/config.go +243 -0
  326. package/dist/runtime/cli/discovery.go +147 -0
  327. package/dist/runtime/cli/format.go +174 -0
  328. package/dist/runtime/cli/log.go +117 -0
  329. package/dist/runtime/cli/output.go +247 -0
  330. package/dist/runtime/cli/params.go +197 -0
  331. package/dist/runtime/cli/run.go +226 -0
  332. package/dist/runtime/cli/socket.go +60 -0
  333. package/dist/runtime/cli/stream.go +217 -0
  334. package/dist/runtime/cli/target.go +117 -0
  335. package/dist/runtime/csharp/Adapters.cs +183 -0
  336. package/dist/runtime/csharp/Auth.cs +56 -0
  337. package/dist/runtime/csharp/Body.cs +135 -0
  338. package/dist/runtime/csharp/Config.cs +161 -0
  339. package/dist/runtime/csharp/Envelope.cs +149 -0
  340. package/dist/runtime/csharp/Errors.cs +194 -0
  341. package/dist/runtime/csharp/Events.cs +155 -0
  342. package/dist/runtime/csharp/Exchange.cs +247 -0
  343. package/dist/runtime/csharp/Handler.cs +103 -0
  344. package/dist/runtime/csharp/Hooks.cs +128 -0
  345. package/dist/runtime/csharp/Invalidation.cs +102 -0
  346. package/dist/runtime/csharp/Json.cs +144 -0
  347. package/dist/runtime/csharp/Log.cs +48 -0
  348. package/dist/runtime/csharp/Operation.cs +33 -0
  349. package/dist/runtime/csharp/Path.cs +65 -0
  350. package/dist/runtime/csharp/Query.cs +72 -0
  351. package/dist/runtime/csharp/Realtime.cs +118 -0
  352. package/dist/runtime/csharp/RealtimeLoop.cs +236 -0
  353. package/dist/runtime/csharp/Redirect.cs +53 -0
  354. package/dist/runtime/csharp/Result.cs +57 -0
  355. package/dist/runtime/csharp/Sse.cs +122 -0
  356. package/dist/runtime/csharp/Stale.cs +151 -0
  357. package/dist/runtime/csharp/Transport.cs +143 -0
  358. package/dist/runtime/csharp/TransportLongPoll.cs +63 -0
  359. package/dist/runtime/csharp/TransportSse.cs +54 -0
  360. package/dist/runtime/csharp/TransportWs.cs +40 -0
  361. package/dist/runtime/csharp/Wire.cs +109 -0
  362. package/dist/runtime/csharp/Ws.cs +300 -0
  363. package/dist/runtime/csharp/WsDial.cs +127 -0
  364. package/dist/runtime/go/auth.go +127 -0
  365. package/dist/runtime/go/body.go +129 -0
  366. package/dist/runtime/go/config.go +75 -0
  367. package/dist/runtime/go/errors.go +185 -0
  368. package/dist/runtime/go/export.go +37 -0
  369. package/dist/runtime/go/hooks.go +53 -0
  370. package/dist/runtime/go/invalidation.go +112 -0
  371. package/dist/runtime/go/log.go +92 -0
  372. package/dist/runtime/go/nullable.go +64 -0
  373. package/dist/runtime/go/options.go +118 -0
  374. package/dist/runtime/go/path.go +156 -0
  375. package/dist/runtime/go/query.go +147 -0
  376. package/dist/runtime/go/realtime.go +239 -0
  377. package/dist/runtime/go/realtime_loop.go +208 -0
  378. package/dist/runtime/go/redirect.go +124 -0
  379. package/dist/runtime/go/request.go +222 -0
  380. package/dist/runtime/go/result.go +86 -0
  381. package/dist/runtime/go/sse.go +186 -0
  382. package/dist/runtime/go/stale.go +229 -0
  383. package/dist/runtime/go/stream.go +105 -0
  384. package/dist/runtime/go/transport.go +242 -0
  385. package/dist/runtime/go/transport_longpoll.go +121 -0
  386. package/dist/runtime/go/transport_sse.go +175 -0
  387. package/dist/runtime/go/ws.go +205 -0
  388. package/dist/runtime/java/Answer.java +107 -0
  389. package/dist/runtime/java/ApiException.java +110 -0
  390. package/dist/runtime/java/BinaryBody.java +36 -0
  391. package/dist/runtime/java/Body.java +105 -0
  392. package/dist/runtime/java/Call.java +23 -0
  393. package/dist/runtime/java/CallLog.java +51 -0
  394. package/dist/runtime/java/ClientConfig.java +233 -0
  395. package/dist/runtime/java/ConnectionState.java +12 -0
  396. package/dist/runtime/java/Credential.java +58 -0
  397. package/dist/runtime/java/Deadline.java +38 -0
  398. package/dist/runtime/java/Decode.java +181 -0
  399. package/dist/runtime/java/Envelope.java +141 -0
  400. package/dist/runtime/java/ErrorEnvelope.java +23 -0
  401. package/dist/runtime/java/EventStream.java +129 -0
  402. package/dist/runtime/java/Exchange.java +62 -0
  403. package/dist/runtime/java/FilePart.java +5 -0
  404. package/dist/runtime/java/Flight.java +306 -0
  405. package/dist/runtime/java/HoneyException.java +14 -0
  406. package/dist/runtime/java/Hooks.java +47 -0
  407. package/dist/runtime/java/Hops.java +133 -0
  408. package/dist/runtime/java/InvalidationConfig.java +73 -0
  409. package/dist/runtime/java/Json.java +23 -0
  410. package/dist/runtime/java/Keepalive.java +60 -0
  411. package/dist/runtime/java/LogEntry.java +14 -0
  412. package/dist/runtime/java/LongPollAdapter.java +68 -0
  413. package/dist/runtime/java/Operation.java +21 -0
  414. package/dist/runtime/java/Opt.java +121 -0
  415. package/dist/runtime/java/Pump.java +160 -0
  416. package/dist/runtime/java/RawResponse.java +48 -0
  417. package/dist/runtime/java/Realtime.java +152 -0
  418. package/dist/runtime/java/RealtimeLoop.java +371 -0
  419. package/dist/runtime/java/RedirectPolicy.java +13 -0
  420. package/dist/runtime/java/Redirects.java +126 -0
  421. package/dist/runtime/java/RequestContext.java +78 -0
  422. package/dist/runtime/java/RequestHook.java +9 -0
  423. package/dist/runtime/java/RequestOptions.java +91 -0
  424. package/dist/runtime/java/ResponseContext.java +70 -0
  425. package/dist/runtime/java/ResponseHook.java +12 -0
  426. package/dist/runtime/java/Result.java +32 -0
  427. package/dist/runtime/java/ResumableConnection.java +165 -0
  428. package/dist/runtime/java/SdkException.java +11 -0
  429. package/dist/runtime/java/Socket.java +301 -0
  430. package/dist/runtime/java/Sse.java +171 -0
  431. package/dist/runtime/java/SseAdapter.java +61 -0
  432. package/dist/runtime/java/SseEvent.java +10 -0
  433. package/dist/runtime/java/StaleMeta.java +16 -0
  434. package/dist/runtime/java/StaleTracker.java +287 -0
  435. package/dist/runtime/java/Transport.java +16 -0
  436. package/dist/runtime/java/TransportAdapter.java +14 -0
  437. package/dist/runtime/java/TransportConnection.java +15 -0
  438. package/dist/runtime/java/TransportKind.java +12 -0
  439. package/dist/runtime/java/TransportMessage.java +9 -0
  440. package/dist/runtime/java/TransportOptions.java +138 -0
  441. package/dist/runtime/java/TypedWebSocket.java +83 -0
  442. package/dist/runtime/java/UrlPath.java +49 -0
  443. package/dist/runtime/java/UrlQuery.java +99 -0
  444. package/dist/runtime/java/WsAdapter.java +52 -0
  445. package/dist/runtime/java/WsClose.java +47 -0
  446. package/dist/runtime/java/WsDial.java +148 -0
  447. package/dist/runtime/java/WsMessage.java +18 -0
  448. package/dist/runtime/mcp/call.ts +167 -0
  449. package/dist/runtime/mcp/files.ts +183 -0
  450. package/dist/runtime/mcp/guard.ts +176 -0
  451. package/dist/runtime/mcp/http.ts +159 -0
  452. package/dist/runtime/mcp/jsonrpc.ts +50 -0
  453. package/dist/runtime/mcp/listen.ts +76 -0
  454. package/dist/runtime/mcp/mount.ts +123 -0
  455. package/dist/runtime/mcp/protocol.ts +219 -0
  456. package/dist/runtime/mcp/reader.ts +57 -0
  457. package/dist/runtime/mcp/result.ts +85 -0
  458. package/dist/runtime/mcp/stdio.ts +79 -0
  459. package/dist/runtime/mcp/stream.ts +62 -0
  460. package/dist/runtime/python/__init__.py +2 -0
  461. package/dist/runtime/python/auth.py +67 -0
  462. package/dist/runtime/python/body.py +83 -0
  463. package/dist/runtime/python/config.py +139 -0
  464. package/dist/runtime/python/errors.py +213 -0
  465. package/dist/runtime/python/events.py +152 -0
  466. package/dist/runtime/python/exchange.py +298 -0
  467. package/dist/runtime/python/hooks.py +86 -0
  468. package/dist/runtime/python/invalidation.py +57 -0
  469. package/dist/runtime/python/log.py +60 -0
  470. package/dist/runtime/python/operation.py +25 -0
  471. package/dist/runtime/python/path.py +41 -0
  472. package/dist/runtime/python/query.py +48 -0
  473. package/dist/runtime/python/realtime.py +244 -0
  474. package/dist/runtime/python/redirect.py +93 -0
  475. package/dist/runtime/python/result.py +58 -0
  476. package/dist/runtime/python/send_async.py +189 -0
  477. package/dist/runtime/python/send_sync.py +105 -0
  478. package/dist/runtime/python/sse.py +81 -0
  479. package/dist/runtime/python/stale.py +94 -0
  480. package/dist/runtime/python/transport.py +157 -0
  481. package/dist/runtime/python/transport_longpoll.py +60 -0
  482. package/dist/runtime/python/transport_sse.py +60 -0
  483. package/dist/runtime/python/transport_ws.py +57 -0
  484. package/dist/runtime/python/ws.py +276 -0
  485. package/dist/runtime/rust/Cargo.lock +1763 -0
  486. package/dist/runtime/rust/answer.rs +120 -0
  487. package/dist/runtime/rust/auth.rs +80 -0
  488. package/dist/runtime/rust/body.rs +150 -0
  489. package/dist/runtime/rust/call.rs +200 -0
  490. package/dist/runtime/rust/config.rs +254 -0
  491. package/dist/runtime/rust/envelope.rs +84 -0
  492. package/dist/runtime/rust/errors.rs +235 -0
  493. package/dist/runtime/rust/events.rs +177 -0
  494. package/dist/runtime/rust/exchange.rs +287 -0
  495. package/dist/runtime/rust/hooks.rs +63 -0
  496. package/dist/runtime/rust/invalidation.rs +84 -0
  497. package/dist/runtime/rust/log.rs +88 -0
  498. package/dist/runtime/rust/nullable.rs +13 -0
  499. package/dist/runtime/rust/path.rs +83 -0
  500. package/dist/runtime/rust/query.rs +84 -0
  501. package/dist/runtime/rust/realtime.rs +182 -0
  502. package/dist/runtime/rust/realtime_loop.rs +177 -0
  503. package/dist/runtime/rust/redirect.rs +121 -0
  504. package/dist/runtime/rust/request.rs +178 -0
  505. package/dist/runtime/rust/result.rs +101 -0
  506. package/dist/runtime/rust/sse.rs +104 -0
  507. package/dist/runtime/rust/stale.rs +209 -0
  508. package/dist/runtime/rust/transport.rs +221 -0
  509. package/dist/runtime/rust/transport_longpoll.rs +108 -0
  510. package/dist/runtime/rust/transport_sse.rs +91 -0
  511. package/dist/runtime/rust/transport_ws.rs +75 -0
  512. package/dist/runtime/rust/ws.rs +322 -0
  513. package/dist/runtime/ts/app-types.ts +200 -0
  514. package/dist/runtime/ts/app.ts +103 -0
  515. package/dist/runtime/ts/config.ts +119 -0
  516. package/dist/runtime/ts/defaults.ts +48 -0
  517. package/dist/runtime/ts/error.ts +113 -0
  518. package/dist/runtime/ts/hooks.ts +82 -0
  519. package/dist/runtime/ts/http.ts +283 -0
  520. package/dist/runtime/ts/media-type.ts +36 -0
  521. package/dist/runtime/ts/path.ts +152 -0
  522. package/dist/runtime/ts/realtime-connection.ts +296 -0
  523. package/dist/runtime/ts/realtime-transports.ts +149 -0
  524. package/dist/runtime/ts/realtime.ts +293 -0
  525. package/dist/runtime/ts/redirect-policy.ts +17 -0
  526. package/dist/runtime/ts/redirects.ts +74 -0
  527. package/dist/runtime/ts/request.ts +237 -0
  528. package/dist/runtime/ts/response.ts +223 -0
  529. package/dist/runtime/ts/sdk.ts +299 -0
  530. package/dist/runtime/ts/sse.ts +156 -0
  531. package/dist/runtime/ts/stale.ts +137 -0
  532. package/dist/runtime/ts/ws.ts +144 -0
  533. package/package.json +70 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lovro Žagar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,438 @@
1
+ # @lovrozagar/honey-clients
2
+
3
+ Generates SDKs (TypeScript, Go, Rust, Python, C#, Java), a Go command-line client and a Model Context Protocol
4
+ server from an OpenAPI 3.x document, or straight from a
5
+ [`@lovrozagar/honey`](https://www.npmjs.com/package/@lovrozagar/honey) app.
6
+
7
+ Every target reads one intermediate representation and vendors its own small runtime, so a generated SDK has no
8
+ dependency on honey, and a spec from another framework generates just as well. The output is formatted and
9
+ deterministic: regenerating an unchanged spec changes nothing on disk.
10
+
11
+ This page is the whole generator — every target, every flag, and what each client looks like to call.
12
+
13
+ - [Install](#install)
14
+ - [Start](#start)
15
+ - [honey-clients generate](#honey-clients-generate)
16
+ - [Every flag](#every-flag)
17
+ - [The six SDKs](#the-six-sdks)
18
+ - [The TypeScript SDK](#the-typescript-sdk)
19
+ - [The Go SDK](#the-go-sdk)
20
+ - [The Rust SDK](#the-rust-sdk)
21
+ - [The Python SDK](#the-python-sdk)
22
+ - [The C# SDK](#the-c-sdk)
23
+ - [The Java SDK](#the-java-sdk)
24
+ - [Errors and the safe mirror](#errors-and-the-safe-mirror)
25
+ - [The command-line client](#the-command-line-client)
26
+ - [The MCP server](#the-mcp-server)
27
+ - [Configuring generation](#configuring-generation)
28
+ - [What a run writes](#what-a-run-writes)
29
+ - [Documentation](#documentation)
30
+ - [License](#license)
31
+
32
+ ## Install
33
+
34
+ 1.0 is out as a release candidate, published under npm's `next` tag, so an install without a tag still gives 0.7.3.
35
+ Add `@next` until the final release:
36
+
37
+ ```sh
38
+ npm install --save-dev @lovrozagar/honey-clients@next
39
+ ```
40
+
41
+ Node 22.12 or later, or Bun 1.3 or later.
42
+
43
+ The `go` and `cli` targets format every Go file they write with gofmt, so they need Go installed. gofmt is found by
44
+ `$GOFMT`, then `$GOROOT/bin/gofmt`, then `gofmt` on `PATH`, then beside the `go` on `PATH`. Without one they refuse,
45
+ rather than writing unformatted Go. The `ts` target formats with oxfmt, an optional peer: install `oxfmt` beside
46
+ honey-clients. Without it the files go out as emitted, valid TypeScript that is not formatted.
47
+
48
+ ## Start
49
+
50
+ From a document:
51
+
52
+ ```sh
53
+ npx honey-clients generate --spec openapi.json --target ts --target python --out generated
54
+ ```
55
+
56
+ From a honey app module, with no document written first:
57
+
58
+ ```sh
59
+ npx honey-clients generate --app src/app.ts --target ts --target go --go-module-path github.com/acme/shop/sdk \
60
+ --out generated
61
+ ```
62
+
63
+ The targets are `ts`, `go`, `rust`, `python`, `csharp`, `java`, `cli` and `mcp`. Each target's files go under
64
+ `<out>/<target>`.
65
+
66
+ ## honey-clients generate
67
+
68
+ ```sh
69
+ honey-clients generate --spec openapi.json --target ts --target cli --out generated \
70
+ --cli-binary-name shop --cli-module-path github.com/acme/shop --cli-repo acme/shop
71
+ ```
72
+
73
+ - `--spec <file>`: the OpenAPI document, as JSON.
74
+ - `--app <module>[#export]`: a honey app module instead of `--spec` (give one, never both). Its named export, else
75
+ `app`, else `default`, is the app; its document is made by the app's own `@lovrozagar/honey/openapi`, resolved from
76
+ the app as at run time, and the module's `openApi` export, if any, is that document's options (`info`,
77
+ `securitySchemes`, `invalidate`, …, as `generateOpenApi` takes them). Started by `bun run`, the bin hands the load to
78
+ that Bun, so a module needing Bun's loaders works; a run ends once it has written, whatever the module left open.
79
+ The module exports the app and serves nothing: one that calls `serve()` as it loads is outside `--app`'s contract,
80
+ since honey never serves implicitly and has no switch to stop it.
81
+ - `--target <name>`: `ts`, `go`, `rust`, `python`, `csharp`, `java`, `cli` or `mcp`; repeat it for more than one.
82
+ - `--out <dir>`: each target's files go under `<dir>/<target>`.
83
+ - `--<target>-<option>`: a target's options are its generator's, passed through as given. Each takes a value.
84
+ - `--watch`: generate again on each change of the spec (or the `--app` module), each run in a fresh process.
85
+ - `-h`, `--help`: the usage text, with every target's options.
86
+
87
+ Parsing is strict, because a typo that generates the wrong thing silently is worse than a refusal: an unknown flag, a
88
+ missing value, a stray argument, an unknown target, or an option for a target no `--target` names is a usage error.
89
+ `--k v` and `--k=v` both work, and a value is never the next flag.
90
+
91
+ ## Every flag
92
+
93
+ One table, since a flag that is not written down is a flag nobody finds:
94
+
95
+ | Flag | Target | What it sets |
96
+ | ------------------------- | ------ | ------------------------------------------------------------------ |
97
+ | `--spec <file>` | — | the OpenAPI document to generate from |
98
+ | `--app <module>[#export]` | — | a honey app module instead of a document |
99
+ | `--target <name>` | — | which target to emit; repeat for more than one |
100
+ | `--out <dir>` | — | the output root; each target writes under `<dir>/<target>` |
101
+ | `--watch` | — | regenerate on each change, in a fresh process |
102
+ | `-h`, `--help` | — | the usage text |
103
+ | `--ts-name` | ts | the client class's name (default `SDK`) |
104
+ | `--ts-stem` | ts | the file stem the generated modules share |
105
+ | `--go-module-path` | go | the Go module path the SDK is imported by |
106
+ | `--rust-crate-name` | rust | the crate's name |
107
+ | `--rust-version` | rust | the crate's version |
108
+ | `--rust-description` | rust | what crates.io shows; `cargo publish` needs one |
109
+ | `--rust-license` | rust | its SPDX license; `cargo publish` needs one |
110
+ | `--rust-repository` | rust | the repository crates.io links |
111
+ | `--rust-homepage` | rust | the home page crates.io links |
112
+ | `--rust-keywords` | rust | its crates.io keywords, comma separated |
113
+ | `--python-package-name` | python | the Python package's name |
114
+ | `--python-version` | python | the package's version |
115
+ | `--csharp-client-name` | csharp | the client class's name |
116
+ | `--csharp-package-id` | csharp | the NuGet package id |
117
+ | `--csharp-root-namespace` | csharp | the root namespace |
118
+ | `--csharp-version` | csharp | the package's version |
119
+ | `--java-artifact-id` | java | the Maven artifact id |
120
+ | `--java-group-id` | java | the Maven group id |
121
+ | `--java-package-name` | java | the Java package name |
122
+ | `--java-client-name` | java | the client class's name |
123
+ | `--java-version` | java | the publication's version |
124
+ | `--cli-binary-name` | cli | the command's own name (`shop`) |
125
+ | `--cli-base-url` | cli | the base URL it calls by default; the document's server by default |
126
+ | `--cli-module-path` | cli | the Go module path the CLI is built from |
127
+ | `--cli-repo` | cli | the GitHub repository its release workflow and install scripts use |
128
+ | `--cli-env-prefix` | cli | the prefix of the environment variables it reads |
129
+ | `--mcp-name` | mcp | the server's name, and the stem of its bin |
130
+ | `--mcp-env-prefix` | mcp | the prefix of the environment variables it reads |
131
+
132
+ ## The six SDKs
133
+
134
+ Every SDK takes the same configuration — a base URL, the auth the spec's security scheme names, a timeout, retries,
135
+ hooks around each HTTP call, and per-call overrides — and every one answers the same way: the normal call returns
136
+ your value and throws a typed error by status, while `client.safe` answers a result instead. What follows is each
137
+ language's client in a slice of a compiled example; the
138
+ [SDK recipes](https://github.com/lovrozagar/honey/blob/main/docs/sdk-recipes.md) page has the whole programs.
139
+
140
+ ### The TypeScript SDK
141
+
142
+ ```sh
143
+ honey-clients generate --spec openapi.json --target ts --out generated --ts-name Kitchen
144
+ ```
145
+
146
+ ```ts sdk
147
+ import { DecodeError, Kitchen, NotFoundError } from "./kitchen"
148
+
149
+ export function newClient(): Kitchen {
150
+ return new Kitchen({
151
+ baseURL: "https://api.example.com",
152
+ headers: { authorization: `Bearer ${process.env.KITCHEN_TOKEN ?? ""}` },
153
+ timeout: 10_000,
154
+ })
155
+ }
156
+
157
+ export async function organization(client: Kitchen, orgId: string): Promise<string | null> {
158
+ try {
159
+ await client.getApiV1OrganizationsByOrgId({ params: { orgId } })
160
+ return orgId
161
+ } catch (error) {
162
+ if (error instanceof NotFoundError) return null
163
+ throw error
164
+ }
165
+ }
166
+
167
+ export async function health(client: Kitchen): Promise<string> {
168
+ const result = await client.safe.getApiHealth()
169
+ if (result.ok) return "up"
170
+ if (result.error instanceof DecodeError) return `unreadable answer: ${result.error.message}`
171
+ return `answered ${result.error.status}`
172
+ }
173
+ ```
174
+
175
+ ### The Go SDK
176
+
177
+ Idiomatic Go: a `Config`, `context.Context` on every call, errors read with `errors.As`, and an event stream as a
178
+ `range` over a function.
179
+
180
+ ```sh
181
+ honey-clients generate --spec openapi.json --target go --out generated --go-module-path github.com/acme/shop/sdk
182
+ ```
183
+
184
+ ```go
185
+ func listing(ctx context.Context, client *sdk.Client) string {
186
+ r, err := client.Safe().GetApi(ctx, nil)
187
+ if err != nil {
188
+ return fmt.Sprintf("no answer: %v", err) // never sent, refused, dropped, timed out or canceled
189
+ }
190
+ var unreadable *sdk.DecodeError
191
+ var failed *sdk.ClientError
192
+ switch {
193
+ case r.Ok():
194
+ return fmt.Sprintf("answered %d: %v", r.Response.StatusCode, r.Data)
195
+ case errors.As(r.Err, &unreadable):
196
+ return fmt.Sprintf("answered %d, unreadable: %v", r.Response.StatusCode, unreadable.Err)
197
+ case errors.As(r.Err, &failed):
198
+ return fmt.Sprintf("answered %d: %s", failed.StatusCode, failed.Key)
199
+ }
200
+ return r.Err.Error()
201
+ }
202
+ ```
203
+
204
+ ### The Rust SDK
205
+
206
+ Async over `reqwest`, each call taking its options struct, with the safe mirror as a second client style.
207
+
208
+ ```sh
209
+ honey-clients generate --spec openapi.json --target rust --out generated --rust-crate-name shop-sdk
210
+ ```
211
+
212
+ ```rust
213
+ async fn listing(client: &Client) -> String {
214
+ match client.safe().get_api(&GetApiOpts::default()).await {
215
+ Ok(Answer::Ok { data, response }) => format!("answered {}: {data:?}", response.status),
216
+ Ok(Answer::Err {
217
+ error: SafeError::Api(failed),
218
+ response,
219
+ }) => format!("answered {}: {}", response.status, failed.message()),
220
+ Ok(Answer::Err {
221
+ error: SafeError::Decode(unreadable),
222
+ response,
223
+ }) => format!("answered {}, unreadable: {unreadable}", response.status),
224
+ Err(no_answer) => format!("no answer: {no_answer}"), // never sent, refused, timed out or canceled
225
+ }
226
+ }
227
+ ```
228
+
229
+ ### The Python SDK
230
+
231
+ A sync `SDK` and an async `AsyncSDK`, both context managers, typed for `mypy --strict`, with results as frozen
232
+ dataclasses to narrow with `match`.
233
+
234
+ ```sh
235
+ honey-clients generate --spec openapi.json --target python --out generated --python-package-name shop_sdk
236
+ ```
237
+
238
+ ```python
239
+ async def health(client: AsyncSDK) -> str:
240
+ match await client.safe.get_api_health():
241
+ case Ok(data, response):
242
+ return f"answered {response.status}: {data}"
243
+ case Err(DecodeError() as unreadable, response):
244
+ return f"answered {response.status}, unreadable: {unreadable}"
245
+ case Err(error, response):
246
+ return f"answered {response.status}: {error}"
247
+ ```
248
+
249
+ ### The C# SDK
250
+
251
+ A .NET project with its own `HttpClient` pipeline, `IAsyncDisposable` streams, and `client.Safe` answering
252
+ `Result<T>`.
253
+
254
+ ```sh
255
+ honey-clients generate --spec openapi.json --target csharp --out generated --csharp-package-id Acme.Shop
256
+ ```
257
+
258
+ ```csharp
259
+ public static async Task<string> Listing(HoneySdkClient client, string id)
260
+ {
261
+ var result = await client.Safe.GetApiAsync(id); // no answer (never sent, refused, timed out, canceled) still throws
262
+ return result.Match(
263
+ found => $"answered {result.Response.Status}: {found}",
264
+ error => error switch
265
+ {
266
+ DecodeException unreadable => $"answered {result.Response.Status}, unreadable: {unreadable.Message}",
267
+ ApiStatusException failed => $"answered {failed.Status}: {failed.Key}",
268
+ _ => error.Message,
269
+ });
270
+ }
271
+ ```
272
+
273
+ ### The Java SDK
274
+
275
+ A Java 17 library on Jackson 3, with builders, `try`-with-resources streams, `client.safe()` answering a sealed
276
+ `Result<T>`, and a Gradle publication.
277
+
278
+ ```sh
279
+ honey-clients generate --spec openapi.json --target java --out generated --java-group-id com.acme
280
+ ```
281
+
282
+ ```java
283
+ static String listing(KitchenClient client) {
284
+ // no answer (never sent, refused, timed out, canceled) still throws
285
+ Result<ListApiResponse200> result = client.safe().getApi(GetApiParams.builder().build());
286
+ int status = result.response().status();
287
+ return result.fold(
288
+ found -> "answered " + status + ": " + found,
289
+ error ->
290
+ error instanceof ApiException failed
291
+ ? "answered " + status + ": " + failed.key()
292
+ : "answered " + status + ", unreadable: " + error.getMessage());
293
+ }
294
+ ```
295
+
296
+ ## Errors and the safe mirror
297
+
298
+ Two styles, in all six SDKs, over the same calls:
299
+
300
+ - **The normal call** answers its value and throws on any failure: an error status as its typed error
301
+ (`NotFoundError` and so on, each a `ClientError`), and an undecodable or over-cap 2xx as a `DecodeError`.
302
+ - **`client.safe`** holds the same calls, each answering a result. On `ok` it carries the data, the raw response, and
303
+ the declared response headers when the operation has any. Otherwise it carries the error the normal call would have
304
+ thrown, with the parsed body on it. A declared status narrows the error's type and body; any other status is the
305
+ base client error with an `unknown` body.
306
+ - **No answer throws in both styles.** A call never sent, a refused or dropped connection, a timeout, a cancel, and a
307
+ stream that drops after it opened are not answers, so there is nothing for a result to carry.
308
+
309
+ A name of yours that collides with the mirror, or with a runtime type, is renamed and reported on stderr — never
310
+ silently. An operation or root resource named `safe` becomes `safe_`, and a component named like one of the runtime
311
+ types becomes `<Name>Model`.
312
+
313
+ Full reference: [generated clients](https://github.com/lovrozagar/honey/blob/main/docs/client.md).
314
+
315
+ ## The command-line client
316
+
317
+ `--target cli` writes a Go command-line client for the API: one command per operation, grouped by its dotted
318
+ `operationId`, with `--help` everywhere, `commands` and `schema` for discovery, typed flags, table/JSON/NDJSON/YAML
319
+ output, streams, pagination, shell completion, and an embedded `SKILL.md` so an agent can drive it. It ships with a
320
+ release workflow and install scripts that verify what they install.
321
+
322
+ ```sh
323
+ honey-clients generate --spec openapi.json --target cli --out ./cli --cli-repo acme/shop-cli
324
+ shop orders list --status open --output json
325
+ ```
326
+
327
+ | Value | Default | What it does |
328
+ | ------------------------------------------------------------------- | --------------- | ---------------------------------------------------- |
329
+ | a command per operation | — | grouped by the dotted operationId resource tree |
330
+ | `--json` | off | one machine-readable shape on every command |
331
+ | `--output <json\|ndjson\|yaml\|table>` | table | human and machine formats |
332
+ | `--api-key` / `--base-url` / `--config` / `--timeout` / `--verbose` | from config/env | auth, target, config file, deadline, logging |
333
+ | `commands`, `schema` | — | a listable command index and per-call schemas |
334
+ | `--output <file>` | stdout | a binary response written as bytes, pipe-safe |
335
+ | exit codes | usage/standard | non-zero on usage error, distinct from a runtime one |
336
+
337
+ Its configuration has one precedence, everywhere: **flag, then environment, then config file.** The environment
338
+ variables are the `--cli-env-prefix` (or the API's name) upper-cased.
339
+
340
+ Full reference: [the generated CLI](https://github.com/lovrozagar/honey/blob/main/docs/cli.md) and
341
+ [releasing it](https://github.com/lovrozagar/honey/blob/main/docs/cli-release.md).
342
+
343
+ ## The MCP server
344
+
345
+ `--target mcp` writes a standalone Model Context Protocol server: one tool per operation marked for MCP, its
346
+ `inputSchema` from the operation's parameters and body, an `outputSchema` from its success response, and
347
+ `structuredContent` an agent reads as data beside a text rendering. A failure comes back as a tool error with its
348
+ status and key, never as a successful result. Read-only operations are annotated as such. It speaks stdio by
349
+ default, and Streamable HTTP with `--http`.
350
+
351
+ ```sh
352
+ honey-clients generate --spec openapi.json --target mcp --out ./mcp --mcp-name anyrow
353
+ ```
354
+
355
+ ```json
356
+ {
357
+ "name": "orders_get",
358
+ "inputSchema": { "type": "object", "properties": { "id": { "type": "string" } }, "required": ["id"] },
359
+ "outputSchema": { "type": "object", "properties": { "id": { "type": "string" }, "status": { "type": "string" } } }
360
+ }
361
+ ```
362
+
363
+ The server reads its configuration from the environment, under the `--mcp-env-prefix` (or the document's title,
364
+ upper-cased):
365
+
366
+ | Variable | Default | What it does |
367
+ | ---------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------- |
368
+ | `$<PREFIX>_BASE_URL` | the document's first server | the API every call goes to |
369
+ | `$<PREFIX>_API_KEY` | none | the credential, sent as the document's scheme says; scrubbed from every result |
370
+ | `$<PREFIX>_HEADERS` | none | a JSON object of headers sent on every call, each scrubbed from results |
371
+ | `$<PREFIX>_REDIRECT` | `same-origin` | `same-origin`, or `follow` to follow a redirect off the API's origin with its credentials dropped |
372
+ | `$<PREFIX>_TIMEOUT_MS` | `30000` | each call's bound, an event stream's collect included |
373
+ | `$<PREFIX>_FILE_ROOT` | the client's working dir | the only directory a `{ path }` file argument is read from |
374
+ | `$<PREFIX>_MAX_FILE_BYTES` | `52428800` | the largest file a path may name |
375
+ | `$<PREFIX>_MAX_INLINE_BYTES` | `1048576` | all inline files of one call together, decoded |
376
+ | `$<PREFIX>_MCP_TOKEN` | none | the bearer token `--http` requires; it never reaches the API |
377
+
378
+ **The standalone server needs Node**: it holds a listening socket and reads local files, so it belongs on a machine
379
+ or a container, never on serverless or Workers. To serve the same tools remotely, mount them in the app instead with
380
+ `mcp()` from `@lovrozagar/honey/mcp`, which runs wherever the app runs and is guarded by the app's own auth.
381
+
382
+ Full reference: [the generated MCP server](https://github.com/lovrozagar/honey/blob/main/docs/mcp.md).
383
+
384
+ ## Configuring generation
385
+
386
+ In a honey project the generation is configured once, in the Vite plugin, and `honey-clients generate --app` reads
387
+ the same app. `codegen.mcp` writes the handler `mcp()` mounts, and `codegen.openApi` the document the SDKs are
388
+ generated from:
389
+
390
+ ```sh
391
+ # the whole set, from the app module, in one run
392
+ npx honey-clients generate --app src/app.ts \
393
+ --target ts --target go --target python --target cli --target mcp \
394
+ --go-module-path github.com/acme/shop/sdk --cli-repo acme/shop-cli --out generated
395
+ ```
396
+
397
+ ```json
398
+ {
399
+ "scripts": {
400
+ "generate": "honey generate && honey-clients generate --app src/app.ts --target ts --out generated"
401
+ }
402
+ }
403
+ ```
404
+
405
+ What each target names its package, its client class and its environment variables is the `--<target>-<option>` set
406
+ above; nothing is read from a config file of ours, so one command line is the whole input and a CI run cannot drift
407
+ from a developer's.
408
+
409
+ ## What a run writes
410
+
411
+ **Stale files are deleted, edited ones kept.** Each `<out>/<target>` keeps `.honey-generated.json`: every file the
412
+ run wrote, with its sha256. A file is rewritten only when its bytes change, through a temp file renamed over it. A
413
+ regeneration deletes a file the last run wrote and this one does not (a `cli` target's old `<name>_cmds.go`, say),
414
+ unless it was edited since: that one is kept and named on stderr. A file the manifest never listed is never deleted,
415
+ nothing outside `<out>/<target>` is touched, and no symlink is followed. Without a manifest, nothing is deleted.
416
+
417
+ Every target is held to the same conformance grid: one shared scenario suite runs against a live reference server
418
+ for all eight targets, and each decoded answer and each request on the wire must match one expected table. A feature
419
+ that works in one SDK and breaks in another fails the grid.
420
+
421
+ This package also exports the app-side generators the honey CLI and Vite plugin use: `generateRouteTree`,
422
+ `generateTypes` and `extractTypes` from `@lovrozagar/honey-clients`, and the command's own entry at
423
+ `@lovrozagar/honey-clients/cli`.
424
+
425
+ ## Documentation
426
+
427
+ - [Code generation](https://github.com/lovrozagar/honey/blob/main/docs/codegen.md): every target and its options.
428
+ - [Generated clients](https://github.com/lovrozagar/honey/blob/main/docs/client.md) and their
429
+ [per-language recipes](https://github.com/lovrozagar/honey/blob/main/docs/sdk-recipes.md).
430
+ - [The generated CLI](https://github.com/lovrozagar/honey/blob/main/docs/cli.md),
431
+ [releasing it](https://github.com/lovrozagar/honey/blob/main/docs/cli-release.md), and
432
+ [the MCP server](https://github.com/lovrozagar/honey/blob/main/docs/mcp.md).
433
+ - [SDK conformance](https://github.com/lovrozagar/honey/blob/main/docs/conformance.md) and
434
+ [the framework itself](https://github.com/lovrozagar/honey/blob/main/packages/core/README.md).
435
+
436
+ ## License
437
+
438
+ MIT
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ // The honey-clients bin (bit 17 phase h). A repository checkout (marked by tsconfig.json, which is not published)
3
+ // runs the TypeScript source, natively on Bun (under the honey-source condition) and through jiti on Node, so a stale
4
+ // dist/ never runs; an installed package runs the compiled JavaScript on any runtime (the tarball ships dist/, not src/).
5
+ import { spawn } from "node:child_process"
6
+ import { existsSync } from "node:fs"
7
+ import { basename } from "node:path"
8
+ import { fileURLToPath } from "node:url"
9
+
10
+ const isBun = typeof globalThis.Bun !== "undefined"
11
+ const checkout = existsSync(new URL("../tsconfig.json", import.meta.url))
12
+
13
+ // `bun run` and `bunx` start this file through its node shebang, while what they run is meant for Bun: hand over to
14
+ // the Bun that started us, which they name in npm_execpath. Once, never again in the child.
15
+ function invokingBun() {
16
+ if (isBun || process.env.HONEY_NO_BUN_HANDOFF === "1") return null
17
+ if (!process.env.npm_config_user_agent?.startsWith("bun/")) return null
18
+ const bun = process.env.npm_execpath
19
+ if (!bun || !/^bunx?(\.exe)?$/.test(basename(bun)) || !existsSync(bun)) return null
20
+ return bun
21
+ }
22
+
23
+ // The handoff: Bun runs this file with our arguments and `env` over ours; a signal we get is passed on to it, and we
24
+ // end as it ended, its exit code or the same signal.
25
+ function handOff(bun, env) {
26
+ // Forwarders first: a signal landing as spawn returns would otherwise end this process by its default action,
27
+ // orphaning the child. A handler runs from the event loop, after this block, so `child` is set by then.
28
+ let child
29
+ const forward = (signal) => child.kill(signal)
30
+ for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) process.on(signal, forward)
31
+ child = spawn(bun, [fileURLToPath(import.meta.url), ...process.argv.slice(2)], {
32
+ env: { ...process.env, ...env, HONEY_NO_BUN_HANDOFF: "1" },
33
+ stdio: "inherit",
34
+ })
35
+ child.on("error", (error) => {
36
+ console.error(`honey-clients: could not start ${bun}: ${error.message}`)
37
+ process.exit(1)
38
+ })
39
+ child.on("exit", (code, signal) => {
40
+ if (signal) {
41
+ for (const each of ["SIGINT", "SIGTERM", "SIGHUP"]) process.off(each, forward)
42
+ process.kill(process.pid, signal)
43
+ return
44
+ }
45
+ process.exit(code ?? 1)
46
+ })
47
+ }
48
+
49
+ // A checkout on Bun runs under the honey-source condition: an --app module's checkout core then resolves to its
50
+ // source, never to an unbuilt or stale dist/ (bit 20). Set through BUN_OPTIONS when the caller did not, in the one
51
+ // handoff, so a watch's generation children inherit it; Bun reports BUN_OPTIONS' flags in execArgv, so a Bun started
52
+ // with it never hands off again.
53
+ const SOURCE_CONDITION = "--conditions=honey-source"
54
+ const unconditioned = isBun && checkout && !process.execArgv.includes(SOURCE_CONDITION)
55
+ // The hand-off's backstop: its child carries HONEY_BUN_HANDOFF, the depth of hand-offs before it. A child that would
56
+ // hand off again (the condition set but not in its execArgv) refuses instead of re-running itself without end.
57
+ const handOffDepth = Number(process.env.HONEY_BUN_HANDOFF ?? 0)
58
+ const sourceEnv = checkout
59
+ ? {
60
+ BUN_OPTIONS: `${process.env.BUN_OPTIONS ?? ""} ${SOURCE_CONDITION}`.trim(),
61
+ HONEY_BUN_HANDOFF: String(handOffDepth + 1),
62
+ }
63
+ : {}
64
+
65
+ async function entry() {
66
+ if (checkout) {
67
+ if (isBun) return import("../src/cli.ts")
68
+ const { createJiti } = await import("jiti")
69
+ return createJiti(import.meta.url).import("../src/cli.ts")
70
+ }
71
+ try {
72
+ return await import("../dist/cli.js")
73
+ } catch (error) {
74
+ if (error?.code === "ERR_MODULE_NOT_FOUND" && String(error.url).endsWith("/dist/cli.js")) {
75
+ console.error("honey-clients: dist/ is missing from this install. Reinstall it, or run it with Bun.")
76
+ process.exit(1)
77
+ }
78
+ throw error
79
+ }
80
+ }
81
+
82
+ const bun = invokingBun()
83
+ if (bun) handOff(bun, sourceEnv)
84
+ else if (unconditioned && handOffDepth >= 1) {
85
+ console.error("honey-clients: Bun hand-off loop: --conditions=honey-source not visible after re-exec")
86
+ process.exit(1)
87
+ } else if (unconditioned) handOff(process.execPath, sourceEnv)
88
+ else {
89
+ const { main } = await entry()
90
+ const code = await main(process.argv.slice(2))
91
+ /* an --app module may leave a timer or a socket open: the run is over once main returns, its output flushed */
92
+ for (const stream of [process.stdout, process.stderr]) await new Promise((done) => stream.write("", done))
93
+ process.exit(code)
94
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { type Formatter } from "./emit/shared/format.ts";
2
+ import { type Options, type Target } from "./gen/args.ts";
3
+ /**
4
+ * The gofmt the go and cli targets are formatted with: `$GOFMT`, else `$GOROOT/bin/gofmt`, else gofmt on PATH, else
5
+ * the gofmt beside the real `go` on PATH (where every Go install keeps it); none when no Go is installed. Found by
6
+ * looking, never by running Go.
7
+ */
8
+ export declare function findGofmt(env?: NodeJS.ProcessEnv): string | undefined;
9
+ /** oxfmt's `format`, the optional peer, when installed; else undefined (TS then goes out as emitted). */
10
+ export declare function loadOxfmt(specifier?: string): Promise<Formatter | undefined>;
11
+ /** What a generation reads beside its run: the environment, where skips are reported, the oxfmt module to load. */
12
+ /**
13
+ * What one run generates: its targets, and each target's options by name (a target whose options are left out
14
+ * takes its generator's defaults). The CLI parses `generate` into one of these; a consumer writes one by hand.
15
+ */
16
+ export type GenerateRun = {
17
+ readonly options?: Readonly<Partial<Record<Target, Options>>>;
18
+ readonly targets: readonly Target[];
19
+ };
20
+ export type GenerateContext = {
21
+ readonly env: NodeJS.ProcessEnv;
22
+ readonly report: (line: string) => void;
23
+ /** oxfmt's specifier, "oxfmt" by default: a leg names a missing one to run without it */
24
+ readonly oxfmt?: string;
25
+ };
26
+ /** Every file a run writes, by target and its path under the target's directory, Go's through gofmt, TS's through oxfmt. */
27
+ export declare function generated(run: GenerateRun, document: Record<string, unknown>, { env, oxfmt, report }: GenerateContext): Promise<Partial<Record<"cli" | "csharp" | "go" | "java" | "mcp" | "python" | "rust" | "ts", Readonly<Record<string, string>>>>>;
28
+ /** Where the CLI writes: standard output and standard error, by default the process's. */
29
+ export type Io = {
30
+ readonly out: (text: string) => void;
31
+ readonly err: (text: string) => void;
32
+ };
33
+ /** `document`'s targets generated and written under `<out>/<target>`, stale files deleted. */
34
+ export declare function writeGenerated(run: GenerateRun & {
35
+ readonly out: string;
36
+ }, document: Record<string, unknown>, io: Io, env: NodeJS.ProcessEnv): Promise<number>;
37
+ /** What a run takes beside its arguments: the environment, the directory paths resolve from, a watch's stop signal. */
38
+ export type RunOptions = {
39
+ readonly cwd?: string;
40
+ readonly env?: NodeJS.ProcessEnv;
41
+ readonly signal?: AbortSignal;
42
+ };
43
+ /** Runs `honey-clients <argv>`: the exit code it ends with (a watch ends only by `options.signal`). */
44
+ export declare function main(argv: readonly string[], io?: Io, options?: RunOptions): Promise<number>;