agent-messenger 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/release.md +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/ci.yml +1 -1
- package/.github/workflows/e2e.yml.disabled +69 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +18 -15
- package/biome.json +34 -2
- package/bun.lock +63 -0
- package/dist/package.json +8 -4
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +4 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/platforms/discord/cli.js +4 -4
- package/dist/src/platforms/discord/cli.js.map +1 -1
- package/dist/src/platforms/discord/client.d.ts +26 -5
- package/dist/src/platforms/discord/client.d.ts.map +1 -1
- package/dist/src/platforms/discord/client.js +115 -17
- package/dist/src/platforms/discord/client.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js +16 -16
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/commands/channel.js +4 -4
- package/dist/src/platforms/discord/commands/channel.js.map +1 -1
- package/dist/src/platforms/discord/commands/dm.d.ts +9 -0
- package/dist/src/platforms/discord/commands/dm.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/dm.js +68 -0
- package/dist/src/platforms/discord/commands/dm.js.map +1 -0
- package/dist/src/platforms/discord/commands/friend.d.ts +3 -0
- package/dist/src/platforms/discord/commands/friend.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/friend.js +39 -0
- package/dist/src/platforms/discord/commands/friend.js.map +1 -0
- package/dist/src/platforms/discord/commands/index.d.ts +1 -1
- package/dist/src/platforms/discord/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/index.js +1 -1
- package/dist/src/platforms/discord/commands/index.js.map +1 -1
- package/dist/src/platforms/discord/commands/member.d.ts +3 -0
- package/dist/src/platforms/discord/commands/member.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/member.js +47 -0
- package/dist/src/platforms/discord/commands/member.js.map +1 -0
- package/dist/src/platforms/discord/commands/mention.d.ts +8 -0
- package/dist/src/platforms/discord/commands/mention.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/mention.js +47 -0
- package/dist/src/platforms/discord/commands/mention.js.map +1 -0
- package/dist/src/platforms/discord/commands/message.d.ts +13 -0
- package/dist/src/platforms/discord/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/message.js +95 -1
- package/dist/src/platforms/discord/commands/message.js.map +1 -1
- package/dist/src/platforms/discord/commands/note.d.ts +3 -0
- package/dist/src/platforms/discord/commands/note.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/note.js +56 -0
- package/dist/src/platforms/discord/commands/note.js.map +1 -0
- package/dist/src/platforms/discord/commands/profile.d.ts +3 -0
- package/dist/src/platforms/discord/commands/profile.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/profile.js +47 -0
- package/dist/src/platforms/discord/commands/profile.js.map +1 -0
- package/dist/src/platforms/discord/commands/server.d.ts +15 -0
- package/dist/src/platforms/discord/commands/server.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/server.js +102 -0
- package/dist/src/platforms/discord/commands/server.js.map +1 -0
- package/dist/src/platforms/discord/commands/snapshot.js +10 -10
- package/dist/src/platforms/discord/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/discord/commands/thread.d.ts +10 -0
- package/dist/src/platforms/discord/commands/thread.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/thread.js +67 -0
- package/dist/src/platforms/discord/commands/thread.js.map +1 -0
- package/dist/src/platforms/discord/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/user.js +14 -5
- package/dist/src/platforms/discord/commands/user.js.map +1 -1
- package/dist/src/platforms/discord/credential-manager.d.ts +13 -13
- package/dist/src/platforms/discord/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/discord/credential-manager.js +28 -22
- package/dist/src/platforms/discord/credential-manager.js.map +1 -1
- package/dist/src/platforms/discord/super-properties.d.ts +4 -0
- package/dist/src/platforms/discord/super-properties.d.ts.map +1 -0
- package/dist/src/platforms/discord/super-properties.js +50 -0
- package/dist/src/platforms/discord/super-properties.js.map +1 -0
- package/dist/src/platforms/discord/token-extractor.d.ts +6 -1
- package/dist/src/platforms/discord/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/discord/token-extractor.js +27 -2
- package/dist/src/platforms/discord/token-extractor.js.map +1 -1
- package/dist/src/platforms/discord/types.d.ts +389 -22
- package/dist/src/platforms/discord/types.d.ts.map +1 -1
- package/dist/src/platforms/discord/types.js +46 -4
- package/dist/src/platforms/discord/types.js.map +1 -1
- package/dist/src/platforms/slack/cli.d.ts.map +1 -1
- package/dist/src/platforms/slack/cli.js +7 -2
- package/dist/src/platforms/slack/cli.js.map +1 -1
- package/dist/src/platforms/slack/client.d.ts +19 -1
- package/dist/src/platforms/slack/client.d.ts.map +1 -1
- package/dist/src/platforms/slack/client.js +134 -0
- package/dist/src/platforms/slack/client.js.map +1 -1
- package/dist/src/platforms/slack/commands/activity.d.ts +3 -0
- package/dist/src/platforms/slack/commands/activity.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/activity.js +40 -0
- package/dist/src/platforms/slack/commands/activity.js.map +1 -0
- package/dist/src/platforms/slack/commands/drafts.d.ts +3 -0
- package/dist/src/platforms/slack/commands/drafts.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/drafts.js +45 -0
- package/dist/src/platforms/slack/commands/drafts.js.map +1 -0
- package/dist/src/platforms/slack/commands/index.d.ts +5 -0
- package/dist/src/platforms/slack/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/index.js +5 -0
- package/dist/src/platforms/slack/commands/index.js.map +1 -1
- package/dist/src/platforms/slack/commands/saved.d.ts +3 -0
- package/dist/src/platforms/slack/commands/saved.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/saved.js +54 -0
- package/dist/src/platforms/slack/commands/saved.js.map +1 -0
- package/dist/src/platforms/slack/commands/sections.d.ts +3 -0
- package/dist/src/platforms/slack/commands/sections.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/sections.js +37 -0
- package/dist/src/platforms/slack/commands/sections.js.map +1 -0
- package/dist/src/platforms/slack/commands/unread.d.ts +12 -0
- package/dist/src/platforms/slack/commands/unread.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/unread.js +89 -0
- package/dist/src/platforms/slack/commands/unread.js.map +1 -0
- package/dist/src/platforms/slack/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/slack/credential-manager.js +20 -6
- package/dist/src/platforms/slack/credential-manager.js.map +1 -1
- package/dist/src/platforms/slack/token-extractor.d.ts +8 -1
- package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/slack/token-extractor.js +83 -11
- package/dist/src/platforms/slack/token-extractor.js.map +1 -1
- package/dist/src/platforms/slack/types.d.ts +52 -0
- package/dist/src/platforms/slack/types.d.ts.map +1 -1
- package/dist/src/platforms/slack/types.js.map +1 -1
- package/dist/src/platforms/teams/cli.d.ts.map +1 -0
- package/dist/{cli.js → src/platforms/teams/cli.js} +11 -10
- package/dist/src/platforms/teams/cli.js.map +1 -0
- package/dist/src/platforms/teams/client.d.ts +32 -0
- package/dist/src/platforms/teams/client.d.ts.map +1 -0
- package/dist/src/platforms/teams/client.js +202 -0
- package/dist/src/platforms/teams/client.js.map +1 -0
- package/dist/src/platforms/teams/commands/auth.d.ts +14 -0
- package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/auth.js +176 -0
- package/dist/src/platforms/teams/commands/auth.js.map +1 -0
- package/dist/src/platforms/teams/commands/channel.d.ts +13 -0
- package/dist/src/platforms/teams/commands/channel.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/channel.js +97 -0
- package/dist/src/platforms/teams/commands/channel.js.map +1 -0
- package/dist/src/platforms/teams/commands/file.d.ts +12 -0
- package/dist/src/platforms/teams/commands/file.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/file.js +104 -0
- package/dist/src/platforms/teams/commands/file.js.map +1 -0
- package/dist/{commands → src/platforms/teams/commands}/index.d.ts +5 -2
- package/dist/src/platforms/teams/commands/index.d.ts.map +1 -0
- package/dist/{commands → src/platforms/teams/commands}/index.js +5 -2
- package/dist/src/platforms/teams/commands/index.js.map +1 -0
- package/dist/src/platforms/teams/commands/message.d.ts +17 -0
- package/dist/src/platforms/teams/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/message.js +133 -0
- package/dist/src/platforms/teams/commands/message.js.map +1 -0
- package/dist/src/platforms/teams/commands/reaction.d.ts +9 -0
- package/dist/src/platforms/teams/commands/reaction.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/reaction.js +68 -0
- package/dist/src/platforms/teams/commands/reaction.js.map +1 -0
- package/dist/src/platforms/teams/commands/snapshot.d.ts +10 -0
- package/dist/src/platforms/teams/commands/snapshot.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/snapshot.js +85 -0
- package/dist/src/platforms/teams/commands/snapshot.js.map +1 -0
- package/dist/src/platforms/teams/commands/team.d.ts +18 -0
- package/dist/src/platforms/teams/commands/team.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/team.js +130 -0
- package/dist/src/platforms/teams/commands/team.js.map +1 -0
- package/dist/src/platforms/teams/commands/user.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/user.js +88 -0
- package/dist/src/platforms/teams/commands/user.js.map +1 -0
- package/dist/src/platforms/teams/credential-manager.d.ts +18 -0
- package/dist/src/platforms/teams/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/teams/credential-manager.js +81 -0
- package/dist/src/platforms/teams/credential-manager.js.map +1 -0
- package/dist/src/platforms/teams/index.d.ts +4 -0
- package/dist/src/platforms/teams/index.d.ts.map +1 -0
- package/dist/src/platforms/teams/index.js +6 -0
- package/dist/src/platforms/teams/index.js.map +1 -0
- package/dist/src/platforms/teams/token-extractor.d.ts +41 -0
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -0
- package/dist/src/platforms/teams/token-extractor.js +360 -0
- package/dist/src/platforms/teams/token-extractor.js.map +1 -0
- package/dist/src/platforms/teams/types.d.ts +209 -0
- package/dist/src/platforms/teams/types.d.ts.map +1 -0
- package/dist/src/platforms/teams/types.js +65 -0
- package/dist/src/platforms/teams/types.js.map +1 -0
- package/dist/src/shared/utils/derived-key-cache.d.ts +20 -0
- package/dist/src/shared/utils/derived-key-cache.d.ts.map +1 -0
- package/dist/src/shared/utils/derived-key-cache.js +52 -0
- package/dist/src/shared/utils/derived-key-cache.js.map +1 -0
- package/docs/README.md +113 -0
- package/docs/biome.json +8 -0
- package/docs/bun.lock +1426 -0
- package/docs/content/docs/agent-skills.mdx +98 -0
- package/docs/content/docs/index.mdx +124 -0
- package/docs/{discord.md → content/docs/integrations/discord.mdx} +46 -21
- package/docs/content/docs/integrations/meta.json +5 -0
- package/docs/{slack.md → content/docs/integrations/slack.mdx} +5 -4
- package/docs/content/docs/integrations/teams.mdx +322 -0
- package/docs/content/docs/meta.json +8 -0
- package/docs/content/docs/quick-start.mdx +103 -0
- package/docs/eslint.config.mjs +30 -0
- package/docs/next.config.ts +10 -0
- package/docs/package.json +42 -0
- package/docs/postcss.config.mjs +7 -0
- package/docs/public/file.svg +1 -0
- package/docs/public/globe.svg +1 -0
- package/docs/public/next.svg +1 -0
- package/docs/public/vercel.svg +1 -0
- package/docs/public/window.svg +1 -0
- package/docs/source.config.ts +11 -0
- package/docs/src/app/api/search/route.ts +4 -0
- package/docs/src/app/docs/[[...slug]]/page.tsx +53 -0
- package/docs/src/app/docs/layout.tsx +21 -0
- package/docs/src/app/globals.css +10 -0
- package/docs/src/app/icon.png +0 -0
- package/docs/src/app/layout.config.tsx +7 -0
- package/docs/src/app/layout.tsx +35 -0
- package/docs/src/app/page.tsx +489 -0
- package/docs/src/lib/source.ts +15 -0
- package/docs/src/mdx-components.tsx +18 -0
- package/docs/tsconfig.json +36 -0
- package/e2e/README.md +256 -0
- package/e2e/config.ts +51 -0
- package/e2e/discord.e2e.test.ts +252 -0
- package/e2e/helpers.ts +107 -0
- package/e2e/slack.e2e.test.ts +309 -0
- package/package.json +8 -4
- package/scripts/postbuild.ts +15 -0
- package/skills/agent-discord/SKILL.md +96 -30
- package/skills/agent-discord/references/authentication.md +27 -27
- package/skills/agent-discord/references/common-patterns.md +15 -15
- package/skills/agent-discord/templates/post-message.sh +6 -6
- package/skills/agent-discord/templates/{guild-summary.sh → server-summary.sh} +20 -20
- package/skills/agent-slack/SKILL.md +53 -0
- package/skills/agent-teams/SKILL.md +292 -0
- package/skills/agent-teams/references/authentication.md +375 -0
- package/skills/agent-teams/references/common-patterns.md +596 -0
- package/skills/agent-teams/templates/monitor-channel.sh +239 -0
- package/skills/agent-teams/templates/post-message.sh +224 -0
- package/skills/agent-teams/templates/team-summary.sh +210 -0
- package/src/cli.ts +4 -0
- package/src/platforms/discord/cli.ts +3 -3
- package/src/platforms/discord/client.test.ts +15 -15
- package/src/platforms/discord/client.ts +163 -17
- package/src/platforms/discord/commands/auth.test.ts +53 -37
- package/src/platforms/discord/commands/auth.ts +16 -16
- package/src/platforms/discord/commands/channel.test.ts +58 -46
- package/src/platforms/discord/commands/channel.ts +4 -4
- package/src/platforms/discord/commands/dm.test.ts +146 -0
- package/src/platforms/discord/commands/dm.ts +85 -0
- package/src/platforms/discord/commands/file.test.ts +40 -53
- package/src/platforms/discord/commands/friend.test.ts +134 -0
- package/src/platforms/discord/commands/friend.ts +45 -0
- package/src/platforms/discord/commands/index.ts +1 -1
- package/src/platforms/discord/commands/member.test.ts +98 -0
- package/src/platforms/discord/commands/member.ts +59 -0
- package/src/platforms/discord/commands/mention.test.ts +129 -0
- package/src/platforms/discord/commands/mention.ts +59 -0
- package/src/platforms/discord/commands/message.test.ts +139 -44
- package/src/platforms/discord/commands/message.ts +134 -1
- package/src/platforms/discord/commands/note.test.ts +84 -0
- package/src/platforms/discord/commands/note.ts +73 -0
- package/src/platforms/discord/commands/profile.test.ts +107 -0
- package/src/platforms/discord/commands/profile.ts +55 -0
- package/src/platforms/discord/commands/reaction.test.ts +54 -42
- package/src/platforms/discord/commands/server.test.ts +137 -0
- package/src/platforms/discord/commands/{guild.ts → server.ts} +31 -31
- package/src/platforms/discord/commands/snapshot.test.ts +1 -1
- package/src/platforms/discord/commands/snapshot.ts +10 -10
- package/src/platforms/discord/commands/thread.test.ts +121 -0
- package/src/platforms/discord/commands/thread.ts +92 -0
- package/src/platforms/discord/commands/user.test.ts +8 -8
- package/src/platforms/discord/commands/user.ts +16 -5
- package/src/platforms/discord/credential-manager.test.ts +137 -136
- package/src/platforms/discord/credential-manager.ts +35 -26
- package/src/platforms/discord/super-properties.ts +55 -0
- package/src/platforms/discord/token-extractor.test.ts +133 -383
- package/src/platforms/discord/token-extractor.ts +37 -3
- package/src/platforms/discord/types.test.ts +8 -8
- package/src/platforms/discord/types.ts +144 -8
- package/{tests → src/platforms/slack}/cli.test.ts +3 -3
- package/src/platforms/slack/cli.ts +10 -0
- package/{tests/slack-client.test.ts → src/platforms/slack/client.test.ts} +1 -1
- package/src/platforms/slack/client.ts +172 -1
- package/src/platforms/slack/commands/activity.test.ts +147 -0
- package/src/platforms/slack/commands/activity.ts +65 -0
- package/{tests → src/platforms/slack}/commands/auth.test.ts +25 -13
- package/{tests → src/platforms/slack}/commands/channel.test.ts +2 -2
- package/src/platforms/slack/commands/drafts.test.ts +136 -0
- package/src/platforms/slack/commands/drafts.ts +62 -0
- package/{tests → src/platforms/slack}/commands/file.test.ts +2 -2
- package/src/platforms/slack/commands/index.ts +5 -0
- package/{tests → src/platforms/slack}/commands/message.test.ts +2 -2
- package/{tests → src/platforms/slack}/commands/reaction.test.ts +1 -1
- package/src/platforms/slack/commands/saved.test.ts +140 -0
- package/src/platforms/slack/commands/saved.ts +71 -0
- package/src/platforms/slack/commands/sections.test.ts +80 -0
- package/src/platforms/slack/commands/sections.ts +50 -0
- package/{tests → src/platforms/slack}/commands/snapshot.test.ts +117 -105
- package/src/platforms/slack/commands/unread.test.ts +139 -0
- package/src/platforms/slack/commands/unread.ts +129 -0
- package/{tests → src/platforms/slack}/commands/user.test.ts +3 -3
- package/{tests → src/platforms/slack}/commands/workspace.test.ts +44 -95
- package/{tests → src/platforms/slack}/credential-manager.test.ts +2 -2
- package/src/platforms/slack/credential-manager.ts +22 -7
- package/src/platforms/slack/token-extractor-node-test.ts +40 -0
- package/src/platforms/slack/token-extractor-node.test.ts +10 -0
- package/src/platforms/slack/token-extractor.ts +93 -12
- package/{tests → src/platforms/slack}/types.test.ts +1 -1
- package/src/platforms/slack/types.ts +58 -0
- package/src/platforms/teams/cli.ts +36 -0
- package/src/platforms/teams/client.test.ts +500 -0
- package/src/platforms/teams/client.ts +365 -0
- package/src/platforms/teams/commands/auth.test.ts +99 -0
- package/src/platforms/teams/commands/auth.ts +232 -0
- package/src/platforms/teams/commands/channel.test.ts +147 -0
- package/src/platforms/teams/commands/channel.ts +129 -0
- package/src/platforms/teams/commands/file.test.ts +88 -0
- package/src/platforms/teams/commands/file.ts +144 -0
- package/src/platforms/teams/commands/index.ts +12 -0
- package/src/platforms/teams/commands/message.test.ts +110 -0
- package/src/platforms/teams/commands/message.ts +188 -0
- package/src/platforms/teams/commands/reaction.test.ts +87 -0
- package/src/platforms/teams/commands/reaction.ts +104 -0
- package/src/platforms/teams/commands/snapshot.test.ts +35 -0
- package/src/platforms/teams/commands/snapshot.ts +115 -0
- package/src/platforms/teams/commands/team.test.ts +157 -0
- package/src/platforms/teams/commands/team.ts +164 -0
- package/src/platforms/teams/commands/user.test.ts +83 -0
- package/src/platforms/teams/commands/user.ts +112 -0
- package/src/platforms/teams/credential-manager.test.ts +178 -0
- package/src/platforms/teams/credential-manager.ts +92 -0
- package/src/platforms/teams/index.ts +5 -0
- package/src/platforms/teams/token-extractor.test.ts +429 -0
- package/src/platforms/teams/token-extractor.ts +490 -0
- package/src/platforms/teams/types.test.ts +226 -0
- package/src/platforms/teams/types.ts +140 -0
- package/src/shared/utils/derived-key-cache.test.ts +136 -0
- package/src/shared/utils/derived-key-cache.ts +63 -0
- package/tsconfig.json +1 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -3
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js +0 -140
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/channel.d.ts +0 -3
- package/dist/commands/channel.d.ts.map +0 -1
- package/dist/commands/channel.js +0 -118
- package/dist/commands/channel.js.map +0 -1
- package/dist/commands/file.d.ts +0 -3
- package/dist/commands/file.d.ts.map +0 -1
- package/dist/commands/file.js +0 -113
- package/dist/commands/file.js.map +0 -1
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/message.d.ts +0 -3
- package/dist/commands/message.d.ts.map +0 -1
- package/dist/commands/message.js +0 -214
- package/dist/commands/message.js.map +0 -1
- package/dist/commands/reaction.d.ts +0 -3
- package/dist/commands/reaction.d.ts.map +0 -1
- package/dist/commands/reaction.js +0 -100
- package/dist/commands/reaction.js.map +0 -1
- package/dist/commands/snapshot.d.ts +0 -3
- package/dist/commands/snapshot.d.ts.map +0 -1
- package/dist/commands/snapshot.js +0 -88
- package/dist/commands/snapshot.js.map +0 -1
- package/dist/commands/user.d.ts.map +0 -1
- package/dist/commands/user.js +0 -96
- package/dist/commands/user.js.map +0 -1
- package/dist/commands/workspace.d.ts +0 -3
- package/dist/commands/workspace.d.ts.map +0 -1
- package/dist/commands/workspace.js +0 -89
- package/dist/commands/workspace.js.map +0 -1
- package/dist/lib/credential-manager.d.ts +0 -13
- package/dist/lib/credential-manager.d.ts.map +0 -1
- package/dist/lib/credential-manager.js +0 -58
- package/dist/lib/credential-manager.js.map +0 -1
- package/dist/lib/index.d.ts +0 -3
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js +0 -3
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/ref-manager.d.ts +0 -26
- package/dist/lib/ref-manager.d.ts.map +0 -1
- package/dist/lib/ref-manager.js +0 -92
- package/dist/lib/ref-manager.js.map +0 -1
- package/dist/lib/slack-client.d.ts +0 -37
- package/dist/lib/slack-client.d.ts.map +0 -1
- package/dist/lib/slack-client.js +0 -379
- package/dist/lib/slack-client.js.map +0 -1
- package/dist/lib/token-extractor.d.ts +0 -28
- package/dist/lib/token-extractor.d.ts.map +0 -1
- package/dist/lib/token-extractor.js +0 -401
- package/dist/lib/token-extractor.js.map +0 -1
- package/dist/src/platforms/discord/client.test.d.ts +0 -2
- package/dist/src/platforms/discord/client.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/client.test.js +0 -367
- package/dist/src/platforms/discord/client.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/auth.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/auth.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/auth.test.js +0 -65
- package/dist/src/platforms/discord/commands/auth.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/channel.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/channel.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/channel.test.js +0 -136
- package/dist/src/platforms/discord/commands/channel.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/file.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/file.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/file.test.js +0 -83
- package/dist/src/platforms/discord/commands/file.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/guild.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/guild.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/guild.test.js +0 -100
- package/dist/src/platforms/discord/commands/guild.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/message.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/message.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/message.test.js +0 -91
- package/dist/src/platforms/discord/commands/message.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/reaction.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/reaction.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/reaction.test.js +0 -115
- package/dist/src/platforms/discord/commands/reaction.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/snapshot.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/snapshot.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/snapshot.test.js +0 -25
- package/dist/src/platforms/discord/commands/snapshot.test.js.map +0 -1
- package/dist/src/platforms/discord/commands/user.test.d.ts +0 -2
- package/dist/src/platforms/discord/commands/user.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/commands/user.test.js +0 -103
- package/dist/src/platforms/discord/commands/user.test.js.map +0 -1
- package/dist/src/platforms/discord/credential-manager.test.d.ts +0 -2
- package/dist/src/platforms/discord/credential-manager.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/credential-manager.test.js +0 -136
- package/dist/src/platforms/discord/credential-manager.test.js.map +0 -1
- package/dist/src/platforms/discord/token-extractor.test.d.ts +0 -2
- package/dist/src/platforms/discord/token-extractor.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/token-extractor.test.js +0 -789
- package/dist/src/platforms/discord/token-extractor.test.js.map +0 -1
- package/dist/src/platforms/discord/types.test.d.ts +0 -2
- package/dist/src/platforms/discord/types.test.d.ts.map +0 -1
- package/dist/src/platforms/discord/types.test.js +0 -211
- package/dist/src/platforms/discord/types.test.js.map +0 -1
- package/dist/src/shared/utils/concurrency.test.d.ts +0 -2
- package/dist/src/shared/utils/concurrency.test.d.ts.map +0 -1
- package/dist/src/shared/utils/concurrency.test.js +0 -39
- package/dist/src/shared/utils/concurrency.test.js.map +0 -1
- package/dist/tests/cli.test.d.ts +0 -2
- package/dist/tests/cli.test.d.ts.map +0 -1
- package/dist/tests/cli.test.js +0 -83
- package/dist/tests/cli.test.js.map +0 -1
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/CURRENT +0 -1
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOCK +0 -0
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOG +0 -3
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOG.old +0 -1
- package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/MANIFEST-000004 +0 -0
- package/dist/tests/commands/auth.test.d.ts +0 -2
- package/dist/tests/commands/auth.test.d.ts.map +0 -1
- package/dist/tests/commands/auth.test.js +0 -304
- package/dist/tests/commands/auth.test.js.map +0 -1
- package/dist/tests/commands/channel.test.d.ts +0 -2
- package/dist/tests/commands/channel.test.d.ts.map +0 -1
- package/dist/tests/commands/channel.test.js +0 -166
- package/dist/tests/commands/channel.test.js.map +0 -1
- package/dist/tests/commands/file.test.d.ts +0 -2
- package/dist/tests/commands/file.test.d.ts.map +0 -1
- package/dist/tests/commands/file.test.js +0 -175
- package/dist/tests/commands/file.test.js.map +0 -1
- package/dist/tests/commands/message.test.d.ts +0 -2
- package/dist/tests/commands/message.test.d.ts.map +0 -1
- package/dist/tests/commands/message.test.js +0 -293
- package/dist/tests/commands/message.test.js.map +0 -1
- package/dist/tests/commands/reaction.test.d.ts +0 -2
- package/dist/tests/commands/reaction.test.d.ts.map +0 -1
- package/dist/tests/commands/reaction.test.js +0 -84
- package/dist/tests/commands/reaction.test.js.map +0 -1
- package/dist/tests/commands/snapshot.test.d.ts +0 -2
- package/dist/tests/commands/snapshot.test.d.ts.map +0 -1
- package/dist/tests/commands/snapshot.test.js +0 -280
- package/dist/tests/commands/snapshot.test.js.map +0 -1
- package/dist/tests/commands/user.test.d.ts +0 -2
- package/dist/tests/commands/user.test.d.ts.map +0 -1
- package/dist/tests/commands/user.test.js +0 -117
- package/dist/tests/commands/user.test.js.map +0 -1
- package/dist/tests/commands/workspace.test.d.ts +0 -2
- package/dist/tests/commands/workspace.test.d.ts.map +0 -1
- package/dist/tests/commands/workspace.test.js +0 -453
- package/dist/tests/commands/workspace.test.js.map +0 -1
- package/dist/tests/credential-manager.test.d.ts +0 -2
- package/dist/tests/credential-manager.test.d.ts.map +0 -1
- package/dist/tests/credential-manager.test.js +0 -199
- package/dist/tests/credential-manager.test.js.map +0 -1
- package/dist/tests/slack-client.test.d.ts +0 -2
- package/dist/tests/slack-client.test.d.ts.map +0 -1
- package/dist/tests/slack-client.test.js +0 -741
- package/dist/tests/slack-client.test.js.map +0 -1
- package/dist/tests/types.test.d.ts +0 -2
- package/dist/tests/types.test.d.ts.map +0 -1
- package/dist/tests/types.test.js +0 -215
- package/dist/tests/types.test.js.map +0 -1
- package/dist/types/index.d.ts +0 -369
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -92
- package/dist/types/index.js.map +0 -1
- package/dist/utils/error-handler.d.ts +0 -2
- package/dist/utils/error-handler.d.ts.map +0 -1
- package/dist/utils/error-handler.js +0 -5
- package/dist/utils/error-handler.js.map +0 -1
- package/dist/utils/output.d.ts +0 -2
- package/dist/utils/output.d.ts.map +0 -1
- package/dist/utils/output.js +0 -4
- package/dist/utils/output.js.map +0 -1
- package/src/platforms/discord/commands/guild.test.ts +0 -117
- /package/dist/{cli.d.ts → src/platforms/teams/cli.d.ts} +0 -0
- /package/dist/{commands → src/platforms/teams/commands}/user.d.ts +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Command } from 'commander'
|
|
2
|
+
import { handleError } from '../../../shared/utils/error-handler'
|
|
3
|
+
import { formatOutput } from '../../../shared/utils/output'
|
|
4
|
+
import { SlackClient } from '../client'
|
|
5
|
+
import { CredentialManager } from '../credential-manager'
|
|
6
|
+
|
|
7
|
+
async function listAction(options: {
|
|
8
|
+
pretty?: boolean
|
|
9
|
+
unread?: boolean
|
|
10
|
+
limit?: string
|
|
11
|
+
types?: string
|
|
12
|
+
}): Promise<void> {
|
|
13
|
+
try {
|
|
14
|
+
const credManager = new CredentialManager()
|
|
15
|
+
const ws = await credManager.getWorkspace()
|
|
16
|
+
|
|
17
|
+
if (!ws) {
|
|
18
|
+
console.log(
|
|
19
|
+
formatOutput(
|
|
20
|
+
{ error: 'No workspace configured. Run "auth extract" first.' },
|
|
21
|
+
options.pretty
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
process.exit(1)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const client = new SlackClient(ws.token, ws.cookie)
|
|
28
|
+
|
|
29
|
+
const mode = options.unread ? 'priority_unreads_v1' : 'chrono_reads_and_unreads'
|
|
30
|
+
const limit = options.limit ? parseInt(options.limit, 10) : 20
|
|
31
|
+
|
|
32
|
+
const items = await client.getActivityFeed({
|
|
33
|
+
types: options.types,
|
|
34
|
+
mode,
|
|
35
|
+
limit,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
console.log(
|
|
39
|
+
formatOutput(
|
|
40
|
+
{
|
|
41
|
+
items,
|
|
42
|
+
count: items.length,
|
|
43
|
+
},
|
|
44
|
+
options.pretty
|
|
45
|
+
)
|
|
46
|
+
)
|
|
47
|
+
} catch (error) {
|
|
48
|
+
handleError(error as Error)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const activityCommand = new Command('activity')
|
|
53
|
+
.description('Activity feed commands')
|
|
54
|
+
.addCommand(
|
|
55
|
+
new Command('list')
|
|
56
|
+
.description('List activity feed items')
|
|
57
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
58
|
+
.option('--unread', 'Show only unread activity')
|
|
59
|
+
.option('--limit <number>', 'Number of items to return (default: 20)')
|
|
60
|
+
.option(
|
|
61
|
+
'--types <types>',
|
|
62
|
+
'Filter by activity types (comma-separated: thread_reply,message_reaction,at_user,at_channel,keyword)'
|
|
63
|
+
)
|
|
64
|
+
.action(listAction)
|
|
65
|
+
)
|
|
@@ -2,8 +2,8 @@ import { afterAll, beforeEach, describe, expect, mock, test } from 'bun:test'
|
|
|
2
2
|
import { mkdirSync, rmSync } from 'node:fs'
|
|
3
3
|
import { homedir } from 'node:os'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
|
-
import { CredentialManager } from '
|
|
6
|
-
import { type ExtractedWorkspace, TokenExtractor } from '
|
|
5
|
+
import { CredentialManager } from '@/platforms/slack/credential-manager'
|
|
6
|
+
import { type ExtractedWorkspace, TokenExtractor } from '@/platforms/slack/token-extractor'
|
|
7
7
|
|
|
8
8
|
const testConfigDir = join(import.meta.dir, '.test-auth-config')
|
|
9
9
|
const testSlackDir = join(import.meta.dir, '.test-slack-data')
|
|
@@ -74,8 +74,9 @@ describe('TokenExtractor', () => {
|
|
|
74
74
|
|
|
75
75
|
describe('extract', () => {
|
|
76
76
|
test('throws error when Slack directory does not exist', async () => {
|
|
77
|
-
// Given: Slack directory does not exist
|
|
78
|
-
|
|
77
|
+
// Given: Slack directory does not exist (use unique path to avoid any collision)
|
|
78
|
+
const nonExistentPath = `/tmp/nonexistent-slack-${Date.now()}-${Math.random()}`
|
|
79
|
+
extractor = new TokenExtractor('darwin', nonExistentPath)
|
|
79
80
|
|
|
80
81
|
// When/Then: extract should throw
|
|
81
82
|
await expect(extractor.extract()).rejects.toThrow('Slack directory not found')
|
|
@@ -124,6 +125,7 @@ describe('Auth Commands Integration', () => {
|
|
|
124
125
|
|
|
125
126
|
beforeEach(() => {
|
|
126
127
|
rmSync(testConfigDir, { recursive: true, force: true })
|
|
128
|
+
mkdirSync(testConfigDir, { recursive: true })
|
|
127
129
|
credManager = new CredentialManager(testConfigDir)
|
|
128
130
|
})
|
|
129
131
|
|
|
@@ -350,23 +352,33 @@ describe('Output Formatting', () => {
|
|
|
350
352
|
})
|
|
351
353
|
|
|
352
354
|
describe('Error Handling', () => {
|
|
355
|
+
beforeEach(() => {
|
|
356
|
+
rmSync(testSlackDir, { recursive: true, force: true })
|
|
357
|
+
mkdirSync(testSlackDir, { recursive: true })
|
|
358
|
+
})
|
|
359
|
+
|
|
360
|
+
afterAll(() => {
|
|
361
|
+
rmSync(testSlackDir, { recursive: true, force: true })
|
|
362
|
+
})
|
|
363
|
+
|
|
353
364
|
test('handles missing Slack installation gracefully', async () => {
|
|
354
|
-
// Given: Slack is not installed
|
|
355
|
-
const
|
|
365
|
+
// Given: Slack is not installed (use unique path)
|
|
366
|
+
const nonExistentPath = `/tmp/nonexistent-slack-${Date.now()}-${Math.random()}`
|
|
367
|
+
const extractor = new TokenExtractor('darwin', nonExistentPath)
|
|
356
368
|
|
|
357
369
|
// When/Then: Should throw descriptive error
|
|
358
370
|
await expect(extractor.extract()).rejects.toThrow('Slack directory not found')
|
|
359
371
|
})
|
|
360
372
|
|
|
361
|
-
test('handles
|
|
362
|
-
// Given:
|
|
363
|
-
// This would require creating a corrupted LevelDB file
|
|
364
|
-
// We test that the extractor handles errors gracefully
|
|
373
|
+
test('handles empty Slack directory gracefully', async () => {
|
|
374
|
+
// Given: Slack directory exists but has no data
|
|
365
375
|
const extractor = new TokenExtractor('darwin', testSlackDir)
|
|
366
376
|
|
|
367
|
-
// When: Trying to extract from
|
|
368
|
-
|
|
369
|
-
|
|
377
|
+
// When: Trying to extract from empty directory
|
|
378
|
+
const result = await extractor.extract()
|
|
379
|
+
|
|
380
|
+
// Then: Should return empty array
|
|
381
|
+
expect(result).toEqual([])
|
|
370
382
|
})
|
|
371
383
|
|
|
372
384
|
test('handles missing Cookies database gracefully', async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, mock, test } from 'bun:test'
|
|
2
|
-
import { SlackClient } from '
|
|
3
|
-
import type { SlackChannel } from '
|
|
2
|
+
import { SlackClient } from '@/platforms/slack/client'
|
|
3
|
+
import type { SlackChannel } from '@/platforms/slack/types'
|
|
4
4
|
|
|
5
5
|
describe('Channel Commands', () => {
|
|
6
6
|
let mockClient: SlackClient
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, mock, test } from 'bun:test'
|
|
2
|
+
import { SlackClient } from '@/platforms/slack/client'
|
|
3
|
+
|
|
4
|
+
describe('Drafts Commands', () => {
|
|
5
|
+
let mockClient: SlackClient
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
// Mock SlackClient
|
|
9
|
+
mockClient = {
|
|
10
|
+
getDrafts: mock(async (cursor?: string) => ({
|
|
11
|
+
drafts: [
|
|
12
|
+
{
|
|
13
|
+
id: 'D001',
|
|
14
|
+
channel_id: 'C123',
|
|
15
|
+
message: {
|
|
16
|
+
text: 'Draft message 1',
|
|
17
|
+
blocks: [],
|
|
18
|
+
},
|
|
19
|
+
date_created: 1234567890,
|
|
20
|
+
date_updated: 1234567891,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'D002',
|
|
24
|
+
channel_id: 'C456',
|
|
25
|
+
message: {
|
|
26
|
+
text: 'Draft message 2',
|
|
27
|
+
blocks: [],
|
|
28
|
+
},
|
|
29
|
+
date_created: 1234567892,
|
|
30
|
+
date_updated: 1234567893,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'D003',
|
|
34
|
+
channel_id: 'C789',
|
|
35
|
+
message: null,
|
|
36
|
+
date_created: 1234567894,
|
|
37
|
+
date_updated: 1234567895,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'D004',
|
|
41
|
+
channel_id: 'C999',
|
|
42
|
+
message: {},
|
|
43
|
+
date_created: 1234567896,
|
|
44
|
+
date_updated: 1234567897,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
next_cursor: cursor ? undefined : 'next_page_cursor',
|
|
48
|
+
})),
|
|
49
|
+
} as any
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
describe('drafts list', () => {
|
|
53
|
+
test('returns drafts', async () => {
|
|
54
|
+
// Given: Client with drafts
|
|
55
|
+
// When: Getting drafts
|
|
56
|
+
const result = await mockClient.getDrafts()
|
|
57
|
+
|
|
58
|
+
// Then: Should return drafts array
|
|
59
|
+
expect(result.drafts).toHaveLength(4)
|
|
60
|
+
expect(result.drafts[0].id).toBe('D001')
|
|
61
|
+
expect(result.drafts[0].message?.text).toBe('Draft message 1')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
test('handles empty message content gracefully', async () => {
|
|
65
|
+
// Given: Client with drafts including null/empty message
|
|
66
|
+
// When: Getting drafts
|
|
67
|
+
const result = await mockClient.getDrafts()
|
|
68
|
+
|
|
69
|
+
// Then: Should handle null message
|
|
70
|
+
expect(result.drafts[2].message).toBeNull()
|
|
71
|
+
|
|
72
|
+
// Then: Should handle empty object message
|
|
73
|
+
expect(result.drafts[3].message).toEqual({})
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test('pagination with cursor works', async () => {
|
|
77
|
+
// Given: Client with pagination support
|
|
78
|
+
// When: Getting first page
|
|
79
|
+
const firstPage = await mockClient.getDrafts()
|
|
80
|
+
|
|
81
|
+
// Then: Should return next_cursor
|
|
82
|
+
expect(firstPage.next_cursor).toBe('next_page_cursor')
|
|
83
|
+
|
|
84
|
+
// When: Getting next page with cursor
|
|
85
|
+
const secondPage = await mockClient.getDrafts('next_page_cursor')
|
|
86
|
+
|
|
87
|
+
// Then: Should not have next_cursor (last page)
|
|
88
|
+
expect(secondPage.next_cursor).toBeUndefined()
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
test('returns next_cursor for pagination', async () => {
|
|
92
|
+
// Given: Client with more drafts available
|
|
93
|
+
// When: Getting drafts
|
|
94
|
+
const result = await mockClient.getDrafts()
|
|
95
|
+
|
|
96
|
+
// Then: Should include next_cursor
|
|
97
|
+
expect(result.next_cursor).toBeDefined()
|
|
98
|
+
expect(result.next_cursor).toBe('next_page_cursor')
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
describe('output formatting', () => {
|
|
103
|
+
test('formats draft output', async () => {
|
|
104
|
+
// Given: Drafts from API
|
|
105
|
+
const result = await mockClient.getDrafts()
|
|
106
|
+
|
|
107
|
+
// When: Formatting output
|
|
108
|
+
const output = result.drafts.map((draft) => ({
|
|
109
|
+
id: draft.id,
|
|
110
|
+
channel_id: draft.channel_id,
|
|
111
|
+
text: draft.message?.text || '',
|
|
112
|
+
date_created: draft.date_created,
|
|
113
|
+
date_updated: draft.date_updated,
|
|
114
|
+
}))
|
|
115
|
+
|
|
116
|
+
// Then: Should include draft fields
|
|
117
|
+
expect(output[0].id).toBe('D001')
|
|
118
|
+
expect(output[0].text).toBe('Draft message 1')
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
test('handles null message in output', async () => {
|
|
122
|
+
// Given: Draft with null message
|
|
123
|
+
const result = await mockClient.getDrafts()
|
|
124
|
+
|
|
125
|
+
// When: Formatting output with null message
|
|
126
|
+
const output = result.drafts.map((draft) => ({
|
|
127
|
+
id: draft.id,
|
|
128
|
+
text: draft.message?.text || '',
|
|
129
|
+
}))
|
|
130
|
+
|
|
131
|
+
// Then: Should use empty string for null message
|
|
132
|
+
expect(output[2].text).toBe('')
|
|
133
|
+
expect(output[3].text).toBe('')
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Command } from 'commander'
|
|
2
|
+
import { handleError } from '../../../shared/utils/error-handler'
|
|
3
|
+
import { formatOutput } from '../../../shared/utils/output'
|
|
4
|
+
import { SlackClient } from '../client'
|
|
5
|
+
import { CredentialManager } from '../credential-manager'
|
|
6
|
+
|
|
7
|
+
async function listAction(options: {
|
|
8
|
+
limit?: number
|
|
9
|
+
cursor?: string
|
|
10
|
+
pretty?: boolean
|
|
11
|
+
}): Promise<void> {
|
|
12
|
+
try {
|
|
13
|
+
const credManager = new CredentialManager()
|
|
14
|
+
const workspace = await credManager.getWorkspace()
|
|
15
|
+
|
|
16
|
+
if (!workspace) {
|
|
17
|
+
console.log(
|
|
18
|
+
formatOutput(
|
|
19
|
+
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
20
|
+
options.pretty
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
process.exit(1)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const client = new SlackClient(workspace.token, workspace.cookie)
|
|
27
|
+
const result = await client.getDrafts(options.cursor)
|
|
28
|
+
|
|
29
|
+
let drafts = result.drafts
|
|
30
|
+
|
|
31
|
+
if (options.limit) {
|
|
32
|
+
drafts = drafts.slice(0, options.limit)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const output = drafts.map((draft) => ({
|
|
36
|
+
id: draft.id,
|
|
37
|
+
channel_id: draft.channel_id,
|
|
38
|
+
text: draft.message?.text || '',
|
|
39
|
+
date_created: draft.date_created,
|
|
40
|
+
date_updated: draft.date_updated,
|
|
41
|
+
}))
|
|
42
|
+
|
|
43
|
+
console.log(formatOutput(output, options.pretty))
|
|
44
|
+
} catch (error) {
|
|
45
|
+
handleError(error as Error)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const draftsCommand = new Command('drafts').description('Drafts commands').addCommand(
|
|
50
|
+
new Command('list')
|
|
51
|
+
.description('List message drafts')
|
|
52
|
+
.option('--limit <n>', 'Number of drafts to display')
|
|
53
|
+
.option('--cursor <cursor>', 'Pagination cursor')
|
|
54
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
55
|
+
.action((options) => {
|
|
56
|
+
listAction({
|
|
57
|
+
limit: options.limit ? parseInt(options.limit, 10) : undefined,
|
|
58
|
+
cursor: options.cursor,
|
|
59
|
+
pretty: options.pretty,
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, mock, test } from 'bun:test'
|
|
2
|
-
import { SlackClient } from '
|
|
3
|
-
import type { SlackFile } from '
|
|
2
|
+
import { SlackClient } from '@/platforms/slack/client'
|
|
3
|
+
import type { SlackFile } from '@/platforms/slack/types'
|
|
4
4
|
|
|
5
5
|
describe('File Commands', () => {
|
|
6
6
|
let mockClient: SlackClient
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
export { activityCommand } from './activity'
|
|
1
2
|
export { authCommand } from './auth'
|
|
2
3
|
export { channelCommand } from './channel'
|
|
4
|
+
export { draftsCommand } from './drafts'
|
|
3
5
|
export { fileCommand } from './file'
|
|
4
6
|
export { messageCommand } from './message'
|
|
5
7
|
export { reactionCommand } from './reaction'
|
|
8
|
+
export { savedCommand } from './saved'
|
|
9
|
+
export { sectionsCommand } from './sections'
|
|
6
10
|
export { snapshotCommand } from './snapshot'
|
|
11
|
+
export { unreadCommand } from './unread'
|
|
7
12
|
export { userCommand } from './user'
|
|
8
13
|
export { workspaceCommand } from './workspace'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, mock, test } from 'bun:test'
|
|
2
|
-
import { SlackClient } from '
|
|
3
|
-
import type { SlackMessage } from '
|
|
2
|
+
import { SlackClient } from '@/platforms/slack/client'
|
|
3
|
+
import type { SlackMessage } from '@/platforms/slack/types'
|
|
4
4
|
|
|
5
5
|
describe('Message Commands', () => {
|
|
6
6
|
let mockClient: SlackClient
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, mock, test } from 'bun:test'
|
|
2
2
|
import { Command } from 'commander'
|
|
3
|
-
import { reactionCommand } from '
|
|
3
|
+
import { reactionCommand } from '@/platforms/slack/commands/reaction'
|
|
4
4
|
|
|
5
5
|
describe('reaction command', () => {
|
|
6
6
|
describe('add subcommand', () => {
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, mock, test } from 'bun:test'
|
|
2
|
+
import { SlackClient } from '@/platforms/slack/client'
|
|
3
|
+
import type { SlackSavedItem } from '@/platforms/slack/types'
|
|
4
|
+
|
|
5
|
+
describe('Saved Commands', () => {
|
|
6
|
+
let mockClient: SlackClient
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
// Mock SlackClient
|
|
10
|
+
mockClient = {
|
|
11
|
+
getSavedItems: mock(async (cursor?: string) => {
|
|
12
|
+
const items: SlackSavedItem[] = [
|
|
13
|
+
{
|
|
14
|
+
type: 'message',
|
|
15
|
+
message: {
|
|
16
|
+
ts: '1234567890.123456',
|
|
17
|
+
text: 'Important message to save',
|
|
18
|
+
user: 'U001',
|
|
19
|
+
type: 'message',
|
|
20
|
+
},
|
|
21
|
+
channel: {
|
|
22
|
+
id: 'C001',
|
|
23
|
+
name: 'general',
|
|
24
|
+
},
|
|
25
|
+
date_created: 1234567890,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'message',
|
|
29
|
+
message: {
|
|
30
|
+
ts: '1234567891.123456',
|
|
31
|
+
text: 'Another saved message',
|
|
32
|
+
user: 'U002',
|
|
33
|
+
type: 'message',
|
|
34
|
+
},
|
|
35
|
+
channel: {
|
|
36
|
+
id: 'C002',
|
|
37
|
+
name: 'random',
|
|
38
|
+
},
|
|
39
|
+
date_created: 1234567891,
|
|
40
|
+
},
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
if (cursor === 'next_page') {
|
|
44
|
+
return {
|
|
45
|
+
items: [
|
|
46
|
+
{
|
|
47
|
+
type: 'message',
|
|
48
|
+
message: {
|
|
49
|
+
ts: '1234567892.123456',
|
|
50
|
+
text: 'Third saved message',
|
|
51
|
+
user: 'U003',
|
|
52
|
+
type: 'message',
|
|
53
|
+
},
|
|
54
|
+
channel: {
|
|
55
|
+
id: 'C003',
|
|
56
|
+
name: 'dev',
|
|
57
|
+
},
|
|
58
|
+
date_created: 1234567892,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
has_more: false,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
items,
|
|
67
|
+
has_more: true,
|
|
68
|
+
next_cursor: 'next_page',
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
} as any
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
describe('saved list', () => {
|
|
75
|
+
test('lists saved items', async () => {
|
|
76
|
+
// Given: SlackClient returns saved items
|
|
77
|
+
// When: Listing saved items
|
|
78
|
+
const result = await mockClient.getSavedItems()
|
|
79
|
+
|
|
80
|
+
// Then: Should return saved items
|
|
81
|
+
expect(result.items).toHaveLength(2)
|
|
82
|
+
expect(result.items[0].message.text).toBe('Important message to save')
|
|
83
|
+
expect(result.items[1].message.text).toBe('Another saved message')
|
|
84
|
+
expect(result.has_more).toBe(true)
|
|
85
|
+
expect(result.next_cursor).toBe('next_page')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test('supports pagination with cursor', async () => {
|
|
89
|
+
// Given: SlackClient returns paginated results
|
|
90
|
+
// When: Fetching with cursor
|
|
91
|
+
const result = await mockClient.getSavedItems('next_page')
|
|
92
|
+
|
|
93
|
+
// Then: Should return next page
|
|
94
|
+
expect(result.items).toHaveLength(1)
|
|
95
|
+
expect(result.items[0].message.text).toBe('Third saved message')
|
|
96
|
+
expect(result.has_more).toBe(false)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
test('returns channel information with saved items', async () => {
|
|
100
|
+
// Given: SlackClient returns saved items with channel info
|
|
101
|
+
// When: Listing saved items
|
|
102
|
+
const result = await mockClient.getSavedItems()
|
|
103
|
+
|
|
104
|
+
// Then: Should include channel details
|
|
105
|
+
expect(result.items[0].channel.id).toBe('C001')
|
|
106
|
+
expect(result.items[0].channel.name).toBe('general')
|
|
107
|
+
expect(result.items[1].channel.id).toBe('C002')
|
|
108
|
+
expect(result.items[1].channel.name).toBe('random')
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('includes date_created timestamp', async () => {
|
|
112
|
+
// Given: SlackClient returns saved items
|
|
113
|
+
// When: Listing saved items
|
|
114
|
+
const result = await mockClient.getSavedItems()
|
|
115
|
+
|
|
116
|
+
// Then: Should include creation timestamp
|
|
117
|
+
expect(result.items[0].date_created).toBe(1234567890)
|
|
118
|
+
expect(result.items[1].date_created).toBe(1234567891)
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
describe('CLI command: saved list', () => {
|
|
123
|
+
test('supports --limit option', async () => {
|
|
124
|
+
// Given: CLI command with --limit 50
|
|
125
|
+
// When: Executing saved list --limit 50
|
|
126
|
+
// Then: Should pass limit to API (tested via integration)
|
|
127
|
+
expect(true).toBe(true)
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
test('supports --cursor option for pagination', async () => {
|
|
131
|
+
// Given: CLI command with --cursor next_page
|
|
132
|
+
// When: Executing saved list --cursor next_page
|
|
133
|
+
const result = await mockClient.getSavedItems('next_page')
|
|
134
|
+
|
|
135
|
+
// Then: Should fetch next page
|
|
136
|
+
expect(result.items).toHaveLength(1)
|
|
137
|
+
expect(result.has_more).toBe(false)
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
})
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Command } from 'commander'
|
|
2
|
+
import { handleError } from '../../../shared/utils/error-handler'
|
|
3
|
+
import { formatOutput } from '../../../shared/utils/output'
|
|
4
|
+
import { SlackClient } from '../client'
|
|
5
|
+
import { CredentialManager } from '../credential-manager'
|
|
6
|
+
|
|
7
|
+
async function listAction(options: {
|
|
8
|
+
limit?: number
|
|
9
|
+
cursor?: string
|
|
10
|
+
pretty?: boolean
|
|
11
|
+
}): Promise<void> {
|
|
12
|
+
try {
|
|
13
|
+
const credManager = new CredentialManager()
|
|
14
|
+
const workspace = await credManager.getWorkspace()
|
|
15
|
+
|
|
16
|
+
if (!workspace) {
|
|
17
|
+
console.log(
|
|
18
|
+
formatOutput(
|
|
19
|
+
{ error: 'No current workspace set. Run "auth extract" first.' },
|
|
20
|
+
options.pretty
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
process.exit(1)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const client = new SlackClient(workspace.token, workspace.cookie)
|
|
27
|
+
const result = await client.getSavedItems(options.cursor)
|
|
28
|
+
|
|
29
|
+
let items = result.items
|
|
30
|
+
|
|
31
|
+
if (options.limit) {
|
|
32
|
+
items = items.slice(0, options.limit)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const output = {
|
|
36
|
+
items: items.map((item) => ({
|
|
37
|
+
type: item.type,
|
|
38
|
+
message: {
|
|
39
|
+
ts: item.message.ts,
|
|
40
|
+
text: item.message.text,
|
|
41
|
+
user: item.message.user,
|
|
42
|
+
username: item.message.username,
|
|
43
|
+
thread_ts: item.message.thread_ts,
|
|
44
|
+
},
|
|
45
|
+
channel: item.channel,
|
|
46
|
+
date_created: item.date_created,
|
|
47
|
+
})),
|
|
48
|
+
has_more: result.has_more,
|
|
49
|
+
next_cursor: result.next_cursor,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
console.log(formatOutput(output, options.pretty))
|
|
53
|
+
} catch (error) {
|
|
54
|
+
handleError(error as Error)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const savedCommand = new Command('saved').description('Saved items commands').addCommand(
|
|
59
|
+
new Command('list')
|
|
60
|
+
.description('List saved items')
|
|
61
|
+
.option('--limit <n>', 'Number of items to display')
|
|
62
|
+
.option('--cursor <cursor>', 'Pagination cursor')
|
|
63
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
64
|
+
.action((options) => {
|
|
65
|
+
listAction({
|
|
66
|
+
limit: options.limit ? parseInt(options.limit, 10) : undefined,
|
|
67
|
+
cursor: options.cursor,
|
|
68
|
+
pretty: options.pretty,
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, mock, test } from 'bun:test'
|
|
2
|
+
import { SlackClient } from '@/platforms/slack/client'
|
|
3
|
+
|
|
4
|
+
describe('Sections Commands', () => {
|
|
5
|
+
let mockClient: SlackClient
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
// Mock SlackClient
|
|
9
|
+
mockClient = {
|
|
10
|
+
getChannelSections: mock(async () => [
|
|
11
|
+
{
|
|
12
|
+
id: 'S001',
|
|
13
|
+
name: 'Work Projects',
|
|
14
|
+
channel_ids: ['C001', 'C002', 'C003'],
|
|
15
|
+
date_created: 1234567890,
|
|
16
|
+
date_updated: 1234567900,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: 'S002',
|
|
20
|
+
name: 'Personal',
|
|
21
|
+
channel_ids: ['C004', 'C005'],
|
|
22
|
+
date_created: 1234567891,
|
|
23
|
+
date_updated: 1234567901,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'S003',
|
|
27
|
+
name: 'Archive',
|
|
28
|
+
channel_ids: [],
|
|
29
|
+
date_created: 1234567892,
|
|
30
|
+
date_updated: 1234567902,
|
|
31
|
+
},
|
|
32
|
+
]),
|
|
33
|
+
} as any
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
describe('sections list', () => {
|
|
37
|
+
test('lists all channel sections', async () => {
|
|
38
|
+
// Given: SlackClient returns channel sections
|
|
39
|
+
// When: Listing sections
|
|
40
|
+
const sections = await mockClient.getChannelSections()
|
|
41
|
+
|
|
42
|
+
// Then: Should return sections
|
|
43
|
+
expect(sections).toHaveLength(3)
|
|
44
|
+
expect(sections[0].name).toBe('Work Projects')
|
|
45
|
+
expect(sections[1].name).toBe('Personal')
|
|
46
|
+
expect(sections[2].name).toBe('Archive')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('returns sections with channel IDs', async () => {
|
|
50
|
+
// Given: SlackClient returns sections with channels
|
|
51
|
+
// When: Listing sections
|
|
52
|
+
const sections = await mockClient.getChannelSections()
|
|
53
|
+
|
|
54
|
+
// Then: Should include channel IDs
|
|
55
|
+
expect(sections[0].channel_ids).toHaveLength(3)
|
|
56
|
+
expect(sections[0].channel_ids).toContain('C001')
|
|
57
|
+
expect(sections[1].channel_ids).toHaveLength(2)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
test('returns sections with timestamps', async () => {
|
|
61
|
+
// Given: SlackClient returns sections
|
|
62
|
+
// When: Listing sections
|
|
63
|
+
const sections = await mockClient.getChannelSections()
|
|
64
|
+
|
|
65
|
+
// Then: Should include timestamps
|
|
66
|
+
expect(sections[0].date_created).toBe(1234567890)
|
|
67
|
+
expect(sections[0].date_updated).toBe(1234567900)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
test('handles empty sections', async () => {
|
|
71
|
+
// Given: SlackClient returns section with no channels
|
|
72
|
+
// When: Listing sections
|
|
73
|
+
const sections = await mockClient.getChannelSections()
|
|
74
|
+
|
|
75
|
+
// Then: Should include empty section
|
|
76
|
+
expect(sections[2].channel_ids).toHaveLength(0)
|
|
77
|
+
expect(sections[2].name).toBe('Archive')
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
})
|