From af016dd23101537ccc8ecd5a992bf3b7c6d3abe9 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 4 Mar 2026 16:24:29 +0000 Subject: add NIP-21 content tags (q/p) to issues, comments, PRs and patches - parse nostr: URI mentions in issue bodies, comment bodies, PR descriptions, patch commit messages and cover letters - npub/nprofile mentions produce p tags; note/nevent/naddr mentions produce q tags per NIP-22 - naddr q tag value uses raw :: format - nevent pubkey field populated from embedded author or local cache lookup - dedup_tags() removes duplicate p tags and suppresses q tags whose event-id is already covered by an existing e threading tag - all parsing errors are non-fatal: invalid nostr: tokens are skipped --- src/bin/ngit/sub_commands/issue_create.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/bin/ngit/sub_commands/issue_create.rs') diff --git a/src/bin/ngit/sub_commands/issue_create.rs b/src/bin/ngit/sub_commands/issue_create.rs index 0c4b677..4543823 100644 --- a/src/bin/ngit/sub_commands/issue_create.rs +++ b/src/bin/ngit/sub_commands/issue_create.rs @@ -1,5 +1,8 @@ use anyhow::{Context, Result, bail}; -use ngit::client::{Params, send_events, sign_event}; +use ngit::{ + client::{Params, send_events, sign_event}, + content_tags::{dedup_tags, tags_from_content}, +}; use nostr::{EventBuilder, Tag, TagStandard, ToBech32, nips::nip19::Nip19Event}; use nostr_sdk::Kind; @@ -74,6 +77,11 @@ pub async fn launch( tags.push(Tag::public_key(*pk)); } + // NIP-21 mention tags: q tags for cited events/addresses, p tags for cited + // pubkeys + tags.extend(tags_from_content(&body, Some(git_repo_path)).await?); + let tags = dedup_tags(tags); + let issue_event = sign_event( EventBuilder::new(Kind::GitIssue, body).tags(tags), &signer, -- cgit v1.2.3