codebase_index 0.3.2 → 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.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/lib/codebase_index.rb +3 -243
  3. metadata +28 -223
  4. data/CHANGELOG.md +0 -89
  5. data/CODE_OF_CONDUCT.md +0 -83
  6. data/CONTRIBUTING.md +0 -65
  7. data/LICENSE.txt +0 -21
  8. data/README.md +0 -325
  9. data/exe/codebase-console +0 -59
  10. data/exe/codebase-console-mcp +0 -22
  11. data/exe/codebase-index-mcp +0 -34
  12. data/exe/codebase-index-mcp-http +0 -37
  13. data/exe/codebase-index-mcp-start +0 -58
  14. data/lib/codebase_index/ast/call_site_extractor.rb +0 -106
  15. data/lib/codebase_index/ast/method_extractor.rb +0 -71
  16. data/lib/codebase_index/ast/node.rb +0 -116
  17. data/lib/codebase_index/ast/parser.rb +0 -614
  18. data/lib/codebase_index/ast.rb +0 -6
  19. data/lib/codebase_index/builder.rb +0 -200
  20. data/lib/codebase_index/cache/cache_middleware.rb +0 -199
  21. data/lib/codebase_index/cache/cache_store.rb +0 -264
  22. data/lib/codebase_index/cache/redis_cache_store.rb +0 -116
  23. data/lib/codebase_index/cache/solid_cache_store.rb +0 -111
  24. data/lib/codebase_index/chunking/chunk.rb +0 -84
  25. data/lib/codebase_index/chunking/semantic_chunker.rb +0 -295
  26. data/lib/codebase_index/console/adapters/cache_adapter.rb +0 -58
  27. data/lib/codebase_index/console/adapters/good_job_adapter.rb +0 -33
  28. data/lib/codebase_index/console/adapters/job_adapter.rb +0 -68
  29. data/lib/codebase_index/console/adapters/sidekiq_adapter.rb +0 -33
  30. data/lib/codebase_index/console/adapters/solid_queue_adapter.rb +0 -33
  31. data/lib/codebase_index/console/audit_logger.rb +0 -75
  32. data/lib/codebase_index/console/bridge.rb +0 -177
  33. data/lib/codebase_index/console/confirmation.rb +0 -90
  34. data/lib/codebase_index/console/connection_manager.rb +0 -173
  35. data/lib/codebase_index/console/console_response_renderer.rb +0 -74
  36. data/lib/codebase_index/console/embedded_executor.rb +0 -373
  37. data/lib/codebase_index/console/model_validator.rb +0 -81
  38. data/lib/codebase_index/console/rack_middleware.rb +0 -87
  39. data/lib/codebase_index/console/safe_context.rb +0 -82
  40. data/lib/codebase_index/console/server.rb +0 -612
  41. data/lib/codebase_index/console/sql_validator.rb +0 -172
  42. data/lib/codebase_index/console/tools/tier1.rb +0 -118
  43. data/lib/codebase_index/console/tools/tier2.rb +0 -117
  44. data/lib/codebase_index/console/tools/tier3.rb +0 -110
  45. data/lib/codebase_index/console/tools/tier4.rb +0 -79
  46. data/lib/codebase_index/coordination/pipeline_lock.rb +0 -109
  47. data/lib/codebase_index/cost_model/embedding_cost.rb +0 -88
  48. data/lib/codebase_index/cost_model/estimator.rb +0 -128
  49. data/lib/codebase_index/cost_model/provider_pricing.rb +0 -67
  50. data/lib/codebase_index/cost_model/storage_cost.rb +0 -52
  51. data/lib/codebase_index/cost_model.rb +0 -22
  52. data/lib/codebase_index/db/migrations/001_create_units.rb +0 -38
  53. data/lib/codebase_index/db/migrations/002_create_edges.rb +0 -35
  54. data/lib/codebase_index/db/migrations/003_create_embeddings.rb +0 -37
  55. data/lib/codebase_index/db/migrations/004_create_snapshots.rb +0 -45
  56. data/lib/codebase_index/db/migrations/005_create_snapshot_units.rb +0 -40
  57. data/lib/codebase_index/db/migrator.rb +0 -71
  58. data/lib/codebase_index/db/schema_version.rb +0 -73
  59. data/lib/codebase_index/dependency_graph.rb +0 -236
  60. data/lib/codebase_index/embedding/indexer.rb +0 -140
  61. data/lib/codebase_index/embedding/openai.rb +0 -126
  62. data/lib/codebase_index/embedding/provider.rb +0 -162
  63. data/lib/codebase_index/embedding/text_preparer.rb +0 -112
  64. data/lib/codebase_index/evaluation/baseline_runner.rb +0 -115
  65. data/lib/codebase_index/evaluation/evaluator.rb +0 -139
  66. data/lib/codebase_index/evaluation/metrics.rb +0 -79
  67. data/lib/codebase_index/evaluation/query_set.rb +0 -148
  68. data/lib/codebase_index/evaluation/report_generator.rb +0 -90
  69. data/lib/codebase_index/extracted_unit.rb +0 -145
  70. data/lib/codebase_index/extractor.rb +0 -1028
  71. data/lib/codebase_index/extractors/action_cable_extractor.rb +0 -201
  72. data/lib/codebase_index/extractors/ast_source_extraction.rb +0 -46
  73. data/lib/codebase_index/extractors/behavioral_profile.rb +0 -309
  74. data/lib/codebase_index/extractors/caching_extractor.rb +0 -261
  75. data/lib/codebase_index/extractors/callback_analyzer.rb +0 -246
  76. data/lib/codebase_index/extractors/concern_extractor.rb +0 -292
  77. data/lib/codebase_index/extractors/configuration_extractor.rb +0 -219
  78. data/lib/codebase_index/extractors/controller_extractor.rb +0 -404
  79. data/lib/codebase_index/extractors/database_view_extractor.rb +0 -278
  80. data/lib/codebase_index/extractors/decorator_extractor.rb +0 -253
  81. data/lib/codebase_index/extractors/engine_extractor.rb +0 -223
  82. data/lib/codebase_index/extractors/event_extractor.rb +0 -211
  83. data/lib/codebase_index/extractors/factory_extractor.rb +0 -289
  84. data/lib/codebase_index/extractors/graphql_extractor.rb +0 -892
  85. data/lib/codebase_index/extractors/i18n_extractor.rb +0 -117
  86. data/lib/codebase_index/extractors/job_extractor.rb +0 -374
  87. data/lib/codebase_index/extractors/lib_extractor.rb +0 -218
  88. data/lib/codebase_index/extractors/mailer_extractor.rb +0 -269
  89. data/lib/codebase_index/extractors/manager_extractor.rb +0 -188
  90. data/lib/codebase_index/extractors/middleware_extractor.rb +0 -133
  91. data/lib/codebase_index/extractors/migration_extractor.rb +0 -469
  92. data/lib/codebase_index/extractors/model_extractor.rb +0 -988
  93. data/lib/codebase_index/extractors/phlex_extractor.rb +0 -252
  94. data/lib/codebase_index/extractors/policy_extractor.rb +0 -191
  95. data/lib/codebase_index/extractors/poro_extractor.rb +0 -229
  96. data/lib/codebase_index/extractors/pundit_extractor.rb +0 -223
  97. data/lib/codebase_index/extractors/rails_source_extractor.rb +0 -473
  98. data/lib/codebase_index/extractors/rake_task_extractor.rb +0 -343
  99. data/lib/codebase_index/extractors/route_extractor.rb +0 -181
  100. data/lib/codebase_index/extractors/scheduled_job_extractor.rb +0 -331
  101. data/lib/codebase_index/extractors/serializer_extractor.rb +0 -339
  102. data/lib/codebase_index/extractors/service_extractor.rb +0 -217
  103. data/lib/codebase_index/extractors/shared_dependency_scanner.rb +0 -91
  104. data/lib/codebase_index/extractors/shared_utility_methods.rb +0 -281
  105. data/lib/codebase_index/extractors/state_machine_extractor.rb +0 -398
  106. data/lib/codebase_index/extractors/test_mapping_extractor.rb +0 -225
  107. data/lib/codebase_index/extractors/validator_extractor.rb +0 -211
  108. data/lib/codebase_index/extractors/view_component_extractor.rb +0 -311
  109. data/lib/codebase_index/extractors/view_template_extractor.rb +0 -261
  110. data/lib/codebase_index/feedback/gap_detector.rb +0 -89
  111. data/lib/codebase_index/feedback/store.rb +0 -119
  112. data/lib/codebase_index/filename_utils.rb +0 -32
  113. data/lib/codebase_index/flow_analysis/operation_extractor.rb +0 -206
  114. data/lib/codebase_index/flow_analysis/response_code_mapper.rb +0 -154
  115. data/lib/codebase_index/flow_assembler.rb +0 -290
  116. data/lib/codebase_index/flow_document.rb +0 -191
  117. data/lib/codebase_index/flow_precomputer.rb +0 -102
  118. data/lib/codebase_index/formatting/base.rb +0 -30
  119. data/lib/codebase_index/formatting/claude_adapter.rb +0 -98
  120. data/lib/codebase_index/formatting/generic_adapter.rb +0 -56
  121. data/lib/codebase_index/formatting/gpt_adapter.rb +0 -64
  122. data/lib/codebase_index/formatting/human_adapter.rb +0 -78
  123. data/lib/codebase_index/graph_analyzer.rb +0 -374
  124. data/lib/codebase_index/mcp/bootstrapper.rb +0 -96
  125. data/lib/codebase_index/mcp/index_reader.rb +0 -394
  126. data/lib/codebase_index/mcp/renderers/claude_renderer.rb +0 -81
  127. data/lib/codebase_index/mcp/renderers/json_renderer.rb +0 -17
  128. data/lib/codebase_index/mcp/renderers/markdown_renderer.rb +0 -353
  129. data/lib/codebase_index/mcp/renderers/plain_renderer.rb +0 -240
  130. data/lib/codebase_index/mcp/server.rb +0 -961
  131. data/lib/codebase_index/mcp/tool_response_renderer.rb +0 -85
  132. data/lib/codebase_index/model_name_cache.rb +0 -51
  133. data/lib/codebase_index/notion/client.rb +0 -217
  134. data/lib/codebase_index/notion/exporter.rb +0 -219
  135. data/lib/codebase_index/notion/mapper.rb +0 -40
  136. data/lib/codebase_index/notion/mappers/column_mapper.rb +0 -57
  137. data/lib/codebase_index/notion/mappers/migration_mapper.rb +0 -39
  138. data/lib/codebase_index/notion/mappers/model_mapper.rb +0 -161
  139. data/lib/codebase_index/notion/mappers/shared.rb +0 -22
  140. data/lib/codebase_index/notion/rate_limiter.rb +0 -68
  141. data/lib/codebase_index/observability/health_check.rb +0 -79
  142. data/lib/codebase_index/observability/instrumentation.rb +0 -34
  143. data/lib/codebase_index/observability/structured_logger.rb +0 -57
  144. data/lib/codebase_index/operator/error_escalator.rb +0 -81
  145. data/lib/codebase_index/operator/pipeline_guard.rb +0 -92
  146. data/lib/codebase_index/operator/status_reporter.rb +0 -80
  147. data/lib/codebase_index/railtie.rb +0 -38
  148. data/lib/codebase_index/resilience/circuit_breaker.rb +0 -99
  149. data/lib/codebase_index/resilience/index_validator.rb +0 -167
  150. data/lib/codebase_index/resilience/retryable_provider.rb +0 -108
  151. data/lib/codebase_index/retrieval/context_assembler.rb +0 -261
  152. data/lib/codebase_index/retrieval/query_classifier.rb +0 -133
  153. data/lib/codebase_index/retrieval/ranker.rb +0 -277
  154. data/lib/codebase_index/retrieval/search_executor.rb +0 -316
  155. data/lib/codebase_index/retriever.rb +0 -152
  156. data/lib/codebase_index/ruby_analyzer/class_analyzer.rb +0 -170
  157. data/lib/codebase_index/ruby_analyzer/dataflow_analyzer.rb +0 -77
  158. data/lib/codebase_index/ruby_analyzer/fqn_builder.rb +0 -18
  159. data/lib/codebase_index/ruby_analyzer/mermaid_renderer.rb +0 -280
  160. data/lib/codebase_index/ruby_analyzer/method_analyzer.rb +0 -143
  161. data/lib/codebase_index/ruby_analyzer/trace_enricher.rb +0 -143
  162. data/lib/codebase_index/ruby_analyzer.rb +0 -87
  163. data/lib/codebase_index/session_tracer/file_store.rb +0 -104
  164. data/lib/codebase_index/session_tracer/middleware.rb +0 -143
  165. data/lib/codebase_index/session_tracer/redis_store.rb +0 -106
  166. data/lib/codebase_index/session_tracer/session_flow_assembler.rb +0 -254
  167. data/lib/codebase_index/session_tracer/session_flow_document.rb +0 -223
  168. data/lib/codebase_index/session_tracer/solid_cache_store.rb +0 -139
  169. data/lib/codebase_index/session_tracer/store.rb +0 -81
  170. data/lib/codebase_index/storage/graph_store.rb +0 -120
  171. data/lib/codebase_index/storage/metadata_store.rb +0 -196
  172. data/lib/codebase_index/storage/pgvector.rb +0 -195
  173. data/lib/codebase_index/storage/qdrant.rb +0 -205
  174. data/lib/codebase_index/storage/vector_store.rb +0 -167
  175. data/lib/codebase_index/temporal/json_snapshot_store.rb +0 -245
  176. data/lib/codebase_index/temporal/snapshot_store.rb +0 -345
  177. data/lib/codebase_index/token_utils.rb +0 -19
  178. data/lib/codebase_index/version.rb +0 -5
  179. data/lib/generators/codebase_index/install_generator.rb +0 -32
  180. data/lib/generators/codebase_index/pgvector_generator.rb +0 -37
  181. data/lib/generators/codebase_index/templates/add_pgvector_to_codebase_index.rb.erb +0 -15
  182. data/lib/generators/codebase_index/templates/create_codebase_index_tables.rb.erb +0 -43
  183. data/lib/tasks/codebase_index.rake +0 -597
  184. data/lib/tasks/codebase_index_evaluation.rake +0 -115
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a55ea6a46950c68c6cc1b39f9008bbff466dea9e20d8b646564d4cc489060552
4
- data.tar.gz: ca3f117e515fb14f2ec6069c4e6ef541b661e90f0e3d33daa9f9fab43afb746a
3
+ metadata.gz: eddea71f3c17946eac1fffac433f0b7802087020aa237be722e1c8ab9e29dfa5
4
+ data.tar.gz: '07316803c47bbc1823d8b25c22c16371a14c5b0c03669b805421a593f68b2845'
5
5
  SHA512:
