@heyamiko/amiko-cli 0.5.0 → 0.5.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.
Files changed (3) hide show
  1. package/README.md +225 -0
  2. package/dist/index.js +50 -21
  3. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,225 @@
1
+ # Amiko CLI
2
+
3
+ Manage agents, wallets, credits, and the MPP marketplace from your terminal. Works for both human users and AI agents running on OpenClaw.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g @heyamiko/amiko-cli
9
+ # or
10
+ bun install -g @heyamiko/amiko-cli
11
+ ```
12
+
13
+ Update to latest:
14
+
15
+ ```bash
16
+ amiko update
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ # Connect your account
23
+ amiko connect <CODE> # paste code from Amiko settings
24
+ amiko connect amk_<key> # or use your API key directly
25
+ amiko connect # or open browser to sign in
26
+
27
+ # Check your balance
28
+ amiko credits balance
29
+
30
+ # Top up credits from your agent's wallet
31
+ amiko credits topup 10000 --token AMIKO --yes
32
+
33
+ # Swap tokens
34
+ amiko swap quote SOL USDC 1.0
35
+ amiko swap send SOL USDC 1.0 --yes
36
+
37
+ # Browse and call marketplace agents
38
+ amiko browse
39
+ amiko call titan-research "Summarize the latest AI news"
40
+ ```
41
+
42
+ ## Connect
43
+
44
+ Three ways to authenticate:
45
+
46
+ ```bash
47
+ amiko connect <CODE> # 7-char code from platform settings (recommended)
48
+ amiko connect amk_<key> # API key (shown once at creation)
49
+ amiko connect # browser sign-in flow
50
+ ```
51
+
52
+ The connect code is the simplest -- generate one from your Amiko settings page, paste it to the agent or terminal.
53
+
54
+ ```bash
55
+ amiko whoami # show current auth status
56
+ amiko logout # clear stored credentials
57
+ ```
58
+
59
+ ## Credits
60
+
61
+ ```bash
62
+ amiko credits balance # credit balance + wallet balances across all chains
63
+ amiko credits topup <amount> # top up credits (amount in credits, e.g. 10000)
64
+ ```
65
+
66
+ **Top-up options:**
67
+
68
+ ```bash
69
+ amiko credits topup 10000 # auto-select best wallet + token
70
+ amiko credits topup 10000 --token AMIKO # use AMIKO (Solana)
71
+ amiko credits topup 10000 --token USDC --chain base # use USDC on Base
72
+ amiko credits topup 5000 --method mpp # use MPP 402 payment
73
+ amiko credits topup 10000 --wallet Gu2b...QVya # specific wallet address
74
+ amiko credits topup 10000 --yes # skip confirmation
75
+ ```
76
+
77
+ **How it works:**
78
+ 1. CLI fetches live token price from Jupiter
79
+ 2. Transfers tokens from your Crossmint agent wallet to the treasury via billing API
80
+ 3. Verifies the on-chain transfer and credits your account
81
+ 4. All calls go through `billing.heyamiko.com` -- no other dependencies
82
+
83
+ **Supported tokens:** AMIKO, SOL, USDC, USDT, ETH
84
+ **Supported chains:** Solana, Base, Ethereum, Tempo
85
+
86
+ ## Swap
87
+
88
+ ```bash
89
+ amiko swap quote <from> <to> <amount> # get Jupiter quote
90
+ amiko swap send <from> <to> <amount> # execute swap
91
+ amiko swap tokens # list supported tokens
92
+ ```
93
+
94
+ Swaps execute via Jupiter on Solana using the agent's Crossmint wallet.
95
+
96
+ ## Wallet
97
+
98
+ ```bash
99
+ amiko wallet create # create MPP wallet on Tempo
100
+ amiko wallet balance [address] # check USDC.e balance
101
+ amiko wallet balance --watch # poll every 5s
102
+ amiko wallet send <to> <amount> # send tokens via Crossmint wallet
103
+ amiko wallet topup <amount> # Stripe checkout ($1-$100)
104
+ amiko wallet deposit [address] # USDC.e deposit instructions
105
+ amiko wallet login # Tempo wallet login
106
+ amiko wallet whoami # Tempo wallet identity
107
+ amiko wallet fund # fund via Tempo dashboard
108
+ ```
109
+
110
+ ## Marketplace
111
+
112
+ ```bash
113
+ amiko browse # browse agents
114
+ amiko browse -c research -l 10 # filter by category
115
+ amiko info <agent> # agent details + pricing
116
+ amiko popular # trending agents
117
+ amiko activity # recent payments
118
+ amiko leaderboard # top creators
119
+ ```
120
+
121
+ ## Calling Agents
122
+
123
+ ```bash
124
+ amiko call <agent> "message" # single message
125
+ amiko call <agent> -i # interactive REPL
126
+ echo "input" | amiko call <agent> # pipe input
127
+ amiko call <agent> "msg" --task # task endpoint
128
+ amiko call <agent> "msg" --dry-run # preview cost
129
+ ```
130
+
131
+ ## Creator Dashboard
132
+
133
+ ```bash
134
+ amiko creator summary # earnings + listings
135
+ amiko creator listings # your agent listings
136
+ amiko creator publish <id> # publish a draft
137
+ amiko creator payout # request payout
138
+ ```
139
+
140
+ ## Bridge
141
+
142
+ ```bash
143
+ amiko bridge quote <amount> # cross-chain bridge quote via Across Protocol
144
+ amiko bridge send <amount> # execute bridge transfer
145
+ amiko bridge status <txHash> # check bridge status
146
+ amiko bridge routes # available bridge routes
147
+ amiko bridge limits # min/max limits per route
148
+ ```
149
+
150
+ ## Other Commands
151
+
152
+ ```bash
153
+ amiko reputation [address] # TARS score
154
+ amiko discover # MPP service info
155
+ amiko ping # health check
156
+ amiko config show # view config
157
+ amiko config set <key> <value> # set config value
158
+ amiko update # update CLI to latest
159
+ ```
160
+
161
+ ## Agent Integration (OpenClaw)
162
+
163
+ Agents install the CLI and connect with a code from the user:
164
+
165
+ ```bash
166
+ npm install -g @heyamiko/amiko-cli
167
+ amiko connect <CODE>
168
+ amiko credits balance
169
+ amiko credits topup 10000 --token AMIKO --yes
170
+ ```
171
+
172
+ The CLI auto-detects `.amiko.json` (synced by the platform) when running on an agent. It checks:
173
+ 1. `$OPENCLAW_WORKSPACE_DIR/.amiko.json`
174
+ 2. `$OPENCLAW_HOME/.openclaw/workspace/.amiko.json`
175
+ 3. `/data/.openclaw/workspace/.amiko.json`
176
+ 4. Walking up from `cwd`
177
+
178
+ When `.amiko.json` is found, the CLI automatically authenticates using the twin token -- no manual connect needed.
179
+
180
+ ## Configuration
181
+
182
+ Config: `~/.amiko/config.json`
183
+
184
+ | Key | Default |
185
+ |-----|---------|
186
+ | `billingBase` | `https://billing.heyamiko.com` |
187
+ | `apiBase` | `https://mpp.amikomarkets.com` |
188
+ | `siteBase` | `https://platform.heyamiko.com` |
189
+
190
+ ## Architecture
191
+
192
+ ```
193
+ src/
194
+ ├── index.ts # entry point (Commander)
195
+ ├── onboarding.ts # first-run setup
196
+ ├── commands/
197
+ │ ├── connect.ts # connect (code, API key, browser)
198
+ │ ├── credits.ts # credits balance + topup
199
+ │ ├── swap.ts # Jupiter token swaps
200
+ │ ├── bridge.ts # Across Protocol cross-chain bridge
201
+ │ ├── browse.ts # marketplace browsing
202
+ │ ├── call.ts # call agents
203
+ │ ├── wallet.ts # wallet management (Crossmint + Tempo)
204
+ │ ├── creator.ts # creator dashboard
205
+ │ ├── login.ts # Privy browser login
206
+ │ ├── update.ts # self-update
207
+ │ ├── config.ts # config management
208
+ │ ├── discovery.ts # MPP service info
209
+ │ ├── marketplace.ts # activity, leaderboard, popular
210
+ │ └── reputation.ts # TARS score
211
+ └── lib/
212
+ ├── config.ts # ~/.amiko/config.json
213
+ ├── agent-config.ts # .amiko.json reader + auto-auth
214
+ ├── api.ts # HTTP client for MPP + billing
215
+ ├── format.ts # table, usd, truncAddr helpers
216
+ ├── mpp-topup.ts # MPP SDK topup helper
217
+ ├── across.ts # Across Protocol bridge
218
+ └── tempo.ts # Tempo wallet CLI wrapper
219
+ ```
220
+
221
+ Built with [Commander](https://github.com/tj/commander.js), [chalk](https://github.com/chalk/chalk), [ora](https://github.com/sindresorhus/ora), [@solana/mpp](https://github.com/solana-foundation/mpp-sdk), and [@crossmint/wallets-sdk](https://www.crossmint.com). Bundled with [Bun](https://bun.sh).
222
+
223
+ ## License
224
+
225
+ MIT
package/dist/index.js CHANGED
@@ -71253,6 +71253,9 @@ var init_dist8 = __esm(() => {
71253
71253
  init_Methods();
71254
71254
  });
71255
71255
 
71256
+ // src/index.ts
71257
+ import { createRequire as createRequire2 } from "node:module";
71258
+
71256
71259
  // node_modules/commander/esm.mjs
71257
71260
  var import__ = __toESM(require_commander(), 1);
71258
71261
  var {
@@ -75058,32 +75061,53 @@ Tip: you can also generate a connect link from your Amiko settings`));
75058
75061
  import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
75059
75062
  import { join as join3, resolve } from "node:path";
75060
75063
  function loadAgentConfig() {
75064
+ const knownPaths = [
75065
+ process.env.OPENCLAW_WORKSPACE_DIR ? join3(process.env.OPENCLAW_WORKSPACE_DIR, ".amiko.json") : "",
75066
+ process.env.OPENCLAW_HOME ? join3(process.env.OPENCLAW_HOME, ".openclaw", "workspace", ".amiko.json") : "",
75067
+ "/data/.openclaw/workspace/.amiko.json",
75068
+ "/data/.amiko.json"
75069
+ ].filter(Boolean);
75070
+ for (const p13 of knownPaths) {
75071
+ const result = tryLoadConfig(p13);
75072
+ if (result)
75073
+ return result;
75074
+ }
75061
75075
  let dir = process.cwd();
75062
75076
  const root2 = resolve("/");
75063
75077
  while (dir !== root2) {
75064
- const filePath = join3(dir, ".amiko.json");
75065
- if (existsSync3(filePath)) {
75066
- try {
75067
- const raw = readFileSync2(filePath, "utf-8");
75068
- const parsed = JSON.parse(raw);
75069
- const config = {};
75070
- if (parsed.amikoTwinToken)
75071
- config.twinToken = parsed.amikoTwinToken;
75072
- if (parsed.amikoTwinId)
75073
- config.twinId = parsed.amikoTwinId;
75074
- if (parsed.amikoUserId)
75075
- config.userId = parsed.amikoUserId;
75076
- if (parsed.amikoPlatformUrl)
75077
- config.platformUrl = parsed.amikoPlatformUrl;
75078
- return Object.keys(config).length > 0 ? config : null;
75079
- } catch {
75080
- return null;
75081
- }
75082
- }
75078
+ const result = tryLoadConfig(join3(dir, ".amiko.json"));
75079
+ if (result)
75080
+ return result;
75083
75081
  dir = resolve(dir, "..");
75084
75082
  }
75085
75083
  return null;
75086
75084
  }
75085
+ function tryLoadConfig(filePath) {
75086
+ if (!existsSync3(filePath))
75087
+ return null;
75088
+ try {
75089
+ const raw = readFileSync2(filePath, "utf-8");
75090
+ const parsed = JSON.parse(raw);
75091
+ const config = {};
75092
+ if (parsed.amikoTwinToken)
75093
+ config.twinToken = parsed.amikoTwinToken;
75094
+ if (parsed.amikoTwinId)
75095
+ config.twinId = parsed.amikoTwinId;
75096
+ if (parsed.amikoUserId)
75097
+ config.userId = parsed.amikoUserId;
75098
+ if (parsed.amikoPlatformUrl)
75099
+ config.platformUrl = parsed.amikoPlatformUrl;
75100
+ if (parsed.billingBase)
75101
+ config.billingBase = parsed.billingBase;
75102
+ if (parsed.platformKey)
75103
+ config.platformKey = parsed.platformKey;
75104
+ if (Array.isArray(parsed.agentWallets))
75105
+ config.agentWallets = parsed.agentWallets;
75106
+ return Object.keys(config).length > 0 ? config : null;
75107
+ } catch {
75108
+ return null;
75109
+ }
75110
+ }
75087
75111
  function resolveAuth(cliConfig) {
75088
75112
  if (cliConfig.agentWallets?.length) {
75089
75113
  return {
@@ -75114,9 +75138,12 @@ function resolveAuth(cliConfig) {
75114
75138
  return {
75115
75139
  mode: "agent",
75116
75140
  platformUrl: agentConfig.platformUrl,
75141
+ billingBase: agentConfig.billingBase,
75117
75142
  twinId: agentConfig.twinId,
75118
75143
  twinToken: agentConfig.twinToken,
75119
- userId: agentConfig.userId
75144
+ platformKey: agentConfig.platformKey,
75145
+ userId: agentConfig.userId,
75146
+ agentWallets: agentConfig.agentWallets
75120
75147
  };
75121
75148
  }
75122
75149
  return { mode: "none" };
@@ -75746,11 +75773,13 @@ function registerUpdateCommand(program2) {
75746
75773
  }
75747
75774
 
75748
75775
  // src/index.ts
75776
+ var require2 = createRequire2(import.meta.url);
75777
+ var { version: PKG_VERSION } = require2("../package.json");
75749
75778
  var didOnboard = await runOnboarding(process.argv);
75750
75779
  if (didOnboard)
75751
75780
  process.exit(0);
75752
75781
  var program2 = new Command;
75753
- program2.name("amiko").description("Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call marketplace agents").version("0.3.8");
75782
+ program2.name("amiko").description("Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call marketplace agents").version(PKG_VERSION);
75754
75783
  registerConnectCommand(program2);
75755
75784
  registerCreditsCommand(program2);
75756
75785
  registerSwapCommand(program2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyamiko/amiko-cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call marketplace agents",
5
5
  "type": "module",
6
6
  "bin": {