@clossys/writer 0.3.2

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 (115) hide show
  1. package/CHANGELOG.md +196 -0
  2. package/LICENSE +21 -0
  3. package/README.md +593 -0
  4. package/dist/addressability.d.ts +245 -0
  5. package/dist/addressability.d.ts.map +1 -0
  6. package/dist/addressability.js +567 -0
  7. package/dist/addressability.js.map +1 -0
  8. package/dist/checker.d.ts +159 -0
  9. package/dist/checker.d.ts.map +1 -0
  10. package/dist/checker.js +177 -0
  11. package/dist/checker.js.map +1 -0
  12. package/dist/cli.d.ts +149 -0
  13. package/dist/cli.d.ts.map +1 -0
  14. package/dist/cli.js +1049 -0
  15. package/dist/cli.js.map +1 -0
  16. package/dist/copy-gate.d.ts +107 -0
  17. package/dist/copy-gate.d.ts.map +1 -0
  18. package/dist/copy-gate.js +132 -0
  19. package/dist/copy-gate.js.map +1 -0
  20. package/dist/fingerprint.d.ts +61 -0
  21. package/dist/fingerprint.d.ts.map +1 -0
  22. package/dist/fingerprint.js +64 -0
  23. package/dist/fingerprint.js.map +1 -0
  24. package/dist/index.d.ts +47 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +63 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/locale-coverage.d.ts +227 -0
  29. package/dist/locale-coverage.d.ts.map +1 -0
  30. package/dist/locale-coverage.js +414 -0
  31. package/dist/locale-coverage.js.map +1 -0
  32. package/dist/passage.d.ts +294 -0
  33. package/dist/passage.d.ts.map +1 -0
  34. package/dist/passage.js +463 -0
  35. package/dist/passage.js.map +1 -0
  36. package/dist/path-exclusions.d.ts +114 -0
  37. package/dist/path-exclusions.d.ts.map +1 -0
  38. package/dist/path-exclusions.js +213 -0
  39. package/dist/path-exclusions.js.map +1 -0
  40. package/dist/registry.d.ts +61 -0
  41. package/dist/registry.d.ts.map +1 -0
  42. package/dist/registry.js +64 -0
  43. package/dist/registry.js.map +1 -0
  44. package/dist/resolve.d.ts +33 -0
  45. package/dist/resolve.d.ts.map +1 -0
  46. package/dist/resolve.js +133 -0
  47. package/dist/resolve.js.map +1 -0
  48. package/dist/scan.d.ts +457 -0
  49. package/dist/scan.d.ts.map +1 -0
  50. package/dist/scan.js +1698 -0
  51. package/dist/scan.js.map +1 -0
  52. package/dist/schema.d.ts +81 -0
  53. package/dist/schema.d.ts.map +1 -0
  54. package/dist/schema.js +482 -0
  55. package/dist/schema.js.map +1 -0
  56. package/dist/types.d.ts +268 -0
  57. package/dist/types.d.ts.map +1 -0
  58. package/dist/types.js +40 -0
  59. package/dist/types.js.map +1 -0
  60. package/dist/voice/checker.d.ts +186 -0
  61. package/dist/voice/checker.d.ts.map +1 -0
  62. package/dist/voice/checker.js +483 -0
  63. package/dist/voice/checker.js.map +1 -0
  64. package/dist/voice/derivation-coverage.d.ts +168 -0
  65. package/dist/voice/derivation-coverage.d.ts.map +1 -0
  66. package/dist/voice/derivation-coverage.js +181 -0
  67. package/dist/voice/derivation-coverage.js.map +1 -0
  68. package/dist/voice/fields.d.ts +107 -0
  69. package/dist/voice/fields.d.ts.map +1 -0
  70. package/dist/voice/fields.js +144 -0
  71. package/dist/voice/fields.js.map +1 -0
  72. package/dist/voice/index.d.ts +19 -0
  73. package/dist/voice/index.d.ts.map +1 -0
  74. package/dist/voice/index.js +24 -0
  75. package/dist/voice/index.js.map +1 -0
  76. package/dist/voice/internal/parse-template.d.ts +27 -0
  77. package/dist/voice/internal/parse-template.d.ts.map +1 -0
  78. package/dist/voice/internal/parse-template.js +111 -0
  79. package/dist/voice/internal/parse-template.js.map +1 -0
  80. package/dist/voice/internal/pattern-safety.d.ts +111 -0
  81. package/dist/voice/internal/pattern-safety.d.ts.map +1 -0
  82. package/dist/voice/internal/pattern-safety.js +278 -0
  83. package/dist/voice/internal/pattern-safety.js.map +1 -0
  84. package/dist/voice/schema.d.ts +65 -0
  85. package/dist/voice/schema.d.ts.map +1 -0
  86. package/dist/voice/schema.js +535 -0
  87. package/dist/voice/schema.js.map +1 -0
  88. package/dist/voice/types.d.ts +282 -0
  89. package/dist/voice/types.d.ts.map +1 -0
  90. package/dist/voice/types.js +37 -0
  91. package/dist/voice/types.js.map +1 -0
  92. package/package.json +72 -0
  93. package/src/addressability.ts +664 -0
  94. package/src/checker.ts +293 -0
  95. package/src/cli.ts +1166 -0
  96. package/src/copy-gate.ts +197 -0
  97. package/src/fingerprint.ts +66 -0
  98. package/src/index.ts +163 -0
  99. package/src/locale-coverage.ts +512 -0
  100. package/src/passage.ts +644 -0
  101. package/src/path-exclusions.ts +265 -0
  102. package/src/registry.ts +103 -0
  103. package/src/resolve.ts +172 -0
  104. package/src/scan.ts +1959 -0
  105. package/src/schema.ts +528 -0
  106. package/src/types.ts +301 -0
  107. package/src/voice/checker.ts +590 -0
  108. package/src/voice/derivation-coverage.ts +217 -0
  109. package/src/voice/fields.ts +160 -0
  110. package/src/voice/index.ts +55 -0
  111. package/src/voice/internal/parse-template.ts +114 -0
  112. package/src/voice/internal/pattern-safety.ts +336 -0
  113. package/src/voice/schema.ts +585 -0
  114. package/src/voice/types.ts +329 -0
  115. package/templates/voice-record.template.jsonc +135 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-coverage.js","sourceRoot":"","sources":["../src/locale-coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoJG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAgExD,SAAS,OAAO,CACd,YAAwB,EACxB,eAA6B,EAC7B,aAA2B,EAC3B,OAA8B;IAE9B,OAAO;QACL,YAAY;QACZ,eAAe;QACf,aAAa;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CAAC;gBACjB,QAAQ,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,+BAA+B;oBACrC,QAAQ,EAAE,OAAO;oBACjB,OAAO,EAAE,UAAU,KAAK,CAAC,EAAE,8BAA8B,YAAY,uCAAuC,MAAM,IAAI;oBACtH,IAAI,EAAE,KAAK,CAAC,EAAE;oBACd,MAAM;oBACN,OAAO,EAAE,KAAK,CAAC,EAAE;iBAClB,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YACD,kEAAkE;YAClE,gEAAgE;YAChE,+DAA+D;YAC/D,0DAA0D;YAC1D,oCAAoC,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC3F,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC;YAC3C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC7B,QAAQ,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,gCAAgC;oBACtC,QAAQ,EAAE,SAAS;oBACnB,OAAO,EAAE,UAAU,KAAK,CAAC,EAAE,uBAAuB,MAAM,8CAA8C,YAAY,6DAA6D;oBAC/K,IAAI,EAAE,KAAK,CAAC,EAAE;oBACd,MAAM;oBACN,OAAO,EAAE,KAAK,CAAC,EAAE;iBAClB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,YAAY;QACZ,eAAe,EAAE,QAAQ;QACzB,aAAa;QACb,cAAc;QACd,cAAc;QACd,gBAAgB,EAAE,cAAc,CAAC,OAAO,CAAC,MAAM;QAC/C,QAAQ;QACR,QAAQ,EAAE,cAAc,CAAC,MAAM,KAAK,CAAC;KACtC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,294 @@