6
- metadata.gz: e9ff9f423902e1651540b9f933e9a1afab31b3b4ebb0347a368769a83aaf8c1a493e7a33ac68d14a7733753da085dc830e9509911d0bc49205b21e2e07d82de3
7
- data.tar.gz: ab8630e12cd123cfeeeee6796d0529cdbaa0f8e6e8c0fb9d7d95dadf753b8a8fbb0d5e2136ff2353cc3aac8b0acb5f525f75f903bc777e86326468c6a759ae8a
6
+ metadata.gz: 674c4526b467daf98309ee5afcc4f89a080b40420f2532adcb923f87fa7c0969fde9e1373b72301326f0f25b81c49f0965460ff03fc17e8e3ae4cdb74b1100c2
7
+ data.tar.gz: f4417425c8964e176c9b804332f2fb6e31f53827c51cffdea4d0f8b084cbe5c953083496e6403059c6bea2dc2b2c1d87129ecf7d5231fad7b4c5a9d4b51b8339
@@ -1,246 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # CodebaseIndex - Rails Codebase Indexing and Retrieval
4
- #
5
- # A system for extracting, indexing, and retrieving context from Rails codebases
6
- # to enable AI-assisted development, debugging, and analytics.
7
- #
8
- # ## Quick Start
9
- #
10
- # # Extract codebase
11
- # CodebaseIndex.extract!
12
- #
13
- # # Or via rake
14
- # bundle exec rake codebase_index:extract
15
- #
16
- # ## Configuration
17
- #
18
- # CodebaseIndex.configure do |config|
19
- # config.output_dir = Rails.root.join("tmp/codebase_index")
20
- # config.max_context_tokens = 8000
21
- # config.include_framework_sources = true
22
- # end
23
- #
24
- require_relative 'codebase_index/version'
3
+ warn '[DEPRECATION] The "codebase_index" gem has been renamed to "woods". ' \
4
+ 'Please update your Gemfile: gem "woods"'
25
5
 
