@oneie/cli 0.6.0 → 0.8.0

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 CHANGED
@@ -63,7 +63,20 @@ one login --key <key> # stored at ~/.config/oneie/key (0600)
63
63
  # or set ONEIE_API_KEY in the environment
64
64
  ```
65
65
 
66
- Workspace operations use a Bearer token `<slug>:<key>`. Override the API base per command with `--api` (default `https://one.ie`).
66
+ Workspace operations use a Bearer token `<slug>:<key>`. Override the API base per command with `--api` (default `https://api.one.ie`, the gateway).
67
+
68
+ ## Wallets
69
+
70
+ Every actor — human or agent — gets real, self-custodied multi-chain wallets. The CLI reads and writes the same `wallet:*` receivers `/w` uses:
71
+
72
+ ```bash
73
+ one wallet create --workspace <slug> --kind agent # provision a wallet row (idempotent)
74
+ one wallet get --workspace <slug> # credits, ceiling, live balances, delegated wallets
75
+ one wallet transactions --workspace <slug> --limit 50 # unified feed across every settlement rail
76
+ one wallet send <to> --chain SUI --amount 5 --payment-tx <hash> --workspace <slug>
77
+ ```
78
+
79
+ `send` never signs — sign and broadcast the transfer yourself first (`agent-wallet-client.ts` for an agent, `/w` for a human), then pass the resulting transaction hash. The private key never crosses this command.
67
80
 
68
81
  ## Chat — fan in · fan out
69
82
 
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/cli",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "ONE agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,8 +1,7 @@
1
1
  import { Command } from 'commander';
2
- import { mkdirSync, mkdtempSync, readFileSync, writeFileSync, existsSync } from 'node:fs';
2
+ import { mkdirSync, readFileSync, writeFileSync, existsSync } from 'node:fs';
3
3
  import { resolve, join } from 'node:path';
4
4
  import { spawnSync } from 'node:child_process';
5
- import { tmpdir } from 'node:os';
6
5
  const SAFE_REF = /^[A-Za-z0-9._/-]+$/;
