# GenerateContextType

TYPE in `@skmtc/core 0.63.4`

The type of the `context` that `transform`, projections and snippets
receive. Use it as the type of a `context` argument in a generator.

`GenerateContext` implements it. See that class for what a generator
does with the context.

## Signature

```ts
import type { GenerateContextType } from '@skmtc/core'
```

## Properties

- `settings` (ClientSettings | undefined, required)
- `logger` (Logger, required): The run's logger. A line logged inside a transform carries the subject's stack trail, and a `warn` or `error` line sets the subject's result to `'warning'` or `'error'`.
- `pendingStack` (PendingDefinition[], required): The pending models, outermost first: the last is the model whose projection constructor is running, the source of any reference made now. Kept by the `ModelDriver`.
- `document` (SkmtcParsedDocument, required)
- `attribution` (AttributionState): Attribution (gen-maps) state. It does not decide whether a `SnippetBase` wraps its `toString`: `capturesRender` does.
- `captureSink` (CaptureSink | undefined, required): The active attribution capture sink, or `undefined` outside the capture interval. Read by every `SnippetBase` instance's `toString` wrapper; `RenderContext` opens/closes the interval through the shared `CaptureChannel` that `CoreContext` wires into both contexts. In a run with no capturing render (`capturesRender` false, as in a bare test mock) no snippet has a wrapper, so nothing reads it.
- `capturesRender` (boolean, required): Whether the run has a capturing render (attribution emission is configured). Read once by every `SnippetBase` instance, at construction: it installs its `toString` wrapper only when this is true.
- `toArtifacts` ((stackTrail: StackTrail) => GenerateResult, required)
- `registerJson` ((args: RegisterJsonArgs) => void, required)
- `registerMarkdown` ((args: RegisterMarkdownArgs) => void, required)
- `register` ((args: ContextRegisterArgs) => void, required)
- `getFile` ((filePath: string) => FileBase | undefined, required): Look up an existing file by path (no creation); the neutral read primitive. Throws for a file given to the host by `onArtifact`.
- `getFileByWorkspacePath` ((path: WorkspacePath) => FileBase | undefined, required): Look up an existing file by its normalized path, which is its key: a miss is not normalized again. Throws for a file given to the host by `onArtifact`.
- `inspectedFiles` (ReadonlyMap<string, FileBase>, required): Read-only view of every file generated so far, without those given to the host by `onArtifact` - an inspection/tooling seam (not coordination).
- `addFile` (<File extends FileBase>(file: File) => File, required): Store a language-constructed file; the neutral write primitive. Returns the stored file.
- `insertOperation` (<V extends GeneratedValue, EnrichmentType = undefined, ProjectionOptions = undefined>(args: InsertOperationArgs<V, EnrichmentType, ProjectionOptions>) => Inserted<V, EnrichmentType>, required)
- `insertNormalizedModel` (<V extends GeneratedValue, Schema extends OasSchema | OasRef<'schema'> | OasVoid, EnrichmentType, ProjectionOptions = undefined>(projection: NormalizedModelProjection<V, EnrichmentType, ProjectionOptions>, args: InsertNormalizedModelArgs<Schema>, ...rest: ProjectionOptionsRest<InsertNormalizedModelOptions<ProjectionOptions>, ProjectionOptions>) => InsertNormalizedModelReturn<V, Schema>, required)
- `insertModel` (<V extends GeneratedValue, EnrichmentType, ProjectionOptions = undefined>(projection: ModelProjection<V, EnrichmentType, ProjectionOptions>, ref: RefParts, ...rest: ProjectionOptionsRest<InsertModelOptions<ProjectionOptions>, ProjectionOptions>) => Inserted<V, EnrichmentType>, required)
- `toOperationContentSettings` (<V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: ToOperationSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>, required)
- `insertWebhook` (<V extends GeneratedValue, EnrichmentType = undefined, ProjectionOptions = undefined>(args: InsertWebhookArgs<V, EnrichmentType, ProjectionOptions>) => Inserted<V, EnrichmentType>, required)
- `toWebhookContentSettings` (<V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: ToWebhookSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>, required)
- `toModelContentSettings` (<V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: BuildModelSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>, required)
- `resolveSchemaRefOnce` ((ref: RefParts) => OasSchema | OasRef<'schema'>, required)
- `findDefinition` ((args: FindDefinitionArgs) => DefinitionBase | undefined, required): The Definition named `name` in `exportPath` (or inside the declaration `into`), or `undefined`.
- `readEnrichment` ((segments: readonly string[]) => unknown, required): The recording enrichment accessor - the single choke point every enrichment lookup routes through. Reads the node at `settings.enrichments[...segments]` (segments are literal keys, never dotted paths) and records the read for the post-walk consumption audit, so configured-but-never-read entries surface as `UNCONSUMED_ENRICHMENT` warnings.
- `parseEnrichments` (<EnrichmentType>(args: ParseEnrichmentsArgs<EnrichmentType>) => EnrichmentType, required): Read the `{ subject, generator, stack }` enrichments of a generator and parse them with `schema`. An entry's `toEnrichments` calls it with the place of its kind of subject. Each read is recorded for the audit (`GenerateContextType.readEnrichment`), and each key that the schema drops is reported.
- `reportEnrichmentWarning` ((warning: EnrichmentWarning) => void, required): Add an enrichment warning to this run's audit, deduplicated on `(type, path)`. Used by `parseEnrichments` for `UNKNOWN_ENRICHMENT_KEY` reports; the warnings surface on `GenerateResult.enrichmentWarnings` and ride the manifest.