26
- module CodebaseIndex
27
- class Error < StandardError; end
28
- class ConfigurationError < Error; end
29
- class ExtractionError < Error; end
30
- class SessionTracerError < Error; end
31
-
32
- CONFIG_MUTEX = Mutex.new
33
-
34
- # ════════════════════════════════════════════════════════════════════════
35
- # Configuration
36
- # ════════════════════════════════════════════════════════════════════════
37
-
38
- class Configuration
39
- attr_accessor :embedding_model, :include_framework_sources, :gem_configs,
40
- :vector_store, :metadata_store, :graph_store, :embedding_provider, :log_level,
41
- :vector_store_options, :metadata_store_options, :embedding_options,
42
- :concurrent_extraction, :precompute_flows, :enable_snapshots,
43
- :session_tracer_enabled, :session_store, :session_id_proc, :session_exclude_paths,
44
- :console_mcp_enabled, :console_mcp_path, :console_redacted_columns,
45
- :notion_api_token, :notion_database_ids,
46
- :cache_store, :cache_options
47
- attr_reader :max_context_tokens, :similarity_threshold, :extractors, :pretty_json, :context_format,
48
- :cache_enabled
49
-
50
- def initialize # rubocop:disable Metrics/MethodLength
51
- @output_dir = nil # Resolved lazily; Rails.root is nil at require time
52
- @embedding_model = 'text-embedding-3-small'
53
- @max_context_tokens = 8000
54
- @similarity_threshold = 0.7
55
- @include_framework_sources = true
56
- @gem_configs = {}
57
- @extractors = %i[models controllers services components view_components jobs mailers graphql serializers
58
- managers policies validators rails_source]
59
- @pretty_json = true
60
- @concurrent_extraction = false
61
- @precompute_flows = false
62
- @enable_snapshots = false
63
- @context_format = :markdown
64
- @session_tracer_enabled = false
65
- @session_store = nil
66
- @session_id_proc = nil
67
- @session_exclude_paths = []
68
- @console_mcp_enabled = false
69
- @console_mcp_path = '/mcp/console'
70
- @console_redacted_columns = []
71
- @notion_api_token = nil
72
- @notion_database_ids = {}
73
- @cache_enabled = false
74
- @cache_store = nil # :redis, :solid_cache, :memory, or a CacheStore instance
75
- @cache_options = {} # { redis: client, cache: store, ttl: { embeddings: 86400, ... } }
76
- end
77
-
78
- # @return [Pathname, String] Output directory, defaulting to Rails.root/tmp/codebase_index
79
- def output_dir
80
- @output_dir ||= defined?(Rails) && Rails.root ? Rails.root.join('tmp/codebase_index') : 'tmp/codebase_index'
81
- end
82
-
83
- # @param value [Object] Must respond to #to_s
84
- # @raise [ConfigurationError] if value is nil
85
- def output_dir=(value)
86
- raise ConfigurationError, 'output_dir cannot be nil' if value.nil?
87
-
88
- @output_dir = value
89
- end
90
-
91
- # @param value [Integer] Must be a positive Integer
92
- # @raise [ConfigurationError] if value is not a positive Integer
93
- def max_context_tokens=(value)
94
- unless value.is_a?(Integer) && value.positive?
95
- raise ConfigurationError, "max_context_tokens must be a positive Integer, got #{value.inspect}"
96
- end
97
-
98
- @max_context_tokens = value
99
- end
100
-
101
- # @param value [Numeric] Must be between 0.0 and 1.0 inclusive
102
- # @raise [ConfigurationError] if value is out of range or not numeric
103
- def similarity_threshold=(value)
104
- raise ConfigurationError, "similarity_threshold must be Numeric, got #{value.inspect}" unless value.is_a?(Numeric)
105
-
106
- float_val = value.to_f
107
- unless float_val.between?(0.0, 1.0)
108
- raise ConfigurationError, "similarity_threshold must be between 0.0 and 1.0, got #{value.inspect}"
109
- end
110
-
111
- @similarity_threshold = float_val
112
- end
113
-
114
- # @param value [Array<Symbol>] List of extractor names
115
- # @raise [ConfigurationError] if value is not an Array of Symbols
116
- def extractors=(value)
117
- unless value.is_a?(Array) && value.all?(Symbol)
118
- raise ConfigurationError, "extractors must be an Array of Symbols, got #{value.inspect}"
119
- end
120
-
121
- @extractors = value
122
- end
123
-
124
- # @param value [Boolean] Must be true or false
125
- # @raise [ConfigurationError] if value is not a boolean
126
- def pretty_json=(value)
127
- validate_boolean!(:pretty_json, value)
128
- @pretty_json = value
129
- end
130
-
131
- # @param value [Symbol] Must be one of :claude, :markdown, :plain, :json
132
- # @raise [ConfigurationError] if value is not a valid format
133
- def context_format=(value)
134
- valid = %i[claude markdown plain json]
135
- unless valid.include?(value)
136
- raise ConfigurationError, "context_format must be one of #{valid.inspect}, got #{value.inspect}"
137
- end
138
-
139
- @context_format = value
140
- end
141
-
142
- # @param value [Boolean] Enable or disable the cache layer
143
- # @raise [ConfigurationError] if value is not a boolean
144
- def cache_enabled=(value)
145
- validate_boolean!(:cache_enabled, value)
146
- @cache_enabled = value
147
- end
148
-
149
- # Add a gem to be indexed
150
- #
151
- # @param gem_name [String] Name of the gem
152
- # @param paths [Array<String>] Relative paths within the gem to index
153
- # @param priority [Symbol] :high, :medium, or :low
154
- def add_gem(gem_name, paths:, priority: :medium)
155
- @gem_configs[gem_name] = { paths: paths, priority: priority }
156
- end
157
-
158
- private
159
-
160
- def validate_boolean!(name, value)
161
- return if value.is_a?(TrueClass) || value.is_a?(FalseClass)
162
-
163
- raise ConfigurationError, "#{name} must be true or false, got #{value.inspect}"
164
- end
165
- end
166
-
167
- # ════════════════════════════════════════════════════════════════════════
168
- # Module Interface
169
- # ════════════════════════════════════════════════════════════════════════
170
-
171
- class << self
172
- attr_accessor :configuration
173
-
174
- def configure
175
- CONFIG_MUTEX.synchronize do
176
- self.configuration ||= Configuration.new
177
- yield(configuration) if block_given?
178
- configuration
179
- end
180
- end
181
-
182
- # Configure the module using a named preset and optional block customization.
183
- #
184
- # Valid preset names: :local, :postgresql, :production
185
- #
186
- # @param name [Symbol] Preset name
187
- # @yield [config] Optional block for further customization after preset is applied
188
- # @yieldparam config [Configuration] The configuration object
189
- # @return [Configuration] The applied configuration
190
- def configure_with_preset(name)
191
- CONFIG_MUTEX.synchronize do
192
- self.configuration = Builder.preset_config(name)
193
- yield configuration if block_given?
194
- configuration
195
- end
196
- end
197
-
198
- # Build a Retriever wired with adapters from the current configuration.
199
- #
200
- # @return [Retriever] A fully wired retriever instance
201
- def build_retriever
202
- Builder.new(configuration).build_retriever
203
- end
204
-
205
- # Retrieve context for a natural language query using the current configuration.
206
- #
207
- # @param query [String] Natural language query
208
- # @param opts [Hash] Options passed through to the retriever (e.g., budget:)
209
- # @return [Retriever::RetrievalResult] Retrieval result
210
- def retrieve(query, **opts)
211
- build_retriever.retrieve(query, **opts)
212
- end
213
-
214
- # Perform full extraction
215
- #
216
- # @param output_dir [String] Override output directory
217
- # @return [Hash] Extraction results
218
- def extract!(output_dir: nil)
219
- require_relative 'codebase_index/extractor'
220
-
221
- dir = output_dir || configuration.output_dir
222
- extractor = Extractor.new(output_dir: dir)
223
- extractor.extract_all
224
- end
225
-
226
- # Perform incremental extraction
227
- #
228
- # @param changed_files [Array<String>] List of changed files
229
- # @return [Array<String>] Re-extracted unit identifiers
230
- def extract_changed!(changed_files)
231
- require_relative 'codebase_index/extractor'
232
-
233
- extractor = Extractor.new(output_dir: configuration.output_dir)
234
- extractor.extract_changed(changed_files)
235
- end
236
- end
237
-
238
- # Initialize with defaults
239
- configure
240
- end
241
-
242
- require_relative 'codebase_index/builder'
243
- require_relative 'codebase_index/cost_model'
244
- require_relative 'codebase_index/cache/cache_store'
245
- require_relative 'codebase_index/cache/cache_middleware'
246
- require_relative 'codebase_index/railtie' if defined?(Rails::Railtie)
6
+ require 'woods'
metadata CHANGED
@@ -1,253 +1,59 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebase_index
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Armstrong
8
- autorequire:
9
- bindir: exe
8
+ bindir: bin
10
9
  cert_chain: []
