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"; 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[]) => 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: ["feed", "kind"], 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: ["nip"], appId: "kind", category: "Documentation", argParser: (args: string[]) => ({ number: args[0] || "1" }), defaultProps: { number: "1" }, }, help: { name: "help", section: "1", synopsis: "help", description: "Display general help information about Grimoire and available commands.", examples: [ "Use man to view detailed documentation", "Click any command to open its man page", ], 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: {}, }, // 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 feed View the feed 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.", 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, or bare domain). Supports comma-separated values: -a npub1...,user@domain.com", }, { flag: "-l, --limit ", description: "Maximum number of events to return", }, { flag: "-e ", description: "Filter by referenced event ID (#e tag). Supports comma-separated values: -e id1,id2,id3", }, { flag: "-p ", description: "Filter by mentioned pubkey (#p tag, supports npub, hex, NIP-05, or bare domain). Supports comma-separated values: -p npub1...,npub2...", }, { 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