stitchkit 0.136.7 → 0.136.8

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/CHANGELOG.md CHANGED
@@ -15,6 +15,21 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.136.8] - 2026-12-04
19
+
20
+ ### Added
21
+
22
+ - `stitchkit/postgres` — add peer-free `postgresConnectionConfig` (plus types `PostgresConnectionConfig` and `PostgresConnectionOptions`) to surgically remove `?options=` (including empty, bare, repeated, and percent-encoded `%6fptions`) from PostgreSQL connection strings (`postgres://`, `postgresql://`, `@/` and `///` empty-host Unix socket URLs, `socket:`, and raw `/path` socket strings) without rewriting unrelated query parameters or credentials, validate raw option fragments against PostgreSQL `pg_split_opts` boundaries (refusing control characters, odd trailing backslashes, standalone `--`, and trailing `-c`), and append validated `parameters`, `searchPath` (string or array), and `timeZone` (default `'UTC'`; `null` omits) last so `pg` cannot overwrite enforced session flags while preserving extra `pg.PoolConfig` fields and redacting credentials on invalid URLs.
23
+ - `stitchkit/cli` — export `CliTrustRootSchema` (Zod-first schema backing `CliTrustRoot`) validating non-empty Ed25519 SPKI PEM or canonical 32-byte raw base64 public keys and rejecting empty, whitespace-padded, or prototype-polluting key ids.
24
+ - `stitchkit/cli/publish` — export `CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE`, `CliDistributionUnpublishedResponse`, and the synchronous, body-free predicate `isCliDistributionUnpublishedResponse` so external probes and release gates identify a genuinely empty CLI channel (`503`, `x-stitchkit-cli-distribution-state: unpublished`, `No verified CLI build is published`) without hardcoding prose or consuming response bodies.
25
+
26
+ ### Fixed
27
+
28
+ - `stitchkit/cli`, `stitchkit/cli/publish` — close fail-open trust verification and separate empty-channel vs fault `503` responses: `publishCli` now validates `trust` eagerly with `CliTrustRootSchema` (rejecting empty `{ keys: {} }`, padded, prototype-polluting, or non-Ed25519 keys), snapshots `trust` and `signing` against TOCTOU mutation, and requires strictly `verifyCliManifest === 'valid'` (never accepting `'unenforced'`); `applyCliUpdate` validates non-empty `trust` roots with `CliTrustRootSchema`, rejects prototype-polluting key ids even without other keys, freezes `trust`, requires strictly `verifyCliManifest === 'valid'`, and verifies that the selected asset's signed `size`, `compression`, `platform`, `arch`, and `sha256` all match an entry in the signed manifest before downloading while preserving the documented ADR 0193 `'unenforced'` behaviour for an explicit empty `{ keys: {} }`. `createCliDistributionRoutes` now validates `trust` via `CliTrustRootSchema` (rejecting malformed or non-Ed25519 keys even on an empty channel), emits `CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE` strictly for `reason: 'missing'` (classifying missing `root` as `io-error`, non-directory or dangling/escaping symlinks at `root` or any channel/version segment via step-by-step `lstat` as `unsafe-path`, and invalid/empty `trust.keys` as `empty-trust-root`), while returning a distinct fail-closed `503` (`x-stitchkit-cli-distribution-state: unavailable`, `CLI distribution is unavailable`) for all configuration, path, integrity, and signature faults, rejecting prototype-polluting key ids in `trust.keys`, and freezing `trust` at construction time.
29
+ **Affects:** `stitchkit/cli` applyCliUpdate, CliTrustRootSchema, verifyCliManifest; `stitchkit/cli/publish` publishCli, createCliDistributionRoutes, CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE, isCliDistributionUnpublishedResponse
30
+ - `stitchkit/cli` — anchor `compareCliVersions` to strict O(N) SemVer 2.0.0 grammar with `$`, refusing trailing garbage (such as `'1.2.0garbage'`), leading zeros in core or numeric prerelease identifiers, malformed prerelease/build segments, and non-safe integer core numbers while supporting `+build` metadata (ignored in precedence).
31
+ **Affects:** `stitchkit/cli` compareCliVersions
32
+
18
33
  ## [0.136.7] - 2026-12-03
