@chatbotkit/cli 1.26.1 → 1.26.3

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 (122) hide show
  1. package/dist/cjs/command/api/blueprint/index.cjs +81 -0
  2. package/dist/cjs/command/api/blueprint/index.d.ts +8 -0
  3. package/dist/cjs/command/api/bot/index.cjs +61 -0
  4. package/dist/cjs/command/api/bot/index.d.ts +6 -0
  5. package/dist/cjs/command/api/contact/index.cjs +61 -0
  6. package/dist/cjs/command/api/contact/index.d.ts +6 -0
  7. package/dist/cjs/command/api/dataset/file/index.cjs +76 -0
  8. package/dist/cjs/command/api/dataset/file/index.d.ts +7 -0
  9. package/dist/cjs/command/api/dataset/index.cjs +7 -2
  10. package/dist/cjs/command/api/dataset/record/index.cjs +83 -0
  11. package/dist/cjs/command/api/dataset/record/index.d.ts +7 -0
  12. package/dist/cjs/command/api/file/index.cjs +71 -0
  13. package/dist/cjs/command/api/file/index.d.ts +7 -0
  14. package/dist/cjs/command/api/index.cjs +24 -8
  15. package/dist/cjs/command/api/integration/discord/index.cjs +71 -0
  16. package/dist/cjs/command/api/integration/discord/index.d.ts +7 -0
  17. package/dist/cjs/command/api/integration/email/index.cjs +71 -0
  18. package/dist/cjs/command/api/integration/email/index.d.ts +7 -0
  19. package/dist/cjs/command/api/integration/extract/index.cjs +61 -0
  20. package/dist/cjs/command/api/integration/extract/index.d.ts +6 -0
  21. package/dist/cjs/command/api/integration/index.cjs +44 -0
  22. package/dist/cjs/command/api/integration/index.d.ts +3 -0
  23. package/dist/cjs/command/api/integration/instagram/index.cjs +71 -0
  24. package/dist/cjs/command/api/integration/instagram/index.d.ts +7 -0
  25. package/dist/cjs/command/api/integration/mcpserver/index.cjs +61 -0
  26. package/dist/cjs/command/api/integration/mcpserver/index.d.ts +6 -0
  27. package/dist/cjs/command/api/integration/messenger/index.cjs +71 -0
  28. package/dist/cjs/command/api/integration/messenger/index.d.ts +7 -0
  29. package/dist/cjs/command/api/integration/notion/index.cjs +71 -0
  30. package/dist/cjs/command/api/integration/notion/index.d.ts +7 -0
  31. package/dist/cjs/command/api/integration/sitemap/index.cjs +71 -0
  32. package/dist/cjs/command/api/integration/sitemap/index.d.ts +7 -0
  33. package/dist/cjs/command/api/integration/slack/index.cjs +71 -0
  34. package/dist/cjs/command/api/integration/slack/index.d.ts +7 -0
  35. package/dist/cjs/command/api/integration/support/index.cjs +61 -0
  36. package/dist/cjs/command/api/integration/support/index.d.ts +6 -0
  37. package/dist/cjs/command/api/integration/telegram/index.cjs +71 -0
  38. package/dist/cjs/command/api/integration/telegram/index.d.ts +7 -0
  39. package/dist/cjs/command/api/integration/trigger/index.cjs +71 -0
  40. package/dist/cjs/command/api/integration/trigger/index.d.ts +7 -0
  41. package/dist/cjs/command/api/integration/twilio/index.cjs +71 -0
  42. package/dist/cjs/command/api/integration/twilio/index.d.ts +7 -0
  43. package/dist/cjs/command/api/integration/whatsapp/index.cjs +71 -0
  44. package/dist/cjs/command/api/integration/whatsapp/index.d.ts +7 -0
  45. package/dist/cjs/command/api/integration/widget/index.cjs +71 -0
  46. package/dist/cjs/command/api/integration/widget/index.d.ts +7 -0
  47. package/dist/cjs/command/api/memory/index.cjs +79 -0
  48. package/dist/cjs/command/api/memory/index.d.ts +7 -0
  49. package/dist/cjs/command/api/secret/index.cjs +81 -0
  50. package/dist/cjs/command/api/secret/index.d.ts +8 -0
  51. package/dist/cjs/command/api/skillset/ability/index.cjs +83 -0
  52. package/dist/cjs/command/api/skillset/ability/index.d.ts +7 -0
  53. package/dist/cjs/command/api/skillset/index.cjs +5 -2
  54. package/dist/cjs/command/api/team/index.cjs +42 -0
  55. package/dist/cjs/command/api/team/index.d.ts +4 -0
  56. package/dist/cjs/input.cjs +28 -0
  57. package/dist/cjs/input.d.ts +5 -0
  58. package/dist/cjs/solution/index.cjs +1 -1
  59. package/dist/cjs/tools.cjs +5 -186
  60. package/dist/cjs/tools.d.ts +2 -7
  61. package/dist/esm/command/api/blueprint/index.d.ts +8 -0
  62. package/dist/esm/command/api/blueprint/index.js +78 -0
  63. package/dist/esm/command/api/bot/index.d.ts +6 -0
  64. package/dist/esm/command/api/bot/index.js +58 -0
  65. package/dist/esm/command/api/contact/index.d.ts +6 -0
  66. package/dist/esm/command/api/contact/index.js +58 -0
  67. package/dist/esm/command/api/dataset/file/index.d.ts +7 -0
  68. package/dist/esm/command/api/dataset/file/index.js +73 -0
  69. package/dist/esm/command/api/dataset/index.js +4 -0
  70. package/dist/esm/command/api/dataset/record/index.d.ts +7 -0
  71. package/dist/esm/command/api/dataset/record/index.js +80 -0
  72. package/dist/esm/command/api/file/index.d.ts +7 -0
  73. package/dist/esm/command/api/file/index.js +68 -0
  74. package/dist/esm/command/api/index.js +17 -1
  75. package/dist/esm/command/api/integration/discord/index.d.ts +7 -0
  76. package/dist/esm/command/api/integration/discord/index.js +68 -0
  77. package/dist/esm/command/api/integration/email/index.d.ts +7 -0
  78. package/dist/esm/command/api/integration/email/index.js +68 -0
  79. package/dist/esm/command/api/integration/extract/index.d.ts +6 -0
  80. package/dist/esm/command/api/integration/extract/index.js +58 -0
  81. package/dist/esm/command/api/integration/index.d.ts +3 -0
  82. package/dist/esm/command/api/integration/index.js +40 -0
  83. package/dist/esm/command/api/integration/instagram/index.d.ts +7 -0
  84. package/dist/esm/command/api/integration/instagram/index.js +68 -0
  85. package/dist/esm/command/api/integration/mcpserver/index.d.ts +6 -0
  86. package/dist/esm/command/api/integration/mcpserver/index.js +58 -0
  87. package/dist/esm/command/api/integration/messenger/index.d.ts +7 -0
  88. package/dist/esm/command/api/integration/messenger/index.js +68 -0
  89. package/dist/esm/command/api/integration/notion/index.d.ts +7 -0
  90. package/dist/esm/command/api/integration/notion/index.js +68 -0
  91. package/dist/esm/command/api/integration/sitemap/index.d.ts +7 -0
  92. package/dist/esm/command/api/integration/sitemap/index.js +68 -0
  93. package/dist/esm/command/api/integration/slack/index.d.ts +7 -0
  94. package/dist/esm/command/api/integration/slack/index.js +68 -0
  95. package/dist/esm/command/api/integration/support/index.d.ts +6 -0
  96. package/dist/esm/command/api/integration/support/index.js +58 -0
  97. package/dist/esm/command/api/integration/telegram/index.d.ts +7 -0
  98. package/dist/esm/command/api/integration/telegram/index.js +68 -0
  99. package/dist/esm/command/api/integration/trigger/index.d.ts +7 -0
  100. package/dist/esm/command/api/integration/trigger/index.js +68 -0
  101. package/dist/esm/command/api/integration/twilio/index.d.ts +7 -0
  102. package/dist/esm/command/api/integration/twilio/index.js +68 -0
  103. package/dist/esm/command/api/integration/whatsapp/index.d.ts +7 -0
  104. package/dist/esm/command/api/integration/whatsapp/index.js +68 -0
  105. package/dist/esm/command/api/integration/widget/index.d.ts +7 -0
  106. package/dist/esm/command/api/integration/widget/index.js +68 -0
  107. package/dist/esm/command/api/memory/index.d.ts +7 -0
  108. package/dist/esm/command/api/memory/index.js +76 -0
  109. package/dist/esm/command/api/secret/index.d.ts +8 -0
  110. package/dist/esm/command/api/secret/index.js +78 -0
  111. package/dist/esm/command/api/skillset/ability/index.d.ts +7 -0
  112. package/dist/esm/command/api/skillset/ability/index.js +80 -0
  113. package/dist/esm/command/api/skillset/index.js +2 -0
  114. package/dist/esm/command/api/team/index.d.ts +4 -0
  115. package/dist/esm/command/api/team/index.js +39 -0
  116. package/dist/esm/input.d.ts +5 -0
  117. package/dist/esm/input.js +27 -0
  118. package/dist/esm/solution/index.d.ts +78 -72
  119. package/dist/esm/solution/index.js +1 -1
  120. package/dist/esm/tools.d.ts +2 -7
  121. package/dist/esm/tools.js +2 -183
  122. package/package.json +783 -3
