Skip to main content

harn_cli/package/
mod.rs

1use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
2use std::ffi::OsStr;
3use std::fs::File;
4use std::path::{Path, PathBuf};
5use std::rc::Rc;
6use std::sync::{Arc, OnceLock};
7use std::time::{Duration, SystemTime, UNIX_EPOCH};
8use std::{fs, process};
9
10use chrono_tz::Tz;
11use fs2::FileExt;
12use regex::Regex;
13use serde::{Deserialize, Serialize};
14use sha2::{Digest, Sha256};
15use std::str::FromStr;
16use url::Url;
17
18const CONTENT_HASH_FILE: &str = ".harn-content-hash";
19const CACHE_METADATA_FILE: &str = ".harn-package-cache.toml";
20const HARN_CACHE_DIR_ENV: &str = "HARN_CACHE_DIR";
21const HARN_PACKAGE_REGISTRY_ENV: &str = "HARN_PACKAGE_REGISTRY";
22const DEFAULT_PACKAGE_REGISTRY_URL: &str = "https://packages.harnlang.com/index.toml";
23const CACHE_METADATA_VERSION: u32 = 1;
24const LOCK_FILE_VERSION: u32 = 1;
25const REGISTRY_INDEX_VERSION: u32 = 1;
26const PKG_DIR: &str = ".harn/packages";
27const MANIFEST: &str = "harn.toml";
28const LOCK_FILE: &str = "harn.lock";
29const TRIGGER_RETRY_MAX_LIMIT: u32 = 100;
30
31pub(crate) mod errors;
32mod extensions;
33mod lockfile;
34mod manifest;
35mod package_ops;
36mod registry;
37mod skills;
38mod validation;
39
40#[allow(unused_imports)]
41pub use errors::{PackageError, PackageResult};
42
43pub use extensions::*;
44#[cfg(test)]
45pub use lockfile::add_package;
46pub(crate) use lockfile::*;
47pub use lockfile::{
48    add_package_with_registry, ensure_dependencies_materialized, install_packages, lock_packages,
49    remove_package, update_packages,
50};
51pub use manifest::*;
52pub use package_ops::*;
53pub(crate) use registry::*;
54pub use registry::{
55    clean_package_cache, list_package_cache, search_package_registry, show_package_registry_info,
56    verify_package_cache,
57};
58pub use skills::*;
59pub(crate) use validation::*;
60
61#[cfg(test)]
62pub(crate) mod test_support;