@clickraft/cli 0.1.3 → 0.1.4

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
@@ -1,9 +1,9 @@
1
- ## [0.1.3](https://github.com/clickraft/cli/compare/v0.1.2...v0.1.3) (2026-05-23)
1
+ ## [0.1.4](https://github.com/clickraft/cli/compare/v0.1.3...v0.1.4) (2026-05-23)
2
2
 
3
3
  ### Bug Fixes
4
4
 
5
- * **cli:** remove double-prefix in generate/jobs/upload commands ([43c1058](https://github.com/clickraft/cli/commit/43c1058c71f3992a81b60bfa53c9171f9530f423))
6
- * **schemas:** accept postgres-style timestamps in jobs schema ([d8a05ea](https://github.com/clickraft/cli/commit/d8a05ea8560646fd6813a11db1a5fd5c4ea4b4c4)), closes [#7](https://github.com/clickraft/cli/issues/7)
5
+ * **errors:** surface zod issue path in E_SCHEMA_MISMATCH messages ([723cc29](https://github.com/clickraft/cli/commit/723cc29cd65c8c34de523ce49974bd2504a119dd))
6
+ * **schemas:** allow null estimatedSeconds in POST /jobs response ([52a96b0](https://github.com/clickraft/cli/commit/52a96b0439be9cb2554b9cf192956c5afd731d37))
7
7
 
8
8
  # Changelog
9
9
 
package/dist/cli.js CHANGED
@@ -322,6 +322,31 @@ function toEnvelopeCode(code) {
322
322
  }
323
323
  var SIGINT_EXIT_CODE = 130;
324
324
 
325
+ // src/errors/schema-mismatch.ts
326
+ var MAX_ISSUES = 5;
327
+ function formatSchemaIssues(error) {
328
+ const issues = error.issues;
329
+ const shown = issues.slice(0, MAX_ISSUES).map(formatIssue);
330
+ const remaining = issues.length - shown.length;
331
+ const joined = shown.join("; ");
332
+ return remaining > 0 ? `${joined} (+${remaining} more)` : joined;
333
+ }
334
+ function formatIssue(issue) {
335
+ const path = formatPath(issue.path);
336
+ if (issue.code === "invalid_type") {
337
+ return `${path}: ${issue.code} (expected ${issue.expected}, received ${issue.received})`;
338
+ }
339
+ if (issue.code === "invalid_string") {
340
+ const validation = typeof issue.validation === "string" ? issue.validation : Object.keys(issue.validation)[0] ?? "string";
341
+ return `${path}: ${issue.code} (${validation})`;
342
+ }
343
+ return `${path}: ${issue.code}`;
344
+ }
345
+ function formatPath(path) {
346
+ if (path.length === 0) return "(root)";
347
+ return path.map(String).join(".");
348
+ }
349
+
325
350
  // src/api/idempotency.ts
326
351
  import { createHash, randomUUID } from "crypto";
327
352
  function generateIdempotencyKey() {
@@ -589,12 +614,17 @@ function parseSuccessBody(args) {
589
614
  }
590
615
  const envelope = ServerSuccessSchema(args.responseSchema ?? z2.unknown()).safeParse(parsed);
591
616
  if (!envelope.success) {
592
- throw new ApiError("SCHEMA_MISMATCH", "Server response did not match the expected schema.", {
593
- status: args.statusCode,
594
- requestId: args.requestId,
595
- retryable: false,
596
- redactedBody: redactAndTruncate(args.bodyText)
597
- });
617
+ const issues = formatSchemaIssues(envelope.error);
618
+ throw new ApiError(
619
+ "SCHEMA_MISMATCH",
620
+ `Server response did not match the expected schema. Issues: ${issues}`,
621
+ {
622
+ status: args.statusCode,
623
+ requestId: args.requestId,
624
+ retryable: false,
625
+ redactedBody: redactAndTruncate(args.bodyText)
626
+ }
627
+ );
598
628
  }
599
629
  return envelope.data.data;
600
630
  }
@@ -835,7 +865,7 @@ var GenerateCreateRequestSchema = z3.object({
835
865
  var GenerateCreateResponseSchema = z3.object({
836
866
  jobId: z3.string().uuid(),
837
867
  status: z3.enum(["queued", "processing", "completed", "failed"]),
838
- estimatedSeconds: z3.number().int().nonnegative(),
868
+ estimatedSeconds: z3.number().int().nonnegative().nullable(),
839
869
  creditsCharged: z3.number().int().nonnegative()
840
870
  }).strict();
841
871
  var GenerationStatusSchema = z3.enum([