1
+ /**
2
+ * The PASSAGE LAYER — issue #373. `@example/copy` (now `writer`,
3
+ * per issue #373's own retargeting comment) has terms (a glossary) and
4
+ * entries (single addressable strings) and nothing between them.
5
+ * `@clossys/designer` has tokens, atoms, AND BLOCKS. This file is the
6
+ * missing middle: a `Passage` composes `CopyEntry`/glossary-term
7
+ * REFERENCES the way a block composes atoms — never a raw sentence of its
8
+ * own. Terms ≈ tokens, entries ≈ atoms, passages ≈ blocks, documents (a
9
+ * later, composition-layer concern, out of scope here — see the issue)
10
+ * ≈ views.
11
+ *
12
+ * WHERE THE MIRROR STOPS. This file deliberately does NOT port
13
+ * `@clossys/designer/tokens`' `brandable` boolean onto a `Passage`
14
+ * field. In tokens, `brandable` marks a subset WITHIN one namespace (154
15
+ * ship, 42 are brandable). The voice record's own consumer/machinery
16
+ * split runs between FILES instead (a consumer's own `VoiceRecord` vs.
17
+ * this package's shipped machinery) — forcing a boolean into a field here
18
+ * would be false symmetry with a split that does not exist at this
19
+ * layer. This file mirrors the LADDER (structure: terms/entries/passages/
20
+ * documents), not the binding mechanism.
21
+ *
22
+ * ============================================================================
23
+ * WHAT A `Passage` IS
24
+ * ============================================================================
25
+ *
26
+ * One reusable, addressable unit of composed language — an empty-state
27
+ * (title + body + action), an FAQ item (question + answer), an error
28
+ * (message + recovery) — never a single string, and never real prose of
29
+ * its own. `fields` is a plain `Record<string, unknown>` AT THE TYPE
30
+ * LEVEL, deliberately: a field's value is exactly what
31
+ * `classifyPassageField`/`checkPassageComposition` below classify at
32
+ * RUNTIME, not what a compile-time type could statically forbid a
33
+ * malformed registry file (real JSON on disk, not TypeScript-checked
34
+ * code) from containing. See "THE TERNARY" below for why a field holding
35
+ * a raw literal string must reach the GATE as a real, reportable
36
+ * violation rather than being rejected upstream as a schema error.
37
+ *
38
+ * This file ships no example content of anyone's real copy — the same
39
+ * "vocabulary layer, never a source of real words" constraint `types.ts`
40
+ * documents for `CopyEntry`/`CopyRecord`. Every fixture in this package's
41
+ * own tests is structural placeholder text, never something a product
42
+ * would actually show a user.
43
+ *
44
+ * ============================================================================
45
+ * THE GATE, WITH THE TERNARY (issue #373)
46
+ * ============================================================================
47
+ *
48
+ * 0 — SATISFIED: every passage references only entries and terms, and
49
+ * at least one passage was evaluated.
50
+ * 1 — VIOLATED: a passage inlines a literal string instead of
51
+ * referencing an entry (the verbal equivalent of a hardcoded color
52
+ * instead of a token), OR a passage references another passage's
53
+ * OWN INTERNALS (`{ ref: "passage", id, field }`) rather than
54
+ * composing entries/terms the way a block composes atoms, never
55
+ * reaching directly into a sibling block's own implementation.
56
+ * 2 — INDETERMINATE: the registry could not be read/parsed/validated,
57
+ * zero passages were evaluated (an empty `passages: []`), or a
58
+ * field's value could not be confidently classified as any of the
59
+ * above (not a string, not a recognized `{ ref: ... }` shape).
60
+ *
61
+ * PRECEDENCE — a real violation outranks an incomplete picture. This
62
+ * package already settled this exact question for a different gate
63
+ * (`addressability.ts`, issue #407/#433): letting "at least one
64
+ * unclassifiable field" outrank a confirmed violation would make the
65
+ * `"violated"` branch practically unreachable the moment a registry ever
66
+ * mixes a genuinely new/unknown field shape in with a real inlined
67
+ * literal — the identical collapse #407 fixed for addressability is fixed
68
+ * here from the start, not discovered later. `checkPassageComposition`
69
+ * applies the same "violated wins" ordering `checkAddressability` does.
70
+ *
71
+ * ============================================================================
72
+ * THE ADVERSARIAL SEPARATION (the weaker tool this gate must beat)
73
+ * ============================================================================
74
+ *
75
+ * A weaker tool that only checks "every referenced entry id exists"
76
+ * passes a passage built ENTIRELY from inline literals, because such a
77
+ * passage has ZERO references for that tool to check — nothing to
78
+ * validate is indistinguishable, to that tool, from everything being
79
+ * valid. The separating fixture: a passage with zero references and real
80
+ * prose sitting directly in its fields. The reference-checker reports
81
+ * clean (0 references, 0 problems). This gate must exit 1 — see
82
+ * `passage.adversarial.test.ts`, which runs both tools against the
83
+ * identical fixture in the same test, plus the sanity check that the weak
84
+ * tool is not simply broken (it correctly reports 0 when references truly
85
+ * do all exist).
86
+ *
87
+ * ============================================================================
88
+ * WHAT THIS GATE DELIBERATELY DOES NOT DO
89
+ * ============================================================================
90
+ *
91
+ * - It does not verify a referenced entry id or term actually EXISTS in
92
+ * a real `CopyRecord`/glossary. That is a DIFFERENT, weaker question
93
+ * ("does this id resolve") than the one this gate answers ("is this
94
+ * field a reference at all, or a smuggled-in literal") — the same
95
+ * split `addressability.ts` draws from `copy-gate.ts`'s traceability
96
+ * check (see that file's own top doc comment: "this gate has no
97
+ * `CopyRecord` input at all"). A gate with visibility into both a
98
+ * `PassageRecord` and a real `CopyRecord`/glossary to check
99
+ * referential integrity is a different, later gate — precisely the
100
+ * "weaker tool" this file's own adversarial proof names and beats on
101
+ * the property that actually matters here: composition purity.
102
+ * - It does not resolve/render a passage into text. Rendering a
103
+ * `Passage` against a real `CopyRecord`/`VoiceRecord` glossary is a
104
+ * consumer-owned, later concern — this file only ever validates
105
+ * SHAPE and COMPOSITION PURITY.
106
+ */
107
+ /**
108
+ * A stable address for one `Passage`, unique within its `PassageRecord`.
109
+ * Same shape as `CopyEntryId` (`types.ts`) — dot-separated, lowercase,
110
+ * kebab-case within each segment, at least one dot — deliberately
111
+ * duplicated as its own regex below rather than importing `CopyEntryId`'s
112
+ * private pattern: `schema.ts` does not export `COPY_ENTRY_ID_RE`, and
113
+ * this package's own precedent (`addressability.ts`'s locally redefined
114
+ * `SKIP_FILE_RE`) is to redefine a small, unexported pattern locally
115
+ * rather than reach across a file boundary for it.
116
+ */
117
+ export type PassageId = string;
118
+ /**
119
+ * A reference to a registered `CopyEntry`, by id. This — and
120
+ * `PassageTermReference` below — are the ONLY two shapes a `Passage`
121
+ * field may validly hold; see this file's top doc comment, "THE GATE".
122
+ */
123
+ export interface PassageEntryReference {
124
+ ref: "entry";
125
+ id: string;
126
+ }
127
+ /** A reference to a glossary term (see `@clossys/writer/voice`'s `GlossaryEntry.term`), by its term string. */
128
+ export interface PassageTermReference {
129
+ ref: "term";
130
+ term: string;
131
+ }
132
+ /** The two valid reference shapes a `Passage` field may hold. */
133
+ export type PassageReference = PassageEntryReference | PassageTermReference;
134
+ /**
135
+ * One reusable, addressable unit of composed language. `fields` is
136
+ * intentionally `Record<string, unknown>`, not `Record<string,
137
+ * PassageReference>` — see this file's top doc comment for why a field's
138
+ * actual value is a runtime classification question, not a compile-time
139
+ * type guarantee, for data that arrives as real (possibly malformed) JSON
140
+ * on disk.
141
+ */
142
+ export interface Passage {
143
+ /** Stable address. Unique within the `PassageRecord` it belongs to — see `PassageId`. */
144
+ id: PassageId;
145
+ /**
146
+ * Where this passage appears — a screen name, a component, a flow.
147
+ * Required, mirroring `CopyEntry.context`'s own "unlocatable copy is
148
+ * not reviewable copy" rule, restated once more here because it is the
149
+ * identical rule at one layer up: an unlocatable passage is not
150
+ * reviewable either.
151
+ */
152
+ context: string;
153
+ /**
154
+ * Named slots this passage composes — e.g. `{ title: {...}, body:
155
+ * {...}, action: {...} }` for an empty-state. Each value should be a
156
+ * `PassageReference`; whether it actually is one is exactly what
157
+ * `checkPassageComposition` (via `classifyPassageField`) determines.
158
+ */
159
+ fields: Record<string, unknown>;
160
+ }
161
+ /** One consumer's complete, registered set of passages. The "brand.css" of this file — foundry ships the schema this conforms to, never a real instance of it. */
162
+ export interface PassageRecord {
163
+ id: string;
164
+ passages: Passage[];
165
+ }
166
+ /**
167
+ * One thing `validatePassageRecordShape` found wrong with a candidate
168
+ * `PassageRecord`/`Passage`. Deliberately the same shape as `CopyFinding`
169
+ * (`types.ts`) — `rule`/`severity`/`message`/optional `path` — so a
170
+ * caller already handling one kind of finding in this package does not
171
+ * need a second mental model for this one. Defined fresh here rather than
172
+ * imported: this file does not import from `types.ts` at all (see this
173
+ * file's top doc comment on why passages never reach for a `CopyRecord`).
174
+ */
175
+ export interface PassageFinding {
176
+ rule: string;
177
+ severity: "error";
178
+ message: string;
179
+ path?: string;
180
+ }
181
+ /**
182
+ * Validates that `value` conforms to the `PassageRecord` shape. Returns a
183
+ * `PassageFinding[]`; empty means `value` is a well-formed `PassageRecord`.
184
+ * Never throws — mirrors `schema.ts`'s `validateCopyRecordShape` exactly:
185
+ * any input, including `null`/a string/a wildly malformed object,
186
+ * produces findings rather than an exception.
187
+ */
188
+ export declare function validatePassageRecordShape(value: unknown): PassageFinding[];
189
+ /**
190
+ * Parses `value` as a `PassageRecord`, throwing a plain `Error` (never a
191
+ * `PassageFinding[]`) if it does not conform — mirrors `schema.ts`'s
192
+ * `parseCopyRecord` exactly, including the two-pass validate-then-build
193
+ * shape and why (see that function's own doc comment for the fuller
194
+ * argument).
195
+ */
196
+ export declare function parsePassageRecord(value: unknown): PassageRecord;
197
+ /**
198
+ * Why `path` did not become a usable `PassageRecord`. Mirrors
199
+ * `registry.ts`'s `CopyRegistryReadIssueReason` exactly — see that type's
200
+ * own doc comment for what each reason means.
201
+ */
202
+ export type PassageRegistryReadIssueReason = "unreadable" | "unparseable" | "invalid-schema";
203
+ export interface PassageRegistryReadIssue {
204
+ reason: PassageRegistryReadIssueReason;
205
+ detail: string;
206
+ }
207
+ export interface PassageRegistryReadResult {
208
+ path: string;
209
+ record?: PassageRecord;
210
+ issues: PassageRegistryReadIssue[];
211
+ /** `true` exactly when `issues` is empty and `record` is populated — see `registry.ts`'s `CopyRegistryReadResult.complete` for why this is the shared one-boolean-read contract across this package. */
212
+ complete: boolean;
213
+ }
214
+ /**
215
+ * Reads and validates the `PassageRecord` at `path`. Never throws: every
216
+ * failure — an unreadable file, invalid JSON, or a schema violation — is
217
+ * recorded into `issues` and reflected in `.complete`. Mirrors
218
+ * `registry.ts`'s `readCopyRecord` exactly, including the discipline it
219
+ * documents: an unreadable/invalid registry is "could not run" (fed into
220
+ * exit `2` by the CLI), never a clean pass produced from a record this
221
+ * function could not actually trust.
222
+ */
223
+ export declare function readPassageRecord(path: string): PassageRegistryReadResult;
224
+ export type PassageFieldClassification = "entry-reference" | "term-reference" | "inline-literal" | "passage-internals-reference" | "unclassifiable";
225
+ interface PassageFieldClassificationResult {
226
+ classification: PassageFieldClassification;
227
+ detail: string;
228
+ }
229
+ /**
230
+ * Classifies one `Passage` field's raw value into exactly one of the five
231
+ * `PassageFieldClassification` outcomes. Pure — no I/O, never throws on
232
+ * any input shape.
233
+ *
234
+ * - A plain string is ALWAYS `"inline-literal"` — real prose (or
235
+ * anything else) sitting directly in the field instead of a
236
+ * reference. This is the shape the adversarial proof's separating
237
+ * fixture is built from — see this file's top doc comment.
238
+ * - `{ ref: "entry", id: <non-empty string> }` is `"entry-reference"`.
239
+ * - `{ ref: "term", term: <non-empty string> }` is `"term-reference"`.
240
+ * - `{ ref: "passage", ... }` — REGARDLESS of what else it carries — is
241
+ * always `"passage-internals-reference"`: a passage may compose
242
+ * entries and terms, never reach directly into another passage's own
243
+ * fields. This is a VIOLATION, not something this function treats as
244
+ * merely unclassifiable, because the shape is unambiguous the moment
245
+ * `ref === "passage"` is seen.
246
+ * - `{ ref: "entry" | "term", ... }` with a missing/malformed
247
+ * `id`/`term` is `"unclassifiable"` — the AUTHOR'S intent (compose an
248
+ * entry or a term) is legible, but the reference itself is broken, so
249
+ * this function refuses to guess which finding shape to promote it
250
+ * to rather than silently treating a broken reference as either
251
+ * "fine" or "definitely a literal."
252
+ * - Anything else (a number, boolean, null, array, or an object with no
253
+ * recognized `ref`) is `"unclassifiable"`.
254
+ */
255
+ export declare function classifyPassageField(value: unknown): PassageFieldClassificationResult;
256
+ export type PassageViolationRule = "field-inlines-literal" | "field-references-passage-internals";
257
+ export interface PassageViolation {
258
+ passageId: PassageId;
259
+ field: string;
260
+ rule: PassageViolationRule;
261
+ message: string;
262
+ }
263
+ export interface PassageUnclassifiedItem {
264
+ passageId: PassageId;
265
+ field: string;
266
+ detail: string;
267
+ }
268
+ export type PassageVerdict = "satisfied" | "violated" | "indeterminate";
269
+ export interface PassageGateResult {
270
+ verdict: PassageVerdict;
271
+ violations: PassageViolation[];
272
+ /** Every field this gate could not confidently classify — never silently dropped. See `classifyPassageField`'s own doc comment. */
273
+ unclassified: PassageUnclassifiedItem[];
274
+ /** How many passages had at least one field examined. Required to be > 0 for a satisfied verdict — see this file's top doc comment, "THE GATE". */
275
+ passagesEvaluated: number;
276
+ /** Human-readable reasons coverage is incomplete — empty for `"satisfied"`. Non-empty for `"violated"` too is possible (a real violation AND unclassified fields in the same run) — only `"indeterminate"` requires this to be non-empty. */
277
+ reasons: string[];
278
+ }
279
+ /**
280
+ * Pure — takes an already-parsed `PassageRecord` (see `readPassageRecord`/
281
+ * `parsePassageRecord`), classifies every field of every passage, and
282
+ * decides the ternary verdict. Never throws, does no I/O.
283
+ *
284
+ * PRECEDENCE: a real violation wins over an incomplete picture — see this
285
+ * file's top doc comment, "THE TERNARY", for why this mirrors
286
+ * `checkAddressability`'s own post-#407 ordering rather than the older
287
+ * "indeterminate wins" precedence `checkCopyTraceability`/`scan.ts` still
288
+ * use for a different reason (see `checkAddressability`'s own doc comment
289
+ * for the fuller argument against letting a permanent-in-practice
290
+ * coverage gap make a real violation unreachable).
291
+ */
292
+ export declare function checkPassageComposition(record: PassageRecord): PassageGateResult;
293
+ export {};
294
+ //# sourceMappingURL=passage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passage.d.ts","sourceRoot":"","sources":["../src/passage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AAQH;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,OAAO,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,+GAA+G;AAC/G,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,iEAAiE;AACjE,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,oBAAoB,CAAC;AAE5E;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,yFAAyF;IACzF,EAAE,EAA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