aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-vcs/src/downloader/mod.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-23 11:38:42 +0900
committernsfisis <nsfisis@gmail.com>2026-02-23 11:38:42 +0900
commit0080efea9386d46f65d1862fcb90eb44999d9761 (patch)
treee9f7e17b3f12ff9b09b3df0848fd55e91003cd23 /crates/mozart-vcs/src/downloader/mod.rs
parenteb1e21c059d83f0af9786e4d3cace80afe8456a2 (diff)
downloadphp-mozart-0080efea9386d46f65d1862fcb90eb44999d9761.tar.gz
php-mozart-0080efea9386d46f65d1862fcb90eb44999d9761.tar.zst
php-mozart-0080efea9386d46f65d1862fcb90eb44999d9761.zip
feat(vcs): add mozart-vcs crate for VCS repository support
Implement VCS driver/downloader infrastructure mirroring Composer's VCS subsystem. Includes drivers for GitHub, GitLab, Bitbucket, Forgejo, Git, Hg, and SVN with API-based metadata resolution, plus source downloaders for Git/Hg/SVN. Integrates into mozart-registry via vcs_bridge module to scan VCS repositories and feed discovered packages into the SAT resolver. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart-vcs/src/downloader/mod.rs')
-rw-r--r--crates/mozart-vcs/src/downloader/mod.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/crates/mozart-vcs/src/downloader/mod.rs b/crates/mozart-vcs/src/downloader/mod.rs
new file mode 100644
index 0000000..7186348
--- /dev/null
+++ b/crates/mozart-vcs/src/downloader/mod.rs
@@ -0,0 +1,31 @@
+pub mod git;
+pub mod hg;
+pub mod svn;
+
+use std::path::Path;
+
+use anyhow::Result;
+
+/// The VCS downloader interface.
+///
+/// Corresponds to Composer's `VcsDownloader` hierarchy.
+pub trait VcsDownloader {
+ /// Prepare for installation (e.g., sync mirror cache).
+ fn download(&self, url: &str, reference: &str, target: &Path) -> Result<()>;
+
+ /// Install (clone/checkout) the source to the target directory.
+ fn install(&self, url: &str, reference: &str, target: &Path) -> Result<()>;
+
+ /// Update the source at target to a new reference.
+ fn update(&self, url: &str, old_ref: &str, new_ref: &str, target: &Path) -> Result<()>;
+
+ /// Remove the source from the target directory.
+ fn remove(&self, target: &Path) -> Result<()>;
+
+ /// Detect local changes in the working copy.
+ /// Returns `None` if clean, `Some(diff)` if modified.
+ fn local_changes(&self, target: &Path) -> Result<Option<String>>;
+
+ /// Get commit log between two references.
+ fn commit_logs(&self, from: &str, to: &str, target: &Path) -> Result<String>;
+}