Skip to main content

hyprstream_core/cli/commands/
git.rs

1//! Git-style model management commands for Phase 1
2//!
3//! Provides essential git operations for training workflows:
4//! - branch: Create new branches for experiments
5//! - checkout: Switch between branches/tags/commits
6//! - status: Show current branch and changes
7//! - commit: Save changes to git history
8
9use clap::{Args, Subcommand};
10
11/// Git-style model management commands
12#[derive(Args)]
13pub struct GitCommand {
14    #[command(subcommand)]
15    pub action: GitAction,
16}
17
18/// Git management actions
19#[derive(Subcommand)]
20pub enum GitAction {
21    /// Create a new branch
22    Branch {
23        /// Model name or reference
24        model: String,
25
26        /// Name for the new branch
27        name: String,
28
29        /// Create from specific ref (default: current HEAD)
30        #[arg(long)]
31        from: Option<String>,
32    },
33
34    /// Switch branches or checkout specific commit/tag
35    Checkout {
36        /// Model reference (e.g., "llama3:main", "llama3:v2.0")
37        model_ref: String,
38
39        /// Create new branch if it doesn't exist
40        #[arg(short = 'b')]
41        create_branch: bool,
42
43        /// Force checkout, discarding local changes
44        #[arg(long)]
45        force: bool,
46    },
47
48    /// Show working tree status
49    Status {
50        /// Model name (optional, defaults to all models)
51        model: Option<String>,
52
53        /// Show verbose output with file changes
54        #[arg(short, long)]
55        verbose: bool,
56
57        /// Show in short format
58        #[arg(short, long)]
59        short: bool,
60    },
61
62    /// Record changes to the repository
63    Commit {
64        /// Model name
65        model: String,
66
67        /// Commit message
68        #[arg(short, long)]
69        message: String,
70
71        /// Automatically stage all tracked files
72        #[arg(short = 'a', long)]
73        all: bool,
74
75        /// Amend previous commit
76        #[arg(long)]
77        amend: bool,
78    },
79
80    /// Stage files for commit (Phase 1.5)
81    Add {
82        /// Model name
83        model: String,
84
85        /// Files to stage (or "." for all)
86        #[arg(required = true)]
87        files: Vec<String>,
88    },
89
90    /// Basic push support (Phase 1.5)
91    Push {
92        /// Model reference
93        model: String,
94
95        /// Remote name (default: origin)
96        remote: Option<String>,
97
98        /// Branch to push
99        branch: Option<String>,
100
101        /// Set upstream tracking
102        #[arg(short = 'u', long)]
103        set_upstream: bool,
104    },
105
106    /// Basic pull support (Phase 1.5)
107    Pull {
108        /// Model reference
109        model: String,
110
111        /// Remote name (default: origin)
112        remote: Option<String>,
113
114        /// Branch to pull
115        branch: Option<String>,
116
117        /// Rebase instead of merge
118        #[arg(long)]
119        rebase: bool,
120    },
121
122    /// Remove a model from the system
123    Remove {
124        /// Model name to remove (e.g., "Qwen3-4B")
125        model: String,
126
127        /// Force removal without confirmation
128        #[arg(short, long)]
129        force: bool,
130
131        /// Remove only from registry, keep files
132        #[arg(long)]
133        registry_only: bool,
134
135        /// Remove files only, keep registry entry
136        #[arg(long)]
137        files_only: bool,
138    },
139}