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.zpaarchives.
§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§
- Build
Options - Options for building a package from a
.pkg.luadefinition. - Dependency
Resolution - Dependency graph resolution result.
- Dependency
Resolution Options - Options for resolving a dependency graph without installing packages.
- Package
Install Options - Options for installing a local
.zpaarchive. - Resolved
Package - Result of resolving a single package source.
- Source
Install Options - 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.luafile. - build_
with_ options - Builds a Zoi package from a
.pkg.luadefinition using the provided options. - bundle_
package - Bundles a Zoi package and its local assets into a
.zsaarchive. - install_
package - Installs a Zoi package from a local package archive.
- install_
package_ with_ options - Installs a local
.zpapackage 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.