@maverickcer/env-cap 0.2.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 (195) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +279 -0
  3. package/dist/.dts/build/assemble-project.d.ts +47 -0
  4. package/dist/.dts/build/assemble-project.d.ts.map +1 -0
  5. package/dist/.dts/build/change-model.d.ts +62 -0
  6. package/dist/.dts/build/change-model.d.ts.map +1 -0
  7. package/dist/.dts/build/check-artifacts.d.ts +48 -0
  8. package/dist/.dts/build/check-artifacts.d.ts.map +1 -0
  9. package/dist/.dts/build/citation-verification.d.ts +62 -0
  10. package/dist/.dts/build/citation-verification.d.ts.map +1 -0
  11. package/dist/.dts/build/compatibility.d.ts +76 -0
  12. package/dist/.dts/build/compatibility.d.ts.map +1 -0
  13. package/dist/.dts/build/contract-model.d.ts +92 -0
  14. package/dist/.dts/build/contract-model.d.ts.map +1 -0
  15. package/dist/.dts/build/deep-equal.d.ts +9 -0
  16. package/dist/.dts/build/deep-equal.d.ts.map +1 -0
  17. package/dist/.dts/build/deep-freeze.d.ts +20 -0
  18. package/dist/.dts/build/deep-freeze.d.ts.map +1 -0
  19. package/dist/.dts/build/dependency-graph.d.ts +168 -0
  20. package/dist/.dts/build/dependency-graph.d.ts.map +1 -0
  21. package/dist/.dts/build/dependency-model.d.ts +79 -0
  22. package/dist/.dts/build/dependency-model.d.ts.map +1 -0
  23. package/dist/.dts/build/discover.d.ts +25 -0
  24. package/dist/.dts/build/discover.d.ts.map +1 -0
  25. package/dist/.dts/build/display-path.d.ts +24 -0
  26. package/dist/.dts/build/display-path.d.ts.map +1 -0
  27. package/dist/.dts/build/docs.d.ts +176 -0
  28. package/dist/.dts/build/docs.d.ts.map +1 -0
  29. package/dist/.dts/build/env-example.d.ts +85 -0
  30. package/dist/.dts/build/env-example.d.ts.map +1 -0
  31. package/dist/.dts/build/errors.d.ts +78 -0
  32. package/dist/.dts/build/errors.d.ts.map +1 -0
  33. package/dist/.dts/build/evidence-cache.d.ts +74 -0
  34. package/dist/.dts/build/evidence-cache.d.ts.map +1 -0
  35. package/dist/.dts/build/evidence-model.d.ts +50 -0
  36. package/dist/.dts/build/evidence-model.d.ts.map +1 -0
  37. package/dist/.dts/build/evidence-reference.d.ts +67 -0
  38. package/dist/.dts/build/evidence-reference.d.ts.map +1 -0
  39. package/dist/.dts/build/evidence-snapshot.d.ts +123 -0
  40. package/dist/.dts/build/evidence-snapshot.d.ts.map +1 -0
  41. package/dist/.dts/build/exclusive-group.d.ts +19 -0
  42. package/dist/.dts/build/exclusive-group.d.ts.map +1 -0
  43. package/dist/.dts/build/finding-model.d.ts +79 -0
  44. package/dist/.dts/build/finding-model.d.ts.map +1 -0
  45. package/dist/.dts/build/generate-documentation.d.ts +176 -0
  46. package/dist/.dts/build/generate-documentation.d.ts.map +1 -0
  47. package/dist/.dts/build/generate-env-artifacts.d.ts +176 -0
  48. package/dist/.dts/build/generate-env-artifacts.d.ts.map +1 -0
  49. package/dist/.dts/build/generate-evidence.d.ts +77 -0
  50. package/dist/.dts/build/generate-evidence.d.ts.map +1 -0
  51. package/dist/.dts/build/generate-manifest.d.ts +101 -0
  52. package/dist/.dts/build/generate-manifest.d.ts.map +1 -0
  53. package/dist/.dts/build/generate-usage.d.ts +95 -0
  54. package/dist/.dts/build/generate-usage.d.ts.map +1 -0
  55. package/dist/.dts/build/generated-banner.d.ts +52 -0
  56. package/dist/.dts/build/generated-banner.d.ts.map +1 -0
  57. package/dist/.dts/build/glob.d.ts +18 -0
  58. package/dist/.dts/build/glob.d.ts.map +1 -0
  59. package/dist/.dts/build/governance-fields.d.ts +34 -0
  60. package/dist/.dts/build/governance-fields.d.ts.map +1 -0
  61. package/dist/.dts/build/humanize-key.d.ts +14 -0
  62. package/dist/.dts/build/humanize-key.d.ts.map +1 -0
  63. package/dist/.dts/build/index.d.ts +107 -0
  64. package/dist/.dts/build/index.d.ts.map +1 -0
  65. package/dist/.dts/build/lifecycle-model.d.ts +64 -0
  66. package/dist/.dts/build/lifecycle-model.d.ts.map +1 -0
  67. package/dist/.dts/build/link.d.ts +215 -0
  68. package/dist/.dts/build/link.d.ts.map +1 -0
  69. package/dist/.dts/build/literal-eval.d.ts +23 -0
  70. package/dist/.dts/build/literal-eval.d.ts.map +1 -0
  71. package/dist/.dts/build/live-expirations.d.ts +47 -0
  72. package/dist/.dts/build/live-expirations.d.ts.map +1 -0
  73. package/dist/.dts/build/manifest-snapshot.d.ts +229 -0
  74. package/dist/.dts/build/manifest-snapshot.d.ts.map +1 -0
  75. package/dist/.dts/build/manifest.d.ts +31 -0
  76. package/dist/.dts/build/manifest.d.ts.map +1 -0
  77. package/dist/.dts/build/map-utils.d.ts +8 -0
  78. package/dist/.dts/build/map-utils.d.ts.map +1 -0
  79. package/dist/.dts/build/ownership-model.d.ts +57 -0
  80. package/dist/.dts/build/ownership-model.d.ts.map +1 -0
  81. package/dist/.dts/build/parse.d.ts +199 -0
  82. package/dist/.dts/build/parse.d.ts.map +1 -0
  83. package/dist/.dts/build/reference-projections.d.ts +156 -0
  84. package/dist/.dts/build/reference-projections.d.ts.map +1 -0
  85. package/dist/.dts/build/resolution/resolve-import.d.ts +53 -0
  86. package/dist/.dts/build/resolution/resolve-import.d.ts.map +1 -0
  87. package/dist/.dts/build/resolution/resolve-package-schema.d.ts +83 -0
  88. package/dist/.dts/build/resolution/resolve-package-schema.d.ts.map +1 -0
  89. package/dist/.dts/build/resolution/resolve-tsconfig-paths.d.ts +101 -0
  90. package/dist/.dts/build/resolution/resolve-tsconfig-paths.d.ts.map +1 -0
  91. package/dist/.dts/build/resolution/resolve-within-root.d.ts +35 -0
  92. package/dist/.dts/build/resolution/resolve-within-root.d.ts.map +1 -0
  93. package/dist/.dts/build/resolve-import.d.ts +50 -0
  94. package/dist/.dts/build/resolve-import.d.ts.map +1 -0
  95. package/dist/.dts/build/resolve-package-schema.d.ts +99 -0
  96. package/dist/.dts/build/resolve-package-schema.d.ts.map +1 -0
  97. package/dist/.dts/build/resolve-tsconfig-paths.d.ts +100 -0
  98. package/dist/.dts/build/resolve-tsconfig-paths.d.ts.map +1 -0
  99. package/dist/.dts/build/resolve-within-root.d.ts +35 -0
  100. package/dist/.dts/build/resolve-within-root.d.ts.map +1 -0
  101. package/dist/.dts/build/sarif.d.ts +66 -0
  102. package/dist/.dts/build/sarif.d.ts.map +1 -0
  103. package/dist/.dts/build/scan-dependencies.d.ts +47 -0
  104. package/dist/.dts/build/scan-dependencies.d.ts.map +1 -0
  105. package/dist/.dts/build/sort-by-identity.d.ts +14 -0
  106. package/dist/.dts/build/sort-by-identity.d.ts.map +1 -0
  107. package/dist/.dts/build/source-position.d.ts +69 -0
  108. package/dist/.dts/build/source-position.d.ts.map +1 -0
  109. package/dist/.dts/build/tool-version.d.ts +8 -0
  110. package/dist/.dts/build/tool-version.d.ts.map +1 -0
  111. package/dist/.dts/build/types.d.ts +53 -0
  112. package/dist/.dts/build/types.d.ts.map +1 -0
  113. package/dist/.dts/build/usage-report.d.ts +124 -0
  114. package/dist/.dts/build/usage-report.d.ts.map +1 -0
  115. package/dist/.dts/cli/filesystem.d.ts +3 -0
  116. package/dist/.dts/cli/filesystem.d.ts.map +1 -0
  117. package/dist/.dts/eslint-plugin/glob.d.ts +18 -0
  118. package/dist/.dts/eslint-plugin/glob.d.ts.map +1 -0
  119. package/dist/.dts/eslint-plugin/index.d.ts +27 -0
  120. package/dist/.dts/eslint-plugin/index.d.ts.map +1 -0
  121. package/dist/.dts/eslint-plugin/no-node-fs.d.ts +25 -0
  122. package/dist/.dts/eslint-plugin/no-node-fs.d.ts.map +1 -0
  123. package/dist/.dts/eslint-plugin/no-raw-process-env.d.ts +23 -0
  124. package/dist/.dts/eslint-plugin/no-raw-process-env.d.ts.map +1 -0
  125. package/dist/.dts/evidence/define-projection.d.ts +51 -0
  126. package/dist/.dts/evidence/define-projection.d.ts.map +1 -0
  127. package/dist/.dts/evidence/index.d.ts +23 -0
  128. package/dist/.dts/evidence/index.d.ts.map +1 -0
  129. package/dist/.dts/helpers/index.d.ts +135 -0
  130. package/dist/.dts/helpers/index.d.ts.map +1 -0
  131. package/dist/.dts/helpers/processors.d.ts +32 -0
  132. package/dist/.dts/helpers/processors.d.ts.map +1 -0
  133. package/dist/.dts/helpers/validators.d.ts +68 -0
  134. package/dist/.dts/helpers/validators.d.ts.map +1 -0
  135. package/dist/.dts/node/index.d.ts +2 -0
  136. package/dist/.dts/node/index.d.ts.map +1 -0
  137. package/dist/.dts/runtime/cache.d.ts +20 -0
  138. package/dist/.dts/runtime/cache.d.ts.map +1 -0
  139. package/dist/.dts/runtime/create.d.ts +20 -0
  140. package/dist/.dts/runtime/create.d.ts.map +1 -0
  141. package/dist/.dts/runtime/document.d.ts +181 -0
  142. package/dist/.dts/runtime/document.d.ts.map +1 -0
  143. package/dist/.dts/runtime/errors.d.ts +55 -0
  144. package/dist/.dts/runtime/errors.d.ts.map +1 -0
  145. package/dist/.dts/runtime/index.d.ts +24 -0
  146. package/dist/.dts/runtime/index.d.ts.map +1 -0
  147. package/dist/.dts/runtime/registry.d.ts +12 -0
  148. package/dist/.dts/runtime/registry.d.ts.map +1 -0
  149. package/dist/.dts/runtime/reset.d.ts +8 -0
  150. package/dist/.dts/runtime/reset.d.ts.map +1 -0
  151. package/dist/.dts/runtime/types.d.ts +175 -0
  152. package/dist/.dts/runtime/types.d.ts.map +1 -0
  153. package/dist/.dts/runtime/validate.d.ts +14 -0
  154. package/dist/.dts/runtime/validate.d.ts.map +1 -0
  155. package/dist/build.cjs +83 -0
  156. package/dist/build.cjs.map +1 -0
  157. package/dist/build.d.cts +1 -0
  158. package/dist/build.d.ts +1 -0
  159. package/dist/build.js +19 -0
  160. package/dist/build.js.map +1 -0
  161. package/dist/cli/index.js +134 -0
  162. package/dist/cli/index.js.map +1 -0
  163. package/dist/eslint-plugin/index.cjs +12 -0
  164. package/dist/eslint-plugin/index.cjs.map +1 -0
  165. package/dist/eslint-plugin/index.d.cts +1 -0
  166. package/dist/eslint-plugin/index.d.ts +1 -0
  167. package/dist/eslint-plugin/index.js +5 -0
  168. package/dist/eslint-plugin/index.js.map +1 -0
  169. package/dist/evidence.cjs +7 -0
  170. package/dist/evidence.cjs.map +1 -0
  171. package/dist/evidence.d.cts +1 -0
  172. package/dist/evidence.d.ts +1 -0
  173. package/dist/evidence.js +5 -0
  174. package/dist/evidence.js.map +1 -0
  175. package/dist/helpers.cjs +8 -0
  176. package/dist/helpers.cjs.map +1 -0
  177. package/dist/helpers.d.cts +1 -0
  178. package/dist/helpers.d.ts +1 -0
  179. package/dist/helpers.js +5 -0
  180. package/dist/helpers.js.map +1 -0
  181. package/dist/index.cjs +15 -0
  182. package/dist/index.cjs.map +1 -0
  183. package/dist/index.d.cts +1 -0
  184. package/dist/index.d.ts +1 -0
  185. package/dist/index.js +7 -0
  186. package/dist/index.js.map +1 -0
  187. package/dist/node.cjs +13 -0
  188. package/dist/node.cjs.map +1 -0
  189. package/dist/node.d.cts +1 -0
  190. package/dist/node.d.ts +1 -0
  191. package/dist/node.js +7 -0
  192. package/dist/node.js.map +1 -0
  193. package/package.json +183 -0
  194. package/schemas/contract-model.schema.json +321 -0
  195. package/schemas/env-cap-report.schema.json +2369 -0
