Skip to main content

Module pkg

Module pkg 

Source
Expand description

pkg — the zpm plugin package manager (global store). zshrs plugin package manager (znative) — a GLOBAL-only package manager for zsh script plugins AND native (Rust cdylib) plugins.

Ported from strykelang’s package manager (strykelang/pkg/), retargeted from .stk modules to zshrs plugins and simplified to the global-store model (no per-project manifest/lockfile — the global install index at $ZSHRS_HOME/pkg/installed.toml is the single source of truth).

World’s first: a compiled Unix shell whose package manager installs and loads BOTH interpreted (zsh) and compiled (Rust cdylib) plugins from one content-addressed global store, with SHA-256 integrity pinning.

Surface:

  • [manifest] — a plugin’s optional znative.toml ([plugin]/[native]/ [script]); auto-detected when absent.
  • [store] — $ZSHRS_HOME/pkg/{store,cache,git,bin}/ layout + the installed.toml global index.
  • [resolver] — turn a source spec (owner/repo, git+URL, path:DIR) into a staged directory ready to install.
  • [commands] — znative {add,remove,list,info,load,update} implementations.
  • builtin — the znative builtin dispatcher (wired from fusevm_bridge).

Modules§

builtin
The znative builtin — argv dispatcher over super::commands. Wired from fusevm_bridge alongside the other zshrs-original z* builtins. Errors print as znative: <reason> on stderr (terse zsh style) and return 1.
commands
znative subcommand implementations (global model). Ported in spirit from strykelang’s pkg/commands.rs, reduced to the global store: install a plugin, record it in installed.toml, and load it — natives via the zmodload -R plugin host, scripts via source + $fpath.
manifest
A plugin’s optional znative.toml, declaring how the plugin is loaded.
resolver
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).
store
Global store + installed index. Ported from strykelang’s pkg/store.rs, retargeted to $ZSHRS_HOME/pkg/ and reduced to the global-only model.

Enums§

PkgError
Errors emitted by the package manager. Display produces the one-line reason (no znative: prefix — the builtin adds it).

Functions§

store_integrity
Deterministic SHA-256 of a directory tree, sha256-<hex>. Ported from strykelang pkg/lockfile.rs::integrity_for_directory. Files are walked in sorted order so the hash is stable regardless of filesystem iteration; each file contributes <relpath>\0F\0<len>\n<bytes>\n, symlinks their target. Recorded in the install index for change detection / audit.

Type Aliases§

PkgResult
Result alias used throughout the package manager. Errors are stringly-typed (one user-facing diagnostic per failure path), emitted to stderr as znative: <reason> with exit code 1 — matching the shell’s terse error style.