@mandate.md/cli 0.1.1 → 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 +141 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# @mandate.md/cli
|
|
2
|
+
|
|
3
|
+
The non-custodial CLI for agent wallets. Validate transactions against spend limits, allowlists, and approval workflows — your private key never leaves your machine.
|
|
4
|
+
|
|
5
|
+
Built with [incur](https://github.com/wevm/incur). Agents discover commands via `--llms`, not by reading docs.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add -g @mandate.md/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or run without installing:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @mandate.md/cli --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Why a CLI?
|
|
20
|
+
|
|
21
|
+
An agent given SKILL.md + a runtime key will parse the docs, set up credentials — then call the wallet directly, skipping validation. Because docs are suggestions.
|
|
22
|
+
|
|
23
|
+
A CLI is an interface. There's no `mandate send`. The only path is:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
mandate validate → agent signs locally → mandate event
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The enforcement is structural.
|
|
30
|
+
|
|
31
|
+
## Flow
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
mandate login Register agent, get runtimeKey
|
|
35
|
+
↓
|
|
36
|
+
mandate validate Policy check (intentHash computed for you)
|
|
37
|
+
↓
|
|
38
|
+
agent signs Private key stays local
|
|
39
|
+
↓
|
|
40
|
+
mandate event Post txHash for envelope verification
|
|
41
|
+
↓
|
|
42
|
+
mandate status Poll until confirmed
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Commands
|
|
46
|
+
|
|
47
|
+
### Register
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
mandate login --name "MyAgent" --address 0x1234...
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Stores credentials in `~/.mandate/credentials.json` (chmod 600). Prints `claimUrl` for the human owner to link the agent to their dashboard.
|
|
54
|
+
|
|
55
|
+
### Validate a raw transaction
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
mandate validate \
|
|
59
|
+
--to 0x036CbD53842c5426634e7929541eC2318f3dCF7e \
|
|
60
|
+
--calldata 0xa9059cbb... \
|
|
61
|
+
--nonce 42 \
|
|
62
|
+
--gas-limit 90000 \
|
|
63
|
+
--max-fee-per-gas 1000000000 \
|
|
64
|
+
--max-priority-fee-per-gas 1000000000 \
|
|
65
|
+
--reason "Invoice #127 from Alice"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The CLI computes `intentHash` internally. You never touch keccak256.
|
|
69
|
+
|
|
70
|
+
### ERC20 transfer (high-level)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
mandate transfer \
|
|
74
|
+
--to 0xAlice \
|
|
75
|
+
--amount 10000000 \
|
|
76
|
+
--token 0x036CbD53842c5426634e7929541eC2318f3dCF7e \
|
|
77
|
+
--reason "Invoice #127" \
|
|
78
|
+
--nonce 42 \
|
|
79
|
+
--max-fee-per-gas 1000000000 \
|
|
80
|
+
--max-priority-fee-per-gas 1000000000
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Encodes calldata, estimates gas, validates, returns unsigned tx params ready to sign.
|
|
84
|
+
|
|
85
|
+
### Post broadcast
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
mandate event <intentId> --tx-hash 0xabc...
|
|
89
|
+
mandate status <intentId>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Wait for approval
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
mandate approve <intentId> --timeout 3600
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Polls until the owner approves or rejects.
|
|
99
|
+
|
|
100
|
+
### Other commands
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
mandate activate 0x1234... # Set wallet address post-registration
|
|
104
|
+
mandate whoami # Verify credentials
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Agent Discovery
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
mandate --llms # Machine-readable command manifest
|
|
111
|
+
mandate --llms-full # Full manifest with schemas
|
|
112
|
+
mandate validate --schema # JSON Schema for a specific command
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Agents call `mandate --llms` to discover available commands. Each response includes a `next` field pointing to the logical next step — agents can't get lost.
|
|
116
|
+
|
|
117
|
+
## What about swaps, bridges, deploys?
|
|
118
|
+
|
|
119
|
+
Mandate validates **transactions**, not strategies. Every on-chain action is an EVM transaction with `{to, calldata, value}`.
|
|
120
|
+
|
|
121
|
+
| Operation | Command |
|
|
122
|
+
|-----------|---------|
|
|
123
|
+
| ERC20 transfer | `mandate transfer` |
|
|
124
|
+
| Swap | Build calldata yourself, then `mandate validate` |
|
|
125
|
+
| Deploy | Build deploy tx, then `mandate validate` |
|
|
126
|
+
| DCA / TWAP | Each tick is a separate `mandate validate` → sign → `mandate event` |
|
|
127
|
+
|
|
128
|
+
Mandate doesn't need to understand WHAT the tx does. It validates against policies: amount, recipient, selector, gas, schedule, quotas.
|
|
129
|
+
|
|
130
|
+
## MCP Server
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
mandate --mcp # Start as MCP stdio server
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Links
|
|
137
|
+
|
|
138
|
+
- [SKILL.md](https://app.mandate.md/SKILL.md) — Full API reference for AI agents
|
|
139
|
+
- [Dashboard](https://app.mandate.md) — Configure policies
|
|
140
|
+
- [@mandate.md/sdk](https://www.npmjs.com/package/@mandate.md/sdk) — TypeScript SDK for programmatic use
|
|
141
|
+
- [GitHub](https://github.com/SwiftAdviser/mandate)
|