agent-messenger 1.2.0 → 1.3.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.
- package/.claude-plugin/marketplace.json +27 -1
- package/.claude-plugin/plugin.json +17 -4
- package/.env.template +3 -0
- package/.github/workflows/release.yml +94 -0
- package/AGENTS.md +48 -0
- package/README.md +25 -20
- package/biome.json +15 -39
- package/bun.lock +69 -0
- package/dist/package.json +12 -4
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +1 -4
- package/dist/src/cli.js.map +1 -1
- package/dist/src/platforms/discord/client.d.ts.map +1 -1
- package/dist/src/platforms/discord/client.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/commands/channel.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/channel.js.map +1 -1
- package/dist/src/platforms/discord/commands/dm.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/dm.js.map +1 -1
- package/dist/src/platforms/discord/commands/file.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/file.js +1 -4
- package/dist/src/platforms/discord/commands/file.js.map +1 -1
- package/dist/src/platforms/discord/commands/friend.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/friend.js +1 -3
- package/dist/src/platforms/discord/commands/friend.js.map +1 -1
- package/dist/src/platforms/discord/commands/member.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/member.js.map +1 -1
- package/dist/src/platforms/discord/commands/mention.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/mention.js.map +1 -1
- package/dist/src/platforms/discord/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/message.js.map +1 -1
- package/dist/src/platforms/discord/commands/note.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/note.js.map +1 -1
- package/dist/src/platforms/discord/commands/profile.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/profile.js.map +1 -1
- package/dist/src/platforms/discord/commands/reaction.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/reaction.js.map +1 -1
- package/dist/src/platforms/discord/commands/server.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/server.js.map +1 -1
- package/dist/src/platforms/discord/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/discord/commands/thread.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/thread.js.map +1 -1
- package/dist/src/platforms/discord/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/user.js.map +1 -1
- package/dist/src/platforms/discord/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/discord/credential-manager.js.map +1 -1
- package/dist/src/platforms/discord/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/discord/token-extractor.js +2 -7
- package/dist/src/platforms/discord/token-extractor.js.map +1 -1
- package/dist/src/platforms/slack/client.d.ts.map +1 -1
- package/dist/src/platforms/slack/client.js.map +1 -1
- package/dist/src/platforms/slack/commands/activity.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/activity.js.map +1 -1
- package/dist/src/platforms/slack/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/auth.js.map +1 -1
- package/dist/src/platforms/slack/commands/channel.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/channel.js.map +1 -1
- package/dist/src/platforms/slack/commands/drafts.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/drafts.js.map +1 -1
- package/dist/src/platforms/slack/commands/file.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/file.js +1 -4
- package/dist/src/platforms/slack/commands/file.js.map +1 -1
- package/dist/src/platforms/slack/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/message.js.map +1 -1
- package/dist/src/platforms/slack/commands/reaction.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/reaction.js.map +1 -1
- package/dist/src/platforms/slack/commands/saved.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/saved.js.map +1 -1
- package/dist/src/platforms/slack/commands/sections.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/sections.js.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/slack/commands/unread.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/unread.js.map +1 -1
- package/dist/src/platforms/slack/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/user.js.map +1 -1
- package/dist/src/platforms/slack/commands/workspace.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/workspace.js.map +1 -1
- package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/slack/token-extractor.js +4 -5
- package/dist/src/platforms/slack/token-extractor.js.map +1 -1
- package/dist/src/platforms/slackbot/cli.d.ts +5 -0
- package/dist/src/platforms/slackbot/cli.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/cli.js +19 -0
- package/dist/src/platforms/slackbot/cli.js.map +1 -0
- package/dist/src/platforms/slackbot/client.d.ts +43 -0
- package/dist/src/platforms/slackbot/client.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/client.js +347 -0
- package/dist/src/platforms/slackbot/client.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/auth.d.ts +35 -0
- package/dist/src/platforms/slackbot/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/auth.js +185 -0
- package/dist/src/platforms/slackbot/commands/auth.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/channel.d.ts +3 -0
- package/dist/src/platforms/slackbot/commands/channel.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/channel.js +40 -0
- package/dist/src/platforms/slackbot/commands/channel.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/index.d.ts +6 -0
- package/dist/src/platforms/slackbot/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/index.js +6 -0
- package/dist/src/platforms/slackbot/commands/index.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/message.d.ts +3 -0
- package/dist/src/platforms/slackbot/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/message.js +135 -0
- package/dist/src/platforms/slackbot/commands/message.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/reaction.d.ts +3 -0
- package/dist/src/platforms/slackbot/commands/reaction.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/reaction.js +43 -0
- package/dist/src/platforms/slackbot/commands/reaction.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/shared.d.ts +9 -0
- package/dist/src/platforms/slackbot/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/shared.js +13 -0
- package/dist/src/platforms/slackbot/commands/shared.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/user.d.ts +3 -0
- package/dist/src/platforms/slackbot/commands/user.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/user.js +40 -0
- package/dist/src/platforms/slackbot/commands/user.js.map +1 -0
- package/dist/src/platforms/slackbot/credential-manager.d.ts +18 -0
- package/dist/src/platforms/slackbot/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/credential-manager.js +185 -0
- package/dist/src/platforms/slackbot/credential-manager.js.map +1 -0
- package/dist/src/platforms/slackbot/index.d.ts +4 -0
- package/dist/src/platforms/slackbot/index.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/index.js +4 -0
- package/dist/src/platforms/slackbot/index.js.map +1 -0
- package/dist/src/platforms/slackbot/types.d.ts +460 -0
- package/dist/src/platforms/slackbot/types.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/types.js +114 -0
- package/dist/src/platforms/slackbot/types.js.map +1 -0
- package/dist/src/platforms/teams/client.d.ts.map +1 -1
- package/dist/src/platforms/teams/client.js.map +1 -1
- package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/auth.js.map +1 -1
- package/dist/src/platforms/teams/commands/channel.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/channel.js.map +1 -1
- package/dist/src/platforms/teams/commands/file.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/file.js.map +1 -1
- package/dist/src/platforms/teams/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/message.js.map +1 -1
- package/dist/src/platforms/teams/commands/reaction.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/reaction.js.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/teams/commands/team.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/team.js +1 -4
- package/dist/src/platforms/teams/commands/team.js.map +1 -1
- package/dist/src/platforms/teams/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/user.js.map +1 -1
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/teams/token-extractor.js +3 -1
- package/dist/src/platforms/teams/token-extractor.js.map +1 -1
- package/docs/content/docs/agent-skills.mdx +4 -4
- package/docs/content/docs/index.mdx +11 -18
- package/docs/content/docs/integrations/discord.mdx +65 -1
- package/docs/content/docs/integrations/meta.json +1 -1
- package/docs/content/docs/integrations/slack.mdx +51 -1
- package/docs/content/docs/integrations/slackbot.mdx +214 -0
- package/docs/content/docs/integrations/teams.mdx +4 -1
- package/docs/content/docs/quick-start.mdx +3 -2
- package/docs/src/app/icon.png +0 -0
- package/docs/src/app/layout.config.tsx +8 -1
- package/docs/src/app/page.tsx +18 -1
- package/e2e/config.ts +26 -0
- package/e2e/helpers.ts +6 -1
- package/e2e/slackbot.e2e.test.ts +306 -0
- package/package.json +16 -8
- package/scripts/prepublish.ts +11 -0
- package/skills/agent-slackbot/SKILL.md +285 -0
- package/skills/agent-slackbot/references/authentication.md +253 -0
- package/skills/agent-slackbot/references/common-patterns.md +218 -0
- package/skills/agent-slackbot/templates/monitor-channel.sh +98 -0
- package/skills/agent-slackbot/templates/post-message.sh +107 -0
- package/skills/agent-slackbot/templates/workspace-summary.sh +113 -0
- package/src/cli.ts +1 -4
- package/src/platforms/discord/client.test.ts +6 -14
- package/src/platforms/discord/client.ts +12 -34
- package/src/platforms/discord/commands/auth.test.ts +2 -7
- package/src/platforms/discord/commands/auth.ts +14 -19
- package/src/platforms/discord/commands/channel.test.ts +18 -20
- package/src/platforms/discord/commands/channel.ts +9 -18
- package/src/platforms/discord/commands/dm.test.ts +1 -3
- package/src/platforms/discord/commands/dm.ts +6 -10
- package/src/platforms/discord/commands/file.ts +10 -23
- package/src/platforms/discord/commands/friend.ts +33 -35
- package/src/platforms/discord/commands/member.ts +5 -7
- package/src/platforms/discord/commands/mention.ts +5 -11
- package/src/platforms/discord/commands/message.test.ts +1 -3
- package/src/platforms/discord/commands/message.ts +23 -61
- package/src/platforms/discord/commands/note.ts +7 -15
- package/src/platforms/discord/commands/profile.ts +4 -6
- package/src/platforms/discord/commands/reaction.test.ts +1 -3
- package/src/platforms/discord/commands/reaction.ts +19 -29
- package/src/platforms/discord/commands/server.test.ts +14 -18
- package/src/platforms/discord/commands/server.ts +9 -15
- package/src/platforms/discord/commands/snapshot.ts +5 -7
- package/src/platforms/discord/commands/thread.ts +8 -15
- package/src/platforms/discord/commands/user.ts +9 -20
- package/src/platforms/discord/credential-manager.test.ts +2 -2
- package/src/platforms/discord/credential-manager.ts +1 -3
- package/src/platforms/discord/token-extractor.test.ts +28 -57
- package/src/platforms/discord/token-extractor.ts +10 -30
- package/src/platforms/discord/types.ts +1 -1
- package/src/platforms/slack/client.test.ts +14 -20
- package/src/platforms/slack/client.ts +4 -11
- package/src/platforms/slack/commands/activity.test.ts +3 -9
- package/src/platforms/slack/commands/activity.ts +7 -12
- package/src/platforms/slack/commands/auth.test.ts +2 -2
- package/src/platforms/slack/commands/auth.ts +15 -31
- package/src/platforms/slack/commands/channel.ts +10 -32
- package/src/platforms/slack/commands/drafts.ts +5 -14
- package/src/platforms/slack/commands/file.ts +9 -29
- package/src/platforms/slack/commands/message.ts +23 -67
- package/src/platforms/slack/commands/reaction.ts +19 -48
- package/src/platforms/slack/commands/saved.ts +5 -14
- package/src/platforms/slack/commands/sections.ts +4 -11
- package/src/platforms/slack/commands/snapshot.test.ts +1 -3
- package/src/platforms/slack/commands/snapshot.ts +5 -10
- package/src/platforms/slack/commands/unread.test.ts +6 -8
- package/src/platforms/slack/commands/unread.ts +10 -33
- package/src/platforms/slack/commands/user.test.ts +1 -4
- package/src/platforms/slack/commands/user.ts +6 -8
- package/src/platforms/slack/commands/workspace.test.ts +1 -1
- package/src/platforms/slack/commands/workspace.ts +7 -12
- package/src/platforms/slack/token-extractor-node-test.ts +1 -1
- package/src/platforms/slack/token-extractor.ts +8 -17
- package/src/platforms/slack/types.ts +1 -1
- package/src/platforms/slackbot/cli.ts +24 -0
- package/src/platforms/slackbot/client.test.ts +282 -0
- package/src/platforms/slackbot/client.ts +394 -0
- package/src/platforms/slackbot/commands/auth.test.ts +245 -0
- package/src/platforms/slackbot/commands/auth.ts +240 -0
- package/src/platforms/slackbot/commands/channel.ts +46 -0
- package/src/platforms/slackbot/commands/index.ts +5 -0
- package/src/platforms/slackbot/commands/message.ts +169 -0
- package/src/platforms/slackbot/commands/reaction.ts +49 -0
- package/src/platforms/slackbot/commands/shared.ts +21 -0
- package/src/platforms/slackbot/commands/user.ts +46 -0
- package/src/platforms/slackbot/credential-manager.test.ts +264 -0
- package/src/platforms/slackbot/credential-manager.ts +213 -0
- package/src/platforms/slackbot/index.ts +19 -0
- package/src/platforms/slackbot/types.test.ts +90 -0
- package/src/platforms/slackbot/types.ts +222 -0
- package/src/platforms/teams/client.test.ts +15 -32
- package/src/platforms/teams/client.ts +18 -51
- package/src/platforms/teams/commands/auth.test.ts +6 -16
- package/src/platforms/teams/commands/auth.ts +16 -26
- package/src/platforms/teams/commands/channel.test.ts +2 -5
- package/src/platforms/teams/commands/channel.ts +10 -20
- package/src/platforms/teams/commands/file.test.ts +1 -4
- package/src/platforms/teams/commands/file.ts +11 -21
- package/src/platforms/teams/commands/message.test.ts +1 -3
- package/src/platforms/teams/commands/message.ts +15 -25
- package/src/platforms/teams/commands/reaction.test.ts +2 -7
- package/src/platforms/teams/commands/reaction.ts +12 -16
- package/src/platforms/teams/commands/snapshot.ts +6 -11
- package/src/platforms/teams/commands/team.test.ts +15 -26
- package/src/platforms/teams/commands/team.ts +10 -19
- package/src/platforms/teams/commands/user.ts +8 -14
- package/src/platforms/teams/credential-manager.test.ts +2 -5
- package/src/platforms/teams/token-extractor.test.ts +21 -50
- package/src/platforms/teams/token-extractor.ts +12 -20
- package/src/platforms/teams/types.ts +1 -1
- package/src/shared/utils/concurrency.test.ts +2 -2
- package/src/shared/utils/concurrency.ts +1 -1
- package/.claude/commands/release.md +0 -92
- package/dist/src/platforms/discord/commands/guild.d.ts +0 -15
- package/dist/src/platforms/discord/commands/guild.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/guild.js +0 -102
- package/dist/src/platforms/discord/commands/guild.js.map +0 -1
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs'
|
|
2
2
|
import { resolve } from 'node:path'
|
|
3
3
|
import { Command } from 'commander'
|
|
4
|
-
import { handleError } from '
|
|
5
|
-
import { formatOutput } from '
|
|
4
|
+
import { handleError } from '@/shared/utils/error-handler'
|
|
5
|
+
import { formatOutput } from '@/shared/utils/output'
|
|
6
6
|
import { SlackClient } from '../client'
|
|
7
7
|
import { CredentialManager } from '../credential-manager'
|
|
8
8
|
|
|
9
9
|
async function uploadAction(
|
|
10
10
|
channel: string,
|
|
11
11
|
path: string,
|
|
12
|
-
options: { filename?: string; pretty?: boolean }
|
|
12
|
+
options: { filename?: string; pretty?: boolean },
|
|
13
13
|
): Promise<void> {
|
|
14
14
|
try {
|
|
15
15
|
const credManager = new CredentialManager()
|
|
16
16
|
const workspace = await credManager.getWorkspace()
|
|
17
17
|
|
|
18
18
|
if (!workspace) {
|
|
19
|
-
console.log(
|
|
20
|
-
formatOutput(
|
|
21
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
22
|
-
options.pretty
|
|
23
|
-
)
|
|
24
|
-
)
|
|
19
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
25
20
|
process.exit(1)
|
|
26
21
|
}
|
|
27
22
|
|
|
@@ -57,12 +52,7 @@ async function listAction(options: { channel?: string; pretty?: boolean }): Prom
|
|
|
57
52
|
const workspace = await credManager.getWorkspace()
|
|
58
53
|
|
|
59
54
|
if (!workspace) {
|
|
60
|
-
console.log(
|
|
61
|
-
formatOutput(
|
|
62
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
63
|
-
options.pretty
|
|
64
|
-
)
|
|
65
|
-
)
|
|
55
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
66
56
|
process.exit(1)
|
|
67
57
|
}
|
|
68
58
|
|
|
@@ -93,12 +83,7 @@ async function infoAction(fileId: string, options: { pretty?: boolean }): Promis
|
|
|
93
83
|
const workspace = await credManager.getWorkspace()
|
|
94
84
|
|
|
95
85
|
if (!workspace) {
|
|
96
|
-
console.log(
|
|
97
|
-
formatOutput(
|
|
98
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
99
|
-
options.pretty
|
|
100
|
-
)
|
|
101
|
-
)
|
|
86
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
102
87
|
process.exit(1)
|
|
103
88
|
}
|
|
104
89
|
|
|
@@ -137,17 +122,12 @@ export const fileCommand = new Command('file')
|
|
|
137
122
|
.argument('<channel>', 'channel ID or name')
|
|
138
123
|
.argument('<path>', 'file path')
|
|
139
124
|
.option('--filename <name>', 'override filename')
|
|
140
|
-
.action(uploadAction)
|
|
125
|
+
.action(uploadAction),
|
|
141
126
|
)
|
|
142
127
|
.addCommand(
|
|
143
128
|
new Command('list')
|
|
144
129
|
.description('list files in workspace')
|
|
145
130
|
.option('--channel <id>', 'filter by channel')
|
|
146
|
-
.action(listAction)
|
|
147
|
-
)
|
|
148
|
-
.addCommand(
|
|
149
|
-
new Command('info')
|
|
150
|
-
.description('show file details')
|
|
151
|
-
.argument('<file>', 'file ID')
|
|
152
|
-
.action(infoAction)
|
|
131
|
+
.action(listAction),
|
|
153
132
|
)
|
|
133
|
+
.addCommand(new Command('info').description('show file details').argument('<file>', 'file ID').action(infoAction))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
-
import { handleError } from '
|
|
3
|
-
import { formatOutput } from '
|
|
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
|
import type { SlackMessage } from '../types'
|
|
@@ -8,19 +8,14 @@ import type { SlackMessage } from '../types'
|
|
|
8
8
|
async function sendAction(
|
|
9
9
|
channel: string,
|
|
10
10
|
text: string,
|
|
11
|
-
options: { thread?: string; pretty?: boolean }
|
|
11
|
+
options: { thread?: string; pretty?: boolean },
|
|
12
12
|
): Promise<void> {
|
|
13
13
|
try {
|
|
14
14
|
const credManager = new CredentialManager()
|
|
15
15
|
const workspace = await credManager.getWorkspace()
|
|
16
16
|
|
|
17
17
|
if (!workspace) {
|
|
18
|
-
console.log(
|
|
19
|
-
formatOutput(
|
|
20
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
21
|
-
options.pretty
|
|
22
|
-
)
|
|
23
|
-
)
|
|
18
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
24
19
|
process.exit(1)
|
|
25
20
|
}
|
|
26
21
|
|
|
@@ -43,19 +38,14 @@ async function sendAction(
|
|
|
43
38
|
|
|
44
39
|
async function listAction(
|
|
45
40
|
channel: string,
|
|
46
|
-
options: { limit?: number; thread?: string; pretty?: boolean }
|
|
41
|
+
options: { limit?: number; thread?: string; pretty?: boolean },
|
|
47
42
|
): Promise<void> {
|
|
48
43
|
try {
|
|
49
44
|
const credManager = new CredentialManager()
|
|
50
45
|
const workspace = await credManager.getWorkspace()
|
|
51
46
|
|
|
52
47
|
if (!workspace) {
|
|
53
|
-
console.log(
|
|
54
|
-
formatOutput(
|
|
55
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
56
|
-
options.pretty
|
|
57
|
-
)
|
|
58
|
-
)
|
|
48
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
59
49
|
process.exit(1)
|
|
60
50
|
}
|
|
61
51
|
|
|
@@ -80,22 +70,13 @@ async function listAction(
|
|
|
80
70
|
}
|
|
81
71
|
}
|
|
82
72
|
|
|
83
|
-
async function getAction(
|
|
84
|
-
channel: string,
|
|
85
|
-
ts: string,
|
|
86
|
-
options: { pretty?: boolean }
|
|
87
|
-
): Promise<void> {
|
|
73
|
+
async function getAction(channel: string, ts: string, options: { pretty?: boolean }): Promise<void> {
|
|
88
74
|
try {
|
|
89
75
|
const credManager = new CredentialManager()
|
|
90
76
|
const workspace = await credManager.getWorkspace()
|
|
91
77
|
|
|
92
78
|
if (!workspace) {
|
|
93
|
-
console.log(
|
|
94
|
-
formatOutput(
|
|
95
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
96
|
-
options.pretty
|
|
97
|
-
)
|
|
98
|
-
)
|
|
79
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
99
80
|
process.exit(1)
|
|
100
81
|
}
|
|
101
82
|
|
|
@@ -124,23 +105,13 @@ async function getAction(
|
|
|
124
105
|
}
|
|
125
106
|
}
|
|
126
107
|
|
|
127
|
-
async function updateAction(
|
|
128
|
-
channel: string,
|
|
129
|
-
ts: string,
|
|
130
|
-
text: string,
|
|
131
|
-
options: { pretty?: boolean }
|
|
132
|
-
): Promise<void> {
|
|
108
|
+
async function updateAction(channel: string, ts: string, text: string, options: { pretty?: boolean }): Promise<void> {
|
|
133
109
|
try {
|
|
134
110
|
const credManager = new CredentialManager()
|
|
135
111
|
const workspace = await credManager.getWorkspace()
|
|
136
112
|
|
|
137
113
|
if (!workspace) {
|
|
138
|
-
console.log(
|
|
139
|
-
formatOutput(
|
|
140
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
141
|
-
options.pretty
|
|
142
|
-
)
|
|
143
|
-
)
|
|
114
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
144
115
|
process.exit(1)
|
|
145
116
|
}
|
|
146
117
|
|
|
@@ -163,19 +134,14 @@ async function updateAction(
|
|
|
163
134
|
async function deleteAction(
|
|
164
135
|
channel: string,
|
|
165
136
|
ts: string,
|
|
166
|
-
options: { force?: boolean; pretty?: boolean }
|
|
137
|
+
options: { force?: boolean; pretty?: boolean },
|
|
167
138
|
): Promise<void> {
|
|
168
139
|
try {
|
|
169
140
|
const credManager = new CredentialManager()
|
|
170
141
|
const workspace = await credManager.getWorkspace()
|
|
171
142
|
|
|
172
143
|
if (!workspace) {
|
|
173
|
-
console.log(
|
|
174
|
-
formatOutput(
|
|
175
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
176
|
-
options.pretty
|
|
177
|
-
)
|
|
178
|
-
)
|
|
144
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
179
145
|
process.exit(1)
|
|
180
146
|
}
|
|
181
147
|
|
|
@@ -195,19 +161,14 @@ async function deleteAction(
|
|
|
195
161
|
|
|
196
162
|
async function searchAction(
|
|
197
163
|
query: string,
|
|
198
|
-
options: { sort?: string; sortDir?: string; limit?: number; pretty?: boolean }
|
|
164
|
+
options: { sort?: string; sortDir?: string; limit?: number; pretty?: boolean },
|
|
199
165
|
): Promise<void> {
|
|
200
166
|
try {
|
|
201
167
|
const credManager = new CredentialManager()
|
|
202
168
|
const workspace = await credManager.getWorkspace()
|
|
203
169
|
|
|
204
170
|
if (!workspace) {
|
|
205
|
-
console.log(
|
|
206
|
-
formatOutput(
|
|
207
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
208
|
-
options.pretty
|
|
209
|
-
)
|
|
210
|
-
)
|
|
171
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
211
172
|
process.exit(1)
|
|
212
173
|
}
|
|
213
174
|
|
|
@@ -237,19 +198,14 @@ async function searchAction(
|
|
|
237
198
|
async function repliesAction(
|
|
238
199
|
channel: string,
|
|
239
200
|
threadTs: string,
|
|
240
|
-
options: { limit?: number; oldest?: string; latest?: string; cursor?: string; pretty?: boolean }
|
|
201
|
+
options: { limit?: number; oldest?: string; latest?: string; cursor?: string; pretty?: boolean },
|
|
241
202
|
): Promise<void> {
|
|
242
203
|
try {
|
|
243
204
|
const credManager = new CredentialManager()
|
|
244
205
|
const workspace = await credManager.getWorkspace()
|
|
245
206
|
|
|
246
207
|
if (!workspace) {
|
|
247
|
-
console.log(
|
|
248
|
-
formatOutput(
|
|
249
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
250
|
-
options.pretty
|
|
251
|
-
)
|
|
252
|
-
)
|
|
208
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
253
209
|
process.exit(1)
|
|
254
210
|
}
|
|
255
211
|
|
|
@@ -287,7 +243,7 @@ export const messageCommand = new Command('message')
|
|
|
287
243
|
.argument('<text>', 'Message text')
|
|
288
244
|
.option('--thread <ts>', 'Thread timestamp for replies')
|
|
289
245
|
.option('--pretty', 'Pretty print JSON output')
|
|
290
|
-
.action(sendAction)
|
|
246
|
+
.action(sendAction),
|
|
291
247
|
)
|
|
292
248
|
.addCommand(
|
|
293
249
|
new Command('list')
|
|
@@ -302,7 +258,7 @@ export const messageCommand = new Command('message')
|
|
|
302
258
|
thread: options.thread,
|
|
303
259
|
pretty: options.pretty,
|
|
304
260
|
})
|
|
305
|
-
})
|
|
261
|
+
}),
|
|
306
262
|
)
|
|
307
263
|
.addCommand(
|
|
308
264
|
new Command('get')
|
|
@@ -310,7 +266,7 @@ export const messageCommand = new Command('message')
|
|
|
310
266
|
.argument('<channel>', 'Channel ID or name')
|
|
311
267
|
.argument('<ts>', 'Message timestamp')
|
|
312
268
|
.option('--pretty', 'Pretty print JSON output')
|
|
313
|
-
.action(getAction)
|
|
269
|
+
.action(getAction),
|
|
314
270
|
)
|
|
315
271
|
.addCommand(
|
|
316
272
|
new Command('update')
|
|
@@ -319,7 +275,7 @@ export const messageCommand = new Command('message')
|
|
|
319
275
|
.argument('<ts>', 'Message timestamp')
|
|
320
276
|
.argument('<text>', 'New message text')
|
|
321
277
|
.option('--pretty', 'Pretty print JSON output')
|
|
322
|
-
.action(updateAction)
|
|
278
|
+
.action(updateAction),
|
|
323
279
|
)
|
|
324
280
|
.addCommand(
|
|
325
281
|
new Command('delete')
|
|
@@ -328,7 +284,7 @@ export const messageCommand = new Command('message')
|
|
|
328
284
|
.argument('<ts>', 'Message timestamp')
|
|
329
285
|
.option('--force', 'Skip confirmation')
|
|
330
286
|
.option('--pretty', 'Pretty print JSON output')
|
|
331
|
-
.action(deleteAction)
|
|
287
|
+
.action(deleteAction),
|
|
332
288
|
)
|
|
333
289
|
.addCommand(
|
|
334
290
|
new Command('search')
|
|
@@ -345,7 +301,7 @@ export const messageCommand = new Command('message')
|
|
|
345
301
|
limit: parseInt(options.limit, 10),
|
|
346
302
|
pretty: options.pretty,
|
|
347
303
|
})
|
|
348
|
-
})
|
|
304
|
+
}),
|
|
349
305
|
)
|
|
350
306
|
.addCommand(
|
|
351
307
|
new Command('replies')
|
|
@@ -365,5 +321,5 @@ export const messageCommand = new Command('message')
|
|
|
365
321
|
cursor: options.cursor,
|
|
366
322
|
pretty: options.pretty,
|
|
367
323
|
})
|
|
368
|
-
})
|
|
324
|
+
}),
|
|
369
325
|
)
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
-
import { handleError } from '
|
|
3
|
-
import { formatOutput } from '
|
|
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
|
|
|
7
|
-
async function addAction(
|
|
8
|
-
channel: string,
|
|
9
|
-
ts: string,
|
|
10
|
-
emoji: string,
|
|
11
|
-
options: { pretty?: boolean }
|
|
12
|
-
): Promise<void> {
|
|
7
|
+
async function addAction(channel: string, ts: string, emoji: string, options: { pretty?: boolean }): Promise<void> {
|
|
13
8
|
try {
|
|
14
9
|
const credManager = new CredentialManager()
|
|
15
10
|
const ws = await credManager.getWorkspace()
|
|
16
11
|
|
|
17
12
|
if (!ws) {
|
|
18
|
-
console.log(
|
|
19
|
-
formatOutput(
|
|
20
|
-
{ error: 'No workspace configured. Run "auth extract" first.' },
|
|
21
|
-
options.pretty
|
|
22
|
-
)
|
|
23
|
-
)
|
|
13
|
+
console.log(formatOutput({ error: 'No workspace configured. Run "auth extract" first.' }, options.pretty))
|
|
24
14
|
process.exit(1)
|
|
25
15
|
}
|
|
26
16
|
|
|
@@ -35,31 +25,21 @@ async function addAction(
|
|
|
35
25
|
ts,
|
|
36
26
|
emoji,
|
|
37
27
|
},
|
|
38
|
-
options.pretty
|
|
39
|
-
)
|
|
28
|
+
options.pretty,
|
|
29
|
+
),
|
|
40
30
|
)
|
|
41
31
|
} catch (error) {
|
|
42
32
|
handleError(error as Error)
|
|
43
33
|
}
|
|
44
34
|
}
|
|
45
35
|
|
|
46
|
-
async function removeAction(
|
|
47
|
-
channel: string,
|
|
48
|
-
ts: string,
|
|
49
|
-
emoji: string,
|
|
50
|
-
options: { pretty?: boolean }
|
|
51
|
-
): Promise<void> {
|
|
36
|
+
async function removeAction(channel: string, ts: string, emoji: string, options: { pretty?: boolean }): Promise<void> {
|
|
52
37
|
try {
|
|
53
38
|
const credManager = new CredentialManager()
|
|
54
39
|
const ws = await credManager.getWorkspace()
|
|
55
40
|
|
|
56
41
|
if (!ws) {
|
|
57
|
-
console.log(
|
|
58
|
-
formatOutput(
|
|
59
|
-
{ error: 'No workspace configured. Run "auth extract" first.' },
|
|
60
|
-
options.pretty
|
|
61
|
-
)
|
|
62
|
-
)
|
|
42
|
+
console.log(formatOutput({ error: 'No workspace configured. Run "auth extract" first.' }, options.pretty))
|
|
63
43
|
process.exit(1)
|
|
64
44
|
}
|
|
65
45
|
|
|
@@ -74,30 +54,21 @@ async function removeAction(
|
|
|
74
54
|
ts,
|
|
75
55
|
emoji,
|
|
76
56
|
},
|
|
77
|
-
options.pretty
|
|
78
|
-
)
|
|
57
|
+
options.pretty,
|
|
58
|
+
),
|
|
79
59
|
)
|
|
80
60
|
} catch (error) {
|
|
81
61
|
handleError(error as Error)
|
|
82
62
|
}
|
|
83
63
|
}
|
|
84
64
|
|
|
85
|
-
async function listAction(
|
|
86
|
-
channel: string,
|
|
87
|
-
ts: string,
|
|
88
|
-
options: { pretty?: boolean }
|
|
89
|
-
): Promise<void> {
|
|
65
|
+
async function listAction(channel: string, ts: string, options: { pretty?: boolean }): Promise<void> {
|
|
90
66
|
try {
|
|
91
67
|
const credManager = new CredentialManager()
|
|
92
68
|
const ws = await credManager.getWorkspace()
|
|
93
69
|
|
|
94
70
|
if (!ws) {
|
|
95
|
-
console.log(
|
|
96
|
-
formatOutput(
|
|
97
|
-
{ error: 'No workspace configured. Run "auth extract" first.' },
|
|
98
|
-
options.pretty
|
|
99
|
-
)
|
|
100
|
-
)
|
|
71
|
+
console.log(formatOutput({ error: 'No workspace configured. Run "auth extract" first.' }, options.pretty))
|
|
101
72
|
process.exit(1)
|
|
102
73
|
}
|
|
103
74
|
|
|
@@ -113,8 +84,8 @@ async function listAction(
|
|
|
113
84
|
channel,
|
|
114
85
|
ts,
|
|
115
86
|
},
|
|
116
|
-
options.pretty
|
|
117
|
-
)
|
|
87
|
+
options.pretty,
|
|
88
|
+
),
|
|
118
89
|
)
|
|
119
90
|
process.exit(1)
|
|
120
91
|
}
|
|
@@ -128,8 +99,8 @@ async function listAction(
|
|
|
128
99
|
ts,
|
|
129
100
|
reactions,
|
|
130
101
|
},
|
|
131
|
-
options.pretty
|
|
132
|
-
)
|
|
102
|
+
options.pretty,
|
|
103
|
+
),
|
|
133
104
|
)
|
|
134
105
|
} catch (error) {
|
|
135
106
|
handleError(error as Error)
|
|
@@ -145,7 +116,7 @@ export const reactionCommand = new Command('reaction')
|
|
|
145
116
|
.argument('<ts>', 'Message timestamp')
|
|
146
117
|
.argument('<emoji>', 'Emoji name (without colons)')
|
|
147
118
|
.option('--pretty', 'Pretty print JSON output')
|
|
148
|
-
.action(addAction)
|
|
119
|
+
.action(addAction),
|
|
149
120
|
)
|
|
150
121
|
.addCommand(
|
|
151
122
|
new Command('remove')
|
|
@@ -154,7 +125,7 @@ export const reactionCommand = new Command('reaction')
|
|
|
154
125
|
.argument('<ts>', 'Message timestamp')
|
|
155
126
|
.argument('<emoji>', 'Emoji name (without colons)')
|
|
156
127
|
.option('--pretty', 'Pretty print JSON output')
|
|
157
|
-
.action(removeAction)
|
|
128
|
+
.action(removeAction),
|
|
158
129
|
)
|
|
159
130
|
.addCommand(
|
|
160
131
|
new Command('list')
|
|
@@ -162,5 +133,5 @@ export const reactionCommand = new Command('reaction')
|
|
|
162
133
|
.argument('<channel>', 'Channel ID or name')
|
|
163
134
|
.argument('<ts>', 'Message timestamp')
|
|
164
135
|
.option('--pretty', 'Pretty print JSON output')
|
|
165
|
-
.action(listAction)
|
|
136
|
+
.action(listAction),
|
|
166
137
|
)
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
-
import { handleError } from '
|
|
3
|
-
import { formatOutput } from '
|
|
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
|
|
|
7
|
-
async function listAction(options: {
|
|
8
|
-
limit?: number
|
|
9
|
-
cursor?: string
|
|
10
|
-
pretty?: boolean
|
|
11
|
-
}): Promise<void> {
|
|
7
|
+
async function listAction(options: { limit?: number; cursor?: string; pretty?: boolean }): Promise<void> {
|
|
12
8
|
try {
|
|
13
9
|
const credManager = new CredentialManager()
|
|
14
10
|
const workspace = await credManager.getWorkspace()
|
|
15
11
|
|
|
16
12
|
if (!workspace) {
|
|
17
|
-
console.log(
|
|
18
|
-
formatOutput(
|
|
19
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
20
|
-
options.pretty
|
|
21
|
-
)
|
|
22
|
-
)
|
|
13
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
23
14
|
process.exit(1)
|
|
24
15
|
}
|
|
25
16
|
|
|
@@ -67,5 +58,5 @@ export const savedCommand = new Command('saved').description('Saved items comman
|
|
|
67
58
|
cursor: options.cursor,
|
|
68
59
|
pretty: options.pretty,
|
|
69
60
|
})
|
|
70
|
-
})
|
|
61
|
+
}),
|
|
71
62
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
-
import { handleError } from '
|
|
3
|
-
import { formatOutput } from '
|
|
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 @@ async function listAction(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
|
|
|
@@ -37,9 +32,7 @@ async function listAction(options: { pretty?: boolean }): Promise<void> {
|
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
34
|
|
|
40
|
-
const sections = new Command('sections').description(
|
|
41
|
-
'Manage Slack channel sections (sidebar folders)'
|
|
42
|
-
)
|
|
35
|
+
const sections = new Command('sections').description('Manage Slack channel sections (sidebar folders)')
|
|
43
36
|
|
|
44
37
|
sections
|
|
45
38
|
.command('list')
|
|
@@ -132,9 +132,7 @@ beforeEach(() => {
|
|
|
132
132
|
team: 'Test Workspace',
|
|
133
133
|
})
|
|
134
134
|
|
|
135
|
-
clientListChannelsSpy = spyOn(SlackClient.prototype, 'listChannels').mockResolvedValue(
|
|
136
|
-
mockChannels
|
|
137
|
-
)
|
|
135
|
+
clientListChannelsSpy = spyOn(SlackClient.prototype, 'listChannels').mockResolvedValue(mockChannels)
|
|
138
136
|
clientListUsersSpy = spyOn(SlackClient.prototype, 'listUsers').mockResolvedValue(mockUsers)
|
|
139
137
|
clientGetMessagesSpy = spyOn(SlackClient.prototype, 'getMessages').mockResolvedValue(mockMessages)
|
|
140
138
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
-
import { parallelMap } from '
|
|
3
|
-
import { handleError } from '
|
|
4
|
-
import { formatOutput } from '
|
|
2
|
+
import { parallelMap } from '@/shared/utils/concurrency'
|
|
3
|
+
import { handleError } from '@/shared/utils/error-handler'
|
|
4
|
+
import { formatOutput } from '@/shared/utils/output'
|
|
5
5
|
import { SlackClient } from '../client'
|
|
6
6
|
import { CredentialManager } from '../credential-manager'
|
|
7
7
|
import type { SlackChannel } from '../types'
|
|
@@ -17,12 +17,7 @@ async function snapshotAction(options: {
|
|
|
17
17
|
const workspace = await credManager.getWorkspace()
|
|
18
18
|
|
|
19
19
|
if (!workspace) {
|
|
20
|
-
console.log(
|
|
21
|
-
formatOutput(
|
|
22
|
-
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
23
|
-
options.pretty
|
|
24
|
-
)
|
|
25
|
-
)
|
|
20
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty))
|
|
26
21
|
process.exit(1)
|
|
27
22
|
}
|
|
28
23
|
|
|
@@ -64,7 +59,7 @@ async function snapshotAction(options: {
|
|
|
64
59
|
channel_name: channel.name,
|
|
65
60
|
}))
|
|
66
61
|
},
|
|
67
|
-
5
|
|
62
|
+
5,
|
|
68
63
|
)
|
|
69
64
|
|
|
70
65
|
snapshot.recent_messages = channelMessages.flat().map((msg) => ({
|
|
@@ -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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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 }],
|