Class: Woods::Configuration
- Inherits:
-
Object
- Object
- Woods::Configuration
- Defined in:
- lib/woods.rb
Overview
════════════════════════════════════════════════════════════════════════Configuration ════════════════════════════════════════════════════════════════════════
Instance Attribute Summary collapse
-
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
-
#cache_options ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#cache_store ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#concurrent_extraction ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_blocked_tables ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_credential_defense_enabled ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_credential_rotation_warning ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_disabled_scanner_patterns ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_embedded_read_tools ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_mcp_allowed_origins ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_mcp_enabled ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_mcp_path ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_mcp_token ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_redacted_columns ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_redacted_key_values ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_unsafe_eval_audit_log_path ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_unsafe_eval_confirmation ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#console_unsafe_eval_enabled ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#context_format ⇒ Object
Returns the value of attribute context_format.
-
#dump_retention_count ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#embedding_model ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#embedding_options ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#embedding_provider ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#enable_snapshots ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#extract_navigation_edges ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#extractors ⇒ Object
Returns the value of attribute extractors.
-
#gem_configs ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#graph_store ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#include_framework_sources ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#log_level ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#max_context_tokens ⇒ Object
Returns the value of attribute max_context_tokens.
-
#metadata_store ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#metadata_store_options ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#notion_api_token ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#notion_database_ids ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#precompute_flows ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#pretty_json ⇒ Object
Returns the value of attribute pretty_json.
-
#session_exclude_paths ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#session_id_proc ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#session_store ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#session_tracer_allow_production ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#session_tracer_enabled ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#similarity_threshold ⇒ Object
Returns the value of attribute similarity_threshold.
-
#unblocked_api_token ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#unblocked_collection_id ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#unblocked_repo_url ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#vector_store ⇒ Object
rubocop:disable Metrics/ClassLength.
-
#vector_store_options ⇒ Object
rubocop:disable Metrics/ClassLength.
Instance Method Summary collapse
-
#add_gem(gem_name, paths:, priority: :medium) ⇒ Object
Add a gem to be indexed.
-
#initialize ⇒ Configuration
constructor
rubocop:disable Metrics/MethodLength.
-
#output_dir ⇒ Pathname, String
Output directory, defaulting to Rails.root/tmp/woods.
- #output_dir=(value) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
rubocop:disable Metrics/MethodLength
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/woods.rb', line 144 def initialize # rubocop:disable Metrics/MethodLength @output_dir = nil # Resolved lazily; Rails.root is nil at require time @embedding_model = 'text-embedding-3-small' @max_context_tokens = 8000 @similarity_threshold = 0.7 @include_framework_sources = true @gem_configs = {} @extractors = %i[models controllers services components view_components jobs mailers graphql serializers managers policies validators rails_source] @pretty_json = true @concurrent_extraction = false @precompute_flows = false @extract_navigation_edges = true @enable_snapshots = false @context_format = :markdown @session_tracer_enabled = false @session_tracer_allow_production = false @session_store = nil @session_id_proc = nil @session_exclude_paths = [] @console_mcp_enabled = false @console_mcp_path = '/mcp/console' # Accept token from config or env var. Nil by default — the railtie # refuses to wire the middleware in production without a real token # and only warns loudly in non-prod when unset. @console_mcp_token = ENV.fetch('WOODS_CONSOLE_MCP_TOKEN', nil) # Origins allowed to reach the embedded console MCP. Loopback only # by default; override in host initializers for tunneled or internal # dashboard access. @console_mcp_allowed_origins = %w[ http://localhost http://127.0.0.1 http://[::1] ] @console_redacted_columns = DEFAULT_CONSOLE_REDACTED_COLUMNS.dup @console_redacted_key_values = [] @console_embedded_read_tools = false @console_blocked_tables = DEFAULT_CONSOLE_BLOCKED_TABLES.dup @console_disabled_scanner_patterns = [] @console_credential_defense_enabled = true @console_credential_rotation_warning = true @console_unsafe_eval_enabled = nil # nil = fall back to env WOODS_CONSOLE_UNSAFE_EVAL # Required collaborators when the opt-in is on. Both default to nil; # the server refuses to boot with the opt-in set unless the host has # wired them (fail-closed — see Server.build_embedded). @console_unsafe_eval_confirmation = nil @console_unsafe_eval_audit_log_path = nil @notion_api_token = nil @notion_database_ids = {} @unblocked_api_token = nil @unblocked_collection_id = nil @unblocked_repo_url = nil @cache_enabled = false @cache_store = nil # :redis, :solid_cache, :memory, or a CacheStore instance @cache_options = {} # { redis: client, cache: store, ttl: { embeddings: 86400, ... } } @dump_retention_count = 3 end |
Instance Attribute Details
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
141 142 143 |
# File 'lib/woods.rb', line 141 def cache_enabled @cache_enabled end |
#cache_options ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def @cache_options end |
#cache_store ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def cache_store @cache_store end |
#concurrent_extraction ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def concurrent_extraction @concurrent_extraction end |
#console_blocked_tables ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_blocked_tables @console_blocked_tables end |
#console_credential_defense_enabled ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_credential_defense_enabled @console_credential_defense_enabled end |
#console_credential_rotation_warning ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_credential_rotation_warning @console_credential_rotation_warning end |
#console_disabled_scanner_patterns ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_disabled_scanner_patterns @console_disabled_scanner_patterns end |
#console_embedded_read_tools ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def @console_embedded_read_tools end |
#console_mcp_allowed_origins ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_mcp_allowed_origins @console_mcp_allowed_origins end |
#console_mcp_enabled ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_mcp_enabled @console_mcp_enabled end |
#console_mcp_path ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_mcp_path @console_mcp_path end |
#console_mcp_token ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_mcp_token @console_mcp_token end |
#console_redacted_columns ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_redacted_columns @console_redacted_columns end |
#console_redacted_key_values ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_redacted_key_values @console_redacted_key_values end |
#console_unsafe_eval_audit_log_path ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_unsafe_eval_audit_log_path @console_unsafe_eval_audit_log_path end |
#console_unsafe_eval_confirmation ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_unsafe_eval_confirmation @console_unsafe_eval_confirmation end |
#console_unsafe_eval_enabled ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def console_unsafe_eval_enabled @console_unsafe_eval_enabled end |
#context_format ⇒ Object
Returns the value of attribute context_format.
141 142 143 |
# File 'lib/woods.rb', line 141 def context_format @context_format end |
#dump_retention_count ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def dump_retention_count @dump_retention_count end |
#embedding_model ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def @embedding_model end |
#embedding_options ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def @embedding_options end |
#embedding_provider ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def @embedding_provider end |
#enable_snapshots ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def enable_snapshots @enable_snapshots end |
#extract_navigation_edges ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def @extract_navigation_edges end |
#extractors ⇒ Object
Returns the value of attribute extractors.
141 142 143 |
# File 'lib/woods.rb', line 141 def extractors @extractors end |
#gem_configs ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def gem_configs @gem_configs end |
#graph_store ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def graph_store @graph_store end |
#include_framework_sources ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def include_framework_sources @include_framework_sources end |
#log_level ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def log_level @log_level end |
#max_context_tokens ⇒ Object
Returns the value of attribute max_context_tokens.
141 142 143 |
# File 'lib/woods.rb', line 141 def max_context_tokens @max_context_tokens end |
#metadata_store ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def @metadata_store end |
#metadata_store_options ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def @metadata_store_options end |
#notion_api_token ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def notion_api_token @notion_api_token end |
#notion_database_ids ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def notion_database_ids @notion_database_ids end |
#precompute_flows ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def precompute_flows @precompute_flows end |
#pretty_json ⇒ Object
Returns the value of attribute pretty_json.
141 142 143 |
# File 'lib/woods.rb', line 141 def pretty_json @pretty_json end |
#session_exclude_paths ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def session_exclude_paths @session_exclude_paths end |
#session_id_proc ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def session_id_proc @session_id_proc end |
#session_store ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def session_store @session_store end |
#session_tracer_allow_production ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def session_tracer_allow_production @session_tracer_allow_production end |
#session_tracer_enabled ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def session_tracer_enabled @session_tracer_enabled end |
#similarity_threshold ⇒ Object
Returns the value of attribute similarity_threshold.
141 142 143 |
# File 'lib/woods.rb', line 141 def similarity_threshold @similarity_threshold end |
#unblocked_api_token ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def unblocked_api_token @unblocked_api_token end |
#unblocked_collection_id ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def unblocked_collection_id @unblocked_collection_id end |
#unblocked_repo_url ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def unblocked_repo_url @unblocked_repo_url end |
#vector_store ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def vector_store @vector_store end |
#vector_store_options ⇒ Object
rubocop:disable Metrics/ClassLength
123 124 125 |
# File 'lib/woods.rb', line 123 def @vector_store_options end |
Instance Method Details
#add_gem(gem_name, paths:, priority: :medium) ⇒ Object
Add a gem to be indexed
278 279 280 |
# File 'lib/woods.rb', line 278 def add_gem(gem_name, paths:, priority: :medium) @gem_configs[gem_name] = { paths: paths, priority: priority } end |
#output_dir ⇒ Pathname, String
Returns Output directory, defaulting to Rails.root/tmp/woods.
203 204 205 |
# File 'lib/woods.rb', line 203 def output_dir @output_dir ||= defined?(Rails) && Rails.root ? Rails.root.join('tmp/woods') : 'tmp/woods' end |
#output_dir=(value) ⇒ Object
209 210 211 212 213 |
# File 'lib/woods.rb', line 209 def output_dir=(value) raise ConfigurationError, 'output_dir cannot be nil' if value.nil? @output_dir = value end |