diff --git a/package.json b/package.json index 1bf13fd..3d41caf 100644 --- a/package.json +++ b/package.json @@ -33,10 +33,13 @@ ], "author": "Alby contributors", "license": "MIT", + "engines": { + "node": ">=20" + }, "dependencies": { "@getalby/lightning-tools": "^7.0.2", "@getalby/sdk": "^7.0.0", - "commander": "^13.1.0" + "commander": "^14.0.3" }, "devDependencies": { "@types/node": "^25.2.0", @@ -44,4 +47,4 @@ "typescript": "^5.9.3", "vitest": "^4.0.18" } -} +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index a893450..785591b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,15 +26,27 @@ const program = new Command(); program .name("alby-cli") - .description("CLI for Nostr Wallet Connect (NIP-47) with lightning tools") + .description( + "CLI for Nostr Wallet Connect (NIP-47) with lightning tools\n\n" + + " Examples:\n" + + " $ alby-cli --connection-secret /path/to/secret.key get-balance\n" + + " $ alby-cli --connection-secret /path/to/secret.key pay-invoice --invoice lnbc...\n" + + " $ alby-cli fiat-to-sats --currency USD --amount 5\n" + + " $ alby-cli pay-invoice --invoice lnbc...", + ) .version("0.2.4") .option( "-c, --connection-secret ", "NWC connection secret (nostr+walletconnect://...) or path to file containing it (preferred)", ) .addHelpText( - "afterAll", + "after", ` +Connection Secret Resolution (in order of priority): + 1. --connection-secret flag (value or path to file) + 2. NWC_URL environment variable + 3. ~/.alby-cli/connection-secret.key (default file location) + Security: - Do NOT print the connection secret to any logs or otherwise reveal it. - NEVER share connection secrets with anyone. @@ -42,21 +54,30 @@ Security: as this can be used to gain access to your wallet or reduce your wallet's privacy.`, ); -// Register all commands +// Register common wallet commands +program.commandsGroup("Wallet Commands (require --connection-secret):"); registerGetBalanceCommand(program); registerGetBudgetCommand(program); registerGetInfoCommand(program); -registerGetWalletServiceInfoCommand(program); registerMakeInvoiceCommand(program); -registerMakeHoldInvoiceCommand(program); -registerSettleHoldInvoiceCommand(program); -registerCancelHoldInvoiceCommand(program); registerPayInvoiceCommand(program); -registerPayKeysendCommand(program); registerLookupInvoiceCommand(program); registerListTransactionsCommand(program); + +// Register advanced wallet commands +program.commandsGroup( + "Advanced Wallet Commands (require --connection-secret):", +); +registerPayKeysendCommand(program); +registerGetWalletServiceInfoCommand(program); registerWaitForPaymentCommand(program); registerSignMessageCommand(program); +registerMakeHoldInvoiceCommand(program); +registerSettleHoldInvoiceCommand(program); +registerCancelHoldInvoiceCommand(program); + +// Register lightning tool commands +program.commandsGroup("Lightning Tools (no --connection-secret required):"); registerFiatToSatsCommand(program); registerSatsToFiatCommand(program); registerParseInvoiceCommand(program); diff --git a/yarn.lock b/yarn.lock index 7c2921a..eee67de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -422,10 +422,10 @@ chai@^6.2.1: resolved "https://registry.yarnpkg.com/chai/-/chai-6.2.2.tgz#ae41b52c9aca87734505362717f3255facda360e" integrity sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg== -commander@^13.1.0: - version "13.1.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-13.1.0.tgz#776167db68c78f38dcce1f9b8d7b8b9a488abf46" - integrity sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw== +commander@^14.0.3: + version "14.0.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.3.tgz#425d79b48f9af82fcd9e4fc1ea8af6c5ec07bbc2" + integrity sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw== es-module-lexer@^1.7.0: version "1.7.0"