Expand description
CLI-side glue that assembles harn-vm’s layered skill discovery
from the inputs harn run / harn test / harn check see at
startup: repeatable --skill-dir, $HARN_SKILLS_PATH, the nearest
harn.toml, and the user’s home / system directories.
The output is a pre-populated skills VM global — a registry dict
in the shape the existing skill_* builtins already understand, so
scripts can call skill_count(skills) / skill_find(skills, name)
without any new language surface.
Structs§
- Loaded
Skills - Bundle of everything the run path needs: the registry VmValue to set
as a global, plus the raw discovery report (for
harn doctorand post-run diagnostics). Theloader_warningsvec carries per-skill messages — unknown frontmatter fields, unreadable SKILL.md files — that the caller prints to stderr before the VM starts. - Skill
Loader Inputs - Inputs threaded in from the CLI layer. Anything we can compute from the environment or from the source path we compute internally; this struct captures only the stuff the user passed via flags.
Functions§
- canonicalize_
cli_ dirs - Convenience: canonicalize CLI-provided
--skill-dirpaths against the provided cwd (or the process cwd whenNone). Non-existent paths are kept as-is soharn doctorcan flag the typo. - emit_
loader_ warnings - Print loader warnings to stderr. Non-fatal — a malformed SKILL.md simply doesn’t participate in the registry.
- install_
skills_ global - Set the resolved skill registry as the VM global
skills. Safe to call even when no skills were discovered — the value is an emptyskill_registrysoskill_count(skills)still returns0. - load_
skills - Build a
LoadedSkillsfrom CLI inputs. Does no I/O unless one of the input layers has a directory to walk.