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

Function vault_init

atomic-cli/src/commands/rpc.rs:7221–7244  ·  view source on GitHub ↗

`atomic vault init` over InitVault — the vault init operates inside an EXISTING repository (it requires one), so it routes normally via the daemon: the handler runs has_vault → init_vault → the recursive track → the defaults record, and the CLI prints the local report.

()

Source from the content-addressed store, hash-verified

7219/// daemon: the handler runs has_vault → init_vault → the recursive track
7220/// → the defaults record, and the CLI prints the local report.
7221pub fn vault_init() -> CliResult<bool> {
7222 let Some(session) = Service::open()? else {
7223 return Ok(false);
7224 };
7225 let request = pb::InitVaultRequest {
7226 repository: Some(session.reference.clone()),
7227 meta: request_meta(),
7228 view: None,
7229 expected_snapshot: None,
7230 };
7231 let response = session.init_vault(request)?;
7232 if response.already_initialized {
7233 print_info("Vault is already initialized");
7234 return Ok(true);
7235 }
7236 print_info(&format!(
7237 "Initialized vault at {}",
7238 response.vault_dir.clone().unwrap_or_default()
7239 ));
7240 if response.recorded {
7241 print_success("Recorded vault defaults");
7242 }
7243 Ok(true)
7244}
7245
7246/// `atomic project init` — the server-side project creation (the
7247/// management StorageClient built from the global config + the identity

Callers 1

runMethod · 0.85

Calls 6

openFunction · 0.85
print_infoFunction · 0.85
print_successFunction · 0.85
request_metaFunction · 0.70
cloneMethod · 0.45
init_vaultMethod · 0.45

Tested by

no test coverage detected