caruso 0.7.4 → 0.7.5

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: f8b934cb6295f95d2246260f6eb77a4b31c999bb35e73a379457fa9c9d27d7d2
4
- data.tar.gz: 9da817fab3ff58b8a363c631ad945d206f3d4ed3f9fc65efd8f0225b3d731a6b
3
+ metadata.gz: 8eed6a0c1f2de97f2f16bdced1953bde78c4d1687e57a2be7686f4d824cce363
4
+ data.tar.gz: 31ad0e3bf661f0883e852c015633e42e59c2265d899b3d987ea35b64dc10d2ea
5
5
  SHA512:
6
- metadata.gz: 4d135ab13fc7b995cfb1fa029900902d458f1ec84d8eb7d7a1e2a54daeecf757cbfceee0a8491b8e9aeb427e7f18c01800dd227652859ea01f40fd472a55ca67
7
- data.tar.gz: 94aeb96c6fb123a76d0056785ce12489fc5d4d2d176491e5da2d35c93f3d74e4c2d53509c7932958d687abd22510e95ef30ba3fffe2cfc141389434143166332
6
+ metadata.gz: d6ec542034f0cc10881b61d008b2a49fda43cfeeaed43565b00fde4c12ae0ca8a821311a9465a6ae697353047c942047281e5fed7d7b7d32c9ca4b406daaccac
7
+ data.tar.gz: ba2ef61be533cfd99052705ab8d0fc8489596107cf8170410b7e2edf903c0de1541f698eeda2a65b7657a655ea536259547386bffc2d5db0af932bbeaff4fc76
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: cursor-spec-reviewer
3
+ description: "Use this agent when you need to verify that converted Cursor rule files (.mdc) produced by Caruso strictly conform to the official Cursor documentation and specifications. This includes reviewing frontmatter structure, metadata fields, file naming conventions, and content formatting. Launch this agent after any conversion operation to validate output correctness.\\n\\nExamples:\\n\\n- Example 1:\\n user: \"caruso plugin install document-skills@skills\"\\n assistant: \"I've installed the document-skills plugin and converted the files to Cursor format. Let me now verify the output is correct.\"\\n <commentary>\\n Since a conversion just happened, use the Task tool to launch the cursor-spec-reviewer agent to validate all generated .mdc files in .cursor/rules/caruso/ against the official Cursor specification.\\n </commentary>\\n assistant: \"Now let me use the cursor-spec-reviewer agent to validate the converted files against the Cursor specification.\"\\n\\n- Example 2:\\n user: \"Can you check if these .mdc files are valid Cursor rules?\"\\n assistant: \"I'll use the cursor-spec-reviewer agent to thoroughly validate these files against the official Cursor documentation.\"\\n <commentary>\\n The user is asking for validation of Cursor rule files. Use the Task tool to launch the cursor-spec-reviewer agent to perform a detailed specification review.\\n </commentary>\\n\\n- Example 3:\\n user: \"I just ran caruso plugin update and want to make sure everything still looks right\"\\n assistant: \"Let me launch the cursor-spec-reviewer agent to verify the updated files conform to Cursor's specifications.\"\\n <commentary>\\n After a plugin update, converted files may have changed. Use the Task tool to launch the cursor-spec-reviewer agent to re-validate all output files.\\n </commentary>"
4
+ model: opus
5
+ memory: project
6
+ ---
7
+
8
+ You are a Cursor IDE specification reviewer. Your job is to review ALL output produced by Caruso's conversion pipeline and verify it conforms to the official Cursor documentation.
9
+
10
+ ## Step 1: Fetch the Official Cursor Documentation
11
+
12
+ **MANDATORY.** Before reviewing ANY file, use WebFetch to read the current official Cursor docs:
13
+
14
+ 1. `https://cursor.com/docs/agent/hooks` — hooks specification
15
+ 2. `https://cursor.com/docs/context/rules` — rules specification
16
+ 3. `https://cursor.com/docs/context/commands` — commands specification
17
+
18
+ These are the ONLY authoritative sources. Do not rely on your training data, assumptions, or third-party sources. If a fetch fails, note the gap in your report.
19
+
20
+ Read each page carefully and extract the exact specification: required fields, valid values, supported events, JSON schemas, file formats, and any constraints or defaults.
21
+
22
+ ## Step 2: Inventory Caruso Output
23
+
24
+ Find all files Caruso generated. Check these locations:
25
+ - `.cursor/rules/caruso/` — converted rule files (`.mdc`)
26
+ - `.cursor/hooks.json` — merged hooks configuration
27
+ - `.cursor/hooks/caruso/` — hook scripts and wrappers
28
+ - `.cursor/commands/caruso/` — converted command files
29
+ - `.cursor/scripts/caruso/` — copied skill scripts
30
+
31
+ ## Step 3: Validate Each File Against the Fetched Specs
32
+
33
+ For every file found, validate it against the specification you extracted in Step 1. Check:
34
+ - File format and structure match the spec exactly
35
+ - All required fields are present with correct types
36
+ - No invalid or unknown fields
37
+ - Field values are within the allowed set (e.g., valid event names, correct boolean types)
38
+ - Referenced file paths (scripts, commands) actually exist on disk
39
+ - No leftover `${CLAUDE_PLUGIN_ROOT}` placeholders (these should have been rewritten)
40
+ - Scripts are executable and non-empty
41
+
42
+ Use the spec as your checklist — if the docs say a field is required, verify it exists. If the docs list valid values, verify the value is in that list. Do not invent requirements beyond what the docs state.
43
+
44
+ ## Step 4: Report
45
+
46
+ For each file, report:
47
+ - **Status**: PASS | WARNING | FAIL
48
+ - **Issues**: what's wrong and why (cite the spec)
49
+
50
+ End with a summary: total files, pass/warn/fail counts, overall verdict.
51
+
52
+ ## Rules
53
+
54
+ 1. **The fetched docs are your only authority.** If you can't confirm something from the docs, say so — don't guess.
55
+ 2. **Be precise about types.** String `"false"` vs boolean `false` matters. A wrong type is FAIL.
56
+ 3. **Spec violations are FAIL. Style concerns are WARNING.** Keep them separate.
57
+ 4. **Record learnings in your agent memory** for future reviews.
58
+
59
+ # Persistent Agent Memory
60
+
61
+ You have a persistent Persistent Agent Memory directory at `/Users/philipp/.superset/worktrees/caruso/ralph/.claude/agent-memory/cursor-spec-reviewer/`. Its contents persist across conversations.
62
+
63
+ As you work, consult your memory files to build on previous experience. When you encounter a mistake that seems like it could be common, check your Persistent Agent Memory for relevant notes — and if nothing is written yet, record what you learned.
64
+
65
+ Guidelines:
66
+ - `MEMORY.md` is always loaded into your system prompt — lines after 200 will be truncated, so keep it concise
67
+ - Create separate topic files (e.g., `debugging.md`, `patterns.md`) for detailed notes and link to them from MEMORY.md
68
+ - Record insights about problem constraints, strategies that worked or failed, and lessons learned
69
+ - Update or remove memories that turn out to be wrong or outdated
70
+ - Organize memory semantically by topic, not chronologically
71
+ - Use the Write and Edit tools to update your memory files
72
+ - Since this memory is project-scope and shared with your team via version control, tailor your memories to this project
73
+
74
+ ## MEMORY.md
75
+
76
+ Your MEMORY.md is currently empty. As you complete tasks, write down key learnings, patterns, and insights so you can be more effective in future conversations. Anything saved in MEMORY.md will be included in your system prompt next time.
@@ -41,7 +41,7 @@ module Caruso
41
41
  # Just return content as-is, Claude Code commands are already compatible
