agent-messenger 1.3.0 → 1.3.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.
Files changed (236) hide show
  1. package/.claude-plugin/marketplace.json +27 -1
  2. package/.claude-plugin/plugin.json +17 -4
  3. package/.env.template +3 -0
  4. package/.github/workflows/release.yml +80 -0
  5. package/AGENTS.md +48 -0
  6. package/README.md +25 -20
  7. package/biome.json +15 -39
  8. package/bun.lock +69 -0
  9. package/dist/package.json +10 -3
  10. package/dist/src/cli.d.ts.map +1 -1
  11. package/dist/src/cli.js +1 -4
  12. package/dist/src/cli.js.map +1 -1
  13. package/dist/src/platforms/discord/client.d.ts.map +1 -1
  14. package/dist/src/platforms/discord/client.js.map +1 -1
  15. package/dist/src/platforms/discord/commands/auth.d.ts.map +1 -1
  16. package/dist/src/platforms/discord/commands/auth.js.map +1 -1
  17. package/dist/src/platforms/discord/commands/channel.d.ts.map +1 -1
  18. package/dist/src/platforms/discord/commands/channel.js.map +1 -1
  19. package/dist/src/platforms/discord/commands/dm.d.ts.map +1 -1
  20. package/dist/src/platforms/discord/commands/dm.js.map +1 -1
  21. package/dist/src/platforms/discord/commands/file.d.ts.map +1 -1
  22. package/dist/src/platforms/discord/commands/file.js +1 -4
  23. package/dist/src/platforms/discord/commands/file.js.map +1 -1
  24. package/dist/src/platforms/discord/commands/friend.d.ts.map +1 -1
  25. package/dist/src/platforms/discord/commands/friend.js +1 -3
  26. package/dist/src/platforms/discord/commands/friend.js.map +1 -1
  27. package/dist/src/platforms/discord/commands/member.d.ts.map +1 -1
  28. package/dist/src/platforms/discord/commands/member.js.map +1 -1
  29. package/dist/src/platforms/discord/commands/mention.d.ts.map +1 -1
  30. package/dist/src/platforms/discord/commands/mention.js.map +1 -1
  31. package/dist/src/platforms/discord/commands/message.d.ts.map +1 -1
  32. package/dist/src/platforms/discord/commands/message.js.map +1 -1
  33. package/dist/src/platforms/discord/commands/note.d.ts.map +1 -1
  34. package/dist/src/platforms/discord/commands/note.js.map +1 -1
  35. package/dist/src/platforms/discord/commands/profile.d.ts.map +1 -1
  36. package/dist/src/platforms/discord/commands/profile.js.map +1 -1
  37. package/dist/src/platforms/discord/commands/reaction.d.ts.map +1 -1
  38. package/dist/src/platforms/discord/commands/reaction.js.map +1 -1
  39. package/dist/src/platforms/discord/commands/server.d.ts.map +1 -1
  40. package/dist/src/platforms/discord/commands/server.js.map +1 -1
  41. package/dist/src/platforms/discord/commands/snapshot.d.ts.map +1 -1
  42. package/dist/src/platforms/discord/commands/snapshot.js.map +1 -1
  43. package/dist/src/platforms/discord/commands/thread.d.ts.map +1 -1
  44. package/dist/src/platforms/discord/commands/thread.js.map +1 -1
  45. package/dist/src/platforms/discord/commands/user.d.ts.map +1 -1
  46. package/dist/src/platforms/discord/commands/user.js.map +1 -1
  47. package/dist/src/platforms/discord/credential-manager.d.ts.map +1 -1
  48. package/dist/src/platforms/discord/credential-manager.js.map +1 -1
  49. package/dist/src/platforms/discord/token-extractor.d.ts.map +1 -1
  50. package/dist/src/platforms/discord/token-extractor.js +2 -7
  51. package/dist/src/platforms/discord/token-extractor.js.map +1 -1
  52. package/dist/src/platforms/slack/client.d.ts.map +1 -1
  53. package/dist/src/platforms/slack/client.js +2 -0
  54. package/dist/src/platforms/slack/client.js.map +1 -1
  55. package/dist/src/platforms/slack/commands/activity.d.ts.map +1 -1
  56. package/dist/src/platforms/slack/commands/activity.js.map +1 -1
  57. package/dist/src/platforms/slack/commands/auth.d.ts.map +1 -1
  58. package/dist/src/platforms/slack/commands/auth.js.map +1 -1
  59. package/dist/src/platforms/slack/commands/channel.d.ts.map +1 -1
  60. package/dist/src/platforms/slack/commands/channel.js.map +1 -1
  61. package/dist/src/platforms/slack/commands/drafts.d.ts.map +1 -1
  62. package/dist/src/platforms/slack/commands/drafts.js.map +1 -1
  63. package/dist/src/platforms/slack/commands/file.d.ts.map +1 -1
  64. package/dist/src/platforms/slack/commands/file.js +1 -4
  65. package/dist/src/platforms/slack/commands/file.js.map +1 -1
  66. package/dist/src/platforms/slack/commands/message.d.ts.map +1 -1
  67. package/dist/src/platforms/slack/commands/message.js.map +1 -1
  68. package/dist/src/platforms/slack/commands/reaction.d.ts.map +1 -1
  69. package/dist/src/platforms/slack/commands/reaction.js +1 -2
  70. package/dist/src/platforms/slack/commands/reaction.js.map +1 -1
  71. package/dist/src/platforms/slack/commands/saved.d.ts.map +1 -1
  72. package/dist/src/platforms/slack/commands/saved.js.map +1 -1
  73. package/dist/src/platforms/slack/commands/sections.d.ts.map +1 -1
  74. package/dist/src/platforms/slack/commands/sections.js.map +1 -1
  75. package/dist/src/platforms/slack/commands/snapshot.d.ts.map +1 -1
  76. package/dist/src/platforms/slack/commands/snapshot.js.map +1 -1
  77. package/dist/src/platforms/slack/commands/unread.d.ts.map +1 -1
  78. package/dist/src/platforms/slack/commands/unread.js.map +1 -1
  79. package/dist/src/platforms/slack/commands/user.d.ts.map +1 -1
  80. package/dist/src/platforms/slack/commands/user.js.map +1 -1
  81. package/dist/src/platforms/slack/commands/workspace.d.ts.map +1 -1
  82. package/dist/src/platforms/slack/commands/workspace.js.map +1 -1
  83. package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
  84. package/dist/src/platforms/slack/token-extractor.js +4 -5
  85. package/dist/src/platforms/slack/token-extractor.js.map +1 -1
  86. package/dist/src/platforms/slack/types.d.ts +24 -0
  87. package/dist/src/platforms/slack/types.d.ts.map +1 -1
  88. package/dist/src/platforms/slack/types.js +7 -0
  89. package/dist/src/platforms/slack/types.js.map +1 -1
  90. package/dist/src/platforms/slackbot/cli.d.ts.map +1 -1
  91. package/dist/src/platforms/slackbot/cli.js +1 -1
  92. package/dist/src/platforms/slackbot/cli.js.map +1 -1
  93. package/dist/src/platforms/slackbot/client.d.ts.map +1 -1
  94. package/dist/src/platforms/slackbot/client.js.map +1 -1
  95. package/dist/src/platforms/slackbot/commands/auth.js.map +1 -1
  96. package/dist/src/platforms/slackbot/commands/channel.js.map +1 -1
  97. package/dist/src/platforms/slackbot/commands/message.d.ts.map +1 -1
  98. package/dist/src/platforms/slackbot/commands/message.js.map +1 -1
  99. package/dist/src/platforms/slackbot/commands/reaction.d.ts.map +1 -1
  100. package/dist/src/platforms/slackbot/commands/reaction.js.map +1 -1
  101. package/dist/src/platforms/slackbot/commands/shared.d.ts.map +1 -1
  102. package/dist/src/platforms/slackbot/commands/shared.js.map +1 -1
  103. package/dist/src/platforms/slackbot/commands/user.js.map +1 -1
  104. package/dist/src/platforms/slackbot/credential-manager.d.ts.map +1 -1
  105. package/dist/src/platforms/slackbot/credential-manager.js +2 -4
  106. package/dist/src/platforms/slackbot/credential-manager.js.map +1 -1
  107. package/dist/src/platforms/teams/client.d.ts.map +1 -1
  108. package/dist/src/platforms/teams/client.js.map +1 -1
  109. package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -1
  110. package/dist/src/platforms/teams/commands/auth.js.map +1 -1
  111. package/dist/src/platforms/teams/commands/channel.d.ts.map +1 -1
  112. package/dist/src/platforms/teams/commands/channel.js.map +1 -1
  113. package/dist/src/platforms/teams/commands/file.d.ts.map +1 -1
  114. package/dist/src/platforms/teams/commands/file.js.map +1 -1
  115. package/dist/src/platforms/teams/commands/message.d.ts.map +1 -1
  116. package/dist/src/platforms/teams/commands/message.js.map +1 -1
  117. package/dist/src/platforms/teams/commands/reaction.d.ts.map +1 -1
  118. package/dist/src/platforms/teams/commands/reaction.js.map +1 -1
  119. package/dist/src/platforms/teams/commands/snapshot.d.ts.map +1 -1
  120. package/dist/src/platforms/teams/commands/snapshot.js.map +1 -1
  121. package/dist/src/platforms/teams/commands/team.d.ts.map +1 -1
  122. package/dist/src/platforms/teams/commands/team.js +1 -4
  123. package/dist/src/platforms/teams/commands/team.js.map +1 -1
  124. package/dist/src/platforms/teams/commands/user.d.ts.map +1 -1
  125. package/dist/src/platforms/teams/commands/user.js.map +1 -1
  126. package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -1
  127. package/dist/src/platforms/teams/token-extractor.js +3 -1
  128. package/dist/src/platforms/teams/token-extractor.js.map +1 -1
  129. package/docs/content/docs/agent-skills.mdx +4 -4
  130. package/docs/content/docs/index.mdx +11 -18
  131. package/docs/content/docs/integrations/discord.mdx +65 -1
  132. package/docs/content/docs/integrations/slack.mdx +51 -1
  133. package/docs/content/docs/integrations/slackbot.mdx +11 -1
  134. package/docs/content/docs/integrations/teams.mdx +4 -1
  135. package/docs/content/docs/quick-start.mdx +3 -2
  136. package/docs/src/app/icon.png +0 -0
  137. package/docs/src/app/layout.config.tsx +8 -1
  138. package/package.json +16 -9
  139. package/scripts/prepublish.ts +11 -0
  140. package/skills/agent-discord/SKILL.md +14 -0
  141. package/skills/agent-slack/SKILL.md +14 -0
  142. package/skills/agent-slackbot/SKILL.md +14 -0
  143. package/skills/agent-teams/SKILL.md +14 -0
  144. package/src/cli.ts +1 -4
  145. package/src/platforms/discord/client.test.ts +6 -14
  146. package/src/platforms/discord/client.ts +12 -34
  147. package/src/platforms/discord/commands/auth.test.ts +2 -7
  148. package/src/platforms/discord/commands/auth.ts +14 -19
  149. package/src/platforms/discord/commands/channel.test.ts +18 -20
  150. package/src/platforms/discord/commands/channel.ts +9 -18
  151. package/src/platforms/discord/commands/dm.test.ts +1 -3
  152. package/src/platforms/discord/commands/dm.ts +6 -10
  153. package/src/platforms/discord/commands/file.ts +10 -23
  154. package/src/platforms/discord/commands/friend.ts +33 -35
  155. package/src/platforms/discord/commands/member.ts +5 -7
  156. package/src/platforms/discord/commands/mention.ts +5 -11
  157. package/src/platforms/discord/commands/message.test.ts +1 -3
  158. package/src/platforms/discord/commands/message.ts +23 -61
  159. package/src/platforms/discord/commands/note.ts +7 -15
  160. package/src/platforms/discord/commands/profile.ts +4 -6
  161. package/src/platforms/discord/commands/reaction.test.ts +1 -3
  162. package/src/platforms/discord/commands/reaction.ts +19 -29
  163. package/src/platforms/discord/commands/server.test.ts +14 -18
  164. package/src/platforms/discord/commands/server.ts +9 -15
  165. package/src/platforms/discord/commands/snapshot.ts +5 -7
  166. package/src/platforms/discord/commands/thread.ts +8 -15
  167. package/src/platforms/discord/commands/user.ts +9 -20
  168. package/src/platforms/discord/credential-manager.test.ts +2 -2
  169. package/src/platforms/discord/credential-manager.ts +1 -3
  170. package/src/platforms/discord/token-extractor.test.ts +28 -57
  171. package/src/platforms/discord/token-extractor.ts +10 -30
  172. package/src/platforms/discord/types.ts +1 -1
  173. package/src/platforms/slack/client.test.ts +14 -20
  174. package/src/platforms/slack/client.ts +6 -11
  175. package/src/platforms/slack/commands/activity.test.ts +3 -9
  176. package/src/platforms/slack/commands/activity.ts +7 -12
  177. package/src/platforms/slack/commands/auth.test.ts +2 -2
  178. package/src/platforms/slack/commands/auth.ts +15 -31
  179. package/src/platforms/slack/commands/channel.ts +10 -32
  180. package/src/platforms/slack/commands/drafts.ts +5 -14
  181. package/src/platforms/slack/commands/file.ts +9 -29
  182. package/src/platforms/slack/commands/message.ts +23 -67
  183. package/src/platforms/slack/commands/reaction.test.ts +37 -33
  184. package/src/platforms/slack/commands/reaction.ts +21 -51
  185. package/src/platforms/slack/commands/saved.ts +5 -14
  186. package/src/platforms/slack/commands/sections.ts +4 -11
  187. package/src/platforms/slack/commands/snapshot.test.ts +1 -3
  188. package/src/platforms/slack/commands/snapshot.ts +5 -10
  189. package/src/platforms/slack/commands/unread.test.ts +6 -8
  190. package/src/platforms/slack/commands/unread.ts +10 -33
  191. package/src/platforms/slack/commands/user.test.ts +1 -4
  192. package/src/platforms/slack/commands/user.ts +6 -8
  193. package/src/platforms/slack/commands/workspace.test.ts +1 -1
  194. package/src/platforms/slack/commands/workspace.ts +7 -12
  195. package/src/platforms/slack/token-extractor-node-test.ts +1 -1
  196. package/src/platforms/slack/token-extractor.ts +8 -17
  197. package/src/platforms/slack/types.ts +11 -1
  198. package/src/platforms/slackbot/cli.ts +1 -7
  199. package/src/platforms/slackbot/client.test.ts +7 -7
  200. package/src/platforms/slackbot/client.ts +4 -11
  201. package/src/platforms/slackbot/commands/auth.test.ts +1 -1
  202. package/src/platforms/slackbot/commands/auth.ts +7 -7
  203. package/src/platforms/slackbot/commands/channel.ts +4 -4
  204. package/src/platforms/slackbot/commands/message.ts +16 -29
  205. package/src/platforms/slackbot/commands/reaction.ts +6 -16
  206. package/src/platforms/slackbot/commands/shared.ts +2 -4
  207. package/src/platforms/slackbot/commands/user.ts +4 -4
  208. package/src/platforms/slackbot/credential-manager.ts +2 -7
  209. package/src/platforms/slackbot/types.ts +1 -1
  210. package/src/platforms/teams/client.test.ts +15 -32
  211. package/src/platforms/teams/client.ts +18 -51
  212. package/src/platforms/teams/commands/auth.test.ts +6 -16
  213. package/src/platforms/teams/commands/auth.ts +16 -26
  214. package/src/platforms/teams/commands/channel.test.ts +2 -5
  215. package/src/platforms/teams/commands/channel.ts +10 -20
  216. package/src/platforms/teams/commands/file.test.ts +1 -4
  217. package/src/platforms/teams/commands/file.ts +11 -21
  218. package/src/platforms/teams/commands/message.test.ts +1 -3
  219. package/src/platforms/teams/commands/message.ts +15 -25
  220. package/src/platforms/teams/commands/reaction.test.ts +2 -7
  221. package/src/platforms/teams/commands/reaction.ts +12 -16
  222. package/src/platforms/teams/commands/snapshot.ts +6 -11
  223. package/src/platforms/teams/commands/team.test.ts +15 -26
  224. package/src/platforms/teams/commands/team.ts +10 -19
  225. package/src/platforms/teams/commands/user.ts +8 -14
  226. package/src/platforms/teams/credential-manager.test.ts +2 -5
  227. package/src/platforms/teams/token-extractor.test.ts +21 -50
  228. package/src/platforms/teams/token-extractor.ts +12 -20
  229. package/src/platforms/teams/types.ts +1 -1
  230. package/src/shared/utils/concurrency.test.ts +2 -2
  231. package/src/shared/utils/concurrency.ts +1 -1
  232. package/.claude/commands/release.md +0 -92
  233. package/dist/src/platforms/discord/commands/guild.d.ts +0 -15
  234. package/dist/src/platforms/discord/commands/guild.d.ts.map +0 -1
  235. package/dist/src/platforms/discord/commands/guild.js +0 -102
  236. package/dist/src/platforms/discord/commands/guild.js.map +0 -1
