fastclaw-cli 0.2.0 → 0.2.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.
- package/README.md +2 -1
- package/dist/index.js +15 -8
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,9 +49,10 @@ fastclaw setup # Interactive one-step bot creation
|
|
|
49
49
|
|
|
50
50
|
fastclaw config set|get|show # Manage local config (~/.fastclaw/config.json)
|
|
51
51
|
|
|
52
|
-
fastclaw admin apps create|list|delete|rotate-token
|
|
52
|
+
fastclaw admin apps create|list [-t]|delete|rotate-token
|
|
53
53
|
|
|
54
54
|
fastclaw bot create|list|get|update|delete
|
|
55
|
+
fastclaw bot list -A [--user-id <uid>] # List bots across all apps (requires admin token)
|
|
55
56
|
fastclaw bot start|stop|restart|status|connect|reset-token <id>
|
|
56
57
|
|
|
57
58
|
fastclaw model add|list|get|delete <bot-id> [provider]
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { dirname, join as join2 } from "path";
|
|
4
7
|
import { Command } from "commander";
|
|
5
8
|
|
|
6
9
|
// src/commands/config-cmd.ts
|
|
@@ -376,7 +379,9 @@ var FastClawClient = class {
|
|
|
376
379
|
return this.request("POST", "/bots", { body: req });
|
|
377
380
|
}
|
|
378
381
|
async listBots(userId) {
|
|
379
|
-
|
|
382
|
+
const query = {};
|
|
383
|
+
if (userId) query.user_id = userId;
|
|
384
|
+
return this.request("GET", "/bots", { query });
|
|
380
385
|
}
|
|
381
386
|
async getBot(id) {
|
|
382
387
|
return this.request("GET", `/bots/${id}`);
|
|
@@ -664,7 +669,7 @@ function registerBotCrudCommands(bot) {
|
|
|
664
669
|
withErrorHandler(async (cmdOpts) => {
|
|
665
670
|
if (cmdOpts.all) {
|
|
666
671
|
const { client: adminClient, cfg } = getAdminClient(bot);
|
|
667
|
-
const userId = cmdOpts.userId
|
|
672
|
+
const userId = cmdOpts.userId;
|
|
668
673
|
const apps = await adminClient.listApps();
|
|
669
674
|
const allBots = [];
|
|
670
675
|
for (const app of apps) {
|
|
@@ -691,13 +696,13 @@ function registerBotCrudCommands(bot) {
|
|
|
691
696
|
console.log(chalk5.dim("No bots found."));
|
|
692
697
|
} else {
|
|
693
698
|
printTable(
|
|
694
|
-
["App", "ID", "Name", "Slug", "Status", "Ready", "Created"],
|
|
695
|
-
allBots.map((x) => [x.app_name, x.bot.id, x.bot.name, x.bot.slug, x.bot.status, x.ready, x.bot.created_at])
|
|
699
|
+
["App", "User", "ID", "Name", "Slug", "Status", "Ready", "Created"],
|
|
700
|
+
allBots.map((x) => [x.app_name, x.bot.user_id, x.bot.id, x.bot.name, x.bot.slug, x.bot.status, x.ready, x.bot.created_at])
|
|
696
701
|
);
|
|
697
702
|
}
|
|
698
703
|
} else {
|
|
699
704
|
const { client, cfg } = getClient2(bot);
|
|
700
|
-
const userId = cmdOpts.userId
|
|
705
|
+
const userId = cmdOpts.userId;
|
|
701
706
|
const list = await client.listBots(userId);
|
|
702
707
|
if (cfg.json) {
|
|
703
708
|
printJson(list);
|
|
@@ -714,9 +719,9 @@ function registerBotCrudCommands(bot) {
|
|
|
714
719
|
} catch {
|
|
715
720
|
}
|
|
716
721
|
}
|
|
717
|
-
rows.push([b.id, b.name, b.slug, b.status, ready, b.created_at]);
|
|
722
|
+
rows.push([b.user_id, b.id, b.name, b.slug, b.status, ready, b.created_at]);
|
|
718
723
|
}
|
|
719
|
-
printTable(["ID", "Name", "Slug", "Status", "Ready", "Created"], rows);
|
|
724
|
+
printTable(["User", "ID", "Name", "Slug", "Status", "Ready", "Created"], rows);
|
|
720
725
|
}
|
|
721
726
|
}
|
|
722
727
|
})
|
|
@@ -1484,7 +1489,9 @@ function registerSetupCommand(program2) {
|
|
|
1484
1489
|
}
|
|
1485
1490
|
|
|
1486
1491
|
// src/index.ts
|
|
1487
|
-
var
|
|
1492
|
+
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1493
|
+
var pkg = JSON.parse(readFileSync3(join2(__dirname, "..", "package.json"), "utf-8"));
|
|
1494
|
+
var program = new Command().name("fastclaw").description("CLI for managing FastClaw bots").version(pkg.version).option("--url <url>", "FastClaw server URL").option("--admin-token <token>", "Admin API token").option("--app-token <token>", "App API token").option("--json", "Output as JSON");
|
|
1488
1495
|
registerSetupCommand(program);
|
|
1489
1496
|
registerConfigCommand(program);
|
|
1490
1497
|
registerAdminCommand(program);
|
package/dist/sdk.d.ts
CHANGED
|
@@ -217,7 +217,7 @@ declare class FastClawClient {
|
|
|
217
217
|
upgradeBot(id: string, req?: UpgradeRequest): Promise<UpgradeResponse>;
|
|
218
218
|
upgradeAllBots(req?: UpgradeRequest): Promise<BulkUpgradeResponse>;
|
|
219
219
|
createBot(req: CreateBotRequest): Promise<Bot>;
|
|
220
|
-
listBots(userId
|
|
220
|
+
listBots(userId?: string): Promise<Bot[]>;
|
|
221
221
|
getBot(id: string): Promise<Bot>;
|
|
222
222
|
updateBot(id: string, req: UpdateBotRequest): Promise<Bot>;
|
|
223
223
|
deleteBot(id: string): Promise<{
|
package/dist/sdk.js
CHANGED
|
@@ -206,7 +206,9 @@ var FastClawClient = class {
|
|
|
206
206
|
return this.request("POST", "/bots", { body: req });
|
|
207
207
|
}
|
|
208
208
|
async listBots(userId) {
|
|
209
|
-
|
|
209
|
+
const query = {};
|
|
210
|
+
if (userId) query.user_id = userId;
|
|
211
|
+
return this.request("GET", "/bots", { query });
|
|
210
212
|
}
|
|
211
213
|
async getBot(id) {
|
|
212
214
|
return this.request("GET", `/bots/${id}`);
|