11
- date: 2026-03-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: mcp
13
+ name: woods
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '0.6'
18
+ version: '1.0'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '0.6'
27
- - !ruby/object:Gem::Dependency
28
- name: railties
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '6.1'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '6.1'
25
+ version: '1.0'
41
26
  description: |
42
- CodebaseIndex extracts structured data from Rails applications for use in
43
- AI-assisted development tooling. It provides version-specific context by
44
- running inside Rails to leverage runtime introspection, inlining concerns,
45
- mapping routes to controllers, and indexing the exact Rails/gem source
46
- versions in use.
27
+ This gem has been renamed to "woods". Install "woods" instead.
28
+ This shim exists only to notify existing users of the rename.
47
29
  email:
48
30
  - info@leah.wtf
49
- executables:
50
- - codebase-index-mcp
51
- - codebase-index-mcp-start
52
- - codebase-console-mcp
53
- - codebase-console
54
- - codebase-index-mcp-http
31
+ executables: []
55
32
  extensions: []
56
33
  extra_rdoc_files: []
57
34
  files:
58
- - CHANGELOG.md
59
- - CODE_OF_CONDUCT.md
60
- - CONTRIBUTING.md
61
- - LICENSE.txt
62
- - README.md
63
- - exe/codebase-console
64
- - exe/codebase-console-mcp
65
- - exe/codebase-index-mcp
66
- - exe/codebase-index-mcp-http
67
- - exe/codebase-index-mcp-start
68
35
  - lib/codebase_index.rb
