Skip to main content

cardinal_kernel/pack/
mod.rs

1//! Cardinal Codex Pack System
2//!
3//! This module provides functionality for creating, loading, and managing
4//! .ccpack files - single-file distributable bundles of card definitions
5//! and Rhai scripts.
6//!
7//! # Overview
8//!
9//! A `.ccpack` file is a deterministic, compressed archive containing:
10//! - `pack.toml`: Pack metadata (ID, version, dependencies)
11//! - `cards/*.toml`: Card definition files
12//! - `scripts/*.rhai`: Rhai script files
13//! - `manifest.toml`: Auto-generated file list with hashes
14//!
15//! # Format
16//!
17//! The pack format is:
18//! - Deterministic: Same input → same output
19//! - Portable: Single file, no extraction needed
20//! - Inspectable: Can list contents without extraction
21//! - Verifiable: Includes SHA-256 hashes for all files
22//!
23//! # Example Usage
24//!
25//! ```no_run
26//! use cardinal::pack::{build_pack, load_pack, list_pack};
27//!
28//! // Build a pack from a directory
29//! build_pack("./my-pack", "./output/my-pack.ccpack").unwrap();
30//!
31//! // List pack contents
32//! list_pack("./output/my-pack.ccpack").unwrap();
33//!
34//! // Load pack into memory
35//! let (manifest, files) = load_pack("./output/my-pack.ccpack").unwrap();
36//! ```
37
38pub mod metadata;
39pub mod builder;
40pub mod loader;
41
42// Re-export main API
43pub use metadata::{PackMeta, FileEntry, Manifest};
44pub use builder::build_pack;
45pub use loader::{load_pack, list_pack, unpack_pack};