MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / handle_update

Method handle_update

crates/chat-cli/src/cli/chat/cli/knowledge.rs:344–363  ·  view source on GitHub ↗

Handle update operation

(os: &Os, session: &ChatSession, path: &str)

Source from the content-addressed store, hash-verified

342
343 /// Handle update operation
344 async fn handle_update(os: &Os, session: &ChatSession, path: &str) -> OperationResult {
345 match Self::validate_and_sanitize_path(os, path) {
346 Ok(sanitized_path) => {
347 let agent = Self::get_agent(session);
348 let async_knowledge_store = match KnowledgeStore::get_async_instance(os, agent).await {
349 Ok(store) => store,
350 Err(e) => {
351 return OperationResult::Error(format!("Error accessing knowledge base directory: {}", e));
352 },
353 };
354 let mut store = async_knowledge_store.lock().await;
355
356 match store.update_by_path(&sanitized_path).await {
357 Ok(message) => OperationResult::Info(message),
358 Err(e) => OperationResult::Error(format!("Failed to update: {}", e)),
359 }
360 },
361 Err(e) => OperationResult::Error(e),
362 }
363 }
364
365 /// Handle clear operation
366 async fn handle_clear(os: &Os, session: &mut ChatSession) -> OperationResult {

Callers

nothing calls this directly

Calls 2

update_by_pathMethod · 0.80
ErrorEnum · 0.50

Tested by

no test coverage detected