(
&self,
delegator: &Identity,
agent: &Identity,
terms: &Delegation,
server_url: Option<&str>,
enrolled: &CliResult<bool>,
)
| 311 | } |
| 312 | |
| 313 | fn report( |
| 314 | &self, |
| 315 | delegator: &Identity, |
| 316 | agent: &Identity, |
| 317 | terms: &Delegation, |
| 318 | server_url: Option<&str>, |
| 319 | enrolled: &CliResult<bool>, |
| 320 | ) { |
| 321 | print_success(&format!("Created agent identity {}", agent.name)); |
| 322 | println!(); |
| 323 | println!(" DID {}", agent.id.to_did()); |
| 324 | println!(" Key {}", agent.public_key.to_did_key()); |
| 325 | println!( |
| 326 | " Delegated by {} ({})", |
| 327 | delegator.name, |
| 328 | delegator.id.to_did() |
| 329 | ); |
| 330 | println!( |
| 331 | " Can {}", |
| 332 | terms |
| 333 | .scope |
| 334 | .permissions |
| 335 | .iter() |
| 336 | .map(|p| p.to_string()) |
| 337 | .collect::<Vec<_>>() |
| 338 | .join(", ") |
| 339 | ); |
| 340 | if !terms.scope.projects.is_empty() { |
| 341 | println!(" On {}", terms.scope.projects.join(", ")); |
| 342 | } |
| 343 | if let Some(max) = terms.scope.max_changes { |
| 344 | println!(" Change cap {max}"); |
| 345 | } |
| 346 | match terms.expires { |
| 347 | Some(expires) => println!( |
| 348 | " Expires {} ({})", |
| 349 | expires.format("%Y-%m-%d"), |
| 350 | humanize_remaining(Some(expires - Utc::now())) |
| 351 | ), |
| 352 | None => println!(" Expires never"), |
| 353 | } |
| 354 | println!(" Delegation {}", terms.id.to_urn()); |
| 355 | |
| 356 | println!(); |
| 357 | match (server_url, enrolled) { |
| 358 | (Some(url), Ok(true)) => { |
| 359 | println!("Registered with {url}"); |
| 360 | println!(" Bound in ~/.atomic/config.toml (agent_identity)"); |
| 361 | } |
| 362 | (Some(_), Ok(false)) => {} |
| 363 | (Some(url), Err(e)) => print_warning(&format!("Not registered with {url}: {e}")), |
| 364 | (None, _) => print_hint("Local only — run 'atomic identity delegation push' to enroll"), |
| 365 | } |
| 366 | |
| 367 | println!(); |
| 368 | println!("{}", crate::output::hint("Next steps:")); |
| 369 | println!( |
| 370 | " {} Inspect this agent", |
no test coverage detected