Fix duplicate client tag in spell encoding (#215)

The client tag was being added twice to spells:
1. Unconditionally in encodeSpell() in spell-conversion.ts
2. Conditionally in publish-spell.ts based on user settings

Removed the unconditional addition in encodeSpell() so the client tag
is only added once by publish-spell.ts when the user setting is enabled.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Alejandro
2026-01-26 12:44:42 +01:00
committed by GitHub
parent 569388c135
commit 3f3ebcf5f6
2 changed files with 4 additions and 6 deletions

View File

@@ -12,7 +12,8 @@ describe("Spell Conversion", () => {
});
expect(result.tags).toContainEqual(["cmd", "REQ"]);
expect(result.tags).toContainEqual(GRIMOIRE_CLIENT_TAG);
// Note: Client tag is NOT added by encodeSpell - it's added by publish-spell.ts
// based on user settings to avoid duplicate tags
expect(result.tags).toContainEqual(["k", "1"]);
expect(result.tags).toContainEqual(["k", "3"]);
expect(result.tags).toContainEqual(["k", "7"]);

View File

@@ -6,7 +6,6 @@ import type {
SpellEvent,
} from "@/types/spell";
import type { NostrFilter } from "@/types/nostr";
import { GRIMOIRE_CLIENT_TAG } from "@/constants/app";
/**
* Simple tokenization that doesn't expand shell variables
@@ -115,10 +114,8 @@ export function encodeSpell(options: CreateSpellOptions): EncodedSpell {
}
// Start with required tags
const tags: [string, string, ...string[]][] = [
["cmd", cmdType],
GRIMOIRE_CLIENT_TAG,
];
// Note: Client tag is added by publish-spell.ts based on user settings
const tags: [string, string, ...string[]][] = [["cmd", cmdType]];
// Add name tag if provided
if (name && name.trim().length > 0) {