42
42
 
43
43
  # Add note about bash execution if it contains ! prefix
44
- if content.include?("!`")
44
+ if content.include?("`!")
45
45
  add_bash_execution_note(content)
46
46
  else
47
47
  content
@@ -28,6 +28,42 @@ module Caruso
28
28
  PermissionRequest
29
29
  ].freeze
30
30
 
31
+ # Cursor stop events need output format translation and loop_limit.
32
+ STOP_EVENTS = %w[stop subagentStop].freeze
33
+
34
+ WRAPPER_PATH = File.join(".cursor", "hooks", "caruso", "_cc_stop_wrapper.sh").freeze
35
+
36
+ # Translates Claude Code stop hook output to Cursor format.
37
+ # CC: {"decision":"block","reason":"..."} or exit 2 with stderr
38
+ # Cursor: {"followup_message":"..."}
39
+ CC_STOP_WRAPPER = <<~'BASH'
40
+ #!/bin/bash
41
+ set -uo pipefail
42
+ SCRIPT="$1"
43
+ shift
44
+ STDERR_TMP=$(mktemp) || exit 1
45
+ trap 'rm -f "$STDERR_TMP"' EXIT
46
+ OUTPUT=$("$SCRIPT" "$@" 2>"$STDERR_TMP")
47
+ EXIT_CODE=$?
48
+ if [ $EXIT_CODE -eq 2 ]; then
49
+ REASON=$(cat "$STDERR_TMP")
50
+ if [ -n "$REASON" ] && command -v jq >/dev/null 2>&1; then
51
+ jq -n --arg msg "$REASON" '{"followup_message": $msg}'
52
+ fi
53
+ exit 0
54
+ fi
55
+ if [ $EXIT_CODE -eq 0 ] && [ -n "$OUTPUT" ] && command -v jq >/dev/null 2>&1; then
56
+ DECISION=$(echo "$OUTPUT" | jq -r '.decision // empty' 2>/dev/null)
57
+ if [ "$DECISION" = "block" ]; then
58
+ REASON=$(echo "$OUTPUT" | jq -r '.reason // empty' 2>/dev/null)
59
+ [ -n "$REASON" ] && jq -n --arg msg "$REASON" '{"followup_message": $msg}'
60
+ exit 0
61
+ fi
62
+ fi
63
+ [ -n "$OUTPUT" ] && echo "$OUTPUT"
64
+ exit $EXIT_CODE
65
+ BASH
66
+
31
67
  # Contains translated hook commands keyed by event (for clean uninstall tracking).
