caruso 0.5.4

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c64aeb60f2cf2507b6b3cad6756d9730775931e2b059384f3c43febceec1aec3
4
+ data.tar.gz: ba8c515ffa913873789826bb4f704445106cc8cfbf7cbedb39ab50f68289ef83
5
+ SHA512:
6
+ metadata.gz: d81e5ab8c88206fb14523eb0a906dfd1cb4fe98e2154580242d9cd63e7d73127497d623adb0fcf5b17c32d77cf9c1091f1bd3fab49eeeef9de1fa367d149fac8
7
+ data.tar.gz: 52d8eb203ad04f396b66a00b54e5235bc3f609ea394036e7d76adaf16bc9a46bc77017901a4836f3ba2451ff905f91edea747b2845c86330b32b96a38012f981
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
4
+ --order random
data/.rubocop.yml ADDED
@@ -0,0 +1,146 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+ Exclude:
6
+ - 'vendor/**/*'
7
+ - 'pkg/**/*'
8
+ - 'tmp/**/*'
9
+ - 'node_modules/**/*'
10
+ - '.git/**/*'
11
+
12
+ # Prefer single quotes for consistency
13
+ Style/StringLiterals:
14
+ Enabled: true
15
+ EnforcedStyle: double_quotes
16
+
17
+ # Documentation is nice but not mandatory for small projects
18
+ Style/Documentation:
19
+ Enabled: false
20
+
21
+ # Block length is fine for tests and Rake tasks
22
+ Metrics/BlockLength:
23
+ Exclude:
24
+ - 'spec/**/*'
25
+ - 'Rakefile'
26
+ - '*.gemspec'
27
+
28
+ # Method length - reasonable limit
29
+ Metrics/MethodLength:
30
+ Max: 25
31
+ Exclude:
32
+ - 'spec/**/*'
33
+ - 'lib/caruso/cli.rb' # CLI command methods can be longer
34
+
35
+ # Line length - modern screens can handle more
36
+ Layout/LineLength:
37
+ Max: 120
38
+ Exclude:
39
+ - 'spec/**/*'
40
+ - '*.gemspec'
41
+
42
+ # Allow longer parameter lists for complex methods
43
+ Metrics/ParameterLists:
44
+ Max: 6
45
+
46
+ # ABC size - complexity metric
47
+ Metrics/AbcSize:
48
+ Max: 20
49
+ Exclude:
50
+ - 'spec/**/*'
51
+ - 'lib/caruso/cli.rb' # Plugin install/list methods are complex by nature
52
+ - 'lib/caruso/fetcher.rb' # Marketplace loading handles multiple sources
53
+
54
+ # Class length is fine for main classes
55
+ Metrics/ClassLength:
56
+ Max: 150
57
+ Exclude:
58
+ - 'spec/**/*'
59
+
60
+ # Prefer descriptive block parameter names
61
+ Lint/UnusedBlockArgument:
62
+ AllowUnusedKeywordArguments: true
63
+
64
+ # Allow rescue in modifier form for simple cases
65
+ Style/RescueModifier:
66
+ Enabled: false
67
+
68
+ # Prefer modern hash syntax
69
+ Style/HashSyntax:
70
+ EnforcedStyle: ruby19
71
+
72
+ # Frozen string literals - enable for performance
73
+ Style/FrozenStringLiteralComment:
74
+ Enabled: true
75
+ EnforcedStyle: always
76
+
77
+ # Prefer explicit return in some cases for clarity
78
+ Style/RedundantReturn:
79
+ Enabled: false
80
+
81
+ # Allow both semantic and compact style for conditionals
82
+ Style/IfUnlessModifier:
83
+ Enabled: false
84
+
85
+ # Allow parallel assignment for readability
86
+ Style/ParallelAssignment:
87
+ Enabled: false
88
+
89
+ # Perl-style regex backrefs are fine and more concise
90
+ Style/PerlBackrefs:
91
+ Enabled: false
92
+
93
+ # Trailing whitespace should be removed
94
+ Layout/TrailingWhitespace:
95
+ Enabled: true
96
+
97
+ # Naming conventions
98
+ Naming/MethodName:
99
+ Enabled: true
100
+ EnforcedStyle: snake_case
101
+
102
+ # Prefer raise over fail
103
+ Style/SignalException:
104
+ EnforcedStyle: only_raise
105
+
106
+ # Modern Ruby features
107
+ Style/HashEachMethods:
108
+ Enabled: true
109
+
110
+ Style/HashTransformKeys:
111
+ Enabled: true
112
+
113
+ Style/HashTransformValues:
114
+ Enabled: true
115
+
116
+ # Security
117
+ Security/Eval:
118
+ Enabled: true
119
+
120
+ Security/Open:
121
+ Enabled: true
122
+
123
+ # Gemspec cops
124
+ Gemspec/RequireMFA:
125
+ Enabled: false # MFA is good but not mandatory for all projects
126
+
127
+ Gemspec/DevelopmentDependencies:
128
+ Enabled: false # We keep dev dependencies in gemspec for gem distribution
129
+
130
+ Gemspec/OrderedDependencies:
131
+ Enabled: true # Keep dependencies alphabetically sorted
132
+
133
+ # Allow complex install method in CLI
134
+ Metrics/CyclomaticComplexity:
135
+ Max: 12
136
+ Exclude:
137
+ - 'lib/caruso/cli.rb'
138
+
139
+ Metrics/PerceivedComplexity:
140
+ Max: 12
141
+ Exclude:
142
+ - 'lib/caruso/cli.rb'
143
+
144
+ # Duplicate branches are acceptable for error handling with different contexts
145
+ Lint/DuplicateBranch:
146
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,213 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.5.3] - 2025-11-23
11
+
12
+ ### Changed
13
+ - Updated GitHub Actions workflow to only trigger on version tags (`v*`) instead of every push to main
14
+
15
+ ### Fixed
16
+ - Added debugging to verify RubyGems API token is loaded correctly in CI/CD
17
+
18
+ ### Note
19
+ - This release and versions 0.5.0-0.5.2 were used to test and configure continuous deployment to RubyGems and GitHub Packages
20
+
21
+ ## [0.5.2] - 2025-11-23
22
+
23
+ ### Note
24
+ - Testing continuous deployment workflow
25
+
26
+ ## [0.5.1] - 2025-11-23
27
+
28
+ ### Note
29
+ - Testing continuous deployment workflow
30
+
31
+ ## [0.5.0] - 2025-11-23
32
+
33
+ ### Changed
34
+ - Removed automatic `.gitignore` editing - developers now manage their own .gitignore
35
+ - Improved `caruso init` output to clearly show which files should be committed vs gitignored
36
+ - Updated CLI output to provide recommended .gitignore entries without modifying the file
37
+
38
+ ### Added
39
+ - Clear VCS documentation in README explaining which files to track
40
+ - Example `.gitignore` snippet in README for easy copy-paste
41
+ - Helpful init output showing "(commit this)" and "(add to .gitignore)" labels
42
+
43
+ ### Removed
44
+ - `update_gitignore` method from ConfigManager
45
+ - Automatic .gitignore modification during initialization
46
+
47
+ ## [0.4.0] - 2025-11-23
48
+
49
+ ### Changed
50
+ - **BREAKING**: Marketplace names now read from `marketplace.json` `name` field (required)
51
+ - **BREAKING**: Removed optional `NAME` parameter from `marketplace add` command
52
+ - Cache directory now based on URL for stability, while marketplace name comes from manifest
53
+ - Marketplace.json `name` field is now the authoritative source of truth for marketplace identity
54
+
55
+ ### Fixed
56
+ - Marketplace name resolution now matches Claude Code behavior
57
+ - `https://github.com/anthropics/claude-code` correctly resolves to `claude-code-plugins` (from manifest)
58
+ - Local directory marketplace paths now properly detected and processed
59
+
60
+ ### Added
61
+ - `Fetcher#extract_marketplace_name` public method for reading marketplace names from manifest
62
+ - Support for directory paths in marketplace URLs (auto-detects `.claude-plugin/marketplace.json`)
63
+ - Clear error message when marketplace.json is missing required `name` field
64
+ - Comprehensive test fixtures for offline testing (`spec/fixtures/test-marketplace/`, `spec/fixtures/other-marketplace/`)
65
+
66
+ ### Implementation Details
67
+ This release aligns with Claude Code specification where marketplace `name` field is required. The implementation follows a clean approach with no defensive fallbacks - if marketplace.json is invalid, it fails with a clear error rather than guessing.
68
+
69
+ Cache directories remain URL-based (`~/.caruso/marketplaces/claude-code/`) for stability, while logical marketplace names (`claude-code-plugins`) come from the manifest, properly decoupling these concerns.
70
+
71
+ ## [0.3.0] - 2025-11-22
72
+
73
+ ### Changed
74
+ - **BREAKING**: Refactored state management to use centralized `ConfigManager`
75
+ - **BREAKING**: Split configuration into `caruso.json` (project settings) and `.caruso.local.json` (local state)
76
+ - **BREAKING**: Plugins now installed to `.cursor/rules/caruso/` vendor directory
77
+ - **BREAKING**: Removed `ManifestManager` class and `.cursor/rules/caruso.json` manifest file
78
+ - Updated `init` command to create both config files and add local config to `.gitignore`
79
+ - Updated plugin installation to use composite keys (`plugin@marketplace`) for uniqueness
80
+ - Improved `uninstall` command to rely on strict file tracking in `.caruso.local.json`
81
+
82
+ ### Added
83
+ - Vendor directory strategy for better separation of managed vs user files
84
+ - Deterministic file tracking for robust uninstalls
85
+ - Support for multiple marketplaces with same plugin names via composite keys
86
+
87
+ ## [0.2.0] - 2025-11-22
88
+
89
+ ### Added
90
+ - **MarketplaceRegistry**: New persistent registry at `~/.caruso/known_marketplaces.json` tracking marketplace metadata
91
+ - `marketplace info NAME` command to view detailed marketplace information (source, URL, location, last updated, ref, cache status)
92
+ - Support for Git ref/branch pinning via `--ref` option on `marketplace add` command
93
+ - Marketplace source type tracking (git, github, url, local, directory)
94
+ - SSH authentication error detection with helpful error messages
95
+ - Registry schema validation with corruption handling and automatic backups
96
+ - `CARUSO_TESTING_SKIP_CLONE` environment variable for testing without network access
97
+
98
+ ### Changed
99
+ - **BREAKING**: Marketplace cache moved from `/tmp/caruso_cache/` to `~/.caruso/marketplaces/<marketplace-name>/`
100
+ - **BREAKING**: No backwards compatibility with previous cache location (clean break)
101
+ - Marketplace metadata now persists across system reboots in registry
102
+ - Fetcher tracks marketplace updates with timestamps
103
+ - Comprehensive test suite with 22 new MarketplaceRegistry unit tests (all passing)
104
+
105
+ ### Fixed
106
+ - Made `clone_git_repo` public for CLI access
107
+ - Integration tests now skip Git cloning in test mode for reliable offline testing
108
+ - All 158 test examples passing (0 failures)
109
+
110
+ ### Implementation Details
111
+ This release adopts Claude Code's proven architecture patterns:
112
+ - Persistent cache in `~/.caruso/` following XDG-style conventions
113
+ - Metadata registry for tracking marketplace state
114
+ - Git ref support for version pinning
115
+ - Graceful error handling for network and authentication issues
116
+
117
+ ## [0.1.4] - 2025-11-21
118
+
119
+ ### Added
120
+ - Support for custom component paths in marketplace entries (`commands`, `agents`, `skills` arrays)
121
+ - Comprehensive unit test suite for fetcher with 9 tests covering all component types
122
+ - Support for both string and array formats for custom component paths
123
+ - File deduplication when paths appear in both default and custom locations
124
+
125
+ ### Changed
126
+ - Fetcher now handles custom paths for all component types (commands, agents, skills) consistently
127
+ - Custom paths now supplement (rather than replace) default directories as per specification
128
+ - Test suite improvements with better success assertions and deterministic timing
129
+
130
+ ### Fixed
131
+ - Plugin installation from anthropics/skills marketplace now works correctly
132
+ - Integration tests reduced from 17 failures to 0 with proper assertions
133
+ - Test isolation issues resolved for more reliable test runs
134
+
135
+ ### Added (Development)
136
+ - Aruba for professional CLI testing
137
+ - RuboCop as development dependency for code quality
138
+ - Comprehensive improvement checklist in IMPROVEMENTS.md
139
+
140
+ ### Changed (Development)
141
+ - Consolidated all dependencies to gemspec (removed duplication in Gemfile)
142
+ - Updated RSpec to 3.13 for consistency
143
+ - Simplified Gemfile to only contain source and gemspec
144
+
145
+ ## [0.1.3] - 2025-11-20
146
+
147
+ ### Changed
148
+ - Updated caruso gem metadata and dependencies
149
+
150
+ ### Fixed
151
+ - Improved error handling for missing marketplaces
152
+ - Enhanced error messages when plugins are not found
153
+ - Better error handling throughout plugin operations
154
+
155
+ ## [0.1.2] - 2025-11-20
156
+
157
+ ### Added
158
+ - Rake tasks for automated semantic version bumping (`rake bump:patch`, `rake bump:minor`, `rake bump:major`)
159
+ - Script to automate version management workflow
160
+
161
+ ### Fixed
162
+ - Require `time` in config manager
163
+ - Add `lib` directory to executable load path
164
+
165
+ ## [0.1.1] - 2025-11-19
166
+
167
+ ### Added
168
+ - Cursor frontmatter now includes `alwaysApply: false` metadata
169
+ - Ensures `globs: []` is set in Cursor frontmatter for proper scoping
170
+
171
+ ### Changed
172
+ - Updated README mission statement to clarify Claude Code plugin conversion
173
+ - Adapter now returns created filenames for proper plugin registration
174
+
175
+ ### Improved
176
+ - Enhanced `init` command `--ide` flag tests
177
+ - Better plugin network error handling in tests
178
+ - Refactored file validation test setup
179
+
180
+ ## [0.1.0] - 2025-11-19
181
+
182
+ ### Added
183
+ - Initial release of Caruso gem
184
+ - Marketplace management commands (`marketplace add`, `marketplace list`, `marketplace remove`)
185
+ - Plugin installation and uninstallation (`plugin install`, `plugin uninstall`, `plugin list`)
186
+ - Configuration management with `.caruso.json`
187
+ - Manifest tracking for installed plugins
188
+ - Support for Cursor IDE integration
189
+ - Git-based marketplace cloning and plugin fetching
190
+ - Comprehensive integration test suite with RSpec
191
+ - Documentation in README and TESTING.md
192
+
193
+ ### Features
194
+ - Initialize Caruso in a project with `caruso init --ide=cursor`
195
+ - Add multiple marketplaces from GitHub repositories
196
+ - Install plugins from configured marketplaces
197
+ - Track installed plugins in manifest file
198
+ - Automatic conversion of Claude Code plugins to Cursor Rules format
199
+ - Plugin metadata preservation and frontmatter injection
200
+
201
+ [Unreleased]: https://github.com/pcomans/caruso/compare/v0.5.3...HEAD
202
+ [0.5.3]: https://github.com/pcomans/caruso/releases/tag/v0.5.3
203
+ [0.5.2]: https://github.com/pcomans/caruso/releases/tag/v0.5.2
204
+ [0.5.1]: https://github.com/pcomans/caruso/releases/tag/v0.5.1
205
+ [0.5.0]: https://github.com/pcomans/caruso/releases/tag/v0.5.0
206
+ [0.4.0]: https://github.com/pcomans/caruso/releases/tag/v0.4.0
207
+ [0.3.0]: https://github.com/pcomans/caruso/releases/tag/v0.3.0
208
+ [0.2.0]: https://github.com/pcomans/caruso/releases/tag/v0.2.0
209
+ [0.1.4]: https://github.com/pcomans/caruso/releases/tag/v0.1.4
210
+ [0.1.3]: https://github.com/pcomans/caruso/releases/tag/v0.1.3
211
+ [0.1.2]: https://github.com/pcomans/caruso/releases/tag/v0.1.2
212
+ [0.1.1]: https://github.com/pcomans/caruso/releases/tag/v0.1.1
213
+ [0.1.0]: https://github.com/pcomans/caruso/releases/tag/v0.1.0
data/CLAUDE.md ADDED
@@ -0,0 +1,276 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Mission
6
+
7
+ Caruso is a Ruby gem CLI that bridges the gap between AI coding assistants. It fetches "steering documentation" (commands, agents, skills) from Claude Code Marketplaces and converts them to formats compatible with other IDEs, currently Cursor.
8
+
9
+ ## Source of Truth: Claude Code Documentation
10
+
11
+ **IMPORTANT:** The official Claude Code marketplace and plugin specifications are located in `/Users/philipp/code/caruso/reference/`:
12
+
13
+ - `marketplace.md` - Marketplace structure and specification
14
+ - `plugins.md` - Plugin format and configuration
15
+ - `plugins_reference.md` - Component configuration fields and metadata
16
+
17
+ **These reference documents are the authoritative source for:**
18
+ - Marketplace.json schema and plugin metadata format
19
+ - Component configuration fields (`commands`, `agents`, `skills`, `hooks`, `mcpServers`)
20
+ - Expected directory structures and file patterns
21
+ - Metadata requirements and validation rules
22
+
23
+ When implementing features or fixing bugs related to marketplace compatibility, **always consult these reference files first**. If the implementation conflicts with the reference docs, the reference docs are correct and the code should be updated to match.
24
+
25
+ ## Development Commands
26
+
27
+ ### Build and Install
28
+ ```bash
29
+ # Build the gem
30
+ gem build caruso.gemspec
31
+
32
+ # Install locally
33
+ gem install caruso-*.gem
34
+
35
+ # Verify installation
36
+ caruso version
37
+ ```
38
+
39
+ ### Testing
40
+ ```bash
41
+ # Run offline tests only (default)
42
+ bundle exec rake spec
43
+ # or
44
+ bundle exec rspec
45
+
46
+ # Run all tests including live marketplace integration
47
+ bundle exec rake spec:all
48
+ # or
49
+ RUN_LIVE_TESTS=1 bundle exec rspec
50
+
51
+ # Run only live tests
52
+ bundle exec rake spec:live
53
+
54
+ # Run specific test file
55
+ bundle exec rspec spec/integration/plugin_spec.rb
56
+
57
+ # Run specific test
58
+ bundle exec rspec spec/integration/plugin_spec.rb:42
59
+ ```
60
+
61
+ **Important:** Live tests (tagged with `:live`) interact with real marketplaces (anthropics/skills) and require network access. They can be slow (~7 minutes). Marketplace cache is stored in `~/.caruso/marketplaces/`. Integration tests set `CARUSO_TESTING_SKIP_CLONE=true` to skip Git cloning for fast offline testing.
62
+
63
+ ### Linting
64
+ ```bash
65
+ bundle exec rubocop
66
+ ```
67
+
68
+ ### Version Management
69
+ ```bash
70
+ # Bump patch version (0.1.3 → 0.1.4)
71
+ bundle exec rake bump:patch
72
+
73
+ # Bump minor version (0.1.4 → 0.2.0)
74
+ bundle exec rake bump:minor
75
+
76
+ # Bump major version (0.1.4 → 1.0.0)
77
+ bundle exec rake bump:major
78
+ ```
79
+
80
+ ## Architecture
81
+
82
+ ### Core Pipeline: Fetch → Adapt → Track
83
+
84
+ Caruso follows a three-stage pipeline for plugin management:
85
+
86
+ 1. **Fetch** (`Fetcher`) - Clones Git repositories, resolves marketplace.json, finds plugin markdown files
87
+ 2. **Adapt** (`Adapter`) - Converts Claude Code markdown to target IDE format with metadata injection
88
+ 3. **Track** (`ConfigManager`) - Records installations in `caruso.json` and `.caruso.local.json`
89
+
90
+ ### Key Components
91
+
92
+ #### ConfigManager (`lib/caruso/config_manager.rb`)
93
+ Manages configuration and state. Splits data between:
94
+
95
+ **1. Project Config (`caruso.json`)**
96
+ - `ide`: Target IDE (currently only "cursor" supported)
97
+ - `target_dir`: Where to write converted files (`.cursor/rules` for Cursor)
98
+ - `marketplaces`: Name → URL mapping
99
+ - `plugins`: Name → metadata (marketplace source)
100
+ - `version`: Config schema version
101
+
102
+ **2. Local Config (`.caruso.local.json`)**
103
+ - `installed_files`: Plugin Name → Array of file paths
104
+ - `initialized_at`: Timestamp
105
+
106
+ Must run `caruso init --ide=cursor` before other commands. ConfigManager handles loading/saving both files and ensures `.caruso.local.json` is gitignored.
107
+
108
+ #### MarketplaceRegistry (`lib/caruso/marketplace_registry.rb`)
109
+ Manages persistent marketplace metadata registry at `~/.caruso/known_marketplaces.json`. Contains:
110
+ - `source`: Marketplace type (git, github, url, local, directory)
111
+ - `url`: Original marketplace URL
112
+ - `install_location`: Local cache path (e.g., `~/.caruso/marketplaces/skills/`)
113
+ - `last_updated`: ISO8601 timestamp of last update
114
+ - `ref`: Optional Git ref/branch/tag for pinning
115
+
116
+ **Key features:**
117
+ - **Schema validation**: Validates required fields and timestamp format on load
118
+ - **Corruption handling**: Backs up corrupted registry to `.corrupted.<timestamp>` and continues with empty registry
119
+ - **Timestamp tracking**: Updates `last_updated` when marketplace cache is refreshed
120
+ - **Source type tracking**: Enables future support for multiple marketplace sources
121
+
122
+ This registry enables persistent tracking of marketplace state across reboots, unlike the previous `/tmp` approach.
123
+
124
+ #### Fetcher (`lib/caruso/fetcher.rb`)
125
+ Resolves and fetches plugins from marketplaces. Supports:
126
+ - GitHub repos: `https://github.com/owner/repo`
127
+ - Git URLs: Any Git-cloneable URL
128
+ - Local paths: `./path/to/marketplace` or `./path/to/marketplace.json`
129
+
130
+ **Key behavior:**
131
+ - Clones Git repos to `~/.caruso/marketplaces/<marketplace-name>/` (persistent across reboots)
132
+ - Registers marketplace metadata in `~/.caruso/known_marketplaces.json` (via MarketplaceRegistry)
133
+ - Supports Git ref/branch pinning for version control
134
+ - Reads `marketplace.json` to find available plugins
135
+ - Supports custom component paths: plugins can specify `commands`, `agents`, `skills` arrays pointing to non-standard locations
136
+ - Scans standard directories: `{commands,agents,skills}/**/*.md`
137
+ - Excludes README.md and LICENSE.md files
138
+ - **Custom paths supplement (not replace) default directories** - this is critical
139
+ - Detects SSH authentication errors and provides helpful error messages
140
+
141
+ **marketplace.json structure:**
142
+ ```json
143
+ {
144
+ "plugins": [
145
+ {
146
+ "name": "document-skills",
147
+ "description": "Work with documents",
148
+ "source": "./document-skills",
149
+ "skills": ["./document-skills/xlsx", "./document-skills/pdf"]
150
+ }
151
+ ]
152
+ }
153
+ ```
154
+
155
+ The `commands`, `agents`, and `skills` fields accept:
156
+ - String: `"./custom/path"`
157
+ - Array: `["./path1", "./path2"]`
158
+
159
+ Both files and directories are supported. Fetcher recursively finds all `.md` files.
160
+
161
+ #### Adapter (`lib/caruso/adapter.rb`)
162
+ Converts Claude Code markdown files to target IDE format. For Cursor:
163
+ - Renames `.md` → `.mdc`
164
+ - Injects YAML frontmatter with required Cursor metadata:
165
+ - `globs: []` - Enables semantic search (Apply Intelligently)
166
+ - `alwaysApply: false` - Prevents auto-application to every chat
167
+ - `description` - Preserved from original or generated
168
+ - Preserves existing frontmatter if present, adds missing fields
169
+ - Handles special case: `SKILL.md` → named after parent directory to avoid collisions
170
+
171
+ Returns array of created filenames (not full paths) for manifest tracking.
172
+
173
+ #### CLI (`lib/caruso/cli.rb`)
174
+ Thor-based CLI with nested commands:
175
+ - `caruso init [PATH] --ide=cursor`
176
+ - `caruso marketplace add URL [--ref=BRANCH]` - Add marketplace with optional Git ref pinning (name comes from marketplace.json)
177
+ - `caruso marketplace list` - List configured marketplaces
178
+ - `caruso marketplace remove NAME` - Remove marketplace from manifest and registry
179
+ - `caruso marketplace update [NAME]` - Update marketplace cache (all if no name given)
180
+ - `caruso marketplace info NAME` - Show detailed marketplace information from registry
181
+ - `caruso plugin install|uninstall|list|update|outdated`
182
+
183
+ **Important patterns:**
184
+ - All commands except `init` require existing `caruso.json` (enforced by `load_config` helper)
185
+ - Plugin install format: `plugin@marketplace` or just `plugin` (if only one marketplace configured)
186
+ - Update commands refresh marketplace cache (git pull) before fetching latest plugin files
187
+ - Marketplace add eagerly clones repos unless `CARUSO_TESTING_SKIP_CLONE` env var is set (used in tests)
188
+ - **Marketplace names always come from marketplace.json `name` field (required)** - no custom names allowed
189
+ - Errors use descriptive messages with suggestions (e.g., "use 'caruso marketplace add <url>'")
190
+
191
+ ### Data Flow Example
192
+
193
+ User runs: `caruso plugin install document-skills@skills`
194
+
195
+ 1. **CLI** parses command, loads config from `caruso.json`
196
+ 2. **ConfigManager** looks up marketplace "skills" URL
197
+ 3. **Fetcher** clones/updates marketplace repo to `~/.caruso/marketplaces/skills/`
198
+ 4. **Fetcher** registers/updates marketplace metadata in MarketplaceRegistry
199
+ 5. **Fetcher** reads `marketplace.json`, finds document-skills plugin
200
+ 6. **Fetcher** scans standard directories + custom paths from `skills: [...]` array
201
+ 7. **Fetcher** returns list of `.md` file paths
202
+ 8. **Adapter** converts each file: adds frontmatter, renames to `.mdc`, writes to `.cursor/rules/caruso/`
203
+ 9. **Adapter** returns created filenames
204
+ 10. **ConfigManager** records plugin in `caruso.json` and files in `.caruso.local.json`
205
+ 11. **CLI** prints success message
206
+
207
+ ### Testing Architecture
208
+
209
+ Uses **Aruba** for CLI integration testing. Test structure:
210
+ - `spec/unit/` - Direct class testing (ConfigManager, Fetcher logic)
211
+ - `spec/integration/` - Full CLI workflow tests via Aruba subprocess execution
212
+
213
+ **Aruba helpers in spec_helper.rb:**
214
+ - `init_caruso(ide: "cursor")` - Runs init command with success assertion
215
+ - `add_marketplace(url, name)` - Adds marketplace with success assertion
216
+ - `config_file`, `manifest_file`, `load_config`, `load_manifest` - File access helpers
217
+ - `mdc_files` - Glob for `.cursor/rules/*.mdc` files
218
+
219
+ **Critical testing pattern:**
220
+ ```ruby
221
+ run_command("caruso plugin install foo@bar")
222
+ expect(last_command_started).to be_successfully_executed # Always verify success first!
223
+ manifest = load_manifest # Then access results
224
+ ```
225
+
226
+ **Why this matters:** If command fails, manifest might not exist (nil). Always assert success before accessing command results to prevent confusing test failures.
227
+
228
+ **Live tests:**
229
+ - Tagged with `:live` metadata
230
+ - Run only when `RUN_LIVE_TESTS=1` environment variable set
231
+ - Interact with real anthropics/skills marketplace
232
+ - Cache cleared once at test suite start for performance
233
+ - Use `sleep` for timestamp resolution (not `Timecop`) because Caruso runs as subprocess
234
+
235
+ **Timecop limitation:** Cannot mock time in subprocesses. When testing timestamp updates in plugin reinstall scenarios, use `sleep 1.1` (ISO8601 has second precision) instead of `Timecop.travel`.
236
+
237
+ ## Marketplace Compatibility
238
+
239
+ Caruso supports the Claude Code marketplace specification with custom component paths:
240
+
241
+ - Standard structure: `{commands,agents,skills}/**/*.md`
242
+ - Custom paths: `"commands": ["./custom/path"]` in marketplace.json
243
+ - Both string and array formats supported
244
+ - Custom paths **supplement** defaults (they don't replace)
245
+
246
+ Example: anthropics/skills marketplace uses custom paths:
247
+ ```json
248
+ {
249
+ "name": "document-skills",
250
+ "skills": ["./document-skills/xlsx", "./document-skills/pdf"]
251
+ }
252
+ ```
253
+
254
+ Fetcher will scan both:
255
+ 1. `./document-skills/skills/**/*.md` (default)
256
+ 2. `./document-skills/xlsx/**/*.md` (custom)
257
+ 3. `./document-skills/pdf/**/*.md` (custom)
258
+
259
+ Results are deduplicated with `.uniq`.
260
+
261
+ ## Release Process
262
+
263
+ 1. Run tests: `bundle exec rake spec:all`
264
+ 2. Bump version: `bundle exec rake bump:patch` (or minor/major)
265
+ 3. Update CHANGELOG.md with release notes
266
+ 4. Commit: `git commit -m "chore: Bump version to X.Y.Z"`
267
+ 5. Tag: `git tag -a vX.Y.Z -m "Release version X.Y.Z"`
268
+ 6. Build: `gem build caruso.gemspec`
269
+ 7. Install and test: `gem install caruso-X.Y.Z.gem && caruso version`
270
+ 8. Push: `git push origin main --tags`
271
+
272
+ Version is managed in `lib/caruso/version.rb`.
273
+
274
+ # Memory
275
+ - The goal is a clean, correct, consistent implementation. Never implement fallbacks that hide errors or engage in defensive programming.
276
+ - Treat the vendor directory .cursor/rules/caruso/ as a build artifact