caruso 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 718b4ebf40d78b4314d5ba6869ccf65d4e7ba02ada56c0c9b98e5de973d538c7
4
- data.tar.gz: c6fcc0b7f7e45b6cd5e9235e954ea0c1cdc5d49fd729f0c6268e135ef7ac6bce
3
+ metadata.gz: e38c7a5007af96bb708d286a62909f07f1c1aa3b3aa800baa4a23f36c1a35814
4
+ data.tar.gz: 18a217953c0ec7c87bc6d9476c89bbca442fde6b45aec4614e4f58c183a3a760
5
5
  SHA512:
6
- metadata.gz: 76693951a7604897ad48efaa2e81570165e483ab20e651ff757d009a4c179f21a7738f9912229dd768205736ee076fbf2f865e1b7549385ce4c320132674c08a
7
- data.tar.gz: 691886bb54d63379e80df0663b0825f89b2dd7ece512fc2e859b90c7e09cc830c63c3f6c2cad4fe2dc6f83974eec03d728cb1c150240cf424821cb6948d2b7f4
6
+ metadata.gz: 427385d4dca6b37150a1bcf487884db8979883d1e7e3d6caa353217b55609ad43dd97dfd1c85860379a6807c62eb37646eabe491540a54a683ec347e17edbc99
7
+ data.tar.gz: f04abed100aef554d47572af9507c4d7701782b6321e5f48cfdee677f5cbe5ecd82dffab4e719b2328231ea8bee1a1a041c476ee3322fbdc8653c23333d81ed5
data/AGENTS.md CHANGED
@@ -273,4 +273,5 @@ Version is managed in `lib/caruso/version.rb`.
273
273
 
274
274
  # Memory
275
275
  - The goal is a clean, correct, consistent implementation. Never implement fallbacks that hide errors or engage in defensive programming.
276
+ - **Idempotency**: Removal commands (`marketplace remove`, `plugin uninstall`) are designed to be idempotent. They exit successfully (0) if the target does not exist. This is intentional for automation friendliness and is NOT considered "hiding errors".
276
277
  - Treat the vendor directory .cursor/rules/caruso/ as a build artifact
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.6.2] - 2025-12-17
11
+
12
+ ### Fixed
13
+ - `marketplace remove` now exits gracefully (code 0) when marketplace is not found, making it idempotent
14
+ - Documented idempotent behavior of `marketplace remove` and `plugin uninstall` in README
15
+
10
16
  ## [0.6.0] - 2025-11-24
11
17
 
12
18
  ### Security
@@ -20,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
26
  - `Adapter` now strictly validates file existence and raises errors instead of silently skipping invalid files
21
27
  - `Fetcher` now filters glob results to ensure they remain within trusted plugin directories
22
28
 
29
+
23
30
  ## [0.5.3] - 2025-11-23
24
31
 
25
32
  ### Changed
data/caruso.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "marketplaces": {},
4
+ "plugins": {}
5
+ }
data/lib/caruso/cli.rb CHANGED
@@ -51,27 +51,30 @@ module Caruso
51
51
  end
52
52
  end
53
53
 
54
- desc "remove NAME", "Remove a marketplace"
55
- def remove(name)
54
+ desc "remove NAME_OR_URL", "Remove a marketplace"
55
+ def remove(name_or_url)
56
56
  config_manager = load_config
57
+ marketplaces = config_manager.list_marketplaces
57
58
 
58
- # Remove from config
59
- config_manager.remove_marketplace(name)
60
-
61
- # Remove from registry
62
- registry = Caruso::MarketplaceRegistry.new
63
- marketplace = registry.get_marketplace(name)
64
- if marketplace
65
- cache_dir = marketplace["install_location"]
66
- registry.remove_marketplace(name)
67
-
68
- # Inform about cache directory
69
- if Dir.exist?(cache_dir)
70
- puts "Cache directory still exists at: #{cache_dir}"
71
- puts "Run 'rm -rf #{cache_dir}' to delete it if desired."
59
+ # Try to find by name first
60
+ if marketplaces.key?(name_or_url)
61
+ name = name_or_url
62
+ else
63
+ # Try to find by URL
64
+ # We need to check exact match or maybe normalized match
65
+ match = marketplaces.find { |_, details| details["url"] == name_or_url || details["url"].chomp(".git") == name_or_url }
66
+ if match
67
+ name = match[0]
68
+ else
69
+ puts "Marketplace '#{name_or_url}' not found."
70
+ return
72
71
  end
73
72
  end
74
73
 
74
+ # Use Remover to handle cleanup
75
+ remover = Caruso::Remover.new(config_manager)
76
+ remover.remove_marketplace(name)
77
+
75
78
  puts "Removed marketplace '#{name}'"
