ask-slack 0.1.2 → 0.1.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +34 -8
- data/lib/ask/slack/context.rb +3 -2
- data/lib/ask/slack/version.rb +1 -1
- data/lib/tasks/vcr.rake +42 -0
- metadata +12 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa494a5831a8a5e57491f43b8c7d6677db0e8acfc4c47b9fe208ab36a2f8183e
|
|
4
|
+
data.tar.gz: 5bff6d53dfd1efed345fc260162d0ca1f93ace445a090a058e8271b8434ecc09
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 219ed3857e6e18d585cceccda1a7511a5fa0d49c16f9ebcd3af3058679f562c41f02987111c8b8074c7d2e1acf9550419ca5a144f75393d0aa9715b99a6b53ec
|
|
7
|
+
data.tar.gz: 73897b358c923fa37d892104196fe00d37297073507be9f13afe67b445b4e613a8e22d02d57a7fc0cf77aae2f13bfa79adcaff28f24d71a05435de288eded5b2
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## [0.1.3] - 2026-06-25
|
|
2
|
+
|
|
3
|
+
### Changed
|
|
4
|
+
- Gemspec validation test. Infrastructure: rubocop, overcommit, bin/setup, CI matrix. VCR rake tasks.
|
|
5
|
+
# Changelog
|
|
6
|
+
|
|
7
|
+
## [0.1.2] - 2026-06-21
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Initial release of `ask-slack` — Slack service context for the ask-rb ecosystem.
|
|
12
|
+
- **context.rb** — Metadata constants for AI system prompts: `DESCRIPTION`, `DOCS_URL`, `OPENAPI_URL`, `AUTH_NAME`, `AUTH_HOW`, `GEM_NAME`, `GEM_VERSION`, `GEM_DOCS`, `QUICK_START`
|
|
13
|
+
- **client.rb** — `Ask::Slack.client` returns an authenticated `Slack::Web::Client` via `Ask::Auth.resolve(:slack_token)`. Wraps client in `ClientProxy` to convert `NotAuthed`, `InvalidAuth`, `AccountInactive`, `TokenRevoked`, and `TokenExpired` errors to `Ask::Auth::InvalidCredential`.
|
|
14
|
+
- **error_guide.rb** — `Ask::Slack::Errors` with rate limit info, HTTP status code descriptions, Slack API error string guidance map, exception class mappings, and pagination info for agents.
|
|
15
|
+
- **Dependencies:** `ask-auth ~> 0.1`, `slack-ruby-client ~> 3.1`
|
|
16
|
+
- **Testing:** 29 tests, 81 assertions covering context constants, client auth flow, and error guide lookups.
|
data/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# ask-slack
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/rb/ask-slack)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Slack service context for AI agents in the ask-rb ecosystem. It provides an
|
|
6
|
+
authenticated Slack Web API client built on slack-ruby-client, metadata
|
|
7
|
+
constants for system prompts, and a structured error guide for common Slack
|
|
8
|
+
API issues.
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ Provides:
|
|
|
13
13
|
gem "ask-slack"
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Quick Start
|
|
17
17
|
|
|
18
18
|
```ruby
|
|
19
19
|
require "ask-slack"
|
|
@@ -26,7 +26,8 @@ client.users_list
|
|
|
26
26
|
|
|
27
27
|
## Authentication
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
`Ask::Slack.client` resolves a token via `Ask::Auth.resolve(:slack_token)`.
|
|
30
|
+
Set your Slack Bot User OAuth Token in the environment:
|
|
30
31
|
|
|
31
32
|
```bash
|
|
32
33
|
export SLACK_TOKEN=xoxb-your-bot-token-here
|
|
@@ -38,9 +39,34 @@ Or add it to `~/.ask/credentials.yml`:
|
|
|
38
39
|
slack_token: xoxb-your-bot-token-here
|
|
39
40
|
```
|
|
40
41
|
|
|
42
|
+
Credentials can also come from Rails credentials, a database, or an OAuth
|
|
43
|
+
provider, depending on your `ask-auth` configuration. Create a Slack app at
|
|
44
|
+
[api.slack.com/apps](https://api.slack.com/apps) to get a bot token.
|
|
45
|
+
|
|
46
|
+
## Key entry points
|
|
47
|
+
|
|
48
|
+
- `Ask::Slack.client` - an authenticated `Slack::Web::Client`. It is wrapped
|
|
49
|
+
in a proxy that converts auth errors (`NotAuthed`, `InvalidAuth`, and
|
|
50
|
+
related) into `Ask::Auth::InvalidCredential` and retries transient network
|
|
51
|
+
failures with exponential backoff.
|
|
52
|
+
- `Ask::Slack::Errors` - structured error knowledge for agents: guidance by
|
|
53
|
+
error string, HTTP status code descriptions, and exception class mapping.
|
|
54
|
+
- `Ask::Slack::DESCRIPTION`, `DOCS_URL`, `AUTH_NAME`, `GEM_NAME`,
|
|
55
|
+
`GEM_VERSION`, and `QUICK_START` - metadata constants for system prompts.
|
|
56
|
+
|
|
57
|
+
Use `conversations_list`, not `channels_list`. `channels_list` was removed in
|
|
58
|
+
modern versions of slack-ruby-client.
|
|
59
|
+
|
|
60
|
+
## Full documentation
|
|
61
|
+
|
|
62
|
+
The full ask-rb documentation lives at https://ask-rb.github.io/ask-docs.
|
|
63
|
+
[Services: Slack](https://ask-rb.github.io/ask-docs/services/slack) covers
|
|
64
|
+
ask-slack in depth, including the client, error guide, and constants.
|
|
65
|
+
API reference: https://ask-rb.github.io/ask-docs/reference/api.
|
|
66
|
+
|
|
41
67
|
## Development
|
|
42
68
|
|
|
43
|
-
```
|
|
69
|
+
```
|
|
44
70
|
bundle install
|
|
45
71
|
bundle exec rake test
|
|
46
72
|
```
|
data/lib/ask/slack/context.rb
CHANGED
|
@@ -8,8 +8,9 @@ module Ask
|
|
|
8
8
|
# Base URL for Slack Web API methods.
|
|
9
9
|
DOCS_URL = "https://api.slack.com/methods"
|
|
10
10
|
|
|
11
|
-
#
|
|
12
|
-
|
|
11
|
+
# Slack no longer serves an OpenAPI spec at a stable URL.
|
|
12
|
+
# The API methods reference is at DOCS_URL instead.
|
|
13
|
+
# OPENAPI_URL was removed because the spec redirects to a 404 page.
|
|
13
14
|
|
|
14
15
|
# Credential name used with Ask::Auth.resolve.
|
|
15
16
|
AUTH_NAME = :slack_token
|
data/lib/ask/slack/version.rb
CHANGED
data/lib/tasks/vcr.rake
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
namespace :vcr do
|
|
4
|
+
desc "Record VCR cassettes for a specific provider"
|
|
5
|
+
task :record, [:provider] do |_t, args|
|
|
6
|
+
provider = args[:provider] || "all"
|
|
7
|
+
cassette_dir = File.expand_path("../../test/cassettes", __dir__)
|
|
8
|
+
|
|
9
|
+
if provider == "all"
|
|
10
|
+
puts "Removing all cassettes..."
|
|
11
|
+
FileUtils.rm_rf(Dir[File.join(cassette_dir, "*.yml")])
|
|
12
|
+
else
|
|
13
|
+
puts "Removing cassettes for #{provider}..."
|
|
14
|
+
FileUtils.rm_rf(Dir[File.join(cassette_dir, "*#{provider}*.yml")])
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
puts "Running tests to re-record cassettes..."
|
|
18
|
+
system("bundle exec rake test")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
desc "Verify cassettes are fresh (less than 30 days old)"
|
|
22
|
+
task :verify_freshness do
|
|
23
|
+
cassette_dir = File.expand_path("../../test/cassettes", __dir__)
|
|
24
|
+
stale = false
|
|
25
|
+
|
|
26
|
+
Dir[File.join(cassette_dir, "*.yml")].each do |cassette|
|
|
27
|
+
age_days = (Time.now - File.mtime(cassette)) / 86400.0
|
|
28
|
+
if age_days > 30
|
|
29
|
+
puts "STALE: #{File.basename(cassette)} is #{age_days.round(1)} days old"
|
|
30
|
+
stale = true
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
if stale
|
|
35
|
+
puts "\nSome cassettes are older than 30 days. Re-record them with:"
|
|
36
|
+
puts " bundle exec rake vcr:record[all]"
|
|
37
|
+
exit 1
|
|
38
|
+
else
|
|
39
|
+
puts "All cassettes are fresh (less than 30 days old)."
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ask-slack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kaka Ruto
|
|
@@ -13,16 +13,16 @@ dependencies:
|
|
|
13
13
|
name: ask-auth
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 0.3.2
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
|
-
- - "
|
|
23
|
+
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 0.3.2
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: slack-ruby-client
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -143,6 +143,7 @@ executables: []
|
|
|
143
143
|
extensions: []
|
|
144
144
|
extra_rdoc_files: []
|
|
145
145
|
files:
|
|
146
|
+
- CHANGELOG.md
|
|
146
147
|
- LICENSE
|
|
147
148
|
- README.md
|
|
148
149
|
- lib/ask-slack.rb
|
|
@@ -151,10 +152,14 @@ files:
|
|
|
151
152
|
- lib/ask/slack/context.rb
|
|
152
153
|
- lib/ask/slack/error_guide.rb
|
|
153
154
|
- lib/ask/slack/version.rb
|
|
155
|
+
- lib/tasks/vcr.rake
|
|
154
156
|
homepage: https://github.com/ask-rb/ask-slack
|
|
155
157
|
licenses:
|
|
156
158
|
- MIT
|
|
157
|
-
metadata:
|
|
159
|
+
metadata:
|
|
160
|
+
homepage_uri: https://github.com/ask-rb/ask-slack
|
|
161
|
+
source_code_uri: https://github.com/ask-rb/ask-slack
|
|
162
|
+
changelog_uri: https://github.com/ask-rb/ask-slack/blob/master/CHANGELOG.md
|
|
158
163
|
rdoc_options: []
|
|
159
164
|
require_paths:
|
|
160
165
|
- lib
|
|
@@ -169,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
169
174
|
- !ruby/object:Gem::Version
|
|
170
175
|
version: '0'
|
|
171
176
|
requirements: []
|
|
172
|
-
rubygems_version: 4.0.
|
|
177
|
+
rubygems_version: 4.0.18
|
|
173
178
|
specification_version: 4
|
|
174
179
|
summary: Slack service context for the ask-rb ecosystem
|
|
175
180
|
test_files: []
|