Skip to content

Commit 2bcc98d

Browse files
echobtfactorydroid
andauthored
feat(slack): implement full Slack integration for CLI (#420)
Add cortex-slack crate with comprehensive Slack integration: - Slack bot with Socket Mode (WebSocket) for real-time events - Event handlers for @mentions and direct messages - Slash commands (/cortex, /cortex-review) - OAuth flow for workspace installation - Message formatting (Markdown to Slack mrkdwn) - Secure credential storage via OS keyring - Comprehensive error handling for network/API errors - 49 unit tests covering all modules The integration supports: - Bot OAuth tokens (xoxb-...) - App-level tokens for Socket Mode (xapp-...) - Signing secret for request verification - Rate limiting handling with retry-after - Token expiration and malformed API response handling Modules: - bot.rs: Main bot implementation with Socket Mode - events.rs: Event parsing and handlers - commands.rs: Slash command handling - messages.rs: Block Kit message formatting - oauth.rs: OAuth flow and routes - config.rs: Configuration and keyring storage - error.rs: Comprehensive error types Co-authored-by: Droid Agent <droid@factory.ai>
1 parent ecd0a4f commit 2bcc98d

File tree

10 files changed

+3341
-0
lines changed

10 files changed

+3341
-0
lines changed

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ members = [
7373
"cortex-network-proxy",
7474
"cortex-shell-snapshot",
7575

76+
# CLI - Integrations
77+
"cortex-slack",
78+
7679
# CLI - LM Studio Integration
7780
"cortex-lmstudio",
7881

@@ -226,6 +229,9 @@ cortex-collab = { path = "cortex-collab" }
226229
cortex-network-proxy = { path = "cortex-network-proxy" }
227230
cortex-shell-snapshot = { path = "cortex-shell-snapshot" }
228231

232+
# Integrations
233+
cortex-slack = { path = "cortex-slack" }
234+
229235
# OpenTUI crates
230236
opentui = { path = "opentui-rs" }
231237
opentui-core = { path = "opentui-rs/crates/opentui-core" }

cortex-slack/Cargo.toml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[package]
2+
name = "cortex-slack"
3+
version.workspace = true
4+
edition.workspace = true
5+
license.workspace = true
6+
description = "Slack integration for Cortex CLI - bot, events, and slash commands"
7+
8+
[lints]
9+
workspace = true
10+
11+
[dependencies]
12+
# Internal crates
13+
cortex-keyring-store = { path = "../cortex-keyring-store" }
14+
cortex-agents = { path = "../cortex-agents" }
15+
cortex-common = { path = "../cortex-common" }
16+
17+
# Async runtime
18+
tokio = { workspace = true, features = ["full", "sync"] }
19+
tokio-stream = { workspace = true }
20+
async-trait = { workspace = true }
21+
futures = { workspace = true }
22+
23+
# Web framework (for OAuth routes)
24+
axum = { workspace = true }
25+
tower = { workspace = true }
26+
tower-http = { workspace = true }
27+
28+
# HTTP client
29+
reqwest = { workspace = true }
30+
hyper = { workspace = true }
31+
32+
# Serialization
33+
serde = { workspace = true }
34+
serde_json = { workspace = true }
35+
36+
# Error handling
37+
anyhow = { workspace = true }
38+
thiserror = { workspace = true }
39+
40+
# Logging
41+
tracing = { workspace = true }
42+
43+
# Utilities
44+
url = { workspace = true }
45+
chrono = { workspace = true }
46+
uuid = { workspace = true }
47+
base64 = { workspace = true }
48+
sha2 = { workspace = true }
49+
hmac = { workspace = true }
50+
hex = { workspace = true }
51+
secrecy = { workspace = true }
52+
urlencoding = { workspace = true }
53+
54+
# WebSocket for Socket Mode
55+
tokio-tungstenite = { version = "0.24", features = ["native-tls"] }
56+
57+
[dev-dependencies]
58+
tokio-test = { workspace = true }
59+
tempfile = { workspace = true }
60+
wiremock = { workspace = true }

0 commit comments

Comments
 (0)