Documentation
¶
Overview ¶
Package validate exposes syntax validation for external consumers.
This is the public API for mache's AST validation. Since mache-73b885 it is backed by the pinned leyline daemon's `validate` op (ley-line-open >= v0.8.0) instead of in-process tree-sitter. As of v0.8.0 the daemon validates EVERY mache registry language except CUE (no tree-sitter-0.26 grammar exists); HCL/Terraform validates in-process via hclsyntax (a fast, offline path — the daemon covers it too). Only .cue and unrecognized extensions pass through with no error. A leyline daemon is acquired lazily on first use (see internal/leyline ValidateContent for the latency profile); daemon-acquisition failures surface as ordinary errors, never as false "valid" results.
Usage:
err := validate.File("path/to/file.go")
errors := validate.FileErrors("path/to/file.go")
err := validate.Content([]byte("package main"), "main.go")
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Content ¶
Content validates content for the language inferred from filePath's extension. Returns nil if the AST is clean or the extension is not validated (pass-through).
func SupportedExtension ¶
SupportedExtension returns true if the file extension is validated by the leyline daemon's validate op.
Types ¶
type ValidationError ¶
type ValidationError = writeback.ValidationError
ValidationError contains structured information about a syntax error.
func ContentErrors ¶
func ContentErrors(content []byte, filePath string) []ValidationError
ContentErrors returns all AST error locations for diagnostic reporting. Returns nil if no errors or unknown language.
func FileErrors ¶
func FileErrors(filePath string) []ValidationError
FileErrors reads a file from disk and returns all AST error locations.