MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / resolve_registered_project_root

Function resolve_registered_project_root

src/main.rs:340–373  ·  view source on GitHub ↗
(
    project_id: Option<String>,
    project_path: Option<String>,
)

Source from the content-addressed store, hash-verified

338}
339
340async fn resolve_registered_project_root(
341 project_id: Option<String>,
342 project_path: Option<String>,
343) -> tracedecay::errors::Result<Option<PathBuf>> {
344 let db = tracedecay::global_db::GlobalDb::open()
345 .await
346 .ok_or_else(|| tracedecay::errors::TraceDecayError::Config {
347 message: "could not open tracedecay project registry; run tracedecay init first"
348 .to_string(),
349 })?;
350 let context = if let Some(project_id) = project_id.as_deref() {
351 db.project_registry_context_by_id(project_id).await
352 } else if let Some(project_path) = project_path.as_deref() {
353 let project_path_arg = Path::new(project_path);
354 if let Some(context) = db.project_registry_context_by_alias(project_path_arg).await {
355 Some(context)
356 } else if tracedecay::global_db::GlobalDb::is_explicit_project_path_selector(project_path) {
357 let git_common_dir = tracedecay::worktree::git_common_dir(project_path_arg);
358 db.project_registry_context_by_identity(project_path_arg, git_common_dir.as_deref())
359 .await
360 } else {
361 None
362 }
363 } else {
364 return Ok(None);
365 };
366
367 context
368 .map(|context| PathBuf::from(context.project.display_root))
369 .ok_or_else(|| tracedecay::errors::TraceDecayError::Config {
370 message: "registered project not found for selector".to_string(),
371 })
372 .map(Some)
373}
374
375pub(crate) async fn resolve_cli_project_root(
376 path: Option<String>,

Callers 1

resolve_cli_project_rootFunction · 0.85

Tested by

no test coverage detected