ask-rails-harness 0.2.1 → 0.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/README.md +7 -4
- data/lib/ask/rails/harness/railtie.rb +1 -0
- data/lib/ask/rails/harness/tool.rb +4 -33
- data/lib/ask/rails/harness/tools.rb +24 -0
- data/lib/ask/rails/harness/version.rb +1 -1
- data/lib/ask/rails/harness.rb +13 -143
- data/lib/ask/skills/rails.deploy_pipeline/SKILL.md +8 -8
- data/lib/ask/skills/rails.route_trouble/SKILL.md +7 -5
- metadata +7 -48
- data/lib/ask/rails/harness/audit_log.rb +0 -185
- data/lib/ask/rails/harness/configuration.rb +0 -73
- data/lib/ask/rails/harness/environment_permissions.rb +0 -41
- data/lib/ask/rails/harness/minitest_json_reporter.rb +0 -83
- data/lib/ask/rails/harness/tools/query_database.rb +0 -75
- data/lib/ask/rails/harness/tools/read_file.rb +0 -23
- data/lib/ask/rails/harness/tools/read_log.rb +0 -122
- data/lib/ask/rails/harness/tools/read_model.rb +0 -75
- data/lib/ask/rails/harness/tools/read_routes.rb +0 -20
- data/lib/ask/rails/harness/tools/run_command.rb +0 -60
- data/lib/ask/rails/harness/tools/run_tests.rb +0 -249
- data/lib/ask/rails/harness/tools/schema_graph.rb +0 -176
- data/lib/ask/rails/harness/tools/search_codebase.rb +0 -23
- data/lib/minitest/ask_rails_harness_plugin.rb +0 -39
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3138db7c116e0f0742a091cad7c5ecfdbe8263de2b27c892830e56d32e259691
|
|
4
|
+
data.tar.gz: b0a87afaed52e3d66313fea3c1d1536d19934876e1e52dd6503b4e3ce112aaed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1e3e71b34c262d91350dd2ccd213bdbca3915d75302307dbc3e94b89b1e803b98d0568ef7ea5b94b6a197b0859b53276f337a7d4885d8cf496cddf9f5ea65904
|
|
7
|
+
data.tar.gz: a6db27db6dfc1b050c45aa5bea45d6c1862937e45998f265ccb5226a5a09df94b4f73d0be486468a421854c55b7483ff655ed554d80e880979b90f9996d122cf
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
## [0.4.0] — 2026-08-10
|
|
2
|
+
|
|
3
|
+
### Changed
|
|
4
|
+
|
|
5
|
+
- **Generic tools moved to the new `ask-ruby-harness` gem** — `RunCommand`,
|
|
6
|
+
`QueryDatabase`, `ReadModel`, `ReadLog`, `SchemaGraph`, and `RunTests` now
|
|
7
|
+
live in the language-agnostic harness (`Ask::Ruby::Harness`), which this
|
|
8
|
+
gem depends on. This gem keeps the Rails-native surface: the Engine
|
|
9
|
+
(mount at /ask), railtie, generators, auth, persistence, and
|
|
10
|
+
`RouteInspector`.
|
|
11
|
+
- **Backward-compatible aliases** — `Ask::Rails::Harness::Tools::*`,
|
|
12
|
+
`Ask::Rails::Harness::AuditLog`, `Ask::Rails::Harness::Configuration`, and
|
|
13
|
+
`Ask::Rails::Harness::MinitestJsonReporter` still resolve (to the generic
|
|
14
|
+
implementations), and `Ask::Rails::Harness::Tool` subclasses the generic
|
|
15
|
+
base. `app_root` is pinned to `::Rails.root` by the railtie.
|
|
16
|
+
- **Audit notification renamed** — the generic audit log now fires
|
|
17
|
+
`audit_log.ask_ruby_harness` (was `audit_log.ask_rails_harness`).
|
|
18
|
+
|
|
19
|
+
### Removed
|
|
20
|
+
|
|
21
|
+
- `lib/minitest/ask_rails_harness_plugin.rb` — superseded by
|
|
22
|
+
`minitest/ask_ruby_harness_plugin.rb` in ask-ruby-harness.
|
|
23
|
+
|
|
24
|
+
## [0.3.0] — 2026-08-10
|
|
25
|
+
|
|
26
|
+
### Removed
|
|
27
|
+
|
|
28
|
+
- **`ReadFile`, `SearchCodebase`, `ReadRoutes` tools removed** — generic
|
|
29
|
+
file-read and grep capabilities that coding agents provide natively.
|
|
30
|
+
`RouteInspector` fully supersedes `ReadRoutes` (parsed table vs raw file,
|
|
31
|
+
including `draw`-split and engine routes). The harness now ships only
|
|
32
|
+
Rails-aware tools: `QueryDatabase`, `ReadModel`, `ReadLog`, `RunCommand`,
|
|
33
|
+
`SchemaGraph`, `RouteInspector`, `RunTests`. Skills updated to use the
|
|
34
|
+
shell `Read` tool and `RouteInspector`.
|
|
35
|
+
|
|
1
36
|
## [0.2.1] — 2026-08-10
|
|
2
37
|
|
|
3
38
|
### Fixed
|
data/README.md
CHANGED
|
@@ -68,15 +68,18 @@ Available settings: `default_model`, `max_turns`, `tool_concurrency`, `system_pr
|
|
|
68
68
|
|
|
69
69
|
| Tool | What it does |
|
|
70
70
|
|---|---|
|
|
71
|
-
| `ReadFile` | Read any file relative to `Rails.root` |
|
|
72
71
|
| `QueryDatabase` | Read-only SQL (non-SELECT rejected in production) |
|
|
73
72
|
| `ReadModel` | Inspect an ActiveRecord model's columns, associations, validations |
|
|
74
|
-
| `ReadRoutes` | Read `config/routes.rb` |
|
|
75
73
|
| `ReadLog` | Read log files with level/search filtering |
|
|
76
|
-
| `RunCommand` | Run shell commands in the app root |
|
|
77
|
-
| `SearchCodebase` | Grep the codebase |
|
|
74
|
+
| `RunCommand` | Run shell commands in the app root, gated by permission rules |
|
|
78
75
|
| `SchemaGraph` | Full schema introspection: models, tables, columns, associations |
|
|
79
76
|
| `RouteInspector` | Parsed route table with filters |
|
|
77
|
+
| `RunTests` | Structured test results with failure reruns (minitest/rspec) |
|
|
78
|
+
|
|
79
|
+
Generic file and search capabilities (read, grep, edit) are provided by the
|
|
80
|
+
agent's native tools; the harness focuses on what only a Rails-aware layer
|
|
81
|
+
can give an agent: database access, schema/model introspection, routes,
|
|
82
|
+
logs, and tests — all permission-gated and audited.
|
|
80
83
|
|
|
81
84
|
## Full documentation
|
|
82
85
|
|
|
@@ -17,6 +17,7 @@ module Ask
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
initializer "ask_rails_harness.configure" do |app|
|
|
20
|
+
Ask::Ruby::Harness.app_root = ::Rails.root
|
|
20
21
|
Ask::Rails::Harness.configuration.default_model ||= ENV["ASK_DEFAULT_MODEL"] || "gpt-4o"
|
|
21
22
|
Ask::Rails::Harness.configuration.max_turns ||= (ENV["ASK_MAX_TURNS"] || 25).to_i
|
|
22
23
|
end
|
|
@@ -3,39 +3,10 @@
|
|
|
3
3
|
module Ask
|
|
4
4
|
module Rails
|
|
5
5
|
module Harness
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# Override call to add audit logging around every tool execution.
|
|
12
|
-
# Logs the intent (sanitized params) and outcome (status, timing),
|
|
13
|
-
# but not the returned data.
|
|
14
|
-
def call(args = {}, abort_controller = nil)
|
|
15
|
-
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
16
|
-
result = super
|
|
17
|
-
duration_ms = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time) * 1000).round
|
|
18
|
-
|
|
19
|
-
AuditLog.log(
|
|
20
|
-
session_id: Thread.current[:ask_session_id],
|
|
21
|
-
tool_name: name,
|
|
22
|
-
params: args,
|
|
23
|
-
result: result,
|
|
24
|
-
duration_ms: duration_ms
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
result
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# Allow the session to set its ID for audit log correlation.
|
|
31
|
-
# Called by the agent loop before executing a tool.
|
|
32
|
-
def self.session_id=(id)
|
|
33
|
-
Thread.current[:ask_session_id] = id
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def self.session_id
|
|
37
|
-
Thread.current[:ask_session_id]
|
|
38
|
-
end
|
|
6
|
+
# The Rails edition's tool base. app_root is pinned to ::Rails.root by
|
|
7
|
+
# the railtie; everything else (audit logging, session correlation)
|
|
8
|
+
# comes from the generic ask-ruby-harness base.
|
|
9
|
+
class Tool < Ask::Ruby::Harness::Tool
|
|
39
10
|
end
|
|
40
11
|
end
|
|
41
12
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Backward-compatible constant aliases: the generic tools moved to
|
|
4
|
+
# ask-ruby-harness (Ask::Ruby::Harness::Tools::*). Existing references to
|
|
5
|
+
# Ask::Rails::Harness::Tools::*, AuditLog, and Configuration keep working.
|
|
6
|
+
# (MinitestJsonReporter is intentionally not aliased — it lives behind the
|
|
7
|
+
# minitest plugin and must not load minitest at app boot.)
|
|
8
|
+
module Ask
|
|
9
|
+
module Rails
|
|
10
|
+
module Harness
|
|
11
|
+
Configuration = Ask::Ruby::Harness::Configuration
|
|
12
|
+
AuditLog = Ask::Ruby::Harness::AuditLog
|
|
13
|
+
|
|
14
|
+
module Tools
|
|
15
|
+
RunCommand = Ask::Ruby::Harness::Tools::RunCommand
|
|
16
|
+
QueryDatabase = Ask::Ruby::Harness::Tools::QueryDatabase
|
|
17
|
+
ReadModel = Ask::Ruby::Harness::Tools::ReadModel
|
|
18
|
+
ReadLog = Ask::Ruby::Harness::Tools::ReadLog
|
|
19
|
+
SchemaGraph = Ask::Ruby::Harness::Tools::SchemaGraph
|
|
20
|
+
RunTests = Ask::Ruby::Harness::Tools::RunTests
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
data/lib/ask/rails/harness.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "rails"
|
|
4
|
-
require "ask/
|
|
4
|
+
require "ask/ruby/harness"
|
|
5
5
|
require "ask/auth"
|
|
6
6
|
require "time"
|
|
7
7
|
|
|
@@ -9,148 +9,31 @@ module Ask
|
|
|
9
9
|
module Rails
|
|
10
10
|
module Harness
|
|
11
11
|
class << self
|
|
12
|
+
# The Rails edition shares the generic configuration — the generic
|
|
13
|
+
# gem owns the runtime, this gem adapts it to Rails.
|
|
12
14
|
def configure
|
|
13
15
|
yield configuration
|
|
14
16
|
end
|
|
15
17
|
|
|
16
18
|
def configuration
|
|
17
|
-
|
|
19
|
+
Ask::Ruby::Harness.configuration
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def agent_session(**extra)
|
|
21
|
-
|
|
22
|
-
cleanup! if configuration.max_session_age || configuration.max_sessions
|
|
23
|
-
|
|
24
|
-
tools = configuration.tools.map { |t| t.is_a?(Class) ? t.new : t }
|
|
25
|
-
prompt = extra.delete(:system_prompt) || configuration.system_prompt || default_system_prompt
|
|
26
|
-
|
|
27
|
-
# Resolve environment-specific permissions and wire into agent hooks
|
|
28
|
-
hooks = build_environment_hooks
|
|
29
|
-
|
|
30
|
-
Ask::Agent::Session.new(
|
|
31
|
-
model: configuration.default_model,
|
|
32
|
-
max_turns: configuration.max_turns,
|
|
33
|
-
system_prompt: prompt,
|
|
34
|
-
tools: tools,
|
|
35
|
-
state: configuration.persistence_adapter,
|
|
36
|
-
hooks: hooks,
|
|
37
|
-
**extra
|
|
38
|
-
)
|
|
23
|
+
Ask::Ruby::Harness.agent_session(**extra)
|
|
39
24
|
end
|
|
40
25
|
|
|
41
26
|
def discover_tools!
|
|
42
|
-
|
|
27
|
+
Ask::Ruby::Harness.discover_tools!
|
|
43
28
|
end
|
|
44
29
|
|
|
45
|
-
# Prune old sessions and audit logs based on configuration limits.
|
|
46
|
-
#
|
|
47
|
-
# Removes sessions older than +max_session_age+ seconds, and limits the
|
|
48
|
-
# total number of sessions to +max_sessions+ (deleting the oldest first).
|
|
49
|
-
# Audit log entries older than the oldest kept session are also removed.
|
|
50
|
-
#
|
|
51
|
-
# Call manually via rake task or cron, or configure limits to auto-prune
|
|
52
|
-
# on agent_session creation.
|
|
53
30
|
def cleanup!
|
|
54
|
-
|
|
55
|
-
limit_session_count
|
|
31
|
+
Ask::Ruby::Harness.cleanup!
|
|
56
32
|
end
|
|
57
33
|
|
|
58
34
|
def root
|
|
59
35
|
@root ||= Pathname.new(File.expand_path("../..", __dir__))
|
|
60
36
|
end
|
|
61
|
-
|
|
62
|
-
private
|
|
63
|
-
|
|
64
|
-
def build_environment_hooks
|
|
65
|
-
env_mode = configuration.effective_mode
|
|
66
|
-
return {} unless env_mode
|
|
67
|
-
|
|
68
|
-
perms = Ask::Agent::Policies::Permissions.new(mode: env_mode)
|
|
69
|
-
{ before_tool: [perms.method(:before_tool_call)] }
|
|
70
|
-
rescue ArgumentError => e
|
|
71
|
-
warn "[ask-rails-harness] Invalid environment mode: #{e.message}"
|
|
72
|
-
{}
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def prune_old_sessions
|
|
76
|
-
age = configuration.max_session_age
|
|
77
|
-
return unless age&.> 0
|
|
78
|
-
return unless persistence_available?
|
|
79
|
-
|
|
80
|
-
cutoff = age.seconds.ago
|
|
81
|
-
count = 0
|
|
82
|
-
|
|
83
|
-
configuration.persistence_adapter.list.each do |id|
|
|
84
|
-
data = configuration.persistence_adapter.load(id)
|
|
85
|
-
created = data&.dig(:metadata, :created_at)
|
|
86
|
-
if created && Time.parse(created) < cutoff
|
|
87
|
-
configuration.persistence_adapter.delete(id)
|
|
88
|
-
count += 1
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
count
|
|
93
|
-
rescue StandardError
|
|
94
|
-
nil
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def limit_session_count
|
|
98
|
-
max = configuration.max_sessions
|
|
99
|
-
return unless max&.> 0
|
|
100
|
-
return unless persistence_available?
|
|
101
|
-
|
|
102
|
-
sessions = configuration.persistence_adapter.list
|
|
103
|
-
excess = sessions.size - max
|
|
104
|
-
return unless excess > 0
|
|
105
|
-
|
|
106
|
-
# Delete oldest sessions first
|
|
107
|
-
with_timestamps = sessions.map { |id|
|
|
108
|
-
data = configuration.persistence_adapter.load(id)
|
|
109
|
-
created = data&.dig(:metadata, :created_at)
|
|
110
|
-
[id, created ? Time.parse(created) : Time.at(0)]
|
|
111
|
-
}.sort_by(&:last)
|
|
112
|
-
|
|
113
|
-
with_timestamps.first(excess).each do |id, _|
|
|
114
|
-
configuration.persistence_adapter.delete(id)
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
excess
|
|
118
|
-
rescue StandardError
|
|
119
|
-
nil
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def persistence_available?
|
|
123
|
-
defined?(ActiveRecord::Base) &&
|
|
124
|
-
ActiveRecord::Base.connection.data_source_exists?("ask_sessions")
|
|
125
|
-
rescue StandardError
|
|
126
|
-
false
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def core_rails_tools
|
|
130
|
-
CORE_RAILS_TOOLS.map(&:new)
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
def discovered_user_tools
|
|
134
|
-
tools = []
|
|
135
|
-
files = Dir[::Rails.root.join("app", "tools", "*.rb")]
|
|
136
|
-
files.each do |f|
|
|
137
|
-
require f
|
|
138
|
-
klass = File.basename(f, ".rb").camelize.constantize rescue next
|
|
139
|
-
tools << klass if klass < Ask::Rails::Harness::Tool
|
|
140
|
-
end
|
|
141
|
-
tools
|
|
142
|
-
rescue
|
|
143
|
-
tools
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
def default_system_prompt
|
|
147
|
-
<<~PROMPT
|
|
148
|
-
You are a Ruby on Rails software engineer.
|
|
149
|
-
You have direct access to the application's code, database, and runtime.
|
|
150
|
-
Use your tools to inspect and modify the codebase.
|
|
151
|
-
Once you have enough information, stop calling tools and give your answer.
|
|
152
|
-
PROMPT
|
|
153
|
-
end
|
|
154
37
|
end
|
|
155
38
|
end
|
|
156
39
|
end
|
|
@@ -158,35 +41,22 @@ end
|
|
|
158
41
|
|
|
159
42
|
require_relative "harness/version"
|
|
160
43
|
require_relative "harness/engine"
|
|
161
|
-
require_relative "harness/configuration"
|
|
162
|
-
require_relative "harness/audit_log"
|
|
163
|
-
require_relative "harness/environment_permissions"
|
|
164
44
|
require_relative "harness/auth"
|
|
165
45
|
require_relative "harness/persistence"
|
|
166
46
|
require_relative "harness/service_discovery"
|
|
167
47
|
require_relative "harness/tool"
|
|
168
|
-
require_relative "harness/tools
|
|
169
|
-
require_relative "harness/tools/run_command"
|
|
170
|
-
require_relative "harness/tools/search_codebase"
|
|
171
|
-
require_relative "harness/tools/read_routes"
|
|
172
|
-
require_relative "harness/tools/query_database"
|
|
173
|
-
require_relative "harness/tools/read_model"
|
|
174
|
-
require_relative "harness/tools/read_log"
|
|
175
|
-
require_relative "harness/tools/schema_graph"
|
|
48
|
+
require_relative "harness/tools" # backward-compat constant aliases
|
|
176
49
|
require_relative "harness/tools/route_inspector"
|
|
177
|
-
require_relative "harness/tools/run_tests"
|
|
178
|
-
require_relative "harness/minitest_json_reporter"
|
|
179
50
|
|
|
180
51
|
# Railtie is loaded only when Rails is fully available
|
|
181
52
|
if defined?(::Rails::Railtie)
|
|
182
53
|
require_relative "harness/railtie"
|
|
183
54
|
end
|
|
184
55
|
|
|
185
|
-
# Define after all tool files are loaded so the constants resolve
|
|
56
|
+
# Define after all tool files are loaded so the constants resolve. The
|
|
57
|
+
# generic Rails-aware tools come from ask-ruby-harness; this gem adds the
|
|
58
|
+
# Rails-native ones (RouteInspector) on top.
|
|
186
59
|
Ask::Rails::Harness::CORE_RAILS_TOOLS = [
|
|
187
|
-
Ask::
|
|
188
|
-
Ask::Rails::Harness::Tools::
|
|
189
|
-
Ask::Rails::Harness::Tools::QueryDatabase, Ask::Rails::Harness::Tools::ReadModel,
|
|
190
|
-
Ask::Rails::Harness::Tools::ReadLog, Ask::Rails::Harness::Tools::SchemaGraph,
|
|
191
|
-
Ask::Rails::Harness::Tools::RouteInspector, Ask::Rails::Harness::Tools::RunTests
|
|
60
|
+
*Ask::Ruby::Harness::HARNESS_TOOLS,
|
|
61
|
+
Ask::Rails::Harness::Tools::RouteInspector
|
|
192
62
|
].freeze
|
|
@@ -15,7 +15,7 @@ RunCommand.new.call(command: "bin/rails db:migrate:status | grep 'down'")
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
If there are pending migrations:
|
|
18
|
-
1. Review them with `
|
|
18
|
+
1. Review them with `Read.new.call(path: Rails.root.join("db/migrate/<TIMESTAMP>_migration_name.rb").to_s)`
|
|
19
19
|
2. Verify they're reversible: check `change`, `up`/`down`, or `reversible` blocks
|
|
20
20
|
3. Check for data migrations (e.g., backfills) that should run separately
|
|
21
21
|
4. Estimate execution time — large tables may need locking strategy
|
|
@@ -38,8 +38,8 @@ For importmap or esbuild/vite setups:
|
|
|
38
38
|
|
|
39
39
|
```ruby
|
|
40
40
|
# Check build config
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
Read.new.call(path: Rails.root.join("package.json").to_s)
|
|
42
|
+
Read.new.call(path: Rails.root.join("vite.config.ts").to_s) if Rails.root.join("vite.config.ts").exist?
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
## Step 3: Review Credentials and Secrets
|
|
@@ -70,7 +70,7 @@ Glob.new.call(pattern: "app/jobs/**/*.rb")
|
|
|
70
70
|
For any new or modified jobs:
|
|
71
71
|
1. Verify the queue adapter is configured in `production.rb`
|
|
72
72
|
2. Check for job retry logic that might affect rollback
|
|
73
|
-
3. Review `
|
|
73
|
+
3. Review `Read.new.call(path: Rails.root.join("config/sidekiq.yml").to_s)` if using Sidekiq
|
|
74
74
|
4. Verify scheduled/cron jobs if using `sidekiq-cron` or `whenever`
|
|
75
75
|
|
|
76
76
|
## Step 5: Review Production Log for Pre-deploy Issues
|
|
@@ -102,10 +102,10 @@ RunCommand.new.call(command: "bundle platform")
|
|
|
102
102
|
Verify configuration files for the target environment:
|
|
103
103
|
|
|
104
104
|
```ruby
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
Read.new.call(path: Rails.root.join("config/environments/production.rb").to_s)
|
|
106
|
+
Read.new.call(path: Rails.root.join("config/database.yml").to_s)
|
|
107
|
+
Read.new.call(path: Rails.root.join("config/cable.yml").to_s) if Rails.root.join("config/cable.yml").exist?
|
|
108
|
+
Read.new.call(path: Rails.root.join("config/storage.yml").to_s) if Rails.root.join("config/storage.yml").exist?
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
Key production checks:
|
|
@@ -6,15 +6,17 @@ description: Step-by-step methodology for debugging routing issues in Rails
|
|
|
6
6
|
Use this skill when a route is returning 404, you're getting route matching errors,
|
|
7
7
|
or routes aren't behaving as expected in a Rails application.
|
|
8
8
|
|
|
9
|
-
## Step 1:
|
|
9
|
+
## Step 1: Inspect the Route Table
|
|
10
10
|
|
|
11
|
-
Start by examining the
|
|
11
|
+
Start by examining the parsed route table:
|
|
12
12
|
|
|
13
13
|
```ruby
|
|
14
|
-
|
|
14
|
+
RouteInspector.new.call
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
This
|
|
17
|
+
This returns every route with its verb, path, controller, action, and name —
|
|
18
|
+
covering routes split across `draw` files and engines that a raw read of
|
|
19
|
+
`config/routes.rb` would miss.
|
|
18
20
|
|
|
19
21
|
Look for:
|
|
20
22
|
- The overall structure (namespaced, nested, shallow routes?)
|
|
@@ -82,7 +84,7 @@ error message tells you what routes were tried before failing.
|
|
|
82
84
|
If the route exists but the controller isn't found:
|
|
83
85
|
|
|
84
86
|
```ruby
|
|
85
|
-
|
|
87
|
+
Read.new.call(path: Rails.root.join("app/controllers/users_controller.rb").to_s)
|
|
86
88
|
```
|
|
87
89
|
|
|
88
90
|
## Step 5: Check Namespace and Module Nesting
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ask-rails-harness
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kaka Ruto
|
|
@@ -24,7 +24,7 @@ dependencies:
|
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '7.1'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: ask-
|
|
27
|
+
name: ask-ruby-harness
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
@@ -37,34 +37,6 @@ dependencies:
|
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '0.1'
|
|
40
|
-
- !ruby/object:Gem::Dependency
|
|
41
|
-
name: ask-tools-shell
|
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - ">="
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0.1'
|
|
47
|
-
type: :runtime
|
|
48
|
-
prerelease: false
|
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - ">="
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0.1'
|
|
54
|
-
- !ruby/object:Gem::Dependency
|
|
55
|
-
name: ask-agent
|
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - ">="
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: 0.28.0
|
|
61
|
-
type: :runtime
|
|
62
|
-
prerelease: false
|
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - ">="
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: 0.28.0
|
|
68
40
|
- !ruby/object:Gem::Dependency
|
|
69
41
|
name: ask-auth
|
|
70
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -135,10 +107,10 @@ dependencies:
|
|
|
135
107
|
- - "~>"
|
|
136
108
|
- !ruby/object:Gem::Version
|
|
137
109
|
version: '13.0'
|
|
138
|
-
description: Rails Engine that mounts an admin AI agent at /ask. Ships
|
|
139
|
-
tools (
|
|
140
|
-
|
|
141
|
-
|
|
110
|
+
description: Rails Engine that mounts an admin AI agent at /ask. Ships Rails-aware
|
|
111
|
+
tools (QueryDatabase, ReadModel, ReadLog, RunCommand, SchemaGraph, RouteInspector,
|
|
112
|
+
RunTests), session persistence, audit logging, environment permissions, and service
|
|
113
|
+
gem discovery. Previously developed as ask-rails (0.1.0–0.11.1).
|
|
142
114
|
email:
|
|
143
115
|
- kaka@myrrlabs.com
|
|
144
116
|
executables: []
|
|
@@ -155,26 +127,14 @@ files:
|
|
|
155
127
|
- config/routes.rb
|
|
156
128
|
- lib/ask-rails-harness.rb
|
|
157
129
|
- lib/ask/rails/harness.rb
|
|
158
|
-
- lib/ask/rails/harness/audit_log.rb
|
|
159
130
|
- lib/ask/rails/harness/auth.rb
|
|
160
|
-
- lib/ask/rails/harness/configuration.rb
|
|
161
131
|
- lib/ask/rails/harness/engine.rb
|
|
162
|
-
- lib/ask/rails/harness/environment_permissions.rb
|
|
163
|
-
- lib/ask/rails/harness/minitest_json_reporter.rb
|
|
164
132
|
- lib/ask/rails/harness/persistence.rb
|
|
165
133
|
- lib/ask/rails/harness/railtie.rb
|
|
166
134
|
- lib/ask/rails/harness/service_discovery.rb
|
|
167
135
|
- lib/ask/rails/harness/tool.rb
|
|
168
|
-
- lib/ask/rails/harness/tools
|
|
169
|
-
- lib/ask/rails/harness/tools/read_file.rb
|
|
170
|
-
- lib/ask/rails/harness/tools/read_log.rb
|
|
171
|
-
- lib/ask/rails/harness/tools/read_model.rb
|
|
172
|
-
- lib/ask/rails/harness/tools/read_routes.rb
|
|
136
|
+
- lib/ask/rails/harness/tools.rb
|
|
173
137
|
- lib/ask/rails/harness/tools/route_inspector.rb
|
|
174
|
-
- lib/ask/rails/harness/tools/run_command.rb
|
|
175
|
-
- lib/ask/rails/harness/tools/run_tests.rb
|
|
176
|
-
- lib/ask/rails/harness/tools/schema_graph.rb
|
|
177
|
-
- lib/ask/rails/harness/tools/search_codebase.rb
|
|
178
138
|
- lib/ask/rails/harness/version.rb
|
|
179
139
|
- lib/ask/skills/rails.db_debug/SKILL.md
|
|
180
140
|
- lib/ask/skills/rails.deploy_pipeline/SKILL.md
|
|
@@ -183,7 +143,6 @@ files:
|
|
|
183
143
|
- lib/generators/ask/rails/harness/install/templates/audit_log_migration.rb
|
|
184
144
|
- lib/generators/ask/rails/harness/install/templates/initializer.rb
|
|
185
145
|
- lib/generators/ask/rails/harness/install/templates/migration.rb
|
|
186
|
-
- lib/minitest/ask_rails_harness_plugin.rb
|
|
187
146
|
homepage: https://github.com/ask-rb/ask-rails-harness
|
|
188
147
|
licenses:
|
|
189
148
|
- MIT
|