MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / from_process

Method from_process

atomic-cli/src/commands/diagnostics/collect.rs:349–375  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

347
348impl Sources {
349 pub(crate) fn from_process() -> Self {
350 let home = dirs::home_dir();
351 let workspace = match workspace_search_readable(home.as_deref())
352 .map_err(Some)
353 .and_then(|()| {
354 find_repository_root().map_err(|error| match error {
355 CliError::RepositoryNotFound { .. } => None,
356 _ => Some(SourceError::WorkspaceLookup),
357 })
358 }) {
359 Ok(root) => Ok(Some(root)),
360 Err(None) => linked_git_search_readable(home.as_deref()).map(|()| None),
361 Err(Some(error)) => Err(error),
362 };
363 let install_source = std::env::current_exe()
364 .map(|exe| detect_source(&exe, &StdEnv).short_label())
365 .unwrap_or("unknown")
366 .to_string();
367 Self {
368 home,
369 integrations_root: atomic_agent::integrations::integrations_root()
370 .map_err(|_| SourceError::IntegrationsHome),
371 integrations_root_overridden: std::env::var_os("ATOMIC_INTEGRATIONS_HOME").is_some(),
372 workspace,
373 install_source,
374 }
375 }
376}
377
378// The shared discovery helper uses boolean file checks; preflight their

Callers

nothing calls this directly

Calls 6

find_repository_rootFunction · 0.85
detect_sourceFunction · 0.85
integrations_rootFunction · 0.85
short_labelMethod · 0.80

Tested by

no test coverage detected