diff --git a/.claude/commands/sync-nips.md b/.claude/commands/sync-nips.md index 4aa39d0..139b9ee 100644 --- a/.claude/commands/sync-nips.md +++ b/.claude/commands/sync-nips.md @@ -21,7 +21,7 @@ Read the current file, then: ### VALID_NIPS array - Add new NIP identifiers found upstream - Remove NIPs no longer listed upstream (unless referenced by a kind in `kinds.ts`) -- Maintain sort order: numeric first (`"01"`–`"99"`), then hexadecimal (`"7D"`, `"A0"`, etc.) +- Maintain sort order: numeric first (`"01"`–`"99"`), then hexadecimal (`"5A"`, `"7D"`, `"A0"`, etc.) - Preserve the `// Numeric NIPs` and `// Hexadecimal NIPs` section comments ### NIP_TITLES record @@ -30,10 +30,27 @@ Read the current file, then: - Keep existing entries that still match ### DEPRECATED_NIPS array -- Sync with upstream: add NIPs marked `deprecated`, remove ones no longer deprecated +- Sync with upstream: add NIPs marked `unrecommended`/`deprecated`, remove ones no longer deprecated - Keep `as const` assertion -## Step 3: Update `src/constants/kinds.ts` +## Step 3: Update `src/lib/nip-icons.ts` + +Read the current file. The `NIP_METADATA` record provides icons, short names, and descriptions for each NIP — used by NIPBadge and NipsViewer. + +### For every new NIP added in Step 2: +- Add a corresponding entry to `NIP_METADATA` with: `id` (string, matches the NIP identifier), `name` (short), `description`, `icon` (lucide-react), and `deprecated` if applicable +- All keys and `id` values are strings (e.g., `"01"`, `"5A"`, `"A0"`) +- Pick an icon from existing imports; add new imports if needed +- Place in correct position (numeric keys first, then hex keys sorted) + +### For deprecated status changes: +- Add or remove the `deprecated: true` field to match upstream + +### Preserve existing entries: +- Never change icons on existing entries +- Only update name/description if upstream changed + +## Step 4: Update `src/constants/kinds.ts` Read the current file, then apply changes carefully. @@ -57,13 +74,14 @@ Read the current file, then apply changes carefully. - If the NIP reference changed, update the `nip` field - **Never** change the `icon` field on existing entries -## Step 4: Cross-reference validation +## Step 5: Cross-reference validation -- Every `nip` field in `EVENT_KINDS` should exist in `VALID_NIPS` (except empty strings `""` and external specs like `"BUD-03"`, `"AMB"`, `"85"`) +- Every `nip` field in `EVENT_KINDS` should exist in `VALID_NIPS` (except empty strings `""` and external specs like `"BUD-03"`, `"AMB"`, `"Marmot"`) - Every NIP in `DEPRECATED_NIPS` should also be in `VALID_NIPS` +- Every NIP in `VALID_NIPS` should have a corresponding entry in `NIP_METADATA` (`src/lib/nip-icons.ts`) - Flag and fix any inconsistencies -## Step 5: Verify +## Step 6: Verify ```bash npm run lint && npm run test:run && npm run build @@ -71,10 +89,11 @@ npm run lint && npm run test:run && npm run build Fix any lint/type/build issues before reporting. -## Step 6: Report +## Step 7: Report Summarize: - NIPs added / removed / title-updated +- NIP icons added / updated in `nip-icons.ts` - Kinds added / updated (with icon choices explained for new ones) - Inconsistencies found and resolved - Verification results (lint/test/build) diff --git a/src/components/NIPBadge.tsx b/src/components/NIPBadge.tsx index 14ed9a9..e05dd17 100644 --- a/src/components/NIPBadge.tsx +++ b/src/components/NIPBadge.tsx @@ -1,6 +1,6 @@ import { getNIPInfo } from "../lib/nip-icons"; import { useAddWindow } from "@/core/state"; -import { isNipDeprecated } from "@/constants/nips"; +import { isNipDeprecated, isValidNip } from "@/constants/nips"; import { getCommunityNipForNipId } from "@/constants/kinds"; export interface NIPBadgeProps { @@ -26,6 +26,7 @@ export function NIPBadge({ const description = nipInfo?.description || `Nostr Implementation Possibility ${nipNumber}`; const isDeprecated = isNipDeprecated(nipNumber); + const isExternal = !isValidNip(nipNumber); const communityNip = getCommunityNipForNipId(nipNumber); @@ -48,6 +49,18 @@ export function NIPBadge({ ); }; + // External specs (Marmot, BUD-03, etc.) render as non-interactive labels + if (isExternal && !communityNip) { + return ( + + {nipNumber} + + ); + } + return (