woods 1.6.2 → 2.0.0.beta1

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.
Files changed (278) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1889 -11
  3. data/CONTRIBUTING.md +195 -129
  4. data/README.md +162 -520
  5. data/SECURITY.md +92 -0
  6. data/assets/woods-wordmark-white-with-bg.png +0 -0
  7. data/docs/AGENT_GUIDE.md +204 -0
  8. data/docs/AGENT_SETUP.md +205 -0
  9. data/docs/BACKEND_MATRIX.md +470 -0
  10. data/docs/CONFIGURATION_REFERENCE.md +620 -0
  11. data/docs/CONSOLE_MCP_SETUP.md +829 -0
  12. data/docs/DOCKER_SETUP.md +454 -0
  13. data/docs/EMBEDDING_MODELS.md +136 -0
  14. data/docs/EVALUATION.md +91 -0
  15. data/docs/EXTRACTOR_REFERENCE.md +765 -0
  16. data/docs/FAQ.md +544 -0
  17. data/docs/GETTING_STARTED.md +183 -0
  18. data/docs/INCREMENTAL_EXTRACTION.md +415 -0
  19. data/docs/INTERNALS.md +415 -0
  20. data/docs/MCP_HTTP_TRANSPORT.md +144 -0
  21. data/docs/MCP_SERVERS.md +231 -0
  22. data/docs/MCP_TOOL_COOKBOOK.md +987 -0
  23. data/docs/MCP_WORKTREE_SETUP.md +127 -0
  24. data/docs/NOTION_INTEGRATION.md +283 -0
  25. data/docs/OBSIDIAN_INTEGRATION.md +170 -0
  26. data/docs/PUBLISHED_INDEX.md +197 -0
  27. data/docs/README.md +94 -0
  28. data/docs/RETRIEVAL_GUIDE.md +267 -0
  29. data/docs/TOKEN_BENCHMARK.md +68 -0
  30. data/docs/TROUBLESHOOTING.md +841 -0
  31. data/docs/UNBLOCKED_INTEGRATION.md +279 -0
  32. data/docs/UPGRADING_TO_2.md +321 -0
  33. data/docs/WATCH_DAEMON.md +667 -0
  34. data/docs/WHY_WOODS.md +219 -0
  35. data/exe/woods-console +40 -4
  36. data/exe/woods-console-mcp +21 -35
  37. data/exe/woods-mcp +20 -7
  38. data/exe/woods-mcp-http +77 -10
  39. data/exe/woods-mcp-start +57 -52
  40. data/lib/generators/woods/install_generator.rb +6 -5
  41. data/lib/generators/woods/pgvector_generator.rb +6 -3
  42. data/lib/generators/woods/templates/add_pgvector_to_woods.rb.erb +29 -9
  43. data/lib/generators/woods/templates/create_woods_tables.rb.erb +5 -1
  44. data/lib/generators/woods/templates/woods.rb.tt +49 -28
  45. data/lib/tasks/woods.rake +622 -168
  46. data/lib/tasks/woods_checks.rake +107 -0
  47. data/lib/tasks/woods_evaluation.rake +164 -80
  48. data/lib/woods/ast/call_site_extractor.rb +6 -15
  49. data/lib/woods/ast/method_extractor.rb +19 -9
  50. data/lib/woods/ast/parser.rb +54 -8
  51. data/lib/woods/atomic_file.rb +40 -1
  52. data/lib/woods/builder.rb +310 -22
  53. data/lib/woods/cache/cache_middleware.rb +7 -2
  54. data/lib/woods/cache/cache_store.rb +9 -1
  55. data/lib/woods/cache/solid_cache_store.rb +6 -4
  56. data/lib/woods/change_set.rb +88 -0
  57. data/lib/woods/checks/generation_resolution.rb +34 -0
  58. data/lib/woods/checks/moved_messages.rb +186 -0
  59. data/lib/woods/chunking/semantic_chunker.rb +160 -18
  60. data/lib/woods/console/audit_logger.rb +12 -3
  61. data/lib/woods/console/bridge_protocol.rb +3 -16
  62. data/lib/woods/console/connection_manager.rb +51 -136
  63. data/lib/woods/console/credential_index.rb +2 -20
  64. data/lib/woods/console/credential_scanner.rb +14 -14
  65. data/lib/woods/console/dispatch_pipeline.rb +42 -12
  66. data/lib/woods/console/embedded_executor.rb +806 -149
  67. data/lib/woods/console/eval_guard.rb +27 -20
  68. data/lib/woods/console/input_contract.rb +78 -0
  69. data/lib/woods/console/model_validator.rb +29 -1
  70. data/lib/woods/console/rack_middleware.rb +63 -43
  71. data/lib/woods/console/redactor.rb +26 -8
  72. data/lib/woods/console/safe_context.rb +58 -10
  73. data/lib/woods/console/scope_predicate_parser.rb +41 -0
  74. data/lib/woods/console/server.rb +135 -265
  75. data/lib/woods/console/sql_noise_stripper.rb +125 -16
  76. data/lib/woods/console/sql_table_scanner.rb +82 -22
  77. data/lib/woods/console/sql_validator.rb +459 -29
  78. data/lib/woods/console/table_gate.rb +2 -2
  79. data/lib/woods/console/tool_specs.rb +462 -88
  80. data/lib/woods/console/tools/tier1.rb +0 -3
  81. data/lib/woods/console/tools/tier4.rb +17 -7
  82. data/lib/woods/coordination/lock_heartbeat.rb +103 -0
  83. data/lib/woods/coordination/pipeline_lock.rb +263 -53
  84. data/lib/woods/db/migrations/007_typed_snapshot_units.rb +45 -0
  85. data/lib/woods/db/migrator.rb +3 -9
  86. data/lib/woods/db/schema_version.rb +47 -2
  87. data/lib/woods/dependency_graph.rb +898 -64
  88. data/lib/woods/embedding/fake.rb +138 -0
  89. data/lib/woods/embedding/indexer.rb +832 -40
  90. data/lib/woods/embedding/openai.rb +77 -19
  91. data/lib/woods/embedding/provider.rb +189 -11
  92. data/lib/woods/embedding/text_preparer.rb +1 -1
  93. data/lib/woods/embedding/token_counter.rb +0 -7
  94. data/lib/woods/evaluation/ablation_agent_payload.rb +38 -0
  95. data/lib/woods/evaluation/ablation_executor.rb +67 -0
  96. data/lib/woods/evaluation/ablation_provenance.rb +38 -0
  97. data/lib/woods/evaluation/ablation_report_writer.rb +43 -0
  98. data/lib/woods/evaluation/ablation_runner.rb +173 -0
  99. data/lib/woods/evaluation/ablation_summary.rb +65 -0
  100. data/lib/woods/evaluation/ablation_task.rb +66 -0
  101. data/lib/woods/evaluation/ablation_task_set.rb +77 -0
  102. data/lib/woods/evaluation/ablation_timed_executor.rb +91 -0
  103. data/lib/woods/evaluation/ablation_worktree.rb +71 -0
  104. data/lib/woods/evaluation/baseline.rb +60 -0
  105. data/lib/woods/evaluation/baseline_runner.rb +11 -3
  106. data/lib/woods/evaluation/evaluator.rb +41 -8
  107. data/lib/woods/evaluation/query_set.rb +79 -13
  108. data/lib/woods/evaluation/report_generator.rb +20 -1
  109. data/lib/woods/export/unit_facts.rb +0 -11
  110. data/lib/woods/extracted_unit.rb +22 -63
  111. data/lib/woods/extractor.rb +2503 -192
  112. data/lib/woods/extractors/action_cable_extractor.rb +9 -4
  113. data/lib/woods/extractors/ast_source_extraction.rb +20 -2
  114. data/lib/woods/extractors/caching_extractor.rb +46 -12
  115. data/lib/woods/extractors/callback_analyzer.rb +39 -9
  116. data/lib/woods/extractors/component_discovery.rb +123 -0
  117. data/lib/woods/extractors/concern_extractor.rb +17 -3
  118. data/lib/woods/extractors/controller_extractor.rb +389 -29
  119. data/lib/woods/extractors/decorator_extractor.rb +7 -14
  120. data/lib/woods/extractors/engine_extractor.rb +53 -8
  121. data/lib/woods/extractors/event_extractor.rb +55 -4
  122. data/lib/woods/extractors/factory_extractor.rb +49 -11
  123. data/lib/woods/extractors/graphql_extractor.rb +162 -66
  124. data/lib/woods/extractors/i18n_extractor.rb +6 -1
  125. data/lib/woods/extractors/job_extractor.rb +51 -21
  126. data/lib/woods/extractors/lib_extractor.rb +23 -17
  127. data/lib/woods/extractors/line_neutralizer.rb +171 -0
  128. data/lib/woods/extractors/mailer_extractor.rb +9 -1
  129. data/lib/woods/extractors/manager_extractor.rb +19 -2
  130. data/lib/woods/extractors/migration_extractor.rb +22 -11
  131. data/lib/woods/extractors/model_extractor.rb +292 -57
  132. data/lib/woods/extractors/package_extractor.rb +154 -0
  133. data/lib/woods/extractors/phlex_extractor.rb +18 -3
  134. data/lib/woods/extractors/policy_extractor.rb +6 -5
  135. data/lib/woods/extractors/poro_extractor.rb +13 -14
  136. data/lib/woods/extractors/pundit_extractor.rb +3 -3
  137. data/lib/woods/extractors/rails_source_extractor.rb +24 -7
  138. data/lib/woods/extractors/rake_task_extractor.rb +158 -30
  139. data/lib/woods/extractors/reference_patterns.rb +38 -0
  140. data/lib/woods/extractors/route_extractor.rb +58 -2
  141. data/lib/woods/extractors/scheduled_job_extractor.rb +51 -35
  142. data/lib/woods/extractors/serializer_extractor.rb +3 -4
  143. data/lib/woods/extractors/service_extractor.rb +11 -1
  144. data/lib/woods/extractors/shared_dependency_scanner.rb +24 -34
  145. data/lib/woods/extractors/shared_utility_methods.rb +36 -6
  146. data/lib/woods/extractors/source_nesting.rb +560 -0
  147. data/lib/woods/extractors/state_machine_extractor.rb +30 -18
  148. data/lib/woods/extractors/test_mapping_extractor.rb +26 -9
  149. data/lib/woods/extractors/view_component_extractor.rb +28 -3
  150. data/lib/woods/extractors/view_engines/erb.rb +17 -3
  151. data/lib/woods/feedback/gap_detector.rb +9 -3
  152. data/lib/woods/feedback/store.rb +7 -1
  153. data/lib/woods/filename_utils.rb +29 -1
  154. data/lib/woods/flow_analysis/operation_extractor.rb +22 -10
  155. data/lib/woods/flow_assembler.rb +63 -21
  156. data/lib/woods/flow_document.rb +1 -0
  157. data/lib/woods/flow_precomputer.rb +138 -22
  158. data/lib/woods/gem_mapper.rb +285 -0
  159. data/lib/woods/generation.rb +185 -0
  160. data/lib/woods/git_command.rb +38 -0
  161. data/lib/woods/git_provenance.rb +16 -2
  162. data/lib/woods/graph_analyzer.rb +408 -34
  163. data/lib/woods/index_artifact.rb +93 -23
  164. data/lib/woods/mcp/bearer_auth.rb +102 -13
  165. data/lib/woods/mcp/bootstrap_state.rb +77 -0
  166. data/lib/woods/mcp/bootstrapper.rb +582 -77
  167. data/lib/woods/mcp/config_resolver.rb +66 -6
  168. data/lib/woods/mcp/errors.rb +60 -0
  169. data/lib/woods/mcp/index_reader.rb +836 -117
  170. data/lib/woods/mcp/index_reader_pinning.rb +78 -0
  171. data/lib/woods/mcp/origin_guard.rb +66 -7
  172. data/lib/woods/mcp/protocol_policy.rb +98 -0
  173. data/lib/woods/mcp/provider_probe.rb +45 -6
  174. data/lib/woods/mcp/renderers/markdown_renderer.rb +72 -4
  175. data/lib/woods/mcp/renderers/plain_renderer.rb +54 -6
  176. data/lib/woods/mcp/server.rb +907 -154
  177. data/lib/woods/mcp/tasks/extension.rb +196 -0
  178. data/lib/woods/mcp/tasks/request_capture.rb +45 -0
  179. data/lib/woods/mcp/tasks/store.rb +518 -0
  180. data/lib/woods/mcp/tool_contract.rb +171 -0
  181. data/lib/woods/mcp/tool_response_renderer.rb +7 -0
  182. data/lib/woods/mcp/version_aware_tool_dispatch.rb +3 -9
  183. data/lib/woods/model_name_cache.rb +19 -1
  184. data/lib/woods/notion/client.rb +132 -36
  185. data/lib/woods/notion/exporter.rb +456 -61
  186. data/lib/woods/notion/mappers/column_mapper.rb +34 -5
  187. data/lib/woods/notion/mappers/migration_mapper.rb +32 -8
  188. data/lib/woods/notion/mappers/model_mapper.rb +21 -6
  189. data/lib/woods/notion/mappers/shared.rb +45 -3
  190. data/lib/woods/notion/sync_manifest.rb +258 -0
  191. data/lib/woods/obsidian/errors.rb +6 -0
  192. data/lib/woods/obsidian/name_mapper.rb +40 -24
  193. data/lib/woods/obsidian/vault_exporter.rb +103 -36
  194. data/lib/woods/operator/pipeline_guard.rb +118 -21
  195. data/lib/woods/operator/status_reporter.rb +20 -3
  196. data/lib/woods/path_dispatcher.rb +276 -0
  197. data/lib/woods/payload_store.rb +223 -0
  198. data/lib/woods/published_index/edge_shaper.rb +61 -0
  199. data/lib/woods/published_index/generation_catalog.rb +72 -0
  200. data/lib/woods/published_index/typed_unit_reader.rb +48 -0
  201. data/lib/woods/published_index.rb +287 -0
  202. data/lib/woods/railtie.rb +69 -30
  203. data/lib/woods/railtie_support.rb +167 -0
  204. data/lib/woods/release.rb +12 -0
  205. data/lib/woods/reload_policy.rb +206 -0
  206. data/lib/woods/resilience/circuit_breaker.rb +47 -8
  207. data/lib/woods/resilience/index_validator.rb +296 -10
  208. data/lib/woods/resilience/retryable_provider.rb +71 -6
  209. data/lib/woods/resolved_config.rb +55 -11
  210. data/lib/woods/retrieval/context_assembler.rb +132 -40
  211. data/lib/woods/retrieval/query_classifier.rb +25 -6
  212. data/lib/woods/retrieval/ranker.rb +193 -28
  213. data/lib/woods/retrieval/search_executor.rb +206 -39
  214. data/lib/woods/retriever.rb +317 -71
  215. data/lib/woods/retry_after.rb +22 -2
  216. data/lib/woods/ruby_analyzer/class_analyzer.rb +10 -14
  217. data/lib/woods/ruby_analyzer/fqn_builder.rb +2 -0
  218. data/lib/woods/ruby_analyzer/mermaid_renderer.rb +14 -4
  219. data/lib/woods/ruby_analyzer/method_analyzer.rb +1 -1
  220. data/lib/woods/ruby_analyzer.rb +21 -5
  221. data/lib/woods/session_tracer/file_store.rb +138 -19
  222. data/lib/woods/session_tracer/redis_store.rb +122 -12
  223. data/lib/woods/session_tracer/session_flow_assembler.rb +54 -11
  224. data/lib/woods/session_tracer/session_flow_document.rb +52 -6
  225. data/lib/woods/session_tracer/solid_cache_coordination.rb +192 -0
  226. data/lib/woods/session_tracer/solid_cache_store.rb +560 -91
  227. data/lib/woods/session_tracer/store.rb +14 -1
  228. data/lib/woods/storage/metadata_store.rb +230 -26
  229. data/lib/woods/storage/pgvector.rb +180 -22
  230. data/lib/woods/storage/qdrant.rb +367 -41
  231. data/lib/woods/storage/snapshotter/metadata.rb +79 -16
  232. data/lib/woods/storage/snapshotter/vector.rb +128 -17
  233. data/lib/woods/storage/snapshotter.rb +23 -5
  234. data/lib/woods/storage/vector_store.rb +49 -8
  235. data/lib/woods/storage_identity.rb +28 -0
  236. data/lib/woods/tasks.rb +53 -2
  237. data/lib/woods/temporal/json_snapshot_store.rb +112 -42
  238. data/lib/woods/temporal/snapshot_store.rb +139 -42
  239. data/lib/woods/unblocked/client.rb +119 -17
  240. data/lib/woods/unblocked/document_builder.rb +34 -2
  241. data/lib/woods/unblocked/exporter.rb +63 -27
  242. data/lib/woods/unblocked/rate_limiter.rb +23 -9
  243. data/lib/woods/unblocked/sync_manifest.rb +16 -8
  244. data/lib/woods/update_check.rb +24 -1
  245. data/lib/woods/util/uuid5.rb +124 -0
  246. data/lib/woods/version.rb +1 -1
  247. data/lib/woods/watch/daemon.rb +1345 -0
  248. data/lib/woods/watch/listen_watcher.rb +81 -0
  249. data/lib/woods/watch/polling_watcher.rb +137 -0
  250. data/lib/woods/watch/status.rb +169 -0
  251. data/lib/woods/watch/tree_scan.rb +163 -0
  252. data/lib/woods/watch/watcher.rb +100 -0
  253. data/lib/woods.rb +53 -9
  254. data/plugin/.claude-plugin/plugin.json +18 -0
  255. data/plugin/hooks/hooks.json +29 -0
  256. data/plugin/hooks/woods-post-edit.sh +226 -0
  257. data/plugin/hooks/woods-session-start.sh +77 -0
  258. data/plugin/skills/woods-agent-enable/SKILL.md +51 -0
  259. data/plugin/skills/woods-diagnose/SKILL.md +75 -0
  260. data/plugin/skills/woods-investigate/SKILL.md +39 -0
  261. data/plugin/skills/woods-mcp-config/SKILL.md +101 -0
  262. data/plugin/skills/woods-setup/SKILL.md +99 -0
  263. metadata +102 -26
  264. data/lib/woods/console/adapters/cache_adapter.rb +0 -58
  265. data/lib/woods/console/adapters/good_job_adapter.rb +0 -33
  266. data/lib/woods/console/adapters/job_adapter.rb +0 -74
  267. data/lib/woods/console/adapters/sidekiq_adapter.rb +0 -33
  268. data/lib/woods/console/adapters/solid_queue_adapter.rb +0 -33
  269. data/lib/woods/console/bridge.rb +0 -210
  270. data/lib/woods/console/credential_scanner_registry.rb +0 -36
  271. data/lib/woods/console/encrypted_credential_snapshot.rb +0 -16
  272. data/lib/woods/formatting/claude_adapter.rb +0 -98
  273. data/lib/woods/formatting/generic_adapter.rb +0 -56
  274. data/lib/woods/formatting/gpt_adapter.rb +0 -64
  275. data/lib/woods/mcp/http_transport_options.rb +0 -24
  276. data/lib/woods/notion/mapper.rb +0 -40
  277. data/lib/woods/observability/health_check.rb +0 -79
  278. data/lib/woods/observability/instrumentation.rb +0 -34
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: woods-mcp-config
3
+ description: Configure Woods MCP connections with the exact client JSON shapes and token rules — the Index Server over stdio or Docker, and the authorized Console server over stdio or authenticated HTTP. Use when wiring a Woods server into any MCP client configuration (.mcp.json, Claude Code, desktop clients), pointing an agent at a Rails app's index, or enabling live-data Console access.
4
+ ---
5
+
6
+ # Woods MCP configuration
7
+
8
+ ## Preflight
9
+
10
+ ```bash
11
+ bundle info woods
12
+ bin/rails woods:validate
13
+ bin/rails woods:stats
14
+ ```
15
+
16
+ This skill describes the Woods 2.x line; the authoritative minimum version lives in the marketplace entry. Operate only against capabilities the recorded installed version provides. Detect the MCP client, app root, host vs Docker Rails process, the filesystem context that contains the application bundle and index, and whether live-data access is actually required.
17
+
18
+ Default to Index-only. It reads generated code context and exposes 14 tools. Console MCP boots Rails and reads live data; ask before enabling it.
19
+
20
+ ## Shape 1: Index-only
21
+
22
+ ```json
23
+ {
24
+ "mcpServers": {
25
+ "woods": {
26
+ "command": "bundle",
27
+ "args": ["exec", "woods-mcp-start", "./tmp/woods"],
28
+ "cwd": "/absolute/path/to/app"
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ Use this shape for any stdio-capable MCP client, adapted to the client's configuration location. `woods-mcp-start` validates and launches; it does not install or auto-restart.
35
+
36
+ When Woods is installed only in Docker, prefer running the server through the application container:
37
+
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "woods": {
42
+ "command": "docker",
43
+ "args": ["compose", "exec", "-T", "app", "bundle", "exec", "woods-mcp", "/app/tmp/woods"],
44
+ "cwd": "/absolute/host/path/to/app"
45
+ }
46
+ }
47
+ }
48
+ ```
49
+
50
+ Use a host-side bundle only after verifying Ruby, the application bundle, and the index are available on the host. Always pass the path visible to the process that runs `woods-mcp`.
51
+
52
+ A read-only index mount is sufficient for structural tools. The `reload` tool for in-memory semantic retrieval also takes Woods' shared on-disk writer lock, so the MCP process needs write access to the index directory. Without it, reload returns a typed degraded error and keeps serving the previous aligned generation. Either grant that access or restart the MCP process after publishing a new embedded index.
53
+
54
+ ## Shape 2: Index plus authorized Console
55
+
56
+ After explicit authorization, enable the live-data master switch in the Rails initializer. The process exits while it remains false:
57
+
58
+ ```ruby
59
+ Woods.configure do |config|
60
+ config.console_mcp_enabled = true
61
+ config.console_mcp_token = ENV["WOODS_CONSOLE_MCP_TOKEN"]
62
+ end
63
+ ```
64
+
65
+ The token authenticates HTTP requests and is not sent by a stdio client. Production Rails boot still requires `WOODS_CONSOLE_MCP_TOKEN` to contain at least 32 characters whenever Console is enabled, including for a stdio-only setup. Keep it in the application's secret store. Outside production, omitting it warns and leaves the Console HTTP endpoint guarded with 401.
66
+
67
+ Then add a direct Console process:
68
+
69
+ ```json
70
+ "woods-console": {
71
+ "command": "bundle",
72
+ "args": ["exec", "woods-console-mcp"],
73
+ "cwd": "/absolute/path/to/app"
74
+ }
75
+ ```
76
+
77
+ For Docker/SSH, configure `~/.woods/console.yml` or `WOODS_CONSOLE_CONFIG`; the launcher owns process replacement. Direct Docker stdio uses `docker exec -i`, or `docker compose exec -T` to disable Compose's pseudo-TTY while retaining stdin.
78
+
79
+ Console registers nine default tools. `config.console_embedded_read_tools = true` explicitly adds `console_sql` and `console_query` for eleven total. Tier 2, Tier 3, and `console_eval` are inventory-only in supported packaged modes.
80
+
81
+ ## Shape 3: Authenticated Console HTTP
82
+
83
+ Use only after authorization and server-side setup:
84
+
85
+ ```json
86
+ "woods-console": {
87
+ "type": "streamable-http",
88
+ "url": "https://app.example.test/mcp/console",
89
+ "headers": { "Authorization": "Bearer <token>" }
90
+ }
91
+ ```
92
+
93
+ Require `console_mcp_enabled`, a strong token, allowed origins, TLS, and the Console security controls. Never commit the token or expose an unauthenticated listener.
94
+
95
+ ## Verify
96
+
97
+ Reconnect through the client so it performs its supported MCP negotiation. Clients on current MCP protocol revisions use per-request metadata/discovery; older clients initialize first — the server supports both. Call `woods_status`, `search`, and `lookup`. For Console, inspect the registered list and call `console_status` only in the authorized environment.
98
+
99
+ Do not use an isolated raw JSON-RPC request as proof of MCP health. Do not claim conditional Index or inventory-only Console schemas are callable.
100
+
101
+ Canonical guide: [MCP_SERVERS.md](https://github.com/lost-in-the/woods/blob/main/docs/MCP_SERVERS.md).
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: woods-setup
3
+ description: Install, upgrade, and first-run-configure the Woods Rails code-intelligence gem — Gemfile entry, generator, extraction, index verification, MCP registration, and the 1.x-to-2.x upgrade path. Use whenever a user wants Woods added to or upgraded in a Rails app, or asks for a runtime-accurate codebase index for AI tools, even without naming Woods' components.
4
+ ---
5
+
6
+ # Woods setup
7
+
8
+ Install a structural Index Server first. Embeddings and Console MCP are separate opt-ins.
9
+
10
+ ## Preflight
11
+
12
+ Read repository instructions and preserve unrelated changes. Record:
13
+
14
+ ```bash
15
+ git status --short --branch
16
+ ruby --version
17
+ bundle exec rails --version
18
+ bundle info woods 2>/dev/null || true
19
+ bundle exec rails runner 'puts Rails.application.class.name'
20
+ ```
21
+
22
+ This skill describes the Woods 2.x line; the authoritative minimum version lives in the marketplace entry. Operate only against capabilities the recorded installed version provides, and for an older gem use the documentation on that version's tag. Determine host vs Docker execution, database adapter, migration policy, existing Woods config/tables, and which filesystem context contains the application bundle and `tmp/woods/`.
23
+
24
+ ## Install and inspect
25
+
26
+ Add `gem "woods", "~> 2.0"` to the development group, then:
27
+
28
+ ```bash
29
+ bundle install
30
+ bundle exec ruby -rwoods/version -e 'puts Woods::VERSION'
31
+ bin/rails generate woods:install
32
+ git diff -- config/initializers/woods.rb db/migrate
33
+ ```
34
+
35
+ The generator creates an initializer and a legacy application migration for `woods_units`, `woods_edges`, and `woods_embeddings`. Woods 2's shipped structural index and storage backends do not use those application tables. For a new default installation, propose removing the generated migration and obtain approval first. Keep or run it only when repository history proves an older/custom integration uses those tables, after normal migration authorization and conflict checks.
36
+
37
+ Do not broadly update gems or overwrite existing configuration.
38
+
39
+ ## Upgrading from 1.x
40
+
41
+ When the preflight records an installed 1.x version, this is an upgrade, not an install. Woods 2.0 changes observable index identifiers, the publication layout, vector-store reconciliation, and the supported MCP surface, so plan a clean re-index and follow the canonical runbook: [UPGRADING_TO_2.md](https://github.com/lost-in-the/woods/blob/main/docs/UPGRADING_TO_2.md).
42
+
43
+ Before changing the Gemfile: back up any shared or durable index and agree on a rollback window — never upgrade one in place. After `bundle update woods`, run a full `bin/rails woods:extract` (not incremental; the old index is not a valid baseline across the major), then `woods:validate`. With embeddings configured, re-embed from scratch into a store matching the configured model; expect identifier-level churn in anything that consumed 1.x identifiers (exports, saved queries, downstream tooling). Verify MCP clients against the new surface rather than assuming 1.x tool behavior.
44
+
45
+ ## Extract and verify
46
+
47
+ Structural setup needs no embedding provider:
48
+
49
+ ```bash
50
+ bin/rails woods:extract
51
+ bin/rails woods:validate
52
+ bin/rails woods:stats
53
+ ```
54
+
55
+ If extraction fails, reproduce Rails boot and eager loading first. Do not inspect internal payload files when Woods tasks provide the check.
56
+
57
+ Configure the Index Server with the application bundle, absolute app `cwd`, and an index path visible to that process. For a host-installed bundle:
58
+
59
+ ```json
60
+ {
61
+ "mcpServers": {
62
+ "woods": {
63
+ "command": "bundle",
64
+ "args": ["exec", "woods-mcp-start", "./tmp/woods"],
65
+ "cwd": "/absolute/path/to/app"
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ When Woods is installed only in Docker, launch it through the application service instead:
72
+
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "woods": {
77
+ "command": "docker",
78
+ "args": ["compose", "exec", "-T", "app", "bundle", "exec", "woods-mcp", "/app/tmp/woods"],
79
+ "cwd": "/absolute/host/path/to/app"
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ Reconnect and call `woods_status`, then `search`, `lookup`, and `dependents` for a known class. The normal Index Server has 14 tools. `codebase_retrieve` requires configured embeddings.
86
+
87
+ Offer to add `bundle exec rake woods:watch` to the existing development process manager. When authorized, it catches up missed changes and automatically maintains the structural index; the Index Server refreshes on its next call, so ordinary edits need no manual extraction or MCP restart. State that boot-captured changes require supervisor restart, Docker may need `WOODS_WATCH_POLL=1`, and semantic vectors still need `woods:embed_incremental`.
88
+
89
+ The plugin also ships two hooks (Woods 2.3 or later), shipped disabled. A `PostToolUse` hook runs `woods:incremental` in the background when an edit touches models, routes, migrations, schema, or a `package.yml`, reading `cwd` from the hook payload so linked worktrees refresh their own index; it batches paths from overlapping edits instead of dropping them under lock contention. A `SessionStart` hook warns when the published generation predates the last commit, a check scoped to commit timestamps, so it does not cover uncommitted edits or an older checkout. Both do nothing until `tmp/woods/generation.json` exists and until the user sets `WOODS_HOOKS_ENABLED=1`; set `WOODS_HOOK_RAKE="docker compose exec -T app bundle exec rake"` when the bundle lives in a container, `WOODS_OUTPUT` when the index directory is non-default, and `WOODS_HOOKS_DISABLED=1` to turn both back off.
90
+
91
+ ## Ask before expanding scope
92
+
93
+ Require explicit approval before adding Ollama/OpenAI, pgvector/Qdrant, secrets, Console MCP/live-data access, HTTP transport, or purge overrides. The `:local` preset avoids cloud keys but requires the `sqlite3` gem, an installed/running Ollama service, and a pulled model (`ollama pull nomic-embed-text` by default); `:shared_filesystem` avoids sqlite3 but still uses Ollama. Recommend `gem "tokenizers", "~> 0.5"` for exact counting on dense Ruby source, while stating that it is optional.
94
+
95
+ ## Handoff
96
+
97
+ Report the Woods version, branch, files changed, commands/results, index path, MCP calls verified, semantic retrieval status, Console status, and unresolved risks. Never infer availability from source schemas alone.
98
+
99
+ Canonical runbook: [AGENT_SETUP.md](https://github.com/lost-in-the/woods/blob/main/docs/AGENT_SETUP.md).
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 2.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Armstrong
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-09-18 00:00:00.000000000 Z
11
+ date: 2026-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mcp
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.23.0
19
+ version: '1.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '1.0'
22
+ version: '2.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.23.0
29
+ version: '1.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '1.0'
32
+ version: '2.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: json
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -56,7 +56,7 @@ dependencies:
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: '1.5'
59
+ version: 1.8.2
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '2'
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '1.5'
69
+ version: 1.8.2
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
72
  version: '2'
@@ -126,6 +126,36 @@ files:
126
126
  - CONTRIBUTING.md
127
127
  - LICENSE.txt
128
128
  - README.md
129
+ - SECURITY.md
130
+ - assets/woods-wordmark-white-with-bg.png
131
+ - docs/AGENT_GUIDE.md
132
+ - docs/AGENT_SETUP.md
133
+ - docs/BACKEND_MATRIX.md
134
+ - docs/CONFIGURATION_REFERENCE.md
135
+ - docs/CONSOLE_MCP_SETUP.md
136
+ - docs/DOCKER_SETUP.md
137
+ - docs/EMBEDDING_MODELS.md
138
+ - docs/EVALUATION.md
139
+ - docs/EXTRACTOR_REFERENCE.md
140
+ - docs/FAQ.md
141
+ - docs/GETTING_STARTED.md
142
+ - docs/INCREMENTAL_EXTRACTION.md
143
+ - docs/INTERNALS.md
144
+ - docs/MCP_HTTP_TRANSPORT.md
145
+ - docs/MCP_SERVERS.md
146
+ - docs/MCP_TOOL_COOKBOOK.md
147
+ - docs/MCP_WORKTREE_SETUP.md
148
+ - docs/NOTION_INTEGRATION.md
149
+ - docs/OBSIDIAN_INTEGRATION.md
150
+ - docs/PUBLISHED_INDEX.md
151
+ - docs/README.md
152
+ - docs/RETRIEVAL_GUIDE.md
153
+ - docs/TOKEN_BENCHMARK.md
154
+ - docs/TROUBLESHOOTING.md
155
+ - docs/UNBLOCKED_INTEGRATION.md
156
+ - docs/UPGRADING_TO_2.md
157
+ - docs/WATCH_DAEMON.md
158
+ - docs/WHY_WOODS.md
129
159
  - exe/woods-console
130
160
  - exe/woods-console-mcp
131
161
  - exe/woods-mcp
@@ -137,6 +167,7 @@ files:
137
167
  - lib/generators/woods/templates/create_woods_tables.rb.erb
138
168
  - lib/generators/woods/templates/woods.rb.tt
139
169
  - lib/tasks/woods.rake
170
+ - lib/tasks/woods_checks.rake
140
171
  - lib/tasks/woods_evaluation.rake
141
172
  - lib/woods.rb
142
173
  - lib/woods/ast.rb
@@ -150,26 +181,22 @@ files:
150
181
  - lib/woods/cache/cache_store.rb
151
182
  - lib/woods/cache/redis_cache_store.rb
152
183
  - lib/woods/cache/solid_cache_store.rb
184
+ - lib/woods/change_set.rb
185
+ - lib/woods/checks/generation_resolution.rb
186
+ - lib/woods/checks/moved_messages.rb
153
187
  - lib/woods/chunking/chunk.rb
154
188
  - lib/woods/chunking/semantic_chunker.rb
155
- - lib/woods/console/adapters/cache_adapter.rb
156
- - lib/woods/console/adapters/good_job_adapter.rb
157
- - lib/woods/console/adapters/job_adapter.rb
158
- - lib/woods/console/adapters/sidekiq_adapter.rb
159
- - lib/woods/console/adapters/solid_queue_adapter.rb
160
189
  - lib/woods/console/audit_logger.rb
161
- - lib/woods/console/bridge.rb
162
190
  - lib/woods/console/bridge_protocol.rb
163
191
  - lib/woods/console/confirmation.rb
164
192
  - lib/woods/console/connection_manager.rb
165
193
  - lib/woods/console/console_response_renderer.rb
166
194
  - lib/woods/console/credential_index.rb
167
195
  - lib/woods/console/credential_scanner.rb
168
- - lib/woods/console/credential_scanner_registry.rb
169
196
  - lib/woods/console/dispatch_pipeline.rb
170
197
  - lib/woods/console/embedded_executor.rb
171
- - lib/woods/console/encrypted_credential_snapshot.rb
172
198
  - lib/woods/console/eval_guard.rb
199
+ - lib/woods/console/input_contract.rb
173
200
  - lib/woods/console/model_validator.rb
174
201
  - lib/woods/console/rack_middleware.rb
175
202
  - lib/woods/console/redactor.rb
@@ -186,6 +213,7 @@ files:
186
213
  - lib/woods/console/tools/tier2.rb
187
214
  - lib/woods/console/tools/tier3.rb
188
215
  - lib/woods/console/tools/tier4.rb
216
+ - lib/woods/coordination/lock_heartbeat.rb
189
217
  - lib/woods/coordination/pipeline_lock.rb
190
218
  - lib/woods/cost_model.rb
191
219
  - lib/woods/cost_model/embedding_cost.rb
@@ -198,14 +226,27 @@ files:
198
226
  - lib/woods/db/migrations/004_create_snapshots.rb
199
227
  - lib/woods/db/migrations/005_create_snapshot_units.rb
200
228
  - lib/woods/db/migrations/006_rename_tables.rb
229
+ - lib/woods/db/migrations/007_typed_snapshot_units.rb
201
230
  - lib/woods/db/migrator.rb
202
231
  - lib/woods/db/schema_version.rb
203
232
  - lib/woods/dependency_graph.rb
233
+ - lib/woods/embedding/fake.rb
204
234
  - lib/woods/embedding/indexer.rb
205
235
  - lib/woods/embedding/openai.rb
206
236
  - lib/woods/embedding/provider.rb
207
237
  - lib/woods/embedding/text_preparer.rb
208
238
  - lib/woods/embedding/token_counter.rb
239
+ - lib/woods/evaluation/ablation_agent_payload.rb
240
+ - lib/woods/evaluation/ablation_executor.rb
241
+ - lib/woods/evaluation/ablation_provenance.rb
242
+ - lib/woods/evaluation/ablation_report_writer.rb
243
+ - lib/woods/evaluation/ablation_runner.rb
244
+ - lib/woods/evaluation/ablation_summary.rb
245
+ - lib/woods/evaluation/ablation_task.rb
246
+ - lib/woods/evaluation/ablation_task_set.rb
247
+ - lib/woods/evaluation/ablation_timed_executor.rb
248
+ - lib/woods/evaluation/ablation_worktree.rb
249
+ - lib/woods/evaluation/baseline.rb
209
250
  - lib/woods/evaluation/baseline_runner.rb
210
251
  - lib/woods/evaluation/evaluator.rb
211
252
  - lib/woods/evaluation/metrics.rb
@@ -219,6 +260,7 @@ files:
219
260
  - lib/woods/extractors/behavioral_profile.rb
220
261
  - lib/woods/extractors/caching_extractor.rb
221
262
  - lib/woods/extractors/callback_analyzer.rb
263
+ - lib/woods/extractors/component_discovery.rb
222
264
  - lib/woods/extractors/concern_extractor.rb
223
265
  - lib/woods/extractors/configuration_extractor.rb
224
266
  - lib/woods/extractors/controller_extractor.rb
@@ -231,17 +273,20 @@ files:
231
273
  - lib/woods/extractors/i18n_extractor.rb
232
274
  - lib/woods/extractors/job_extractor.rb
233
275
  - lib/woods/extractors/lib_extractor.rb
276
+ - lib/woods/extractors/line_neutralizer.rb
234
277
  - lib/woods/extractors/mailer_extractor.rb
235
278
  - lib/woods/extractors/manager_extractor.rb
236
279
  - lib/woods/extractors/middleware_extractor.rb
237
280
  - lib/woods/extractors/migration_extractor.rb
238
281
  - lib/woods/extractors/model_extractor.rb
282
+ - lib/woods/extractors/package_extractor.rb
239
283
  - lib/woods/extractors/phlex_extractor.rb
240
284
  - lib/woods/extractors/policy_extractor.rb
241
285
  - lib/woods/extractors/poro_extractor.rb
242
286
  - lib/woods/extractors/pundit_extractor.rb
243
287
  - lib/woods/extractors/rails_source_extractor.rb
244
288
  - lib/woods/extractors/rake_task_extractor.rb
289
+ - lib/woods/extractors/reference_patterns.rb
245
290
  - lib/woods/extractors/route_extractor.rb
246
291
  - lib/woods/extractors/route_helper_resolver.rb
247
292
  - lib/woods/extractors/scheduled_job_extractor.rb
@@ -249,6 +294,7 @@ files:
249
294
  - lib/woods/extractors/service_extractor.rb
250
295
  - lib/woods/extractors/shared_dependency_scanner.rb
251
296
  - lib/woods/extractors/shared_utility_methods.rb
297
+ - lib/woods/extractors/source_nesting.rb
252
298
  - lib/woods/extractors/state_machine_extractor.rb
253
299
  - lib/woods/extractors/test_mapping_extractor.rb
254
300
  - lib/woods/extractors/validator_extractor.rb
@@ -265,10 +311,10 @@ files:
265
311
  - lib/woods/flow_document.rb
266
312
  - lib/woods/flow_precomputer.rb
267
313
  - lib/woods/formatting/base.rb
268
- - lib/woods/formatting/claude_adapter.rb
269
- - lib/woods/formatting/generic_adapter.rb
270
- - lib/woods/formatting/gpt_adapter.rb
271
314
  - lib/woods/formatting/human_adapter.rb
315
+ - lib/woods/gem_mapper.rb
316
+ - lib/woods/generation.rb
317
+ - lib/woods/git_command.rb
272
318
  - lib/woods/git_provenance.rb
273
319
  - lib/woods/graph_analyzer.rb
274
320
  - lib/woods/index_artifact.rb
@@ -277,28 +323,31 @@ files:
277
323
  - lib/woods/mcp/bootstrapper.rb
278
324
  - lib/woods/mcp/config_resolver.rb
279
325
  - lib/woods/mcp/errors.rb
280
- - lib/woods/mcp/http_transport_options.rb
281
326
  - lib/woods/mcp/index_reader.rb
327
+ - lib/woods/mcp/index_reader_pinning.rb
282
328
  - lib/woods/mcp/origin_guard.rb
329
+ - lib/woods/mcp/protocol_policy.rb
283
330
  - lib/woods/mcp/provider_probe.rb
284
331
  - lib/woods/mcp/renderers/claude_renderer.rb
285
332
  - lib/woods/mcp/renderers/json_renderer.rb
286
333
  - lib/woods/mcp/renderers/markdown_renderer.rb
287
334
  - lib/woods/mcp/renderers/plain_renderer.rb
288
335
  - lib/woods/mcp/server.rb
336
+ - lib/woods/mcp/tasks/extension.rb
337
+ - lib/woods/mcp/tasks/request_capture.rb
338
+ - lib/woods/mcp/tasks/store.rb
339
+ - lib/woods/mcp/tool_contract.rb
289
340
  - lib/woods/mcp/tool_response_renderer.rb
290
341
  - lib/woods/mcp/version_aware_tool_dispatch.rb
291
342
  - lib/woods/model_name_cache.rb
292
343
  - lib/woods/notion/client.rb
293
344
  - lib/woods/notion/exporter.rb
294
- - lib/woods/notion/mapper.rb
295
345
  - lib/woods/notion/mappers/column_mapper.rb
296
346
  - lib/woods/notion/mappers/migration_mapper.rb
297
347
  - lib/woods/notion/mappers/model_mapper.rb
298
348
  - lib/woods/notion/mappers/shared.rb
299
349
  - lib/woods/notion/rate_limiter.rb
300
- - lib/woods/observability/health_check.rb
301
- - lib/woods/observability/instrumentation.rb
350
+ - lib/woods/notion/sync_manifest.rb
302
351
  - lib/woods/observability/structured_logger.rb
303
352
  - lib/woods/obsidian/errors.rb
304
353
  - lib/woods/obsidian/name_mapper.rb
@@ -308,7 +357,16 @@ files:
308
357
  - lib/woods/operator/error_escalator.rb
309
358
  - lib/woods/operator/pipeline_guard.rb
310
359
  - lib/woods/operator/status_reporter.rb
360
+ - lib/woods/path_dispatcher.rb
361
+ - lib/woods/payload_store.rb
362
+ - lib/woods/published_index.rb
363
+ - lib/woods/published_index/edge_shaper.rb
364
+ - lib/woods/published_index/generation_catalog.rb
365
+ - lib/woods/published_index/typed_unit_reader.rb
311
366
  - lib/woods/railtie.rb
367
+ - lib/woods/railtie_support.rb
368
+ - lib/woods/release.rb
369
+ - lib/woods/reload_policy.rb
312
370
  - lib/woods/resilience/circuit_breaker.rb
313
371
  - lib/woods/resilience/index_validator.rb
314
372
  - lib/woods/resilience/retryable_provider.rb
@@ -331,6 +389,7 @@ files:
331
389
  - lib/woods/session_tracer/redis_store.rb
332
390
  - lib/woods/session_tracer/session_flow_assembler.rb
333
391
  - lib/woods/session_tracer/session_flow_document.rb
392
+ - lib/woods/session_tracer/solid_cache_coordination.rb
334
393
  - lib/woods/session_tracer/solid_cache_store.rb
335
394
  - lib/woods/session_tracer/store.rb
336
395
  - lib/woods/storage/graph_store.rb
@@ -342,6 +401,7 @@ files:
342
401
  - lib/woods/storage/snapshotter/metadata.rb
343
402
  - lib/woods/storage/snapshotter/vector.rb
344
403
  - lib/woods/storage/vector_store.rb
404
+ - lib/woods/storage_identity.rb
345
405
  - lib/woods/tasks.rb
346
406
  - lib/woods/temporal/json_snapshot_store.rb
347
407
  - lib/woods/temporal/snapshot_store.rb
@@ -353,16 +413,32 @@ files:
353
413
  - lib/woods/unblocked/sync_manifest.rb
354
414
  - lib/woods/update_check.rb
355
415
  - lib/woods/util/host_guard.rb
416
+ - lib/woods/util/uuid5.rb
356
417
  - lib/woods/version.rb
418
+ - lib/woods/watch/daemon.rb
419
+ - lib/woods/watch/listen_watcher.rb
420
+ - lib/woods/watch/polling_watcher.rb
421
+ - lib/woods/watch/status.rb
422
+ - lib/woods/watch/tree_scan.rb
423
+ - lib/woods/watch/watcher.rb
424
+ - plugin/.claude-plugin/plugin.json
425
+ - plugin/hooks/hooks.json
426
+ - plugin/hooks/woods-post-edit.sh
427
+ - plugin/hooks/woods-session-start.sh
428
+ - plugin/skills/woods-agent-enable/SKILL.md
429
+ - plugin/skills/woods-diagnose/SKILL.md
430
+ - plugin/skills/woods-investigate/SKILL.md
431
+ - plugin/skills/woods-mcp-config/SKILL.md
432
+ - plugin/skills/woods-setup/SKILL.md
357
433
  homepage: https://github.com/lost-in-the/woods
358
434
  licenses:
359
435
  - MIT
360
436
  metadata:
361
437
  homepage_uri: https://github.com/lost-in-the/woods
362
- source_code_uri: https://github.com/lost-in-the/woods/tree/v1.6.2
363
- changelog_uri: https://github.com/lost-in-the/woods/blob/v1.6.2/CHANGELOG.md
438
+ source_code_uri: https://github.com/lost-in-the/woods/tree/v2.0.0.beta1
439
+ changelog_uri: https://github.com/lost-in-the/woods/blob/v2.0.0.beta1/CHANGELOG.md
364
440
  bug_tracker_uri: https://github.com/lost-in-the/woods/issues
365
- documentation_uri: https://github.com/lost-in-the/woods/tree/v1.6.2/docs
441
+ documentation_uri: https://github.com/lost-in-the/woods/tree/v2.0.0.beta1/docs
366
442
  rubygems_mfa_required: 'true'
367
443
  post_install_message:
368
444
  rdoc_options: []
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Woods
4
- module Console
5
- module Adapters
6
- # Cache adapter that auto-detects the active cache store.
7
- #
8
- # Supports Redis, Solid Cache, memory, and file cache stores.
9
- # Detection checks Rails.cache class name first, then falls back
10
- # to checking for SolidCache constant.
11
- #
12
- # @example
13
- # CacheAdapter.detect # => :redis
14
- # CacheAdapter.stats # => { tool: 'cache_stats', params: {} }
15
- #
16
- module CacheAdapter
17
- STORE_PATTERNS = {
18
- 'RedisCacheStore' => :redis,
19
- 'MemoryStore' => :memory,
20
- 'FileStore' => :file
21
- }.freeze
22
-
23
- module_function
24
-
25
- # Detect the active cache store backend.
26
- #
27
- # @return [Symbol] One of :redis, :solid_cache, :memory, :file, :unknown
28
- def detect
29
- if defined?(::Rails) && ::Rails.respond_to?(:cache) && ::Rails.cache
30
- class_name = ::Rails.cache.class.name.to_s
31
- STORE_PATTERNS.each do |pattern, backend|
32
- return backend if class_name.include?(pattern)
33
- end
34
- end
35
-
36
- return :solid_cache if defined?(::SolidCache)
37
-
38
- :unknown
39
- end
40
-
41
- # Get cache store statistics.
42
- #
43
- # @param namespace [String, nil] Cache namespace filter
44
- # @return [Hash] Bridge request
45
- def stats(namespace: nil)
46
- { tool: 'cache_stats', params: { namespace: namespace }.compact }
47
- end
48
-
49
- # Get cache store info (backend type, configuration).
50
- #
51
- # @return [Hash] Bridge request
52
- def info
53
- { tool: 'cache_info', params: {} }
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'job_adapter'
4
-
5
- module Woods
6
- module Console
7
- module Adapters
8
- # Job backend adapter for GoodJob.
9
- #
10
- # Builds bridge requests for GoodJob queue stats, failure listing,
11
- # job lookup, scheduled jobs, and retry operations.
12
- #
13
- # @example
14
- # adapter = GoodJobAdapter.new
15
- # adapter.queue_stats # => { tool: 'good_job_queue_stats', params: {} }
16
- #
17
- class GoodJobAdapter < JobAdapter
18
- # Check if GoodJob is available in the current environment.
19
- #
20
- # @return [Boolean]
21
- def self.available?
22
- !!defined?(::GoodJob)
23
- end
24
-
25
- private
26
-
27
- def prefix
28
- 'good_job'
29
- end
30
- end
31
- end
32
- end
33
- end