32
68
  attr_reader :translated_hooks
33
69
 
@@ -46,6 +82,9 @@ module Caruso
46
82
  # Copy any referenced scripts
47
83
  copied_scripts = copy_hook_scripts(cursor_hooks, hooks_file)
48
84
 
85
+ # Wrap stop hook commands for Cursor compatibility (CC→Cursor output translation)
86
+ wrapper_scripts = wrap_stop_hooks(cursor_hooks)
87
+
49
88
  # Merge into existing .cursor/hooks.json
50
89
  merge_hooks(cursor_hooks)
51
90
 
@@ -55,6 +94,7 @@ module Caruso
55
94
  # Return list of created/modified files for tracking
56
95
  created = [".cursor/hooks.json"]
57
96
  created += copied_scripts
97
+ created += wrapper_scripts
58
98
  created
59
99
  end
60
100
 
@@ -111,6 +151,7 @@ module Caruso
111
151
  cursor_event = resolve_cursor_event(event_name, matcher)
112
152
  cursor_hook = { "command" => command }
113
153
  cursor_hook["timeout"] = hook["timeout"] if hook["timeout"]
154
+ cursor_hook["loop_limit"] = nil if STOP_EVENTS.include?(cursor_event)
114
155
  (hooks[cursor_event] ||= []) << cursor_hook
115
156
  end
