(&self)
| 286 | |
| 287 | impl Command for IntentList { |
| 288 | fn run(&self) -> CliResult<()> { |
| 289 | let root = find_repository_root()?; |
| 290 | let repo = Repository::open(&root).map_err(CliError::Repository)?; |
| 291 | |
| 292 | // Resolve the verifying identity ONCE (soft-fail to "no identity"). |
| 293 | let verifier = resolve_verifier(&self.identity)?; |
| 294 | |
| 295 | // Resolve + validate the kind filter (`--review` ⇒ `--kind review`). An |
| 296 | // unknown kind is a clean argument error rather than a silent empty list. |
| 297 | let filter = self.kind_filter(); |
| 298 | if let Some(k) = &filter { |
| 299 | if !atomic_canonical::vocab::is_known_intent_kind(k) { |
| 300 | return Err(CliError::InvalidArgument { |
| 301 | message: format!( |
| 302 | "unknown intent kind '{}' (expected one of {:?})", |
| 303 | k, |
| 304 | atomic_canonical::vocab::INTENT_KIND |
| 305 | ), |
| 306 | }); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | // Enumerate via the SAME source `atomic vault intent list` uses; already |
| 311 | // sorted by id. Attestation entries are never in `manifest.intents`. The |
| 312 | // kind tag is read from the manifest summary (no lift). |
| 313 | let rows = build_rows(&repo, verifier.as_ref(), filter.as_deref())?; |
| 314 | |
| 315 | if self.json { |
| 316 | let json: Vec<serde_json::Value> = rows |
| 317 | .iter() |
| 318 | .map(|r| { |
| 319 | serde_json::json!({ |
| 320 | "id": r.human_key, |
| 321 | "status": r.status, |
| 322 | "kind": r.kind, |
| 323 | "attested": r.attested.json(), |
| 324 | "verifies": r.verifies.json(), |
| 325 | }) |
| 326 | }) |
| 327 | .collect(); |
| 328 | println!("{}", serde_json::to_string_pretty(&json).unwrap()); |
| 329 | return Ok(()); |
| 330 | } |
| 331 | |
| 332 | if rows.is_empty() { |
| 333 | println!("No intents found."); |
| 334 | return Ok(()); |
| 335 | } |
| 336 | |
| 337 | // Fixed-width, left-aligned columns with a header row. |
| 338 | let key_w = rows |
| 339 | .iter() |
| 340 | .map(|r| r.human_key.chars().count()) |
| 341 | .chain(std::iter::once("humanKey".chars().count())) |
| 342 | .max() |
| 343 | .unwrap_or(8); |
| 344 | let status_w = rows |
| 345 | .iter() |
nothing calls this directly
no test coverage detected