Skip to main content

Interface: Selector

Defined in: packages/core/src/domain/value-objects/selector.ts:11

Identifies one or more nodes in an artifact's AST.

Used in delta entries (to target nodes for modification or removal), in metadataExtraction (to extract spec content), and in validation rules (to assert structural constraints).

All string fields (matches, contains, where values) are matched case-insensitively as regular expressions.

Properties

contains?

readonly optional contains?: string

Defined in: packages/core/src/domain/value-objects/selector.ts:17

Regex matched case-insensitively against the node's value.


index?

readonly optional index?: number

Defined in: packages/core/src/domain/value-objects/selector.ts:24

Targets the item at this zero-based index within an array-item or sequence-item list. Mutually exclusive with where.


level?

readonly optional level?: number

Defined in: packages/core/src/domain/value-objects/selector.ts:35

For markdown section nodes, matches only sections at this heading level (1 = #, 2 = ##, etc.). Non-markdown nodes without level will not match.


matches?

readonly optional matches?: string

Defined in: packages/core/src/domain/value-objects/selector.ts:15

Regex matched case-insensitively against the node's label.


parent?

readonly optional parent?: Selector

Defined in: packages/core/src/domain/value-objects/selector.ts:19

Constrains the search to nodes whose nearest ancestor matches this selector.


type

readonly type: string

Defined in: packages/core/src/domain/value-objects/selector.ts:13

Node type; must be one of the values returned by ArtifactParser.nodeTypes().


where?

readonly optional where?: Readonly<Record<string, string>>

Defined in: packages/core/src/domain/value-objects/selector.ts:30

For array-item / sequence-item nodes that are objects, targets the item whose fields match all key–value pairs (values are case-insensitive regex). Mutually exclusive with index.