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.
- package/.claude-plugin/marketplace.json +27 -1
- package/.claude-plugin/plugin.json +17 -4
- package/.env.template +3 -0
- package/.github/workflows/release.yml +80 -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 +10 -3
- 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 +2 -0
- 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 +1 -2
- 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/slack/types.d.ts +24 -0
- package/dist/src/platforms/slack/types.d.ts.map +1 -1
- package/dist/src/platforms/slack/types.js +7 -0
- package/dist/src/platforms/slack/types.js.map +1 -1
- package/dist/src/platforms/slackbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/cli.js +1 -1
- package/dist/src/platforms/slackbot/cli.js.map +1 -1
- package/dist/src/platforms/slackbot/client.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/client.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/channel.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/commands/message.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/reaction.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/commands/reaction.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/commands/shared.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/user.js.map +1 -1
- package/dist/src/platforms/slackbot/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/credential-manager.js +2 -4
- package/dist/src/platforms/slackbot/credential-manager.js.map +1 -1
- 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/slack.mdx +51 -1
- package/docs/content/docs/integrations/slackbot.mdx +11 -1
- 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/package.json +16 -9
- package/scripts/prepublish.ts +11 -0
- package/skills/agent-discord/SKILL.md +14 -0
- package/skills/agent-slack/SKILL.md +14 -0
- package/skills/agent-slackbot/SKILL.md +14 -0
- package/skills/agent-teams/SKILL.md +14 -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 +6 -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.test.ts +37 -33
- package/src/platforms/slack/commands/reaction.ts +21 -51
- 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 +11 -1
- package/src/platforms/slackbot/cli.ts +1 -7
- package/src/platforms/slackbot/client.test.ts +7 -7
- package/src/platforms/slackbot/client.ts +4 -11
- package/src/platforms/slackbot/commands/auth.test.ts +1 -1
- package/src/platforms/slackbot/commands/auth.ts +7 -7
- package/src/platforms/slackbot/commands/channel.ts +4 -4
- package/src/platforms/slackbot/commands/message.ts +16 -29
- package/src/platforms/slackbot/commands/reaction.ts +6 -16
- package/src/platforms/slackbot/commands/shared.ts +2 -4
- package/src/platforms/slackbot/commands/user.ts +4 -4
- package/src/platforms/slackbot/credential-manager.ts +2 -7
- package/src/platforms/slackbot/types.ts +1 -1
- 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,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 { TeamsClient } from '../client'
|
|
5
5
|
import { TeamsCredentialManager } from '../credential-manager'
|
|
6
6
|
|
|
@@ -10,9 +10,7 @@ export async function listAction(teamId: string, options: { pretty?: boolean }):
|
|
|
10
10
|
const config = await credManager.loadConfig()
|
|
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
|
|
|
@@ -32,19 +30,13 @@ export async function listAction(teamId: string, options: { pretty?: boolean }):
|
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
export async function infoAction(
|
|
36
|
-
teamId: string,
|
|
37
|
-
channelId: string,
|
|
38
|
-
options: { pretty?: boolean }
|
|
39
|
-
): Promise<void> {
|
|
33
|
+
export async function infoAction(teamId: string, channelId: string, options: { pretty?: boolean }): Promise<void> {
|
|
40
34
|
try {
|
|
41
35
|
const credManager = new TeamsCredentialManager()
|
|
42
36
|
const config = await credManager.loadConfig()
|
|
43
37
|
|
|
44
38
|
if (!config?.token) {
|
|
45
|
-
console.log(
|
|
46
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
47
|
-
)
|
|
39
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
48
40
|
process.exit(1)
|
|
49
41
|
}
|
|
50
42
|
|
|
@@ -67,16 +59,14 @@ export async function infoAction(
|
|
|
67
59
|
export async function historyAction(
|
|
68
60
|
teamId: string,
|
|
69
61
|
channelId: string,
|
|
70
|
-
options: { limit?: number; pretty?: boolean }
|
|
62
|
+
options: { limit?: number; pretty?: boolean },
|
|
71
63
|
): Promise<void> {
|
|
72
64
|
try {
|
|
73
65
|
const credManager = new TeamsCredentialManager()
|
|
74
66
|
const config = await credManager.loadConfig()
|
|
75
67
|
|
|
76
68
|
if (!config?.token) {
|
|
77
|
-
console.log(
|
|
78
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
79
|
-
)
|
|
69
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
80
70
|
process.exit(1)
|
|
81
71
|
}
|
|
82
72
|
|
|
@@ -103,7 +93,7 @@ export const channelCommand = new Command('channel')
|
|
|
103
93
|
.description('List channels in a team')
|
|
104
94
|
.argument('<team-id>', 'Team ID')
|
|
105
95
|
.option('--pretty', 'Pretty print JSON output')
|
|
106
|
-
.action(listAction)
|
|
96
|
+
.action(listAction),
|
|
107
97
|
)
|
|
108
98
|
.addCommand(
|
|
109
99
|
new Command('info')
|
|
@@ -111,7 +101,7 @@ export const channelCommand = new Command('channel')
|
|
|
111
101
|
.argument('<team-id>', 'Team ID')
|
|
112
102
|
.argument('<channel-id>', 'Channel ID')
|
|
113
103
|
.option('--pretty', 'Pretty print JSON output')
|
|
114
|
-
.action(infoAction)
|
|
104
|
+
.action(infoAction),
|
|
115
105
|
)
|
|
116
106
|
.addCommand(
|
|
117
107
|
new Command('history')
|
|
@@ -125,5 +115,5 @@ export const channelCommand = new Command('channel')
|
|
|
125
115
|
limit: parseInt(options.limit, 10),
|
|
126
116
|
pretty: options.pretty,
|
|
127
117
|
})
|
|
128
|
-
})
|
|
118
|
+
}),
|
|
129
119
|
)
|
|
@@ -34,10 +34,7 @@ beforeEach(() => {
|
|
|
34
34
|
},
|
|
35
35
|
])
|
|
36
36
|
|
|
37
|
-
credManagerLoadConfigSpy = spyOn(
|
|
38
|
-
TeamsCredentialManager.prototype,
|
|
39
|
-
'loadConfig'
|
|
40
|
-
).mockResolvedValue({
|
|
37
|
+
credManagerLoadConfigSpy = spyOn(TeamsCredentialManager.prototype, 'loadConfig').mockResolvedValue({
|
|
41
38
|
token: 'test_token',
|
|
42
39
|
current_team: 'team_123',
|
|
43
40
|
teams: { team_123: { team_id: 'team_123', team_name: 'Test Team' } },
|
|
@@ -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 { TeamsClient } from '../client'
|
|
6
6
|
import { TeamsCredentialManager } from '../credential-manager'
|
|
7
7
|
import type { TeamsFile } from '../types'
|
|
@@ -10,16 +10,14 @@ export async function uploadAction(
|
|
|
10
10
|
teamId: string,
|
|
11
11
|
channelId: string,
|
|
12
12
|
path: string,
|
|
13
|
-
options: { pretty?: boolean }
|
|
13
|
+
options: { pretty?: boolean },
|
|
14
14
|
): Promise<void> {
|
|
15
15
|
try {
|
|
16
16
|
const credManager = new TeamsCredentialManager()
|
|
17
17
|
const config = await credManager.loadConfig()
|
|
18
18
|
|
|
19
19
|
if (!config?.token) {
|
|
20
|
-
console.log(
|
|
21
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
22
|
-
)
|
|
20
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
23
21
|
process.exit(1)
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -41,19 +39,13 @@ export async function uploadAction(
|
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
export async function listAction(
|
|
45
|
-
teamId: string,
|
|
46
|
-
channelId: string,
|
|
47
|
-
options: { pretty?: boolean }
|
|
48
|
-
): Promise<void> {
|
|
42
|
+
export async function listAction(teamId: string, channelId: string, options: { pretty?: boolean }): Promise<void> {
|
|
49
43
|
try {
|
|
50
44
|
const credManager = new TeamsCredentialManager()
|
|
51
45
|
const config = await credManager.loadConfig()
|
|
52
46
|
|
|
53
47
|
if (!config?.token) {
|
|
54
|
-
console.log(
|
|
55
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
56
|
-
)
|
|
48
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
57
49
|
process.exit(1)
|
|
58
50
|
}
|
|
59
51
|
|
|
@@ -78,16 +70,14 @@ export async function infoAction(
|
|
|
78
70
|
teamId: string,
|
|
79
71
|
channelId: string,
|
|
80
72
|
fileId: string,
|
|
81
|
-
options: { pretty?: boolean }
|
|
73
|
+
options: { pretty?: boolean },
|
|
82
74
|
): Promise<void> {
|
|
83
75
|
try {
|
|
84
76
|
const credManager = new TeamsCredentialManager()
|
|
85
77
|
const config = await credManager.loadConfig()
|
|
86
78
|
|
|
87
79
|
if (!config?.token) {
|
|
88
|
-
console.log(
|
|
89
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
90
|
-
)
|
|
80
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
91
81
|
process.exit(1)
|
|
92
82
|
}
|
|
93
83
|
|
|
@@ -123,7 +113,7 @@ export const fileCommand = new Command('file')
|
|
|
123
113
|
.argument('<channel>', 'channel ID')
|
|
124
114
|
.argument('<path>', 'file path')
|
|
125
115
|
.option('--pretty', 'Pretty print JSON output')
|
|
126
|
-
.action(uploadAction)
|
|
116
|
+
.action(uploadAction),
|
|
127
117
|
)
|
|
128
118
|
.addCommand(
|
|
129
119
|
new Command('list')
|
|
@@ -131,7 +121,7 @@ export const fileCommand = new Command('file')
|
|
|
131
121
|
.argument('<team>', 'team ID')
|
|
132
122
|
.argument('<channel>', 'channel ID')
|
|
133
123
|
.option('--pretty', 'Pretty print JSON output')
|
|
134
|
-
.action(listAction)
|
|
124
|
+
.action(listAction),
|
|
135
125
|
)
|
|
136
126
|
.addCommand(
|
|
137
127
|
new Command('info')
|
|
@@ -140,5 +130,5 @@ export const fileCommand = new Command('file')
|
|
|
140
130
|
.argument('<channel>', 'channel ID')
|
|
141
131
|
.argument('<file>', 'file ID')
|
|
142
132
|
.option('--pretty', 'Pretty print JSON output')
|
|
143
|
-
.action(infoAction)
|
|
133
|
+
.action(infoAction),
|
|
144
134
|
)
|
|
@@ -44,9 +44,7 @@ beforeEach(() => {
|
|
|
44
44
|
timestamp: '2025-01-29T10:00:00Z',
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
-
clientDeleteMessageSpy = spyOn(TeamsClient.prototype, 'deleteMessage').mockResolvedValue(
|
|
48
|
-
undefined
|
|
49
|
-
)
|
|
47
|
+
clientDeleteMessageSpy = spyOn(TeamsClient.prototype, 'deleteMessage').mockResolvedValue(undefined)
|
|
50
48
|
|
|
51
49
|
credManagerLoadSpy = spyOn(TeamsCredentialManager.prototype, 'loadConfig').mockResolvedValue({
|
|
52
50
|
token: 'test_token',
|
|
@@ -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 { TeamsClient } from '../client'
|
|
5
5
|
import { TeamsCredentialManager } from '../credential-manager'
|
|
6
6
|
import type { TeamsMessage } from '../types'
|
|
@@ -9,16 +9,14 @@ export async function sendAction(
|
|
|
9
9
|
teamId: string,
|
|
10
10
|
channelId: string,
|
|
11
11
|
content: string,
|
|
12
|
-
options: { pretty?: boolean }
|
|
12
|
+
options: { pretty?: boolean },
|
|
13
13
|
): Promise<void> {
|
|
14
14
|
try {
|
|
15
15
|
const credManager = new TeamsCredentialManager()
|
|
16
16
|
const config = await credManager.loadConfig()
|
|
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
|
|
|
@@ -41,16 +39,14 @@ export async function sendAction(
|
|
|
41
39
|
export async function listAction(
|
|
42
40
|
teamId: string,
|
|
43
41
|
channelId: string,
|
|
44
|
-
options: { limit?: number; pretty?: boolean }
|
|
42
|
+
options: { limit?: number; pretty?: boolean },
|
|
45
43
|
): Promise<void> {
|
|
46
44
|
try {
|
|
47
45
|
const credManager = new TeamsCredentialManager()
|
|
48
46
|
const config = await credManager.loadConfig()
|
|
49
47
|
|
|
50
48
|
if (!config?.token) {
|
|
51
|
-
console.log(
|
|
52
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
53
|
-
)
|
|
49
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
54
50
|
process.exit(1)
|
|
55
51
|
}
|
|
56
52
|
|
|
@@ -75,16 +71,14 @@ export async function getAction(
|
|
|
75
71
|
teamId: string,
|
|
76
72
|
channelId: string,
|
|
77
73
|
messageId: string,
|
|
78
|
-
options: { pretty?: boolean }
|
|
74
|
+
options: { pretty?: boolean },
|
|
79
75
|
): Promise<void> {
|
|
80
76
|
try {
|
|
81
77
|
const credManager = new TeamsCredentialManager()
|
|
82
78
|
const config = await credManager.loadConfig()
|
|
83
79
|
|
|
84
80
|
if (!config?.token) {
|
|
85
|
-
console.log(
|
|
86
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
87
|
-
)
|
|
81
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
88
82
|
process.exit(1)
|
|
89
83
|
}
|
|
90
84
|
|
|
@@ -113,23 +107,19 @@ export async function deleteAction(
|
|
|
113
107
|
teamId: string,
|
|
114
108
|
channelId: string,
|
|
115
109
|
messageId: string,
|
|
116
|
-
options: { force?: boolean; pretty?: boolean }
|
|
110
|
+
options: { force?: boolean; pretty?: boolean },
|
|
117
111
|
): Promise<void> {
|
|
118
112
|
try {
|
|
119
113
|
const credManager = new TeamsCredentialManager()
|
|
120
114
|
const config = await credManager.loadConfig()
|
|
121
115
|
|
|
122
116
|
if (!config?.token) {
|
|
123
|
-
console.log(
|
|
124
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
125
|
-
)
|
|
117
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
126
118
|
process.exit(1)
|
|
127
119
|
}
|
|
128
120
|
|
|
129
121
|
if (!options.force) {
|
|
130
|
-
console.log(
|
|
131
|
-
formatOutput({ warning: 'Use --force to confirm deletion', messageId }, options.pretty)
|
|
132
|
-
)
|
|
122
|
+
console.log(formatOutput({ warning: 'Use --force to confirm deletion', messageId }, options.pretty))
|
|
133
123
|
process.exit(0)
|
|
134
124
|
}
|
|
135
125
|
|
|
@@ -151,7 +141,7 @@ export const messageCommand = new Command('message')
|
|
|
151
141
|
.argument('<channel-id>', 'Channel ID')
|
|
152
142
|
.argument('<content>', 'Message content')
|
|
153
143
|
.option('--pretty', 'Pretty print JSON output')
|
|
154
|
-
.action(sendAction)
|
|
144
|
+
.action(sendAction),
|
|
155
145
|
)
|
|
156
146
|
.addCommand(
|
|
157
147
|
new Command('list')
|
|
@@ -165,7 +155,7 @@ export const messageCommand = new Command('message')
|
|
|
165
155
|
limit: parseInt(options.limit, 10),
|
|
166
156
|
pretty: options.pretty,
|
|
167
157
|
})
|
|
168
|
-
})
|
|
158
|
+
}),
|
|
169
159
|
)
|
|
170
160
|
.addCommand(
|
|
171
161
|
new Command('get')
|
|
@@ -174,7 +164,7 @@ export const messageCommand = new Command('message')
|
|
|
174
164
|
.argument('<channel-id>', 'Channel ID')
|
|
175
165
|
.argument('<message-id>', 'Message ID')
|
|
176
166
|
.option('--pretty', 'Pretty print JSON output')
|
|
177
|
-
.action(getAction)
|
|
167
|
+
.action(getAction),
|
|
178
168
|
)
|
|
179
169
|
.addCommand(
|
|
180
170
|
new Command('delete')
|
|
@@ -184,5 +174,5 @@ export const messageCommand = new Command('message')
|
|
|
184
174
|
.argument('<message-id>', 'Message ID')
|
|
185
175
|
.option('--force', 'Skip confirmation')
|
|
186
176
|
.option('--pretty', 'Pretty print JSON output')
|
|
187
|
-
.action(deleteAction)
|
|
177
|
+
.action(deleteAction),
|
|
188
178
|
)
|
|
@@ -9,13 +9,8 @@ let credManagerLoadConfigSpy: ReturnType<typeof spyOn>
|
|
|
9
9
|
|
|
10
10
|
beforeEach(() => {
|
|
11
11
|
clientAddReactionSpy = spyOn(TeamsClient.prototype, 'addReaction').mockResolvedValue(undefined)
|
|
12
|
-
clientRemoveReactionSpy = spyOn(TeamsClient.prototype, 'removeReaction').mockResolvedValue(
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
credManagerLoadConfigSpy = spyOn(
|
|
16
|
-
TeamsCredentialManager.prototype,
|
|
17
|
-
'loadConfig'
|
|
18
|
-
).mockResolvedValue({
|
|
12
|
+
clientRemoveReactionSpy = spyOn(TeamsClient.prototype, 'removeReaction').mockResolvedValue(undefined)
|
|
13
|
+
credManagerLoadConfigSpy = spyOn(TeamsCredentialManager.prototype, 'loadConfig').mockResolvedValue({
|
|
19
14
|
token: 'test-token',
|
|
20
15
|
current_team: null,
|
|
21
16
|
teams: {},
|
|
@@ -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 { TeamsClient } from '../client'
|
|
5
5
|
import { TeamsCredentialManager } from '../credential-manager'
|
|
6
6
|
|
|
@@ -9,16 +9,14 @@ export async function addAction(
|
|
|
9
9
|
channelId: string,
|
|
10
10
|
messageId: string,
|
|
11
11
|
emoji: string,
|
|
12
|
-
options: { pretty?: boolean }
|
|
12
|
+
options: { pretty?: boolean },
|
|
13
13
|
): Promise<void> {
|
|
14
14
|
try {
|
|
15
15
|
const credManager = new TeamsCredentialManager()
|
|
16
16
|
const config = await credManager.loadConfig()
|
|
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
|
|
|
@@ -34,8 +32,8 @@ export async function addAction(
|
|
|
34
32
|
message_id: messageId,
|
|
35
33
|
emoji,
|
|
36
34
|
},
|
|
37
|
-
options.pretty
|
|
38
|
-
)
|
|
35
|
+
options.pretty,
|
|
36
|
+
),
|
|
39
37
|
)
|
|
40
38
|
} catch (error) {
|
|
41
39
|
handleError(error as Error)
|
|
@@ -47,16 +45,14 @@ export async function removeAction(
|
|
|
47
45
|
channelId: string,
|
|
48
46
|
messageId: string,
|
|
49
47
|
emoji: string,
|
|
50
|
-
options: { pretty?: boolean }
|
|
48
|
+
options: { pretty?: boolean },
|
|
51
49
|
): Promise<void> {
|
|
52
50
|
try {
|
|
53
51
|
const credManager = new TeamsCredentialManager()
|
|
54
52
|
const config = await credManager.loadConfig()
|
|
55
53
|
|
|
56
54
|
if (!config?.token) {
|
|
57
|
-
console.log(
|
|
58
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
59
|
-
)
|
|
55
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
60
56
|
process.exit(1)
|
|
61
57
|
}
|
|
62
58
|
|
|
@@ -72,8 +68,8 @@ export async function removeAction(
|
|
|
72
68
|
message_id: messageId,
|
|
73
69
|
emoji,
|
|
74
70
|
},
|
|
75
|
-
options.pretty
|
|
76
|
-
)
|
|
71
|
+
options.pretty,
|
|
72
|
+
),
|
|
77
73
|
)
|
|
78
74
|
} catch (error) {
|
|
79
75
|
handleError(error as Error)
|
|
@@ -90,7 +86,7 @@ export const reactionCommand = new Command('reaction')
|
|
|
90
86
|
.argument('<message-id>', 'Message ID')
|
|
91
87
|
.argument('<emoji>', 'Emoji name')
|
|
92
88
|
.option('--pretty', 'Pretty print JSON output')
|
|
93
|
-
.action(addAction)
|
|
89
|
+
.action(addAction),
|
|
94
90
|
)
|
|
95
91
|
.addCommand(
|
|
96
92
|
new Command('remove')
|
|
@@ -100,5 +96,5 @@ export const reactionCommand = new Command('reaction')
|
|
|
100
96
|
.argument('<message-id>', 'Message ID')
|
|
101
97
|
.argument('<emoji>', 'Emoji name')
|
|
102
98
|
.option('--pretty', 'Pretty print JSON output')
|
|
103
|
-
.action(removeAction)
|
|
99
|
+
.action(removeAction),
|
|
104
100
|
)
|
|
@@ -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 { TeamsClient } from '../client'
|
|
6
6
|
import { TeamsCredentialManager } from '../credential-manager'
|
|
7
7
|
import type { TeamsChannel } from '../types'
|
|
@@ -18,19 +18,14 @@ export async function snapshotAction(options: {
|
|
|
18
18
|
const config = await credManager.loadConfig()
|
|
19
19
|
|
|
20
20
|
if (!config?.token) {
|
|
21
|
-
console.log(
|
|
22
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
23
|
-
)
|
|
21
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
24
22
|
process.exit(1)
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
const teamId = options.teamId || config.current_team
|
|
28
26
|
if (!teamId) {
|
|
29
27
|
console.log(
|
|
30
|
-
formatOutput(
|
|
31
|
-
{ error: 'No current team set. Run "team switch" first or use --team-id.' },
|
|
32
|
-
options.pretty
|
|
33
|
-
)
|
|
28
|
+
formatOutput({ error: 'No current team set. Run "team switch" first or use --team-id.' }, options.pretty),
|
|
34
29
|
)
|
|
35
30
|
process.exit(1)
|
|
36
31
|
}
|
|
@@ -66,7 +61,7 @@ export async function snapshotAction(options: {
|
|
|
66
61
|
channel_name: channel.name,
|
|
67
62
|
}))
|
|
68
63
|
},
|
|
69
|
-
5
|
|
64
|
+
5,
|
|
70
65
|
)
|
|
71
66
|
|
|
72
67
|
snapshot.recent_messages = channelMessages.flat().map((msg) => ({
|
|
@@ -15,22 +15,17 @@ beforeEach(() => {
|
|
|
15
15
|
{ id: 'team-2', name: 'Team Two', description: 'Second team' },
|
|
16
16
|
])
|
|
17
17
|
|
|
18
|
-
clientGetTeamSpy = spyOn(TeamsClient.prototype, 'getTeam').mockImplementation(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return { id: 'team-1', name: 'Team One', description: 'First team' }
|
|
22
|
-
}
|
|
23
|
-
if (teamId === 'team-2') {
|
|
24
|
-
return { id: 'team-2', name: 'Team Two', description: 'Second team' }
|
|
25
|
-
}
|
|
26
|
-
throw new Error('Team not found')
|
|
18
|
+
clientGetTeamSpy = spyOn(TeamsClient.prototype, 'getTeam').mockImplementation(async (teamId: string) => {
|
|
19
|
+
if (teamId === 'team-1') {
|
|
20
|
+
return { id: 'team-1', name: 'Team One', description: 'First team' }
|
|
27
21
|
}
|
|
28
|
-
|
|
22
|
+
if (teamId === 'team-2') {
|
|
23
|
+
return { id: 'team-2', name: 'Team Two', description: 'Second team' }
|
|
24
|
+
}
|
|
25
|
+
throw new Error('Team not found')
|
|
26
|
+
})
|
|
29
27
|
|
|
30
|
-
credManagerLoadConfigSpy = spyOn(
|
|
31
|
-
TeamsCredentialManager.prototype,
|
|
32
|
-
'loadConfig'
|
|
33
|
-
).mockResolvedValue({
|
|
28
|
+
credManagerLoadConfigSpy = spyOn(TeamsCredentialManager.prototype, 'loadConfig').mockResolvedValue({
|
|
34
29
|
token: 'test-token',
|
|
35
30
|
current_team: 'team-1',
|
|
36
31
|
teams: {
|
|
@@ -39,20 +34,14 @@ beforeEach(() => {
|
|
|
39
34
|
},
|
|
40
35
|
})
|
|
41
36
|
|
|
42
|
-
credManagerSetCurrentTeamSpy = spyOn(
|
|
43
|
-
TeamsCredentialManager.prototype,
|
|
44
|
-
'setCurrentTeam'
|
|
45
|
-
).mockResolvedValue(undefined)
|
|
37
|
+
credManagerSetCurrentTeamSpy = spyOn(TeamsCredentialManager.prototype, 'setCurrentTeam').mockResolvedValue(undefined)
|
|
46
38
|
|
|
47
|
-
credManagerGetCurrentTeamSpy = spyOn(
|
|
48
|
-
|
|
49
|
-
'
|
|
50
|
-
|
|
39
|
+
credManagerGetCurrentTeamSpy = spyOn(TeamsCredentialManager.prototype, 'getCurrentTeam').mockResolvedValue({
|
|
40
|
+
team_id: 'team-1',
|
|
41
|
+
team_name: 'Team One',
|
|
42
|
+
})
|
|
51
43
|
|
|
52
|
-
credManagerSaveConfigSpy = spyOn(
|
|
53
|
-
TeamsCredentialManager.prototype,
|
|
54
|
-
'saveConfig'
|
|
55
|
-
).mockResolvedValue(undefined)
|
|
44
|
+
credManagerSaveConfigSpy = spyOn(TeamsCredentialManager.prototype, 'saveConfig').mockResolvedValue(undefined)
|
|
56
45
|
})
|
|
57
46
|
|
|
58
47
|
afterEach(() => {
|
|
@@ -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 { TeamsClient } from '../client'
|
|
5
5
|
import { TeamsCredentialManager } from '../credential-manager'
|
|
6
6
|
|
|
@@ -28,9 +28,7 @@ export async function infoAction(teamId: string, options: { pretty?: boolean }):
|
|
|
28
28
|
const config = await credManager.loadConfig()
|
|
29
29
|
|
|
30
30
|
if (!config?.token) {
|
|
31
|
-
console.log(
|
|
32
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
33
|
-
)
|
|
31
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
34
32
|
process.exit(1)
|
|
35
33
|
}
|
|
36
34
|
|
|
@@ -73,18 +71,14 @@ export async function currentAction(options: { pretty?: boolean }): Promise<void
|
|
|
73
71
|
const config = await credManager.loadConfig()
|
|
74
72
|
|
|
75
73
|
if (!config?.current_team) {
|
|
76
|
-
console.log(
|
|
77
|
-
formatOutput({ error: 'No current team set. Run "auth extract" first.' }, options.pretty)
|
|
78
|
-
)
|
|
74
|
+
console.log(formatOutput({ error: 'No current team set. Run "auth extract" first.' }, options.pretty))
|
|
79
75
|
process.exit(1)
|
|
80
76
|
}
|
|
81
77
|
|
|
82
78
|
const team = config.teams[config.current_team]
|
|
83
79
|
|
|
84
80
|
if (!team) {
|
|
85
|
-
console.log(
|
|
86
|
-
formatOutput({ error: 'Current team not found in configuration.' }, options.pretty)
|
|
87
|
-
)
|
|
81
|
+
console.log(formatOutput({ error: 'Current team not found in configuration.' }, options.pretty))
|
|
88
82
|
process.exit(1)
|
|
89
83
|
}
|
|
90
84
|
|
|
@@ -130,35 +124,32 @@ export async function removeAction(teamId: string, options: { pretty?: boolean }
|
|
|
130
124
|
export const teamCommand = new Command('team')
|
|
131
125
|
.description('Team management commands')
|
|
132
126
|
.addCommand(
|
|
133
|
-
new Command('list')
|
|
134
|
-
.description('List all teams')
|
|
135
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
136
|
-
.action(listAction)
|
|
127
|
+
new Command('list').description('List all teams').option('--pretty', 'Pretty print JSON output').action(listAction),
|
|
137
128
|
)
|
|
138
129
|
.addCommand(
|
|
139
130
|
new Command('info')
|
|
140
131
|
.description('Get team info')
|
|
141
132
|
.argument('<team-id>', 'Team ID')
|
|
142
133
|
.option('--pretty', 'Pretty print JSON output')
|
|
143
|
-
.action(infoAction)
|
|
134
|
+
.action(infoAction),
|
|
144
135
|
)
|
|
145
136
|
.addCommand(
|
|
146
137
|
new Command('switch')
|
|
147
138
|
.description('Switch to team')
|
|
148
139
|
.argument('<team-id>', 'Team ID')
|
|
149
140
|
.option('--pretty', 'Pretty print JSON output')
|
|
150
|
-
.action(switchAction)
|
|
141
|
+
.action(switchAction),
|
|
151
142
|
)
|
|
152
143
|
.addCommand(
|
|
153
144
|
new Command('current')
|
|
154
145
|
.description('Show current team')
|
|
155
146
|
.option('--pretty', 'Pretty print JSON output')
|
|
156
|
-
.action(currentAction)
|
|
147
|
+
.action(currentAction),
|
|
157
148
|
)
|
|
158
149
|
.addCommand(
|
|
159
150
|
new Command('remove')
|
|
160
151
|
.description('Remove team from config')
|
|
161
152
|
.argument('<team-id>', 'Team ID')
|
|
162
153
|
.option('--pretty', 'Pretty print JSON output')
|
|
163
|
-
.action(removeAction)
|
|
154
|
+
.action(removeAction),
|
|
164
155
|
)
|
|
@@ -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 { TeamsClient } from '../client'
|
|
5
5
|
import { TeamsCredentialManager } from '../credential-manager'
|
|
6
6
|
|
|
@@ -10,9 +10,7 @@ async function listAction(teamId: string, options: { pretty?: boolean }): Promis
|
|
|
10
10
|
const config = await credManager.loadConfig()
|
|
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
|
|
|
@@ -38,9 +36,7 @@ async function infoAction(userId: string, options: { pretty?: boolean }): Promis
|
|
|
38
36
|
const config = await credManager.loadConfig()
|
|
39
37
|
|
|
40
38
|
if (!config?.token) {
|
|
41
|
-
console.log(
|
|
42
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
43
|
-
)
|
|
39
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
44
40
|
process.exit(1)
|
|
45
41
|
}
|
|
46
42
|
|
|
@@ -66,9 +62,7 @@ async function meAction(options: { pretty?: boolean }): Promise<void> {
|
|
|
66
62
|
const config = await credManager.loadConfig()
|
|
67
63
|
|
|
68
64
|
if (!config?.token) {
|
|
69
|
-
console.log(
|
|
70
|
-
formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty)
|
|
71
|
-
)
|
|
65
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
72
66
|
process.exit(1)
|
|
73
67
|
}
|
|
74
68
|
|
|
@@ -95,18 +89,18 @@ export const userCommand = new Command('user')
|
|
|
95
89
|
.description('List team members')
|
|
96
90
|
.argument('<team-id>', 'Team ID')
|
|
97
91
|
.option('--pretty', 'Pretty print JSON output')
|
|
98
|
-
.action(listAction)
|
|
92
|
+
.action(listAction),
|
|
99
93
|
)
|
|
100
94
|
.addCommand(
|
|
101
95
|
new Command('info')
|
|
102
96
|
.description('Get user info')
|
|
103
97
|
.argument('<user-id>', 'User ID')
|
|
104
98
|
.option('--pretty', 'Pretty print JSON output')
|
|
105
|
-
.action(infoAction)
|
|
99
|
+
.action(infoAction),
|
|
106
100
|
)
|
|
107
101
|
.addCommand(
|
|
108
102
|
new Command('me')
|
|
109
103
|
.description('Show current authenticated user')
|
|
110
104
|
.option('--pretty', 'Pretty print JSON output')
|
|
111
|
-
.action(meAction)
|
|
105
|
+
.action(meAction),
|
|
112
106
|
)
|