76
79
  end
77
80
 
@@ -260,15 +263,9 @@ module Caruso
260
263
  end
261
264
 
262
265
  puts "Removing #{plugin_key}..."
263
- files_to_remove = config_manager.remove_plugin(plugin_key)
264
266
 
265
- files_to_remove.each do |file|
266
- full_path = File.join(config_manager.project_dir, file)
267
- if File.exist?(full_path)
268
- File.delete(full_path)
269
- puts " Deleted #{file}"
270
- end
271
- end
267
+ remover = Caruso::Remover.new(config_manager)
268
+ remover.remove_plugin(plugin_key)
272
269
 
273
270
  puts "Uninstalled #{plugin_key}."
274
271
  end
@@ -150,6 +150,23 @@ module Caruso
150
150
  save_project_config(data)
151
151
  end
152
152
 
153
+ def remove_marketplace_with_plugins(marketplace_name)
154
+ files_to_remove = []
155
+
156
+ # Find and remove all plugins associated with this marketplace
157
+ installed_plugins = list_plugins
158
+ installed_plugins.each do |plugin_key, details|
159
+ if details["marketplace"] == marketplace_name
160
+ files_to_remove.concat(remove_plugin(plugin_key))
161
+ end
162
+ end
163
+
164
+ # Remove the marketplace itself
165
+ remove_marketplace(marketplace_name)
166
+
167
+ files_to_remove.uniq
168
+ end
169
+
153
170
  def list_marketplaces
154
171
  load_project_config["marketplaces"] || {}
155
172
  end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "marketplace_registry"
4
+
5
+ module Caruso
6
+ class Remover
7
+ attr_reader :config_manager
8
+
9
+ def initialize(config_manager)
10
+ @config_manager = config_manager
11
+ end
12
+
13
+ def remove_marketplace(name)
14
+ # 1. Remove from config and get associated plugin files
15
+ # This updates both project config (plugins) and local config (files)
16
+ files_to_remove = config_manager.remove_marketplace_with_plugins(name)
17
+
18
+ # 2. Delete the actual files
19
+ delete_files(files_to_remove)
20
+
21
+ # 3. Clean up registry cache
22
+ remove_from_registry(name)
23
+ end
24
+
25
+ def remove_plugin(name)
26
+ # 1. Remove from config
27
+ files_to_remove = config_manager.remove_plugin(name)
28
+
29
+ # 2. Delete files
30
+ delete_files(files_to_remove)
31
+ end
32
+
33
+ private
34
+
35
+ def delete_files(files)
36
+ files.each do |file|
37
+ full_path = File.join(config_manager.project_dir, file)
38
+ if File.exist?(full_path)
39
+ File.delete(full_path)
40
+ puts " Deleted #{file}"
41
+ end
42
+ end
43
+ end
44
+
45
+ def remove_from_registry(name)
46
+ registry = Caruso::MarketplaceRegistry.new
47
+ marketplace = registry.get_marketplace(name)
48
+ return unless marketplace
49
+
50
+ cache_dir = marketplace["install_location"]
51
+ registry.remove_marketplace(name)
52
+
53
+ # Inform about cache directory
54
+ return unless Dir.exist?(cache_dir)
55
+
56
+ puts "Cache directory still exists at: #{cache_dir}"
57
+ puts "Run 'rm -rf #{cache_dir}' to delete it if desired."
58
+ end
59
+ end
60
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Caruso
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.2"
5
5
  end
data/lib/caruso.rb CHANGED
@@ -7,6 +7,7 @@ require_relative "caruso/config_manager"
7
7
  require_relative "caruso/fetcher"
8
8
  require_relative "caruso/adapter"
9
9
  require_relative "caruso/marketplace_registry"
10
+ require_relative "caruso/remover"
10
11
 
11
12
  require_relative "caruso/cli"
12
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caruso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Comans
@@ -142,6 +142,7 @@ files:
142
142
  - SECURITY.md
143
143
  - bin/caruso
144
144
  - caruso.gemspec
145
+ - caruso.json
145
146
  - lib/caruso.rb
146
147
  - lib/caruso/adapter.rb
147
148
  - lib/caruso/cli.rb
@@ -149,6 +150,7 @@ files:
149
150
  - lib/caruso/fetcher.rb
150
151
  - lib/caruso/marketplace_registry.rb
151
152
  - lib/caruso/path_sanitizer.rb
153
+ - lib/caruso/remover.rb
152
154
  - lib/caruso/safe_dir.rb
153
155
  - lib/caruso/safe_file.rb
154
156
  - lib/caruso/version.rb