From 37244449d6d0d58bb639f181bd15092de1acaaee Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 5 Mar 2026 14:19:49 +0000 Subject: feat(cover-note): add kind-1624 cover notes for PRs, patches, and issues Implements experimental kind-1624 cover note events: - KIND_COVER_NOTE constant and process_cover_note() in git_events.rs; replaceable semantics (latest created_at, hex-id tiebreak), author or maintainer only - kind-1624 events fetched alongside labels in the fetch pipeline; cover_notes count added to FetchReport display - ngit pr/issue view: cover note displayed in place of description with a clear 'Cover Note:' header; maintainer-authored notes identify the author; original description shown only with --comments; cover_note object included in --json output - ngit pr set-cover-note / ngit issue set-cover-note: publish a kind-1624 event; nostr: mentions in --body converted to q/p tags via tags_from_content (same rules as issue --body) - Fix pre-existing clippy::too_many_lines on repo/mod.rs show_info --- src/bin/ngit/sub_commands/label.rs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/bin/ngit/sub_commands/label.rs') diff --git a/src/bin/ngit/sub_commands/label.rs b/src/bin/ngit/sub_commands/label.rs index 634e0b5..f6714ae 100644 --- a/src/bin/ngit/sub_commands/label.rs +++ b/src/bin/ngit/sub_commands/label.rs @@ -3,14 +3,13 @@ use ngit::{ client::{Params, get_issues_from_cache, get_proposals_and_revisions_from_cache, send_events}, git_events::{KIND_LABEL, get_labels}, }; -use nostr::{EventBuilder, Tag, TagStandard}; +use nostr::{EventBuilder, Tag, TagStandard, nips::nip19::Nip19}; use nostr_sdk::{EventId, FromBech32}; -use nostr::nips::nip19::Nip19; use crate::{ client::{ - Client, Connect, fetching_with_report, get_events_from_local_cache, get_repo_ref_from_cache, - save_event_in_local_cache, + Client, Connect, fetching_with_report, get_events_from_local_cache, + get_repo_ref_from_cache, save_event_in_local_cache, }, git::{Repo, RepoActions}, login, @@ -90,19 +89,13 @@ async fn publish_label_event( // Permission check: only the author or a maintainer may label. if target.pubkey != user_pubkey && !repo_ref.maintainers.contains(&user_pubkey) { - bail!( - "only the {target_kind} author or a repository maintainer can label a {target_kind}" - ); + bail!("only the {target_kind} author or a repository maintainer can label a {target_kind}"); } // Fetch existing label events so we can warn about duplicates. let existing_label_events = get_events_from_local_cache( git_repo_path, - vec![ - nostr::Filter::default() - .event(event_id) - .kind(KIND_LABEL), - ], + vec![nostr::Filter::default().event(event_id).kind(KIND_LABEL)], ) .await?; @@ -117,10 +110,7 @@ async fn publish_label_event( .collect(); if new_labels.is_empty() { - let already: Vec = labels - .iter() - .map(|l| format!("#{}", l.trim())) - .collect(); + let already: Vec = labels.iter().map(|l| format!("#{}", l.trim())).collect(); println!( "{target_kind} already has label{}: {}", if already.len() == 1 { "" } else { "s" }, -- cgit v1.2.3