@workerstack/clients 1.0.0-rc.29 → 1.0.0-rc.30

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 (291) hide show
  1. package/README.md +373 -14
  2. package/assets/installers/examples/github.config.ts +17 -19
  3. package/assets/installers/examples/goreleaser.config.ts +16 -18
  4. package/assets/installers/examples/raw.config.ts +13 -15
  5. package/bin/clients.js +87 -66
  6. package/bin/installgen.js +19 -10
  7. package/dist/cli.d.ts +4 -4
  8. package/dist/cli.js +18 -12
  9. package/dist/emit/cli/channels.d.ts +2 -2
  10. package/dist/emit/cli/channels.js +18 -13
  11. package/dist/emit/cli/commands.d.ts +1 -1
  12. package/dist/emit/cli/commands.js +14 -8
  13. package/dist/emit/cli/discovery.d.ts +0 -6
  14. package/dist/emit/cli/discovery.js +9 -7
  15. package/dist/emit/cli/flags.d.ts +1 -3
  16. package/dist/emit/cli/flags.js +11 -5
  17. package/dist/emit/cli/install.d.ts +0 -8
  18. package/dist/emit/cli/install.js +3 -3
  19. package/dist/emit/cli/layout.d.ts +1 -1
  20. package/dist/emit/cli/layout.js +13 -10
  21. package/dist/emit/cli/module.d.ts +6 -6
  22. package/dist/emit/cli/module.js +10 -10
  23. package/dist/emit/cli/release.d.ts +0 -11
  24. package/dist/emit/cli/release.js +4 -4
  25. package/dist/emit/cli/skills.js +3 -3
  26. package/dist/emit/csharp/errors.js +4 -4
  27. package/dist/emit/csharp/json.js +8 -8
  28. package/dist/emit/csharp/realtime.js +3 -3
  29. package/dist/emit/csharp/sdk-answer.js +4 -4
  30. package/dist/emit/csharp/sdk-body.js +8 -6
  31. package/dist/emit/csharp/sdk-client.d.ts +3 -3
  32. package/dist/emit/csharp/sdk-client.js +2 -2
  33. package/dist/emit/csharp/sdk-csproj.d.ts +7 -9
  34. package/dist/emit/csharp/sdk-csproj.js +10 -10
  35. package/dist/emit/csharp/sdk-doc.js +1 -1
  36. package/dist/emit/csharp/sdk-method.d.ts +0 -1
  37. package/dist/emit/csharp/sdk-method.js +10 -6
  38. package/dist/emit/csharp/sdk-plan.js +0 -1
  39. package/dist/emit/csharp/sdk.js +3 -3
  40. package/dist/emit/csharp/sse.d.ts +0 -2
  41. package/dist/emit/csharp/sse.js +7 -7
  42. package/dist/emit/csharp/transport.js +7 -7
  43. package/dist/emit/csharp/types-enum.js +3 -1
  44. package/dist/emit/csharp/types-messages.js +3 -3
  45. package/dist/emit/csharp/types-names.js +10 -12
  46. package/dist/emit/csharp/types-record.js +3 -3
  47. package/dist/emit/csharp/types-union.d.ts +1 -1
  48. package/dist/emit/csharp/types.d.ts +0 -1
  49. package/dist/emit/csharp/types.js +3 -3
  50. package/dist/emit/csharp/ws.js +2 -2
  51. package/dist/emit/go/errors.js +1 -1
  52. package/dist/emit/go/http.js +2 -2
  53. package/dist/emit/go/module-path.js +2 -2
  54. package/dist/emit/go/sdk-answer.js +1 -1
  55. package/dist/emit/go/sdk-body.js +11 -7
  56. package/dist/emit/go/sdk-client.js +1 -1
  57. package/dist/emit/go/sdk-method.js +2 -2
  58. package/dist/emit/go/sdk-mirror.js +2 -2
  59. package/dist/emit/go/sdk-opts.d.ts +0 -2
  60. package/dist/emit/go/sdk-opts.js +3 -3
  61. package/dist/emit/go/sdk.d.ts +1 -1
  62. package/dist/emit/go/sdk.js +9 -9
  63. package/dist/emit/go/sse.js +1 -1
  64. package/dist/emit/go/types-names.js +5 -0
  65. package/dist/emit/go/types-struct.d.ts +2 -1
  66. package/dist/emit/go/types-struct.js +1 -1
  67. package/dist/emit/go/types.js +9 -9
  68. package/dist/emit/go/ws.js +6 -6
  69. package/dist/emit/java/gradle.d.ts +7 -9
  70. package/dist/emit/java/gradle.js +8 -8
  71. package/dist/emit/java/json.js +1 -1
  72. package/dist/emit/java/layout-ast.js +1 -1
  73. package/dist/emit/java/layout-decl.js +5 -4
  74. package/dist/emit/java/layout-doc.js +13 -7
  75. package/dist/emit/java/layout-dot.js +1 -1
  76. package/dist/emit/java/layout-strings.js +4 -5
  77. package/dist/emit/java/layout-types.js +7 -5
  78. package/dist/emit/java/layout-visitor.js +4 -3
  79. package/dist/emit/java/layout.js +5 -4
  80. package/dist/emit/java/models-names.js +5 -4
  81. package/dist/emit/java/models-record.d.ts +0 -1
  82. package/dist/emit/java/models-record.js +3 -3
  83. package/dist/emit/java/models-union.d.ts +1 -1
  84. package/dist/emit/java/models-union.js +1 -1
  85. package/dist/emit/java/models.d.ts +1 -2
  86. package/dist/emit/java/models.js +25 -16
  87. package/dist/emit/java/realtime.d.ts +5 -17
  88. package/dist/emit/java/realtime.js +1 -1
  89. package/dist/emit/java/sdk-client.d.ts +6 -6
  90. package/dist/emit/java/sdk-client.js +1 -1
  91. package/dist/emit/java/sdk-decl.js +2 -2
  92. package/dist/emit/java/sdk-errors.js +1 -1
  93. package/dist/emit/java/sdk-headers.js +2 -2
  94. package/dist/emit/java/sdk-mirror.js +2 -2
  95. package/dist/emit/java/sdk-models.d.ts +1 -1
  96. package/dist/emit/java/sdk-models.js +7 -7
  97. package/dist/emit/java/sdk-op.d.ts +1 -10
  98. package/dist/emit/java/sdk-op.js +8 -8
  99. package/dist/emit/java/sdk-params.d.ts +5 -5
  100. package/dist/emit/java/sdk-params.js +3 -2
  101. package/dist/emit/java/sdk-plan.js +0 -1
  102. package/dist/emit/java/sdk.d.ts +1 -1
  103. package/dist/emit/java/sdk.js +14 -13
  104. package/dist/emit/java/sse.d.ts +2 -4
  105. package/dist/emit/java/sse.js +6 -6
  106. package/dist/emit/java/ws.d.ts +2 -2
  107. package/dist/emit/java/ws.js +3 -4
  108. package/dist/emit/mcp/annotations.js +8 -4
  109. package/dist/emit/mcp/files.js +9 -9
  110. package/dist/emit/mcp/mounted.js +2 -2
  111. package/dist/emit/mcp/output-schema.js +3 -3
  112. package/dist/emit/mcp/registry.d.ts +0 -2
  113. package/dist/emit/mcp/registry.js +5 -4
  114. package/dist/emit/mcp/runtime.js +2 -2
  115. package/dist/emit/mcp/schema.js +22 -11
  116. package/dist/emit/mcp/server.d.ts +7 -7
  117. package/dist/emit/mcp/server.js +7 -6
  118. package/dist/emit/mcp/tools.js +7 -6
  119. package/dist/emit/python/errors.js +3 -3
  120. package/dist/emit/python/realtime.js +2 -2
  121. package/dist/emit/python/sdk-answer.d.ts +3 -7
  122. package/dist/emit/python/sdk-answer.js +2 -2
  123. package/dist/emit/python/sdk-body.js +4 -5
  124. package/dist/emit/python/sdk-client.js +5 -5
  125. package/dist/emit/python/sdk-doc.js +2 -2
  126. package/dist/emit/python/sdk-method.js +5 -5
  127. package/dist/emit/python/sdk-plan.js +0 -1
  128. package/dist/emit/python/sdk-pyproject.d.ts +0 -2
  129. package/dist/emit/python/sdk-pyproject.js +8 -8
  130. package/dist/emit/python/sdk.d.ts +1 -1
  131. package/dist/emit/python/sdk.js +7 -7
  132. package/dist/emit/python/sse.d.ts +0 -2
  133. package/dist/emit/python/sse.js +2 -2
  134. package/dist/emit/python/transport.js +4 -4
  135. package/dist/emit/python/types-dict.d.ts +2 -2
  136. package/dist/emit/python/types-dict.js +1 -1
  137. package/dist/emit/python/types-names.js +2 -2
  138. package/dist/emit/python/types-union.js +1 -1
  139. package/dist/emit/python/types.js +3 -3
  140. package/dist/emit/python/ws.d.ts +2 -5
  141. package/dist/emit/python/ws.js +4 -4
  142. package/dist/emit/rust/errors.js +3 -3
  143. package/dist/emit/rust/http.js +4 -4
  144. package/dist/emit/rust/realtime.js +2 -2
  145. package/dist/emit/rust/sdk-body.js +8 -5
  146. package/dist/emit/rust/sdk-cargo.d.ts +16 -18
  147. package/dist/emit/rust/sdk-cargo.js +12 -12
  148. package/dist/emit/rust/sdk-client.d.ts +1 -1
  149. package/dist/emit/rust/sdk-client.js +3 -3
  150. package/dist/emit/rust/sdk-method.js +2 -2
  151. package/dist/emit/rust/sdk-opts.d.ts +2 -1
  152. package/dist/emit/rust/sdk-opts.js +2 -2
  153. package/dist/emit/rust/sdk-plan.js +0 -1
  154. package/dist/emit/rust/sdk.d.ts +1 -1
  155. package/dist/emit/rust/sdk.js +5 -5
  156. package/dist/emit/rust/sse.d.ts +0 -5
  157. package/dist/emit/rust/sse.js +2 -2
  158. package/dist/emit/rust/types-names.js +3 -3
  159. package/dist/emit/rust/types-struct.js +1 -1
  160. package/dist/emit/rust/types-union.d.ts +1 -1
  161. package/dist/emit/rust/types.js +7 -5
  162. package/dist/emit/rust/ws.d.ts +0 -11
  163. package/dist/emit/rust/ws.js +5 -5
  164. package/dist/emit/shared/escape.js +17 -17
  165. package/dist/emit/shared/format.js +1 -1
  166. package/dist/emit/shared/gofmt.js +1 -1
  167. package/dist/emit/shared/lang.js +10 -10
  168. package/dist/emit/shared/literals.d.ts +5 -0
  169. package/dist/emit/shared/literals.js +8 -0
  170. package/dist/emit/shared/metadata.d.ts +0 -6
  171. package/dist/emit/shared/metadata.js +8 -7
  172. package/dist/emit/shared/ruff.js +1 -1
  173. package/dist/emit/shared/rustfmt.js +1 -1
  174. package/dist/emit/shared/type-emitter.js +37 -20
  175. package/dist/emit/shared/unknown-type.constants.d.ts +2 -0
  176. package/dist/emit/shared/unknown-type.constants.js +2 -0
  177. package/dist/emit/ts/http.d.ts +0 -2
  178. package/dist/emit/ts/http.js +4 -4
  179. package/dist/emit/ts/package.d.ts +14 -12
  180. package/dist/emit/ts/package.js +9 -8
  181. package/dist/emit/ts/route-tree.js +2 -2
  182. package/dist/emit/ts/sdk-types-preamble.d.ts +1 -1
  183. package/dist/emit/ts/sdk-types-preamble.js +2 -2
  184. package/dist/emit/ts/sdk-types.js +11 -11
  185. package/dist/emit/ts/sdk.js +4 -4
  186. package/dist/emit/ts/service-map.d.ts +2 -1
  187. package/dist/emit/ts/tanstack-query.js +6 -6
  188. package/dist/emit/ts/type-gen.js +31 -18
  189. package/dist/emit/ts/webhooks.d.ts +0 -2
  190. package/dist/emit/ts/webhooks.js +3 -3
  191. package/dist/extract/chain.js +5 -4
  192. package/dist/extract/extract.js +5 -5
  193. package/dist/extract/serialize.d.ts +0 -2
  194. package/dist/extract/serialize.js +14 -15
  195. package/dist/extract/walk.js +15 -12
  196. package/dist/gen/args.js +9 -5
  197. package/dist/gen/formatters.js +5 -3
  198. package/dist/gen/shipped.js +2 -2
  199. package/dist/gen/targets.d.ts +2 -4
  200. package/dist/gen/targets.js +8 -4
  201. package/dist/gen/write.js +4 -2
  202. package/dist/index.js +2 -2
  203. package/dist/installers/cli.d.ts +4 -4
  204. package/dist/installers/cli.js +24 -24
  205. package/dist/installers/commands/build.d.ts +4 -4
  206. package/dist/installers/commands/build.js +2 -3
  207. package/dist/installers/commands/check.d.ts +2 -2
  208. package/dist/installers/commands/check.js +11 -10
  209. package/dist/installers/commands/init.d.ts +2 -2
  210. package/dist/installers/commands/init.js +1 -2
  211. package/dist/installers/config/define-config.d.ts +16 -16
  212. package/dist/installers/config/define-config.js +1 -1
  213. package/dist/installers/config/hooks/bun.d.ts +6 -6
  214. package/dist/installers/config/hooks/node.js +1 -1
  215. package/dist/installers/config/load.d.ts +6 -8
  216. package/dist/installers/config/load.js +7 -8
  217. package/dist/installers/config/resolve.d.ts +1 -2
  218. package/dist/installers/config/resolve.js +28 -33
  219. package/dist/installers/config/types.d.ts +6 -6
  220. package/dist/installers/config/types.js +0 -1
  221. package/dist/installers/render/quote.js +3 -5
  222. package/dist/installers/render/render.d.ts +6 -6
  223. package/dist/installers/render/render.js +26 -26
  224. package/dist/installers/ui.d.ts +4 -4
  225. package/dist/installers/ui.js +3 -3
  226. package/dist/ir/build.d.ts +3 -3
  227. package/dist/ir/build.js +8 -5
  228. package/dist/ir/load.js +9 -10
  229. package/dist/ir/model.d.ts +2 -1
  230. package/dist/ir/model.js +0 -1
  231. package/dist/ir/resolve-refs.js +2 -2
  232. package/dist/ir/resource-tree.js +2 -1
  233. package/dist/ir/route-tree-intern.js +1 -1
  234. package/dist/ir/schema.js +3 -3
  235. package/dist/ir/sdk-model.js +3 -3
  236. package/dist/ir/slots.js +13 -8
  237. package/dist/ir/streams.js +1 -1
  238. package/dist/release/bootstrap.d.ts +3 -3
  239. package/dist/release/bootstrap.js +7 -7
  240. package/dist/release/bump-args.js +4 -4
  241. package/dist/release/bump-command.d.ts +1 -1
  242. package/dist/release/bump-command.js +9 -10
  243. package/dist/release/bump.d.ts +5 -4
  244. package/dist/release/bump.js +2 -2
  245. package/dist/release/cli.d.ts +4 -4
  246. package/dist/release/cli.js +4 -4
  247. package/dist/release/codegen.js +1 -1
  248. package/dist/release/digest.js +5 -7
  249. package/dist/release/git.js +5 -8
  250. package/dist/release/load.js +3 -3
  251. package/dist/release/manifest.js +9 -10
  252. package/dist/release/oasdiff.d.ts +10 -15
  253. package/dist/release/oasdiff.js +5 -6
  254. package/dist/release/registries.d.ts +0 -11
  255. package/dist/release/registries.js +17 -17
  256. package/dist/release/release-state.d.ts +16 -13
  257. package/dist/release/release-workflow.js +5 -7
  258. package/dist/release/repo-settings.d.ts +2 -1
  259. package/dist/release/spec-gate.d.ts +0 -2
  260. package/dist/release/spec-gate.js +6 -10
  261. package/dist/release/sync-command.d.ts +2 -2
  262. package/dist/release/sync-command.js +1 -1
  263. package/dist/release/sync-tree.js +9 -13
  264. package/dist/release/sync.d.ts +6 -6
  265. package/dist/release/sync.js +12 -13
  266. package/dist/release/types.d.ts +22 -22
  267. package/dist/release/types.js +0 -1
  268. package/dist/release/version-files.d.ts +3 -4
  269. package/dist/release/version-files.js +4 -5
  270. package/dist/runtime/.oxfmtrc.jsonc +8 -0
  271. package/dist/runtime/mcp/files.ts +1 -1
  272. package/dist/runtime/mcp/http.ts +6 -2
  273. package/dist/runtime/mcp/listen.ts +1 -1
  274. package/dist/runtime/mcp/mount.ts +2 -2
  275. package/dist/runtime/mcp/protocol.ts +1 -1
  276. package/dist/runtime/ts-tanstack-query/query.ts +0 -2
  277. package/package.json +10 -7
  278. package/dist/emit/cli/index.d.ts +0 -1
  279. package/dist/emit/cli/index.js +0 -1
  280. package/dist/emit/csharp/index.d.ts +0 -1
  281. package/dist/emit/csharp/index.js +0 -1
  282. package/dist/emit/go/index.d.ts +0 -1
  283. package/dist/emit/go/index.js +0 -1
  284. package/dist/emit/java/index.d.ts +0 -2
  285. package/dist/emit/java/index.js +0 -2
  286. package/dist/emit/mcp/index.d.ts +0 -3
  287. package/dist/emit/mcp/index.js +0 -3
  288. package/dist/emit/python/index.d.ts +0 -1
  289. package/dist/emit/python/index.js +0 -1
  290. package/dist/emit/rust/index.d.ts +0 -1
  291. package/dist/emit/rust/index.js +0 -1