@@ -0,0 +1,68 @@
1
+ import { getRUNAS_USERID, getSECRET } from '../../../../env.js';
2
+ import { print } from '../../../../output.js';
3
+ import { WhatsAppIntegrationClient } from '@chatbotkit/sdk/integration/whatsapp/index.js';
4
+ import { Command } from 'commander';
5
+ function getClient() {
6
+ return new WhatsAppIntegrationClient({
7
+ secret: getSECRET(),
8
+ runAsUserId: getRUNAS_USERID(),
9
+ });
10
+ }
11
+ export const whatsappList = new Command()
12
+ .name('list')
13
+ .description('List whatsapp integrations')
14
+ .option('-s, --stream', 'Stream whatsapp integrations')
15
+ .action(async (str, options) => {
16
+ const { stream } = options;
17
+ const client = getClient();
18
+ if (stream) {
19
+ for await (const whatsapp of client.list().stream()) {
20
+ print(whatsapp);
21
+ }
22
+ }
23
+ else {
24
+ const { items } = await client.list();
25
+ for (const whatsapp of items) {
26
+ print(whatsapp);
27
+ }
28
+ }
29
+ });
30
+ export const whatsappFetch = new Command()
31
+ .name('fetch')
32
+ .description('Fetch whatsapp integration')
33
+ .argument('<whatsappId>', 'WhatsApp ID')
34
+ .action(async (whatsappId) => {
35
+ const client = getClient();
36
+ const whatsapp = await client.fetch(whatsappId);
37
+ print(whatsapp);
38
+ });
39
+ export const whatsappDelete = new Command()
40
+ .name('delete')
41
+ .description('Delete whatsapp integration')
42
+ .argument('<whatsappId>', 'WhatsApp ID')
43
+ .action(async (whatsappId) => {
44
+ const client = getClient();
45
+ await client.delete(whatsappId);
46
+ });
47
+ export const whatsappSetup = new Command()
48
+ .name('setup')
49
+ .description('Setup whatsapp integration')
50
+ .argument('<whatsappId>', 'WhatsApp ID')
51
+ .action(async (whatsappId) => {
52
+ const client = getClient();
53
+ const result = await client.setup(whatsappId);
54
+ print(result);
55
+ });
56
+ const commands = {
57
+ list: whatsappList,
58
+ fetch: whatsappFetch,
59
+ delete: whatsappDelete,
60
+ setup: whatsappSetup,
61
+ };
62
+ export const command = new Command()
63
+ .name('whatsapp')
64
+ .description('WhatsApp integration tools for ChatBotKit');
65
+ for (const cmd of Object.values(commands)) {
66
+ command.addCommand(cmd);
67
+ }
68
+ export default command;
@@ -0,0 +1,7 @@
1
+ export const widgetList: Command;
2
+ export const widgetFetch: Command;
3
+ export const widgetDelete: Command;
4
+ export const widgetSetup: Command;
5
+ export const command: Command;
6
+ export default command;
7
+ import { Command } from 'commander';
@@ -0,0 +1,68 @@
1
+ import { getRUNAS_USERID, getSECRET } from '../../../../env.js';
2
+ import { print } from '../../../../output.js';
3
+ import { WidgetIntegrationClient } from '@chatbotkit/sdk/integration/widget/index.js';
4
+ import { Command } from 'commander';
5
+ function getClient() {
6
+ return new WidgetIntegrationClient({
7
+ secret: getSECRET(),
8
+ runAsUserId: getRUNAS_USERID(),
9
+ });
10
+ }
11
+ export const widgetList = new Command()
12
+ .name('list')
13
+ .description('List widget integrations')
14
+ .option('-s, --stream', 'Stream widget integrations')
15
+ .action(async (str, options) => {
16
+ const { stream } = options;
17
+ const client = getClient();
18
+ if (stream) {
19
+ for await (const widget of client.list().stream()) {
20
+ print(widget);
21
+ }
22
+ }
23
+ else {
24
+ const { items } = await client.list();
25
+ for (const widget of items) {
26
+ print(widget);
27
+ }
28
+ }
29
+ });
30
+ export const widgetFetch = new Command()
31
+ .name('fetch')
32
+ .description('Fetch widget integration')
33
+ .argument('<widgetId>', 'Widget ID')
34
+ .action(async (widgetId) => {
35
+ const client = getClient();
36
+ const widget = await client.fetch(widgetId);
37
+ print(widget);
38
+ });
39
+ export const widgetDelete = new Command()
40
+ .name('delete')
41
+ .description('Delete widget integration')
42
+ .argument('<widgetId>', 'Widget ID')
43
+ .action(async (widgetId) => {
44
+ const client = getClient();
45
+ await client.delete(widgetId);
46
+ });
47
+ export const widgetSetup = new Command()
48
+ .name('setup')
49
+ .description('Setup widget integration')
50
+ .argument('<widgetId>', 'Widget ID')
51
+ .action(async (widgetId) => {
52
+ const client = getClient();
53
+ const result = await client.setup(widgetId);
54
+ print(result);
55
+ });
56
+ const commands = {
57
+ list: widgetList,
58
+ fetch: widgetFetch,
59
+ delete: widgetDelete,
60
+ setup: widgetSetup,
61
+ };
62
+ export const command = new Command()
63
+ .name('widget')
64
+ .description('Widget integration tools for ChatBotKit');
65
+ for (const cmd of Object.values(commands)) {
66
+ command.addCommand(cmd);
67
+ }
68
+ export default command;
@@ -0,0 +1,7 @@
1
+ export const memoryList: Command;
2
+ export const memoryFetch: Command;
3
+ export const memoryDelete: Command;
4
+ export const memoryExport: Command;
5
+ export const command: Command;
6
+ export default command;
7
+ import { Command } from 'commander';
@@ -0,0 +1,76 @@
1
+ import { getRUNAS_USERID, getSECRET } from '../../../env.js';
2
+ import { print } from '../../../output.js';
3
+ import { MemoryClient } from '@chatbotkit/sdk/memory/index.js';
4
+ import { Command } from 'commander';
5
+ function getClient() {
6
+ return new MemoryClient({
7
+ secret: getSECRET(),
8
+ runAsUserId: getRUNAS_USERID(),
9
+ });
10
+ }
11
+ export const memoryList = new Command()
12
+ .name('list')
13
+ .description('List memories')
14
+ .option('-s, --stream', 'Stream memories')
15
+ .action(async (str, options) => {
16
+ const { stream } = options;
17
+ const client = getClient();
18
+ if (stream) {
19
+ for await (const memory of client.list().stream()) {
20
+ print(memory);
21
+ }
22
+ }
23
+ else {
24
+ const { items } = await client.list();
25
+ for (const memory of items) {
26
+ print(memory);
27
+ }
28
+ }
29
+ });
30
+ export const memoryFetch = new Command()
31
+ .name('fetch')
32
+ .description('Fetch memory')
33
+ .argument('<memoryId>', 'Memory ID')
34
+ .action(async (memoryId) => {
35
+ const client = getClient();
36
+ const memory = await client.fetch(memoryId);
37
+ print(memory);
38
+ });
39
+ export const memoryDelete = new Command()
40
+ .name('delete')
41
+ .description('Delete memory')
42
+ .argument('<memoryId>', 'Memory ID')
43
+ .action(async (memoryId) => {
44
+ const client = getClient();
45
+ await client.delete(memoryId);
46
+ });
47
+ export const memoryExport = new Command()
48
+ .name('export')
49
+ .description('Export memories')
50
+ .option('-s, --stream', 'Stream exports')
51
+ .action(async (str, options) => {
52
+ const { stream } = options;
53
+ const client = getClient();
54
+ if (stream) {
55
+ for await (const memory of client.export().stream()) {
56
+ print(memory);
57
+ }
58
+ }
59
+ else {
60
+ const result = await client.export();
61
+ print(result);
62
+ }
63
+ });
64
+ const commands = {
65
+ list: memoryList,
66
+ fetch: memoryFetch,
67
+ delete: memoryDelete,
68
+ export: memoryExport,
69
+ };
70
+ export const command = new Command()
71
+ .name('memory')
72
+ .description('Memory tools for ChatBotKit');
73
+ for (const cmd of Object.values(commands)) {
74
+ command.addCommand(cmd);
75
+ }
76
+ export default command;
@@ -0,0 +1,8 @@
1
+ export const secretList: Command;
2
+ export const secretFetch: Command;
3
+ export const secretDelete: Command;
4
+ export const secretRevoke: Command;
5
+ export const secretVerify: Command;
6
+ export const command: Command;
7
+ export default command;
8
+ import { Command } from 'commander';
@@ -0,0 +1,78 @@
1
+ import { getRUNAS_USERID, getSECRET } from '../../../env.js';
2
+ import { print } from '../../../output.js';
3
+ import { SecretClient } from '@chatbotkit/sdk/secret/index.js';
4
+ import { Command } from 'commander';
5
+ function getClient() {
6
+ return new SecretClient({
7
+ secret: getSECRET(),
8
+ runAsUserId: getRUNAS_USERID(),
9
+ });
10
+ }
11
+ export const secretList = new Command()
12
+ .name('list')
13
+ .description('List secrets')
14
+ .option('-s, --stream', 'Stream secrets')
15
+ .action(async (str, options) => {
16
+ const { stream } = options;
17
+ const client = getClient();
18
+ if (stream) {
19
+ for await (const secret of client.list().stream()) {
20
+ print(secret);
21
+ }
22
+ }
23
+ else {
24
+ const { items } = await client.list();
25
+ for (const secret of items) {
26
+ print(secret);
27
+ }
28
+ }
29
+ });
30
+ export const secretFetch = new Command()
31
+ .name('fetch')
32
+ .description('Fetch secret')
33
+ .argument('<secretId>', 'Secret ID')
34
+ .action(async (secretId) => {
35
+ const client = getClient();
36
+ const secret = await client.fetch(secretId);
37
+ print(secret);
38
+ });
39
+ export const secretDelete = new Command()
40
+ .name('delete')
41
+ .description('Delete secret')
42
+ .argument('<secretId>', 'Secret ID')
43
+ .action(async (secretId) => {
44
+ const client = getClient();
45
+ await client.delete(secretId);
46
+ });
47
+ export const secretRevoke = new Command()
48
+ .name('revoke')
49
+ .description('Revoke secret')
50
+ .argument('<secretId>', 'Secret ID')
51
+ .action(async (secretId) => {
52
+ const client = getClient();
53
+ const result = await client.revoke(secretId);
54
+ print(result);
55
+ });
56
+ export const secretVerify = new Command()
57
+ .name('verify')
58
+ .description('Verify secret')
59
+ .argument('<secretId>', 'Secret ID')
60
+ .action(async (secretId) => {
61
+ const client = getClient();
62
+ const result = await client.verify(secretId);
63
+ print(result);
64
+ });
65
+ const commands = {
66
+ list: secretList,
67
+ fetch: secretFetch,
68
+ delete: secretDelete,
69
+ revoke: secretRevoke,
70
+ verify: secretVerify,
71
+ };
72
+ export const command = new Command()
73
+ .name('secret')
74
+ .description('Secret tools for ChatBotKit');
75
+ for (const cmd of Object.values(commands)) {
76
+ command.addCommand(cmd);
77
+ }
78
+ export default command;
@@ -0,0 +1,7 @@
1
+ export const abilityList: Command;
2
+ export const abilityFetch: Command;
3
+ export const abilityDelete: Command;
4
+ export const abilityExport: Command;
5
+ export const command: Command;
6
+ export default command;
7
+ import { Command } from 'commander';
@@ -0,0 +1,80 @@
1
+ import { getRUNAS_USERID, getSECRET } from '../../../../env.js';
2
+ import { print } from '../../../../output.js';
3
+ import { SkillsetAbilityClient } from '@chatbotkit/sdk/skillset/ability/index.js';
4
+ import { Command } from 'commander';
5
+ function getClient() {
6
+ return new SkillsetAbilityClient({
7
+ secret: getSECRET(),
8
+ runAsUserId: getRUNAS_USERID(),
9
+ });
10
+ }
11
+ export const abilityList = new Command()
12
+ .name('list')
13
+ .description('List abilities')
14
+ .option('-s, --stream', 'Stream abilities')
15
+ .argument('<skillsetId>', 'Skillset ID')
16
+ .action(async (skillsetId, options) => {
17
+ const { stream } = options;
18
+ const client = getClient();
19
+ if (stream) {
20
+ for await (const ability of client.list(skillsetId).stream()) {
21
+ print(ability);
22
+ }
23
+ }
24
+ else {
25
+ const { items } = await client.list(skillsetId);
26
+ for (const ability of items) {
27
+ print(ability);
28
+ }
29
+ }
30
+ });
31
+ export const abilityFetch = new Command()
32
+ .name('fetch')
33
+ .description('Fetch ability')
34
+ .argument('<skillsetId>', 'Skillset ID')
35
+ .argument('<abilityId>', 'Ability ID')
36
+ .action(async (skillsetId, abilityId) => {
37
+ const client = getClient();
38
+ const ability = await client.fetch(skillsetId, abilityId);
39
+ print(ability);
40
+ });
41
+ export const abilityDelete = new Command()
42
+ .name('delete')
43
+ .description('Delete ability')
44
+ .argument('<skillsetId>', 'Skillset ID')
45
+ .argument('<abilityId>', 'Ability ID')
46
+ .action(async (skillsetId, abilityId) => {
47
+ const client = getClient();
48
+ await client.delete(skillsetId, abilityId);
49
+ });
50
+ export const abilityExport = new Command()
51
+ .name('export')
52
+ .description('Export abilities')
53
+ .option('-s, --stream', 'Stream exports')
54
+ .argument('<skillsetId>', 'Skillset ID')
55
+ .action(async (skillsetId, options) => {
56
+ const { stream } = options;
57
+ const client = getClient();
58
+ if (stream) {
59
+ for await (const ability of client.export(skillsetId).stream()) {
60
+ print(ability);
61
+ }
62
+ }
63
+ else {
64
+ const result = await client.export(skillsetId);
65
+ print(result);
66
+ }
67
+ });
68
+ const commands = {
69
+ list: abilityList,
70
+ fetch: abilityFetch,
71
+ delete: abilityDelete,
72
+ export: abilityExport,
73
+ };
74
+ export const command = new Command()
75
+ .name('ability')
76
+ .description('Ability tools for ChatBotKit');
77
+ for (const cmd of Object.values(commands)) {
78
+ command.addCommand(cmd);
79
+ }
80
+ export default command;
@@ -1,5 +1,6 @@
1
1
  import { getRUNAS_USERID, getSECRET } from '../../../env.js';
