Skip to content

Commit 325be9d

Browse files
committed
chore: integrate syneidesis directly for now
1 parent 57930cf commit 325be9d

344 files changed

Lines changed: 54203 additions & 18508 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ members = [
5656
"crates/action-tools/syntax-validation-tool",
5757
"crates/action-tools/type-checking-tool",
5858
"crates/action-tools/test-coverage-tool",
59-
"crates/action-tools/security-scanning-tool"
59+
"crates/action-tools/security-scanning-tool",
60+
"crates/syneidesis/coordination",
61+
"crates/syneidesis/grpc",
62+
"crates/syneidesis/config",
63+
"crates/syneidesis/core",
64+
"crates/syneidesis/agent"
6065
]
6166

6267
[workspace.package]
@@ -68,6 +73,7 @@ repository = "https://github.com/fugue-ai/rhema"
6873
homepage = "https://github.com/fugue-ai/rhema"
6974
documentation = "https://docs.rs/rhema"
7075
readme = "README.md"
76+
description = "Rhema AI Agent Framework"
7177
keywords = ["git", "ai", "context", "yaml", "protocol", "agent", "cli"]
7278
categories = ["command-line-utilities", "development-tools", "configuration"]
7379

@@ -103,7 +109,9 @@ async-trait = "0.1"
103109
tracing = "0.1"
104110

105111
# Syneidesis Coordination Library
106-
syneidesis-coordination = { path = "../syneidesis/crates/coordination" }
112+
syneidesis-coordination = { path = "crates/syneidesis/coordination" }
113+
syneidesis-grpc = { path = "crates/syneidesis/grpc" }
114+
syneidesis-config = { path = "crates/syneidesis/config" }
107115

108116
# gRPC and networking dependencies
109117
tokio-stream = "0.1"
@@ -165,6 +173,12 @@ trycmd = "0.15"
165173
env_logger = "0.10"
166174
rand = "0.8"
167175

176+
# Additional dependencies for syneidesis
177+
parking_lot = "0.12"
178+
tokio-util = "0.7"
179+
tokio-tungstenite = "0.20"
180+
prost = "0.12"
181+
168182
[dev-dependencies]
169183
tempfile = "3.8"
170184
assert_fs = "1.1"

apps/rhema/src/lib.rs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,12 @@ impl ConfigManager {
315315

316316
pub fn global_config_mut(&mut self) -> std::sync::MutexGuard<'static, GlobalConfig> {
317317
// TODO: Implement actual global config loading
318-
static GLOBAL_CONFIG: std::sync::OnceLock<std::sync::Mutex<GlobalConfig>> = std::sync::OnceLock::new();
319-
GLOBAL_CONFIG.get_or_init(|| std::sync::Mutex::new(GlobalConfig::new())).lock().unwrap()
318+
static GLOBAL_CONFIG: std::sync::OnceLock<std::sync::Mutex<GlobalConfig>> =
319+
std::sync::OnceLock::new();
320+
GLOBAL_CONFIG
321+
.get_or_init(|| std::sync::Mutex::new(GlobalConfig::new()))
322+
.lock()
323+
.unwrap()
320324
}
321325

322326
pub fn load_repository_config(
@@ -353,17 +357,23 @@ impl ConfigManager {
353357
})
354358
}
355359

