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,96 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { CredentialManager } from '../lib/credential-manager';
|
|
3
|
+
import { SlackClient } from '../lib/slack-client';
|
|
4
|
+
import { handleError } from '../utils/error-handler';
|
|
5
|
+
import { formatOutput } from '../utils/output';
|
|
6
|
+
async function getClient(pretty) {
|
|
7
|
+
const credManager = new CredentialManager();
|
|
8
|
+
const workspace = await credManager.getWorkspace();
|
|
9
|
+
if (!workspace) {
|
|
10
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, pretty));
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return new SlackClient(workspace.token, workspace.cookie);
|
|
14
|
+
}
|
|
15
|
+
export const userCommand = new Command('user')
|
|
16
|
+
.description('user commands')
|
|
17
|
+
.addCommand(new Command('list')
|
|
18
|
+
.description('list workspace users')
|
|
19
|
+
.option('--include-bots', 'include bot users')
|
|
20
|
+
.option('--pretty', 'pretty-print JSON output')
|
|
21
|
+
.action(async (options) => {
|
|
22
|
+
try {
|
|
23
|
+
const client = await getClient(options.pretty);
|
|
24
|
+
if (!client)
|
|
25
|
+
return process.exit(1);
|
|
26
|
+
const users = await client.listUsers();
|
|
27
|
+
const filtered = options.includeBots ? users : users.filter((u) => !u.is_bot);
|
|
28
|
+
const output = filtered.map((user) => ({
|
|
29
|
+
id: user.id,
|
|
30
|
+
name: user.name,
|
|
31
|
+
real_name: user.real_name,
|
|
32
|
+
is_admin: user.is_admin,
|
|
33
|
+
is_owner: user.is_owner,
|
|
34
|
+
is_bot: user.is_bot,
|
|
35
|
+
is_app_user: user.is_app_user,
|
|
36
|
+
profile: user.profile,
|
|
37
|
+
}));
|
|
38
|
+
console.log(formatOutput(output, options.pretty));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
handleError(error);
|
|
42
|
+
}
|
|
43
|
+
}))
|
|
44
|
+
.addCommand(new Command('info')
|
|
45
|
+
.description('show user details')
|
|
46
|
+
.argument('<user>', 'user ID or username')
|
|
47
|
+
.option('--pretty', 'pretty-print JSON output')
|
|
48
|
+
.action(async (userArg, options) => {
|
|
49
|
+
try {
|
|
50
|
+
const client = await getClient(options.pretty);
|
|
51
|
+
if (!client)
|
|
52
|
+
return process.exit(1);
|
|
53
|
+
const user = await client.getUser(userArg);
|
|
54
|
+
const output = {
|
|
55
|
+
id: user.id,
|
|
56
|
+
name: user.name,
|
|
57
|
+
real_name: user.real_name,
|
|
58
|
+
is_admin: user.is_admin,
|
|
59
|
+
is_owner: user.is_owner,
|
|
60
|
+
is_bot: user.is_bot,
|
|
61
|
+
is_app_user: user.is_app_user,
|
|
62
|
+
profile: user.profile,
|
|
63
|
+
};
|
|
64
|
+
console.log(formatOutput(output, options.pretty));
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
handleError(error);
|
|
68
|
+
}
|
|
69
|
+
}))
|
|
70
|
+
.addCommand(new Command('me')
|
|
71
|
+
.description('show current authenticated user')
|
|
72
|
+
.option('--pretty', 'pretty-print JSON output')
|
|
73
|
+
.action(async (options) => {
|
|
74
|
+
try {
|
|
75
|
+
const client = await getClient(options.pretty);
|
|
76
|
+
if (!client)
|
|
77
|
+
return process.exit(1);
|
|
78
|
+
const authInfo = await client.testAuth();
|
|
79
|
+
const user = await client.getUser(authInfo.user_id);
|
|
80
|
+
const output = {
|
|
81
|
+
id: user.id,
|
|
82
|
+
name: user.name,
|
|
83
|
+
real_name: user.real_name,
|
|
84
|
+
is_admin: user.is_admin,
|
|
85
|
+
is_owner: user.is_owner,
|
|
86
|
+
is_bot: user.is_bot,
|
|
87
|
+
is_app_user: user.is_app_user,
|
|
88
|
+
profile: user.profile,
|
|
89
|
+
};
|
|
90
|
+
console.log(formatOutput(output, options.pretty));
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
handleError(error);
|
|
94
|
+
}
|
|
95
|
+
}));
|
|
96
|
+
//# sourceMappingURL=user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/commands/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,KAAK,UAAU,SAAS,CAAC,MAAgB;IACvC,MAAM,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAA;IAC3C,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,YAAY,EAAE,CAAA;IAElD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CACT,YAAY,CAAC,EAAE,KAAK,EAAE,qDAAqD,EAAE,EAAE,MAAM,CAAC,CACvF,CAAA;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,IAAI,WAAW,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;AAC3D,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,G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AAE,EAAE;IACxB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC9C,IAAI,CAAC,MAAM;YAAE,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACnC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAA;QACxC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAEnD,MAAM,MAAM,GAAG;YACb,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;QAED,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IACnD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAc,CAAC,CAAA;IAC7B,CAAC;AACH,CAAC,CAAC,CACL,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/commands/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAmFnC,eAAO,MAAM,gBAAgB,SA2B1B,CAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { CredentialManager } from '../lib/credential-manager';
|
|
3
|
+
import { handleError } from '../utils/error-handler';
|
|
4
|
+
import { formatOutput } from '../utils/output';
|
|
5
|
+
async function listAction(options) {
|
|
6
|
+
try {
|
|
7
|
+
const credManager = new CredentialManager();
|
|
8
|
+
const config = await credManager.load();
|
|
9
|
+
const workspaces = Object.values(config.workspaces);
|
|
10
|
+
const output = workspaces.map((ws) => ({
|
|
11
|
+
id: ws.workspace_id,
|
|
12
|
+
name: ws.workspace_name,
|
|
13
|
+
current: ws.workspace_id === config.current_workspace,
|
|
14
|
+
}));
|
|
15
|
+
console.log(formatOutput(output, options.pretty));
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
handleError(error);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function switchAction(id, options) {
|
|
22
|
+
try {
|
|
23
|
+
const credManager = new CredentialManager();
|
|
24
|
+
const config = await credManager.load();
|
|
25
|
+
if (!config.workspaces[id]) {
|
|
26
|
+
console.log(formatOutput({ error: `Workspace not found: ${id}` }, options.pretty));
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
await credManager.setCurrentWorkspace(id);
|
|
30
|
+
console.log(formatOutput({ current: id }, options.pretty));
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
handleError(error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function currentAction(options) {
|
|
37
|
+
try {
|
|
38
|
+
const credManager = new CredentialManager();
|
|
39
|
+
const workspace = await credManager.getWorkspace();
|
|
40
|
+
if (!workspace) {
|
|
41
|
+
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty));
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
const output = {
|
|
45
|
+
workspace_id: workspace.workspace_id,
|
|
46
|
+
workspace_name: workspace.workspace_name,
|
|
47
|
+
};
|
|
48
|
+
console.log(formatOutput(output, options.pretty));
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
handleError(error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function removeAction(id, options) {
|
|
55
|
+
try {
|
|
56
|
+
const credManager = new CredentialManager();
|
|
57
|
+
const config = await credManager.load();
|
|
58
|
+
if (!config.workspaces[id]) {
|
|
59
|
+
console.log(formatOutput({ error: `Workspace not found: ${id}` }, options.pretty));
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
await credManager.removeWorkspace(id);
|
|
63
|
+
console.log(formatOutput({ removed: id }, options.pretty));
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
handleError(error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export const workspaceCommand = new Command('workspace')
|
|
70
|
+
.description('Workspace management commands')
|
|
71
|
+
.addCommand(new Command('list')
|
|
72
|
+
.description('List all workspaces')
|
|
73
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
74
|
+
.action(listAction))
|
|
75
|
+
.addCommand(new Command('switch')
|
|
76
|
+
.description('Switch to workspace')
|
|
77
|
+
.argument('<id>', 'Workspace ID')
|
|
78
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
79
|
+
.action(switchAction))
|
|
80
|
+
.addCommand(new Command('current')
|
|
81
|
+
.description('Show current workspace')
|
|
82
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
83
|
+
.action(currentAction))
|
|
84
|
+
.addCommand(new Command('remove')
|
|
85
|
+
.description('Remove workspace')
|
|
86
|
+
.argument('<id>', 'Workspace ID')
|
|
87
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
88
|
+
.action(removeAction));
|
|
89
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/commands/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY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
2
|
+
export declare class CredentialManager {
|
|
3
|
+
private configDir;
|
|
4
|
+
private credentialsPath;
|
|
5
|
+
constructor(configDir?: string);
|
|
6
|
+
load(): Promise<Config>;
|
|
7
|
+
save(config: Config): Promise<void>;
|
|
8
|
+
getWorkspace(id?: string): Promise<WorkspaceCredentials | null>;
|
|
9
|
+
setWorkspace(creds: WorkspaceCredentials): Promise<void>;
|
|
10
|
+
removeWorkspace(id: string): Promise<void>;
|
|
11
|
+
setCurrentWorkspace(id: string): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=credential-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-manager.d.ts","sourceRoot":"","sources":["../../src/lib/credential-manager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE5D,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,eAAe,CAAQ;gBAEnB,SAAS,CAAC,EAAE,MAAM;IAKxB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAavB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnC,YAAY,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAc/D,YAAY,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxD,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW1C,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKrD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { mkdir } from 'node:fs/promises';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
export class CredentialManager {
|
|
6
|
+
configDir;
|
|
7
|
+
credentialsPath;
|
|
8
|
+
constructor(configDir) {
|
|
9
|
+
this.configDir = configDir ?? join(homedir(), '.config', 'agent-slack');
|
|
10
|
+
this.credentialsPath = join(this.configDir, 'credentials.json');
|
|
11
|
+
}
|
|
12
|
+
async load() {
|
|
13
|
+
if (!existsSync(this.credentialsPath)) {
|
|
14
|
+
return {
|
|
15
|
+
current_workspace: null,
|
|
16
|
+
workspaces: {},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const file = Bun.file(this.credentialsPath);
|
|
20
|
+
const content = await file.text();
|
|
21
|
+
return JSON.parse(content);
|
|
22
|
+
}
|
|
23
|
+
async save(config) {
|
|
24
|
+
await mkdir(this.configDir, { recursive: true });
|
|
25
|
+
const file = Bun.file(this.credentialsPath);
|
|
26
|
+
await Bun.write(file, JSON.stringify(config, null, 2));
|
|
27
|
+
await Bun.spawn(['chmod', '0600', this.credentialsPath]).exited;
|
|
28
|
+
}
|
|
29
|
+
async getWorkspace(id) {
|
|
30
|
+
const config = await this.load();
|
|
31
|
+
if (id) {
|
|
32
|
+
return config.workspaces[id] ?? null;
|
|
33
|
+
}
|
|
34
|
+
if (!config.current_workspace) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return config.workspaces[config.current_workspace] ?? null;
|
|
38
|
+
}
|
|
39
|
+
async setWorkspace(creds) {
|
|
40
|
+
const config = await this.load();
|
|
41
|
+
config.workspaces[creds.workspace_id] = creds;
|
|
42
|
+
await this.save(config);
|
|
43
|
+
}
|
|
44
|
+
async removeWorkspace(id) {
|
|
45
|
+
const config = await this.load();
|
|
46
|
+
delete config.workspaces[id];
|
|
47
|
+
if (config.current_workspace === id) {
|
|
48
|
+
config.current_workspace = null;
|
|
49
|
+
}
|
|
50
|
+
await this.save(config);
|
|
51
|
+
}
|
|
52
|
+
async setCurrentWorkspace(id) {
|
|
53
|
+
const config = await this.load();
|
|
54
|
+
config.current_workspace = id;
|
|
55
|
+
await this.save(config);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=credential-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-manager.js","sourceRoot":"","sources":["../../src/lib/credential-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,MAAM,OAAO,iBAAiB;IACpB,SAAS,CAAQ;IACjB,eAAe,CAAQ;IAE/B,YAAY,SAAkB;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,CAAA;QACvE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAA;IACjE,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACtC,OAAO;gBACL,iBAAiB,EAAE,IAAI;gBACvB,UAAU,EAAE,EAAE;aACf,CAAA;QACH,CAAC;QAED,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QAC3C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAW,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAAc;QACvB,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAEhD,MAAM,IAAI,GAAG,GAAG,CA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IACzB,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,EAAU;QAClC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QAChC,MAAM,CAAC,iBAAiB,GAAG,EAAE,CAAA;QAC7B,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ChannelRef, FileRef, MessageRef, SlackChannel, SlackFile, SlackMessage, SlackUser, UserRef } from '../types';
|
|
2
|
+
export declare class RefManager {
|
|
3
|
+
private channelRefs;
|
|
4
|
+
private messageRefs;
|
|
5
|
+
private userRefs;
|
|
6
|
+
private fileRefs;
|
|
7
|
+
private channelCounter;
|
|
8
|
+
private messageCounter;
|
|
9
|
+
private userCounter;
|
|
10
|
+
private fileCounter;
|
|
11
|
+
assignChannelRef(channel: SlackChannel): ChannelRef;
|
|
12
|
+
assignMessageRef(message: SlackMessage): MessageRef;
|
|
13
|
+
assignUserRef(user: SlackUser): UserRef;
|
|
14
|
+
assignFileRef(file: SlackFile): FileRef;
|
|
15
|
+
resolveRef(ref: string): {
|
|
16
|
+
type: 'channel' | 'message' | 'user' | 'file';
|
|
17
|
+
id: string;
|
|
18
|
+
} | null;
|
|
19
|
+
getChannelByRef(ref: ChannelRef): SlackChannel | null;
|
|
20
|
+
getMessageByRef(ref: MessageRef): SlackMessage | null;
|
|
21
|
+
getUserByRef(ref: UserRef): SlackUser | null;
|
|
22
|
+
getFileByRef(ref: FileRef): SlackFile | null;
|
|
23
|
+
clear(): void;
|
|
24
|
+
serialize(): string;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ref-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref-manager.d.ts","sourceRoot":"","sources":["../../src/lib/ref-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,SAAS,EACT,OAAO,EACR,MAAM,UAAU,CAAA;AAEjB,qBAAa,UAAU;IACrB,OAAO,CAAC,WAAW,CAAkC;IACrD,OAAO,CAAC,WAAW,CAAkC;IACrD,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,QAAQ,CAA+B;IAE/C,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,WAAW,CAAI;IAEvB,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU;IAOnD,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU;IAOnD,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO;IAOvC,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO;IAOvC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAoB7F,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI;IAIrD,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI;IAIrD,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;IAI5C,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;IAI5C,KAAK,IAAI,IAAI;IAWb,SAAS,IAAI,MAAM;CAkBpB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export class RefManager {
|
|
2
|
+
channelRefs = new Map();
|
|
3
|
+
messageRefs = new Map();
|
|
4
|
+
userRefs = new Map();
|
|
5
|
+
fileRefs = new Map();
|
|
6
|
+
channelCounter = 1;
|
|
7
|
+
messageCounter = 1;
|
|
8
|
+
userCounter = 1;
|
|
9
|
+
fileCounter = 1;
|
|
10
|
+
assignChannelRef(channel) {
|
|
11
|
+
const ref = `@c${this.channelCounter}`;
|
|
12
|
+
this.channelRefs.set(ref, channel);
|
|
13
|
+
this.channelCounter++;
|
|
14
|
+
return ref;
|
|
15
|
+
}
|
|
16
|
+
assignMessageRef(message) {
|
|
17
|
+
const ref = `@m${this.messageCounter}`;
|
|
18
|
+
this.messageRefs.set(ref, message);
|
|
19
|
+
this.messageCounter++;
|
|
20
|
+
return ref;
|
|
21
|
+
}
|
|
22
|
+
assignUserRef(user) {
|
|
23
|
+
const ref = `@u${this.userCounter}`;
|
|
24
|
+
this.userRefs.set(ref, user);
|
|
25
|
+
this.userCounter++;
|
|
26
|
+
return ref;
|
|
27
|
+
}
|
|
28
|
+
assignFileRef(file) {
|
|
29
|
+
const ref = `@f${this.fileCounter}`;
|
|
30
|
+
this.fileRefs.set(ref, file);
|
|
31
|
+
this.fileCounter++;
|
|
32
|
+
return ref;
|
|
33
|
+
}
|
|
34
|
+
resolveRef(ref) {
|
|
35
|
+
if (ref.startsWith('@c')) {
|
|
36
|
+
const channel = this.channelRefs.get(ref);
|
|
37
|
+
return channel ? { type: 'channel', id: channel.id } : null;
|
|
38
|
+
}
|
|
39
|
+
if (ref.startsWith('@m')) {
|
|
40
|
+
const message = this.messageRefs.get(ref);
|
|
41
|
+
return message ? { type: 'message', id: message.ts } : null;
|
|
42
|
+
}
|
|
43
|
+
if (ref.startsWith('@u')) {
|
|
44
|
+
const user = this.userRefs.get(ref);
|
|
45
|
+
return user ? { type: 'user', id: user.id } : null;
|
|
46
|
+
}
|
|
47
|
+
if (ref.startsWith('@f')) {
|
|
48
|
+
const file = this.fileRefs.get(ref);
|
|
49
|
+
return file ? { type: 'file', id: file.id } : null;
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
getChannelByRef(ref) {
|
|
54
|
+
return this.channelRefs.get(ref) || null;
|
|
55
|
+
}
|
|
56
|
+
getMessageByRef(ref) {
|
|
57
|
+
return this.messageRefs.get(ref) || null;
|
|
58
|
+
}
|
|
59
|
+
getUserByRef(ref) {
|
|
60
|
+
return this.userRefs.get(ref) || null;
|
|
61
|
+
}
|
|
62
|
+
getFileByRef(ref) {
|
|
63
|
+
return this.fileRefs.get(ref) || null;
|
|
64
|
+
}
|
|
65
|
+
clear() {
|
|
66
|
+
this.channelRefs.clear();
|
|
67
|
+
this.messageRefs.clear();
|
|
68
|
+
this.userRefs.clear();
|
|
69
|
+
this.fileRefs.clear();
|
|
70
|
+
this.channelCounter = 1;
|
|
71
|
+
this.messageCounter = 1;
|
|
72
|
+
this.userCounter = 1;
|
|
73
|
+
this.fileCounter = 1;
|
|
74
|
+
}
|
|
75
|
+
serialize() {
|
|
76
|
+
const refs = {};
|
|
77
|
+
for (const [ref, channel] of this.channelRefs) {
|
|
78
|
+
refs[ref] = channel.id;
|
|
79
|
+
}
|
|
80
|
+
for (const [ref, message] of this.messageRefs) {
|
|
81
|
+
refs[ref] = message.ts;
|
|
82
|
+
}
|
|
83
|
+
for (const [ref, user] of this.userRefs) {
|
|
84
|
+
refs[ref] = user.id;
|
|
85
|
+
}
|
|
86
|
+
for (const [ref, file] of this.fileRefs) {
|
|
87
|
+
refs[ref] = file.id;
|
|
88
|
+
}
|
|
89
|
+
return JSON.stringify(refs);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=ref-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref-manager.js","sourceRoot":"","sources":["../../src/lib/ref-manager.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,UAAU;IACb,WAAW,GAAG,IAAI,GAAG,EAAwB,CAAA;IAC7C,WAAW,GAAG,IAAI,GAAG,EAAwB,CAAA;IAC7C,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAA;IACvC,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAA;IAEvC,cAAc,GAAG,CAAC,CAAA;IAClB,cAAc,GAAG,CAAC,CAAA;IAClB,WAAW,GAAG,CAAC,CAAA;IACf,WAAW,GAAG,CAAC,CAAA;IAEvB,gBAAgB,CAAC,OAAqB;QACpC,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,cAAc,EAAgB,CAAA;QACpD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAClC,IAAI,CAAC,cAAc,EAAE,CAAA;QACrB,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,gBAAgB,CAAC,OAAqB;QACpC,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,cAAc,EAAgB,CAAA;QACpD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAClC,IAAI,CAAC,cAAc,EAAE,CAAA;QACrB,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,aAAa,CAAC,IAAe;QAC3B,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,WAAW,EAAa,CAAA;QAC9C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QAC5B,IAAI,CAAC,WAAW,EAAE,CAAA;QAClB,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,aAAa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C;QACD,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,EAAE,CAAA;QACxB,CAAC;QACD,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACxC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAA;QACrB,CAAC;QACD,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACxC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAA;QACrB,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SlackChannel, SlackFile, SlackMessage, SlackSearchResult, SlackUser } from '../types';
|
|
2
|
+
export declare class SlackError extends Error {
|
|
3
|
+
code: string;
|
|
4
|
+
constructor(message: string, code: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class SlackClient {
|
|
7
|
+
private client;
|
|
8
|
+
constructor(token: string, cookie: string);
|
|
9
|
+
private withRetry;
|
|
10
|
+
private sleep;
|
|
11
|
+
private checkResponse;
|
|
12
|
+
testAuth(): Promise<{
|
|
13
|
+
user_id: string;
|
|
14
|
+
team_id: string;
|
|
15
|
+
user?: string;
|
|
16
|
+
team?: string;
|
|
17
|
+
}>;
|
|
18
|
+
listChannels(): Promise<SlackChannel[]>;
|
|
19
|
+
getChannel(id: string): Promise<SlackChannel>;
|
|
20
|
+
sendMessage(channel: string, text: string, threadTs?: string): Promise<SlackMessage>;
|
|
21
|
+
getMessages(channel: string, limit?: number): Promise<SlackMessage[]>;
|
|
22
|
+
getMessage(channel: string, ts: string): Promise<SlackMessage | null>;
|
|
23
|
+
updateMessage(channel: string, ts: string, text: string): Promise<SlackMessage>;
|
|
24
|
+
deleteMessage(channel: string, ts: string): Promise<void>;
|
|
25
|
+
addReaction(channel: string, ts: string, emoji: string): Promise<void>;
|
|
26
|
+
removeReaction(channel: string, ts: string, emoji: string): Promise<void>;
|
|
27
|
+
listUsers(): Promise<SlackUser[]>;
|
|
28
|
+
getUser(id: string): Promise<SlackUser>;
|
|
29
|
+
uploadFile(channels: string[], file: Buffer, filename: string): Promise<SlackFile>;
|
|
30
|
+
listFiles(channel?: string): Promise<SlackFile[]>;
|
|
31
|
+
searchMessages(query: string, options?: {
|
|
32
|
+
sort?: 'score' | 'timestamp';
|
|
33
|
+
sortDir?: 'asc' | 'desc';
|
|
34
|
+
count?: number;
|
|
35
|
+
}): Promise<SlackSearchResult[]>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=slack-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack-client.d.ts","sourceRoot":"","sources":["../../src/lib/slack-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEnG,qBAAa,UAAW,SAAQ,KAAK;IACnC,IAAI,EAAE,MAAM,CAAA;gBAEA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAK1C;AAKD,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAW;gBAEb,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;YAa3B,SAAS;IAqBvB,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,aAAa;IAMf,QAAQ,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAavF,YAAY,IAAI,OA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