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
26 changes: 13 additions & 13 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ src/

1. Add an exported async function to `src/commands/resources.ts` (or a
new module if it's a brand new resource). Naming pattern:
`<verb><Resource>` — `listReceivers`, `getPayout`, `createBankAccount`,
`<verb><Resource>`, e.g. `listCustomers`, `getPayout`, `createBankAccount`,
`deleteWebhookEndpoint`.
2. Wire it in `src/index.ts` under the appropriate `program.command(...)`
group. Keep groups together with a banner comment
(`// ── Resource ─────────────────────────────────────`).
3. Add `--json` to any read-only command. Use `printResult(data, json,
columns)` to render — pass meaningful columns for the default
non-JSON output.
4. Path params (e.g. `<id>`, `<receiver-id>`) are positional or
`--receiver-id <id>` flags depending on whether they belong to the
4. Path params (e.g. `<id>`, `<customer-id>`) are positional or
`--customer-id <id>` flags depending on whether they belong to the
primary resource being acted on. Look at how existing commands handle
parent IDs (bank_accounts uses `--receiver-id`).
parent IDs (bank_accounts uses `--customer-id`).
5. Wrap all API calls with `try/catch` and route errors through
`handleApiError(err, json)`.
6. Use `parseAmount(...)` (already in resources.ts) for any amount field
Expand All @@ -86,9 +86,9 @@ src/
include an extra test for any non-trivial body shaping
(e.g. cents-scaling, optional-field omission, network-path branching).
**Place the test inside the existing `describe(...)` block that
matches the command's top-level CLI group.** A `receivers submit_rfi`
command's test goes inside `describe('Receivers', ...)` alongside
`lists receivers` / `fetches a receiver by id` not in a new
matches the command's top-level CLI group.** A `customers rfi_submit`
command's test goes inside `describe('Customers', ...)` alongside
`lists customers` / `fetches a customer by id`, not in a new
`describe('RFI', ...)`. Only create a new describe block when you are
introducing a brand-new top-level group (e.g. the first `transfers`
command).
Expand All @@ -97,8 +97,8 @@ src/

| API path | Command |
| ----------------------------------------------------- | -------------------------------- |
| `GET /v1/instances/{id}/receivers` | `blindpay receivers list` |
| `POST /v1/instances/{id}/receivers/{rid}/bank-accounts` | `blindpay bank_accounts create` |
| `GET /v1/instances/{id}/customers` | `blindpay customers list` |
| `POST /v1/instances/{id}/customers/{cid}/bank-accounts` | `blindpay bank_accounts create` |
| `GET /v1/available/...` | `blindpay available rails` |

Group names use `snake_case` (matching the API resource name with
Expand Down Expand Up @@ -132,8 +132,8 @@ do **not** ship a command with an empty `{}` body and a TODO. Accept
the body as a single `--body <json>` flag and parse it. Pattern:

```ts
export async function submitReceiverRfi(
receiverId: string,
export async function submitCustomerRfi(
customerId: string,
options: { body: string; json: boolean },
) {
let body: Record<string, unknown>
Expand All @@ -145,7 +145,7 @@ export async function submitReceiverRfi(
const ctx = resolveContext()
const res = await apiPost<{ success: boolean }>(
ctx,
`${instancePath(ctx)}/receivers/${receiverId}/rfi`,
`${instancePath(ctx)}/customers/${customerId}/rfi`,
body,
)
clack.log.success('RFI response submitted')
Expand All @@ -156,7 +156,7 @@ export async function submitReceiverRfi(
```

The user constructs the body shape on the command line:
`blindpay receivers submit_rfi re_xyz --body '{"address":"..."}'`.
`blindpay customers rfi_submit re_xyz --body '{"address":"..."}'`.

Use `--body` as the standard flag name for all dynamic-body endpoints.
Don't pick a semantically-flavored name like `--response` or
Expand Down
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,36 +57,39 @@ Every command supports `--help` for detailed usage and `--json` for machine-read
| `blindpay instances update` | Update instance name or redirect URL |
| `blindpay instances members list` | List instance members |

### Receivers
### Customers

| Command | Description |
|---|---|
| `blindpay receivers list` | List all receivers |
| `blindpay receivers get <id>` | Get a receiver by ID |
| `blindpay receivers create` | Create a new receiver |
| `blindpay receivers update <id>` | Update a receiver |
| `blindpay receivers delete <id>` | Delete a receiver |
| `blindpay receivers limits <id>` | Get receiver limits |
| `blindpay receivers limits_increase_requests <id>` | Get limits increase requests |
| `blindpay customers list` | List all customers |
| `blindpay customers get <id>` | Get a customer by ID |
| `blindpay customers create` | Create a new customer |
| `blindpay customers update <id>` | Update a customer |
| `blindpay customers delete <id>` | Delete a customer |
| `blindpay customers limits <id>` | Get customer limits |
| `blindpay customers limits_increase_requests <id>` | Get customer limit-increase requests |
| `blindpay customers create_limit_increase <id>` | Request a limit increase for a customer |
| `blindpay customers rfi_get <id>` | Get the open RFI for a customer |
| `blindpay customers rfi_submit <id>` | Submit an RFI response for a customer |

### Bank Accounts

Requires `--receiver-id` on every command.
Requires `--customer-id` on every command.

| Command | Description |
|---|---|
| `blindpay bank_accounts list` | List bank accounts for a receiver |
| `blindpay bank_accounts list` | List bank accounts for a customer |
| `blindpay bank_accounts get <id>` | Get a bank account by ID |
| `blindpay bank_accounts create` | Create a new bank account |
| `blindpay bank_accounts delete <id>` | Delete a bank account |

### Blockchain Wallets

Requires `--receiver-id` on every command.
Requires `--customer-id` on every command.

| Command | Description |
|---|---|
| `blindpay blockchain_wallets list` | List blockchain wallets for a receiver |
| `blindpay blockchain_wallets list` | List blockchain wallets for a customer |
| `blindpay blockchain_wallets get <id>` | Get a blockchain wallet by ID |
| `blindpay blockchain_wallets create` | Create a new blockchain wallet |
| `blindpay blockchain_wallets delete <id>` | Delete a blockchain wallet |
Expand All @@ -113,18 +116,18 @@ Requires `--receiver-id` on every command.

### Virtual Accounts

Requires `--receiver-id` on every command.
Requires `--customer-id` on every command.

| Command | Description |
|---|---|
| `blindpay virtual_accounts list` | List virtual accounts for a receiver |
| `blindpay virtual_accounts list` | List virtual accounts for a customer |
| `blindpay virtual_accounts create` | Create a virtual account |

### Offramp Wallets

| Command | Description |
|---|---|
| `blindpay offramp_wallets list` | List offramp wallets (`--receiver-id` + `--bank-account-id`) |
| `blindpay offramp_wallets list` | List offramp wallets (`--customer-id` + `--bank-account-id`) |

### Webhook Endpoints

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@blindpay/cli",
"type": "module",
"version": "0.4.0",
"version": "0.5.0",
"description": "Blindpay CLI - manage receivers, bank accounts, payouts, payins, and more from the terminal",
"license": "MIT",
"author": "Blindpay <[email protected]> (https://blindpay.com/)",
Expand Down
Loading