upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-03-04 13:28:30 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-03-04 13:28:30 +0000
commit3908abbbfc5e748dd168d22bf5e3ea6aae17de61 (patch)
tree7d16390d57f8a7399212ebc30e6524ed25da1db6 /src/lib
parenta554da3ec0bdfef648921fda41f38ad0a5d53d27 (diff)
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 - <id>: optional positional argument (hex event-id or nevent) to show full details of a specific issue including body content
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/client.rs24
1 files changed, 24 insertions, 0 deletions
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(
2505 Ok((report, had_errors)) 2505 Ok((report, had_errors))
2506} 2506}
2507 2507
2508pub async fn get_issues_from_cache(
2509 git_repo_path: &Path,
2510 repo_coordinates: HashSet<Nip19Coordinate>,
2511) -> Result<Vec<nostr::Event>> {
2512 let mut issues = get_events_from_local_cache(
2513 git_repo_path,
2514 vec![
2515 nostr::Filter::default()
2516 .kinds([nostr::Kind::GitIssue])
2517 .custom_tags(
2518 nostr::SingleLetterTag::lowercase(nostr_sdk::Alphabet::A),
2519 repo_coordinates
2520 .iter()
2521 .map(|c| c.coordinate.to_string())
2522 .collect::<Vec<String>>(),
2523 ),
2524 ],
2525 )
2526 .await?;
2527 issues.sort_by_key(|e| e.created_at);
2528 issues.reverse();
2529 Ok(issues)
2530}
2531
2508pub async fn get_proposals_and_revisions_from_cache( 2532pub async fn get_proposals_and_revisions_from_cache(
2509 git_repo_path: &Path, 2533 git_repo_path: &Path,
2510 repo_coordinates: HashSet<Nip19Coordinate>, 2534 repo_coordinates: HashSet<Nip19Coordinate>,