refactor: consolidate nvim crates, extract server library, and update workspace dependencies

This commit is contained in:
Riz Ashraf committed 2026-10-04 01:42:59 +01:00
1 parent a083719cf1
commit 533adfd41b
53 files changed
+5967 -1230

No files matched your search

+90
View File
@@ -20,6 +20,58 @@ pub struct StickyNote {
pub fn default_namespace() -> String {
"global".to_string()
}
pub fn normalize_entity_type(input: &str) -> String {
let trimmed = input.trim();
if trimmed.is_empty() {
return "Concept".to_string();
}
let clean = trimmed.replace(['_', '-'], " ");
let words: Vec<&str> = clean.split_whitespace().collect();
if words.is_empty() {
return "Concept".to_string();
}
let pascal: String = words
.into_iter()
.map(|w| {
let mut chars = w.chars();
match chars.next() {
None => String::new(),
Some(f) => f.to_uppercase().collect::<String>() + &chars.as_str().to_lowercase(),
}
})
.collect();
match pascal.as_str() {
"File" => "File".to_string(),
"McpTool" | "Mcptool" | "Mcp" => "McpTool".to_string(),
"Databasetable" | "DatabaseTable" => "DatabaseTable".to_string(),
"Datastructure" | "DataStore" | "Datastore" => "DataStructure".to_string(),
"Architecturecomponent" | "ArchitectureComponent" | "Architecture" => "ArchitectureComponent".to_string(),
"Frontendcomponent" | "FrontendComponent" => "FrontendComponent".to_string(),
"Globalrule" | "GlobalRule" => "GlobalRule".to_string(),
"Securitypolicy" | "SecurityPolicy" => "SecurityPolicy".to_string(),
"Serviceaccount" | "ServiceAccount" => "ServiceAccount".to_string(),
"Testframework" | "TestFramework" => "TestFramework".to_string(),
"Toolhandler" | "ToolHandler" => "ToolHandler".to_string(),
"Historicalsummary" | "HistoricalSummary" => "HistoricalSummary".to_string(),
"Externalapi" | "ExternalApi" => "ExternalAPI".to_string(),
"Testsuite" | "TestSuite" => "TestSuite".to_string(),
"Confluencepage" | "ConfluencePage" => "ConfluencePage".to_string(),
"Containerimage" | "ContainerImage" => "ContainerImage".to_string(),
"Buildsystem" | "BuildSystem" => "BuildSystem".to_string(),
_ => pascal,
}
}
pub fn normalize_relation_type(input: &str) -> String {
let trimmed = input.trim();
if trimmed.is_empty() {
return "related_to".to_string();
}
trimmed.to_lowercase().replace([' ', '-'], "_")
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct Entity {
pub name: String,
@@ -79,6 +131,8 @@ pub struct Snippet {
pub description: String,
pub updated_at: u64,
#[serde(default)]
pub tags: Vec<String>,
#[serde(default)]
pub embedding: Option<Vec<f32>>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
@@ -234,3 +288,39 @@ pub struct StateSnapshot {
pub description: String,
pub namespace: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Hypothesis {
pub id: String,
pub task_id: Option<String>,
pub hypothesis: String,
pub status: String,
pub evidence: Option<String>,
pub timestamp: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct AgentSignal {
pub id: String,
pub sender: String,
pub signal_type: String,
pub payload: String,
pub timestamp: u64,
pub ttl_seconds: Option<u64>,
}
#[cfg(test)]
mod tests {
use super::*;
use axum::http::StatusCode;
use axum::response::IntoResponse;
use crate::error::AppError;
#[test]
fn test_app_error_bad_request_invalid_json() {
let err = AppError::BadRequest("invalid json".into());
let res = err.into_response();
assert_eq!(res.status(), StatusCode::BAD_REQUEST);
}
}