Skip to main content

Module resolver

Module resolver 

Source
Expand description

Resolve a user-supplied source spec into a staged plugin directory. Adapted from strykelang’s pkg/resolver.rs, trimmed to the three source forms zshrs plugins ship as (no semver/registry graph — global model).

Source forms accepted by znative add <SOURCE>:

  • owner/repo or github:owner/repogit clone https://github.com/owner/repo
  • git+URL, or any URL ending in .gitgit clone URL
  • path:DIR, an absolute path, or ./rel, ../rel → a local directory

@REF may be appended to a git/github source to pin a branch/tag/commit (owner/repo@v1.2.0). The resolver clones into $ZSHRS_HOME/pkg/git/ and returns the working tree; the caller copies the loadable subset into the content-addressed store.

Structs§

Staged
A staged source ready to install into the store.

Functions§

resolve
Resolve spec into a Staged tree. Clones (git/github) land under store.git_dir(); local paths are used in place.
source_label
The provenance label a spec WOULD receive, computed WITHOUT cloning or network access. Used by znative load <spec> to check whether a source is already installed (the index keys on this label, since a repo’s basename often differs from its znative.toml plugin name — e.g. zshrs-forgitforgit). Returns None for a bare plugin name (not a source form).