@ttsc/evidence 0.30.3 → 0.31.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 (66) hide show
  1. package/README.md +14 -6
  2. package/lib/index.d.ts +2 -3
  3. package/lib/index.js +2 -3
  4. package/lib/internal/canonicalDigest.js +12 -6
  5. package/lib/internal/loadPrismaModels.js +52 -7
  6. package/lib/internal/loadSwaggerOperations.js +253 -59
  7. package/lib/internal/normalizeSwaggerDocument.js +320 -2
  8. package/lib/structures/ITtscEvidenceDocumentedConfig.d.ts +16 -8
  9. package/lib/structures/ITtscEvidenceGraphClaim.d.ts +6 -0
  10. package/lib/structures/ITtscEvidenceGraphClaimBase.d.ts +8 -2
  11. package/lib/structures/ITtscEvidenceGraphConfig.d.ts +6 -0
  12. package/lib/structures/ITtscEvidenceGraphMarkdownClaim.d.ts +7 -1
  13. package/lib/structures/ITtscEvidenceGraphMarkdownReference.d.ts +7 -1
  14. package/lib/structures/ITtscEvidenceGraphPrismaClaim.d.ts +7 -1
  15. package/lib/structures/ITtscEvidenceGraphPrismaReference.d.ts +7 -1
  16. package/lib/structures/ITtscEvidenceGraphReference.d.ts +10 -4
  17. package/lib/structures/ITtscEvidenceGraphReferenceBase.d.ts +6 -0
  18. package/lib/structures/ITtscEvidenceGraphSwaggerReference.d.ts +6 -0
  19. package/lib/structures/ITtscEvidenceGraphTypeScriptClaim.d.ts +7 -1
  20. package/lib/structures/ITtscEvidenceGraphTypeScriptReference.d.ts +11 -3
  21. package/lib/structures/ITtscEvidenceRules.d.ts +93 -0
  22. package/lib/structures/TtscEvidenceGraphMarkdownSymbol.d.ts +39 -0
  23. package/lib/{typings → structures}/TtscEvidenceGraphPrismaSymbol.d.ts +6 -0
  24. package/lib/{typings → structures}/TtscEvidenceGraphTypeScriptSymbol.d.ts +6 -0
  25. package/lib/structures/index.d.ts +4 -0
  26. package/lib/structures/index.js +4 -0
  27. package/native/base.go +25 -23
  28. package/native/bridge_trace.go +348 -0
  29. package/native/comments.go +1 -1
  30. package/native/config.go +6 -3
  31. package/native/declaration.go +17 -43
  32. package/native/documentation_regions.go +214 -0
  33. package/native/documented.go +5 -4
  34. package/native/exports.go +1 -1
  35. package/native/fingerprint.go +2 -8
  36. package/native/glob.go +4 -1
  37. package/native/graph.go +59 -23
  38. package/native/graph_nodes.go +2 -1
  39. package/native/hints.go +22 -18
  40. package/native/imports.go +7 -6
  41. package/native/input_reader.go +83 -0
  42. package/native/inputs.go +13 -12
  43. package/native/loader.go +36 -24
  44. package/native/markdown.go +587 -177
  45. package/native/markdown_capture.go +223 -0
  46. package/native/model.go +2 -1
  47. package/native/prisma.go +110 -25
  48. package/native/prisma_cache.go +12 -8
  49. package/native/prisma_locator.go +70 -33
  50. package/native/review.go +8 -7
  51. package/native/rooted_typescript.go +3 -4
  52. package/native/swagger.go +123 -15
  53. package/native/swagger_cache.go +16 -12
  54. package/native/todo.go +12 -0
  55. package/native/typescript.go +129 -25
  56. package/package.json +9 -7
  57. package/lib/typings/ITtscLintContributorRules.d.ts +0 -57
  58. package/lib/typings/ITtscLintRuleOptionsMap.d.ts +0 -20
  59. package/lib/typings/ITtscLintRuleOptionsMap.js +0 -2
  60. package/lib/typings/TtscEvidenceGraphMarkdownSymbol.d.ts +0 -32
  61. package/lib/typings/index.d.ts +0 -5
  62. package/lib/typings/index.js +0 -21
  63. /package/lib/{typings/ITtscLintContributorRules.js → structures/ITtscEvidenceRules.js} +0 -0
  64. /package/lib/{typings → structures}/TtscEvidenceGraphMarkdownSymbol.js +0 -0
  65. /package/lib/{typings → structures}/TtscEvidenceGraphPrismaSymbol.js +0 -0
  66. /package/lib/{typings → structures}/TtscEvidenceGraphTypeScriptSymbol.js +0 -0
@@ -2,6 +2,324 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeSwaggerDocument = void 0;
4
4
  const utils_1 = require("@typia/utils");
