From 271013f83418b33eb682bb5c3173d67dbc35b962 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 3 Apr 2026 15:32:43 -0500 Subject: [PATCH] Deduplicate auto-added t-tags to prevent duplicates on re-save --- src/lib/appEvent.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/appEvent.ts b/src/lib/appEvent.ts index 4a65f624..88ca370b 100644 --- a/src/lib/appEvent.ts +++ b/src/lib/appEvent.ts @@ -82,13 +82,16 @@ export async function buildAppEvent( } } - // Add t-tags for categorization (shakespeare + template name) + // Add t-tags for categorization (shakespeare + template name), skipping duplicates if (opts?.fs && opts.cwd) { - tags.push(['t', 'shakespeare']); + const existingTTags = new Set(input.tTags?.map(t => t.trim().toLowerCase()) ?? []); + if (!existingTTags.has('shakespeare')) { + tags.push(['t', 'shakespeare']); + } try { const dotAI = new DotAI(opts.fs, opts.cwd); const template = await dotAI.readTemplate(); - if (template) { + if (template && !existingTTags.has(template.name.toLowerCase())) { tags.push(['t', template.name.toLowerCase()]); } } catch {