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