diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-03-04 16:24:29 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-03-04 16:24:29 +0000 |
| commit | af016dd23101537ccc8ecd5a992bf3b7c6d3abe9 (patch) | |
| tree | 15284c3a1301ea738507beadd2687d4dd0d248b5 /src/bin/ngit/sub_commands/issue_create.rs | |
| parent | 293ef01e141846f7de5af2c8c6be9d6c694083fd (diff) | |
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 <kind>:<pubkey-hex>:<identifier> 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
Diffstat (limited to 'src/bin/ngit/sub_commands/issue_create.rs')
| -rw-r--r-- | src/bin/ngit/sub_commands/issue_create.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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 @@ | |||
| 1 | use anyhow::{Context, Result, bail}; | 1 | use anyhow::{Context, Result, bail}; |
| 2 | use ngit::client::{Params, send_events, sign_event}; | 2 | use ngit::{ |
| 3 | client::{Params, send_events, sign_event}, | ||
| 4 | content_tags::{dedup_tags, tags_from_content}, | ||
| 5 | }; | ||
| 3 | use nostr::{EventBuilder, Tag, TagStandard, ToBech32, nips::nip19::Nip19Event}; | 6 | use nostr::{EventBuilder, Tag, TagStandard, ToBech32, nips::nip19::Nip19Event}; |
| 4 | use nostr_sdk::Kind; | 7 | use nostr_sdk::Kind; |
| 5 | 8 | ||
| @@ -74,6 +77,11 @@ pub async fn launch( | |||
| 74 | tags.push(Tag::public_key(*pk)); | 77 | tags.push(Tag::public_key(*pk)); |
| 75 | } | 78 | } |
| 76 | 79 | ||
| 80 | // NIP-21 mention tags: q tags for cited events/addresses, p tags for cited | ||
| 81 | // pubkeys | ||
| 82 | tags.extend(tags_from_content(&body, Some(git_repo_path)).await?); | ||
| 83 | let tags = dedup_tags(tags); | ||
| 84 | |||
| 77 | let issue_event = sign_event( | 85 | let issue_event = sign_event( |
| 78 | EventBuilder::new(Kind::GitIssue, body).tags(tags), | 86 | EventBuilder::new(Kind::GitIssue, body).tags(tags), |
| 79 | &signer, | 87 | &signer, |