@flintpay/cli 0.1.1 → 0.3.0

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.
Files changed (2) hide show
  1. package/README.md +39 -8
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -10,28 +10,59 @@ Every command maps to a documented `/v1` route, so anything you can do over HTTP
10
10
  npm install -g @flintpay/cli
11
11
  ```
12
12
 
13
+ On macOS and Linux, run `flint upgrade` to update the global package and its platform binary to the latest stable release. On Windows, the command prints the exact npm update to run after closing the CLI.
14
+
13
15
  This package resolves a prebuilt binary for your platform. Node `>=18` is required to run the installer. On macOS and Linux you can install with Homebrew instead:
14
16
 
15
17
  ```bash
16
18
  brew install flint-pay/tap/flint
17
19
  ```
18
20
 
19
- ## Authenticate
21
+ ## Sign in (recommended)
20
22
 
21
- Create a sandbox key in the [Flint dashboard](https://app.withflintpay.com/developers/api-keys), then import it:
23
+ For local development, sign in through the Flint website:
22
24
 
23
25
  ```bash
24
- flint auth import
26
+ flint auth login
27
+ flint doctor
25
28
  ```
26
29
 
27
- The key is validated against the API and stored in your OS keychain, not in a config file. If you do not have an account yet, `flint signup` completes machine-actionable onboarding steps and stores the initial sandbox key as soon as the API makes it available.
30
+ Confirm the code shown in your terminal and approve CLI access on the website. Flint validates the OAuth session and stores its access and refresh tokens in your OS keychain. Use `--no-open` to open the printed link yourself, `--profile NAME` for an existing profile, or `--live` to explicitly request production access.
28
31
 
29
- Confirm everything works:
32
+ The existing single-context browser login has been verified against Flint staging. To use staging, set `FLINT_BASE_URL=https://api.staging.withflintpay.com` for login and subsequent commands. Production rollout is separate; use `flint auth import` on servers without browser login support.
30
33
 
31
- ```bash
32
- flint doctor
34
+ Access tokens refresh automatically as needed. `flint auth logout --confirm` revokes the OAuth session before removing its local credentials. If the server does not confirm revocation, logout reports failure and retains the credentials for retry. Imported API-key logout still removes only the local key.
35
+
36
+ `flint login` is a shortcut for `flint auth login`. Related shortcuts: `flint logout` for `flint auth logout`, and `flint whoami` for `flint auth status`.
37
+
38
+ ### Sessions and contexts
39
+
40
+ With a server that supports multi-context sessions, approve access to selected merchants, sandboxes, and live contexts once in the browser, then select where commands run:
41
+
42
+ ```sh
43
+ flint login
44
+ flint context list
45
+ flint context switch # interactive selector
46
+ flint context switch ctx_development # select an authorized sandbox
47
+ flint context switch ctx_production --live # explicitly select a live default
48
+ flint auth status --context ctx_development # one command, without changing the default
49
+ flint reauth # change browser-approved access
33
50
  ```
34
51
 
52
+ `flint login` reuses a valid saved OAuth session and starts browser approval again when the server confirms that the session expired or was revoked. Temporary connection failures or loss of access to one context do not automatically replace the session. Use `flint login --new-session` to replace it after browser approval; the CLI then attempts to revoke the previous session. `flint logout --confirm` revokes the entire session across its contexts.
53
+
54
+ Manage and revoke sessions on the [CLI sessions page](https://app.withflintpay.com/developers/cli). Browser authorization sends your computer's hostname and operating system to help identify the session.
55
+
56
+ Context selection uses `--context ID`, then a project's `.flint/config.json` `context` field, then the profile default. For example, `{"context":"ctx_development"}` pins a project. Switching changes the profile default, not a project pin. Each running command retains its starting context. Access tokens remain restricted to one context and refresh automatically. LIVE contexts are labeled in the selector and command diagnostics; selected multi-context sessions do not need `--live` on every command, while sensitive/destructive operations still require confirmation.
57
+
58
+ Environment credentials (`FLINT_API_KEY`, `FLINT_ACCESS_TOKEN`, or `FLINT_CHECKOUT_SESSION_SECRET`) override configured browser-session contexts. An explicit `--context` cannot be combined with these overrides. Merchant and sandbox guards still apply.
59
+
60
+ **Backend rollout required:** multi-context listing, switching, and reauthorization require the new session endpoints and token metadata. Existing single-context OAuth sessions remain usable and keep their existing live-mode safeguards. Run `flint reauth` after the server is upgraded to authorize multiple contexts. The new multi-context flow has not yet been verified against a deployed backend.
61
+
62
+ ### API keys and automation
63
+
64
+ For manual setup, create a key in the [Flint dashboard](https://app.withflintpay.com/developers/api-keys) and run `flint auth import`. For CI, supply `FLINT_API_KEY` through your secret store and set `FLINT_NO_INPUT=1`. `flint signup` remains available for creating an account from the terminal.
65
+
35
66
  ## Take a payment
36
67
 
37
68
  ```bash
@@ -54,7 +85,7 @@ This streams your sandbox's events to a local server with a real signature, so y
54
85
 
55
86
  ## Scripting
56
87
 
57
- For bounded commands, `--output json` prints one JSON envelope on stdout and disables every prompt. Streaming commands emit newline-delimited JSON instead. `flint listen --output json` writes one listener, webhook event, delivery result, or checkpoint object per line; use `--max-events` or `--for` to bound it. Diagnostics and progress go to stderr, so stdout stays a clean data stream.
88
+ For bounded commands, `--output json` prints one JSON envelope on stdout and disables terminal input prompts. `flint auth login` still requires approval on the website; use `FLINT_NO_INPUT=1` to prohibit browser login in automation. Streaming commands emit newline-delimited JSON instead. `flint listen --output json` writes one listener, webhook event, delivery result, or checkpoint object per line; use `--max-events` or `--for` to bound it. Diagnostics and progress go to stderr, so stdout stays a clean data stream.
58
89
 
59
90
  Exit codes are stable: `0` success, `1` API error, `2` usage error, `3` auth or config, `4` confirmation required, `5` network, `6` `--wait-for` timed out, `70` internal error.
60
91
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flintpay/cli",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Flint Pay command-line interface",
5
5
  "mcpName": "com.withflintpay/cli",
6
6
  "license": "Apache-2.0",
@@ -16,11 +16,11 @@
16
16
  "node": ">=18"
17
17
  },
18
18
  "optionalDependencies": {
19
- "@flintpay/cli-darwin-arm64": "0.1.1",
20
- "@flintpay/cli-darwin-amd64": "0.1.1",
21
- "@flintpay/cli-linux-arm64": "0.1.1",
22
- "@flintpay/cli-linux-amd64": "0.1.1",
23
- "@flintpay/cli-windows-amd64": "0.1.1"
19
+ "@flintpay/cli-darwin-arm64": "0.3.0",
20
+ "@flintpay/cli-darwin-amd64": "0.3.0",
21
+ "@flintpay/cli-linux-arm64": "0.3.0",
22
+ "@flintpay/cli-linux-amd64": "0.3.0",
23
+ "@flintpay/cli-windows-amd64": "0.3.0"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",