package/dist/ir/model.js CHANGED
@@ -2,4 +2,3 @@
2
2
  * The IR: what every emitter reads, built from an OpenAPI document and nothing else (H2). This
3
3
  * file holds its types; `schema.ts` reads a JSON Schema into an IR schema and follows refs.
4
4
  */
5
- export {};
@@ -1,5 +1,5 @@
1
1
  const PREFIX = "#/components/schemas/";
2
- /* past this many schema nodes, inlining fails loudly instead of eating the machine */
2
+ // past this many schema nodes, inlining fails loudly instead of eating the machine
3
3
  const MAX_NODES = 200_000;
4
4
  const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
5
5
  /** `schema` with its component ref, if it is one, replaced by a copy of the component, inlined. */
@@ -60,7 +60,7 @@ export function resolveRefs(doc) {
60
60
  inlineContent(response, run);
61
61
  }
62
62
  }
63
- /* schemas were there, so components are */
63
+ // schemas were there, so components are
64
64
  const { schemas: _inlined, ...rest } = components;
65
65
  return { ...doc, components: Object.keys(rest).length > 0 ? rest : undefined, paths };
66
66
  }
@@ -41,8 +41,9 @@ export function buildResourceTree(operations) {
41
41
  at.entries.set(segment, { kind: "namespace", ns });
42
42
  at = ns;
43
43
  }
