caruso 0.7.1 → 0.7.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: e27842f0328ffd84a7b184987157b7bae790284f304d190896ad566250da4de2
4
- data.tar.gz: 156462c94584cd858bf0bc30fe83ad71e1796c3022088147eb03dd39e4cc0712
3
+ metadata.gz: f35c030837384c4c2ea012adee91d0c0c682c83c940c39cf3c1ffa2455109ead
4
+ data.tar.gz: 3e5a3c12c4ab88d7bcedbd20bb05b9d774840320c5f19eec8606b799edd7f7e4
5
5
  SHA512:
6
- metadata.gz: c404d5dbe4128f2c63e8ab01ac39760aa1e131d73eeb80d7c4a5ca23fb47dde2d9f2f90508625d2c60d60903942e622e62bc14adc690fe5c43657acc8ca26e96
7
- data.tar.gz: 530cb46037d8b3a67dfe3e8fca939d008b41d6ec580049392779ab047ada81321f4faadc17b00d2a2f77ff847f3bee92704929ec05803a15753fbfcbaf9824d7
6
+ metadata.gz: a36a6db9e2f4a676d4b46e815f318a8ef4577dbfb9d0ae68650b2bb2f68aba1381cb5cf9590934bb2cf53613f298c5df0293f648c085a198769f5b6a4375d582
7
+ data.tar.gz: b014ab55f651790fbfcdb59c0fa84ebd970d992987239f31161d3020aacc181e1ef58a9619a95f14856d2604da4bb49309291009203e6391a8a13c396c478f01
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+ # Check if Gemfile.lock is in sync with gemspec version
3
+ # Exit 2 to block Claude from stopping if out of sync
4
+
5
+ set -e
6
+
7
+ cd "$CLAUDE_PROJECT_DIR"
8
+
9
+ # Run bundle install in check mode (doesn't modify anything)
10
+ # If Gemfile.lock would change, bundle check fails
11
+ if ! bundle check > /dev/null 2>&1; then
12
+ echo "Gemfile.lock is out of sync. Run 'bundle install' and commit the changes." >&2
13
+ exit 2
14
+ fi
15
+
16
+ # Also check if Gemfile.lock has uncommitted changes
17
+ if git diff --name-only | grep -q "Gemfile.lock"; then
18
+ echo "Gemfile.lock has uncommitted changes. Please commit them before finishing." >&2
19
+ exit 2
20
+ fi
21
+
22
+ exit 0
@@ -0,0 +1,15 @@
1
+ {
2
+ "hooks": {
3
+ "Stop": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/check-gemfile-lock.sh",
9
+ "timeout": 30
10
+ }
11
+ ]
12
+ }
13
+ ]
14
+ }
15
+ }
@@ -9,13 +9,15 @@ module Caruso
9
9
  created_files = []
10
10
  files.each do |file_path|
11
11
  content = SafeFile.read(file_path)
12
- adapted_content = adapt_command_content(content, file_path)
12
+ rewritten_content, copied_scripts = copy_command_scripts_and_rewrite_paths(content, file_path)
13
+ adapted_content = adapt_command_content(rewritten_content, file_path)
13
14
 
14
15
  # Commands are flat .md files in .cursor/commands/
15
16
  # NOT nested like rules, so we override the save behavior
16
17
  created_file = save_command_file(file_path, adapted_content)
17
18
 
18
19
  created_files << created_file
20
+ created_files.concat(copied_scripts)
19
21
  end
20
22
  created_files
21
23
  end
@@ -83,6 +85,53 @@ module Caruso
83
85
  # Return relative path for tracking
84
86
  File.join(".cursor/commands", subdirs, output_filename)
85
87
  end
88
+
89
+ def copy_command_scripts_and_rewrite_paths(content, command_file)
90
+ command_root = File.join(".cursor", "commands", "caruso", marketplace_name, plugin_name)
91
+
92
+ copied_scripts = extract_plugin_script_paths(content).filter_map do |relative_path|
93
+ copy_script(relative_path, command_file, command_root)
94
+ end
95
+
96
+ rewritten_content = content.gsub("${CLAUDE_PLUGIN_ROOT}", command_root)
97
+ [rewritten_content, copied_scripts]
98
+ end
99
+
100
+ def extract_plugin_script_paths(content)
101
+ content.scan(%r{\$\{CLAUDE_PLUGIN_ROOT\}/([A-Za-z0-9._\-/]+)}).flatten.uniq
102
+ end
103
+
104
+ def copy_script(relative_path, command_file, command_root)
105
+ source_path = locate_script_source(relative_path, command_file)
106
+ unless source_path
107
+ puts "Warning: Referenced command script not found for #{command_file}: #{relative_path}"
108
+ return nil
109
+ end
110
+
111
+ target_path = File.join(command_root, relative_path)
112
+ FileUtils.mkdir_p(File.dirname(target_path))
113
+ FileUtils.cp(source_path, target_path)
114
+ File.chmod(0o755, target_path)
115
+ puts "Copied command script: #{target_path}"
116
+
117
+ target_path
118
+ end
119
+
120
+ def locate_script_source(relative_path, command_file)
121
+ current_dir = File.dirname(command_file)
122
+
123
+ loop do
124
+ candidate = File.join(current_dir, relative_path)
125
+ return candidate if File.exist?(candidate)
126
+
127
+ parent_dir = File.dirname(current_dir)
128
+ break if parent_dir == current_dir
129
+
130
+ current_dir = parent_dir
131
+ end
132
+
133
+ nil
134
+ end
86
135
  end
87
136
  end
88
137
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Caruso
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.2"
5
5
  end
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.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Comans
@@ -130,6 +130,8 @@ executables:
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
+ - ".claude/hooks/check-gemfile-lock.sh"
134
+ - ".claude/settings.json"
133
135
  - ".rspec"
134
136
  - ".rubocop.yml"
135
137
  - AGENTS.md