@allowance/cli 0.1.0 → 0.1.2
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 +33 -87
- package/lib/runtime.js +4 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# allowance
|
|
2
2
|
|
|
3
|
-
`allowance` is a
|
|
3
|
+
`allowance` is a small CLI for OpenClaw setup only.
|
|
4
4
|
|
|
5
|
-
It
|
|
6
|
-
Runtime actions are token-scoped, so requests/allowances are visible to the token session that created them.
|
|
5
|
+
It signs the user in with OTP, mints an Allowance connection token, and installs hosted Allowance MCP into OpenClaw. It is intentionally not a second runtime surface for requests, cards, or allowance operations, and OpenClaw config is the only long-term secret store.
|
|
7
6
|
|
|
8
7
|
## Install
|
|
9
8
|
|
|
@@ -35,6 +34,17 @@ uv sync --dev
|
|
|
35
34
|
uv run allowance --help
|
|
36
35
|
```
|
|
37
36
|
|
|
37
|
+
## CLI Help UX
|
|
38
|
+
|
|
39
|
+
The CLI supports:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
allowance --help
|
|
43
|
+
allowance -h
|
|
44
|
+
allowance -help
|
|
45
|
+
allowance --version
|
|
46
|
+
```
|
|
47
|
+
|
|
38
48
|
## Publish to npm
|
|
39
49
|
|
|
40
50
|
This repo supports npm publishing through GitHub Actions.
|
|
@@ -46,6 +56,7 @@ This repo supports npm publishing through GitHub Actions.
|
|
|
46
56
|
3. Add it as a GitHub repository secret:
|
|
47
57
|
- name: `NPM_TOKEN`
|
|
48
58
|
- value: npm token string
|
|
59
|
+
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.
|
|
49
60
|
|
|
50
61
|
### Release flow
|
|
51
62
|
|
|
@@ -94,96 +105,32 @@ git push origin v0.1.1
|
|
|
94
105
|
- build wheels/sdist
|
|
95
106
|
- publish to PyPI
|
|
96
107
|
|
|
97
|
-
##
|
|
98
|
-
|
|
99
|
-
Use this flow for fastest agent and customer experience:
|
|
100
|
-
|
|
101
|
-
1. Authenticate once for the session.
|
|
102
|
-
2. Create a request with clear merchant + reason + cap amount.
|
|
103
|
-
3. Ask customer to approve immediately in app.
|
|
104
|
-
4. Poll until approved.
|
|
105
|
-
5. Issue card only when checkout is ready.
|
|
106
|
-
6. Complete checkout.
|
|
107
|
-
7. Report purchase outcome immediately (`success` or `failed`).
|
|
108
|
-
8. If failed and still active, re-issue and retry within policy limits.
|
|
109
|
-
|
|
110
|
-
Example:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
allowance auth login --email you@example.com
|
|
114
|
-
allowance requests create --cents 5000 --merchant "Ticketmaster" --reason "2 tickets under $50"
|
|
115
|
-
allowance requests poll <request_id>
|
|
116
|
-
allowance cards issue <allowance_id> --expected-cents 4500
|
|
117
|
-
allowance cards report <allowance_id> <attempt_id> --status success --charged-cents 4380
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Auth
|
|
121
|
-
|
|
122
|
-
Login bootstraps via OTP, then mints and stores a connection token:
|
|
108
|
+
## OpenClaw
|
|
123
109
|
|
|
124
|
-
|
|
125
|
-
allowance auth login --email you@example.com
|
|
126
|
-
```
|
|
110
|
+
All commands output JSON by default. Use `--pretty` for formatted JSON.
|
|
127
111
|
|
|
128
|
-
|
|
112
|
+
| Command | What It Does | Use When |
|
|
113
|
+
|---|---|---|
|
|
114
|
+
| `allowance openclaw install` | Prompts for email or phone, completes OTP bootstrap, mints an OpenClaw-attributed token, and installs hosted Allowance MCP config | First-time setup or reinstall |
|
|
115
|
+
| `allowance openclaw doctor` | Verifies OpenClaw availability, installed config, bearer wiring, and hosted MCP reachability | Troubleshooting |
|
|
116
|
+
| `allowance openclaw uninstall` | Removes the Allowance MCP entry from OpenClaw and best-effort revokes the configured token | Cleanup |
|
|
129
117
|
|
|
130
|
-
`
|
|
118
|
+
`allowance openclaw install` writes an OpenClaw MCP entry named `allowance` using:
|
|
131
119
|
|
|
132
|
-
|
|
120
|
+
- hosted MCP URL from the Allowance API config when available
|
|
121
|
+
- `transport: "streamable-http"`
|
|
122
|
+
- `Authorization: Bearer ak_...`
|
|
133
123
|
|
|
134
|
-
|
|
135
|
-
allowance auth status
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
Logout command (revokes remote token and clears keychain):
|
|
124
|
+
Install accepts either:
|
|
139
125
|
|
|
140
126
|
```bash
|
|
141
|
-
allowance
|
|
127
|
+
allowance openclaw install --email you@example.com
|
|
128
|
+
allowance openclaw install --phone +14155551234
|
|
142
129
|
```
|
|
143
130
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
All commands output JSON by default. Use `--pretty` for formatted JSON.
|
|
131
|
+
If no identifier flag is provided, the CLI prompts for an email address or E.164 phone number.
|
|
147
132
|
|
|
148
|
-
|
|
149
|
-
|---|---|---|
|
|
150
|
-
| `allowance auth login --email <email>` | Signs in via OTP bootstrap and stores token in keychain | Starting a session |
|
|
151
|
-
| `allowance auth status` | Shows whether CLI is logged in and which account/token prefix | Preflight checks |
|
|
152
|
-
| `allowance auth logout` | Revokes token and clears local credentials | End of session/security cleanup |
|
|
153
|
-
| `allowance requests create --cents ... --merchant ... --reason ... [--currency] [--expires-at]` | Creates a pending allowance request | You need user approval before spending |
|
|
154
|
-
| `allowance requests list` | Lists requests created by this token session | Find recent request IDs |
|
|
155
|
-
| `allowance requests get <request_id>` | Fetches full request detail | Inspect request state/details |
|
|
156
|
-
| `allowance requests poll <request_id>` | Returns current request status and `allowance_id` when approved | Waiting on user approval |
|
|
157
|
-
| `allowance requests cancel <request_id>` | Cancels a still-pending request | User changed mind / no longer needed |
|
|
158
|
-
| `allowance cards issue <allowance_id> --expected-cents <int>` | Issues checkout card for one purchase attempt | Approval exists and checkout is ready |
|
|
159
|
-
| `allowance cards attempts <allowance_id>` | Lists purchase attempts for that allowance | Audit/retry decisions |
|
|
160
|
-
| `allowance cards report <allowance_id> <attempt_id> --status success\\|failed ...` | Finalizes attempt result and updates allowance state | Immediately after checkout attempt |
|
|
161
|
-
| `allowance allowances list` | Lists allowances visible to current token | Find/manage active allowances |
|
|
162
|
-
| `allowance allowances get <allowance_id>` | Gets one allowance snapshot | Verify state/retry budget |
|
|
163
|
-
| `allowance allowances pause <allowance_id>` | Pauses spending on allowance | Temporary stop needed |
|
|
164
|
-
| `allowance allowances revoke <allowance_id>` | Permanently revokes allowance | Final stop / cleanup |
|
|
165
|
-
|
|
166
|
-
`allowance allowances unpause` is intentionally not exposed in this CLI.
|
|
167
|
-
|
|
168
|
-
## Agent + Customer Experience Guidelines
|
|
169
|
-
|
|
170
|
-
1. Request only when purchase intent and budget are clear.
|
|
171
|
-
2. Use merchant/reason text the customer can quickly recognize in approval UI.
|
|
172
|
-
3. After `requests create`, immediately provide request summary and ask customer to approve.
|
|
173
|
-
4. Poll with short intervals, but keep customer informed instead of silently looping.
|
|
174
|
-
5. Issue card only at the final checkout step to reduce stale credential windows.
|
|
175
|
-
6. Always call `cards report` right after checkout outcome.
|
|
176
|
-
7. Never echo PAN/CVV unless customer explicitly asks.
|
|
177
|
-
|
|
178
|
-
## Error Handling
|
|
179
|
-
|
|
180
|
-
| Status | Meaning | Typical Action |
|
|
181
|
-
|---|---|---|
|
|
182
|
-
| `401` | Auth invalid/expired | Re-login |
|
|
183
|
-
| `403` | Not allowed for this actor | Use correct actor/flow |
|
|
184
|
-
| `404` | Not found or out-of-scope token access | Verify IDs and token session |
|
|
185
|
-
| `409` | State conflict (not active, retry exhausted, etc.) | Inspect current resource state and adjust |
|
|
186
|
-
| `503` | Upstream issuer/provider unavailable | Retry later or fail gracefully |
|
|
133
|
+
The CLI uses `openclaw mcp set/show/unset` instead of editing OpenClaw config files directly.
|
|
187
134
|
|
|
188
135
|
## Global Flags
|
|
189
136
|
|
|
@@ -193,15 +140,14 @@ All commands output JSON by default. Use `--pretty` for formatted JSON.
|
|
|
193
140
|
Example:
|
|
194
141
|
|
|
195
142
|
```bash
|
|
196
|
-
allowance --api-base-url http://127.0.0.1:8000 --pretty
|
|
143
|
+
allowance --api-base-url http://127.0.0.1:8000 --pretty openclaw doctor
|
|
197
144
|
```
|
|
198
145
|
|
|
199
146
|
## Configuration
|
|
200
147
|
|
|
201
|
-
- `ALLOWANCE_API_BASE_URL` (default: `https://
|
|
148
|
+
- `ALLOWANCE_API_BASE_URL` (default: `https://api.useallowance.com`)
|
|
149
|
+
- `ALLOWANCE_MCP_URL` (default: `https://mcp.useallowance.com`)
|
|
202
150
|
- `ALLOWANCE_HTTP_TIMEOUT_SECONDS` (default: `20`)
|
|
203
|
-
- `ALLOWANCE_CLI_KEYCHAIN_SERVICE` (optional keychain namespace override)
|
|
204
|
-
- `ALLOWANCE_CLI_KEYCHAIN_ACCOUNT` (optional keychain account override)
|
|
205
151
|
|
|
206
152
|
## Tests
|
|
207
153
|
|
package/lib/runtime.js
CHANGED
|
@@ -145,7 +145,10 @@ function installPinnedPackage(targetSpec) {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
function ensureRuntime(options) {
|
|
148
|
-
const
|
|
148
|
+
const envTargetSpec = process.env.ALLOWANCE_PYPI_TARGET;
|
|
149
|
+
const targetSpec = envTargetSpec && envTargetSpec.trim()
|
|
150
|
+
? envTargetSpec.trim()
|
|
151
|
+
: `${options.pypiPackage}==${options.version}`;
|
|
149
152
|
const currentState = readState();
|
|
150
153
|
|
|
151
154
|
if (fs.existsSync(allowanceExecutablePath()) && currentState && currentState.targetSpec === targetSpec) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allowance/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Allowance
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Allowance OpenClaw MCP installation and diagnostics 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
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"openclaw",
|
|
18
|
+
"mcp"
|
|
19
19
|
],
|
|
20
20
|
"bin": {
|
|
21
21
|
"allowance": "bin/allowance.js"
|