19
34
 
20
35
  ### Added
@@ -6,9 +6,9 @@
6
6
  * `cliShippingInputsChanged` and `assertCleanCliSource` derive deterministic versions from git
7
7
  * shipping-input history and verify clean source roots. `createCliDistributionRoutes` builds
8
8
  * portable `RawRoute[]` handlers serving verified channel manifests, immutable assets and the
9
- * shell installer. This entrypoint is release infrastructure and is not held to the stable
10
- * promise of `stitchkit/cli` (ADR 0245). The wire contract — the manifest, signatures,
11
- * installer and updater — stays in `stitchkit/cli`.
9
+ * shell installer. This entrypoint is artifact publication and HTTP serving infrastructure
10
+ * and is not held to the stable promise of `stitchkit/cli` (ADR 0245). The wire contract —
11
+ * the manifest, signatures, installer and updater — stays in `stitchkit/cli`.
12
12
  *
13
13
  * ```ts
14
14
  * import { createCliDistributionRoutes, deriveCliVersionFromShippingInputs, publishCli } from 'stitchkit/cli/publish';
@@ -17,7 +17,7 @@
17
17
  * const routes = createCliDistributionRoutes({ root, name, trust });
18
18
  * ```
19
19
  */
20
- export type { CliDistributionRoutesOptions, CliDistributionUnavailableEvent, } from '../../tools/cli/distribution-config.js';
20
+ export { CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE, type CliDistributionRoutesOptions, type CliDistributionUnavailableEvent, type CliDistributionUnpublishedResponse, isCliDistributionUnpublishedResponse, } from '../../tools/cli/distribution-config.js';
21
21
  export { createCliDistributionRoutes } from '../../tools/cli/distribution-routes.js';
22
22
  export { type CliPublicationOptions, type CliPublicationPhase, type CliPublicationResult, publishCli, } from '../../tools/cli/publication.js';
23
23
  export { assertCleanCliSource, type CleanCliSourceOptions, type CliShippingInputsChangedOptions, type CliShippingVersionOptions, cliShippingInputsChanged, deriveCliVersionFromShippingInputs, } from '../../tools/cli/publication-source.js';
