Module: RailsAiContext::Install::Cleanup
- Defined in:
- lib/rails_ai_context/install/cleanup.rb
Overview
Removing the context files of an AI tool the user dropped. All three install entries prompt about this in their own voice; what they do once the user says yes is the same work, and used to be three copies of it.
Class Method Summary collapse
-
.remove(tools:, keeping:, root:) ⇒ Array<String>
The paths removed, directories marked with a trailing slash so callers can print them the way they always have.
Class Method Details
.remove(tools:, keeping:, root:) ⇒ Array<String>
Returns the paths removed, directories marked with a trailing slash so callers can print them the way they always have.
19 20 21 22 23 24 25 26 |
# File 'lib/rails_ai_context/install/cleanup.rb', line 19 def remove(tools:, keeping:, root:) kept = Array(keeping).flat_map { |key| AiTool.find(key)&.context_paths || [] }.to_set Array(tools).flat_map { |key| paths = AiTool.find(key)&.context_paths || [] paths.filter_map { |relative| remove_path(relative, root) unless kept.include?(relative) } } end |