69
- - lib/codebase_index/ast.rb
70
- - lib/codebase_index/ast/call_site_extractor.rb
71
- - lib/codebase_index/ast/method_extractor.rb
72
- - lib/codebase_index/ast/node.rb
73
- - lib/codebase_index/ast/parser.rb
74
- - lib/codebase_index/builder.rb
75
- - lib/codebase_index/cache/cache_middleware.rb
76
- - lib/codebase_index/cache/cache_store.rb
77
- - lib/codebase_index/cache/redis_cache_store.rb
78
- - lib/codebase_index/cache/solid_cache_store.rb
79
- - lib/codebase_index/chunking/chunk.rb
80
- - lib/codebase_index/chunking/semantic_chunker.rb
81
- - lib/codebase_index/console/adapters/cache_adapter.rb
82
- - lib/codebase_index/console/adapters/good_job_adapter.rb
83
- - lib/codebase_index/console/adapters/job_adapter.rb
84
- - lib/codebase_index/console/adapters/sidekiq_adapter.rb
85
- - lib/codebase_index/console/adapters/solid_queue_adapter.rb
86
- - lib/codebase_index/console/audit_logger.rb
87
- - lib/codebase_index/console/bridge.rb
88
- - lib/codebase_index/console/confirmation.rb
89
- - lib/codebase_index/console/connection_manager.rb
90
- - lib/codebase_index/console/console_response_renderer.rb
91
- - lib/codebase_index/console/embedded_executor.rb
92
- - lib/codebase_index/console/model_validator.rb
93
- - lib/codebase_index/console/rack_middleware.rb
94
- - lib/codebase_index/console/safe_context.rb
95
- - lib/codebase_index/console/server.rb
96
- - lib/codebase_index/console/sql_validator.rb
97
- - lib/codebase_index/console/tools/tier1.rb
98
- - lib/codebase_index/console/tools/tier2.rb
99
- - lib/codebase_index/console/tools/tier3.rb
100
- - lib/codebase_index/console/tools/tier4.rb
101
- - lib/codebase_index/coordination/pipeline_lock.rb
102
- - lib/codebase_index/cost_model.rb
103
- - lib/codebase_index/cost_model/embedding_cost.rb
104
- - lib/codebase_index/cost_model/estimator.rb
105
- - lib/codebase_index/cost_model/provider_pricing.rb
106
- - lib/codebase_index/cost_model/storage_cost.rb
107
- - lib/codebase_index/db/migrations/001_create_units.rb
108
- - lib/codebase_index/db/migrations/002_create_edges.rb
109
- - lib/codebase_index/db/migrations/003_create_embeddings.rb
110
- - lib/codebase_index/db/migrations/004_create_snapshots.rb
111
- - lib/codebase_index/db/migrations/005_create_snapshot_units.rb
112
- - lib/codebase_index/db/migrator.rb
113
- - lib/codebase_index/db/schema_version.rb
114
- - lib/codebase_index/dependency_graph.rb
115
- - lib/codebase_index/embedding/indexer.rb
116
- - lib/codebase_index/embedding/openai.rb
117
- - lib/codebase_index/embedding/provider.rb
118
- - lib/codebase_index/embedding/text_preparer.rb
119
- - lib/codebase_index/evaluation/baseline_runner.rb
120
- - lib/codebase_index/evaluation/evaluator.rb
121
- - lib/codebase_index/evaluation/metrics.rb
122
- - lib/codebase_index/evaluation/query_set.rb
123
- - lib/codebase_index/evaluation/report_generator.rb
124
- - lib/codebase_index/extracted_unit.rb
125
- - lib/codebase_index/extractor.rb
126
- - lib/codebase_index/extractors/action_cable_extractor.rb
127
- - lib/codebase_index/extractors/ast_source_extraction.rb
128
- - lib/codebase_index/extractors/behavioral_profile.rb
129
- - lib/codebase_index/extractors/caching_extractor.rb
130
- - lib/codebase_index/extractors/callback_analyzer.rb
131
- - lib/codebase_index/extractors/concern_extractor.rb
132
- - lib/codebase_index/extractors/configuration_extractor.rb
133
- - lib/codebase_index/extractors/controller_extractor.rb
134
- - lib/codebase_index/extractors/database_view_extractor.rb
135
- - lib/codebase_index/extractors/decorator_extractor.rb
136
- - lib/codebase_index/extractors/engine_extractor.rb
137
- - lib/codebase_index/extractors/event_extractor.rb
138
- - lib/codebase_index/extractors/factory_extractor.rb
139
- - lib/codebase_index/extractors/graphql_extractor.rb
140
- - lib/codebase_index/extractors/i18n_extractor.rb
141
- - lib/codebase_index/extractors/job_extractor.rb
142
- - lib/codebase_index/extractors/lib_extractor.rb
143
- - lib/codebase_index/extractors/mailer_extractor.rb
144
- - lib/codebase_index/extractors/manager_extractor.rb
145
- - lib/codebase_index/extractors/middleware_extractor.rb
146
- - lib/codebase_index/extractors/migration_extractor.rb
147
- - lib/codebase_index/extractors/model_extractor.rb
148
- - lib/codebase_index/extractors/phlex_extractor.rb
149
- - lib/codebase_index/extractors/policy_extractor.rb
150
- - lib/codebase_index/extractors/poro_extractor.rb
151
- - lib/codebase_index/extractors/pundit_extractor.rb
152
- - lib/codebase_index/extractors/rails_source_extractor.rb
153
- - lib/codebase_index/extractors/rake_task_extractor.rb
154
- - lib/codebase_index/extractors/route_extractor.rb
155
- - lib/codebase_index/extractors/scheduled_job_extractor.rb
156
- - lib/codebase_index/extractors/serializer_extractor.rb
157
- - lib/codebase_index/extractors/service_extractor.rb
158
- - lib/codebase_index/extractors/shared_dependency_scanner.rb
159
- - lib/codebase_index/extractors/shared_utility_methods.rb
160
- - lib/codebase_index/extractors/state_machine_extractor.rb
161
- - lib/codebase_index/extractors/test_mapping_extractor.rb
162
- - lib/codebase_index/extractors/validator_extractor.rb
163
- - lib/codebase_index/extractors/view_component_extractor.rb
164
- - lib/codebase_index/extractors/view_template_extractor.rb
165
- - lib/codebase_index/feedback/gap_detector.rb
166
- - lib/codebase_index/feedback/store.rb
167
- - lib/codebase_index/filename_utils.rb
168
- - lib/codebase_index/flow_analysis/operation_extractor.rb
169
- - lib/codebase_index/flow_analysis/response_code_mapper.rb
170
- - lib/codebase_index/flow_assembler.rb
171
- - lib/codebase_index/flow_document.rb
172
- - lib/codebase_index/flow_precomputer.rb
173
- - lib/codebase_index/formatting/base.rb
174
- - lib/codebase_index/formatting/claude_adapter.rb
175
- - lib/codebase_index/formatting/generic_adapter.rb
176
- - lib/codebase_index/formatting/gpt_adapter.rb
177
- - lib/codebase_index/formatting/human_adapter.rb
178
- - lib/codebase_index/graph_analyzer.rb
179
- - lib/codebase_index/mcp/bootstrapper.rb
180
- - lib/codebase_index/mcp/index_reader.rb
181
- - lib/codebase_index/mcp/renderers/claude_renderer.rb
182
- - lib/codebase_index/mcp/renderers/json_renderer.rb
183
- - lib/codebase_index/mcp/renderers/markdown_renderer.rb
184
- - lib/codebase_index/mcp/renderers/plain_renderer.rb
185
- - lib/codebase_index/mcp/server.rb
186
- - lib/codebase_index/mcp/tool_response_renderer.rb
187
- - lib/codebase_index/model_name_cache.rb
188
- - lib/codebase_index/notion/client.rb
189
- - lib/codebase_index/notion/exporter.rb
190
- - lib/codebase_index/notion/mapper.rb
191
- - lib/codebase_index/notion/mappers/column_mapper.rb
192
- - lib/codebase_index/notion/mappers/migration_mapper.rb
193
- - lib/codebase_index/notion/mappers/model_mapper.rb
194
- - lib/codebase_index/notion/mappers/shared.rb
195
- - lib/codebase_index/notion/rate_limiter.rb
196
- - lib/codebase_index/observability/health_check.rb
197
- - lib/codebase_index/observability/instrumentation.rb
198
- - lib/codebase_index/observability/structured_logger.rb
199
- - lib/codebase_index/operator/error_escalator.rb
200
- - lib/codebase_index/operator/pipeline_guard.rb
201
- - lib/codebase_index/operator/status_reporter.rb
202
- - lib/codebase_index/railtie.rb
203
- - lib/codebase_index/resilience/circuit_breaker.rb
204
- - lib/codebase_index/resilience/index_validator.rb
205
- - lib/codebase_index/resilience/retryable_provider.rb
206
- - lib/codebase_index/retrieval/context_assembler.rb
207
- - lib/codebase_index/retrieval/query_classifier.rb
208
- - lib/codebase_index/retrieval/ranker.rb
209
- - lib/codebase_index/retrieval/search_executor.rb
210
- - lib/codebase_index/retriever.rb
211
- - lib/codebase_index/ruby_analyzer.rb
212
- - lib/codebase_index/ruby_analyzer/class_analyzer.rb
213
- - lib/codebase_index/ruby_analyzer/dataflow_analyzer.rb
214
- - lib/codebase_index/ruby_analyzer/fqn_builder.rb
215
- - lib/codebase_index/ruby_analyzer/mermaid_renderer.rb
216
- - lib/codebase_index/ruby_analyzer/method_analyzer.rb
217
- - lib/codebase_index/ruby_analyzer/trace_enricher.rb
218
- - lib/codebase_index/session_tracer/file_store.rb
219
- - lib/codebase_index/session_tracer/middleware.rb
220
- - lib/codebase_index/session_tracer/redis_store.rb
221
- - lib/codebase_index/session_tracer/session_flow_assembler.rb
222
- - lib/codebase_index/session_tracer/session_flow_document.rb
223
- - lib/codebase_index/session_tracer/solid_cache_store.rb
224
- - lib/codebase_index/session_tracer/store.rb
225
- - lib/codebase_index/storage/graph_store.rb
226
- - lib/codebase_index/storage/metadata_store.rb
227
- - lib/codebase_index/storage/pgvector.rb
228
- - lib/codebase_index/storage/qdrant.rb
229
- - lib/codebase_index/storage/vector_store.rb
230
- - lib/codebase_index/temporal/json_snapshot_store.rb
231
- - lib/codebase_index/temporal/snapshot_store.rb
232
- - lib/codebase_index/token_utils.rb
233
- - lib/codebase_index/version.rb
234
- - lib/generators/codebase_index/install_generator.rb
235
- - lib/generators/codebase_index/pgvector_generator.rb
236
- - lib/generators/codebase_index/templates/add_pgvector_to_codebase_index.rb.erb
237
- - lib/generators/codebase_index/templates/create_codebase_index_tables.rb.erb
238
- - lib/tasks/codebase_index.rake
239
- - lib/tasks/codebase_index_evaluation.rake
240
- homepage: https://github.com/LeahArmstrong/codebase_index
36
+ homepage: https://github.com/lost-in-the/woods
241
37
  licenses:
