agent-slack 0.2.12

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Stably
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,247 @@
1
+ # agent-slack
2
+
3
+ Slack automation CLI for AI agents (TypeScript + Bun).
4
+
5
+ Guiding principle:
6
+
7
+ - **token-efficient output by default** (compact JSON, minimal duplication, and empty/null fields pruned) so LLMs can consume results cheaply.
8
+ - **zero-config auth** -- Auth just works if you have Slack Desktop (with fallbacks available). No Python dependency.
9
+
10
+ ## At a glance
11
+
12
+ - **Read**: fetch a message, detect threads, list full threads
13
+ - **Search**: messages + files (with filters)
14
+ - **Artifacts**: auto-download snippets/images/files to local paths for agents
15
+ - **Write**: reply in thread, add reactions
16
+ - **Canvas**: fetch Slack canvases as Markdown
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ curl -fsSL https://raw.githubusercontent.com/stablyai/agent-slack/master/install.sh | sh
22
+ ```
23
+
24
+ ## Agent skill
25
+
26
+ This repo ships an agent skill at `skills/agent-slack/` compatible with Claude Code, Codex, Cursor, etc
27
+
28
+ **Install via [skills.sh](https://skills.sh)** (recommended):
29
+
30
+ ```bash
31
+ npx skills add stablyai/agent-slack
32
+ ```
33
+
34
+ <details>
35
+ <summary>Manual installation</summary>
36
+ ```bash
37
+ bash ./scripts/install-skill.sh
38
+ ```
39
+ </details>
40
+
41
+ ## Command map (high level)
42
+
43
+ ```text
44
+ agent-slack
45
+ ├── auth
46
+ │ ├── whoami
47
+ │ ├── test
48
+ │ ├── import-desktop
49
+ │ ├── import-chrome
50
+ │ └── parse-curl
51
+ ├── message
52
+ │ ├── get <target> # fetch 1 message (+ thread meta )
53
+ │ ├── list <target> # fetch full thread
54
+ │ ├── send <target> <text> # send / reply (does the right thing)
55
+ │ └── react
56
+ │ ├── add <target> <emoji>
57
+ │ └── remove <target> <emoji>
58
+ ├── user
59
+ │ ├── list
60
+ │ └── get <user>
61
+ ├── search
62
+ │ ├── all <query> # messages + files
63
+ │ ├── messages <query>
64
+ │ └── files <query>
65
+ └── canvas
66
+ └── get <canvas-url-or-id> # canvas → markdown
67
+ ```
68
+
69
+ Notes:
70
+
71
+ - Output is **always JSON** and aggressively pruned (`null`/empty fields removed).
72
+ - Attached files are auto-downloaded and returned as absolute local paths.
73
+
74
+ ## Authentication (no fancy setup)
75
+
76
+ On macOS, authentication happens automatically:
77
+
78
+ - Default: reads Slack Desktop local data (no need to quit Slack)
79
+ - Fallback: if that fails, tries Chrome extraction (if Slack is open in Chrome)
80
+
81
+ You can also run manual imports:
82
+
83
+ ```bash
84
+ agent-slack auth whoami
85
+ agent-slack auth import-desktop
86
+ agent-slack auth import-chrome
87
+ agent-slack auth test
88
+ ```
89
+
90
+ Alternatively, set env vars:
91
+
92
+ ```bash
93
+ export SLACK_TOKEN="xoxc-..." # browser token
94
+ export SLACK_COOKIE_D="xoxd-..." # cookie d
95
+ agent-slack auth test
96
+ ```
97
+
98
+ Or use a standard Slack token (xoxb/xoxp):
99
+
100
+ ```bash
101
+ export SLACK_TOKEN="xoxb-..."
102
+ agent-slack auth test
103
+ ```
104
+
105
+ ## Targets: URL or channel
106
+
107
+ `message get` / `message list` accept either a Slack message URL or a channel reference:
108
+
109
+ - URL: `https://workspace.slack.com/archives/<channel>/p<digits>[?thread_ts=...]`
110
+ - Channel: `#general` (or bare `general`) or a channel ID like `C0123...`
111
+
112
+ In practice:
113
+
114
+ ```bash
115
+ # Get a single message by channel + ts
116
+ agent-slack message get "#general" --ts "1770165109.628379"
117
+
118
+ # List a full thread by channel + thread root ts
119
+ agent-slack message list "#general" --thread-ts "1770165109.000001"
120
+ ```
121
+
122
+ If you have multiple workspaces configured and you use a channel **name** (`#channel` / `channel`), you must pass `--workspace` (or set `SLACK_WORKSPACE_URL`):
123
+
124
+ ```bash
125
+ agent-slack message get "#general" --workspace "https://stablygroup.slack.com" --ts "1770165109.628379"
126
+ ```
127
+
128
+ ## Examples
129
+
130
+ > [!TIP]
131
+ > You should probably just use the skill for your agent instead of reading below.
132
+
133
+ ### Read messages / threads
134
+
135
+ ```bash
136
+ # Single message (+ thread summary if threaded)
137
+ agent-slack message get "https://workspace.slack.com/archives/C123/p1700000000000000"
138
+
139
+ # Full thread for a message
140
+ agent-slack message list "https://workspace.slack.com/archives/C123/p1700000000000000"
141
+ ```
142
+
143
+ Optional:
144
+
145
+ ```bash
146
+ # Include reactions + which users reacted
147
+ agent-slack message get "https://workspace.slack.com/archives/C123/p1700000000000000" --include-reactions
148
+ ```
149
+
150
+ ### Message get vs list
151
+
152
+ **`message get`** fetches a single message. If the message is in a thread, it also returns thread metadata (reply count, participants) but **not** the full thread contents:
153
+
154
+ ```json
155
+ {
156
+ "message": { "ts": "...", "text": "...", "user": "U123", ... },
157
+ "thread": { "replyCount": 5, "participants": ["U123", "U456"] }
158
+ }
159
+ ```
160
+
161
+ **`message list`** fetches all messages in a thread (or channel history if no thread). Use this when you need the full conversation:
162
+
163
+ ```json
164
+ {
165
+ "messages": [
166
+ { "ts": "...", "text": "...", "user": "U123", ... },
167
+ { "ts": "...", "text": "...", "user": "U456", ... }
168
+ ]
169
+ }
170
+ ```
171
+
172
+ When to use which:
173
+
174
+ - Use `get` to check a single message or see if there's a thread worth expanding
175
+ - Use `list` to read an entire thread conversation
176
+
177
+ ### Files (snippets/images/attachments)
178
+
179
+ `message get/list` auto-download attached files to an agent-friendly temp directory and return absolute paths in `message.files[].path`:
180
+
181
+ - macOS default: `~/.agent-slack/tmp/downloads/`
182
+
183
+ Agents can read those paths directly (e.g. snippets as `.txt`, images as `.png`).
184
+
185
+ ### Search (messages + files)
186
+
187
+ ```bash
188
+ # Search both messages and files
189
+ agent-slack search all "smoke tests failed" --channel "#alerts" --after 2026-01-01 --before 2026-02-01
190
+
191
+ # Search messages only
192
+ agent-slack search messages "stably ai" --user "@stablyai" --channel general
193
+
194
+ # Search files only (downloads files and returns local paths)
195
+ agent-slack search files "testing" --content-type snippet --limit 10
196
+ ```
197
+
198
+ Tips:
199
+
200
+ - For reliable results, include `--channel ...` (channel-scoped search scans history/files and filters locally).
201
+ - Use `--workspace https://...slack.com` when using `#channel` names across multiple workspaces.
202
+
203
+ <!-- AI search (assistant.search.*) is described in design.doc but not currently implemented. -->
204
+
205
+ ### Users
206
+
207
+ ```bash
208
+ # List users (email requires appropriate Slack scopes; fields are pruned if missing)
209
+ agent-slack user list --workspace "https://workspace.slack.com" --limit 200 | jq .
210
+
211
+ # Get one user by id or handle
212
+ agent-slack user get U12345678 --workspace "https://workspace.slack.com" | jq .
213
+ agent-slack user get "@alice" --workspace "https://workspace.slack.com" | jq .
214
+ ```
215
+
216
+ ### Fetch a Canvas as Markdown
217
+
218
+ ```bash
219
+ agent-slack canvas get "https://workspace.slack.com/docs/T123/F456"
220
+ agent-slack canvas get "F456" --workspace "https://workspace.slack.com"
221
+ ```
222
+
223
+ ## Developing / Contributing
224
+
225
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
226
+
227
+ ---
228
+
229
+ <p align="center">
230
+ <a href="https://stably.ai">
231
+ <img src="https://public-artifacts.stably.ai/logo-white-with-bg.png" height="96" alt="Stably">
232
+ </a>
233
+ </p>
234
+
235
+ <h3 align="center">
236
+ <a href="https://stably.ai">Stably</a>
237
+ </h3>
238
+
239
+ <p align="center">
240
+ Code. Ship. <s>Test.</s>
241
+ </p>
242
+
243
+ <p align="center">
244
+ <a href="https://docs.stably.ai/"><strong>Documentation</strong></a> ·
245
+ <a href="https://stably.ai/"><strong>Homepage</strong></a>
246
+ </p>
247
+ <br/>
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "../dist/index.js";