7
6
  function downloadTarball(url, targetDir) {
8
7
  mkdirSync(targetDir, { recursive: true });
@@ -20,125 +19,51 @@ function downloadTarball(url, targetDir) {
20
19
  if (tar.status !== 0)
21
20
  throw new Error(`tar failed extracting to ${targetDir}`);
22
21
  }
23
- function downloadSubdir(url, subdir, targetDir) {
24
- downloadSubdirs(url, [{ subdir, targetDir }]);
25
- }
26
- // One tarball fetch, multiple subdirs copied out of it — e.g. a node's own
27
- // content plus the shared apps/web site composed into <dir>/site/. Avoids a
28
- // second GitHub API round-trip per extra subdir.
29
- function downloadSubdirs(url, copies) {
30
- const tmp = mkdtempSync(join(tmpdir(), 'one-create-'));
31
- try {
32
- downloadTarball(url, tmp);
33
- for (const { subdir, targetDir } of copies) {
34
- mkdirSync(targetDir, { recursive: true });
35
- const r = spawnSync('cp', ['-r', join(tmp, subdir, '.'), targetDir], { stdio: 'inherit' });
36
- if (r.status !== 0)
37
- throw new Error(`cp failed for ${subdir}`);
38
- }
39
- }
40
- finally {
41
- spawnSync('rm', ['-rf', tmp]);
42
- }
43
- }
44
22
  export function createCmd() {
45
- const cmd = new Command('create').description('Scaffold a new ONE node or site');
46
- // ── one create agency [name] ──────────────────────────────────────────────
23
+ const cmd = new Command('create').description('Scaffold a new ONE node');
24
+ // ── one create [name] ───────────────────────────────────────────────────
25
+ // github.com/one-ie/one is itself one node — ai/ data/ site/ workspace.toml
26
+ // at its root — so scaffolding is a plain whole-repo download, no subdir
27
+ // composition. .claude/ + .mcp.json come along for free: open the scaffold
28
+ // in Claude Code and it's connected from its first `git init`.
47
29
  cmd
48
- .command('agency [name]')
49
- .description('Scaffold a new agency node from github.com/one-ie/one (apps/agency)')
30
+ .command('node [name]', { isDefault: true })
31
+ .description('Scaffold a ONE business node from github.com/one-ie/one — free plan, no credit card')
50
32
  .option('--ref <ref>', 'Git ref to download', 'main')
51
- .option('--slug <slug>', 'Your agency slug (written into agency.toml)')
52
- .option('--name <name>', 'Your agency display name (written into agency.toml)')
33
+ .option('--slug <slug>', 'Workspace slug (written into workspace.toml)')
34
+ .option('--name <name>', 'Display name (written into workspace.toml)')
53
35
  .action((dirName, opts) => {
54
36
  if (!SAFE_REF.test(opts.ref)) {
55
37
  process.stderr.write(`Invalid ref: ${opts.ref}\n`);
56
38
  process.exit(1);
57
39
  }
58
- const label = dirName ?? opts.slug ?? 'my-agency';
40
+ const label = dirName ?? opts.slug ?? 'my-business';
59
41
  const dir = resolve(process.cwd(), label);
60
42
  if (existsSync(dir)) {
61
43
  process.stderr.write(`Directory already exists: ${dir}\n`);
62
44
  process.exit(1);
63
45
  }
64
- process.stdout.write(`Creating agency node at ${dir}...\n`);
65
- downloadSubdirs(`https://api.github.com/repos/one-ie/one/tarball/${opts.ref}`, [
66
- { subdir: 'apps/agency', targetDir: dir },
67
- { subdir: 'apps/_shared', targetDir: dir },
68
- { subdir: 'apps/web', targetDir: join(dir, 'site') },
69
- ]);
70
- // Patch agency.toml with the user's slug + name so they don't have to
71
- const tomlPath = join(dir, 'agency.toml');
46
+ process.stdout.write(`Creating business node at ${dir}...\n`);
47
+ downloadTarball(`https://api.github.com/repos/one-ie/one/tarball/${opts.ref}`, dir);
48
+ const tomlPath = join(dir, 'workspace.toml');
72
49
  if (existsSync(tomlPath) && (opts.slug ?? opts.name)) {
73
50
  let toml = readFileSync(tomlPath, 'utf8');
74
51
  if (opts.slug)
75
- toml = toml.replace(/^slug\s*=\s*"[^"]*"/m, `slug = "${opts.slug}"`);
52
+ toml = toml.replace(/^slug\s*=\s*"[^"]*"/m, `slug = "${opts.slug}"`);
76
53
  if (opts.name)
77
- toml = toml.replace(/^name\s*=\s*"[^"]*"/m, `name = "${opts.name}"`);
54
+ toml = toml.replace(/^name\s*=\s*"[^"]*"/m, `name = "${opts.name}"`);
78
55
  writeFileSync(tomlPath, toml);
79
56
  }
80
- process.stdout.write(`\nAgency node created.\n\n`);
57
+ process.stdout.write(`\nNode created — free plan, no credit card.\n\n`);
81
58
  process.stdout.write(`Next steps:\n`);
82
59
  process.stdout.write(` cd ${label}\n`);
60
+ process.stdout.write(` bun install\n`);
83
61
  process.stdout.write(` cp .env.example .env.local\n`);
84
- process.stdout.write(` # Edit .env.local — set ONE_API_KEY and AGENCY_OWNER_EMAIL\n`);
62
+ process.stdout.write(` # Edit .env.local — set WORKSPACE_OWNER_EMAIL\n`);
85
63
  if (!opts.slug)
86
- process.stdout.write(` # Edit agency.toml — set slug and name\n`);
64
+ process.stdout.write(` # Edit workspace.toml — set slug and name\n`);
87
65
  process.stdout.write(` one setup\n`);
88
66
  });
89
- // ── one create client <slug> ──────────────────────────────────────────────
90
- cmd
91
- .command('client <slug>')
92
- .description('Scaffold a client node in clients/<slug>/')
93
- .option('--name <name>', 'Display name for the client')
94
- .option('--plan <plan>', 'Plan tier', 'studio')
95
- .action((slug, opts) => {
96
- const base = resolve(process.cwd(), 'clients', slug);
97
- if (existsSync(base)) {
98
- process.stderr.write(`Client already exists: clients/${slug}\n`);
99
- process.exit(1);
100
- }
101
- const displayName = opts.name ?? slug;
102
- mkdirSync(join(base, 'ai'), { recursive: true });
103
- mkdirSync(join(base, 'data', 'lifecycles'), { recursive: true });
104
- mkdirSync(join(base, 'site'), { recursive: true });
105
- writeFileSync(join(base, 'ai', 'context.md'), `# ${displayName}\n\nAdd company context here — agents read this on every turn.\n`);
106
- writeFileSync(join(base, 'site', 'one.config.ts'), [
107
- `import { defineOne } from '@oneie/frontend'`,
108
- ``,
109
- `export default defineOne({`,
110
- ` backend: { baseUrl: 'https://one.ie' },`,
111
- ` brand: {`,
112
- ` tokens: {`,
113
- ` primary: 'hsl(216 55% 25%)',`,
114
- ` secondary: 'hsl(219 14% 28%)',`,
115
- ` tertiary: 'hsl(105 22% 25%)',`,
116
- ` background: 'hsl(0 0% 93%)',`,
117
- ` foreground: 'hsl(0 0% 100%)',`,
118
- ` font: 'hsl(0 0% 13%)',`,
119
- ` },`,
120
- ` },`,
121
- ` plugins: [`,
122
- ` // auth(),`,
123
- ` // track({ ws: '${slug}' }),`,
124
- ` // chat({ agent: 'your-agent' }),`,
125
- ` ],`,
126
- `})`,
127
- ].join('\n') + '\n');
128
- writeFileSync(join(base, 'client.toml'), [
129
- `slug = "${slug}"`,
130
- `name = "${displayName}"`,
131
- `plan = "${opts.plan}"`,
132
- ``,
133
- `# markup_pct = 15 # override agency default`,
134
- `# monthly_cap = 50000`,
135
- ].join('\n') + '\n');
136
- process.stdout.write(`Client node scaffolded: clients/${slug}/\n`);
137
- process.stdout.write(` ai/context.md — add company context\n`);
138
- process.stdout.write(` site/one.config.ts — brand tokens (6 tokens rebrand the site)\n`);
139
- process.stdout.write(` client.toml — plan + economics\n\n`);
140
- process.stdout.write(`Next: one client add ${slug} [--dry-run]\n`);
141
- });
142
67
  // ── one create partner [name] ────────────────────────────────────────────
143
68
  cmd
144
69
  .command('partner [name]')
@@ -177,73 +102,5 @@ export function createCmd() {
177
102
  process.stdout.write(` # Edit partner.toml — set slug and name\n`);
178
103
  process.stdout.write(` one setup\n`);
179
104
  });
180
- // ── one create client-repo [name] ───────────────────────────────────────
181
- cmd
182
- .command('client-repo [name]', { isDefault: true })
183
- .description('Scaffold a single-business workspace from github.com/one-ie/one (apps/client) — the default, free plan')
184
- .option('--ref <ref>', 'Git ref to download', 'main')
185
- .option('--slug <slug>', 'Workspace slug (written into workspace.toml)')
186
- .option('--name <name>', 'Display name (written into workspace.toml)')
187
- .action((dirName, opts) => {
188
- if (!SAFE_REF.test(opts.ref)) {
189
- process.stderr.write(`Invalid ref: ${opts.ref}\n`);
190
- process.exit(1);
191
- }
192
- const label = dirName ?? opts.slug ?? 'my-business';
193
- const dir = resolve(process.cwd(), label);
194
- if (existsSync(dir)) {
195
- process.stderr.write(`Directory already exists: ${dir}\n`);
196
- process.exit(1);
197
- }
198
- process.stdout.write(`Creating business workspace at ${dir}...\n`);
199
- downloadSubdirs(`https://api.github.com/repos/one-ie/one/tarball/${opts.ref}`, [
200
- { subdir: 'apps/client', targetDir: dir },
201
- { subdir: 'apps/_shared', targetDir: dir },
202
- { subdir: 'apps/web', targetDir: join(dir, 'site') },
203
- ]);
204
- const tomlPath = join(dir, 'workspace.toml');
205
- if (existsSync(tomlPath) && (opts.slug ?? opts.name)) {
206
- let toml = readFileSync(tomlPath, 'utf8');
207
- if (opts.slug)
208
- toml = toml.replace(/^slug\s*=\s*"[^"]*"/m, `slug = "${opts.slug}"`);
209
- if (opts.name)
210
- toml = toml.replace(/^name\s*=\s*"[^"]*"/m, `name = "${opts.name}"`);
211
- writeFileSync(tomlPath, toml);
212
- }
213
- process.stdout.write(`\nWorkspace created — free plan, no credit card.\n\n`);
214
- process.stdout.write(`Next steps:\n`);
215
- process.stdout.write(` cd ${label}\n`);
216
- process.stdout.write(` cp .env.example .env.local\n`);
217
- process.stdout.write(` # Edit .env.local — set WORKSPACE_OWNER_EMAIL\n`);
218
- if (!opts.slug)
219
- process.stdout.write(` # Edit workspace.toml — set slug and name\n`);
220
- process.stdout.write(` one setup\n\n`);
221
- process.stdout.write(`Outgrew a single business? \`npx oneie create agency\` unlocks reselling\n`);
222
- process.stdout.write(`to multiple clients (agency plan) — see README.md.\n`);
223
- });
224
- // ── one create site [name] ────────────────────────────────────────────────
225
- cmd
226
- .command('site [name]')
227
- .description('Scaffold a standalone ONE Astro site from github.com/one-ie/one')
228
- .option('--ref <ref>', 'Git ref to download', 'main')
229
- .action((name, opts) => {
230
- if (!SAFE_REF.test(opts.ref)) {
231
- process.stderr.write(`Invalid ref: ${opts.ref}\n`);
232
- process.exit(1);
233
- }
234
- const dir = resolve(process.cwd(), name ?? 'my-site');
235
- if (existsSync(dir)) {
236
- process.stderr.write(`Directory already exists: ${dir}\n`);
237
- process.exit(1);
238
- }
239
- process.stdout.write(`Creating site at ${dir}...\n`);
240
- downloadSubdir(`https://api.github.com/repos/one-ie/one/tarball/${opts.ref}`, 'apps/web', dir);
241
- const label = name ?? 'my-site';
242
- process.stdout.write(`\nSite created.\n\n`);
243
- process.stdout.write(`Next steps:\n`);
244
- process.stdout.write(` cd ${label}\n`);
245
- process.stdout.write(` cp .env.example .env.local\n`);
246
- process.stdout.write(` bun install && bun run dev\n`);
247
- });
248
105
  return cmd;
249
106
  }
package/dist/src/index.js CHANGED
@@ -15,6 +15,7 @@ import { substrateCommands } from './substrate.js';
15
15
  import { evalCmd } from './eval.js';
16
16
  import { setupCmd } from './setup.js';
17
17
  import { clientCmd } from './client.js';
18
+ import { walletCmd } from './wallet.js';
18
19
  import { pushCmd } from './push.js';
19
20
  import { deployCmd } from './deploy.js';
20
21
  import { statusCmd } from './status.js';
@@ -52,6 +53,7 @@ program.addCommand(staffCmd());
52
53
  program.addCommand(evalCmd());
53
54
  program.addCommand(setupCmd());
54
55
  program.addCommand(clientCmd());
56
+ program.addCommand(walletCmd());
55
57
  program.addCommand(pushCmd());
56
58
  program.addCommand(deployCmd());
57
59
  program.addCommand(statusCmd());
@@ -1,4 +1,6 @@
1
1
  import { Command } from 'commander';
2
+ import { mkdirSync } from 'node:fs';
3
+ import { spawnSync } from 'node:child_process';
2
4
  function out(cmd, data) {
3
5
  if (process.env.ONEIE_JSON) {
4
6
  process.stdout.write(JSON.stringify({ cmd, ...data }) + '\n');
@@ -19,6 +21,17 @@ function bearerHeaders(workspace) {
19
21
  const key = process.env.ONEIE_API_KEY;
20
22
  return key && workspace ? { Authorization: `Bearer ${workspace}:${key}` } : {};
21
23
  }
24
+ // npm pack wraps a package's contents under a "package/" root — strip-components=1 lands
25
+ // the real package.json + src/ directly at ./plugin-<name>/, same as a real npm install would.
26
+ function extractTarball(bytes, targetDir) {
27
+ mkdirSync(targetDir, { recursive: true });
28
+ const tar = spawnSync('tar', ['-xz', '--strip-components=1', '-C', targetDir], {
29
+ input: bytes,
30
+ stdio: ['pipe', 'inherit', 'inherit'],
31
+ });
32
+ if (tar.status !== 0)
33
+ throw new Error(`tar failed extracting to ${targetDir}`);
34
+ }
22
35
  export function pluginCmd() {
23
36
  const cmd = new Command('plugin').description('Manage ONE plugins');
24
37
  cmd
@@ -65,6 +78,21 @@ export function pluginCmd() {
65
78
  console.error(`Error: ${e instanceof Error ? e.message : e}`);
66
79
  process.exit(1);
67
80
  }
81
+ // Paid plugins (PAID_FEATURES) stream a real gzip tarball on 200; free plugins keep
82
+ // the JSON pointer to their public npm package. Discriminate before parsing the body.
83
+ if (res.ok && res.headers.get('content-type')?.startsWith('application/gzip')) {
84
+ const bytes = new Uint8Array(await res.arrayBuffer());
85
+ const targetDir = `./plugin-${name}`;
86
+ try {
87
+ extractTarball(bytes, targetDir);
88
+ }
89
+ catch (e) {
90
+ out('plugin:add', { ok: false, error: 'extract_failed', plugin: name, detail: e instanceof Error ? e.message : String(e) });
91
+ process.exit(1);
92
+ }
93
+ out('plugin:add', { ok: true, plugin: name, extracted: true, path: targetDir });
94
+ return;
95
+ }
68
96
  const body = (await res.json());
69
97
  if (res.status === 402) {
70
98
  out('plugin:add', {
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ export declare function askPath(base: string, receiver: string): string;
3
+ export declare function okWrap(result: Record<string, unknown>): Record<string, unknown>;
4
+ export declare function walletCmd(): Command;
@@ -0,0 +1,135 @@
1
+ import { Command } from 'commander';
2
+ import { mergeEnv } from './env.js';
3
+ const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://api.one.ie';
4
+ // The api.one.ie GATEWAY serves substrate ops at the short form (/ask/<receiver>,
5
+ // mapped internally to one-prod's /api/ask/<receiver> — api/src/substrate-binding.ts
6
+ // PATH_MAP). Calling /api/ask/ directly against the gateway 404s (verified live
7
+ // 2026-07-03). one.ie/web itself only answers the long form. Pick the path that
8
+ // matches whichever host --api actually points at, rather than hardcoding one.
9
+ export function askPath(base, receiver) {
10
+ const isGateway = new URL(base).hostname === 'api.one.ie';
11
+ return `${base}${isGateway ? '/ask' : '/api/ask'}/${encodeURIComponent(receiver)}`;
12
+ }
13
+ // The ask envelope nests the resolver's return under `result`, not at the top
14
+ // level: { outcome:'result'|'timeout'|'dissolved'|'failure', result, signalId,
15
+ // receiver }. Unwrap it here so callers work with the plain wallet:* shape.
16
+ async function ask(base, key, receiver, data) {
17
+ const res = await fetch(askPath(base, receiver), {
18
+ method: 'POST',
19
+ headers: { 'Content-Type': 'application/json', ...(key ? { Authorization: `Bearer ${key}` } : {}) },
20
+ body: JSON.stringify({ data }),
21
+ });
22
+ if (!res.ok) {
23
+ const body = await res.text().catch(() => '');
24
+ throw new Error(`${receiver} → ${res.status}\n${body}`);
25
+ }
26
+ const envelope = (await res.json());
27
+ if (envelope.outcome && envelope.outcome !== 'result') {
28
+ throw new Error(`${receiver} → ${envelope.outcome}`);
29
+ }
30
+ return envelope.result ?? envelope;
31
+ }
32
+ function resolveAuth(opts) {
33
+ const env = mergeEnv(process.cwd());
34
+ const key = opts.key ?? env.ONEIE_API_KEY ?? env.ONE_API_KEY ?? '';
35
+ return { base: opts.api.replace(/\/$/, ''), key };
36
+ }
37
+ function resolveWorkspace(explicit) {
38
+ const env = mergeEnv(process.cwd());
39
+ const workspace = explicit ?? env.AGENCY_SLUG;
40
+ if (!workspace) {
41
+ process.stderr.write('--workspace required (or set AGENCY_SLUG)\n');
42
+ process.exit(1);
43
+ }
44
+ return workspace;
45
+ }
46
+ // wallet:get/create/transactions return bare data or { error } — no `ok` field
47
+ // of their own. wallet:send already returns { ok, ... }. Normalize both to the
48
+ // { ok, ... } shape out() expects without ever overwriting a real error/false
49
+ // with a hardcoded ok:true.
50
+ export function okWrap(result) {
51
+ if ('ok' in result)
52
+ return result;
53
+ if ('error' in result)
54
+ return { ok: false, ...result };
55
+ return { ok: true, ...result };
56
+ }
57
+ export function walletCmd() {
58
+ const cmd = new Command('wallet').description('Read balances, provision a wallet row, send crypto — wallet:* receivers');
59
+ cmd.command('get')
60
+ .description('Credits, spend ceiling, wallet rows, live chain balances, delegated wallets')
61
+ .option('--workspace <slug>', 'Workspace (defaults to AGENCY_SLUG)')
62
+ .option('--actor <id>', 'Actor within the workspace (defaults to workspace)')
63
+ .option('--api <url>', 'API base URL', DEFAULT_API)
64
+ .option('--key <key>', 'API key (overrides ONEIE_API_KEY env)')
65
+ .action(async (opts) => {
66
+ const { base, key } = resolveAuth(opts);
67
+ const workspace = resolveWorkspace(opts.workspace);
68
+ const result = await ask(base, key, 'wallet:get', { workspace, actor: opts.actor });
69
+ out(cmd, okWrap(result));
70
+ });
71
+ cmd.command('create')
72
+ .description('Provision a wallet row for an actor (idempotent)')
73
+ .option('--workspace <slug>', 'Workspace (defaults to AGENCY_SLUG)')
74
+ .option('--actor <id>', 'Actor to provision (defaults to workspace)')
75
+ .option('--kind <kind>', 'human | agent', 'human')
76
+ .option('--api <url>', 'API base URL', DEFAULT_API)
77
+ .option('--key <key>', 'API key (overrides ONEIE_API_KEY env)')
78
+ .action(async (opts) => {
79
+ const { base, key } = resolveAuth(opts);
80
+ const workspace = resolveWorkspace(opts.workspace);
81
+ const result = await ask(base, key, 'wallet:create', { workspace, actor: opts.actor, kind: opts.kind });
82
+ out(cmd, okWrap(result));
83
+ });
84
+ cmd.command('transactions')
85
+ .description('Unified transaction feed across every settlement rail')
86
+ .option('--workspace <slug>', 'Workspace (defaults to AGENCY_SLUG)')
87
+ .option('--limit <n>', 'Max rows (default 100, max 500)', '100')
88
+ .option('--api <url>', 'API base URL', DEFAULT_API)
89
+ .option('--key <key>', 'API key (overrides ONEIE_API_KEY env)')
90
+ .action(async (opts) => {
91
+ const { base, key } = resolveAuth(opts);
92
+ const workspace = resolveWorkspace(opts.workspace);
93
+ const result = await ask(base, key, 'wallet:transactions', { workspace, limit: Number(opts.limit) });
94
+ out(cmd, okWrap(result));
95
+ });
96
+ cmd.command('send <to>')
97
+ .description('Send crypto via pay.one.ie payment links, incl. Bitcoin — sign the transfer yourself first, pass the tx hash')
98
+ .requiredOption('--chain <chain>', 'SUI | EVM | SOL | BTC | BASE | ARB | OPT')
99
+ .requiredOption('--amount <n>', 'Amount to send')
100
+ .requiredOption('--payment-tx <hash>', 'The transaction hash from signing & broadcasting client-side — this command never signs')
101
+ .option('--workspace <slug>', 'Source workspace (defaults to AGENCY_SLUG)')
102
+ .option('--unit <unit>', 'usd | token', 'usd')
103
+ .option('--currency <currency>', 'NATIVE | USDC', 'NATIVE')
104
+ .option('--user-address <address>', 'Sender address (defaults to --to)')
105
+ .option('--memo <text>', 'Payment memo')
106
+ .option('--api <url>', 'API base URL', DEFAULT_API)
107
+ .option('--key <key>', 'API key (overrides ONEIE_API_KEY env)')
108
+ .action(async (to, opts) => {
109
+ const { base, key } = resolveAuth(opts);
110
+ const workspace = resolveWorkspace(opts.workspace);
111
+ const result = await ask(base, key, 'wallet:send', {
112
+ workspace, to, chain: opts.chain, amount: Number(opts.amount), paymentTx: opts.paymentTx,
113
+ unit: opts.unit, currency: opts.currency, userAddress: opts.userAddress, memo: opts.memo,
114
+ });
115
+ out(cmd, okWrap(result));
116
+ });
117
+ return cmd;
118
+ }
119
+ function out(cmd, data) {
120
+ const isJson = cmd.parent?.opts().json;
121
+ if (isJson) {
122
+ process.stdout.write(JSON.stringify(data) + '\n');
123
+ }
124
+ else if (data.ok) {
125
+ const pairs = Object.entries(data)
126
+ .filter(([k]) => k !== 'ok')
127
+ .map(([k, v]) => `${k}=${JSON.stringify(v)}`)
128
+ .join(' ');
129
+ console.log('✓', pairs);
130
+ }
131
+ else {
132
+ const detail = data.error ?? data.errors ?? data.issues ?? data;
133
+ console.error('✗', typeof detail === 'string' ? detail : JSON.stringify(detail));
134
+ }
135
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/cli",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "ONE agent CLI",
5
5
  "type": "module",
6
6
  "bin": {