Skip to content

base

base

Source resolver ABC + ResolvedSkill dataclass.

Classes

ResolvedSkill dataclass

ResolvedSkill(name: str, source: str, path: Path, category: str, description: str, commit: str, sidecar_data: Dict[str, Any] = dict())

A skill found in an upstream source, ready to import.

Lightweight — does not include the full SKILL.md body. The importer reads the file from path when actually installing.

SourceResolver

Bases: ABC

Abstract base for a skill source resolver.

Implementations clone or pull an upstream repo into a cache directory, walk the cache to find SKILL.md files, and return ResolvedSkill objects that the importer can install.

Functions
cache_dir abstractmethod
cache_dir() -> Path

Where this source clones its repo.

Source code in src/openjarvis/skills/sources/base.py
@abstractmethod
def cache_dir(self) -> Path:
    """Where this source clones its repo."""
sync abstractmethod
sync() -> None

Clone or pull the upstream repo into the cache.

Source code in src/openjarvis/skills/sources/base.py
@abstractmethod
def sync(self) -> None:
    """Clone or pull the upstream repo into the cache."""
list_skills abstractmethod
list_skills() -> List[ResolvedSkill]

Walk the cache directory and return all discoverable skills.

Source code in src/openjarvis/skills/sources/base.py
@abstractmethod
def list_skills(self) -> List[ResolvedSkill]:
    """Walk the cache directory and return all discoverable skills."""
resolve
resolve(query: str) -> List[ResolvedSkill]

Filter list_skills() by name (substring match).

Empty query returns all skills.

Source code in src/openjarvis/skills/sources/base.py
def resolve(self, query: str) -> List[ResolvedSkill]:
    """Filter list_skills() by name (substring match).

    Empty *query* returns all skills.
    """
    all_skills = self.list_skills()
    if not query:
        return all_skills
    q = query.lower()
    return [s for s in all_skills if q in s.name.lower()]
filter_by_category
filter_by_category(category: str) -> List[ResolvedSkill]

Return skills whose category exactly matches category.

Source code in src/openjarvis/skills/sources/base.py
def filter_by_category(self, category: str) -> List[ResolvedSkill]:
    """Return skills whose category exactly matches *category*."""
    return [s for s in self.list_skills() if s.category == category]