@workerstack/clients 1.0.0-rc.28 → 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.
- package/README.md +403 -21
- package/assets/installers/examples/github.config.ts +17 -19
- package/assets/installers/examples/goreleaser.config.ts +16 -18
- package/assets/installers/examples/raw.config.ts +13 -15
- package/bin/clients.js +87 -66
- package/bin/installgen.js +19 -10
- package/dist/cli.d.ts +4 -4
- package/dist/cli.js +18 -12
- package/dist/emit/cli/channels.d.ts +2 -2
- package/dist/emit/cli/channels.js +18 -13
- package/dist/emit/cli/commands.d.ts +1 -1
- package/dist/emit/cli/commands.js +39 -13
- package/dist/emit/cli/discovery.d.ts +0 -6
- package/dist/emit/cli/discovery.js +9 -7
- package/dist/emit/cli/flags.d.ts +1 -3
- package/dist/emit/cli/flags.js +18 -8
- package/dist/emit/cli/install.d.ts +0 -8
- package/dist/emit/cli/install.js +3 -3
- package/dist/emit/cli/layout.d.ts +1 -1
- package/dist/emit/cli/layout.js +13 -10
- package/dist/emit/cli/module.d.ts +6 -6
- package/dist/emit/cli/module.js +10 -10
- package/dist/emit/cli/release.d.ts +0 -11
- package/dist/emit/cli/release.js +4 -4
- package/dist/emit/cli/skills.js +8 -4
- package/dist/emit/csharp/errors.js +4 -4
- package/dist/emit/csharp/json.js +8 -8
- package/dist/emit/csharp/realtime.d.ts +1 -8
- package/dist/emit/csharp/realtime.js +26 -26
- package/dist/emit/csharp/sdk-answer.d.ts +10 -2
- package/dist/emit/csharp/sdk-answer.js +4 -4
- package/dist/emit/csharp/sdk-body.js +8 -6
- package/dist/emit/csharp/sdk-client.d.ts +3 -3
- package/dist/emit/csharp/sdk-client.js +2 -2
- package/dist/emit/csharp/sdk-csproj.d.ts +7 -9
- package/dist/emit/csharp/sdk-csproj.js +10 -10
- package/dist/emit/csharp/sdk-doc.js +1 -1
- package/dist/emit/csharp/sdk-method.d.ts +0 -1
- package/dist/emit/csharp/sdk-method.js +19 -8
- package/dist/emit/csharp/sdk-plan.js +0 -1
- package/dist/emit/csharp/sdk.js +3 -3
- package/dist/emit/csharp/sse.d.ts +0 -13
- package/dist/emit/csharp/sse.js +92 -11
- package/dist/emit/csharp/transport.js +9 -9
- package/dist/emit/csharp/types-enum.js +3 -1
- package/dist/emit/csharp/types-messages.d.ts +47 -0
- package/dist/emit/csharp/types-messages.js +172 -0
- package/dist/emit/csharp/types-names.js +13 -14
- package/dist/emit/csharp/types-record.js +3 -3
- package/dist/emit/csharp/types-union.d.ts +1 -1
- package/dist/emit/csharp/types.d.ts +0 -1
- package/dist/emit/csharp/types.js +3 -3
- package/dist/emit/csharp/ws.d.ts +0 -15
- package/dist/emit/csharp/ws.js +26 -5
- package/dist/emit/go/errors.js +1 -1
- package/dist/emit/go/http.js +2 -2
- package/dist/emit/go/module-path.js +2 -2
- package/dist/emit/go/sdk-answer.d.ts +24 -1
- package/dist/emit/go/sdk-answer.js +1 -1
- package/dist/emit/go/sdk-body.js +11 -7
- package/dist/emit/go/sdk-client.js +1 -1
- package/dist/emit/go/sdk-method.d.ts +3 -0
- package/dist/emit/go/sdk-method.js +18 -12
- package/dist/emit/go/sdk-mirror.js +2 -2
- package/dist/emit/go/sdk-opts.d.ts +0 -2
- package/dist/emit/go/sdk-opts.js +3 -3
- package/dist/emit/go/sdk.d.ts +1 -1
- package/dist/emit/go/sdk.js +9 -9
- package/dist/emit/go/sse.d.ts +2 -10
- package/dist/emit/go/sse.js +88 -13
- package/dist/emit/go/types-names.js +5 -0
- package/dist/emit/go/types-struct.d.ts +2 -1
- package/dist/emit/go/types-struct.js +1 -1
- package/dist/emit/go/types-union.d.ts +3 -2
- package/dist/emit/go/types-union.js +2 -0
- package/dist/emit/go/types.d.ts +6 -0
- package/dist/emit/go/types.js +20 -9
- package/dist/emit/go/ws.d.ts +4 -11
- package/dist/emit/go/ws.js +215 -59
- package/dist/emit/java/gradle.d.ts +7 -9
- package/dist/emit/java/gradle.js +8 -8
- package/dist/emit/java/json.d.ts +3 -0
- package/dist/emit/java/json.js +1 -1
- package/dist/emit/java/layout-ast.d.ts +4 -1
- package/dist/emit/java/layout-ast.js +1 -1
- package/dist/emit/java/layout-decl.js +5 -4
- package/dist/emit/java/layout-doc.js +13 -7
- package/dist/emit/java/layout-dot.js +1 -1
- package/dist/emit/java/layout-strings.js +4 -5
- package/dist/emit/java/layout-types.js +7 -5
- package/dist/emit/java/layout-visitor.js +4 -3
- package/dist/emit/java/layout.js +5 -4
- package/dist/emit/java/models-names.d.ts +2 -0
- package/dist/emit/java/models-names.js +6 -4
- package/dist/emit/java/models-record.d.ts +0 -1
- package/dist/emit/java/models-record.js +3 -3
- package/dist/emit/java/models-union.d.ts +13 -2
- package/dist/emit/java/models-union.js +12 -6
- package/dist/emit/java/models.d.ts +5 -1
- package/dist/emit/java/models.js +44 -20
- package/dist/emit/java/realtime.d.ts +34 -26
- package/dist/emit/java/realtime.js +45 -10
- package/dist/emit/java/sdk-client.d.ts +6 -6
- package/dist/emit/java/sdk-client.js +1 -1
- package/dist/emit/java/sdk-decl.js +2 -2
- package/dist/emit/java/sdk-errors.js +1 -1
- package/dist/emit/java/sdk-headers.js +2 -2
- package/dist/emit/java/sdk-mirror.js +7 -6
- package/dist/emit/java/sdk-models.d.ts +1 -1
- package/dist/emit/java/sdk-models.js +7 -7
- package/dist/emit/java/sdk-op.d.ts +1 -10
- package/dist/emit/java/sdk-op.js +9 -9
- package/dist/emit/java/sdk-params.d.ts +5 -5
- package/dist/emit/java/sdk-params.js +3 -2
- package/dist/emit/java/sdk-plan.js +0 -1
- package/dist/emit/java/sdk.d.ts +1 -1
- package/dist/emit/java/sdk.js +14 -13
- package/dist/emit/java/sse.d.ts +12 -13
- package/dist/emit/java/sse.js +105 -6
- package/dist/emit/java/ws.d.ts +48 -9
- package/dist/emit/java/ws.js +88 -4
- package/dist/emit/mcp/annotations.js +8 -4
- package/dist/emit/mcp/files.js +9 -9
- package/dist/emit/mcp/mounted.js +2 -2
- package/dist/emit/mcp/output-schema.d.ts +4 -2
- package/dist/emit/mcp/output-schema.js +58 -14
- package/dist/emit/mcp/registry.d.ts +0 -2
- package/dist/emit/mcp/registry.js +5 -4
- package/dist/emit/mcp/runtime.js +2 -2
- package/dist/emit/mcp/schema.js +22 -11
- package/dist/emit/mcp/server.d.ts +7 -7
- package/dist/emit/mcp/server.js +7 -6
- package/dist/emit/mcp/tools.js +7 -6
- package/dist/emit/python/errors.js +3 -3
- package/dist/emit/python/realtime.d.ts +9 -6
- package/dist/emit/python/realtime.js +22 -20
- package/dist/emit/python/sdk-answer.d.ts +8 -8
- package/dist/emit/python/sdk-answer.js +2 -2
- package/dist/emit/python/sdk-body.js +4 -5
- package/dist/emit/python/sdk-client.js +5 -5
- package/dist/emit/python/sdk-doc.js +2 -2
- package/dist/emit/python/sdk-method.d.ts +1 -1
- package/dist/emit/python/sdk-method.js +38 -11
- package/dist/emit/python/sdk-plan.js +0 -1
- package/dist/emit/python/sdk-pyproject.d.ts +0 -2
- package/dist/emit/python/sdk-pyproject.js +8 -8
- package/dist/emit/python/sdk.d.ts +1 -1
- package/dist/emit/python/sdk.js +28 -8
- package/dist/emit/python/sse.d.ts +0 -7
- package/dist/emit/python/sse.js +36 -6
- package/dist/emit/python/transport.js +4 -4
- package/dist/emit/python/types-dict.d.ts +2 -2
- package/dist/emit/python/types-dict.js +1 -1
- package/dist/emit/python/types-names.js +2 -2
- package/dist/emit/python/types-union.js +1 -1
- package/dist/emit/python/types.d.ts +7 -0
- package/dist/emit/python/types.js +23 -6
- package/dist/emit/python/ws.d.ts +21 -10
- package/dist/emit/python/ws.js +69 -3
- package/dist/emit/rust/errors.js +3 -3
- package/dist/emit/rust/http.js +4 -4
- package/dist/emit/rust/realtime.d.ts +7 -5
- package/dist/emit/rust/realtime.js +15 -18
- package/dist/emit/rust/sdk-body.js +8 -5
- package/dist/emit/rust/sdk-cargo.d.ts +16 -18
- package/dist/emit/rust/sdk-cargo.js +12 -12
- package/dist/emit/rust/sdk-client.d.ts +1 -1
- package/dist/emit/rust/sdk-client.js +3 -3
- package/dist/emit/rust/sdk-method.js +3 -3
- package/dist/emit/rust/sdk-opts.d.ts +2 -1
- package/dist/emit/rust/sdk-opts.js +2 -2
- package/dist/emit/rust/sdk-plan.js +0 -1
- package/dist/emit/rust/sdk.d.ts +1 -1
- package/dist/emit/rust/sdk.js +5 -5
- package/dist/emit/rust/sse.d.ts +11 -12
- package/dist/emit/rust/sse.js +54 -8
- package/dist/emit/rust/types-names.js +3 -3
- package/dist/emit/rust/types-struct.js +1 -1
- package/dist/emit/rust/types-union.d.ts +10 -2
- package/dist/emit/rust/types-union.js +4 -0
- package/dist/emit/rust/types.d.ts +9 -0
- package/dist/emit/rust/types.js +20 -12
- package/dist/emit/rust/ws.d.ts +22 -15
- package/dist/emit/rust/ws.js +60 -10
- package/dist/emit/shared/escape.js +17 -17
- package/dist/emit/shared/format.js +1 -1
- package/dist/emit/shared/gofmt.js +1 -1
- package/dist/emit/shared/lang.js +10 -10
- package/dist/emit/shared/literals.d.ts +5 -0
- package/dist/emit/shared/literals.js +8 -0
- package/dist/emit/shared/metadata.d.ts +0 -6
- package/dist/emit/shared/metadata.js +8 -7
- package/dist/emit/shared/ruff.js +1 -1
- package/dist/emit/shared/rustfmt.js +1 -1
- package/dist/emit/shared/type-emitter.js +37 -20
- package/dist/emit/shared/unknown-type.constants.d.ts +2 -0
- package/dist/emit/shared/unknown-type.constants.js +2 -0
- package/dist/emit/ts/http.d.ts +0 -2
- package/dist/emit/ts/http.js +4 -4
- package/dist/emit/ts/package.d.ts +14 -12
- package/dist/emit/ts/package.js +9 -8
- package/dist/emit/ts/route-tree.js +2 -2
- package/dist/emit/ts/sdk-types-preamble.d.ts +1 -1
- package/dist/emit/ts/sdk-types-preamble.js +6 -2
- package/dist/emit/ts/sdk-types.js +59 -20
- package/dist/emit/ts/sdk.js +6 -6
- package/dist/emit/ts/service-map.d.ts +10 -3
- package/dist/emit/ts/service-map.js +30 -2
- package/dist/emit/ts/tanstack-query.js +6 -6
- package/dist/emit/ts/type-gen.js +36 -21
- package/dist/emit/ts/webhooks.d.ts +0 -2
- package/dist/emit/ts/webhooks.js +3 -3
- package/dist/extract/chain.js +5 -4
- package/dist/extract/extract.js +5 -5
- package/dist/extract/serialize.d.ts +0 -2
- package/dist/extract/serialize.js +14 -15
- package/dist/extract/walk.js +15 -12
- package/dist/gen/args.js +9 -5
- package/dist/gen/formatters.js +5 -3
- package/dist/gen/shipped.js +2 -2
- package/dist/gen/targets.d.ts +2 -4
- package/dist/gen/targets.js +8 -4
- package/dist/gen/write.js +4 -2
- package/dist/index.js +2 -2
- package/dist/installers/cli.d.ts +4 -4
- package/dist/installers/cli.js +24 -24
- package/dist/installers/commands/build.d.ts +4 -4
- package/dist/installers/commands/build.js +2 -3
- package/dist/installers/commands/check.d.ts +2 -2
- package/dist/installers/commands/check.js +11 -10
- package/dist/installers/commands/init.d.ts +2 -2
- package/dist/installers/commands/init.js +1 -2
- package/dist/installers/config/define-config.d.ts +16 -16
- package/dist/installers/config/define-config.js +1 -1
- package/dist/installers/config/hooks/bun.d.ts +6 -6
- package/dist/installers/config/hooks/node.js +1 -1
- package/dist/installers/config/load.d.ts +6 -8
- package/dist/installers/config/load.js +7 -8
- package/dist/installers/config/resolve.d.ts +1 -2
- package/dist/installers/config/resolve.js +28 -33
- package/dist/installers/config/types.d.ts +6 -6
- package/dist/installers/config/types.js +0 -1
- package/dist/installers/render/quote.js +3 -5
- package/dist/installers/render/render.d.ts +6 -6
- package/dist/installers/render/render.js +26 -26
- package/dist/installers/ui.d.ts +4 -4
- package/dist/installers/ui.js +3 -3
- package/dist/ir/build.d.ts +3 -3
- package/dist/ir/build.js +12 -5
- package/dist/ir/load.js +9 -10
- package/dist/ir/model.d.ts +16 -1
- package/dist/ir/model.js +0 -1
- package/dist/ir/resolve-refs.js +2 -2
- package/dist/ir/resource-tree.js +2 -1
- package/dist/ir/route-tree-intern.js +1 -1
- package/dist/ir/schema.js +3 -3
- package/dist/ir/sdk-model.d.ts +25 -1
- package/dist/ir/sdk-model.js +38 -8
- package/dist/ir/slots.d.ts +1 -1
- package/dist/ir/slots.js +22 -11
- package/dist/ir/streams.d.ts +16 -0
- package/dist/ir/streams.js +40 -0
- package/dist/release/bootstrap.d.ts +3 -3
- package/dist/release/bootstrap.js +7 -7
- package/dist/release/bump-args.js +4 -4
- package/dist/release/bump-command.d.ts +1 -1
- package/dist/release/bump-command.js +9 -10
- package/dist/release/bump.d.ts +5 -4
- package/dist/release/bump.js +2 -2
- package/dist/release/cli.d.ts +4 -4
- package/dist/release/cli.js +4 -4
- package/dist/release/codegen.js +1 -1
- package/dist/release/digest.js +5 -7
- package/dist/release/git.js +5 -8
- package/dist/release/load.js +3 -3
- package/dist/release/manifest.js +9 -10
- package/dist/release/oasdiff.d.ts +10 -15
- package/dist/release/oasdiff.js +5 -6
- package/dist/release/registries.d.ts +0 -11
- package/dist/release/registries.js +17 -17
- package/dist/release/release-state.d.ts +16 -13
- package/dist/release/release-workflow.js +5 -7
- package/dist/release/repo-settings.d.ts +2 -1
- package/dist/release/spec-gate.d.ts +0 -2
- package/dist/release/spec-gate.js +6 -10
- package/dist/release/sync-command.d.ts +2 -2
- package/dist/release/sync-command.js +1 -1
- package/dist/release/sync-tree.js +9 -13
- package/dist/release/sync.d.ts +6 -6
- package/dist/release/sync.js +12 -13
- package/dist/release/types.d.ts +22 -22
- package/dist/release/types.js +0 -1
- package/dist/release/version-files.d.ts +3 -4
- package/dist/release/version-files.js +4 -5
- package/dist/runtime/.oxfmtrc.jsonc +8 -0
- package/dist/runtime/cli/socket.go +107 -13
- package/dist/runtime/cli/stream.go +18 -11
- package/dist/runtime/csharp/Adapters.cs +12 -11
- package/dist/runtime/csharp/Events.cs +22 -17
- package/dist/runtime/csharp/Realtime.cs +50 -23
- package/dist/runtime/csharp/RealtimeLoop.cs +1 -1
- package/dist/runtime/csharp/TransportSse.cs +3 -3
- package/dist/runtime/csharp/Ws.cs +1 -1
- package/dist/runtime/csharp/WsDial.cs +19 -1
- package/dist/runtime/csharp/WsTyped.cs +109 -0
- package/dist/runtime/go/realtime.go +125 -41
- package/dist/runtime/go/realtime_loop.go +21 -18
- package/dist/runtime/go/result.go +2 -1
- package/dist/runtime/go/sse.go +11 -0
- package/dist/runtime/go/stream.go +29 -13
- package/dist/runtime/go/transport.go +15 -21
- package/dist/runtime/go/transport_longpoll.go +3 -4
- package/dist/runtime/go/transport_sse.go +6 -6
- package/dist/runtime/go/ws.go +157 -61
- package/dist/runtime/java/EventStream.java +47 -29
- package/dist/runtime/java/Exchange.java +5 -5
- package/dist/runtime/java/Flight.java +3 -3
- package/dist/runtime/java/Realtime.java +45 -11
- package/dist/runtime/java/ResumableConnection.java +77 -32
- package/dist/runtime/java/Socket.java +8 -4
- package/dist/runtime/java/SseAdapter.java +1 -1
- package/dist/runtime/java/TypedWebSocket.java +81 -24
- package/dist/runtime/java/WsAdapter.java +4 -2
- package/dist/runtime/java/WsDial.java +12 -5
- package/dist/runtime/mcp/files.ts +1 -1
- package/dist/runtime/mcp/http.ts +6 -2
- package/dist/runtime/mcp/listen.ts +1 -1
- package/dist/runtime/mcp/mount.ts +2 -2
- package/dist/runtime/mcp/protocol.ts +1 -1
- package/dist/runtime/python/events.py +25 -11
- package/dist/runtime/python/operation.py +6 -1
- package/dist/runtime/python/realtime.py +47 -33
- package/dist/runtime/python/send_async.py +1 -0
- package/dist/runtime/python/transport_sse.py +2 -2
- package/dist/runtime/python/transport_ws.py +1 -1
- package/dist/runtime/python/ws.py +100 -39
- package/dist/runtime/rust/events.rs +64 -41
- package/dist/runtime/rust/realtime.rs +80 -34
- package/dist/runtime/rust/realtime_loop.rs +37 -12
- package/dist/runtime/rust/sse.rs +3 -2
- package/dist/runtime/rust/transport_sse.rs +1 -1
- package/dist/runtime/rust/transport_ws.rs +3 -2
- package/dist/runtime/rust/ws.rs +122 -50
- package/dist/runtime/ts/realtime-connection.ts +22 -0
- package/dist/runtime/ts/realtime-transports.ts +13 -4
- package/dist/runtime/ts/realtime.ts +27 -3
- package/dist/runtime/ts/sdk-realtime.ts +1 -1
- package/dist/runtime/ts/sdk-sse.ts +31 -14
- package/dist/runtime/ts/sdk-ws.ts +2 -1
- package/dist/runtime/ts/sdk.ts +9 -2
- package/dist/runtime/ts/sse.ts +8 -0
- package/dist/runtime/ts/ws.ts +88 -50
- package/dist/runtime/ts-tanstack-query/query.ts +0 -2
- package/package.json +12 -40
- package/dist/emit/cli/index.d.ts +0 -1
- package/dist/emit/cli/index.js +0 -1
- package/dist/emit/csharp/index.d.ts +0 -1
- package/dist/emit/csharp/index.js +0 -1
- package/dist/emit/go/index.d.ts +0 -1
- package/dist/emit/go/index.js +0 -1
- package/dist/emit/java/index.d.ts +0 -2
- package/dist/emit/java/index.js +0 -2
- package/dist/emit/mcp/index.d.ts +0 -3
- package/dist/emit/mcp/index.js +0 -3
- package/dist/emit/python/index.d.ts +0 -1
- package/dist/emit/python/index.js +0 -1
- package/dist/emit/rust/index.d.ts +0 -1
- package/dist/emit/rust/index.js +0 -1
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
package/dist/release/bump.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type Observed = {
|
|
|
6
6
|
output: string;
|
|
7
7
|
spec: ReleaseState["spec"];
|
|
8
8
|
};
|
|
9
|
-
|
|
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
|
|
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 {};
|
package/dist/release/bump.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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) {
|
package/dist/release/cli.d.ts
CHANGED
|
@@ -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
|
|
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
|
package/dist/release/cli.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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) {
|
package/dist/release/codegen.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { spawnSync } from "node:child_process";
|
|
7
7
|
import { RELEASE_VERSIONS_ENV } from "./manifest.js";
|
|
8
|
-
|
|
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
|
package/dist/release/digest.js
CHANGED
|
@@ -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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
package/dist/release/git.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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. */
|
package/dist/release/load.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 });
|
package/dist/release/manifest.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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) => ({
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
text: z.ZodString;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
/** One change oasdiff reports between two specs. */
|
|
14
|
-
export type ApiChange = z.infer<ReturnType<typeof apiChangeSchema>>;
|
|
1
|
+
import { OASDIFF_LEVEL } from "./constants.ts";
|
|
2
|
+
/** One change oasdiff reports between two specs: level 1 INFO, 2 WARN, 3 ERR (breaking). */
|
|
3
|
+
export type ApiChange = {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly level: (typeof OASDIFF_LEVEL)[keyof typeof OASDIFF_LEVEL];
|
|
6
|
+
readonly operation?: string | undefined;
|
|
7
|
+
readonly operationId?: string | undefined;
|
|
8
|
+
readonly path?: string | undefined;
|
|
9
|
+
readonly text: string;
|
|
10
|
+
};
|
|
15
11
|
/**
|
|
16
12
|
* Every change oasdiff finds from `baseFile` to `revisionFile`, run through `go run` in `env` (the Go on its PATH, its
|
|
17
13
|
* GOTOOLCHAIN honored); throws with oasdiff's stderr when it fails, and says so when Go cannot start.
|
|
18
14
|
*/
|
|
19
15
|
export declare function apiChanges(baseFile: string, revisionFile: string, env?: NodeJS.ProcessEnv): readonly ApiChange[];
|
|
20
|
-
export {};
|
package/dist/release/oasdiff.js
CHANGED
|
@@ -2,8 +2,8 @@ import { spawnSync } from "node:child_process";
|
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { MAX_OUTPUT_BYTES, OASDIFF_LEVEL } from "./constants.js";
|
|
4
4
|
/** The oasdiff module `go run` builds and caches: the breaking-change rules a bump's level comes from. */
|
|
5
|
-
|
|
6
|
-
/** One oasdiff changelog entry
|
|
5
|
+
const OASDIFF = "github.com/oasdiff/oasdiff@v1.35.0";
|
|
6
|
+
/** One oasdiff changelog entry. */
|
|
7
7
|
function apiChangeSchema() {
|
|
8
8
|
return z.object({
|
|
9
9
|
id: z.string(),
|
|
@@ -14,7 +14,7 @@ function apiChangeSchema() {
|
|
|
14
14
|
text: z.string(),
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
// the Go on the caller's PATH, in its environment: a test hands in go-env's, whose GOTOOLCHAIN pins it
|
|
18
18
|
const GO_BINARY = "go";
|
|
19
19
|
/**
|
|
20
20
|
* Every change oasdiff finds from `baseFile` to `revisionFile`, run through `go run` in `env` (the Go on its PATH, its
|
|
@@ -28,9 +28,8 @@ export function apiChanges(baseFile, revisionFile, env = process.env) {
|
|
|
28
28
|
});
|
|
29
29
|
if (result.error)
|
|
30
30
|
throw new Error(`oasdiff could not start (it runs through Go on PATH): ${result.error.message}`);
|
|
31
|
-
if (result.status !== 0)
|
|
31
|
+
if (result.status !== 0)
|
|
32
32
|
throw new Error(`oasdiff failed (${result.status}): ${result.stderr.trim()}`);
|
|
33
|
-
|
|
34
|
-
/* `[]` when the specs do not differ */
|
|
33
|
+
// `[]` when the specs do not differ
|
|
35
34
|
return z.array(apiChangeSchema()).parse(JSON.parse(result.stdout));
|
|
36
35
|
}
|
|
@@ -15,17 +15,6 @@ export declare const ACTIONS: {
|
|
|
15
15
|
readonly setupNode: "actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0";
|
|
16
16
|
readonly setupPython: "actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0";
|
|
17
17
|
};
|
|
18
|
-
export declare const TOOLS: {
|
|
19
|
-
readonly build: "1.6.1";
|
|
20
|
-
readonly dotnet: "10.0.403";
|
|
21
|
-
readonly gradle: "9.8.2";
|
|
22
|
-
readonly java: "21";
|
|
23
|
-
readonly jsr: "0.14.3";
|
|
24
|
-
readonly node: "24";
|
|
25
|
-
readonly npm: "12.2.1";
|
|
26
|
-
readonly python: "3.12";
|
|
27
|
-
readonly rust: "1.99.0";
|
|
28
|
-
};
|
|
29
18
|
/** How one registry kind names the package, reads its version, publishes, and shows it is live. */
|
|
30
19
|
export type Kind = {
|
|
31
20
|
/** The package's own file the registry publishes the version of. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Actions the workflow runs, pinned to a commit.
|
|
2
2
|
export const ACTIONS = {
|
|
3
3
|
checkout: "actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1",
|
|
4
4
|
cratesAuth: "rust-lang/crates-io-auth-action@3268eb413133e2960fa4ae0e963ca76380c54cd9 # v1.0.6",
|
|
@@ -11,8 +11,8 @@ export const ACTIONS = {
|
|
|
11
11
|
setupNode: "actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0",
|
|
12
12
|
setupPython: "actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0",
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// npm publishes over OIDC from 11.5.1 on.
|
|
15
|
+
const TOOLS = {
|
|
16
16
|
build: "1.6.1",
|
|
17
17
|
dotnet: "10.0.403",
|
|
18
18
|
gradle: "9.8.2",
|
|
@@ -23,15 +23,15 @@ export const TOOLS = {
|
|
|
23
23
|
python: "3.12",
|
|
24
24
|
rust: "1.99.0",
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
// The record clients keeps in every package it generates: the package's name and version on each registry.
|
|
27
27
|
const IDENTITY = ".clients-generated.json";
|
|
28
|
-
|
|
28
|
+
// `field` of the package clients recorded for `registry`, or a failed step when it recorded none.
|
|
29
29
|
const identity = (registry, field) => `jq -er '.packages[] | select(.registry == "${registry}") | .${field}' ${IDENTITY}`;
|
|
30
|
-
|
|
30
|
+
// A `key = '…'` line of a Gradle build script.
|
|
31
31
|
const gradleField = (key, file) => `sed -n "s/^${key} = '\\(.*\\)'$/\\1/p" ${file}`;
|
|
32
|
-
|
|
32
|
+
// Maven Central's Portal, which takes a signed bundle and reports the deployment's state.
|
|
33
33
|
const CENTRAL_PORTAL = "https://central.sonatype.com";
|
|
34
|
-
|
|
34
|
+
// repo1 serves a deployment up to 30 minutes after the Portal reports it PUBLISHED.
|
|
35
35
|
const MAVEN_LIVE_TRIES = 180;
|
|
36
36
|
const PORTAL_AUTH = `TOKEN="$(printf '%s:%s' "$MAVEN_CENTRAL_USERNAME" "$MAVEN_CENTRAL_PASSWORD" | base64 -w0)"`;
|
|
37
37
|
const PORTAL_SECRETS = ` MAVEN_CENTRAL_USERNAME: \${{ secrets.MAVEN_CENTRAL_USERNAME }}
|
|
@@ -106,8 +106,8 @@ function crates() {
|
|
|
106
106
|
version: identity("crates.io", "version"),
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
// NuGet's trusted publishing trades the job's OIDC token for a short-lived key; the policy belongs to a
|
|
110
|
+
// nuget.org user, which the repository variable NUGET_USER names
|
|
111
111
|
function nuget() {
|
|
112
112
|
return {
|
|
113
113
|
file: IDENTITY,
|
|
@@ -136,7 +136,7 @@ function nuget() {
|
|
|
136
136
|
version: identity("nuget", "version"),
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
// the signed bundle: the Maven layout of every file with its GPG signature, md5 and sha1
|
|
140
140
|
function mavenBundle() {
|
|
141
141
|
return ` - uses: ${ACTIONS.setupJava}
|
|
142
142
|
with:
|
|
@@ -168,7 +168,7 @@ function mavenBundle() {
|
|
|
168
168
|
zip -qr "$RUNNER_TEMP/bundle.zip" "$REL"
|
|
169
169
|
`;
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
// the bundle uploaded to the Portal, then waited on until the Portal publishes it
|
|
172
172
|
function mavenPortal() {
|
|
173
173
|
return ` - name: Maven Central upload
|
|
174
174
|
env:
|
|
@@ -196,8 +196,8 @@ ${PORTAL_SECRETS} run: |
|
|
|
196
196
|
exit 1
|
|
197
197
|
`;
|
|
198
198
|
}
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
// Maven Central takes no OIDC: a Portal token uploads a bundle, the Maven layout of every file with its
|
|
200
|
+
// GPG signature, md5 and sha1, and the Portal validates and publishes it
|
|
201
201
|
function maven() {
|
|
202
202
|
return {
|
|
203
203
|
file: IDENTITY,
|
|
@@ -209,7 +209,7 @@ function maven() {
|
|
|
209
209
|
version: identity("maven-central", "version"),
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
// the proxy fetches a module version the first time it is asked for it, so the live check publishes it
|
|
213
213
|
function goProxy() {
|
|
214
214
|
return {
|
|
215
215
|
file: IDENTITY,
|
|
@@ -220,7 +220,7 @@ function goProxy() {
|
|
|
220
220
|
version: identity("go", "version"),
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
|
-
|
|
223
|
+
// gh in Actions runs only with a token in GH_TOKEN
|
|
224
224
|
const GH_TOKEN_ENV = ` env:
|
|
225
225
|
GH_TOKEN: \${{ github.token }}
|
|
226
226
|
`;
|
|
@@ -238,7 +238,7 @@ ${GH_TOKEN_ENV} run: gh release create "$TAG" ${assets} --verify-tag --ti
|
|
|
238
238
|
version: "jq -r .version .release-state.json",
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
// every kind but a GitHub release, which reads its assets from the registry entry
|
|
242
242
|
const KINDS = { crates, go: goProxy, jsr, maven, npm, nuget, pypi };
|
|
243
243
|
/** The steps the release workflow runs for `registry`. */
|
|
244
244
|
export function kind(registry) {
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
/** The schema of `.release-state.json`: what a package's last release was cut from. */
|
|
3
|
-
export declare function releaseStateSchema(): z.ZodObject<{
|
|
4
|
-
hand: z.ZodString;
|
|
5
|
-
output: z.ZodString;
|
|
6
|
-
publishedAt: z.ZodString;
|
|
7
|
-
spec: z.ZodObject<{
|
|
8
|
-
commit: z.ZodString;
|
|
9
|
-
path: z.ZodString;
|
|
10
|
-
sha: z.ZodString;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
version: z.ZodString;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
2
|
/** Parsed and validated release state. */
|
|
15
|
-
export type ReleaseState =
|
|
3
|
+
export type ReleaseState = {
|
|
4
|
+
/** sha256 over the package's tracked hand files at release, version lines normalized (`digest.ts`) */
|
|
5
|
+
readonly hand: string;
|
|
6
|
+
/** sha256 over the package's generated output at release, or its product's spec sha for a hand-kept package */
|
|
7
|
+
readonly output: string;
|
|
8
|
+
readonly publishedAt: string;
|
|
9
|
+
/** the committed spec the release was generated from, readable again with `git show {commit}:{path}` */
|
|
10
|
+
readonly spec: {
|
|
11
|
+
readonly commit: string;
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly sha: string;
|
|
14
|
+
};
|
|
15
|
+
readonly version: string;
|
|
16
|
+
};
|
|
17
|
+
/** The schema of `.release-state.json`: what a package's last release was cut from. */
|
|
18
|
+
export declare function releaseStateSchema(): z.ZodType<ReleaseState>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { ACTIONS, kind } from "./registries.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* registry through OIDC (no token secret), fails on any rejection, and waits until each registry serves it.
|
|
6
|
-
*/
|
|
2
|
+
// The `release.yml` a public repo publishes itself with, rendered from its package's `registries`. Sync writes
|
|
3
|
+
// it into the public tree and pushes `v<version>` beside it; the workflow then publishes that tag to every
|
|
4
|
+
// registry through OIDC (no token secret), fails on any rejection, and waits until each registry serves it.
|
|
7
5
|
/** Where the rendered workflow sits in a public repo. */
|
|
8
6
|
export const RELEASE_WORKFLOW = ".github/workflows/release.yml";
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
// Every registry is retried 10 s apart, 60 times unless its kind says more; LIVE_CHECK_TRIES lets a local run of
|
|
8
|
+
// the step give up sooner.
|
|
11
9
|
const DEFAULT_LIVE_TRIES = 60;
|
|
12
10
|
const liveStep = (registry, k) => ` - name: ${registry.kind} serves the version
|
|
13
11
|
${k.liveEnv ?? ""} run: |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PublicPackage } from "./types.ts";
|
|
2
|
-
|
|
2
|
+
type RepoSetting = "description" | "homepage" | "topics";
|
|
3
3
|
export type RepoSettingsResult = {
|
|
4
4
|
changed: RepoSetting[];
|
|
5
5
|
status: "checked";
|
|
@@ -20,3 +20,4 @@ export declare function repoSettingsSyncer(io: {
|
|
|
20
20
|
fetch: Fetch;
|
|
21
21
|
token: string;
|
|
22
22
|
}): RepoSettingsSync;
|
|
23
|
+
export {};
|
|
@@ -12,8 +12,6 @@ export type SpecGate = {
|
|
|
12
12
|
readonly status: "match";
|
|
13
13
|
readonly sha: string;
|
|
14
14
|
} | SpecDrift;
|
|
15
|
-
/** The value with every object's keys sorted, so equal specs serialize equally. */
|
|
16
|
-
export declare function canonicalize(value: unknown): unknown;
|
|
17
15
|
/** sha256 of the spec's canonical JSON. */
|
|
18
16
|
export declare function canonicalSha(spec: unknown): string;
|
|
19
17
|
/** Fetches the deployed spec and compares it with the committed one; throws naming the URL when prod does not answer. */
|