Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Then pass `--wallet-name` to any command to use that wallet:

```bash
npx @getalby/cli --wallet-name work get-balance
npx @getalby/cli --wallet-name personal pay-invoice --invoice lnbc...
npx @getalby/cli --wallet-name personal pay-invoice lnbc...
```

### Connection secret resolution (in order of priority)
Expand Down Expand Up @@ -105,7 +105,7 @@ npx @getalby/cli get-wallet-service-info
npx @getalby/cli make-invoice --amount 1000 --description "Payment"

# Pay an invoice
npx @getalby/cli pay-invoice --invoice "lnbc..."
npx @getalby/cli pay-invoice "lnbc..."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check for outdated pay-invoice examples in CLI description

# Search for pay-invoice examples with --invoice flag in src/index.ts
rg -n 'pay-invoice.*--invoice' src/index.ts

Repository: getAlby/cli

Length of output: 120


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- src/index.ts (around line 39) ----"
sed -n '1,120p' src/index.ts | nl -ba | sed -n '25,70p'

echo "---- README.md (around line 108) ----"
sed -n '90,130p' README.md | nl -ba | sed -n '20,45p'

echo "---- search for pay-invoice examples in src/index.ts ----"
rg -n 'pay-invoice' src/index.ts

echo "---- search for --invoice usage in src/ ----"
rg -n -- '--invoice' src/ || true

Repository: getAlby/cli

Length of output: 156


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- src/index.ts (around line 39) ----"
sed -n '1,120p' src/index.ts | cat -n | sed -n '25,70p'

echo "---- README.md (around line 108) ----"
sed -n '90,130p' README.md | cat -n | sed -n '20,45p'

echo "---- search for pay-invoice examples in src/index.ts ----"
rg -n 'pay-invoice' src/index.ts || true

echo "---- search for --invoice usage in src/ ----"
rg -n -- '--invoice' src/ || true

Repository: getAlby/cli

Length of output: 3867


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- README.md (exact lines 100-115) ----"
sed -n '100,115p' README.md | cat -n

echo "---- Find pay-invoice command implementation ----"
rg -n "registerPayInvoiceCommand|pay-invoice" src/commands src/index.ts

echo "---- Inspect src/commands/pay-invoice*.ts ----"
fd -a -g "pay-invoice*" src/commands . | head -n 20

for f in $(fd -a -g "pay-invoice*" src/commands .); do
  echo "===== $f ====="
  wc -l "$f"
  sed -n '1,200p' "$f" | cat -n
done

Repository: getAlby/cli

Length of output: 3135


Fix outdated pay-invoice syntax in CLI help text (src/index.ts)
src/index.ts advertises npx @getalby/cli pay-invoice --invoice lnbc..., but the pay-invoice command is defined with a positional <bolt11> argument (no --invoice option). Update the example to npx @getalby/cli pay-invoice lnbc... to match both README and the actual CLI behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 108, The help text in src/index.ts advertises the wrong
syntax for the pay-invoice command; update the example so it matches the command
definition that uses a positional <bolt11> argument. Locate the CLI command
registration for "pay-invoice" in src/index.ts (the code that defines the
command/description/usage) and change the example usage string from using
"--invoice lnbc..." to the positional form "lnbc..." (e.g., "npx `@getalby/cli`
pay-invoice lnbc...") so the README, help text and actual CLI behavior are
consistent.


# Send a keysend payment
npx @getalby/cli pay-keysend --pubkey "02abc..." --amount 100
Expand Down
6 changes: 3 additions & 3 deletions src/commands/pay-invoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ export function registerPayInvoiceCommand(program: Command) {
program
.command("pay-invoice")
.description("Pay a lightning invoice")
.requiredOption("-i, --invoice <bolt11>", "Invoice to pay")
.argument("<bolt11>", "Invoice to pay")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify test file usage of pay-invoice command

# Check for old -i flag usage in test files
rg -n 'pay-invoice.*-i' --type=ts -g '*test*'

Repository: getAlby/cli

Length of output: 279


Fix failing tests for pay-invoice argument change

src/test/nwc-payments.test.ts still invokes pay-invoice -i "${invoiceResult.output.invoice}" (lines 29, 44). Since pay-invoice now expects the positional <bolt11> argument (and no -i/--invoice option), update those calls to:

`-c "${sender.nwcUrl}" pay-invoice "${invoiceResult.output.invoice}"`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/pay-invoice.ts` at line 9, Tests still call the old pay-invoice
option flag (-i/--invoice) but the CLI signature changed to require a positional
<bolt11> argument in pay-invoice; update the test invocations in
src/test/nwc-payments.test.ts so the pay-invoice calls use the new positional
form, e.g. replace occurrences like `pay-invoice -i
"${invoiceResult.output.invoice}"` with the form that includes the sender URL
and the positional invoice string, e.g. `-c "${sender.nwcUrl}" pay-invoice
"${invoiceResult.output.invoice}"`, ensuring you update both places around lines
where invoiceResult.output.invoice is used.

.option("-a, --amount <sats>", "Amount (for zero-amount invoices)", parseInt)
.action(async (options) => {
.action(async (invoice, options) => {
await handleError(async () => {
const client = await getClient(program);
const result = await payInvoice(client, {
invoice: options.invoice,
invoice,
amount_in_sats: options.amount,
});
output(result);
Expand Down
Loading