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,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for Microsoft Teams platform
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { z } from 'zod'
|
|
6
|
+
|
|
7
|
+
export interface TeamsTeam {
|
|
8
|
+
id: string
|
|
9
|
+
name: string
|
|
10
|
+
description?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TeamsChannel {
|
|
14
|
+
id: string
|
|
15
|
+
team_id: string
|
|
16
|
+
name: string
|
|
17
|
+
type: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface TeamsMessage {
|
|
21
|
+
id: string
|
|
22
|
+
channel_id: string
|
|
23
|
+
author: {
|
|
24
|
+
id: string
|
|
25
|
+
displayName: string
|
|
26
|
+
}
|
|
27
|
+
content: string
|
|
28
|
+
timestamp: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TeamsUser {
|
|
32
|
+
id: string
|
|
33
|
+
displayName: string
|
|
34
|
+
email?: string
|
|
35
|
+
userPrincipalName?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface TeamsReaction {
|
|
39
|
+
emoji: string
|
|
40
|
+
count: number
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface TeamsFile {
|
|
44
|
+
id: string
|
|
45
|
+
name: string
|
|
46
|
+
size: number
|
|
47
|
+
url: string
|
|
48
|
+
contentType?: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface TeamsCredentials {
|
|
52
|
+
token: string
|
|
53
|
+
cookie?: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface TeamsConfig {
|
|
57
|
+
current_team: string | null
|
|
58
|
+
token: string
|
|
59
|
+
token_expires_at?: string
|
|
60
|
+
teams: Record<
|
|
61
|
+
string,
|
|
62
|
+
{
|
|
63
|
+
team_id: string
|
|
64
|
+
team_name: string
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Zod validation schemas
|
|
70
|
+
export const TeamsTeamSchema = z.object({
|
|
71
|
+
id: z.string(),
|
|
72
|
+
name: z.string(),
|
|
73
|
+
description: z.string().optional(),
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
export const TeamsChannelSchema = z.object({
|
|
77
|
+
id: z.string(),
|
|
78
|
+
team_id: z.string(),
|
|
79
|
+
name: z.string(),
|
|
80
|
+
type: z.string(),
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
export const TeamsMessageSchema = z.object({
|
|
84
|
+
id: z.string(),
|
|
85
|
+
channel_id: z.string(),
|
|
86
|
+
author: z.object({
|
|
87
|
+
id: z.string(),
|
|
88
|
+
displayName: z.string(),
|
|
89
|
+
}),
|
|
90
|
+
content: z.string(),
|
|
91
|
+
timestamp: z.string(),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
export const TeamsUserSchema = z.object({
|
|
95
|
+
id: z.string(),
|
|
96
|
+
displayName: z.string(),
|
|
97
|
+
email: z.string().optional(),
|
|
98
|
+
userPrincipalName: z.string().optional(),
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
export const TeamsReactionSchema = z.object({
|
|
102
|
+
emoji: z.string(),
|
|
103
|
+
count: z.number(),
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
export const TeamsFileSchema = z.object({
|
|
107
|
+
id: z.string(),
|
|
108
|
+
name: z.string(),
|
|
109
|
+
size: z.number(),
|
|
110
|
+
url: z.string(),
|
|
111
|
+
contentType: z.string().optional(),
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
export const TeamsCredentialsSchema = z.object({
|
|
115
|
+
token: z.string(),
|
|
116
|
+
cookie: z.string().optional(),
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
export const TeamsConfigSchema = z.object({
|
|
120
|
+
current_team: z.string().nullable(),
|
|
121
|
+
token: z.string(),
|
|
122
|
+
token_expires_at: z.string().optional(),
|
|
123
|
+
teams: z.record(
|
|
124
|
+
z.string(),
|
|
125
|
+
z.object({
|
|
126
|
+
team_id: z.string(),
|
|
127
|
+
team_name: z.string(),
|
|
128
|
+
})
|
|
129
|
+
),
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
export class TeamsError extends Error {
|
|
133
|
+
code: string
|
|
134
|
+
|
|
135
|
+
constructor(message: string, code: string) {
|
|
136
|
+
super(message)
|
|
137
|
+
this.name = 'TeamsError'
|
|
138
|
+
this.code = code
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test'
|
|
2
|
+
import { existsSync, mkdirSync, rmSync } from 'node:fs'
|
|
3
|
+
import { tmpdir } from 'node:os'
|
|
4
|
+
import { join } from 'node:path'
|
|
5
|
+
import { DerivedKeyCache } from './derived-key-cache'
|
|
6
|
+
|
|
7
|
+
describe('DerivedKeyCache', () => {
|
|
8
|
+
let testDir: string
|
|
9
|
+
let cache: DerivedKeyCache
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
testDir = join(tmpdir(), `derived-key-cache-test-${Date.now()}`)
|
|
13
|
+
mkdirSync(testDir, { recursive: true })
|
|
14
|
+
cache = new DerivedKeyCache(testDir)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
if (existsSync(testDir)) {
|
|
19
|
+
rmSync(testDir, { recursive: true, force: true })
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
describe('get', () => {
|
|
24
|
+
test('returns null when no cached key exists', async () => {
|
|
25
|
+
const result = await cache.get('slack')
|
|
26
|
+
expect(result).toBeNull()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('returns cached key when it exists', async () => {
|
|
30
|
+
// given
|
|
31
|
+
const key = Buffer.from('test-key-16bytes')
|
|
32
|
+
await cache.set('slack', key)
|
|
33
|
+
|
|
34
|
+
// when
|
|
35
|
+
const result = await cache.get('slack')
|
|
36
|
+
|
|
37
|
+
// then
|
|
38
|
+
expect(result).toEqual(key)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test('returns different keys for different platforms', async () => {
|
|
42
|
+
// given
|
|
43
|
+
const slackKey = Buffer.from('slack-key-16byte')
|
|
44
|
+
const discordKey = Buffer.from('discord-key-16by')
|
|
45
|
+
await cache.set('slack', slackKey)
|
|
46
|
+
await cache.set('discord', discordKey)
|
|
47
|
+
|
|
48
|
+
// when/then
|
|
49
|
+
expect(await cache.get('slack')).toEqual(slackKey)
|
|
50
|
+
expect(await cache.get('discord')).toEqual(discordKey)
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
describe('set', () => {
|
|
55
|
+
test('creates cache directory if it does not exist', async () => {
|
|
56
|
+
// given
|
|
57
|
+
const nestedDir = join(testDir, 'nested', 'cache')
|
|
58
|
+
const nestedCache = new DerivedKeyCache(nestedDir)
|
|
59
|
+
|
|
60
|
+
// when
|
|
61
|
+
await nestedCache.set('slack', Buffer.from('test-key'))
|
|
62
|
+
|
|
63
|
+
// then
|
|
64
|
+
expect(existsSync(nestedDir)).toBe(true)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('overwrites existing cached key', async () => {
|
|
68
|
+
// given
|
|
69
|
+
const oldKey = Buffer.from('old-key-16bytes!')
|
|
70
|
+
const newKey = Buffer.from('new-key-16bytes!')
|
|
71
|
+
await cache.set('slack', oldKey)
|
|
72
|
+
|
|
73
|
+
// when
|
|
74
|
+
await cache.set('slack', newKey)
|
|
75
|
+
|
|
76
|
+
// then
|
|
77
|
+
expect(await cache.get('slack')).toEqual(newKey)
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
describe('clear', () => {
|
|
82
|
+
test('removes cached key for platform', async () => {
|
|
83
|
+
// given
|
|
84
|
+
await cache.set('slack', Buffer.from('test-key'))
|
|
85
|
+
|
|
86
|
+
// when
|
|
87
|
+
await cache.clear('slack')
|
|
88
|
+
|
|
89
|
+
// then
|
|
90
|
+
expect(await cache.get('slack')).toBeNull()
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
test('does not affect other platforms', async () => {
|
|
94
|
+
// given
|
|
95
|
+
const discordKey = Buffer.from('discord-key')
|
|
96
|
+
await cache.set('slack', Buffer.from('slack-key'))
|
|
97
|
+
await cache.set('discord', discordKey)
|
|
98
|
+
|
|
99
|
+
// when
|
|
100
|
+
await cache.clear('slack')
|
|
101
|
+
|
|
102
|
+
// then
|
|
103
|
+
expect(await cache.get('slack')).toBeNull()
|
|
104
|
+
expect(await cache.get('discord')).toEqual(discordKey)
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
test('does not throw when key does not exist', async () => {
|
|
108
|
+
await expect(cache.clear('slack')).resolves.toBeUndefined()
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
describe('clearAll', () => {
|
|
113
|
+
test('removes all cached keys', async () => {
|
|
114
|
+
// given
|
|
115
|
+
await cache.set('slack', Buffer.from('slack-key'))
|
|
116
|
+
await cache.set('discord', Buffer.from('discord-key'))
|
|
117
|
+
await cache.set('teams', Buffer.from('teams-key'))
|
|
118
|
+
|
|
119
|
+
// when
|
|
120
|
+
await cache.clearAll()
|
|
121
|
+
|
|
122
|
+
// then
|
|
123
|
+
expect(await cache.get('slack')).toBeNull()
|
|
124
|
+
expect(await cache.get('discord')).toBeNull()
|
|
125
|
+
expect(await cache.get('teams')).toBeNull()
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
test('does not throw when cache directory does not exist', async () => {
|
|
129
|
+
// given
|
|
130
|
+
const emptyCache = new DerivedKeyCache(join(testDir, 'nonexistent'))
|
|
131
|
+
|
|
132
|
+
// when/then
|
|
133
|
+
await expect(emptyCache.clearAll()).resolves.toBeUndefined()
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
})
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs'
|
|
2
|
+
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
|
3
|
+
import { homedir } from 'node:os'
|
|
4
|
+
import { join } from 'node:path'
|
|
5
|
+
|
|
6
|
+
export type Platform = 'slack' | 'discord' | 'teams'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Caches derived encryption keys to avoid repeated macOS Keychain prompts.
|
|
10
|
+
*
|
|
11
|
+
* The derived key (PBKDF2 output) is stored, NOT the keychain password.
|
|
12
|
+
* This is safe because:
|
|
13
|
+
* 1. The derived key can only decrypt app-specific local storage
|
|
14
|
+
* 2. It's stored with 600 permissions (owner read/write only)
|
|
15
|
+
* 3. If the app updates its encryption, cached key becomes invalid and we re-prompt once
|
|
16
|
+
*/
|
|
17
|
+
export class DerivedKeyCache {
|
|
18
|
+
private cacheDir: string
|
|
19
|
+
|
|
20
|
+
constructor(cacheDir?: string) {
|
|
21
|
+
this.cacheDir = cacheDir ?? join(homedir(), '.config', 'agent-messenger', '.derived-keys')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private getKeyPath(platform: Platform): string {
|
|
25
|
+
return join(this.cacheDir, `${platform}.key`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async get(platform: Platform): Promise<Buffer | null> {
|
|
29
|
+
const keyPath = this.getKeyPath(platform)
|
|
30
|
+
|
|
31
|
+
if (!existsSync(keyPath)) {
|
|
32
|
+
return null
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
const content = await readFile(keyPath)
|
|
37
|
+
return content
|
|
38
|
+
} catch {
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async set(platform: Platform, key: Buffer): Promise<void> {
|
|
44
|
+
await mkdir(this.cacheDir, { recursive: true, mode: 0o700 })
|
|
45
|
+
|
|
46
|
+
const keyPath = this.getKeyPath(platform)
|
|
47
|
+
await writeFile(keyPath, key, { mode: 0o600 })
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async clear(platform: Platform): Promise<void> {
|
|
51
|
+
const keyPath = this.getKeyPath(platform)
|
|
52
|
+
|
|
53
|
+
if (existsSync(keyPath)) {
|
|
54
|
+
await rm(keyPath)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async clearAll(): Promise<void> {
|
|
59
|
+
if (existsSync(this.cacheDir)) {
|
|
60
|
+
await rm(this.cacheDir, { recursive: true })
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
package/tsconfig.json
CHANGED
package/dist/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAYnC,QAAA,MAAM,OAAO,SAAgB,CAAA;AAoB7B,eAAe,OAAO,CAAA"}
|
package/dist/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EACL,WAAW,EACX,cAAc,EACd,WAAW,EACX,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,EACX,gBAAgB,GACjB,MAAM,kBAAkB,CAAA;AAEzB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,+EAA+E,CAAC;KAC5F,OAAO,CAAC,OAAO,CAAC;KAChB,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,kBAAkB,EAAE,wBAAwB,CAAC,CAAA;AAEvD,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAA;AACpC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAClC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAClC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;AACnC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;AAEnC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAE3B,eAAe,OAAO,CAAA"}
|
package/dist/commands/auth.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA4KnC,eAAO,MAAM,WAAW,SAqBrB,CAAA"}
|
package/dist/commands/auth.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { CredentialManager } from '../lib/credential-manager';
|
|
3
|
-
import { SlackClient } from '../lib/slack-client';
|
|
4
|
-
import { TokenExtractor } from '../lib/token-extractor';
|
|
5
|
-
import { handleError } from '../utils/error-handler';
|
|
6
|
-
import { formatOutput } from '../utils/output';
|
|
7
|
-
async function extractAction(options) {
|
|
8
|
-
try {
|
|
9
|
-
const extractor = new TokenExtractor();
|
|
10
|
-
if (options.debug) {
|
|
11
|
-
console.error(`[debug] Slack directory: ${extractor.getSlackDir()}`);
|
|
12
|
-
}
|
|
13
|
-
const workspaces = await extractor.extract();
|
|
14
|
-
if (options.debug) {
|
|
15
|
-
console.error(`[debug] Found ${workspaces.length} workspace(s)`);
|
|
16
|
-
for (const ws of workspaces) {
|
|
17
|
-
console.error(`[debug] - ${ws.workspace_id}: token=${ws.token.substring(0, 20)}..., cookie=${ws.cookie ? 'present' : 'missing'}`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
if (workspaces.length === 0) {
|
|
21
|
-
console.log(formatOutput({
|
|
22
|
-
error: 'No workspaces found. Make sure Slack desktop app is installed and logged in.',
|
|
23
|
-
hint: options.debug ? undefined : 'Run with --debug for more info.',
|
|
24
|
-
}, options.pretty));
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
const credManager = new CredentialManager();
|
|
28
|
-
const config = await credManager.load();
|
|
29
|
-
const validWorkspaces = [];
|
|
30
|
-
for (const ws of workspaces) {
|
|
31
|
-
if (options.debug) {
|
|
32
|
-
console.error(`[debug] Testing credentials for ${ws.workspace_id}...`);
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
const client = new SlackClient(ws.token, ws.cookie);
|
|
36
|
-
const authInfo = await client.testAuth();
|
|
37
|
-
ws.workspace_name = authInfo.team || ws.workspace_name;
|
|
38
|
-
validWorkspaces.push(ws);
|
|
39
|
-
await credManager.setWorkspace(ws);
|
|
40
|
-
if (options.debug) {
|
|
41
|
-
console.error(`[debug] ✓ Valid: ${authInfo.team} (${authInfo.user})`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
if (options.debug) {
|
|
46
|
-
console.error(`[debug] ✗ Invalid: ${error.message}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (validWorkspaces.length === 0) {
|
|
51
|
-
console.log(formatOutput({
|
|
52
|
-
error: 'Extracted tokens are invalid. Make sure you are logged into the Slack desktop app.',
|
|
53
|
-
extracted_count: workspaces.length,
|
|
54
|
-
}, options.pretty));
|
|
55
|
-
process.exit(1);
|
|
56
|
-
}
|
|
57
|
-
if (!config.current_workspace && validWorkspaces.length > 0) {
|
|
58
|
-
await credManager.setCurrentWorkspace(validWorkspaces[0].workspace_id);
|
|
59
|
-
}
|
|
60
|
-
const output = {
|
|
61
|
-
workspaces: validWorkspaces.map((ws) => `${ws.workspace_id}/${ws.workspace_name}`),
|
|
62
|
-
current: config.current_workspace || validWorkspaces[0].workspace_id,
|
|
63
|
-
};
|
|
64
|
-
console.log(formatOutput(output, options.pretty));
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
handleError(error);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async function logoutAction(workspace, options) {
|
|
71
|
-
try {
|
|
72
|
-
const credManager = new CredentialManager();
|
|
73
|
-
const config = await credManager.load();
|
|
74
|
-
let targetWorkspace = workspace;
|
|
75
|
-
if (!targetWorkspace) {
|
|
76
|
-
if (!config.current_workspace) {
|
|
77
|
-
console.log(formatOutput({ error: 'No current workspace set. Specify a workspace ID.' }, options.pretty));
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
|
-
targetWorkspace = config.current_workspace;
|
|
81
|
-
}
|
|
82
|
-
if (!config.workspaces[targetWorkspace]) {
|
|
83
|
-
console.log(formatOutput({ error: `Workspace not found: ${targetWorkspace}` }, options.pretty));
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
await credManager.removeWorkspace(targetWorkspace);
|
|
87
|
-
console.log(formatOutput({ removed: targetWorkspace, success: true }, options.pretty));
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
handleError(error);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
async function statusAction(options) {
|
|
94
|
-
try {
|
|
95
|
-
const credManager = new CredentialManager();
|
|
96
|
-
const ws = await credManager.getWorkspace();
|
|
97
|
-
if (!ws) {
|
|
98
|
-
console.log(formatOutput({ error: 'No workspace configured. Run "auth extract" first.' }, options.pretty));
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
let authInfo = null;
|
|
102
|
-
let valid = false;
|
|
103
|
-
try {
|
|
104
|
-
const client = new SlackClient(ws.token, ws.cookie);
|
|
105
|
-
authInfo = await client.testAuth();
|
|
106
|
-
valid = true;
|
|
107
|
-
}
|
|
108
|
-
catch {
|
|
109
|
-
valid = false;
|
|
110
|
-
}
|
|
111
|
-
const output = {
|
|
112
|
-
workspace_id: ws.workspace_id,
|
|
113
|
-
workspace_name: ws.workspace_name,
|
|
114
|
-
user: authInfo?.user,
|
|
115
|
-
team: authInfo?.team,
|
|
116
|
-
valid,
|
|
117
|
-
};
|
|
118
|
-
console.log(formatOutput(output, options.pretty));
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
handleError(error);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
export const authCommand = new Command('auth')
|
|
125
|
-
.description('Authentication commands')
|
|
126
|
-
.addCommand(new Command('extract')
|
|
127
|
-
.description('Extract tokens from Slack desktop app')
|
|
128
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
129
|
-
.option('--debug', 'Show debug output for troubleshooting')
|
|
130
|
-
.action(extractAction))
|
|
131
|
-
.addCommand(new Command('logout')
|
|
132
|
-
.description('Logout from workspace')
|
|
133
|
-
.argument('[workspace]', 'Workspace ID')
|
|
134
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
135
|
-
.action(logoutAction))
|
|
136
|
-
.addCommand(new Command('status')
|
|
137
|
-
.description('Show authentication status')
|
|
138
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
139
|
-
.action(statusAction));
|
|
140
|
-
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.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,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,KAAK,UAAU,aAAa,CAAC,OAA8C;IACzE,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,cAAc,EAAE,CAAA;QAEtC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,4BAA4B,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;QACtE,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,OAAO,EAAE,CAAA;QAE5C,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YA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CAAC,uCAAuC,CAAC;KACpD,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,SAAS,EAAE,uCAAuC,CAAC;KAC1D,MAAM,CAAC,aAAa,CAAC,CACzB;KACA,UAAU,CACT,IAAI,OAAO,CAAC,QAAQ,CAAC;KAClB,WAAW,CAAC,uBAAuB,CAAC;KACpC,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC;KACvC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,CAAC,CACxB;KACA,UAAU,CACT,IAAI,OAAO,CAAC,QAAQ,CAAC;KAClB,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,CAAC,CACxB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/commands/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAgInC,eAAO,MAAM,cAAc,SA6BxB,CAAA"}
|
package/dist/commands/channel.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
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 listAction(options) {
|
|
7
|
-
try {
|
|
8
|
-
const credManager = new CredentialManager();
|
|
9
|
-
const workspace = await credManager.getWorkspace();
|
|
10
|
-
if (!workspace) {
|
|
11
|
-
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty));
|
|
12
|
-
process.exit(1);
|
|
13
|
-
}
|
|
14
|
-
const client = new SlackClient(workspace.token, workspace.cookie);
|
|
15
|
-
let channels = await client.listChannels();
|
|
16
|
-
if (!options.includeArchived) {
|
|
17
|
-
channels = channels.filter((c) => !c.is_archived);
|
|
18
|
-
}
|
|
19
|
-
if (options.type === 'public') {
|
|
20
|
-
channels = channels.filter((c) => !c.is_private);
|
|
21
|
-
}
|
|
22
|
-
else if (options.type === 'private') {
|
|
23
|
-
channels = channels.filter((c) => c.is_private);
|
|
24
|
-
}
|
|
25
|
-
else if (options.type === 'dm') {
|
|
26
|
-
channels = [];
|
|
27
|
-
}
|
|
28
|
-
const output = channels.map((ch) => ({
|
|
29
|
-
id: ch.id,
|
|
30
|
-
name: ch.name,
|
|
31
|
-
is_private: ch.is_private,
|
|
32
|
-
...(options.includeArchived && { is_archived: ch.is_archived }),
|
|
33
|
-
created: ch.created,
|
|
34
|
-
topic: ch.topic?.value,
|
|
35
|
-
purpose: ch.purpose?.value,
|
|
36
|
-
}));
|
|
37
|
-
console.log(formatOutput(output, options.pretty));
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
handleError(error);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async function infoAction(channel, options) {
|
|
44
|
-
try {
|
|
45
|
-
const credManager = new CredentialManager();
|
|
46
|
-
const workspace = await credManager.getWorkspace();
|
|
47
|
-
if (!workspace) {
|
|
48
|
-
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty));
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
const client = new SlackClient(workspace.token, workspace.cookie);
|
|
52
|
-
const ch = await client.getChannel(channel);
|
|
53
|
-
const output = {
|
|
54
|
-
id: ch.id,
|
|
55
|
-
name: ch.name,
|
|
56
|
-
is_private: ch.is_private,
|
|
57
|
-
is_archived: ch.is_archived,
|
|
58
|
-
created: ch.created,
|
|
59
|
-
creator: ch.creator,
|
|
60
|
-
topic: ch.topic,
|
|
61
|
-
purpose: ch.purpose,
|
|
62
|
-
};
|
|
63
|
-
console.log(formatOutput(output, options.pretty));
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
handleError(error);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async function historyAction(channel, options) {
|
|
70
|
-
try {
|
|
71
|
-
const credManager = new CredentialManager();
|
|
72
|
-
const workspace = await credManager.getWorkspace();
|
|
73
|
-
if (!workspace) {
|
|
74
|
-
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty));
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
const client = new SlackClient(workspace.token, workspace.cookie);
|
|
78
|
-
const messages = await client.getMessages(channel, options.limit || 20);
|
|
79
|
-
const output = messages.map((msg) => ({
|
|
80
|
-
ts: msg.ts,
|
|
81
|
-
text: msg.text,
|
|
82
|
-
user: msg.user,
|
|
83
|
-
username: msg.username,
|
|
84
|
-
type: msg.type,
|
|
85
|
-
thread_ts: msg.thread_ts,
|
|
86
|
-
reply_count: msg.reply_count,
|
|
87
|
-
}));
|
|
88
|
-
console.log(formatOutput(output, options.pretty));
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
handleError(error);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
export const channelCommand = new Command('channel')
|
|
95
|
-
.description('Channel commands')
|
|
96
|
-
.addCommand(new Command('list')
|
|
97
|
-
.description('List channels')
|
|
98
|
-
.option('--type <public|private|dm>', 'Filter by channel type')
|
|
99
|
-
.option('--include-archived', 'Include archived channels')
|
|
100
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
101
|
-
.action(listAction))
|
|
102
|
-
.addCommand(new Command('info')
|
|
103
|
-
.description('Get channel info')
|
|
104
|
-
.argument('<channel>', 'Channel ID or name')
|
|
105
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
106
|
-
.action(infoAction))
|
|
107
|
-
.addCommand(new Command('history')
|
|
108
|
-
.description('Get channel message history (alias for message list)')
|
|
109
|
-
.argument('<channel>', 'Channel ID or name')
|
|
110
|
-
.option('--limit <n>', 'Number of messages to fetch', '20')
|
|
111
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
112
|
-
.action((channel, options) => {
|
|
113
|
-
historyAction(channel, {
|
|
114
|
-
limit: parseInt(options.limit, 10),
|
|
115
|
-
pretty: options.pretty,
|
|
116
|
-
});
|
|
117
|
-
}));
|
|
118
|
-
//# sourceMappingURL=channel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/commands/channel.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,UAAU,CAAC,OAIzB;IACC,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAA;QAC3C,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,YAAY,EAAE,CAAA;QAElD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CACT,YAAY,CACV,EAAE,KAAK,EAAE,qDAAqD,EAAE,EAChE,OAAO,CAAC,MAAM,CACf,CACF,CAAA;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;QACjE,IAAI,QAAQ,GAAG,MAAM,MAAM,CAAC,YAAY,EAAE,CAAA;QAE1C,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;YAC7B,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAA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