feat(mcp): implement Prompts capability, Resources, and clean up daemon architecture

This commit is contained in:
Riz Ashraf committed 2026-09-22 21:41:17 +01:00
1 parent 9b9b403ef2
commit 251757f8fc
29 files changed
+1276 -182

No files matched your search

+46
View File
@@ -158,3 +158,49 @@ impl MemoryState {
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use tempfile::tempdir;
#[tokio::test]
async fn test_memory_state_initialization() {
let dir = tempdir().unwrap();
let state = MemoryState::new(dir.path().to_str().unwrap());
// Ensure state fields are properly initialized
assert_eq!(state.base_dir, dir.path());
// Write a test value
state.tasks.modify(|tasks| {
tasks.push(Task {
id: "123".to_string(),
title: "Test Task".to_string(),
description: "".to_string(),
status: "active".to_string(),
created_at: 0,
updated_at: 0,
dependencies: vec![],
acceptance_criteria: vec![],
git_branch: None,
parent_id: None,
});
});
// Ensure it is saved
state.tasks.read_with(|tasks| {
assert_eq!(tasks.len(), 1);
assert_eq!(tasks[0].id, "123");
});
// Test rebuild index
let arc_state = Arc::new(state);
arc_state.rebuild_index().await;
// Check search index initialization
let idx = arc_state.search_index.read().unwrap();
// Just verify we can read it without panic
assert!(idx.search("Test", None).is_ok());
}
}