@@ -9,14 +9,12 @@ let clientGetThreadViewSpy: ReturnType<typeof spyOn>
9
9
  let clientMarkReadSpy: ReturnType<typeof spyOn>
10
10
 
11
11
  beforeEach(() => {
12
- credManagerGetWorkspaceSpy = spyOn(CredentialManager.prototype, 'getWorkspace').mockResolvedValue(
13
- {
14
- workspace_id: 'T123',
15
- workspace_name: 'Test Workspace',
16
- token: 'xoxc-test',
17
- cookie: 'test-cookie',
18
- }
19
- )
12
+ credManagerGetWorkspaceSpy = spyOn(CredentialManager.prototype, 'getWorkspace').mockResolvedValue({
13
+ workspace_id: 'T123',
14
+ workspace_name: 'Test Workspace',
15
+ token: 'xoxc-test',
16
+ cookie: 'test-cookie',
17
+ })
20
18
 
21
19
  clientGetUnreadCountsSpy = spyOn(SlackClient.prototype, 'getUnreadCounts').mockResolvedValue({
22
20
  channels: [{ id: 'C123', name: 'general', unread_count: 5, mention_count: 2 }],
@@ -1,6 +1,6 @@
1
1
  import { Command } from 'commander'
2
- import { handleError } from '../../../shared/utils/error-handler'
3
- import { formatOutput } from '../../../shared/utils/output'
2
+ import { handleError } from '@/shared/utils/error-handler'
3
+ import { formatOutput } from '@/shared/utils/output'
4
4
  import { SlackClient } from '../client'
5
5
  import { CredentialManager } from '../credential-manager'
6
6
 
@@ -10,12 +10,7 @@ export async function countsAction(options: { pretty?: boolean }): Promise<void>
10
10
  const workspace = await credManager.getWorkspace()
11
11
 
12
12
  if (!workspace) {
13
- console.log(
14
- formatOutput(
15
- { error: 'No current workspace set. Run "auth extract" first.' },
16
- options.pretty
17
- )
18
- )
13
+ console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
19
14
  process.exit(1)
20
15
  }
21
16
 
@@ -39,22 +34,13 @@ export async function countsAction(options: { pretty?: boolean }): Promise<void>
39
34
  }
40
35
  }
41
36
 
42
- export async function threadsAction(
43
- channel: string,
44
- threadTs: string,
45
- options: { pretty?: boolean }
46
- ): Promise<void> {
37
+ export async function threadsAction(channel: string, threadTs: string, options: { pretty?: boolean }): Promise<void> {
47
38
  try {
48
39
  const credManager = new CredentialManager()
49
40
  const workspace = await credManager.getWorkspace()
50
41
 
51
42
  if (!workspace) {
52
- console.log(
53
- formatOutput(
54
- { error: 'No current workspace set. Run "auth extract" first.' },
55
- options.pretty
56
- )
57
- )
43
+ console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
58
44
  process.exit(1)
59
45
  }
60
46
 
@@ -75,22 +61,13 @@ export async function threadsAction(
75
61
  }
76
62
  }
77
63
 
78
- export async function markAction(
79
- channel: string,
80
- ts: string,
81
- options: { pretty?: boolean }
82
- ): Promise<void> {
64
+ export async function markAction(channel: string, ts: string, options: { pretty?: boolean }): Promise<void> {
83
65
  try {
84
66
  const credManager = new CredentialManager()
85
67
  const workspace = await credManager.getWorkspace()
86
68
 
87
69
  if (!workspace) {
88
- console.log(
89
- formatOutput(
90
- { error: 'No current workspace set. Run "auth extract" first.' },
91
- options.pretty
92
- )
93
- )
70
+ console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
94
71
  process.exit(1)
95
72
  }
96
73
 
@@ -109,7 +86,7 @@ export const unreadCommand = new Command('unread')
109
86
  new Command('counts')
110
87
  .description('Get unread counts for all channels')
111
88
  .option('--pretty', 'Pretty print JSON output')
112
- .action(countsAction)
89
+ .action(countsAction),
113
90
  )
114
91
  .addCommand(
115
92
  new Command('threads')
@@ -117,7 +94,7 @@ export const unreadCommand = new Command('unread')
117
94
  .argument('<channel>', 'Channel ID or name')
118
95
  .argument('<thread_ts>', 'Thread timestamp')
119
96
  .option('--pretty', 'Pretty print JSON output')
120
- .action(threadsAction)
97
+ .action(threadsAction),
121
98
  )
122
99
  .addCommand(
123
100
  new Command('mark')
@@ -125,5 +102,5 @@ export const unreadCommand = new Command('unread')
125
102
  .argument('<channel>', 'Channel ID or name')
126
103
  .argument('<ts>', 'Message timestamp to mark as read')
127
104
  .option('--pretty', 'Pretty print JSON output')
128
- .action(markAction)
105
+ .action(markAction),
129
106
  )
@@ -50,10 +50,7 @@ describe('User Commands', () => {
50
50
  } as unknown as SlackClient
51
51
 
52
52
  // When: Calling list with all users
53
- const result = await (userCommand as any).commands[0].action(
54
- { includeBots: false },
55
- userCommand
56
- )
53
+ const result = await (userCommand as any).commands[0].action({ includeBots: false }, userCommand)
57
54
 
58
55
  // Then: Should return users
59
56
  expect(result).toBeDefined()
@@ -1,6 +1,6 @@
1
1
  import { Command } from 'commander'
2
- import { handleError } from '../../../shared/utils/error-handler'
3
- import { formatOutput } from '../../../shared/utils/output'
2
+ import { handleError } from '@/shared/utils/error-handler'
3
+ import { formatOutput } from '@/shared/utils/output'
4
4
  import { SlackClient } from '../client'
5
5
  import { CredentialManager } from '../credential-manager'
6
6
 
@@ -9,9 +9,7 @@ async function getClient(pretty?: boolean): Promise<SlackClient | null> {
9
9
  const workspace = await credManager.getWorkspace()
10
10
 
11
11
  if (!workspace) {
12
- console.log(
13
- formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, pretty)
14
- )
12
+ console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, pretty))
15
13
  return null
16
14
  }
17
15
 
@@ -49,7 +47,7 @@ export const userCommand = new Command('user')
49
47
  } catch (error) {
50
48
  handleError(error as Error)
51
49
  }
52
- })
50
+ }),
53
51
  )