5
- /** @internal */
6
- const normalizeSwaggerDocument = (input) => utils_1.OpenApiConverter.upgradeDocument(input);
5
+ /**
6
+ * Normalizes schema targets without letting a version converter rebase their
7
+ * references to an unrelated component with the same final token.
8
+ *
9
+ * Raw 3.1 and 3.2 schema references are lowered to private component names
10
+ * before conversion. Each selected raw target is converted as a schema in its
11
+ * own right, so a pointer into a tuple still selects that schema when the
12
+ * converter changes `items` to `prefixItems`. The names stay inside this call;
13
+ * the digest reader receives the original reference and pointer identity.
14
+ * Missing and foreign references have no private target and cannot accidentally
15
+ * bind to a local component. This does not fetch referenced documents.
16
+ *
17
+ * Only schema positions are rewritten. Example, default, const, enum and
18
+ * extension payloads are copied without interpreting their data as schemas.
19
+ * Existing emended documents and other versions keep the ordinary conversion
20
+ * path. The supplied reader is the bridge's own strict component URI reader,
21
+ * shared with its post-conversion digest resolution.
22
+ *
23
+ * Copies, alias targets and provenance are retained for one source conversion
24
+ * and its operation digests, not in a process-wide cache. Reference proxies
25
+ * share targets by decoded pointer. Nested targets are copied and converted
26
+ * separately from the containing schema because their normalized locations can
27
+ * differ; literal copies preserve each data occurrence. These costs, and
28
+ * recursion depth, are not bounded by the reader's raw-byte limit. Weak
29
+ * identity maps terminate copy/visitor cycles; they do not impose a total
30
+ * memory quota or change the converter's own treatment of cyclic schemas.
31
+ *
32
+ * @internal
33
+ */
34
+ const normalizeSwaggerDocument = (input, componentAt) => {
35
+ const references = new Map();
36
+ let prepared = input;
37
+ if (input !== null &&
38
+ typeof input === "object" &&
39
+ typeof input.openapi === "string" &&
40
+ (input.openapi.startsWith("3.1") || input.openapi.startsWith("3.2")) &&
41
+ !(input.openapi.startsWith("3.2") && input["x-typia-emended-v12"] === true)) {
42
+ const writtenPointers = new Set();
43
+ const copy = (value, copies = new WeakMap()) => {
44
+ if (value === null || typeof value !== "object") {
45
+ if (typeof value === "string" && value.startsWith("#"))
46
+ try {
47
+ writtenPointers.add(decodeURIComponent(value.slice(1)));
48
+ }
49
+ catch {
50
+ // A malformed spelling cannot name a generated alias.
51
+ }
52
+ return value;
53
+ }
54
+ const previous = copies.get(value);
55
+ if (previous !== undefined)
56
+ return previous;
57
+ const result = Array.isArray(value) ? [] : {};
58
+ copies.set(value, result);
59
+ for (const [key, child] of Object.entries(value))
60
+ Object.defineProperty(result, key, {
61
+ value: copy(child, copies),
62
+ writable: true,
63
+ enumerable: true,
64
+ configurable: true,
65
+ });
66
+ return result;
67
+ };
68
+ prepared = copy(input);
69
+ // YAML anchors can share one object between a schema and literal data.
70
+ // Detach every data holder before any reference is rewritten.
71
+ const detachLiterals = swaggerSchemaVisitor(() => { }, (value, holder, key) => {
72
+ if (Object.hasOwn(holder, key))
73
+ holder[key] = copy(value);
74
+ });
75
+ detachLiterals.document(prepared);
76
+ const components = (prepared.components ??= {});
77
+ const schemas = (components.schemas ??= {});
78
+ const targets = new Map();
79
+ const convertedTargets = new Map();
80
+ let sequence = 0;
81
+ const reference = (spelling) => {
82
+ // Keep each spelling for the literal left at a recursive boundary. Its
83
+ // decoded pointer, rather than this private name, identifies the guard.
84
+ const known = targets.get(spelling);
85
+ if (known !== undefined)
86
+ return known;
87
+ const target = componentAt(input.components ?? {}, spelling);
88
+ let key;
89
+ do
90
+ key = `_ttsc_schema_reference_${sequence++}`;
91
+ while (Object.hasOwn(schemas, key) ||
92
+ writtenPointers.has(`/components/schemas/${key}`));
93
+ const alias = `#/components/schemas/${key}`;
94
+ targets.set(spelling, alias);
95
+ const preserved = { reference: spelling, pointer: target?.pointer, key };
96
+ references.set(alias, preserved);
97
+ // Reserve the alias before walking its target: mutual and self references
98
+ // become finite edges, rather than recursively expanded object copies.
99
+ if (target !== undefined) {
100
+ let targetKey = convertedTargets.get(target.pointer);
101
+ if (targetKey === undefined) {
102
+ const prefix = "/components/schemas/";
103
+ const token = target.pointer.startsWith(prefix)
104
+ ? target.pointer.slice(prefix.length)
105
+ : undefined;
106
+ const originalKey = token !== undefined && !token.includes("/")
107
+ ? token.replaceAll("~1", "/").replaceAll("~0", "~")
108
+ : undefined;
109
+ targetKey =
110
+ originalKey !== undefined && Object.hasOwn(schemas, originalKey)
111
+ ? originalKey
112
+ : key;
113
+ convertedTargets.set(target.pointer, targetKey);
114
+ if (targetKey === key) {
115
+ Object.defineProperty(schemas, key, {
116
+ value: copy(target.value),
117
+ writable: true,
118
+ enumerable: true,
119
+ configurable: true,
120
+ });
121
+ detachLiterals.schema(schemas[key]);
122
+ }
123
+ }
124
+ preserved.key = targetKey;
125
+ if (targetKey !== key)
126
+ Object.defineProperty(schemas, key, {
127
+ value: {
128
+ $ref: `#/components/schemas/${encodeURIComponent(targetKey.replaceAll("~", "~0").replaceAll("/", "~1"))}`,
129
+ },
130
+ writable: true,
131
+ enumerable: true,
132
+ configurable: true,
133
+ });
134
+ // Different spellings use small reference proxies. Their equivalent
135
+ // target is copied and normalized once under this pointer identity.
136
+ walk.schema(schemas[targetKey]);
137
+ }
138
+ return alias;
139
+ };
140
+ const walk = swaggerSchemaVisitor((value) => {
141
+ for (const key of ["$ref", "$recursiveRef"])
142
+ if (typeof value[key] === "string")
143
+ value[key] = reference(value[key]);
144
+ }, () => { });
145
+ // Snapshot the author-written schemas. The reference walker visits each
146
+ // newly added alias itself, so additions never invalidate this iteration.
147
+ walk.document(prepared);
148
+ }
149
+ const document = utils_1.OpenApiConverter.upgradeDocument(prepared);
150
+ const literals = new WeakMap();
151
+ swaggerSchemaVisitor(() => { }, (_value, holder, key) => {
152
+ if (!Object.hasOwn(holder, key))
153
+ return;
154
+ let keys = literals.get(holder);
155
+ if (keys === undefined) {
156
+ keys = new Set();
157
+ literals.set(holder, keys);
158
+ }
159
+ keys.add(key);
160
+ }).document(document);
161
+ return {
162
+ document,
163
+ isLiteral: (holder, key) => literals.get(holder)?.has(key) === true,
164
+ referenceAt: (reference) => {
165
+ const preserved = references.get(reference);
166
+ if (preserved === undefined)
167
+ return {
168
+ reference,
169
+ target: componentAt((document.components ?? {}), reference),
170
+ };
171
+ const schemas = document.components?.schemas;
172
+ return {
173
+ reference: preserved.reference,
174
+ target: preserved.pointer !== undefined &&
175
+ schemas !== undefined &&
176
+ Object.hasOwn(schemas, preserved.key) &&
177
+ schemas[preserved.key] !== undefined
178
+ ? { pointer: preserved.pointer, value: schemas[preserved.key] }
179
+ : undefined,
180
+ };
181
+ },
182
+ };
183
+ };
7
184
  exports.normalizeSwaggerDocument = normalizeSwaggerDocument;
