@bankr/cli 0.3.8 → 0.3.11
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 +6 -6
- package/dist/cli.js +18 -3
- package/dist/commands/llm.d.ts +3 -1
- package/dist/commands/llm.js +73 -22
- package/dist/commands/profile.d.ts +5 -1
- package/dist/commands/profile.js +54 -10
- package/dist/commands/prompt.js +1 -0
- package/dist/lib/api.d.ts +7 -3
- package/dist/lib/api.js +14 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,19 +109,19 @@ Launch Claude Code / OpenCode routed through the Bankr gateway:
|
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
111
|
# Claude Code (auto-translates dotted model IDs to the Anthropic wire format)
|
|
112
|
-
bankr llm claude --model claude-opus-4-
|
|
112
|
+
bankr llm claude --model claude-opus-4-8
|
|
113
113
|
|
|
114
|
-
# Or use dotted form — bankr llm claude rewrites it to claude-opus-4-
|
|
115
|
-
bankr llm claude --model claude-opus-4.
|
|
114
|
+
# Or use dotted form — bankr llm claude rewrites it to claude-opus-4-8
|
|
115
|
+
bankr llm claude --model claude-opus-4.8
|
|
116
116
|
|
|
117
117
|
# OpenCode (use the bankr/ prefix with the gateway-canonical dotted form)
|
|
118
|
-
bankr llm opencode -m bankr/claude-opus-4.
|
|
118
|
+
bankr llm opencode -m bankr/claude-opus-4.8
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
**Claude Code model format**: Claude Code's `--model` flag expects
|
|
122
|
-
Anthropic-style dashed IDs (`claude-opus-4-
|
|
122
|
+
Anthropic-style dashed IDs (`claude-opus-4-8`, `claude-sonnet-4-6`,
|
|
123
123
|
`claude-haiku-4-5`). If you pass the gateway-canonical dotted form
|
|
124
|
-
(`claude-opus-4.
|
|
124
|
+
(`claude-opus-4.8`), Claude Code silently falls back to its default —
|
|
125
125
|
the flag appears honored but the real request is a different model.
|
|
126
126
|
|
|
127
127
|
`bankr llm claude` translates dotted → dashed for you. If you use older
|
package/dist/cli.js
CHANGED
|
@@ -418,6 +418,7 @@ profileCmd
|
|
|
418
418
|
profileCmd
|
|
419
419
|
.command("update")
|
|
420
420
|
.description("Update your agent profile")
|
|
421
|
+
.option("--slug <slug>", "Project slug (required if multiple profiles)")
|
|
421
422
|
.option("--name <name>", "Project name")
|
|
422
423
|
.option("--description <text>", "Project description")
|
|
423
424
|
.option("--token <address>", "Token contract address")
|
|
@@ -426,6 +427,7 @@ profileCmd
|
|
|
426
427
|
.option("--json", "Output raw JSON")
|
|
427
428
|
.action(async (opts) => {
|
|
428
429
|
await profileUpdateCommand({
|
|
430
|
+
slug: opts.slug,
|
|
429
431
|
name: opts.name,
|
|
430
432
|
description: opts.description,
|
|
431
433
|
token: opts.token,
|
|
@@ -437,15 +439,20 @@ profileCmd
|
|
|
437
439
|
profileCmd
|
|
438
440
|
.command("delete")
|
|
439
441
|
.description("Delete your agent profile")
|
|
440
|
-
.
|
|
442
|
+
.option("--slug <slug>", "Project slug (required if multiple profiles)")
|
|
443
|
+
.action(async (opts) => {
|
|
444
|
+
await profileDeleteCommand({ slug: opts.slug });
|
|
445
|
+
});
|
|
441
446
|
profileCmd
|
|
442
447
|
.command("add-update")
|
|
443
448
|
.description("Add a project update to your profile")
|
|
449
|
+
.option("--slug <slug>", "Project slug (required if multiple profiles)")
|
|
444
450
|
.option("--title <title>", "Update title")
|
|
445
451
|
.option("--content <text>", "Update content")
|
|
446
452
|
.option("--json", "Output raw JSON")
|
|
447
453
|
.action(async (opts) => {
|
|
448
454
|
await profileAddUpdateCommand({
|
|
455
|
+
slug: opts.slug,
|
|
449
456
|
title: opts.title,
|
|
450
457
|
content: opts.content,
|
|
451
458
|
json: opts.json,
|
|
@@ -461,6 +468,7 @@ const llmCmd = program
|
|
|
461
468
|
llmCmd
|
|
462
469
|
.command("models")
|
|
463
470
|
.description("List available models")
|
|
471
|
+
.option("--private", "Show only models that support private (:private) inference")
|
|
464
472
|
.action(modelsCommand);
|
|
465
473
|
const llmCreditsCmd = llmCmd
|
|
466
474
|
.command("credits")
|
|
@@ -623,6 +631,7 @@ profileAliasCmd
|
|
|
623
631
|
});
|
|
624
632
|
profileAliasCmd
|
|
625
633
|
.command("update")
|
|
634
|
+
.option("--slug <slug>", "Project slug")
|
|
626
635
|
.option("--name <name>", "Project name")
|
|
627
636
|
.option("--description <text>", "Project description")
|
|
628
637
|
.option("--token <address>", "Token contract address")
|
|
@@ -632,6 +641,7 @@ profileAliasCmd
|
|
|
632
641
|
.action(async (opts) => {
|
|
633
642
|
deprecatedCmd("profile update", "agent profile update");
|
|
634
643
|
await profileUpdateCommand({
|
|
644
|
+
slug: opts.slug,
|
|
635
645
|
name: opts.name,
|
|
636
646
|
description: opts.description,
|
|
637
647
|
token: opts.token,
|
|
@@ -640,18 +650,23 @@ profileAliasCmd
|
|
|
640
650
|
json: opts.json,
|
|
641
651
|
});
|
|
642
652
|
});
|
|
643
|
-
profileAliasCmd
|
|
653
|
+
profileAliasCmd
|
|
654
|
+
.command("delete")
|
|
655
|
+
.option("--slug <slug>", "Project slug")
|
|
656
|
+
.action(async (opts) => {
|
|
644
657
|
deprecatedCmd("profile delete", "agent profile delete");
|
|
645
|
-
await profileDeleteCommand();
|
|
658
|
+
await profileDeleteCommand({ slug: opts.slug });
|
|
646
659
|
});
|
|
647
660
|
profileAliasCmd
|
|
648
661
|
.command("add-update")
|
|
662
|
+
.option("--slug <slug>", "Project slug")
|
|
649
663
|
.option("--title <title>", "Update title")
|
|
650
664
|
.option("--content <text>", "Update content")
|
|
651
665
|
.option("--json", "Output raw JSON")
|
|
652
666
|
.action(async (opts) => {
|
|
653
667
|
deprecatedCmd("profile add-update", "agent profile add-update");
|
|
654
668
|
await profileAddUpdateCommand({
|
|
669
|
+
slug: opts.slug,
|
|
655
670
|
title: opts.title,
|
|
656
671
|
content: opts.content,
|
|
657
672
|
json: opts.json,
|
package/dist/commands/llm.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export declare function modelsCommand(
|
|
1
|
+
export declare function modelsCommand(opts?: {
|
|
2
|
+
private?: boolean;
|
|
3
|
+
}): Promise<void>;
|
|
2
4
|
export declare function creditsCommand(): Promise<void>;
|
|
3
5
|
export declare function creditsAddCommand(amount: string, opts: {
|
|
4
6
|
token?: string;
|
package/dist/commands/llm.js
CHANGED
|
@@ -14,6 +14,24 @@ const IMAGE_INPUT = ["text", "image"];
|
|
|
14
14
|
const TEXT_INPUT = ["text"];
|
|
15
15
|
const GATEWAY_MODELS = [
|
|
16
16
|
// Claude
|
|
17
|
+
{
|
|
18
|
+
id: "claude-opus-4.8",
|
|
19
|
+
name: "Claude Opus 4.8",
|
|
20
|
+
owned_by: "anthropic",
|
|
21
|
+
contextWindow: 1000000,
|
|
22
|
+
maxTokens: 128000,
|
|
23
|
+
input: IMAGE_INPUT,
|
|
24
|
+
cost: { input: 5.0, output: 25.0, cacheRead: 0.5, cacheWrite: 6.25 },
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "claude-opus-4.7",
|
|
28
|
+
name: "Claude Opus 4.7",
|
|
29
|
+
owned_by: "anthropic",
|
|
30
|
+
contextWindow: 1000000,
|
|
31
|
+
maxTokens: 128000,
|
|
32
|
+
input: IMAGE_INPUT,
|
|
33
|
+
cost: { input: 5.0, output: 25.0, cacheRead: 0.5, cacheWrite: 6.25 },
|
|
34
|
+
},
|
|
17
35
|
{
|
|
18
36
|
id: "claude-opus-4.6",
|
|
19
37
|
name: "Claude Opus 4.6",
|
|
@@ -351,6 +369,7 @@ async function resolveModels() {
|
|
|
351
369
|
cacheWrite: 0,
|
|
352
370
|
}),
|
|
353
371
|
...(m.deprecation && { deprecation: m.deprecation }),
|
|
372
|
+
...(m.private && { private: true }),
|
|
354
373
|
};
|
|
355
374
|
});
|
|
356
375
|
return { models, live: true };
|
|
@@ -389,28 +408,46 @@ function installConfigFile(configFile, toolName, merge) {
|
|
|
389
408
|
output.success(`Bankr provider installed to ${configFile}`);
|
|
390
409
|
}
|
|
391
410
|
/* ───────────────────────────── bankr llm models ───────────────────────────── */
|
|
392
|
-
export async function modelsCommand() {
|
|
411
|
+
export async function modelsCommand(opts = {}) {
|
|
393
412
|
const spin = output.spinner("Fetching models…");
|
|
394
413
|
const { models, live } = await resolveModels();
|
|
395
414
|
spin.stop();
|
|
396
|
-
|
|
415
|
+
// `private` is the gateway's own "supports :private" flag from
|
|
416
|
+
// /v1/models (driven by each model's NEAR slot + NEARAI_API_KEY), so this
|
|
417
|
+
// tracks the live registry rather than a hardcoded CLI list.
|
|
418
|
+
const shown = opts.private ? models.filter((m) => m.private) : models;
|
|
419
|
+
output.brandBold(opts.private
|
|
420
|
+
? "Bankr LLM Gateway — Private Models"
|
|
421
|
+
: "Bankr LLM Gateway — Available Models");
|
|
397
422
|
console.log();
|
|
423
|
+
if (opts.private && shown.length === 0) {
|
|
424
|
+
output.warn(live
|
|
425
|
+
? "No models currently offer a private (TEE) compute environment."
|
|
426
|
+
: "Private status needs a live gateway — set BANKR_LLM_KEY (and BANKR_LLM_URL).");
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
398
429
|
const COL = { id: 24, name: 24, provider: 12 };
|
|
399
|
-
const
|
|
400
|
-
console.log(` ${output.fmt.brandBold("Model ID".padEnd(COL.id))} ${output.fmt.brandBold("Name".padEnd(COL.name))} ${output.fmt.brandBold("Provider".padEnd(COL.provider))}${
|
|
401
|
-
console.log(output.fmt.dim(` ${"─".repeat(COL.id + COL.name + COL.provider + (
|
|
402
|
-
for (const m of
|
|
430
|
+
const hasNotes = shown.some((m) => m.deprecation || m.private);
|
|
431
|
+
console.log(` ${output.fmt.brandBold("Model ID".padEnd(COL.id))} ${output.fmt.brandBold("Name".padEnd(COL.name))} ${output.fmt.brandBold("Provider".padEnd(COL.provider))}${hasNotes ? ` ${output.fmt.brandBold("Notes")}` : ""}`);
|
|
432
|
+
console.log(output.fmt.dim(` ${"─".repeat(COL.id + COL.name + COL.provider + (hasNotes ? 24 : 2))}`));
|
|
433
|
+
for (const m of shown) {
|
|
403
434
|
let notes = "";
|
|
404
435
|
if (m.deprecation) {
|
|
405
436
|
notes = m.deprecation.replaced_by
|
|
406
437
|
? `deprecated → ${m.deprecation.replaced_by}`
|
|
407
438
|
: "deprecated";
|
|
408
439
|
}
|
|
440
|
+
else if (m.private) {
|
|
441
|
+
notes = "Private (TEE)";
|
|
442
|
+
}
|
|
409
443
|
console.log(` ${output.fmt.brand(m.id.padEnd(COL.id))} ${m.name.padEnd(COL.name)} ${output.fmt.dim(m.owned_by.padEnd(COL.provider))} ${notes ? output.fmt.dim(notes) : ""}`);
|
|
410
444
|
}
|
|
411
445
|
console.log();
|
|
412
446
|
output.dim(` Gateway: ${getLlmUrl()}`);
|
|
413
|
-
output.dim(` ${
|
|
447
|
+
output.dim(` ${shown.length} model${shown.length === 1 ? "" : "s"}${opts.private ? " support :private" : " available"}${live ? "" : " (cached)"}`);
|
|
448
|
+
if (!opts.private && shown.some((m) => m.private)) {
|
|
449
|
+
output.dim(" Private (TEE) — append :private to the model id (e.g. glm-5.2:private). List: bankr llm models --private");
|
|
450
|
+
}
|
|
414
451
|
}
|
|
415
452
|
/* ─────────────────────── bankr llm credits ─────────────────────────────────── */
|
|
416
453
|
export async function creditsCommand() {
|
|
@@ -866,15 +903,25 @@ export async function setupOpenclawCommand(opts) {
|
|
|
866
903
|
baseUrl: llmUrl,
|
|
867
904
|
apiKey: llmKey ?? "${BANKR_API_KEY}",
|
|
868
905
|
api: "openai-completions",
|
|
869
|
-
models:
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
906
|
+
// Private models get both entries: the plain id and a `:private`
|
|
907
|
+
// twin that routes through the TEE compute environment — so users can pick either.
|
|
908
|
+
models: activeModels.flatMap((m) => {
|
|
909
|
+
const base = {
|
|
910
|
+
id: m.id,
|
|
911
|
+
name: m.name,
|
|
912
|
+
...(m.owned_by === "anthropic" ? { api: "anthropic-messages" } : {}),
|
|
913
|
+
input: m.input,
|
|
914
|
+
contextWindow: m.contextWindow,
|
|
915
|
+
maxTokens: m.maxTokens,
|
|
916
|
+
cost: m.cost,
|
|
917
|
+
};
|
|
918
|
+
return m.private
|
|
919
|
+
? [
|
|
920
|
+
base,
|
|
921
|
+
{ ...base, id: `${m.id}:private`, name: `${m.name} (Private)` },
|
|
922
|
+
]
|
|
923
|
+
: [base];
|
|
924
|
+
}),
|
|
878
925
|
};
|
|
879
926
|
if (opts.install) {
|
|
880
927
|
const configFile = join(homedir(), ".openclaw", "openclaw.json");
|
|
@@ -904,6 +951,10 @@ export async function setupOpenCodeCommand(opts) {
|
|
|
904
951
|
const modelsObj = {};
|
|
905
952
|
for (const m of activeModels) {
|
|
906
953
|
modelsObj[m.id] = { name: m.name };
|
|
954
|
+
// Private models also expose a `:private` variant (TEE compute environment).
|
|
955
|
+
if (m.private) {
|
|
956
|
+
modelsObj[`${m.id}:private`] = { name: `${m.name} (Private)` };
|
|
957
|
+
}
|
|
907
958
|
}
|
|
908
959
|
const bankrProvider = {
|
|
909
960
|
npm: "@ai-sdk/openai-compatible",
|
|
@@ -936,7 +987,7 @@ export async function setupOpenCodeCommand(opts) {
|
|
|
936
987
|
output.warn("No API key set. Set BANKR_API_KEY env var or run: bankr login");
|
|
937
988
|
}
|
|
938
989
|
output.dim("Add to ~/.config/opencode/opencode.json or run: bankr llm setup opencode --install");
|
|
939
|
-
output.dim("Use bankr/ prefix for models: opencode -m bankr/claude-opus-4.
|
|
990
|
+
output.dim("Use bankr/ prefix for models: opencode -m bankr/claude-opus-4.8");
|
|
940
991
|
}
|
|
941
992
|
/* ──────────────────────── bankr llm setup cursor ──────────────────────────── */
|
|
942
993
|
export async function setupCursorCommand() {
|
|
@@ -946,7 +997,7 @@ export async function setupCursorCommand() {
|
|
|
946
997
|
const { models } = await resolveModels();
|
|
947
998
|
const activeModels = models.filter((m) => !m.deprecation);
|
|
948
999
|
// Pick one model per provider as recommended examples
|
|
949
|
-
const recommendedIds = ["claude-opus-4.
|
|
1000
|
+
const recommendedIds = ["claude-opus-4.8", "gemini-3.1-pro", "gpt-5.2"];
|
|
950
1001
|
const recommended = recommendedIds.filter((id) => activeModels.some((m) => m.id === id));
|
|
951
1002
|
output.brandBold("Cursor — Bankr LLM Gateway");
|
|
952
1003
|
console.log();
|
|
@@ -985,8 +1036,8 @@ export async function setupClaudeCodeCommand() {
|
|
|
985
1036
|
output.dim("Or launch directly: bankr llm claude");
|
|
986
1037
|
console.log();
|
|
987
1038
|
output.info("Model format:");
|
|
988
|
-
output.dim(" Claude Code accepts Anthropic-style IDs (dashed): claude-opus-4-
|
|
989
|
-
output.dim(" `bankr llm claude` auto-translates the dotted form (claude-opus-4.
|
|
1039
|
+
output.dim(" Claude Code accepts Anthropic-style IDs (dashed): claude-opus-4-8, claude-sonnet-4-6.");
|
|
1040
|
+
output.dim(" `bankr llm claude` auto-translates the dotted form (claude-opus-4.8) for you.");
|
|
990
1041
|
}
|
|
991
1042
|
/* ─────────────────────── Shared launcher helpers ────────────────────────── */
|
|
992
1043
|
function requireAuth() {
|
|
@@ -1027,8 +1078,8 @@ function fileContains(filePath, search) {
|
|
|
1027
1078
|
}
|
|
1028
1079
|
/* ─────────────────────────── bankr llm claude ─────────────────────────────── */
|
|
1029
1080
|
/**
|
|
1030
|
-
* Rewrite gateway-canonical Claude IDs (dotted, e.g. `claude-opus-4.
|
|
1031
|
-
* the wire format Claude Code expects (dashed, e.g. `claude-opus-4-
|
|
1081
|
+
* Rewrite gateway-canonical Claude IDs (dotted, e.g. `claude-opus-4.8`) to
|
|
1082
|
+
* the wire format Claude Code expects (dashed, e.g. `claude-opus-4-8`).
|
|
1032
1083
|
* Otherwise Claude Code silently falls back to its default model — the
|
|
1033
1084
|
* `--model` flag appears honored but the real request is a different
|
|
1034
1085
|
* model. Any suffix (e.g. `[1m]` context tier) is preserved.
|
|
@@ -10,6 +10,7 @@ export declare function profileCreateCommand(opts: {
|
|
|
10
10
|
json?: boolean;
|
|
11
11
|
}): Promise<void>;
|
|
12
12
|
export declare function profileUpdateCommand(opts: {
|
|
13
|
+
slug?: string;
|
|
13
14
|
name?: string;
|
|
14
15
|
description?: string;
|
|
15
16
|
token?: string;
|
|
@@ -17,8 +18,11 @@ export declare function profileUpdateCommand(opts: {
|
|
|
17
18
|
website?: string;
|
|
18
19
|
json?: boolean;
|
|
19
20
|
}): Promise<void>;
|
|
20
|
-
export declare function profileDeleteCommand(
|
|
21
|
+
export declare function profileDeleteCommand(opts: {
|
|
22
|
+
slug?: string;
|
|
23
|
+
}): Promise<void>;
|
|
21
24
|
export declare function profileAddUpdateCommand(opts: {
|
|
25
|
+
slug?: string;
|
|
22
26
|
title?: string;
|
|
23
27
|
content?: string;
|
|
24
28
|
json?: boolean;
|
package/dist/commands/profile.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
import { input, confirm } from "@inquirer/prompts";
|
|
3
|
-
import {
|
|
2
|
+
import { input, confirm, select } from "@inquirer/prompts";
|
|
3
|
+
import { getOwnProfiles, createProfile, updateProfile, deleteProfile, addProjectUpdate, } from "../lib/api.js";
|
|
4
4
|
import * as output from "../lib/output.js";
|
|
5
5
|
const BRAND = chalk.hex("#FF613D");
|
|
6
6
|
const DIM = chalk.dim;
|
|
@@ -42,15 +42,41 @@ function printProfile(profile, json) {
|
|
|
42
42
|
}
|
|
43
43
|
console.log();
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolve which profile to operate on.
|
|
47
|
+
* If --slug is provided, use it. Otherwise, if there's exactly one profile, use that.
|
|
48
|
+
* If multiple profiles exist, prompt the user to pick.
|
|
49
|
+
*/
|
|
50
|
+
async function resolveSlug(profiles, slugOpt) {
|
|
51
|
+
if (slugOpt)
|
|
52
|
+
return slugOpt;
|
|
53
|
+
if (profiles.length === 1)
|
|
54
|
+
return profiles[0].slug;
|
|
55
|
+
const choice = await select({
|
|
56
|
+
message: "Which project?",
|
|
57
|
+
choices: profiles.map((p) => ({
|
|
58
|
+
name: `${p.projectName} (${p.slug})`,
|
|
59
|
+
value: p.slug,
|
|
60
|
+
})),
|
|
61
|
+
theme: output.bankrTheme,
|
|
62
|
+
});
|
|
63
|
+
return choice;
|
|
64
|
+
}
|
|
45
65
|
export async function profileViewCommand(opts) {
|
|
46
66
|
try {
|
|
47
|
-
const
|
|
48
|
-
|
|
67
|
+
const profiles = await getOwnProfiles();
|
|
68
|
+
if (!profiles.length) {
|
|
69
|
+
output.info("No profiles found. Create one with: bankr profile create");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
for (const profile of profiles) {
|
|
73
|
+
printProfile(profile, !!opts.json);
|
|
74
|
+
}
|
|
49
75
|
}
|
|
50
76
|
catch (err) {
|
|
51
77
|
const msg = err.message;
|
|
52
78
|
if (msg.includes("404")) {
|
|
53
|
-
output.info("No
|
|
79
|
+
output.info("No profiles found. Create one with: bankr profile create");
|
|
54
80
|
}
|
|
55
81
|
else {
|
|
56
82
|
output.error(msg);
|
|
@@ -126,7 +152,13 @@ export async function profileUpdateCommand(opts) {
|
|
|
126
152
|
output.error("No fields to update. Use flags: --name, --description, --token, --image, --website");
|
|
127
153
|
return;
|
|
128
154
|
}
|
|
129
|
-
const
|
|
155
|
+
const profiles = await getOwnProfiles();
|
|
156
|
+
if (!profiles.length) {
|
|
157
|
+
output.error("No profiles found. Create one first with: bankr profile create");
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const slug = await resolveSlug(profiles, opts.slug);
|
|
161
|
+
const profile = await updateProfile(slug, data);
|
|
130
162
|
output.success("Profile updated!");
|
|
131
163
|
printProfile(profile, !!opts.json);
|
|
132
164
|
}
|
|
@@ -134,10 +166,16 @@ export async function profileUpdateCommand(opts) {
|
|
|
134
166
|
output.error(err.message);
|
|
135
167
|
}
|
|
136
168
|
}
|
|
137
|
-
export async function profileDeleteCommand() {
|
|
169
|
+
export async function profileDeleteCommand(opts) {
|
|
138
170
|
try {
|
|
171
|
+
const profiles = await getOwnProfiles();
|
|
172
|
+
if (!profiles.length) {
|
|
173
|
+
output.error("No profiles found.");
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const slug = await resolveSlug(profiles, opts.slug);
|
|
139
177
|
const yes = await confirm({
|
|
140
|
-
message:
|
|
178
|
+
message: `Are you sure you want to delete "${slug}"?`,
|
|
141
179
|
default: false,
|
|
142
180
|
theme: output.bankrTheme,
|
|
143
181
|
});
|
|
@@ -145,7 +183,7 @@ export async function profileDeleteCommand() {
|
|
|
145
183
|
output.info("Cancelled.");
|
|
146
184
|
return;
|
|
147
185
|
}
|
|
148
|
-
await deleteProfile();
|
|
186
|
+
await deleteProfile(slug);
|
|
149
187
|
output.success("Profile deleted.");
|
|
150
188
|
}
|
|
151
189
|
catch (err) {
|
|
@@ -170,7 +208,13 @@ export async function profileAddUpdateCommand(opts) {
|
|
|
170
208
|
required: true,
|
|
171
209
|
});
|
|
172
210
|
}
|
|
173
|
-
const
|
|
211
|
+
const profiles = await getOwnProfiles();
|
|
212
|
+
if (!profiles.length) {
|
|
213
|
+
output.error("No profiles found. Create one first with: bankr profile create");
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const slug = await resolveSlug(profiles, opts.slug);
|
|
217
|
+
const profile = await addProjectUpdate(slug, { title, content });
|
|
174
218
|
output.success("Project update added!");
|
|
175
219
|
if (opts.json) {
|
|
176
220
|
console.log(JSON.stringify(profile, null, 2));
|
package/dist/commands/prompt.js
CHANGED
package/dist/lib/api.d.ts
CHANGED
|
@@ -384,16 +384,20 @@ export interface AgentProfileResponse {
|
|
|
384
384
|
content: string;
|
|
385
385
|
createdAt: string;
|
|
386
386
|
}>;
|
|
387
|
+
tags?: string[];
|
|
387
388
|
approved: boolean;
|
|
389
|
+
isPublished?: boolean;
|
|
388
390
|
createdAt: string;
|
|
389
391
|
}
|
|
392
|
+
export declare function getOwnProfiles(): Promise<AgentProfileResponse[]>;
|
|
393
|
+
/** @deprecated Use getOwnProfiles() — returns first profile for backward compat */
|
|
390
394
|
export declare function getOwnProfile(): Promise<AgentProfileResponse>;
|
|
391
395
|
export declare function createProfile(data: Record<string, unknown>): Promise<AgentProfileResponse>;
|
|
392
|
-
export declare function updateProfile(data: Record<string, unknown>): Promise<AgentProfileResponse>;
|
|
393
|
-
export declare function deleteProfile(): Promise<{
|
|
396
|
+
export declare function updateProfile(slug: string, data: Record<string, unknown>): Promise<AgentProfileResponse>;
|
|
397
|
+
export declare function deleteProfile(slug: string): Promise<{
|
|
394
398
|
success: boolean;
|
|
395
399
|
}>;
|
|
396
|
-
export declare function addProjectUpdate(data: {
|
|
400
|
+
export declare function addProjectUpdate(slug: string, data: {
|
|
397
401
|
title: string;
|
|
398
402
|
content: string;
|
|
399
403
|
}): Promise<AgentProfileResponse>;
|
package/dist/lib/api.js
CHANGED
|
@@ -260,37 +260,42 @@ export async function claimTokenLaunchFees(tokenAddress) {
|
|
|
260
260
|
});
|
|
261
261
|
return handleResponse(res);
|
|
262
262
|
}
|
|
263
|
-
export async function
|
|
264
|
-
const res = await fetch(`${getApiUrl()}/agent/profile`, {
|
|
263
|
+
export async function getOwnProfiles() {
|
|
264
|
+
const res = await fetch(`${getApiUrl()}/agent/profile?multi=true`, {
|
|
265
265
|
headers: authHeaders(),
|
|
266
266
|
});
|
|
267
267
|
return handleResponse(res);
|
|
268
268
|
}
|
|
269
|
+
/** @deprecated Use getOwnProfiles() — returns first profile for backward compat */
|
|
270
|
+
export async function getOwnProfile() {
|
|
271
|
+
const profiles = await getOwnProfiles();
|
|
272
|
+
return profiles[0];
|
|
273
|
+
}
|
|
269
274
|
export async function createProfile(data) {
|
|
270
|
-
const res = await fetch(`${getApiUrl()}/agent/profile`, {
|
|
275
|
+
const res = await fetch(`${getApiUrl()}/agent/profile?multi=true`, {
|
|
271
276
|
method: "POST",
|
|
272
277
|
headers: authHeaders(),
|
|
273
278
|
body: JSON.stringify(data),
|
|
274
279
|
});
|
|
275
280
|
return handleResponse(res);
|
|
276
281
|
}
|
|
277
|
-
export async function updateProfile(data) {
|
|
278
|
-
const res = await fetch(`${getApiUrl()}/agent/profile`, {
|
|
282
|
+
export async function updateProfile(slug, data) {
|
|
283
|
+
const res = await fetch(`${getApiUrl()}/agent/profile/${encodeURIComponent(slug)}`, {
|
|
279
284
|
method: "PUT",
|
|
280
285
|
headers: authHeaders(),
|
|
281
286
|
body: JSON.stringify(data),
|
|
282
287
|
});
|
|
283
288
|
return handleResponse(res);
|
|
284
289
|
}
|
|
285
|
-
export async function deleteProfile() {
|
|
286
|
-
const res = await fetch(`${getApiUrl()}/agent/profile`, {
|
|
290
|
+
export async function deleteProfile(slug) {
|
|
291
|
+
const res = await fetch(`${getApiUrl()}/agent/profile/${encodeURIComponent(slug)}`, {
|
|
287
292
|
method: "DELETE",
|
|
288
293
|
headers: authHeaders(),
|
|
289
294
|
});
|
|
290
295
|
return handleResponse(res);
|
|
291
296
|
}
|
|
292
|
-
export async function addProjectUpdate(data) {
|
|
293
|
-
const res = await fetch(`${getApiUrl()}/agent/profile/update`, {
|
|
297
|
+
export async function addProjectUpdate(slug, data) {
|
|
298
|
+
const res = await fetch(`${getApiUrl()}/agent/profile/${encodeURIComponent(slug)}/update`, {
|
|
294
299
|
method: "POST",
|
|
295
300
|
headers: authHeaders(),
|
|
296
301
|
body: JSON.stringify(data),
|