From fee6b8cb95e605b02896d37de78df626ac74941e Mon Sep 17 00:00:00 2001 From: leemour Date: Wed, 25 Nov 2026 02:18:47 +0100 Subject: [PATCH 1/2] fix(codegen): generated manifests import from /codegen/runtime by default DEBT-386. The manifest and definitions generators defaulted coreImport to the experimental /codegen entry, so every CLI passed /codegen/runtime by hand. /codegen/runtime now also exports Binding, HttpBinding, RpcBinding and Confidence, which hubspot reached through ManifestOperation. The API report gains the four types. Co-Authored-By: Claude Opus 5.5 --- api/codegen-runtime.api.txt | 11 +++++++++++ changes/fix-codegen-runtime-default.md | 10 ++++++++++ src/codegen/manifest.ts | 4 ++-- src/codegen/openapi.test.ts | 2 +- src/codegen/runtime.ts | 4 ++++ 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 changes/fix-codegen-runtime-default.md diff --git a/api/codegen-runtime.api.txt b/api/codegen-runtime.api.txt index f765e91..4ffa5a5 100644 --- a/api/codegen-runtime.api.txt +++ b/api/codegen-runtime.api.txt @@ -8,6 +8,8 @@ ApiServer · interface · enum?: readonly string[]; ApiServer · interface · description?: string; ApiServer · interface · }>>; ApiServer · interface · } +Binding · type · export type Binding = HttpBinding | RpcBinding | GraphqlBinding; +Confidence · type · export type Confidence = "contract" | "example" | "inferred" | "override"; Effect · type · export type Effect = "read" | "write" | "destructive"; GraphqlBinding · interface · export interface GraphqlBinding { GraphqlBinding · interface · kind: "graphql"; @@ -16,6 +18,11 @@ GraphqlBinding · interface · field: string; GraphqlBinding · interface · variables: Readonly>; GraphqlBinding · interface · selection: string; GraphqlBinding · interface · } +HttpBinding · interface · export interface HttpBinding { +HttpBinding · interface · kind: "http"; +HttpBinding · interface · method: HttpMethod; +HttpBinding · interface · path: string; +HttpBinding · interface · } ManifestOperation · interface · export interface ManifestOperation { ManifestOperation · interface · id: string; ManifestOperation · interface · command: string; @@ -93,6 +100,10 @@ Pagination · type · style: "link"; Pagination · type · next: string; Pagination · type · items?: string; Pagination · type · }; +RpcBinding · interface · export interface RpcBinding { +RpcBinding · interface · kind: "rpc"; +RpcBinding · interface · name: string; +RpcBinding · interface · } SchemaNode · type · export type SchemaNode = SchemaCommon & ({ SchemaNode · type · type: "ref"; SchemaNode · type · ref: string; diff --git a/changes/fix-codegen-runtime-default.md b/changes/fix-codegen-runtime-default.md new file mode 100644 index 0000000..f78ac2b --- /dev/null +++ b/changes/fix-codegen-runtime-default.md @@ -0,0 +1,10 @@ +### Added + +- **`/codegen/runtime` exports `Binding`, `HttpBinding`, `RpcBinding` and `Confidence`.** A CLI that reads an + operation's binding or how far it is trusted no longer imports the experimental `/codegen` for the type. + +### Changed — may break callers + +- **The generated manifest and definitions import their types from `@wirecat/cli-base/codegen/runtime`** when + `coreImport` is not given, not from `/codegen`. Every type they name is there, and `/codegen/runtime` is part of + the stable API, so a CLI no longer passes `coreImport` by hand. Regenerating changes that one import line. diff --git a/src/codegen/manifest.ts b/src/codegen/manifest.ts index cc4e650..f13ded3 100644 --- a/src/codegen/manifest.ts +++ b/src/codegen/manifest.ts @@ -92,7 +92,7 @@ export const manifestGenerator = ).filter(([, , , value]) => value !== undefined) const types = ["ManifestOperation", ...extras.map(([, type]) => type)].sort() const content = [ - `import type { ${types.join(", ")} } from "${options.coreImport ?? "@wirecat/cli-base/codegen"}"`, + `import type { ${types.join(", ")} } from "${options.coreImport ?? "@wirecat/cli-base/codegen/runtime"}"`, "", `export const operations: readonly ManifestOperation[] = ${JSON.stringify(operations, null, 2)}`, ...extras.flatMap(([name, , type, value]) => [ @@ -112,7 +112,7 @@ export const definitionsGenerator = return [ { path: options.path, - content: `import type { SchemaNode } from "${options.coreImport ?? "@wirecat/cli-base/codegen"}"\n\nexport const definitions: Readonly> = ${JSON.stringify(definitions, null, 2)}\n`, + content: `import type { SchemaNode } from "${options.coreImport ?? "@wirecat/cli-base/codegen/runtime"}"\n\nexport const definitions: Readonly> = ${JSON.stringify(definitions, null, 2)}\n`, }, ] } diff --git a/src/codegen/openapi.test.ts b/src/codegen/openapi.test.ts index d22aa24..76f3084 100644 --- a/src/codegen/openapi.test.ts +++ b/src/codegen/openapi.test.ts @@ -668,7 +668,7 @@ describe("adaptOpenApi reads what a CLI would otherwise write by hand", () => { expect(model.operations.find((candidate) => candidate.id === "open")?.security).toEqual([]) const [manifest] = generate(model, [manifestGenerator({ path: "manifest.ts" })], { banner: [] }) expect(manifest?.content).toContain( - 'import type { ApiServer, ManifestOperation, SecurityRequirement, SecurityScheme } from "@wirecat/cli-base/codegen"', + 'import type { ApiServer, ManifestOperation, SecurityRequirement, SecurityScheme } from "@wirecat/cli-base/codegen/runtime"', ) expect(manifest?.content).toContain('"security": []') }) diff --git a/src/codegen/runtime.ts b/src/codegen/runtime.ts index e74779e..6622362 100644 --- a/src/codegen/runtime.ts +++ b/src/codegen/runtime.ts @@ -78,12 +78,16 @@ export const unique = (items: readonly unknown[]): boolean => export type { ManifestOperation } from "./manifest.js" export type { ApiServer, + Binding, + Confidence, Effect, GraphqlBinding, + HttpBinding, OAuthFlow, OperationPermission, PageParameter, Pagination, + RpcBinding, SchemaNode, SecurityRequirement, SecurityScheme, From a08af33d9628e63420fe9156335a8cec8170c462 Mon Sep 17 00:00:00 2001 From: leemour Date: Wed, 25 Nov 2026 03:11:36 +0100 Subject: [PATCH 2/2] docs(changelog): the generator's default import is an experimental change Co-Authored-By: Claude Opus 5.5 --- changes/fix-codegen-runtime-default.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/fix-codegen-runtime-default.md b/changes/fix-codegen-runtime-default.md index f78ac2b..4524fb0 100644 --- a/changes/fix-codegen-runtime-default.md +++ b/changes/fix-codegen-runtime-default.md @@ -3,7 +3,7 @@ - **`/codegen/runtime` exports `Binding`, `HttpBinding`, `RpcBinding` and `Confidence`.** A CLI that reads an operation's binding or how far it is trusted no longer imports the experimental `/codegen` for the type. -### Changed — may break callers +### Changed — experimental - **The generated manifest and definitions import their types from `@wirecat/cli-base/codegen/runtime`** when `coreImport` is not given, not from `/codegen`. Every type they name is there, and `/codegen/runtime` is part of