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,7 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'node:path'
|
|
2
2
|
import { Command } from 'commander'
|
|
3
|
-
import { handleError } from '
|
|
4
|
-
import { formatOutput } from '
|
|
3
|
+
import { handleError } from '@/shared/utils/error-handler'
|
|
4
|
+
import { formatOutput } from '@/shared/utils/output'
|
|
5
5
|
import { DiscordClient } from '../client'
|
|
6
6
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
7
7
|
import type { DiscordFile } from '../types'
|
|
@@ -9,16 +9,14 @@ import type { DiscordFile } from '../types'
|
|
|
9
9
|
export async function uploadAction(
|
|
10
10
|
channelId: 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 DiscordCredentialManager()
|
|
16
16
|
const config = await credManager.load()
|
|
17
17
|
|
|
18
18
|
if (!config.token) {
|
|
19
|
-
console.log(
|
|
20
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
21
|
-
)
|
|
19
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
22
20
|
process.exit(1)
|
|
23
21
|
}
|
|
24
22
|
|
|
@@ -47,9 +45,7 @@ export async function listAction(channelId: string, options: { pretty?: boolean
|
|
|
47
45
|
const config = await credManager.load()
|
|
48
46
|
|
|
49
47
|
if (!config.token) {
|
|
50
|
-
console.log(
|
|
51
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
52
|
-
)
|
|
48
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
53
49
|
process.exit(1)
|
|
54
50
|
}
|
|
55
51
|
|
|
@@ -70,19 +66,13 @@ export async function listAction(channelId: string, options: { pretty?: boolean
|
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
68
|
|
|
73
|
-
export async function infoAction(
|
|
74
|
-
channelId: string,
|
|
75
|
-
fileId: string,
|
|
76
|
-
options: { pretty?: boolean }
|
|
77
|
-
): Promise<void> {
|
|
69
|
+
export async function infoAction(channelId: string, fileId: string, options: { pretty?: boolean }): Promise<void> {
|
|
78
70
|
try {
|
|
79
71
|
const credManager = new DiscordCredentialManager()
|
|
80
72
|
const config = await credManager.load()
|
|
81
73
|
|
|
82
74
|
if (!config.token) {
|
|
83
|
-
console.log(
|
|
84
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
85
|
-
)
|
|
75
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
86
76
|
process.exit(1)
|
|
87
77
|
}
|
|
88
78
|
|
|
@@ -117,18 +107,15 @@ export const fileCommand = new Command('file')
|
|
|
117
107
|
.argument('<channel>', 'channel ID')
|
|
118
108
|
.argument('<path>', 'file path')
|
|
119
109
|
.option('--filename <name>', 'override filename')
|
|
120
|
-
.action(uploadAction)
|
|
110
|
+
.action(uploadAction),
|
|
121
111
|
)
|
|
122
112
|
.addCommand(
|
|
123
|
-
new Command('list')
|
|
124
|
-
.description('list files in channel')
|
|
125
|
-
.argument('<channel>', 'channel ID')
|
|
126
|
-
.action(listAction)
|
|
113
|
+
new Command('list').description('list files in channel').argument('<channel>', 'channel ID').action(listAction),
|
|
127
114
|
)
|
|
128
115
|
.addCommand(
|
|
129
116
|
new Command('info')
|
|
130
117
|
.description('show file details')
|
|
131
118
|
.argument('<channel>', 'channel ID')
|
|
132
119
|
.argument('<file>', 'file ID')
|
|
133
|
-
.action(infoAction)
|
|
120
|
+
.action(infoAction),
|
|
134
121
|
)
|
|
@@ -2,44 +2,42 @@ import { Command } from 'commander'
|
|
|
2
2
|
import { DiscordClient } from '../client'
|
|
3
3
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
4
4
|
|
|
5
|
-
export const friendCommand = new Command('friend')
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
.
|
|
12
|
-
const credManager = new DiscordCredentialManager()
|
|
13
|
-
const config = await credManager.load()
|
|
5
|
+
export const friendCommand = new Command('friend').description('Manage Discord relationships (friends)').addCommand(
|
|
6
|
+
new Command('list')
|
|
7
|
+
.description('List all relationships')
|
|
8
|
+
.option('--pretty', 'Pretty print output')
|
|
9
|
+
.action(async (options) => {
|
|
10
|
+
const credManager = new DiscordCredentialManager()
|
|
11
|
+
const config = await credManager.load()
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
if (!config.token) {
|
|
14
|
+
throw new Error('No Discord token found. Run auth extract first.')
|
|
15
|
+
}
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
const client = new DiscordClient(config.token)
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
const relationships = await client.getRelationships()
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
if (options.pretty) {
|
|
22
|
+
const typeNames: Record<number, string> = {
|
|
23
|
+
1: 'Friend',
|
|
24
|
+
2: 'Blocked',
|
|
25
|
+
3: 'Incoming Request',
|
|
26
|
+
4: 'Outgoing Request',
|
|
27
|
+
}
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
console.log(JSON.stringify(relationships, null, 2))
|
|
29
|
+
console.log(`\nRelationships (${relationships.length}):\n`)
|
|
30
|
+
for (const rel of relationships) {
|
|
31
|
+
const displayName = rel.user.global_name || rel.user.username
|
|
32
|
+
const nickname = rel.nickname ? ` (${rel.nickname})` : ''
|
|
33
|
+
const type = typeNames[rel.type] || `Type ${rel.type}`
|
|
34
|
+
console.log(` ${displayName}${nickname} - ${type}`)
|
|
35
|
+
console.log(` ID: ${rel.user.id}`)
|
|
36
|
+
console.log(` Username: ${rel.user.username}`)
|
|
37
|
+
console.log()
|
|
43
38
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
39
|
+
} else {
|
|
40
|
+
console.log(JSON.stringify(relationships, null, 2))
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
)
|
|
@@ -1,22 +1,20 @@
|
|
|
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 { DiscordClient } from '../client'
|
|
5
5
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
6
6
|
|
|
7
7
|
async function searchAction(
|
|
8
8
|
guildId: string,
|
|
9
9
|
query: string,
|
|
10
|
-
options: { limit?: string; pretty?: boolean }
|
|
10
|
+
options: { limit?: string; pretty?: boolean },
|
|
11
11
|
): Promise<void> {
|
|
12
12
|
try {
|
|
13
13
|
const credManager = new DiscordCredentialManager()
|
|
14
14
|
const config = await credManager.load()
|
|
15
15
|
|
|
16
16
|
if (!config.token) {
|
|
17
|
-
console.log(
|
|
18
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
19
|
-
)
|
|
17
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
20
18
|
process.exit(1)
|
|
21
19
|
}
|
|
22
20
|
|
|
@@ -55,5 +53,5 @@ export const memberCommand = new Command('member')
|
|
|
55
53
|
.argument('<query>', 'Search query')
|
|
56
54
|
.option('--limit <number>', 'Maximum number of results (default: 10)')
|
|
57
55
|
.option('--pretty', 'Pretty print JSON output')
|
|
58
|
-
.action(searchAction)
|
|
56
|
+
.action(searchAction),
|
|
59
57
|
)
|
|
@@ -1,22 +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 { DiscordClient } from '../client'
|
|
5
5
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
6
6
|
|
|
7
|
-
export async function listAction(options: {
|
|
8
|
-
limit?: number
|
|
9
|
-
guild?: string
|
|
10
|
-
pretty?: boolean
|
|
11
|
-
}): Promise<void> {
|
|
7
|
+
export async function listAction(options: { limit?: number; guild?: string; pretty?: boolean }): Promise<void> {
|
|
12
8
|
try {
|
|
13
9
|
const credManager = new DiscordCredentialManager()
|
|
14
10
|
const config = await credManager.load()
|
|
15
11
|
|
|
16
12
|
if (!config.token) {
|
|
17
|
-
console.log(
|
|
18
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
19
|
-
)
|
|
13
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
20
14
|
process.exit(1)
|
|
21
15
|
}
|
|
22
16
|
|
|
@@ -55,5 +49,5 @@ export const mentionCommand = new Command('mention').description('Mention comman
|
|
|
55
49
|
guild: options.guild,
|
|
56
50
|
pretty: options.pretty,
|
|
57
51
|
})
|
|
58
|
-
})
|
|
52
|
+
}),
|
|
59
53
|
)
|
|
@@ -46,9 +46,7 @@ beforeEach(() => {
|
|
|
46
46
|
timestamp: '2025-01-29T10:00:00Z',
|
|
47
47
|
})
|
|
48
48
|
|
|
49
|
-
clientDeleteMessageSpy = spyOn(DiscordClient.prototype, 'deleteMessage').mockResolvedValue(
|
|
50
|
-
undefined
|
|
51
|
-
)
|
|
49
|
+
clientDeleteMessageSpy = spyOn(DiscordClient.prototype, 'deleteMessage').mockResolvedValue(undefined)
|
|
52
50
|
|
|
53
51
|
clientAckMessageSpy = spyOn(DiscordClient.prototype, 'ackMessage').mockResolvedValue(undefined)
|
|
54
52
|
|
|
@@ -1,23 +1,17 @@
|
|
|
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 { DiscordClient } from '../client'
|
|
5
5
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
6
6
|
import type { DiscordMessage, DiscordSearchOptions } from '../types'
|
|
7
7
|
|
|
8
|
-
export async function sendAction(
|
|
9
|
-
channelId: string,
|
|
10
|
-
content: string,
|
|
11
|
-
options: { pretty?: boolean }
|
|
12
|
-
): Promise<void> {
|
|
8
|
+
export async function sendAction(channelId: string, content: string, options: { pretty?: boolean }): Promise<void> {
|
|
13
9
|
try {
|
|
14
10
|
const credManager = new DiscordCredentialManager()
|
|
15
11
|
const config = await credManager.load()
|
|
16
12
|
|
|
17
13
|
if (!config.token) {
|
|
18
|
-
console.log(
|
|
19
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
20
|
-
)
|
|
14
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
21
15
|
process.exit(1)
|
|
22
16
|
}
|
|
23
17
|
|
|
@@ -37,18 +31,13 @@ export async function sendAction(
|
|
|
37
31
|
}
|
|
38
32
|
}
|
|
39
33
|
|
|
40
|
-
export async function listAction(
|
|
41
|
-
channelId: string,
|
|
42
|
-
options: { limit?: number; pretty?: boolean }
|
|
43
|
-
): Promise<void> {
|
|
34
|
+
export async function listAction(channelId: string, options: { limit?: number; pretty?: boolean }): Promise<void> {
|
|
44
35
|
try {
|
|
45
36
|
const credManager = new DiscordCredentialManager()
|
|
46
37
|
const config = await credManager.load()
|
|
47
38
|
|
|
48
39
|
if (!config.token) {
|
|
49
|
-
console.log(
|
|
50
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
51
|
-
)
|
|
40
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
52
41
|
process.exit(1)
|
|
53
42
|
}
|
|
54
43
|
|
|
@@ -70,19 +59,13 @@ export async function listAction(
|
|
|
70
59
|
}
|
|
71
60
|
}
|
|
72
61
|
|
|
73
|
-
export async function getAction(
|
|
74
|
-
channelId: string,
|
|
75
|
-
messageId: string,
|
|
76
|
-
options: { pretty?: boolean }
|
|
77
|
-
): Promise<void> {
|
|
62
|
+
export async function getAction(channelId: string, messageId: string, options: { pretty?: boolean }): Promise<void> {
|
|
78
63
|
try {
|
|
79
64
|
const credManager = new DiscordCredentialManager()
|
|
80
65
|
const config = await credManager.load()
|
|
81
66
|
|
|
82
67
|
if (!config.token) {
|
|
83
|
-
console.log(
|
|
84
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
85
|
-
)
|
|
68
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
86
69
|
process.exit(1)
|
|
87
70
|
}
|
|
88
71
|
|
|
@@ -111,23 +94,19 @@ export async function getAction(
|
|
|
111
94
|
export async function deleteAction(
|
|
112
95
|
channelId: string,
|
|
113
96
|
messageId: string,
|
|
114
|
-
options: { force?: boolean; pretty?: boolean }
|
|
97
|
+
options: { force?: boolean; pretty?: boolean },
|
|
115
98
|
): Promise<void> {
|
|
116
99
|
try {
|
|
117
100
|
const credManager = new DiscordCredentialManager()
|
|
118
101
|
const config = await credManager.load()
|
|
119
102
|
|
|
120
103
|
if (!config.token) {
|
|
121
|
-
console.log(
|
|
122
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
123
|
-
)
|
|
104
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
124
105
|
process.exit(1)
|
|
125
106
|
}
|
|
126
107
|
|
|
127
108
|
if (!options.force) {
|
|
128
|
-
console.log(
|
|
129
|
-
formatOutput({ warning: 'Use --force to confirm deletion', messageId }, options.pretty)
|
|
130
|
-
)
|
|
109
|
+
console.log(formatOutput({ warning: 'Use --force to confirm deletion', messageId }, options.pretty))
|
|
131
110
|
process.exit(0)
|
|
132
111
|
}
|
|
133
112
|
|
|
@@ -140,19 +119,13 @@ export async function deleteAction(
|
|
|
140
119
|
}
|
|
141
120
|
}
|
|
142
121
|
|
|
143
|
-
export async function ackAction(
|
|
144
|
-
channelId: string,
|
|
145
|
-
messageId: string,
|
|
146
|
-
options: { pretty?: boolean }
|
|
147
|
-
): Promise<void> {
|
|
122
|
+
export async function ackAction(channelId: string, messageId: string, options: { pretty?: boolean }): Promise<void> {
|
|
148
123
|
try {
|
|
149
124
|
const credManager = new DiscordCredentialManager()
|
|
150
125
|
const config = await credManager.load()
|
|
151
126
|
|
|
152
127
|
if (!config.token) {
|
|
153
|
-
console.log(
|
|
154
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
155
|
-
)
|
|
128
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
156
129
|
process.exit(1)
|
|
157
130
|
}
|
|
158
131
|
|
|
@@ -176,26 +149,19 @@ export async function searchAction(
|
|
|
176
149
|
limit?: number
|
|
177
150
|
offset?: number
|
|
178
151
|
pretty?: boolean
|
|
179
|
-
}
|
|
152
|
+
},
|
|
180
153
|
): Promise<void> {
|
|
181
154
|
try {
|
|
182
155
|
const credManager = new DiscordCredentialManager()
|
|
183
156
|
const config = await credManager.load()
|
|
184
157
|
|
|
185
158
|
if (!config.token) {
|
|
186
|
-
console.log(
|
|
187
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
188
|
-
)
|
|
159
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
189
160
|
process.exit(1)
|
|
190
161
|
}
|
|
191
162
|
|
|
192
163
|
if (!config.current_server) {
|
|
193
|
-
console.log(
|
|
194
|
-
formatOutput(
|
|
195
|
-
{ error: 'No server selected. Run "server switch <server-id>" first.' },
|
|
196
|
-
options.pretty
|
|
197
|
-
)
|
|
198
|
-
)
|
|
164
|
+
console.log(formatOutput({ error: 'No server selected. Run "server switch <server-id>" first.' }, options.pretty))
|
|
199
165
|
process.exit(1)
|
|
200
166
|
}
|
|
201
167
|
|
|
@@ -216,11 +182,7 @@ export async function searchAction(
|
|
|
216
182
|
if (options.limit !== undefined) searchOptions.limit = options.limit
|
|
217
183
|
if (options.offset !== undefined) searchOptions.offset = options.offset
|
|
218
184
|
|
|
219
|
-
const { results, total } = await client.searchMessages(
|
|
220
|
-
config.current_server,
|
|
221
|
-
query,
|
|
222
|
-
searchOptions
|
|
223
|
-
)
|
|
185
|
+
const { results, total } = await client.searchMessages(config.current_server, query, searchOptions)
|
|
224
186
|
|
|
225
187
|
const output = {
|
|
226
188
|
total_results: total,
|
|
@@ -248,7 +210,7 @@ export const messageCommand = new Command('message')
|
|
|
248
210
|
.argument('<channel-id>', 'Channel ID')
|
|
249
211
|
.argument('<content>', 'Message content')
|
|
250
212
|
.option('--pretty', 'Pretty print JSON output')
|
|
251
|
-
.action(sendAction)
|
|
213
|
+
.action(sendAction),
|
|
252
214
|
)
|
|
253
215
|
.addCommand(
|
|
254
216
|
new Command('list')
|
|
@@ -261,7 +223,7 @@ export const messageCommand = new Command('message')
|
|
|
261
223
|
limit: parseInt(options.limit, 10),
|
|
262
224
|
pretty: options.pretty,
|
|
263
225
|
})
|
|
264
|
-
})
|
|
226
|
+
}),
|
|
265
227
|
)
|
|
266
228
|
.addCommand(
|
|
267
229
|
new Command('get')
|
|
@@ -269,7 +231,7 @@ export const messageCommand = new Command('message')
|
|
|
269
231
|
.argument('<channel-id>', 'Channel ID')
|
|
270
232
|
.argument('<message-id>', 'Message ID')
|
|
271
233
|
.option('--pretty', 'Pretty print JSON output')
|
|
272
|
-
.action(getAction)
|
|
234
|
+
.action(getAction),
|
|
273
235
|
)
|
|
274
236
|
.addCommand(
|
|
275
237
|
new Command('delete')
|
|
@@ -278,7 +240,7 @@ export const messageCommand = new Command('message')
|
|
|
278
240
|
.argument('<message-id>', 'Message ID')
|
|
279
241
|
.option('--force', 'Skip confirmation')
|
|
280
242
|
.option('--pretty', 'Pretty print JSON output')
|
|
281
|
-
.action(deleteAction)
|
|
243
|
+
.action(deleteAction),
|
|
282
244
|
)
|
|
283
245
|
.addCommand(
|
|
284
246
|
new Command('ack')
|
|
@@ -286,7 +248,7 @@ export const messageCommand = new Command('message')
|
|
|
286
248
|
.argument('<channel-id>', 'Channel ID')
|
|
287
249
|
.argument('<message-id>', 'Message ID')
|
|
288
250
|
.option('--pretty', 'Pretty print JSON output')
|
|
289
|
-
.action(ackAction)
|
|
251
|
+
.action(ackAction),
|
|
290
252
|
)
|
|
291
253
|
.addCommand(
|
|
292
254
|
new Command('search')
|
|
@@ -311,5 +273,5 @@ export const messageCommand = new Command('message')
|
|
|
311
273
|
offset: parseInt(options.offset, 10),
|
|
312
274
|
pretty: options.pretty,
|
|
313
275
|
})
|
|
314
|
-
})
|
|
276
|
+
}),
|
|
315
277
|
)
|
|
@@ -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 { DiscordClient } from '../client'
|
|
5
5
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
6
6
|
|
|
@@ -10,9 +10,7 @@ async function getAction(userId: string, options: { pretty?: boolean }): Promise
|
|
|
10
10
|
const config = await credManager.load()
|
|
11
11
|
|
|
12
12
|
if (!config.token) {
|
|
13
|
-
console.log(
|
|
14
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
15
|
-
)
|
|
13
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
16
14
|
process.exit(1)
|
|
17
15
|
}
|
|
18
16
|
|
|
@@ -29,19 +27,13 @@ async function getAction(userId: string, options: { pretty?: boolean }): Promise
|
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
async function setAction(
|
|
33
|
-
userId: string,
|
|
34
|
-
note: string,
|
|
35
|
-
options: { pretty?: boolean }
|
|
36
|
-
): Promise<void> {
|
|
30
|
+
async function setAction(userId: string, note: string, options: { pretty?: boolean }): Promise<void> {
|
|
37
31
|
try {
|
|
38
32
|
const credManager = new DiscordCredentialManager()
|
|
39
33
|
const config = await credManager.load()
|
|
40
34
|
|
|
41
35
|
if (!config.token) {
|
|
42
|
-
console.log(
|
|
43
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
44
|
-
)
|
|
36
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
45
37
|
process.exit(1)
|
|
46
38
|
}
|
|
47
39
|
|
|
@@ -61,7 +53,7 @@ export const noteCommand = new Command('note')
|
|
|
61
53
|
.description('Get note for a user')
|
|
62
54
|
.argument('<user-id>', 'User ID')
|
|
63
55
|
.option('--pretty', 'Pretty print JSON output')
|
|
64
|
-
.action(getAction)
|
|
56
|
+
.action(getAction),
|
|
65
57
|
)
|
|
66
58
|
.addCommand(
|
|
67
59
|
new Command('set')
|
|
@@ -69,5 +61,5 @@ export const noteCommand = new Command('note')
|
|
|
69
61
|
.argument('<user-id>', 'User ID')
|
|
70
62
|
.argument('<note>', 'Note content')
|
|
71
63
|
.option('--pretty', 'Pretty print JSON output')
|
|
72
|
-
.action(setAction)
|
|
64
|
+
.action(setAction),
|
|
73
65
|
)
|
|
@@ -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 { DiscordClient } from '../client'
|
|
5
5
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
6
6
|
|
|
@@ -10,9 +10,7 @@ async function getAction(userId: string, options: { pretty?: boolean }): Promise
|
|
|
10
10
|
const config = await credManager.load()
|
|
11
11
|
|
|
12
12
|
if (!config.token) {
|
|
13
|
-
console.log(
|
|
14
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
15
|
-
)
|
|
13
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
16
14
|
process.exit(1)
|
|
17
15
|
}
|
|
18
16
|
|
|
@@ -51,5 +49,5 @@ export const profileCommand = new Command('profile')
|
|
|
51
49
|
.description('Get user profile')
|
|
52
50
|
.argument('<user-id>', 'User ID')
|
|
53
51
|
.option('--pretty', 'Pretty print JSON output')
|
|
54
|
-
.action(getAction)
|
|
52
|
+
.action(getAction),
|
|
55
53
|
)
|
|
@@ -12,9 +12,7 @@ beforeEach(() => {
|
|
|
12
12
|
// Spy on DiscordClient.prototype methods
|
|
13
13
|
clientAddReactionSpy = spyOn(DiscordClient.prototype, 'addReaction').mockResolvedValue(undefined)
|
|
14
14
|
|
|
15
|
-
clientRemoveReactionSpy = spyOn(DiscordClient.prototype, 'removeReaction').mockResolvedValue(
|
|
16
|
-
undefined
|
|
17
|
-
)
|
|
15
|
+
clientRemoveReactionSpy = spyOn(DiscordClient.prototype, 'removeReaction').mockResolvedValue(undefined)
|
|
18
16
|
|
|
19
17
|
clientGetMessageSpy = spyOn(DiscordClient.prototype, 'getMessage').mockResolvedValue({
|
|
20
18
|
id: 'msg123',
|