Skip to main content

Crate zoi

Crate zoi 

Source
Expand description

§Zoi: The Advanced Package Manager & Environment Orchestrator

This crate provides the core functionality of Zoi as a library, allowing other Rust applications to leverage its package management and environment setup capabilities.

Architectural Design: Zoi’s library API is designed around “Pragmatic Transactionality”. It allows programmatic control over the two-phase installation process, SAT-based dependency resolution, and cryptographically verified registry state.

For user documentation please visit Zoi’s Docs.

§Key Library Entry Points:

  • install_sources: The high-level API used by the CLI for standard installations.
  • resolve_dependency_graph: Calculate required packages without modifying disk.
  • build_with_options: Create distributable .zpa archives.

§Getting Started

To use Zoi as a library, add it using cargo or as a dependency in your Cargo.toml:

cargo add zoi-rs
[dependencies]
zoi-rs = "1"

§Example: Install a package

use std::path::Path;

use anyhow::Result;
use zoi::{Scope, install_package_with_options};

fn main() -> Result<()> {
    let archive_path =
        Path::new("path/to/your/package-1.0.0-linux-amd64.zpa");
    let options = zoi::PackageInstallOptions {
        scope_override: Some(Scope::User),
        registry_handle: "local".to_string(),
        yes: true,
        ..Default::default()
    };

    let installed_files =
        install_package_with_options(archive_path, &options)?;

    println!(
        "Package installed successfully. {} files were installed.",
        installed_files.len()
    );

    Ok(())
}

Re-exports§

pub use project;

Modules§

alternatives
Built-in package definitions and resources. The alternatives mechanism: choosing between interchangeable implementations.
cli
Command-line argument parsing and definitions.
cmd
Implementation of CLI commands. This module contains the implementations for all Zoi CLI commands.
pkg
Package-related CLI logic.
types
Core types used across the codebase.
utils
General utility functions.

Structs§

BuildOptions
Options for building a package from a .pkg.lua definition.
DependencyResolution
Dependency graph resolution result.
DependencyResolutionOptions
Options for resolving a dependency graph without installing packages.
PackageInstallOptions
Options for installing a local .zpa archive.
ResolvedPackage
Result of resolving a single package source.
SourceInstallOptions
Options for installing one or more package source strings.

Enums§

Scope
The installation scope for a package.

Functions§

build
Builds a Zoi package from a local .pkg.lua file.
build_with_options
Builds a Zoi package from a .pkg.lua definition using the provided options.
bundle_package
Bundles a Zoi package and its local assets into a .zsa archive.
install_package
Installs a Zoi package from a local package archive.
install_package_with_options
Installs a local .zpa package archive using the provided options.
install_sources
Installs one or more package sources using the provided options.
resolve_dependency_graph
Resolves the dependency graph for one or more package sources.
resolve_package
Resolves a single source string into a package and its origin metadata.
uninstall_package
Uninstalls a Zoi package.
update_packages
Updates one or more installed packages.