185
+ /**
186
+ * Visits schema holders once per object and reports literal holder slots.
187
+ *
188
+ * Literalness belongs to a position: one YAML object can also be a schema at
189
+ * another position. Retaining holder/key pairs preserves that distinction. This
190
+ * visitor does not rewrite data, expand references or load documents; its
191
+ * callbacks own those operations and each walk owns its identity sets.
192
+ */
193
+ const swaggerSchemaVisitor = (visitSchema, visitLiteral) => {
194
+ const visited = new WeakSet();
195
+ const extensions = (value, hasAdditionalOperations = false) => {
196
+ for (const [key, child] of Object.entries(value))
197
+ if (key.startsWith("x-") &&
198
+ !(hasAdditionalOperations && key === "x-additionalOperations"))
199
+ visitLiteral(child, value, key);
200
+ };
201
+ const schema = (value) => {
202
+ if (value === null || typeof value !== "object" || visited.has(value))
203
+ return;
204
+ visited.add(value);
205
+ visitSchema(value);
206
+ for (const key of ["example", "examples", "default", "const", "enum"])
207
+ visitLiteral(value[key], value, key);
208
+ extensions(value);
209
+ for (const key of [
210
+ "properties",
211
+ "patternProperties",
212
+ "$defs",
213
+ "definitions",
214
+ ])
215
+ for (const child of Object.values(value[key] ?? {}))
216
+ schema(child);
217
+ for (const key of ["oneOf", "anyOf", "allOf", "prefixItems"])
218
+ if (Array.isArray(value[key]))
219
+ value[key].forEach(schema);
220
+ for (const key of [
221
+ "items",
222
+ "additionalItems",
223
+ "additionalProperties",
224
+ "not",
225
+ "contains",
226
+ "if",
227
+ "then",
228
+ "else",
229
+ "propertyNames",
230
+ ])
231
+ if (Array.isArray(value[key]))
232
+ value[key].forEach(schema);
233
+ else
234
+ schema(value[key]);
235
+ for (const child of Object.values(value.dependentSchemas ?? {}))
236
+ schema(child);
237
+ };
238
+ const examples = (value) => {
239
+ for (const example of Object.values(value ?? {})) {
240
+ if (example === null || typeof example !== "object")
241
+ continue;
242
+ visitLiteral(example.value, example, "value");
243
+ extensions(example);
244
+ }
245
+ };
246
+ const parameter = (value) => {
247
+ if (value === null || typeof value !== "object")
248
+ return;
249
+ schema(value.schema);
250
+ content(value.content);
251
+ visitLiteral(value.example, value, "example");
252
+ examples(value.examples);
253
+ extensions(value);
254
+ };
255
+ const content = (value) => {
256
+ for (const media of Object.values(value ?? {})) {
257
+ if (media === null || typeof media !== "object")
258
+ continue;
259
+ schema(media.schema);
260
+ schema(media.itemSchema);
261
+ visitLiteral(media.example, media, "example");
262
+ examples(media.examples);
263
+ extensions(media);
264
+ }
265
+ };
266
+ const body = (value) => {
267
+ if (value === null || typeof value !== "object")
268
+ return;
269
+ content(value.content);
270
+ for (const header of Object.values(value.headers ?? {}))
271
+ parameter(header);
272
+ extensions(value);
273
+ };
274
+ const paths = new WeakSet();
275
+ const pathItem = (value) => {
276
+ if (value === null || typeof value !== "object" || paths.has(value))
277
+ return;
278
+ paths.add(value);
279
+ extensions(value, true);
280
+ if (Array.isArray(value.parameters))
281
+ value.parameters.forEach(parameter);
282
+ const operations = [
283
+ ...[
284
+ "get",
285
+ "put",
286
+ "post",
287
+ "delete",
288
+ "options",
289
+ "head",
290
+ "patch",
291
+ "trace",
292
+ "query",
293
+ ].map((key) => value[key]),
294
+ ...Object.values(value.additionalOperations ?? {}),
295
+ ...Object.values(value["x-additionalOperations"] ?? {}),
296
+ ];
297
+ for (const operation of operations) {
298
+ if (operation === null || typeof operation !== "object")
299
+ continue;
300
+ if (Array.isArray(operation.parameters))
301
+ operation.parameters.forEach(parameter);
302
+ body(operation.requestBody);
303
+ for (const response of Object.values(operation.responses ?? {}))
304
+ body(response);
305
+ for (const callback of Object.values(operation.callbacks ?? {}))
306
+ for (const child of Object.values(callback ?? {}))
307
+ pathItem(child);
308
+ extensions(operation);
309
+ }
310
+ };
311
+ return {
312
+ schema,
313
+ document: (value) => {
314
+ const components = value.components ?? {};
315
+ Object.values(components.schemas ?? {}).forEach(schema);
316
+ for (const key of ["parameters", "headers"])
317
+ Object.values(components[key] ?? {}).forEach(parameter);
318
+ for (const key of ["requestBodies", "responses"])
319
+ Object.values(components[key] ?? {}).forEach(body);
320
+ examples(components.examples);
321
+ for (const group of [value.paths, value.webhooks, components.pathItems])
322
+ Object.values(group ?? {}).forEach(pathItem);
323
+ },
324
+ };
325
+ };
@@ -1,16 +1,24 @@
1
- import type { TtscEvidenceGraphTypeScriptSymbol } from "../typings/TtscEvidenceGraphTypeScriptSymbol";
1
+ import type { TtscEvidenceGraphTypeScriptSymbol } from "./TtscEvidenceGraphTypeScriptSymbol";
2
2
  /**
3
3
  * Options of the `evidence/documented` rule.
4
4
  *
5
5
  * The rule requires a JSDoc block on every selected export, because a JSDoc
6
- * block is the only place an `@evidence` tag is ever read from. A symbol
7
- * without one cannot cite anything: the citation has no location to live in,
8
- * and the graph's obligation silently shifts onto whichever sibling does have a
9
- * block.
6
+ * block is the only place a TypeScript declaration's `@evidence` tag is ever
7
+ * read from. A symbol without one cannot cite anything: the citation has no
8
+ * location to live in. Ordinary coverage can still be satisfied by another
9
+ * host, while a checklist keeps that undocumented host's own obligations
10
+ * outstanding.
10
11
  *
11
- * Presence is the whole check. The rule never judges what the prose says, how
12
- * long it is, or whether it is sincere — a rule that tried would only teach
13
- * authors to write filler that satisfies it.
12
+ * A block with any text passes, and an empty block is reported like a missing
13
+ * one with its own message. Beyond that the rule never judges what the prose
14
+ * says, how long it is, or whether it is sincere, because a rule that tried
15
+ * would only teach authors to write filler that satisfies it.
16
+ *
17
+ * @evidence contracts/common.md#principled-implementation The optional single-or-array symbol selector represents the same supported declaration kinds used by graph hosts; absence delegates to the documented rule's widest default.
18
+ * @evidence contracts/common.md#clear-and-simple-design This rule has one selection option and reuses the shared symbol union rather than maintaining another vocabulary.
19
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Selection is by declaration kind, with no consumer exceptions or prose-length trick presented as documentation quality.
20
+ * @evidence contracts/common.md#meaningful-documentation The comment states that a block with text is the entire mechanical check, with an empty block reported separately, and explains the selector's default and cardinality separately from the acknowledgment tags.
21
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This type describes rule options and names no path, file, filesystem or process.
14
22
  */
