1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//! Package system for oxi CLI
//!
//! Packages bundle extensions, skills, prompts, and themes for sharing.
//! Supports local directories, npm packages, git repositories, GitHub
//! shorthand, and URL-based archives.
//!
//! ## Package sources
//!
//! - **Local path**: a directory with `oxi-package.toml` or auto-discoverable resources
//! - **npm**: `npm:<package>[@<version>]` — resolved from the npm registry
//! - **git**: `https://github.com/org/repo.git[@ref]`, `git://…`, `git+ssh://…`
//! - **GitHub shorthand**: `github:org/repo[@ref]`
//! - **URL**: direct `.tar.gz` / `.zip` archive
//!
//! ## Package manifest
//!
//! A package is a directory containing an `oxi-package.toml` file:
//!
//! ```toml
//! name = "@foo/oxi-tools"
//! version = "1.0.0"
//! extensions = ["ext/index.ts"]
//! skills = ["skills/code-review/SKILL.md"]
//! prompts = ["prompts/review.md"]
//! themes = ["themes/dark-pro.json"]
//! ```
//!
//! ## Resource discovery
//!
//! When a package lacks explicit resource lists, resources are discovered
//! automatically by scanning the package directory:
//! - **Extensions**: `.so`, `.dylib`, `.dll` files, or `index.ts`/`index.js` entries
//! - **Skills**: Directories containing `SKILL.md`
//! - **Prompts**: `.md` files in `prompts/` subdirectory
//! - **Themes**: `.json` files in `themes/` subdirectory
//!
//! ## Lockfile
//!
//! An `oxi-lock.json` file records exact versions/refs for reproducibility.
//!
//! ## Module layout
//!
//! The package subsystem is split across several submodules for
//! navigability. Public re-exports at the bottom preserve the original
//! `crate::storage::packages::*` API.
//!
//! - `types` — core data types (manifest, kind, scope, progress events)
//! - `source` — source-spec parsing (`ParsedSource`, npm/git/url helpers)
//! - `npm` — npm registry client (`NpmPackageInfo`)
//! - `git_ops` — git command wrappers (`git_clone`, `git_update`, …)
//! - `lockfile` — lockfile types + SHA-256 integrity helpers
//! - `discovery` — auto-discovery of resources in a package directory
//! - `fs` — generic filesystem helpers (`copy_dir_recursive`, …)
//! - `manager` — `PackageManager` facade + tests
// ── Constants ─────────────────────────────────────────────────────────
//
// These three names are referenced by every submodule (manifest paths,
// the lockfile), so they live here in the parent module and are picked
// up by children via `super::MANIFEST_NAME`, etc.
pub const LOCKFILE_NAME: &str = "oxi-lock.json";
pub const MANIFEST_NAME: &str = "oxi-package.toml";
pub const NPM_MANIFEST_NAME: &str = "package.json";
// Public re-exports preserve the original `crate::storage::packages::*`
// surface so existing callers (`use oxi::storage::packages::*`) keep
// working without churn.
pub use ;
pub use PackageManager;
pub use ;
pub use ParsedSource;
pub use ;