356-
pub fn backup_mut(&mut self) -> std::sync::MutexGuard<'static, rhema_config::backup::BackupManager> {
360+
pub fn backup_mut(
361+
&mut self,
362+
) -> std::sync::MutexGuard<'static, rhema_config::backup::BackupManager> {
357363
// TODO: Implement actual backup
358-
static BACKUP: std::sync::OnceLock<std::sync::Mutex<rhema_config::backup::BackupManager>> = std::sync::OnceLock::new();
359-
BACKUP.get_or_init(|| {
360-
let global_config = self.global_config();
361-
std::sync::Mutex::new(
362-
rhema_config::backup::BackupManager::new(global_config).unwrap_or_else(|_| {
363-
rhema_config::backup::BackupManager::new(global_config).unwrap()
364-
})
365-
)
366-
}).lock().unwrap()
364+
static BACKUP: std::sync::OnceLock<std::sync::Mutex<rhema_config::backup::BackupManager>> =
365+
std::sync::OnceLock::new();
366+
BACKUP
367+
.get_or_init(|| {
368+
let global_config = self.global_config();
369+
std::sync::Mutex::new(
370+
rhema_config::backup::BackupManager::new(global_config).unwrap_or_else(|_| {
371+
rhema_config::backup::BackupManager::new(global_config).unwrap()
372+
}),
373+
)
374+
})
375+
.lock()
376+
.unwrap()
367377
}
368378

