import { parseReqCommand } from "../lib/req-parser"; import type { AppId } from "./app"; import { parseOpenCommand } from "@/lib/open-parser"; import { parseProfileCommand } from "@/lib/profile-parser"; import { parseRelayCommand } from "@/lib/relay-parser"; import { resolveNip05Batch } from "@/lib/nip05"; import { parseChatCommand } from "@/lib/chat-parser"; import { parseBlossomCommand } from "@/lib/blossom-parser"; export interface ManPageEntry { name: string; section: string; synopsis: string; description: string; options?: { flag: string; description: string }[]; examples?: string[]; seeAlso?: string[]; // Command execution metadata appId: AppId; category: "Documentation" | "System" | "Nostr"; argParser?: (args: string[], activeAccountPubkey?: string) => any; defaultProps?: any; } export const manPages: Record = { nip: { name: "nip", section: "1", synopsis: "nip ", description: "View a Nostr Implementation Possibility (NIP) specification document. NIPs define the protocol standards and extensions for the Nostr network.", options: [ { flag: "", description: "The NIP number to view (e.g., 01, 02, 19, B0)", }, ], examples: [ "nip 01 View the basic protocol specification", "nip 19 View the bech32 encoding specification", "nip b0 View the NIP-B0 specification", ], seeAlso: ["nips", "kind", "kinds"], appId: "nip", category: "Documentation", argParser: (args: string[]) => { const num = (args[0] || "01").toUpperCase(); // Pad single digit numbers with leading zero const paddedNum = num.length === 1 ? `0${num}` : num; return { number: paddedNum }; }, defaultProps: { number: "01" }, }, kind: { name: "kind", section: "1", synopsis: "kind ", description: "View information about a specific Nostr event kind. Event kinds define the type and purpose of Nostr events.", options: [ { flag: "", description: "The kind number to view (e.g., 0, 1, 3, 7)", }, ], examples: [ "kind 0 View metadata event kind", "kind 1 View short text note kind", ], seeAlso: ["kinds", "nip", "nips"], appId: "kind", category: "Documentation", argParser: (args: string[]) => ({ number: args[0] || "1" }), defaultProps: { number: "1" }, }, spellbooks: { name: "spellbooks", section: "1", synopsis: "spellbooks", description: "Browse and manage saved layout spellbooks.", appId: "spellbooks", category: "System", }, help: { name: "help", section: "1", synopsis: "help", description: "Display general help information about Grimoire and available commands.", seeAlso: ["man", "nip", "kind"], appId: "man", category: "System", defaultProps: { cmd: "help" }, }, kinds: { name: "kinds", section: "1", synopsis: "kinds", description: "Display all Nostr event kinds with rich rendering support in Grimoire. Shows kind numbers, names, descriptions, and links to their defining NIPs.", examples: ["kinds View all supported event kinds"], seeAlso: ["kind", "nip", "man"], appId: "kinds", category: "System", defaultProps: {}, }, nips: { name: "nips", section: "1", synopsis: "nips", description: "Display all Nostr Implementation Possibilities (NIPs). Shows NIP numbers and titles, with links to view each specification document.", examples: ["nips View all NIPs"], seeAlso: ["nip", "kinds", "man"], appId: "nips", category: "Documentation", defaultProps: {}, }, debug: { name: "debug", section: "1", synopsis: "debug", description: "Display the current application state for debugging purposes. Shows windows, workspaces, active account, and other internal state in a formatted view.", examples: ["debug View current application state"], seeAlso: ["help"], appId: "debug", category: "System", defaultProps: {}, }, man: { name: "man", section: "1", synopsis: "man ", description: "Display the manual page for a command. Man pages provide detailed documentation including usage, options, and examples.", options: [ { flag: "", description: "The command to view documentation for", }, ], examples: [ "man req View the req command manual", "man nip View the nip command manual", ], seeAlso: ["help"], appId: "man", category: "System", argParser: (args: string[]) => ({ cmd: args[0] || "help" }), defaultProps: { cmd: "help" }, }, req: { name: "req", section: "1", synopsis: "req [options] [relay...]", description: "Query Nostr relays using filters. Constructs and executes Nostr REQ messages to fetch events matching specified criteria. Supports filtering by kind, author, tags, time ranges, and content search. Use $me and $contacts aliases for queries based on your active account.", options: [ { flag: "-k, --kind ", description: "Filter by event kind (e.g., 0=metadata, 1=note, 7=reaction). Supports comma-separated values: -k 1,3,7", }, { flag: "-a, --author ", description: "Filter by author pubkey (supports npub, hex, NIP-05 identifier, bare domain, $me, or $contacts). Supports comma-separated values: -a npub1...,user@domain.com,$me", }, { flag: "-l, --limit ", description: "Maximum number of events to return", }, { flag: "-e ", description: "Filter by event ID or coordinate. Supports note1 (bare event ID), nevent1 (event with relay hints), naddr1 (addressable event coordinate), or raw hex. Comma-separated values supported: -e note1...,nevent1...,naddr1...", }, { flag: "-p ", description: "Filter by mentioned pubkey (#p tag, supports npub, hex, NIP-05, bare domain, $me, or $contacts). Supports comma-separated values: -p npub1...,npub2...,$contacts", }, { flag: "-P ", description: "Filter by zap sender (#P tag, supports npub, hex, NIP-05, bare domain, $me, or $contacts). Supports comma-separated values: -P npub1...,npub2...,$me. Useful for finding zaps sent by specific users.", }, { flag: "-t ", description: "Filter by hashtag (#t tag). Supports comma-separated values: -t nostr,bitcoin,lightning", }, { flag: "-d ", description: "Filter by d-tag identifier (replaceable events). Supports comma-separated values: -d article1,article2", }, { flag: "-T, --tag ", description: "Filter by any single-letter tag (#). Supports comma-separated values: --tag a val1,val2. Works with any tag (a, r, g, L, etc.)", }, { flag: "--since