Rules system
Rules are the core mechanism for automatically extracting metadata from file and folder names. Instead of manually tagging every model, you write rules once in a findamodel.yaml file and FindAModel computes the correct values for every file at index time.
Why use rules?
If you already organise your models into a logical folder structure - creators at the top level, then collections, then categories - rules let you extract that information without duplicating it in config files.
For example, a folder tree like:
Alice/
Fantasy/
Elves/
elf_warrior_supported.stl
elf_mage.stl
With a single root-level findamodel.yaml, rules can automatically extract:
creator= “Alice” (from the root folder name)collection= “Fantasy” (from the second-level folder)model_name= “Elf Warrior” or “Elf Mage” (from the filename)supported=true/false(from whether “supported” appears in the filename)tags= additional per-model tags (for example, addingsupportedwhen filenames match)
Rule types
FindAModel supports one rule type:
| Rule | Best for |
|---|---|
regex | Matching patterns anywhere in the path - folder names, full path, or filename |
Rule syntax
A rule replaces the plain value for a field with a YAML object:
field_name:
rule: regex
<option>: <value>
...
rule: regex is optional - if omitted, regex is assumed.
Rules go in findamodel.yaml files alongside (or instead of) plain values. They are inherited by subdirectories just like plain values - see Inheritance.
Evaluation order
For each model file, metadata is resolved in this order (highest priority last):
- Inherited plain values from ancestor directories
- Own plain value in this directory’s
findamodel.yaml - Inherited rule from an ancestor directory
- Own rule in this directory’s
findamodel.yaml model_metadataper-file override ← highest priority
Rules override plain values of equal or lower specificity. A plain value in the same directory as a rule means the plain value is ignored - the rule takes effect instead.
Next steps
- Regex rule - match and extract values from path segments