simplecov-mcp 0.3.0 → 1.0.0
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/LICENSE +21 -0
- data/README.md +173 -356
- data/docs/ADVANCED_USAGE.md +967 -0
- data/docs/ARCHITECTURE.md +79 -0
- data/docs/BRANCH_ONLY_COVERAGE.md +81 -0
- data/docs/CLI_USAGE.md +637 -0
- data/docs/DEVELOPMENT.md +82 -0
- data/docs/ERROR_HANDLING.md +93 -0
- data/docs/EXAMPLES.md +430 -0
- data/docs/INSTALLATION.md +352 -0
- data/docs/LIBRARY_API.md +635 -0
- data/docs/MCP_INTEGRATION.md +488 -0
- data/docs/TROUBLESHOOTING.md +276 -0
- data/docs/arch-decisions/001-x-arch-decision.md +93 -0
- data/docs/arch-decisions/002-x-arch-decision.md +157 -0
- data/docs/arch-decisions/003-x-arch-decision.md +163 -0
- data/docs/arch-decisions/004-x-arch-decision.md +199 -0
- data/docs/arch-decisions/005-x-arch-decision.md +187 -0
- data/docs/arch-decisions/README.md +60 -0
- data/docs/presentations/simplecov-mcp-presentation.md +249 -0
- data/exe/simplecov-mcp +4 -4
- data/lib/simplecov_mcp/app_context.rb +26 -0
- data/lib/simplecov_mcp/base_tool.rb +74 -0
- data/lib/simplecov_mcp/cli.rb +234 -0
- data/lib/simplecov_mcp/cli_config.rb +56 -0
- data/lib/simplecov_mcp/commands/base_command.rb +78 -0
- data/lib/simplecov_mcp/commands/command_factory.rb +39 -0
- data/lib/simplecov_mcp/commands/detailed_command.rb +24 -0
- data/lib/simplecov_mcp/commands/list_command.rb +13 -0
- data/lib/simplecov_mcp/commands/raw_command.rb +22 -0
- data/lib/simplecov_mcp/commands/summary_command.rb +24 -0
- data/lib/simplecov_mcp/commands/uncovered_command.rb +26 -0
- data/lib/simplecov_mcp/commands/version_command.rb +18 -0
- data/lib/simplecov_mcp/constants.rb +22 -0
- data/lib/simplecov_mcp/error_handler.rb +124 -0
- data/lib/simplecov_mcp/error_handler_factory.rb +31 -0
- data/lib/simplecov_mcp/errors.rb +179 -0
- data/lib/simplecov_mcp/formatters/source_formatter.rb +148 -0
- data/lib/simplecov_mcp/mcp_server.rb +40 -0
- data/lib/simplecov_mcp/mode_detector.rb +55 -0
- data/lib/simplecov_mcp/model.rb +300 -0
- data/lib/simplecov_mcp/option_normalizers.rb +92 -0
- data/lib/simplecov_mcp/option_parser_builder.rb +134 -0
- data/lib/simplecov_mcp/option_parsers/env_options_parser.rb +50 -0
- data/lib/simplecov_mcp/option_parsers/error_helper.rb +109 -0
- data/lib/simplecov_mcp/path_relativizer.rb +61 -0
- data/lib/simplecov_mcp/presenters/base_coverage_presenter.rb +44 -0
- data/lib/simplecov_mcp/presenters/coverage_detailed_presenter.rb +16 -0
- data/lib/simplecov_mcp/presenters/coverage_raw_presenter.rb +16 -0
- data/lib/simplecov_mcp/presenters/coverage_summary_presenter.rb +16 -0
- data/lib/simplecov_mcp/presenters/coverage_uncovered_presenter.rb +16 -0
- data/lib/simplecov_mcp/presenters/project_coverage_presenter.rb +52 -0
- data/lib/simplecov_mcp/resolvers/coverage_line_resolver.rb +126 -0
- data/lib/simplecov_mcp/resolvers/resolver_factory.rb +28 -0
- data/lib/simplecov_mcp/resolvers/resultset_path_resolver.rb +78 -0
- data/lib/simplecov_mcp/resultset_loader.rb +136 -0
- data/lib/simplecov_mcp/staleness_checker.rb +243 -0
- data/lib/{simple_cov_mcp → simplecov_mcp}/tools/all_files_coverage_tool.rb +31 -13
- data/lib/{simple_cov_mcp → simplecov_mcp}/tools/coverage_detailed_tool.rb +7 -7
- data/lib/{simple_cov_mcp → simplecov_mcp}/tools/coverage_raw_tool.rb +7 -7
- data/lib/{simple_cov_mcp → simplecov_mcp}/tools/coverage_summary_tool.rb +7 -7
- data/lib/simplecov_mcp/tools/coverage_table_tool.rb +90 -0
- data/lib/{simple_cov_mcp → simplecov_mcp}/tools/help_tool.rb +13 -4
- data/lib/{simple_cov_mcp → simplecov_mcp}/tools/uncovered_lines_tool.rb +7 -7
- data/lib/{simple_cov_mcp → simplecov_mcp}/tools/version_tool.rb +11 -3
- data/lib/simplecov_mcp/util.rb +82 -0
- data/lib/{simple_cov_mcp → simplecov_mcp}/version.rb +1 -1
- data/lib/simplecov_mcp.rb +144 -2
- data/spec/MCP_INTEGRATION_TESTS_README.md +111 -0
- data/spec/TIMESTAMPS.md +48 -0
- data/spec/all_files_coverage_tool_spec.rb +29 -25
- data/spec/base_tool_spec.rb +11 -10
- data/spec/cli/show_default_report_spec.rb +33 -0
- data/spec/cli_config_spec.rb +137 -0
- data/spec/cli_enumerated_options_spec.rb +68 -0
- data/spec/cli_error_spec.rb +105 -47
- data/spec/cli_source_spec.rb +82 -23
- data/spec/cli_spec.rb +140 -5
- data/spec/cli_success_predicate_spec.rb +141 -0
- data/spec/cli_table_spec.rb +1 -1
- data/spec/cli_usage_spec.rb +10 -26
- data/spec/commands/base_command_spec.rb +187 -0
- data/spec/commands/command_factory_spec.rb +72 -0
- data/spec/commands/detailed_command_spec.rb +48 -0
- data/spec/commands/raw_command_spec.rb +46 -0
- data/spec/commands/summary_command_spec.rb +47 -0
- data/spec/commands/uncovered_command_spec.rb +49 -0
- data/spec/constants_spec.rb +61 -0
- data/spec/coverage_table_tool_spec.rb +17 -33
- data/spec/error_handler_spec.rb +22 -13
- data/spec/error_mode_spec.rb +143 -0
- data/spec/errors_edge_cases_spec.rb +239 -0
- data/spec/errors_stale_spec.rb +2 -2
- data/spec/file_based_mcp_tools_spec.rb +99 -0
- data/spec/fixtures/project1/lib/bar.rb +0 -1
- data/spec/fixtures/project1/lib/foo.rb +0 -1
- data/spec/help_tool_spec.rb +11 -17
- data/spec/integration_spec.rb +845 -0
- data/spec/logging_fallback_spec.rb +128 -0
- data/spec/mcp_logging_spec.rb +44 -0
- data/spec/mcp_server_integration_spec.rb +23 -0
- data/spec/mcp_server_spec.rb +15 -4
- data/spec/mode_detector_spec.rb +148 -0
- data/spec/model_error_handling_spec.rb +210 -0
- data/spec/model_staleness_spec.rb +40 -10
- data/spec/option_normalizers_spec.rb +204 -0
- data/spec/option_parsers/env_options_parser_spec.rb +233 -0
- data/spec/option_parsers/error_helper_spec.rb +222 -0
- data/spec/path_relativizer_spec.rb +83 -0
- data/spec/presenters/coverage_detailed_presenter_spec.rb +19 -0
- data/spec/presenters/coverage_raw_presenter_spec.rb +15 -0
- data/spec/presenters/coverage_summary_presenter_spec.rb +15 -0
- data/spec/presenters/coverage_uncovered_presenter_spec.rb +16 -0
- data/spec/presenters/project_coverage_presenter_spec.rb +86 -0
- data/spec/resolvers/coverage_line_resolver_spec.rb +57 -0
- data/spec/resolvers/resolver_factory_spec.rb +61 -0
- data/spec/resolvers/resultset_path_resolver_spec.rb +55 -0
- data/spec/resultset_loader_spec.rb +167 -0
- data/spec/shared_examples/README.md +115 -0
- data/spec/shared_examples/coverage_presenter_examples.rb +66 -0
- data/spec/shared_examples/file_based_mcp_tools.rb +174 -0
- data/spec/shared_examples/mcp_tool_text_json_response.rb +16 -0
- data/spec/simple_cov_mcp_module_spec.rb +16 -0
- data/spec/simplecov_mcp_model_spec.rb +340 -9
- data/spec/simplecov_mcp_opts_spec.rb +182 -0
- data/spec/spec_helper.rb +147 -4
- data/spec/staleness_checker_spec.rb +373 -0
- data/spec/staleness_more_spec.rb +16 -13
- data/spec/support/mcp_runner.rb +64 -0
- data/spec/tools_error_handling_spec.rb +144 -0
- data/spec/util_spec.rb +109 -34
- data/spec/version_spec.rb +117 -9
- data/spec/version_tool_spec.rb +131 -10
- metadata +120 -63
- data/lib/simple_cov/mcp.rb +0 -9
- data/lib/simple_cov_mcp/base_tool.rb +0 -70
- data/lib/simple_cov_mcp/cli.rb +0 -390
- data/lib/simple_cov_mcp/error_handler.rb +0 -131
- data/lib/simple_cov_mcp/error_handler_factory.rb +0 -38
- data/lib/simple_cov_mcp/errors.rb +0 -176
- data/lib/simple_cov_mcp/mcp_server.rb +0 -30
- data/lib/simple_cov_mcp/model.rb +0 -104
- data/lib/simple_cov_mcp/staleness_checker.rb +0 -125
- data/lib/simple_cov_mcp/tools/coverage_table_tool.rb +0 -61
- data/lib/simple_cov_mcp/util.rb +0 -122
- data/lib/simple_cov_mcp.rb +0 -102
- data/spec/coverage_detailed_tool_spec.rb +0 -36
- data/spec/coverage_raw_tool_spec.rb +0 -32
- data/spec/coverage_summary_tool_spec.rb +0 -39
- data/spec/legacy_shim_spec.rb +0 -13
- data/spec/uncovered_lines_tool_spec.rb +0 -33
@@ -0,0 +1,352 @@
|
|
1
|
+
# Installation Guide
|
2
|
+
|
3
|
+
This guide covers installing simplecov-mcp in various environments and configurations.
|
4
|
+
|
5
|
+
## Prerequisites
|
6
|
+
|
7
|
+
- **Ruby >= 3.2** (required by the `mcp` dependency)
|
8
|
+
- SimpleCov-generated `.resultset.json` file in your project
|
9
|
+
|
10
|
+
## Quick Install
|
11
|
+
|
12
|
+
### Via RubyGems
|
13
|
+
|
14
|
+
```sh
|
15
|
+
gem install simplecov-mcp
|
16
|
+
```
|
17
|
+
|
18
|
+
### Via Bundler
|
19
|
+
|
20
|
+
Add to your `Gemfile`:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
gem 'simplecov-mcp'
|
24
|
+
```
|
25
|
+
|
26
|
+
Then run:
|
27
|
+
|
28
|
+
```sh
|
29
|
+
bundle install
|
30
|
+
```
|
31
|
+
|
32
|
+
### From Source
|
33
|
+
|
34
|
+
```sh
|
35
|
+
git clone https://github.com/keithrbennett/simplecov-mcp.git
|
36
|
+
cd simplecov-mcp
|
37
|
+
bundle install
|
38
|
+
gem build simplecov-mcp.gemspec
|
39
|
+
gem install simplecov-mcp-*.gem
|
40
|
+
```
|
41
|
+
|
42
|
+
## Require Paths
|
43
|
+
|
44
|
+
The gem supports multiple require paths for compatibility:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
require "simplecov_mcp" # Primary path (recommended)
|
48
|
+
require "simple_cov/mcp" # Legacy shim (supported)
|
49
|
+
```
|
50
|
+
|
51
|
+
The executable is always `simplecov-mcp` (with hyphen).
|
52
|
+
|
53
|
+
## Version Manager Setup
|
54
|
+
|
55
|
+
### rbenv
|
56
|
+
|
57
|
+
After installation:
|
58
|
+
|
59
|
+
```sh
|
60
|
+
rbenv rehash
|
61
|
+
which simplecov-mcp # Should point to rbenv shim
|
62
|
+
```
|
63
|
+
|
64
|
+
For MCP server configuration, use the shim path:
|
65
|
+
|
66
|
+
```sh
|
67
|
+
which simplecov-mcp
|
68
|
+
# Example: /Users/yourname/.rbenv/shims/simplecov-mcp
|
69
|
+
```
|
70
|
+
|
71
|
+
### RVM
|
72
|
+
|
73
|
+
After installation:
|
74
|
+
|
75
|
+
```sh
|
76
|
+
rvm use 3.3.8 # or your preferred Ruby 3.2+ version
|
77
|
+
gem install simplecov-mcp
|
78
|
+
```
|
79
|
+
|
80
|
+
For MCP server configuration with RVM:
|
81
|
+
|
82
|
+
```sh
|
83
|
+
# Get the full gem path for your Ruby version
|
84
|
+
rvm use 3.3.8
|
85
|
+
which simplecov-mcp
|
86
|
+
# Example: /Users/yourname/.rvm/gems/ruby-3.3.8/bin/simplecov-mcp
|
87
|
+
|
88
|
+
# Or use RVM wrappers for stability across shell sessions:
|
89
|
+
rvm wrapper ruby-3.3.8 simplecov-mcp simplecov-mcp
|
90
|
+
# Creates: /Users/yourname/.rvm/wrappers/ruby-3.3.8/simplecov-mcp
|
91
|
+
```
|
92
|
+
|
93
|
+
**Important:** If you change Ruby versions, you'll need to reinstall the gem or update your MCP configuration.
|
94
|
+
|
95
|
+
### asdf
|
96
|
+
|
97
|
+
After installation:
|
98
|
+
|
99
|
+
```sh
|
100
|
+
asdf reshim ruby
|
101
|
+
which simplecov-mcp # Should point to asdf shim
|
102
|
+
```
|
103
|
+
|
104
|
+
### chruby
|
105
|
+
|
106
|
+
chruby automatically adds gem bins to PATH. After installation:
|
107
|
+
|
108
|
+
```sh
|
109
|
+
which simplecov-mcp # Should be in current Ruby's gem bin
|
110
|
+
```
|
111
|
+
|
112
|
+
## PATH Configuration
|
113
|
+
|
114
|
+
### Automatic (with Version Managers)
|
115
|
+
|
116
|
+
Most version managers (rbenv, asdf, RVM, chruby) automatically configure PATH. Verify:
|
117
|
+
|
118
|
+
```sh
|
119
|
+
which simplecov-mcp
|
120
|
+
```
|
121
|
+
|
122
|
+
If this returns a path, you're all set.
|
123
|
+
|
124
|
+
### Manual PATH Setup
|
125
|
+
|
126
|
+
If you're not using a version manager, add the gem bin directory to your PATH:
|
127
|
+
|
128
|
+
1. Find your gem bin directory:
|
129
|
+
```sh
|
130
|
+
gem env | grep "EXECUTABLE DIRECTORY"
|
131
|
+
# or
|
132
|
+
ruby -e 'puts Gem.bindir'
|
133
|
+
```
|
134
|
+
|
135
|
+
2. Add to your shell profile (`.bashrc`, `.zshrc`, etc.):
|
136
|
+
```sh
|
137
|
+
export PATH="$(ruby -e 'puts Gem.bindir'):$PATH"
|
138
|
+
```
|
139
|
+
|
140
|
+
3. Reload your shell:
|
141
|
+
```sh
|
142
|
+
source ~/.zshrc # or ~/.bashrc
|
143
|
+
```
|
144
|
+
|
145
|
+
### Bundler Execution
|
146
|
+
|
147
|
+
If PATH setup is problematic, use bundler:
|
148
|
+
|
149
|
+
```sh
|
150
|
+
bundle exec simplecov-mcp
|
151
|
+
```
|
152
|
+
|
153
|
+
This works from any project directory that has simplecov-mcp in its Gemfile.
|
154
|
+
|
155
|
+
## Verification
|
156
|
+
|
157
|
+
### Test Installation
|
158
|
+
|
159
|
+
```sh
|
160
|
+
# Check version
|
161
|
+
simplecov-mcp version
|
162
|
+
|
163
|
+
# Show help
|
164
|
+
simplecov-mcp --help
|
165
|
+
|
166
|
+
# Run on current project (requires coverage data)
|
167
|
+
simplecov-mcp
|
168
|
+
```
|
169
|
+
|
170
|
+
### Generate Test Coverage
|
171
|
+
|
172
|
+
If you don't have coverage data yet:
|
173
|
+
|
174
|
+
```sh
|
175
|
+
# Run your tests with SimpleCov enabled
|
176
|
+
bundle exec rspec # or your test command
|
177
|
+
|
178
|
+
# Verify coverage file exists
|
179
|
+
ls coverage/.resultset.json
|
180
|
+
|
181
|
+
# Now test simplecov-mcp
|
182
|
+
simplecov-mcp
|
183
|
+
```
|
184
|
+
|
185
|
+
## Platform-Specific Notes
|
186
|
+
|
187
|
+
### macOS
|
188
|
+
|
189
|
+
Works with system Ruby or any version manager. Recommended: use rbenv or asdf.
|
190
|
+
|
191
|
+
### Linux
|
192
|
+
|
193
|
+
Works with system Ruby or any version manager. May need to install Ruby development headers:
|
194
|
+
|
195
|
+
```sh
|
196
|
+
# Debian/Ubuntu
|
197
|
+
sudo apt-get install ruby-dev
|
198
|
+
|
199
|
+
# RHEL/CentOS
|
200
|
+
sudo yum install ruby-devel
|
201
|
+
```
|
202
|
+
|
203
|
+
### Windows
|
204
|
+
|
205
|
+
Should work with Ruby installed via RubyInstaller. PATH configuration may differ.
|
206
|
+
|
207
|
+
## Docker/Container Environments
|
208
|
+
|
209
|
+
When using in containers:
|
210
|
+
|
211
|
+
```dockerfile
|
212
|
+
FROM ruby:3.3
|
213
|
+
|
214
|
+
# Install gem
|
215
|
+
RUN gem install simplecov-mcp
|
216
|
+
|
217
|
+
# Or with Bundler
|
218
|
+
COPY Gemfile Gemfile.lock ./
|
219
|
+
RUN bundle install
|
220
|
+
|
221
|
+
# Usage
|
222
|
+
CMD ["simplecov-mcp"]
|
223
|
+
```
|
224
|
+
|
225
|
+
Mount your project directory to access coverage data:
|
226
|
+
|
227
|
+
```sh
|
228
|
+
docker run -v $(pwd):/app -w /app ruby:3.3 simplecov-mcp
|
229
|
+
```
|
230
|
+
|
231
|
+
## CI/CD Environments
|
232
|
+
|
233
|
+
### GitHub Actions
|
234
|
+
|
235
|
+
```yaml
|
236
|
+
- name: Setup Ruby
|
237
|
+
uses: ruby/setup-ruby@v1
|
238
|
+
with:
|
239
|
+
ruby-version: 3.3
|
240
|
+
bundler-cache: true
|
241
|
+
|
242
|
+
- name: Install simplecov-mcp
|
243
|
+
run: gem install simplecov-mcp
|
244
|
+
|
245
|
+
- name: Check coverage
|
246
|
+
run: simplecov-mcp --stale error
|
247
|
+
```
|
248
|
+
|
249
|
+
### GitLab CI
|
250
|
+
|
251
|
+
```yaml
|
252
|
+
test:
|
253
|
+
image: ruby:3.3
|
254
|
+
before_script:
|
255
|
+
- gem install simplecov-mcp
|
256
|
+
script:
|
257
|
+
- bundle exec rspec
|
258
|
+
- simplecov-mcp --stale error
|
259
|
+
```
|
260
|
+
|
261
|
+
## Upgrading
|
262
|
+
|
263
|
+
### From Previous Versions
|
264
|
+
|
265
|
+
```sh
|
266
|
+
gem update simplecov-mcp
|
267
|
+
```
|
268
|
+
|
269
|
+
With Bundler:
|
270
|
+
|
271
|
+
```sh
|
272
|
+
bundle update simplecov-mcp
|
273
|
+
```
|
274
|
+
|
275
|
+
### Version Manager Considerations
|
276
|
+
|
277
|
+
After upgrading Ruby versions, reinstall:
|
278
|
+
|
279
|
+
```sh
|
280
|
+
# rbenv/asdf
|
281
|
+
gem install simplecov-mcp
|
282
|
+
rbenv rehash # or: asdf reshim ruby
|
283
|
+
|
284
|
+
# RVM
|
285
|
+
rvm use 3.3.8
|
286
|
+
gem install simplecov-mcp
|
287
|
+
```
|
288
|
+
|
289
|
+
## Troubleshooting
|
290
|
+
|
291
|
+
### "command not found: simplecov-mcp"
|
292
|
+
|
293
|
+
1. Verify gem is installed:
|
294
|
+
```sh
|
295
|
+
gem list simplecov-mcp
|
296
|
+
```
|
297
|
+
|
298
|
+
2. Check gem bin is in PATH:
|
299
|
+
```sh
|
300
|
+
echo $PATH | grep -o "$(gem env gemdir)/bin"
|
301
|
+
```
|
302
|
+
|
303
|
+
3. Use full path temporarily:
|
304
|
+
```sh
|
305
|
+
$(gem env gemdir)/bin/simplecov-mcp
|
306
|
+
```
|
307
|
+
|
308
|
+
4. Or use bundler:
|
309
|
+
```sh
|
310
|
+
bundle exec simplecov-mcp
|
311
|
+
```
|
312
|
+
|
313
|
+
### "cannot load such file -- mcp"
|
314
|
+
|
315
|
+
Your Ruby version is too old. Verify:
|
316
|
+
|
317
|
+
```sh
|
318
|
+
ruby -v # Should be 3.2.0 or higher
|
319
|
+
```
|
320
|
+
|
321
|
+
Upgrade Ruby and reinstall.
|
322
|
+
|
323
|
+
### "wrong number of arguments"
|
324
|
+
|
325
|
+
You may have multiple versions installed. Clean up:
|
326
|
+
|
327
|
+
```sh
|
328
|
+
gem uninstall simplecov-mcp
|
329
|
+
# Select "All versions" if prompted
|
330
|
+
gem install simplecov-mcp
|
331
|
+
```
|
332
|
+
|
333
|
+
### Version Manager Shims Not Updating
|
334
|
+
|
335
|
+
```sh
|
336
|
+
# rbenv
|
337
|
+
rbenv rehash
|
338
|
+
|
339
|
+
# asdf
|
340
|
+
asdf reshim ruby
|
341
|
+
|
342
|
+
# RVM
|
343
|
+
# Usually automatic, but try:
|
344
|
+
rvm reload
|
345
|
+
```
|
346
|
+
|
347
|
+
## Next Steps
|
348
|
+
|
349
|
+
- **[CLI Usage](CLI_USAGE.md)** - Learn command-line options
|
350
|
+
- **[Library API](LIBRARY_API.md)** - Use in Ruby code
|
351
|
+
- **[MCP Integration](MCP_INTEGRATION.md)** - Connect to AI assistants
|
352
|
+
- **[Troubleshooting](TROUBLESHOOTING.md)** - More detailed troubleshooting
|