fastclaw-cli 0.1.0 → 0.2.1

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 (2) hide show
  1. package/dist/index.js +146 -58
  2. package/package.json +1 -1
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
@@ -534,8 +537,8 @@ function registerAppsCommand(admin) {
534
537
  }
535
538
  })
536
539
  );
537
- apps.command("list").description("List all apps").action(
538
- withErrorHandler(async () => {
540
+ apps.command("list").description("List all apps").option("-t, --show-token", "Show full API token (masked by default)").action(
541
+ withErrorHandler(async (cmdOpts) => {
539
542
  const { client, cfg } = getClient(apps);
540
543
  const list = await client.listApps();
541
544
  if (cfg.json) {
@@ -543,9 +546,16 @@ function registerAppsCommand(admin) {
543
546
  } else if (list.length === 0) {
544
547
  console.log(chalk4.dim("No apps found."));
545
548
  } else {
549
+ const maskToken2 = (token) => token.length > 8 ? token.slice(0, 4) + "****" + token.slice(-4) : "****";
546
550
  printTable(
547
- ["ID", "Name", "Status", "Created"],
548
- list.map((a) => [a.id, a.name, a.status, a.created_at])
551
+ ["ID", "Name", "Token", "Status", "Created"],
552
+ list.map((a) => [
553
+ a.id,
554
+ a.name,
555
+ cmdOpts.showToken ? a.api_token : maskToken2(a.api_token),
556
+ a.status,
557
+ a.created_at
558
+ ])
549
559
  );
550
560
  }
551
561
  })
@@ -583,12 +593,50 @@ function registerAdminCommand(program2) {
583
593
 
584
594
  // src/commands/bot/crud.ts
585
595
  import chalk5 from "chalk";
586
- function getClient2(bot) {
587
- const opts = { ...bot.parent.opts(), ...bot.opts() };
596
+
597
+ // src/commands/bot/resolve.ts
598
+ function getClient2(cmd) {
599
+ const opts = { ...cmd.parent.opts(), ...cmd.opts() };
588
600
  const cfg = resolveConfig(opts);
589
601
  requireOption(cfg.appToken, "app-token");
590
602
  return { client: new FastClawClient({ url: cfg.url, appToken: cfg.appToken }), cfg };
591
603
  }
604
+ function getAdminClient(cmd) {
605
+ const opts = { ...cmd.parent.opts(), ...cmd.opts() };
606
+ const cfg = resolveConfig(opts);
607
+ requireOption(cfg.adminToken, "admin-token");
608
+ return { client: new FastClawClient({ url: cfg.url, adminToken: cfg.adminToken }), cfg };
609
+ }
610
+ async function resolveClientForBot(cmd, botId) {
611
+ const opts = { ...cmd.parent.opts(), ...cmd.opts() };
612
+ const cfg = resolveConfig(opts);
613
+ if (cfg.appToken) {
614
+ try {
615
+ const client = new FastClawClient({ url: cfg.url, appToken: cfg.appToken });
616
+ await client.getBot(botId);
617
+ return { client, cfg };
618
+ } catch {
619
+ }
620
+ }
621
+ if (cfg.adminToken) {
622
+ const adminClient = new FastClawClient({ url: cfg.url, adminToken: cfg.adminToken });
623
+ const apps = await adminClient.listApps();
624
+ for (const app of apps) {
625
+ try {
626
+ const appClient = new FastClawClient({ url: cfg.url, appToken: app.api_token });
627
+ await appClient.getBot(botId);
628
+ return { client: appClient, cfg };
629
+ } catch {
630
+ continue;
631
+ }
632
+ }
633
+ }
634
+ throw new Error(
635
+ `Bot ${botId} not found. Ensure the correct --app-token is set, or provide --admin-token for cross-app lookup.`
636
+ );
637
+ }
638
+
639
+ // src/commands/bot/crud.ts
592
640
  function registerBotCrudCommands(bot) {
593
641
  bot.command("create").description("Create a new bot").requiredOption("-n, --name <name>", "Bot name").option("--slug <slug>", "URL slug").option("--user-id <userId>", "User ID").option("--expires-at <date>", "Expiration date (ISO-8601)").action(
594
642
  withErrorHandler(async (cmdOpts) => {
@@ -615,26 +663,70 @@ function registerBotCrudCommands(bot) {
615
663
  }
616
664
  })
617
665
  );
618
- bot.command("list").description("List bots").option("--user-id <userId>", "User ID").action(
666
+ bot.command("list").description("List bots").option("--user-id <userId>", "User ID").option("-A, --all", "List bots across all apps (requires admin token)").action(
619
667
  withErrorHandler(async (cmdOpts) => {
620
- const { client, cfg } = getClient2(bot);
621
- const userId = cmdOpts.userId || cfg.userId;
622
- const list = await client.listBots(userId);
623
- if (cfg.json) {
624
- printJson(list);
625
- } else if (list.length === 0) {
626
- console.log(chalk5.dim("No bots found."));
668
+ if (cmdOpts.all) {
669
+ const { client: adminClient, cfg } = getAdminClient(bot);
670
+ const userId = cmdOpts.userId || cfg.userId;
671
+ const apps = await adminClient.listApps();
672
+ const allBots = [];
673
+ for (const app of apps) {
674
+ const appClient = new FastClawClient({ url: cfg.url, appToken: app.api_token });
675
+ try {
676
+ const bots = await appClient.listBots(userId);
677
+ for (const b of bots) {
678
+ let ready = "-";
679
+ if (b.status === "running") {
680
+ try {
681
+ const s = await appClient.getBotStatus(b.id);
682
+ ready = s.ready ? "yes" : "no";
683
+ } catch {
684
+ }
685
+ }
686
+ allBots.push({ app_name: app.name, bot: b, ready });
687
+ }
688
+ } catch {
689
+ }
690
+ }
691
+ if (cfg.json) {
692
+ printJson(allBots.map((x) => ({ ...x.bot, app_name: x.app_name, ready: x.ready })));
693
+ } else if (allBots.length === 0) {
694
+ console.log(chalk5.dim("No bots found."));
695
+ } else {
696
+ printTable(
697
+ ["App", "ID", "Name", "Slug", "Status", "Ready", "Created"],
698
+ 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
+ );
700
+ }
627
701
  } else {
628
- printTable(
629
- ["ID", "Name", "Slug", "Status", "Created"],
630
- list.map((b) => [b.id, b.name, b.slug, b.status, b.created_at])
631
- );
702
+ const { client, cfg } = getClient2(bot);
703
+ const userId = cmdOpts.userId || cfg.userId;
704
+ const list = await client.listBots(userId);
705
+ if (cfg.json) {
706
+ printJson(list);
707
+ } else if (list.length === 0) {
708
+ console.log(chalk5.dim("No bots found."));
709
+ } else {
710
+ const rows = [];
711
+ for (const b of list) {
712
+ let ready = "-";
713
+ if (b.status === "running") {
714
+ try {
715
+ const s = await client.getBotStatus(b.id);
716
+ ready = s.ready ? "yes" : "no";
717
+ } catch {
718
+ }
719
+ }
720
+ rows.push([b.id, b.name, b.slug, b.status, ready, b.created_at]);
721
+ }
722
+ printTable(["ID", "Name", "Slug", "Status", "Ready", "Created"], rows);
723
+ }
632
724
  }
633
725
  })
634
726
  );
635
727
  bot.command("get <id>").description("Get bot details").action(
636
728
  withErrorHandler(async (id) => {
637
- const { client, cfg } = getClient2(bot);
729
+ const { client, cfg } = await resolveClientForBot(bot, id);
638
730
  const b = await client.getBot(id);
639
731
  if (cfg.json) {
640
732
  printJson(b);
@@ -658,7 +750,7 @@ function registerBotCrudCommands(bot) {
658
750
  );
659
751
  bot.command("update <id>").description("Update a bot").option("-n, --name <name>", "New name").option("--slug <slug>", "New slug").option("--expires-at <date>", "New expiration date").action(
660
752
  withErrorHandler(async (id, cmdOpts) => {
661
- const { client, cfg } = getClient2(bot);
753
+ const { client, cfg } = await resolveClientForBot(bot, id);
662
754
  const result = await client.updateBot(id, {
663
755
  name: cmdOpts.name,
664
756
  slug: cmdOpts.slug,
@@ -673,7 +765,7 @@ function registerBotCrudCommands(bot) {
673
765
  );
674
766
  bot.command("delete <id>").description("Delete a bot").action(
675
767
  withErrorHandler(async (id) => {
676
- const { client, cfg } = getClient2(bot);
768
+ const { client, cfg } = await resolveClientForBot(bot, id);
677
769
  const res = await client.deleteBot(id);
678
770
  if (cfg.json) {
679
771
  printJson(res);
@@ -686,12 +778,6 @@ function registerBotCrudCommands(bot) {
686
778
 
687
779
  // src/commands/bot/lifecycle.ts
688
780
  import chalk6 from "chalk";
689
- function getClient3(bot) {
690
- const opts = { ...bot.parent.opts(), ...bot.opts() };
691
- const cfg = resolveConfig(opts);
692
- requireOption(cfg.appToken, "app-token");
693
- return { client: new FastClawClient({ url: cfg.url, appToken: cfg.appToken }), cfg };
694
- }
695
781
  function buildBotUrls(baseUrl, slug, accessToken) {
696
782
  const { hostname } = new URL(baseUrl);
697
783
  const webchatUrl = `https://${slug}.${hostname}#token=${accessToken}`;
@@ -701,7 +787,7 @@ function buildBotUrls(baseUrl, slug, accessToken) {
701
787
  function registerBotLifecycleCommands(bot) {
702
788
  bot.command("start <id>").description("Start a bot").option("--wait", "Wait until bot is ready", true).action(
703
789
  withErrorHandler(async (id, cmdOpts) => {
704
- const { client, cfg } = getClient3(bot);
790
+ const { client, cfg } = await resolveClientForBot(bot, id);
705
791
  await client.startBot(id);
706
792
  if (cmdOpts.wait) {
707
793
  const spinner = startSpinner("Waiting for bot to be ready...");
@@ -722,7 +808,7 @@ function registerBotLifecycleCommands(bot) {
722
808
  );
723
809
  bot.command("stop <id>").description("Stop a bot").action(
724
810
  withErrorHandler(async (id) => {
725
- const { client, cfg } = getClient3(bot);
811
+ const { client, cfg } = await resolveClientForBot(bot, id);
726
812
  const res = await client.stopBot(id);
727
813
  if (cfg.json) {
728
814
  printJson(res);
@@ -733,7 +819,7 @@ function registerBotLifecycleCommands(bot) {
733
819
  );
734
820
  bot.command("restart <id>").description("Restart a bot").action(
735
821
  withErrorHandler(async (id) => {
736
- const { client, cfg } = getClient3(bot);
822
+ const { client, cfg } = await resolveClientForBot(bot, id);
737
823
  const res = await client.restartBot(id);
738
824
  if (cfg.json) {
739
825
  printJson(res);
@@ -744,7 +830,7 @@ function registerBotLifecycleCommands(bot) {
744
830
  );
745
831
  bot.command("status <id>").description("Get bot status").action(
746
832
  withErrorHandler(async (id) => {
747
- const { client, cfg } = getClient3(bot);
833
+ const { client, cfg } = await resolveClientForBot(bot, id);
748
834
  const s = await client.getBotStatus(id);
749
835
  const urls = s.status === "running" && s.ready ? await client.getBot(id).then((b) => buildBotUrls(cfg.url, b.slug, b.access_token)) : null;
750
836
  if (cfg.json) {
@@ -772,7 +858,7 @@ function registerBotLifecycleCommands(bot) {
772
858
  );
773
859
  bot.command("connect <id>").description("Get bot connection info").action(
774
860
  withErrorHandler(async (id) => {
775
- const { client, cfg } = getClient3(bot);
861
+ const { client, cfg } = await resolveClientForBot(bot, id);
776
862
  const [c, b] = await Promise.all([client.getBotConnect(id), client.getBot(id)]);
777
863
  const urls = buildBotUrls(cfg.url, b.slug, b.access_token);
778
864
  if (cfg.json) {
@@ -793,7 +879,7 @@ function registerBotLifecycleCommands(bot) {
793
879
  );
794
880
  bot.command("reset-token <id>").description("Reset bot access token").action(
795
881
  withErrorHandler(async (id) => {
796
- const { client, cfg } = getClient3(bot);
882
+ const { client, cfg } = await resolveClientForBot(bot, id);
797
883
  const res = await client.resetBotToken(id);
798
884
  if (cfg.json) {
799
885
  printJson(res);
@@ -831,7 +917,7 @@ async function promptSelect(message, choices) {
831
917
  }
832
918
 
833
919
  // src/commands/model/provider.ts
834
- function getClient4(model) {
920
+ function getClient3(model) {
835
921
  const opts = model.parent.opts();
836
922
  const cfg = resolveConfig(opts);
837
923
  requireOption(cfg.appToken, "app-token");
@@ -840,7 +926,7 @@ function getClient4(model) {
840
926
  function registerModelProviderCommands(model) {
841
927
  model.command("add <bot-id>").description("Add a model provider (interactive or preset)").option("-p, --provider <name>", "Provider name or preset (google/anthropic/openai)").option("-k, --api-key <key>", "API key").action(
842
928
  withErrorHandler(async (botId, cmdOpts) => {
843
- const { client, cfg } = getClient4(model);
929
+ const { client, cfg } = getClient3(model);
844
930
  let providerName = cmdOpts.provider;
845
931
  let apiKey = cmdOpts.apiKey;
846
932
  if (!providerName) {
@@ -883,7 +969,7 @@ function registerModelProviderCommands(model) {
883
969
  );
884
970
  model.command("list <bot-id>").description("List model providers").action(
885
971
  withErrorHandler(async (botId) => {
886
- const { client, cfg } = getClient4(model);
972
+ const { client, cfg } = getClient3(model);
887
973
  const providers = await client.listProviders(botId);
888
974
  if (cfg.json) {
889
975
  printJson(providers);
@@ -901,7 +987,7 @@ function registerModelProviderCommands(model) {
901
987
  );
902
988
  model.command("get <bot-id> <provider>").description("Get provider details").action(
903
989
  withErrorHandler(async (botId, provider) => {
904
- const { client, cfg } = getClient4(model);
990
+ const { client, cfg } = getClient3(model);
905
991
  const p = await client.getProvider(botId, provider);
906
992
  if (cfg.json) {
907
993
  printJson(p);
@@ -917,7 +1003,7 @@ function registerModelProviderCommands(model) {
917
1003
  );
918
1004
  model.command("delete <bot-id> <provider>").description("Delete a model provider").action(
919
1005
  withErrorHandler(async (botId, provider) => {
920
- const { client, cfg } = getClient4(model);
1006
+ const { client, cfg } = getClient3(model);
921
1007
  await client.deleteProvider(botId, provider);
922
1008
  if (cfg.json) {
923
1009
  printJson({ message: "deleted" });
@@ -929,7 +1015,7 @@ function registerModelProviderCommands(model) {
929
1015
  const defaults = model.command("defaults").description("Manage default model settings");
930
1016
  defaults.command("get <bot-id>").description("Get default model settings").action(
931
1017
  withErrorHandler(async (botId) => {
932
- const { client, cfg } = getClient4(model);
1018
+ const { client, cfg } = getClient3(model);
933
1019
  const d = await client.getDefaults(botId);
934
1020
  if (cfg.json) {
935
1021
  printJson(d);
@@ -943,7 +1029,7 @@ function registerModelProviderCommands(model) {
943
1029
  );
944
1030
  defaults.command("set <bot-id>").description("Set default model").option("--primary <model>", "Primary model (provider/model_id)").option("--fallback <model>", "Fallback model").action(
945
1031
  withErrorHandler(async (botId, cmdOpts) => {
946
- const { client, cfg } = getClient4(model);
1032
+ const { client, cfg } = getClient3(model);
947
1033
  const body = {};
948
1034
  if (cmdOpts.primary) body.primary_model = cmdOpts.primary;
949
1035
  if (cmdOpts.fallback) body.fallback_model = cmdOpts.fallback;
@@ -969,7 +1055,7 @@ function registerModelCommand(program2) {
969
1055
 
970
1056
  // src/commands/channel/crud.ts
971
1057
  import chalk8 from "chalk";
972
- function getClient5(parent) {
1058
+ function getClient4(parent) {
973
1059
  const opts = parent.parent.opts();
974
1060
  const cfg = resolveConfig(opts);
975
1061
  requireOption(cfg.appToken, "app-token");
@@ -978,7 +1064,7 @@ function getClient5(parent) {
978
1064
  function registerChannelCrudCommands(channel) {
979
1065
  channel.command("add <bot-id>").description("Add an IM channel").option("-c, --channel <type>", "Channel type (feishu/telegram/slack/discord)").option("--account <name>", "Account name", "default").option("--dm-policy <policy>", "DM policy (open/pairing/allowlist/disabled)").option("--group-policy <policy>", "Group policy (open/allowlist/disabled)").action(
980
1066
  withErrorHandler(async (botId, cmdOpts) => {
981
- const { client, cfg } = getClient5(channel);
1067
+ const { client, cfg } = getClient4(channel);
982
1068
  let channelType = cmdOpts.channel;
983
1069
  if (!channelType) {
984
1070
  channelType = await promptSelect("Channel type:", [
@@ -1019,7 +1105,7 @@ function registerChannelCrudCommands(channel) {
1019
1105
  );
1020
1106
  channel.command("list <bot-id>").description("List channels").action(
1021
1107
  withErrorHandler(async (botId) => {
1022
- const { client, cfg } = getClient5(channel);
1108
+ const { client, cfg } = getClient4(channel);
1023
1109
  const channels = await client.listChannels(botId);
1024
1110
  if (cfg.json) {
1025
1111
  printJson(channels);
@@ -1038,7 +1124,7 @@ function registerChannelCrudCommands(channel) {
1038
1124
  );
1039
1125
  channel.command("remove <bot-id> <channel>").description("Remove a channel").option("--account <name>", "Specific account to remove").action(
1040
1126
  withErrorHandler(async (botId, ch, cmdOpts) => {
1041
- const { client, cfg } = getClient5(channel);
1127
+ const { client, cfg } = getClient4(channel);
1042
1128
  const result = await client.removeChannel(botId, ch, cmdOpts.account);
1043
1129
  if (cfg.json) {
1044
1130
  printJson(result);
@@ -1050,7 +1136,7 @@ function registerChannelCrudCommands(channel) {
1050
1136
  }
1051
1137
 
1052
1138
  // src/commands/channel/pairing.ts
1053
- function getClient6(parent) {
1139
+ function getClient5(parent) {
1054
1140
  const root = parent.parent.parent;
1055
1141
  const opts = root.opts();
1056
1142
  const cfg = resolveConfig(opts);
@@ -1061,7 +1147,7 @@ function registerPairingCommands(channel) {
1061
1147
  const pairing = channel.command("pairing").description("Manage channel pairing");
1062
1148
  pairing.command("list <bot-id> <channel>").description("List pairing requests").action(
1063
1149
  withErrorHandler(async (botId, ch) => {
1064
- const { client, cfg } = getClient6(pairing);
1150
+ const { client, cfg } = getClient5(pairing);
1065
1151
  const list = await client.listPairing(botId, ch);
1066
1152
  if (cfg.json) {
1067
1153
  printJson(list);
@@ -1072,7 +1158,7 @@ function registerPairingCommands(channel) {
1072
1158
  );
1073
1159
  pairing.command("approve <bot-id> <channel>").description("Approve a pairing request").requiredOption("--code <code>", "Pairing code").action(
1074
1160
  withErrorHandler(async (botId, ch, cmdOpts) => {
1075
- const { client, cfg } = getClient6(pairing);
1161
+ const { client, cfg } = getClient5(pairing);
1076
1162
  const result = await client.approvePairing(botId, ch, { code: cmdOpts.code });
1077
1163
  if (cfg.json) {
1078
1164
  printJson(result);
@@ -1083,7 +1169,7 @@ function registerPairingCommands(channel) {
1083
1169
  );
1084
1170
  pairing.command("revoke <bot-id> <channel>").description("Revoke a user's pairing").requiredOption("--user-id <userId>", "User ID to revoke").action(
1085
1171
  withErrorHandler(async (botId, ch, cmdOpts) => {
1086
- const { client, cfg } = getClient6(pairing);
1172
+ const { client, cfg } = getClient5(pairing);
1087
1173
  const result = await client.revokePairing(botId, ch, { user_id: cmdOpts.userId });
1088
1174
  if (cfg.json) {
1089
1175
  printJson(result);
@@ -1094,7 +1180,7 @@ function registerPairingCommands(channel) {
1094
1180
  );
1095
1181
  pairing.command("users <bot-id> <channel>").description("List paired users").action(
1096
1182
  withErrorHandler(async (botId, ch) => {
1097
- const { client, cfg } = getClient6(pairing);
1183
+ const { client, cfg } = getClient5(pairing);
1098
1184
  const result = await client.listPairedUsers(botId, ch);
1099
1185
  if (cfg.json) {
1100
1186
  printJson(result);
@@ -1114,7 +1200,7 @@ function registerChannelCommand(program2) {
1114
1200
 
1115
1201
  // src/commands/device/crud.ts
1116
1202
  import chalk9 from "chalk";
1117
- function getClient7(device) {
1203
+ function getClient6(device) {
1118
1204
  const opts = device.parent.opts();
1119
1205
  const cfg = resolveConfig(opts);
1120
1206
  requireOption(cfg.appToken, "app-token");
@@ -1123,7 +1209,7 @@ function getClient7(device) {
1123
1209
  function registerDeviceCrudCommands(device) {
1124
1210
  device.command("list <bot-id>").description("List devices").option("--status <status>", "Filter by status (pending/paired)").option("--client-mode <mode>", "Filter by client mode (web/cli/desktop)").action(
1125
1211
  withErrorHandler(async (botId, cmdOpts) => {
1126
- const { client, cfg } = getClient7(device);
1212
+ const { client, cfg } = getClient6(device);
1127
1213
  const result = await client.listDevices(botId, {
1128
1214
  status: cmdOpts.status,
1129
1215
  client_mode: cmdOpts.clientMode
@@ -1150,7 +1236,7 @@ function registerDeviceCrudCommands(device) {
1150
1236
  );
1151
1237
  device.command("approve <bot-id> <request-id>").description("Approve a device pairing request").action(
1152
1238
  withErrorHandler(async (botId, requestId) => {
1153
- const { client, cfg } = getClient7(device);
1239
+ const { client, cfg } = getClient6(device);
1154
1240
  const result = await client.approveDevice(botId, requestId);
1155
1241
  if (cfg.json) {
1156
1242
  printJson(result);
@@ -1161,7 +1247,7 @@ function registerDeviceCrudCommands(device) {
1161
1247
  );
1162
1248
  device.command("revoke <bot-id> <device-id>").description("Revoke a paired device").option("--role <role>", "Role to revoke", "operator").action(
1163
1249
  withErrorHandler(async (botId, deviceId, cmdOpts) => {
1164
- const { client, cfg } = getClient7(device);
1250
+ const { client, cfg } = getClient6(device);
1165
1251
  const result = await client.revokeDevice(botId, deviceId, cmdOpts.role);
1166
1252
  if (cfg.json) {
1167
1253
  printJson(result);
@@ -1181,7 +1267,7 @@ function registerDeviceCommand(program2) {
1181
1267
  // src/commands/skill/crud.ts
1182
1268
  import { readFileSync as readFileSync2 } from "fs";
1183
1269
  import chalk10 from "chalk";
1184
- function getClient8(skill) {
1270
+ function getClient7(skill) {
1185
1271
  const opts = skill.parent.opts();
1186
1272
  const cfg = resolveConfig(opts);
1187
1273
  requireOption(cfg.appToken, "app-token");
@@ -1190,7 +1276,7 @@ function getClient8(skill) {
1190
1276
  function registerSkillCrudCommands(skill) {
1191
1277
  skill.command("list <bot-id>").description("List skills").action(
1192
1278
  withErrorHandler(async (botId) => {
1193
- const { client, cfg } = getClient8(skill);
1279
+ const { client, cfg } = getClient7(skill);
1194
1280
  const list = await client.listSkills(botId);
1195
1281
  if (cfg.json) {
1196
1282
  printJson(list);
@@ -1203,7 +1289,7 @@ function registerSkillCrudCommands(skill) {
1203
1289
  );
1204
1290
  skill.command("set <bot-id> <name>").description("Create or update a skill").option("-c, --content <content>", "Skill content (markdown)").option("-f, --file <path>", "Read content from file").action(
1205
1291
  withErrorHandler(async (botId, name, cmdOpts) => {
1206
- const { client, cfg } = getClient8(skill);
1292
+ const { client, cfg } = getClient7(skill);
1207
1293
  let content;
1208
1294
  if (cmdOpts.file) {
1209
1295
  content = readFileSync2(cmdOpts.file, "utf-8");
@@ -1222,7 +1308,7 @@ function registerSkillCrudCommands(skill) {
1222
1308
  );
1223
1309
  skill.command("delete <bot-id> <name>").description("Delete a skill").action(
1224
1310
  withErrorHandler(async (botId, name) => {
1225
- const { client, cfg } = getClient8(skill);
1311
+ const { client, cfg } = getClient7(skill);
1226
1312
  const result = await client.deleteSkill(botId, name);
1227
1313
  if (cfg.json) {
1228
1314
  printJson(result);
@@ -1401,7 +1487,9 @@ function registerSetupCommand(program2) {
1401
1487
  }
1402
1488
 
1403
1489
  // src/index.ts
1404
- var program = new Command().name("fastclaw").description("CLI for managing FastClaw bots").version("0.1.0").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");
1490
+ var __dirname = dirname(fileURLToPath(import.meta.url));
1491
+ var pkg = JSON.parse(readFileSync3(join2(__dirname, "..", "package.json"), "utf-8"));
1492
+ 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");
1405
1493
  registerSetupCommand(program);
1406
1494
  registerConfigCommand(program);
1407
1495
  registerAdminCommand(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastclaw-cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "CLI and SDK for managing FastClaw bots",
5
5
  "type": "module",
6
6
  "main": "dist/sdk.js",