54
52
  .addCommand(
55
53
  new Command('info')
@@ -78,7 +76,7 @@ export const userCommand = new Command('user')
78
76
  } catch (error) {
79
77
  handleError(error as Error)
80
78
  }
81
- })
79
+ }),
82
80
  )
83
81
  .addCommand(
84
82
  new Command('me')
@@ -106,5 +104,5 @@ export const userCommand = new Command('user')
106
104
  } catch (error) {
107
105
  handleError(error as Error)
108
106
  }
109
- })
107
+ }),
110
108
  )
@@ -9,7 +9,7 @@ const testDirs: string[] = []
9
9
  function setup(): CredentialManager {
10
10
  const testConfigDir = join(
11
11
  import.meta.dir,
12
- `.test-workspace-config-${Date.now()}-${Math.random().toString(36).slice(2)}`
12
+ `.test-workspace-config-${Date.now()}-${Math.random().toString(36).slice(2)}`,
13
13
  )
14
14
  testDirs.push(testConfigDir)
15
15
  return new CredentialManager(testConfigDir)
@@ -1,6 +1,6 @@
1
1
  import { Command } from 'commander'
2
- import { handleError } from '../../../shared/utils/error-handler'
3
- import { formatOutput } from '../../../shared/utils/output'
2
+ import { handleError } from '@/shared/utils/error-handler'
3
+ import { formatOutput } from '@/shared/utils/output'
4
4
  import { CredentialManager } from '../credential-manager'
5
5
 
6
6
  async function listAction(options: { pretty?: boolean }): Promise<void> {
@@ -44,12 +44,7 @@ async function currentAction(options: { pretty?: boolean }): Promise<void> {
44
44
  const workspace = await credManager.getWorkspace()
45
45
 
46
46
  if (!workspace) {
47
- console.log(
48
- formatOutput(
49
- { error: 'No current workspace set. Run "auth extract" first.' },
50
- options.pretty
51
- )
52
- )
47
+ console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
53
48
  process.exit(1)
54
49
  }
55
50
 
@@ -87,25 +82,25 @@ export const workspaceCommand = new Command('workspace')
87
82
  new Command('list')
88
83
  .description('List all workspaces')
89
84
  .option('--pretty', 'Pretty print JSON output')
90
- .action(listAction)
85
+ .action(listAction),
91
86
  )
92
87
  .addCommand(
93
88
  new Command('switch')
94
89
  .description('Switch to workspace')
95
90
  .argument('<id>', 'Workspace ID')
96
91
  .option('--pretty', 'Pretty print JSON output')
97
- .action(switchAction)
92
+ .action(switchAction),
98
93
  )
99
94
  .addCommand(
100
95
  new Command('current')
101
96
  .description('Show current workspace')
102
97
  .option('--pretty', 'Pretty print JSON output')
103
- .action(currentAction)
98
+ .action(currentAction),
104
99
  )
105
100
  .addCommand(
106
101
  new Command('remove')
107
102
  .description('Remove workspace')
108
103
  .argument('<id>', 'Workspace ID')
109
104
  .option('--pretty', 'Pretty print JSON output')
110
- .action(removeAction)
105
+ .action(removeAction),
111
106
  )
@@ -22,7 +22,7 @@ try {
22
22
  )
23
23
  `)
24
24
  db.prepare(
25
- "INSERT INTO cookies (name, value, host_key, last_access_utc) VALUES ('d', 'xoxd-test-cookie', '.slack.com', 1000)"
25
+ "INSERT INTO cookies (name, value, host_key, last_access_utc) VALUES ('d', 'xoxd-test-cookie', '.slack.com', 1000)",
26
26
  ).run()
27
27
  db.close()
28
28
 
@@ -5,7 +5,7 @@ import { createRequire } from 'node:module'
5
5
  import { homedir, tmpdir } from 'node:os'
6
6
  import { join } from 'node:path'
7
7
  import { ClassicLevel } from 'classic-level'
8
- import { DerivedKeyCache } from '../../shared/utils/derived-key-cache'
8
+ import { DerivedKeyCache } from '@/shared/utils/derived-key-cache'
9
9
 
10
10
  const require = createRequire(import.meta.url)
11
11
 
@@ -55,7 +55,7 @@ export class TokenExtractor {
55
55
  'Data',
56
56
  'Library',
57
57
  'Application Support',
58
- 'Slack'
58
+ 'Slack',
59
59
  )
60
60
  if (existsSync(sandboxedPath)) {
61
61
  return sandboxedPath
@@ -306,12 +306,7 @@ export class TokenExtractor {
306
306
  } else {
307
307
  // Check for 4-byte fragmentation marker pattern
308
308
  // Pattern: 0x19 0x0d 0xf0 0xNN (where NN varies)
309
- if (
310
- i + 3 < chunk.length &&
311
- chunk[i] === 0x19 &&
312
- chunk[i + 1] === 0x0d &&
313
- chunk[i + 2] === 0xf0
314
- ) {
309
+ if (i + 3 < chunk.length && chunk[i] === 0x19 && chunk[i + 1] === 0x0d && chunk[i + 2] === 0xf0) {
315
310
  // Skip the 4 garbage bytes and insert a hyphen
316
311
  result.push(0x2d) // hyphen
317
312
  i += 4
@@ -419,10 +414,7 @@ export class TokenExtractor {
419
414
  private readCookieFromDB(dbPath: string): string {
420
415
  // Copy the database to a temp file to avoid SQLite lock contention
421
416
  // when Slack is running and has a write lock on the Cookies database
422
- const tempDbPath = join(
423
- tmpdir(),
424
- `slack-cookies-${Date.now()}-${Math.random().toString(36).slice(2)}.db`
425
- )
417
+ const tempDbPath = join(tmpdir(), `slack-cookies-${Date.now()}-${Math.random().toString(36).slice(2)}.db`)
426
418
 
427
419
  try {
428
420
  copyFileSync(dbPath, tempDbPath)
@@ -555,13 +547,12 @@ export class TokenExtractor {
555
547
  try {
556
548
  password = execSync(
557
549
  'security find-generic-password -ga "Slack App Store Key" -s "Slack Safe Storage" -w 2>/dev/null',
558
- { encoding: 'utf8' }
550
+ { encoding: 'utf8' },
559
551
  ).trim()
560
552
  } catch {
561
- password = execSync(
562
- 'security find-generic-password -ga "Slack Key" -s "Slack Safe Storage" -w 2>/dev/null',
563
- { encoding: 'utf8' }
564
- ).trim()
553
+ password = execSync('security find-generic-password -ga "Slack Key" -s "Slack Safe Storage" -w 2>/dev/null', {
554
+ encoding: 'utf8',
555
+ }).trim()
565
556
  }
566
557
 
567
558
  return pbkdf2Sync(password, 'saltysalt', 1003, 16, 'sha1')
@@ -36,6 +36,7 @@ export interface SlackMessage {
36
36
  user: string
37
37
  ts: string
38
38
  }
39
+ reactions?: SlackReaction[]
39
40
  }
40
41
 
41
42
  export interface SlackUser {
@@ -191,7 +192,7 @@ export const SlackMessageSchema = z.object({
191
192
  z.object({
192
193
  user: z.string(),
193
194
  ts: z.string(),
194
- })
195
+ }),
195
196
  )
196
197
  .optional(),
197
198
  edited: z
@@ -200,6 +201,15 @@ export const SlackMessageSchema = z.object({
200
201
  ts: z.string(),
201
202
  })
202
203
  .optional(),
204
+ reactions: z
205
+ .array(
206
+ z.object({
207
+ name: z.string(),
208
+ count: z.number(),
209
+ users: z.array(z.string()),
210
+ }),
211
+ )
212
+ .optional(),
203
213
  })
204
214
 
205
215
  export const SlackUserSchema = z.object({
@@ -2,13 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import pkg from '../../../package.json'
5
- import {
6
- authCommand,
7
- channelCommand,
8
- messageCommand,
9
- reactionCommand,
10
- userCommand,
11
- } from './commands/index'
5
+ import { authCommand, channelCommand, messageCommand, reactionCommand, userCommand } from './commands/index'
12
6
 
13
7
  const program = new Command()
14
8
 
@@ -12,7 +12,7 @@ const mockAuth = {
12
12
  bot_id: 'B789',
13
13
  user: 'testbot',
14
14
  team: 'Test Team',
15
- })
15
+ }),
16
16
  ),
17
17
  }
18
18
  const mockConversations = {
@@ -29,7 +29,7 @@ const mockConversations = {
29
29
  creator: 'U001',
30
30
  },
31
31
  ],
32
- })
32
+ }),
33
33
  ),
34
34
  info: mock(() =>
35
35
  Promise.resolve({
@@ -42,13 +42,13 @@ const mockConversations = {
42
42
  created: 1234567890,
43
43
  creator: 'U001',
44
44
  },
45
- })
45
+ }),
46
46
  ),
47
47
  history: mock(() =>
48
48
  Promise.resolve({
49
49
  ok: true,
50
50
  messages: [{ ts: '1234567890.123456', text: 'Hello', type: 'message', user: 'U123' }],
51
- })
51
+ }),
52
52
  ),
53
53
  }
54
54
  const mockChat = {
@@ -57,7 +57,7 @@ const mockChat = {
57
57
  ok: true,
58
58
  ts: '1234567890.123456',
59
59
  message: { text: 'Hello', type: 'message' },
60
- })
60
+ }),
61
61
  ),
62
62
  }
63
63
  const mockReactions = {
@@ -79,7 +79,7 @@ const mockUsers = {
79
79
  is_app_user: false,
80
80
  },
81
81
  ],
82
- })
82
+ }),
83
83
  ),
84
84
  info: mock(() =>
85
85
  Promise.resolve({
@@ -93,7 +93,7 @@ const mockUsers = {
93
93
  is_bot: false,
94
94
  is_app_user: false,
95
95
  },
96
- })
96
+ }),
97
97
  ),
98
98
  }
99
99
 
@@ -33,10 +33,7 @@ export class SlackBotClient {
33
33
  break
34
34
  }
35
35
  }
36
- throw new SlackBotError(
37
- lastError?.message || 'Unknown error',
38
- (lastError as any)?.code || 'unknown_error'
39
- )
36
+ throw new SlackBotError(lastError?.message || 'Unknown error', (lastError as any)?.code || 'unknown_error')
40
37
  }
41
38
 
42
39
  private sleep(ms: number): Promise<void> {
@@ -69,11 +66,7 @@ export class SlackBotClient {
69
66
  })
70
67
  }
71
68
 
72
- async postMessage(
73
- channel: string,
74
- text: string,
75
- options?: { thread_ts?: string }
76
- ): Promise<SlackMessage> {
69
+ async postMessage(channel: string, text: string, options?: { thread_ts?: string }): Promise<SlackMessage> {
77
70
  return this.withRetry(async () => {
78
71
  const response = await this.client.chat.postMessage({
79
72
  channel,
@@ -95,7 +88,7 @@ export class SlackBotClient {
95
88
 
96
89
  async getConversationHistory(
97
90
  channel: string,
98
- options?: { limit?: number; cursor?: string }
91
+ options?: { limit?: number; cursor?: string },
99
92
  ): Promise<SlackMessage[]> {
100
93
  return this.withRetry(async () => {
101
94
  const response = await this.client.conversations.history({
@@ -356,7 +349,7 @@ export class SlackBotClient {
356
349
  async getThreadReplies(
357
350
  channel: string,
358
351
  ts: string,
359
- options?: { limit?: number; cursor?: string }
352
+ options?: { limit?: number; cursor?: string },
360
353
  ): Promise<SlackMessage[]> {
361
354
  return this.withRetry(async () => {
362
355
  const response = await this.client.conversations.replies({
@@ -12,7 +12,7 @@ const mockTestAuth = mock(() =>
12
12
  bot_id: 'B789',
13
13
  user: 'testbot',
14
14
  team: 'Test Team',
15
- })
15
+ }),
16
16
  )
17
17
 
18
18
  mock.module('../client', () => ({
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander'
2
- import { formatOutput } from '../../../shared/utils/output'
2
+ import { formatOutput } from '@/shared/utils/output'
3
3
  import { SlackBotClient } from '../client'
4
4
  import { SlackBotCredentialManager } from '../credential-manager'
5
5
 
@@ -191,7 +191,7 @@ export const authCommand = new Command('auth')
191
191
  .option('--pretty', 'Pretty print JSON output')
192
192
  .action(async (token: string, opts: { bot?: string; name?: string; pretty?: boolean }) => {
193
193
  cliOutput(await setAction(token, opts), opts.pretty)
194
- })
194
+ }),
195
195
  )
196
196
  .addCommand(
197
197
  new Command('clear')
@@ -199,7 +199,7 @@ export const authCommand = new Command('auth')
199
199
  .option('--pretty', 'Pretty print JSON output')
200
200
  .action(async (opts: { pretty?: boolean }) => {
201
201
  cliOutput(await clearAction(opts), opts.pretty)
202
- })
202
+ }),
203
203
  )
204
204
  .addCommand(
205
205
  new Command('status')
@@ -210,7 +210,7 @@ export const authCommand = new Command('auth')
210
210
  const result = await statusAction(opts)
211
211
  console.log(formatOutput(result, opts.pretty))
212
212
  if (!result.valid) process.exit(1)
213
- })
213
+ }),
214
214
  )
215
215
  .addCommand(
216
216
  new Command('list')
@@ -218,7 +218,7 @@ export const authCommand = new Command('auth')
218
218
  .option('--pretty', 'Pretty print JSON output')
219
219
  .action(async (opts: { pretty?: boolean }) => {
220
220
  cliOutput(await listAction(opts), opts.pretty)
221
- })
221
+ }),
222
222
  )
223
223
  .addCommand(
224
224
  new Command('use')
@@ -227,7 +227,7 @@ export const authCommand = new Command('auth')
227
227
  .option('--pretty', 'Pretty print JSON output')
228
228
  .action(async (botId: string, opts: { pretty?: boolean }) => {
229
229
  cliOutput(await useAction(botId, opts), opts.pretty)
230
- })
230
+ }),
231
231
  )
232
232
  .addCommand(
233
233
  new Command('remove')
@@ -236,5 +236,5 @@ export const authCommand = new Command('auth')
236
236
  .option('--pretty', 'Pretty print JSON output')
237
237
  .action(async (botId: string, opts: { pretty?: boolean }) => {
238
238
  cliOutput(await removeAction(botId, opts), opts.pretty)
239
- })
239
+ }),
240
240
  )
@@ -1,6 +1,6 @@
1
1
  import { Command } from 'commander'
2
- import { handleError } from '../../../shared/utils/error-handler'
3
- import { formatOutput } from '../../../shared/utils/output'
2
+ import { handleError } from '@/shared/utils/error-handler'
3
+ import { formatOutput } from '@/shared/utils/output'
4
4
  import { type BotOption, getClient } from './shared'
5
5
 
6
6
  async function listAction(options: BotOption & { limit?: string }): Promise<void> {
@@ -34,7 +34,7 @@ export const channelCommand = new Command('channel')
34
34
  .option('--limit <n>', 'Number of channels to fetch')
35
35
  .option('--bot <id>', 'Use specific bot')
36
36
  .option('--pretty', 'Pretty print JSON output')
37
- .action(listAction)
37
+ .action(listAction),
38
38
  )
39
39
  .addCommand(
40
40
  new Command('info')
@@ -42,5 +42,5 @@ export const channelCommand = new Command('channel')
42
42
  .argument('<channel>', 'Channel ID')
43
43
  .option('--bot <id>', 'Use specific bot')
44
44
  .option('--pretty', 'Pretty print JSON output')
45
- .action(infoAction)
45
+ .action(infoAction),
46
46
  )
@@ -1,13 +1,9 @@
1
1
  import { Command } from 'commander'
2
- import { handleError } from '../../../shared/utils/error-handler'
3
- import { formatOutput } from '../../../shared/utils/output'
2
+ import { handleError } from '@/shared/utils/error-handler'
3
+ import { formatOutput } from '@/shared/utils/output'
4
4
  import { type BotOption, getClient } from './shared'
5
5
 
6
- async function sendAction(
7
- channel: string,
8
- text: string,
9
- options: BotOption & { thread?: string }
10
- ): Promise<void> {
6
+ async function sendAction(channel: string, text: string, options: BotOption & { thread?: string }): Promise<void> {
11
7
  try {
12
8
  const client = await getClient(options)
13
9
  const result = await client.postMessage(channel, text, {
@@ -22,8 +18,8 @@ async function sendAction(
22
18
  text: result.text,
23
19
  thread_ts: result.thread_ts,
24
20
  },
25
- options.pretty
26
- )
21
+ options.pretty,
22
+ ),
27
23
  )
28
24
  } catch (error) {
29
25
  handleError(error as Error)
@@ -58,12 +54,7 @@ async function getAction(channel: string, ts: string, options: BotOption): Promi
58
54
  }
59
55
  }
60
56
 
61
- async function updateAction(
62
- channel: string,
63
- ts: string,
64
- text: string,
65
- options: BotOption
66
- ): Promise<void> {
57
+ async function updateAction(channel: string, ts: string, text: string, options: BotOption): Promise<void> {
67
58
  try {
68
59
  const client = await getClient(options)
69
60
  const message = await client.updateMessage(channel, ts, text)
@@ -76,19 +67,15 @@ async function updateAction(
76
67
  type: message.type,
77
68
  user: message.user,
78
69
  },
79
- options.pretty
80
- )
70
+ options.pretty,
71
+ ),
81
72
  )
82
73
  } catch (error) {
83
74
  handleError(error as Error)
84
75
  }
85
76
  }
86
77
 
87
- async function deleteAction(
88
- channel: string,
89
- ts: string,
90
- options: BotOption & { force?: boolean }
91
- ): Promise<void> {
78
+ async function deleteAction(channel: string, ts: string, options: BotOption & { force?: boolean }): Promise<void> {
92
79
  try {
93
80
  if (!options.force) {
94
81
  console.log(formatOutput({ warning: 'Use --force to confirm deletion', ts }, options.pretty))
@@ -107,7 +94,7 @@ async function deleteAction(
107
94
  async function repliesAction(
108
95
  channel: string,
109
96
  threadTs: string,
110
- options: BotOption & { limit?: string }
97
+ options: BotOption & { limit?: string },
111
98
  ): Promise<void> {
112
99
  try {
113
100
  const client = await getClient(options)
@@ -130,7 +117,7 @@ export const messageCommand = new Command('message')
130
117
  .option('--thread <ts>', 'Thread timestamp for replies')
131
118
  .option('--bot <id>', 'Use specific bot')
132
119
  .option('--pretty', 'Pretty print JSON output')
133
- .action(sendAction)
120
+ .action(sendAction),
134
121
  )
135
122
  .addCommand(
136
123
  new Command('list')
@@ -139,7 +126,7 @@ export const messageCommand = new Command('message')
139
126
  .option('--limit <n>', 'Number of messages to fetch', '20')
140
127
  .option('--bot <id>', 'Use specific bot')
141
128
  .option('--pretty', 'Pretty print JSON output')
142
- .action(listAction)
129
+ .action(listAction),
143
130
  )
144
131
  .addCommand(
145
132
  new Command('get')
@@ -148,7 +135,7 @@ export const messageCommand = new Command('message')
148
135
  .argument('<ts>', 'Message timestamp')
149
136
  .option('--bot <id>', 'Use specific bot')
150
137
  .option('--pretty', 'Pretty print JSON output')
151
- .action(getAction)
138
+ .action(getAction),
152
139
  )
153
140
  .addCommand(
154
141
  new Command('update')
@@ -158,7 +145,7 @@ export const messageCommand = new Command('message')
158
145
  .argument('<text>', 'New message text')
159
146
  .option('--bot <id>', 'Use specific bot')
160
147
  .option('--pretty', 'Pretty print JSON output')
161
- .action(updateAction)
148
+ .action(updateAction),
162
149
  )
163
150
  .addCommand(
164
151
  new Command('delete')
@@ -168,7 +155,7 @@ export const messageCommand = new Command('message')
168
155
  .option('--force', 'Skip confirmation')
169
156
  .option('--bot <id>', 'Use specific bot')
170
157
  .option('--pretty', 'Pretty print JSON output')
171
- .action(deleteAction)
158
+ .action(deleteAction),
172
159
  )
173
160
  .addCommand(
174
161
  new Command('replies')
@@ -178,5 +165,5 @@ export const messageCommand = new Command('message')
178
165
  .option('--limit <n>', 'Number of replies to fetch', '100')
179
166
  .option('--bot <id>', 'Use specific bot')
180
167
  .option('--pretty', 'Pretty print JSON output')
181
- .action(repliesAction)
168
+ .action(repliesAction),
182
169
  )