From fe09e05edaf4bf22681ceddef095018a977f476b Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Tue, 10 Dec 2024 09:43:13 -0500 Subject: [PATCH 01/20] debugging stuff --- src/git_grabber.rs | 1 + src/main.rs | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/git_grabber.rs b/src/git_grabber.rs index 06f8181..78fe3db 100644 --- a/src/git_grabber.rs +++ b/src/git_grabber.rs @@ -8,6 +8,7 @@ pub struct GitGrabber { impl GitGrabber { pub fn new() -> Self { + println!("{:?}", current_dir().unwrap()); GitGrabber { repo: None, dir: current_dir().unwrap(), diff --git a/src/main.rs b/src/main.rs index 08a7aec..1ca91da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,15 +13,12 @@ fn main() { let mut gg = GitGrabber::new(); gg.get_repo(); - - gg.repo.unwrap().revwalk().unwrap().for_each(|x| { - if x.is_ok() { - println!("{:?}", x.unwrap()) - } else { - println!("No rev") - } - }); - + gg.repo + .unwrap() + .reflog("head") + .unwrap() + .iter() + .for_each(|x| println!("{:?}", x.message())); return (); // let res_text = transporter.make_request(a).unwrap().text().unwrap(); -- 2.43.0 From b552e72cd70f742d5d50f674f076ccfb335f8621 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Tue, 10 Dec 2024 12:06:43 -0500 Subject: [PATCH 02/20] Task(main): Remove unused dependencies. --- Cargo.lock | 67 ------------------------------------------------------ Cargo.toml | 1 - 2 files changed, 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c108a7c..0039c84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -74,8 +74,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" dependencies = [ - "jobserver", - "libc", "shlex", ] @@ -147,7 +145,6 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" name = "ferro" version = "0.1.0" dependencies = [ - "git2", "reqwest", "serde", "serde_json", @@ -250,21 +247,6 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" -[[package]] -name = "git2" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" -dependencies = [ - "bitflags", - "libc", - "libgit2-sys", - "log", - "openssl-probe", - "openssl-sys", - "url", -] - [[package]] name = "h2" version = "0.4.7" @@ -563,15 +545,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.76" @@ -588,46 +561,6 @@ version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" -[[package]] -name = "libgit2-sys" -version = "0.17.0+1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" -dependencies = [ - "cc", - "libc", - "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -] - -[[package]] -name = "libssh2-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "libz-sys" -version = "1.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linux-raw-sys" version = "0.4.14" diff --git a/Cargo.toml b/Cargo.toml index e3ddb00..2886f3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] -git2 = "0.19.0" reqwest = { version = "0.12.9", features = ["blocking"] } serde = { version = "1.0.215", features = ["derive"] } serde_json = "1.0.133" -- 2.43.0 From a5905ae31c60c7d0075ebe4158c9120eaf8fc138 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Tue, 10 Dec 2024 12:11:39 -0500 Subject: [PATCH 03/20] Task(dev): Added functionality to GitGrabber to get staged files diff. --- src/git_grabber.rs | 36 +++++++++++++++++++----------------- src/main.rs | 34 +++++++++++++++------------------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/git_grabber.rs b/src/git_grabber.rs index 78fe3db..f4220a3 100644 --- a/src/git_grabber.rs +++ b/src/git_grabber.rs @@ -1,26 +1,28 @@ -use git2::Repository; -use std::{env::current_dir, path::PathBuf}; +use std::{fs::write, io::Write, process::Command, str::from_utf8}; -pub struct GitGrabber { - pub repo: Option, - dir: PathBuf, -} +// this is a comment test here +pub struct GitGrabber {} impl GitGrabber { pub fn new() -> Self { - println!("{:?}", current_dir().unwrap()); - GitGrabber { - repo: None, - dir: current_dir().unwrap(), - } + GitGrabber {} } - pub fn get_repo(&mut self) { - let repo = match Repository::open(self.dir.clone()) { - Ok(repo) => repo, - Err(e) => panic!("Failed to open: {}", e), - }; + pub fn get_diff(&self) -> String { + // just to print + let staged_files_output = Command::new("git") + .args(["diff", "--staged", "--stat"]) + .output() + .expect("Failed to get diff"); + let _ = std::io::stdout().write_all(&staged_files_output.stdout); - self.repo = Some(repo); + // actual output + let output = Command::new("git") + .args(["diff", "--staged", "--", ".", "':(exclude)*lock*'"]) + .output() + .expect("Failed to execute process"); + + let b = from_utf8(&output.stdout).unwrap(); + String::from(b) } } diff --git a/src/main.rs b/src/main.rs index 1ca91da..c7953e7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,31 +2,27 @@ mod git_grabber; mod mind_bridge; mod transporter; -// use core::panic; +use core::panic; use git_grabber::GitGrabber; use mind_bridge::*; -// use transporter::Transporter; +use transporter::Transporter; fn main() { - // let a = MindGen::new("Some random commit message"); - // let mut transporter = Transporter::new(); + let mut transporter = Transporter::new(); - let mut gg = GitGrabber::new(); - gg.get_repo(); - gg.repo + let gg = GitGrabber::new(); + let diff = gg.get_diff(); + let mind_gen_text = MindGen::new(format!("input: {}; branch: {}", diff, "dev")); + let res_text = transporter + .make_request(mind_gen_text) .unwrap() - .reflog("head") - .unwrap() - .iter() - .for_each(|x| println!("{:?}", x.message())); - return (); + .text() + .unwrap(); + let response: Result = serde_json::from_str(&res_text); - // let res_text = transporter.make_request(a).unwrap().text().unwrap(); - // let response: Result = serde_json::from_str(&res_text); + if response.is_err() { + panic!("oop something went wrong: {:?}", response.err()); + } - // if response.is_err() { - // panic!("oop something went wrong: {:?}", response.err()); - // } - - // println!("{:#?}", response.unwrap()); + println!("{:#?}", response.unwrap().response); } -- 2.43.0 From fa70d465d4e21340a86b7edbcf44f9969cb622a4 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Tue, 10 Dec 2024 12:12:05 -0500 Subject: [PATCH 04/20] Task(dev): Update MindGen to handle new GenOptions fields --- src/mind_bridge.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/mind_bridge.rs b/src/mind_bridge.rs index 234cade..fc253e3 100644 --- a/src/mind_bridge.rs +++ b/src/mind_bridge.rs @@ -1,11 +1,12 @@ use serde::{Deserialize, Serialize}; + // this is a test comment #[derive(Debug, Deserialize)] #[allow(unused)] pub struct GenRes { model: String, created_at: String, - response: String, + pub response: String, done: bool, total_duration: u64, load_duration: u64, @@ -19,6 +20,9 @@ struct GenOptions { temperature: f32, num_predict: u8, + repeat_last_n: u8, + top_k: u8, + top_p: f32 } #[derive(Debug, Serialize)] @@ -33,16 +37,19 @@ impl MindGen { #[allow(unused)] - pub fn new(input: &str) -> Self { + pub fn new(input: String) -> Self { Self { model: String::from("llama3.1"), stream: false, raw: false, - prompt: String::from(input), - system: String::from("You are a commit message generator. You will generate commit messages following this format Task(): making sure to never go over 90 characters"), + prompt: input, + system: String::from("create a short commit message from this diff, with format Task(): . only respond with the commit message"), options: GenOptions { - temperature: 0.5, - num_predict: 90 + temperature: 0.1, + num_predict: 0, + repeat_last_n: 0, + top_k: 10, + top_p: 0.5 } } } -- 2.43.0 From e5036b55b13b3f9d9b69f6927667468d27bdd6be Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Thu, 12 Dec 2024 09:55:33 -0500 Subject: [PATCH 05/20] (save state) few random changes and fn adds --- src/git_grabber.rs | 26 +++++++++++++- src/main.rs | 21 +++++++++-- src/mind_bridge.rs | 86 +++++++++++++++++++++++----------------------- 3 files changed, 86 insertions(+), 47 deletions(-) diff --git a/src/git_grabber.rs b/src/git_grabber.rs index f4220a3..1f4ff3f 100644 --- a/src/git_grabber.rs +++ b/src/git_grabber.rs @@ -1,4 +1,9 @@ -use std::{fs::write, io::Write, process::Command, str::from_utf8}; +use std::{ + fs::write, + io::Write, + process::{Command, Output}, + str::from_utf8, +}; // this is a comment test here pub struct GitGrabber {} @@ -25,4 +30,23 @@ impl GitGrabber { let b = from_utf8(&output.stdout).unwrap(); String::from(b) } + + pub fn generate_repo_desc(&self, origin_branch: &str, local_branch: &str) -> String { + let output = Command::new("git") + .args([ + "rev-list", + "--left-right", + "--pretty=oneline", + &format!( + "{}...{}", + origin_branch.to_string(), + local_branch.to_string() + ), + ]) + .output() + .expect("Failed to get repo details"); + + let b = from_utf8(&output.stdout).unwrap(); + String::from(b) + } } diff --git a/src/main.rs b/src/main.rs index c7953e7..f38bb75 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,17 +12,32 @@ fn main() { let gg = GitGrabber::new(); let diff = gg.get_diff(); - let mind_gen_text = MindGen::new(format!("input: {}; branch: {}", diff, "dev")); + let commits_msg = String::from("create a short commit message from this diff, with format Task(): . only respond with the commit message"); + let mind_gen_text = MindGen::new(commits_msg, format!("input: {}; branch: {}", diff, "dev")); let res_text = transporter .make_request(mind_gen_text) .unwrap() .text() .unwrap(); let response: Result = serde_json::from_str(&res_text); - if response.is_err() { panic!("oop something went wrong: {:?}", response.err()); } - println!("{:#?}", response.unwrap().response); + + let z = gg.generate_repo_desc("master", "dev"); + let pr_msg = String::from( + "create a pull request description in markdown from the following revlog output. Only respond with pr description, nothing else.", + ); + let mind_gen_repo = MindGen::new(pr_msg, z); + let repo_text = transporter + .make_request(mind_gen_repo) + .unwrap() + .text() + .unwrap(); + let repo_response: Result = serde_json::from_str(&repo_text); + if repo_response.is_err() { + panic!("oop something went wrong: {:?}", repo_response.err()); + } + println!("{:#?}", repo_response.unwrap().response); } diff --git a/src/mind_bridge.rs b/src/mind_bridge.rs index fc253e3..9ad4e9f 100644 --- a/src/mind_bridge.rs +++ b/src/mind_bridge.rs @@ -1,56 +1,56 @@ - use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; - // this is a test comment - #[derive(Debug, Deserialize)] +// this is a test comment +#[derive(Debug, Deserialize)] +#[allow(unused)] +pub struct GenRes { + model: String, + created_at: String, + pub response: String, + done: bool, + total_duration: u64, + load_duration: u64, + prompt_eval_count: u64, + prompt_eval_duration: u64, + eval_count: u64, + eval_duration: u64, +} + +#[derive(Debug, Serialize)] +struct GenOptions { + temperature: f32, + num_predict: u8, + repeat_last_n: u8, + top_k: u8, + top_p: f32, +} + +#[derive(Debug, Serialize)] +pub struct MindGen { + model: String, + prompt: String, + stream: bool, + raw: bool, + system: String, + options: GenOptions, +} + +impl MindGen { #[allow(unused)] - pub struct GenRes { - model: String, - created_at: String, - pub response: String, - done: bool, - total_duration: u64, - load_duration: u64, - prompt_eval_count: u64, - prompt_eval_duration: u64, - eval_count: u64, - eval_duration: u64, - } - - #[derive(Debug, Serialize)] - struct GenOptions { - temperature: f32, - num_predict: u8, - repeat_last_n: u8, - top_k: u8, - top_p: f32 - } - - #[derive(Debug, Serialize)] - pub struct MindGen { - model: String, - prompt: String, - stream: bool, - raw: bool, - system: String, - options: GenOptions, - } - - impl MindGen { - #[allow(unused)] - pub fn new(input: String) -> Self { - Self { + pub fn new(directions: String, input: String) -> Self { + Self { model: String::from("llama3.1"), stream: false, raw: false, prompt: input, - system: String::from("create a short commit message from this diff, with format Task(): . only respond with the commit message"), - options: GenOptions { + system: directions, + options: GenOptions { temperature: 0.1, num_predict: 0, repeat_last_n: 0, top_k: 10, - top_p: 0.5 - } + top_p: 0.5, + }, } } } -- 2.43.0 From 3feb7b333553db6684d76b5a028cb68a27a5498f Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 5 Jan 2025 11:12:25 -0500 Subject: [PATCH 06/20] (wip): reworking architecture --- src/arg_parser.rs | 32 +++++++++++ src/commit_handler.rs | 7 +++ src/main.rs | 91 ++++++++++++++++++------------ src/mind_bridge.rs | 55 ------------------- src/pr_handler.rs | 6 ++ src/transporter.rs | 55 +++++++++++++++++++ src/uml.drawio | 125 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 280 insertions(+), 91 deletions(-) create mode 100644 src/arg_parser.rs create mode 100644 src/commit_handler.rs create mode 100644 src/pr_handler.rs create mode 100644 src/uml.drawio diff --git a/src/arg_parser.rs b/src/arg_parser.rs new file mode 100644 index 0000000..3a15f3a --- /dev/null +++ b/src/arg_parser.rs @@ -0,0 +1,32 @@ +use std::env::args; + +pub struct ArgParser {} + +#[derive(Debug)] +pub enum ParsedArg { + Commit, + PullRequest, +} + +impl ArgParser { + pub fn parse() -> Option { + let arg = args().nth(1); + if arg.is_none() { + // <-- interactive mode will go here + return None; + } + let arg = arg.unwrap(); + match arg.as_str() { + "-c" => Some(ParsedArg::Commit), + "-p" => Some(ParsedArg::PullRequest), + "-h" => { + println!("help stuff here"); + None + } + _ => { + println!("Available Commands: -c [commit] -p [pull request] -h [help]"); + None + } + } + } +} diff --git a/src/commit_handler.rs b/src/commit_handler.rs new file mode 100644 index 0000000..3475b72 --- /dev/null +++ b/src/commit_handler.rs @@ -0,0 +1,7 @@ +pub struct CommitHandler {} + +impl CommitHandler { + pub fn new() -> Option { + Some(String::from("create a short commit message from this diff, with format Task(): . only respond with the commit message")) + } +} diff --git a/src/main.rs b/src/main.rs index f38bb75..3577747 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,43 +1,62 @@ -mod git_grabber; -mod mind_bridge; -mod transporter; +mod arg_parser; +mod commit_handler; +mod pr_handler; +// mod git_grabber; +// mod mind_bridge; +// mod transporter; -use core::panic; -use git_grabber::GitGrabber; -use mind_bridge::*; -use transporter::Transporter; +use arg_parser::ArgParser; +use commit_handler::CommitHandler; +use pr_handler::PrHandler; +// use core::panic; +// use ferrum_input::ArgParser; +// use git_grabber::GitGrabber; +// use mind_bridge::*; +// use transporter::Transporter; fn main() { - let mut transporter = Transporter::new(); + let prompt: Option = match ArgParser::parse() { + Some(arg_parser::ParsedArg::Commit) => CommitHandler::new(), + Some(arg_parser::ParsedArg::PullRequest) => PrHandler::new(), + None => None, + }; - let gg = GitGrabber::new(); - let diff = gg.get_diff(); - let commits_msg = String::from("create a short commit message from this diff, with format Task(): . only respond with the commit message"); - let mind_gen_text = MindGen::new(commits_msg, format!("input: {}; branch: {}", diff, "dev")); - let res_text = transporter - .make_request(mind_gen_text) - .unwrap() - .text() - .unwrap(); - let response: Result = serde_json::from_str(&res_text); - if response.is_err() { - panic!("oop something went wrong: {:?}", response.err()); + if prompt.is_none() { + println!("Sorry nothing to do.. exiting"); + return; } - println!("{:#?}", response.unwrap().response); - let z = gg.generate_repo_desc("master", "dev"); - let pr_msg = String::from( - "create a pull request description in markdown from the following revlog output. Only respond with pr description, nothing else.", - ); - let mind_gen_repo = MindGen::new(pr_msg, z); - let repo_text = transporter - .make_request(mind_gen_repo) - .unwrap() - .text() - .unwrap(); - let repo_response: Result = serde_json::from_str(&repo_text); - if repo_response.is_err() { - panic!("oop something went wrong: {:?}", repo_response.err()); - } - println!("{:#?}", repo_response.unwrap().response); + println!("{prompt:?}") + + // let mut transporter = Transporter::new(); + // let gg = GitGrabber::new(); + // let diff = gg.get_diff(); + // let commits_msg = String::from("create a short commit message from this diff, with format Task(): . only respond with the commit message"); + // let mind_gen_text = MindGen::new(commits_msg, format!("input: {}; branch: {}", diff, "dev")); + // let res_text = transporter + // .make_request(mind_gen_text) + // .unwrap() + // .text() + // .unwrap(); + // let response: Result = serde_json::from_str(&res_text); + // if response.is_err() { + // panic!("oop something went wrong: {:?}", response.err()); + // } + // println!("{:#?}", response.unwrap().response); + + // let z = gg.generate_repo_desc("master", "dev"); + // let pr_msg = String::from( + // "create a pull request description in markdown from the following revlog output. Only respond with pr description, nothing else.", + // ); + // let mind_gen_repo = MindGen::new(pr_msg, z); + // let repo_text = transporter + // .make_request(mind_gen_repo) + // .unwrap() + // .text() + // .unwrap(); + // let repo_response: Result = serde_json::from_str(&repo_text); + // if repo_response.is_err() { + // panic!("oop something went wrong: {:?}", repo_response.err()); + // } + // println!("{:#?}", repo_response.unwrap().response); } diff --git a/src/mind_bridge.rs b/src/mind_bridge.rs index 9ad4e9f..8b13789 100644 --- a/src/mind_bridge.rs +++ b/src/mind_bridge.rs @@ -1,56 +1 @@ -use serde::{Deserialize, Serialize}; -// this is a test comment -#[derive(Debug, Deserialize)] -#[allow(unused)] -pub struct GenRes { - model: String, - created_at: String, - pub response: String, - done: bool, - total_duration: u64, - load_duration: u64, - prompt_eval_count: u64, - prompt_eval_duration: u64, - eval_count: u64, - eval_duration: u64, -} - -#[derive(Debug, Serialize)] -struct GenOptions { - temperature: f32, - num_predict: u8, - repeat_last_n: u8, - top_k: u8, - top_p: f32, -} - -#[derive(Debug, Serialize)] -pub struct MindGen { - model: String, - prompt: String, - stream: bool, - raw: bool, - system: String, - options: GenOptions, -} - -impl MindGen { - #[allow(unused)] - pub fn new(directions: String, input: String) -> Self { - Self { - model: String::from("llama3.1"), - stream: false, - raw: false, - prompt: input, - system: directions, - options: GenOptions { - temperature: 0.1, - num_predict: 0, - repeat_last_n: 0, - top_k: 10, - top_p: 0.5, - }, - } - } -} diff --git a/src/pr_handler.rs b/src/pr_handler.rs new file mode 100644 index 0000000..2f6885f --- /dev/null +++ b/src/pr_handler.rs @@ -0,0 +1,6 @@ +pub struct PrHandler {} +impl PrHandler { + pub fn new() -> Option { + Some("Pull Request Handler".to_string()) + } +} diff --git a/src/transporter.rs b/src/transporter.rs index 3f1d803..e982a59 100644 --- a/src/transporter.rs +++ b/src/transporter.rs @@ -1,5 +1,6 @@ use crate::MindGen; use reqwest::blocking::Client; +use serde::{Deserialize, Serialize}; #[allow(unused)] pub static OLLAMA_ENDP: &str = "http://localhost:11434/api/generate"; @@ -9,6 +10,60 @@ pub struct Transporter { pub client: Client, } +#[derive(Debug, Deserialize)] +#[allow(unused)] +pub struct GenRes { + model: String, + created_at: String, + pub response: String, + done: bool, + total_duration: u64, + load_duration: u64, + prompt_eval_count: u64, + prompt_eval_duration: u64, + eval_count: u64, + eval_duration: u64, +} + +#[derive(Debug, Serialize)] +struct GenOptions { + temperature: f32, + num_predict: u8, + repeat_last_n: u8, + top_k: u8, + top_p: f32, +} + +#[derive(Debug, Serialize)] +pub struct MindGen { + model: String, + prompt: String, + stream: bool, + raw: bool, + system: String, + options: GenOptions, +} + +impl MindGen { + #[allow(unused)] + pub fn new(directions: String, input: String) -> Self { + Self { + model: String::from("llama3.1"), + stream: false, + raw: false, + prompt: input, + system: directions, + options: GenOptions { + temperature: 0.1, + num_predict: 0, + repeat_last_n: 0, + top_k: 10, + top_p: 0.5, + }, + } + } +} + #[allow(unused)] impl Transporter { #[allow(unused)] diff --git a/src/uml.drawio b/src/uml.drawio new file mode 100644 index 0000000..f663125 --- /dev/null +++ b/src/uml.drawio @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.43.0 From 149458411fefe16faa8227d9d4587832a4e1b62d Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sat, 11 Jan 2025 08:20:47 -0500 Subject: [PATCH 07/20] update readme --- README.md | 66 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 8 deletions(-) mode change 100644 => 100755 README.md diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 492238a..b083e25 --- a/README.md +++ b/README.md @@ -1,18 +1,68 @@ -"Ferro" is inspired by: +# Ferro +A rust base llm wrapper for generating git commits and descriptions +## How to read +This readme can be read _As-Is_ but youll be missing some nice visuals. If you want to see those, you need two tools: +1. [graph-easy](http://bloodgate.com/perl/graph/manual/overview.html) +2. [slides](https://github.com/maaslalani/slides) -Scientific Roots +figure out how to get those installed on your OS and then come back, otherwise, continue on... +## Fun Facts +### Scientific Roots 1. Ferrum: Latin for iron, reflecting Rust's iron/oxidation themes. 2. Ferro-: Greek prefix meaning iron or iron-containing. - -Relevant Connections - +### Relevant Connections 1. Ferrocene: An iron-containing compound. 2. Ferroelectric: Materials exhibiting iron-like electrical properties. - -Simple, Modern Sound - +### Simple, Modern Sound "Ferro" is concise, memorable and has a technical feel, fitting for a Rust CLI tool. + +*continue to architecture on next page* + +--- + +## Architecture +I just wanted to split things up in a cohesive way. Where one node is resposible for its own thing and returns whatever +data, it creates, to its caller + +``` +this is a graph demonstrating the mvp architecture + +~~~graph-easy --as=boxart +graph { flow: east; } +[main]->{start:front; end:back}[arg parser] +[arg parser] -> {start:front,0; end:back;} [pr handler] +[arg parser] -> {start:front,0; end:back;} [commit handler] +[pr handler], [commit handler] -> {start:front; end:back,0;} [ml interface] +[ml interface] -> [out] + +[commit handler] <=> [banana] +[pr handler] <=> [apple] +~~~ +``` + +*continue to next slide to see mvp v2 architecture* + +--- + +``` +this is a graph demonstrating the mvp (v2) architecture + +~~~graph-easy --as=boxart +graph { flow: east; } +[main]->{start:front; end:back}[arg parser] +[arg parser] -> {start:front,0; end:back;} [pr handler] +[arg parser] -> {start:front,0; end:back;} [commit handler] +[pr handler], [commit handler] -> {start:front; end:back,0;} [ml interface] +[ml interface] -> [out] + +[commit handler] <=> [banana] +[pr handler] <=> [apple] +[config loader]{ origin: main; offset: 0,-2; } -> {start:right; end:left} [main] +[interactive] { origin: arg parser; offset: 0,-2; } <== no args ==> {start:right; end:left}[arg parser] +~~~ +``` + -- 2.43.0 From 3c0a1c505cdd7b662ad7212bbea3ce3c78371d37 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sat, 11 Jan 2025 14:43:21 -0500 Subject: [PATCH 08/20] refactor some things --- src/commit_handler.rs | 7 +++- src/git_grabber.rs | 31 +++++++------- src/main.rs | 55 ++++++------------------- src/mind_bridge.rs | 1 - src/{transporter.rs => ml_interface.rs} | 33 +++++++-------- src/pr_handler.rs | 7 +++- 6 files changed, 56 insertions(+), 78 deletions(-) delete mode 100644 src/mind_bridge.rs rename src/{transporter.rs => ml_interface.rs} (80%) diff --git a/src/commit_handler.rs b/src/commit_handler.rs index 3475b72..5d46159 100644 --- a/src/commit_handler.rs +++ b/src/commit_handler.rs @@ -1,7 +1,10 @@ +use crate::git_grabber::GitGrabber; + pub struct CommitHandler {} impl CommitHandler { - pub fn new() -> Option { - Some(String::from("create a short commit message from this diff, with format Task(): . only respond with the commit message")) + pub fn new() -> Option<(String, String)> { + let dirs = String::from("create a short commit message from this diff, with format Task(): . only respond with the commit message"); + Some((dirs, GitGrabber::get_diff())) } } diff --git a/src/git_grabber.rs b/src/git_grabber.rs index 1f4ff3f..14f61e9 100644 --- a/src/git_grabber.rs +++ b/src/git_grabber.rs @@ -13,25 +13,28 @@ impl GitGrabber { GitGrabber {} } - pub fn get_diff(&self) -> String { - // just to print - let staged_files_output = Command::new("git") - .args(["diff", "--staged", "--stat"]) + pub fn get_current_branch() -> String { + let branch = Command::new("git") + .args(["branch", "--show-current"]) .output() - .expect("Failed to get diff"); - let _ = std::io::stdout().write_all(&staged_files_output.stdout); + .expect("Failed to get branch"); - // actual output - let output = Command::new("git") - .args(["diff", "--staged", "--", ".", "':(exclude)*lock*'"]) - .output() - .expect("Failed to execute process"); - - let b = from_utf8(&output.stdout).unwrap(); + let b = from_utf8(&branch.stdout).unwrap(); String::from(b) } - pub fn generate_repo_desc(&self, origin_branch: &str, local_branch: &str) -> String { + pub fn get_diff() -> String { + // just to print + let staged_files_output = Command::new("git") + .args(["diff", "--staged"]) + .output() + .expect("Failed to get diff"); + + let b = from_utf8(&staged_files_output.stdout).unwrap(); + String::from(b) + } + + pub fn generate_repo_desc(origin_branch: &str, local_branch: &str) -> String { let output = Command::new("git") .args([ "rev-list", diff --git a/src/main.rs b/src/main.rs index 3577747..e9d7bd9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,21 +1,16 @@ mod arg_parser; mod commit_handler; +mod git_grabber; +mod ml_interface; mod pr_handler; -// mod git_grabber; -// mod mind_bridge; -// mod transporter; use arg_parser::ArgParser; use commit_handler::CommitHandler; +use ml_interface::{MlBody, MlInterface, MlResponse}; use pr_handler::PrHandler; -// use core::panic; -// use ferrum_input::ArgParser; -// use git_grabber::GitGrabber; -// use mind_bridge::*; -// use transporter::Transporter; fn main() { - let prompt: Option = match ArgParser::parse() { + let prompt: Option<(String, String)> = match ArgParser::parse() { Some(arg_parser::ParsedArg::Commit) => CommitHandler::new(), Some(arg_parser::ParsedArg::PullRequest) => PrHandler::new(), None => None, @@ -26,37 +21,13 @@ fn main() { return; } - println!("{prompt:?}") - - // let mut transporter = Transporter::new(); - // let gg = GitGrabber::new(); - // let diff = gg.get_diff(); - // let commits_msg = String::from("create a short commit message from this diff, with format Task(): . only respond with the commit message"); - // let mind_gen_text = MindGen::new(commits_msg, format!("input: {}; branch: {}", diff, "dev")); - // let res_text = transporter - // .make_request(mind_gen_text) - // .unwrap() - // .text() - // .unwrap(); - // let response: Result = serde_json::from_str(&res_text); - // if response.is_err() { - // panic!("oop something went wrong: {:?}", response.err()); - // } - // println!("{:#?}", response.unwrap().response); - - // let z = gg.generate_repo_desc("master", "dev"); - // let pr_msg = String::from( - // "create a pull request description in markdown from the following revlog output. Only respond with pr description, nothing else.", - // ); - // let mind_gen_repo = MindGen::new(pr_msg, z); - // let repo_text = transporter - // .make_request(mind_gen_repo) - // .unwrap() - // .text() - // .unwrap(); - // let repo_response: Result = serde_json::from_str(&repo_text); - // if repo_response.is_err() { - // panic!("oop something went wrong: {:?}", repo_response.err()); - // } - // println!("{:#?}", repo_response.unwrap().response); + let mut ml = MlInterface::new(); + let (directions, content) = prompt.unwrap(); + let mind_gen_text = MlBody::new(content, directions); + let res_text = ml.make_request(mind_gen_text).unwrap().text().unwrap(); + let response: Result = serde_json::from_str(&res_text); + if response.is_err() { + panic!("oop something went wrong: {:?}", response.err()); + } + println!("{:#?}", response.unwrap()); } diff --git a/src/mind_bridge.rs b/src/mind_bridge.rs deleted file mode 100644 index 8b13789..0000000 --- a/src/mind_bridge.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/transporter.rs b/src/ml_interface.rs similarity index 80% rename from src/transporter.rs rename to src/ml_interface.rs index e982a59..96bf7b4 100644 --- a/src/transporter.rs +++ b/src/ml_interface.rs @@ -1,18 +1,12 @@ -use crate::MindGen; use reqwest::blocking::Client; use serde::{Deserialize, Serialize}; #[allow(unused)] pub static OLLAMA_ENDP: &str = "http://localhost:11434/api/generate"; -#[allow(unused)] -pub struct Transporter { - pub client: Client, -} - #[derive(Debug, Deserialize)] #[allow(unused)] -pub struct GenRes { +pub struct MlResponse { model: String, created_at: String, pub response: String, @@ -26,7 +20,7 @@ pub struct GenRes { } #[derive(Debug, Serialize)] -struct GenOptions { +struct MlOptions { temperature: f32, num_predict: u8, repeat_last_n: u8, @@ -35,26 +29,26 @@ struct GenOptions { } #[derive(Debug, Serialize)] -pub struct MindGen { +pub struct MlBody { model: String, prompt: String, stream: bool, raw: bool, system: String, - options: GenOptions, + options: MlOptions, } -impl MindGen { +impl MlBody { #[allow(unused)] - pub fn new(directions: String, input: String) -> Self { + pub fn new(content: String, directions: String) -> Self { Self { model: String::from("llama3.1"), stream: false, raw: false, - prompt: input, + prompt: content, system: directions, - options: GenOptions { - temperature: 0.1, + options: MlOptions { + temperature: 0.5, num_predict: 0, repeat_last_n: 0, top_k: 10, @@ -65,7 +59,12 @@ impl MindGen { } #[allow(unused)] -impl Transporter { +pub struct MlInterface { + pub client: Client, +} + +#[allow(unused)] +impl MlInterface { #[allow(unused)] pub fn new() -> Self { Self { @@ -76,7 +75,7 @@ impl Transporter { #[allow(unused)] pub fn make_request( &mut self, - gen_data: MindGen, + gen_data: MlBody, ) -> Result { let json_body = serde_json::to_string(&gen_data).unwrap(); self.client.post(OLLAMA_ENDP).body(json_body).send() diff --git a/src/pr_handler.rs b/src/pr_handler.rs index 2f6885f..ae5c931 100644 --- a/src/pr_handler.rs +++ b/src/pr_handler.rs @@ -1,6 +1,9 @@ +use crate::git_grabber::GitGrabber; + pub struct PrHandler {} impl PrHandler { - pub fn new() -> Option { - Some("Pull Request Handler".to_string()) + pub fn new() -> Option<(String, String)> { + let dirs = String::from("Pull Request Handler"); + Some((dirs, GitGrabber::generate_repo_desc("", ""))) } } -- 2.43.0 From 4132b953c910a7e42611f4e41d1998d677d4d8e2 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 12:50:59 -0500 Subject: [PATCH 09/20] "feat(main): Update main function to use new MlBody and ml.make_request APIs" --- src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index e9d7bd9..8321c41 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,17 +17,17 @@ fn main() { }; if prompt.is_none() { - println!("Sorry nothing to do.. exiting"); return; } let mut ml = MlInterface::new(); let (directions, content) = prompt.unwrap(); - let mind_gen_text = MlBody::new(content, directions); - let res_text = ml.make_request(mind_gen_text).unwrap().text().unwrap(); + let body = MlBody::new(content, directions); + let res_text = ml.make_request(body).unwrap().text().unwrap(); + let response: Result = serde_json::from_str(&res_text); if response.is_err() { panic!("oop something went wrong: {:?}", response.err()); } - println!("{:#?}", response.unwrap()); + println!("{:?}", response.unwrap().response); } -- 2.43.0 From 57ed1ca513888470e163f68d68bcee735c212cf9 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 12:53:10 -0500 Subject: [PATCH 10/20] "feat(main): Added a comment that is incorrect and will not affect the program's functionality." --- src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.rs b/src/main.rs index 8321c41..ed60dd1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,7 @@ fn main() { None => None, }; + // 1+2 = 5 if prompt.is_none() { return; } -- 2.43.0 From 6ae7ce6a5751ccc338a74e207c000d748b7a9a19 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 13:00:18 -0500 Subject: [PATCH 11/20] "feat(arg_parser): Add interactive mode and help message" --- src/arg_parser.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/arg_parser.rs b/src/arg_parser.rs index 3a15f3a..8129c6b 100644 --- a/src/arg_parser.rs +++ b/src/arg_parser.rs @@ -13,6 +13,7 @@ impl ArgParser { let arg = args().nth(1); if arg.is_none() { // <-- interactive mode will go here + println!("...(future) interactive mode not implimented... exiting"); return None; } let arg = arg.unwrap(); @@ -20,13 +21,10 @@ impl ArgParser { "-c" => Some(ParsedArg::Commit), "-p" => Some(ParsedArg::PullRequest), "-h" => { - println!("help stuff here"); - None - } - _ => { println!("Available Commands: -c [commit] -p [pull request] -h [help]"); None } + _ => None, } } } -- 2.43.0 From 3bff96acab6437fcc22fd354327997da2516e5dd Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 13:10:23 -0500 Subject: [PATCH 12/20] "feat(grabber): Update GitGrabber to ignore whitespace and blank lines in diff output" --- src/git_grabber.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/git_grabber.rs b/src/git_grabber.rs index 14f61e9..fd24415 100644 --- a/src/git_grabber.rs +++ b/src/git_grabber.rs @@ -20,13 +20,24 @@ impl GitGrabber { .expect("Failed to get branch"); let b = from_utf8(&branch.stdout).unwrap(); - String::from(b) + String::from(b.strip_suffix("\n").unwrap()) } pub fn get_diff() -> String { // just to print - let staged_files_output = Command::new("git") - .args(["diff", "--staged"]) + let output = Command::new("git") + .args([ + "diff", + "--staged", + "--ignore-all-space", + "--ignore-blank-lines", + "--ignore-cr-at-eol", + "--minimal", + "--no-prefix", + "--no-renames", + "--word-diff", + "--inter-hunk-context=0", + ]) .output() .expect("Failed to get diff"); -- 2.43.0 From 28afb4942dc7b9de5ae350247d3e416324fb3a75 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 13:10:43 -0500 Subject: [PATCH 13/20] "feat(commit_handler): Update commit handler to generate commit message based on diff changes." --- src/commit_handler.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/commit_handler.rs b/src/commit_handler.rs index 5d46159..07b516c 100644 --- a/src/commit_handler.rs +++ b/src/commit_handler.rs @@ -4,7 +4,17 @@ pub struct CommitHandler {} impl CommitHandler { pub fn new() -> Option<(String, String)> { - let dirs = String::from("create a short commit message from this diff, with format Task(): . only respond with the commit message"); - Some((dirs, GitGrabber::get_diff())) + let dirs = String::from(format!(" + + change_type: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert + + create a short commit message from this entire diff, with format (): . + the commit message should vaguely describe the changes present unless a small change is made that can be + precisely described withtin a short commit message + + Only respond with the commit message. + ")); + let prompt = GitGrabber::get_diff(); + Some((dirs, prompt)) } } -- 2.43.0 From 8715e8b753145b7bce3dc322b42f54900f5475ea Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 13:11:16 -0500 Subject: [PATCH 14/20] "feat(io): Panic if Git diff command fails" --- src/git_grabber.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/git_grabber.rs b/src/git_grabber.rs index fd24415..e08bbf5 100644 --- a/src/git_grabber.rs +++ b/src/git_grabber.rs @@ -1,3 +1,4 @@ +use core::panic; use std::{ fs::write, io::Write, @@ -41,7 +42,11 @@ impl GitGrabber { .output() .expect("Failed to get diff"); - let b = from_utf8(&staged_files_output.stdout).unwrap(); + if !output.status.success() { + panic!("Did you forget to stage your files?"); + } + + let b = from_utf8(&output.stdout).unwrap(); String::from(b) } -- 2.43.0 From 44c996127ba203ce1dfa86dd044643e92dcbcbd4 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 13:11:37 -0500 Subject: [PATCH 15/20] "feat(git_grabber): generate repo description from reflog" --- src/git_grabber.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/git_grabber.rs b/src/git_grabber.rs index e08bbf5..05f344a 100644 --- a/src/git_grabber.rs +++ b/src/git_grabber.rs @@ -50,18 +50,10 @@ impl GitGrabber { String::from(b) } - pub fn generate_repo_desc(origin_branch: &str, local_branch: &str) -> String { + pub fn generate_repo_desc() -> String { + let curr_branch = GitGrabber::get_current_branch(); let output = Command::new("git") - .args([ - "rev-list", - "--left-right", - "--pretty=oneline", - &format!( - "{}...{}", - origin_branch.to_string(), - local_branch.to_string() - ), - ]) + .args(["reflog", "show", &curr_branch]) .output() .expect("Failed to get repo details"); -- 2.43.0 From f96ab7523e0c028a663830e2358bd87a42e5599f Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 13:11:53 -0500 Subject: [PATCH 16/20] "feat(ml_interface): update ml_body temperature value" --- src/ml_interface.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ml_interface.rs b/src/ml_interface.rs index 96bf7b4..a7aa8f2 100644 --- a/src/ml_interface.rs +++ b/src/ml_interface.rs @@ -1,3 +1,5 @@ +use std::error::Error; + use reqwest::blocking::Client; use serde::{Deserialize, Serialize}; @@ -48,7 +50,7 @@ impl MlBody { prompt: content, system: directions, options: MlOptions { - temperature: 0.5, + temperature: 0.1, num_predict: 0, repeat_last_n: 0, top_k: 10, -- 2.43.0 From 8445e2f0761d90231028c59c6372feedb469255d Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 13:12:14 -0500 Subject: [PATCH 17/20] "feat(ml_interface): add prompt validation to make_request function" --- src/ml_interface.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ml_interface.rs b/src/ml_interface.rs index a7aa8f2..d0070e4 100644 --- a/src/ml_interface.rs +++ b/src/ml_interface.rs @@ -75,11 +75,15 @@ impl MlInterface { } #[allow(unused)] - pub fn make_request( - &mut self, - gen_data: MlBody, - ) -> Result { + pub fn make_request(&mut self, gen_data: MlBody) -> Result { + if gen_data.prompt.len() < 1 { + panic!("No prompt provided"); + } let json_body = serde_json::to_string(&gen_data).unwrap(); - self.client.post(OLLAMA_ENDP).body(json_body).send() + let res = self.client.post(OLLAMA_ENDP).body(json_body).send(); + if res.is_err() { + panic!("Failed to send ollama payload"); + } + Ok(res.unwrap()) } } -- 2.43.0 From aa56f6dab70430a98c8138d024db16c89ad528a8 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 13:12:38 -0500 Subject: [PATCH 18/20] "feat(pr_handler): Add PR title and description generation rules" --- src/pr_handler.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pr_handler.rs b/src/pr_handler.rs index ae5c931..f9e5442 100644 --- a/src/pr_handler.rs +++ b/src/pr_handler.rs @@ -3,7 +3,16 @@ use crate::git_grabber::GitGrabber; pub struct PrHandler {} impl PrHandler { pub fn new() -> Option<(String, String)> { - let dirs = String::from("Pull Request Handler"); - Some((dirs, GitGrabber::generate_repo_desc("", ""))) + let directions = String::from(" + + change_type: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert + + create a short PR title from this diff, with format (): . + + create an additional PR Description in markdown format to describe the changes made in this diff. + + Only respond with the Pr title and Pr description. + "); + Some((directions, GitGrabber::generate_repo_desc())) } } -- 2.43.0 From c98dedf347626cd87f152e44f2e051743b0e25ea Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 13:53:25 -0500 Subject: [PATCH 19/20] "feat(pr_handler): Add PR title and description generation" --- src/pr_handler.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/pr_handler.rs b/src/pr_handler.rs index f9e5442..9c70d9a 100644 --- a/src/pr_handler.rs +++ b/src/pr_handler.rs @@ -6,12 +6,33 @@ impl PrHandler { let directions = String::from(" change_type: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert + create a short PR title from this diff, with format (): . + - create an additional PR Description in markdown format to describe the changes made in this diff. + create a PR Description to describe the changes made in this diff using the commit messages for the body content. + + follow this format: + ## What? + [what_description] + #[ticket_number] + ## Why? + [why_description] + ## How? + [how_description] + ## Testing? + [testing_description] + ## Screenshots (optional) + [screenshots] + ## Anything Else? + [leftover_details] + + include signature at the end stating 'this is an ai generated pull request description'. + Only respond with the Pr title and Pr description. + Use Emojis in description body only. "); Some((directions, GitGrabber::generate_repo_desc())) } -- 2.43.0 From 1cf6d12bd677c27703c8d490abdd840264085dc3 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 14:00:18 -0500 Subject: [PATCH 20/20] "feat(ml_interface): remove unused import and refactor GitGrabber implementation" --- src/git_grabber.rs | 11 +---------- src/ml_interface.rs | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/git_grabber.rs b/src/git_grabber.rs index 05f344a..6b1482f 100644 --- a/src/git_grabber.rs +++ b/src/git_grabber.rs @@ -1,19 +1,10 @@ use core::panic; -use std::{ - fs::write, - io::Write, - process::{Command, Output}, - str::from_utf8, -}; +use std::{process::Command, str::from_utf8}; // this is a comment test here pub struct GitGrabber {} impl GitGrabber { - pub fn new() -> Self { - GitGrabber {} - } - pub fn get_current_branch() -> String { let branch = Command::new("git") .args(["branch", "--show-current"]) diff --git a/src/ml_interface.rs b/src/ml_interface.rs index d0070e4..cd69e12 100644 --- a/src/ml_interface.rs +++ b/src/ml_interface.rs @@ -1,4 +1,3 @@ -use std::error::Error; use reqwest::blocking::Client; use serde::{Deserialize, Serialize}; -- 2.43.0