agent-messenger 1.0.0 → 1.1.0
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/commands/release.md +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/ci.yml +1 -1
- package/.github/workflows/e2e.yml.disabled +69 -0
- package/README.md +16 -14
- package/biome.json +33 -1
- package/bun.lock +63 -0
- package/dist/package.json +8 -4
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +4 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/platforms/discord/cli.js +1 -1
- package/dist/src/platforms/discord/client.d.ts.map +1 -1
- package/dist/src/platforms/discord/client.js +3 -3
- package/dist/src/platforms/discord/client.js.map +1 -1
- package/dist/src/platforms/discord/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/user.js +10 -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 +18 -12
- package/dist/src/platforms/discord/credential-manager.js.map +1 -1
- package/dist/src/platforms/slack/cli.js +1 -1
- package/dist/src/platforms/slack/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/slack/credential-manager.js +20 -6
- package/dist/src/platforms/slack/credential-manager.js.map +1 -1
- package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/slack/token-extractor.js +34 -9
- package/dist/src/platforms/slack/token-extractor.js.map +1 -1
- package/dist/src/platforms/teams/cli.d.ts.map +1 -0
- package/dist/{cli.js → src/platforms/teams/cli.js} +11 -10
- package/dist/src/platforms/teams/cli.js.map +1 -0
- package/dist/src/platforms/teams/client.d.ts +32 -0
- package/dist/src/platforms/teams/client.d.ts.map +1 -0
- package/dist/src/platforms/teams/client.js +202 -0
- package/dist/src/platforms/teams/client.js.map +1 -0
- package/dist/src/platforms/teams/commands/auth.d.ts +14 -0
- package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/auth.js +176 -0
- package/dist/src/platforms/teams/commands/auth.js.map +1 -0
- package/dist/src/platforms/teams/commands/channel.d.ts +13 -0
- package/dist/src/platforms/teams/commands/channel.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/channel.js +97 -0
- package/dist/src/platforms/teams/commands/channel.js.map +1 -0
- package/dist/src/platforms/teams/commands/file.d.ts +12 -0
- package/dist/src/platforms/teams/commands/file.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/file.js +104 -0
- package/dist/src/platforms/teams/commands/file.js.map +1 -0
- package/dist/{commands → src/platforms/teams/commands}/index.d.ts +5 -2
- package/dist/src/platforms/teams/commands/index.d.ts.map +1 -0
- package/dist/{commands → src/platforms/teams/commands}/index.js +5 -2
- package/dist/src/platforms/teams/commands/index.js.map +1 -0
- package/dist/src/platforms/teams/commands/message.d.ts +17 -0
- package/dist/src/platforms/teams/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/message.js +133 -0
- package/dist/src/platforms/teams/commands/message.js.map +1 -0
- package/dist/src/platforms/teams/commands/reaction.d.ts +9 -0
- package/dist/src/platforms/teams/commands/reaction.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/reaction.js +68 -0
- package/dist/src/platforms/teams/commands/reaction.js.map +1 -0
- package/dist/src/platforms/teams/commands/snapshot.d.ts +10 -0
- package/dist/src/platforms/teams/commands/snapshot.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/snapshot.js +85 -0
- package/dist/src/platforms/teams/commands/snapshot.js.map +1 -0
- package/dist/src/platforms/teams/commands/team.d.ts +18 -0
- package/dist/src/platforms/teams/commands/team.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/team.js +130 -0
- package/dist/src/platforms/teams/commands/team.js.map +1 -0
- package/dist/src/platforms/teams/commands/user.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/user.js +88 -0
- package/dist/src/platforms/teams/commands/user.js.map +1 -0
- package/dist/src/platforms/teams/credential-manager.d.ts +18 -0
- package/dist/src/platforms/teams/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/teams/credential-manager.js +81 -0
- package/dist/src/platforms/teams/credential-manager.js.map +1 -0
- package/dist/src/platforms/teams/index.d.ts +4 -0
- package/dist/src/platforms/teams/index.d.ts.map +1 -0
- package/dist/src/platforms/teams/index.js +6 -0
- package/dist/src/platforms/teams/index.js.map +1 -0
- package/dist/src/platforms/teams/token-extractor.d.ts +36 -0
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -0
- package/dist/src/platforms/teams/token-extractor.js +335 -0
- package/dist/src/platforms/teams/token-extractor.js.map +1 -0
- package/dist/src/platforms/teams/types.d.ts +209 -0
- package/dist/src/platforms/teams/types.d.ts.map +1 -0
- package/dist/src/platforms/teams/types.js +65 -0
- package/dist/src/platforms/teams/types.js.map +1 -0
- package/docs/teams.md +321 -0
- package/e2e/README.md +256 -0
- package/e2e/config.ts +45 -0
- package/e2e/discord.e2e.test.ts +252 -0
- package/e2e/helpers.ts +107 -0
- package/e2e/slack.e2e.test.ts +309 -0
- package/package.json +8 -4
- package/scripts/postbuild.ts +15 -0
- package/skills/agent-teams/SKILL.md +292 -0
- package/skills/agent-teams/references/authentication.md +375 -0
- package/skills/agent-teams/references/common-patterns.md +596 -0
- package/skills/agent-teams/templates/monitor-channel.sh +239 -0
- package/skills/agent-teams/templates/post-message.sh +224 -0
- package/skills/agent-teams/templates/team-summary.sh +210 -0
- package/src/cli.ts +4 -0
- package/src/platforms/discord/client.ts +3 -3
- package/src/platforms/discord/commands/auth.test.ts +48 -32
- package/src/platforms/discord/commands/channel.test.ts +54 -42
- package/src/platforms/discord/commands/file.test.ts +40 -53
- package/src/platforms/discord/commands/guild.test.ts +47 -27
- package/src/platforms/discord/commands/message.test.ts +54 -51
- package/src/platforms/discord/commands/reaction.test.ts +54 -42
- package/src/platforms/discord/commands/user.ts +12 -1
- package/src/platforms/discord/credential-manager.test.ts +137 -136
- package/src/platforms/discord/credential-manager.ts +20 -13
- package/src/platforms/discord/token-extractor.test.ts +133 -383
- package/{tests → src/platforms/slack}/cli.test.ts +3 -3
- package/{tests/slack-client.test.ts → src/platforms/slack/client.test.ts} +1 -1
- package/{tests → src/platforms/slack}/commands/auth.test.ts +25 -13
- package/{tests → src/platforms/slack}/commands/channel.test.ts +2 -2
- package/{tests → src/platforms/slack}/commands/file.test.ts +2 -2
- package/{tests → src/platforms/slack}/commands/message.test.ts +2 -2
- package/{tests → src/platforms/slack}/commands/reaction.test.ts +1 -1
- package/{tests → src/platforms/slack}/commands/snapshot.test.ts +117 -105
- package/{tests → src/platforms/slack}/commands/user.test.ts +3 -3
- package/{tests → src/platforms/slack}/commands/workspace.test.ts +44 -95
- package/{tests → src/platforms/slack}/credential-manager.test.ts +2 -2
- package/src/platforms/slack/credential-manager.ts +22 -7
- package/src/platforms/slack/token-extractor-node-test.ts +40 -0
- package/src/platforms/slack/token-extractor-node.test.ts +10 -0
- package/src/platforms/slack/token-extractor.ts +36 -10
- package/{tests → src/platforms/slack}/types.test.ts +1 -1
- package/src/platforms/teams/cli.ts +36 -0
- package/src/platforms/teams/client.test.ts +500 -0
- package/src/platforms/teams/client.ts +365 -0
- package/src/platforms/teams/commands/auth.test.ts +99 -0
- package/src/platforms/teams/commands/auth.ts +232 -0
- package/src/platforms/teams/commands/channel.test.ts +147 -0
- package/src/platforms/teams/commands/channel.ts +129 -0
- package/src/platforms/teams/commands/file.test.ts +88 -0
- package/src/platforms/teams/commands/file.ts +144 -0
- package/src/platforms/teams/commands/index.ts +12 -0
- package/src/platforms/teams/commands/message.test.ts +110 -0
- package/src/platforms/teams/commands/message.ts +188 -0
- package/src/platforms/teams/commands/reaction.test.ts +87 -0
- package/src/platforms/teams/commands/reaction.ts +104 -0
- package/src/platforms/teams/commands/snapshot.test.ts +35 -0
- package/src/platforms/teams/commands/snapshot.ts +115 -0
- package/src/platforms/teams/commands/team.test.ts +157 -0
- package/src/platforms/teams/commands/team.ts +164 -0
- package/src/platforms/teams/commands/user.test.ts +83 -0
- package/src/platforms/teams/commands/user.ts +112 -0
- package/src/platforms/teams/credential-manager.test.ts +178 -0
- package/src/platforms/teams/credential-manager.ts +92 -0
- package/src/platforms/teams/index.ts +5 -0
- package/src/platforms/teams/token-extractor.test.ts +429 -0
- package/src/platforms/teams/token-extractor.ts +462 -0
- package/src/platforms/teams/types.test.ts +226 -0
- package/src/platforms/teams/types.ts +140 -0
- package/tsconfig.json +1 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -3
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js +0 -140
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/channel.d.ts +0 -3
- package/dist/commands/channel.d.ts.map +0 -1
- package/dist/commands/channel.js +0 -118
- package/dist/commands/channel.js.map +0 -1
- package/dist/commands/file.d.ts +0 -3
- package/dist/commands/file.d.ts.map +0 -1
- package/dist/commands/file.js +0 -113
- package/dist/commands/file.js.map +0 -1
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/message.d.ts +0 -3
- package/dist/commands/message.d.ts.map +0 -1
- package/dist/commands/message.js +0 -214
- package/dist/commands/message.js.map +0 -1
- package/dist/commands/reaction.d.ts +0 -3
- package/dist/commands/reaction.d.ts.map +0 -1
- package/dist/commands/reaction.js +0 -100
- package/dist/commands/reaction.js.map +0 -1
- package/dist/commands/snapshot.d.ts +0 -3
- package/dist/commands/snapshot.d.ts.map +0 -1
- package/dist/commands/snapshot.js +0 -88
- package/dist/commands/snapshot.js.map +0 -1
- package/dist/commands/user.d.ts.map +0 -1
- package/dist/commands/user.js +0 -96
- package/dist/commands/user.js.map +0 -1
- package/dist/commands/workspace.d.ts +0 -3
- package/dist/commands/workspace.d.ts.map +0 -1
- package/dist/commands/workspace.js +0 -89
- package/dist/commands/workspace.js.map +0 -1
- package/dist/lib/credential-manager.d.ts +0 -13
- package/dist/lib/credential-manager.d.ts.map +0 -1
- package/dist/lib/credential-manager.js +0 -58
- package/dist/lib/credential-manager.js.map +0 -1
- package/dist/lib/index.d.ts +0 -3
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js +0 -3
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/ref-manager.d.ts +0 -26
- package/dist/lib/ref-manager.d.ts.map +0 -1
- package/dist/lib/ref-manager.js +0 -92
- package/dist/lib/ref-manager.js.map +0 -1
- package/dist/lib/slack-client.d.ts +0 -37
- package/dist/lib/slack-client.d.ts.map +0 -1
- package/dist/lib/slack-client.js +0 -379
- package/dist/lib/slack-client.js.map +0 -1
- package/dist/lib/token-extractor.d.ts +0 -28
- package/dist/lib/token-extractor.d.ts.map +0 -1
- package/dist/lib/token-extractor.js +0 -401
- package/dist/lib/token-extractor.js.map +0 -1
- package/dist/src/platforms/discord/client.test.d.ts +0 -2
- package/dist/src/platforms/discord/client.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/client.test.js +0 -367
- package/dist/src/platforms/discord/client.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/auth.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/auth.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/auth.test.js +0 -65
- package/dist/src/platforms/discord/commands/auth.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/channel.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/channel.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/channel.test.js +0 -136
- package/dist/src/platforms/discord/commands/channel.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/file.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/file.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/file.test.js +0 -83
- package/dist/src/platforms/discord/commands/file.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/guild.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/guild.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/guild.test.js +0 -100
- package/dist/src/platforms/discord/commands/guild.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/message.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/message.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/message.test.js +0 -91
- package/dist/src/platforms/discord/commands/message.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/reaction.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/reaction.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/reaction.test.js +0 -115
- package/dist/src/platforms/discord/commands/reaction.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/snapshot.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/snapshot.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/snapshot.test.js +0 -25
- package/dist/src/platforms/discord/commands/snapshot.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/user.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/user.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/user.test.js +0 -103
- package/dist/src/platforms/discord/commands/user.test.js.map +0 -1
- package/dist/src/platforms/discord/credential-manager.test.d.ts +0 -2
- package/dist/src/platforms/discord/credential-manager.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/credential-manager.test.js +0 -136
- package/dist/src/platforms/discord/credential-manager.test.js.map +0 -1
- package/dist/src/platforms/discord/token-extractor.test.d.ts +0 -2
- package/dist/src/platforms/discord/token-extractor.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/token-extractor.test.js +0 -789
- package/dist/src/platforms/discord/token-extractor.test.js.map +0 -1
- package/dist/src/platforms/discord/types.test.d.ts +0 -2
- package/dist/src/platforms/discord/types.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/types.test.js +0 -211
- package/dist/src/platforms/discord/types.test.js.map +0 -1
- package/dist/src/shared/utils/concurrency.test.d.ts +0 -2
- package/dist/src/shared/utils/concurrency.test.d.ts.map +0 -1
- package/dist/src/shared/utils/concurrency.test.js +0 -39
- package/dist/src/shared/utils/concurrency.test.js.map +0 -1
- package/dist/tests/cli.test.d.ts +0 -2
- package/dist/tests/cli.test.d.ts.map +0 -1
- package/dist/tests/cli.test.js +0 -83
- package/dist/tests/cli.test.js.map +0 -1
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/CURRENT +0 -1
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOCK +0 -0
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOG +0 -3
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOG.old +0 -1
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/MANIFEST-000004 +0 -0
- package/dist/tests/commands/auth.test.d.ts +0 -2
- package/dist/tests/commands/auth.test.d.ts.map +0 -1
- package/dist/tests/commands/auth.test.js +0 -304
- package/dist/tests/commands/auth.test.js.map +0 -1
- package/dist/tests/commands/channel.test.d.ts +0 -2
- package/dist/tests/commands/channel.test.d.ts.map +0 -1
- package/dist/tests/commands/channel.test.js +0 -166
- package/dist/tests/commands/channel.test.js.map +0 -1
- package/dist/tests/commands/file.test.d.ts +0 -2
- package/dist/tests/commands/file.test.d.ts.map +0 -1
- package/dist/tests/commands/file.test.js +0 -175
- package/dist/tests/commands/file.test.js.map +0 -1
- package/dist/tests/commands/message.test.d.ts +0 -2
- package/dist/tests/commands/message.test.d.ts.map +0 -1
- package/dist/tests/commands/message.test.js +0 -293
- package/dist/tests/commands/message.test.js.map +0 -1
- package/dist/tests/commands/reaction.test.d.ts +0 -2
- package/dist/tests/commands/reaction.test.d.ts.map +0 -1
- package/dist/tests/commands/reaction.test.js +0 -84
- package/dist/tests/commands/reaction.test.js.map +0 -1
- package/dist/tests/commands/snapshot.test.d.ts +0 -2
- package/dist/tests/commands/snapshot.test.d.ts.map +0 -1
- package/dist/tests/commands/snapshot.test.js +0 -280
- package/dist/tests/commands/snapshot.test.js.map +0 -1
- package/dist/tests/commands/user.test.d.ts +0 -2
- package/dist/tests/commands/user.test.d.ts.map +0 -1
- package/dist/tests/commands/user.test.js +0 -117
- package/dist/tests/commands/user.test.js.map +0 -1
- package/dist/tests/commands/workspace.test.d.ts +0 -2
- package/dist/tests/commands/workspace.test.d.ts.map +0 -1
- package/dist/tests/commands/workspace.test.js +0 -453
- package/dist/tests/commands/workspace.test.js.map +0 -1
- package/dist/tests/credential-manager.test.d.ts +0 -2
- package/dist/tests/credential-manager.test.d.ts.map +0 -1
- package/dist/tests/credential-manager.test.js +0 -199
- package/dist/tests/credential-manager.test.js.map +0 -1
- package/dist/tests/slack-client.test.d.ts +0 -2
- package/dist/tests/slack-client.test.d.ts.map +0 -1
- package/dist/tests/slack-client.test.js +0 -741
- package/dist/tests/slack-client.test.js.map +0 -1
- package/dist/tests/types.test.d.ts +0 -2
- package/dist/tests/types.test.d.ts.map +0 -1
- package/dist/tests/types.test.js +0 -215
- package/dist/tests/types.test.js.map +0 -1
- package/dist/types/index.d.ts +0 -369
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -92
- package/dist/types/index.js.map +0 -1
- package/dist/utils/error-handler.d.ts +0 -2
- package/dist/utils/error-handler.d.ts.map +0 -1
- package/dist/utils/error-handler.js +0 -5
- package/dist/utils/error-handler.js.map +0 -1
- package/dist/utils/output.d.ts +0 -2
- package/dist/utils/output.d.ts.map +0 -1
- package/dist/utils/output.js +0 -4
- package/dist/utils/output.js.map +0 -1
- /package/dist/{cli.d.ts → src/platforms/teams/cli.d.ts} +0 -0
- /package/dist/{commands → src/platforms/teams/commands}/user.d.ts +0 -0
package/docs/teams.md
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
# Microsoft Teams Integration
|
|
2
|
+
|
|
3
|
+
Detailed documentation for Microsoft Teams integration in agent-messenger.
|
|
4
|
+
|
|
5
|
+
> **Note**: `agent-teams` is a convenient shortcut for `agent-messenger teams`.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# 1. Extract credentials from Teams desktop app (zero-config!)
|
|
11
|
+
agent-teams auth extract
|
|
12
|
+
|
|
13
|
+
# 2. Get team snapshot
|
|
14
|
+
agent-teams snapshot
|
|
15
|
+
|
|
16
|
+
# 3. Send a message
|
|
17
|
+
agent-teams message send <channel-id> "Hello from AI agent!"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Authentication
|
|
21
|
+
|
|
22
|
+
### Seamless Token Extraction
|
|
23
|
+
|
|
24
|
+
agent-teams automatically extracts your Microsoft Teams credentials from the desktop app:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
agent-teams auth extract
|
|
28
|
+
|
|
29
|
+
# Use --debug for troubleshooting
|
|
30
|
+
agent-teams auth extract --debug
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This command:
|
|
34
|
+
- Auto-detects your platform (macOS/Linux/Windows)
|
|
35
|
+
- Extracts Teams access token from the desktop app
|
|
36
|
+
- Validates token against Teams API
|
|
37
|
+
- Discovers ALL joined teams
|
|
38
|
+
- Stores credentials securely in `~/.config/agent-messenger/`
|
|
39
|
+
|
|
40
|
+
### ⚠️ TOKEN EXPIRY WARNING
|
|
41
|
+
|
|
42
|
+
**Teams tokens expire in 60-90 minutes!** Unlike Slack and Discord tokens which last much longer, Microsoft Teams uses short-lived OAuth tokens.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Check if your token is still valid
|
|
46
|
+
agent-teams auth status
|
|
47
|
+
|
|
48
|
+
# Re-extract when expired (just run extract again)
|
|
49
|
+
agent-teams auth extract
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Best practices for AI agents:**
|
|
53
|
+
- Always check `auth status` before operations
|
|
54
|
+
- Re-run `auth extract` if you get 401 errors
|
|
55
|
+
- Consider automating token refresh in long-running workflows
|
|
56
|
+
|
|
57
|
+
### Authentication Commands
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Check auth status (shows expiry time!)
|
|
61
|
+
agent-teams auth status
|
|
62
|
+
|
|
63
|
+
# Logout (clear stored credentials)
|
|
64
|
+
agent-teams auth logout
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Supported Teams Versions
|
|
68
|
+
|
|
69
|
+
agent-teams supports both **New Teams** (WebView2-based, com.microsoft.teams2) and **Classic Teams**:
|
|
70
|
+
|
|
71
|
+
| Version | macOS | Windows | Linux |
|
|
72
|
+
|---------|:-----:|:-------:|:-----:|
|
|
73
|
+
| New Teams | ✅ | ✅ | N/A |
|
|
74
|
+
| Classic Teams | ✅ | ✅ | ✅ |
|
|
75
|
+
|
|
76
|
+
### Manual Token Input (Last Resort)
|
|
77
|
+
|
|
78
|
+
If automatic extraction fails, you can manually provide a token:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
agent-teams auth extract --token <your-skype-token>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**How to get your token manually:**
|
|
85
|
+
|
|
86
|
+
1. Open Microsoft Teams in your browser (teams.microsoft.com)
|
|
87
|
+
2. Open Developer Tools (F12 or Cmd+Option+I)
|
|
88
|
+
3. Go to **Application** > **Cookies** > `https://teams.microsoft.com`
|
|
89
|
+
4. Find the cookie named `skypetoken_asm`
|
|
90
|
+
5. Copy the **Value** (it's a long string starting with `eyJ...`)
|
|
91
|
+
6. Run: `agent-teams auth extract --token "eyJ..."`
|
|
92
|
+
|
|
93
|
+
> **Note**: Browser tokens also expire in 60-90 minutes. For long-running workflows, you may need to refresh periodically.
|
|
94
|
+
|
|
95
|
+
## Team Management
|
|
96
|
+
|
|
97
|
+
Teams uses "teams" as the top-level organizational unit. You must select a team before using most commands.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# List all teams
|
|
101
|
+
agent-teams team list
|
|
102
|
+
|
|
103
|
+
# Switch to a different team
|
|
104
|
+
agent-teams team switch <team-id>
|
|
105
|
+
|
|
106
|
+
# Show current team
|
|
107
|
+
agent-teams team current
|
|
108
|
+
|
|
109
|
+
# Get team info
|
|
110
|
+
agent-teams team info <team-id>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Commands
|
|
114
|
+
|
|
115
|
+
### Message Commands
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Send a message
|
|
119
|
+
agent-teams message send <channel-id> <content>
|
|
120
|
+
agent-teams message send abc123-def456 "Hello world"
|
|
121
|
+
|
|
122
|
+
# List messages
|
|
123
|
+
agent-teams message list <channel-id>
|
|
124
|
+
agent-teams message list abc123-def456 --limit 50
|
|
125
|
+
|
|
126
|
+
# Get a specific message
|
|
127
|
+
agent-teams message get <channel-id> <message-id>
|
|
128
|
+
|
|
129
|
+
# Delete a message
|
|
130
|
+
agent-teams message delete <channel-id> <message-id> --force
|
|
131
|
+
|
|
132
|
+
# Reply to a message (thread)
|
|
133
|
+
agent-teams message reply <channel-id> <message-id> "Reply content"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Channel Commands
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# List channels in current team
|
|
140
|
+
agent-teams channel list
|
|
141
|
+
|
|
142
|
+
# Get channel info
|
|
143
|
+
agent-teams channel info <channel-id>
|
|
144
|
+
|
|
145
|
+
# Get channel message history
|
|
146
|
+
agent-teams channel history <channel-id>
|
|
147
|
+
agent-teams channel history abc123-def456 --limit 100
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### User Commands
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# List team members
|
|
154
|
+
agent-teams user list
|
|
155
|
+
|
|
156
|
+
# Get user info
|
|
157
|
+
agent-teams user info <user-id>
|
|
158
|
+
|
|
159
|
+
# Get current authenticated user
|
|
160
|
+
agent-teams user me
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Reaction Commands
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Add reaction
|
|
167
|
+
agent-teams reaction add <channel-id> <message-id> <emoji>
|
|
168
|
+
agent-teams reaction add abc123-def456 msg789 like
|
|
169
|
+
|
|
170
|
+
# Remove reaction
|
|
171
|
+
agent-teams reaction remove <channel-id> <message-id> <emoji>
|
|
172
|
+
|
|
173
|
+
# List reactions on a message
|
|
174
|
+
agent-teams reaction list <channel-id> <message-id>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### File Commands
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Upload file to channel
|
|
181
|
+
agent-teams file upload <channel-id> <path>
|
|
182
|
+
agent-teams file upload abc123-def456 ./report.pdf
|
|
183
|
+
|
|
184
|
+
# List files in channel
|
|
185
|
+
agent-teams file list <channel-id>
|
|
186
|
+
|
|
187
|
+
# Get file info
|
|
188
|
+
agent-teams file info <channel-id> <file-id>
|
|
189
|
+
|
|
190
|
+
# Download file
|
|
191
|
+
agent-teams file download <file-id> <output-path>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Snapshot Command
|
|
195
|
+
|
|
196
|
+
Get comprehensive team state for AI agents:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Full snapshot (channels, members, recent messages)
|
|
200
|
+
agent-teams snapshot
|
|
201
|
+
|
|
202
|
+
# Filtered snapshots
|
|
203
|
+
agent-teams snapshot --channels-only
|
|
204
|
+
agent-teams snapshot --users-only
|
|
205
|
+
|
|
206
|
+
# Limit messages per channel
|
|
207
|
+
agent-teams snapshot --limit 10
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Global Options
|
|
211
|
+
|
|
212
|
+
All commands support these options:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
--pretty # Pretty-print JSON output (default is compact JSON)
|
|
216
|
+
--team <id> # Use specific team (overrides current team)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Key Differences: Teams vs Discord vs Slack
|
|
220
|
+
|
|
221
|
+
| Concept | Slack | Discord | Teams |
|
|
222
|
+
|---------|-------|---------|-------|
|
|
223
|
+
| Server/Workspace | Workspace | Guild | Team |
|
|
224
|
+
| Channel ID format | Alphanumeric (C01234567) | Numeric snowflake | UUID (abc123-def456-...) |
|
|
225
|
+
| Message ID format | Timestamp (1234567890.123456) | Numeric snowflake | UUID |
|
|
226
|
+
| User ID format | Alphanumeric (U01234567) | Numeric snowflake | UUID (Azure AD Object ID) |
|
|
227
|
+
| Token lifetime | Long-lived | Long-lived | **60-90 minutes** |
|
|
228
|
+
| API | Slack Web API | Discord API | Teams Messaging API |
|
|
229
|
+
| Threads | Thread timestamps | Thread channels | Reply chains |
|
|
230
|
+
| Rate limits | Moderate | Moderate | Strict |
|
|
231
|
+
|
|
232
|
+
## Troubleshooting
|
|
233
|
+
|
|
234
|
+
### Token Expired (401 Unauthorized)
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Teams tokens expire in 60-90 minutes! To refresh:
|
|
238
|
+
# 1. Open Microsoft Teams desktop app
|
|
239
|
+
# 2. Send any message (this refreshes your session cookies)
|
|
240
|
+
# 3. Re-extract:
|
|
241
|
+
agent-teams auth extract
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### "No teams found"
|
|
245
|
+
|
|
246
|
+
Ensure you're a member of at least one team in the Teams desktop app, then:
|
|
247
|
+
```bash
|
|
248
|
+
agent-teams auth extract --debug
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### "Channel not found"
|
|
252
|
+
|
|
253
|
+
Teams channel IDs are UUIDs. Make sure you're using the full ID:
|
|
254
|
+
```bash
|
|
255
|
+
# Get channel list to find correct IDs
|
|
256
|
+
agent-teams channel list --pretty
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Rate Limiting (429 Too Many Requests)
|
|
260
|
+
|
|
261
|
+
Teams API has strict rate limits. Wait and retry:
|
|
262
|
+
```bash
|
|
263
|
+
# Add delays between operations in scripts
|
|
264
|
+
sleep 2
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Desktop App Not Detected
|
|
268
|
+
|
|
269
|
+
Ensure Teams desktop app is:
|
|
270
|
+
1. Installed (not just web version)
|
|
271
|
+
2. Currently running
|
|
272
|
+
3. Signed in to your account
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Debug extraction
|
|
276
|
+
agent-teams auth extract --debug
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Permission Errors
|
|
280
|
+
|
|
281
|
+
Some operations require specific Microsoft 365 permissions. Check with your IT admin if you encounter persistent 403 errors.
|
|
282
|
+
|
|
283
|
+
## AI Agent Integration
|
|
284
|
+
|
|
285
|
+
See `skills/agent-messenger/` directory for:
|
|
286
|
+
- Complete skill documentation
|
|
287
|
+
- Runnable templates
|
|
288
|
+
|
|
289
|
+
### Example: AI Agent Workflow
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
#!/bin/bash
|
|
293
|
+
# Example: Daily standup automation
|
|
294
|
+
|
|
295
|
+
# 1. Check auth (re-extract if needed)
|
|
296
|
+
if ! agent-teams auth status | grep -q "valid"; then
|
|
297
|
+
agent-teams auth extract
|
|
298
|
+
fi
|
|
299
|
+
|
|
300
|
+
# 2. Get team context
|
|
301
|
+
agent-teams snapshot --limit 5 > /tmp/teams-context.json
|
|
302
|
+
|
|
303
|
+
# 3. Send standup reminder
|
|
304
|
+
agent-teams message send $STANDUP_CHANNEL "🌅 Good morning! Time for standup."
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Token Refresh Pattern for Long-Running Agents
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
# Wrapper function for token-aware operations
|
|
311
|
+
teams_cmd() {
|
|
312
|
+
# Check token validity
|
|
313
|
+
if ! agent-teams auth status 2>/dev/null | grep -q "valid"; then
|
|
314
|
+
agent-teams auth extract
|
|
315
|
+
fi
|
|
316
|
+
agent-teams "$@"
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
# Usage
|
|
320
|
+
teams_cmd message send $CHANNEL "Hello!"
|
|
321
|
+
```
|
package/e2e/README.md
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# E2E Tests
|
|
2
|
+
|
|
3
|
+
End-to-end tests that run every CLI command against real Slack and Discord APIs.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Before running E2E tests, you need:
|
|
8
|
+
|
|
9
|
+
1. **Dedicated Test Workspaces** - Create separate Slack and Discord test workspaces/guilds
|
|
10
|
+
- **Never run E2E tests against your business or personal accounts**
|
|
11
|
+
- Tests create and delete messages, which could interfere with real work
|
|
12
|
+
|
|
13
|
+
2. **Test Channels** - Create an `e2e-test` channel in each test workspace/guild
|
|
14
|
+
- Slack: Channel named `e2e-test`
|
|
15
|
+
- Discord: Text channel named `e2e-test`
|
|
16
|
+
|
|
17
|
+
3. **Authentication** - Either:
|
|
18
|
+
- Local credentials from desktop apps (via `auth extract`)
|
|
19
|
+
- Environment variables (for CI)
|
|
20
|
+
|
|
21
|
+
## Test Infrastructure
|
|
22
|
+
|
|
23
|
+
| File | Description |
|
|
24
|
+
|------|-------------|
|
|
25
|
+
| `config.ts` | Hardcoded test workspace/guild IDs and validation |
|
|
26
|
+
| `helpers.ts` | CLI runner, JSON parser, message cleanup utilities |
|
|
27
|
+
| `slack.e2e.test.ts` | Slack command tests (23 tests) |
|
|
28
|
+
| `discord.e2e.test.ts` | Discord command tests (20 tests) |
|
|
29
|
+
|
|
30
|
+
## Running E2E Tests Locally
|
|
31
|
+
|
|
32
|
+
### Step 1: Extract Credentials
|
|
33
|
+
|
|
34
|
+
First, make sure the desktop apps (Slack/Discord) are running and logged into your **test** workspaces.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Extract Slack credentials
|
|
38
|
+
agent-slack auth extract
|
|
39
|
+
|
|
40
|
+
# Extract Discord credentials
|
|
41
|
+
agent-discord auth extract
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Step 2: Switch to Test Workspace
|
|
45
|
+
|
|
46
|
+
Ensure you're targeting the correct test workspace:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Verify Slack workspace
|
|
50
|
+
agent-slack workspace current
|
|
51
|
+
# Should show: "Agent Messenger" (T0AC55BSF6E)
|
|
52
|
+
|
|
53
|
+
# Verify Discord guild
|
|
54
|
+
agent-discord guild current
|
|
55
|
+
# Should show: "Agent Messenger" (1467039439770357844)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If wrong, switch workspaces:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
agent-slack workspace switch <test-workspace-id>
|
|
62
|
+
agent-discord guild switch <test-guild-id>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Step 3: Run Tests
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Run all E2E tests
|
|
69
|
+
bun test e2e/
|
|
70
|
+
|
|
71
|
+
# Run only Slack tests
|
|
72
|
+
bun test e2e/slack.e2e.test.ts
|
|
73
|
+
|
|
74
|
+
# Run only Discord tests
|
|
75
|
+
bun test e2e/discord.e2e.test.ts
|
|
76
|
+
|
|
77
|
+
# Run specific test by name
|
|
78
|
+
bun test e2e/slack.e2e.test.ts --test-name-pattern "message send"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Running E2E Tests in CI (GitHub Actions)
|
|
82
|
+
|
|
83
|
+
### Required Secrets
|
|
84
|
+
|
|
85
|
+
Set these secrets in your GitHub repository settings:
|
|
86
|
+
|
|
87
|
+
#### Slack Secrets
|
|
88
|
+
|
|
89
|
+
| Secret | Description | How to Get |
|
|
90
|
+
|--------|-------------|------------|
|
|
91
|
+
| `E2E_SLACK_TOKEN` | Slack auth token (xoxc-...) | `agent-slack auth extract` → check output |
|
|
92
|
+
| `E2E_SLACK_COOKIE` | Slack cookie (xoxd-...) | Same as above |
|
|
93
|
+
| `E2E_SLACK_WORKSPACE_ID` | Test workspace ID | `agent-slack workspace current` |
|
|
94
|
+
| `E2E_SLACK_WORKSPACE_NAME` | Test workspace name | Same as above |
|
|
95
|
+
|
|
96
|
+
#### Discord Secrets
|
|
97
|
+
|
|
98
|
+
| Secret | Description | How to Get |
|
|
99
|
+
|--------|-------------|------------|
|
|
100
|
+
| `E2E_DISCORD_TOKEN` | Discord auth token | `agent-discord auth extract` → check output |
|
|
101
|
+
| `E2E_DISCORD_GUILD_ID` | Test guild ID | `agent-discord guild current` |
|
|
102
|
+
|
|
103
|
+
### Getting Credentials for CI
|
|
104
|
+
|
|
105
|
+
Run locally to extract credentials, then copy them to GitHub Secrets:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Slack - extract and view credentials
|
|
109
|
+
agent-slack auth extract
|
|
110
|
+
cat ~/.agent-messenger/slack/credentials.json
|
|
111
|
+
# Copy token and cookie values
|
|
112
|
+
|
|
113
|
+
# Discord - extract and view credentials
|
|
114
|
+
agent-discord auth extract
|
|
115
|
+
cat ~/.agent-messenger/discord/credentials.json
|
|
116
|
+
# Copy token value
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Workflow Triggers
|
|
120
|
+
|
|
121
|
+
The E2E workflow (`.github/workflows/e2e.yml`) runs:
|
|
122
|
+
|
|
123
|
+
- **Manually**: Via `workflow_dispatch` (Actions tab → Run workflow)
|
|
124
|
+
- **On PRs**: When changes are made to `src/`, `e2e/`, or `package.json`
|
|
125
|
+
|
|
126
|
+
### Manual Trigger Options
|
|
127
|
+
|
|
128
|
+
When triggering manually, you can select which platform to test:
|
|
129
|
+
|
|
130
|
+
- `all` - Run both Slack and Discord tests (default)
|
|
131
|
+
- `slack` - Run only Slack tests
|
|
132
|
+
- `discord` - Run only Discord tests
|
|
133
|
+
|
|
134
|
+
## Test Coverage
|
|
135
|
+
|
|
136
|
+
### Slack Tests (23 tests)
|
|
137
|
+
|
|
138
|
+
| Command Group | Tests |
|
|
139
|
+
|---------------|-------|
|
|
140
|
+
| `auth` | status |
|
|
141
|
+
| `workspace` | list, current |
|
|
142
|
+
| `message` | send, list, get, update, delete, thread reply, replies, search |
|
|
143
|
+
| `channel` | list, list --type, info |
|
|
144
|
+
| `user` | list, me, info |
|
|
145
|
+
| `reaction` | add, list, remove |
|
|
146
|
+
| `file` | upload, list, list --channel, info |
|
|
147
|
+
| `snapshot` | default, --channels-only, --users-only, --limit |
|
|
148
|
+
|
|
149
|
+
### Discord Tests (20 tests)
|
|
150
|
+
|
|
151
|
+
| Command Group | Tests |
|
|
152
|
+
|---------------|-------|
|
|
153
|
+
| `auth` | status |
|
|
154
|
+
| `guild` | list, current, info |
|
|
155
|
+
| `message` | send, list, get*, delete |
|
|
156
|
+
| `channel` | list, info, history |
|
|
157
|
+
| `user` | list, me, info* |
|
|
158
|
+
| `reaction` | add*, list*, remove* |
|
|
159
|
+
| `file` | upload, list |
|
|
160
|
+
| `snapshot` | default, --channels-only, --users-only |
|
|
161
|
+
|
|
162
|
+
\* Some Discord tests are skipped because they require Bot Token permissions not available to user tokens.
|
|
163
|
+
|
|
164
|
+
## Troubleshooting
|
|
165
|
+
|
|
166
|
+
### "Wrong workspace" / "Wrong guild" Error
|
|
167
|
+
|
|
168
|
+
The tests detected you're not in the designated test workspace:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
Error: Wrong Slack workspace. Expected: Agent Messenger (T0AC55BSF6E), Got: My Company (TXXXXXX)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Solution**: Switch to the correct test workspace before running tests.
|
|
175
|
+
|
|
176
|
+
### Authentication Failed
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
Error: Slack authentication failed. Please run: agent-messenger slack auth login
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Solution**:
|
|
183
|
+
1. Make sure the desktop app is running
|
|
184
|
+
2. Run `agent-slack auth extract` or `agent-discord auth extract`
|
|
185
|
+
3. For CI, check that secrets are correctly configured
|
|
186
|
+
|
|
187
|
+
### Rate Limiting
|
|
188
|
+
|
|
189
|
+
If tests fail intermittently with rate limit errors, try running fewer tests at once:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
bun test e2e/slack.e2e.test.ts --test-name-pattern "auth"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The test harness includes automatic delays between API calls, but heavy testing may still hit limits.
|
|
196
|
+
|
|
197
|
+
### Orphaned Test Messages
|
|
198
|
+
|
|
199
|
+
If tests crash before cleanup, you may have leftover messages in the `e2e-test` channel. Clean them up manually:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# List recent messages
|
|
203
|
+
agent-slack message list e2e-test --limit 20 --pretty
|
|
204
|
+
|
|
205
|
+
# Delete specific message
|
|
206
|
+
agent-slack message delete e2e-test <timestamp> --force
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### CI Environment Variables Not Working
|
|
210
|
+
|
|
211
|
+
Verify the credential managers are reading env vars:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# Test locally with env vars
|
|
215
|
+
E2E_SLACK_TOKEN=xoxc-test E2E_SLACK_COOKIE=xoxd-test bun -e "
|
|
216
|
+
import { CredentialManager } from './src/platforms/slack/credential-manager.ts';
|
|
217
|
+
const cm = new CredentialManager();
|
|
218
|
+
const creds = await cm.getWorkspace();
|
|
219
|
+
console.log(creds);
|
|
220
|
+
"
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
If this shows your test credentials, env var support is working.
|
|
224
|
+
|
|
225
|
+
## Safety Features
|
|
226
|
+
|
|
227
|
+
1. **Hardcoded Test IDs**: Test workspace/guild IDs are hardcoded in `config.ts`. Tests will refuse to run against other workspaces.
|
|
228
|
+
|
|
229
|
+
2. **Environment Validation**: Before any write operations, tests call `validateSlackEnvironment()` or `validateDiscordEnvironment()` to verify the correct workspace.
|
|
230
|
+
|
|
231
|
+
3. **Automatic Cleanup**: Tests track created messages and delete them in `afterEach` hooks.
|
|
232
|
+
|
|
233
|
+
4. **Rate Limiting**: Built-in delays between API calls prevent hitting rate limits.
|
|
234
|
+
|
|
235
|
+
## Adding New Tests
|
|
236
|
+
|
|
237
|
+
1. Follow existing patterns in `slack.e2e.test.ts` or `discord.e2e.test.ts`
|
|
238
|
+
2. Use helpers from `helpers.ts` for CLI execution
|
|
239
|
+
3. Track created resources for cleanup in `afterEach`
|
|
240
|
+
4. Add appropriate delays with `waitForRateLimit()`
|
|
241
|
+
|
|
242
|
+
Example:
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
test('my new test', async () => {
|
|
246
|
+
const testId = generateTestId()
|
|
247
|
+
const { id } = await createTestMessage('slack', SLACK_TEST_CHANNEL_ID, `Test ${testId}`)
|
|
248
|
+
testMessages.push(id) // Track for cleanup
|
|
249
|
+
|
|
250
|
+
await waitForRateLimit()
|
|
251
|
+
|
|
252
|
+
// Your test assertions here
|
|
253
|
+
const result = await runCLI('slack', ['some', 'command', id])
|
|
254
|
+
expect(result.exitCode).toBe(0)
|
|
255
|
+
})
|
|
256
|
+
```
|
package/e2e/config.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const SLACK_TEST_WORKSPACE_ID = 'T0AC55BSF6E'
|
|
2
|
+
export const SLACK_TEST_WORKSPACE_NAME = 'Agent Messenger'
|
|
3
|
+
export const SLACK_TEST_CHANNEL_ID = 'C0ACZKTDDC0'
|
|
4
|
+
export const SLACK_TEST_CHANNEL = 'e2e-test'
|
|
5
|
+
|
|
6
|
+
// Discord Test Environment
|
|
7
|
+
export const DISCORD_TEST_GUILD_ID = '1467039439770357844'
|
|
8
|
+
export const DISCORD_TEST_GUILD_NAME = 'Agent Messenger'
|
|
9
|
+
export const DISCORD_TEST_CHANNEL_ID = '1467062262996144162'
|
|
10
|
+
export const DISCORD_TEST_CHANNEL = 'e2e-test'
|
|
11
|
+
|
|
12
|
+
export async function validateSlackEnvironment() {
|
|
13
|
+
const { runCLI, parseJSON } = await import('./helpers')
|
|
14
|
+
|
|
15
|
+
const result = await runCLI('slack', ['auth', 'status'])
|
|
16
|
+
if (result.exitCode !== 0) {
|
|
17
|
+
throw new Error('Slack authentication failed. Please run: agent-messenger slack auth login')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const data = parseJSON<{ workspace_id: string; workspace_name: string }>(result.stdout)
|
|
21
|
+
if (data?.workspace_id !== SLACK_TEST_WORKSPACE_ID) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Wrong Slack workspace. Expected: ${SLACK_TEST_WORKSPACE_NAME} (${SLACK_TEST_WORKSPACE_ID}), ` +
|
|
24
|
+
`Got: ${data?.workspace_name} (${data?.workspace_id})`
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function validateDiscordEnvironment() {
|
|
30
|
+
const { runCLI, parseJSON } = await import('./helpers')
|
|
31
|
+
|
|
32
|
+
const result = await runCLI('discord', ['auth', 'status'])
|
|
33
|
+
if (result.exitCode !== 0) {
|
|
34
|
+
throw new Error('Discord authentication failed. Please run: agent-messenger discord auth login')
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const currentResult = await runCLI('discord', ['guild', 'current'])
|
|
38
|
+
const data = parseJSON<{ guild_id: string; guild_name: string }>(currentResult.stdout)
|
|
39
|
+
if (data?.guild_id !== DISCORD_TEST_GUILD_ID) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Wrong Discord guild. Expected: ${DISCORD_TEST_GUILD_NAME} (${DISCORD_TEST_GUILD_ID}), ` +
|
|
42
|
+
`Got: ${data?.guild_name} (${data?.guild_id})`
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
}
|