@allowance/cli 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +25 -98
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # allowance
2
2
 
3
- `allowance` is a human-first CLI for Allowance purchase workflows.
3
+ `allowance` is the CLI for Allowance — the agent purchase wallet. It has two roles:
4
4
 
5
- It uses an `ak_...` connection token at runtime and stores credentials in the OS keychain.
6
- Runtime actions are token-scoped, so requests/allowances are visible to the token session that created them.
5
+ 1. **Setup** (`allowance setup`) — signs the user in via OTP, mints a connection token, and writes agent skill files so Claude Desktop, Codex, or OpenClaw knows how to use Allowance.
6
+ 2. **Runtime checkout** the full purchase flow agents use at runtime: request approval, issue a virtual card, fetch identity/address, and report the outcome.
7
7
 
8
8
  ## Install
9
9
 
@@ -37,14 +37,13 @@ uv run allowance --help
37
37
 
38
38
  ## CLI Help UX
39
39
 
40
- The CLI now supports all of these help forms:
40
+ The CLI supports:
41
41
 
42
42
  ```bash
43
43
  allowance --help
44
44
  allowance -h
45
45
  allowance -help
46
46
  allowance --version
47
- allowance quickstart
48
47
  ```
49
48
 
50
49
  ## Publish to npm
@@ -58,6 +57,7 @@ This repo supports npm publishing through GitHub Actions.
58
57
  3. Add it as a GitHub repository secret:
59
58
  - name: `NPM_TOKEN`
60
59
  - value: npm token string
60
+ 4. Current npm automation token expires on June 23, 2026. Rotate both the GitHub `NPM_TOKEN` secret and your local `~/.npmrc` entry before that date.
61
61
 
62
62
  ### Release flow
63
63
 
@@ -106,115 +106,42 @@ git push origin v0.1.1
106
106
  - build wheels/sdist
107
107
  - publish to PyPI
108
108
 
109
- ## Fast Purchase Path (Recommended)
109
+ ## Command surface
110
110
 
111
- Use this flow for fastest agent and customer experience:
112
-
113
- 1. Authenticate once for the session.
114
- 2. Create a request with clear merchant + reason + cap amount.
115
- 3. Ask customer to approve immediately in app.
116
- 4. Poll until approved.
117
- 5. Issue card only when checkout is ready.
118
- 6. Complete checkout.
119
- 7. Report purchase outcome immediately (`success` or `failed`).
120
- 8. If failed and still active, re-issue and retry within policy limits.
121
-
122
- Example:
111
+ ### Setup
123
112
 
124
113
  ```bash
125
- allowance auth login --email you@example.com
126
- allowance requests create --cents 5000 --merchant "Ticketmaster" --reason "2 tickets under $50"
127
- allowance requests poll <request_id>
128
- allowance cards issue <allowance_id> --expected-cents 4500
129
- allowance cards report <allowance_id> <attempt_id> --status success --charged-cents 4380
114
+ allowance setup # auto-detect agent
115
+ allowance setup --for claude-code
116
+ allowance setup --for codex
117
+ allowance setup --for openclaw
118
+ allowance setup --for generic
130
119
  ```
131
120
 
132
- ## Auth
133
-
134
- Login bootstraps via OTP, then mints and stores a connection token:
135
-
136
- ```bash
137
- allowance auth login --email you@example.com
138
- ```
139
-
140
- If already logged in, login exits with:
141
-
142
- `Already logged in as <email>. Run allowance auth logout to switch accounts.`
143
-
144
- Status command:
121
+ Authenticates via phone OTP, mints a connection token, and writes skill files for every detected agent (Claude Desktop, Codex, OpenClaw).
145
122
 
146
- ```bash
147
- allowance auth status
148
- ```
149
-
150
- Logout command (revokes remote token and clears keychain):
123
+ ### Runtime checkout (used by agents)
151
124
 
152
- ```bash
153
- allowance auth logout
154
- ```
125
+ | Command | What It Does |
126
+ |---|---|
127
+ | `allowance request` | Request spend approval from the user; blocks until approved/denied |
128
+ | `allowance card issue` | Issue a one-time virtual card for an approved request |
129
+ | `allowance identity` | Fetch name, email, phone for checkout forms |
130
+ | `allowance address shipping` | Fetch shipping address for an approved request |
131
+ | `allowance address billing` | Fetch billing address for an approved request |
132
+ | `allowance purchase success` | Report a completed purchase |
133
+ | `allowance purchase failure` | Report a failed purchase attempt |
155
134
 
