Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrConflict = errors.New("compiler: directive conflicts detected")
ErrConflict is returned when directive conflicts are detected.
var ErrNotInstalled = errors.New("compiler: mln.lock not found — run mln install first")
ErrNotInstalled is returned when mln.lock does not exist. The user should run mln install first.
Functions ¶
func Compile ¶
func Compile(opts CompileOptions) error
Compile runs the full compile pipeline:
- Load mln.lock — return ErrNotInstalled if missing.
- Load each installed markdown file from .mln/ into []InstalledFile.
- Run conflict detection via Detect(). If conflicts found, call Print() and return ErrConflict. Do not write any output files on conflict.
- If clean, group InstalledFiles by their declared output target from mln.yaml outputs block.
- Call Assemble per output target group.
- Write each assembled string to its declared target path on disk (unless DryRun or CheckOnly).
- Print a summary of written files.
func Print ¶
Print formats conflicts into a human-readable terminal report and writes it to w. For each conflict it prints:
- the directive key in conflict
- which packages define it
- each package's conflicting value
- a suggested resolution: remove one conflicting dep from mln.yaml, or add a manual override directive in the mln.yaml outputs block.
Uses github.com/fatih/color for colored output. The caller is responsible for exiting non-zero after calling Print.
Types ¶
type CompileOptions ¶
type CompileOptions struct {
ProjectDir string // root of the project (where mln.yaml and mln.lock live)
DryRun bool // if true, print what would be written but do not write files
CheckOnly bool // if true, run conflict detection only, do not write files
}
CompileOptions controls the behavior of Compile.
type Conflict ¶
type Conflict struct {
Key string // the conflicting directive key
Instances []injector.Directive // all definitions of this key across installed files
}
Conflict represents two or more deps that define the same directive key with different values.
func Detect ¶
func Detect(files []injector.InstalledFile) []Conflict
Detect parses @directive lines from each InstalledFile and returns a []Conflict for every directive key defined with more than one distinct value.
Only lines matching "@directive:<key>: <value>" are checked. Plain prose is NOT conflict-checked in MVP. An empty return slice means the install is clean and safe to assemble.