Implement chrs-slurp: Context Intelligence layer with DR curation and Dolt integration
This commit is contained in:
@@ -44,20 +44,23 @@ impl DoltGraph {
|
||||
.output()?;
|
||||
if !output.status.success() {
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
eprintln!("Dolt Command Failed: {:?} -> {}", args, stderr);
|
||||
return Err(GraphError::CommandFailed(stderr.to_string()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn commit(&self, message: &str) -> Result<(), GraphError> {
|
||||
self.run_cmd(&["add", "."])?;
|
||||
self.run_cmd(&["add", "-A"])?;
|
||||
self.run_cmd(&["commit", "-m", message])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn create_table(&self, table_name: &str, schema: &str) -> Result<(), GraphError> {
|
||||
let query = format!("CREATE TABLE {} ({})", table_name, schema);
|
||||
println!("Executing: dolt sql -q \"{}\"", query);
|
||||
self.run_cmd(&["sql", "-q", &query])?;
|
||||
self.commit(&format!("Create table {}", table_name))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -90,6 +93,7 @@ impl DoltGraph {
|
||||
columns.join(", "),
|
||||
values.join(", ")
|
||||
);
|
||||
println!("Executing: dolt sql -q \"{}\"", query);
|
||||
self.run_cmd(&["sql", "-q", &query])?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -105,6 +109,5 @@ mod tests {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let graph = DoltGraph::init(dir.path()).expect("init failed");
|
||||
graph.create_table("nodes", "id INT PRIMARY KEY, name TEXT").expect("create table failed");
|
||||
graph.commit("initial commit with table").expect("commit failed");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user