242
38
  - MIT
243
39
  metadata:
244
- homepage_uri: https://github.com/LeahArmstrong/codebase_index
245
- source_code_uri: https://github.com/LeahArmstrong/codebase_index/tree/main
246
- changelog_uri: https://github.com/LeahArmstrong/codebase_index/blob/main/CHANGELOG.md
247
- bug_tracker_uri: https://github.com/LeahArmstrong/codebase_index/issues
248
- documentation_uri: https://github.com/LeahArmstrong/codebase_index/tree/main/docs
40
+ homepage_uri: https://github.com/lost-in-the/woods
41
+ source_code_uri: https://github.com/lost-in-the/woods
42
+ changelog_uri: https://github.com/lost-in-the/woods/blob/main/CHANGELOG.md
249
43
  rubygems_mfa_required: 'true'
250
- post_install_message:
44
+ post_install_message: |
45
+ ╔══════════════════════════════════════════════════════════════╗
46
+ ║ codebase_index has been renamed to "woods" ║
47
+ ║ ║
48
+ ║ Please update your Gemfile: ║
49
+ ║ gem 'woods' # was: gem 'codebase_index' ║
50
+ ║ ║
51
+ ║ And update your require: ║
52
+ ║ require 'woods' # was: require 'codebase_index' ║
53
+ ║ ║
54
+ ║ This shim will be removed in a future version. ║
55
+ ║ https://github.com/lost-in-the/woods ║
56
+ ╚══════════════════════════════════════════════════════════════╝
251
57
  rdoc_options: []
