@kaa5945/slack-cli 2026.4.11
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/LICENSE +21 -0
- package/README.md +620 -0
- package/README.zh-TW.md +620 -0
- package/dist/commands/bookmark.d.ts +3 -0
- package/dist/commands/bookmark.d.ts.map +1 -0
- package/dist/commands/bookmark.js +62 -0
- package/dist/commands/bookmark.js.map +1 -0
- package/dist/commands/canvas.d.ts +3 -0
- package/dist/commands/canvas.d.ts.map +1 -0
- package/dist/commands/canvas.js +92 -0
- package/dist/commands/canvas.js.map +1 -0
- package/dist/commands/channel.d.ts +3 -0
- package/dist/commands/channel.d.ts.map +1 -0
- package/dist/commands/channel.js +53 -0
- package/dist/commands/channel.js.map +1 -0
- package/dist/commands/channels.d.ts +3 -0
- package/dist/commands/channels.d.ts.map +1 -0
- package/dist/commands/channels.js +41 -0
- package/dist/commands/channels.js.map +1 -0
- package/dist/commands/config-subcommands.d.ts +17 -0
- package/dist/commands/config-subcommands.d.ts.map +1 -0
- package/dist/commands/config-subcommands.js +170 -0
- package/dist/commands/config-subcommands.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +40 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/delete.d.ts +3 -0
- package/dist/commands/delete.d.ts.map +1 -0
- package/dist/commands/delete.js +28 -0
- package/dist/commands/delete.js.map +1 -0
- package/dist/commands/edit.d.ts +3 -0
- package/dist/commands/edit.d.ts.map +1 -0
- package/dist/commands/edit.js +29 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/history-display.d.ts +9 -0
- package/dist/commands/history-display.d.ts.map +1 -0
- package/dist/commands/history-display.js +17 -0
- package/dist/commands/history-display.js.map +1 -0
- package/dist/commands/history-validators.d.ts +5 -0
- package/dist/commands/history-validators.d.ts.map +1 -0
- package/dist/commands/history-validators.js +35 -0
- package/dist/commands/history-validators.js.map +1 -0
- package/dist/commands/history.d.ts +3 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +141 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/invite.d.ts +3 -0
- package/dist/commands/invite.d.ts.map +1 -0
- package/dist/commands/invite.js +34 -0
- package/dist/commands/invite.js.map +1 -0
- package/dist/commands/join.d.ts +3 -0
- package/dist/commands/join.d.ts.map +1 -0
- package/dist/commands/join.js +25 -0
- package/dist/commands/join.js.map +1 -0
- package/dist/commands/leave.d.ts +3 -0
- package/dist/commands/leave.d.ts.map +1 -0
- package/dist/commands/leave.js +25 -0
- package/dist/commands/leave.js.map +1 -0
- package/dist/commands/members.d.ts +3 -0
- package/dist/commands/members.d.ts.map +1 -0
- package/dist/commands/members.js +53 -0
- package/dist/commands/members.js.map +1 -0
- package/dist/commands/pin.d.ts +3 -0
- package/dist/commands/pin.d.ts.map +1 -0
- package/dist/commands/pin.js +91 -0
- package/dist/commands/pin.js.map +1 -0
- package/dist/commands/reaction.d.ts +3 -0
- package/dist/commands/reaction.d.ts.map +1 -0
- package/dist/commands/reaction.js +45 -0
- package/dist/commands/reaction.js.map +1 -0
- package/dist/commands/reminder.d.ts +3 -0
- package/dist/commands/reminder.d.ts.map +1 -0
- package/dist/commands/reminder.js +78 -0
- package/dist/commands/reminder.js.map +1 -0
- package/dist/commands/scheduled.d.ts +3 -0
- package/dist/commands/scheduled.d.ts.map +1 -0
- package/dist/commands/scheduled.js +69 -0
- package/dist/commands/scheduled.js.map +1 -0
- package/dist/commands/search.d.ts +3 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +51 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/send-ephemeral.d.ts +3 -0
- package/dist/commands/send-ephemeral.d.ts.map +1 -0
- package/dist/commands/send-ephemeral.js +36 -0
- package/dist/commands/send-ephemeral.js.map +1 -0
- package/dist/commands/send.d.ts +3 -0
- package/dist/commands/send.d.ts.map +1 -0
- package/dist/commands/send.js +125 -0
- package/dist/commands/send.js.map +1 -0
- package/dist/commands/unread.d.ts +3 -0
- package/dist/commands/unread.d.ts.map +1 -0
- package/dist/commands/unread.js +92 -0
- package/dist/commands/unread.js.map +1 -0
- package/dist/commands/upload.d.ts +3 -0
- package/dist/commands/upload.d.ts.map +1 -0
- package/dist/commands/upload.js +99 -0
- package/dist/commands/upload.js.map +1 -0
- package/dist/commands/users.d.ts +3 -0
- package/dist/commands/users.d.ts.map +1 -0
- package/dist/commands/users.js +138 -0
- package/dist/commands/users.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/types/commands.d.ts +216 -0
- package/dist/types/commands.d.ts.map +1 -0
- package/dist/types/commands.js +3 -0
- package/dist/types/commands.js.map +1 -0
- package/dist/types/config.d.ts +18 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/slack.d.ts +198 -0
- package/dist/types/slack.d.ts.map +1 -0
- package/dist/types/slack.js +3 -0
- package/dist/types/slack.js.map +1 -0
- package/dist/utils/attachment-downloader.d.ts +22 -0
- package/dist/utils/attachment-downloader.d.ts.map +1 -0
- package/dist/utils/attachment-downloader.js +138 -0
- package/dist/utils/attachment-downloader.js.map +1 -0
- package/dist/utils/channel-formatter.d.ts +13 -0
- package/dist/utils/channel-formatter.d.ts.map +1 -0
- package/dist/utils/channel-formatter.js +43 -0
- package/dist/utils/channel-formatter.js.map +1 -0
- package/dist/utils/channel-resolver.d.ts +27 -0
- package/dist/utils/channel-resolver.d.ts.map +1 -0
- package/dist/utils/channel-resolver.js +76 -0
- package/dist/utils/channel-resolver.js.map +1 -0
- package/dist/utils/client-factory.d.ts +6 -0
- package/dist/utils/client-factory.d.ts.map +1 -0
- package/dist/utils/client-factory.js +13 -0
- package/dist/utils/client-factory.js.map +1 -0
- package/dist/utils/command-support.d.ts +16 -0
- package/dist/utils/command-support.d.ts.map +1 -0
- package/dist/utils/command-support.js +29 -0
- package/dist/utils/command-support.js.map +1 -0
- package/dist/utils/command-wrapper.d.ts +6 -0
- package/dist/utils/command-wrapper.d.ts.map +1 -0
- package/dist/utils/command-wrapper.js +27 -0
- package/dist/utils/command-wrapper.js.map +1 -0
- package/dist/utils/config-helper.d.ts +8 -0
- package/dist/utils/config-helper.d.ts.map +1 -0
- package/dist/utils/config-helper.js +19 -0
- package/dist/utils/config-helper.js.map +1 -0
- package/dist/utils/constants.d.ts +64 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +77 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/date-utils.d.ts +4 -0
- package/dist/utils/date-utils.d.ts.map +1 -0
- package/dist/utils/date-utils.js +24 -0
- package/dist/utils/date-utils.js.map +1 -0
- package/dist/utils/error-utils.d.ts +4 -0
- package/dist/utils/error-utils.d.ts.map +1 -0
- package/dist/utils/error-utils.js +46 -0
- package/dist/utils/error-utils.js.map +1 -0
- package/dist/utils/errors.d.ts +17 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +36 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/format-utils.d.ts +4 -0
- package/dist/utils/format-utils.d.ts.map +1 -0
- package/dist/utils/format-utils.js +24 -0
- package/dist/utils/format-utils.js.map +1 -0
- package/dist/utils/formatters/base-formatter.d.ts +23 -0
- package/dist/utils/formatters/base-formatter.d.ts.map +1 -0
- package/dist/utils/formatters/base-formatter.js +27 -0
- package/dist/utils/formatters/base-formatter.js.map +1 -0
- package/dist/utils/formatters/bookmark-formatters.d.ts +14 -0
- package/dist/utils/formatters/bookmark-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/bookmark-formatters.js +60 -0
- package/dist/utils/formatters/bookmark-formatters.js.map +1 -0
- package/dist/utils/formatters/channel-formatters.d.ts +7 -0
- package/dist/utils/formatters/channel-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/channel-formatters.js +65 -0
- package/dist/utils/formatters/channel-formatters.js.map +1 -0
- package/dist/utils/formatters/channel-info-formatters.d.ts +6 -0
- package/dist/utils/formatters/channel-info-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/channel-info-formatters.js +69 -0
- package/dist/utils/formatters/channel-info-formatters.js.map +1 -0
- package/dist/utils/formatters/channels-list-formatters.d.ts +6 -0
- package/dist/utils/formatters/channels-list-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/channels-list-formatters.js +49 -0
- package/dist/utils/formatters/channels-list-formatters.js.map +1 -0
- package/dist/utils/formatters/history-formatters.d.ts +10 -0
- package/dist/utils/formatters/history-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/history-formatters.js +87 -0
- package/dist/utils/formatters/history-formatters.js.map +1 -0
- package/dist/utils/formatters/members-formatters.d.ts +10 -0
- package/dist/utils/formatters/members-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/members-formatters.js +42 -0
- package/dist/utils/formatters/members-formatters.js.map +1 -0
- package/dist/utils/formatters/message-formatters.d.ts +12 -0
- package/dist/utils/formatters/message-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/message-formatters.js +95 -0
- package/dist/utils/formatters/message-formatters.js.map +1 -0
- package/dist/utils/formatters/reminder-formatters.d.ts +12 -0
- package/dist/utils/formatters/reminder-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/reminder-formatters.js +64 -0
- package/dist/utils/formatters/reminder-formatters.js.map +1 -0
- package/dist/utils/formatters/search-formatters.d.ts +10 -0
- package/dist/utils/formatters/search-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/search-formatters.js +87 -0
- package/dist/utils/formatters/search-formatters.js.map +1 -0
- package/dist/utils/mention-utils.d.ts +17 -0
- package/dist/utils/mention-utils.d.ts.map +1 -0
- package/dist/utils/mention-utils.js +45 -0
- package/dist/utils/mention-utils.js.map +1 -0
- package/dist/utils/option-parsers.d.ts +47 -0
- package/dist/utils/option-parsers.d.ts.map +1 -0
- package/dist/utils/option-parsers.js +75 -0
- package/dist/utils/option-parsers.js.map +1 -0
- package/dist/utils/profile-config.d.ts +19 -0
- package/dist/utils/profile-config.d.ts.map +1 -0
- package/dist/utils/profile-config.js +203 -0
- package/dist/utils/profile-config.js.map +1 -0
- package/dist/utils/schedule-utils.d.ts +3 -0
- package/dist/utils/schedule-utils.d.ts.map +1 -0
- package/dist/utils/schedule-utils.js +34 -0
- package/dist/utils/schedule-utils.js.map +1 -0
- package/dist/utils/slack-api-client.d.ts +3 -0
- package/dist/utils/slack-api-client.d.ts.map +1 -0
- package/dist/utils/slack-api-client.js +22 -0
- package/dist/utils/slack-api-client.js.map +1 -0
- package/dist/utils/slack-client-service.d.ts +66 -0
- package/dist/utils/slack-client-service.d.ts.map +1 -0
- package/dist/utils/slack-client-service.js +181 -0
- package/dist/utils/slack-client-service.js.map +1 -0
- package/dist/utils/slack-operations/base-client.d.ts +18 -0
- package/dist/utils/slack-operations/base-client.d.ts.map +1 -0
- package/dist/utils/slack-operations/base-client.js +52 -0
- package/dist/utils/slack-operations/base-client.js.map +1 -0
- package/dist/utils/slack-operations/canvas-operations.d.ts +10 -0
- package/dist/utils/slack-operations/canvas-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/canvas-operations.js +28 -0
- package/dist/utils/slack-operations/canvas-operations.js.map +1 -0
- package/dist/utils/slack-operations/channel-operations.d.ts +33 -0
- package/dist/utils/slack-operations/channel-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/channel-operations.js +276 -0
- package/dist/utils/slack-operations/channel-operations.js.map +1 -0
- package/dist/utils/slack-operations/file-operations.d.ts +19 -0
- package/dist/utils/slack-operations/file-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/file-operations.js +51 -0
- package/dist/utils/slack-operations/file-operations.js.map +1 -0
- package/dist/utils/slack-operations/index.d.ts +5 -0
- package/dist/utils/slack-operations/index.d.ts.map +1 -0
- package/dist/utils/slack-operations/index.js +12 -0
- package/dist/utils/slack-operations/index.js.map +1 -0
- package/dist/utils/slack-operations/message-history-operations.d.ts +17 -0
- package/dist/utils/slack-operations/message-history-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/message-history-operations.js +101 -0
- package/dist/utils/slack-operations/message-history-operations.js.map +1 -0
- package/dist/utils/slack-operations/message-operations.d.ts +24 -0
- package/dist/utils/slack-operations/message-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/message-operations.js +61 -0
- package/dist/utils/slack-operations/message-operations.js.map +1 -0
- package/dist/utils/slack-operations/message-permalink-operations.d.ts +10 -0
- package/dist/utils/slack-operations/message-permalink-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/message-permalink-operations.js +49 -0
- package/dist/utils/slack-operations/message-permalink-operations.js.map +1 -0
- package/dist/utils/slack-operations/message-user-resolver.d.ts +7 -0
- package/dist/utils/slack-operations/message-user-resolver.d.ts.map +1 -0
- package/dist/utils/slack-operations/message-user-resolver.js +27 -0
- package/dist/utils/slack-operations/message-user-resolver.js.map +1 -0
- package/dist/utils/slack-operations/message-write-operations.d.ts +17 -0
- package/dist/utils/slack-operations/message-write-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/message-write-operations.js +76 -0
- package/dist/utils/slack-operations/message-write-operations.js.map +1 -0
- package/dist/utils/slack-operations/pin-operations.d.ts +11 -0
- package/dist/utils/slack-operations/pin-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/pin-operations.js +34 -0
- package/dist/utils/slack-operations/pin-operations.js.map +1 -0
- package/dist/utils/slack-operations/reaction-operations.d.ts +10 -0
- package/dist/utils/slack-operations/reaction-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/reaction-operations.js +32 -0
- package/dist/utils/slack-operations/reaction-operations.js.map +1 -0
- package/dist/utils/slack-operations/reminder-operations.d.ts +10 -0
- package/dist/utils/slack-operations/reminder-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/reminder-operations.js +32 -0
- package/dist/utils/slack-operations/reminder-operations.js.map +1 -0
- package/dist/utils/slack-operations/search-operations.d.ts +11 -0
- package/dist/utils/slack-operations/search-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/search-operations.js +116 -0
- package/dist/utils/slack-operations/search-operations.js.map +1 -0
- package/dist/utils/slack-operations/star-operations.d.ts +9 -0
- package/dist/utils/slack-operations/star-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/star-operations.js +32 -0
- package/dist/utils/slack-operations/star-operations.js.map +1 -0
- package/dist/utils/slack-operations/user-operations.d.ts +12 -0
- package/dist/utils/slack-operations/user-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/user-operations.js +69 -0
- package/dist/utils/slack-operations/user-operations.js.map +1 -0
- package/dist/utils/slack-patterns.d.ts +20 -0
- package/dist/utils/slack-patterns.d.ts.map +1 -0
- package/dist/utils/slack-patterns.js +54 -0
- package/dist/utils/slack-patterns.js.map +1 -0
- package/dist/utils/terminal-sanitizer.d.ts +7 -0
- package/dist/utils/terminal-sanitizer.d.ts.map +1 -0
- package/dist/utils/terminal-sanitizer.js +51 -0
- package/dist/utils/terminal-sanitizer.js.map +1 -0
- package/dist/utils/token-crypto-service.d.ts +40 -0
- package/dist/utils/token-crypto-service.d.ts.map +1 -0
- package/dist/utils/token-crypto-service.js +273 -0
- package/dist/utils/token-crypto-service.js.map +1 -0
- package/dist/utils/token-utils.d.ts +7 -0
- package/dist/utils/token-utils.d.ts.map +1 -0
- package/dist/utils/token-utils.js +18 -0
- package/dist/utils/token-utils.js.map +1 -0
- package/dist/utils/update-notifier.d.ts +10 -0
- package/dist/utils/update-notifier.d.ts.map +1 -0
- package/dist/utils/update-notifier.js +147 -0
- package/dist/utils/update-notifier.js.map +1 -0
- package/dist/utils/validators.d.ts +147 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/utils/validators.js +401 -0
- package/dist/utils/validators.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/commands/canvas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoDpC,wBAAgB,kBAAkB,IAAI,OAAO,CAuD5C"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setupCanvasCommand = setupCanvasCommand;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const command_support_1 = require("../utils/command-support");
|
|
10
|
+
const command_wrapper_1 = require("../utils/command-wrapper");
|
|
11
|
+
const terminal_sanitizer_1 = require("../utils/terminal-sanitizer");
|
|
12
|
+
const validators_1 = require("../utils/validators");
|
|
13
|
+
function extractText(elements) {
|
|
14
|
+
return elements
|
|
15
|
+
.map((el) => {
|
|
16
|
+
if (el.text)
|
|
17
|
+
return (0, terminal_sanitizer_1.sanitizeTerminalText)(el.text);
|
|
18
|
+
if (el.elements)
|
|
19
|
+
return extractText(el.elements);
|
|
20
|
+
return '';
|
|
21
|
+
})
|
|
22
|
+
.join('');
|
|
23
|
+
}
|
|
24
|
+
function formatSectionsTable(sections) {
|
|
25
|
+
sections.forEach((section) => {
|
|
26
|
+
const text = section.elements ? extractText(section.elements) : '';
|
|
27
|
+
console.log(chalk_1.default.cyan(`ID: ${(0, terminal_sanitizer_1.sanitizeTerminalText)(section.id || '(no id)')}`) +
|
|
28
|
+
` Content: ${text || '(no content)'}`);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function formatSectionsSimple(sections) {
|
|
32
|
+
sections.forEach((section) => {
|
|
33
|
+
const text = section.elements ? extractText(section.elements) : '';
|
|
34
|
+
console.log(`${(0, terminal_sanitizer_1.sanitizeTerminalText)(section.id || '(no id)')}\t${text || '(no content)'}`);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function formatCanvasesTable(canvases) {
|
|
38
|
+
canvases.forEach((canvas) => {
|
|
39
|
+
console.log(chalk_1.default.cyan(`ID: ${(0, terminal_sanitizer_1.sanitizeTerminalText)(canvas.id || '(no id)')}`) +
|
|
40
|
+
` Name: ${(0, terminal_sanitizer_1.sanitizeTerminalText)(canvas.name || '(no name)')}`);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function formatCanvasesSimple(canvases) {
|
|
44
|
+
canvases.forEach((canvas) => {
|
|
45
|
+
console.log(`${(0, terminal_sanitizer_1.sanitizeTerminalText)(canvas.id || '(no id)')}\t${(0, terminal_sanitizer_1.sanitizeTerminalText)(canvas.name || '(no name)')}`);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function setupCanvasCommand() {
|
|
49
|
+
const canvasCommand = new commander_1.Command('canvas').description('Manage Slack Canvases');
|
|
50
|
+
const readCommand = new commander_1.Command('read')
|
|
51
|
+
.description('Get the sections of a Canvas')
|
|
52
|
+
.requiredOption('-i, --id <canvas-id>', 'Canvas ID')
|
|
53
|
+
.option('--format <format>', 'Output format: table, simple, json', 'table')
|
|
54
|
+
.option('--profile <profile>', 'Use specific workspace profile')
|
|
55
|
+
.hook('preAction', (0, validators_1.createValidationHook)([validators_1.optionValidators.format]))
|
|
56
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
57
|
+
await (0, command_support_1.withSlackClient)(options, async (client) => {
|
|
58
|
+
const sections = await client.readCanvas(options.id);
|
|
59
|
+
if (sections.length === 0) {
|
|
60
|
+
console.log('No sections found in canvas');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
(0, command_support_1.renderByFormat)(options, sections, {
|
|
64
|
+
table: formatSectionsTable,
|
|
65
|
+
simple: formatSectionsSimple,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}));
|
|
69
|
+
const listCommand = new commander_1.Command('list')
|
|
70
|
+
.description('List canvases linked to a channel')
|
|
71
|
+
.requiredOption('-c, --channel <channel>', 'Channel name or ID')
|
|
72
|
+
.option('--format <format>', 'Output format: table, simple, json', 'table')
|
|
73
|
+
.option('--profile <profile>', 'Use specific workspace profile')
|
|
74
|
+
.hook('preAction', (0, validators_1.createValidationHook)([validators_1.optionValidators.format]))
|
|
75
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
76
|
+
await (0, command_support_1.withSlackClient)(options, async (client) => {
|
|
77
|
+
const canvases = await client.listCanvases(options.channel);
|
|
78
|
+
if (canvases.length === 0) {
|
|
79
|
+
console.log('No canvases found in channel');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
(0, command_support_1.renderByFormat)(options, canvases, {
|
|
83
|
+
table: formatCanvasesTable,
|
|
84
|
+
simple: formatCanvasesSimple,
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}));
|
|
88
|
+
canvasCommand.addCommand(readCommand);
|
|
89
|
+
canvasCommand.addCommand(listCommand);
|
|
90
|
+
return canvasCommand;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=canvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.js","sourceRoot":"","sources":["../../src/commands/canvas.ts"],"names":[],"mappings":";;;;;AAqDA,gDAuDC;AA5GD,kDAA0B;AAC1B,yCAAoC;AAGpC,8DAA2E;AAC3E,8DAAuD;AACvD,oEAAmE;AACnE,oDAA6E;AAE7E,SAAS,WAAW,CAAC,QAAgC;IACnD,OAAO,QAAQ;SACZ,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QACV,IAAI,EAAE,CAAC,IAAI;YAAE,OAAO,IAAA,yCAAoB,EAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC,QAAQ;YAAE,OAAO,WAAW,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAO,EAAE,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,mBAAmB,IAAI,OAAO,CAyD7C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupChannelCommand = setupChannelCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const client_factory_1 = require("../utils/client-factory");
|
|
6
|
+
const command_wrapper_1 = require("../utils/command-wrapper");
|
|
7
|
+
const channel_info_formatters_1 = require("../utils/formatters/channel-info-formatters");
|
|
8
|
+
const option_parsers_1 = require("../utils/option-parsers");
|
|
9
|
+
const validators_1 = require("../utils/validators");
|
|
10
|
+
function setupChannelCommand() {
|
|
11
|
+
const channelCommand = new commander_1.Command('channel').description('Manage channel topic, purpose, and info');
|
|
12
|
+
channelCommand
|
|
13
|
+
.command('info')
|
|
14
|
+
.description('Display channel details including topic and purpose')
|
|
15
|
+
.requiredOption('-c, --channel <channel>', 'Target channel name or ID')
|
|
16
|
+
.option('--format <format>', 'Output format: table, simple, json', 'table')
|
|
17
|
+
.option('--profile <profile>', 'Use specific workspace profile')
|
|
18
|
+
.hook('preAction', (0, validators_1.createValidationHook)([validators_1.optionValidators.format]))
|
|
19
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
20
|
+
const profile = (0, option_parsers_1.parseProfile)(options.profile);
|
|
21
|
+
const client = await (0, client_factory_1.createSlackClient)(profile);
|
|
22
|
+
const channel = await client.getChannelDetail(options.channel);
|
|
23
|
+
const format = (0, option_parsers_1.parseFormat)(options.format);
|
|
24
|
+
const formatter = (0, channel_info_formatters_1.createChannelInfoFormatter)(format);
|
|
25
|
+
formatter.format({ channel });
|
|
26
|
+
}));
|
|
27
|
+
channelCommand
|
|
28
|
+
.command('set-topic')
|
|
29
|
+
.description('Set the topic of a channel')
|
|
30
|
+
.requiredOption('-c, --channel <channel>', 'Target channel name or ID')
|
|
31
|
+
.requiredOption('--topic <topic>', 'New topic text')
|
|
32
|
+
.option('--profile <profile>', 'Use specific workspace profile')
|
|
33
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
34
|
+
const profile = (0, option_parsers_1.parseProfile)(options.profile);
|
|
35
|
+
const client = await (0, client_factory_1.createSlackClient)(profile);
|
|
36
|
+
await client.setTopic(options.channel, options.topic);
|
|
37
|
+
console.log(`✓ Topic updated for #${options.channel}`);
|
|
38
|
+
}));
|
|
39
|
+
channelCommand
|
|
40
|
+
.command('set-purpose')
|
|
41
|
+
.description('Set the purpose of a channel')
|
|
42
|
+
.requiredOption('-c, --channel <channel>', 'Target channel name or ID')
|
|
43
|
+
.requiredOption('--purpose <purpose>', 'New purpose text')
|
|
44
|
+
.option('--profile <profile>', 'Use specific workspace profile')
|
|
45
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
46
|
+
const profile = (0, option_parsers_1.parseProfile)(options.profile);
|
|
47
|
+
const client = await (0, client_factory_1.createSlackClient)(profile);
|
|
48
|
+
await client.setPurpose(options.channel, options.purpose);
|
|
49
|
+
console.log(`✓ Purpose updated for #${options.channel}`);
|
|
50
|
+
}));
|
|
51
|
+
return channelCommand;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/commands/channel.ts"],"names":[],"mappings":";;AAYA,kDAyDC;AArED,yCAAoC;AAMpC,4DAA4D;AAC5D,8DAAuD;AACvD,yFAAyF;AACzF,4DAAoE;AACpE,oDAA6E;AAE7E,SAAgB,mBAAmB;IACjC,MAAM,cAAc,GAAG,IAAI,mBAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CACvD,yCAAyC,CAC1C,CAAC;IAEF,cAAc;SACX,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,qDAAqD,CAAC;SAClE,cAAc,CAAC,yBAAyB,EAAE,2BAA2B,CAAC;SACtE,MAAM,CAAC,mBAAmB,EAAE,oCAAoC,EA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AC,wBAAwB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,CACH,CAAC;IAEJ,cAAc;SACX,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,8BAA8B,CAAC;SAC3C,cAAc,CAAC,yBAAyB,EAAE,2BAA2B,CAAC;SACtE,cAAc,CAAC,qBAAqB,EAAE,kBAAkB,CAAC;SACzD,MAAM,CAAC,qBAAqB,EAAE,gCAAgC,CAAC;SAC/D,MAAM,CACL,IAAA,6BAAW,EAAC,KAAK,EAAE,OAAiC,EAAE,EAAE;QACtD,MAAM,OAAO,GAAG,IAAA,6BAAY,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,MAAM,IAAA,kCAAiB,EAAC,OAAO,CAAC,CAAC;QAEhD,MAAM,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,0BAA0B,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3D,CAAC,CAAC,CACH,CAAC;IAEJ,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/commands/channels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,oBAAoB,IAAI,OAAO,CAmC9C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupChannelsCommand = setupChannelsCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const channel_formatter_1 = require("../utils/channel-formatter");
|
|
6
|
+
const command_support_1 = require("../utils/command-support");
|
|
7
|
+
const command_wrapper_1 = require("../utils/command-wrapper");
|
|
8
|
+
const constants_1 = require("../utils/constants");
|
|
9
|
+
const channels_list_formatters_1 = require("../utils/formatters/channels-list-formatters");
|
|
10
|
+
const option_parsers_1 = require("../utils/option-parsers");
|
|
11
|
+
function setupChannelsCommand() {
|
|
12
|
+
const channelsCommand = new commander_1.Command('channels');
|
|
13
|
+
channelsCommand
|
|
14
|
+
.description('List Slack channels')
|
|
15
|
+
.option('--type <type>', 'Channel type: public, private, im, mpim, all', 'public')
|
|
16
|
+
.option('--include-archived', 'Include archived channels', false)
|
|
17
|
+
.option('--format <format>', 'Output format: table, simple, json', 'table')
|
|
18
|
+
.option('--limit <number>', 'Maximum number of channels to list', '100')
|
|
19
|
+
.option('--profile <profile>', 'Use specific workspace profile')
|
|
20
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
21
|
+
await (0, command_support_1.withSlackClient)(options, async (client) => {
|
|
22
|
+
const types = (0, channel_formatter_1.getChannelTypes)(options.type);
|
|
23
|
+
const limit = (0, option_parsers_1.parseLimit)(options.limit, 100);
|
|
24
|
+
const channels = await client.listChannels({
|
|
25
|
+
types,
|
|
26
|
+
exclude_archived: !(0, option_parsers_1.parseBoolean)(options.includeArchived),
|
|
27
|
+
limit,
|
|
28
|
+
});
|
|
29
|
+
if (channels.length === 0) {
|
|
30
|
+
console.log(constants_1.ERROR_MESSAGES.NO_CHANNELS_FOUND);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const channelInfos = channels.map(channel_formatter_1.mapChannelToInfo);
|
|
34
|
+
const format = (0, option_parsers_1.parseFormat)(options.format);
|
|
35
|
+
const formatter = (0, channels_list_formatters_1.createChannelsListFormatter)(format);
|
|
36
|
+
formatter.format({ channels: channelInfos });
|
|
37
|
+
});
|
|
38
|
+
}));
|
|
39
|
+
return channelsCommand;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=channels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../src/commands/channels.ts"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CAAC;YACpD,MAAM,MAAM,GAAG,IAAA,4BAAW,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC3C,MAAM,SAAS,GAAG,IAAA,sDAA2B,EAAC,MAAM,CAAC,CAAC;YACtD,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;IAEJ,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface SetTokenOptions {
|
|
2
|
+
token?: string;
|
|
3
|
+
tokenStdin?: boolean;
|
|
4
|
+
profile?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function handleSetToken(options: SetTokenOptions): Promise<void>;
|
|
7
|
+
export declare function handleGetConfig(options: {
|
|
8
|
+
profile?: string;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
export declare function handleListProfiles(): Promise<void>;
|
|
11
|
+
export declare function handleUseProfile(profile: string): Promise<void>;
|
|
12
|
+
export declare function handleShowCurrentProfile(): Promise<void>;
|
|
13
|
+
export declare function handleClearConfig(options: {
|
|
14
|
+
profile?: string;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=config-subcommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-subcommands.d.ts","sourceRoot":"","sources":["../../src/commands/config-subcommands.ts"],"names":[],"mappings":"AAOA,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAuFD,wBAAsB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAM5E;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAalF;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgBxD;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIrE;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAI9D;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAKpF"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.handleSetToken = handleSetToken;
|
|
40
|
+
exports.handleGetConfig = handleGetConfig;
|
|
41
|
+
exports.handleListProfiles = handleListProfiles;
|
|
42
|
+
exports.handleUseProfile = handleUseProfile;
|
|
43
|
+
exports.handleShowCurrentProfile = handleShowCurrentProfile;
|
|
44
|
+
exports.handleClearConfig = handleClearConfig;
|
|
45
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
46
|
+
const readline = __importStar(require("readline"));
|
|
47
|
+
const stream_1 = require("stream");
|
|
48
|
+
const command_wrapper_1 = require("../utils/command-wrapper");
|
|
49
|
+
const constants_1 = require("../utils/constants");
|
|
50
|
+
const profile_config_1 = require("../utils/profile-config");
|
|
51
|
+
async function readTokenFromStdin() {
|
|
52
|
+
const chunks = [];
|
|
53
|
+
for await (const chunk of process.stdin) {
|
|
54
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
55
|
+
}
|
|
56
|
+
return Buffer.concat(chunks).toString('utf-8').trim();
|
|
57
|
+
}
|
|
58
|
+
async function promptTokenInteractively() {
|
|
59
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
60
|
+
throw new Error('No token provided. Use --token-stdin, set SLACK_CLI_TOKEN, or run this command in an interactive terminal.');
|
|
61
|
+
}
|
|
62
|
+
return await new Promise((resolve, reject) => {
|
|
63
|
+
let isMuted = false;
|
|
64
|
+
const maskedOutput = new stream_1.Writable({
|
|
65
|
+
write(chunk, encoding, callback) {
|
|
66
|
+
if (!isMuted) {
|
|
67
|
+
if (typeof chunk === 'string') {
|
|
68
|
+
process.stdout.write(chunk, encoding);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
process.stdout.write(chunk);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
callback();
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
maskedOutput.isTTY = true;
|
|
78
|
+
const rl = readline.createInterface({
|
|
79
|
+
input: process.stdin,
|
|
80
|
+
output: maskedOutput,
|
|
81
|
+
terminal: true,
|
|
82
|
+
});
|
|
83
|
+
rl.question('Slack API token: ', (answer) => {
|
|
84
|
+
rl.close();
|
|
85
|
+
process.stdout.write('\n');
|
|
86
|
+
resolve(answer.trim());
|
|
87
|
+
});
|
|
88
|
+
isMuted = true;
|
|
89
|
+
rl.on('SIGINT', () => {
|
|
90
|
+
rl.close();
|
|
91
|
+
reject(new Error('Token input cancelled'));
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async function resolveTokenInput(options) {
|
|
96
|
+
if (options.token && options.tokenStdin) {
|
|
97
|
+
throw new Error('Cannot use --token and --token-stdin together');
|
|
98
|
+
}
|
|
99
|
+
if (options.tokenStdin) {
|
|
100
|
+
const token = await readTokenFromStdin();
|
|
101
|
+
if (!token) {
|
|
102
|
+
throw new Error('No token received from stdin');
|
|
103
|
+
}
|
|
104
|
+
return token;
|
|
105
|
+
}
|
|
106
|
+
if (options.token) {
|
|
107
|
+
console.error(chalk_1.default.yellow('Warning: --token may leak secrets via shell history/process list. Prefer --token-stdin or interactive input.'));
|
|
108
|
+
return options.token.trim();
|
|
109
|
+
}
|
|
110
|
+
const envToken = process.env.SLACK_CLI_TOKEN?.trim();
|
|
111
|
+
if (envToken) {
|
|
112
|
+
return envToken;
|
|
113
|
+
}
|
|
114
|
+
const promptedToken = await promptTokenInteractively();
|
|
115
|
+
if (!promptedToken) {
|
|
116
|
+
throw new Error('Token cannot be empty');
|
|
117
|
+
}
|
|
118
|
+
return promptedToken;
|
|
119
|
+
}
|
|
120
|
+
async function handleSetToken(options) {
|
|
121
|
+
const configManager = new profile_config_1.ProfileConfigManager();
|
|
122
|
+
const token = await resolveTokenInput(options);
|
|
123
|
+
const profileName = await (0, command_wrapper_1.getProfileName)(configManager, options.profile);
|
|
124
|
+
await configManager.setToken(token, options.profile);
|
|
125
|
+
console.log(chalk_1.default.green(`✓ ${constants_1.SUCCESS_MESSAGES.TOKEN_SAVED(profileName)}`));
|
|
126
|
+
}
|
|
127
|
+
async function handleGetConfig(options) {
|
|
128
|
+
const configManager = new profile_config_1.ProfileConfigManager();
|
|
129
|
+
const profileName = await (0, command_wrapper_1.getProfileName)(configManager, options.profile);
|
|
130
|
+
const currentConfig = await configManager.getConfig(options.profile);
|
|
131
|
+
if (!currentConfig) {
|
|
132
|
+
console.log(chalk_1.default.yellow(constants_1.ERROR_MESSAGES.NO_CONFIG(profileName)));
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
console.log(chalk_1.default.bold(`Configuration for profile "${profileName}":`));
|
|
136
|
+
console.log(` Token: ${chalk_1.default.cyan(configManager.maskToken(currentConfig.token))}`);
|
|
137
|
+
console.log(` Updated: ${chalk_1.default.gray(currentConfig.updatedAt)}`);
|
|
138
|
+
}
|
|
139
|
+
async function handleListProfiles() {
|
|
140
|
+
const configManager = new profile_config_1.ProfileConfigManager();
|
|
141
|
+
const profiles = await configManager.listProfiles();
|
|
142
|
+
const currentProfile = await configManager.getCurrentProfile();
|
|
143
|
+
if (profiles.length === 0) {
|
|
144
|
+
console.log(chalk_1.default.yellow(constants_1.ERROR_MESSAGES.NO_PROFILES_FOUND));
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
console.log(chalk_1.default.bold('Available profiles:'));
|
|
148
|
+
profiles.forEach((profile) => {
|
|
149
|
+
const marker = profile.name === currentProfile ? '*' : ' ';
|
|
150
|
+
const maskedToken = configManager.maskToken(profile.config.token);
|
|
151
|
+
console.log(` ${marker} ${chalk_1.default.cyan(profile.name)} (${maskedToken})`);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async function handleUseProfile(profile) {
|
|
155
|
+
const configManager = new profile_config_1.ProfileConfigManager();
|
|
156
|
+
await configManager.useProfile(profile);
|
|
157
|
+
console.log(chalk_1.default.green(`✓ ${constants_1.SUCCESS_MESSAGES.PROFILE_SWITCHED(profile)}`));
|
|
158
|
+
}
|
|
159
|
+
async function handleShowCurrentProfile() {
|
|
160
|
+
const configManager = new profile_config_1.ProfileConfigManager();
|
|
161
|
+
const currentProfile = await configManager.getCurrentProfile();
|
|
162
|
+
console.log(chalk_1.default.bold(`Current profile: ${chalk_1.default.cyan(currentProfile)}`));
|
|
163
|
+
}
|
|
164
|
+
async function handleClearConfig(options) {
|
|
165
|
+
const configManager = new profile_config_1.ProfileConfigManager();
|
|
166
|
+
const profileName = await (0, command_wrapper_1.getProfileName)(configManager, options.profile);
|
|
167
|
+
await configManager.clearConfig(options.profile);
|
|
168
|
+
console.log(chalk_1.default.green(`✓ ${constants_1.SUCCESS_MESSAGES.PROFILE_CLEARED(profileName)}`));
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=config-subcommands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-subcommands.js","sourceRoot":"","sources":["../../src/commands/config-subcommands.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkGA,wCAMC;AAED,0CAaC;AAED,gDAgBC;AAED,4CAIC;AAED,4DAIC;AAED,8CAKC;AA5JD,kDAA0B;AAC1B,mDAAqC;AACrC,mCAAkC;AAClC,8DAA0D;AAC1D,kDAAsE;AACtE,4DAA+D;AAQ/D,KAAK,UAAU,kBAAkB;IAC/B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,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AG,CAAC,eAAK,CAAC,KAAK,CAAC,KAAK,4BAAgB,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9E,CAAC;AAEM,KAAK,UAAU,wBAAwB;IAC5C,MAAM,aAAa,GAAG,IAAI,qCAAoB,EAAE,CAAC;IACjD,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,iBAAiB,EAAE,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,oBAAoB,eAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5E,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,OAA6B;IACnE,MAAM,aAAa,GAAG,IAAI,qCAAoB,EAAE,CAAC;IACjD,MAAM,WAAW,GAAG,MAAM,IAAA,gCAAc,EAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACzE,MAAM,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,KAAK,4BAAgB,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,wBAAgB,kBAAkB,IAAI,OAAO,CA0C5C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupConfigCommand = setupConfigCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const command_wrapper_1 = require("../utils/command-wrapper");
|
|
6
|
+
const config_subcommands_1 = require("./config-subcommands");
|
|
7
|
+
function setupConfigCommand() {
|
|
8
|
+
const config = new commander_1.Command('config').description('Manage Slack CLI configuration');
|
|
9
|
+
config
|
|
10
|
+
.command('set')
|
|
11
|
+
.description('Set API token')
|
|
12
|
+
.option('--token <token>', 'Slack API token (deprecated: may leak via shell history/process list)')
|
|
13
|
+
.option('--token-stdin', 'Read Slack API token from stdin')
|
|
14
|
+
.option('--profile <profile>', 'Profile name (default: "default")')
|
|
15
|
+
.action((0, command_wrapper_1.wrapCommand)(config_subcommands_1.handleSetToken));
|
|
16
|
+
config
|
|
17
|
+
.command('get')
|
|
18
|
+
.description('Show current configuration')
|
|
19
|
+
.option('--profile <profile>', 'Profile name')
|
|
20
|
+
.action((0, command_wrapper_1.wrapCommand)(config_subcommands_1.handleGetConfig));
|
|
21
|
+
config
|
|
22
|
+
.command('profiles')
|
|
23
|
+
.description('List all profiles')
|
|
24
|
+
.action((0, command_wrapper_1.wrapCommand)(config_subcommands_1.handleListProfiles));
|
|
25
|
+
config
|
|
26
|
+
.command('use <profile>')
|
|
27
|
+
.description('Switch to a different profile')
|
|
28
|
+
.action((0, command_wrapper_1.wrapCommand)(config_subcommands_1.handleUseProfile));
|
|
29
|
+
config
|
|
30
|
+
.command('current')
|
|
31
|
+
.description('Show current active profile')
|
|
32
|
+
.action((0, command_wrapper_1.wrapCommand)(config_subcommands_1.handleShowCurrentProfile));
|
|
33
|
+
config
|
|
34
|
+
.command('clear')
|
|
35
|
+
.description('Clear configuration')
|
|
36
|
+
.option('--profile <profile>', 'Profile name')
|
|
37
|
+
.action((0, command_wrapper_1.wrapCommand)(config_subcommands_1.handleClearConfig));
|
|
38
|
+
return config;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":";;AAWA,gDA0CC;AArDD,yCAAoC;AACpC,8DAAuD;AACvD,6DAO8B;AAE9B,SAAgB,kBAAkB;IA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":"delete.d.ts","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,kBAAkB,IAAI,OAAO,CAkB5C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setupDeleteCommand = setupDeleteCommand;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const client_factory_1 = require("../utils/client-factory");
|
|
10
|
+
const command_wrapper_1 = require("../utils/command-wrapper");
|
|
11
|
+
const option_parsers_1 = require("../utils/option-parsers");
|
|
12
|
+
const validators_1 = require("../utils/validators");
|
|
13
|
+
function setupDeleteCommand() {
|
|
14
|
+
const deleteCommand = new commander_1.Command('delete')
|
|
15
|
+
.description('Delete a sent message')
|
|
16
|
+
.requiredOption('-c, --channel <channel>', 'Channel name or ID')
|
|
17
|
+
.requiredOption('--ts <timestamp>', 'Message timestamp to delete')
|
|
18
|
+
.option('--profile <profile>', 'Use specific workspace profile')
|
|
19
|
+
.hook('preAction', (0, validators_1.createValidationHook)([validators_1.optionValidators.deleteTimestamp]))
|
|
20
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
21
|
+
const profile = (0, option_parsers_1.parseProfile)(options.profile);
|
|
22
|
+
const client = await (0, client_factory_1.createSlackClient)(profile);
|
|
23
|
+
await client.deleteMessage(options.channel, options.ts);
|
|
24
|
+
console.log(chalk_1.default.green(`✓ Message deleted successfully from #${options.channel}`));
|
|
25
|
+
}));
|
|
26
|
+
return deleteCommand;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":";;;;;AAQA,gDAkBC;AA1BD,kDAA0B;AAC1B,yCAAoC;AAEpC,4DAA4D;AAC5D,8DAAuD;AACvD,4DAAuD;AACvD,oDAA6E;AAE7E,SAAgB,kBAAkB;IAChC,MAAM,aAAa,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;SACxC,WAAW,CAAC,uBAAuB,CAAC;SACpC,cAAc,CAAC,yBAAyB,EAAE,oBAAoB,CAAC;SAC/D,cAAc,CAAC,kBAAkB,EAAE,6BAA6B,CAAC;SACjE,MAAM,CAAC,qBAAqB,EAAE,gCAAgC,CAAC;SAC/D,IAAI,CAAC,WAAW,EAAE,IAAA,iCAAoB,EAAC,CAAC,6BAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;SAC3E,MAAM,CACL,IAAA,6BAAW,EAAC,KAAK,EAAE,OAAsB,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,IAAA,6BAAY,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,MAAM,IAAA,kCAAiB,EAAC,OAAO,CAAC,CAAC;QAEhD,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,wCAAwC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACtF,CAAC,CAAC,CACH,CAAC;IAEJ,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/commands/edit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,gBAAgB,IAAI,OAAO,CAmB1C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setupEditCommand = setupEditCommand;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const client_factory_1 = require("../utils/client-factory");
|
|
10
|
+
const command_wrapper_1 = require("../utils/command-wrapper");
|
|
11
|
+
const option_parsers_1 = require("../utils/option-parsers");
|
|
12
|
+
const validators_1 = require("../utils/validators");
|
|
13
|
+
function setupEditCommand() {
|
|
14
|
+
const editCommand = new commander_1.Command('edit')
|
|
15
|
+
.description('Edit a sent message')
|
|
16
|
+
.requiredOption('-c, --channel <channel>', 'Channel name or ID')
|
|
17
|
+
.requiredOption('--ts <timestamp>', 'Message timestamp to edit')
|
|
18
|
+
.requiredOption('-m, --message <message>', 'New message text')
|
|
19
|
+
.option('--profile <profile>', 'Use specific workspace profile')
|
|
20
|
+
.hook('preAction', (0, validators_1.createValidationHook)([validators_1.optionValidators.editTimestamp]))
|
|
21
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
22
|
+
const profile = (0, option_parsers_1.parseProfile)(options.profile);
|
|
23
|
+
const client = await (0, client_factory_1.createSlackClient)(profile);
|
|
24
|
+
await client.updateMessage(options.channel, options.ts, options.message);
|
|
25
|
+
console.log(chalk_1.default.green(`✓ Message updated successfully in #${options.channel}`));
|
|
26
|
+
}));
|
|
27
|
+
return editCommand;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../src/commands/edit.ts"],"names":[],"mappings":";;;;;AAQA,4CAmBC;AA3BD,kDAA0B;AAC1B,yCAAoC;AAEpC,4DAA4D;AAC5D,8DAAuD;AACvD,4DAAuD;AACvD,oDAA6E;AAE7E,SAAgB,gBAAgB;IAC9B,MAAM,WAAW,GAAG,IAAI,mBAAO,CAAC,MAAM,CAAC;SACpC,WAAW,CAAC,qBAAqB,CAAC;SAClC,cAAc,CAAC,yBAAyB,EAAE,oBAAoB,CAAC;SAC/D,cAAc,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;SAC/D,cAAc,CAAC,yBAAyB,EAAE,kBAAkB,CAAC;SAC7D,MAAM,CAAC,qBAAqB,EAAE,gCAAgC,CAAC;SAC/D,IAAI,CAAC,WAAW,EAAE,IAAA,iCAAoB,EAAC,CAAC,6BAAgB,CAAC,aAAa,CAAC,CAAC,CAAC;SACzE,MAAM,CACL,IAAA,6BAAW,EAAC,KAAK,EAAE,OAAoB,EAAE,EAAE;QACzC,MAAM,OAAO,GAAG,IAAA,6BAAY,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,MAAM,IAAA,kCAAiB,EAAC,OAAO,CAAC,CAAC;QAEhD,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,sCAAsC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACpF,CAAC,CAAC,CACH,CAAC;IAEJ,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Message } from '../types/slack';
|
|
2
|
+
interface DisplayHistoryOptions {
|
|
3
|
+
preserveOrder?: boolean;
|
|
4
|
+
permalinks?: Map<string, string>;
|
|
5
|
+
attachmentPaths?: Map<string, string[]>;
|
|
6
|
+
}
|
|
7
|
+
export declare function displayHistoryResults(messages: Message[], users: Map<string, string>, channelName: string, format?: string, options?: DisplayHistoryOptions): void;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=history-display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-display.d.ts","sourceRoot":"","sources":["../../src/commands/history-display.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,UAAU,qBAAqB;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACzC;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1B,WAAW,EAAE,MAAM,EACnB,MAAM,SAAU,EAChB,OAAO,GAAE,qBAA0B,GAClC,IAAI,CAYN"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayHistoryResults = displayHistoryResults;
|
|
4
|
+
const history_formatters_1 = require("../utils/formatters/history-formatters");
|
|
5
|
+
function displayHistoryResults(messages, users, channelName, format = 'table', options = {}) {
|
|
6
|
+
// conversations.history returns newest-first, so reverse by default.
|
|
7
|
+
const orderedMessages = options.preserveOrder ? [...messages] : [...messages].reverse();
|
|
8
|
+
const formatter = (0, history_formatters_1.createHistoryFormatter)(format);
|
|
9
|
+
formatter.format({
|
|
10
|
+
channelName,
|
|
11
|
+
messages: orderedMessages,
|
|
12
|
+
users,
|
|
13
|
+
permalinks: options.permalinks,
|
|
14
|
+
attachmentPaths: options.attachmentPaths,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=history-display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-display.js","sourceRoot":"","sources":["../../src/commands/history-display.ts"],"names":[],"mappings":";;AASA,sDAkBC;AA1BD,+EAAgF;AAQhF,SAAgB,qBAAqB,CACnC,QAAmB,EACnB,KAA0B,EAC1B,WAAmB,EACnB,MAAM,GAAG,OAAO,EAChB,UAAiC,EAAE;IAEnC,qEAAqE;IACrE,MAAM,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;IAExF,MAAM,SAAS,GAAG,IAAA,2CAAsB,EAAC,MAAM,CAAC,CAAC;IACjD,SAAS,CAAC,MAAM,CAAC;QACf,WAAW;QACX,QAAQ,EAAE,eAAe;QACzB,KAAK;QACL,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,eAAe,EAAE,OAAO,CAAC,eAAe;KACzC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export declare function validateMessageCount(value: string | undefined, command: Command): number | undefined;
|
|
3
|
+
export declare function validateDateFormat(value: string | undefined, command: Command): string | undefined;
|
|
4
|
+
export declare function prepareSinceTimestamp(since: string | undefined): string | undefined;
|
|
5
|
+
//# sourceMappingURL=history-validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-validators.d.ts","sourceRoot":"","sources":["../../src/commands/history-validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,OAAO,EAAE,OAAO,GACf,MAAM,GAAG,SAAS,CAapB;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,OAAO,EAAE,OAAO,GACf,MAAM,GAAG,SAAS,CAWpB;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAQnF"}
|