@airwallex/airi-cli 0.1.0-beta.2 → 0.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # airi-cli
2
2
 
3
- ![Version](https://img.shields.io/badge/version-0.1.0--beta.2-orange)
3
+ ![Version](https://img.shields.io/badge/version-0.1.0--beta.3-orange)
4
4
 
5
5
  Command-line tool for the Airi wallet. Authenticate with OAuth, inspect your
6
6
  session, and drive an **agentic checkout** — list payment methods, create a
7
- payment mandate, fetch the single-use checkout credential, and report the
8
- result — from your terminal or an AI agent.
7
+ payment mandate, fetch the single-use checkout credential, report the result,
8
+ and cancel a mandate — or browse mandates already in the wallet, from your
9
+ terminal or an AI agent.
9
10
 
10
11
  Results are printed to stdout as JSON, so they are easy to consume from scripts
11
12
  and agents.
@@ -59,7 +60,7 @@ If npm is not available, install the binary directly with the install script:
59
60
  curl -fsSL https://raw.githubusercontent.com/airwallex/airi-cli/master/install.sh | sh
60
61
  ```
61
62
 
62
- To uninstall (removes the binary and local state):
63
+ To uninstall (removes the binary):
63
64
 
64
65
  ```bash
65
66
  curl -fsSL https://raw.githubusercontent.com/airwallex/airi-cli/master/install.sh | sh -s -- uninstall
@@ -203,6 +204,22 @@ after `auth login`, is:
203
204
 
204
205
  4. **Report the result** — after submitting the checkout, always report the
205
206
  outcome with `airi-cli mandate result --mandate-id <id> --result <SUCCEEDED|CANCELLED|DECLINED>`.
207
+ 5. **Cancel a mandate** — when the user asks to cancel, run
208
+ `airi-cli mandate cancel --mandate-id <id>`. The id is a flag, not a
209
+ positional argument. A cancelled mandate's status becomes `DENIED`. An
210
+ agent should cancel only when the user requests it.
211
+
212
+ ## Browsing mandates
213
+
214
+ `airi-cli mandate list` returns the user's mandates, most recent first. Page
215
+ with `--page` (0-based) and `--size` when `hasMore` is true. Filter with
216
+ repeatable `--status` (`CREATED`, `AUTHENTICATED`, `READY`, `COMPLETED`,
217
+ `FAILED`, `DENIED`) and `--created-from` / `--created-to` (full ISO-8601
218
+ timestamps, for example `2026-10-01T00:00:00Z`).
219
+
220
+ ```bash
221
+ airi-cli mandate list --status READY --size 10 --pretty
222
+ ```
206
223
 
207
224
  ## Commands
208
225
 
@@ -213,7 +230,9 @@ after `auth login`, is:
213
230
  | `airi-cli auth whoami` | Print the current sign-in status. |
214
231
  | `airi-cli auth logout` | Sign out by removing the stored session (local only). |
215
232
  | `airi-cli payment-methods list` | List payment methods available for agentic checkout. |
233
+ | `airi-cli mandate list` | List payment mandates, most recent first. |
216
234
  | `airi-cli mandate create` | Create a payment mandate for a checkout. |
235
+ | `airi-cli mandate cancel` | Cancel a payment mandate (`status` becomes `DENIED`). |
217
236
  | `airi-cli mandate get-credential` | Poll for and fetch the single-use checkout credential. |
218
237
  | `airi-cli mandate result` | Report the transaction outcome for a mandate. |
219
238
  | `airi-cli skills install` | Deploy the bundled agent skills into local AI-agent skill directories. |
@@ -238,6 +257,22 @@ Flags for `airi-cli auth whoami`:
238
257
  | --- | --- | --- |
239
258
  | `--verbose` | `false` | Include device details (name, platform, device id). |
240
259
 
260
+ Flags for `airi-cli mandate list`:
261
+
262
+ | Flag | Default | Description |
263
+ | --- | --- | --- |
264
+ | `--status` | — | Filter by mandate status (repeatable): `CREATED`, `AUTHENTICATED`, `READY`, `COMPLETED`, `FAILED`, `DENIED`. |
265
+ | `--created-from` | — | Include mandates created at or after this ISO-8601 time. |
266
+ | `--created-to` | — | Include mandates created at or before this ISO-8601 time. |
267
+ | `--page` | `0` | Zero-based page number. |
268
+ | `--size` | `10` | Mandates per page (1–100). |
269
+
270
+ Flags for `airi-cli mandate cancel`:
271
+
272
+ | Flag | Description |
273
+ | --- | --- |
274
+ | `--mandate-id` | Mandate ID (required). |
275
+
241
276
  Flags for `airi-cli mandate create` (all required):
242
277
 
243
278
  | Flag | Description |
package/checksums.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "checksums": {
3
- "linux_amd64": "1654d67477a4673902000467638dd9d8dabeebaf05b6ccc2f3b32776cd18e8a5",
4
- "linux_arm64": "9962fd90bfd55d5aa722e0c40ce93038656101127aeed60c58a2ea169a36efcd",
5
- "macos_x86_64": "e81bb619536b8b5c86bf3f9d94c1436022c51a3bf03d14bbf640bc6154e38235",
6
- "macos_arm64": "5f9fbb14c3d27e7375fa4e9d17f99b27d21b3883f7c94ddc70c89e07d276f849"
3
+ "linux_amd64": "c928039f16658358e493b27ab09710ef8d768552d4b55ffdc2a32375d7b8ce2d",
4
+ "linux_arm64": "267acceccdbecf8de21aabbdc654dc2552aa7f22da8d060a09cd33143bd5096a",
5
+ "macos_x86_64": "2fb413d8c48b0639f548e5a250bce69b95bcc0cd1267ba1758a16472e3bfda91",
6
+ "macos_arm64": "6e617b33e087a12e57e0c601d223aa55e809acbc211abbfa2f9c2ecd4510f25d"
7
7
  }
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airwallex/airi-cli",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "Command-line tool for the Airi wallet — OAuth sign-in and agentic checkout from your terminal or an AI agent.",
5
5
  "bin": {
6
6
  "airi-cli": "bin/airi-cli.js"
@@ -32,7 +32,7 @@
32
32
  // a missing binary with the same remediation if the CLI is run.
33
33
 
34
34
  import { createWriteStream, existsSync } from 'node:fs'
35
- import { mkdir, mkdtemp, readFile, rm, chmod, rename } from 'node:fs/promises'
35
+ import { mkdir, mkdtemp, readFile, rm, chmod, rename, copyFile } from 'node:fs/promises'
36
36
  import { createHash } from 'node:crypto'
37
37
  import { tmpdir } from 'node:os'
38
38
  import path from 'node:path'
@@ -246,15 +246,12 @@ async function main() {
246
246
  throw new Error(`archive did not contain expected '${BIN_NAME}' binary`)
247
247
  }
248
248
  const finalPath = binPath()
249
- // Stage the new binary INSIDE the vendor dir (same filesystem as finalPath)
250
- // and rename it into place. Renaming within one filesystem is atomic and
251
- // avoids EXDEV (which a rename from os.tmpdir() across filesystems would
252
- // hit) — and because the staged copy is fully in place and executable
253
- // before the swap, a failure never leaves the old working binary deleted
254
- // with no replacement.
249
+ // copyFile (not rename) crosses devices without EXDEV; staging inside the
250
+ // vendor dir keeps the final swap a same-device atomic rename, so a failure
251
+ // never leaves the old working binary deleted with no replacement.
255
252
  const staged = path.join(dir, `.${BIN_NAME}.new`)
256
253
  await rm(staged, { force: true })
257
- await rename(extracted, staged)
254
+ await copyFile(extracted, staged)
258
255
  await chmod(staged, 0o755)
259
256
  await rename(staged, finalPath)
260
257
  log(`installed ${BIN_NAME} ${tag}`)