@@ -1 +1 @@
1
- {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/cli/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,YAAY,EACV,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,KAAK,+BAA+B,EACpC,KAAK,yBAAyB,EAC9B,wBAAwB,EACxB,kCAAkC,GACnC,MAAM,oCAAoC,CAAC"}
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/cli/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,qCAAqC,EACrC,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EACvC,oCAAoC,GACrC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,KAAK,+BAA+B,EACpC,KAAK,yBAAyB,EAC9B,wBAAwB,EACxB,kCAAkC,GACnC,MAAM,oCAAoC,CAAC"}
@@ -1,13 +1,10 @@
1
- import {
2
- RegularFileError2,
3
- readRegularFile2,
4
- parseJsonBytes2
5
- } from "../../index-ctaxjpa4.js";
6
1
  import {
7
2
  renderCliInstaller2,
3
+ CliTrustRootSchema2,
4
+ isUnsafeTrustKeyId,
5
+ freezeTrustRoot,
8
6
  signCliManifest2,
9
7
  verifyCliManifest2,
10
- cliSignatureAccepted2,
11
8
  CliBuildTargetSchema2,
12
9
  CliBuildManifestSchema2,
13
10
  assertCliPublishable2,
@@ -17,7 +14,12 @@ import {
17
14
  gzipCliAsset,
18
15
  decodeCliAsset,
19
16
  compareCliVersions2
20
- } from "../../index-f103md2v.js";
17
+ } from "../../index-3zt0r4y0.js";
18
+ import {
19
+ RegularFileError2,
20
+ readRegularFile2,
21
+ parseJsonBytes2
22
+ } from "../../index-ctaxjpa4.js";
21
23
  import"../../index-xqhede6x.js";
22
24
  import"../../index-6kec3b14.js";
23
25
  import"../../index-673drwkn.js";
@@ -66,10 +68,6 @@ import {
66
68
  isRecord
67
69
  } from "../../index-ps3djm8d.js";
68
70
 
69
- // src/tools/cli/distribution-routes.ts
70
- import { realpath } from "node:fs/promises";
71
- import { join } from "node:path";
72
-
73
71
  // src/tools/cli/distribution-config.ts
74
72
  import { isAbsolute } from "node:path";
75
73
  var DEFAULT_CHANNELS = ["stable", "beta"];
@@ -116,14 +114,17 @@ function validateTrust(trust) {
116
114
  if (!isRecord(trust) || !isRecord(trust.keys)) {
117
115
  throw new TypeError("trust must be a CliTrustRoot with a keys map");
118
116
  }
119
- const keys = {};
117
+ const keys = Object.create(null);
120
118
  for (const [keyId, publicKey] of Object.entries(trust.keys)) {
119
+ if (isUnsafeTrustKeyId(keyId)) {
120
+ throw new TypeError(`trust.keys contains an unsafe key id: ${keyId}`);
121
+ }
121
122
  if (typeof publicKey !== "string") {
122
123
  throw new TypeError(`trust.keys.${keyId} must be a PEM or base64 public key string`);
123
124
  }
124
125
  keys[keyId] = publicKey;
125
126
  }
126
- return { keys };
127
+ return Object.freeze({ keys: Object.freeze(keys) });
127
128
  }
128
129
  function validateInstallDir(value) {
129
130
  if (typeof value !== "string" || value.length === 0 || CONTROL_CHAR_PATTERN.test(value)) {
@@ -180,6 +181,23 @@ function resolveDistributionConfig(options) {
180
181
  onUnavailable: options.onUnavailable
181
182
  };
182
183
  }
184
+ var DISTRIBUTION_STATE_HEADER = "x-stitchkit-cli-distribution-state";
185
+ var UNPUBLISHED_STATE = "unpublished";
186
+ var UNAVAILABLE_STATE = "unavailable";
187
+ var UNPUBLISHED_BODY = "No verified CLI build is published";
188
+ var UNAVAILABLE_BODY = "CLI distribution is unavailable";
189
+ var CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE = Object.freeze({
190
+ status: 503,
191
+ header: DISTRIBUTION_STATE_HEADER,
192
+ headerValue: UNPUBLISHED_STATE,
193
+ body: UNPUBLISHED_BODY
194
+ });
195
+ function isCliDistributionUnpublishedResponse(response) {
196
+ return response.status === CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE.status && response.headers.get(CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE.header)?.trim().toLowerCase() === CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE.headerValue;
197
+ }
198
+ function hasUsableTrustKeys(trust) {
199
+ return CliTrustRootSchema2.safeParse(trust).success;
200
+ }
183
201
  function assetMatchesUrl(entryUrl, asset) {
184
202
  let pathname;
185
203
  try {
@@ -198,6 +216,9 @@ function assetMatchesUrl(entryUrl, asset) {
198
216
  return false;
199
217
  }
200
218
  }
219
+ // src/tools/cli/distribution-routes.ts
220
+ import { lstat, realpath } from "node:fs/promises";
221
+ import { join } from "node:path";
201
222
 
202
223
  // src/tools/cli/publication-contract.ts
203
224
  import { isAbsolute as isAbsolute2 } from "node:path";
@@ -244,6 +265,21 @@ var dataSchema = CliBuildManifestSchema2.pick({
244
265
  retention: positive.min(2).default(2)
245
266
  });
246
267
  var phaseSchema = z.enum(["prepare", "build", "commit", "promote"]);
268
+ function snapshotSigning(signing) {
269
+ if (signing === undefined)
270
+ return;
271
+ if (typeof signing !== "object" || signing === null) {
272
+ throw new TypeError("CLI publication signing must be an object with keyId and privateKey");
273
+ }
274
+ if (typeof signing.keyId !== "string" || signing.keyId.length === 0 || signing.keyId !== signing.keyId.trim() || isUnsafeTrustKeyId(signing.keyId)) {
275
+ throw new TypeError("CLI publication signing.keyId must be a non-empty trimmed safe string");
276
+ }
277
+ const privateKey = typeof signing.privateKey === "string" ? signing.privateKey : signing.privateKey instanceof Uint8Array ? new Uint8Array(signing.privateKey) : undefined;
278
+ if (privateKey === undefined) {
279
+ throw new TypeError("CLI publication signing.privateKey must be a string or Uint8Array");
280
+ }
281
+ return Object.freeze({ keyId: signing.keyId, privateKey });
282
+ }
247
283
  function publicationData(options) {
248
284
  const data = dataSchema.parse(options);
249
285
  if (data.targets.length > data.limits.maxTargets)
@@ -257,7 +293,13 @@ function publicationData(options) {
257
293
  throw new TypeError("CLI publication targets must be unique");
258
294
  if (typeof options.admit !== "function" || typeof options.build !== "function")
259
295
  throw new TypeError("CLI publication needs build and admit callbacks");
260
- return data;
296
+ const trust = options.trust !== undefined ? freezeTrustRoot(CliTrustRootSchema2.parse(options.trust)) : undefined;
297
+ const signing = snapshotSigning(options.signing);
298
+ return {
299
+ ...data,
300
+ ...trust !== undefined && { trust },
301
+ ...signing !== undefined && { signing }
302
+ };
261
303
  }
262
304
  function assetFilename(name, target) {
263
305
  return `${name}-${target.platform}-${target.arch}.gz`;
@@ -268,7 +310,6 @@ function assetUrl(baseUrl, version, filename) {
268
310
 
269
311
  // src/tools/cli/distribution-routes.ts
270
312
  var STREAM_CHUNK_BYTES = 64 * 1024;
271
- var UNAVAILABLE_BODY = "No verified CLI build is published";
272
313
  function notifyUnavailable(config, event) {
273
314
  if (!config.onUnavailable)
274
315
  return;
@@ -276,12 +317,79 @@ function notifyUnavailable(config, event) {
276
317
  config.onUnavailable(event);
277
318
  } catch {}
278
319
  }
320
+ function unpublishedResponse() {
321
+ return new Response(CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE.body, {
322
+ status: CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE.status,
323
+ headers: {
324
+ "Content-Type": "text/plain; charset=utf-8",
325
+ "Cache-Control": "no-store",
326
+ [CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE.header]: CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE.headerValue
327
+ }
328
+ });
329
+ }
279
330
  function unavailableResponse() {
280
331
  return new Response(UNAVAILABLE_BODY, {
281
332
  status: 503,
282
- headers: { "Content-Type": "text/plain; charset=utf-8", "Cache-Control": "no-store" }
333
+ headers: {
334
+ "Content-Type": "text/plain; charset=utf-8",
335
+ "Cache-Control": "no-store",
336
+ [DISTRIBUTION_STATE_HEADER]: UNAVAILABLE_STATE
337
+ }
283
338
  });
284
339
  }
340
+ function channelUnavailableResponse(reason) {
341
+ return reason === "missing" ? unpublishedResponse() : unavailableResponse();
342
+ }
343
+ async function resolveDistributionParent(root, parts) {
344
+ let canonicalRoot;
345
+ try {
346
+ canonicalRoot = await realpath(root);
347
+ } catch (error) {
348
+ if (errnoOf(error) === "ENOENT") {
349
+ try {
350
+ const rootLink = await lstat(root);
351
+ if (rootLink.isSymbolicLink())
352
+ return { ok: false, reason: "unsafe-path", error };
353
+ } catch {}
354
+ return { ok: false, reason: "io-error", error };
355
+ }
356
+ return { ok: false, reason: "io-error", error };
357
+ }
358
+ try {
359
+ const rootStat = await lstat(canonicalRoot);
360
+ if (!rootStat.isDirectory())
361
+ return { ok: false, reason: "unsafe-path" };
362
+ } catch (error) {
363
+ return { ok: false, reason: "io-error", error };
364
+ }
365
+ let currentDir = canonicalRoot;
366
+ for (const segment of parts) {
367
+ currentDir = join(currentDir, segment);
368
+ try {
369
+ const entryStat = await lstat(currentDir);
370
+ if (entryStat.isSymbolicLink() || !entryStat.isDirectory()) {
371
+ return { ok: false, reason: "unsafe-path" };
372
+ }
373
+ } catch (error) {
374
+ return {
375
+ ok: false,
376
+ reason: errnoOf(error) === "ENOENT" ? "missing" : "io-error",
377
+ error
378
+ };
379
+ }
380
+ }
381
+ let canonicalParent;
382
+ try {
383
+ canonicalParent = await realpath(currentDir);
384
+ } catch (error) {
385
+ return { ok: false, reason: errnoOf(error) === "ENOENT" ? "missing" : "io-error", error };
386
+ }
387
+ const expectedParent = join(canonicalRoot, ...parts);
388
+ if (!isWithinDir2(canonicalRoot, canonicalParent) || canonicalParent !== expectedParent) {
389
+ return { ok: false, reason: "unsafe-path" };
390
+ }
391
+ return { ok: true, canonicalParent };
392
+ }
285
393
  function notFoundResponse(body) {
286
394
  return new Response(body, {
287
395
  status: 404,
@@ -313,21 +421,14 @@ async function readVerifiedManifest(config, route, channel, version, asset) {
313
421
  };
314
422
  if (config.root === undefined)
315
423
  return fail("unconfigured-root");
316
- if (Object.keys(config.trust.keys).length === 0)
424
+ if (!hasUsableTrustKeys(config.trust))
317
425
  return fail("empty-trust-root");
318
426
  const parts = ["channels", channel, ...version !== undefined ? [version] : []];
319
- let canonicalRoot;
320
- let canonicalParent;
321
- try {
322
- canonicalRoot = await realpath(config.root);
323
- canonicalParent = await realpath(join(config.root, ...parts));
324
- } catch (error) {
325
- return fail(errnoOf(error) === "ENOENT" ? "missing" : "io-error", { error });
326
- }
327
- const expectedParent = join(canonicalRoot, ...parts);
328
- if (!isWithinDir2(canonicalRoot, canonicalParent) || canonicalParent !== expectedParent) {
329
- return fail("unsafe-path");
427
+ const parent = await resolveDistributionParent(config.root, parts);
428
+ if (!parent.ok) {
429
+ return fail(parent.reason, ...parent.error !== undefined ? [{ error: parent.error }] : []);
330
430
  }
431
+ const { canonicalParent } = parent;
331
432
  let bytes;
332
433
  try {
333
434
  bytes = await readRegularFile2(join(canonicalParent, "manifest.json"), {
@@ -437,7 +538,7 @@ function buildChannelRoutes(config, channel) {
437
538
  handler: async () => {
438
539
  const current = await readVerifiedManifest(config, "manifest", channel);
439
540
  if (!current.ok)
440
- return unavailableResponse();
541
+ return channelUnavailableResponse(current.reason);
441
542
  return new Response(new Uint8Array(current.bytes), {
442
543
  status: 200,
443
544
  headers: { "Content-Type": "application/json", "Cache-Control": "no-store" }
@@ -515,7 +616,7 @@ function createCliDistributionRoutes(options) {
515
616
  handler: async () => {
516
617
  const current = await readVerifiedManifest(config, "installer", config.installerChannel);
517
618
  if (!current.ok)
518
- return unavailableResponse();
619
+ return channelUnavailableResponse(current.reason);
519
620
  if (current.manifest.assets.length === 0) {
520
621
  notifyUnavailable(config, {
521
622
  route: "installer",
@@ -541,16 +642,16 @@ function createCliDistributionRoutes(options) {
541
642
  }
542
643
  // src/tools/cli/publication.ts
543
644
  import { createHash } from "node:crypto";
544
- import { lstat as lstat2, mkdtemp, rename, rm as rm2 } from "node:fs/promises";
645
+ import { lstat as lstat3, mkdtemp, rename, rm as rm2 } from "node:fs/promises";
545
646
  import { join as join3 } from "node:path";
546
647
  import { z as z3 } from "zod";
547
648
 
548
649
  // src/tools/cli/publication-storage.ts
549
- import { lstat, mkdir, opendir, realpath as realpath2, rm } from "node:fs/promises";
650
+ import { lstat as lstat2, mkdir, opendir, realpath as realpath2, rm } from "node:fs/promises";
550
651
  import { join as join2, resolve } from "node:path";
551
652
  import { z as z2 } from "zod";
552
653
  async function directoryGeneration(path) {
553
- const info = await lstat(path);
654
+ const info = await lstat2(path);
554
655
  if (!info.isDirectory() || info.isSymbolicLink())
555
656
  throw new Error("CLI storage directory must not be a link or non-directory");
556
657
  return { dev: info.dev, ino: info.ino };
@@ -679,7 +780,7 @@ async function publicationHistory(storage, data, signal) {
679
780
  if (!PublicationVersionSchema.safeParse(name).success)
680
781
  continue;
681
782
  const path = join2(storage.root, name);
682
- const info = await lstat(path);
783
+ const info = await lstat2(path);
683
784
  if (!info.isDirectory() || info.isSymbolicLink())
684
785
  continue;
685
786
  let record;
@@ -737,11 +838,16 @@ var resultSchema = z3.object({
737
838
  outcome: z3.enum(["published", "existing"]),
738
839
  manifest: CliBuildManifestSchema2
739
840
  });
740
- function trustPublication(manifest, options) {
741
- const verdict = verifyCliManifest2(manifest, manifest.signature, options.trust);
742
- if (!cliSignatureAccepted2(verdict))
743
- throw new Error(`CLI publication manifest signature ${verdict}`);
744
- if (options.signing && !manifest.signature)
841
+ function trustPublication(manifest, data) {
842
+ if (data.trust !== undefined) {
843
+ if (Object.keys(data.trust.keys).length === 0) {
844
+ throw new Error("CLI publication trust.keys must contain at least one signing key");
845
+ }
846
+ const verdict = verifyCliManifest2(manifest, manifest.signature, data.trust);
847
+ if (verdict !== "valid")
848
+ throw new Error(`CLI publication manifest signature ${verdict}`);
849
+ }
850
+ if (data.signing && !manifest.signature)
745
851
  throw new Error("CLI publication requires a signed manifest");
746
852
  }
747
853
  function sameManifest(left, right) {
@@ -784,7 +890,7 @@ async function retainVersions(storage, history, keep, count, data, lock, signal)
784
890
  }
785
891
  async function promote(storage, record, prior, data, options, lock, signal) {
786
892
  await admission(options, data, "promote", signal);
787
- trustPublication(record.manifest, options);
893
+ trustPublication(record.manifest, data);
788
894
  await unchanged(storage, prior, data, lock, signal);
789
895
  const names = await directoryNames(storage.root, data.limits.maxDirectoryEntries, signal);
790
896
  if (names.length + 1 > data.limits.maxDirectoryEntries)
@@ -843,9 +949,9 @@ async function buildVersion(storage, data, options, lock, prior, signal) {
843
949
  });
844
950
  }
845
951
  const manifest = CliBuildManifestSchema2.parse({ name: data.name, ...stamp, assets });
846
- if (options.signing)
847
- manifest.signature = signCliManifest2(manifest, options.signing);
848
- trustPublication(manifest, options);
952
+ if (data.signing)
953
+ manifest.signature = signCliManifest2(manifest, data.signing);
954
+ trustPublication(manifest, data);
849
955
  const bytes = new TextEncoder().encode(`${JSON.stringify(manifest)}
850
956
  `);
851
957
  if (bytes.byteLength > data.limits.maxManifestBytes)
@@ -860,7 +966,7 @@ async function buildVersion(storage, data, options, lock, prior, signal) {
860
966
  await unchanged(storage, prior, data, lock, signal);
861
967
  await assertDirectory(staged, generation);
862
968
  try {
863
- await lstat2(join3(storage.root, data.version));
969
+ await lstat3(join3(storage.root, data.version));
864
970
  throw new Error("CLI version directory already exists");
865
971
  } catch (error) {
866
972
  if (errnoOf(error) !== "ENOENT")
@@ -909,7 +1015,7 @@ async function publishLocked(storage, data, options, lock, signal) {
909
1015
  if (!pointed || !sameManifest(prior, pointed))
910
1016
  throw new Error("CLI public manifest differs from its stored version");
911
1017
  assertPublicationManifest(prior, data, prior.manifest.version === data.version);
912
- trustPublication(prior.manifest, options);
1018
+ trustPublication(prior.manifest, data);
913
1019
  const order = compareCliVersions2(data.version, prior.manifest.version) ?? -1;
914
1020
  if (order < 0 || order === 0 && data.version !== prior.manifest.version)
915
1021
  throw new Error("CLI publication downgrade or non-advancing version refused");
@@ -923,7 +1029,7 @@ async function publishLocked(storage, data, options, lock, signal) {
923
1029
  let stored = history;
924
1030
  if (record) {
925
1031
  assertPublicationManifest(record, data, true);
926
- trustPublication(record.manifest, options);
1032
+ trustPublication(record.manifest, data);
927
1033
  } else {
928
1034
  const protect = new Set(prior ? [prior.manifest.version] : []);
929
1035
  const previous = newest(history).find((item) => prior && (compareCliVersions2(item.manifest.version, prior.manifest.version) ?? 0) < 0);
@@ -1177,9 +1283,11 @@ ${untracked.stdout}`);
1177
1283
  });
1178
1284
  }
1179
1285
  export {
1286
+ CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE,
1180
1287
  assertCleanCliSource,
1181
1288
  cliShippingInputsChanged,
1182
1289
  createCliDistributionRoutes,
1183
1290
  deriveCliVersionFromShippingInputs,
1291
+ isCliDistributionUnpublishedResponse,
1184
1292
  publishCli
1185
1293
  };
@@ -35,7 +35,7 @@ export { type CliInstallerConfig, renderCliInstaller, } from '../tools/cli/insta
35
35
  export { assertCliPublishable, type CliBuildAsset, CliBuildAssetSchema, type CliBuildManifest, CliBuildManifestSchema, type CliBuildStamp, CliBuildStampSchema, type CliBuildTarget, CliBuildTargetSchema, currentCliBuildTarget, formatCliBuildStamp, selectCliBuildAsset, } from '../tools/cli/manifest.js';
36
36
  export type { CliPresentationPolicyConfig } from '../tools/cli/policy.js';
37
37
  export { CliProfileError, type CliProfileStore, type CliProfileStoreConfig, createCliProfileStore, type ResolvedCliProfile, } from '../tools/cli/profile.js';
38
- export { type CliBuildSignature, CliBuildSignatureSchema, type CliSignatureVerdict, type CliSigningKey, type CliTrustRoot, cliManifestSigningPayload, cliSignatureAccepted, signCliManifest, verifyCliManifest, } from '../tools/cli/signature.js';
38
+ export { type CliBuildSignature, CliBuildSignatureSchema, type CliSignatureVerdict, type CliSigningKey, type CliTrustRoot, CliTrustRootSchema, cliManifestSigningPayload, cliSignatureAccepted, signCliManifest, verifyCliManifest, } from '../tools/cli/signature.js';
39
39
  export { type CliBatchCommandConfig, type CliStreamAnswer, type CliStreamCommandConfig, type CliStreamHooks, defineCliBatchCommand, defineCliStreamCommand, runCliStream, } from '../tools/cli/stream.js';
40
40
  export { type AppliedCliUpdate, applyCliUpdate, type CliRollbackConfig, type CliUpdateApplyConfig, type CliUpdateCheck, type CliUpdateCheckConfig, checkCliUpdate, compareCliVersions, type RolledBackCliUpdate, rollbackCliUpdate, } from '../tools/cli/update.js';
41
41
  export { type CliViewOutput, renderCliView } from '../tools/cli/view.js';
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/entrypoints/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,uBAAuB,EACvB,KAAK,aAAa,EAClB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACtC,KAAK,eAAe,EACpB,gBAAgB,EAChB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,SAAS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AAkB,EAClB,KAAK,mBAAmB,EACxB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvF,YAAY,EACV,qBAAqB,EACrB,+BAA+B,EAC/B,kCAAkC,GACnC,MAAM,mCAAmC,CAAC;AAC3C;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
@@ -35,6 +35,7 @@ import"../index-yrhw10ef.js";
35
35
  import {
36
36
  renderCliInstaller2,
37
37
  CliBuildSignatureSchema2,
38
+ CliTrustRootSchema2,
38
39
  cliManifestSigningPayload2,
39
40
  signCliManifest2,
40
41
  verifyCliManifest2,
@@ -51,7 +52,7 @@ import {
51
52
  checkCliUpdate2,
52
53
  applyCliUpdate2,
53
54
  rollbackCliUpdate2
54
- } from "../index-f103md2v.js";
55
+ } from "../index-3zt0r4y0.js";
55
56
  import"../index-673drwkn.js";
56
57
  import"../index-2qnqvq11.js";
57
58
  import"../index-zhngww7q.js";
@@ -422,6 +423,7 @@ export {
422
423
  CliBuildStampSchema2 as CliBuildStampSchema,
423
424
  CliBuildTargetSchema2 as CliBuildTargetSchema,
424
425
  CliProfileError,
426
+ CliTrustRootSchema2 as CliTrustRootSchema,
425
427
  DEFAULT_EXIT_CODES2 as DEFAULT_EXIT_CODES,
426
428
  applyCliUpdate2 as applyCliUpdate,
427
429
  assertCliPublishable2 as assertCliPublishable,
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * `stitchkit/postgres` — peer-free helpers for PostgreSQL applications,
3
- * including per-transaction serialization for Prisma SQL driver adapters.
3
+ * including safe `pg` / `PrismaPg` startup option merging (`TimeZone=UTC`, `search_path`,
4
+ * and URL `?options=`) and per-transaction serialization for Prisma SQL driver adapters.
4
5
  */
6
+ export { type PostgresConnectionConfig, type PostgresConnectionOptions, postgresConnectionConfig, } from '../postgres/connection-config.js';
5
7
  export { type PrismaDriverAdapter, type PrismaDriverAdapterFactory, type PrismaDriverTransaction, withSerializedPrismaTransactions, } from '../postgres/serialize-prisma.js';
6
8
  //# sourceMappingURL=postgres.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/entrypoints/postgres.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,gCAAgC,GACjC,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/entrypoints/postgres.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,gCAAgC,GACjC,MAAM,8BAA8B,CAAC"}