From 3908abbbfc5e748dd168d22bf5e3ea6aae17de61 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 4 Mar 2026 13:28:30 +0000 Subject: feat: add ngit issue list command Non-interactive listing of NIP-34 issues (kind 1621) with status resolution, hashtag display, and detail view. - get_issues_from_cache: fetch GitIssue events from local cache by repo coordinate, mirroring get_proposals_and_revisions_from_cache - ngit issue list: table output of ID, status, title and hashtags at end of each row; status resolved via existing get_status() logic - --status: comma-separated filter (open,draft,closed,applied; default: open) - --hashtag: comma-separated label filter (case-insensitive, OR match) - --json: machine-readable output including hashtags and description - --offline: skip network fetch, use local cache only - : optional positional argument (hex event-id or nevent) to show full details of a specific issue including body content --- src/lib/client.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/lib/client.rs') diff --git a/src/lib/client.rs b/src/lib/client.rs index 62db8d2..1f46e3c 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs @@ -2505,6 +2505,30 @@ pub async fn fetching_quietly( Ok((report, had_errors)) } +pub async fn get_issues_from_cache( + git_repo_path: &Path, + repo_coordinates: HashSet, +) -> Result> { + let mut issues = get_events_from_local_cache( + git_repo_path, + vec![ + nostr::Filter::default() + .kinds([nostr::Kind::GitIssue]) + .custom_tags( + nostr::SingleLetterTag::lowercase(nostr_sdk::Alphabet::A), + repo_coordinates + .iter() + .map(|c| c.coordinate.to_string()) + .collect::>(), + ), + ], + ) + .await?; + issues.sort_by_key(|e| e.created_at); + issues.reverse(); + Ok(issues) +} + pub async fn get_proposals_and_revisions_from_cache( git_repo_path: &Path, repo_coordinates: HashSet, -- cgit v1.2.3