rails-informant 0.5.1 → 0.5.2

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: ef3e66d24feee02958d2d57db85411ec1e19db17fa0cc440936c3f2072016d7c
4
- data.tar.gz: a43101bb80bffbad9d1a940d06e2a2d35bc5a8853a2978d5ada0dfdcbd87063d
3
+ metadata.gz: df864c72b8d47ff6e08332fe9df58a1540a19dba41c0c1c66a90bb0257572f5a
4
+ data.tar.gz: cd0d0f7f000e32edb7c9e8afc945407370718aded879322c74fd346304660a3c
5
5
  SHA512:
6
- metadata.gz: 626124766b399453b846fb37ea492a9cc971206dafcbe5019e050b8adde854f20a55944c84f8906d03c5a55255530480c7599dd3aaf143ac37bc4aca743ae83a
7
- data.tar.gz: 8fb18f7ab56d4044601224d6c7c20ffcc77944517738d2a7fded15470fc3a18bb83ae963b6784305145519166d54f887b39e84f34c7ff3b5e2623581fd85096c
6
+ metadata.gz: 80629c20d8551b7c07528c49a6eac833065e743b9e75fbbdceab58eddc06dd7792d7a648ff63cda66d81e39d9a0d82bc14abd38abf5adfe001774ddd9810b1a6
7
+ data.tar.gz: ca790a7b34a26af218c14798228fc2c005649d9e11da611680871e52d082dec192e755398f90cebc9e2a0ae4ca0c9ff82b7b923b0deb997ea34b448a79c78270
data/README.md CHANGED
@@ -87,6 +87,7 @@ Every option can be set via an environment variable. The initializer takes prece
87
87
  |--------|---------|---------|-------------|
88
88
  | `api_token` | `INFORMANT_API_TOKEN` | `nil` | Authentication token for API/MCP access |
89
89
  | `capture_errors` | `INFORMANT_CAPTURE_ERRORS` | `true` | Enable/disable error capture |
90
+ | `capture_runner_errors` | `INFORMANT_CAPTURE_RUNNER_ERRORS` | `true` | Capture errors raised under `rails runner` |
90
91
  | `capture_user_email` | _(none)_ | `false` | Capture email from detected user (PII -- opt-in) |
91
92
  | `ignored_exceptions` | `INFORMANT_IGNORED_EXCEPTIONS` | `[]` | Exception classes to skip (walks cause chain) |
92
93
  | `ignored_paths` | `INFORMANT_IGNORED_PATHS` | `[]` | Request paths to skip (exact or segment match) |
@@ -126,6 +127,19 @@ is recorded and no notifications are sent. You see exceptions live at the prompt
126
127
  recording and alerting on them would only be noise. This is always on and not configurable.
127
128
  Errors from web requests, background jobs, and rake tasks are captured as normal.
128
129
 
130
+ ### Rails Runner
131
+
132
+ `rails runner` is captured by default, because it is how many apps run cron and scheduled
133
+ tasks -- exactly the errors you want to hear about. If your app instead uses it by hand, for
134
+ one-off production data corrections, the operator already sees the exception on their own
135
+ terminal and recording it only pages the team:
136
+
137
+ ```ruby
138
+ config.capture_runner_errors = false
139
+ ```
140
+
141
+ That applies only to `rails runner`; requests, jobs and rake tasks are captured either way.
142
+
129
143
  ### Silenced Blocks
130
144
 
131
145
  ```ruby
@@ -192,6 +206,22 @@ export INFORMANT_STAGING_URL=https://staging.myapp.com
192
206
  export INFORMANT_STAGING_TOKEN=<token>
193
207
  ```
194
208
 
209
+ ### Keeping it in sync
210
+
211
+ The generator's output (`.claude/`, `.mcp.json`) is committed to your app, so a gem update leaves those files untouched. After `bundle update rails-informant`, re-run the generator and commit the result to pick up template changes:
212
+
213
+ ```sh
214
+ bin/rails generate rails_informant:skill
215
+ ```
216
+
217
+ Re-running migrates any prior hook registration in place, so there are no duplicates. The gem also flags drift when the committed files fall behind the installed version — via a warning on dev boot, an in-session Claude Code nudge, and an on-demand check:
218
+
219
+ ```sh
220
+ bin/rails informant:doctor # reports current / stale / not installed; exits nonzero when stale
221
+ ```
222
+
223
+ Apps that use the gem only for error capture (no Claude Code integration) are never affected.
224
+
195
225
  ### Tools
196
226
 
197
227
  | Tool | Description |
@@ -1,6 +1,7 @@
1
1
  module RailsInformant
2
2
  class Configuration
3
3
  attr_accessor :capture_errors,
4
+ :capture_runner_errors,
4
5
  :capture_user_email,
5
6
  :api_token,
6
7
  :ignored_exceptions,
@@ -17,6 +18,7 @@ module RailsInformant
17
18
  @api_token = ENV["INFORMANT_API_TOKEN"]
18
19
  @app_name = ENV["INFORMANT_APP_NAME"]
19
20
  @capture_errors = ENV.fetch("INFORMANT_CAPTURE_ERRORS", "true") != "false"
21
+ @capture_runner_errors = ENV.fetch("INFORMANT_CAPTURE_RUNNER_ERRORS", "true") != "false"
20
22
  @capture_user_email = false
21
23
  @custom_notifiers = []
22
24
  @ignored_exceptions = ENV["INFORMANT_IGNORED_EXCEPTIONS"]&.split(",")&.map(&:strip) || []
@@ -15,6 +15,10 @@ module RailsInformant
15
15
  # Never capture from an interactive console — the operator sees errors
16
16
  # live, so recording and alerting on them is noise.
17
17
  return if RailsInformant.console_mode?
18
+ # `rails runner` is the same shape when an operator drives it by hand, but it also
19
+ # backs cron and scheduled tasks, where those errors are the whole point. Apps that
20
+ # only use it interactively opt out; capturing stays the default.
21
+ return if RailsInformant.runner_mode? && !RailsInformant.config.capture_runner_errors
18
22
  return unless RailsInformant.initialized?
19
23
  return if self_caused_error?(error)
20
24
 
@@ -139,6 +139,11 @@ module RailsInformant
139
139
  defined?(Rails::Console)
140
140
  end
141
141
 
142
+ # `rails runner` loads this command class; a server, worker or rake process never does.
143
+ def runner_mode?
144
+ defined?(Rails::Command::RunnerCommand)
145
+ end
146
+
142
147
  def server_mode?
143
148
  defined?(Rails::Server)
144
149
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-informant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel López Prat
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  - !ruby/object:Gem::Version
199
199
  version: '0'
200
200
  requirements: []
201
- rubygems_version: 4.0.10
201
+ rubygems_version: 4.0.16
202
202
  specification_version: 4
203
203
  summary: Self-hosted error monitoring for Rails with MCP server for agentic workflows
204
204
  test_files: []