116
157
  end
@@ -184,6 +225,31 @@ module Caruso
184
225
  target_path
185
226
  end
186
227
 
228
+ def wrap_stop_hooks(cursor_hooks)
229
+ has_stop = STOP_EVENTS.any? { |event| cursor_hooks.key?(event) }
230
+ return [] unless has_stop
231
+
232
+ wrapper_path = install_wrapper_script
233
+
234
+ STOP_EVENTS.each do |event|
235
+ next unless cursor_hooks[event]
236
+
237
+ cursor_hooks[event].each do |hook|
238
+ hook["command"] = "#{WRAPPER_PATH} #{hook['command']}"
239
+ end
240
+ end
241
+
242
+ [wrapper_path]
243
+ end
244
+
245
+ def install_wrapper_script
246
+ FileUtils.mkdir_p(File.dirname(WRAPPER_PATH))
247
+ File.write(WRAPPER_PATH, CC_STOP_WRAPPER)
248
+ File.chmod(0o755, WRAPPER_PATH)
249
+ puts "Installed stop hook wrapper: #{WRAPPER_PATH}"
250
+ WRAPPER_PATH
251
+ end
252
+
187
253
  def merge_hooks(new_hooks)
188
254
  hooks_path = File.join(".cursor", "hooks.json")
189
255
  existing = read_existing_hooks(hooks_path)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Caruso
4
- VERSION = "0.7.4"
4
+ VERSION = "0.7.5"
5
5
  end
@@ -0,0 +1,13 @@
1
+ # Claude Code Reference
2
+
3
+ Official documentation: https://code.claude.com/docs
4
+
5
+ - Hooks: https://code.claude.com/docs/en/hooks
6
+ - Hooks guide: https://code.claude.com/docs/en/hooks-guide
7
+ - Plugins: https://code.claude.com/docs/en/plugins
8
+ - Plugins reference: https://code.claude.com/docs/en/plugins-reference
9
+ - Create plugins: https://code.claude.com/docs/en/create-plugins
10
+ - Discover plugins: https://code.claude.com/docs/en/discover-plugins
11
+ - Plugin marketplaces: https://code.claude.com/docs/en/plugin-marketplaces
12
+ - Skills: https://code.claude.com/docs/en/skills
13
+ - Sub-agents: https://code.claude.com/docs/en/sub-agents
@@ -0,0 +1,8 @@
1
+ # Cursor Reference
2
+
3
+ Official documentation: https://cursor.com/docs
4
+
5
+ - Hooks: https://cursor.com/docs/agent/hooks
6
+ - Modes: https://cursor.com/docs/agent/modes
7
+ - Rules: https://cursor.com/docs/context/rules
8
+ - Commands: https://cursor.com/docs/context/commands
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
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Comans
@@ -130,6 +130,7 @@ executables:
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
+ - ".claude/agents/cursor-spec-reviewer.md"
133
134
  - ".claude/hooks/check-gemfile-lock.sh"
134
135
  - ".claude/settings.json"
135
136
  - ".rspec"
@@ -164,17 +165,8 @@ files:
164
165
  - lib/caruso/safe_file.rb
165
166
  - lib/caruso/version.rb
166
167
  - package-lock.json
167
- - reference/claude_code_create_marketplaces.md
168
- - reference/claude_code_hooks.md
169
- - reference/claude_code_marketplaces.md
170
- - reference/claude_code_plugins.md
171
- - reference/claude_code_slash_commands.md
172
- - reference/cursor_commands.md
173
- - reference/cursor_hooks.md
174
- - reference/cursor_modes.md
175
- - reference/cursor_rules.md
176
- - reference/plugins.md
177
- - reference/steering_docs.md
168
+ - reference/claude_code.md
169
+ - reference/cursor.md
178
170
  - tasks.md
179
171
  homepage: https://github.com/pcomans/caruso
180
172
  licenses: