@bankr/cli 0.3.13 → 0.3.32
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 +34 -10
- package/dist/cli.js +34 -18
- package/dist/commands/balances.js +3 -3
- package/dist/commands/cancel.js +1 -3
- package/dist/commands/club.js +6 -16
- package/dist/commands/config.js +1 -2
- package/dist/commands/fees.js +79 -64
- package/dist/commands/files.js +17 -39
- package/dist/commands/launch.d.ts +4 -0
- package/dist/commands/launch.js +56 -18
- package/dist/commands/llm.d.ts +10 -0
- package/dist/commands/llm.js +510 -99
- package/dist/commands/login.d.ts +14 -0
- package/dist/commands/login.js +57 -57
- package/dist/commands/portfolio.js +4 -4
- package/dist/commands/profile.js +6 -5
- package/dist/commands/prompt.js +36 -26
- package/dist/commands/sign.js +9 -16
- package/dist/commands/sounds.js +6 -15
- package/dist/commands/status.js +2 -4
- package/dist/commands/submit.js +13 -24
- package/dist/commands/swap.js +11 -11
- package/dist/commands/tokens.js +4 -4
- package/dist/commands/transfer.js +10 -10
- package/dist/commands/update.js +2 -2
- package/dist/commands/webhooks.js +27 -67
- package/dist/commands/whoami.js +4 -4
- package/dist/commands/x402.d.ts +3 -0
- package/dist/commands/x402.js +95 -115
- package/dist/lib/api.d.ts +17 -3
- package/dist/lib/api.js +34 -43
- package/dist/lib/explorer.js +1 -0
- package/dist/lib/output.d.ts +5 -0
- package/dist/lib/output.js +18 -0
- package/dist/lib/passthrough.d.ts +21 -0
- package/dist/lib/passthrough.js +26 -0
- package/dist/lib/tokens.d.ts +0 -5
- package/dist/lib/tokens.js +0 -5
- package/package.json +1 -1
package/dist/commands/files.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync, statSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { basename } from "node:path";
|
|
3
3
|
import { CLI_USER_AGENT, getApiUrl, requireApiKey } from "../lib/config.js";
|
|
4
|
+
import { authHeaders } from "../lib/api.js";
|
|
4
5
|
import * as output from "../lib/output.js";
|
|
5
6
|
import { getErrorMessage } from "../lib/errors.js";
|
|
6
7
|
async function readStdin() {
|
|
@@ -12,13 +13,6 @@ async function readStdin() {
|
|
|
12
13
|
chunks.push(chunk);
|
|
13
14
|
return Buffer.concat(chunks).toString("utf-8");
|
|
14
15
|
}
|
|
15
|
-
function authHeaders() {
|
|
16
|
-
return {
|
|
17
|
-
"X-API-Key": requireApiKey(),
|
|
18
|
-
"Content-Type": "application/json",
|
|
19
|
-
"User-Agent": CLI_USER_AGENT,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
16
|
// ── List files ──────────────────────────────────────────────────────────
|
|
23
17
|
export async function filesListCommand(opts) {
|
|
24
18
|
const spinner = output.spinner("Fetching files...");
|
|
@@ -55,8 +49,7 @@ export async function filesListCommand(opts) {
|
|
|
55
49
|
}
|
|
56
50
|
catch (err) {
|
|
57
51
|
spinner.stop();
|
|
58
|
-
output.
|
|
59
|
-
process.exit(1);
|
|
52
|
+
output.fatal(getErrorMessage(err));
|
|
60
53
|
}
|
|
61
54
|
}
|
|
62
55
|
// ── Upload file ─────────────────────────────────────────────────────────
|
|
@@ -103,8 +96,7 @@ export async function filesUploadCommand(filePath, opts) {
|
|
|
103
96
|
}
|
|
104
97
|
catch (err) {
|
|
105
98
|
spinner.stop();
|
|
106
|
-
output.
|
|
107
|
-
process.exit(1);
|
|
99
|
+
output.fatal(getErrorMessage(err));
|
|
108
100
|
}
|
|
109
101
|
}
|
|
110
102
|
// ── Download file ───────────────────────────────────────────────────────
|
|
@@ -125,8 +117,7 @@ export async function filesDownloadCommand(fileId) {
|
|
|
125
117
|
}
|
|
126
118
|
catch (err) {
|
|
127
119
|
spinner.stop();
|
|
128
|
-
output.
|
|
129
|
-
process.exit(1);
|
|
120
|
+
output.fatal(getErrorMessage(err));
|
|
130
121
|
}
|
|
131
122
|
}
|
|
132
123
|
// ── Create folder ───────────────────────────────────────────────────────
|
|
@@ -150,8 +141,7 @@ export async function filesMkdirCommand(name, opts) {
|
|
|
150
141
|
}
|
|
151
142
|
catch (err) {
|
|
152
143
|
spinner.stop();
|
|
153
|
-
output.
|
|
154
|
-
process.exit(1);
|
|
144
|
+
output.fatal(getErrorMessage(err));
|
|
155
145
|
}
|
|
156
146
|
}
|
|
157
147
|
// ── Delete file ─────────────────────────────────────────────────────────
|
|
@@ -171,8 +161,7 @@ export async function filesRmCommand(fileId) {
|
|
|
171
161
|
}
|
|
172
162
|
catch (err) {
|
|
173
163
|
spinner.stop();
|
|
174
|
-
output.
|
|
175
|
-
process.exit(1);
|
|
164
|
+
output.fatal(getErrorMessage(err));
|
|
176
165
|
}
|
|
177
166
|
}
|
|
178
167
|
// ── Storage usage ───────────────────────────────────────────────────────
|
|
@@ -203,8 +192,7 @@ export async function filesStorageCommand() {
|
|
|
203
192
|
}
|
|
204
193
|
catch (err) {
|
|
205
194
|
spinner.stop();
|
|
206
|
-
output.
|
|
207
|
-
process.exit(1);
|
|
195
|
+
output.fatal(getErrorMessage(err));
|
|
208
196
|
}
|
|
209
197
|
}
|
|
210
198
|
// ── Read file contents ──────────────────────────────────────────────────
|
|
@@ -240,8 +228,7 @@ export async function filesCatCommand(fileId, opts) {
|
|
|
240
228
|
}
|
|
241
229
|
catch (err) {
|
|
242
230
|
spinner.stop();
|
|
243
|
-
output.
|
|
244
|
-
process.exit(1);
|
|
231
|
+
output.fatal(getErrorMessage(err));
|
|
245
232
|
}
|
|
246
233
|
}
|
|
247
234
|
// ── Edit file (find/replace or overwrite) ───────────────────────────────
|
|
@@ -249,16 +236,13 @@ export async function filesEditCommand(fileId, opts) {
|
|
|
249
236
|
const hasReplace = opts.find !== undefined || opts.replace !== undefined;
|
|
250
237
|
const hasOverwrite = opts.content !== undefined || opts.from !== undefined;
|
|
251
238
|
if (!hasReplace && !hasOverwrite) {
|
|
252
|
-
output.
|
|
253
|
-
process.exit(1);
|
|
239
|
+
output.fatal("Specify either --find/--replace for find-and-replace, or --content/--from for full overwrite.");
|
|
254
240
|
}
|
|
255
241
|
if (hasReplace && hasOverwrite) {
|
|
256
|
-
output.
|
|
257
|
-
process.exit(1);
|
|
242
|
+
output.fatal("Cannot combine --find/--replace with --content/--from.");
|
|
258
243
|
}
|
|
259
244
|
if (hasReplace && (opts.find === undefined || opts.replace === undefined)) {
|
|
260
|
-
output.
|
|
261
|
-
process.exit(1);
|
|
245
|
+
output.fatal("Find-and-replace requires both --find and --replace.");
|
|
262
246
|
}
|
|
263
247
|
const spinner = output.spinner("Editing file...");
|
|
264
248
|
try {
|
|
@@ -316,8 +300,7 @@ export async function filesEditCommand(fileId, opts) {
|
|
|
316
300
|
}
|
|
317
301
|
catch (err) {
|
|
318
302
|
spinner.stop();
|
|
319
|
-
output.
|
|
320
|
-
process.exit(1);
|
|
303
|
+
output.fatal(getErrorMessage(err));
|
|
321
304
|
}
|
|
322
305
|
}
|
|
323
306
|
// ── Write/replace file content from stdin or local file ─────────────────
|
|
@@ -342,8 +325,7 @@ export async function filesWriteCommand(fileId, opts) {
|
|
|
342
325
|
}
|
|
343
326
|
catch (err) {
|
|
344
327
|
spinner.stop();
|
|
345
|
-
output.
|
|
346
|
-
process.exit(1);
|
|
328
|
+
output.fatal(getErrorMessage(err));
|
|
347
329
|
}
|
|
348
330
|
}
|
|
349
331
|
// ── Search files ────────────────────────────────────────────────────────
|
|
@@ -381,8 +363,7 @@ export async function filesSearchCommand(query, opts) {
|
|
|
381
363
|
}
|
|
382
364
|
catch (err) {
|
|
383
365
|
spinner.stop();
|
|
384
|
-
output.
|
|
385
|
-
process.exit(1);
|
|
366
|
+
output.fatal(getErrorMessage(err));
|
|
386
367
|
}
|
|
387
368
|
}
|
|
388
369
|
// ── Move file to a different folder ─────────────────────────────────────
|
|
@@ -404,8 +385,7 @@ export async function filesMvCommand(fileId, folder) {
|
|
|
404
385
|
}
|
|
405
386
|
catch (err) {
|
|
406
387
|
spinner.stop();
|
|
407
|
-
output.
|
|
408
|
-
process.exit(1);
|
|
388
|
+
output.fatal(getErrorMessage(err));
|
|
409
389
|
}
|
|
410
390
|
}
|
|
411
391
|
// ── Rename file ─────────────────────────────────────────────────────────
|
|
@@ -427,8 +407,7 @@ export async function filesRenameCommand(fileId, name) {
|
|
|
427
407
|
}
|
|
428
408
|
catch (err) {
|
|
429
409
|
spinner.stop();
|
|
430
|
-
output.
|
|
431
|
-
process.exit(1);
|
|
410
|
+
output.fatal(getErrorMessage(err));
|
|
432
411
|
}
|
|
433
412
|
}
|
|
434
413
|
// ── File info ───────────────────────────────────────────────────────────
|
|
@@ -456,8 +435,7 @@ export async function filesInfoCommand(fileId) {
|
|
|
456
435
|
}
|
|
457
436
|
catch (err) {
|
|
458
437
|
spinner.stop();
|
|
459
|
-
output.
|
|
460
|
-
process.exit(1);
|
|
438
|
+
output.fatal(getErrorMessage(err));
|
|
461
439
|
}
|
|
462
440
|
}
|
|
463
441
|
// ── Helpers ─────────────────────────────────────────────────────────────
|
|
@@ -3,10 +3,14 @@ export interface LaunchOptions {
|
|
|
3
3
|
symbol?: string;
|
|
4
4
|
image?: string;
|
|
5
5
|
chain?: string;
|
|
6
|
+
/** Commander --no-vesting flag: false = vesting explicitly turned off. */
|
|
7
|
+
vesting?: boolean;
|
|
6
8
|
tweet?: string;
|
|
7
9
|
website?: string;
|
|
8
10
|
fee?: string;
|
|
9
11
|
feeType?: string;
|
|
12
|
+
/** --quote-only-fees flag: collect all creator fees in the quote token. */
|
|
13
|
+
quoteOnlyFees?: boolean;
|
|
10
14
|
yes?: boolean;
|
|
11
15
|
simulate?: boolean;
|
|
12
16
|
}
|
package/dist/commands/launch.js
CHANGED
|
@@ -3,10 +3,16 @@ import { deployToken, } from "../lib/api.js";
|
|
|
3
3
|
import { emitCESP } from "../lib/cesp/engine.js";
|
|
4
4
|
import { requireApiKey } from "../lib/config.js";
|
|
5
5
|
import * as output from "../lib/output.js";
|
|
6
|
+
import { getErrorMessage } from "../lib/errors.js";
|
|
6
7
|
const VALID_FEE_TYPES = ["x", "farcaster", "ens", "wallet"];
|
|
7
|
-
const VALID_CHAINS = ["base", "robinhood"];
|
|
8
|
+
const VALID_CHAINS = ["base", "robinhood", "arbitrum"];
|
|
9
|
+
const CHAIN_LABELS = {
|
|
10
|
+
base: "Base",
|
|
11
|
+
robinhood: "Robinhood Chain",
|
|
12
|
+
arbitrum: "Arbitrum",
|
|
13
|
+
};
|
|
8
14
|
function chainLabel(chain) {
|
|
9
|
-
return chain
|
|
15
|
+
return CHAIN_LABELS[chain];
|
|
10
16
|
}
|
|
11
17
|
function parseChain(value) {
|
|
12
18
|
if (!value)
|
|
@@ -16,8 +22,7 @@ function parseChain(value) {
|
|
|
16
22
|
return lower;
|
|
17
23
|
// Launching is irreversible and chain-selecting — a mistyped chain must be
|
|
18
24
|
// a hard usage error, never a silent fallback to Base.
|
|
19
|
-
output.
|
|
20
|
-
process.exit(1);
|
|
25
|
+
output.fatal(`Unknown chain "${value}". Valid chains: ${VALID_CHAINS.join(", ")}.`);
|
|
21
26
|
}
|
|
22
27
|
function parseFeeType(value) {
|
|
23
28
|
if (!value)
|
|
@@ -47,8 +52,7 @@ async function promptOrSkip(message) {
|
|
|
47
52
|
}
|
|
48
53
|
async function collectInteractive(options) {
|
|
49
54
|
if (output.isNonInteractive() && !options.name) {
|
|
50
|
-
output.
|
|
51
|
-
process.exit(1);
|
|
55
|
+
output.fatal("--name is required in non-interactive mode");
|
|
52
56
|
}
|
|
53
57
|
const tokenName = options.name ??
|
|
54
58
|
(await input({
|
|
@@ -66,15 +70,43 @@ async function collectInteractive(options) {
|
|
|
66
70
|
if (!chain && !output.isNonInteractive()) {
|
|
67
71
|
chain = await select({
|
|
68
72
|
message: "Which chain do you want to launch on?",
|
|
69
|
-
choices:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
choices: VALID_CHAINS.map((value) => ({
|
|
74
|
+
name: chainLabel(value),
|
|
75
|
+
value,
|
|
76
|
+
})),
|
|
73
77
|
default: "base",
|
|
74
78
|
theme: output.bankrTheme,
|
|
75
79
|
});
|
|
76
80
|
}
|
|
77
81
|
chain ?? (chain = "base");
|
|
82
|
+
// Vesting: --no-vesting wins; otherwise interactive select (default: keep
|
|
83
|
+
// the 15% creator vesting). Non-interactive runs keep vesting on.
|
|
84
|
+
let disableVesting = options.vesting === false;
|
|
85
|
+
if (!disableVesting && !output.isNonInteractive()) {
|
|
86
|
+
disableVesting = await select({
|
|
87
|
+
message: "Creator vesting? By default 15% of supply vests to the fee recipient over 1 year (30-day cliff).",
|
|
88
|
+
choices: [
|
|
89
|
+
{ name: "15% vesting (default)", value: false },
|
|
90
|
+
{ name: "No vesting — sell 100% into the pool", value: true },
|
|
91
|
+
],
|
|
92
|
+
default: false,
|
|
93
|
+
theme: output.bankrTheme,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// Fee collection: --quote-only-fees wins; otherwise interactive select
|
|
97
|
+
// (default: in-kind). Non-interactive runs keep the in-kind default.
|
|
98
|
+
let quoteOnlyFees = options.quoteOnlyFees === true;
|
|
99
|
+
if (!quoteOnlyFees && !output.isNonInteractive()) {
|
|
100
|
+
quoteOnlyFees = await select({
|
|
101
|
+
message: "Fee collection? By default creator fees accrue as a mix of your token and the pool's quote token (e.g. WETH).",
|
|
102
|
+
choices: [
|
|
103
|
+
{ name: "Both tokens (default)", value: false },
|
|
104
|
+
{ name: "Quote token only", value: true },
|
|
105
|
+
],
|
|
106
|
+
default: false,
|
|
107
|
+
theme: output.bankrTheme,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
78
110
|
const tweetUrl = options.tweet ??
|
|
79
111
|
(await promptOrSkip("Associate with a tweet? Paste URL (press Enter to skip):"));
|
|
80
112
|
const websiteUrl = options.website ??
|
|
@@ -94,9 +126,7 @@ async function collectInteractive(options) {
|
|
|
94
126
|
theme: output.bankrTheme,
|
|
95
127
|
});
|
|
96
128
|
}
|
|
97
|
-
|
|
98
|
-
feeRecipient = "";
|
|
99
|
-
}
|
|
129
|
+
feeRecipient || (feeRecipient = "");
|
|
100
130
|
return {
|
|
101
131
|
tokenName: tokenName.trim(),
|
|
102
132
|
tokenSymbol: tokenSymbol.trim(),
|
|
@@ -106,6 +136,8 @@ async function collectInteractive(options) {
|
|
|
106
136
|
websiteUrl: websiteUrl.trim(),
|
|
107
137
|
feeRecipient: feeRecipient.trim(),
|
|
108
138
|
feeRecipientType,
|
|
139
|
+
disableVesting,
|
|
140
|
+
quoteOnlyFees,
|
|
109
141
|
};
|
|
110
142
|
}
|
|
111
143
|
export async function launchCommand(options) {
|
|
@@ -113,8 +145,7 @@ export async function launchCommand(options) {
|
|
|
113
145
|
// Collect token details
|
|
114
146
|
const state = await collectInteractive(options);
|
|
115
147
|
if (!state.tokenName) {
|
|
116
|
-
output.
|
|
117
|
-
process.exit(1);
|
|
148
|
+
output.fatal("Token name is required.");
|
|
118
149
|
}
|
|
119
150
|
// Display summary
|
|
120
151
|
console.log();
|
|
@@ -129,6 +160,12 @@ export async function launchCommand(options) {
|
|
|
129
160
|
? `${state.feeRecipient} (${feeTypeLabel(state.feeRecipientType)})`
|
|
130
161
|
: "(self)");
|
|
131
162
|
output.keyValue("Chain", chainLabel(state.chain));
|
|
163
|
+
output.keyValue("Vesting", state.disableVesting
|
|
164
|
+
? "Off (100% of supply sold into the pool)"
|
|
165
|
+
: "15% to fee recipient over 1 year (default)");
|
|
166
|
+
output.keyValue("Fee collection", state.quoteOnlyFees
|
|
167
|
+
? "Quote token only (e.g. WETH)"
|
|
168
|
+
: "Both tokens (default)");
|
|
132
169
|
if (options.simulate) {
|
|
133
170
|
output.keyValue("Mode", "Simulation (dry run)");
|
|
134
171
|
}
|
|
@@ -161,6 +198,8 @@ export async function launchCommand(options) {
|
|
|
161
198
|
? { type: state.feeRecipientType, value: state.feeRecipient }
|
|
162
199
|
: undefined,
|
|
163
200
|
simulateOnly: options.simulate,
|
|
201
|
+
disableVesting: state.disableVesting || undefined,
|
|
202
|
+
quoteOnlyFees: state.quoteOnlyFees || undefined,
|
|
164
203
|
});
|
|
165
204
|
const elapsed = output.formatDuration(Date.now() - startTime);
|
|
166
205
|
spin.succeed(result.simulated
|
|
@@ -187,13 +226,12 @@ export async function launchCommand(options) {
|
|
|
187
226
|
}
|
|
188
227
|
}
|
|
189
228
|
console.log();
|
|
190
|
-
output.dim(`View token: https://bankr.bot/
|
|
229
|
+
output.dim(`View token: https://bankr.bot/terminal/trade?out=${result.tokenAddress}&chain=${result.chain}`);
|
|
191
230
|
}
|
|
192
231
|
catch (err) {
|
|
193
232
|
spin.fail("Token launch failed");
|
|
194
233
|
emitCESP("task.error");
|
|
195
|
-
output.
|
|
196
|
-
process.exit(1);
|
|
234
|
+
output.fatal(getErrorMessage(err));
|
|
197
235
|
}
|
|
198
236
|
}
|
|
199
237
|
//# sourceMappingURL=launch.js.map
|
package/dist/commands/llm.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function modelsCommand(opts?: {
|
|
2
2
|
private?: boolean;
|
|
3
|
+
zdr?: boolean;
|
|
3
4
|
}): Promise<void>;
|
|
4
5
|
export declare function creditsCommand(): Promise<void>;
|
|
5
6
|
export declare function creditsAddCommand(amount: string, opts: {
|
|
@@ -15,12 +16,21 @@ export declare function creditsAutoCommand(opts: {
|
|
|
15
16
|
}): Promise<void>;
|
|
16
17
|
export declare function setupOpenclawCommand(opts: {
|
|
17
18
|
install?: boolean;
|
|
19
|
+
images?: boolean;
|
|
18
20
|
}): Promise<void>;
|
|
19
21
|
export declare function setupOpenCodeCommand(opts: {
|
|
20
22
|
install?: boolean;
|
|
21
23
|
}): Promise<void>;
|
|
22
24
|
export declare function setupCursorCommand(): Promise<void>;
|
|
23
25
|
export declare function setupClaudeCodeCommand(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Rewrite gateway-canonical Claude IDs (dotted, e.g. `claude-opus-4.8`) to
|
|
28
|
+
* the wire format Claude Code expects (dashed, e.g. `claude-opus-4-8`).
|
|
29
|
+
* Otherwise Claude Code silently falls back to its default model — the
|
|
30
|
+
* `--model` flag appears honored but the real request is a different
|
|
31
|
+
* model. Any suffix (e.g. `[1m]` context tier) is preserved.
|
|
32
|
+
*/
|
|
33
|
+
export declare function toAnthropicModelId(model: string): string;
|
|
24
34
|
export declare function claudeCommand(args: string[]): Promise<void>;
|
|
25
35
|
export declare function opencodeCommand(args: string[]): Promise<void>;
|
|
26
36
|
//# sourceMappingURL=llm.d.ts.map
|