agent-messenger 1.0.0 → 1.1.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/README.md +16 -14
- package/biome.json +33 -1
- 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 +1 -1
- package/dist/src/platforms/discord/client.d.ts.map +1 -1
- package/dist/src/platforms/discord/client.js +3 -3
- package/dist/src/platforms/discord/client.js.map +1 -1
- package/dist/src/platforms/discord/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/user.js +10 -1
- package/dist/src/platforms/discord/commands/user.js.map +1 -1
- package/dist/src/platforms/discord/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/discord/credential-manager.js +18 -12
- package/dist/src/platforms/discord/credential-manager.js.map +1 -1
- package/dist/src/platforms/slack/cli.js +1 -1
- 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.map +1 -1
- package/dist/src/platforms/slack/token-extractor.js +34 -9
- package/dist/src/platforms/slack/token-extractor.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 +36 -0
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -0
- package/dist/src/platforms/teams/token-extractor.js +335 -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/docs/teams.md +321 -0
- package/e2e/README.md +256 -0
- package/e2e/config.ts +45 -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-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/client.ts +3 -3
- package/src/platforms/discord/commands/auth.test.ts +48 -32
- package/src/platforms/discord/commands/channel.test.ts +54 -42
- package/src/platforms/discord/commands/file.test.ts +40 -53
- package/src/platforms/discord/commands/guild.test.ts +47 -27
- package/src/platforms/discord/commands/message.test.ts +54 -51
- package/src/platforms/discord/commands/reaction.test.ts +54 -42
- package/src/platforms/discord/commands/user.ts +12 -1
- package/src/platforms/discord/credential-manager.test.ts +137 -136
- package/src/platforms/discord/credential-manager.ts +20 -13
- package/src/platforms/discord/token-extractor.test.ts +133 -383
- package/{tests → src/platforms/slack}/cli.test.ts +3 -3
- package/{tests/slack-client.test.ts → src/platforms/slack/client.test.ts} +1 -1
- package/{tests → src/platforms/slack}/commands/auth.test.ts +25 -13
- package/{tests → src/platforms/slack}/commands/channel.test.ts +2 -2
- package/{tests → src/platforms/slack}/commands/file.test.ts +2 -2
- package/{tests → src/platforms/slack}/commands/message.test.ts +2 -2
- package/{tests → src/platforms/slack}/commands/reaction.test.ts +1 -1
- package/{tests → src/platforms/slack}/commands/snapshot.test.ts +117 -105
- 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 +36 -10
- package/{tests → src/platforms/slack}/types.test.ts +1 -1
- 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 +462 -0
- package/src/platforms/teams/types.test.ts +226 -0
- package/src/platforms/teams/types.ts +140 -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/dist/{cli.d.ts → src/platforms/teams/cli.d.ts} +0 -0
- /package/dist/{commands → src/platforms/teams/commands}/user.d.ts +0 -0
package/dist/commands/message.js
DELETED
|
@@ -1,214 +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 sendAction(channel, text, 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
|
-
const message = await client.sendMessage(channel, text, options.thread);
|
|
16
|
-
const output = {
|
|
17
|
-
ts: message.ts,
|
|
18
|
-
text: message.text,
|
|
19
|
-
type: message.type,
|
|
20
|
-
user: message.user,
|
|
21
|
-
thread_ts: message.thread_ts,
|
|
22
|
-
};
|
|
23
|
-
console.log(formatOutput(output, options.pretty));
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
handleError(error);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
async function listAction(channel, options) {
|
|
30
|
-
try {
|
|
31
|
-
const credManager = new CredentialManager();
|
|
32
|
-
const workspace = await credManager.getWorkspace();
|
|
33
|
-
if (!workspace) {
|
|
34
|
-
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty));
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
const client = new SlackClient(workspace.token, workspace.cookie);
|
|
38
|
-
const limit = options.limit || 20;
|
|
39
|
-
const messages = await client.getMessages(channel, limit);
|
|
40
|
-
const output = messages.map((msg) => ({
|
|
41
|
-
ts: msg.ts,
|
|
42
|
-
text: msg.text,
|
|
43
|
-
type: msg.type,
|
|
44
|
-
user: msg.user,
|
|
45
|
-
username: msg.username,
|
|
46
|
-
thread_ts: msg.thread_ts,
|
|
47
|
-
reply_count: msg.reply_count,
|
|
48
|
-
edited: msg.edited,
|
|
49
|
-
}));
|
|
50
|
-
console.log(formatOutput(output, options.pretty));
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
handleError(error);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
async function getAction(channel, ts, options) {
|
|
57
|
-
try {
|
|
58
|
-
const credManager = new CredentialManager();
|
|
59
|
-
const workspace = await credManager.getWorkspace();
|
|
60
|
-
if (!workspace) {
|
|
61
|
-
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty));
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
const client = new SlackClient(workspace.token, workspace.cookie);
|
|
65
|
-
const message = await client.getMessage(channel, ts);
|
|
66
|
-
if (!message) {
|
|
67
|
-
console.log(formatOutput({ error: `Message not found: ${ts}` }, options.pretty));
|
|
68
|
-
process.exit(1);
|
|
69
|
-
}
|
|
70
|
-
const output = {
|
|
71
|
-
ts: message.ts,
|
|
72
|
-
text: message.text,
|
|
73
|
-
type: message.type,
|
|
74
|
-
user: message.user,
|
|
75
|
-
username: message.username,
|
|
76
|
-
thread_ts: message.thread_ts,
|
|
77
|
-
reply_count: message.reply_count,
|
|
78
|
-
edited: message.edited,
|
|
79
|
-
};
|
|
80
|
-
console.log(formatOutput(output, options.pretty));
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
handleError(error);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async function updateAction(channel, ts, text, options) {
|
|
87
|
-
try {
|
|
88
|
-
const credManager = new CredentialManager();
|
|
89
|
-
const workspace = await credManager.getWorkspace();
|
|
90
|
-
if (!workspace) {
|
|
91
|
-
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty));
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
const client = new SlackClient(workspace.token, workspace.cookie);
|
|
95
|
-
const message = await client.updateMessage(channel, ts, text);
|
|
96
|
-
const output = {
|
|
97
|
-
ts: message.ts,
|
|
98
|
-
text: message.text,
|
|
99
|
-
type: message.type,
|
|
100
|
-
user: message.user,
|
|
101
|
-
};
|
|
102
|
-
console.log(formatOutput(output, options.pretty));
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
handleError(error);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
async function deleteAction(channel, ts, options) {
|
|
109
|
-
try {
|
|
110
|
-
const credManager = new CredentialManager();
|
|
111
|
-
const workspace = await credManager.getWorkspace();
|
|
112
|
-
if (!workspace) {
|
|
113
|
-
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty));
|
|
114
|
-
process.exit(1);
|
|
115
|
-
}
|
|
116
|
-
if (!options.force) {
|
|
117
|
-
console.log(formatOutput({ warning: 'Use --force to confirm deletion', ts }, options.pretty));
|
|
118
|
-
process.exit(0);
|
|
119
|
-
}
|
|
120
|
-
const client = new SlackClient(workspace.token, workspace.cookie);
|
|
121
|
-
await client.deleteMessage(channel, ts);
|
|
122
|
-
console.log(formatOutput({ deleted: ts }, options.pretty));
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
handleError(error);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async function searchAction(query, options) {
|
|
129
|
-
try {
|
|
130
|
-
const credManager = new CredentialManager();
|
|
131
|
-
const workspace = await credManager.getWorkspace();
|
|
132
|
-
if (!workspace) {
|
|
133
|
-
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty));
|
|
134
|
-
process.exit(1);
|
|
135
|
-
}
|
|
136
|
-
const client = new SlackClient(workspace.token, workspace.cookie);
|
|
137
|
-
const results = await client.searchMessages(query, {
|
|
138
|
-
sort: options.sort,
|
|
139
|
-
sortDir: options.sortDir,
|
|
140
|
-
count: options.limit || 20,
|
|
141
|
-
});
|
|
142
|
-
const output = results.map((result) => ({
|
|
143
|
-
ts: result.ts,
|
|
144
|
-
text: result.text,
|
|
145
|
-
user: result.user,
|
|
146
|
-
username: result.username,
|
|
147
|
-
channel_id: result.channel.id,
|
|
148
|
-
channel_name: result.channel.name,
|
|
149
|
-
permalink: result.permalink,
|
|
150
|
-
}));
|
|
151
|
-
console.log(formatOutput(output, options.pretty));
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
handleError(error);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
export const messageCommand = new Command('message')
|
|
158
|
-
.description('Message commands')
|
|
159
|
-
.addCommand(new Command('send')
|
|
160
|
-
.description('Send message to channel')
|
|
161
|
-
.argument('<channel>', 'Channel ID or name')
|
|
162
|
-
.argument('<text>', 'Message text')
|
|
163
|
-
.option('--thread <ts>', 'Thread timestamp for replies')
|
|
164
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
165
|
-
.action(sendAction))
|
|
166
|
-
.addCommand(new Command('list')
|
|
167
|
-
.description('List messages from channel')
|
|
168
|
-
.argument('<channel>', 'Channel ID or name')
|
|
169
|
-
.option('--limit <n>', 'Number of messages to retrieve', '20')
|
|
170
|
-
.option('--thread <ts>', 'Filter by thread timestamp')
|
|
171
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
172
|
-
.action((channel, options) => {
|
|
173
|
-
listAction(channel, {
|
|
174
|
-
limit: parseInt(options.limit, 10),
|
|
175
|
-
thread: options.thread,
|
|
176
|
-
pretty: options.pretty,
|
|
177
|
-
});
|
|
178
|
-
}))
|
|
179
|
-
.addCommand(new Command('get')
|
|
180
|
-
.description('Get a single message by timestamp')
|
|
181
|
-
.argument('<channel>', 'Channel ID or name')
|
|
182
|
-
.argument('<ts>', 'Message timestamp')
|
|
183
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
184
|
-
.action(getAction))
|
|
185
|
-
.addCommand(new Command('update')
|
|
186
|
-
.description('Update message text')
|
|
187
|
-
.argument('<channel>', 'Channel ID or name')
|
|
188
|
-
.argument('<ts>', 'Message timestamp')
|
|
189
|
-
.argument('<text>', 'New message text')
|
|
190
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
191
|
-
.action(updateAction))
|
|
192
|
-
.addCommand(new Command('delete')
|
|
193
|
-
.description('Delete message')
|
|
194
|
-
.argument('<channel>', 'Channel ID or name')
|
|
195
|
-
.argument('<ts>', 'Message timestamp')
|
|
196
|
-
.option('--force', 'Skip confirmation')
|
|
197
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
198
|
-
.action(deleteAction))
|
|
199
|
-
.addCommand(new Command('search')
|
|
200
|
-
.description('Search messages across workspace')
|
|
201
|
-
.argument('<query>', 'Search query')
|
|
202
|
-
.option('--sort <type>', 'Sort by: score, timestamp (default: timestamp)')
|
|
203
|
-
.option('--sort-dir <dir>', 'Sort direction: asc, desc (default: desc)')
|
|
204
|
-
.option('--limit <n>', 'Number of results', '20')
|
|
205
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
206
|
-
.action((query, options) => {
|
|
207
|
-
searchAction(query, {
|
|
208
|
-
sort: options.sort,
|
|
209
|
-
sortDir: options.sortDir,
|
|
210
|
-
limit: parseInt(options.limit, 10),
|
|
211
|
-
pretty: options.pretty,
|
|
212
|
-
});
|
|
213
|
-
}));
|
|
214
|
-
//# sourceMappingURL=message.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/commands/message.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;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,KAAK,UAAU,UAAU,CACvB,OAAe,EACf,IAAY,EACZ,OAA8C;IAE9C,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,Y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KAC9C,MAAM,CAAC,CAAC,KAAa,EAAE,OAAY,EAAE,EAAE;IACtC,YAAY,CAAC,KAAK,EAAE;QAClB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QAClC,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAA;AACJ,CAAC,CAAC,CACL,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../src/commands/reaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA0InC,eAAO,MAAM,eAAe,SA2BzB,CAAA"}
|
|
@@ -1,100 +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 addAction(channel, ts, emoji, options) {
|
|
7
|
-
try {
|
|
8
|
-
const credManager = new CredentialManager();
|
|
9
|
-
const ws = await credManager.getWorkspace();
|
|
10
|
-
if (!ws) {
|
|
11
|
-
console.log(formatOutput({ error: 'No workspace configured. Run "auth extract" first.' }, options.pretty));
|
|
12
|
-
process.exit(1);
|
|
13
|
-
}
|
|
14
|
-
const client = new SlackClient(ws.token, ws.cookie);
|
|
15
|
-
await client.addReaction(channel, ts, emoji);
|
|
16
|
-
console.log(formatOutput({
|
|
17
|
-
success: true,
|
|
18
|
-
channel,
|
|
19
|
-
ts,
|
|
20
|
-
emoji,
|
|
21
|
-
}, options.pretty));
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
handleError(error);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async function removeAction(channel, ts, emoji, options) {
|
|
28
|
-
try {
|
|
29
|
-
const credManager = new CredentialManager();
|
|
30
|
-
const ws = await credManager.getWorkspace();
|
|
31
|
-
if (!ws) {
|
|
32
|
-
console.log(formatOutput({ error: 'No workspace configured. Run "auth extract" first.' }, options.pretty));
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
const client = new SlackClient(ws.token, ws.cookie);
|
|
36
|
-
await client.removeReaction(channel, ts, emoji);
|
|
37
|
-
console.log(formatOutput({
|
|
38
|
-
success: true,
|
|
39
|
-
channel,
|
|
40
|
-
ts,
|
|
41
|
-
emoji,
|
|
42
|
-
}, options.pretty));
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
handleError(error);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async function listAction(channel, ts, options) {
|
|
49
|
-
try {
|
|
50
|
-
const credManager = new CredentialManager();
|
|
51
|
-
const ws = await credManager.getWorkspace();
|
|
52
|
-
if (!ws) {
|
|
53
|
-
console.log(formatOutput({ error: 'No workspace configured. Run "auth extract" first.' }, options.pretty));
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
const client = new SlackClient(ws.token, ws.cookie);
|
|
57
|
-
const messages = await client.getMessages(channel, 1);
|
|
58
|
-
const message = messages.find((m) => m.ts === ts);
|
|
59
|
-
if (!message) {
|
|
60
|
-
console.log(formatOutput({
|
|
61
|
-
error: 'Message not found',
|
|
62
|
-
channel,
|
|
63
|
-
ts,
|
|
64
|
-
}, options.pretty));
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
67
|
-
const reactions = message.reactions || [];
|
|
68
|
-
console.log(formatOutput({
|
|
69
|
-
channel,
|
|
70
|
-
ts,
|
|
71
|
-
reactions,
|
|
72
|
-
}, options.pretty));
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
handleError(error);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
export const reactionCommand = new Command('reaction')
|
|
79
|
-
.description('Reaction commands')
|
|
80
|
-
.addCommand(new Command('add')
|
|
81
|
-
.description('Add emoji reaction to message')
|
|
82
|
-
.argument('<channel>', 'Channel ID or name')
|
|
83
|
-
.argument('<ts>', 'Message timestamp')
|
|
84
|
-
.argument('<emoji>', 'Emoji name (without colons)')
|
|
85
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
86
|
-
.action(addAction))
|
|
87
|
-
.addCommand(new Command('remove')
|
|
88
|
-
.description('Remove emoji reaction from message')
|
|
89
|
-
.argument('<channel>', 'Channel ID or name')
|
|
90
|
-
.argument('<ts>', 'Message timestamp')
|
|
91
|
-
.argument('<emoji>', 'Emoji name (without colons)')
|
|
92
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
93
|
-
.action(removeAction))
|
|
94
|
-
.addCommand(new Command('list')
|
|
95
|
-
.description('List reactions on a message')
|
|
96
|
-
.argument('<channel>', 'Channel ID or name')
|
|
97
|
-
.argument('<ts>', 'Message timestamp')
|
|
98
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
99
|
-
.action(listAction));
|
|
100
|
-
//# sourceMappingURL=reaction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reaction.js","sourceRoot":"","sources":["../../src/commands/reaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,KAAK,UAAU,SAAS,CACtB,OAAe,EACf,EAAU,EACV,KAAa,EACb,OAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAA;QAC3C,MAAM,EAAE,GAAG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ts","sourceRoot":"","sources":["../../src/commands/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAiGnC,eAAO,MAAM,eAAe,SAaxB,CAAA"}
|
|
@@ -1,88 +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 snapshotAction(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
|
-
const auth = await client.testAuth();
|
|
16
|
-
const messageLimit = options.limit || 20;
|
|
17
|
-
const snapshot = {
|
|
18
|
-
workspace: {
|
|
19
|
-
id: auth.team_id,
|
|
20
|
-
name: auth.team,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
if (!options.usersOnly) {
|
|
24
|
-
const channels = await client.listChannels();
|
|
25
|
-
snapshot.channels = channels.map((ch) => ({
|
|
26
|
-
id: ch.id,
|
|
27
|
-
name: ch.name,
|
|
28
|
-
is_private: ch.is_private,
|
|
29
|
-
is_archived: ch.is_archived,
|
|
30
|
-
created: ch.created,
|
|
31
|
-
topic: ch.topic?.value,
|
|
32
|
-
purpose: ch.purpose?.value,
|
|
33
|
-
}));
|
|
34
|
-
if (!options.channelsOnly) {
|
|
35
|
-
const allMessages = [];
|
|
36
|
-
for (const channel of channels) {
|
|
37
|
-
const messages = await client.getMessages(channel.id, messageLimit);
|
|
38
|
-
for (const msg of messages) {
|
|
39
|
-
allMessages.push({
|
|
40
|
-
...msg,
|
|
41
|
-
channel_id: channel.id,
|
|
42
|
-
channel_name: channel.name,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
snapshot.recent_messages = allMessages.map((msg) => ({
|
|
47
|
-
channel_id: msg.channel_id,
|
|
48
|
-
channel_name: msg.channel_name,
|
|
49
|
-
ts: msg.ts,
|
|
50
|
-
text: msg.text,
|
|
51
|
-
user: msg.user,
|
|
52
|
-
username: msg.username,
|
|
53
|
-
thread_ts: msg.thread_ts,
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (!options.channelsOnly) {
|
|
58
|
-
const users = await client.listUsers();
|
|
59
|
-
snapshot.users = users.map((u) => ({
|
|
60
|
-
id: u.id,
|
|
61
|
-
name: u.name,
|
|
62
|
-
real_name: u.real_name,
|
|
63
|
-
is_admin: u.is_admin,
|
|
64
|
-
is_bot: u.is_bot,
|
|
65
|
-
profile: u.profile,
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
console.log(formatOutput(snapshot, options.pretty));
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
handleError(error);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
export const snapshotCommand = new Command()
|
|
75
|
-
.name('snapshot')
|
|
76
|
-
.description('Get comprehensive workspace state for AI agents')
|
|
77
|
-
.option('--channels-only', 'Include only channels (exclude messages and users)')
|
|
78
|
-
.option('--users-only', 'Include only users (exclude channels and messages)')
|
|
79
|
-
.option('--limit <n>', 'Number of recent messages per channel (default: 20)', '20')
|
|
80
|
-
.action(async (options) => {
|
|
81
|
-
await snapshotAction({
|
|
82
|
-
channelsOnly: options.channelsOnly,
|
|
83
|
-
usersOnly: options.usersOnly,
|
|
84
|
-
limit: parseInt(options.limit, 10),
|
|
85
|
-
pretty: options.pretty,
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
//# sourceMappingURL=snapshot.js.map
|
|
@@ -1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"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/commands/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAoBnC,eAAO,MAAM,WAAW,SAyFrB,CAAA"}
|
package/dist/commands/user.js
DELETED
|
@@ -1,96 +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 getClient(pretty) {
|
|
7
|
-
const credManager = new CredentialManager();
|
|
8
|
-
const workspace = await credManager.getWorkspace();
|
|
9
|
-
if (!workspace) {
|
|
10
|
-
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, pretty));
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
return new SlackClient(workspace.token, workspace.cookie);
|
|
14
|
-
}
|
|
15
|
-
export const userCommand = new Command('user')
|
|
16
|
-
.description('user commands')
|
|
17
|
-
.addCommand(new Command('list')
|
|
18
|
-
.description('list workspace users')
|
|
19
|
-
.option('--include-bots', 'include bot users')
|
|
20
|
-
.option('--pretty', 'pretty-print JSON output')
|
|
21
|
-
.action(async (options) => {
|
|
22
|
-
try {
|
|
23
|
-
const client = await getClient(options.pretty);
|
|
24
|
-
if (!client)
|
|
25
|
-
return process.exit(1);
|
|
26
|
-
const users = await client.listUsers();
|
|
27
|
-
const filtered = options.includeBots ? users : users.filter((u) => !u.is_bot);
|
|
28
|
-
const output = filtered.map((user) => ({
|
|
29
|
-
id: user.id,
|
|
30
|
-
name: user.name,
|
|
31
|
-
real_name: user.real_name,
|
|
32
|
-
is_admin: user.is_admin,
|
|
33
|
-
is_owner: user.is_owner,
|
|
34
|
-
is_bot: user.is_bot,
|
|
35
|
-
is_app_user: user.is_app_user,
|
|
36
|
-
profile: user.profile,
|
|
37
|
-
}));
|
|
38
|
-
console.log(formatOutput(output, options.pretty));
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
handleError(error);
|
|
42
|
-
}
|
|
43
|
-
}))
|
|
44
|
-
.addCommand(new Command('info')
|
|
45
|
-
.description('show user details')
|
|
46
|
-
.argument('<user>', 'user ID or username')
|
|
47
|
-
.option('--pretty', 'pretty-print JSON output')
|
|
48
|
-
.action(async (userArg, options) => {
|
|
49
|
-
try {
|
|
50
|
-
const client = await getClient(options.pretty);
|
|
51
|
-
if (!client)
|
|
52
|
-
return process.exit(1);
|
|
53
|
-
const user = await client.getUser(userArg);
|
|
54
|
-
const output = {
|
|
55
|
-
id: user.id,
|
|
56
|
-
name: user.name,
|
|
57
|
-
real_name: user.real_name,
|
|
58
|
-
is_admin: user.is_admin,
|
|
59
|
-
is_owner: user.is_owner,
|
|
60
|
-
is_bot: user.is_bot,
|
|
61
|
-
is_app_user: user.is_app_user,
|
|
62
|
-
profile: user.profile,
|
|
63
|
-
};
|
|
64
|
-
console.log(formatOutput(output, options.pretty));
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
handleError(error);
|
|
68
|
-
}
|
|
69
|
-
}))
|
|
70
|
-
.addCommand(new Command('me')
|
|
71
|
-
.description('show current authenticated user')
|
|
72
|
-
.option('--pretty', 'pretty-print JSON output')
|
|
73
|
-
.action(async (options) => {
|
|
74
|
-
try {
|
|
75
|
-
const client = await getClient(options.pretty);
|
|
76
|
-
if (!client)
|
|
77
|
-
return process.exit(1);
|
|
78
|
-
const authInfo = await client.testAuth();
|
|
79
|
-
const user = await client.getUser(authInfo.user_id);
|
|
80
|
-
const output = {
|
|
81
|
-
id: user.id,
|
|
82
|
-
name: user.name,
|
|
83
|
-
real_name: user.real_name,
|
|
84
|
-
is_admin: user.is_admin,
|
|
85
|
-
is_owner: user.is_owner,
|
|
86
|
-
is_bot: user.is_bot,
|
|
87
|
-
is_app_user: user.is_app_user,
|
|
88
|
-
profile: user.profile,
|
|
89
|
-
};
|
|
90
|
-
console.log(formatOutput(output, options.pretty));
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
handleError(error);
|
|
94
|
-
}
|
|
95
|
-
}));
|
|
96
|
-
//# sourceMappingURL=user.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/commands/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,KAAK,UAAU,SAAS,CAAC,MAAgB;IACvC,MAAM,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAA;IAC3C,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,YAAY,EAAE,CAAA;IAElD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CACT,YAAY,CAAC,EAAE,KAAK,EAAE,qDAAqD,EAAE,EAAE,MAAM,CAAC,CACvF,CAAA;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,IAAI,WAAW,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;AAC3D,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,eAAe,CAAC;KAC5B,UAAU,CACT,IAAI,OAAO,CAAC,MAAM,CAAC;KAChB,WAAW,CAAC,sBAAsB,CAAC;KACnC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;KAC7C,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAA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AG,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAEnD,MAAM,MAAM,GAAG;YACb,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;QAED,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IACnD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAc,CAAC,CAAA;IAC7B,CAAC;AACH,CAAC,CAAC,CACL,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/commands/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAmFnC,eAAO,MAAM,gBAAgB,SA2B1B,CAAA"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { CredentialManager } from '../lib/credential-manager';
|
|
3
|
-
import { handleError } from '../utils/error-handler';
|
|
4
|
-
import { formatOutput } from '../utils/output';
|
|
5
|
-
async function listAction(options) {
|
|
6
|
-
try {
|
|
7
|
-
const credManager = new CredentialManager();
|
|
8
|
-
const config = await credManager.load();
|
|
9
|
-
const workspaces = Object.values(config.workspaces);
|
|
10
|
-
const output = workspaces.map((ws) => ({
|
|
11
|
-
id: ws.workspace_id,
|
|
12
|
-
name: ws.workspace_name,
|
|
13
|
-
current: ws.workspace_id === config.current_workspace,
|
|
14
|
-
}));
|
|
15
|
-
console.log(formatOutput(output, options.pretty));
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
handleError(error);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
async function switchAction(id, options) {
|
|
22
|
-
try {
|
|
23
|
-
const credManager = new CredentialManager();
|
|
24
|
-
const config = await credManager.load();
|
|
25
|
-
if (!config.workspaces[id]) {
|
|
26
|
-
console.log(formatOutput({ error: `Workspace not found: ${id}` }, options.pretty));
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
await credManager.setCurrentWorkspace(id);
|
|
30
|
-
console.log(formatOutput({ current: id }, options.pretty));
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
handleError(error);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
async function currentAction(options) {
|
|
37
|
-
try {
|
|
38
|
-
const credManager = new CredentialManager();
|
|
39
|
-
const workspace = await credManager.getWorkspace();
|
|
40
|
-
if (!workspace) {
|
|
41
|
-
console.log(formatOutput({ error: 'No current workspace set. Run "auth extract" first.' }, options.pretty));
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
const output = {
|
|
45
|
-
workspace_id: workspace.workspace_id,
|
|
46
|
-
workspace_name: workspace.workspace_name,
|
|
47
|
-
};
|
|
48
|
-
console.log(formatOutput(output, options.pretty));
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
handleError(error);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async function removeAction(id, options) {
|
|
55
|
-
try {
|
|
56
|
-
const credManager = new CredentialManager();
|
|
57
|
-
const config = await credManager.load();
|
|
58
|
-
if (!config.workspaces[id]) {
|
|
59
|
-
console.log(formatOutput({ error: `Workspace not found: ${id}` }, options.pretty));
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
await credManager.removeWorkspace(id);
|
|
63
|
-
console.log(formatOutput({ removed: id }, options.pretty));
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
handleError(error);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export const workspaceCommand = new Command('workspace')
|
|
70
|
-
.description('Workspace management commands')
|
|
71
|
-
.addCommand(new Command('list')
|
|
72
|
-
.description('List all workspaces')
|
|
73
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
74
|
-
.action(listAction))
|
|
75
|
-
.addCommand(new Command('switch')
|
|
76
|
-
.description('Switch to workspace')
|
|
77
|
-
.argument('<id>', 'Workspace ID')
|
|
78
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
79
|
-
.action(switchAction))
|
|
80
|
-
.addCommand(new Command('current')
|
|
81
|
-
.description('Show current workspace')
|
|
82
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
83
|
-
.action(currentAction))
|
|
84
|
-
.addCommand(new Command('remove')
|
|
85
|
-
.description('Remove workspace')
|
|
86
|
-
.argument('<id>', 'Workspace ID')
|
|
87
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
88
|
-
.action(removeAction));
|
|
89
|
-
//# sourceMappingURL=workspace.js.map
|