@openspecui/core 11.1.0 → 12.0.0

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 (50) hide show
  1. package/dist/{active-root-config-CsFtntHf.d.mts → active-root-config-Ba57tJrq.d.mts} +17 -17
  2. package/dist/active-root-config.d.mts +5 -5
  3. package/dist/{cli-projection-Dd5Gdqa2.d.mts → cli-projection-CvtX601c.d.mts} +17 -17
  4. package/dist/cli-projection.d.mts +5 -5
  5. package/dist/{command-result-DWMmDl6I.mjs → command-result-DbXO8ZgG.mjs} +106 -13
  6. package/dist/{dashboard-summary-transport-wRH7oVWM.d.mts → dashboard-summary-transport-edeWQPi7.d.mts} +5449 -5394
  7. package/dist/dashboard-summary-transport.d.mts +18 -18
  8. package/dist/{document-translation-OvsFNs-H.d.mts → document-translation-CGMD0RLA.d.mts} +102 -102
  9. package/dist/document-translation.d.mts +1 -1
  10. package/dist/hosted-app.d.mts +18 -18
  11. package/dist/hosted-contract.d.mts +18 -18
  12. package/dist/{index-jbHV-sxg.d.mts → index-D9qYKNqh.d.mts} +2215 -189
  13. package/dist/index.d.mts +19 -19
  14. package/dist/index.mjs +127 -59
  15. package/dist/{local-download-profiles-DXNExauZ.d.mts → local-download-profiles-DaFozMhH.d.mts} +1 -1
  16. package/dist/local-download-profiles.d.mts +2 -2
  17. package/dist/{notifications-B8Ael_hq.d.mts → notifications-Dkoh_xrs.d.mts} +8 -8
  18. package/dist/notifications.d.mts +2 -2
  19. package/dist/{openspec-compat-DctIDxRM.mjs → openspec-compat-CpMO8-dz.mjs} +20 -16
  20. package/dist/openspec-compat.d.mts +5 -5
  21. package/dist/openspec-compat.mjs +3 -3
  22. package/dist/{openspec-projection-xOnjhQ7v.d.mts → openspec-projection-46QLZ6b8.d.mts} +1 -1
  23. package/dist/openspec-projection.d.mts +2 -2
  24. package/dist/{opsx-entity-Dc4XotlR.d.mts → opsx-entity-Btqm5OhC.d.mts} +2 -2
  25. package/dist/opsx-entity.d.mts +7 -7
  26. package/dist/{opsx-schema-detail-BJ6wzYhq.d.mts → opsx-schema-detail-C4VyWZ8B.d.mts} +2 -2
  27. package/dist/opsx-schema-detail.d.mts +8 -8
  28. package/dist/{opsx-types-CnZ4dsxb.d.mts → opsx-types-hVFHL9Cb.d.mts} +255 -255
  29. package/dist/{planning-cli-projection-pq8vZC1r.mjs → planning-cli-projection-BUU26bEw.mjs} +2 -2
  30. package/dist/planning-cli-projection.d.mts +18 -18
  31. package/dist/planning-cli-projection.mjs +3 -3
  32. package/dist/{schemas-pfpqDlAd.d.mts → schemas-Ce7B_SNx.d.mts} +208 -208
  33. package/dist/{sounds-B0GiWqBN.d.mts → sounds-DzDkqTIX.d.mts} +4 -4
  34. package/dist/sounds.d.mts +1 -1
  35. package/dist/{spec-catalog-BkX0tZp9.mjs → spec-catalog-DshONoJ9.mjs} +31 -2
  36. package/dist/spec-catalog.d.mts +18 -18
  37. package/dist/spec-catalog.mjs +2 -2
  38. package/dist/{store-mutation-protocol-DXeWtAvN.d.mts → store-mutation-protocol-DHjp76v0.d.mts} +24 -24
  39. package/dist/store-mutation-protocol.d.mts +1 -1
  40. package/dist/{store-types-BLW7QE7W.d.mts → store-types-vKTsXtfb.d.mts} +1 -1
  41. package/dist/store-types.d.mts +5 -5
  42. package/dist/task-progress.d.mts +6 -6
  43. package/dist/{terminal-audio-BpfUW_eB.d.mts → terminal-audio-C6kc0fbX.d.mts} +1 -1
  44. package/dist/terminal-audio.d.mts +2 -2
  45. package/dist/terminal-control.d.mts +2 -2
  46. package/dist/{terminal-invocation-DROo1wu_.d.mts → terminal-invocation-zNp8J57-.d.mts} +108 -108
  47. package/dist/terminal-invocation.d.mts +1 -1
  48. package/dist/{translator-C5z6a5C4.d.mts → translator-DZO_bY1X.d.mts} +254 -254
  49. package/dist/translator.d.mts +1 -1
  50. package/package.json +2 -1
@@ -1,4 +1,4 @@
1
- import { At as CliRootSource, Mt as CliExecutor, Nt as CliResult, bt as CliDiagnostic, f as CliDoctor, gt as CliCommandResult, l as OpenSpecCliContractExecutor, n as CliRootSelector, u as CliContext, vt as CliJsonValue, wt as CliDoctorReferenceEntry } from "./index-jbHV-sxg.mjs";
1
+ import { Ct as CliJsonValue, Ft as CliRootSource, Lt as CliExecutor, Rt as CliResult, Tt as CliDiagnostic, f as CliDoctor, kt as CliDoctorReferenceEntry, l as OpenSpecCliContractExecutor, n as CliRootSelector, u as CliContext, xt as CliCommandResult } from "./index-D9qYKNqh.mjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/open-spec-data-scope.d.ts
@@ -393,8 +393,8 @@ declare const ActiveRootOfficialConfigSchema: z.ZodObject<{
393
393
  } | undefined;
394
394
  }>>;
395
395
  }, "strict", z.ZodTypeAny, {
396
- context: string | null;
397
396
  schema: string | null;
397
+ context: string | null;
398
398
  rules: Record<string, string[]> | null;
399
399
  operations: {
400
400
  apply?: {
@@ -405,8 +405,8 @@ declare const ActiveRootOfficialConfigSchema: z.ZodObject<{
405
405
  } | undefined;
406
406
  } | null;
407
407
  }, {
408
- context: string | null;
409
408
  schema: string | null;
409
+ context: string | null;
410
410
  rules: Record<string, string[]> | null;
411
411
  operations: {
412
412
  apply?: {
@@ -455,8 +455,8 @@ declare const ActiveRootStructuredUpdateSchema: z.ZodObject<{
455
455
  } | null;
456
456
  }>>;
457
457
  }, "strict", z.ZodTypeAny, {
458
- context: string | null;
459
458
  schema: string;
459
+ context: string | null;
460
460
  rules: Record<string, string[]> | null;
461
461
  operations: {
462
462
  apply: {
@@ -467,8 +467,8 @@ declare const ActiveRootStructuredUpdateSchema: z.ZodObject<{
467
467
  } | null;
468
468
  } | null;
469
469
  }, {
470
- context: string | null;
471
470
  schema: string;
471
+ context: string | null;
472
472
  rules: Record<string, string[]> | null;
473
473
  operations: {
474
474
  apply: {
@@ -523,8 +523,8 @@ declare const ActiveRootMutationSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodOb
523
523
  } | null;
524
524
  }>>;
525
525
  }, "strict", z.ZodTypeAny, {
526
- context: string | null;
527
526
  schema: string;
527
+ context: string | null;
528
528
  rules: Record<string, string[]> | null;
529
529
  operations: {
530
530
  apply: {
@@ -535,8 +535,8 @@ declare const ActiveRootMutationSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodOb
535
535
  } | null;
536
536
  } | null;
537
537
  }, {
538
- context: string | null;
539
538
  schema: string;
539
+ context: string | null;
540
540
  rules: Record<string, string[]> | null;
541
541
  operations: {
542
542
  apply: {
@@ -551,11 +551,11 @@ declare const ActiveRootMutationSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodOb
551
551
  filePath: z.ZodString;
552
552
  revision: z.ZodString;
553
553
  }, "strict", z.ZodTypeAny, {
554
- filePath: string;
554
+ mode: "structured";
555
555
  revision: string;
556
556
  update: {
557
- context: string | null;
558
557
  schema: string;
558
+ context: string | null;
559
559
  rules: Record<string, string[]> | null;
560
560
  operations: {
561
561
  apply: {
@@ -566,14 +566,14 @@ declare const ActiveRootMutationSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodOb
566
566
  } | null;
567
567
  } | null;
568
568
  };
569
- mode: "structured";
569
+ filePath: string;
570
570
  ownerPath: string;
571
571
  }, {
572
- filePath: string;
572
+ mode: "structured";
573
573
  revision: string;
574
574
  update: {
575
- context: string | null;
576
575
  schema: string;
576
+ context: string | null;
577
577
  rules: Record<string, string[]> | null;
578
578
  operations: {
579
579
  apply: {
@@ -584,7 +584,7 @@ declare const ActiveRootMutationSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodOb
584
584
  } | null;
585
585
  } | null;
586
586
  };
587
- mode: "structured";
587
+ filePath: string;
588
588
  ownerPath: string;
589
589
  }>, z.ZodObject<{
590
590
  mode: z.ZodLiteral<"raw">;
@@ -593,16 +593,16 @@ declare const ActiveRootMutationSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodOb
593
593
  filePath: z.ZodString;
594
594
  revision: z.ZodString;
595
595
  }, "strict", z.ZodTypeAny, {
596
- filePath: string;
597
- revision: string;
598
596
  mode: "raw";
599
597
  content: string;
598
+ revision: string;
599
+ filePath: string;
600
600
  ownerPath: string;
601
601
  }, {
602
- filePath: string;
603
- revision: string;
604
602
  mode: "raw";
605
603
  content: string;
604
+ revision: string;
605
+ filePath: string;
606
606
  ownerPath: string;
607
607
  }>]>;
608
608
  /** Revision-aware Active Root mutation request. */
@@ -1,6 +1,6 @@
1
- import "./index-jbHV-sxg.mjs";
2
- import "./document-translation-OvsFNs-H.mjs";
3
- import "./sounds-B0GiWqBN.mjs";
4
- import "./notifications-B8Ael_hq.mjs";
5
- import { _ as ActiveRootStructuredUpdateSchema, a as ActiveRootConfigDiagnostic, c as ActiveRootMutation, d as ActiveRootOfficialConfig, f as ActiveRootOfficialConfigSchema, g as ActiveRootStructuredUpdate, h as ActiveRootRevisionSchema, i as ActiveRootConfig, l as ActiveRootMutationResult, m as ActiveRootRevision, n as patchActiveRootOfficialFields, o as ActiveRootConfigFile, p as ActiveRootRawValidation, r as validateActiveRootRawYaml, s as ActiveRootConfigInspection, t as inspectActiveRootOfficialConfig, u as ActiveRootMutationSchema, v as MAX_ACTIVE_ROOT_CONTEXT_BYTES } from "./active-root-config-CsFtntHf.mjs";
1
+ import "./index-D9qYKNqh.mjs";
2
+ import "./document-translation-CGMD0RLA.mjs";
3
+ import "./sounds-DzDkqTIX.mjs";
4
+ import "./notifications-Dkoh_xrs.mjs";
5
+ import { _ as ActiveRootStructuredUpdateSchema, a as ActiveRootConfigDiagnostic, c as ActiveRootMutation, d as ActiveRootOfficialConfig, f as ActiveRootOfficialConfigSchema, g as ActiveRootStructuredUpdate, h as ActiveRootRevisionSchema, i as ActiveRootConfig, l as ActiveRootMutationResult, m as ActiveRootRevision, n as patchActiveRootOfficialFields, o as ActiveRootConfigFile, p as ActiveRootRawValidation, r as validateActiveRootRawYaml, s as ActiveRootConfigInspection, t as inspectActiveRootOfficialConfig, u as ActiveRootMutationSchema, v as MAX_ACTIVE_ROOT_CONTEXT_BYTES } from "./active-root-config-Ba57tJrq.mjs";
6
6
  export { ActiveRootConfig, ActiveRootConfigDiagnostic, ActiveRootConfigFile, ActiveRootConfigInspection, ActiveRootMutation, ActiveRootMutationResult, ActiveRootMutationSchema, ActiveRootOfficialConfig, ActiveRootOfficialConfigSchema, ActiveRootRawValidation, ActiveRootRevision, ActiveRootRevisionSchema, ActiveRootStructuredUpdate, ActiveRootStructuredUpdateSchema, MAX_ACTIVE_ROOT_CONTEXT_BYTES, inspectActiveRootOfficialConfig, patchActiveRootOfficialFields, validateActiveRootRawYaml };
@@ -1,4 +1,4 @@
1
- import { gt as CliCommandResult, vt as CliJsonValue } from "./index-jbHV-sxg.mjs";
1
+ import { Ct as CliJsonValue, xt as CliCommandResult } from "./index-D9qYKNqh.mjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/cli-projection.d.ts
@@ -215,22 +215,22 @@ declare function createCliProjectionStateSchema<TOutput, TInput>(dataSchema: z.Z
215
215
  workGeneration: z.ZodNumber;
216
216
  invalidationCause: z.ZodEnum<["initial", "dependency", "explicit-refresh", "subscriber-resume"]>;
217
217
  }, "strip", z.ZodTypeAny, {
218
- identity: string;
219
- workGeneration: number;
220
- snapshotGeneration: null;
221
218
  error: null;
219
+ identity: string;
222
220
  state: "loading";
223
221
  data: null;
224
222
  freshness: null;
223
+ snapshotGeneration: null;
224
+ workGeneration: number;
225
225
  invalidationCause: "initial" | "dependency" | "explicit-refresh" | "subscriber-resume";
226
226
  }, {
227
- identity: string;
228
- workGeneration: number;
229
- snapshotGeneration: null;
230
227
  error: null;
228
+ identity: string;
231
229
  state: "loading";
232
230
  data: null;
233
231
  freshness: null;
232
+ snapshotGeneration: null;
233
+ workGeneration: number;
234
234
  invalidationCause: "initial" | "dependency" | "explicit-refresh" | "subscriber-resume";
235
235
  }>, z.ZodObject<{
236
236
  state: z.ZodLiteral<"ready">;
@@ -390,9 +390,6 @@ declare function createCliProjectionStateSchema<TOutput, TInput>(dataSchema: z.Z
390
390
  workGeneration: z.ZodNumber;
391
391
  invalidationCause: z.ZodEnum<["initial", "dependency", "explicit-refresh", "subscriber-resume"]>;
392
392
  }, "strip", z.ZodTypeAny, {
393
- identity: string;
394
- workGeneration: number;
395
- snapshotGeneration: null;
396
393
  error: {
397
394
  message: string;
398
395
  name: string;
@@ -412,14 +409,14 @@ declare function createCliProjectionStateSchema<TOutput, TInput>(dataSchema: z.Z
412
409
  contractError?: string | undefined;
413
410
  } | null;
414
411
  };
412
+ identity: string;
415
413
  state: "error";
416
414
  data: null;
417
415
  freshness: null;
416
+ snapshotGeneration: null;
417
+ workGeneration: number;
418
418
  invalidationCause: "initial" | "dependency" | "explicit-refresh" | "subscriber-resume";
419
419
  }, {
420
- identity: string;
421
- workGeneration: number;
422
- snapshotGeneration: null;
423
420
  error: {
424
421
  message: string;
425
422
  name: string;
@@ -439,9 +436,12 @@ declare function createCliProjectionStateSchema<TOutput, TInput>(dataSchema: z.Z
439
436
  contractError?: string | undefined;
440
437
  } | null;
441
438
  };
439
+ identity: string;
442
440
  state: "error";
443
441
  data: null;
444
442
  freshness: null;
443
+ snapshotGeneration: null;
444
+ workGeneration: number;
445
445
  invalidationCause: "initial" | "dependency" | "explicit-refresh" | "subscriber-resume";
446
446
  }>, z.ZodObject<{
447
447
  state: z.ZodLiteral<"refresh-error">;
@@ -762,15 +762,15 @@ declare const CliProjectionNoticeSchema: z.ZodObject<{
762
762
  invalidationCause: z.ZodEnum<["initial", "dependency", "explicit-refresh", "subscriber-resume"]>;
763
763
  }, "strip", z.ZodTypeAny, {
764
764
  identity: string;
765
- workGeneration: number;
765
+ state: "error" | "ready" | "loading" | "revalidating" | "refresh-error";
766
766
  snapshotGeneration: number | null;
767
- state: "loading" | "ready" | "revalidating" | "error" | "refresh-error";
767
+ workGeneration: number;
768
768
  invalidationCause: "initial" | "dependency" | "explicit-refresh" | "subscriber-resume";
769
769
  }, {
770
770
  identity: string;
771
- workGeneration: number;
771
+ state: "error" | "ready" | "loading" | "revalidating" | "refresh-error";
772
772
  snapshotGeneration: number | null;
773
- state: "loading" | "ready" | "revalidating" | "error" | "refresh-error";
773
+ workGeneration: number;
774
774
  invalidationCause: "initial" | "dependency" | "explicit-refresh" | "subscriber-resume";
775
775
  }>;
776
776
  type CliProjectionNotice = z.infer<typeof CliProjectionNoticeSchema>;
@@ -1,6 +1,6 @@
1
- import "./index-jbHV-sxg.mjs";
2
- import "./document-translation-OvsFNs-H.mjs";
3
- import "./sounds-B0GiWqBN.mjs";
4
- import "./notifications-B8Ael_hq.mjs";
5
- import { _ as toCliProjectionCommandEvidence, a as CliProjectionFailure, c as CliProjectionInvalidationCauseSchema, d as CliProjectionState, f as CliProjectionStateName, g as createCliProjectionStateSchema, h as cliProjectionStates, i as CliProjectionCommandEvidenceSchema, l as CliProjectionNotice, m as cliProjectionInvalidationCauses, n as CliProjectionCommandError, o as CliProjectionFailureSchema, p as CliProjectionStateNameSchema, r as CliProjectionCommandEvidence, s as CliProjectionInvalidationCause, t as CliJsonValueSchema, u as CliProjectionNoticeSchema, v as toCliProjectionFailure, y as toCliProjectionNotice } from "./cli-projection-Dd5Gdqa2.mjs";
1
+ import "./index-D9qYKNqh.mjs";
2
+ import "./document-translation-CGMD0RLA.mjs";
3
+ import "./sounds-DzDkqTIX.mjs";
4
+ import "./notifications-Dkoh_xrs.mjs";
5
+ import { _ as toCliProjectionCommandEvidence, a as CliProjectionFailure, c as CliProjectionInvalidationCauseSchema, d as CliProjectionState, f as CliProjectionStateName, g as createCliProjectionStateSchema, h as cliProjectionStates, i as CliProjectionCommandEvidenceSchema, l as CliProjectionNotice, m as cliProjectionInvalidationCauses, n as CliProjectionCommandError, o as CliProjectionFailureSchema, p as CliProjectionStateNameSchema, r as CliProjectionCommandEvidence, s as CliProjectionInvalidationCause, t as CliJsonValueSchema, u as CliProjectionNoticeSchema, v as toCliProjectionFailure, y as toCliProjectionNotice } from "./cli-projection-CvtX601c.mjs";
6
6
  export { CliJsonValueSchema, CliProjectionCommandError, CliProjectionCommandEvidence, CliProjectionCommandEvidenceSchema, CliProjectionFailure, CliProjectionFailureSchema, CliProjectionInvalidationCause, CliProjectionInvalidationCauseSchema, CliProjectionNotice, CliProjectionNoticeSchema, CliProjectionState, CliProjectionStateName, CliProjectionStateNameSchema, cliProjectionInvalidationCauses, cliProjectionStates, createCliProjectionStateSchema, toCliProjectionCommandEvidence, toCliProjectionFailure, toCliProjectionNotice };
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
 
4
4
  //#region src/cli-contracts/workflow.ts
5
5
  /**
6
- * Orthogonal intents (updated 2026-08-28 Asia/Shanghai):
6
+ * Orthogonal intents (updated 2026-09-03 Asia/Shanghai):
7
7
  * 1. Model camelCase workflow JSON independently from Store-family JSON.
8
8
  * 2. Preserve strict, archived, and bulk Validate plus Archive outcomes, including failure payloads.
9
9
  * 3. Preserve multiline requirement bodies from `show --json`.
@@ -11,11 +11,18 @@ import { z } from "zod";
11
11
  * 5. Export the successful Spec-document schema for browser-safe projection validation.
12
12
  * 6. Export the root-less Status payload fields and Requirement shape shared with the
13
13
  * OpenSpec 1.11 batch Status and show --diff contracts.
14
+ * 7. Model the OpenSpec 1.12 `validate --report findings` document beside (never inside) the
15
+ * full Validate report, sharing the bulk-item and summary shapes while keeping decoding
16
+ * independent of the process exit code and of full-report validation truth. Decode owns
17
+ * the upstream-guaranteed invariants (non-empty per-item issues, returnedItems bounded
18
+ * by totalItems), and the union guard validates the discriminator shape rather than
19
+ * mere `report`-key presence.
14
20
  *
15
21
  * Original request (2026-07-15): "为不同命令建立强类型适配器,不实现平行解析规则。"
16
22
  * Original request (2026-07-26): "展开全面的接口升级和内核升级和测试升级。"
17
23
  * Original request (2026-08-15): "v9的适配需要同时适配 1.8和1.9。"
18
24
  * Original request (2026-08-28): "直接将 0.10.0 和 0.11.0 一起适配,然后发布 v11。"
25
+ * Original request (2026-09-03): "Openspec 1.12.0 刚刚放出来,你更新一下,调查变更内容,然后开始规划适配工作,我们将用标准工作流worktree来推进"
19
26
  */
20
27
  const CliChangeListEntrySchema = z.object({
21
28
  name: z.string(),
@@ -240,24 +247,110 @@ const CliValidationTotalsSchema = z.object({
240
247
  passed: z.number(),
241
248
  failed: z.number()
242
249
  }).passthrough();
250
+ /** One bulk Validate item: verdict, full issue array, and runtime-dependent duration. */
251
+ const CliValidateItemSchema = z.object({
252
+ id: z.string(),
253
+ type: z.enum(["change", "spec"]),
254
+ valid: z.boolean(),
255
+ issues: z.array(CliValidationIssueSchema),
256
+ durationMs: z.number()
257
+ }).passthrough();
258
+ /** Shared Validate summary: full-run totals plus per-type totals, never the filtered view. */
259
+ const CliValidateSummarySchema = z.object({
260
+ totals: CliValidationTotalsSchema,
261
+ byType: z.record(CliValidationTotalsSchema)
262
+ }).passthrough();
243
263
  /** Typed ordinary Validate report, also used by 1.9 `validate --archived --json`. */
244
264
  const CliValidateReportSchema = z.object({
245
- items: z.array(z.object({
246
- id: z.string(),
247
- type: z.enum(["change", "spec"]),
248
- valid: z.boolean(),
249
- issues: z.array(CliValidationIssueSchema),
250
- durationMs: z.number()
251
- }).passthrough()),
252
- summary: z.object({
253
- totals: CliValidationTotalsSchema,
254
- byType: z.record(CliValidationTotalsSchema)
255
- }).passthrough(),
265
+ items: z.array(CliValidateItemSchema),
266
+ summary: CliValidateSummarySchema,
256
267
  version: z.string(),
257
268
  root: CliRootSchema
258
269
  }).passthrough();
259
270
  /** Typed strict, non-strict, or archived Validate result, including failure diagnostics. */
260
271
  const CliValidateSchema = z.union([CliValidateReportSchema, CliDiagnosticFailureSchema]);
272
+ /**
273
+ * Typed OpenSpec 1.12 `validate --report findings` document.
274
+ *
275
+ * The findings report is a filtered evidence transport beside the full report, never the
276
+ * validation truth: `itemFindings` carries only items with issues, while `summary` and
277
+ * `root` stay the full-run values the CLI computed over every item in scope.
278
+ * `report.returnedItems`/`report.totalItems` distinguish the filtered view from the run
279
+ * size, and the process exit code keeps the full-run rule (`failed > 0 -> 1`), so decoding
280
+ * never consults it. An empty scope is the success document
281
+ * `{ returnedItems: 0, totalItems: 0, itemFindings: [] }`, not a failure sum type.
282
+ *
283
+ * Two upstream-guaranteed invariants are decode-level facts (pinned v1.12.0
284
+ * `projectValidationFindings`): every `itemFindings` entry carries at least one issue
285
+ * (upstream filters `item.issues.length > 0`), and `returnedItems` never exceeds
286
+ * `totalItems` (the filtered view is a subset of the full run). Upstream also happens to
287
+ * set `returnedItems === itemFindings.length` today; that equality stays unasserted so a
288
+ * future patch-level count adjustment inside the admitted range cannot fabricate a
289
+ * contract error out of otherwise well-formed CLI evidence.
290
+ */
291
+ const CliValidateFindingsSchema = z.object({
292
+ report: z.object({
293
+ kind: z.literal("validation-findings"),
294
+ version: z.string(),
295
+ scope: z.enum([
296
+ "all",
297
+ "changes",
298
+ "specs",
299
+ "archived"
300
+ ]),
301
+ returnedItems: z.number(),
302
+ totalItems: z.number()
303
+ }).passthrough(),
304
+ itemFindings: z.array(CliValidateItemSchema),
305
+ summary: CliValidateSummarySchema,
306
+ root: CliRootSchema
307
+ }).passthrough().superRefine((document, ctx) => {
308
+ if (document.report.returnedItems > document.report.totalItems) ctx.addIssue({
309
+ code: z.ZodIssueCode.custom,
310
+ path: ["report", "returnedItems"],
311
+ message: `returnedItems (${document.report.returnedItems}) must not exceed totalItems (${document.report.totalItems}).`
312
+ });
313
+ document.itemFindings.forEach((finding, index) => {
314
+ if (finding.issues.length === 0) ctx.addIssue({
315
+ code: z.ZodIssueCode.custom,
316
+ path: [
317
+ "itemFindings",
318
+ index,
319
+ "issues"
320
+ ],
321
+ message: "Every findings item must carry at least one issue."
322
+ });
323
+ });
324
+ });
325
+ /**
326
+ * Typed findings or request-failure result of `validate --report findings --json`.
327
+ *
328
+ * Invalid requests (no bulk scope, an item name, archived+active mixing, or an unknown
329
+ * report value) produce the shared status-array failure envelope with code
330
+ * `invalid_validation_report_request`, decoded here through the shared diagnostic
331
+ * failure schema including its optional `fix` string.
332
+ */
333
+ const CliValidateFindingsResultSchema = z.union([CliValidateFindingsSchema, CliDiagnosticFailureSchema]);
334
+ /**
335
+ * Whether a findings result is the findings document rather than the request-failure
336
+ * envelope. Passthrough tolerance means a failure envelope may legally carry unknown
337
+ * keys, so mere `report`-key presence cannot discriminate the union: the guard validates
338
+ * the upstream discriminator shape — `report` is an object whose `kind` is the
339
+ * `validation-findings` literal and whose count fields are numbers.
340
+ *
341
+ * The input is deliberately `unknown`: route and evidence consumers receive the union
342
+ * of every validate transport (`CliValidate | CliValidateFindingsResult | null`), so the
343
+ * guard must accept the consumed boundary, not only the already-narrowed findings union.
344
+ * It stays a cheap shape check, never a second decode: schema-level invariants
345
+ * (issue presence, count bounds) belong to `CliValidateFindingsSchema` alone.
346
+ */
347
+ function isCliValidateFindings(result) {
348
+ if (typeof result !== "object" || result === null) return false;
349
+ const report = result.report;
350
+ if (typeof report !== "object" || report === null) return false;
351
+ const { kind, returnedItems, totalItems } = report;
352
+ return kind === "validation-findings" && typeof returnedItems === "number" && typeof totalItems === "number";
353
+ }
261
354
  const CliArchiveTotalsSchema = z.object({
262
355
  added: z.number(),
263
356
  modified: z.number(),
@@ -352,4 +445,4 @@ function parseCliCommandResult(result, schema) {
352
445
  }
353
446
 
354
447
  //#endregion
355
- export { CliValidateReportSchema as C, CliWorkflowStatusSuccessSchema as D, CliWorkflowStatusSchema as E, CliTemplatesSchema as S, CliWorkflowStatusFieldsSchema as T, CliShowSpecDocumentSchema as _, CliApplyInstructionsSuccessSchema as a, CliSpecRequirementSchema as b, CliArchiveSchema as c, CliArtifactPathSchema as d, CliChangeListSchema as f, CliSchemaWhichSchema as g, CliSchemaShadowSchema as h, CliApplyInstructionsSchema as i, CliArtifactInstructionsSchema as l, CliSchemaResolutionSchema as m, parseCliCommandResult as n, CliArchiveInstructionsSchema as o, CliPlanningHomeSchema as p, CliActionContextSchema as r, CliArchiveInstructionsSuccessSchema as s, CliCommandTransportSchema as t, CliArtifactInstructionsSuccessSchema as u, CliShowSpecSchema as v, CliValidateSchema as w, CliTemplateEntrySchema as x, CliSpecListSchema as y };
448
+ export { isCliValidateFindings as A, CliValidateFindingsResultSchema as C, CliWorkflowStatusFieldsSchema as D, CliValidateSchema as E, CliWorkflowStatusSchema as O, CliTemplatesSchema as S, CliValidateReportSchema as T, CliShowSpecDocumentSchema as _, CliApplyInstructionsSuccessSchema as a, CliSpecRequirementSchema as b, CliArchiveSchema as c, CliArtifactPathSchema as d, CliChangeListSchema as f, CliSchemaWhichSchema as g, CliSchemaShadowSchema as h, CliApplyInstructionsSchema as i, CliWorkflowStatusSuccessSchema as k, CliArtifactInstructionsSchema as l, CliSchemaResolutionSchema as m, parseCliCommandResult as n, CliArchiveInstructionsSchema as o, CliPlanningHomeSchema as p, CliActionContextSchema as r, CliArchiveInstructionsSuccessSchema as s, CliCommandTransportSchema as t, CliArtifactInstructionsSuccessSchema as u, CliShowSpecSchema as v, CliValidateFindingsSchema as w, CliTemplateEntrySchema as x, CliSpecListSchema as y };