From d4d6ff0d8992667d00aa1c068da82f3e92aa5be1 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 2 Apr 2026 02:47:52 -0500 Subject: [PATCH] Include nsite "a" tag in kind 31990 app events when deployment exists --- src/lib/appEvent.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/lib/appEvent.ts b/src/lib/appEvent.ts index 6c5079d4..4f5e1eb6 100644 --- a/src/lib/appEvent.ts +++ b/src/lib/appEvent.ts @@ -1,6 +1,7 @@ import git from 'isomorphic-git'; import { DotAI } from './DotAI'; import { NostrURI } from './NostrURI'; +import { readNsiteVfsConfig } from './nsiteConfig'; import type { JSRuntimeFS } from './JSRuntime'; /** Input for building a kind 31990 app event. */ @@ -97,6 +98,24 @@ export async function buildAppEvent( } } + // If an nsite deployment exists, add an "a" tag referencing the site manifest event + if (opts?.fs && opts.cwd && opts.pubkey) { + try { + const nsiteConfig = await readNsiteVfsConfig(opts.fs, opts.cwd); + if (nsiteConfig) { + if (nsiteConfig.id) { + // Named site: kind 35128 addressable event + tags.push(['a', `35128:${opts.pubkey}:${nsiteConfig.id}`]); + } else { + // Root site: kind 15128 replaceable event + tags.push(['a', `15128:${opts.pubkey}:`]); + } + } + } catch { + // No nsite config found, skip + } + } + return { content: JSON.stringify(content), tags,