@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 @@
|
|
|
1
|
+
{"version":3,"file":"finding-model.d.ts","sourceRoot":"","sources":["../../../src/build/finding-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAEpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAA;AAC9E,OAAO,KAAK,EACV,wBAAwB,EACxB,6BAA6B,EAC7B,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,mBAAmB,CAAA;AAE1B;;;;;GAKG;AAEH,yKAAyK;AACzK,MAAM,MAAM,WAAW,GACnB,sBAAsB,GACtB,2BAA2B,GAC3B,gBAAgB,GAChB,kBAAkB,GAClB,uBAAuB,GACvB,uBAAuB,GACvB,iBAAiB,GACjB,SAAS,GACT,eAAe,GACf,6BAA6B,GAC7B,oBAAoB,GACpB,qBAAqB,GACrB,2BAA2B,GAC3B,yBAAyB,GACzB,iCAAiC,GACjC,+BAA+B,GAC/B,+BAA+B,CAAA;AAEnC,iNAAiN;AACjN,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,OAAO,GAAG,eAAe,GAAG,WAAW,CAAA;AAErF,oFAAoF;AACpF,MAAM,WAAW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BAAsB,CAAC,EAAE,SAAS,6BAA6B,EAAE,CAAA;IAC1E,oKAAoK;IACpK,QAAQ,CAAC,6BAA6B,CAAC,EAAE,SAAS,4BAA4B,EAAE,CAAA;CACjF;AAmCD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAwN7E"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import type { ContractModelContract } from "./contract-model.js";
|
|
2
|
+
import type { CatalogContract, ExpiringEntry } from "./docs.js";
|
|
3
|
+
import type { EnvExampleOnExisting, EnvExampleResult } from "./env-example.js";
|
|
4
|
+
import type { DiscoveredContract, DiscoveredContractSummary, LinkResult } from "./link.js";
|
|
5
|
+
import type { LiveExpirationDates } from "./live-expirations.js";
|
|
6
|
+
import type { ParseWarning } from "./parse.js";
|
|
7
|
+
import type { BuildFileSystem } from "./types.js";
|
|
8
|
+
/** Options for {@link generateDocumentation}. */
|
|
9
|
+
export interface GenerateDocumentationOptions {
|
|
10
|
+
/** The filesystem capability -- `./build` never imports `node:fs` (ADR 0040). */
|
|
11
|
+
fs: BuildFileSystem;
|
|
12
|
+
/** Project root schema discovery is relative to. Defaults to `process.cwd()`. */
|
|
13
|
+
root?: string | undefined;
|
|
14
|
+
/** Output path for the Markdown docs artifact, relative to `root`. */
|
|
15
|
+
location: string;
|
|
16
|
+
/** Glob patterns for files to scan. Defaults to `defaultInclude()`. */
|
|
17
|
+
include?: string[] | undefined;
|
|
18
|
+
/** Glob patterns for files/directories to prune. Defaults to `defaultExclude()`. */
|
|
19
|
+
exclude?: string[] | undefined;
|
|
20
|
+
/** **Experimental** (see VERSIONING.md) -- see `GenerateEnvManifestOptions.packages`; see ADR 0014. */
|
|
21
|
+
packages?: readonly string[] | undefined;
|
|
22
|
+
/** **Experimental** (see VERSIONING.md) -- see `GenerateEnvManifestOptions.tsconfig`; see ADR 0023. */
|
|
23
|
+
tsconfig?: string | false | undefined;
|
|
24
|
+
/** How many days out counts as "expiring soon". Defaults to 30. */
|
|
25
|
+
expiringWithinDays?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Also emit a `.env.example`-style file, relative to `root`. `onExisting`
|
|
28
|
+
* controls what happens when a file already exists there -- defaults to
|
|
29
|
+
* `"keep-sibling"` (never overwrites; see `EnvExampleOnExisting` and
|
|
30
|
+
* `EnvExampleResult`).
|
|
31
|
+
*/
|
|
32
|
+
envExample?: {
|
|
33
|
+
/** Output path for the `.env.example`-style file, relative to `root`. */
|
|
34
|
+
location: string;
|
|
35
|
+
/** What to do when a file already exists at `location`. Defaults to `"keep-sibling"`. */
|
|
36
|
+
onExisting?: EnvExampleOnExisting | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Supplies expiration metadata from a live source as a post-discovery
|
|
40
|
+
* override, invoked exactly once with every discovered variable name after
|
|
41
|
+
* linking completes and before rendering. See `live-expirations.ts` and
|
|
42
|
+
* ADR 0012. Omitted: behavior is unchanged from a purely static `expiresAt`.
|
|
43
|
+
*/
|
|
44
|
+
liveExpirationDates?: LiveExpirationDates | undefined;
|
|
45
|
+
}
|
|
46
|
+
/** Everything {@link generateDocumentation} found that isn't fully documented or up to date -- never blocks generation; a team that wants to gate CI on this reads `Finding[]` (the "documentation" family) from the persisted evidence artifact and decides for itself. See ADR 0038. */
|
|
47
|
+
export interface DocumentationFindings {
|
|
48
|
+
/** Contracts with no linked `documentEnv()` call at all. */
|
|
49
|
+
readonly undocumentedContracts: readonly {
|
|
50
|
+
/** Absolute path of the file declaring the contract. */
|
|
51
|
+
readonly file: string;
|
|
52
|
+
/** The contract's exported binding name. */
|
|
53
|
+
readonly exportName: string;
|
|
54
|
+
}[];
|
|
55
|
+
/** Schema variables with no matching entry in their contract's linked documentation. */
|
|
56
|
+
readonly undocumentedVariables: readonly {
|
|
57
|
+
/** Absolute path of the file declaring the contract. */
|
|
58
|
+
readonly file: string;
|
|
59
|
+
/** The contract's exported binding name. */
|
|
60
|
+
readonly exportName: string;
|
|
61
|
+
/** The undocumented environment variable name. */
|
|
62
|
+
readonly key: string;
|
|
63
|
+
}[];
|
|
64
|
+
/** Documented variable entries with no matching schema variable (the schema key was removed or renamed). */
|
|
65
|
+
readonly staleDocEntries: readonly {
|
|
66
|
+
/** Absolute path of the file declaring the contract. */
|
|
67
|
+
readonly file: string;
|
|
68
|
+
/** The contract's exported binding name. */
|
|
69
|
+
readonly exportName: string;
|
|
70
|
+
/** The stale documented variable name. */
|
|
71
|
+
readonly key: string;
|
|
72
|
+
}[];
|
|
73
|
+
/** Variables whose `expiresAt` falls within the configured window. */
|
|
74
|
+
readonly expiringSoon: readonly ExpiringEntry[];
|
|
75
|
+
/** Contract- or variable-level `sensitivity` values outside {@link STANDARD_SENSITIVITY_LEVELS}. Advisory only -- the declared level is always honored verbatim; this exists purely so vocabulary drift across a repo stays visible. */
|
|
76
|
+
readonly nonstandardSensitivityLevels: readonly NonstandardSensitivityEntry[];
|
|
77
|
+
/** `documentEnv()` calls that couldn't be statically linked to a schema. */
|
|
78
|
+
readonly unresolvedLinks: readonly {
|
|
79
|
+
/** Absolute path of the file containing the unlinkable call. */
|
|
80
|
+
readonly file: string;
|
|
81
|
+
/** Human-readable explanation of why the link couldn't be resolved. */
|
|
82
|
+
readonly reason: string;
|
|
83
|
+
}[];
|
|
84
|
+
}
|
|
85
|
+
/** The result of a completed {@link generateDocumentation} run. */
|
|
86
|
+
export interface GenerateDocumentationResult {
|
|
87
|
+
/** Absolute path the Markdown docs artifact was written to. */
|
|
88
|
+
readonly docsPath: string;
|
|
89
|
+
/** Set only when `options.envExample` was passed. */
|
|
90
|
+
readonly envExample: EnvExampleResult | undefined;
|
|
91
|
+
/** Root-relative summary of every discovered contract, active or not. */
|
|
92
|
+
readonly contracts: readonly DiscoveredContractSummary[];
|
|
93
|
+
/** Same descriptive content as the generated Markdown Catalog, reshaped for
|
|
94
|
+
* programmatic consumers -- see `buildCatalog()` in `docs.ts`. */
|
|
95
|
+
readonly catalog: readonly CatalogContract[];
|
|
96
|
+
/** Parse-time warnings collected across every analyzed file (including allow-listed package resolution). */
|
|
97
|
+
readonly parseWarnings: readonly ParseWarning[];
|
|
98
|
+
/** Everything found that isn't fully documented or up to date. */
|
|
99
|
+
readonly documentation: DocumentationFindings;
|
|
100
|
+
}
|
|
101
|
+
/** Default value for {@link GenerateDocumentationOptions.expiringWithinDays}. */
|
|
102
|
+
export declare const DEFAULT_EXPIRING_WITHIN_DAYS = 30;
|
|
103
|
+
/**
|
|
104
|
+
* The sensitivity vocabulary env-cap's own docs, examples, and `.env.example`
|
|
105
|
+
* comments are written around. Purely advisory: `sensitivity` is an open
|
|
106
|
+
* `string` (see {@link runtime.VariableDocs.sensitivity}), any value is
|
|
107
|
+
* honored verbatim, and nothing here ever drops or rewrites a declared level.
|
|
108
|
+
* A level outside this set only produces a non-blocking
|
|
109
|
+
* `NONSTANDARD_SENSITIVITY_LEVEL` finding, so a team that deliberately runs
|
|
110
|
+
* its own vocabulary sees one advisory line rather than silent data loss --
|
|
111
|
+
* and a team that meant to write `"secret"` and typo'd `"secrets"` finds out.
|
|
112
|
+
*/
|
|
113
|
+
export declare const STANDARD_SENSITIVITY_LEVELS: ReadonlySet<string>;
|
|
114
|
+
/** One contract- or variable-level `sensitivity` declaring a level outside {@link STANDARD_SENSITIVITY_LEVELS}. */
|
|
115
|
+
export interface NonstandardSensitivityEntry {
|
|
116
|
+
/** Absolute path of the file declaring the contract. */
|
|
117
|
+
readonly file: string;
|
|
118
|
+
/** The contract's exported binding name. */
|
|
119
|
+
readonly exportName: string;
|
|
120
|
+
/** `undefined` for a contract-level `sensitivity`, set for a per-variable one. */
|
|
121
|
+
readonly key: string | undefined;
|
|
122
|
+
/** The declared level, exactly as written. */
|
|
123
|
+
readonly sensitivity: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Every contract- or variable-level `sensitivity` outside the standard set,
|
|
127
|
+
* in declaration order (contract first, then its own variables by key).
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* A variable's *own* declared level only -- never the contract-inherited one
|
|
131
|
+
* `effectiveSensitivity()` would resolve to. Reporting the inherited value
|
|
132
|
+
* would fire this same finding once per variable on a contract that already
|
|
133
|
+
* produced its own contract-level entry, turning one real vocabulary
|
|
134
|
+
* question into N duplicates of it.
|
|
135
|
+
*/
|
|
136
|
+
export declare function findNonstandardSensitivityLevels(contracts: readonly DiscoveredContract[]): NonstandardSensitivityEntry[];
|
|
137
|
+
export interface DocumentationComputation {
|
|
138
|
+
readonly contractSummaries: readonly DiscoveredContractSummary[];
|
|
139
|
+
readonly catalog: readonly CatalogContract[];
|
|
140
|
+
readonly documentation: DocumentationFindings;
|
|
141
|
+
/** `ContractModel`'s own projection of the same contracts, built once here and reused by `writeDocumentation()` -- the shape `renderDocs()` itself takes (ADR 0038). */
|
|
142
|
+
readonly contractModelContracts: readonly ContractModelContract[];
|
|
143
|
+
}
|
|
144
|
+
/** Root-relative, POSIX-separated -- `RenderDocsOptions`'s own convention, matching `ContractModel`'s `file`. Exported so `check-artifacts.ts`'s drift check can convert the same `documentation.undocumentedContracts`/`undocumentedVariables` fields for its own `renderDocs()` call, identically. Delegates to `displayPath()` so this can never disagree with the `ContractModel` `file` values it's matched against by identity. */
|
|
145
|
+
export declare function relativizeRef<T extends {
|
|
146
|
+
file: string;
|
|
147
|
+
}>(root: string, ref: T): T;
|
|
148
|
+
/**
|
|
149
|
+
* Pure -- no I/O. Computes undocumented/stale/expiring findings against an
|
|
150
|
+
* already-discovered contract graph (active and inactive alike -- docs
|
|
151
|
+
* document everything, unlike the manifest). Never blocks -- see
|
|
152
|
+
* `DocumentationFindings`'s own doc comment. Shared by the standalone
|
|
153
|
+
* `generateDocumentation()` and `generate-env-artifacts.ts` (which also
|
|
154
|
+
* reuses this same call for Finding Model's documentation-family findings,
|
|
155
|
+
* ADR 0038 -- one computation, not two).
|
|
156
|
+
*/
|
|
157
|
+
export declare function computeDocumentation(root: string, linkResult: LinkResult, expiringWithinDays: number, generatedAt: Date): DocumentationComputation;
|
|
158
|
+
/** Writes the docs artifact and, if requested, the `.env.example` file. Callers must have already confirmed both output paths are safe and nothing is blocking. */
|
|
159
|
+
export declare function writeDocumentation(docsPath: string, envExamplePath: string | undefined, root: string, contracts: readonly DiscoveredContract[], contractModelContracts: readonly ContractModelContract[], documentation: DocumentationFindings, expiringWithinDays: number, generatedAt: Date, fs: BuildFileSystem, envExampleOnExisting?: EnvExampleOnExisting): Promise<{
|
|
160
|
+
envExample: EnvExampleResult | undefined;
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Build-time only. Discovers and links `env.schema.ts` files (same static
|
|
164
|
+
* analysis as {@link generateEnvManifest}) and writes the rich Markdown "Catalog" --
|
|
165
|
+
* every variable, its description, default, processor/validator flags,
|
|
166
|
+
* owner, and expiry -- the single onboarding reference application
|
|
167
|
+
* developers use to see what configuration a feature needs and how to set
|
|
168
|
+
* it up. Optionally also writes a reconciling `.env.example`.
|
|
169
|
+
*
|
|
170
|
+
* @remarks
|
|
171
|
+
* Documents every discovered contract, active or not, unlike {@link generateEnvManifest}.
|
|
172
|
+
*
|
|
173
|
+
* @throws {EnvDocumentationGenerationError} If `location`/`envExample.location` escape `root`.
|
|
174
|
+
*/
|
|
175
|
+
export declare function generateDocumentation(options: GenerateDocumentationOptions): Promise<GenerateDocumentationResult>;
|
|
176
|
+
//# sourceMappingURL=generate-documentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-documentation.d.ts","sourceRoot":"","sources":["../../../src/build/generate-documentation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAEhE,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EAGd,MAAM,WAAW,CAAA;AAElB,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAI9E,OAAO,KAAK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ACnK,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,kBAAkB,EAAE,EACxC,sBAAsB,EAAE,SAAS,qBAAqB,EAAE,EACxD,aAAa,EAAE,qBAAqB,EACpC,kBAAkB,EAAE,MAAM,EAC1B,WAAW,EAAE,IAAI,EACjB,EAAE,EAAE,eAAe,EACnB,oBAAoB,CAAC,EAAE,oBAAoB,GAC1C,OAAO,CAAC;IAAE,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAA;CAAE,CAAC,CA0CvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,2BAA2B,CAAC,CAsEtC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import type { CompatibilityIssue } from "./compatibility.js";
|
|
2
|
+
import type { EvidenceModel } from "./evidence-model.js";
|
|
3
|
+
import type { Finding, FindingFamily } from "./finding-model.js";
|
|
4
|
+
import type { DocumentationComputation, GenerateDocumentationOptions, GenerateDocumentationResult } from "./generate-documentation.js";
|
|
5
|
+
import type { GenerateEnvManifestOptions, GenerateEnvManifestResult, ManifestComputation } from "./generate-manifest.js";
|
|
6
|
+
import type { GenerateUsageReportOptions, GenerateUsageReportResult, UsageComputation } from "./generate-usage.js";
|
|
7
|
+
import type { DiscoveredContract } from "./link.js";
|
|
8
|
+
import type { LiveExpirationDates } from "./live-expirations.js";
|
|
9
|
+
import type { ParseWarning } from "./parse.js";
|
|
10
|
+
import type { BuildFileSystem } from "./types.js";
|
|
11
|
+
/** Options for {@link generateEnvArtifacts}. */
|
|
12
|
+
export interface GenerateEnvArtifactsOptions {
|
|
13
|
+
/** The filesystem capability, shared across every requested pass -- `./build` never imports `node:fs` (ADR 0040). */
|
|
14
|
+
fs: BuildFileSystem;
|
|
15
|
+
/** Directory glob patterns are resolved against, shared across every requested pass. Defaults to `process.cwd()`. */
|
|
16
|
+
root?: string | undefined;
|
|
17
|
+
/** Shared schema-discovery glob for the contract graph. Defaults to `["**\/env.schema.ts"]`. */
|
|
18
|
+
include?: string[] | undefined;
|
|
19
|
+
/** Glob patterns to exclude, shared across every requested pass. Defaults to node_modules/dist/.git. */
|
|
20
|
+
exclude?: string[] | undefined;
|
|
21
|
+
/** **Experimental** (see VERSIONING.md) -- see `GenerateEnvManifestOptions.packages`; shared across every requested pass. See ADR 0014. */
|
|
22
|
+
packages?: readonly string[] | undefined;
|
|
23
|
+
/** **Experimental** (see VERSIONING.md) -- see `GenerateEnvManifestOptions.tsconfig`; shared across every requested pass. See ADR 0023. */
|
|
24
|
+
tsconfig?: string | false | undefined;
|
|
25
|
+
/** Manifest pass options, or `false` to skip it entirely. */
|
|
26
|
+
manifest?: Omit<GenerateEnvManifestOptions, "fs" | "root" | "include" | "exclude" | "packages" | "tsconfig"> | false | undefined;
|
|
27
|
+
/** Docs pass options, or `false` to skip it entirely. */
|
|
28
|
+
docs?: Omit<GenerateDocumentationOptions, "fs" | "root" | "include" | "exclude" | "packages" | "tsconfig" | "liveExpirationDates"> | false | undefined;
|
|
29
|
+
/** Usage-report pass options, or `false` to skip it entirely. */
|
|
30
|
+
usage?: Omit<GenerateUsageReportOptions, "fs" | "root" | "include" | "exclude" | "packages" | "tsconfig"> | false | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Where to write the persisted evidence artifact (the full, literal
|
|
33
|
+
* `EvidenceModel`, plus a paired `.fingerprint` sidecar -- see
|
|
34
|
+
* `evidence-cache.ts`), e.g. `docs/env.evidence.json`, relative to `root`.
|
|
35
|
+
* Independent of `manifest.location` -- requesting this needs no other
|
|
36
|
+
* pass, and generating a manifest never requires it. `EvidenceModel`
|
|
37
|
+
* itself is always computed regardless of this option (ADR 0038, "free to
|
|
38
|
+
* compute, always real") and always returned as `result.evidence`; this
|
|
39
|
+
* option controls only whether it's also written to disk. Omitted:
|
|
40
|
+
* nothing is written, `result.evidence` is still populated.
|
|
41
|
+
*/
|
|
42
|
+
evidence?: {
|
|
43
|
+
location: string;
|
|
44
|
+
} | false | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Escalates every warning-severity `"documentation"`-family finding
|
|
47
|
+
* (undocumented contracts/variables, stale doc entries, expiring/expired
|
|
48
|
+
* entries, unresolvable `documentEnv()` links) into a blocking error, so a
|
|
49
|
+
* run with any of them writes nothing and throws. Defaults to `"warn"` --
|
|
50
|
+
* ADR 0038's stance, unchanged: documentation gaps never block by default.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* Scoped deliberately narrowly, unlike `manifest.onIncompatibility`, which
|
|
54
|
+
* gates only the compatibility family. `"info"`-severity findings are never
|
|
55
|
+
* escalated by either -- see `Finding.severity`.
|
|
56
|
+
*/
|
|
57
|
+
onUndocumented?: "warn" | "throw" | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Escalates every warning-severity `"ownership"`-family finding (abandoned
|
|
60
|
+
* contracts, unresolved consumers, unconsumed owned variables,
|
|
61
|
+
* indeterminate ownership, stale/missing `dynamicAccess` citations) into a
|
|
62
|
+
* blocking error. Defaults to `"warn"` -- see {@link onUndocumented}.
|
|
63
|
+
*/
|
|
64
|
+
onOwnershipIssue?: "warn" | "throw" | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Supplies expiration metadata from a live source (a secrets manager, an
|
|
67
|
+
* internal inventory API, ...) as a post-discovery override applied only to
|
|
68
|
+
* the docs pass. Invoked at most once, only when a `docs` pass is actually
|
|
69
|
+
* requested, with every discovered variable name across all passes' shared
|
|
70
|
+
* contract graph. See `live-expirations.ts` and ADR 0012. Omitted: behavior
|
|
71
|
+
* is unchanged from a purely static `expiresAt`.
|
|
72
|
+
*/
|
|
73
|
+
liveExpirationDates?: LiveExpirationDates | undefined;
|
|
74
|
+
}
|
|
75
|
+
/** The result of a completed {@link generateEnvArtifacts} run. */
|
|
76
|
+
export interface GenerateEnvArtifactsResult {
|
|
77
|
+
/** Set only when `options.manifest` wasn't `false`. */
|
|
78
|
+
readonly manifest: GenerateEnvManifestResult | undefined;
|
|
79
|
+
/** Set only when `options.docs` wasn't `false`. */
|
|
80
|
+
readonly docs: GenerateDocumentationResult | undefined;
|
|
81
|
+
/** Set only when `options.usage` wasn't `false`. */
|
|
82
|
+
readonly usage: GenerateUsageReportResult | undefined;
|
|
83
|
+
/** Always populated, regardless of `options.evidence` -- see that option's own doc comment. */
|
|
84
|
+
readonly evidence: EvidenceModel;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Every intermediate value both the write path (`generateEnvArtifacts()`
|
|
88
|
+
* below) and the drift-check path (`checkEnvArtifacts()` in
|
|
89
|
+
* `check-artifacts.ts`) need, computed exactly once. Internal/Private tier
|
|
90
|
+
* per `VERSIONING.md` -- not re-exported from `./index.ts`.
|
|
91
|
+
*/
|
|
92
|
+
export interface ComputeArtifactsResult {
|
|
93
|
+
readonly root: string;
|
|
94
|
+
readonly manifestOptions: Omit<GenerateEnvManifestOptions, "fs" | "root" | "include" | "exclude" | "packages" | "tsconfig"> | undefined;
|
|
95
|
+
readonly manifestOutputPath: string | undefined;
|
|
96
|
+
readonly manifestComputed: ManifestComputation | undefined;
|
|
97
|
+
readonly docsOptions: Omit<GenerateDocumentationOptions, "fs" | "root" | "include" | "exclude" | "packages" | "tsconfig" | "liveExpirationDates"> | undefined;
|
|
98
|
+
readonly docsPath: string | undefined;
|
|
99
|
+
readonly envExamplePath: string | undefined;
|
|
100
|
+
/** Always computed -- Finding Model needs it regardless of whether a `docs` pass was itself requested. See ADR 0038. */
|
|
101
|
+
readonly docsComputed: DocumentationComputation;
|
|
102
|
+
readonly docsContracts: readonly DiscoveredContract[];
|
|
103
|
+
readonly usageOptions: Omit<GenerateUsageReportOptions, "fs" | "root" | "include" | "exclude" | "packages" | "tsconfig"> | undefined;
|
|
104
|
+
readonly usageReportPath: string | undefined;
|
|
105
|
+
/** Always computed -- Finding Model needs it regardless of whether a `usage` pass was itself requested. See ADR 0038. */
|
|
106
|
+
readonly usageComputed: UsageComputation;
|
|
107
|
+
readonly evidencePath: string | undefined;
|
|
108
|
+
readonly evidence: EvidenceModel;
|
|
109
|
+
readonly blocking: readonly CompatibilityIssue[];
|
|
110
|
+
readonly packageWarnings: readonly ParseWarning[];
|
|
111
|
+
readonly linkWarnings: readonly ParseWarning[];
|
|
112
|
+
/** Single timestamp shared by every pass' own time-sensitive computation (`expiringSoon`, `EvidenceModel.provenance.generatedAt`), so all of them agree on exactly the same instant. */
|
|
113
|
+
readonly generatedAt: Date;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Adapts every warning-severity finding of one family into the
|
|
117
|
+
* `CompatibilityIssue` shape `blocking`/`EnvProjectGenerationError` speak, so
|
|
118
|
+
* `--strict-docs`/`--strict-ownership` fail through exactly the same path
|
|
119
|
+
* `--strict` already does rather than inventing a second failure mode.
|
|
120
|
+
*
|
|
121
|
+
* @remarks
|
|
122
|
+
* `"info"` findings are filtered out unconditionally and can never be
|
|
123
|
+
* escalated by any flag -- they're observations, not gaps (see
|
|
124
|
+
* `Finding.severity`). `"error"` findings are excluded too: those already
|
|
125
|
+
* block on their own, via the manifest pass, and re-adding them here would
|
|
126
|
+
* report the same violation twice in one error message. `code` is left unset
|
|
127
|
+
* -- `CompatibilityIssueCode` is that check family's own closed vocabulary,
|
|
128
|
+
* and a `FindingCode` from another family is not a member of it.
|
|
129
|
+
*/
|
|
130
|
+
/** @internal Exported for direct unit coverage -- reached through `generateEnvArtifacts()`'s `--strict-docs`/`--strict-ownership` flags in production, but its filter/mapping logic isn't independently observable through that path alone (every mutant on it still needs a real `computeArtifacts()` call, discovery included, to reach it). */
|
|
131
|
+
export declare function escalatedFindings(findings: readonly Finding[], family: FindingFamily): CompatibilityIssue[];
|
|
132
|
+
/** The variable a finding is about, or a `"(contract) <name>"` label when it's contract-level -- matching `CompatibilityIssue.variable`'s own documented convention.
|
|
133
|
+
* @internal Exported for direct unit coverage -- see {@link escalatedFindings}'s own doc comment for why. */
|
|
134
|
+
export declare function findingSubject(finding: Finding): string;
|
|
135
|
+
/** Every file a finding names, as `CompatibilityIssue.files` -- empty when its location carries none (an ownership finding about a variable, which names no single file).
|
|
136
|
+
* @internal Exported for direct unit coverage -- see {@link escalatedFindings}'s own doc comment for why. */
|
|
137
|
+
export declare function findingFiles(finding: Finding): string[];
|
|
138
|
+
/**
|
|
139
|
+
* Runs schema discovery, linking, and every requested pass's pure `compute*()`
|
|
140
|
+
* step -- but never writes anything to disk. Throws `EnvProjectGenerationError`
|
|
141
|
+
* immediately if any requested output location escapes `root` (same
|
|
142
|
+
* fail-fast-before-any-work guarantee `generateEnvArtifacts()` has always
|
|
143
|
+
* given); otherwise returns every intermediate value without itself checking
|
|
144
|
+
* `blocking` findings, so callers (the write path below, and `--check`'s
|
|
145
|
+
* `checkEnvArtifacts()`) each decide when to throw on those.
|
|
146
|
+
*
|
|
147
|
+
* @remarks
|
|
148
|
+
* The six canonical fact models (Contract/Dependency/Ownership/Lifecycle/
|
|
149
|
+
* Finding/Change -> `EvidenceModel`) are composed on every call,
|
|
150
|
+
* unconditionally, reusing the exact same builders `generateEvidenceModel()`
|
|
151
|
+
* calls -- not a second implementation of the same assembly. See ADR 0038.
|
|
152
|
+
*/
|
|
153
|
+
export declare function computeArtifacts(options: GenerateEnvArtifactsOptions): Promise<ComputeArtifactsResult>;
|
|
154
|
+
/**
|
|
155
|
+
* Orchestrates {@link generateEnvManifest}/{@link generateDocumentation}/
|
|
156
|
+
* {@link generateUsageReport}, plus the persisted evidence artifact, by
|
|
157
|
+
* composing their shared private compute/write pipeline directly, running
|
|
158
|
+
* schema discovery+linking exactly once regardless of how many outputs are
|
|
159
|
+
* requested -- an orchestrator, not a new analysis engine (see ADR 0011).
|
|
160
|
+
*
|
|
161
|
+
* @remarks
|
|
162
|
+
* Two distinct atomicity guarantees, not one:
|
|
163
|
+
* - **Compute atomicity (guaranteed)**: every requested pass's blocking
|
|
164
|
+
* findings are checked, across all passes, before any pass writes
|
|
165
|
+
* anything.
|
|
166
|
+
* - **Write atomicity (NOT guaranteed, and not attempted)**: once writes
|
|
167
|
+
* begin, each `fs.writeFile` is independent. A real I/O failure partway
|
|
168
|
+
* through (disk full, permissions changed mid-run) can leave some
|
|
169
|
+
* artifacts on disk and not others. Transactional (temp-file + rename)
|
|
170
|
+
* writes across all three artifacts were considered and rejected as
|
|
171
|
+
* disproportionate machinery for a rare failure mode -- see ADR 0011.
|
|
172
|
+
*
|
|
173
|
+
* @throws {EnvProjectGenerationError} If any requested output location escapes `root`, or if any requested pass reports a blocking finding.
|
|
174
|
+
*/
|
|
175
|
+
export declare function generateEnvArtifacts(options: GenerateEnvArtifactsOptions): Promise<GenerateEnvArtifactsResult>;
|
|
176
|
+
//# sourceMappingURL=generate-env-artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-env-artifacts.d.ts","sourceRoot":"","sources":["../../../src/build/generate-env-artifacts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAM5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAOxD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAMhE,OAAO,KAAK,EACV,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,6BAA6B,CAAA;AAOpC,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAInD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;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js";
|
|
2
|
+
import type { LiveExpirationDates } from "./live-expirations.js";
|
|
3
|
+
import type { BuildFileSystem } from "./types.js";
|
|
4
|
+
/** Options for {@link generateEvidenceModel}. */
|
|
5
|
+
export interface GenerateEvidenceModelOptions {
|
|
6
|
+
/** The filesystem capability -- `./build` never imports `node:fs` (ADR 0040). */
|
|
7
|
+
fs: BuildFileSystem;
|
|
8
|
+
/** Directory glob patterns are resolved against. Defaults to `process.cwd()`. */
|
|
9
|
+
root?: string | undefined;
|
|
10
|
+
/** Schema-discovery glob for the contract graph. Defaults to `["**\/env.schema.ts"]`. */
|
|
11
|
+
include?: string[] | undefined;
|
|
12
|
+
/** Glob patterns to exclude, shared across every pass. Defaults to node_modules/dist/.git. */
|
|
13
|
+
exclude?: string[] | undefined;
|
|
14
|
+
/** **Experimental** (see VERSIONING.md) -- see `GenerateEnvManifestOptions.packages`. See ADR 0014. */
|
|
15
|
+
packages?: readonly string[] | undefined;
|
|
16
|
+
/** **Experimental** (see VERSIONING.md) -- see `GenerateEnvManifestOptions.tsconfig`. See ADR 0023. */
|
|
17
|
+
tsconfig?: string | false | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Where a previously-persisted evidence artifact lives, relative to
|
|
20
|
+
* `root` -- read (never written) as the baseline Change Model diffs
|
|
21
|
+
* against and dynamic-access citation freshness (ADR 0037) compares
|
|
22
|
+
* content hashes to. Independent of any `.ts` manifest a project may or
|
|
23
|
+
* may not also generate -- there is no derivation from a manifest's own
|
|
24
|
+
* location. Omitted: treated as the normal first-run state (everything
|
|
25
|
+
* reads as added, no citation-freshness baseline to compare against),
|
|
26
|
+
* never an error.
|
|
27
|
+
*/
|
|
28
|
+
previousSnapshotLocation?: string | undefined;
|
|
29
|
+
/** Feeds Lifecycle Model's `expiring` list. Defaults to 30. */
|
|
30
|
+
expiringWithinDays?: number | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Supplies expiration metadata from a live source as a post-discovery
|
|
33
|
+
* override, applied to Lifecycle Model's (and Finding Model's
|
|
34
|
+
* `expiring-soon` findings') data only -- Contract Model still reflects the
|
|
35
|
+
* schema's own static `expiresAt`. See `live-expirations.ts` and ADR 0012.
|
|
36
|
+
*/
|
|
37
|
+
liveExpirationDates?: LiveExpirationDates | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the commit SHA to stamp onto `EvidenceModel.provenance.commit`.
|
|
40
|
+
* Invoked at most once, after discovery/linking completes. env-cap never
|
|
41
|
+
* shells out to `git` itself -- see ADR 0012's callback precedent. Omitted:
|
|
42
|
+
* `commit` is `undefined`.
|
|
43
|
+
*/
|
|
44
|
+
commit?: (() => Promise<string | undefined>) | undefined;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Node-only assembly orchestrator (ADR 0024, ADR 0031): runs schema
|
|
48
|
+
* discovery and linking once (via `assembleProject()`, shared with
|
|
49
|
+
* `computeArtifacts()`), then builds all seven canonical fact models by
|
|
50
|
+
* calling each model's own public builder directly -- this function
|
|
51
|
+
* introduces no derivation logic of its own, only sequencing and the shared
|
|
52
|
+
* discovery/linking every builder needs. The result is `deepFreeze()`-d
|
|
53
|
+
* before being returned.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* Deliberately never throws on a data-quality finding (a compatibility
|
|
57
|
+
* issue, an undocumented variable, an abandoned contract, ...) -- every one
|
|
58
|
+
* of those becomes a `Finding` in the returned model's `finding` field
|
|
59
|
+
* instead. This is a real difference from `generateEnvManifest()`, which
|
|
60
|
+
* throws by default: that's a "should I write this artifact" gate, while
|
|
61
|
+
* Evidence Model assembly is a read-only snapshot whose entire purpose is
|
|
62
|
+
* representing such issues as data for a consumer's own projection to act
|
|
63
|
+
* on (see ADR 0024's mission statement). It still throws
|
|
64
|
+
* `EnvProjectGenerationError` for a genuine configuration error --
|
|
65
|
+
* `previousSnapshotLocation` escaping `root`.
|
|
66
|
+
*
|
|
67
|
+
* The dependency-graph scan underlying Dependency Model (via
|
|
68
|
+
* `buildDependencyModel()`) and the one underlying Finding Model's
|
|
69
|
+
* ownership-related findings (via `computeUsage()`) each run their own,
|
|
70
|
+
* independent pass over the repository -- a real, accepted cost of calling
|
|
71
|
+
* each half's already-tested public building block directly rather than
|
|
72
|
+
* hand-deriving a second copy of either's logic here. Both are Node-only,
|
|
73
|
+
* dev/CI-time-only work (never a runtime hot path), so the redundant I/O is
|
|
74
|
+
* an honest tradeoff, not an oversight.
|
|
75
|
+
*/
|
|
76
|
+
export declare function generateEvidenceModel(options: GenerateEvidenceModelOptions): Promise<EvidenceModel>;
|
|
77
|
+
//# sourceMappingURL=generate-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-evidence.d.ts","sourceRoot":"","sources":["../../../src/build/generate-evidence.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAYxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,iDAAiD;AACjD,MAAM,WAAW,4BAA4B;IAC3C,iFAAiF;IACjF,EAAE,EAAE,eAAe,CAAA;IACnB,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,yFAAyF;IACzF,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC9B,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC9B,uGAAuG;IACvG,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IACxC,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAA;IACrC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7C,+DAA+D;IAC/D,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACvC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAA;IACrD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,CAAA;CACzD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,aAAa,CAAC,CAqJxB"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { BuildFileSystem } from "./types.js";
|
|
2
|
+
import type { CompatibilityIssue } from "./compatibility.js";
|
|
3
|
+
import { type DiscoveredContract, type DiscoveredContractSummary, type LinkResult } from "./link.js";
|
|
4
|
+
import type { ParseWarning } from "./parse.js";
|
|
5
|
+
/** Options for {@link generateEnvManifest}. */
|
|
6
|
+
export interface GenerateEnvManifestOptions {
|
|
7
|
+
/** The filesystem capability -- `./build` never imports `node:fs` (ADR 0040). */
|
|
8
|
+
fs: BuildFileSystem;
|
|
9
|
+
/** Directory glob patterns are resolved against. Defaults to `process.cwd()`. */
|
|
10
|
+
root?: string | undefined;
|
|
11
|
+
/** Output path for the generated manifest, relative to `root` (e.g. "src/generated/env.manifest.ts"). */
|
|
12
|
+
location: string;
|
|
13
|
+
/** Glob patterns for schema files. Defaults to `["**\/env.schema.ts"]`. */
|
|
14
|
+
include?: string[] | undefined;
|
|
15
|
+
/** Glob patterns to exclude. Defaults to node_modules/dist/.git. */
|
|
16
|
+
exclude?: string[] | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* **Experimental** (see VERSIONING.md) -- explicit allowlist of installed
|
|
19
|
+
* package names whose declared `"envCap": { "schema": "<path>" }` entry
|
|
20
|
+
* point should also be discovered, so a contract that ships as its own
|
|
21
|
+
* separately-published package (no monorepo required) can be included in
|
|
22
|
+
* the manifest. Opt-in only: a package is never considered unless its
|
|
23
|
+
* exact name appears here. See ADR 0014.
|
|
24
|
+
*/
|
|
25
|
+
packages?: readonly string[] | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* **Experimental** (see VERSIONING.md) -- path to a tsconfig.json (relative to `root`)
|
|
28
|
+
* whose `compilerOptions.paths`/`baseUrl` resolve aliased import specifiers (e.g.
|
|
29
|
+
* `"@/lib/env.schema.js"`) encountered during static analysis, so a contract or consumer
|
|
30
|
+
* reached only through an alias isn't misreported as abandoned/unresolved. Defaults to
|
|
31
|
+
* `"tsconfig.json"` at `root` -- on automatically, no opt-in required, since (unlike
|
|
32
|
+
* `packages`) this never crosses a trust/versioning boundary: every resolved file is
|
|
33
|
+
* already local, already-trusted project source. Pass `false` to disable entirely. See
|
|
34
|
+
* ADR 0023.
|
|
35
|
+
*/
|
|
36
|
+
tsconfig?: string | false | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* "warn" (default): only provable incompatibilities (conflicting explicit processor
|
|
39
|
+
* return type annotations) block generation; everything else is reported as a warning.
|
|
40
|
+
* "throw": warnings are escalated to hard errors too, for stricter CI gates.
|
|
41
|
+
*/
|
|
42
|
+
onIncompatibility?: "warn" | "throw" | undefined;
|
|
43
|
+
}
|
|
44
|
+
/** The result of a completed {@link generateEnvManifest} run. */
|
|
45
|
+
export interface GenerateEnvManifestResult {
|
|
46
|
+
/** Absolute path the manifest file was written to. */
|
|
47
|
+
readonly outputPath: string;
|
|
48
|
+
/** Root-relative summary of every discovered contract, active or not. */
|
|
49
|
+
readonly contracts: readonly DiscoveredContractSummary[];
|
|
50
|
+
/** Non-blocking compatibility/exclusive-group issues (severity `"warning"`). */
|
|
51
|
+
readonly warnings: readonly CompatibilityIssue[];
|
|
52
|
+
/** Parse-time warnings collected across every analyzed file (including allow-listed package resolution). */
|
|
53
|
+
readonly parseWarnings: readonly ParseWarning[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Default value for {@link GenerateEnvManifestOptions.include}. A function
|
|
57
|
+
* (not a bare module-level `const`) so every call gets its own fresh array
|
|
58
|
+
* -- a shared literal used from many files (`evidence-cache.ts`,
|
|
59
|
+
* `generate-documentation.ts`, `generate-evidence.ts`,
|
|
60
|
+
* `generate-env-artifacts.ts`, `generate-usage.ts`) is a covered-static
|
|
61
|
+
* mutant magnet under Stryker's `coverageAnalysis: perTest` +
|
|
62
|
+
* `ignoreStatic: true` (a mutant on module-load code that's still referenced
|
|
63
|
+
* by a test is run anyway and falsely reported "Survived") -- see this
|
|
64
|
+
* drive's memory for the fully-documented limitation.
|
|
65
|
+
*/
|
|
66
|
+
export declare function defaultInclude(): string[];
|
|
67
|
+
/** Default value for {@link GenerateEnvManifestOptions.exclude}. Same reasoning as {@link defaultInclude}. */
|
|
68
|
+
export declare function defaultExclude(): string[];
|
|
69
|
+
export interface ManifestComputation {
|
|
70
|
+
readonly activeContracts: readonly DiscoveredContract[];
|
|
71
|
+
readonly contractSummaries: readonly DiscoveredContractSummary[];
|
|
72
|
+
readonly warnings: readonly CompatibilityIssue[];
|
|
73
|
+
readonly blocking: readonly CompatibilityIssue[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Pure -- no I/O. Runs compatibility (0005) and exclusive-group (0009,
|
|
77
|
+
* always-error, never gated by `onIncompatibility`) checks against an
|
|
78
|
+
* already-discovered contract graph and applies the `onIncompatibility` gate.
|
|
79
|
+
* Shared by the standalone `generateEnvManifest()` (which discovers its own
|
|
80
|
+
* graph) and `generate-env-artifacts.ts` (which discovers once and reuses it across
|
|
81
|
+
* manifest/docs/usage) -- see ADR 0011.
|
|
82
|
+
*/
|
|
83
|
+
export declare function computeManifest(root: string, linkResult: LinkResult, onIncompatibility: "warn" | "throw"): ManifestComputation;
|
|
84
|
+
/** Writes the manifest file. Callers must have already confirmed `outputPath` is safe and nothing is blocking. */
|
|
85
|
+
export declare function writeManifest(outputPath: string, activeContracts: readonly DiscoveredContract[], fs: BuildFileSystem): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Build-time only. Discovers `env.schema.ts` files, statically analyzes them
|
|
88
|
+
* (never executes them) to link `createEnv()`/`documentEnv()` calls, checks
|
|
89
|
+
* for provable incompatibilities between duplicate variable declarations,
|
|
90
|
+
* and writes a deterministic manifest file that re-exports every discovered
|
|
91
|
+
* active contract.
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
* Never call this at application startup or import it from
|
|
95
|
+
* runtime code -- wire it into an npm script, a bundler plugin, or a CI
|
|
96
|
+
* step instead.
|
|
97
|
+
*
|
|
98
|
+
* @throws {EnvManifestGenerationError} If `location` escapes `root`, or if a blocking compatibility/exclusive-group issue is found.
|
|
99
|
+
*/
|
|
100
|
+
export declare function generateEnvManifest(options: GenerateEnvManifestOptions): Promise<GenerateEnvManifestResult>;
|
|
101
|
+
//# sourceMappingURL=generate-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-manifest.d.ts","sourceRoot":"","sources":["../../../src/build/generate-manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAG5D,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,UAAU,EAChB,MAAM,WAAW,CAAA;AAElB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAG9C,+CAA+C;AAC/C,MAAM,WAAW,0BAA0B;IACzC,iFAAiF;IACjF,EAAE,EAAE,eAAe,CAAA;IACnB,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,yGAAyG;IACzG,QAAQ,EAAE,MAAM,CAAA;IAChB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC9B,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,SA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