securegit 0.8.5

Zero-trust git replacement with 12 built-in security scanners, LLM redteam bridge, universal undo, durable backups, and a 50-tool MCP server
Documentation
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

// ---- Security tool parameters ----

#[derive(Debug, Deserialize, JsonSchema)]
pub struct ScanParams {
    /// Directory to scan (defaults to working directory)
    pub path: Option<String>,
    /// Minimum severity to include: "critical", "high", "medium", "low"
    pub min_severity: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct ScanStagedParams {
    /// Minimum severity to include
    pub min_severity: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct SafeCommitParams {
    /// Commit message
    pub message: String,
    /// Maximum severity to allow (blocks if findings >= this level)
    pub max_severity: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct ReviewParams {
    /// File path to review for security issues
    pub file: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct FindingsParams {
    /// Filter by minimum severity
    pub min_severity: Option<String>,
    /// Filter by file path pattern
    pub file_pattern: Option<String>,
}

// ---- Git read tool parameters ----

#[derive(Debug, Deserialize, JsonSchema)]
pub struct LogParams {
    /// Maximum number of commits to show
    pub max_count: Option<usize>,
    /// Filter by author
    pub author: Option<String>,
    /// Show commits after this date
    pub since: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct DiffParams {
    /// Commit or range (e.g., "HEAD~3", "main..feature")
    pub commit: Option<String>,
    /// Show staged changes
    pub cached: Option<bool>,
    /// Show only file names
    pub name_only: Option<bool>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct BlameParams {
    /// File to blame
    pub file: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct ShowParams {
    /// Commit, tag, or object to show
    pub object: Option<String>,
    /// Show diffstat only
    pub stat: Option<bool>,
}

// ---- Git write tool parameters ----

#[derive(Debug, Deserialize, JsonSchema)]
pub struct AddParams {
    /// Files to stage
    pub files: Vec<String>,
    /// Stage all changes
    pub all: Option<bool>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct CommitParams {
    /// Commit message
    pub message: String,
    /// Allow empty commit
    pub allow_empty: Option<bool>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct CheckoutParams {
    /// Branch, tag, or commit to checkout
    pub target: String,
    /// Create a new branch
    pub create: Option<bool>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct BranchCreateParams {
    /// Branch name
    pub name: String,
    /// Start point (commit or branch)
    pub start_point: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct BranchDeleteParams {
    /// Branch name to delete
    pub name: String,
    /// Force delete
    pub force: Option<bool>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct MergeParams {
    /// Branch to merge
    pub branch: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct StashSaveParams {
    /// Stash message
    pub message: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct StashPopParams {
    /// Stash index to pop
    pub index: Option<usize>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct TagCreateParams {
    /// Tag name
    pub name: String,
    /// Tag message (creates annotated tag)
    pub message: Option<String>,
    /// Target commit
    pub target: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct UndoParams {
    /// Specific operation ID to undo
    pub op_id: Option<String>,
}

// ---- Push tool parameters ----

#[derive(Debug, Deserialize, JsonSchema)]
pub struct PushParams {
    /// Remote name (default: "origin")
    pub remote: Option<String>,
    /// Branch to push (default: current branch)
    pub branch: Option<String>,
    /// Force push
    pub force: Option<bool>,
    /// Set upstream tracking
    pub set_upstream: Option<bool>,
}

// ---- Backup tool parameters ----

#[derive(Debug, Deserialize, JsonSchema)]
pub struct BackupAddParams {
    /// Destination name (e.g., "nas", "s3", "usb")
    pub name: String,
    /// Destination path/remote (rsync path, rclone remote, or local path)
    pub destination: String,
    /// Backend type: local, rsync, rclone (auto-detected if omitted)
    pub backend_type: Option<String>,
    /// Auto-backup after every push
    pub auto: Option<bool>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct BackupRemoveParams {
    /// Destination name to remove
    pub name: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct BackupPushParams {
    /// Destination name (default: all)
    pub name: Option<String>,
    /// Include all branches (default: current branch only)
    pub all_branches: Option<bool>,
}

// ---- Platform tool parameters ----

#[derive(Debug, Deserialize, JsonSchema)]
pub struct PrListParams {
    /// Filter by state: open, closed, all (default: open)
    pub state: Option<String>,
    /// Target a registered server by name (default: auto-detect from remote)
    pub server: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct PrViewParams {
    /// Pull request number
    pub number: u64,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct CiStatusParams {
    /// Branch to check (default: current)
    pub branch: Option<String>,
    /// Target a registered server by name (default: auto-detect from remote)
    pub server: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct ReleaseListParams {
    /// Number of releases to show (default: 10)
    pub count: Option<usize>,
    /// Target a registered server by name (default: auto-detect from remote)
    pub server: Option<String>,
}

// ---- Worktree tool parameters ----

#[derive(Debug, Deserialize, JsonSchema)]
pub struct WorktreeAddParams {
    /// Worktree name (used as identifier)
    pub name: String,
    /// Path for the new worktree (defaults to .worktrees/<name>)
    pub path: Option<String>,
    /// Branch to checkout (created from HEAD if it doesn't exist)
    pub branch: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct WorktreeRemoveParams {
    /// Worktree name to remove
    pub name: String,
    /// Force removal even with uncommitted changes
    pub force: Option<bool>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct WorktreeLockParams {
    /// Worktree name to lock
    pub name: String,
    /// Reason for locking
    pub reason: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct WorktreeUnlockParams {
    /// Worktree name to unlock
    pub name: String,
}

// ---- Server management tool parameters ----

#[derive(Debug, Deserialize, JsonSchema)]
pub struct ServerAddParams {
    /// Server name (used as identifier, e.g. "my-gitlab")
    pub name: String,
    /// Platform type: "github" or "gitlab"
    pub platform: String,
    /// API base URL (e.g. "https://gitlab.example.com/api/v4")
    pub api_url: String,
    /// Authentication token (stored encrypted, never returned)
    pub token: String,
    /// Enable as push target (default: true)
    pub push_enabled: Option<bool>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct ServerRemoveParams {
    /// Server name to remove
    pub name: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct ServerPushParams {
    /// Specific server names to push to (default: all push-enabled)
    pub servers: Option<Vec<String>>,
    /// Branch to push (default: current branch)
    pub branch: Option<String>,
    /// Force push
    pub force: Option<bool>,
}

// ---- Repository creation parameters ----

#[derive(Debug, Deserialize, JsonSchema)]
pub struct CreateRepoParams {
    /// Repository name (e.g. "my-project")
    pub name: String,
    /// Target a registered server by name (default: auto-detect from remote)
    pub server: Option<String>,
    /// Namespace: GitHub org or GitLab group path (default: user's personal namespace)
    pub namespace: Option<String>,
    /// Create as private repository (default: false)
    pub private: Option<bool>,
    /// Repository description
    pub description: Option<String>,
}

// ---- HuggingFace tool parameters ----

#[derive(Debug, Deserialize, JsonSchema)]
pub struct HfPullParams {
    /// HuggingFace model ID (e.g., "meta-llama/Llama-3.2-1B")
    pub model_id: String,
    /// Revision (branch, tag, commit SHA). Default: "main"
    pub revision: Option<String>,
    /// Include only files matching these globs (e.g., ["*.safetensors"])
    pub include: Option<Vec<String>>,
    /// Exclude files matching these globs (e.g., ["*.bin"])
    pub exclude: Option<Vec<String>>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct HfPushParams {
    /// Local path to model files
    pub path: String,
    /// Target HuggingFace repository ID (e.g., "myorg/my-model")
    pub repo_id: String,
    /// HuggingFace organization (prepended to repo_id if provided)
    pub hf_org: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct HfSearchParams {
    /// Search query
    pub query: String,
    /// Filter by pipeline task (e.g., "text-generation", "image-classification")
    pub task: Option<String>,
    /// Filter by library (e.g., "transformers", "diffusers")
    pub library: Option<String>,
    /// Maximum number of results (default: 10)
    pub limit: Option<usize>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct HfInfoParams {
    /// HuggingFace model ID
    pub model_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct HfScanParams {
    /// HuggingFace model ID or local path to scan
    pub model_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct HfPipelineTriggerParams {
    /// Model ID to harden
    pub model_id: String,
    /// GitLab server name from registry (default: "gpubox")
    pub server: Option<String>,
    /// GitLab project ID for the pipeline
    pub project_id: Option<u64>,
    /// Pipeline trigger token (falls back to SECUREGIT_PIPELINE_TOKEN env)
    pub token: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct HfPipelineStatusParams {
    /// Specific pipeline ID to check (omit for recent pipelines)
    pub pipeline_id: Option<u64>,
    /// GitLab server name from registry (default: "gpubox")
    pub server: Option<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub struct HfFullPipelineParams {
    /// Model ID on HuggingFace (e.g., "Qwen/Qwen2.5-7B-Instruct")
    pub model_id: String,
    /// HuggingFace organization for output (e.g., "ArmyknifeLabs")
    pub hf_org: Option<String>,
    /// AutoTrain hardware tier (default: "a10g-large")
    pub hf_hardware: Option<String>,
    /// Minimum fix rate to pass verification (0.0-1.0, default: 0.30)
    pub min_fix_rate: Option<f64>,
    /// Comma-separated probe filter (default: all)
    pub probes: Option<String>,
    /// Training epochs (default: 3)
    pub epochs: Option<u32>,
    /// Fail pipeline if regressions detected (default: true)
    pub fail_on_regression: Option<bool>,
}

#[derive(Debug, Serialize)]
pub struct HfFullPipelineResult {
    pub original_model: String,
    pub hardened_model: String,
    pub model_url: String,
    pub total_findings: u64,
    pub fix_rate: f64,
    pub verdict: String,
    pub regression_count: u64,
    pub status: String,
}

// ---- Response types ----

#[derive(Debug, Serialize)]
pub struct ScanResult {
    pub scanned_files: usize,
    pub findings_count: usize,
    pub findings: Vec<FindingResult>,
}

#[derive(Debug, Serialize)]
pub struct FindingResult {
    pub id: String,
    pub title: String,
    pub severity: String,
    pub file: Option<String>,
    pub line: Option<usize>,
    pub description: String,
}