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,241 @@
|
|
|
1
|
+
import { afterAll, beforeEach, describe, expect, test } from 'bun:test'
|
|
2
|
+
import { existsSync, rmSync } from 'node:fs'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
import { CredentialManager } from '../src/platforms/slack/credential-manager'
|
|
5
|
+
import type { Config, WorkspaceCredentials } from '../src/platforms/slack/types'
|
|
6
|
+
|
|
7
|
+
const testConfigDir = join(import.meta.dir, '.test-config')
|
|
8
|
+
|
|
9
|
+
describe('CredentialManager', () => {
|
|
10
|
+
let manager: CredentialManager
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
rmSync(testConfigDir, { recursive: true, force: true })
|
|
14
|
+
manager = new CredentialManager(testConfigDir)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
afterAll(() => {
|
|
18
|
+
rmSync(testConfigDir, { recursive: true, force: true })
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('load() returns empty config when no file exists', async () => {
|
|
22
|
+
// Given: No credentials file exists
|
|
23
|
+
// When: load() is called
|
|
24
|
+
const config = await manager.load()
|
|
25
|
+
|
|
26
|
+
// Then: Should return empty config
|
|
27
|
+
expect(config).toEqual({
|
|
28
|
+
current_workspace: null,
|
|
29
|
+
workspaces: {},
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('save() and load() round-trip', async () => {
|
|
34
|
+
// Given: A config with workspace credentials
|
|
35
|
+
const testConfig: Config = {
|
|
36
|
+
current_workspace: 'workspace-1',
|
|
37
|
+
workspaces: {
|
|
38
|
+
'workspace-1': {
|
|
39
|
+
workspace_id: 'workspace-1',
|
|
40
|
+
workspace_name: 'Test Workspace',
|
|
41
|
+
token: 'xoxb-test-token',
|
|
42
|
+
cookie: 'test-cookie-value',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// When: save() is called
|
|
48
|
+
await manager.save(testConfig)
|
|
49
|
+
|
|
50
|
+
// And: load() is called
|
|
51
|
+
const loaded = await manager.load()
|
|
52
|
+
|
|
53
|
+
// Then: Should return the same config
|
|
54
|
+
expect(loaded).toEqual(testConfig)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
test('save() creates credentials file with 0600 permissions', async () => {
|
|
58
|
+
// Given: A config to save
|
|
59
|
+
const testConfig: Config = {
|
|
60
|
+
current_workspace: null,
|
|
61
|
+
workspaces: {},
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// When: save() is called
|
|
65
|
+
await manager.save(testConfig)
|
|
66
|
+
|
|
67
|
+
// Then: File should exist with 0600 permissions
|
|
68
|
+
const credPath = join(testConfigDir, 'slack-credentials.json')
|
|
69
|
+
expect(existsSync(credPath)).toBe(true)
|
|
70
|
+
|
|
71
|
+
const stats = await Bun.file(credPath).stat()
|
|
72
|
+
const mode = stats?.mode ?? 0
|
|
73
|
+
const permissions = mode & 0o777
|
|
74
|
+
|
|
75
|
+
expect(permissions).toBe(0o600)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
test('setWorkspace() adds or updates workspace', async () => {
|
|
79
|
+
// Given: A credential manager with empty config
|
|
80
|
+
// When: setWorkspace() is called
|
|
81
|
+
const creds: WorkspaceCredentials = {
|
|
82
|
+
workspace_id: 'ws-123',
|
|
83
|
+
workspace_name: 'My Workspace',
|
|
84
|
+
token: 'xoxb-token-123',
|
|
85
|
+
cookie: 'cookie-123',
|
|
86
|
+
}
|
|
87
|
+
await manager.setWorkspace(creds)
|
|
88
|
+
|
|
89
|
+
// Then: Workspace should be saved and retrievable
|
|
90
|
+
const loaded = await manager.load()
|
|
91
|
+
expect(loaded.workspaces['ws-123']).toEqual(creds)
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('getWorkspace() returns workspace by id', async () => {
|
|
95
|
+
// Given: A workspace is saved
|
|
96
|
+
const creds: WorkspaceCredentials = {
|
|
97
|
+
workspace_id: 'ws-456',
|
|
98
|
+
workspace_name: 'Another Workspace',
|
|
99
|
+
token: 'xoxb-token-456',
|
|
100
|
+
cookie: 'cookie-456',
|
|
101
|
+
}
|
|
102
|
+
await manager.setWorkspace(creds)
|
|
103
|
+
|
|
104
|
+
// When: getWorkspace() is called with id
|
|
105
|
+
const retrieved = await manager.getWorkspace('ws-456')
|
|
106
|
+
|
|
107
|
+
// Then: Should return the workspace
|
|
108
|
+
expect(retrieved).toEqual(creds)
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('getWorkspace() returns null for non-existent workspace', async () => {
|
|
112
|
+
// Given: No workspace with this id exists
|
|
113
|
+
// When: getWorkspace() is called
|
|
114
|
+
const retrieved = await manager.getWorkspace('non-existent')
|
|
115
|
+
|
|
116
|
+
// Then: Should return null
|
|
117
|
+
expect(retrieved).toBeNull()
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
test('getWorkspace() returns current workspace when no id provided', async () => {
|
|
121
|
+
// Given: A current workspace is set
|
|
122
|
+
const creds: WorkspaceCredentials = {
|
|
123
|
+
workspace_id: 'ws-789',
|
|
124
|
+
workspace_name: 'Current Workspace',
|
|
125
|
+
token: 'xoxb-token-789',
|
|
126
|
+
cookie: 'cookie-789',
|
|
127
|
+
}
|
|
128
|
+
await manager.setWorkspace(creds)
|
|
129
|
+
await manager.setCurrentWorkspace('ws-789')
|
|
130
|
+
|
|
131
|
+
// When: getWorkspace() is called without id
|
|
132
|
+
const retrieved = await manager.getWorkspace()
|
|
133
|
+
|
|
134
|
+
// Then: Should return the current workspace
|
|
135
|
+
expect(retrieved).toEqual(creds)
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
test('getWorkspace() returns null when no current workspace set', async () => {
|
|
139
|
+
// Given: No current workspace is set
|
|
140
|
+
// When: getWorkspace() is called without id
|
|
141
|
+
const retrieved = await manager.getWorkspace()
|
|
142
|
+
|
|
143
|
+
// Then: Should return null
|
|
144
|
+
expect(retrieved).toBeNull()
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
test('removeWorkspace() deletes workspace', async () => {
|
|
148
|
+
// Given: A workspace is saved
|
|
149
|
+
const creds: WorkspaceCredentials = {
|
|
150
|
+
workspace_id: 'ws-delete',
|
|
151
|
+
workspace_name: 'To Delete',
|
|
152
|
+
token: 'xoxb-token-delete',
|
|
153
|
+
cookie: 'cookie-delete',
|
|
154
|
+
}
|
|
155
|
+
await manager.setWorkspace(creds)
|
|
156
|
+
|
|
157
|
+
// When: removeWorkspace() is called
|
|
158
|
+
await manager.removeWorkspace('ws-delete')
|
|
159
|
+
|
|
160
|
+
// Then: Workspace should no longer exist
|
|
161
|
+
const retrieved = await manager.getWorkspace('ws-delete')
|
|
162
|
+
expect(retrieved).toBeNull()
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
test('removeWorkspace() clears current workspace if it matches', async () => {
|
|
166
|
+
// Given: A workspace is set as current
|
|
167
|
+
const creds: WorkspaceCredentials = {
|
|
168
|
+
workspace_id: 'ws-current',
|
|
169
|
+
workspace_name: 'Current',
|
|
170
|
+
token: 'xoxb-token-current',
|
|
171
|
+
cookie: 'cookie-current',
|
|
172
|
+
}
|
|
173
|
+
await manager.setWorkspace(creds)
|
|
174
|
+
await manager.setCurrentWorkspace('ws-current')
|
|
175
|
+
|
|
176
|
+
// When: removeWorkspace() is called on current workspace
|
|
177
|
+
await manager.removeWorkspace('ws-current')
|
|
178
|
+
|
|
179
|
+
// Then: current_workspace should be null
|
|
180
|
+
const config = await manager.load()
|
|
181
|
+
expect(config.current_workspace).toBeNull()
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
test('setCurrentWorkspace() sets current workspace', async () => {
|
|
185
|
+
// Given: A workspace exists
|
|
186
|
+
const creds: WorkspaceCredentials = {
|
|
187
|
+
workspace_id: 'ws-set-current',
|
|
188
|
+
workspace_name: 'Set Current',
|
|
189
|
+
token: 'xoxb-token-set',
|
|
190
|
+
cookie: 'cookie-set',
|
|
191
|
+
}
|
|
192
|
+
await manager.setWorkspace(creds)
|
|
193
|
+
|
|
194
|
+
// When: setCurrentWorkspace() is called
|
|
195
|
+
await manager.setCurrentWorkspace('ws-set-current')
|
|
196
|
+
|
|
197
|
+
// Then: current_workspace should be updated
|
|
198
|
+
const config = await manager.load()
|
|
199
|
+
expect(config.current_workspace).toBe('ws-set-current')
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
test('creates config directory if it does not exist', async () => {
|
|
203
|
+
// Given: Config directory does not exist
|
|
204
|
+
expect(existsSync(testConfigDir)).toBe(false)
|
|
205
|
+
|
|
206
|
+
// When: save() is called
|
|
207
|
+
const testConfig: Config = {
|
|
208
|
+
current_workspace: null,
|
|
209
|
+
workspaces: {},
|
|
210
|
+
}
|
|
211
|
+
await manager.save(testConfig)
|
|
212
|
+
|
|
213
|
+
// Then: Directory should be created
|
|
214
|
+
expect(existsSync(testConfigDir)).toBe(true)
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
test('multiple workspaces can coexist', async () => {
|
|
218
|
+
// Given: Multiple workspaces are added
|
|
219
|
+
const creds1: WorkspaceCredentials = {
|
|
220
|
+
workspace_id: 'ws-1',
|
|
221
|
+
workspace_name: 'Workspace 1',
|
|
222
|
+
token: 'token-1',
|
|
223
|
+
cookie: 'cookie-1',
|
|
224
|
+
}
|
|
225
|
+
const creds2: WorkspaceCredentials = {
|
|
226
|
+
workspace_id: 'ws-2',
|
|
227
|
+
workspace_name: 'Workspace 2',
|
|
228
|
+
token: 'token-2',
|
|
229
|
+
cookie: 'cookie-2',
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// When: Both are saved
|
|
233
|
+
await manager.setWorkspace(creds1)
|
|
234
|
+
await manager.setWorkspace(creds2)
|
|
235
|
+
|
|
236
|
+
// Then: Both should be retrievable
|
|
237
|
+
const config = await manager.load()
|
|
238
|
+
expect(config.workspaces['ws-1']).toEqual(creds1)
|
|
239
|
+
expect(config.workspaces['ws-2']).toEqual(creds2)
|
|
240
|
+
})
|
|
241
|
+
})
|