44
- else
44
+ else {
45
45
  at = entry.ns;
46
+ }
46
47
  }
47
48
  const existing = at.entries.get(leaf);
48
49
  if (existing?.kind === "namespace")
@@ -4,7 +4,7 @@
4
4
  * values JSON cannot carry first, so equal JSON always means equal values.
5
5
  */
6
6
  import { tsString } from "../emit/shared/escape.js";
7
- /* shorter strings and numbers cost less inline than a name */
7
+ // shorter strings and numbers cost less inline than a name
8
8
  const STRING_MIN = 8;
9
9
  const NUMBER_MIN = 8;
10
10
  /** How deeply `value` nests: 0 for a primitive. */
package/dist/ir/schema.js CHANGED
@@ -12,7 +12,7 @@ function isNullable(schema) {
12
12
  /** The schema `schema` makes nullable; never wrapped twice. */
13
13
  function nullableOf(schema) {
14
14
  let inner;
15
- /* only a type list that holds null is stripped; a flag beside any other list drops the flag below */
15
+ // only a type list that holds null is stripped; a flag beside any other list drops the flag below
16
16
  if (Array.isArray(schema.type) && schema.type.includes("null")) {
17
17
  const rest = schema.type.filter((type) => type !== "null");
18
18
  inner = schemaToIR({ ...schema, type: rest.length === 1 ? rest[0] : rest });
@@ -119,7 +119,7 @@ function constOf(schema) {
119
119
  const typed = SCALARS.includes(schema.type) && schema.type !== "null";
120
120
  return typed ? { kind: "const", type: schema.type, value } : { kind: "const", value };
121
121
  }
122
- /* the constraint keywords a value carries (bit 19 c), each read when the spec states it with its JSON type */
122
+ // the constraint keywords a value carries (bit 19 c), each read when the spec states it with its JSON type
123
123
  const BOUNDS = ["minLength", "maxLength", "minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum"];
124
124
  function scalarOf(schema) {
125
125
  if (!SCALARS.includes(schema.type))
@@ -147,7 +147,7 @@ function arrayOf(schema) {
147
147
  array.maxItems = schema.maxItems;
148
148
  return array;
149
149
  }
150
- /* the order matters: a ref before anything it might also say, const before type, nullability before unions */
150
+ // the order matters: a ref before anything it might also say, const before type, nullability before unions
151
151
  const READERS = [
152
152
  (schema) => (typeof schema.$ref === "string" ? { kind: "ref", name: lastSegment(schema.$ref) } : null),
153
153
  (schema) => (Array.isArray(schema.allOf) ? { kind: "allOf", parts: schema.allOf.map(schemaToIR) } : null),
@@ -4,6 +4,7 @@
4
4
  * realtime calls alike, instead of in each emitter.
5
5
  */
6
6
  import { compareCodeUnits } from "../emit/shared/lang.js";
7
+ import {} from "./model.js";
7
8
  import { irResolver } from "./schema.js";
8
9
  import { parseOpenApiPath } from "./slots.js";
9
10
  /** A media type's essence: `Application/JSON; charset=utf-8` → `application/json`. */
@@ -34,9 +35,8 @@ function successOf(op) {
34
35
  const status = codes.find((code) => op.responses[code]?.contentType !== undefined) ?? codes[0];
35
36
  if (status === undefined) {
36
37
  const fallback = op.responses["2XX"] ?? op.responses.default;
37
- if (fallback?.contentType === undefined || !isJsonMedia(fallback.contentType)) {
38
+ if (fallback?.contentType === undefined || !isJsonMedia(fallback.contentType))
38
39
  return { kind: Object.keys(op.responses).length === 0 ? "json" : "none", status: "200" };
39
- }
40
40
  const out = { contentType: fallback.contentType, kind: "json", status: fallback.status };
41
41
  if (fallback.schema !== undefined)
42
42
  out.schema = fallback.schema;
@@ -81,7 +81,7 @@ function streamOf(op) {
81
81
  return "ws";
82
82
  return sse === true ? "sse" : null;
83
83
  }
84
- /* a string-typed schema: a scalar string, or a string const or enum */
84
+ // a string-typed schema: a scalar string, or a string const or enum
85
85
  const isStringSchema = (schema) => (schema.kind === "scalar" && schema.type === "string") ||
86
86
  (schema.kind === "const" && typeof schema.value === "string");
87
87
  /** The SSE response of `op`: its `text/event-stream` answer, if any. */
package/dist/ir/slots.js CHANGED
@@ -1,6 +1,13 @@
1
+ import { compareCodeUnits } from "../emit/shared/lang.js";
2
+ /**
3
+ * One operation's slots in the IR: its parameters by where they travel, its request bodies in
4
+ * preference order, its responses by status, and the backend extensions it carries (realtime, SSE,
5
+ * websocket, invalidation…), and for a Standard Webhooks event, its type and data. Component `$ref`s on
6
+ * parameters, bodies, responses and an event's envelope are followed.
7
+ */
8
+ import {} from "./model.js";
1
9
  import { schemaToIR } from "./schema.js";
2
10
  import { sseEventsOf, websocketMessagesOf } from "./streams.js";
3
- import { compareCodeUnits } from "../emit/shared/lang.js";
4
11
  /** Splits an OpenAPI path template into literal text and `{param}` pieces. */
5
12
  export function parseOpenApiPath(path) {
6
13
  const out = [];
@@ -67,13 +74,12 @@ export function paramsOf(path, op, item, components) {
67
74
  const declared = (op.parameters ?? [])
68
75
  .map((p) => deref(p, components))
69
76
  .filter((p) => p !== undefined);
70
- for (const p of (item.parameters ?? []).map((q) => deref(q, components))) {
77
+ for (const p of (item.parameters ?? []).map((q) => deref(q, components)))
71
78
  if (p !== undefined && !declared.some((d) => d.name === p.name && d.in === p.in))
72
79
  declared.push(p);
73
- }
74
80
  const by = (place) => declared.filter((p) => p.in === place).map(paramOf);
75
81
  const pathParams = by("path");
76
- /* path params in template order; one the template lacks cannot be sent, one it has but nobody declared is a string */
82
+ // path params in template order; one the template lacks cannot be sent, one it has but nobody declared is a string
77
83
  const params = {
78
84
  header: by("header"),
79
85
  path: openApiPathParams(path).map((name) => pathParams.find((p) => p.name === name) ?? { name, required: true, schema: STRING }),
@@ -84,7 +90,7 @@ export function paramsOf(path, op, item, components) {
84
90
  params.cookie = cookie;
85
91
  return params;
86
92
  }
87
- /* JSON first, then the structured kinds; other JSON-like types next, then the rest as listed */
93
+ // JSON first, then the structured kinds; other JSON-like types next, then the rest as listed
88
94
  const PREFERENCE = [
89
95
  "application/json",
90
96
  "application/x-www-form-urlencoded",
@@ -125,12 +131,11 @@ function bodyOf(type, media, required, components) {
125
131
  return { contentType: "application/octet-stream", kind: "stream", required };
126
132
  const ir = schemaToIR(schema);
127
133
  const parts = essence === "multipart/form-data" ? partsOf(ir, components) : [];
128
- if (parts.some((part) => part.type === "file")) {
134
+ if (parts.some((part) => part.type === "file"))
129
135
  return { contentType: "multipart/form-data", kind: "multipart", parts, required, schema: ir };
130
- }
131
136
  return { contentType: type, kind: "raw", required, schema: ir };
132
137
  }
133
- /* a urlencoded form cannot carry a file, so a multipart one with a file part ranks just above it */
138
+ // a urlencoded form cannot carry a file, so a multipart one with a file part ranks just above it
134
139
  const weight = (body) => body.kind === "multipart" ? rank("application/x-www-form-urlencoded") - 0.5 : rank(body.contentType);
135
140
  /** Every request body the operation declares, preferred first. */
136
141
  export function requestBodies(op, components) {
@@ -21,7 +21,7 @@ export function sseEventsOf(itemSchema, follow) {
21
21
  return [{ data: dataOf(properties.data), name: event ?? "message" }];
22
22
  });
23
23
  }
24
- /* an event's data: what `contentSchema` encodes when it is there, else the schema itself */
24
+ // an event's data: what `contentSchema` encodes when it is there, else the schema itself
25
25
  function dataOf(data) {
26
26
  if (!isObject(data))
27
27
  return { kind: "unknown" };
@@ -2,7 +2,7 @@ import { type ReleaseContext } from "./context.ts";
2
2
  /** The most commits a public repo's branch may hold for `--force-bootstrap` to overwrite it: a stub, not history. */
3
3
  export declare const FORCE_COMMIT_LIMIT = 2;
4
4
  /** What `release bootstrap` prints when it is not told what to target. */
5
- export declare const USAGE: string[];
5
+ export declare const USAGE: readonly string[];
6
6
  /**
7
7
  * Returns commit count on the remote branch, capped at FORCE_COMMIT_LIMIT + 1.
8
8
  * Used to gate --force-bootstrap: only mirrors with ≤FORCE_COMMIT_LIMIT commits
@@ -10,7 +10,7 @@ export declare const USAGE: string[];
10
10
  */
11
11
  export declare function countRemoteCommits(httpsUrl: string, branch: string): Promise<number>;
12
12
  /** What `release bootstrap` was asked for. */
13
- export interface BootstrapOptions {
13
+ export type BootstrapOptions = {
14
14
  /** Every package of the release. */
15
15
  all: boolean;
16
16
  /** The release config's path; required. */
@@ -19,7 +19,7 @@ export interface BootstrapOptions {
19
19
  forceBootstrap: boolean;
20
20
  /** The packages to bootstrap, by `name` or `project/name`. */
21
21
  only: string[] | undefined;
22
- }
22
+ };
23
23
  /** A parse that succeeded with `options`, or failed with an `error` to show the caller. */
24
24
  export type ParsedArgs = {
25
25
  error: string;
@@ -44,7 +44,7 @@ export async function countRemoteCommits(httpsUrl, branch) {
44
44
  rmSync(tmpDir, { force: true, recursive: true });
45
45
  }
46
46
  }
47
- /* Unknown arguments are ignored. */
47
+ // Unknown arguments are ignored.
48
48
  const SWITCHES = { "--all": "all", "--force-bootstrap": "forceBootstrap" };
49
49
  const VALUE_FLAGS = { "--config": "config", "--name": "only", "--only": "only" };
50
50
  const isSwitch = (arg) => Object.hasOwn(SWITCHES, arg);
@@ -106,7 +106,7 @@ export function judgeMirror(input) {
106
106
  }
107
107
  return { proceed: true };
108
108
  }
109
- /* one package bootstrapped: its outcome, reported as it goes */
109
+ // one package bootstrapped: its outcome, reported as it goes
110
110
  async function bootstrapOne(entry, run, ctx) {
111
111
  ctx.out(`\n→ ${packageKey(entry)} → ${entry.mirror}\n`);
112
112
  const httpsUrl = sshToHttps(entry.mirror, run.token);
@@ -121,9 +121,9 @@ async function bootstrapOne(entry, run, ctx) {
121
121
  ctx.err(` fail: ${verdict.reason}\n`);
122
122
  return "failed";
123
123
  }
124
- /* Bootstrap commits force-overwrite the mirror with a fresh "initial release" snapshot. bootstrapExclude globs
125
- skip generated source on the initial push, so the next sync adds it cleanly. A repo bootstrap creates is exactly
126
- one whose description, website and topics are empty, so the settings step fills them. */
124
+ // Bootstrap commits force-overwrite the mirror with a fresh "initial release" snapshot. bootstrapExclude globs
125
+ // skip generated source on the initial push, so the next sync adds it cleanly. A repo bootstrap creates is exactly
126
+ // one whose description, website and topics are empty, so the settings step fills them.
127
127
  const result = await syncPackage(entry, {
128
128
  applyBootstrapExclude: true,
129
129
  dryRun: false,
@@ -142,12 +142,12 @@ async function bootstrapOne(entry, run, ctx) {
142
142
  ctx.out(` skip: ${result.reason}\n`);
143
143
  return "skipped";
144
144
  }
145
- /* a push that is no dry run always reports both shas */
145
+ // a push that is no dry run always reports both shas
146
146
  const [source, mirror] = [result.sourceSha, result.mirrorSha];
147
147
  ctx.out(` ok: source=${source.slice(0, SHORT_SHA_LENGTH)} mirror=${mirror.slice(0, SHORT_SHA_LENGTH)}\n`);
148
148
  return "synced";
149
149
  }
150
- /* the packages a bootstrap targets, bootstrapped one after another; the exit code it ends with */
150
+ // the packages a bootstrap targets, bootstrapped one after another; the exit code it ends with
151
151
  async function bootstrapAll(release, options, token, ctx) {
152
152
  const targets = filterPackages(release.packages, { only: options.only });
153
153
  if (targets.length === 0) {
@@ -1,9 +1,9 @@
1
- /* Each flag takes the next argument as its value, unless that argument is a switch. */
1
+ // Each flag takes the next argument as its value, unless that argument is a switch.
2
2
  const BUMP_FLAGS = { "--config": "config" };
3
- /* Bare flags: present or not. */
3
+ // Bare flags: present or not.
4
4
  const BUMP_SWITCHES = { "--major": "major" };
5
- /* The value of every `flags` entry and the presence of every `switches` entry in `argv`, or the first argument that
6
- * is neither. */
5
+ // The value of every `flags` entry and the presence of every `switches` entry in `argv`, or the first argument that
6
+ // is neither.
7
7
  function readFlags(flags, switches, argv) {
8
8
  const values = {};
9
9
  const set = {};
@@ -1,6 +1,6 @@
1
1
  import type { ReleaseContext } from "./context.ts";
2
- import type { Release } from "./types.ts";
3
2
  import { type ReleaseState } from "./release-state.ts";
3
+ import type { Release } from "./types.ts";
4
4
  /** The header every CHANGELOG bump writes starts with; entries go directly under it, newest first. */
5
5
  export declare const CHANGELOG_HEADER = "# Changelog\n\n";
6
6
  /**
@@ -9,8 +9,8 @@ import * as fs from "node:fs/promises";
9
9
  import { tmpdir } from "node:os";
10
10
  import * as path from "node:path";
11
11
  import { decide } from "./bump.js";
12
- import { CHANGELOG_FILE, ENOENT, MAX_OUTPUT_BYTES, PORCELAIN_PREFIX_LENGTH, RELEASE_STATE } from "./constants.js";
13
12
  import { regenerate } from "./codegen.js";
13
+ import { CHANGELOG_FILE, ENOENT, MAX_OUTPUT_BYTES, PORCELAIN_PREFIX_LENGTH, RELEASE_STATE } from "./constants.js";
14
14
  import { handDigest, outputDigest } from "./digest.js";
15
15
  import { apiChanges } from "./oasdiff.js";
16
16
  import { releaseStateSchema } from "./release-state.js";
@@ -50,7 +50,7 @@ async function prependChangelog(changelogFile, entry) {
50
50
  await fs.writeFile(changelogFile, prependEntry(existing, entry), "utf8");
51
51
  }
52
52
  const git = (root, ...args) => execFileSync("git", args, { cwd: root, encoding: "utf8", maxBuffer: MAX_OUTPUT_BYTES });
53
- /* The committed spec as HEAD holds it; refuses a working copy that differs, since the state records HEAD. */
53
+ // The committed spec as HEAD holds it; refuses a working copy that differs, since the state records HEAD.
54
54
  function committedSpec({ root, spec }) {
55
55
  const specPath = path.relative(root, spec.committedPath);
56
56
  const sha = canonicalSha(JSON.parse(readFileSync(spec.committedPath, "utf8")));
@@ -66,7 +66,7 @@ function committedSpec({ root, spec }) {
66
66
  }
67
67
  return { commit: git(root, "rev-parse", "HEAD").trim(), path: specPath, sha };
68
68
  }
69
- /* oasdiff from each released spec to the committed one, run once per released spec. */
69
+ // oasdiff from each released spec to the committed one, run once per released spec.
70
70
  function changesSince(release, env) {
71
71
  const found = new Map();
72
72
  return (released) => {
@@ -74,9 +74,8 @@ function changesSince(release, env) {
74
74
  if (cached !== undefined)
75
75
  return cached;
76
76
  const base = git(release.root, "show", `${released.commit}:${released.path}`);
77
- if (canonicalSha(JSON.parse(base)) !== released.sha) {
77
+ if (canonicalSha(JSON.parse(base)) !== released.sha)
78
78
  throw new Error(`${released.commit}:${released.path} is not the spec the release recorded (${released.sha})`);
79
- }
80
79
  const dir = mkdtempSync(path.join(tmpdir(), "oss-release-spec-"));
81
80
  try {
82
81
  const file = path.join(dir, "released.json");
@@ -90,14 +89,14 @@ function changesSince(release, env) {
90
89
  }
91
90
  };
92
91
  }
93
- /* Paths under `dir` that differ from HEAD (tracked or new, never ignored), repo-relative. */
92
+ // Paths under `dir` that differ from HEAD (tracked or new, never ignored), repo-relative.
94
93
  function changedPaths(root, dir) {
95
94
  return git(root, "status", "--porcelain=v1", "-z", "--untracked-files=all", "--", dir)
96
95
  .split("\0")
97
96
  .filter((entry) => entry.length > PORCELAIN_PREFIX_LENGTH)
98
97
  .map((entry) => entry.slice(PORCELAIN_PREFIX_LENGTH));
99
98
  }
100
- /* each package's decision from its digests now and its last release */
99
+ // each package's decision from its digests now and its last release
101
100
  async function plan(release, major, env) {
102
101
  const spec = committedSpec(release);
103
102
  const changes = changesSince(release, env);
@@ -105,7 +104,7 @@ async function plan(release, major, env) {
105
104
  const planned = [];
106
105
  for (const pkg of release.packages) {
107
106
  const dir = path.join(release.root, pkg.path);
108
- /* a version file bump cannot read fails the run before anything is written */
107
+ // a version file bump cannot read fails the run before anything is written
109
108
  readVersions(dir);
110
109
  const previous = await readPrevious(path.join(dir, RELEASE_STATE));
111
110
  const observed = { hand: handDigest(release.root, pkg), output: outputDigest(release.root, pkg, spec.sha), spec };
@@ -121,7 +120,7 @@ async function plan(release, major, env) {
121
120
  }
122
121
  return planned;
123
122
  }
124
- /* writes one package's state and changelog, and reports every path its release touched */
123
+ // writes one package's state and changelog, and reports every path its release touched
125
124
  async function record(release, { decision, dir, now, observed, pkg }, versionFiles, ctx) {
126
125
  const { root } = release;
127
126
  const state = {
@@ -174,7 +173,7 @@ export async function runBump(release, major, ctx) {
174
173
  ctx.out("no changes since last release\n");
175
174
  return 0;
176
175
  }
177
- /* versions first, then codegen at those versions, so the recorded digests are the released output's */
176
+ // versions first, then codegen at those versions, so the recorded digests are the released output's
178
177
  const written = releasing.map((planned) => ({
179
178
  files: writeVersions(planned.dir, planned.decision.nextVersion),
180
179
  planned,
@@ -6,7 +6,7 @@ export type Observed = {
6
6
  output: string;
7
7
  spec: ReleaseState["spec"];
8
8
  };
9
- export type ReleaseKind = "initial" | "major" | "minor" | "patch";
9
+ type ReleaseKind = "initial" | "major" | "minor" | "patch";
10
10
  export type Decision = {
11
11
  kind: "none";
12
12
  } | {
@@ -14,7 +14,7 @@ export type Decision = {
14
14
  kind: ReleaseKind;
15
15
  nextVersion: string;
16
16
  };
17
- export interface DecideInput {
17
+ export type DecideInput = {
18
18
  /** oasdiff from the released spec to the observed one; called only when the output changed and the spec moved */
19
19
  changes: (released: ReleaseState["spec"]) => readonly ApiChange[];
20
20
  /** the first release's CHANGELOG text */
@@ -23,11 +23,12 @@ export interface DecideInput {
23
23
  major?: boolean;
24
24
  now: Date;
25
25
  observed: Observed;
26
- previous?: ReleaseState;
27
- }
26
+ previous?: ReleaseState | undefined;
27
+ };
28
28
  /**
29
29
  * Whether a package releases and at what level. Nothing releases while its output and hand files match the last
30
30
  * release, even when the spec moved (a package may expose only part of it). A changed output on a moved spec with
31
31
  * any oasdiff entry is a minor; every other change is a patch; `major` makes any release a major.
32
32
  */
33
33
  export declare function decide(input: DecideInput): Decision;
34
+ export {};
@@ -7,11 +7,11 @@ function nextVersion(version, kind) {
7
7
  return `${major}.${minor + 1}.0`;
8
8
  return `${major}.${minor}.${patch + 1}`;
9
9
  }
10
- /* Every package stays on its major line: any API change, breaking or not, is a minor; a major is only ever asked for. */
10
+ // Every package stays on its major line: any API change, breaking or not, is a minor; a major is only ever asked for.
11
11
  function levelOf(changes) {
12
12
  return changes.length > 0 ? "minor" : "patch";
13
13
  }
14
- /* Each operation once, under the first section it belongs to: breaking, then added, then changed. */
14
+ // Each operation once, under the first section it belongs to: breaking, then added, then changed.
15
15
  function sections(changes) {
16
16
  const byOperation = new Map();
17
17
  for (const change of changes) {
@@ -6,15 +6,15 @@
6
6
  import type { Io } from "../cli.ts";
7
7
  import { type LoadReleaseOptions } from "./load.ts";
8
8
  /** What `clients release` prints when it is given no command, or one it does not know. */
9
- export declare const USAGE = "usage: clients release <command> --config <path> [options]\n\n bump --config <path> [--major]\n regenerate, then release each package whose output or hand files changed: any API change is a minor,\n --major makes each release a major\n sync --config <path> [--only <names>] [--dry-run] [--validate-only]\n mirror each package into its public repo (release sync --help says more)\n bootstrap --config <path> (--all | --only <names>) [--force-bootstrap]\n the first push to an empty public repo, or over the stub a new one starts with\n codegen --config <path>\n run the config's codegen from the repo root, as bump does before it decides\n toolchains --config <path>\n print the config's toolchains, one per line: the system.config.ts names its codegen needs\n";
9
+ export declare const USAGE: string;
10
10
  /** What a release run reads beside its arguments; each defaults to the running process's own. */
11
11
  export type ReleaseOptions = {
12
12
  /** The environment: `GH_TOKEN`, and what codegen and Go run with. */
13
- readonly env?: NodeJS.ProcessEnv;
13
+ readonly env?: NodeJS.ProcessEnv | undefined;
14
14
  /** The fetch the spec gate and the GitHub settings step use. */
15
- readonly fetch?: typeof fetch;
15
+ readonly fetch?: typeof fetch | undefined;
16
16
  /** How the release config is imported (`loadRelease`'s options). */
17
- readonly load?: LoadReleaseOptions;
17
+ readonly load?: LoadReleaseOptions | undefined;
18
18
  };
19
19
  /**
20
20
  * Runs `clients release <argv>`: the exit code it ends with. A usage mistake is one line naming the command; any
@@ -5,7 +5,7 @@ import { regenerate } from "./codegen.js";
5
5
  import { parseConfigOnly, ReleaseUsageError } from "./context.js";
6
6
  import { readRelease } from "./load.js";
7
7
  import { sync } from "./sync-command.js";
8
- /* the usage entries of the commands that take only --config, each also its own --help */
8
+ // the usage entries of the commands that take only --config, each also its own --help
9
9
  const CODEGEN_USAGE = `codegen --config <path>
10
10
  run the config's codegen from the repo root, as bump does before it decides
11
11
  `;
@@ -23,14 +23,14 @@ export const USAGE = `usage: clients release <command> --config <path> [options]
23
23
  bootstrap --config <path> (--all | --only <names>) [--force-bootstrap]
24
24
  the first push to an empty public repo, or over the stub a new one starts with
25
25
  ${CODEGEN_USAGE} ${TOOLCHAINS_USAGE}`;
26
- /* `release bump <argv>`: the release its config describes, bumped */
26
+ // `release bump <argv>`: the release its config describes, bumped
27
27
  async function bump(argv, ctx) {
28
28
  const parsed = parseBumpArgs(argv);
29
29
  if (!parsed.ok)
30
30
  throw new ReleaseUsageError(parsed.error);
31
31
  return runBump(await ctx.load(parsed.value.config), parsed.value.major, ctx);
32
32
  }
33
- /* `release codegen <argv>`: the config's codegen, run as bump runs it */
33
+ // `release codegen <argv>`: the config's codegen, run as bump runs it
34
34
  async function codegen(argv, ctx) {
35
35
  const parsed = parseConfigOnly(argv);
36
36
  if (parsed.help) {
@@ -40,7 +40,7 @@ async function codegen(argv, ctx) {
40
40
  regenerate(await ctx.load(parsed.config), ctx.env);
41
41
  return 0;
42
42
  }
43
- /* `release toolchains <argv>`: the config's toolchains, one per line, for a workflow to install before codegen */
43
+ // `release toolchains <argv>`: the config's toolchains, one per line, for a workflow to install before codegen
44
44
  async function toolchains(argv, ctx) {
45
45
  const parsed = parseConfigOnly(argv);
46
46
  if (parsed.help) {
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { spawnSync } from "node:child_process";
7
7
  import { RELEASE_VERSIONS_ENV } from "./manifest.js";
8
- /* codegen's own output goes to stderr's descriptor, so stdout stays the command's report */
8
+ // codegen's own output goes to stderr's descriptor, so stdout stays the command's report
9
9
  const STDERR_FD = 2;
10
10
  /**
11
11
  * Runs the product's codegen from the repo root in `env`, with `versions` (package name to version) as
@@ -6,13 +6,11 @@ import { MANIFEST } from "../gen/write.js";
6
6
  import { CHANGELOG_FILE, RELEASE_STATE } from "./constants.js";
7
7
  import { canonicalSha, generatedFiles, generatedPaths } from "./spec-gate.js";
8
8
  import { VERSION_FILES } from "./version-files.js";
9
- /*
10
- * What a release is cut from, as two digests `.release-state.json` records: the generated output and the hand
11
- * files. A package releases when either moved since its last release.
12
- */
13
- /* Files bump itself writes on every release, so they never count as a change. */
9
+ // What a release is cut from, as two digests `.release-state.json` records: the generated output and the hand
10
+ // files. A package releases when either moved since its last release.
11
+ // Files bump itself writes on every release, so they never count as a change.
14
12
  const BUMP_WRITES = [RELEASE_STATE, CHANGELOG_FILE];
15
- /* A version file hashes as if it held this version, so a release's own version move is not a change. */
13
+ // A version file hashes as if it held this version, so a release's own version move is not a change.
16
14
  const NORMALIZED_VERSION = "0.0.0";
17
15
  const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
18
16
  /**
@@ -46,7 +44,7 @@ export function handDigest(repoRoot, pkg) {
46
44
  if (rel === MANIFEST || BUMP_WRITES.includes(rel) || generated.has(rel))
47
45
  continue;
48
46
  const full = join(dir, rel);
49
- /* a tracked file deleted in the worktree is a change too */
47
+ // a tracked file deleted in the worktree is a change too
50
48
  if (!existsSync(full)) {
51
49
  files[rel] = "deleted";
52
50
  continue;
@@ -1,10 +1,8 @@
1
1
  import { spawn } from "node:child_process";
2
- /*
3
- * The variables git exports to a hook, which every child process inherits. A `cwd` does not
4
- * override them: with GIT_DIR set, `git init` in a sandbox re-initialises the enclosing repository
5
- * and a commit lands there. The pre-push hook runs this package's tests, so they have to be
6
- * cleared or a test's sandbox writes into the repository being pushed.
7
- */
2
+ // The variables git exports to a hook, which every child process inherits. A `cwd` does not
3
+ // override them: with GIT_DIR set, `git init` in a sandbox re-initialises the enclosing repository
4
+ // and a commit lands there. The pre-push hook runs this package's tests, so they have to be
5
+ // cleared or a test's sandbox writes into the repository being pushed.
8
6
  const INHERITED_GIT_VARS = [
9
7
  "GIT_ALTERNATE_OBJECT_DIRECTORIES",
10
8
  "GIT_COMMON_DIR",
@@ -35,9 +33,8 @@ function runGit(args, cwd) {
35
33
  /** `git args` in `cwd`: its trimmed stdout; throws with its stderr when it exits non-zero. */
36
34
  export async function gitOutput(args, cwd) {
37
35
  const result = await runGit(args, cwd);
38
- if (result.exitCode !== 0) {
36
+ if (result.exitCode !== 0)
39
37
  throw new Error(`git ${args.join(" ")} failed: ${result.stderr.trim()}`);
40
- }
41
38
  return result.stdout.trim();
42
39
  }
43
40
  /** `git args` in `cwd`, for its effect; throws with its stderr when it exits non-zero. */
@@ -22,7 +22,7 @@ import { gitOutput } from "./git.js";
22
22
  import { placeRelease } from "./manifest.js";
23
23
  /** The specifier a release config imports `defineRelease` from, resolved to the running package. */
24
24
  export const RELEASE_SPECIFIER = "@workerstack/clients/release";
25
- /* the config's default export, imported with the self-resolve hook in place for the import alone */
25
+ // the config's default export, imported with the self-resolve hook in place for the import alone
26
26
  async function importConfig(path, options) {
27
27
  const runtime = options.runtime ?? detectRuntime();
28
28
  const ext = extname(path);
@@ -31,7 +31,7 @@ async function importConfig(path, options) {
31
31
  "run clients with Bun, or upgrade Node");
32
32
  }
33
33
  const importModule = options.importModule ?? ((url) => import(__rewriteRelativeImportExtension(url)));
34
- /* the sibling entry in this module's own form: index.ts from a checkout's source, index.js from an install */
34
+ // the sibling entry in this module's own form: index.ts from a checkout's source, index.js from an install
35
35
  const selfUrl = options.selfUrl ?? new URL(`./index${extname(new URL(import.meta.url).pathname)}`, import.meta.url).href;
36
36
  let hook;
37
37
  if (runtime.bun)
@@ -58,7 +58,7 @@ async function importConfig(path, options) {
58
58
  export async function readRelease(configPath, options) {
59
59
  if (!existsSync(configPath))
60
60
  throw new Error(`${configPath}: no such release config`);
61
- /* git reports its toplevel with symlinks resolved, so the config's path is too: one is made relative to the other */
61
+ // git reports its toplevel with symlinks resolved, so the config's path is too: one is made relative to the other
62
62
  const path = realpathSync(resolve(configPath));
63
63
  const root = await gitOutput(["rev-parse", "--show-toplevel"], dirname(path)).catch((error) => {
64
64
  throw new Error(`${configPath}: not inside a git repository`, { cause: error });
@@ -9,15 +9,15 @@ import * as z from "zod";
9
9
  import { TARGETS } from "../gen/targets.js";
10
10
  import { DEFAULT_COMMITTER, DESCRIPTION_MAX, HTTP_PROTOCOL, HTTPS_PROTOCOL, TOPICS_MAX } from "./constants.js";
11
11
  const SLUG = /^[a-z][a-z0-9-]*$/;
12
- /* a topic is GitHub's lowercase slug of up to 50 characters */
12
+ // a topic is GitHub's lowercase slug of up to 50 characters
13
13
  const TOPIC = /^[a-z0-9][a-z0-9-]{0,49}$/;
14
- /* https, or http on loopback for tests */
14
+ // https, or http on loopback for tests
15
15
  const LOOPBACK = ["127.0.0.1", "localhost", "[::1]"];
16
16
  /** The one shape of a public repo's remote that sync pushes to: an SSH URL on github.com. */
17
17
  export const MIRROR_ALLOWLIST = /^git@github\.com:[a-z0-9-]+\/[a-z0-9-]+\.git$/;
18
18
  /** Env var bump sets for codegen: JSON `{ [packageName]: version }`, the version each package generates at. */
19
19
  export const RELEASE_VERSIONS_ENV = "RELEASE_VERSIONS";
20
- /* one entry per METADATA_FIELDS name */
20
+ // one entry per METADATA_FIELDS name
21
21
  function packageMetadata() {
22
22
  const text = z.string().min(1).optional();
23
23
  const list = z.array(z.string().min(1)).optional();
@@ -36,7 +36,7 @@ function packageMetadata() {
36
36
  repository: text,
37
37
  });
38
38
  }
39
- /* names come from the package's own files, so a registry carries only what those files cannot say */
39
+ // names come from the package's own files, so a registry carries only what those files cannot say
40
40
  function registry() {
41
41
  return z.discriminatedUnion("kind", [
42
42
  z.object({ kind: z.enum(["crates", "go", "jsr", "maven", "npm", "nuget", "pypi"]) }),
@@ -70,7 +70,7 @@ function releaseManifest() {
70
70
  return z
71
71
  .object({
72
72
  codegen: z.array(z.string().min(1)).min(1),
73
- /* git takes any address; a GitHub App's bot address (`123+app[bot]@users.noreply.github.com`) is no RFC email */
73
+ // git takes any address; a GitHub App's bot address (`123+app[bot]@users.noreply.github.com`) is no RFC email
74
74
  committer: z
75
75
  .strictObject({ email: z.string().regex(/^[^\s@]+@[^\s@]+$/, "an email address"), name: z.string().min(1) })
76
76
  .default(DEFAULT_COMMITTER),
@@ -107,20 +107,20 @@ function metadataOf(product, own) {
107
107
  const keywords = [...(product?.keywords ?? []), ...(own?.keywords ?? [])];
108
108
  return { ...product, ...own, ...(keywords.length === 0 ? {} : { keywords }) };
109
109
  }
110
- /* the slug the config names, read before the rest: every package's key and the codegen's filter depend on it */
110
+ // the slug the config names, read before the rest: every package's key and the codegen's filter depend on it
111
111
  function projectOf(file, raw) {
112
112
  const project = typeof raw === "object" && raw !== null ? raw.project : undefined;
113
113
  if (typeof project === "string" && SLUG.test(project))
114
114
  return project;
115
115
  throw new Error(`${file}: project: expected a slug, got ${JSON.stringify(project) ?? "undefined"}`);
116
116
  }
117
- /* the dirs beside the config that are neither a listed package nor hidden: a package the config forgot */
117
+ // the dirs beside the config that are neither a listed package nor hidden: a package the config forgot
118
118
  function unlistedDirs(configDir, listed) {
119
119
  return readdirSync(configDir, { withFileTypes: true })
120
120
  .filter((entry) => entry.isDirectory() && !entry.name.startsWith(".") && !listed.has(entry.name))
121
121
  .map((entry) => join(configDir, entry.name));
122
122
  }
123
- /* the config's schema-checked contents; throws listing every issue, naming the config */
123
+ // the config's schema-checked contents; throws listing every issue, naming the config
124
124
  function parsed(file, raw) {
125
125
  const result = releaseManifest().safeParse(raw);
126
126
  if (result.success)
@@ -138,9 +138,8 @@ export function placeRelease(raw, root, configPath) {
138
138
  const project = projectOf(file, raw);
139
139
  const data = parsed(file, raw);
140
140
  const committedPath = join(root, data.spec.committedPath);
141
- if (!existsSync(committedPath)) {
141
+ if (!existsSync(committedPath))
142
142
  throw new Error(`${file}: spec.committedPath ${data.spec.committedPath} does not exist`);
143
- }
144
143
  const spec = { committedPath, deployedUrl: data.spec.deployedUrl };
145
144
  const configDir = dirname(configPath);
146
145
  const packages = data.packages.map((pkg) => ({