feat: add attestr/trusted-list kind search aliases (phase 1) - #247
feat: add attestr/trusted-list kind search aliases (phase 1)#247dadofsambonzuki wants to merge 1 commit into
Conversation
|
Someone is attempting to deploy a commit to the dergigi's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds new Nostr event kind mappings for attestations and trusted lists to query tokens and extends UI icon/display name mappings for those event kinds. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/lib/eventKindIcons.ts (1)
33-66: Consider consolidating the three parallel mappings.The file maintains three separate
Record<number, ...>structures (EVENT_KIND_ICONS, icon names ingetEventKindIconName, and display names ingetEventKindDisplayName) that must stay synchronized. This is an existing pattern, but as the number of kinds grows, a single source-of-truth object could reduce maintenance burden.♻️ Optional: Unified mapping structure for future consideration
// Single source of truth interface KindMeta { icon: IconDefinition; iconName: string; displayName: string; } const EVENT_KINDS: Record<number, KindMeta> = { // ... etc }; export const EVENT_KIND_ICONS: Record<number, IconDefinition> = Object.fromEntries(Object.entries(EVENT_KINDS).map(([k, v]) => [k, v.icon])); export function getEventKindIconName(kind: number): string | null { return EVENT_KINDS[kind]?.iconName ?? null; } export function getEventKindDisplayName(kind: number): string { return EVENT_KINDS[kind]?.displayName ?? 'Note'; }Also applies to: 82-119, 126-163
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/eventKindIcons.ts` around lines 33 - 66, The three parallel mappings (EVENT_KIND_ICONS, getEventKindIconName, getEventKindDisplayName) drift out of sync; replace them with a single source-of-truth mapping (e.g., EVENT_KINDS: Record<number, KindMeta> where KindMeta has icon, iconName, displayName) and derive the existing exports/helpers from it (keep EVENT_KIND_ICONS by building it from EVENT_KINDS, implement getEventKindIconName and getEventKindDisplayName to read from EVENT_KINDS with appropriate fallbacks); update usages to continue relying on EVENT_KIND_ICONS/getEventKindIconName/getEventKindDisplayName so behavior remains unchanged while ensuring a single authoritative mapping.public/replacements.txt (1)
60-72: New search aliases are correctly formatted and follow existing conventions.The
is:token mappings inreplacements.txt(lines 60-72) are properly structured. However, note thatsrc/lib/spellTranslate.ts:KIND_SHORTCUTSwas not updated to include these new kinds. If spell events (kind:777) should support filtering by attestation and trusted list kinds, consider adding them to theKIND_SHORTCUTSmap for consistency. Currently, spell events won't recognize these shortcuts.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@public/replacements.txt` around lines 60 - 72, replacements.txt added new is: shortcuts but src/lib/spellTranslate.ts's KIND_SHORTCUTS map doesn't include them, so spell events (kind:777) won't recognize them; update the KIND_SHORTCUTS constant in spellTranslate.ts to add entries for each new alias (e.g., "is:attestation" -> 31871, "is:attestation-request" -> 31872, "is:attestor-recommendation" -> 31873, "is:attestor-proficiency" -> 11871, "is:trusted-list" -> 30392, "is:trusted-list-topic" -> 30393, "is:trusted-list-dedup" -> 30394, "is:trusted-list-meta" -> 30395, "is:trusted-assertion-user" -> 30382, "is:trusted-assertion-event" -> 30383, "is:trusted-assertion-address" -> 30384, "is:trusted-service-providers" -> 10040) and verify that KIND_SHORTCUTS is used by the logic handling kind 777 so these aliases are recognized by spell events.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@public/replacements.txt`:
- Around line 60-72: replacements.txt added new is: shortcuts but
src/lib/spellTranslate.ts's KIND_SHORTCUTS map doesn't include them, so spell
events (kind:777) won't recognize them; update the KIND_SHORTCUTS constant in
spellTranslate.ts to add entries for each new alias (e.g., "is:attestation" ->
31871, "is:attestation-request" -> 31872, "is:attestor-recommendation" -> 31873,
"is:attestor-proficiency" -> 11871, "is:trusted-list" -> 30392,
"is:trusted-list-topic" -> 30393, "is:trusted-list-dedup" -> 30394,
"is:trusted-list-meta" -> 30395, "is:trusted-assertion-user" -> 30382,
"is:trusted-assertion-event" -> 30383, "is:trusted-assertion-address" -> 30384,
"is:trusted-service-providers" -> 10040) and verify that KIND_SHORTCUTS is used
by the logic handling kind 777 so these aliases are recognized by spell events.
In `@src/lib/eventKindIcons.ts`:
- Around line 33-66: The three parallel mappings (EVENT_KIND_ICONS,
getEventKindIconName, getEventKindDisplayName) drift out of sync; replace them
with a single source-of-truth mapping (e.g., EVENT_KINDS: Record<number,
KindMeta> where KindMeta has icon, iconName, displayName) and derive the
existing exports/helpers from it (keep EVENT_KIND_ICONS by building it from
EVENT_KINDS, implement getEventKindIconName and getEventKindDisplayName to read
from EVENT_KINDS with appropriate fallbacks); update usages to continue relying
on EVENT_KIND_ICONS/getEventKindIconName/getEventKindDisplayName so behavior
remains unchanged while ensuring a single authoritative mapping.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 259b671e-80bc-4a3d-93fa-d5f75ae83fb2
📒 Files selected for processing (2)
public/replacements.txtsrc/lib/eventKindIcons.ts
|
FYI — |
dc96e5a to
60c7c16
Compare
OK, done. 🫡 I have ignored the CodeRabbit nitpicks as they extend to the whole codebase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Adds Phase 1 support for searching attestation-related Nostr kinds by extending aliases and kind metadata.
What changed
1) Search aliases (
public/replacements.txt)Added
is:aliases for attestr/trusted-list/trusted-assertion kinds:is:attestation->kind:31871is:attestation-request->kind:31872is:attestor-recommendation->kind:31873is:attestor-proficiency->kind:11871is:trusted-service-providers->kind:10040is:trusted-assertion-user->kind:30382is:trusted-assertion-event->kind:30383is:trusted-assertion-address->kind:30384is:trusted-list->kind:30392is:trusted-list-topic->kind:30393is:trusted-list-dedup->kind:30394is:trusted-list-meta->kind:30395This enables direct search queries such as:
is:attestation by:aliceis:trusted-listis:trusted-service-providers by:bob2) Kind metadata/icons (
src/lib/eventKindIcons.ts)Added icon and display-name mappings for the same kinds so kind badges/buttons resolve correctly and consistently.
Scope
This PR intentionally focuses only on Phase 1 (search/discoverability + mappings). It does not add custom rendering cards for these kinds yet.
Validation
npx tsc --noEmit✅npm test✅ (all existing suites passing)Summary by CodeRabbit