rails-informant 0.0.7 → 0.0.8
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 792329a23e7d5d2d5259bd8f7b222f6975f182808d7f5d9ab996e966522ff35b
|
|
4
|
+
data.tar.gz: 425d553a2919e5009a60042ec0df0284fd712e0baff0cb0f789a1abc71ac5d44
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c4048a38d1d54f4937e8c9b30cc0357c9cc1bc25125b4cf4528294beb37744d9923596555b2a3dee1a5547e3cfff5cd4dbbddfcd2233799e3c91fc518575202
|
|
7
|
+
data.tar.gz: aac0ce55063d607f0d247cbb2ec11568264aa051697526d711695f84c222ca0458ca6e0cebf5ab8ae3921329456ea6678d3ef436260dac057feedaa085841f4f
|
data/README.md
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
<p>
|
|
14
14
|
<a href="#why-rails-informant">Why Rails Informant?</a>
|
|
15
15
|
◆ <a href="#quick-start">Quick Start</a>
|
|
16
|
-
◆ <a href="#agent-setup">Agent Setup</a>
|
|
17
16
|
◆ <a href="#configuration">Configuration</a>
|
|
18
17
|
◆ <a href="#mcp-server">MCP Server</a>
|
|
19
18
|
◆ <a href="#architecture">Architecture</a>
|
|
@@ -44,20 +43,30 @@ Add to your Gemfile:
|
|
|
44
43
|
gem "rails-informant"
|
|
45
44
|
```
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
Install:
|
|
48
47
|
|
|
49
48
|
```sh
|
|
49
|
+
bundle install
|
|
50
50
|
bin/rails generate rails_informant:install
|
|
51
51
|
bin/rails db:migrate
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Set an authentication token:
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
```sh
|
|
57
|
+
bin/rails credentials:edit
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
rails_informant:
|
|
62
|
+
api_token: your-secret-token # generate with: openssl rand -hex 32
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Install your AI agent integration:
|
|
57
66
|
|
|
58
67
|
```sh
|
|
59
|
-
bin/rails generate rails_informant:skill # Claude Code
|
|
60
|
-
bin/rails generate rails_informant:devin # Devin
|
|
68
|
+
bin/rails generate rails_informant:skill # Claude Code
|
|
69
|
+
bin/rails generate rails_informant:devin # Devin AI
|
|
61
70
|
```
|
|
62
71
|
|
|
63
72
|
Errors are captured automatically in non-local environments. To capture errors manually:
|
|
@@ -66,33 +75,6 @@ Errors are captured automatically in non-local environments. To capture errors m
|
|
|
66
75
|
RailsInformant.capture(exception, context: { order_id: 42 })
|
|
67
76
|
```
|
|
68
77
|
|
|
69
|
-
## Agent Setup
|
|
70
|
-
|
|
71
|
-
End-to-end path for AI agents (Claude Code, Devin) to start triaging errors:
|
|
72
|
-
|
|
73
|
-
1. **Install the gem** -- follow [Quick Start](#quick-start) above. The install generator creates `.mcp.json` automatically.
|
|
74
|
-
2. **Set an authentication token** in your Rails credentials or env var:
|
|
75
|
-
```ruby
|
|
76
|
-
# config/initializers/rails_informant.rb
|
|
77
|
-
config.api_token = Rails.application.credentials.dig(:rails_informant, :api_token)
|
|
78
|
-
```
|
|
79
|
-
3. **Set env vars** for the MCP server (e.g., via `.envrc` + [direnv](https://direnv.net)):
|
|
80
|
-
```sh
|
|
81
|
-
# .envrc
|
|
82
|
-
export INFORMANT_PRODUCTION_URL=https://myapp.com
|
|
83
|
-
export INFORMANT_PRODUCTION_TOKEN=your-api-token
|
|
84
|
-
```
|
|
85
|
-
The MCP server process inherits environment variables from your shell, so `INFORMANT_*` vars set via `.envrc` (or any other method) are picked up automatically -- no need to inline them in `.mcp.json`.
|
|
86
|
-
4. **Install the Claude Code skill** (optional but recommended):
|
|
87
|
-
```sh
|
|
88
|
-
bin/rails generate rails_informant:skill
|
|
89
|
-
```
|
|
90
|
-
5. **Use `/informant`** in Claude Code to triage and fix errors, or let Devin handle them autonomously with the [Devin integration](#devin-ai).
|
|
91
|
-
|
|
92
|
-
> **Connecting the tokens:** The `api_token` in your Rails credentials and `INFORMANT_PRODUCTION_TOKEN` must be the **same value**. The first authenticates incoming requests to your app; the second tells the MCP server what token to send.
|
|
93
|
-
|
|
94
|
-
> **Secrets hygiene:** `.envrc` contains secrets and should be in `.gitignore`. `.mcp.json` is safe to commit -- it only contains the command name, no tokens.
|
|
95
|
-
|
|
96
78
|
## Configuration
|
|
97
79
|
|
|
98
80
|
```ruby
|
|
@@ -105,7 +87,7 @@ RailsInformant.configure do |config|
|
|
|
105
87
|
end
|
|
106
88
|
```
|
|
107
89
|
|
|
108
|
-
Every option can be set via an environment variable. The initializer takes precedence over env vars. These configure the **Rails app**. For MCP server env vars (agent side), see [
|
|
90
|
+
Every option can be set via an environment variable. The initializer takes precedence over env vars. These configure the **Rails app**. For MCP server env vars (agent side), see [MCP Server > Setup](#setup).
|
|
109
91
|
|
|
110
92
|
| Option | Env var | Default | Description |
|
|
111
93
|
|--------|---------|---------|-------------|
|
|
@@ -119,6 +101,10 @@ Every option can be set via an environment variable. The initializer takes prece
|
|
|
119
101
|
| `capture_user_email` | _(none)_ | `false` | Capture email from detected user (PII -- opt-in) |
|
|
120
102
|
| `webhook_url` | `INFORMANT_WEBHOOK_URL` | `nil` | Generic webhook URL for notifications |
|
|
121
103
|
|
|
104
|
+
> **Connecting the tokens:** The `api_token` in your Rails credentials and `INFORMANT_PRODUCTION_TOKEN` must be the **same value**. The first authenticates incoming requests to your app; the second tells the MCP server what token to send.
|
|
105
|
+
|
|
106
|
+
> **Secrets hygiene:** `.envrc` contains secrets and should be in `.gitignore`. `.mcp.json` is safe to commit -- it only contains the command name, no tokens.
|
|
107
|
+
|
|
122
108
|
## Error Capture
|
|
123
109
|
|
|
124
110
|
Errors are captured automatically via:
|
|
@@ -148,19 +134,9 @@ The bundled `informant-mcp` executable connects Claude Code to your error data v
|
|
|
148
134
|
|
|
149
135
|
### Setup
|
|
150
136
|
|
|
151
|
-
The
|
|
152
|
-
|
|
153
|
-
```json
|
|
154
|
-
{
|
|
155
|
-
"mcpServers": {
|
|
156
|
-
"informant": {
|
|
157
|
-
"command": "informant-mcp"
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
```
|
|
137
|
+
The `rails_informant:skill` generator creates `.mcp.json` automatically. Set `INFORMANT_PRODUCTION_URL` and `INFORMANT_PRODUCTION_TOKEN` as environment variables (e.g., via `.envrc` + direnv). The MCP server inherits env vars from your shell.
|
|
162
138
|
|
|
163
|
-
|
|
139
|
+
> `.mcp.json` is used by Claude Code. Devin AI configures MCP servers through the [Devin MCP Marketplace](https://docs.devin.ai/work-with-devin/mcp).
|
|
164
140
|
|
|
165
141
|
For multi-environment setups, create `~/.config/informant-mcp.yml`:
|
|
166
142
|
|
|
@@ -6,7 +6,27 @@ module RailsInformant
|
|
|
6
6
|
|
|
7
7
|
def copy_playbook
|
|
8
8
|
copy_file "error-triage.devin.md", ".devin/error-triage.devin.md"
|
|
9
|
-
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def print_next_steps
|
|
12
|
+
say ""
|
|
13
|
+
say "Devin AI integration installed!", :green
|
|
14
|
+
say ""
|
|
15
|
+
say " Created .devin/error-triage.devin.md"
|
|
16
|
+
say ""
|
|
17
|
+
say "Next steps — configure the MCP server in Devin:", :yellow
|
|
18
|
+
say " 1. Go to Settings > MCP Marketplace in the Devin web app"
|
|
19
|
+
say " 2. Click \"Add Your Own\""
|
|
20
|
+
say " 3. Fill in:"
|
|
21
|
+
say " Name: Rails Informant"
|
|
22
|
+
say " Transport: STDIO"
|
|
23
|
+
say " Command: informant-mcp"
|
|
24
|
+
say " Env vars: INFORMANT_PRODUCTION_URL=https://your-app.com"
|
|
25
|
+
say " INFORMANT_PRODUCTION_TOKEN=<same token from credentials>"
|
|
26
|
+
say " 4. Click \"Test listing tools\" to verify the connection"
|
|
27
|
+
say ""
|
|
28
|
+
say "The token must match rails_informant.api_token in your Rails credentials."
|
|
29
|
+
say ""
|
|
10
30
|
end
|
|
11
31
|
end
|
|
12
32
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require "json"
|
|
2
1
|
require "rails/generators"
|
|
3
2
|
require "rails/generators/active_record"
|
|
4
3
|
|
|
@@ -19,23 +18,7 @@ module RailsInformant
|
|
|
19
18
|
end
|
|
20
19
|
|
|
21
20
|
def mount_engine
|
|
22
|
-
route "mount RailsInformant::Engine =>
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def create_or_update_mcp_json
|
|
26
|
-
mcp_path = File.join(destination_root, ".mcp.json")
|
|
27
|
-
informant_entry = { "command" => "informant-mcp" }
|
|
28
|
-
|
|
29
|
-
if File.exist?(mcp_path)
|
|
30
|
-
existing = JSON.parse(File.read(mcp_path))
|
|
31
|
-
existing["mcpServers"] ||= {}
|
|
32
|
-
existing["mcpServers"]["informant"] = informant_entry
|
|
33
|
-
create_file ".mcp.json", JSON.pretty_generate(existing) + "\n", force: true
|
|
34
|
-
else
|
|
35
|
-
create_file ".mcp.json", JSON.pretty_generate(
|
|
36
|
-
"mcpServers" => { "informant" => informant_entry }
|
|
37
|
-
) + "\n"
|
|
38
|
-
end
|
|
21
|
+
route "mount RailsInformant::Engine => \"/informant\""
|
|
39
22
|
end
|
|
40
23
|
|
|
41
24
|
def print_next_steps
|
|
@@ -46,20 +29,14 @@ module RailsInformant
|
|
|
46
29
|
say " 1. Run migrations:"
|
|
47
30
|
say " bin/rails db:migrate"
|
|
48
31
|
say ""
|
|
49
|
-
say " 2. Set a token
|
|
32
|
+
say " 2. Set a token in your Rails credentials:"
|
|
50
33
|
say " bin/rails credentials:edit"
|
|
51
34
|
say " # Add: rails_informant:"
|
|
52
35
|
say " # api_token: #{SecureRandom.hex 32}"
|
|
53
36
|
say ""
|
|
54
|
-
say " 3.
|
|
55
|
-
say "
|
|
56
|
-
say "
|
|
57
|
-
say ""
|
|
58
|
-
say " The token must match the api_token in your Rails credentials."
|
|
59
|
-
say " Add .envrc to .gitignore — it contains secrets."
|
|
60
|
-
say ""
|
|
61
|
-
say " 4. Optional — install the Claude Code skill:"
|
|
62
|
-
say " bin/rails generate rails_informant:skill"
|
|
37
|
+
say " 3. Install your AI agent integration:"
|
|
38
|
+
say " bin/rails generate rails_informant:skill # Claude Code"
|
|
39
|
+
say " bin/rails generate rails_informant:devin # Devin AI"
|
|
63
40
|
say ""
|
|
64
41
|
end
|
|
65
42
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "json"
|
|
1
2
|
require "rails/generators"
|
|
2
3
|
|
|
3
4
|
module RailsInformant
|
|
@@ -6,7 +7,42 @@ module RailsInformant
|
|
|
6
7
|
|
|
7
8
|
def copy_skill_file
|
|
8
9
|
copy_file "SKILL.md", ".claude/skills/informant/SKILL.md"
|
|
9
|
-
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create_or_update_mcp_json
|
|
13
|
+
mcp_path = File.join(destination_root, ".mcp.json")
|
|
14
|
+
informant_entry = { "command" => "informant-mcp" }
|
|
15
|
+
|
|
16
|
+
if File.exist?(mcp_path)
|
|
17
|
+
existing = JSON.parse(File.read(mcp_path))
|
|
18
|
+
existing["mcpServers"] ||= {}
|
|
19
|
+
existing["mcpServers"]["informant"] = informant_entry
|
|
20
|
+
create_file ".mcp.json", JSON.pretty_generate(existing) + "\n", force: true
|
|
21
|
+
else
|
|
22
|
+
create_file ".mcp.json", JSON.pretty_generate(
|
|
23
|
+
"mcpServers" => { "informant" => informant_entry }
|
|
24
|
+
) + "\n"
|
|
25
|
+
end
|
|
26
|
+
rescue JSON::ParserError
|
|
27
|
+
say "Could not parse existing .mcp.json — skipping merge. Add the informant server manually.", :red
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def print_next_steps
|
|
31
|
+
say ""
|
|
32
|
+
say "Claude Code integration installed!", :green
|
|
33
|
+
say ""
|
|
34
|
+
say " Created .mcp.json"
|
|
35
|
+
say " Created .claude/skills/informant/SKILL.md"
|
|
36
|
+
say ""
|
|
37
|
+
say "Next step — set env vars so the MCP server can reach your app.", :yellow
|
|
38
|
+
say "Add to your .envrc (or export manually):"
|
|
39
|
+
say ""
|
|
40
|
+
say " export INFORMANT_PRODUCTION_URL=https://your-app.com"
|
|
41
|
+
say " export INFORMANT_PRODUCTION_TOKEN=<same token from credentials>"
|
|
42
|
+
say ""
|
|
43
|
+
say "The token must match rails_informant.api_token in your Rails credentials."
|
|
44
|
+
say "Add .envrc to .gitignore — it contains secrets."
|
|
45
|
+
say ""
|
|
10
46
|
end
|
|
11
47
|
end
|
|
12
48
|
end
|