@heyamiko/amiko-cli 0.2.1 → 0.2.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 +141 -126
- package/dist/index.js +123 -48
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
# Amiko CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Manage agents, wallets, credits, and marketplace on the MPP payment rail. Works for both human users and AI agents running on OpenClaw.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g @heyamiko/amiko-cli
|
|
9
|
+
# or
|
|
10
|
+
bun install -g @heyamiko/amiko-cli
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Update to latest:
|
|
12
14
|
|
|
13
15
|
```bash
|
|
14
|
-
|
|
15
|
-
npm install
|
|
16
|
-
npm run build
|
|
17
|
-
npm link # makes `amiko` available globally
|
|
16
|
+
amiko update
|
|
18
17
|
```
|
|
19
18
|
|
|
20
19
|
## Quick Start
|
|
21
20
|
|
|
22
21
|
```bash
|
|
23
|
-
#
|
|
24
|
-
amiko
|
|
22
|
+
# Connect your account (opens browser)
|
|
23
|
+
amiko connect
|
|
25
24
|
|
|
26
25
|
# Browse the marketplace
|
|
27
26
|
amiko browse
|
|
@@ -29,194 +28,210 @@ amiko browse
|
|
|
29
28
|
# Call an agent (auto-pays via Tempo or API key)
|
|
30
29
|
amiko call titan-research "Summarize the latest news on AI agents"
|
|
31
30
|
|
|
32
|
-
# Check
|
|
33
|
-
amiko
|
|
34
|
-
```
|
|
31
|
+
# Check credits and wallet balances
|
|
32
|
+
amiko credits balance
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
# Top up credits from agent wallet
|
|
35
|
+
amiko credits topup 10000 --token AMIKO
|
|
36
|
+
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
## Authentication
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
2. **API key** — pre-funded account balance, topped up via Stripe
|
|
40
|
+
Two ways to connect:
|
|
42
41
|
|
|
43
42
|
```bash
|
|
44
|
-
#
|
|
45
|
-
|
|
46
|
-
tempo wallet login
|
|
47
|
-
|
|
48
|
-
# Option 2: API key
|
|
49
|
-
amiko config set apiKey amk_<your-key>
|
|
50
|
-
amiko wallet topup 10
|
|
51
|
-
```
|
|
43
|
+
# Browser flow (for humans)
|
|
44
|
+
amiko connect # opens browser, authorize with one click
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
# URL flow (for agents on OpenClaw)
|
|
47
|
+
amiko connect <url> # paste connect link from Amiko settings
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
| `amiko browse` | Browse marketplace agents |
|
|
60
|
-
| `amiko info <agent>` | Show agent details, pricing, and stats |
|
|
61
|
-
| `amiko popular` | Trending agents by period |
|
|
62
|
-
| `amiko activity` | Recent payment activity |
|
|
63
|
-
| `amiko leaderboard` | Top creators by revenue/usage |
|
|
64
|
-
|
|
65
|
-
**Browse options:**
|
|
49
|
+
# Legacy Privy login (marketplace features)
|
|
50
|
+
amiko login # sign in via browser
|
|
51
|
+
amiko login --no-browser # print login URL instead
|
|
52
|
+
```
|
|
66
53
|
|
|
67
54
|
```bash
|
|
68
|
-
amiko
|
|
69
|
-
amiko
|
|
70
|
-
amiko browse -q "image generation" # search by keyword
|
|
55
|
+
amiko whoami # show current auth status
|
|
56
|
+
amiko logout # clear stored credentials
|
|
71
57
|
```
|
|
72
58
|
|
|
73
|
-
|
|
59
|
+
## Credits
|
|
60
|
+
|
|
61
|
+
Manage platform credits — check balance and top up from agent wallets.
|
|
74
62
|
|
|
75
63
|
```bash
|
|
76
|
-
amiko
|
|
77
|
-
amiko
|
|
64
|
+
amiko credits balance # show credit balance + wallet balances
|
|
65
|
+
amiko credits topup <amount> # top up credits (amount in credits)
|
|
78
66
|
```
|
|
79
67
|
|
|
80
|
-
|
|
68
|
+
**Top-up options:**
|
|
81
69
|
|
|
82
70
|
```bash
|
|
83
|
-
#
|
|
84
|
-
amiko
|
|
85
|
-
|
|
86
|
-
#
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
# Interactive REPL
|
|
90
|
-
amiko call titan-research -i
|
|
71
|
+
amiko credits topup 10000 # auto-select best token/wallet
|
|
72
|
+
amiko credits topup 10000 --token AMIKO # use AMIKO token (Solana)
|
|
73
|
+
amiko credits topup 10000 --token USDC --chain base # use USDC on Base
|
|
74
|
+
amiko credits topup 5000 --method mpp # use MPP 402 payment flow
|
|
75
|
+
amiko credits topup 10000 --yes # skip confirmation
|
|
76
|
+
```
|
|
91
77
|
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
**Supported tokens:** AMIKO, SOL, USDC, USDT, ETH
|
|
79
|
+
**Supported chains:** Solana, Base, Ethereum, Tempo
|
|
94
80
|
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
**Payment methods:**
|
|
82
|
+
- `crossmint` — transfer from agent Crossmint wallet to treasury (default)
|
|
83
|
+
- `mpp` — auto-pay via `@solana/mpp` SDK (402 challenge flow)
|
|
84
|
+
- `auto` — try crossmint first, fall back to mpp
|
|
97
85
|
|
|
98
|
-
|
|
99
|
-
amiko call titan-research "hello" --raw
|
|
86
|
+
## Wallet Management
|
|
100
87
|
|
|
101
|
-
|
|
102
|
-
amiko
|
|
88
|
+
```bash
|
|
89
|
+
amiko wallet create # create MPP wallet on Tempo
|
|
90
|
+
amiko wallet balance [address] # check USDC.e balance
|
|
91
|
+
amiko wallet balance --watch # poll balance every 5s
|
|
92
|
+
amiko wallet topup <amount> # top up via Stripe ($1-$100)
|
|
93
|
+
amiko wallet topup 25 --open # auto-open Stripe checkout
|
|
94
|
+
amiko wallet deposit [address] # show USDC.e deposit instructions
|
|
95
|
+
amiko wallet login # log in to Tempo wallet
|
|
96
|
+
amiko wallet whoami # show Tempo wallet identity
|
|
97
|
+
amiko wallet fund # fund via Tempo dashboard
|
|
103
98
|
```
|
|
104
99
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
| Command | Description |
|
|
108
|
-
|---------|-------------|
|
|
109
|
-
| `amiko wallet create` | Create a new MPP wallet on Tempo |
|
|
110
|
-
| `amiko wallet balance [address]` | Check USDC.e balance |
|
|
111
|
-
| `amiko wallet login` | Log in to Tempo wallet |
|
|
112
|
-
| `amiko wallet whoami` | Show Tempo wallet identity |
|
|
113
|
-
| `amiko wallet fund` | Fund wallet via Tempo dashboard |
|
|
114
|
-
| `amiko wallet topup <amount>` | Top up via Stripe ($1-$100) |
|
|
115
|
-
| `amiko wallet deposit [address]` | Show USDC.e deposit instructions |
|
|
100
|
+
## Marketplace
|
|
116
101
|
|
|
117
102
|
```bash
|
|
118
|
-
#
|
|
119
|
-
amiko
|
|
120
|
-
amiko
|
|
121
|
-
|
|
122
|
-
#
|
|
123
|
-
amiko
|
|
124
|
-
|
|
125
|
-
#
|
|
126
|
-
amiko
|
|
103
|
+
amiko browse # browse marketplace agents
|
|
104
|
+
amiko browse -c research # filter by category
|
|
105
|
+
amiko browse -s newest -l 10 # sort by newest, limit 10
|
|
106
|
+
amiko browse -q "image gen" # search by keyword
|
|
107
|
+
amiko info <agent> # show agent details + pricing
|
|
108
|
+
amiko popular # trending agents
|
|
109
|
+
amiko popular -p day # trending today
|
|
110
|
+
amiko activity # recent payment activity
|
|
111
|
+
amiko leaderboard # top creators by revenue
|
|
127
112
|
```
|
|
128
113
|
|
|
129
|
-
|
|
114
|
+
## Calling Agents
|
|
130
115
|
|
|
131
116
|
```bash
|
|
132
|
-
amiko
|
|
133
|
-
amiko
|
|
134
|
-
amiko
|
|
135
|
-
amiko
|
|
117
|
+
amiko call titan-research "What is quantum computing?" # single message
|
|
118
|
+
echo "Explain transformers" | amiko call titan-research # pipe input
|
|
119
|
+
amiko call titan-research -i # interactive REPL
|
|
120
|
+
amiko call titan-research "Generate a report" --task # task endpoint
|
|
121
|
+
amiko call titan-research "hello" --dry-run # preview cost
|
|
122
|
+
amiko call titan-research "hello" --raw # raw JSON output
|
|
123
|
+
amiko call titan-research "hello" --no-tempo # force API key
|
|
136
124
|
```
|
|
137
125
|
|
|
138
|
-
|
|
126
|
+
## Creator Dashboard
|
|
139
127
|
|
|
140
128
|
Requires authentication (`amiko login`).
|
|
141
129
|
|
|
142
130
|
```bash
|
|
143
|
-
amiko creator summary
|
|
144
|
-
amiko creator listings
|
|
145
|
-
amiko creator publish <id>
|
|
146
|
-
amiko creator payout
|
|
131
|
+
amiko creator summary # earnings, listings, payout status
|
|
132
|
+
amiko creator listings # list your agent listings
|
|
133
|
+
amiko creator publish <id> # publish a draft listing
|
|
134
|
+
amiko creator payout # request payout
|
|
147
135
|
```
|
|
148
136
|
|
|
149
|
-
|
|
137
|
+
## Reputation
|
|
150
138
|
|
|
151
139
|
```bash
|
|
152
|
-
amiko reputation
|
|
153
|
-
amiko
|
|
154
|
-
amiko rep 0xabc...def # Short alias
|
|
140
|
+
amiko reputation # your TARS score
|
|
141
|
+
amiko rep 0xabc...def # look up any address
|
|
155
142
|
```
|
|
156
143
|
|
|
157
|
-
|
|
144
|
+
## Service Discovery
|
|
158
145
|
|
|
159
|
-
|
|
146
|
+
```bash
|
|
147
|
+
amiko discover # MPP service info + endpoints
|
|
148
|
+
amiko ping # health check with latency
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Cross-Chain Bridge
|
|
160
152
|
|
|
161
153
|
```bash
|
|
162
|
-
amiko
|
|
163
|
-
amiko status
|
|
164
|
-
amiko
|
|
154
|
+
amiko bridge quote 5 # get bridge quote (USDC, $5)
|
|
155
|
+
amiko bridge status <depositId> # check transfer status
|
|
156
|
+
amiko bridge routes # list available routes
|
|
165
157
|
```
|
|
166
158
|
|
|
167
|
-
|
|
159
|
+
## Configuration
|
|
168
160
|
|
|
169
|
-
Config
|
|
161
|
+
Config stored at `~/.amiko/config.json`. Agent config read from `.amiko.json` when running on OpenClaw.
|
|
170
162
|
|
|
171
163
|
```bash
|
|
172
|
-
amiko config show
|
|
173
|
-
amiko config set <key> <
|
|
174
|
-
amiko config reset
|
|
175
|
-
amiko config path
|
|
164
|
+
amiko config show # display configuration
|
|
165
|
+
amiko config set <key> <value> # set a value
|
|
166
|
+
amiko config reset # reset to defaults
|
|
167
|
+
amiko config path # print config file path
|
|
176
168
|
```
|
|
177
169
|
|
|
178
|
-
**Default endpoints:**
|
|
179
|
-
|
|
180
170
|
| Key | Default |
|
|
181
171
|
|-----|---------|
|
|
182
|
-
| `apiBase` | `https://mpp.
|
|
172
|
+
| `apiBase` | `https://mpp.amikomarkets.com` |
|
|
183
173
|
| `billingBase` | `https://billing.heyamiko.com` |
|
|
184
174
|
| `siteBase` | `https://amikomarkets.com` |
|
|
175
|
+
| `platformUrl` | `https://app.heyamiko.com` |
|
|
176
|
+
|
|
177
|
+
## Agent Integration (OpenClaw)
|
|
178
|
+
|
|
179
|
+
Agents running on OpenClaw can install and use the CLI to manage credits:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# 1. User generates connect link from Amiko settings
|
|
183
|
+
# 2. Agent runs:
|
|
184
|
+
amiko connect https://app.heyamiko.com/api/cli/connect/redeem?code=abc123
|
|
185
|
+
|
|
186
|
+
# 3. Agent can now top up credits:
|
|
187
|
+
amiko credits topup 10000 --token AMIKO --yes
|
|
188
|
+
|
|
189
|
+
# Or check balances:
|
|
190
|
+
amiko credits balance
|
|
191
|
+
```
|
|
185
192
|
|
|
186
|
-
|
|
193
|
+
The CLI auto-detects `.amiko.json` (synced by the platform) for twin token auth when running on an agent.
|
|
187
194
|
|
|
188
195
|
## Development
|
|
189
196
|
|
|
190
197
|
```bash
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
198
|
+
bun install # install dependencies
|
|
199
|
+
bun run dev # run without building
|
|
200
|
+
bun run build # compile to dist/
|
|
201
|
+
bun run typecheck # type-check
|
|
202
|
+
bun test # run tests
|
|
195
203
|
```
|
|
196
204
|
|
|
197
205
|
## Architecture
|
|
198
206
|
|
|
199
207
|
```
|
|
200
208
|
src/
|
|
201
|
-
├── index.ts
|
|
209
|
+
├── index.ts # entry point — registers all commands
|
|
210
|
+
├── onboarding.ts # first-run setup flow
|
|
202
211
|
├── commands/
|
|
203
|
-
│ ├── browse.ts
|
|
204
|
-
│ ├── call.ts
|
|
205
|
-
│ ├──
|
|
206
|
-
│ ├──
|
|
207
|
-
│ ├──
|
|
208
|
-
│ ├──
|
|
209
|
-
│ ├──
|
|
210
|
-
│ ├──
|
|
211
|
-
│
|
|
212
|
+
│ ├── browse.ts # browse, info
|
|
213
|
+
│ ├── call.ts # call (Tempo + API key + interactive)
|
|
214
|
+
│ ├── connect.ts # connect (browser + URL modes)
|
|
215
|
+
│ ├── credits.ts # credits balance + topup
|
|
216
|
+
│ ├── wallet.ts # wallet subcommands
|
|
217
|
+
│ ├── creator.ts # creator dashboard
|
|
218
|
+
│ ├── reputation.ts # TARS reputation lookup
|
|
219
|
+
│ ├── config.ts # config management
|
|
220
|
+
│ ├── discovery.ts # discover, ping
|
|
221
|
+
│ ├── marketplace.ts # activity, leaderboard, popular
|
|
222
|
+
│ ├── login.ts # login, logout, whoami
|
|
223
|
+
│ ├── bridge.ts # cross-chain bridge
|
|
224
|
+
│ └── update.ts # self-update
|
|
212
225
|
└── lib/
|
|
213
|
-
├── api.ts
|
|
214
|
-
├── config.ts
|
|
215
|
-
├──
|
|
216
|
-
|
|
226
|
+
├── api.ts # HTTP client (MPP + billing)
|
|
227
|
+
├── config.ts # ~/.amiko/config.json I/O
|
|
228
|
+
├── agent-config.ts # .amiko.json reader + auth resolver
|
|
229
|
+
├── mpp-topup.ts # MPP SDK payment helper
|
|
230
|
+
├── format.ts # terminal formatting
|
|
231
|
+
└── tempo.ts # Tempo CLI detection
|
|
217
232
|
```
|
|
218
233
|
|
|
219
|
-
Built with [Commander](https://github.com/tj/commander.js), [chalk](https://github.com/chalk/chalk),
|
|
234
|
+
Built with [Commander](https://github.com/tj/commander.js), [chalk](https://github.com/chalk/chalk), [ora](https://github.com/sindresorhus/ora), and [@solana/mpp](https://github.com/solana-foundation/mpp-sdk). Bundled with [Bun](https://bun.sh).
|
|
220
235
|
|
|
221
236
|
## License
|
|
222
237
|
|
package/dist/index.js
CHANGED
|
@@ -23419,6 +23419,7 @@ var SKIP_COMMANDS = new Set([
|
|
|
23419
23419
|
"login",
|
|
23420
23420
|
"logout",
|
|
23421
23421
|
"connect",
|
|
23422
|
+
"credits",
|
|
23422
23423
|
"update"
|
|
23423
23424
|
]);
|
|
23424
23425
|
function prompt(question) {
|
|
@@ -26351,52 +26352,126 @@ function registerBridgeCommand(program2) {
|
|
|
26351
26352
|
}
|
|
26352
26353
|
|
|
26353
26354
|
// src/commands/connect.ts
|
|
26355
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
26356
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
26357
|
+
function openBrowser2(url) {
|
|
26358
|
+
try {
|
|
26359
|
+
const platform = process.platform;
|
|
26360
|
+
if (platform === "darwin") {
|
|
26361
|
+
execFileSync2("open", [url]);
|
|
26362
|
+
} else if (platform === "win32") {
|
|
26363
|
+
execFileSync2("cmd", ["/c", "start", "", url]);
|
|
26364
|
+
} else {
|
|
26365
|
+
try {
|
|
26366
|
+
execFileSync2("xdg-open", [url], { stdio: "ignore" });
|
|
26367
|
+
} catch {}
|
|
26368
|
+
}
|
|
26369
|
+
} catch {}
|
|
26370
|
+
}
|
|
26371
|
+
function printSuccess(data) {
|
|
26372
|
+
console.log(heading("Connected"));
|
|
26373
|
+
console.log("");
|
|
26374
|
+
if (data.userId)
|
|
26375
|
+
console.log(label("User", String(data.userId)));
|
|
26376
|
+
if (data.platformUrl)
|
|
26377
|
+
console.log(label("Platform", String(data.platformUrl)));
|
|
26378
|
+
const wallets = data.wallets;
|
|
26379
|
+
console.log(label("Wallets", `${wallets?.length || 0} found`));
|
|
26380
|
+
if (wallets?.length) {
|
|
26381
|
+
for (const w of wallets) {
|
|
26382
|
+
console.log(dim(` ${w.chain}: ${w.address.slice(0, 8)}...${w.address.slice(-6)}`));
|
|
26383
|
+
}
|
|
26384
|
+
}
|
|
26385
|
+
console.log("");
|
|
26386
|
+
console.log(success("Account connected. You can now run: amiko credits topup <amount>"));
|
|
26387
|
+
}
|
|
26388
|
+
function saveCredentials(data) {
|
|
26389
|
+
saveConfig({
|
|
26390
|
+
userId: data.userId,
|
|
26391
|
+
platformUrl: data.platformUrl,
|
|
26392
|
+
billingBase: data.billingBase,
|
|
26393
|
+
agentWallets: data.wallets
|
|
26394
|
+
});
|
|
26395
|
+
}
|
|
26354
26396
|
function registerConnectCommand(program2) {
|
|
26355
|
-
program2.command("connect").description("Connect to an Amiko account
|
|
26356
|
-
|
|
26357
|
-
|
|
26358
|
-
|
|
26359
|
-
|
|
26360
|
-
|
|
26361
|
-
|
|
26362
|
-
|
|
26363
|
-
|
|
26364
|
-
|
|
26365
|
-
|
|
26366
|
-
|
|
26367
|
-
|
|
26368
|
-
|
|
26369
|
-
|
|
26370
|
-
|
|
26371
|
-
|
|
26372
|
-
|
|
26373
|
-
|
|
26374
|
-
|
|
26375
|
-
|
|
26376
|
-
|
|
26377
|
-
|
|
26378
|
-
|
|
26379
|
-
|
|
26380
|
-
|
|
26381
|
-
|
|
26382
|
-
|
|
26383
|
-
|
|
26384
|
-
|
|
26385
|
-
|
|
26386
|
-
console.log("");
|
|
26387
|
-
console.log(label("User", data.userId));
|
|
26388
|
-
console.log(label("Platform", data.platformUrl));
|
|
26389
|
-
console.log(label("Wallets", `${data.wallets?.length || 0} found`));
|
|
26390
|
-
if (data.wallets?.length > 0) {
|
|
26391
|
-
for (const w of data.wallets) {
|
|
26392
|
-
console.log(dim(` ${w.chain}: ${w.address.slice(0, 8)}...${w.address.slice(-6)}`));
|
|
26397
|
+
program2.command("connect").description("Connect to an Amiko account (opens browser, or pass a connect URL)").argument("[url]", "Connect URL from Amiko settings (optional — opens browser if omitted)").option("--no-browser", "Print the connect URL instead of opening a browser").action(async (urlStr, opts) => {
|
|
26398
|
+
if (urlStr) {
|
|
26399
|
+
const spinner2 = ora("Connecting...").start();
|
|
26400
|
+
try {
|
|
26401
|
+
let code;
|
|
26402
|
+
let redeemOrigin;
|
|
26403
|
+
try {
|
|
26404
|
+
const url = new URL(urlStr);
|
|
26405
|
+
code = url.searchParams.get("code") || urlStr;
|
|
26406
|
+
redeemOrigin = url.origin;
|
|
26407
|
+
} catch {
|
|
26408
|
+
code = urlStr.trim();
|
|
26409
|
+
const config2 = loadConfig();
|
|
26410
|
+
redeemOrigin = config2.platformUrl || process.env.AMIKO_PLATFORM_URL || "https://app.heyamiko.com";
|
|
26411
|
+
}
|
|
26412
|
+
if (!code) {
|
|
26413
|
+
spinner2.stop();
|
|
26414
|
+
console.error(error("Invalid code or URL."));
|
|
26415
|
+
process.exit(1);
|
|
26416
|
+
}
|
|
26417
|
+
const redeemUrl = `${redeemOrigin}/api/cli/connect/redeem`;
|
|
26418
|
+
const res = await fetch(redeemUrl, {
|
|
26419
|
+
method: "POST",
|
|
26420
|
+
headers: { "Content-Type": "application/json" },
|
|
26421
|
+
body: JSON.stringify({ code })
|
|
26422
|
+
});
|
|
26423
|
+
if (!res.ok) {
|
|
26424
|
+
spinner2.stop();
|
|
26425
|
+
const err = await res.json().catch(() => ({ error: "Failed to connect" }));
|
|
26426
|
+
console.error(error(err.error || `Connection failed: ${res.status}`));
|
|
26427
|
+
process.exit(1);
|
|
26393
26428
|
}
|
|
26429
|
+
const data = await res.json();
|
|
26430
|
+
spinner2.stop();
|
|
26431
|
+
saveCredentials(data);
|
|
26432
|
+
printSuccess(data);
|
|
26433
|
+
} catch (err) {
|
|
26434
|
+
spinner2.stop();
|
|
26435
|
+
console.error(error(err instanceof Error ? err.message : "Failed to connect"));
|
|
26436
|
+
process.exit(1);
|
|
26394
26437
|
}
|
|
26395
|
-
|
|
26396
|
-
|
|
26438
|
+
return;
|
|
26439
|
+
}
|
|
26440
|
+
const config = loadConfig();
|
|
26441
|
+
const state = randomBytes2(16).toString("hex");
|
|
26442
|
+
const platformUrl = config.platformUrl || process.env.AMIKO_PLATFORM_URL || "https://app.heyamiko.com";
|
|
26443
|
+
console.log(heading("Amiko Connect"));
|
|
26444
|
+
console.log(dim(`Connect your CLI to your Amiko account.
|
|
26445
|
+
`));
|
|
26446
|
+
const spinner = ora("Starting connection server...").start();
|
|
26447
|
+
const { port, token: callbackPromise } = await startCallbackServer(state);
|
|
26448
|
+
spinner.stop();
|
|
26449
|
+
const connectUrl = `${platformUrl}/cli-connect?port=${port}&state=${state}`;
|
|
26450
|
+
if (opts.browser !== false) {
|
|
26451
|
+
console.log(dim(`Opening browser...
|
|
26452
|
+
`));
|
|
26453
|
+
openBrowser2(connectUrl);
|
|
26454
|
+
}
|
|
26455
|
+
console.log(dim(`If your browser does not open, visit:
|
|
26456
|
+
`));
|
|
26457
|
+
console.log(source_default.cyan(connectUrl));
|
|
26458
|
+
console.log("");
|
|
26459
|
+
const waitSpinner = ora("Waiting for authorization...").start();
|
|
26460
|
+
try {
|
|
26461
|
+
const result = await callbackPromise;
|
|
26462
|
+
const data = JSON.parse(JSON.stringify(result));
|
|
26463
|
+
delete data.state;
|
|
26464
|
+
delete data.token;
|
|
26465
|
+
result.acknowledge({ ok: true });
|
|
26466
|
+
waitSpinner.stop();
|
|
26467
|
+
saveCredentials(data);
|
|
26468
|
+
printSuccess(data);
|
|
26397
26469
|
} catch (err) {
|
|
26398
|
-
|
|
26399
|
-
console.error(error(err instanceof Error ? err.message : "
|
|
26470
|
+
waitSpinner.stop();
|
|
26471
|
+
console.error(error(err instanceof Error ? err.message : "Connection timed out or failed"));
|
|
26472
|
+
console.log(dim(`
|
|
26473
|
+
Tip: you can also generate a connect link from your Amiko settings`));
|
|
26474
|
+
console.log(dim(" and run: amiko connect <url>"));
|
|
26400
26475
|
process.exit(1);
|
|
26401
26476
|
}
|
|
26402
26477
|
});
|
|
@@ -26711,10 +26786,10 @@ function registerCreditsCommand(program2) {
|
|
|
26711
26786
|
}
|
|
26712
26787
|
|
|
26713
26788
|
// src/commands/update.ts
|
|
26714
|
-
import { execFileSync as
|
|
26789
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
26715
26790
|
function detectPackageManager() {
|
|
26716
26791
|
try {
|
|
26717
|
-
|
|
26792
|
+
execFileSync3("bun", ["--version"], { stdio: "ignore" });
|
|
26718
26793
|
return "bun";
|
|
26719
26794
|
} catch {
|
|
26720
26795
|
return "npm";
|
|
@@ -26732,14 +26807,14 @@ function registerUpdateCommand(program2) {
|
|
|
26732
26807
|
const spinner = ora("Installing latest version...").start();
|
|
26733
26808
|
try {
|
|
26734
26809
|
if (pm === "bun") {
|
|
26735
|
-
|
|
26810
|
+
execFileSync3("bun", ["install", "-g", `${pkg}@latest`], { stdio: "pipe" });
|
|
26736
26811
|
} else {
|
|
26737
|
-
|
|
26812
|
+
execFileSync3("npm", ["install", "-g", `${pkg}@latest`], { stdio: "pipe" });
|
|
26738
26813
|
}
|
|
26739
26814
|
spinner.stop();
|
|
26740
26815
|
let newVersion = "latest";
|
|
26741
26816
|
try {
|
|
26742
|
-
newVersion =
|
|
26817
|
+
newVersion = execFileSync3("amiko", ["--version"], { encoding: "utf-8" }).trim();
|
|
26743
26818
|
} catch {}
|
|
26744
26819
|
if (newVersion !== currentVersion) {
|
|
26745
26820
|
console.log(success(`Updated to v${newVersion}`));
|
|
@@ -26762,7 +26837,7 @@ var didOnboard = await runOnboarding(process.argv);
|
|
|
26762
26837
|
if (didOnboard)
|
|
26763
26838
|
process.exit(0);
|
|
26764
26839
|
var program2 = new Command;
|
|
26765
|
-
program2.name("amiko").description("
|
|
26840
|
+
program2.name("amiko").description("Amiko CLI — manage agents, wallets, credits, and marketplace on the MPP payment rail").version("0.2.3");
|
|
26766
26841
|
registerBrowseCommand(program2);
|
|
26767
26842
|
registerCallCommand(program2);
|
|
26768
26843
|
registerWalletCommand(program2);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyamiko/amiko-cli",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.3",
|
|
4
|
+
"description": "Amiko CLI — manage agents, wallets, credits, and marketplace on the MPP payment rail",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"amiko": "./dist/index.js"
|