156
- ## Command Reference
157
-
158
- All commands output JSON by default. Use `--pretty` for formatted JSON.
159
-
160
- | Command | What It Does | Use When |
161
- |---|---|---|
162
- | `allowance quickstart` | Prints copy-paste end-to-end purchase flow | You want the fastest correct flow immediately |
163
- | `allowance auth login --email <email>` | Signs in via OTP bootstrap and stores token in keychain | Starting a session |
164
- | `allowance auth status` | Shows whether CLI is logged in and which account/token prefix | Preflight checks |
165
- | `allowance auth logout` | Revokes token and clears local credentials | End of session/security cleanup |
166
- | `allowance requests create --cents ... --merchant ... --reason ... [--currency] [--expires-at]` | Creates a pending allowance request | You need user approval before spending |
167
- | `allowance requests list` | Lists requests created by this token session | Find recent request IDs |
168
- | `allowance requests get <request_id>` | Fetches full request detail | Inspect request state/details |
169
- | `allowance requests poll <request_id>` | Returns current request status and `allowance_id` when approved | Waiting on user approval |
170
- | `allowance requests cancel <request_id>` | Cancels a still-pending request | User changed mind / no longer needed |
171
- | `allowance cards issue <allowance_id> --expected-cents <int>` | Issues checkout card for one purchase attempt | Approval exists and checkout is ready |
172
- | `allowance cards attempts <allowance_id>` | Lists purchase attempts for that allowance | Audit/retry decisions |
173
- | `allowance cards report <allowance_id> <attempt_id> --status success\\|failed ...` | Finalizes attempt result and updates allowance state | Immediately after checkout attempt |
174
- | `allowance allowances list` | Lists allowances visible to current token | Find/manage active allowances |
175
- | `allowance allowances get <allowance_id>` | Gets one allowance snapshot | Verify state/retry budget |
176
- | `allowance allowances pause <allowance_id>` | Pauses spending on allowance | Temporary stop needed |
177
- | `allowance allowances revoke <allowance_id>` | Permanently revokes allowance | Final stop / cleanup |
178
-
179
- `allowance allowances unpause` is intentionally not exposed in this CLI.
180
-
181
- ## Agent + Customer Experience Guidelines
182
-
183
- 1. Request only when purchase intent and budget are clear.
184
- 2. Use merchant/reason text the customer can quickly recognize in approval UI.
185
- 3. After `requests create`, immediately provide request summary and ask customer to approve.
186
- 4. Poll with short intervals, but keep customer informed instead of silently looping.
187
- 5. Issue card only at the final checkout step to reduce stale credential windows.
188
- 6. Always call `cards report` right after checkout outcome.
189
- 7. Never echo PAN/CVV unless customer explicitly asks.
190
-
191
- ## Error Handling
192
-
193
- | Status | Meaning | Typical Action |
194
- |---|---|---|
195
- | `401` | Auth invalid/expired | Re-login |
196
- | `403` | Not allowed for this actor | Use correct actor/flow |
197
- | `404` | Not found or out-of-scope token access | Verify IDs and token session |
198
- | `409` | State conflict (not active, retry exhausted, etc.) | Inspect current resource state and adjust |
199
- | `503` | Upstream issuer/provider unavailable | Retry later or fail gracefully |
135
+ Runtime checkout commands output human-readable text by default. Pass `--json` to any checkout command for machine-parseable output (useful for scripting or agent use).
200
136
 
201
137
  ## Global Flags
202
138
 
203
139
  - `--api-base-url` to target another environment for one invocation
204
- - `--pretty` for formatted JSON output
205
-
206
- Example:
207
-
208
- ```bash
209
- allowance --api-base-url http://127.0.0.1:8000 --pretty allowances list
210
- ```
211
140
 
212
141
  ## Configuration
213
142
 
214
- - `ALLOWANCE_API_BASE_URL` (default: `https://allowance-api.fly.dev`)
143
+ - `ALLOWANCE_API_BASE_URL` (default: `https://api.useallowance.com`)
215
144
  - `ALLOWANCE_HTTP_TIMEOUT_SECONDS` (default: `20`)
216
- - `ALLOWANCE_CLI_KEYCHAIN_SERVICE` (optional keychain namespace override)
217
- - `ALLOWANCE_CLI_KEYCHAIN_ACCOUNT` (optional keychain account override)
218
145
 
219
146
  ## Tests
220
147
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@allowance/cli",
3
- "version": "0.1.1",
4
- "description": "Allowance CLI wrapper package for npm global installs",
3
+ "version": "0.1.3",
4
+ "description": "Allowance agent purchase wallet CLI",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -14,8 +14,8 @@
14
14
  "keywords": [
15
15
  "allowance",
16
16
  "cli",
17
- "payments",
18
- "agents"
17
+ "agent",
18
+ "purchase"
19
19
  ],
20
20
  "bin": {
21
21
  "allowance": "bin/allowance.js"