agent-messenger 1.0.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 +92 -0
- package/.claude-plugin/README.md +144 -0
- package/.claude-plugin/marketplace.json +37 -0
- package/.claude-plugin/plugin.json +17 -0
- package/.github/workflows/ci.yml +30 -0
- package/CLAUDE.md +106 -0
- package/CONTRIBUTING.md +131 -0
- package/README.md +140 -0
- package/biome.json +34 -0
- package/bun.lock +252 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +21 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/auth.d.ts +3 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +140 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/channel.d.ts +3 -0
- package/dist/commands/channel.d.ts.map +1 -0
- package/dist/commands/channel.js +118 -0
- package/dist/commands/channel.js.map +1 -0
- package/dist/commands/file.d.ts +3 -0
- package/dist/commands/file.d.ts.map +1 -0
- package/dist/commands/file.js +113 -0
- package/dist/commands/file.js.map +1 -0
- package/dist/commands/index.d.ts +9 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +9 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/message.d.ts +3 -0
- package/dist/commands/message.d.ts.map +1 -0
- package/dist/commands/message.js +214 -0
- package/dist/commands/message.js.map +1 -0
- package/dist/commands/reaction.d.ts +3 -0
- package/dist/commands/reaction.d.ts.map +1 -0
- package/dist/commands/reaction.js +100 -0
- package/dist/commands/reaction.js.map +1 -0
- package/dist/commands/snapshot.d.ts +3 -0
- package/dist/commands/snapshot.d.ts.map +1 -0
- package/dist/commands/snapshot.js +88 -0
- package/dist/commands/snapshot.js.map +1 -0
- package/dist/commands/user.d.ts +3 -0
- package/dist/commands/user.d.ts.map +1 -0
- package/dist/commands/user.js +96 -0
- package/dist/commands/user.js.map +1 -0
- package/dist/commands/workspace.d.ts +3 -0
- package/dist/commands/workspace.d.ts.map +1 -0
- package/dist/commands/workspace.js +89 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/lib/credential-manager.d.ts +13 -0
- package/dist/lib/credential-manager.d.ts.map +1 -0
- package/dist/lib/credential-manager.js +58 -0
- package/dist/lib/credential-manager.js.map +1 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +3 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/ref-manager.d.ts +26 -0
- package/dist/lib/ref-manager.d.ts.map +1 -0
- package/dist/lib/ref-manager.js +92 -0
- package/dist/lib/ref-manager.js.map +1 -0
- package/dist/lib/slack-client.d.ts +37 -0
- package/dist/lib/slack-client.d.ts.map +1 -0
- package/dist/lib/slack-client.js +379 -0
- package/dist/lib/slack-client.js.map +1 -0
- package/dist/lib/token-extractor.d.ts +28 -0
- package/dist/lib/token-extractor.d.ts.map +1 -0
- package/dist/lib/token-extractor.js +401 -0
- package/dist/lib/token-extractor.js.map +1 -0
- package/dist/package.json +37 -0
- package/dist/src/cli.d.ts +5 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +22 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/platforms/discord/cli.d.ts +5 -0
- package/dist/src/platforms/discord/cli.d.ts.map +1 -0
- package/dist/src/platforms/discord/cli.js +22 -0
- package/dist/src/platforms/discord/cli.js.map +1 -0
- package/dist/src/platforms/discord/client.d.ts +34 -0
- package/dist/src/platforms/discord/client.d.ts.map +1 -0
- package/dist/src/platforms/discord/client.js +187 -0
- package/dist/src/platforms/discord/client.js.map +1 -0
- package/dist/src/platforms/discord/client.test.d.ts +2 -0
- package/dist/src/platforms/discord/client.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/client.test.js +367 -0
- package/dist/src/platforms/discord/client.test.js.map +1 -0
- package/dist/src/platforms/discord/commands/auth.d.ts +13 -0
- package/dist/src/platforms/discord/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/auth.js +155 -0
- package/dist/src/platforms/discord/commands/auth.js.map +1 -0
- package/dist/src/platforms/discord/commands/auth.test.d.ts +2 -0
- package/dist/src/platforms/discord/commands/auth.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/auth.test.js +65 -0
- package/dist/src/platforms/discord/commands/auth.test.js.map +1 -0
- package/dist/src/platforms/discord/commands/channel.d.ts +13 -0
- package/dist/src/platforms/discord/commands/channel.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/channel.js +99 -0
- package/dist/src/platforms/discord/commands/channel.js.map +1 -0
- package/dist/src/platforms/discord/commands/channel.test.d.ts +2 -0
- package/dist/src/platforms/discord/commands/channel.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/channel.test.js +136 -0
- package/dist/src/platforms/discord/commands/channel.test.js.map +1 -0
- package/dist/src/platforms/discord/commands/file.d.ts +13 -0
- package/dist/src/platforms/discord/commands/file.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/file.js +99 -0
- package/dist/src/platforms/discord/commands/file.js.map +1 -0
- package/dist/src/platforms/discord/commands/file.test.d.ts +2 -0
- package/dist/src/platforms/discord/commands/file.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/file.test.js +83 -0
- package/dist/src/platforms/discord/commands/file.test.js.map +1 -0
- package/dist/src/platforms/discord/commands/guild.d.ts +15 -0
- package/dist/src/platforms/discord/commands/guild.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/guild.js +102 -0
- package/dist/src/platforms/discord/commands/guild.js.map +1 -0
- package/dist/src/platforms/discord/commands/guild.test.d.ts +2 -0
- package/dist/src/platforms/discord/commands/guild.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/guild.test.js +100 -0
- package/dist/src/platforms/discord/commands/guild.test.js.map +1 -0
- package/dist/src/platforms/discord/commands/index.d.ts +9 -0
- package/dist/src/platforms/discord/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/index.js +9 -0
- package/dist/src/platforms/discord/commands/index.js.map +1 -0
- package/dist/src/platforms/discord/commands/message.d.ts +17 -0
- package/dist/src/platforms/discord/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/message.js +131 -0
- package/dist/src/platforms/discord/commands/message.js.map +1 -0
- package/dist/src/platforms/discord/commands/message.test.d.ts +2 -0
- package/dist/src/platforms/discord/commands/message.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/message.test.js +91 -0
- package/dist/src/platforms/discord/commands/message.test.js.map +1 -0
- package/dist/src/platforms/discord/commands/reaction.d.ts +12 -0
- package/dist/src/platforms/discord/commands/reaction.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/reaction.js +99 -0
- package/dist/src/platforms/discord/commands/reaction.js.map +1 -0
- package/dist/src/platforms/discord/commands/reaction.test.d.ts +2 -0
- package/dist/src/platforms/discord/commands/reaction.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/reaction.test.js +115 -0
- package/dist/src/platforms/discord/commands/reaction.test.js.map +1 -0
- package/dist/src/platforms/discord/commands/snapshot.d.ts +9 -0
- package/dist/src/platforms/discord/commands/snapshot.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/snapshot.js +80 -0
- package/dist/src/platforms/discord/commands/snapshot.js.map +1 -0
- package/dist/src/platforms/discord/commands/snapshot.test.d.ts +2 -0
- package/dist/src/platforms/discord/commands/snapshot.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/snapshot.test.js +25 -0
- package/dist/src/platforms/discord/commands/snapshot.test.js.map +1 -0
- package/dist/src/platforms/discord/commands/user.d.ts +3 -0
- package/dist/src/platforms/discord/commands/user.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/user.js +94 -0
- package/dist/src/platforms/discord/commands/user.js.map +1 -0
- package/dist/src/platforms/discord/commands/user.test.d.ts +2 -0
- package/dist/src/platforms/discord/commands/user.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/user.test.js +103 -0
- package/dist/src/platforms/discord/commands/user.test.js.map +1 -0
- package/dist/src/platforms/discord/credential-manager.d.ts +33 -0
- package/dist/src/platforms/discord/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/discord/credential-manager.js +73 -0
- package/dist/src/platforms/discord/credential-manager.js.map +1 -0
- package/dist/src/platforms/discord/credential-manager.test.d.ts +2 -0
- package/dist/src/platforms/discord/credential-manager.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/credential-manager.test.js +136 -0
- package/dist/src/platforms/discord/credential-manager.test.js.map +1 -0
- package/dist/src/platforms/discord/token-extractor.d.ts +55 -0
- package/dist/src/platforms/discord/token-extractor.d.ts.map +1 -0
- package/dist/src/platforms/discord/token-extractor.js +462 -0
- package/dist/src/platforms/discord/token-extractor.js.map +1 -0
- package/dist/src/platforms/discord/token-extractor.test.d.ts +2 -0
- package/dist/src/platforms/discord/token-extractor.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/token-extractor.test.js +789 -0
- package/dist/src/platforms/discord/token-extractor.test.js.map +1 -0
- package/dist/src/platforms/discord/types.d.ts +251 -0
- package/dist/src/platforms/discord/types.d.ts.map +1 -0
- package/dist/src/platforms/discord/types.js +74 -0
- package/dist/src/platforms/discord/types.js.map +1 -0
- package/dist/src/platforms/discord/types.test.d.ts +2 -0
- package/dist/src/platforms/discord/types.test.d.ts.map +1 -0
- package/dist/src/platforms/discord/types.test.js +211 -0
- package/dist/src/platforms/discord/types.test.js.map +1 -0
- package/dist/src/platforms/slack/cli.d.ts +5 -0
- package/dist/src/platforms/slack/cli.d.ts.map +1 -0
- package/dist/src/platforms/slack/cli.js +22 -0
- package/dist/src/platforms/slack/cli.js.map +1 -0
- package/dist/src/platforms/slack/client.d.ts +47 -0
- package/dist/src/platforms/slack/client.d.ts.map +1 -0
- package/dist/src/platforms/slack/client.js +412 -0
- package/dist/src/platforms/slack/client.js.map +1 -0
- package/dist/src/platforms/slack/commands/auth.d.ts +3 -0
- package/dist/src/platforms/slack/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/auth.js +156 -0
- package/dist/src/platforms/slack/commands/auth.js.map +1 -0
- package/dist/src/platforms/slack/commands/channel.d.ts +3 -0
- package/dist/src/platforms/slack/commands/channel.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/channel.js +118 -0
- package/dist/src/platforms/slack/commands/channel.js.map +1 -0
- package/dist/src/platforms/slack/commands/file.d.ts +3 -0
- package/dist/src/platforms/slack/commands/file.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/file.js +113 -0
- package/dist/src/platforms/slack/commands/file.js.map +1 -0
- package/dist/src/platforms/slack/commands/index.d.ts +9 -0
- package/dist/src/platforms/slack/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/index.js +9 -0
- package/dist/src/platforms/slack/commands/index.js.map +1 -0
- package/dist/src/platforms/slack/commands/message.d.ts +3 -0
- package/dist/src/platforms/slack/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/message.js +263 -0
- package/dist/src/platforms/slack/commands/message.js.map +1 -0
- package/dist/src/platforms/slack/commands/reaction.d.ts +3 -0
- package/dist/src/platforms/slack/commands/reaction.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/reaction.js +100 -0
- package/dist/src/platforms/slack/commands/reaction.js.map +1 -0
- package/dist/src/platforms/slack/commands/snapshot.d.ts +3 -0
- package/dist/src/platforms/slack/commands/snapshot.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/snapshot.js +87 -0
- package/dist/src/platforms/slack/commands/snapshot.js.map +1 -0
- package/dist/src/platforms/slack/commands/user.d.ts +3 -0
- package/dist/src/platforms/slack/commands/user.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/user.js +96 -0
- package/dist/src/platforms/slack/commands/user.js.map +1 -0
- package/dist/src/platforms/slack/commands/workspace.d.ts +3 -0
- package/dist/src/platforms/slack/commands/workspace.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/workspace.js +89 -0
- package/dist/src/platforms/slack/commands/workspace.js.map +1 -0
- package/dist/src/platforms/slack/credential-manager.d.ts +13 -0
- package/dist/src/platforms/slack/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/slack/credential-manager.js +58 -0
- package/dist/src/platforms/slack/credential-manager.js.map +1 -0
- package/dist/src/platforms/slack/index.d.ts +3 -0
- package/dist/src/platforms/slack/index.d.ts.map +1 -0
- package/dist/src/platforms/slack/index.js +3 -0
- package/dist/src/platforms/slack/index.js.map +1 -0
- package/dist/src/platforms/slack/token-extractor.d.ts +28 -0
- package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -0
- package/dist/src/platforms/slack/token-extractor.js +401 -0
- package/dist/src/platforms/slack/token-extractor.js.map +1 -0
- package/dist/src/platforms/slack/types.d.ts +369 -0
- package/dist/src/platforms/slack/types.d.ts.map +1 -0
- package/dist/src/platforms/slack/types.js +92 -0
- package/dist/src/platforms/slack/types.js.map +1 -0
- package/dist/src/shared/utils/concurrency.d.ts +2 -0
- package/dist/src/shared/utils/concurrency.d.ts.map +1 -0
- package/dist/src/shared/utils/concurrency.js +14 -0
- package/dist/src/shared/utils/concurrency.js.map +1 -0
- package/dist/src/shared/utils/concurrency.test.d.ts +2 -0
- package/dist/src/shared/utils/concurrency.test.d.ts.map +1 -0
- package/dist/src/shared/utils/concurrency.test.js +39 -0
- package/dist/src/shared/utils/concurrency.test.js.map +1 -0
- package/dist/src/shared/utils/error-handler.d.ts +2 -0
- package/dist/src/shared/utils/error-handler.d.ts.map +1 -0
- package/dist/src/shared/utils/error-handler.js +5 -0
- package/dist/src/shared/utils/error-handler.js.map +1 -0
- package/dist/src/shared/utils/output.d.ts +2 -0
- package/dist/src/shared/utils/output.d.ts.map +1 -0
- package/dist/src/shared/utils/output.js +4 -0
- package/dist/src/shared/utils/output.js.map +1 -0
- package/dist/tests/cli.test.d.ts +2 -0
- package/dist/tests/cli.test.d.ts.map +1 -0
- package/dist/tests/cli.test.js +83 -0
- package/dist/tests/cli.test.js.map +1 -0
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/CURRENT +1 -0
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOCK +0 -0
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOG +3 -0
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOG.old +1 -0
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/MANIFEST-000004 +0 -0
- package/dist/tests/commands/auth.test.d.ts +2 -0
- package/dist/tests/commands/auth.test.d.ts.map +1 -0
- package/dist/tests/commands/auth.test.js +304 -0
- package/dist/tests/commands/auth.test.js.map +1 -0
- package/dist/tests/commands/channel.test.d.ts +2 -0
- package/dist/tests/commands/channel.test.d.ts.map +1 -0
- package/dist/tests/commands/channel.test.js +166 -0
- package/dist/tests/commands/channel.test.js.map +1 -0
- package/dist/tests/commands/file.test.d.ts +2 -0
- package/dist/tests/commands/file.test.d.ts.map +1 -0
- package/dist/tests/commands/file.test.js +175 -0
- package/dist/tests/commands/file.test.js.map +1 -0
- package/dist/tests/commands/message.test.d.ts +2 -0
- package/dist/tests/commands/message.test.d.ts.map +1 -0
- package/dist/tests/commands/message.test.js +293 -0
- package/dist/tests/commands/message.test.js.map +1 -0
- package/dist/tests/commands/reaction.test.d.ts +2 -0
- package/dist/tests/commands/reaction.test.d.ts.map +1 -0
- package/dist/tests/commands/reaction.test.js +84 -0
- package/dist/tests/commands/reaction.test.js.map +1 -0
- package/dist/tests/commands/snapshot.test.d.ts +2 -0
- package/dist/tests/commands/snapshot.test.d.ts.map +1 -0
- package/dist/tests/commands/snapshot.test.js +280 -0
- package/dist/tests/commands/snapshot.test.js.map +1 -0
- package/dist/tests/commands/user.test.d.ts +2 -0
- package/dist/tests/commands/user.test.d.ts.map +1 -0
- package/dist/tests/commands/user.test.js +117 -0
- package/dist/tests/commands/user.test.js.map +1 -0
- package/dist/tests/commands/workspace.test.d.ts +2 -0
- package/dist/tests/commands/workspace.test.d.ts.map +1 -0
- package/dist/tests/commands/workspace.test.js +453 -0
- package/dist/tests/commands/workspace.test.js.map +1 -0
- package/dist/tests/credential-manager.test.d.ts +2 -0
- package/dist/tests/credential-manager.test.d.ts.map +1 -0
- package/dist/tests/credential-manager.test.js +199 -0
- package/dist/tests/credential-manager.test.js.map +1 -0
- package/dist/tests/slack-client.test.d.ts +2 -0
- package/dist/tests/slack-client.test.d.ts.map +1 -0
- package/dist/tests/slack-client.test.js +741 -0
- package/dist/tests/slack-client.test.js.map +1 -0
- package/dist/tests/types.test.d.ts +2 -0
- package/dist/tests/types.test.d.ts.map +1 -0
- package/dist/tests/types.test.js +215 -0
- package/dist/tests/types.test.js.map +1 -0
- package/dist/types/index.d.ts +369 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +92 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/error-handler.d.ts +2 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +5 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/output.d.ts +2 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +4 -0
- package/dist/utils/output.js.map +1 -0
- package/docs/discord.md +182 -0
- package/docs/slack.md +160 -0
- package/package.json +37 -0
- package/skills/agent-discord/SKILL.md +273 -0
- package/skills/agent-discord/references/authentication.md +294 -0
- package/skills/agent-discord/references/common-patterns.md +455 -0
- package/skills/agent-discord/templates/guild-summary.sh +167 -0
- package/skills/agent-discord/templates/monitor-channel.sh +180 -0
- package/skills/agent-discord/templates/post-message.sh +173 -0
- package/skills/agent-slack/SKILL.md +268 -0
- package/skills/agent-slack/references/authentication.md +332 -0
- package/skills/agent-slack/references/common-patterns.md +527 -0
- package/skills/agent-slack/templates/monitor-channel.sh +186 -0
- package/skills/agent-slack/templates/post-message.sh +130 -0
- package/skills/agent-slack/templates/workspace-summary.sh +149 -0
- package/src/cli.ts +29 -0
- package/src/platforms/discord/cli.ts +36 -0
- package/src/platforms/discord/client.test.ts +456 -0
- package/src/platforms/discord/client.ts +281 -0
- package/src/platforms/discord/commands/auth.test.ts +72 -0
- package/src/platforms/discord/commands/auth.ts +206 -0
- package/src/platforms/discord/commands/channel.test.ts +153 -0
- package/src/platforms/discord/commands/channel.ts +127 -0
- package/src/platforms/discord/commands/file.test.ts +98 -0
- package/src/platforms/discord/commands/file.ts +134 -0
- package/src/platforms/discord/commands/guild.test.ts +117 -0
- package/src/platforms/discord/commands/guild.ts +129 -0
- package/src/platforms/discord/commands/index.ts +8 -0
- package/src/platforms/discord/commands/message.test.ts +107 -0
- package/src/platforms/discord/commands/message.ts +182 -0
- package/src/platforms/discord/commands/reaction.test.ts +123 -0
- package/src/platforms/discord/commands/reaction.ts +156 -0
- package/src/platforms/discord/commands/snapshot.test.ts +29 -0
- package/src/platforms/discord/commands/snapshot.ts +104 -0
- package/src/platforms/discord/commands/user.test.ts +115 -0
- package/src/platforms/discord/commands/user.ts +124 -0
- package/src/platforms/discord/credential-manager.test.ts +173 -0
- package/src/platforms/discord/credential-manager.ts +95 -0
- package/src/platforms/discord/token-extractor.test.ts +918 -0
- package/src/platforms/discord/token-extractor.ts +549 -0
- package/src/platforms/discord/types.test.ts +245 -0
- package/src/platforms/discord/types.ts +158 -0
- package/src/platforms/slack/cli.ts +36 -0
- package/src/platforms/slack/client.ts +466 -0
- package/src/platforms/slack/commands/auth.ts +211 -0
- package/src/platforms/slack/commands/channel.ts +158 -0
- package/src/platforms/slack/commands/file.ts +153 -0
- package/src/platforms/slack/commands/index.ts +8 -0
- package/src/platforms/slack/commands/message.ts +369 -0
- package/src/platforms/slack/commands/reaction.ts +166 -0
- package/src/platforms/slack/commands/snapshot.ts +114 -0
- package/src/platforms/slack/commands/user.ts +110 -0
- package/src/platforms/slack/commands/workspace.ts +111 -0
- package/src/platforms/slack/credential-manager.ts +74 -0
- package/src/platforms/slack/index.ts +2 -0
- package/src/platforms/slack/token-extractor.ts +496 -0
- package/src/platforms/slack/types.ts +193 -0
- package/src/shared/utils/concurrency.test.ts +53 -0
- package/src/shared/utils/concurrency.ts +20 -0
- package/src/shared/utils/error-handler.ts +4 -0
- package/src/shared/utils/output.ts +3 -0
- package/tests/cli.test.ts +94 -0
- package/tests/commands/auth.test.ts +383 -0
- package/tests/commands/channel.test.ts +185 -0
- package/tests/commands/file.test.ts +204 -0
- package/tests/commands/message.test.ts +344 -0
- package/tests/commands/reaction.test.ts +101 -0
- package/tests/commands/snapshot.test.ts +308 -0
- package/tests/commands/user.test.ts +138 -0
- package/tests/commands/workspace.test.ts +528 -0
- package/tests/credential-manager.test.ts +241 -0
- package/tests/slack-client.test.ts +916 -0
- package/tests/types.test.ts +241 -0
- package/tsconfig.json +36 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { expect, mock, test } from 'bun:test'
|
|
2
|
+
import { SlackClient } from '@/platforms/slack/client'
|
|
3
|
+
import { snapshotCommand } from '@/platforms/slack/commands/snapshot'
|
|
4
|
+
import { CredentialManager } from '@/platforms/slack/credential-manager'
|
|
5
|
+
import type { SlackChannel, SlackMessage, SlackUser } from '@/platforms/slack/types'
|
|
6
|
+
|
|
7
|
+
mock.module('@/platforms/slack/credential-manager', () => ({
|
|
8
|
+
CredentialManager: class {
|
|
9
|
+
async getWorkspace() {
|
|
10
|
+
return {
|
|
11
|
+
workspace_id: 'T123',
|
|
12
|
+
workspace_name: 'Test Workspace',
|
|
13
|
+
token: 'xoxc-test',
|
|
14
|
+
cookie: 'test-cookie',
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
}))
|
|
19
|
+
|
|
20
|
+
mock.module('@/platforms/slack/client', () => ({
|
|
21
|
+
SlackClient: class {
|
|
22
|
+
async testAuth() {
|
|
23
|
+
return {
|
|
24
|
+
user_id: 'U123',
|
|
25
|
+
team_id: 'T123',
|
|
26
|
+
user: 'testuser',
|
|
27
|
+
team: 'Test Workspace',
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async listChannels(): Promise<SlackChannel[]> {
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
id: 'C123',
|
|
34
|
+
name: 'general',
|
|
35
|
+
is_private: false,
|
|
36
|
+
is_archived: false,
|
|
37
|
+
created: 1234567890,
|
|
38
|
+
creator: 'U123',
|
|
39
|
+
topic: { value: 'General discussion', creator: 'U123', last_set: 1234567890 },
|
|
40
|
+
purpose: { value: 'General channel', creator: 'U123', last_set: 1234567890 },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'C456',
|
|
44
|
+
name: 'random',
|
|
45
|
+
is_private: false,
|
|
46
|
+
is_archived: false,
|
|
47
|
+
created: 1234567891,
|
|
48
|
+
creator: 'U123',
|
|
49
|
+
topic: { value: 'Random stuff', creator: 'U123', last_set: 1234567891 },
|
|
50
|
+
purpose: { value: 'Random channel', creator: 'U123', last_set: 1234567891 },
|
|
51
|
+
},
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
async getMessages(_channel: string, _limit?: number): Promise<SlackMessage[]> {
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
ts: '1234567890.000100',
|
|
58
|
+
text: 'Hello world',
|
|
59
|
+
type: 'message',
|
|
60
|
+
user: 'U123',
|
|
61
|
+
username: 'testuser',
|
|
62
|
+
thread_ts: undefined,
|
|
63
|
+
reply_count: 0,
|
|
64
|
+
edited: undefined,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
ts: '1234567890.000200',
|
|
68
|
+
text: 'Second message',
|
|
69
|
+
type: 'message',
|
|
70
|
+
user: 'U456',
|
|
71
|
+
username: 'otheruser',
|
|
72
|
+
thread_ts: undefined,
|
|
73
|
+
reply_count: 0,
|
|
74
|
+
edited: undefined,
|
|
75
|
+
},
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
async listUsers(): Promise<SlackUser[]> {
|
|
79
|
+
return [
|
|
80
|
+
{
|
|
81
|
+
id: 'U123',
|
|
82
|
+
name: 'alice',
|
|
83
|
+
real_name: 'Alice Smith',
|
|
84
|
+
is_admin: true,
|
|
85
|
+
is_owner: false,
|
|
86
|
+
is_bot: false,
|
|
87
|
+
is_app_user: false,
|
|
88
|
+
profile: {
|
|
89
|
+
email: 'alice@example.com',
|
|
90
|
+
title: 'Engineer',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 'U456',
|
|
95
|
+
name: 'bob',
|
|
96
|
+
real_name: 'Bob Jones',
|
|
97
|
+
is_admin: false,
|
|
98
|
+
is_owner: false,
|
|
99
|
+
is_bot: false,
|
|
100
|
+
is_app_user: false,
|
|
101
|
+
profile: {
|
|
102
|
+
email: 'bob@example.com',
|
|
103
|
+
title: 'Designer',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
}))
|
|
110
|
+
|
|
111
|
+
test('snapshot command exports correctly', () => {
|
|
112
|
+
expect(snapshotCommand).toBeDefined()
|
|
113
|
+
expect(typeof snapshotCommand).toBe('object')
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
test('snapshot command has correct structure', () => {
|
|
117
|
+
expect(snapshotCommand.name()).toBe('snapshot')
|
|
118
|
+
expect(snapshotCommand.description()).toContain('workspace')
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
test('snapshot command has --channels-only option', () => {
|
|
122
|
+
const options = snapshotCommand.options
|
|
123
|
+
const hasChannelsOnly = options.some((opt: any) => opt.long === '--channels-only')
|
|
124
|
+
expect(hasChannelsOnly).toBe(true)
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
test('snapshot command has --users-only option', () => {
|
|
128
|
+
const options = snapshotCommand.options
|
|
129
|
+
const hasUsersOnly = options.some((opt: any) => opt.long === '--users-only')
|
|
130
|
+
expect(hasUsersOnly).toBe(true)
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
test('snapshot command has --limit option', () => {
|
|
134
|
+
const options = snapshotCommand.options
|
|
135
|
+
const hasLimit = options.some((opt: any) => opt.long === '--limit')
|
|
136
|
+
expect(hasLimit).toBe(true)
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
test('full snapshot returns workspace, channels, messages, and users', async () => {
|
|
140
|
+
const credManager = new CredentialManager()
|
|
141
|
+
const client = new SlackClient('xoxc-test', 'test-cookie')
|
|
142
|
+
|
|
143
|
+
const _workspace = await credManager.getWorkspace()
|
|
144
|
+
const auth = await client.testAuth()
|
|
145
|
+
const channels = await client.listChannels()
|
|
146
|
+
const users = await client.listUsers()
|
|
147
|
+
|
|
148
|
+
const allMessages: Array<SlackMessage & { channel_id: string; channel_name: string }> = []
|
|
149
|
+
for (const channel of channels) {
|
|
150
|
+
const messages = await client.getMessages(channel.id, 20)
|
|
151
|
+
for (const msg of messages) {
|
|
152
|
+
allMessages.push({
|
|
153
|
+
...msg,
|
|
154
|
+
channel_id: channel.id,
|
|
155
|
+
channel_name: channel.name,
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const snapshot = {
|
|
161
|
+
workspace: {
|
|
162
|
+
id: auth.team_id,
|
|
163
|
+
name: auth.team,
|
|
164
|
+
},
|
|
165
|
+
channels: channels.map((ch) => ({
|
|
166
|
+
id: ch.id,
|
|
167
|
+
name: ch.name,
|
|
168
|
+
is_private: ch.is_private,
|
|
169
|
+
is_archived: ch.is_archived,
|
|
170
|
+
created: ch.created,
|
|
171
|
+
topic: ch.topic?.value,
|
|
172
|
+
purpose: ch.purpose?.value,
|
|
173
|
+
})),
|
|
174
|
+
recent_messages: allMessages.map((msg) => ({
|
|
175
|
+
channel_id: msg.channel_id,
|
|
176
|
+
channel_name: msg.channel_name,
|
|
177
|
+
ts: msg.ts,
|
|
178
|
+
text: msg.text,
|
|
179
|
+
user: msg.user,
|
|
180
|
+
username: msg.username,
|
|
181
|
+
thread_ts: msg.thread_ts,
|
|
182
|
+
})),
|
|
183
|
+
users: users.map((u) => ({
|
|
184
|
+
id: u.id,
|
|
185
|
+
name: u.name,
|
|
186
|
+
real_name: u.real_name,
|
|
187
|
+
is_admin: u.is_admin,
|
|
188
|
+
is_bot: u.is_bot,
|
|
189
|
+
profile: u.profile,
|
|
190
|
+
})),
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
expect(snapshot.workspace).toBeDefined()
|
|
194
|
+
expect(snapshot.workspace.id).toBe('T123')
|
|
195
|
+
expect(snapshot.workspace.name).toBe('Test Workspace')
|
|
196
|
+
|
|
197
|
+
expect(snapshot.channels).toBeDefined()
|
|
198
|
+
expect(snapshot.channels.length).toBe(2)
|
|
199
|
+
expect(snapshot.channels[0].name).toBe('general')
|
|
200
|
+
|
|
201
|
+
expect(snapshot.recent_messages).toBeDefined()
|
|
202
|
+
expect(snapshot.recent_messages.length).toBeGreaterThan(0)
|
|
203
|
+
|
|
204
|
+
expect(snapshot.users).toBeDefined()
|
|
205
|
+
expect(snapshot.users.length).toBe(2)
|
|
206
|
+
expect(snapshot.users[0].name).toBe('alice')
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
test('snapshot with --channels-only excludes messages and users', async () => {
|
|
210
|
+
const credManager = new CredentialManager()
|
|
211
|
+
const client = new SlackClient('xoxc-test', 'test-cookie')
|
|
212
|
+
|
|
213
|
+
const _workspace = await credManager.getWorkspace()
|
|
214
|
+
const auth = await client.testAuth()
|
|
215
|
+
const channels = await client.listChannels()
|
|
216
|
+
|
|
217
|
+
const snapshot = {
|
|
218
|
+
workspace: {
|
|
219
|
+
id: auth.team_id,
|
|
220
|
+
name: auth.team,
|
|
221
|
+
},
|
|
222
|
+
channels: channels.map((ch) => ({
|
|
223
|
+
id: ch.id,
|
|
224
|
+
name: ch.name,
|
|
225
|
+
is_private: ch.is_private,
|
|
226
|
+
is_archived: ch.is_archived,
|
|
227
|
+
created: ch.created,
|
|
228
|
+
topic: ch.topic?.value,
|
|
229
|
+
purpose: ch.purpose?.value,
|
|
230
|
+
})),
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
expect(snapshot.workspace).toBeDefined()
|
|
234
|
+
expect(snapshot.channels).toBeDefined()
|
|
235
|
+
expect(snapshot.channels.length).toBe(2)
|
|
236
|
+
expect((snapshot as any).recent_messages).toBeUndefined()
|
|
237
|
+
expect((snapshot as any).users).toBeUndefined()
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
test('snapshot with --users-only excludes channels and messages', async () => {
|
|
241
|
+
const credManager = new CredentialManager()
|
|
242
|
+
const client = new SlackClient('xoxc-test', 'test-cookie')
|
|
243
|
+
|
|
244
|
+
const _workspace = await credManager.getWorkspace()
|
|
245
|
+
const auth = await client.testAuth()
|
|
246
|
+
const users = await client.listUsers()
|
|
247
|
+
|
|
248
|
+
const snapshot = {
|
|
249
|
+
workspace: {
|
|
250
|
+
id: auth.team_id,
|
|
251
|
+
name: auth.team,
|
|
252
|
+
},
|
|
253
|
+
users: users.map((u) => ({
|
|
254
|
+
id: u.id,
|
|
255
|
+
name: u.name,
|
|
256
|
+
real_name: u.real_name,
|
|
257
|
+
is_admin: u.is_admin,
|
|
258
|
+
is_bot: u.is_bot,
|
|
259
|
+
profile: u.profile,
|
|
260
|
+
})),
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
expect(snapshot.workspace).toBeDefined()
|
|
264
|
+
expect(snapshot.users).toBeDefined()
|
|
265
|
+
expect(snapshot.users.length).toBe(2)
|
|
266
|
+
expect((snapshot as any).channels).toBeUndefined()
|
|
267
|
+
expect((snapshot as any).recent_messages).toBeUndefined()
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
test('snapshot respects --limit option for messages', async () => {
|
|
271
|
+
const credManager = new CredentialManager()
|
|
272
|
+
const client = new SlackClient('xoxc-test', 'test-cookie')
|
|
273
|
+
|
|
274
|
+
const _workspace = await credManager.getWorkspace()
|
|
275
|
+
const auth = await client.testAuth()
|
|
276
|
+
const channels = await client.listChannels()
|
|
277
|
+
|
|
278
|
+
const allMessages: Array<SlackMessage & { channel_id: string; channel_name: string }> = []
|
|
279
|
+
for (const channel of channels) {
|
|
280
|
+
const messages = await client.getMessages(channel.id, 5)
|
|
281
|
+
for (const msg of messages) {
|
|
282
|
+
allMessages.push({
|
|
283
|
+
...msg,
|
|
284
|
+
channel_id: channel.id,
|
|
285
|
+
channel_name: channel.name,
|
|
286
|
+
})
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const snapshot = {
|
|
291
|
+
workspace: {
|
|
292
|
+
id: auth.team_id,
|
|
293
|
+
name: auth.team,
|
|
294
|
+
},
|
|
295
|
+
channels: channels.map((ch) => ({
|
|
296
|
+
id: ch.id,
|
|
297
|
+
name: ch.name,
|
|
298
|
+
is_private: ch.is_private,
|
|
299
|
+
is_archived: ch.is_archived,
|
|
300
|
+
created: ch.created,
|
|
301
|
+
topic: ch.topic?.value,
|
|
302
|
+
purpose: ch.purpose?.value,
|
|
303
|
+
})),
|
|
304
|
+
recent_messages: allMessages,
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
expect(snapshot.recent_messages.length).toBeLessThanOrEqual(10)
|
|
308
|
+
})
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test'
|
|
2
|
+
import { SlackClient } from '../../src/platforms/slack/client'
|
|
3
|
+
import { userCommand } from '../../src/platforms/slack/commands/user'
|
|
4
|
+
import type { SlackUser } from '../../src/platforms/slack/types'
|
|
5
|
+
|
|
6
|
+
// Mock users
|
|
7
|
+
const mockUsers: SlackUser[] = [
|
|
8
|
+
{
|
|
9
|
+
id: 'U001',
|
|
10
|
+
name: 'alice',
|
|
11
|
+
real_name: 'Alice Smith',
|
|
12
|
+
is_admin: true,
|
|
13
|
+
is_owner: false,
|
|
14
|
+
is_bot: false,
|
|
15
|
+
is_app_user: false,
|
|
16
|
+
profile: {
|
|
17
|
+
email: 'alice@example.com',
|
|
18
|
+
title: 'Engineer',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'U002',
|
|
23
|
+
name: 'bob',
|
|
24
|
+
real_name: 'Bob Jones',
|
|
25
|
+
is_admin: false,
|
|
26
|
+
is_owner: false,
|
|
27
|
+
is_bot: false,
|
|
28
|
+
is_app_user: false,
|
|
29
|
+
profile: {
|
|
30
|
+
email: 'bob@example.com',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'U003',
|
|
35
|
+
name: 'slackbot',
|
|
36
|
+
real_name: 'Slackbot',
|
|
37
|
+
is_admin: false,
|
|
38
|
+
is_owner: false,
|
|
39
|
+
is_bot: true,
|
|
40
|
+
is_app_user: false,
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
describe('User Commands', () => {
|
|
45
|
+
describe('user list', () => {
|
|
46
|
+
test('lists all users', async () => {
|
|
47
|
+
// Given: SlackClient with users
|
|
48
|
+
const _mockClient = {
|
|
49
|
+
listUsers: async () => mockUsers,
|
|
50
|
+
} as unknown as SlackClient
|
|
51
|
+
|
|
52
|
+
// When: Calling list with all users
|
|
53
|
+
const result = await (userCommand as any).commands[0].action(
|
|
54
|
+
{ includeBots: false },
|
|
55
|
+
userCommand
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
// Then: Should return users
|
|
59
|
+
expect(result).toBeDefined()
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
test('filters out bots by default', async () => {
|
|
63
|
+
// Given: Users including bots
|
|
64
|
+
// When: Listing without --include-bots flag
|
|
65
|
+
// Then: Should exclude bots (is_bot: true)
|
|
66
|
+
expect(mockUsers.filter((u) => !u.is_bot)).toHaveLength(2)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('includes bots with --include-bots flag', async () => {
|
|
70
|
+
// Given: Users including bots
|
|
71
|
+
// When: Listing with --include-bots flag
|
|
72
|
+
// Then: Should include all users
|
|
73
|
+
expect(mockUsers).toHaveLength(3)
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
describe('user info', () => {
|
|
78
|
+
test('shows user details by ID', async () => {
|
|
79
|
+
// Given: User ID
|
|
80
|
+
// When: Getting user info
|
|
81
|
+
// Then: Should return user details
|
|
82
|
+
const user = mockUsers[0]
|
|
83
|
+
expect(user.id).toBe('U001')
|
|
84
|
+
expect(user.name).toBe('alice')
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
test('returns error for invalid user ID', async () => {
|
|
88
|
+
// Given: Invalid user ID
|
|
89
|
+
// When: Getting user info
|
|
90
|
+
// Then: Should return error
|
|
91
|
+
expect(true).toBe(true)
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
describe('user me', () => {
|
|
96
|
+
test('shows current authenticated user', async () => {
|
|
97
|
+
// Given: Authenticated client
|
|
98
|
+
// When: Running user me
|
|
99
|
+
// Then: Should return current user info
|
|
100
|
+
expect(true).toBe(true)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('includes user profile details', async () => {
|
|
104
|
+
// Given: Current user
|
|
105
|
+
const user = mockUsers[0]
|
|
106
|
+
|
|
107
|
+
// When: Getting user info
|
|
108
|
+
// Then: Should include profile
|
|
109
|
+
expect(user.profile).toBeDefined()
|
|
110
|
+
expect(user.profile?.email).toBe('alice@example.com')
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
describe('output format', () => {
|
|
115
|
+
test('returns JSON with user data', async () => {
|
|
116
|
+
// Given: Users
|
|
117
|
+
const user = mockUsers[0]
|
|
118
|
+
|
|
119
|
+
// When: Formatting output
|
|
120
|
+
const output = { user }
|
|
121
|
+
|
|
122
|
+
// Then: Should be valid JSON
|
|
123
|
+
const json = JSON.stringify(output)
|
|
124
|
+
expect(json).toContain('alice')
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
test('supports --pretty flag for formatting', async () => {
|
|
128
|
+
// Given: Output data
|
|
129
|
+
const data = { users: mockUsers }
|
|
130
|
+
|
|
131
|
+
// When: Formatting with pretty flag
|
|
132
|
+
const pretty = JSON.stringify(data, null, 2)
|
|
133
|
+
|
|
134
|
+
// Then: Should have indentation
|
|
135
|
+
expect(pretty).toContain('\n')
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
})
|