2
2
  import { print } from '../../../output.js';
3
+ import ability from './ability/index.js';
3
4
  import { SkillsetClient } from '@chatbotkit/sdk/skillset/index.js';
4
5
  import { Command } from 'commander';
5
6
  function getClient() {
@@ -48,6 +49,7 @@ const commands = {
48
49
  list: skillsetList,
49
50
  fetch: skillsetFetch,
50
51
  delete: skillsetDelete,
52
+ ability,
51
53
  };
52
54
  export const command = new Command()
53
55
  .name('skillset')
@@ -0,0 +1,4 @@
1
+ export const teamList: Command;
2
+ export const command: Command;
3
+ export default command;
4
+ import { Command } from 'commander';
@@ -0,0 +1,39 @@
1
+ import { getRUNAS_USERID, getSECRET } from '../../../env.js';
2
+ import { print } from '../../../output.js';
3
+ import { TeamClient } from '@chatbotkit/sdk/team/index.js';
4
+ import { Command } from 'commander';
5
+ function getClient() {
6
+ return new TeamClient({
7
+ secret: getSECRET(),
8
+ runAsUserId: getRUNAS_USERID(),
9
+ });
10
+ }
11
+ export const teamList = new Command()
12
+ .name('list')
13
+ .description('List teams')
14
+ .option('-s, --stream', 'Stream teams')
15
+ .action(async (str, options) => {
16
+ const { stream } = options;
17
+ const client = getClient();
18
+ if (stream) {
19
+ for await (const team of client.list().stream()) {
20
+ print(team);
21
+ }
22
+ }
23
+ else {
24
+ const { items } = await client.list();
25
+ for (const team of items) {
26
+ print(team);
27
+ }
28
+ }
29
+ });
30
+ const commands = {
31
+ list: teamList,
32
+ };
33
+ export const command = new Command()
34
+ .name('team')
35
+ .description('Team tools for ChatBotKit');
36
+ for (const cmd of Object.values(commands)) {
37
+ command.addCommand(cmd);
38
+ }
39
+ export default command;
@@ -1,2 +1,7 @@
1
1
  export function confirm(question: string): Promise<boolean>;
2
2
  export function prompt(question: string): Promise<string>;
3
+ export function select(question: string, options: SelectOption[]): Promise<string>;
4
+ export type SelectOption = {
5
+ value: string;
6
+ label: string;
7
+ };
package/dist/esm/input.js CHANGED
@@ -23,3 +23,30 @@ export async function prompt(question) {
23
23
  });
24
24
  });
25
25
  }
26
+ export async function select(question, options) {
27
+ const rl = readline.createInterface({
28
+ input: process.stdin,
29
+ output: process.stdout,
30
+ });
31
+ try {
32
+ while (true) {
33
+ console.log(question);
34
+ options.forEach((option, index) => {
35
+ console.log(` ${index + 1}) ${option.label}`);
36
+ });
37
+ const answer = await new Promise((resolve) => {
38
+ rl.question('Enter your choice (number): ', (input) => {
39
+ resolve(input);
40
+ });
41
+ });
42
+ const index = parseInt((answer), 10) - 1;
43
+ if (index >= 0 && index < options.length) {
44
+ return options[index].value;
45
+ }
46
+ console.log('Invalid choice. Please try again.\n');
47
+ }
48
+ }
49
+ finally {
50
+ rl.close();
51
+ }
52
+ }