Skip to main content

Interface: Extractor

Defined in: packages/core/src/domain/value-objects/extractor.ts:54

Declares how to extract structured content from an AST.

Generic, reusable value object — can be used by metadata extraction, compliance gates, impact analysis, or any feature that needs to pull structured data from artifact ASTs.

Selector handles node selection. Extractor adds post-processing: what to extract from matched nodes, how to clean up the result, and optionally how to map matched nodes into structured objects.

Properties

capture?

readonly optional capture?: string

Defined in: packages/core/src/domain/value-objects/extractor.ts:60

Regex with capture group applied to the extracted text.


extract?

readonly optional extract?: "content" | "label" | "both"

Defined in: packages/core/src/domain/value-objects/extractor.ts:58

What to extract from each matched node. Defaults to 'content'.


fields?

readonly optional fields?: Readonly<Record<string, FieldMapping>>

Defined in: packages/core/src/domain/value-objects/extractor.ts:71

Structured field mapping for complex objects. When present, each matched node produces one object with the declared fields.


groupBy?

readonly optional groupBy?: "label"

Defined in: packages/core/src/domain/value-objects/extractor.ts:64

Group matched nodes by their label (after strip).


selector

readonly selector: Selector

Defined in: packages/core/src/domain/value-objects/extractor.ts:56

Selector identifying the AST node(s) to extract from.


strip?

readonly optional strip?: string

Defined in: packages/core/src/domain/value-objects/extractor.ts:62

Regex removed from labels/values before output.


transform?

readonly optional transform?: ExtractorTransformDeclaration

Defined in: packages/core/src/domain/value-objects/extractor.ts:66

Named post-processing callback (e.g. 'resolveSpecPath').