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 =
23 "https://burin-labs.github.io/harn-cloud/package-index/harn-package-index.toml";
24const CACHE_METADATA_VERSION: u32 = 1;
25const LOCK_FILE_VERSION: u32 = 4;
26const REGISTRY_INDEX_VERSION: u32 = 1;
27const PKG_DIR: &str = ".harn/packages";
28const MANIFEST: &str = "harn.toml";
29const LOCK_FILE: &str = "harn.lock";
30const TRIGGER_RETRY_MAX_LIMIT: u32 = 100;
31
32pub(crate) mod errors;
33mod extensions;
34mod lockfile;
35mod manifest;
36mod maturity;
37mod package_ops;
38mod registry;
39mod skills;
40mod validation;
41
42#[allow(unused_imports)]
43pub use errors::{PackageError, PackageResult};
44
45pub use extensions::*;
46#[cfg(test)]
47pub use lockfile::add_package;
48pub(crate) use lockfile::*;
49pub use lockfile::{
50 add_package_with_registry, ensure_dependencies_materialized, install_packages, lock_packages,
51 remove_package, update_packages, PackageLockExport, PackageLockExports,
52};
53pub use manifest::*;
54pub use maturity::{
55 artifacts_check, artifacts_manifest, audit_packages, outdated_packages, ArtifactDriftReport,
56 AuditCode, AuditFinding, AuditReport, AuditSeverity, OutdatedEntry, OutdatedReport,
57 OutdatedStatus,
58};
59pub use package_ops::*;
60pub(crate) use registry::*;
61pub use registry::{
62 clean_package_cache, list_package_cache, search_package_registry, show_package_registry_info,
63 verify_package_cache,
64};
65pub use skills::*;
66pub(crate) use validation::*;
67
68#[cfg(test)]
69pub(crate) mod test_support;