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

Function vault_init

atomic-cli/src/commands/rpc.rs:7304–7327  ·  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

7302/// daemon: the handler runs has_vault → init_vault → the recursive track
7303/// → the defaults record, and the CLI prints the local report.
7304pub fn vault_init() -> CliResult<bool> {
7305 let Some(session) = Service::open()? else {
7306 return Ok(false);
7307 };
7308 let request = pb::InitVaultRequest {
7309 repository: Some(session.reference.clone()),
7310 meta: request_meta(),
7311 view: None,
7312 expected_snapshot: None,
7313 };
7314 let response = session.init_vault(request)?;
7315 if response.already_initialized {
7316 print_info("Vault is already initialized");
7317 return Ok(true);
7318 }
7319 print_info(&format!(
7320 "Initialized vault at {}",
7321 response.vault_dir.clone().unwrap_or_default()
7322 ));
7323 if response.recorded {
7324 print_success("Recorded vault defaults");
7325 }
7326 Ok(true)
7327}
7328
7329/// `atomic project init` — the server-side project creation (the
7330/// management StorageClient built from the global config + the identity

Callers 1

runMethod · 0.85

Calls 6

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

Tested by

no test coverage detected