@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.
- package/LICENSE +21 -0
- package/README.md +279 -0
- package/dist/.dts/build/assemble-project.d.ts +47 -0
- package/dist/.dts/build/assemble-project.d.ts.map +1 -0
- package/dist/.dts/build/change-model.d.ts +62 -0
- package/dist/.dts/build/change-model.d.ts.map +1 -0
- package/dist/.dts/build/check-artifacts.d.ts +48 -0
- package/dist/.dts/build/check-artifacts.d.ts.map +1 -0
- package/dist/.dts/build/citation-verification.d.ts +62 -0
- package/dist/.dts/build/citation-verification.d.ts.map +1 -0
- package/dist/.dts/build/compatibility.d.ts +76 -0
- package/dist/.dts/build/compatibility.d.ts.map +1 -0
- package/dist/.dts/build/contract-model.d.ts +92 -0
- package/dist/.dts/build/contract-model.d.ts.map +1 -0
- package/dist/.dts/build/deep-equal.d.ts +9 -0
- package/dist/.dts/build/deep-equal.d.ts.map +1 -0
- package/dist/.dts/build/deep-freeze.d.ts +20 -0
- package/dist/.dts/build/deep-freeze.d.ts.map +1 -0
- package/dist/.dts/build/dependency-graph.d.ts +168 -0
- package/dist/.dts/build/dependency-graph.d.ts.map +1 -0
- package/dist/.dts/build/dependency-model.d.ts +79 -0
- package/dist/.dts/build/dependency-model.d.ts.map +1 -0
- package/dist/.dts/build/discover.d.ts +25 -0
- package/dist/.dts/build/discover.d.ts.map +1 -0
- package/dist/.dts/build/display-path.d.ts +24 -0
- package/dist/.dts/build/display-path.d.ts.map +1 -0
- package/dist/.dts/build/docs.d.ts +176 -0
- package/dist/.dts/build/docs.d.ts.map +1 -0
- package/dist/.dts/build/env-example.d.ts +85 -0
- package/dist/.dts/build/env-example.d.ts.map +1 -0
- package/dist/.dts/build/errors.d.ts +78 -0
- package/dist/.dts/build/errors.d.ts.map +1 -0
- package/dist/.dts/build/evidence-cache.d.ts +74 -0
- package/dist/.dts/build/evidence-cache.d.ts.map +1 -0
- package/dist/.dts/build/evidence-model.d.ts +50 -0
- package/dist/.dts/build/evidence-model.d.ts.map +1 -0
- package/dist/.dts/build/evidence-reference.d.ts +67 -0
- package/dist/.dts/build/evidence-reference.d.ts.map +1 -0
- package/dist/.dts/build/evidence-snapshot.d.ts +123 -0
- package/dist/.dts/build/evidence-snapshot.d.ts.map +1 -0
- package/dist/.dts/build/exclusive-group.d.ts +19 -0
- package/dist/.dts/build/exclusive-group.d.ts.map +1 -0
- package/dist/.dts/build/finding-model.d.ts +79 -0
- package/dist/.dts/build/finding-model.d.ts.map +1 -0
- package/dist/.dts/build/generate-documentation.d.ts +176 -0
- package/dist/.dts/build/generate-documentation.d.ts.map +1 -0
- package/dist/.dts/build/generate-env-artifacts.d.ts +176 -0
- package/dist/.dts/build/generate-env-artifacts.d.ts.map +1 -0
- package/dist/.dts/build/generate-evidence.d.ts +77 -0
- package/dist/.dts/build/generate-evidence.d.ts.map +1 -0
- package/dist/.dts/build/generate-manifest.d.ts +101 -0
- package/dist/.dts/build/generate-manifest.d.ts.map +1 -0
- package/dist/.dts/build/generate-usage.d.ts +95 -0
- package/dist/.dts/build/generate-usage.d.ts.map +1 -0
- package/dist/.dts/build/generated-banner.d.ts +52 -0
- package/dist/.dts/build/generated-banner.d.ts.map +1 -0
- package/dist/.dts/build/glob.d.ts +18 -0
- package/dist/.dts/build/glob.d.ts.map +1 -0
- package/dist/.dts/build/governance-fields.d.ts +34 -0
- package/dist/.dts/build/governance-fields.d.ts.map +1 -0
- package/dist/.dts/build/humanize-key.d.ts +14 -0
- package/dist/.dts/build/humanize-key.d.ts.map +1 -0
- package/dist/.dts/build/index.d.ts +107 -0
- package/dist/.dts/build/index.d.ts.map +1 -0
- package/dist/.dts/build/lifecycle-model.d.ts +64 -0
- package/dist/.dts/build/lifecycle-model.d.ts.map +1 -0
- package/dist/.dts/build/link.d.ts +215 -0
- package/dist/.dts/build/link.d.ts.map +1 -0
- package/dist/.dts/build/literal-eval.d.ts +23 -0
- package/dist/.dts/build/literal-eval.d.ts.map +1 -0
- package/dist/.dts/build/live-expirations.d.ts +47 -0
- package/dist/.dts/build/live-expirations.d.ts.map +1 -0
- package/dist/.dts/build/manifest-snapshot.d.ts +229 -0
- package/dist/.dts/build/manifest-snapshot.d.ts.map +1 -0
- package/dist/.dts/build/manifest.d.ts +31 -0
- package/dist/.dts/build/manifest.d.ts.map +1 -0
- package/dist/.dts/build/map-utils.d.ts +8 -0
- package/dist/.dts/build/map-utils.d.ts.map +1 -0
- package/dist/.dts/build/ownership-model.d.ts +57 -0
- package/dist/.dts/build/ownership-model.d.ts.map +1 -0
- package/dist/.dts/build/parse.d.ts +199 -0
- package/dist/.dts/build/parse.d.ts.map +1 -0
- package/dist/.dts/build/reference-projections.d.ts +156 -0
- package/dist/.dts/build/reference-projections.d.ts.map +1 -0
- package/dist/.dts/build/resolution/resolve-import.d.ts +53 -0
- package/dist/.dts/build/resolution/resolve-import.d.ts.map +1 -0
- package/dist/.dts/build/resolution/resolve-package-schema.d.ts +83 -0
- package/dist/.dts/build/resolution/resolve-package-schema.d.ts.map +1 -0
- package/dist/.dts/build/resolution/resolve-tsconfig-paths.d.ts +101 -0
- package/dist/.dts/build/resolution/resolve-tsconfig-paths.d.ts.map +1 -0
- package/dist/.dts/build/resolution/resolve-within-root.d.ts +35 -0
- package/dist/.dts/build/resolution/resolve-within-root.d.ts.map +1 -0
- package/dist/.dts/build/resolve-import.d.ts +50 -0
- package/dist/.dts/build/resolve-import.d.ts.map +1 -0
- package/dist/.dts/build/resolve-package-schema.d.ts +99 -0
- package/dist/.dts/build/resolve-package-schema.d.ts.map +1 -0
- package/dist/.dts/build/resolve-tsconfig-paths.d.ts +100 -0
- package/dist/.dts/build/resolve-tsconfig-paths.d.ts.map +1 -0
- package/dist/.dts/build/resolve-within-root.d.ts +35 -0
- package/dist/.dts/build/resolve-within-root.d.ts.map +1 -0
- package/dist/.dts/build/sarif.d.ts +66 -0
- package/dist/.dts/build/sarif.d.ts.map +1 -0
- package/dist/.dts/build/scan-dependencies.d.ts +47 -0
- package/dist/.dts/build/scan-dependencies.d.ts.map +1 -0
- package/dist/.dts/build/sort-by-identity.d.ts +14 -0
- package/dist/.dts/build/sort-by-identity.d.ts.map +1 -0
- package/dist/.dts/build/source-position.d.ts +69 -0
- package/dist/.dts/build/source-position.d.ts.map +1 -0
- package/dist/.dts/build/tool-version.d.ts +8 -0
- package/dist/.dts/build/tool-version.d.ts.map +1 -0
- package/dist/.dts/build/types.d.ts +53 -0
- package/dist/.dts/build/types.d.ts.map +1 -0
- package/dist/.dts/build/usage-report.d.ts +124 -0
- package/dist/.dts/build/usage-report.d.ts.map +1 -0
- package/dist/.dts/cli/filesystem.d.ts +3 -0
- package/dist/.dts/cli/filesystem.d.ts.map +1 -0
- package/dist/.dts/eslint-plugin/glob.d.ts +18 -0
- package/dist/.dts/eslint-plugin/glob.d.ts.map +1 -0
- package/dist/.dts/eslint-plugin/index.d.ts +27 -0
- package/dist/.dts/eslint-plugin/index.d.ts.map +1 -0
- package/dist/.dts/eslint-plugin/no-node-fs.d.ts +25 -0
- package/dist/.dts/eslint-plugin/no-node-fs.d.ts.map +1 -0
- package/dist/.dts/eslint-plugin/no-raw-process-env.d.ts +23 -0
- package/dist/.dts/eslint-plugin/no-raw-process-env.d.ts.map +1 -0
- package/dist/.dts/evidence/define-projection.d.ts +51 -0
- package/dist/.dts/evidence/define-projection.d.ts.map +1 -0
- package/dist/.dts/evidence/index.d.ts +23 -0
- package/dist/.dts/evidence/index.d.ts.map +1 -0
- package/dist/.dts/helpers/index.d.ts +135 -0
- package/dist/.dts/helpers/index.d.ts.map +1 -0
- package/dist/.dts/helpers/processors.d.ts +32 -0
- package/dist/.dts/helpers/processors.d.ts.map +1 -0
- package/dist/.dts/helpers/validators.d.ts +68 -0
- package/dist/.dts/helpers/validators.d.ts.map +1 -0
- package/dist/.dts/node/index.d.ts +2 -0
- package/dist/.dts/node/index.d.ts.map +1 -0
- package/dist/.dts/runtime/cache.d.ts +20 -0
- package/dist/.dts/runtime/cache.d.ts.map +1 -0
- package/dist/.dts/runtime/create.d.ts +20 -0
- package/dist/.dts/runtime/create.d.ts.map +1 -0
- package/dist/.dts/runtime/document.d.ts +181 -0
- package/dist/.dts/runtime/document.d.ts.map +1 -0
- package/dist/.dts/runtime/errors.d.ts +55 -0
- package/dist/.dts/runtime/errors.d.ts.map +1 -0
- package/dist/.dts/runtime/index.d.ts +24 -0
- package/dist/.dts/runtime/index.d.ts.map +1 -0
- package/dist/.dts/runtime/registry.d.ts +12 -0
- package/dist/.dts/runtime/registry.d.ts.map +1 -0
- package/dist/.dts/runtime/reset.d.ts +8 -0
- package/dist/.dts/runtime/reset.d.ts.map +1 -0
- package/dist/.dts/runtime/types.d.ts +175 -0
- package/dist/.dts/runtime/types.d.ts.map +1 -0
- package/dist/.dts/runtime/validate.d.ts +14 -0
- package/dist/.dts/runtime/validate.d.ts.map +1 -0
- package/dist/build.cjs +83 -0
- package/dist/build.cjs.map +1 -0
- package/dist/build.d.cts +1 -0
- package/dist/build.d.ts +1 -0
- package/dist/build.js +19 -0
- package/dist/build.js.map +1 -0
- package/dist/cli/index.js +134 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/eslint-plugin/index.cjs +12 -0
- package/dist/eslint-plugin/index.cjs.map +1 -0
- package/dist/eslint-plugin/index.d.cts +1 -0
- package/dist/eslint-plugin/index.d.ts +1 -0
- package/dist/eslint-plugin/index.js +5 -0
- package/dist/eslint-plugin/index.js.map +1 -0
- package/dist/evidence.cjs +7 -0
- package/dist/evidence.cjs.map +1 -0
- package/dist/evidence.d.cts +1 -0
- package/dist/evidence.d.ts +1 -0
- package/dist/evidence.js +5 -0
- package/dist/evidence.js.map +1 -0
- package/dist/helpers.cjs +8 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/helpers.d.cts +1 -0
- package/dist/helpers.d.ts +1 -0
- package/dist/helpers.js +5 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.cjs +15 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/node.cjs +13 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +1 -0
- package/dist/node.d.ts +1 -0
- package/dist/node.js +7 -0
- package/dist/node.js.map +1 -0
- package/package.json +183 -0
- package/schemas/contract-model.schema.json +321 -0
- package/schemas/env-cap-report.schema.json +2369 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import type { DiscoveredSchemaVariable, DiscoveredVariableEvidence, ParseWarning } from "./parse.js";
|
|
2
|
+
import type { EnvGovernanceFields } from "./governance-fields.js";
|
|
3
|
+
import type { ImportResolutionContext } from "./resolution/resolve-import.js";
|
|
4
|
+
import type { PackageOrigin } from "./resolution/resolve-package-schema.js";
|
|
5
|
+
import type { SourcePosition } from "./source-position.js";
|
|
6
|
+
/** One schema variable, merged with its linked `documentEnv()` documentation (if any). */
|
|
7
|
+
/**
|
|
8
|
+
* One schema variable merged with its linked `documentEnv()` documentation. Its
|
|
9
|
+
* governance fields (`owner` .. `metadata`) are {@link EnvGovernanceFields} --
|
|
10
|
+
* each an individual-variable override of the contract's own value, from the
|
|
11
|
+
* linked `documentEnv()` call's matching `variables` entry, or `undefined`.
|
|
12
|
+
*/
|
|
13
|
+
export interface DiscoveredVariable extends DiscoveredSchemaVariable, EnvGovernanceFields {
|
|
14
|
+
/** From the linked `documentEnv()` call's matching `variables` entry, if any. */
|
|
15
|
+
readonly description: string | undefined;
|
|
16
|
+
/** From the linked `documentEnv()` call's matching `variables` entry, if any. */
|
|
17
|
+
readonly refreshInstructions: string | undefined;
|
|
18
|
+
/** From the linked `documentEnv()` call's matching `variables` entry, if any. */
|
|
19
|
+
readonly setupInstructions: string | undefined;
|
|
20
|
+
/** From the linked `documentEnv()` call's matching `variables` entry, if any. */
|
|
21
|
+
readonly required: boolean | undefined;
|
|
22
|
+
/** From the linked `documentEnv()` call's matching `variables` entry, if any. */
|
|
23
|
+
readonly deprecated: boolean | undefined;
|
|
24
|
+
/** From the linked `documentEnv()` call's matching `variables` entry, if any. */
|
|
25
|
+
readonly deprecatedReason: string | undefined;
|
|
26
|
+
/** From the linked `documentEnv()` call's matching `variables` entry, if any. */
|
|
27
|
+
readonly removeBy: string | undefined;
|
|
28
|
+
/** From the linked `documentEnv()` call's matching `variables` entry, if any -- the previous variable name this one renames, if this declaration is the result of a rename. */
|
|
29
|
+
readonly renamedFrom: string | undefined;
|
|
30
|
+
/** The linked `documentEnv()` entry's `evidence` sub-object -- the re-verified-every-run half of this variable's documentation, deliberately not flattened in alongside the declared-only fields above. See {@link runtime.VariableEvidenceDocs} and ADR 0037. */
|
|
31
|
+
readonly evidence: DiscoveredVariableEvidence | undefined;
|
|
32
|
+
/** Whether this specific key had a matching entry in the linked `documentEnv()` call, if any. */
|
|
33
|
+
readonly documented: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** One `createEnv()` contract, merged with its linked `documentEnv()` documentation (if any). Its governance fields (`owner` .. `metadata`) are {@link EnvGovernanceFields} -- contract-level defaults that individual variables may override. */
|
|
36
|
+
export interface DiscoveredContract extends EnvGovernanceFields {
|
|
37
|
+
/** Absolute path of the file declaring the `createEnv()` call. */
|
|
38
|
+
readonly file: string;
|
|
39
|
+
/** The binding name the `createEnv()` result is exported as. */
|
|
40
|
+
readonly exportName: string;
|
|
41
|
+
/** Resolved display name: linked `documentEnv()`'s `name`, else `createEnv()`'s own `name` option, else `exportName`. */
|
|
42
|
+
readonly contractName: string;
|
|
43
|
+
/** From the linked `documentEnv()`'s `active` option. Defaults to `true` when omitted or undocumented. */
|
|
44
|
+
readonly active: boolean;
|
|
45
|
+
/** From the linked `documentEnv()` call, if any. */
|
|
46
|
+
readonly category: string | undefined;
|
|
47
|
+
/** From the linked `documentEnv()` call, if any -- see {@link runtime.ContractDocs.exclusiveGroup}. */
|
|
48
|
+
readonly exclusiveGroup: string | undefined;
|
|
49
|
+
/** From the linked `documentEnv()` call, if any. */
|
|
50
|
+
readonly deprecated: boolean | undefined;
|
|
51
|
+
/** From the linked `documentEnv()` call, if any. */
|
|
52
|
+
readonly deprecatedReason: string | undefined;
|
|
53
|
+
/** Every variable declared in the schema, merged with its linked documentation. */
|
|
54
|
+
readonly variables: readonly DiscoveredVariable[];
|
|
55
|
+
/** Whether *any* `documentEnv()` call is linked to this contract at all. */
|
|
56
|
+
readonly documented: boolean;
|
|
57
|
+
/** Set when this contract was discovered via an allow-listed package's
|
|
58
|
+
* declared schema entry point rather than local discovery -- the bare
|
|
59
|
+
* package name `renderManifest()` must import from instead of computing a
|
|
60
|
+
* relative path to the (analysis-only) resolved file. See ADR 0014. */
|
|
61
|
+
readonly packageOrigin: PackageOrigin | undefined;
|
|
62
|
+
/** Where this contract's `createEnv(...)` call is declared. Always present -- every discovered contract has one, by definition. See ADR 0036. */
|
|
63
|
+
readonly declaration: SourcePosition;
|
|
64
|
+
/** Where this contract's `documentEnv(...)` call is declared, if one exists. Undefined for a contract that's never been documented. See ADR 0036. */
|
|
65
|
+
readonly documentation: SourcePosition | undefined;
|
|
66
|
+
}
|
|
67
|
+
/** A `documentEnv()` call that could not be statically linked back to a `createEnv()` schema. */
|
|
68
|
+
export interface UnresolvedLink {
|
|
69
|
+
/** Absolute path of the file containing the unlinkable call. */
|
|
70
|
+
readonly file: string;
|
|
71
|
+
/** Human-readable explanation of why the link couldn't be resolved. */
|
|
72
|
+
readonly reason: string;
|
|
73
|
+
}
|
|
74
|
+
/** The full result of {@link linkFiles}: every linked contract, plus every category of thing that didn't link cleanly. */
|
|
75
|
+
export interface LinkResult {
|
|
76
|
+
/** Every `createEnv()` contract found, merged with its documentation. */
|
|
77
|
+
readonly contracts: readonly DiscoveredContract[];
|
|
78
|
+
/** Parse-time warnings collected across every analyzed file. */
|
|
79
|
+
readonly warnings: readonly ParseWarning[];
|
|
80
|
+
/** `documentEnv()` calls that couldn't be statically linked to a schema. */
|
|
81
|
+
readonly unresolvedLinks: readonly UnresolvedLink[];
|
|
82
|
+
/** Contracts with no linked `documentEnv()` call at all. */
|
|
83
|
+
readonly undocumentedContracts: readonly {
|
|
84
|
+
/** Absolute path of the file declaring the contract. */
|
|
85
|
+
readonly file: string;
|
|
86
|
+
/** The contract's exported binding name. */
|
|
87
|
+
readonly exportName: string;
|
|
88
|
+
}[];
|
|
89
|
+
/** Schema variables with no matching entry in their contract's linked documentation. */
|
|
90
|
+
readonly undocumentedVariables: readonly {
|
|
91
|
+
/** Absolute path of the file declaring the contract. */
|
|
92
|
+
readonly file: string;
|
|
93
|
+
/** The contract's exported binding name. */
|
|
94
|
+
readonly exportName: string;
|
|
95
|
+
/** The undocumented environment variable name. */
|
|
96
|
+
readonly key: string;
|
|
97
|
+
}[];
|
|
98
|
+
/** Documented variable entries with no matching schema variable (the schema key was removed or renamed). */
|
|
99
|
+
readonly staleDocEntries: readonly {
|
|
100
|
+
/** Absolute path of the file declaring the contract. */
|
|
101
|
+
readonly file: string;
|
|
102
|
+
/** The contract's exported binding name. */
|
|
103
|
+
readonly exportName: string;
|
|
104
|
+
/** The stale documented variable name. */
|
|
105
|
+
readonly key: string;
|
|
106
|
+
}[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Parses every discovered file, then resolves and links `createEnv`/
|
|
110
|
+
* `documentEnv` calls into the merged, docs-enriched contract shape the rest
|
|
111
|
+
* of the generator (`compatibility.ts`, `exclusive-group.ts`, `manifest.ts`,
|
|
112
|
+
* `docs.ts`, `env-example.ts`) consumes.
|
|
113
|
+
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* Cross-file linking is deliberately narrow (see `resolveImportSpecifier`):
|
|
116
|
+
* a `documentEnv()` call's schema reference resolves either to a `const` in
|
|
117
|
+
* its own file, to a directly-imported named export of another file's
|
|
118
|
+
* `const`, or (since ADR 0014) to an allow-listed package's declared schema
|
|
119
|
+
* entry point. Anything else -- a re-export barrel, a namespace import, an
|
|
120
|
+
* unlisted bare package specifier -- becomes an `unresolvedLinks` entry
|
|
121
|
+
* rather than a throw or a guess, exactly like every other static-analysis
|
|
122
|
+
* boundary in this codebase.
|
|
123
|
+
*
|
|
124
|
+
* `packageOrigins` (from `resolveAllowlistedPackages()`) tags any discovered
|
|
125
|
+
* contract whose `file` matches a package-resolved path with that package's
|
|
126
|
+
* origin -- purely a lookup; `discoveredFiles` must already include those
|
|
127
|
+
* files (merged in by the caller via `mergeLocalAndPackageFiles()`).
|
|
128
|
+
*
|
|
129
|
+
* @param context - See `ImportResolutionContext`; drives how a resolved import specifier maps back to a file on disk.
|
|
130
|
+
*/
|
|
131
|
+
export declare function linkFiles(discoveredFiles: readonly string[], readFile: (filePath: string) => Promise<string>, context: ImportResolutionContext, packageOrigins?: ReadonlyMap<string, PackageOrigin>): Promise<LinkResult>;
|
|
132
|
+
/** Root-relative projection of a {@link DiscoveredContract}, as returned by {@link generateEnvManifest}/{@link generateDocumentation}. */
|
|
133
|
+
export interface DiscoveredContractSummary {
|
|
134
|
+
/** Root-relative, POSIX-separated file path. */
|
|
135
|
+
readonly file: string;
|
|
136
|
+
/** The binding name the `createEnv()` result is exported as. */
|
|
137
|
+
readonly exportName: string;
|
|
138
|
+
/** Resolved display name (see {@link DiscoveredContract.contractName}). */
|
|
139
|
+
readonly contractName: string;
|
|
140
|
+
/** Number of variables declared in this contract's schema. */
|
|
141
|
+
readonly variableCount: number;
|
|
142
|
+
/** Whether this contract was included in the generated manifest (`active` defaults to true). */
|
|
143
|
+
readonly active: boolean;
|
|
144
|
+
/** Whether a `documentEnv()` call is linked to this contract. */
|
|
145
|
+
readonly documented: boolean;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Projects a {@link DiscoveredContract} (absolute `file`) into the root-relative
|
|
149
|
+
* summary shape returned by {@link generateEnvManifest}/{@link generateDocumentation}.
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* Pulled out here, rather than duplicated in both, since it's a pure
|
|
153
|
+
* projection with no manifest- or docs-specific behavior.
|
|
154
|
+
*/
|
|
155
|
+
export declare function summarizeContract(contract: DiscoveredContract, root: string): DiscoveredContractSummary;
|
|
156
|
+
/**
|
|
157
|
+
* A variable's owner, falling back to its contract's default when the
|
|
158
|
+
* variable itself doesn't set one.
|
|
159
|
+
*
|
|
160
|
+
* @remarks
|
|
161
|
+
* The one place this resolution rule should live -- see ADR 0028. Every
|
|
162
|
+
* caller that needs "who owns this variable" (the docs Catalog/ownership
|
|
163
|
+
* matrix/security review, and, as of ADR 0028, the usage report's
|
|
164
|
+
* variable-level ownership findings) must go through this, not
|
|
165
|
+
* `variable.owner` or `contract.owner` alone, so two call sites can never
|
|
166
|
+
* again disagree about who owns a variable the way `docs.ts` and
|
|
167
|
+
* `usage-report.ts` once did.
|
|
168
|
+
*
|
|
169
|
+
* Structurally typed (not pinned to `DiscoveredContract`/`DiscoveredVariable`)
|
|
170
|
+
* so the same one resolution rule also serves `ContractModelContract`/
|
|
171
|
+
* `ContractModelVariable` (`contract-model.ts`) -- both shapes carry the same
|
|
172
|
+
* field, and this rule must never have two independent implementations.
|
|
173
|
+
*/
|
|
174
|
+
export declare function effectiveOwner(contract: {
|
|
175
|
+
readonly owner: string | undefined;
|
|
176
|
+
}, variable: {
|
|
177
|
+
readonly owner: string | undefined;
|
|
178
|
+
}): string | undefined;
|
|
179
|
+
/** A variable's sensitivity, falling back to its contract's default -- see {@link effectiveOwner}. */
|
|
180
|
+
export declare function effectiveSensitivity(contract: {
|
|
181
|
+
readonly sensitivity: string | undefined;
|
|
182
|
+
}, variable: {
|
|
183
|
+
readonly sensitivity: string | undefined;
|
|
184
|
+
}): string | undefined;
|
|
185
|
+
/** A variable's purpose, falling back to its contract's default -- see {@link effectiveOwner}. */
|
|
186
|
+
export declare function effectivePurpose(contract: {
|
|
187
|
+
readonly purpose: string | undefined;
|
|
188
|
+
}, variable: {
|
|
189
|
+
readonly purpose: string | undefined;
|
|
190
|
+
}): string | undefined;
|
|
191
|
+
/** A variable's legal basis, falling back to its contract's default -- see {@link effectiveOwner}. */
|
|
192
|
+
export declare function effectiveLegalBasis(contract: {
|
|
193
|
+
readonly legalBasis: string | undefined;
|
|
194
|
+
}, variable: {
|
|
195
|
+
readonly legalBasis: string | undefined;
|
|
196
|
+
}): string | undefined;
|
|
197
|
+
/** A variable's retention policy, falling back to its contract's default -- see {@link effectiveOwner}. */
|
|
198
|
+
export declare function effectiveRetention(contract: {
|
|
199
|
+
readonly retention: string | undefined;
|
|
200
|
+
}, variable: {
|
|
201
|
+
readonly retention: string | undefined;
|
|
202
|
+
}): string | undefined;
|
|
203
|
+
/** A variable's data residency, falling back to its contract's default -- see {@link effectiveOwner}. */
|
|
204
|
+
export declare function effectiveDataResidency(contract: {
|
|
205
|
+
readonly dataResidency: string | readonly string[] | undefined;
|
|
206
|
+
}, variable: {
|
|
207
|
+
readonly dataResidency: string | readonly string[] | undefined;
|
|
208
|
+
}): string | readonly string[] | undefined;
|
|
209
|
+
/** A variable's audit-required assertion, falling back to its contract's default -- see {@link effectiveOwner}. */
|
|
210
|
+
export declare function effectiveAuditRequired(contract: {
|
|
211
|
+
readonly auditRequired: boolean | undefined;
|
|
212
|
+
}, variable: {
|
|
213
|
+
readonly auditRequired: boolean | undefined;
|
|
214
|
+
}): boolean | undefined;
|
|
215
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/build/link.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAG1B,YAAY,EAEb,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAGjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;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AAE,EAC5E,QAAQ,EAAE;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CAAE,GAC3E,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAExC;AAED,mHAAmH;AACnH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE;IAAE,QAAQ,CAAC,aAAa,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,EACzD,QAAQ,EAAE;IAAE,QAAQ,CAAC,aAAa,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,GACxD,OAAO,GAAG,SAAS,CAErB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
/**
|
|
3
|
+
* The result of a literal evaluation: either a real JS value, or `{ ok: false }` when the AST
|
|
4
|
+
* expression wasn't a literal (or contained a non-literal element/property).
|
|
5
|
+
*/
|
|
6
|
+
export type LiteralEvalResult = {
|
|
7
|
+
ok: true;
|
|
8
|
+
value: unknown;
|
|
9
|
+
} | {
|
|
10
|
+
ok: false;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Structurally evaluates a *literal* AST expression (strings, numbers, booleans, null, arrays,
|
|
14
|
+
* and object literals of the same) into a real JS value -- without ever executing code.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Anything that isn't a literal (identifiers, calls, imports, template expressions with
|
|
18
|
+
* interpolation) resolves to `{ ok: false }` rather than being guessed at.
|
|
19
|
+
*/
|
|
20
|
+
export declare function evaluateLiteral(node: ts.Expression): LiteralEvalResult;
|
|
21
|
+
/** Reads a property name statically (identifier, string literal, or numeric literal) -- a computed key (e.g. `[expr]`) resolves to `undefined` rather than being guessed at. */
|
|
22
|
+
export declare function getStaticPropertyName(name: ts.PropertyName): string | undefined;
|
|
23
|
+
//# sourceMappingURL=literal-eval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal-eval.d.ts","sourceRoot":"","sources":["../../../src/build/literal-eval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAAA;AAE5E;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,GAAG,iBAAiB,CA4CtE;AAED,gLAAgL;AAChL,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,GAAG,MAAM,GAAG,SAAS,CAK/E"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DiscoveredContract } from "./link.js";
|
|
2
|
+
/**
|
|
3
|
+
* Supplies expiration metadata from a live source (a secrets manager, an
|
|
4
|
+
* internal inventory API, ...) as a post-discovery override -- the one
|
|
5
|
+
* sanctioned escape hatch from static-only `expiresAt`.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Invoked exactly once per generation run, from the orchestration layer, after AST discovery/
|
|
9
|
+
* linking completes and before documentation is rendered. Never invoked
|
|
10
|
+
* during AST parsing or runtime validation -- see ADR 0012 for why a
|
|
11
|
+
* function embedded in a schema file itself was rejected instead.
|
|
12
|
+
*/
|
|
13
|
+
export type LiveExpirationDates = (variableNames: readonly string[]) => Promise<Readonly<Record<string, string>>>;
|
|
14
|
+
/**
|
|
15
|
+
* Every unique variable key across every linked contract's `variables`.
|
|
16
|
+
* Contract-level `expiresAt` is out of scope for override -- the callback is
|
|
17
|
+
* keyed by variable name, not contract name.
|
|
18
|
+
*/
|
|
19
|
+
export declare function collectVariableNames(contracts: readonly DiscoveredContract[]): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Applies `overrides` onto a fresh copy of `contracts` -- every contract and
|
|
22
|
+
* every variable (and their nested `metadata`/`extra` records) is rebuilt
|
|
23
|
+
* into a new object, never the original reference, so the returned structure
|
|
24
|
+
* shares no mutable object identity with `contracts` at any depth.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* A key absent from `overrides`, or present but not a `parseIsoDate`-parseable
|
|
28
|
+
* ISO-8601 string, leaves that variable's static `expiresAt` untouched --
|
|
29
|
+
* same "warn/skip, never guess" policy the rest of the generator uses for
|
|
30
|
+
* malformed data. Contract-level `expiresAt` is never touched; only
|
|
31
|
+
* variable-level `expiresAt` is in scope for override.
|
|
32
|
+
*/
|
|
33
|
+
export declare function applyLiveExpirationOverrides(contracts: readonly DiscoveredContract[], overrides: Readonly<Record<string, string>>): readonly DiscoveredContract[];
|
|
34
|
+
/**
|
|
35
|
+
* Orchestration entry point -- the only place `liveExpirationDates` is ever invoked.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* No-ops (returns the exact same array reference, zero invocations)
|
|
39
|
+
* when `liveExpirationDates` is undefined, which is what guarantees "omitted ->
|
|
40
|
+
* behavior unchanged." Otherwise collects the unique discovered variable
|
|
41
|
+
* names, invokes the callback exactly once, applies the result, and
|
|
42
|
+
* deep-freezes the returned structure so it can never be mutated into
|
|
43
|
+
* affecting `contracts` (used elsewhere, e.g. by the manifest/usage passes in
|
|
44
|
+
* the same {@link generateEnvArtifacts} run) or anything else downstream.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveLiveExpirationDates(contracts: readonly DiscoveredContract[], liveExpirationDates: LiveExpirationDates | undefined): Promise<readonly DiscoveredContract[]>;
|
|
47
|
+
//# sourceMappingURL=live-expirations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-expirations.d.ts","sourceRoot":"","sources":["../../../src/build/live-expirations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAsB,MAAM,WAAW,CAAA;AAEvE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,aAAa,EAAE,SAAS,MAAM,EAAE,KAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;AAE9C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,kBAAkB,EAAE,GAAG,MAAM,EAAE,CAMvF;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,SAAS,kBAAkB,EAAE,EACxC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC1C,SAAS,kBAAkB,EAAE,CAM/B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAC9C,SAAS,EAAE,SAAS,kBAAkB,EAAE,EACxC,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,GACnD,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC,CAIxC"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import type { DiscoveredContract } from "./link.js";
|
|
2
|
+
import type { DiscoveredClassification, ParseWarning } from "./parse.js";
|
|
3
|
+
import type { DynamicAccessAssertion, SourcePosition } from "./source-position.js";
|
|
4
|
+
/**
|
|
5
|
+
* The manifest's own `.ts` output is deliberately metadata-free (imports +
|
|
6
|
+
* an array, see `manifest.ts`'s docstring) -- there is nothing in it for a
|
|
7
|
+
* later `generateEnvManifest()` run to read back and diff against. This
|
|
8
|
+
* module is the persisted, committed sidecar that makes "what changed in
|
|
9
|
+
* `documentEnv()` since last time" answerable at all. See ADR 0021.
|
|
10
|
+
*/
|
|
11
|
+
/** Bump only when a reader could misinterpret the new shape (a field changes
|
|
12
|
+
* type/meaning, or is removed) -- NOT for every additive field. Same
|
|
13
|
+
* discipline `src/cli/json.ts`'s `JSON_SCHEMA_VERSION` already documents;
|
|
14
|
+
* this format is meant to stay backwards-compatible across ordinary
|
|
15
|
+
* releases. */
|
|
16
|
+
export declare const MANIFEST_SNAPSHOT_SCHEMA_VERSION = 2;
|
|
17
|
+
export interface ManifestSnapshotVariable {
|
|
18
|
+
readonly key: string;
|
|
19
|
+
readonly description: string | undefined;
|
|
20
|
+
readonly owner: string | undefined;
|
|
21
|
+
readonly classification: DiscoveredClassification | undefined;
|
|
22
|
+
readonly expiresAt: string | undefined;
|
|
23
|
+
readonly refreshInstructions: string | undefined;
|
|
24
|
+
readonly setupInstructions: string | undefined;
|
|
25
|
+
readonly required: boolean | undefined;
|
|
26
|
+
readonly deprecated: boolean | undefined;
|
|
27
|
+
readonly deprecatedReason: string | undefined;
|
|
28
|
+
readonly removeBy: string | undefined;
|
|
29
|
+
readonly renamedFrom: string | undefined;
|
|
30
|
+
readonly purpose: string | undefined;
|
|
31
|
+
readonly legalBasis: string | undefined;
|
|
32
|
+
readonly retentionPolicy: string | undefined;
|
|
33
|
+
readonly dataResidency: string | readonly string[] | undefined;
|
|
34
|
+
readonly auditRequired: boolean | undefined;
|
|
35
|
+
readonly metadata: Readonly<Record<string, unknown>> | undefined;
|
|
36
|
+
readonly documented: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* One entry per {@link runtime.VariableDocs.dynamicAccess} citation whose
|
|
39
|
+
* cited file existed at snapshot-build time, each carrying a SHA-256 hex
|
|
40
|
+
* digest of that file's full content at that moment -- the committed
|
|
41
|
+
* baseline a later run's citation is compared against to tell "fresh" from
|
|
42
|
+
* "stale" (ADR 0037). A citation whose file doesn't exist at build time is
|
|
43
|
+
* simply omitted here, not recorded as an error -- `computeManifestChanges()`'s
|
|
44
|
+
* own live existence check is what reports a missing file, every run,
|
|
45
|
+
* independent of this stored baseline. `buildManifestSnapshot()` always
|
|
46
|
+
* populates this (as `[]` at minimum); typed `| undefined` because it's
|
|
47
|
+
* purely additive (no `MANIFEST_SNAPSHOT_SCHEMA_VERSION` bump), so a real
|
|
48
|
+
* snapshot committed before this field existed reads back as "ok" while
|
|
49
|
+
* genuinely lacking the key -- every reader must treat it as optional.
|
|
50
|
+
*/
|
|
51
|
+
readonly dynamicAccessSnapshots: readonly (SourcePosition & {
|
|
52
|
+
readonly acknowledgedContentHash: string;
|
|
53
|
+
})[] | undefined;
|
|
54
|
+
}
|
|
55
|
+
export interface ManifestSnapshotContract {
|
|
56
|
+
/** Root-relative, POSIX-separated -- matches `DiscoveredContractSummary.file`. */
|
|
57
|
+
readonly file: string;
|
|
58
|
+
readonly exportName: string;
|
|
59
|
+
readonly contractName: string;
|
|
60
|
+
readonly active: boolean;
|
|
61
|
+
readonly category: string | undefined;
|
|
62
|
+
readonly exclusiveGroup: string | undefined;
|
|
63
|
+
readonly owner: string | undefined;
|
|
64
|
+
readonly classification: DiscoveredClassification | undefined;
|
|
65
|
+
readonly expiresAt: string | undefined;
|
|
66
|
+
readonly deprecated: boolean | undefined;
|
|
67
|
+
readonly deprecatedReason: string | undefined;
|
|
68
|
+
readonly purpose: string | undefined;
|
|
69
|
+
readonly legalBasis: string | undefined;
|
|
70
|
+
readonly retentionPolicy: string | undefined;
|
|
71
|
+
readonly dataResidency: string | readonly string[] | undefined;
|
|
72
|
+
readonly auditRequired: boolean | undefined;
|
|
73
|
+
readonly metadata: Readonly<Record<string, unknown>> | undefined;
|
|
74
|
+
readonly variables: readonly ManifestSnapshotVariable[];
|
|
75
|
+
}
|
|
76
|
+
export interface ManifestSnapshot {
|
|
77
|
+
readonly schemaVersion: typeof MANIFEST_SNAPSHOT_SCHEMA_VERSION;
|
|
78
|
+
readonly contracts: readonly ManifestSnapshotContract[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Sorted deterministically (by file, then exportName, then variable key) so
|
|
82
|
+
* `JSON.stringify` output is stable and diffs cleanly in PRs. Scoped to
|
|
83
|
+
* **active** contracts only, matching `renderManifest()`'s own scope -- a
|
|
84
|
+
* contract flipping to `active: false` disappears from `manifest.ts` itself,
|
|
85
|
+
* so it disappears from this snapshot too.
|
|
86
|
+
*/
|
|
87
|
+
export declare function buildManifestSnapshot(activeContracts: readonly DiscoveredContract[], root: string, readFile: (filePath: string) => Promise<string>): Promise<ManifestSnapshot>;
|
|
88
|
+
/** Derives the sidecar snapshot path from a manifest's own output path (e.g. `src/generated/env.manifest.ts` -> `src/generated/env.manifest.snapshot.json`). */
|
|
89
|
+
export declare function manifestSnapshotPath(manifestOutputPath: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* Distinguishes *why* there's no usable previous snapshot, rather than
|
|
92
|
+
* collapsing every case into a bare `undefined`. A missing file is the
|
|
93
|
+
* normal, silent, expected first-run case. An unparseable file or a
|
|
94
|
+
* `schemaVersion` this build doesn't recognize are both real, diagnosable
|
|
95
|
+
* problems -- `computeManifestChanges()` below surfaces those two (never
|
|
96
|
+
* `"missing"`) as a `ParseWarning` instead of silently re-baselining.
|
|
97
|
+
*/
|
|
98
|
+
export type ManifestSnapshotReadResult = {
|
|
99
|
+
readonly status: "missing";
|
|
100
|
+
} | {
|
|
101
|
+
readonly status: "invalid-json";
|
|
102
|
+
readonly detail: string;
|
|
103
|
+
} | {
|
|
104
|
+
readonly status: "unsupported-version";
|
|
105
|
+
readonly foundVersion: unknown;
|
|
106
|
+
} | {
|
|
107
|
+
readonly status: "ok";
|
|
108
|
+
readonly snapshot: ManifestSnapshot;
|
|
109
|
+
};
|
|
110
|
+
export declare function readManifestSnapshot(snapshotPath: string): Promise<ManifestSnapshotReadResult>;
|
|
111
|
+
export declare function writeManifestSnapshot(snapshotPath: string, snapshot: ManifestSnapshot): Promise<void>;
|
|
112
|
+
/** One field's before/after value in a {@link ManifestContractUpdate} or {@link ManifestVariableUpdate}. */
|
|
113
|
+
export interface ManifestFieldChange {
|
|
114
|
+
/** The changed field's name (dotted, e.g. `metadata.runbook`, for a per-key record change). */
|
|
115
|
+
readonly field: string;
|
|
116
|
+
/** The value from the previous snapshot, or `undefined` if the field was unset. */
|
|
117
|
+
readonly previous: string | undefined;
|
|
118
|
+
/** The value in the current run, or `undefined` if the field is now unset. */
|
|
119
|
+
readonly current: string | undefined;
|
|
120
|
+
}
|
|
121
|
+
/** Identifies one contract for {@link ManifestChangeReport} purposes. */
|
|
122
|
+
export interface ManifestContractRef {
|
|
123
|
+
/** Stable identity: `${file}#${exportName}`. */
|
|
124
|
+
readonly identity: string;
|
|
125
|
+
/** Root-relative, POSIX-separated file path. */
|
|
126
|
+
readonly file: string;
|
|
127
|
+
/** The binding name the `createEnv()` result is exported as. */
|
|
128
|
+
readonly exportName: string;
|
|
129
|
+
/** Resolved display name (see {@link DiscoveredContract.contractName}). */
|
|
130
|
+
readonly contractName: string;
|
|
131
|
+
}
|
|
132
|
+
/** Identifies one variable for {@link ManifestChangeReport} purposes. */
|
|
133
|
+
export interface ManifestVariableRef {
|
|
134
|
+
/** Stable identity: `${contractIdentity}#${key}`. */
|
|
135
|
+
readonly identity: string;
|
|
136
|
+
/** The owning contract's {@link ManifestContractRef.identity}. */
|
|
137
|
+
readonly contractIdentity: string;
|
|
138
|
+
/** Root-relative, POSIX-separated file path of the owning contract. */
|
|
139
|
+
readonly file: string;
|
|
140
|
+
/** The owning contract's exported binding name. */
|
|
141
|
+
readonly exportName: string;
|
|
142
|
+
/** The owning contract's resolved display name. */
|
|
143
|
+
readonly contractName: string;
|
|
144
|
+
/** The environment variable name. */
|
|
145
|
+
readonly key: string;
|
|
146
|
+
}
|
|
147
|
+
/** A contract present in both snapshots, with at least one changed field. */
|
|
148
|
+
export interface ManifestContractUpdate extends ManifestContractRef {
|
|
149
|
+
/** Every field that changed between the previous and current snapshot. */
|
|
150
|
+
readonly changes: readonly ManifestFieldChange[];
|
|
151
|
+
}
|
|
152
|
+
/** A variable present in both snapshots, with at least one changed field. */
|
|
153
|
+
export interface ManifestVariableUpdate extends ManifestVariableRef {
|
|
154
|
+
/** Every field that changed between the previous and current snapshot. */
|
|
155
|
+
readonly changes: readonly ManifestFieldChange[];
|
|
156
|
+
}
|
|
157
|
+
/** The result of diffing two manifest snapshots -- see `result.manifest.changes` (ADR 0021). */
|
|
158
|
+
export interface ManifestChangeReport {
|
|
159
|
+
/** Contracts present now but not in the previous snapshot. */
|
|
160
|
+
readonly addedContracts: readonly ManifestContractRef[];
|
|
161
|
+
/** Contracts present in the previous snapshot but not now. */
|
|
162
|
+
readonly removedContracts: readonly ManifestContractRef[];
|
|
163
|
+
/** Variables present now but not in the previous snapshot. */
|
|
164
|
+
readonly addedVariables: readonly ManifestVariableRef[];
|
|
165
|
+
/** Variables present in the previous snapshot but not now. */
|
|
166
|
+
readonly removedVariables: readonly ManifestVariableRef[];
|
|
167
|
+
/** Contracts present in both snapshots with at least one changed field. */
|
|
168
|
+
readonly updatedContracts: readonly ManifestContractUpdate[];
|
|
169
|
+
/** Variables present in both snapshots with at least one changed field. */
|
|
170
|
+
readonly updatedVariables: readonly ManifestVariableUpdate[];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Pure. `previous === undefined` (no snapshot last time, for any reason --
|
|
174
|
+
* see `ManifestSnapshotReadResult`) reports everything in `current` as
|
|
175
|
+
* added, nothing as removed/updated.
|
|
176
|
+
*/
|
|
177
|
+
export declare function diffManifestSnapshots(previous: ManifestSnapshot | undefined, current: ManifestSnapshot): ManifestChangeReport;
|
|
178
|
+
/** Stable key `dynamicAccessAcknowledgments` (below) and `dependency-graph.ts`'s consumer of it agree on -- `file` must be root-relative, POSIX-separated on both sides for a lookup to ever hit. */
|
|
179
|
+
export declare function dynamicAccessVariableIdentity(file: string, exportName: string, key: string): string;
|
|
180
|
+
/**
|
|
181
|
+
* Re-checks every current `dynamicAccess` citation against the previous
|
|
182
|
+
* snapshot's committed baseline, keyed by `${file}#${exportName}#${key}`
|
|
183
|
+
* (matching `ManifestVariableRef.identity`'s own scheme). Existence is
|
|
184
|
+
* always re-checked live (never trusted from either snapshot); content drift
|
|
185
|
+
* is only detectable when a previous baseline exists at all -- a citation
|
|
186
|
+
* with no previous baseline (first time it's ever been seen) is reported
|
|
187
|
+
* `"fresh"`, matching the same "nothing to contradict yet" logic every other
|
|
188
|
+
* committed-baseline field in this module already follows. See ADR 0037.
|
|
189
|
+
*/
|
|
190
|
+
export declare function computeDynamicAccessAcknowledgments(activeContracts: readonly DiscoveredContract[], previous: ManifestSnapshot | undefined, root: string, readFile: (filePath: string) => Promise<string>): Promise<ReadonlyMap<string, readonly DynamicAccessAssertion[]>>;
|
|
191
|
+
/** One `dynamicAccess` citation env-cap can no longer vouch for -- the direct input to `finding-model.ts`'s `"dynamic-access-citation-stale"`/`"dynamic-access-citation-missing"` findings. See ADR 0037. */
|
|
192
|
+
export interface DynamicAccessCitationProblem {
|
|
193
|
+
readonly contractName: string;
|
|
194
|
+
/** Root-relative, POSIX-separated. */
|
|
195
|
+
readonly file: string;
|
|
196
|
+
readonly exportName: string;
|
|
197
|
+
/** The variable whose `dynamicAccess` citation this is. */
|
|
198
|
+
readonly key: string;
|
|
199
|
+
/** Where the citation points -- not the variable's own declaration. */
|
|
200
|
+
readonly position: SourcePosition;
|
|
201
|
+
readonly acknowledgment: "stale" | "missing";
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Flattens `dynamicAccessAcknowledgments` down to just the citations that
|
|
205
|
+
* need attention -- every `"stale"`/`"missing"` assertion, enriched with the
|
|
206
|
+
* owning contract's display name (the acknowledgments map itself only keys
|
|
207
|
+
* by identity, not a renderable name). `"fresh"` assertions are silently
|
|
208
|
+
* omitted -- nothing to report about a citation that's still trustworthy.
|
|
209
|
+
*/
|
|
210
|
+
export declare function findDynamicAccessCitationProblems(activeContracts: readonly DiscoveredContract[], root: string, acknowledgments: ReadonlyMap<string, readonly DynamicAccessAssertion[]>): readonly DynamicAccessCitationProblem[];
|
|
211
|
+
export interface ManifestChangesComputation {
|
|
212
|
+
readonly report: ManifestChangeReport;
|
|
213
|
+
readonly snapshot: ManifestSnapshot;
|
|
214
|
+
/** Set only when the previous snapshot existed but was unusable (corrupt JSON or an unrecognized `schemaVersion`) -- never set for the ordinary "no snapshot yet" first-run case. */
|
|
215
|
+
readonly readWarning: ParseWarning | undefined;
|
|
216
|
+
/** Every current `dynamicAccess` citation's freshness, keyed by `${file}#${exportName}#${key}` -- see `computeDynamicAccessAcknowledgments()`. See ADR 0037. */
|
|
217
|
+
readonly dynamicAccessAcknowledgments: ReadonlyMap<string, readonly DynamicAccessAssertion[]>;
|
|
218
|
+
/** Every citation that isn't `"fresh"` -- see `findDynamicAccessCitationProblems()`. Derived from `dynamicAccessAcknowledgments` above for convenience; a caller could equally recompute it. */
|
|
219
|
+
readonly dynamicAccessCitationProblems: readonly DynamicAccessCitationProblem[];
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* The one I/O-performing helper both `generateEnvManifest()` and
|
|
223
|
+
* `generate-env-artifacts.ts`'s `computeArtifacts()` share: builds the
|
|
224
|
+
* current snapshot, reads the previous one, diffs. Writing the new snapshot
|
|
225
|
+
* stays a separate, explicit step on the real write path -- this never
|
|
226
|
+
* writes anything itself, so it's safe to call from a read-only compute too.
|
|
227
|
+
*/
|
|
228
|
+
export declare function computeManifestChanges(root: string, manifestOutputPath: string, activeContracts: readonly DiscoveredContract[], readFile: (filePath: string) => Promise<string>): Promise<ManifestChangesComputation>;
|
|
229
|
+
//# sourceMappingURL=manifest-snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-snapshot.d.ts","sourceRoot":"","sources":["../../../src/build/manifest-snapshot.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAsB,MAAM,WAAW,CAAA;AACvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAExE,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAElF;;;;;;GAMG;AAEH;;;;gBAIgB;AAChB,eAAO,MAAM,gCAAgC,IAAI,CAAA;AAEjD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,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sBAAsB,EAAE,CAAC,GACtE,SAAS,4BAA4B,EAAE,CAoBzC;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAA;IACrC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,qLAAqL;IACrL,QAAQ,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS,CAAA;IAC9C,gKAAgK;IAChK,QAAQ,CAAC,4BAA4B,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,sBAAsB,EAAE,CAAC,CAAA;IAC7F,gMAAgM;IAChM,QAAQ,CAAC,6BAA6B,EAAE,SAAS,4BAA4B,EAAE,CAAA;CAChF;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,SAAS,kBAAkB,EAAE,EAC9C,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAC9C,OAAO,CAAC,0BAA0B,CAAC,CAwCrC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DiscoveredContract } from "./link.js";
|
|
2
|
+
/**
|
|
3
|
+
* Every validation context declared by any variable in an *active* contract
|
|
4
|
+
* in `contracts` (a variable belonging to a contract documented `active:
|
|
5
|
+
* false` never contributes -- same exclusion the `manifest` array itself
|
|
6
|
+
* already applies), sorted and deduplicated. What {@link renderManifest}
|
|
7
|
+
* surfaces as the generated `activeContexts` export. Exported for reuse by
|
|
8
|
+
* anything that needs the same computation (currently just `renderManifest`
|
|
9
|
+
* itself).
|
|
10
|
+
*/
|
|
11
|
+
export declare function discoverValidationContexts(contracts: readonly DiscoveredContract[]): readonly string[];
|
|
12
|
+
/**
|
|
13
|
+
* Renders the deterministic manifest source: sorted imports (aliased on name
|
|
14
|
+
* collision) plus a `contracts` array, in the exact banner format schema
|
|
15
|
+
* authors will recognize as generated. No timestamps, no randomness -- same
|
|
16
|
+
* input files always produce byte-identical output.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* When at least one discovered variable declares a `context` (ADR 0022),
|
|
20
|
+
* this also emits `activeContexts` -- every validation context found across
|
|
21
|
+
* `contracts`, as a plain array named to match {@link runtime.validateEnvOptions}'s
|
|
22
|
+
* own `activeContexts` field -- so application code can import it alongside
|
|
23
|
+
* `manifest` and pass it straight through: `validateEnv({ manifest, values, activeContexts })`.
|
|
24
|
+
* It's every context this manifest has, meant as a starting point to narrow
|
|
25
|
+
* per process/deployment, not a pre-scoped default -- see the README's
|
|
26
|
+
* "Validation contexts" section. Omitted entirely (not even an empty array)
|
|
27
|
+
* when no variable declares a `context` at all, so generated output for
|
|
28
|
+
* projects that don't use this feature is untouched.
|
|
29
|
+
*/
|
|
30
|
+
export declare function renderManifest(contracts: readonly DiscoveredContract[], outputFile: string): string;
|
|
31
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/build/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAEnD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,SAAS,kBAAkB,EAAE,GACvC,SAAS,MAAM,EAAE,CASnB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,kBAAkB,EAAE,EACxC,UAAU,EAAE,MAAM,GACjB,MAAM,CA8DR"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `map.get(key)` after iterating `map`'s own `.keys()` is always defined --
|
|
3
|
+
* this makes that invariant an explicit, named operation instead of a bare
|
|
4
|
+
* `!` non-null assertion at each call site, with a real error (not a
|
|
5
|
+
* silent `undefined`) if it's ever violated by a future bug.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mustGet<K, V>(map: ReadonlyMap<K, V>, key: K): V;
|
|
8
|
+
//# sourceMappingURL=map-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-utils.d.ts","sourceRoot":"","sources":["../../../src/build/map-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAK/D"}
|