252
58
  require_paths:
253
59
  - lib
@@ -262,8 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
68
  - !ruby/object:Gem::Version
263
69
  version: '0'
264
70
  requirements: []
265
- rubygems_version: 3.5.22
266
- signing_key:
71
+ rubygems_version: 4.0.3
267
72
  specification_version: 4
268
- summary: Rails codebase extraction and indexing for AI-assisted development
73
+ summary: '[DEPRECATED] Use the "woods" gem instead'
269
74
  test_files: []
data/CHANGELOG.md DELETED
@@ -1,89 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [0.3.1] - 2026-03-04
9
-
10
- ### Fixed
11
-
12
- - **Gemspec version** now reads from `version.rb` instead of being hardcoded — prevents version mismatch during gem builds
13
- - **Release workflow** replaced `rake release` (fails on tag-triggered detached HEAD) with `gem build` + `gem push`
14
-
15
- ## [0.3.0] - 2026-03-04
16
-
17
- ### Added
18
-
19
- - **Redis/SolidCache caching layer** for retrieval pipeline with TTL, namespace isolation, and nil-caching
20
- - **Engine classification** — engines tagged as `:framework` or `:application` based on install path (handles Docker vendor paths)
21
- - **Graph analysis staleness tracking** — `generated_at` timestamp and `graph_sha` for detecting stale analysis
22
- - **Docker setup guide** (`docs/DOCKER_SETUP.md`) — split architecture, volume mounts, bridge mode, troubleshooting
23
- - **Context7 documentation suite** — 10 new user-facing docs optimized for AI retrieval: FAQ, Troubleshooting, Architecture, Extractor Reference, WHY CodebaseIndex, MCP Tool Cookbook, and 3 Context7 skills
24
- - **`context7.json`** configuration for controlling Context7 indexing scope
25
-
26
- ### Fixed
27
-
28
- - **Vendor path leak** in source file resolution across 9 extractors — framework gems under `vendor/bundle` no longer produce empty source
29
- - **Prism cross-version compatibility** — handle API differences between Prism versions
30
- - **`schema_sha`** now supports `db/structure.sql` fallback (not just `db/schema.rb`)
31
- - **ViewComponent extractor** skips framework-internal components with no resolvable source file
32
- - **HTTP connection reuse** and retry handling in embedding providers
33
- - **DependencyGraph `to_h`** returns a dup to prevent cache pollution
34
- - **MCP tool counts** corrected across all documentation (27 index / 31 console)
35
- - **TROUBLESHOOTING.md** corrected: `config.extractors` controls retrieval scope, not which extractors run
36
-
37
- ### Changed
38
-
39
- - **README streamlined** from 620 to 325 lines — added Quick Start, Documentation table; removed verbose sections in favor of links to dedicated docs
40
- - **Internal rake tasks** (`retrieve`, `self_analyze`) hidden from `rails -T`
41
- - **Estimated tokens memoization** removed to prevent stale values after source changes
42
- - **Simplification sweep** — dead code removal, shared helper extraction, bug fixes across caching and retrieval layers
43
-
44
- ### Performance
45
-
46
- - Critical hotspots fixed across extraction, storage, and retrieval pipelines
47
- - `fetch_key` optimization for falsy value handling in cache layer
48
-
49
- ## [0.2.1] - 2026-02-19
50
-
51
- ### Changed
52
-
53
- - Switch release workflow to RubyGems trusted publishing
54
-
55
- ## [0.2.0] - 2026-02-19
56
-
57
- ### Added
58
-
59
- - **Embedded console MCP server** for zero-config Rails querying (no bridge process needed)
60
- - **Console MCP setup guide** (`docs/CONSOLE_MCP_SETUP.md`) — stdio, Docker, HTTP/Rack, SSH bridge options
61
- - **CODEOWNERS** and issue template configuration
62
-
63
- ### Fixed
64
-
65
- - MCP gem compatibility and symbol key handling in embedded executor
66
- - Duplicate URI warning in gemspec
67
-
68
- ## [0.1.0] - 2026-02-18
69
-
70
- ### Added
71
-
72
- - **Extraction layer** with 13 extractors: Model, Controller, Service, Job, Mailer, Phlex, ViewComponent, GraphQL, Serializer, Manager, Policy, Validator, RailsSource
73
- - **Dependency graph** with PageRank scoring and GraphAnalyzer (orphans, hubs, cycles, bridges)
74
- - **Storage interfaces** with InMemory, SQLite, Pgvector, and Qdrant adapters
75
- - **Embedding pipeline** with OpenAI and Ollama providers, TextPreparer, resumable Indexer
76
- - **Semantic chunking** with type-aware splitting (model sections, controller per-action)
77
- - **Context formatting** adapters for Claude, GPT, generic LLMs, and humans
78
- - **Retrieval pipeline** with QueryClassifier, SearchExecutor, RRF Ranker, ContextAssembler
79
- - **Retriever orchestrator** with degradation tiers and RetrievalTrace
80
- - **Schema management** with versioned migrations and Rails generators
81
- - **Observability** with ActiveSupport::Notifications instrumentation, structured logging, health checks
82
- - **Resilience** with CircuitBreaker, RetryableProvider, IndexValidator
83
- - **MCP Index Server** (21 tools) for AI agent codebase retrieval
84
- - **Console MCP Server** (31 tools across 4 tiers) for live Rails data access
85
- - **AST layer** with Prism adapter for method extraction and call site analysis
86
- - **RubyAnalyzer** for class, method, and data flow analysis
87
- - **Flow extraction** with FlowAssembler, OperationExtractor, FlowDocument
88
- - **Evaluation harness** with Precision@k, Recall, MRR metrics and baseline comparisons
89
- - **Rake tasks** for extraction, incremental indexing, framework source, validation, stats, evaluation