369379
pub fn migration(&self) -> &rhema_config::migration::MigrationManager {

apps/rhema/src/main.rs

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use clap::{Parser, Subcommand};
22
use rhema_api::{Rhema, RhemaResult};
33

4-
54
#[derive(Parser)]
65
#[command(author, version, about, long_about = None)]
76
struct Cli {
@@ -16,88 +15,87 @@ enum Commands {
1615
/// Scope type (e.g., service, library, application)
1716
#[arg(long)]
1817
scope_type: Option<String>,
19-
18+
2019
/// Scope name
2120
#[arg(long)]
2221
scope_name: Option<String>,
23-
22+
2423
/// Auto-configure based on repository analysis
2524
#[arg(long)]
2625
auto_config: bool,
2726
},
28-
27+
2928
/// List all scopes in the repository
3029
Scopes,
31-
30+
3231
/// Show information about a specific scope
3332
Scope {
3433
/// Path to the scope
3534
path: Option<String>,
3635
},
37-
36+
3837
/// Show the scope tree
3938
Tree,
40-
39+
4140
/// Execute a CQL query
4241
Query {
4342
/// The CQL query to execute
4443
query: String,
45-
44+
4645
/// Output format (json, yaml, table)
4746
#[arg(short, long, default_value = "table")]
4847
format: String,
49-
48+
5049
/// Include provenance information
5150
#[arg(long)]
5251
provenance: bool,
53-
52+
5453
/// Include field provenance
5554
#[arg(long)]
5655
field_provenance: bool,
57-
56+
5857
/// Include statistics
5958
#[arg(long)]
6059
stats: bool,
6160
},
62-
61+
6362
/// Search for content in the repository
6463
Search {
6564
/// Search term
6665
term: String,
67-
66+
6867
/// Search in specific file
6968
#[arg(short, long)]
7069
in_file: Option<String>,
71-
70+
7271
/// Use regex search
7372
#[arg(long)]
7473
regex: bool,
7574
},
76-
75+
7776
/// Validate the repository
7877
Validate {
7978
/// Validate recursively
8079
#[arg(long)]
8180
recursive: bool,
82-
81+
8382
/// Use JSON schema validation
8483
#[arg(long)]
8584
json_schema: bool,
86-
85+
8786
/// Migrate schemas if needed
8887
#[arg(long)]
8988
migrate: bool,
9089
},
91-
90+
9291
/// Show health information
9392
Health {
9493
/// Scope to check health for
9594
scope: Option<String>,
9695
},
97-
96+
9897
/// Show statistics
9998
Stats,
100-
10199
// /// Manage coordination between agents
102100
// Coordination {
103101
// #[command(subcommand)]
@@ -108,11 +106,15 @@ enum Commands {
108106
#[tokio::main]
109107
async fn main() -> RhemaResult<()> {
110108
let cli = Cli::parse();
111-
109+
112110
let rhema = Rhema::new()?;
113-
111+
114112
match &cli.command {
115-
Some(Commands::Init { scope_type, scope_name, auto_config }) => {
113+
Some(Commands::Init {
114+
scope_type,
115+
scope_name,
116+
auto_config,
117+
}) => {
116118
println!("Initializing new Rhema repository...");
117119
rhema_api::init::run(
118120
&rhema,
@@ -121,7 +123,7 @@ async fn main() -> RhemaResult<()> {
121123
*auto_config,
122124
)
123125
}
124-
126+
125127
Some(Commands::Scopes) => {
126128
println!("Discovering scopes...");
127129
let scopes = rhema.discover_scopes()?;
@@ -130,7 +132,7 @@ async fn main() -> RhemaResult<()> {
130132
}
131133
Ok(())
132134
}
133-
135+
134136
Some(Commands::Scope { path }) => {
135137
if let Some(scope_path) = path {
136138
println!("Showing scope: {}", scope_path);
@@ -142,7 +144,7 @@ async fn main() -> RhemaResult<()> {
142144
}
143145
Ok(())
144146
}
145-
147+
146148
Some(Commands::Tree) => {
147149
println!("Showing scope tree...");
148150
let scopes = rhema.discover_scopes()?;
@@ -151,10 +153,16 @@ async fn main() -> RhemaResult<()> {
151153
}
152154
Ok(())
153155
}
154-
155-
Some(Commands::Query { query, format, provenance, field_provenance, stats }) => {
156+
157+
Some(Commands::Query {
158+
query,
159+
format,
160+
provenance,
161+
field_provenance,
162+
stats,
163+
}) => {
156164
println!("Executing query: {}", query);
157-
165+
158166
if *field_provenance {
159167
let (result, _) = rhema.query_with_provenance(query)?;
160168
println!("Result: {:?}", result);
@@ -175,24 +183,32 @@ async fn main() -> RhemaResult<()> {
175183
}
176184
Ok(())
177185
}
178-
179-
Some(Commands::Search { term, in_file, regex }) => {
186+
187+
Some(Commands::Search {
188+
term,
189+
in_file,
190+
regex,
191+
}) => {
180192
println!("Searching for: {}", term);
181193
if let Some(file) = in_file {
182194
println!("In file: {}", file);
183195
}
184196
if *regex {
185197
println!("Using regex search");
186198
}
187-
199+
188200
let results = rhema.search_regex(term, in_file.as_deref())?;
189201
for result in results {
190202
println!("Found: {:?}", result);
191203
}
192204
Ok(())
193205
}
194-
195-
Some(Commands::Validate { recursive, json_schema, migrate }) => {
206+
207+
Some(Commands::Validate {
208+
recursive,
209+
json_schema,
210+
migrate,
211+
}) => {
196212
println!("Validating repository...");
197213
if *recursive {
198214
println!("Validating recursively");
@@ -206,7 +222,7 @@ async fn main() -> RhemaResult<()> {
206222
println!("Validation completed successfully!");
207223
Ok(())
208224
}
209-
225+
210226
Some(Commands::Health { scope }) => {
211227
println!("Checking health...");
212228
if let Some(scope_name) = scope {
@@ -215,17 +231,17 @@ async fn main() -> RhemaResult<()> {
215231
println!("Health check completed successfully!");
216232
Ok(())
217233
}
218-
234+
219235
Some(Commands::Stats) => {
220236
println!("Showing statistics...");
221237
println!("Statistics feature not yet implemented");
222238
Ok(())
223239
}
224-
240+
225241
// Some(Commands::Coordination { subcommand }) => {
226242
// println!("Executing coordination command...");
227243
// let manager = CoordinationManager::new();
228-
//
244+
//
229245
// match subcommand {
230246
// CoordinationSubcommands::Agent { subcommand } => {
231247
// manager.execute_agent_command(subcommand).await
@@ -238,7 +254,6 @@ async fn main() -> RhemaResult<()> {
238254
// }
239255
// }
240256
// }
241-
242257
None => {
243258
println!("Welcome to Rhema CLI!");
244259
println!("Use --help to see available commands");

0 commit comments

Comments
 (0)