slack-term 1.55.2 → 1.57.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/README.md +30 -715
- package/SKILL.md +9 -9
- package/dist/cli.js +276 -273
- package/locales/en.json +1 -1
- package/locales/ja.json +1 -1
- package/package.json +5 -5
- package/ts/ask.ts +3 -2
- package/ts/askPush.ts +5 -4
- package/ts/auth.ts +8 -8
- package/ts/brand.ts +46 -0
- package/ts/chromeCookieWin.ts +12 -12
- package/ts/cli.ts +55 -33
- package/ts/identity.ts +23 -12
- package/ts/inbox.ts +1 -1
- package/ts/locales.ts +1 -1
- package/ts/profiles.ts +10 -9
- package/ts/redact.ts +1 -1
- package/ts/relay.ts +5 -3
- package/ts/relayInit.ts +15 -15
- package/ts/scope.ts +23 -20
- package/ts/sentlog.ts +12 -10
- package/ts/stream.ts +1 -1
- package/worker/README.md +10 -10
- package/worker/src/hub.ts +6 -2
- package/worker/src/index.ts +4 -3
package/README.md
CHANGED
|
@@ -1,729 +1,44 @@
|
|
|
1
|
-
# slack
|
|
1
|
+
# slack-term → renamed to **slack-hub**
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
(
|
|
6
|
-
|
|
3
|
+
This package is **deprecated**. The project is now published as
|
|
4
|
+
[`slack-hub`](https://www.npmjs.com/package/slack-hub)
|
|
5
|
+
([GitHub](https://github.com/snomiao/slack-hub)). Every release is still
|
|
6
|
+
mirrored here under the old name, but new installs should use `slack-hub`.
|
|
7
7
|
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
- **News** — Activity feed showing recent mentions (`to:me`), grouped by day with human-readable timestamps
|
|
11
|
-
- **Messages** — Browse recent messages across joined channels
|
|
12
|
-
- **Tail** — Stream new messages from a channel in real time (like `tail -f`)
|
|
13
|
-
- **Search** — Full-text search across the workspace
|
|
14
|
-
- **Send** — Send messages to channels, DMs, or threads with a confirm-hash safety gate (prevents accidental sends); targeting a message permalink replies in that message's thread
|
|
15
|
-
- **Edit / Delete** — Rewrite or remove a sent message, guarded by the same confirm-hash gate
|
|
16
|
-
- **React** — Add or remove an emoji reaction — a lightweight ack that doesn't grow the thread
|
|
17
|
-
- **Dump** — Bulk-export channel history as markdown
|
|
18
|
-
|
|
19
|
-
### Output formatting
|
|
20
|
-
|
|
21
|
-
- DM channels display as `@DisplayName`, public channels as `#channel-name`
|
|
22
|
-
- Slack `<@UID>` mention tokens are resolved to display names
|
|
23
|
-
- Slack `<!date^...>` markup is rendered as human-readable dates
|
|
24
|
-
- Messages are grouped by day (Today / Yesterday / weekday)
|
|
25
|
-
|
|
26
|
-
## Comparison with other Slack tools
|
|
27
|
-
|
|
28
|
-
`slack-term` focuses on everyday workspace interaction through shell commands:
|
|
29
|
-
read, search, reply, and coordinate work from a terminal or an agent script.
|
|
30
|
-
The alternatives below serve different workflows; links point to their upstream
|
|
31
|
-
documentation.
|
|
32
|
-
|
|
33
|
-
| Tool | Main workflow | How it compares with this project |
|
|
34
|
-
| --- | --- | --- |
|
|
35
|
-
| **`slack-term` (this project)** | Workspace messaging and automation | TypeScript and Rust implementations; explicit user-token setup; message previews and confirm codes for `send`, `edit`, and `delete`; `ask` waits for answers and `todo` tracks tasks through reactions. |
|
|
36
|
-
| [`slkcli`](https://github.com/therohitdas/slkcli) | Slack commands for macOS users and agents | Extracts credentials from the Slack desktop app for convenient onboarding. This project offers an explicit-token setup suitable for other platforms, at the cost of configuring an app and scopes. |
|
|
37
|
-
| [Official Slack CLI](https://docs.slack.dev/tools/slack-cli/) | Building, running, and deploying Slack apps | Choose it for Slack app development. This project's commands focus on interacting with messages in an existing workspace. |
|
|
38
|
-
| [Go `slack-term`](https://github.com/jpbruinsslot/slack-term) | Interactive terminal chat | Provides a full-screen terminal client. This project uses individual shell commands, which fit scripts and quick queries. The two projects are unrelated despite sharing a name. |
|
|
39
|
-
| [`wee-slack`](https://github.com/wee-slack/wee-slack) | Slack inside WeeChat | Offers ongoing chat with threads, reactions, and synchronized read markers. Choose it if you already use WeeChat; this project runs as a standalone CLI. |
|
|
40
|
-
| [`slackcat`](https://github.com/bcicen/slackcat) | Posting files and piped command output | Focuses on sending stdin, files, and streaming logs to Slack. This project also covers reading, searching, and following conversations. |
|
|
41
|
-
| [`slackdump`](https://github.com/rusq/slackdump) | Archiving and exporting Slack data | Offers dedicated archives, export formats, and a local viewer. This project's `dump` provides markdown history exports alongside everyday messaging commands. |
|
|
42
|
-
|
|
43
|
-
Choose this project when you want **scriptable conversations with a preview before
|
|
44
|
-
sending**. The confirmation step adds an extra invocation, and token setup requires
|
|
45
|
-
the appropriate Slack scopes. Reactions are immediate and do not use the confirm
|
|
46
|
-
gate. For a persistent chat UI or a dedicated archive, the specialized tools above
|
|
47
|
-
may be a better fit.
|
|
48
|
-
|
|
49
|
-
## Installation
|
|
50
|
-
|
|
51
|
-
### TypeScript (npm, recommended)
|
|
52
|
-
|
|
53
|
-
One package, no native binaries, any platform with Node 18+.
|
|
54
|
-
|
|
55
|
-
```sh
|
|
56
|
-
npm install -g slack-term
|
|
57
|
-
# or: bun add -g slack-term | pnpm add -g slack-term
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
> **Note:** Previously published as `@snomiao/slack` (now deprecated).
|
|
61
|
-
|
|
62
|
-
### Rust (cargo)
|
|
63
|
-
|
|
64
|
-
```sh
|
|
65
|
-
cargo install --path rs
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Both expose the same `slack` command.
|
|
69
|
-
|
|
70
|
-
## Usage
|
|
71
|
-
|
|
72
|
-
```sh
|
|
73
|
-
# Activity feed (mentions directed to you)
|
|
74
|
-
slack news
|
|
75
|
-
slack news --limit 5
|
|
76
|
-
|
|
77
|
-
# Recent messages across joined channels
|
|
78
|
-
slack msgs
|
|
79
|
-
|
|
80
|
-
# Channel/DM history. Thread parents are marked `[+N replies]`, so a line with
|
|
81
|
-
# replies is distinguishable from one without — open it with `slack thread`.
|
|
82
|
-
# --json adds reply_count / reply_users_count / latest_reply.
|
|
83
|
-
slack read "#general"
|
|
84
|
-
slack read "#general" --unreplied # only threads/posts whose last word isn't yours
|
|
85
|
-
|
|
86
|
-
# Search messages
|
|
87
|
-
slack search "deploy"
|
|
88
|
-
slack search "deploy" --count 50
|
|
89
|
-
|
|
90
|
-
# Send a message (two-step confirm — quote #channel)
|
|
91
|
-
slack send "#general" "Hello team"
|
|
92
|
-
# Prints who you're acting as (From: @handle (Uxxxx) — Workspace) + a destination
|
|
93
|
-
# preview + confirm code; rerun with --code=<code> to actually send. Every gated write
|
|
94
|
-
# (send/edit/delete/upload/schedule/channel create/rename/lists/drafts) shows that From: line and
|
|
95
|
-
# binds it into the code, so a profile switch mid-flow invalidates it instead of acting
|
|
96
|
-
# as the wrong account.
|
|
97
|
-
slack send "#general" "Hello team" --code=<code>
|
|
98
|
-
|
|
99
|
-
# send/edit/ask refuse ambiguous bare URLs such as https://example.com/path/内容.
|
|
100
|
-
# Put the URL on its own line or use <https://example.com/path/> (or <url|label>).
|
|
101
|
-
# Intentional Unicode URLs should also be wrapped. --allow-url-adjacent warns only;
|
|
102
|
-
# the normal confirmation code is still required.
|
|
103
|
-
|
|
104
|
-
# Reply in a thread — #chan:<thread_ts>, or just paste a message permalink
|
|
105
|
-
slack send "#general:1700000000.000100" "Replying in thread"
|
|
106
|
-
slack send "https://acme.slack.com/archives/C0123456789/p1700000000000100" "Replying in thread"
|
|
107
|
-
|
|
108
|
-
# @handle tokens are auto-converted to real <@USERID> mentions (on by default; also on `edit`).
|
|
109
|
-
# Resolves via users.list, then the channel's members so Slack Connect guests work;
|
|
110
|
-
# any handle that can't be resolved is left as plain text. The confirm preview shows
|
|
111
|
-
# the converted message before sending. Use --no-mentions to keep @text literal.
|
|
112
|
-
slack send "#general" "thanks @t.yamada19850101 and @alice"
|
|
113
|
-
slack send "#general" "ping @ops on call" --no-mentions # leave @ops as plain text
|
|
114
|
-
|
|
115
|
-
# Edit or delete a sent message (same confirm-code gate)
|
|
116
|
-
slack edit "<permalink>" "fixed wording"
|
|
117
|
-
slack delete "<permalink>"
|
|
118
|
-
|
|
119
|
-
# React instead of replying for a simple ack — keeps the thread tidy (no confirm gate)
|
|
120
|
-
# 👀 seen ✅ done ⏳ working on it — target is the #chan:<ts> / permalink form
|
|
121
|
-
slack react "#general:1700000000.000100" white_check_mark
|
|
122
|
-
slack react "<permalink>" eyes --remove # take a reaction back
|
|
123
|
-
|
|
124
|
-
# Ask a question with its choices pre-seeded as 1️⃣..🔟 reactions — answering is
|
|
125
|
-
# one tap on an existing pill, no emoji picker. Same two-step confirm gate as send.
|
|
126
|
-
# A ➕ "その他 (other)" pill always follows the choices: pressing it means "none of
|
|
127
|
-
# these" and the answer comes as a reply (exit 5), not as the ➕ itself. (Pills posted
|
|
128
|
-
# before ➕ carry ❓ there; they are still read, collected and voided the same way.)
|
|
129
|
-
# --explain (or SLACK_TERM_ASK_EXPLAIN=1) adds an ℹ️ "説明して (explain)" pill after ➕:
|
|
130
|
-
# pressing it asks YOU to explain in the thread and is never an answer — the question
|
|
131
|
-
# stays open. --wait/--waitFor say so on stderr and may post ONE thread note (once per
|
|
132
|
-
# question) saying an explanation is coming; --explain-exit makes that exit 7.
|
|
133
|
-
# --pending only reports a ℹ️ press — it posts nothing.
|
|
134
|
-
# The instructions are posted in ja or en: --lang / SLACK_TERM_LANG, else the
|
|
135
|
-
# answerers' Slack locale, else the question's own language, else $LANG, else ja.
|
|
136
|
-
slack ask "@bob" "本番に出してよい?" "出してよい" "待って"
|
|
137
|
-
# --wait blocks until answered and prints ONLY the answer on stdout, so it composes:
|
|
138
|
-
ANS=$(slack ask "@bob" "本番に出してよい?" "出してよい" "待って" --code=<code> --wait)
|
|
139
|
-
# exit 0 = answered, 2 = timed out (--timeout, default 3600s), 3 = transport failure,
|
|
140
|
-
# 4 = a reply matched several choices, 6 = the question was voided, 5 = a free-text reply that picked NO choice —
|
|
141
|
-
# the reply text is on stdout, it is not a decision, and the question stays open.
|
|
142
|
-
#
|
|
143
|
-
# The question must say WHO may answer — only their reaction/reply is taken as the
|
|
144
|
-
# answer, so a bystander can't decide it for them. `ask` refuses to post otherwise.
|
|
145
|
-
slack ask "#eng" "@alice この PR 出してよい?" "出す" "待つ" # only alice's answer counts
|
|
146
|
-
slack ask "#eng" "@here 誰か見れる?" "見る" "あとで" # anyone in #eng; real broadcast
|
|
147
|
-
# (In a 1:1 DM the other party counts automatically — no tag needed.)
|
|
148
|
-
# A tag that resolves to no one (no match, ambiguous, or the user list could not be read)
|
|
149
|
-
# refuses the ask rather than dropping that answerer. With --as-bot, @tags and an
|
|
150
|
-
# @user destination resolve with the bot token (it needs users:read).
|
|
151
|
-
#
|
|
152
|
-
# With no choices the question asks for a free-text reply and the reply is the answer.
|
|
153
|
-
# In a DM a plain reply counts; in a channel only reactions and thread replies do.
|
|
154
|
-
# Once answered, the question is edited to "✅ …回答済み > <answer>" — the body/background
|
|
155
|
-
# and the CHOSEN option line stay; the other options, ➕ line and instructions go. The
|
|
156
|
-
# unpressed seeds are removed, leaving the chosen pill visible.
|
|
157
|
-
#
|
|
158
|
-
# Thread notes (audience replies that are not the answer, even after ✅) go to
|
|
159
|
-
# stderr; --json puts {answer, notes[], cursor} on stdout. Feed cursor back as --after:
|
|
160
|
-
# slack ask --waitFor='<permalink>' --timeout 0 --json --after=<cursor>
|
|
161
|
-
#
|
|
162
|
-
# Retire a question that expired / stopped meaning anything (無効化) — waits on it exit 6:
|
|
163
|
-
# slack ask --void='<permalink>' --reason 'head moved' --superseded-by '<new permalink>'
|
|
164
|
-
# Change one: slack ask --edit='<permalink>' ["new question" [choices…]] [--body …]
|
|
165
|
-
# (options only while unanswered; after that: --void='<permalink>' --reask …)
|
|
166
|
-
# List mine with live state: slack ask --ls [--stale 24h] [--state all] [--json]
|
|
167
|
-
# (`slack edit` refuses an edit that would break an ask/poll; --force overrides.)
|
|
168
|
-
#
|
|
169
|
-
# WITHOUT --wait, stdout is the command that collects the answer later:
|
|
170
|
-
RESUME=$(slack ask "@bob" "本番に出してよい?" "出してよい" "待って" --code=<code>)
|
|
171
|
-
# -> slack ask --waitFor='https://acme.slack.com/archives/C00000001/p1700000000000100'
|
|
172
|
-
# Run it whenever you like: it re-reads the question from Slack, so nothing is
|
|
173
|
-
# stored locally and any machine holding the link can collect. Same stdout/exit
|
|
174
|
-
# contract as --wait, plus --timeout 0 = check once (exit 2 while still open, 5 with
|
|
175
|
-
# the reply on stdout if somebody wrote free text instead of choosing; re-wait past
|
|
176
|
-
# it with --after=<reply ts>),
|
|
177
|
-
# which is what a periodic monitor should use instead of parking on --wait.
|
|
178
|
-
eval "$RESUME --timeout 0" && echo answered
|
|
179
|
-
# A pressed pill is invisible to `slack tail` (it only sees `type: "message"`
|
|
180
|
-
# events and drops `message_changed`), so this is the only way to hear about an
|
|
181
|
-
# answer to a question you did not block on.
|
|
182
|
-
#
|
|
183
|
-
# Answered but never collected? Asks from THIS machine (local sent-log) whose pill was
|
|
184
|
-
# pressed, or that got a reply, while nobody was waiting — grouped by the asking
|
|
185
|
-
# session, with whether that agent is still alive and the --waitFor line that
|
|
186
|
-
# collects each. Read-only: collecting (that line) is what takes it off the list.
|
|
187
|
-
# Never blocks: no waiting out rate limits — a throttled pass says what it skipped.
|
|
188
|
-
slack ask --pending # last 7 days; --since 2h, --channel, --json
|
|
189
|
-
# Push instead of waiting to be asked: each answer goes to the agent that asked
|
|
190
|
-
# (`ay send` to its pid from the sent-log, or a parent ay knows), then a decision
|
|
191
|
-
# is collected (✅, off the list); a free-text reply is pushed once and the
|
|
192
|
-
# question stays open. A gone asker's answer goes to the newest live agent in the
|
|
193
|
-
# same directory (a restarted lane); with none, it stays listed.
|
|
194
|
-
slack ask --pending --push
|
|
195
|
-
# The sweep: answers that have reached nobody yet.
|
|
196
|
-
slack ask --pending --undelivered
|
|
197
|
-
# As a service: a pass every --interval (min), and one per question as soon as
|
|
198
|
-
# the relay rings for it (SLACK_RELAY_URL / SLACK_RELAY_TOKEN: a reaction on it
|
|
199
|
-
# or a reply in its thread). Prints only what it pushed.
|
|
200
|
-
slack ask --pending --push --watch --interval 10
|
|
201
|
-
|
|
202
|
-
# Who sent what: every send/ask/poll/edit is logged locally with its sender —
|
|
203
|
-
# pid, cwd, git branch, agent CLI and session id — and the same attribution rides
|
|
204
|
-
# along as invisible Slack message metadata (event_type `slack_term_sent`).
|
|
205
|
-
slack sent # newest first, sender on its own line
|
|
206
|
-
slack sent "deploy" --since 2h --kind ask # substring of the text
|
|
207
|
-
slack sent --session 4f1c --cwd ~/ws/app --json
|
|
208
|
-
# Log: ~/.config/slack-cli/sent.sqlite (SLACK_TERM_SENT_DB overrides).
|
|
209
|
-
# Opt out of both with SLACK_TERM_ATTRIBUTION=off. Agent CLIs other than Claude
|
|
210
|
-
# Code are found by process name; set SLACK_TERM_AGENT_SESSION / _CLI / _PID to
|
|
211
|
-
# name the session explicitly.
|
|
212
|
-
|
|
213
|
-
# Task tracking on top of reactions — :pushpin: marks a message as a task,
|
|
214
|
-
# a second reaction carries its progress (see "todo" below)
|
|
215
|
-
slack todo ls # my open tasks
|
|
216
|
-
slack todo ls --state untriaged --in "#general"
|
|
217
|
-
slack todo set "#general:1700000000.000100" doing
|
|
218
|
-
slack todo flag "<permalink>" blocked
|
|
219
|
-
slack todo doctor --in "#general" # find messages stuck in two states
|
|
220
|
-
|
|
221
|
-
# Bulk export channel history
|
|
222
|
-
slack dump --days 7 --filter eng
|
|
223
|
-
|
|
224
|
-
# Stream new messages in real time (Ctrl-C to stop)
|
|
225
|
-
slack tail "#general"
|
|
226
|
-
slack tail "#general" --since=10m # backfill last 10 minutes first
|
|
227
|
-
slack tail "#general" --thread=<ts> # follow a single thread
|
|
228
|
-
slack tail "#general" --me # only messages that mention you
|
|
229
|
-
slack tail "@bob" --exit-on-message --timeout 30m # wait for a reply, then exit
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### todo — task tracking on reactions
|
|
233
|
-
|
|
234
|
-
Tasks are just messages. A **marker** reaction (📌 `:pushpin:`) says "this is a task";
|
|
235
|
-
a **progress** reaction says where it stands; **reason flags** stack on top:
|
|
236
|
-
|
|
237
|
-
| axis | reaction | meaning |
|
|
238
|
-
| --- | --- | --- |
|
|
239
|
-
| progress 1 | ✅ `white_check_mark` | done |
|
|
240
|
-
| progress 2 | 🚫 `no_entry_sign` | dropped |
|
|
241
|
-
| progress 3 | 👀 `eyes` | doing |
|
|
242
|
-
| progress 4 | ⏳ `hourglass_flowing_sand` | pending |
|
|
243
|
-
| progress 5 | *(marker only)* | undefined / untriaged |
|
|
244
|
-
| flag | ❗ `exclamation` | alert |
|
|
245
|
-
| flag | ❓ `question` | needs discussion |
|
|
246
|
-
| flag | 💬 `speech_balloon` | waiting — the other party in this conversation owes a reply |
|
|
247
|
-
| flag | 🔒 `lock` | blocked — stuck on something *outside* this conversation |
|
|
248
|
-
|
|
249
|
-
The invariant is **"at least one progress reaction, readers collapse by priority"** —
|
|
250
|
-
not "exactly one". A message carrying both ✅ and 👀 reads as *done*.
|
|
251
|
-
|
|
252
|
-
**Whose ball is it?** There are only three answers, and `pending` ⏳ already means *mine*.
|
|
253
|
-
The other two are the flags:
|
|
254
|
-
|
|
255
|
-
- 💬 **waiting** — I've done my part; someone **in this conversation** owes the next move
|
|
256
|
-
(I asked a question, I'm waiting on a review, I sent it and need a yes/no).
|
|
257
|
-
- 🔒 **blocked** — the hold-up is **outside this conversation**: another task, a third
|
|
258
|
-
party, an external dependency, a deploy window.
|
|
259
|
-
|
|
260
|
-
They stack with each other and with ❗/❓; `--state stuck` matches a task with any of them.
|
|
261
|
-
|
|
262
|
-
```sh
|
|
263
|
-
# Two listings, split by whose reactions count — the distinction is the command,
|
|
264
|
-
# not a flag, so "everyone's list" and "my list" can't be confused at a glance.
|
|
265
|
-
slack todo ls # EVERYONE's tasks (has:)
|
|
266
|
-
slack mytodo ls # only tasks YOU reacted to (hasmy:)
|
|
267
|
-
|
|
268
|
-
slack todo ls --state untriaged # marked, no progress reaction yet
|
|
269
|
-
slack todo ls --state doing --in "#eng" # scoped to a channel
|
|
270
|
-
slack mytodo ls --state stuck # my unfinished tasks carrying a reason flag
|
|
271
|
-
slack todo ls --state stuck --from "@alice" # …and it was alice who wrote it
|
|
272
|
-
slack todo ls --from me # tasks on my own messages (any reactor)
|
|
273
|
-
slack todo ls --mine # same as `slack mytodo ls`
|
|
274
|
-
slack todo set "#eng:1700000000.000100" doing
|
|
275
|
-
slack todo flag "<permalink>" waiting # their ball now
|
|
276
|
-
slack todo flag "<permalink>" needs-discussion
|
|
277
|
-
slack todo flag "<permalink>" blocked --remove
|
|
278
|
-
slack todo doctor --in "#eng" # report messages in two progress states
|
|
279
|
-
slack todo doctor --in "#eng" --fix # keep the highest-priority one
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
Notes:
|
|
283
|
-
|
|
284
|
-
- **`todo ls` vs `mytodo ls`** — `todo ls` matches anyone's reactions (`has:`), `mytodo ls`
|
|
285
|
-
only your own (`hasmy:`). Everything else about them is identical. Both print a
|
|
286
|
-
`From: @handle (Uxxxx) — Workspace` line first, because `hasmy:` resolves against
|
|
287
|
-
whichever account the token belongs to — "my tasks" means nothing until you know who
|
|
288
|
-
*my* is, and a stale profile otherwise lists someone else's list without saying so.
|
|
289
|
-
(`todo ls --mine` is a one-off shortcut to the narrow view.)
|
|
290
|
-
- Both are read-only and run **exactly one** `search.messages` call — priority is expressed
|
|
291
|
-
as negated `has:`/`hasmy:` terms in the query, not as multiple searches
|
|
292
|
-
(`search.messages` is Tier 2, ~20 req/min). Slack's search index lags a little
|
|
293
|
-
behind `reactions.add`, so a just-set task may take a moment to appear.
|
|
294
|
-
- `todo set` **adds the new reaction before removing the old ones**, and removes serially.
|
|
295
|
-
The reverse order would leave a window with no progress reaction at all — a crash or a
|
|
296
|
-
429 there would drop the task out of every query with nothing left pointing at it.
|
|
297
|
-
Worst case here is a message with two progress reactions, which reads correctly and is
|
|
298
|
-
repairable with `todo doctor --fix`.
|
|
299
|
-
- `--from <@user|me>` maps to search's `from:` modifier (a missing `@` is supplied; `me`
|
|
300
|
-
passes through as-is). Reactions carry no reference to *whom* a task waits on, but the
|
|
301
|
-
sender is usually that person — so filtering by author answers most of the question for
|
|
302
|
-
free. It composes with `--in` in the same single search.
|
|
303
|
-
- **Not implemented, deliberately:** encoding the actual reference ("blocked on @alice" /
|
|
304
|
-
"blocked on task X") as a machine-readable token in a thread reply. Measured: Slack's
|
|
305
|
-
full-text index splits on punctuation, so a quoted search for `"blocked-on"` returns 0
|
|
306
|
-
hits, and `"1.91"` matches `1.91.0`. A token like `todo:v1 blocked-on=@alice` is therefore
|
|
307
|
-
unsearchable. Any future attempt needs a single alphanumeric marker word (e.g. `tdblock`)
|
|
308
|
-
plus a bare `@mention`.
|
|
309
|
-
- `todo doctor` pages history sequentially and scans at most `--limit` messages
|
|
310
|
-
(default 1000); if it hits the limit it says so rather than silently stopping.
|
|
311
|
-
- Emoji are configurable in `~/.config/slack-cli/todo.json` (same directory as
|
|
312
|
-
`profiles.json`); anything omitted falls back to the defaults above:
|
|
313
|
-
|
|
314
|
-
```json
|
|
315
|
-
{ "marker": "round_pushpin", "progress": { "doing": "construction" } }
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
- Channel-name→ID and user-ID→handle lookups are cached in
|
|
319
|
-
`~/.config/slack-cli/cache.json` for 1 hour, namespaced by workspace (`team_id`) since
|
|
320
|
-
both are workspace-scoped; `--no-cache` bypasses it. Reaction state and search results
|
|
321
|
-
are **never** cached — they are exactly the values that change, and Slack's search index
|
|
322
|
-
already lags. A corrupt or unwritable cache is ignored and the command runs uncached.
|
|
323
|
-
|
|
324
|
-
### .slack-term/ — aliases and settings per directory
|
|
325
|
-
|
|
326
|
-
`slack init` makes a `.slack-term/` in the current directory. `slack` uses the nearest one walking up from where it runs, like `.git`. So each repo, or each agent lane's `tree/<lane>`, has its own aliases and reply prefix, with no pid or env var needed. Without one, it uses `~/.config/slack-term/`. The dir holds a `.gitignore` of `*`, so nothing in it is committed.
|
|
8
|
+
## Migrate
|
|
327
9
|
|
|
328
10
|
```sh
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
slack
|
|
332
|
-
slack read board # the thread
|
|
333
|
-
slack reply board 'done' # posts "[design] done" in it, behind the --code gate
|
|
334
|
-
slack reply --to <permalink> 'on it' # replies in the thread where that message is
|
|
335
|
-
slack reply board 'on it' --to <permalink> # exit 2 when that message is in another thread (--any-thread overrides)
|
|
336
|
-
slack send '#chan:<ts>' 'x' --to <permalink> # the same check on send
|
|
337
|
-
slack alias unset board
|
|
338
|
-
slack tick <permalink> 2 # ⬜ 2. → ✅ 2. in a posted checklist, nothing else changed
|
|
339
|
-
slack thread C00000001 <ts> --since <ts> --format tsv # <ts> TAB <user|bot id> TAB <escaped text> [files: N], every page
|
|
340
|
-
slack edit <permalink> 'new text' # in a [lane] scope the lane tag the message was posted with is kept
|
|
11
|
+
npm uninstall -g slack-term
|
|
12
|
+
npm install -g slack-hub
|
|
13
|
+
# or: bun remove -g slack-term && bun add -g slack-hub
|
|
341
14
|
```
|
|
342
15
|
|
|
343
|
-
|
|
344
|
-
- **`settings.local.yml`** is written by `slack alias set/unset`, under a lock and with an atomic rename. It has the same keys and overrides `settings.yml`.
|
|
345
|
-
- **The prefix is never doubled.** A text that already starts with `[design] ` (or `[design@host] `) keeps only one.
|
|
346
|
-
- `reply` only posts in threads. Use `send` for a top-level post.
|
|
16
|
+
The command is still `slack`, and your existing setup keeps working:
|
|
347
17
|
|
|
348
|
-
|
|
18
|
+
| Before (slack-term) | Now (slack-hub) | Old one still read? |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `.slack-term/` (per directory) | `.slack-hub/` | yes. An existing `.slack-term/` is found when there is no `.slack-hub/` |
|
|
21
|
+
| `~/.config/slack-term/` | `~/.config/slack-hub/` | yes, when the new one does not exist |
|
|
22
|
+
| `~/.slack-term/.env.local` | `~/.slack-hub/.env.local` | yes, when the new one does not exist |
|
|
23
|
+
| `$XDG_STATE_HOME/slack-term/` | `$XDG_STATE_HOME/slack-hub/` | yes, when the new one does not exist |
|
|
24
|
+
| `SLACK_TERM_*` env vars | `SLACK_HUB_*` | yes. `SLACK_HUB_*` wins when both are set |
|
|
25
|
+
| `slack-term/worker` (relay import) | `slack-hub/worker` | change the import and the dependency |
|
|
26
|
+
| relay subprotocol `slack-term-relay.v1` | `slack-hub-relay.v1` | yes, both directions |
|
|
27
|
+
| message metadata `slack_term_sent` | `slack_hub_sent` | (new messages only) |
|
|
349
28
|
|
|
350
|
-
|
|
351
|
-
- **Redaction:** secrets in the text are replaced with `[redacted:<rule>]` before the entry is written (gitleaks' rules plus ours, `ts/redact.ts`). `slack read <permalink>` fetches the original live.
|
|
352
|
-
- **Handled:** `slack done <file|ts>` moves an entry to `archived/`. So does a reply sent with `outbox add … --in-reply-to <ts>` and then `outbox flush`, which records each sent reply's ts and permalink in `sent/`.
|
|
29
|
+
### If you deployed the relay (`slack relay init`)
|
|
353
30
|
|
|
354
|
-
|
|
355
|
-
slack inbox listen --timeout 3600 --thread <ts> --from U00000001 # one JSON line per new message, filtered
|
|
356
|
-
slack outbox add board 'fixed' --in-reply-to <ts> && slack outbox flush # then flush again with its --code
|
|
357
|
-
slack alias who D00000001 <thread_ts> --json # for a relay: which lane dir owns a thread
|
|
358
|
-
slack alias set t-<ts> <permalink> --shared --dir <lane tree> # the owner adds to a lane's allowlist
|
|
359
|
-
slack alias import allowlist.tsv --channel D00000001 --lane-dir design=~/ws/x/tree/design
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
**Settings only `settings.yml` can hold:** `restrict_to_subscriptions: true`, `auto_subscribe: [<channel>]` and `nudge_after_min` (see `slack inbox nudge`).
|
|
363
|
-
|
|
364
|
-
- With `restrict_to_subscriptions`, only the `settings.yml` subscriptions count. `alias set` without `--shared` refuses, and `reply` and `outbox flush` refuse any other thread.
|
|
365
|
-
- Who the lane posts as (`prefix`, `as_bot`, `channel`) also comes from `settings.yml` only. `--prefix` and a differing `--as-bot` are refused.
|
|
366
|
-
- `owner: <dir>` names the allowlist's owner. `--shared` writes run only from under that directory, and are refused for everyone when no owner is named. Every lane runs as the same uid, so only the CLI can tell them apart.
|
|
367
|
-
- `auto_subscribe` subscribes a new top-level message in that channel to this dir as `t-<ts>`.
|
|
368
|
-
|
|
369
|
-
### Identities — `slack @<who> <command>`
|
|
370
|
-
|
|
371
|
-
When several identities exist (bots and people), name the one a command acts as:
|
|
31
|
+
In your relay folder, replace the dependency and the import:
|
|
372
32
|
|
|
373
33
|
```sh
|
|
374
|
-
slack
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
The names live in `identities:` in `.slack-term/settings.yml` or `~/.config/slack-term/settings.yml`. Each name points to **where** a token lives (an env var, optionally in an env file, or a `slack auth` profile), never the token itself:
|
|
380
|
-
|
|
381
|
-
```yaml
|
|
382
|
-
identities:
|
|
383
|
-
deploy-bot: { kind: bot, env_file: ~/.config/slack-cli/deploy-bot.env } # reads SLACK_BOT_TOKEN from it
|
|
384
|
-
ops-bot: { kind: bot, env_file: ~/.config/slack-cli/ops-bot.env }
|
|
385
|
-
alice: { kind: user, profile: acme }
|
|
34
|
+
npm uninstall slack-term && npm install slack-hub
|
|
35
|
+
sed -i 's#"slack-term/worker"#"slack-hub/worker"#' src/index.ts
|
|
36
|
+
npx wrangler deploy
|
|
386
37
|
```
|
|
387
38
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
- from inside an agent (`AY_AGENT_ID`, `AGENT_YES_PID` or `CLAUDECODE` set);
|
|
391
|
-
- when two or more identities are configured.
|
|
392
|
-
|
|
393
|
-
This closes the trap where an agent's `slack ask` without `--as-bot` was posted as the person.
|
|
394
|
-
|
|
395
|
-
### Language packs (locales/*.json)
|
|
396
|
-
|
|
397
|
-
slack-term's own text (help, errors, logs, hints) is English. Language packs hold only two things: text it posts to **people**, and patterns it looks for in **their** messages.
|
|
398
|
-
|
|
399
|
-
- `ask`'s copy is `ask.*`. It follows the readers' Slack locale, then the question's language, then the system locale, and finally `en`. Keys marked `(WIRE)` are matched back on questions already posted, so never reword them.
|
|
400
|
-
- `choice_patterns` are regexes (flags `iu`). Every pack's patterns are applied, so a "(yes/no)?" question is spotted in any language. `send`/`reply` then print a hint to use `slack ask` instead (a hint only, never a block).
|
|
401
|
-
- Packs are read at call time and cached by mtime, so an edit takes effect on the next command with no rebuild.
|
|
402
|
-
- A `.slack-term/locales/<lang>.json` overrides the package's keys. A new file there adds a language.
|
|
403
|
-
|
|
404
|
-
### pinlog — a pinned status board that keeps a log
|
|
405
|
-
|
|
406
|
-
A **pinlog** is one pinned top-level message that always holds the *current* state
|
|
407
|
-
(HEAD), plus a thread under it with one short reply per change (the log). The HEAD is
|
|
408
|
-
**edited in place, which is silent**; each log reply **notifies**. People who want the
|
|
409
|
-
state read the pin; people who want to know what changed follow the thread. Good for
|
|
410
|
-
anything people come back to: blocker boards, release readiness, incidents — one board
|
|
411
|
-
per topic.
|
|
412
|
-
|
|
413
|
-
```bash
|
|
414
|
-
slack pinlog ls "#gtm" # boards in a channel (found by their footer)
|
|
415
|
-
slack pinlog get <board> # state + log (--json for one object)
|
|
416
|
-
slack pinlog new "#gtm" "販売ブロッカー\n1. 見積テンプレ — 未" ["why this board exists"]
|
|
417
|
-
slack pinlog set <board> "<the WHOLE new state>" "見積テンプレ: 未 → 済"
|
|
418
|
-
slack pinlog set <board> --file board.md "見積テンプレ: 未 → 済" # state from a file (- = stdin)
|
|
419
|
-
slack pinlog note <board> "まだ法務待ち — 再送済" # reason only, state unchanged
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
`<board>` is the board's permalink, `#chan:ts`, or the `C…:ts` id `new` prints. There
|
|
423
|
-
are no names and nothing is stored locally: a board *is* its Slack message, so the same
|
|
424
|
-
command works from any machine. Each verb takes only its own kind of target — `new` and
|
|
425
|
-
`ls` a channel, the rest a board — so a pasted channel can never turn an intended update
|
|
426
|
-
into a second board.
|
|
427
|
-
|
|
428
|
-
- Every HEAD ends with a footer, `_Pinlog · 最終更新 2026-10-08 15:10 JST · 更新はスレッドに_`,
|
|
429
|
-
refreshed on each update. `ls` finds boards by it, and `set` **refuses** a message
|
|
430
|
-
without it, so a wrong link cannot overwrite an ordinary message.
|
|
431
|
-
To turn an existing hand-run board into a pinlog on purpose, pass `set --adopt` once.
|
|
432
|
-
- `new`, `set` and `note` use the same two-step `--code` gate as `send`/`edit`, and the
|
|
433
|
-
preview shows the situation, not just your text: `new` lists boards already in the
|
|
434
|
-
channel (usually a sign you meant `set`), and `set` shows the current state next to
|
|
435
|
-
the new one. The `set` code covers the current state, so if someone else changed the
|
|
436
|
-
board after your preview, your code stops matching and you re-read first.
|
|
437
|
-
- **`set` order:** the state edit first, then the reason reply. If the edit fails, **no**
|
|
438
|
-
reason is posted. If the reply fails, the command exits 1, says the state *is* updated,
|
|
439
|
-
and prints the exact retry (`slack pinlog note <board> '…' --code=…`).
|
|
440
|
-
A failure that *may* have landed (network error, Slack `internal_error`/`fatal_error`)
|
|
441
|
-
is reported as `UNKNOWN`, not `NOT posted`, with the `get`/`ls` command to check
|
|
442
|
-
first, because a blind retry would post a second board or a second notifying reply.
|
|
443
|
-
A HEAD over Slack's 40,000-character limit is refused before posting, because Slack
|
|
444
|
-
would truncate the footer.
|
|
445
|
-
- `new` without the pin scope still creates the board: it says `NOT pinned`, prints
|
|
446
|
-
the `slack pinlog pin <board>` command, and exits 0, because retrying `new` would make a
|
|
447
|
-
second board. Pinning needs `pins:write` on the token you act with.
|
|
448
|
-
- `--as-bot` acts as the bot for reads and writes. Slack lets a token edit only its own
|
|
449
|
-
messages, so a board the bot created must be updated `--as-bot`.
|
|
450
|
-
- During quiet hours (JST 23:00–08:00) the preview shows the quiet-hours line, and the
|
|
451
|
-
confirmed run warns that the reply notified. It warns but does not block.
|
|
452
|
-
- Text is posted as-is (plain mrkdwn, no blocks) so the footer reads back verbatim;
|
|
453
|
-
`@handle`s are **not** converted — write `<@U…>` if you need a real mention.
|
|
454
|
-
- Stateless: the only local files are short-lived per-board locks, held while a `set` runs,
|
|
455
|
-
so two writers on one machine cannot interleave.
|
|
456
|
-
|
|
457
|
-
### tail — real-time message stream
|
|
458
|
-
|
|
459
|
-
`slack tail` prints new messages in a channel as they arrive, in the same
|
|
460
|
-
`[ts] @handle: text` format as the `read` command.
|
|
461
|
-
|
|
462
|
-
- **Transport: RTM WebSocket** (default) when the token is a desktop session
|
|
463
|
-
(`xoxc-` + cookie) and none of `--since`, `--timeout`, `--exit-on-message` is
|
|
464
|
-
given. If RTM can't connect it says `RTM unavailable — switching to polling.`
|
|
465
|
-
- **Fallback: polling** every `--interval` ms (default `60000` = 60 s; e.g.
|
|
466
|
-
`--interval=3000` for near-real-time at the cost of more API calls). Used for
|
|
467
|
-
other tokens, with any of the three flags above, or with `--no-rtm`.
|
|
468
|
-
|
|
469
|
-
```sh
|
|
470
|
-
slack tail "#general" # follow new messages from now
|
|
471
|
-
slack tail "#general" --since=30m # backfill 30 minutes, then stream
|
|
472
|
-
slack tail "#general" --thread=1700000000.000100 # one thread only
|
|
473
|
-
slack tail "#general" --me # only messages mentioning you
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
For automation, `--exit-on-message` stops as soon as the first message from
|
|
477
|
-
**someone else** arrives (your own posts are ignored), and `--timeout <dur>`
|
|
478
|
-
(e.g. `30m`, `2h`) auto-stops after the deadline with exit code 0. Together they
|
|
479
|
-
make a "wait for a reply, then act" primitive that won't hang:
|
|
480
|
-
|
|
481
|
-
```sh
|
|
482
|
-
slack tail "@alice" --exit-on-message --timeout 30m --interval 15000
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
**Note:** Cross-channel mention streaming (`--me` without a target) is not yet
|
|
486
|
-
supported — a target channel is required.
|
|
487
|
-
|
|
488
|
-
### stream — every matching message, across all channels
|
|
489
|
-
|
|
490
|
-
`slack stream --grep <regex>` watches **every** conversation the identity is in —
|
|
491
|
-
new top-level posts *and* thread replies — and prints each message whose text
|
|
492
|
-
matches. It is the cross-channel counterpart of `tail`, built for a long-running
|
|
493
|
-
consumer (e.g. "wake an agent whenever someone @mentions the bot"):
|
|
494
|
-
|
|
495
|
-
```sh
|
|
496
|
-
slack stream --grep '<@U00000001>|@mybot' --json # runs until stopped
|
|
497
|
-
slack stream --grep 'deploy' -i --channel '#dev' --once # one scan, then exit
|
|
498
|
-
slack stream --grep '<@U00000001>' --since 2h --json # replay the last 2 hours
|
|
499
|
-
slack stream --grep '<@U00000001>' --replies-to self --json # + every reply in threads the bot is in
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
- **One JSON line per match** with `--json`:
|
|
503
|
-
`{type: "message"|"reply", channel: {id, name}, ts, thread_ts, user: {id, name}, text, permalink, match}`,
|
|
504
|
-
where `match` is `"grep"` or `"replies-to"`.
|
|
505
|
-
`--grep` runs on the raw text (mentions look like `<@U…>`), plus legacy attachment
|
|
506
|
-
text; the emitted `text` has `< > &` decoded.
|
|
507
|
-
- **Privacy-safe defaults.** With a bot token (`SLACK_BOT_TOKEN`) it streams **as the
|
|
508
|
-
bot**, so it sees only channels the bot was invited to — never the user's DMs.
|
|
509
|
-
`--as-user` opts into the user identity. Matching happens before anything is
|
|
510
|
-
printed: a non-matching message is never printed, logged, or even name-resolved.
|
|
511
|
-
- **Replies in a user's threads.** `--replies-to <user-id>` (repeatable; `self` = the
|
|
512
|
-
streaming identity) also prints every reply in a thread that user started or has
|
|
513
|
-
replied in, whether or not it matches `--grep` — people answer a bot in its thread
|
|
514
|
-
without tagging it. It matches Slack's `parent_user_id`, the parent's
|
|
515
|
-
`reply_users`, and the id's own replies the stream has seen (kept in the state
|
|
516
|
-
file for 30 days). `reply_users` lists at most five people, so a thread cut short
|
|
517
|
-
there is read once in full (as is one whose list is missing). A bot can appear
|
|
518
|
-
as its user id (`U…`) or bot id (`B…`); `self`, or a `B…` id, covers both. Polling only reaches threads inside `--thread-window`;
|
|
519
|
-
with the relay, a reply in an older thread is caught too.
|
|
520
|
-
- **No self-echo.** Posts by the streaming identity are excluded by sender id (its user
|
|
521
|
-
id and bot id; with `--as-user`, the bot's posts too) — the same text from anyone
|
|
522
|
-
else still matches.
|
|
523
|
-
- **Resumable.** A per-channel cursor (plus one per active thread) is saved under
|
|
524
|
-
`$XDG_STATE_HOME/slack-term/stream/` (one file per identity + grep + channels + `--replies-to`;
|
|
525
|
-
override with `--state`). A restart continues where it stopped: nothing lost,
|
|
526
|
-
nothing repeated. The first run starts *now*; `--since` replays from a point,
|
|
527
|
-
ignoring the saved cursor. Delivery is at-least-once only in one corner — a crash
|
|
528
|
-
between printing a match and saving the cursor repeats that line, so dedupe on
|
|
529
|
-
`channel.id + ts`. A lock file keeps two streams off the same state.
|
|
530
|
-
- **Transport: the relay is the primary mode; polling is the fallback.** Deploy
|
|
531
|
-
the relay (a Cloudflare Worker on Slack's Events API — see
|
|
532
|
-
[Setting up the relay](#setting-up-the-relay)) and set `SLACK_RELAY_URL` and
|
|
533
|
-
`SLACK_RELAY_TOKEN`: the stream then hears a *doorbell* — `{channel, ts, thread_ts}`,
|
|
534
|
-
no text — within a second of each post, reads that one message through the Web API
|
|
535
|
-
with its own token and runs it through the same `--grep`. While the relay is
|
|
536
|
-
connected the poll still runs, every `--reconcile` (default `5m`), as the safety net;
|
|
537
|
-
when the relay is down it goes back to `--interval`. Both paths share one record of
|
|
538
|
-
what was printed, so a message is never printed twice. The relay is used only when
|
|
539
|
-
streaming as the bot (it rings for the bot's channels) and never with `--once`.
|
|
540
|
-
The connection is a WebSocket (the relay hibernates between bells, so an idle
|
|
541
|
-
connection costs next to nothing); against a relay deployed before that, it falls
|
|
542
|
-
back to Server-Sent Events. `SLACK_RELAY_TRANSPORT=websocket|sse` pins one.
|
|
543
|
-
- **Polling fallback** (no relay configured, `--as-user`, or `--no-relay`). The stream
|
|
544
|
-
prints a `WARNING: polling mode` line on stderr, pointing to the relay setup. It
|
|
545
|
-
polls every `--interval` (default `45s`), paced to stay inside Slack's rate limits:
|
|
546
|
-
- every cycle reads each channel's history **from its cursor only** (new posts);
|
|
547
|
-
- each channel's whole `--thread-window` (default `3d`) — which shows which threads
|
|
548
|
-
gained replies, and only those threads are read — is re-read once per
|
|
549
|
-
`--thread-scan` (default `3m`), spread across cycles rather than all at once, so a
|
|
550
|
-
reply under an older parent can take up to `--thread-scan` to appear;
|
|
551
|
-
- a channel with no post inside the window skips that re-read, and such an idle
|
|
552
|
-
DM/MPIM (`--as-user`) is not read at all between `--thread-scan` periods;
|
|
553
|
-
- all `conversations.history` / `conversations.replies` calls share one token
|
|
554
|
-
bucket, `--calls-per-min` (default `40`, under Tier 3's ~50/min; 10 at once).
|
|
555
|
-
A message is held back until it is 5 s old, so a cursor never skips one Slack has
|
|
556
|
-
not made visible yet. Rate limits honour `Retry-After`.
|
|
557
|
-
- **Not covered:** edits (a message edited *into* matching is not re-emitted), and —
|
|
558
|
-
without the relay — replies in a thread whose parent is older than `--thread-window`.
|
|
559
|
-
- **Failures are loud and distinguishable.** A network/API error retries the cycle
|
|
560
|
-
with φ backoff (`2s·1.618ⁿ`, capped at 5 min), one stderr line per attempt; after
|
|
561
|
-
12 consecutive failures (≈16 min) it exits. A channel it cannot read is skipped with
|
|
562
|
-
one stderr line; if *every* channel fails, that is a failure, not "no matches".
|
|
563
|
-
- **Exit codes** (same contract as `ask`): `0` matches printed (`--once`) or stopped by
|
|
564
|
-
SIGINT/SIGTERM; `2` `--once` found nothing; `3` transport/auth failure (stderr says
|
|
565
|
-
which); `1` bad arguments (e.g. an invalid regex).
|
|
566
|
-
|
|
567
|
-
#### Setting up the relay
|
|
568
|
-
|
|
569
|
-
No clone needed — the relay ships in the npm package as `slack-term/worker`:
|
|
570
|
-
|
|
571
|
-
```sh
|
|
572
|
-
slack relay init my-relay # writes package.json, wrangler.jsonc, src/index.ts, .gitignore, README.md
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
It writes local files only (no network; refuses to overwrite without `--force`) and
|
|
576
|
-
prints a freshly generated `RELAY_TOKEN` (never saved to disk) with the next steps:
|
|
577
|
-
`npm install`, `npx wrangler login` (or `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID`),
|
|
578
|
-
`npx wrangler deploy` (Node ≥ 22), `wrangler secret put SLACK_SIGNING_SECRET` /
|
|
579
|
-
`RELAY_TOKEN` / optional `SLACK_TEAM_ID`, then the Slack app's Event Subscriptions
|
|
580
|
-
Request URL `https://<worker>/slack/events`. Check it with `slack relay health`
|
|
581
|
-
(GET `/health` using `SLACK_RELAY_URL` / `SLACK_RELAY_TOKEN`) and `slack stream`,
|
|
582
|
-
which says `relay connected (websocket)`.
|
|
583
|
-
|
|
584
|
-
An existing Worker project needs only the re-export (plus the `RELAY` Durable
|
|
585
|
-
Object binding and a `new_sqlite_classes: ["Relay"]` migration in wrangler config):
|
|
586
|
-
|
|
587
|
-
```ts
|
|
588
|
-
// src/index.ts
|
|
589
|
-
export { default, Relay } from "slack-term/worker";
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
Endpoints, privacy and protocol: [worker/README.md](worker/README.md), which also
|
|
593
|
-
covers deploying straight from a clone of this repo (for contributors).
|
|
594
|
-
|
|
595
|
-
## Configuration
|
|
596
|
-
|
|
597
|
-
Requires a Slack user token (`xoxp-...`) with the following scopes:
|
|
598
|
-
|
|
599
|
-
- `search:read` — for search and news
|
|
600
|
-
- `channels:history`, `groups:history`, `im:history`, `mpim:history` — for message history
|
|
601
|
-
- `channels:read`, `groups:read`, `im:read`, `mpim:read` — for channel listing
|
|
602
|
-
- `users:read` — for resolving display names
|
|
603
|
-
- `chat:write` — for sending messages
|
|
604
|
-
- `reactions:write` — for `react` and for `ask` (seeding / clearing the choice pills)
|
|
605
|
-
|
|
606
|
-
`ask` needs no `reactions:read`: it reads the answers back from
|
|
607
|
-
`conversations.history`, which returns each message's `reactions` (with the user
|
|
608
|
-
list) under the `*:history` scopes above. `reactions.get` would need
|
|
609
|
-
`reactions:read`, so it is deliberately not used.
|
|
610
|
-
|
|
611
|
-
> Add each scope to the **token type the CLI actually uses**. The CLI defaults to the
|
|
612
|
-
> **user token** (`xoxp-...`), so `reactions:write` must be under **User Token Scopes**.
|
|
613
|
-
> Adding it only to **Bot Token Scopes** makes `slack doctor` (which checks the bot
|
|
614
|
-
> token) look green while `slack react` still fails with `missing_scope` — the bot scope
|
|
615
|
-
> only helps `--as-bot`/bot-token usage. After changing scopes, **reinstall the app** to
|
|
616
|
-
> the workspace for it to take effect.
|
|
617
|
-
|
|
618
|
-
Set the token via environment variable:
|
|
619
|
-
|
|
620
|
-
```sh
|
|
621
|
-
export SLACK_MCP_XOXP_TOKEN=xoxp-...
|
|
622
|
-
```
|
|
623
|
-
|
|
624
|
-
Or place it in `~/.config/slack-cli/.env` or a local `.env` file.
|
|
625
|
-
|
|
626
|
-
See [`SKILL.md`](SKILL.md) for a full token-acquisition walkthrough.
|
|
627
|
-
|
|
628
|
-
### Ubuntu desktop session
|
|
629
|
-
|
|
630
|
-
Sign in to Slack in Chrome or Slack Desktop. `--from-chrome` reads a browser `xoxc-` token and cookie from the same Chrome profile; desktop import reads `xoxc-` tokens from native, Snap, or Flatpak data directories. Browser profiles contain sensitive cookies, so the CLI asks `Read local browser profiles and Slack session cookies? [y/N]` before scanning. Enter `y` to allow a scan; the default is no.
|
|
631
|
-
|
|
632
|
-
```sh
|
|
633
|
-
slack auth login --from-desktop # desktop token only
|
|
634
|
-
slack auth login --from-chrome # Chrome token + Chrome cookie
|
|
635
|
-
slack auth login --from-firefox # desktop token + Firefox cookie
|
|
636
|
-
slack auth login --from-all # desktop and browser sources
|
|
637
|
-
slack auth login --from-chrome --yes # bypass the browser-read prompt
|
|
638
|
-
slack auth tokens # print active credentials in .env format
|
|
639
|
-
slack auth save --envfile=./.env.local # export active token + cookie
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
`--from-all` attaches a cookie only when exactly one browser session is found. If several are found, the desktop token is saved without a cookie; use `slack auth chrome -w <name>` or `slack auth firefox -w <name>` to select the matching profile. These commands also ask before reading browser profiles, and accept `--yes` for scripts. Select the saved workspace with `slack auth use -g <name>`. `auth tokens` prints the active `SLACK_TOKEN`, optional `SLACK_COOKIE`, and optional `SLACK_BOT_TOKEN` to stdout; treat its output as secret. `auth save` requires a cookie, writes `SLACK_TOKEN` and `SLACK_COOKIE`, and makes the env file owner-readable only on Unix. `--workspace <name>` selects a specific profile.
|
|
643
|
-
|
|
644
|
-
Chrome supports Linux `v10` cookies and `v11` cookies when `secret-tool` can read the unlocked GNOME keyring. Other Linux keyring backends are not yet supported. Firefox discovery covers native, Snap, and Flatpak profiles. If browser session access is unavailable, use `slack auth token` to add a user token from a Slack app. Treat desktop tokens and browser cookies as credentials; keep profile files and local env files private.
|
|
645
|
-
|
|
646
|
-
## Development
|
|
647
|
-
|
|
648
|
-
```sh
|
|
649
|
-
# TypeScript
|
|
650
|
-
bun install
|
|
651
|
-
bun run dev -- news --limit 3 # run straight from source
|
|
652
|
-
bun run typecheck
|
|
653
|
-
bun run build # produces dist/cli.js
|
|
654
|
-
|
|
655
|
-
# Rust
|
|
656
|
-
cargo run --manifest-path rs/Cargo.toml --release --bin slack -- news --limit 3
|
|
657
|
-
|
|
658
|
-
# Parity test (requires a token — compares Rust and TS stdout)
|
|
659
|
-
bun run test:parity
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
## Dependencies
|
|
663
|
-
|
|
664
|
-
**TypeScript impl** — zero runtime deps; uses built-in `fetch`, `node:crypto`,
|
|
665
|
-
`node:util` argument parsing.
|
|
666
|
-
|
|
667
|
-
**Rust impl**
|
|
668
|
-
|
|
669
|
-
- [clap](https://crates.io/crates/clap) — CLI argument parsing
|
|
670
|
-
- [reqwest](https://crates.io/crates/reqwest) — HTTP client for Slack Web API
|
|
671
|
-
- [tokio](https://crates.io/crates/tokio) — async runtime
|
|
672
|
-
- [chrono](https://crates.io/crates/chrono) — date/time formatting
|
|
673
|
-
- [ring](https://crates.io/crates/ring) — SHA-256 for confirm hashes
|
|
674
|
-
|
|
675
|
-
## Release notes
|
|
676
|
-
|
|
677
|
-
### v0.x — 2026-05-15: `slack tail`
|
|
678
|
-
|
|
679
|
-
New `tail` subcommand streams channel messages in real time using poll-based
|
|
680
|
-
delivery (3-second interval). Supports `--since=<duration>` for backfill,
|
|
681
|
-
`--thread=<ts>` to follow a single thread, and `--me` to filter for messages
|
|
682
|
-
that mention you. Uses `conversations.history?oldest=<ts>` as a cursor so
|
|
683
|
-
already-seen messages are never re-printed, even across reconnects.
|
|
684
|
-
|
|
685
|
-
## Ecosystem
|
|
686
|
-
|
|
687
|
-
This CLI is the human-comms surface of the
|
|
688
|
-
[agent-yes](https://github.com/snomiao/agent-yes) fleet: agent-yes runs, watches and
|
|
689
|
-
delegates to AI coding agents, and `slack` is how they read and answer the humans they
|
|
690
|
-
work with. Neither depends on the other — they share a stance rather than a library:
|
|
691
|
-
file-based state over daemons, one command surface across two runtimes, gates on the
|
|
692
|
-
irreversible and warnings on the merely unwise, and no real operational data in a public
|
|
693
|
-
repo.
|
|
694
|
-
|
|
695
|
-
A write-up of the design decisions behind the confirm gate lives on the agent-yes lab:
|
|
696
|
-
[A confirm code that goes stale](https://lab.agent-yes.com/2026-08-11-slack-term-safe-writes).
|
|
697
|
-
|
|
698
|
-
## Related / prior art
|
|
699
|
-
|
|
700
|
-
- [`slkcli`](https://www.npmjs.com/package/slkcli) by
|
|
701
|
-
[@therohitdas](https://github.com/therohitdas) — a macOS-only Node CLI that
|
|
702
|
-
auto-extracts `xoxc-` session tokens from the Slack desktop app. Different
|
|
703
|
-
tradeoffs (zero-config on macOS vs. our cross-platform explicit-token
|
|
704
|
-
approach). See [`docs/comparison-slkcli.md`](docs/comparison-slkcli.md) for
|
|
705
|
-
a full UX side-by-side.
|
|
706
|
-
- [`docs/ecosystem.md`](docs/ecosystem.md) — survey of other terminal Slack
|
|
707
|
-
tools (official, `slack-term`, `wee-slack`, `slackcat`, `slackdump`, …).
|
|
708
|
-
|
|
709
|
-
## License
|
|
710
|
-
|
|
711
|
-
`ts/vendor/gitleaks.toml` is gitleaks' default rule set (v8.30.1, MIT, © 2019 Zachary Rice, `ts/vendor/gitleaks.LICENSE`). slack-term runs it in-process (`ts/redact.ts`) to redact secrets from anything it writes to disk.
|
|
712
|
-
|
|
713
|
-
MIT
|
|
714
|
-
|
|
715
|
-
### Print the active token (TypeScript CLI)
|
|
716
|
-
|
|
717
|
-
`slack auth token` prints the resolved token followed by a newline, like
|
|
718
|
-
`gh auth token`. Select a saved workspace with `slack auth token --workspace acme`.
|
|
719
|
-
It uses the same environment/profile precedence as other commands and makes no
|
|
720
|
-
API request. Diagnostics go to stderr so stdout can be used in scripts.
|
|
721
|
-
|
|
722
|
-
Use `slack auth login` for interactive setup. Existing imports with
|
|
723
|
-
`slack auth token --token <token> --name acme` continue to work.
|
|
39
|
+
Old and new clients and relays still talk to each other, so you can upgrade
|
|
40
|
+
them in any order.
|
|
724
41
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
It follows the same credential precedence, makes no API request, and prints only
|
|
729
|
-
assignments to stdout. Each export contains one workspace, avoiding duplicate keys.
|
|
42
|
+
To move to new names you can rename `.slack-term/` → `.slack-hub/` and
|
|
43
|
+
`~/.config/slack-term/` → `~/.config/slack-hub/` at any time. Do it before
|
|
44
|
+
anything creates the new one, or merge the two yourself.
|