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 +4 -4
- data/.claude/hooks/check-gemfile-lock.sh +22 -0
- data/.claude/settings.json +15 -0
- data/lib/caruso/adapters/command_adapter.rb +50 -1
- data/lib/caruso/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f35c030837384c4c2ea012adee91d0c0c682c83c940c39cf3c1ffa2455109ead
|
|
4
|
+
data.tar.gz: 3e5a3c12c4ab88d7bcedbd20bb05b9d774840320c5f19eec8606b799edd7f7e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
@@ -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
|
-
|
|
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
|
data/lib/caruso/version.rb
CHANGED
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.
|
|
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
|