@@ -0,0 +1,92 @@
1
+ import { type EnvGovernanceFields } from "./governance-fields.js";
2
+ import type { DiscoveredContract } from "./link.js";
3
+ import type { DiscoveredVariableEvidence } from "./parse.js";
4
+ import type { PackageOrigin } from "./resolution/resolve-package-schema.js";
5
+ import type { SourcePosition } from "./source-position.js";
6
+ /**
7
+ * The first of env-cap's seven canonical fact models (ADR 0024) -- a
8
+ * versioned, JSON-serializable projection of every declared environment
9
+ * variable's structural and documentation contract. See ADR 0025.
10
+ *
11
+ * @remarks
12
+ * Deliberately broader than the persisted evidence snapshot's
13
+ * (`evidence-snapshot.ts`) `ManifestChangeReport` scope: that diff is scoped
14
+ * to *active* contracts and *only* the `documentEnv()`-sourced fields,
15
+ * matching `renderManifest()`'s own scope (ADR 0021). This model includes
16
+ * every discovered contract regardless of `active`, plus the AST-derived
17
+ * schema facts (`hasDefault`/`hasProcessor`/etc.) the change report
18
+ * deliberately excludes -- both are load-bearing for downstream
19
+ * Finding/Evidence Model work.
20
+ */
21
+ /** Bump only when a reader could misinterpret the new shape (a field changes
22
+ * type/meaning, or is removed) -- NOT for every additive field. Same
23
+ * discipline `evidence-model.ts`'s `EVIDENCE_MODEL_SCHEMA_VERSION` and
24
+ * `src/cli/json.ts`'s `JSON_SCHEMA_VERSION` already document. */
25
+ export declare const CONTRACT_MODEL_SCHEMA_VERSION = 3;
26
+ /**
27
+ * One variable's full statically-discoverable contract: schema-shaped facts plus linked documentation.
28
+ *
29
+ * @see {@link DependencyModelVariable} -- this same declared variable's access status.
30
+ * @see {@link OwnershipModelVariable} -- this same declared variable's effective owner.
31
+ * @see {@link LifecycleModelVariable} -- this same declared variable's lifecycle data.
32
+ * @see `CatalogVariable` (`docs.ts`) -- this same declared variable, reshaped for the generated
33
+ * docs catalog/JSON. Plain reference, not `{@link}`: `CatalogVariable` is intentionally not part
34
+ * of the public surface (see `typedoc.json`'s `intentionallyNotExported`).
35
+ */
36
+ export interface ContractModelVariable extends EnvGovernanceFields {
37
+ readonly key: string;
38
+ readonly hasDefault: boolean;
39
+ readonly defaultValue: {
40
+ readonly ok: true;
41
+ readonly value: unknown;
42
+ } | {
43
+ readonly ok: false;
44
+ } | undefined;
45
+ readonly hasProcessor: boolean;
46
+ readonly processorSource: string | undefined;
47
+ readonly processorReturnType: string | undefined;
48
+ readonly hasValidator: boolean;
49
+ readonly validatorSource: string | undefined;
50
+ readonly context: string | undefined;
51
+ readonly description: string | undefined;
52
+ readonly refreshInstructions: string | undefined;
53
+ readonly setupInstructions: string | undefined;
54
+ readonly required: boolean | undefined;
55
+ readonly documented: boolean;
56
+ /** The `evidence` sub-object from this variable's linked documentation -- re-verified every run, unlike every declared-only field above. See {@link runtime.VariableEvidenceDocs} and ADR 0037. */
57
+ readonly evidence: DiscoveredVariableEvidence | undefined;
58
+ /** Where this variable's own schema property is declared. See ADR 0036. */
59
+ readonly declaration: SourcePosition;
60
+ }
61
+ /** One `createEnv()` contract's full statically-discoverable contract, active or not. */
62
+ export interface ContractModelContract extends EnvGovernanceFields {
63
+ /** Root-relative, POSIX-separated -- matches `DiscoveredContractSummary.file`. */
64
+ readonly file: string;
65
+ readonly exportName: string;
66
+ readonly contractName: string;
67
+ readonly active: boolean;
68
+ readonly category: string | undefined;
69
+ readonly exclusiveGroup: string | undefined;
70
+ readonly variables: readonly ContractModelVariable[];
71
+ readonly documented: boolean;
72
+ readonly packageOrigin: PackageOrigin | undefined;
73
+ /** Where this contract's `createEnv(...)` call is declared. Always present. See ADR 0036. */
74
+ readonly declaration: SourcePosition;
75
+ /** Where this contract's `documentEnv(...)` call is declared, if one exists. See ADR 0036. */
76
+ readonly documentation: SourcePosition | undefined;
77
+ }
78
+ export interface ContractModel {
79
+ readonly schemaVersion: typeof CONTRACT_MODEL_SCHEMA_VERSION;
80
+ readonly contracts: readonly ContractModelContract[];
81
+ }
82
+ /**
83
+ * Projects every discovered contract (active or not) into the Contract
84
+ * Model's versioned, JSON-serializable shape.
85
+ *
86
+ * @remarks
87
+ * Sorted deterministically (by file, then exportName, then variable key), so
88
+ * `JSON.stringify` output is stable and diffs cleanly wherever this is
89
+ * persisted.
90
+ */
91
+ export declare function buildContractModel(contracts: readonly DiscoveredContract[], root: string): ContractModel;
92
+ //# sourceMappingURL=contract-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-model.d.ts","sourceRoot":"","sources":["../../../src/build/contract-model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCA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,yFAAyF;AACzF,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3C,QAAQ,CAAC,SAAS,EAAE,SAAS,qBAAqB,EAAE,CAAA;IACpD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,aAAa,EAAE,aAAa,GAAG,SAAS,CAAA;IACjD,6FAA6F;IAC7F,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAA;IACpC,8FAA8F;IAC9F,QAAQ,CAAC,aAAa,EAAE,cAAc,GAAG,SAAS,CAAA;CACnD;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,aAAa,EAAE,OAAO,6BAA6B,CAAA;IAC5D,QAAQ,CAAC,SAAS,EAAE,SAAS,qBAAqB,EAAE,CAAA;CACrD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,kBAAkB,EAAE,EACxC,IAAI,EAAE,MAAM,GACX,aAAa,CAmDf"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Structural equality for JSON-safe values -- `documentEnv()`'s `metadata` can hold an
3
+ * object/array (ADR 0035), so two independently-declared-but-identical values are never `===`.
4
+ * Values compared here are always JSON-safe (string/number/boolean/null/array/object,
5
+ * recursively -- see `literal-eval.ts`), so this doesn't need to handle cycles, `Date`, `Map`, or
6
+ * anything else `evaluateLiteral()` can never produce.
7
+ */
8
+ export declare function deepEqual(a: unknown, b: unknown): boolean;
9
+ //# sourceMappingURL=deep-equal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-equal.d.ts","sourceRoot":"","sources":["../../../src/build/deep-equal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAezD"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Recursively freezes `value` and everything reachable from it (array
3
+ * elements, plain-object property values), so a mutation anywhere in the
4
+ * structure throws instead of silently succeeding.
5
+ *
6
+ * @remarks
7
+ * Generalized from `live-expirations.ts`'s former `DiscoveredContract[]`-
8
+ * hardcoded `deepFreezeContracts()` (see ADR 0012) into a truly generic
9
+ * utility, so Evidence Model's own immutability guarantee (a later phase)
10
+ * can reuse it instead of duplicating the recursion.
11
+ *
12
+ * Only recurses into arrays and plain objects (`{}` or `Object.create(null)`)
13
+ * -- a `Map`, `Set`, or class instance is frozen at its own top level but not
14
+ * walked further. This codebase's fact models are plain JSON-serializable
15
+ * data, never class instances, so this is deliberately narrow rather than a
16
+ * general-purpose deep-freeze library. A `WeakSet` guards against infinite
17
+ * recursion if a cyclic reference is ever passed in.
18
+ */
19
+ export declare function deepFreeze<T>(value: T): T;
20
+ //# sourceMappingURL=deep-freeze.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-freeze.d.ts","sourceRoot":"","sources":["../../../src/build/deep-freeze.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAEzC"}
@@ -0,0 +1,168 @@
1
+ import type { EscapeReason } from "./scan-dependencies.js";
2
+ import type { ImportResolutionContext } from "./resolution/resolve-import.js";
3
+ import type { DiscoveredContract } from "./link.js";
4
+ import type { ParseWarning } from "./parse.js";
5
+ import type { DynamicAccessAssertion, SourcePosition } from "./source-position.js";
6
+ /**
7
+ * What env-cap's static scan could prove about one variable's consumption:
8
+ * it was member-accessed somewhere (`"used"`), it was never accessed at all
9
+ * within the scanned surfaces (`"unconsumed"`), or a computed (dynamic)
10
+ * property access on the owning contract makes the answer unprovable
11
+ * (`"indeterminate"`).
12
+ *
13
+ * @remarks
14
+ * Deliberately narrower than `@maverickcer/data-cap`'s equivalent, which
15
+ * splits the unprovable case further (an unresolved *consumer* vs. an
16
+ * indeterminate *field*). That split exists because a data-cap capability
17
+ * exposes many fields at once, so it has a real "we resolved the consumer,
18
+ * but can't tell which field it touched" state to name. env-cap's
19
+ * consumption model is one value per key: a contract member access either
20
+ * names the key statically (`"used"`) or it doesn't (`"indeterminate"`), and
21
+ * there is no intermediate case where the consumer is known but the thing
22
+ * consumed is ambiguous. Adding a fourth state here would be vocabulary
23
+ * borrowed from a model env-cap doesn't have -- see ADR 0010's
24
+ * "provable, not heuristic" rule. Developer-declared `dynamicAccess`
25
+ * citations stay a wholly separate fact and are never folded into this
26
+ * status (ADR 0037).
27
+ */
28
+ export type VariableAccessStatus = "used" | "unconsumed" | "indeterminate";
29
+ /**
30
+ * Every reason `deriveOwnershipFindings` can cite for an `indeterminate`
31
+ * variable, cited on the {@link EscapeSite} the scanner actually observed --
32
+ * `EscapeReason` (destructuring/aliasing shapes the scanner declines to
33
+ * follow, see ADR 0039) plus `"reference"` for a tracked import/alias
34
+ * mentioned bare (passed as an argument, spread, assigned elsewhere, ...):
35
+ * a real, provable read of the contract that this single-file walk simply
36
+ * can't attribute to any specific key.
37
+ */
38
+ type EscapeVia = EscapeReason | "reference";
39
+ /** One position where a tracked contract's value escaped this scanner's local dataflow analysis -- see {@link EscapeVia}. */
40
+ interface EscapeSite extends SourcePosition {
41
+ readonly via: EscapeVia;
42
+ }
43
+ interface VariableAccessInfo {
44
+ readonly status: VariableAccessStatus;
45
+ /** Internal only, never exposed publicly -- which AST evidence produced
46
+ * this status, so a future "why does env-cap think this is
47
+ * unconsumed" bug report is debuggable without re-deriving the AST walk
48
+ * by hand. */
49
+ readonly evidence: "member-access" | "dynamic-access" | "escape" | "no-access";
50
+ /** Every position where a member access was observed for this variable,
51
+ * aggregated across every consuming file -- empty unless
52
+ * `status === "used"`. Previously computed by `scan-dependencies.ts`'s
53
+ * `AccessSite` and discarded before reaching even this internal type;
54
+ * threaded through as of ADR 0027 (line only) and ADR 0036 (full
55
+ * position, one entry per file rather than a flat, file-less list of
56
+ * line numbers) so `dependency-model.ts` can publish it. */
57
+ readonly positions: readonly SourcePosition[];
58
+ /** Every developer-declared `dynamicAccess` citation's current freshness for this variable -- a wholly separate, independent fact from `status`/`evidence` above, never folded into them. Empty unless the linked `documentEnv()` call declared at least one citation for this key. See ADR 0037. */
59
+ readonly dynamicAccessAssertions: readonly DynamicAccessAssertion[];
60
+ }
61
+ /** One named surface `buildDependencyGraph()`'s scan actually covered -- the
62
+ * application's own root, plus one entry per allow-listed `packages` (ADR
63
+ * 0014) name whose source was also scanned. See ADR 0036: a claim like
64
+ * "no consumer found" is only ever as strong as what was actually
65
+ * searched, and this is what lets a renderer say so explicitly instead of
66
+ * implying an unbounded guarantee it can't back up. */
67
+ export interface ScannedSurface {
68
+ /** `"application"` for the local project root, `"package:<name>"` for an allow-listed package's own source. */
69
+ readonly label: string;
70
+ /** Root-relative, POSIX-separated. */
71
+ readonly root: string;
72
+ }
73
+ interface ContractDependencySummary {
74
+ readonly file: string;
75
+ readonly exportName: string;
76
+ readonly contractName: string;
77
+ readonly imported: boolean;
78
+ readonly hasDynamicAccess: boolean;
79
+ /** Every declared key is always present. */
80
+ readonly variables: ReadonlyMap<string, VariableAccessInfo>;
81
+ /** Every file coupled to this contract -- contract-level "who depends on
82
+ * this," not proof any specific variable was read. See the
83
+ * consumer-vs-variable-access semantics note in `deriveOwnershipFindings`. */
84
+ readonly consumingFiles: readonly string[];
85
+ /** Files whose import of this contract's name couldn't be verified
86
+ * because it resolved through a file containing an unresolved wildcard
87
+ * re-export. */
88
+ readonly ambiguousBarrelFiles: readonly string[];
89
+ /** Every computed (dynamic) property-access site observed anywhere on
90
+ * this contract -- previously collapsed into `hasDynamicAccess` alone
91
+ * and discarded; threaded through as of ADR 0036 so a finding can cite
92
+ * exactly where the uncertainty comes from instead of just asserting it
93
+ * exists. */
94
+ readonly dynamicAccessSites: readonly SourcePosition[];
95
+ /** Every position where the contract's value flowed somewhere this
96
+ * scanner's local dataflow analysis can't follow -- see {@link
97
+ * EscapeVia} and ADR 0039. Like `dynamicAccessSites`, this widens every
98
+ * not-otherwise-accessed variable on the SAME contract to
99
+ * `indeterminate`, never `unconsumed`. */
100
+ readonly escapeSites: readonly EscapeSite[];
101
+ }
102
+ export interface DependencyGraph {
103
+ readonly contracts: readonly ContractDependencySummary[];
104
+ readonly warnings: readonly ParseWarning[];
105
+ /** Every surface actually scanned for usage -- see {@link ScannedSurface}. Always has at least one entry (the application root). */
106
+ readonly scannedSurfaces: readonly ScannedSurface[];
107
+ }
108
+ export declare function buildDependencyGraph(contracts: readonly DiscoveredContract[], scanFiles: readonly string[], readFile: (filePath: string) => Promise<string>, context: ImportResolutionContext, scannedSurfaces?: readonly ScannedSurface[], dynamicAccessAcknowledgments?: ReadonlyMap<string, readonly DynamicAccessAssertion[]>): Promise<DependencyGraph>;
109
+ interface AbandonedOwnershipFinding {
110
+ readonly file: string;
111
+ readonly exportName: string;
112
+ readonly contractName: string;
113
+ }
114
+ interface UnresolvedConsumerOwnershipFinding extends AbandonedOwnershipFinding {
115
+ readonly reason: string;
116
+ }
117
+ interface UnconsumedOwnedVariableOwnershipFinding extends AbandonedOwnershipFinding {
118
+ readonly key: string;
119
+ }
120
+ interface IndeterminateAccessOwnershipFinding extends AbandonedOwnershipFinding {
121
+ readonly key: string;
122
+ readonly reason: string;
123
+ /** Every AST-observed dynamic-access site on this contract -- see ADR 0036. */
124
+ readonly dynamicAccessSites: readonly SourcePosition[];
125
+ /** Every AST-observed escape site on this contract -- see {@link EscapeVia} and ADR 0039. */
126
+ readonly escapeSites: readonly EscapeSite[];
127
+ }
128
+ /** A variable that would otherwise be `unconsumedOwned`/`indeterminate`, but has at least one `"fresh"` developer-declared `dynamicAccess` assertion -- the "asserted" category (ADR 0037). Never silently dropped: the raw `wouldBeStatus` is always shown alongside the assertion, per Design 7's "never let a claim overwrite an observation" rule. */
129
+ interface AssertedOwnershipFinding extends AbandonedOwnershipFinding {
130
+ readonly key: string;
131
+ readonly wouldBeStatus: "unconsumed" | "indeterminate";
132
+ readonly dynamicAccessAssertions: readonly DynamicAccessAssertion[];
133
+ }
134
+ export interface OwnershipFindings {
135
+ readonly abandoned: readonly AbandonedOwnershipFinding[];
136
+ readonly unresolvedConsumers: readonly UnresolvedConsumerOwnershipFinding[];
137
+ readonly unconsumedOwned: readonly UnconsumedOwnedVariableOwnershipFinding[];
138
+ readonly indeterminate: readonly IndeterminateAccessOwnershipFinding[];
139
+ readonly asserted: readonly AssertedOwnershipFinding[];
140
+ }
141
+ /**
142
+ * Derives ownership findings from the graph. This is where the epistemic
143
+ * rules that matter most live:
144
+ * - A contract never imported anywhere, with no ambiguous barrel path
145
+ * either, is `abandoned` -- a feature's schema outliving the feature.
146
+ * - A contract never *directly* imported, but reachable only through an
147
+ * unresolved barrel re-export, is `unresolvedConsumers` -- never
148
+ * `abandoned`. Claiming "abandoned" here would be a false positive with
149
+ * real consequences.
150
+ * - A variable with no member access anywhere, on a contract with no
151
+ * dynamic access anywhere, is `unconsumedOwned` -- "no consumer found in
152
+ * this repository," not "provably dead." The scanned surfaces are named
153
+ * explicitly in the reason, per ADR 0036, so the claim is exactly as
154
+ * strong as what was actually searched.
155
+ * - A variable with no member access, but dynamic access observed
156
+ * *somewhere* on that contract, is `indeterminate` -- never
157
+ * `unconsumedOwned`. Uncertainty is never promoted to certainty in either
158
+ * direction. Every candidate dynamic-access site is cited by name.
159
+ * - A variable with at least one `"fresh"` {@link DynamicAccessAssertion}
160
+ * (ADR 0037) gets neither `unconsumedOwned` nor `indeterminate`, regardless
161
+ * of `status` -- a developer has re-acknowledged the access exists. The
162
+ * Dependency Model itself still keeps `status` and the assertion side by
163
+ * side, unedited; only *this* finding-suppression decision reads them
164
+ * together.
165
+ */
166
+ export declare function deriveOwnershipFindings(graph: DependencyGraph): OwnershipFindings;
167
+ export {};
168
+ //# sourceMappingURL=dependency-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency-graph.d.ts","sourceRoot":"","sources":["../../../src/build/dependency-graph.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,YAAY,EAAkB,MAAM,wBAAwB,CAAA;AAEtF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AAG7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAElF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,YAAY,GAAG,eAAe,CAAA;AAE1E;;;;;;;;GAQG;AACH,KAAK,SAAS,GAAG,YAAY,GAAG,WAAW,CAAA;AAE3C,6HAA6H;AAC7H,UAAU,UAAW,SAAQ,cAAc;IACzC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAA;CACxB;AAED,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAA;IACrC;;;mBAGe;IACf,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,gBAAgB,GAAG,QAAQ,GAAG,WAAW,CAAA;IAC9E;;;;;;iEAM6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,CAAA;IAC7C,qSAAqS;IACrS,QAAQ,CAAC,uBAAuB,EAAE,SAAS,sBAAsB,EAAE,CAAA;CACpE;AAED;;;;;wDAKwD;AACxD,MAAM,WAAW,cAAc;IAC7B,+GAA+G;IAC/G,QAAQ,CAAC,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;;;;;;;GAwBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,iBAAiB,CAsEjF"}
@@ -0,0 +1,79 @@
1
+ import type { ContractRef } from "./evidence-reference.js";
2
+ import type { ScannedSurface, VariableAccessStatus } from "./dependency-graph.js";
3
+ import type { DiscoveredContract } from "./link.js";
4
+ import type { ParseWarning } from "./parse.js";
5
+ import type { ImportResolutionContext } from "./resolution/resolve-import.js";
6
+ import type { DynamicAccessAssertion, SourcePosition } from "./source-position.js";
7
+ /**
8
+ * The second of env-cap's seven canonical fact models (ADR 0024) -- a
9
+ * versioned, JSON-serializable projection of the dependency-ownership
10
+ * engine's graph. See ADR 0027 and ADR 0036.
11
+ *
12
+ * @remarks
13
+ * `dependency-graph.ts`'s scanning/graph-building internals stay Private,
14
+ * unchanged, per ADR 0010 -- this is a fact-shaped *result* built on top of
15
+ * them, not a relaxation of that boundary. Graph-format rendering (DOT,
16
+ * Mermaid, a `{nodes, edges}` JSON export) is deliberately not here --
17
+ * that's presentation over this model's data, not the model itself.
18
+ */
19
+ /** Bump only when a reader could misinterpret the new shape -- same discipline every other canonical model's `schemaVersion` follows. */
20
+ export declare const DEPENDENCY_MODEL_SCHEMA_VERSION = 2;
21
+ /**
22
+ * One variable's access status within a contract, plus every position it was found
23
+ * member-accessed at, aggregated across every consuming file.
24
+ *
25
+ * @see {@link ContractModelVariable} -- this same declared variable's canonical starting point.
26
+ */
27
+ export interface DependencyModelVariable {
28
+ readonly key: string;
29
+ readonly status: VariableAccessStatus;
30
+ /** Empty unless `status === "used"`. Previously discarded before reaching any public type -- see ADR 0027 (line only) and ADR 0036 (full position, file included per entry). */
31
+ readonly positions: readonly SourcePosition[];
32
+ /** Every developer-declared `dynamicAccess` citation's current freshness for this variable -- a wholly separate, independent fact from `status` above, never folded into it. Empty when no citation was declared, or when no manifest snapshot baseline was available to check against (the manifest pass wasn't also requested). See ADR 0037. */
33
+ readonly dynamicAccessAssertions: readonly DynamicAccessAssertion[];
34
+ }
35
+ export interface DependencyModelContract {
36
+ /** Root-relative, POSIX-separated -- matches `ContractModelContract.file`. */
37
+ readonly file: string;
38
+ readonly exportName: string;
39
+ readonly contractName: string;
40
+ readonly imported: boolean;
41
+ readonly hasDynamicAccess: boolean;
42
+ readonly variables: readonly DependencyModelVariable[];
43
+ /** Every file coupled to this contract -- contract-level "who depends on this," not proof any specific variable was read. */
44
+ readonly consumingFiles: readonly string[];
45
+ /** Files whose import of this contract's name couldn't be verified because it resolved through a file containing an unresolved wildcard re-export. */
46
+ readonly ambiguousBarrelFiles: readonly string[];
47
+ /** Every computed (dynamic) property-access site observed anywhere on this contract -- see ADR 0036. */
48
+ readonly dynamicAccessSites: readonly SourcePosition[];
49
+ }
50
+ /** One contract, as referenced from the inverse (`consumers`) index -- see {@link ContractRef} for why no `contractName` is carried here. */
51
+ export type DependencyModelContractRef = ContractRef;
52
+ /** One consuming file, and every contract it depends on -- the inverse of `DependencyModelContract.consumingFiles`. */
53
+ export interface DependencyModelConsumer {
54
+ /** Root-relative, POSIX-separated. */
55
+ readonly file: string;
56
+ readonly contracts: readonly DependencyModelContractRef[];
57
+ }
58
+ export interface DependencyModel {
59
+ readonly schemaVersion: typeof DEPENDENCY_MODEL_SCHEMA_VERSION;
60
+ readonly contracts: readonly DependencyModelContract[];
61
+ /** Inverse of `contracts[].consumingFiles` -- one entry per file that consumes at least one contract, listing which contracts it reads. */
62
+ readonly consumers: readonly DependencyModelConsumer[];
63
+ readonly warnings: readonly ParseWarning[];
64
+ /** Every surface actually scanned for usage -- see ADR 0036. Always has at least one entry (the application root). */
65
+ readonly scannedSurfaces: readonly ScannedSurface[];
66
+ }
67
+ /**
68
+ * Runs the dependency-ownership engine (`buildDependencyGraph()`, Private)
69
+ * and projects its result into the Dependency Model's versioned,
70
+ * JSON-serializable shape -- including the inverse file-\>contracts index
71
+ * neither `dependency-graph.ts` nor `usage-report.ts` exposes today.
72
+ *
73
+ * @param scannedSurfaces - See `buildDependencyGraph()`'s own parameter of
74
+ * the same name -- passed straight through to the published model.
75
+ * @param dynamicAccessAcknowledgments - See `buildDependencyGraph()`'s own
76
+ * parameter of the same name (ADR 0037) -- passed straight through.
77
+ */
78
+ export declare function buildDependencyModel(contracts: readonly DiscoveredContract[], scanFiles: readonly string[], readFile: (filePath: string) => Promise<string>, context: ImportResolutionContext, root: string, scannedSurfaces?: readonly ScannedSurface[], dynamicAccessAcknowledgments?: ReadonlyMap<string, readonly DynamicAccessAssertion[]>): Promise<DependencyModel>;
79
+ //# sourceMappingURL=dependency-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency-model.d.ts","sourceRoot":"","sources":["../../../src/build/dependency-model.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAElF;;;;;;;;;;;GAWG;AAEH,yIAAyI;AACzI,eAAO,MAAM,+BAA+B,IAAI,CAAA;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAA;IACrC,gLAAgL;IAChL,QAAQ,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,CAAA;IAC7C,mVAAmV;IACnV,QAAQ,CAAC,uBAAuB,EAAE,SAAS,sBAAsB,EAAE,CAAA;CACpE;AAED,MAAM,WAAW,uBAAuB;IACtC,8EAA8E;IAC9E,QAAQ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AAO,CAAC,MAAM,CAAC,EAC/C,OAAO,EAAE,uBAAuB,EAChC,IAAI,EAAE,MAAM,EACZ,eAAe,CAAC,EAAE,SAAS,cAAc,EAAE,EAC3C,4BAA4B,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,sBAAsB,EAAE,CAAC,GACpF,OAAO,CAAC,eAAe,CAAC,CAiE1B"}
@@ -0,0 +1,25 @@
1
+ import type { BuildFileSystem } from "./types.js";
2
+ /** Options for {@link discoverSchemaFiles}. */
3
+ export interface DiscoverOptions {
4
+ /** The filesystem capability -- `./build` never imports `node:fs` (ADR 0040). */
5
+ readonly fs: BuildFileSystem;
6
+ /** Absolute path to search under. */
7
+ readonly root: string;
8
+ /** Glob patterns (relative to `root`) a file must match at least one of to be included. */
9
+ readonly include: readonly string[];
10
+ /** Glob patterns (relative to `root`) that prune a file or directory regardless of `include`. */
11
+ readonly exclude: readonly string[];
12
+ }
13
+ /**
14
+ * Finds every schema file matching `include`/`exclude` under `root`, returned
15
+ * as absolute paths in deterministic (alphabetically sorted) order.
16
+ *
17
+ * @remarks
18
+ * No external glob dependency: directories are pruned *during* the walk
19
+ * (both a hardcoded node_modules/.git skip and the caller's `exclude`
20
+ * patterns), rather than walked in full and filtered afterward -- walking an
21
+ * entire node_modules tree just to discard it is not acceptable for a tool
22
+ * meant to run against real projects.
23
+ */
24
+ export declare function discoverSchemaFiles(options: DiscoverOptions): Promise<string[]>;
25
+ //# sourceMappingURL=discover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../../src/build/discover.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B,iFAAiF;IACjF,QAAQ,CAAC,EAAE,EAAE,eAAe,CAAA;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,iGAAiG;IACjG,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AAUD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAoBrF"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Renders an absolute path for a human-facing generated artifact
3
+ * (`ENVIRONMENT.md`/`OWNERSHIP.md`) or a root-relative canonical model field,
4
+ * root-relative when possible. The one place this conversion lives -- every
5
+ * model builder and renderer that needs "the path as a reader should see it"
6
+ * goes through this, so two of them can never disagree about the form of the
7
+ * same file's path (which would silently break every `${file}#${exportName}`
8
+ * lookup that crosses between them).
9
+ *
10
+ * A `DiscoveredContract.file` keeps its own absolute path untouched -- that's
11
+ * the correct, unambiguous fact, and what stays sane when discovery spans
12
+ * multiple roots (a `packages`-discovered file living outside `root`
13
+ * entirely, ADR 0014).
14
+ */
15
+ /**
16
+ * Renders `absolutePath` relative to `root`, POSIX-separated regardless of
17
+ * platform (matching every other rendered path in this package's Markdown and
18
+ * JSON output). Falls back to `absolutePath` itself, unchanged, whenever the
19
+ * result would need to climb outside `root` (a `packages`-discovered file, or
20
+ * any other path not under root) -- never manufactures a `../` escape, which
21
+ * reads as a real relative path to a consumer and resolves to nothing useful.
22
+ */
23
+ export declare function displayPath(root: string, absolutePath: string): string;
24
+ //# sourceMappingURL=display-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display-path.d.ts","sourceRoot":"","sources":["../../../src/build/display-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAItE"}
@@ -0,0 +1,176 @@
1
+ import type { ContractModelContract } from "./contract-model.js";
2
+ import { type EnvGovernanceFields } from "./governance-fields.js";
3
+ import type { DiscoveredVariableEvidence } from "./parse.js";
4
+ /** Identifies a contract with no linked `documentEnv()` call at all. `file`'s absolute-vs-relative convention depends on where a given instance comes from -- see the specific field using this type (`DocumentationFindings.undocumentedContracts` is absolute; `RenderDocsOptions.undocumentedContracts` must be root-relative, matching the `ContractModel`-shaped `contracts` it's compared against). */
5
+ export interface UndocumentedContractRef {
6
+ readonly file: string;
7
+ /** The contract's exported binding name. */
8
+ readonly exportName: string;
9
+ }
10
+ /** Identifies a schema variable with no matching entry in its contract's linked documentation. See {@link UndocumentedContractRef}'s own note on `file`. */
11
+ export interface UndocumentedVariableRef {
12
+ readonly file: string;
13
+ /** The contract's exported binding name. */
14
+ readonly exportName: string;
15
+ /** The undocumented environment variable name. */
16
+ readonly key: string;
17
+ }
18
+ /** One contract- or variable-level `expiresAt` falling within the configured "expiring soon" window. */
19
+ export interface ExpiringEntry {
20
+ /** Absolute path of the file declaring the contract. */
21
+ readonly file: string;
22
+ /** The contract's exported binding name. */
23
+ readonly exportName: string;
24
+ /** `undefined` for a contract-level `expiresAt`, set for a per-variable one. */
25
+ readonly key: string | undefined;
26
+ /** The raw ISO date string, unparsed. */
27
+ readonly expiresAt: string;
28
+ /** Days from `now` until expiry; negative when already expired. */
29
+ readonly daysRemaining: number;
30
+ }
31
+ /** Options for {@link renderDocs}. */
32
+ export interface RenderDocsOptions {
33
+ /** How many days out counts as "expiring soon" in the lifecycle report and security review. */
34
+ readonly expiringWithinDays: number;
35
+ /** Contracts with no linked `documentEnv()` call at all. `file` must be root-relative, POSIX-separated -- matching `contracts`' own `ContractModel` convention, since this is matched against it by identity. */
36
+ readonly undocumentedContracts: readonly UndocumentedContractRef[];
37
+ /** Schema variables with no matching entry in their contract's linked documentation. `file` must be root-relative, POSIX-separated -- see `undocumentedContracts`. */
38
+ readonly undocumentedVariables: readonly UndocumentedVariableRef[];
39
+ /** Timestamp rendered into the header and used for expiry/days-remaining math. */
40
+ readonly generatedAt: Date;
41
+ /** Content already at `docs.location`, if any -- used only for the "changes since last report" summary. */
42
+ readonly previousContent: string | undefined;
43
+ }
44
+ /**
45
+ * Parses `expiresAt` as a real date.
46
+ *
47
+ * @remarks
48
+ * Malformed strings are silently ignored (return `undefined`) rather than throwing -- same
49
+ * "warn/skip, never guess" policy as the rest of the generator. Exported so `live-expirations.ts`
50
+ * can validate live override values against the exact same rule used for static `expiresAt`.
51
+ */
52
+ export declare function parseIsoDate(value: string): Date | undefined;
53
+ /** The minimal shape {@link computeExpiringEntries} needs -- structural, not pinned to `DiscoveredContract`, so the exact same rule serves both `LinkResult`'s absolute-path contracts (`generate-documentation.ts`'s `documentation.expiringSoon`, Stable tier) and `ContractModel`'s root-relative ones, whichever a caller already has on hand. */
54
+ interface ExpiryBearingContract {
55
+ readonly file: string;
56
+ readonly exportName: string;
57
+ readonly expiresAt: string | undefined;
58
+ readonly variables: readonly {
59
+ readonly key: string;
60
+ readonly expiresAt: string | undefined;
61
+ }[];
62
+ }
63
+ /**
64
+ * Computes every contract- or variable-level `expiresAt` within `expiringWithinDays` of `now`, sorted soonest-first.
65
+ */
66
+ export declare function computeExpiringEntries(contracts: readonly ExpiryBearingContract[], expiringWithinDays: number, now: Date): ExpiringEntry[];
67
+ /**
68
+ * Same data `renderCatalog()` renders to Markdown for one variable, reshaped for JSON/
69
+ * programmatic consumers instead of prose.
70
+ *
71
+ * @see `ContractModelVariable` (`contract-model.ts`) -- this same declared variable's canonical
72
+ * starting point. Plain reference, not `{@link}`: this type is intentionally not part of the
73
+ * public surface (see `typedoc.json`'s `intentionallyNotExported`).
74
+ */
75
+ interface CatalogVariable extends EnvGovernanceFields {
76
+ readonly description: string | undefined;
77
+ readonly refreshInstructions: string | undefined;
78
+ readonly setupInstructions: string | undefined;
79
+ readonly required: boolean | undefined;
80
+ readonly hasDefault: boolean;
81
+ readonly hasProcessor: boolean;
82
+ readonly processorReturnType: string | undefined;
83
+ readonly hasValidator: boolean;
84
+ readonly documented: boolean;
85
+ /** The variable's declared validation context, if any -- see ADR 0022. Participation data, not documentation: describes when `validateEnv()` processes this variable, not who may access it or what a bundler includes. */
86
+ readonly context: string | undefined;
87
+ /** The `evidence` sub-object from this variable's linked documentation -- re-verified every run, unlike every declared-only field above. See ADR 0037. */
88
+ readonly evidence: DiscoveredVariableEvidence | undefined;
89
+ }
90
+ export interface CatalogContract extends EnvGovernanceFields {
91
+ readonly file: string;
92
+ readonly exportName: string;
93
+ readonly contractName: string;
94
+ readonly active: boolean;
95
+ readonly documented: boolean;
96
+ readonly category: string | undefined;
97
+ readonly exclusiveGroup: string | undefined;
98
+ /** Keyed by variable name -- unique within one contract (a schema
99
+ * object-literal property name), unlike `contractName` at the top level. */
100
+ readonly variables: Readonly<Record<string, CatalogVariable>>;
101
+ }
102
+ /**
103
+ * Same data `renderCatalog()` renders to Markdown, reshaped for JSON/
104
+ * programmatic consumers instead of prose. See `GenerateDocumentationResult.catalog`.
105
+ */
106
+ export declare function buildCatalog(contracts: readonly ContractModelContract[]): CatalogContract[];
107
+ /** Every variable key that appeared as a catalog heading in a previously-generated docs file. Exported for testing. */
108
+ export declare function extractPreviouslyDocumentedKeys(previousContent: string): Set<string>;
109
+ /**
110
+ * Every variable key that was documented under an *active* contract in a
111
+ * previously-generated docs file -- walks the same `- Active: yes/no`
112
+ * marker `renderCatalog` always emits immediately after each `## <contract>`
113
+ * heading, so a key already inactive last time (a permanently-dormant
114
+ * contract, e.g. behind an unused feature flag) is excluded even though it
115
+ * still appears as a `### \`KEY\`` heading. Exported for testing.
116
+ */
117
+ export declare function extractPreviouslyActiveKeys(previousContent: string): Set<string>;
118
+ /** Every number the security review reports, as structured data instead of only rendered Markdown text. */
119
+ export interface SecurityReviewCounters {
120
+ readonly totalContracts: number;
121
+ readonly totalVariableDeclarations: number;
122
+ readonly activeVariableDeclarations: number;
123
+ readonly uniqueVariableNames: number;
124
+ readonly expiresAtSetCount: number;
125
+ readonly expiredCount: number;
126
+ readonly expiringSoonCount: number;
127
+ readonly requiredCount: number;
128
+ readonly refreshInstructionsCount: number;
129
+ readonly noOwnerCount: number;
130
+ readonly duplicateVariableNameCount: number;
131
+ readonly undocumentedContractCount: number;
132
+ readonly undocumentedVariableCount: number;
133
+ }
134
+ /**
135
+ * Computes every number `renderSecurityReview()` reports, as real data.
136
+ *
137
+ * @remarks
138
+ * Previously this arithmetic lived entirely inside the renderer as closure
139
+ * locals that only ever became interpolated Markdown text -- no exported
140
+ * type backed any of it, so nothing downstream (the `--json` envelope, a CI
141
+ * gate, a future Finding Model adapter) could consume it as data. Extracted
142
+ * so it can be reused wherever these facts are needed, not just prose.
143
+ */
144
+ export declare function computeSecurityReviewCounters(contracts: readonly ContractModelContract[], expiringWithinDays: number, now: Date, undocumentedContractCount: number, undocumentedVariableCount: number): SecurityReviewCounters;
145
+ /**
146
+ * Renders the full docs artifact: header + change summary + table of
147
+ * contents, then the comprehensive catalog, ownership matrix (if used),
148
+ * dependency graph, lifecycle report, and a security review.
149
+ *
150
+ * @remarks
151
+ * Documents everything discovered, active or not, same scope as the catalog always
152
+ * had. Fully regenerated every run -- unlike `.env.example`, nothing here is
153
+ * meant to be hand-edited, so there's no "never overwrite" behavior.
154
+ *
155
+ * `contracts` is `ContractModel`'s own shape (`file` root-relative and
156
+ * POSIX-separated already, per that model's convention) -- there is no
157
+ * separate `root` parameter to resolve against, unlike this function's
158
+ * pre-ADR-0038 signature.
159
+ */
160
+ export declare function renderDocs(contracts: readonly ContractModelContract[], options: RenderDocsOptions): string;
161
+ /**
162
+ * Normalizes every wall-clock-relative substring `renderDocs()` can produce
163
+ * -- not just the single `_Generated ..._` timestamp line, but also the
164
+ * lifecycle report's `(**Xd remaining**)`/`(**expired Xd ago**)` annotations
165
+ * and the security review's "Already expired"/"Expiring within N days"
166
+ * counts -- so two renders of the *same* input, taken on different days,
167
+ * compare equal. `check-artifacts.ts`'s drift comparison and the examples
168
+ * golden-file test harness (`test/support/example-runner.ts`) both need
169
+ * exactly this, not just the timestamp line alone: any contract with a near-term
170
+ * `expiresAt` renders day-relative text that would otherwise make `--check`
171
+ * (or a golden-file comparison) report false drift purely because real time
172
+ * passed between generation and comparison.
173
+ */
174
+ export declare function normalizeDocsForComparison(content: string): string;
175
+ export {};
176
+ //# sourceMappingURL=docs.d.ts.map