15
23
  export interface ITtscEvidenceDocumentedConfig {
16
24
  /**
@@ -10,5 +10,11 @@ import type { ITtscEvidenceGraphTypeScriptClaim } from "./ITtscEvidenceGraphType
10
10
  * be acknowledged completely. Separate claims remain separate obligations,
11
11
  * preventing two teams' partial use of the same evidence from being reported as
12
12
  * one complete use.
13
+ *
14
+ * @evidence contracts/common.md#principled-implementation The discriminated union includes exactly the three artifact kinds that can host acknowledgments; Swagger operations remain reference-only.
15
+ * @evidence contracts/common.md#clear-and-simple-design Each artifact-specific interface owns its selector while the common base owns outgoing coverage, so callers narrow one type discriminator.
16
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The alternatives describe supported artifact semantics and contain no consumer-specific variant or test-only escape.
17
+ * @evidence contracts/common.md#meaningful-documentation The JSDoc explains the outgoing relationship and independent obligations rather than repeating the union members, with prose separated from tags.
18
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This union only selects among the artifact claim shapes and names no path, file, filesystem or process itself.
13
19
  */
14
20
  export type ITtscEvidenceGraphClaim = ITtscEvidenceGraphMarkdownClaim | ITtscEvidenceGraphPrismaClaim | ITtscEvidenceGraphTypeScriptClaim;
@@ -10,8 +10,14 @@ import type { ITtscEvidenceGraphReference } from "./ITtscEvidenceGraphReference"
10
10
  * kinds are a property of the language rather than of the claim.
11
11
  *
12
12
  * Swagger is deliberately absent. An API operation grounds a claim but cannot
13
- * host `@evidence`, so it extends {@link ITtscEvidenceGraphReferenceBase}
14
- * instead and never this one.
13
+ * host `@evidence`, so it belongs to {@link ITtscEvidenceGraphReference} instead
14
+ * and never this one.
15
+ *
16
+ * @evidence contracts/common.md#principled-implementation The generic artifact discriminator preserves each derived claim's kind while shared fields express population ownership, diagnostic inheritance and independently complete references.
17
+ * @evidence contracts/common.md#clear-and-simple-design Fields common to all claiming artifacts have one owner here; each derived interface supplies only its artifact-specific selection semantics.
18
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Disabled claims and exclusion carriers are explicit supported configuration mechanisms, not hidden consumer-specific coverage substitutions.
19
+ * @evidence contracts/common.md#meaningful-documentation Member comments explain defaults, glob ordering, root identity and exclusion restrictions with blank lines between documented members and before the tags.
20
+ * @evidence contracts/portability.md#os-neutral-implementation Root and file patterns describe a native filesystem boundary with stable absolute or project-relative roots, portable glob separators and explicit rejection of Windows drive-relative paths; identity case sensitivity is a graph policy, not an inferred filesystem capability.
15
21
  */
16
22
  export interface ITtscEvidenceGraphClaimBase<Type extends string> {
17
23
  /** Identifies the artifact kind making this claim. */
@@ -7,6 +7,12 @@ import type { ITtscEvidenceGraphClaim } from "./ITtscEvidenceGraphClaim";
7
7
  * evidence it must cite with a reason. The configuration defines those
8
8
  * boundaries without hardcoding a repository's folder layout or its notion of
9
9
  * proof.
10
+ *
11
+ * @evidence contracts/common.md#principled-implementation A graph is represented by independent claims, each carrying its own references, so the type preserves the boundary at which coverage is evaluated.
12
+ * @evidence contracts/common.md#clear-and-simple-design The root holds only the claim collection; population and policy decisions stay in claim and reference types.
13
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No repository-specific path, expected coverage result or bypass flag is embedded in this root representation.
14
+ * @evidence contracts/common.md#meaningful-documentation The root and claims comments explain relationship direction, independent coverage and the nonempty-array runtime requirement that TypeScript's array type cannot enforce.
15
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This type holds a list of claims and names no path, file, filesystem or process itself.
10
16
  */
11
17
  export interface ITtscEvidenceGraphConfig {
12
18
  /**
@@ -1,5 +1,5 @@
1
- import type { TtscEvidenceGraphMarkdownSymbol } from "../typings/TtscEvidenceGraphMarkdownSymbol";
2
1
  import type { ITtscEvidenceGraphClaimBase } from "./ITtscEvidenceGraphClaimBase";
2
+ import type { TtscEvidenceGraphMarkdownSymbol } from "./TtscEvidenceGraphMarkdownSymbol";
3
3
  /**
4
4
  * A population of Markdown documents claiming its referenced evidence.
5
5
  *
@@ -15,6 +15,12 @@ import type { ITtscEvidenceGraphClaimBase } from "./ITtscEvidenceGraphClaimBase"
15
15
  *
16
16
  * @example
17
17
  * <!-- @evidence docs/orders.md#create-order This section adopts the creation contract. -->
18
+ *
19
+ * @evidence contracts/common.md#principled-implementation The Markdown discriminator and outline-kind selector express which parsed document scopes can make claims while coverage policy remains on their references.
20
+ * @evidence contracts/common.md#clear-and-simple-design Only Markdown files and host kinds are specialized; the shared base remains responsible for roots, diagnostics and outgoing references.
21
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The type selects outline kinds rather than hardcoding document names or accepting a fixture-specific acknowledgment path.
22
+ * @evidence contracts/common.md#meaningful-documentation The comment describes where Markdown acknowledgments live and the member comments state file parsing and selector defaults, separated from these tags.
23
+ * @evidence contracts/portability.md#os-neutral-implementation The inherited stable root and ordered glob paths select a native document population independently of outline targets; separators are portable and identity remains the explicit graph policy rather than a guess from the OS name.
18
24
  */
19
25
  export interface ITtscEvidenceGraphMarkdownClaim extends ITtscEvidenceGraphClaimBase<"markdown"> {
20
26
  /**
@@ -1,5 +1,5 @@
1
- import type { TtscEvidenceGraphMarkdownSymbol } from "../typings/TtscEvidenceGraphMarkdownSymbol";
2
1
  import type { ITtscEvidenceGraphReferenceBase } from "./ITtscEvidenceGraphReferenceBase";
2
+ import type { TtscEvidenceGraphMarkdownSymbol } from "./TtscEvidenceGraphMarkdownSymbol";
3
3
  /**
4
4
  * A population of documentary evidence that the owning claim must cite.
5
5
  *
@@ -8,6 +8,12 @@ import type { ITtscEvidenceGraphReferenceBase } from "./ITtscEvidenceGraphRefere
8
8
  * while allowing one file or heading target to acknowledge its selected
9
9
  * descendants. Citations remain anchored in the outline, so an editorial change
10
10
  * cannot silently preserve a claim whose grounds disappeared.
11
+ *
12
+ * @evidence contracts/common.md#principled-implementation The Markdown discriminator and heading selector describe outline evidence; the checklist flag adds a per-host obligation rather than changing how a heading target is identified.
13
+ * @evidence contracts/common.md#clear-and-simple-design Markdown population and checklist details stay together while ordinary reference policies remain inherited from the shared base.
14
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Checklist mode explicitly rejects aggregate positive citations and incompatible cardinality policies instead of allowing one answer to impersonate every item's answer.
15
+ * @evidence contracts/common.md#meaningful-documentation Separate property paragraphs explain rooted addresses, ordered glob selection, checklist denominator, exclusion behavior and policy incompatibilities without relying on these tags as instructions.
16
+ * @evidence contracts/portability.md#os-neutral-implementation Root describes a stable native directory including links and junctions, while evidence addresses use root-relative protocol spelling; drive-relative paths are refused and graph identity does not guess host filesystem case rules.
11
17
  */
12
18
  export interface ITtscEvidenceGraphMarkdownReference extends ITtscEvidenceGraphReferenceBase<"markdown"> {
13
19
  /**
@@ -1,5 +1,5 @@
1
- import type { TtscEvidenceGraphPrismaSymbol } from "../typings/TtscEvidenceGraphPrismaSymbol";
2
1
  import type { ITtscEvidenceGraphClaimBase } from "./ITtscEvidenceGraphClaimBase";
2
+ import type { TtscEvidenceGraphPrismaSymbol } from "./TtscEvidenceGraphPrismaSymbol";
3
3
  /**
4
4
  * A Prisma schema claiming its referenced evidence.
5
5
  *
@@ -38,6 +38,12 @@ import type { ITtscEvidenceGraphClaimBase } from "./ITtscEvidenceGraphClaimBase"
38
38
  * coupon_limit Int
39
39
  * }
40
40
  * ```
41
+ *
42
+ * @evidence contracts/common.md#principled-implementation The Prisma discriminator and semantic model/column/relation selector match parser-classified schema units, including file-level exclusion carriers that deliberately have no model identity.
43
+ * @evidence contracts/common.md#clear-and-simple-design Prisma specializes only schema-file interpretation and host kinds while the common base carries root and outgoing coverage policy.
44
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Eligibility is based on actual schema documentation syntax; ignored double-slash annotations do not silently become evidence and no consumer model is singled out.
45
+ * @evidence contracts/common.md#meaningful-documentation The declaration documents comment attachment, file-level exclusions and native Prisma examples; field comments explain schema composition and selector defaults.
46
+ * @evidence contracts/portability.md#os-neutral-implementation Schema files resolve through the inherited stable native root while prisma model identities remain path-free; linked aliases join one schema without using OS names to infer file case or capability.
41
47
  */
42
48
  export interface ITtscEvidenceGraphPrismaClaim extends ITtscEvidenceGraphClaimBase<"prisma"> {
43
49
  /**
@@ -1,5 +1,5 @@
1
- import type { TtscEvidenceGraphPrismaSymbol } from "../typings/TtscEvidenceGraphPrismaSymbol";
2
1
  import type { ITtscEvidenceGraphReferenceBase } from "./ITtscEvidenceGraphReferenceBase";
2
+ import type { TtscEvidenceGraphPrismaSymbol } from "./TtscEvidenceGraphPrismaSymbol";
3
3
  /**
4
4
  * A population of Prisma schema declarations that the owning claim must cite.
5
5
  *
@@ -12,6 +12,12 @@ import type { ITtscEvidenceGraphReferenceBase } from "./ITtscEvidenceGraphRefere
12
12
  * folder is a single namespace whose files reference each other. The parse is
13
13
  * Prisma's own, so a schema it rejects is reported as a parse failure rather
14
14
  * than as an empty population.
15
+ *
16
+ * @evidence contracts/common.md#principled-implementation This representation selects models and parser-classified members from one composed schema, preserving Prisma's cross-file namespace rather than treating each file as an independent schema.
17
+ * @evidence contracts/common.md#clear-and-simple-design Root, files and symbol choices define the Prisma population while shared acknowledgment policies stay in the base reference.
18
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Parsing failures remain failures rather than an empty-success substitute, and model-only default selection is an explicit general contract rather than a consumer exception.
19
+ * @evidence contracts/common.md#meaningful-documentation Member prose explains schema-set identity, root effects, default model granularity and aggregate member coverage with separated documentation blocks.
20
+ * @evidence contracts/portability.md#os-neutral-implementation Root selects a native schema directory independently of path-free prisma targets; stable relative or absolute paths and linked directories are supported while drive-relative Windows paths are explicitly invalid.
15
21
  */
16
22
  export interface ITtscEvidenceGraphPrismaReference extends ITtscEvidenceGraphReferenceBase<"prisma"> {
17
23
  /**
@@ -6,9 +6,15 @@ import type { ITtscEvidenceGraphTypeScriptReference } from "./ITtscEvidenceGraph
6
6
  * One population of evidence units that a claim must cite completely.
7
7
  *
8
8
  * A reference selects what counts as evidence: Markdown documents and heading
9
- * sections, Swagger or OpenAPI operations, or selected exported TypeScript
10
- * symbols. Every unit it materializes must be acknowledged by the owning claim,
11
- * so a reference is the denominator of one coverage obligation, never a pooled
12
- * global set.
9
+ * sections, Prisma schema declarations, Swagger or OpenAPI operations, or
10
+ * selected exported TypeScript symbols. Every unit it materializes must be
11
+ * acknowledged by the owning claim, so a reference is the denominator of one
12
+ * coverage obligation, never a pooled global set.
13
+ *
14
+ * @evidence contracts/common.md#principled-implementation The union permits each supported evidence artifact, including reference-only Swagger operations, and retains each kind's population contract.
15
+ * @evidence contracts/common.md#clear-and-simple-design Artifact-specific interfaces share one policy base, keeping selection details with their parser rather than introducing a second configuration hierarchy.
16
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The closed alternatives reflect supported loaders rather than consumer names or fixture-specific bypasses.
17
+ * @evidence contracts/common.md#meaningful-documentation The native comment explains reference ownership and the coverage denominator; member-specific selection details remain in their respective declarations.
18
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This union only selects among the artifact reference shapes and names no path, file, filesystem or process itself.
13
19
  */
14
20
  export type ITtscEvidenceGraphReference = ITtscEvidenceGraphMarkdownReference | ITtscEvidenceGraphPrismaReference | ITtscEvidenceGraphSwaggerReference | ITtscEvidenceGraphTypeScriptReference;
@@ -22,6 +22,12 @@ import type { TtscLintSeverity } from "@ttsc/lint";
22
22
  * these. They tighten a count inside the per-reference obligation; that one
23
23
  * gives the obligation a host dimension, and it is documented on the Markdown
24
24
  * reference because no other artifact kind is read item by item.
25
+ *
26
+ * @evidence contracts/common.md#principled-implementation Optional policy fields independently constrain one reference relation, preserving inherited severity and permissive zero-value semantics without pooling sibling obligations.
27
+ * @evidence contracts/common.md#clear-and-simple-design One generic base owns shared acknowledgment policies while artifact-specific references own their populations and Markdown alone owns checklist semantics.
28
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts These explicit policies constrain real graph relations; requireReview documents its limited assurance instead of claiming a fingerprint proves review sincerity.
29
+ * @evidence contracts/common.md#meaningful-documentation Property comments explain counting identities, aggregate scopes, expiry and the limitations of review fingerprints; separate paragraphs and member gaps keep distinct requirements readable.
30
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation These shared fields are policies and selectors over evidence units and name no path, file, filesystem or process.
25
31
  */
26
32
  export interface ITtscEvidenceGraphReferenceBase<Type extends string> {
27
33
  /** Identifies the artifact kind this population materializes. */
@@ -7,6 +7,12 @@ import type { ITtscEvidenceGraphReferenceBase } from "./ITtscEvidenceGraphRefere
7
7
  * TypeScript or Markdown claim, but a Swagger document cannot host `@evidence`
8
8
  * declarations. Every operation under the normalized document's `paths` object
9
9
  * becomes one independent evidence unit.
10
+ *
11
+ * @evidence contracts/common.md#principled-implementation A Swagger reference identifies one normalized API document and inherits reference policies; absence of a Swagger claim counterpart reflects that operations cannot host acknowledgments.
12
+ * @evidence contracts/common.md#clear-and-simple-design One exact source location is sufficient because document format normalization and operation indexing belong to the loader, not to extra configuration layers.
13
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts An unavailable remote source fails its obligation rather than silently removing API operations from the expected population.
14
+ * @evidence contracts/common.md#meaningful-documentation The source comment explains accepted local and HTTP locations, rejection of unstable drive-relative paths, normalization and operation-target spelling.
15
+ * @evidence contracts/portability.md#os-neutral-implementation The file field distinguishes native local paths from HTTP URLs, requiring stable project-relative or absolute local resolution and refusing Windows drive-relative spelling instead of applying filesystem rules to a URL.
10
16
  */
11
17
  export interface ITtscEvidenceGraphSwaggerReference extends ITtscEvidenceGraphReferenceBase<"swagger"> {
12
18
  /**
@@ -1,5 +1,5 @@
1
- import type { TtscEvidenceGraphTypeScriptSymbol } from "../typings/TtscEvidenceGraphTypeScriptSymbol";
2
1
  import type { ITtscEvidenceGraphClaimBase } from "./ITtscEvidenceGraphClaimBase";
2
+ import type { TtscEvidenceGraphTypeScriptSymbol } from "./TtscEvidenceGraphTypeScriptSymbol";
3
3
  /**
4
4
  * A population of TypeScript declarations claiming its referenced evidence.
5
5
  *
@@ -14,6 +14,12 @@ import type { ITtscEvidenceGraphClaimBase } from "./ITtscEvidenceGraphClaimBase"
14
14
  * a host selected by {@link symbol}. An exclusion may instead sit on any
15
15
  * supported public export in the matching {@link files}, without changing the
16
16
  * target scope this claim excludes.
17
+ *
18
+ * @evidence contracts/common.md#principled-implementation The literal TypeScript discriminator and shared symbol vocabulary describe public Program declarations; root and files narrow that Program rather than promising a disk loader for claims.
19
+ * @evidence contracts/common.md#clear-and-simple-design This interface specializes the common claim with only TypeScript population and host selection details, retaining reference ownership in the base.
20
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Host and exclusion eligibility follow supported declaration syntax and configured populations rather than special cases for known consumers.
21
+ * @evidence contracts/common.md#meaningful-documentation The JSDoc explicitly distinguishes Program inclusion from rooted path selection and explains host versus exclusion-carrier eligibility and selector defaults.
22
+ * @evidence contracts/portability.md#os-neutral-implementation Root and glob spelling describe the native project boundary used to match Program sources; selection must respect host-supplied source identity and linked paths rather than inferring filesystem case policy from an operating-system name.
17
23
  */
18
24
  export interface ITtscEvidenceGraphTypeScriptClaim extends ITtscEvidenceGraphClaimBase<"typescript"> {
19
25
  /**
@@ -1,5 +1,5 @@
1
- import type { TtscEvidenceGraphTypeScriptSymbol } from "../typings/TtscEvidenceGraphTypeScriptSymbol";
2
1
  import type { ITtscEvidenceGraphReferenceBase } from "./ITtscEvidenceGraphReferenceBase";
2
+ import type { TtscEvidenceGraphTypeScriptSymbol } from "./TtscEvidenceGraphTypeScriptSymbol";
3
3
  /**
4
4
  * A population of TypeScript evidence that the owning claim must cite.
5
5
  *
@@ -11,6 +11,12 @@ import type { ITtscEvidenceGraphReferenceBase } from "./ITtscEvidenceGraphRefere
11
11
  * The selection keeps the evidence graph deliberate. It can cover public types
12
12
  * by default, then opt into functions or properties only where their individual
13
13
  * contracts deserve documentary proof.
14
+ *
15
+ * @evidence contracts/common.md#principled-implementation Local Program, explicit root and installed-package populations share one reference policy while documenting their distinct loading boundaries and exported-symbol identities.
16
+ * @evidence contracts/common.md#clear-and-simple-design Package and root selection remain explicit alternatives within one artifact interface; the shared base owns policy instead of duplicating it for each loading mode.
17
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Package lookup uses declaration entry semantics, not a consumer-specific JavaScript entry or a fallback that invents unavailable exports.
18
+ * @evidence contracts/common.md#meaningful-documentation Property prose explains the root/package restriction, declaration-entry precedence, Program snapshot priority and exact selector defaults with separate member comments.
19
+ * @evidence contracts/portability.md#os-neutral-implementation The type distinguishes a native root or installed-package location from exported symbol identity; forward-slash glob semantics are explicit while path resolution and linked-directory identity remain the loader's supported filesystem boundary.
14
20
  */
15
21
  export interface ITtscEvidenceGraphTypeScriptReference extends ITtscEvidenceGraphReferenceBase<"typescript"> {
16
22
  /**
@@ -42,8 +48,10 @@ export interface ITtscEvidenceGraphTypeScriptReference extends ITtscEvidenceGrap
42
48
  * addressed by its accessor path from that entry — which is what makes
43
49
  * `api.functional.questions.get` nameable. The entry is read from the `types`
44
50
  * condition of the `exports` map, then `typesVersions`, then the `types` or
45
- * `typings` field — never `main`, which names the JavaScript a consumer runs
46
- * rather than the declarations a citation can address.
51
+ * `typings` field. If no declaration channel answers, a runtime `exports`
52
+ * target or `main` is accepted only when it names TypeScript source itself,
53
+ * as in a source-first workspace package. Emitted JavaScript entries are not
54
+ * declaration populations.
47
55
  */
48
56
  package?: string;
49
57
  /**