feat: Add zap command for sending Bitcoin Lightning tips

- Implemented the `zap` command in the CLI to allow users to send sats to a user, event, or snippet using a NIP-60 wallet.
- Created a new `zap.ts` file to handle the command logic and integrated it into the MCP server.
- Added wallet balance command to check the balance of a user's wallet.
- Enhanced the MCP server to register the new zap command and wallet balance command.
- Introduced caching for wallets to optimize performance and reduce redundant network requests.
- Updated database schema to include snippets table for storing code snippets.
- Improved logging functionality for better debugging and tracking of operations.
- Added functionality to save snippets to the database upon retrieval.
- Updated project overview documentation to reflect new features and structure.
- Refactored existing commands and logic for better modularity and maintainability.
This commit is contained in:
pablof7z
2025-04-08 18:10:16 +01:00
parent f74736191a
commit 10fbca0824
19 changed files with 723 additions and 35 deletions

View File

@@ -70,10 +70,13 @@ export function formatSnippets(snippets: CodeSnippet[]): string {
.map((snippet) => {
const author = knownUsers[snippet.pubkey];
const keys: Record<string, string> = {
ID: snippet.id,
Title: snippet.title,
Description: snippet.description,
Language: snippet.language,
Tags: snippet.tags.join(", "),
Code: snippet.code,
Date: new Date(snippet.createdAt * 1000).toISOString(),
};
if (author?.profile?.name) keys.Author = author.profile.name;
return Object.entries(keys)
@@ -95,7 +98,7 @@ export function formatPartialMatches(snippets: CodeSnippet[]): string {
"\n\nSome other events not included in this result since they had less in common with your search, here is a list of the events that had partial matches:\n\n";
text += snippets
.map((snippet) => {
return ` * ${snippet.title}:\n Tags: ${snippet.tags.join(", ")}`;
return ` * ${snippet.title}:\n Tags: ${snippet.tags.join(", ")} (ID: ${snippet.id})`;
})
.join("\n");