Interface: ArtifactParser
Defined in: packages/core/src/application/ports/artifact-parser.ts:64
Domain port that abstracts all file-type-specific parsing, delta application, and serialization. Each supported file format has a corresponding infrastructure adapter implementing this port.
Injected at the application layer — domain services never reference concrete parsers directly.
Properties
fileExtensions
readonlyfileExtensions: readonlystring[]
Defined in: packages/core/src/application/ports/artifact-parser.ts:66
File extensions this adapter handles, e.g. ['.md'] or ['.json'].
Methods
apply()
apply(
ast,delta):ArtifactAST
Defined in: packages/core/src/application/ports/artifact-parser.ts:77
Applies a sequence of delta entries to an AST. All selectors are resolved before any operation is applied — if any selector fails to resolve (no match or ambiguous match), the entire application is rejected with DeltaApplicationError.
Parameters
ast
delta
readonly DeltaEntry[]
Returns
deltaInstructions()
deltaInstructions():
string
Defined in: packages/core/src/application/ports/artifact-parser.ts:102
Returns a format-specific static text block that CompileContext injects
verbatim when delta: true is active for the artifact.
Returns
string
nodeTypes()
nodeTypes(): readonly
NodeTypeDescriptor[]
Defined in: packages/core/src/application/ports/artifact-parser.ts:90
Returns a static description of all addressable node types for this format.
Returns
readonly NodeTypeDescriptor[]
outline()
outline(
ast): readonlyOutlineEntry[]
Defined in: packages/core/src/application/ports/artifact-parser.ts:96
Returns a simplified navigable summary of the artifact's addressable nodes.
CompileContext injects this outline when asking the LLM to generate a delta.
Parameters
ast
Returns
readonly OutlineEntry[]
parse()
parse(
content):ArtifactAST
Defined in: packages/core/src/application/ports/artifact-parser.ts:69
Parses artifact content into a normalized AST.
Parameters
content
string
Returns
parseDelta()
parseDelta(
content): readonlyDeltaEntry[]
Defined in: packages/core/src/application/ports/artifact-parser.ts:112
Parses a YAML delta file's raw content into a typed array of delta entries.
Called by ValidateArtifacts on the YAML adapter to convert the raw delta
file into DeltaEntry[] before passing them to apply(). Only the YAML
adapter is expected to return a non-empty result — other adapters may return
an empty array.
Parameters
content
string
Returns
readonly DeltaEntry[]
renderSubtree()
renderSubtree(
node):string
Defined in: packages/core/src/application/ports/artifact-parser.ts:87
Serializes a single AST node and all its descendants back to the artifact's
native format string. Used by ValidateArtifacts to evaluate contentMatches
and by the metadata extraction engine to extract spec content.
Parameters
node
Returns
string
serialize()
serialize(
ast):string
Defined in: packages/core/src/application/ports/artifact-parser.ts:80
Serializes an AST back to the artifact's native format string.
Parameters
ast
Returns
string