simplecov-mcp 1.0.1 → 2.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.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +98 -50
  3. data/docs/{ARCHITECTURE.md → dev/ARCHITECTURE.md} +11 -10
  4. data/docs/dev/BRANCH_ONLY_COVERAGE.md +158 -0
  5. data/docs/{DEVELOPMENT.md → dev/DEVELOPMENT.md} +2 -1
  6. data/docs/dev/README.md +10 -0
  7. data/docs/dev/RELEASING.md +146 -0
  8. data/docs/{arch-decisions → dev/arch-decisions}/001-x-arch-decision.md +3 -1
  9. data/docs/{arch-decisions → dev/arch-decisions}/002-x-arch-decision.md +7 -5
  10. data/docs/{arch-decisions → dev/arch-decisions}/003-x-arch-decision.md +2 -0
  11. data/docs/{arch-decisions → dev/arch-decisions}/004-x-arch-decision.md +6 -2
  12. data/docs/{arch-decisions → dev/arch-decisions}/005-x-arch-decision.md +4 -2
  13. data/docs/{arch-decisions → dev/arch-decisions}/README.md +3 -3
  14. data/docs/{presentations → dev/presentations}/simplecov-mcp-presentation.md +28 -22
  15. data/docs/fixtures/demo_project/README.md +9 -0
  16. data/docs/{ADVANCED_USAGE.md → user/ADVANCED_USAGE.md} +129 -319
  17. data/docs/user/CLI_FALLBACK_FOR_LLMS.md +34 -0
  18. data/docs/user/CLI_USAGE.md +750 -0
  19. data/docs/{ERROR_HANDLING.md → user/ERROR_HANDLING.md} +12 -12
  20. data/docs/user/EXAMPLES.md +588 -0
  21. data/docs/user/INSTALLATION.md +130 -0
  22. data/docs/{LIBRARY_API.md → user/LIBRARY_API.md} +90 -32
  23. data/docs/{MCP_INTEGRATION.md → user/MCP_INTEGRATION.md} +36 -34
  24. data/docs/user/README.md +14 -0
  25. data/docs/{TROUBLESHOOTING.md → user/TROUBLESHOOTING.md} +21 -100
  26. data/docs/user/V2-BREAKING-CHANGES.md +472 -0
  27. data/exe/simplecov-mcp +1 -1
  28. data/lib/simplecov_mcp/{cli_config.rb → app_config.rb} +12 -12
  29. data/lib/simplecov_mcp/app_context.rb +1 -1
  30. data/lib/simplecov_mcp/base_tool.rb +66 -38
  31. data/lib/simplecov_mcp/cli.rb +67 -123
  32. data/lib/simplecov_mcp/commands/base_command.rb +16 -27
  33. data/lib/simplecov_mcp/commands/command_factory.rb +8 -2
  34. data/lib/simplecov_mcp/commands/detailed_command.rb +16 -2
  35. data/lib/simplecov_mcp/commands/list_command.rb +1 -1
  36. data/lib/simplecov_mcp/commands/raw_command.rb +18 -2
  37. data/lib/simplecov_mcp/commands/summary_command.rb +20 -3
  38. data/lib/simplecov_mcp/commands/totals_command.rb +53 -0
  39. data/lib/simplecov_mcp/commands/uncovered_command.rb +24 -5
  40. data/lib/simplecov_mcp/commands/validate_command.rb +60 -0
  41. data/lib/simplecov_mcp/commands/version_command.rb +19 -4
  42. data/lib/simplecov_mcp/config_parser.rb +32 -0
  43. data/lib/simplecov_mcp/constants.rb +3 -3
  44. data/lib/simplecov_mcp/coverage_reporter.rb +31 -0
  45. data/lib/simplecov_mcp/error_handler.rb +81 -40
  46. data/lib/simplecov_mcp/error_handler_factory.rb +2 -2
  47. data/lib/simplecov_mcp/errors.rb +12 -19
  48. data/lib/simplecov_mcp/formatters/source_formatter.rb +23 -19
  49. data/lib/simplecov_mcp/formatters.rb +51 -0
  50. data/lib/simplecov_mcp/mcp_server.rb +9 -7
  51. data/lib/simplecov_mcp/mode_detector.rb +6 -5
  52. data/lib/simplecov_mcp/model.rb +122 -88
  53. data/lib/simplecov_mcp/option_normalizers.rb +39 -18
  54. data/lib/simplecov_mcp/option_parser_builder.rb +82 -65
  55. data/lib/simplecov_mcp/option_parsers/env_options_parser.rb +3 -5
  56. data/lib/simplecov_mcp/option_parsers/error_helper.rb +18 -17
  57. data/lib/simplecov_mcp/path_relativizer.rb +17 -14
  58. data/lib/simplecov_mcp/predicate_evaluator.rb +72 -0
  59. data/lib/simplecov_mcp/presenters/base_coverage_presenter.rb +1 -3
  60. data/lib/simplecov_mcp/presenters/coverage_detailed_presenter.rb +1 -3
  61. data/lib/simplecov_mcp/presenters/coverage_raw_presenter.rb +1 -3
  62. data/lib/simplecov_mcp/presenters/coverage_summary_presenter.rb +1 -3
  63. data/lib/simplecov_mcp/presenters/coverage_uncovered_presenter.rb +1 -3
  64. data/lib/simplecov_mcp/presenters/project_coverage_presenter.rb +1 -3
  65. data/lib/simplecov_mcp/presenters/project_totals_presenter.rb +27 -0
  66. data/lib/simplecov_mcp/resolvers/coverage_line_resolver.rb +14 -18
  67. data/lib/simplecov_mcp/resolvers/resultset_path_resolver.rb +7 -9
  68. data/lib/simplecov_mcp/resultset_loader.rb +20 -25
  69. data/lib/simplecov_mcp/staleness_checker.rb +50 -46
  70. data/lib/simplecov_mcp/table_formatter.rb +64 -0
  71. data/lib/simplecov_mcp/tools/all_files_coverage_tool.rb +20 -50
  72. data/lib/simplecov_mcp/tools/coverage_detailed_tool.rb +13 -7
  73. data/lib/simplecov_mcp/tools/coverage_raw_tool.rb +12 -7
  74. data/lib/simplecov_mcp/tools/coverage_summary_tool.rb +13 -8
  75. data/lib/simplecov_mcp/tools/coverage_table_tool.rb +20 -60
  76. data/lib/simplecov_mcp/tools/coverage_totals_tool.rb +44 -0
  77. data/lib/simplecov_mcp/tools/help_tool.rb +38 -66
  78. data/lib/simplecov_mcp/tools/uncovered_lines_tool.rb +13 -8
  79. data/lib/simplecov_mcp/tools/validate_tool.rb +72 -0
  80. data/lib/simplecov_mcp/tools/version_tool.rb +7 -14
  81. data/lib/simplecov_mcp/util.rb +18 -12
  82. data/lib/simplecov_mcp/version.rb +1 -1
  83. data/lib/simplecov_mcp.rb +23 -29
  84. data/spec/all_files_coverage_tool_spec.rb +4 -3
  85. data/spec/{cli_config_spec.rb → app_config_spec.rb} +31 -26
  86. data/spec/base_tool_spec.rb +17 -14
  87. data/spec/cli/show_default_report_spec.rb +2 -2
  88. data/spec/cli_enumerated_options_spec.rb +31 -9
  89. data/spec/cli_error_spec.rb +46 -23
  90. data/spec/cli_format_spec.rb +123 -0
  91. data/spec/cli_json_options_spec.rb +50 -0
  92. data/spec/cli_source_spec.rb +11 -63
  93. data/spec/cli_spec.rb +82 -97
  94. data/spec/cli_usage_spec.rb +15 -15
  95. data/spec/commands/base_command_spec.rb +12 -92
  96. data/spec/commands/command_factory_spec.rb +7 -3
  97. data/spec/commands/detailed_command_spec.rb +10 -24
  98. data/spec/commands/list_command_spec.rb +28 -0
  99. data/spec/commands/raw_command_spec.rb +43 -20
  100. data/spec/commands/summary_command_spec.rb +10 -23
  101. data/spec/commands/totals_command_spec.rb +34 -0
  102. data/spec/commands/uncovered_command_spec.rb +29 -23
  103. data/spec/commands/validate_command_spec.rb +213 -0
  104. data/spec/commands/version_command_spec.rb +38 -0
  105. data/spec/constants_spec.rb +3 -3
  106. data/spec/coverage_reporter_spec.rb +102 -0
  107. data/spec/coverage_table_tool_spec.rb +21 -10
  108. data/spec/coverage_totals_tool_spec.rb +37 -0
  109. data/spec/error_handler_spec.rb +120 -4
  110. data/spec/error_mode_spec.rb +18 -22
  111. data/spec/errors_edge_cases_spec.rb +101 -28
  112. data/spec/errors_stale_spec.rb +34 -0
  113. data/spec/file_based_mcp_tools_spec.rb +6 -6
  114. data/spec/fixtures/project1/lib/bar.rb +2 -0
  115. data/spec/fixtures/project1/lib/foo.rb +2 -0
  116. data/spec/help_tool_spec.rb +2 -18
  117. data/spec/integration_spec.rb +103 -161
  118. data/spec/logging_fallback_spec.rb +3 -3
  119. data/spec/mcp_server_integration_spec.rb +1 -1
  120. data/spec/mcp_server_spec.rb +70 -53
  121. data/spec/mode_detector_spec.rb +46 -41
  122. data/spec/model_error_handling_spec.rb +139 -78
  123. data/spec/model_staleness_spec.rb +13 -13
  124. data/spec/option_normalizers_spec.rb +111 -112
  125. data/spec/option_parsers/env_options_parser_spec.rb +25 -37
  126. data/spec/option_parsers/error_helper_spec.rb +56 -56
  127. data/spec/path_relativizer_spec.rb +15 -0
  128. data/spec/presenters/coverage_detailed_presenter_spec.rb +1 -1
  129. data/spec/presenters/coverage_summary_presenter_spec.rb +1 -1
  130. data/spec/presenters/coverage_uncovered_presenter_spec.rb +1 -1
  131. data/spec/presenters/project_coverage_presenter_spec.rb +9 -8
  132. data/spec/presenters/project_totals_presenter_spec.rb +144 -0
  133. data/spec/resolvers/coverage_line_resolver_spec.rb +261 -36
  134. data/spec/resolvers/resultset_path_resolver_spec.rb +13 -8
  135. data/spec/shared_examples/file_based_mcp_tools.rb +23 -18
  136. data/spec/shared_examples/formatted_command_examples.rb +64 -0
  137. data/spec/simple_cov_mcp_module_spec.rb +24 -3
  138. data/spec/simplecov_mcp/formatters/source_formatter_spec.rb +267 -0
  139. data/spec/simplecov_mcp/formatters_spec.rb +76 -0
  140. data/spec/simplecov_mcp/presenters/base_coverage_presenter_spec.rb +79 -0
  141. data/spec/simplecov_mcp_model_spec.rb +97 -47
  142. data/spec/simplecov_mcp_opts_spec.rb +42 -39
  143. data/spec/spec_helper.rb +27 -92
  144. data/spec/staleness_checker_spec.rb +10 -9
  145. data/spec/staleness_more_spec.rb +4 -4
  146. data/spec/support/cli_helpers.rb +22 -0
  147. data/spec/support/control_flow_helpers.rb +20 -0
  148. data/spec/support/fake_mcp.rb +40 -0
  149. data/spec/support/io_helpers.rb +29 -0
  150. data/spec/support/mcp_helpers.rb +35 -0
  151. data/spec/support/mcp_runner.rb +10 -8
  152. data/spec/support/mocking_helpers.rb +30 -0
  153. data/spec/table_format_spec.rb +70 -0
  154. data/spec/tools/validate_tool_spec.rb +132 -0
  155. data/spec/tools_error_handling_spec.rb +34 -48
  156. data/spec/util_spec.rb +5 -4
  157. data/spec/version_spec.rb +7 -7
  158. data/spec/version_tool_spec.rb +20 -22
  159. metadata +90 -23
  160. data/docs/BRANCH_ONLY_COVERAGE.md +0 -81
  161. data/docs/CLI_USAGE.md +0 -637
  162. data/docs/EXAMPLES.md +0 -430
  163. data/docs/INSTALLATION.md +0 -352
  164. data/spec/cli_success_predicate_spec.rb +0 -141
@@ -1,81 +1,15 @@
1
1
  # Troubleshooting Guide
2
2
 
3
- This guide helps you diagnose and fix common issues with simplecov-mcp. Issues are organized by symptom for quick lookup.
3
+ [Back to main README](../README.md)
4
4
 
5
5
  ## Table of Contents
6
6
 
7
- - [Installation Issues](#installation-issues)
8
7
  - [Running Issues](#running-issues)
9
8
  - [Coverage Data Issues](#coverage-data-issues)
10
9
  - [MCP Server Issues](#mcp-server-issues)
11
10
  - [Development Issues](#development-issues)
12
11
  - [Diagnostic Commands](#diagnostic-commands)
13
12
 
14
- ## Installation Issues
15
-
16
- ### "command not found: simplecov-mcp"
17
-
18
- **Symptom:** Shell can't find the simplecov-mcp executable.
19
-
20
- **Solutions:**
21
-
22
- 1. **Verify installation:**
23
- ```bash
24
- gem list simplecov-mcp
25
- ```
26
- If not listed, install it: `gem install simplecov-mcp`
27
-
28
- 2. **Check PATH:**
29
- ```bash
30
- which simplecov-mcp
31
- echo $PATH | grep -o "$(gem env gemdir)/bin"
32
- ```
33
-
34
- 3. **Rehash version manager shims:**
35
- ```bash
36
- # rbenv
37
- rbenv rehash
38
-
39
- # asdf
40
- asdf reshim ruby
41
-
42
- # RVM
43
- rvm reload
44
- ```
45
-
46
- 4. **Use bundler as workaround:**
47
- ```bash
48
- bundle exec simplecov-mcp
49
- ```
50
-
51
- ### "cannot load such file -- mcp"
52
-
53
- **Symptom:** Ruby can't load the mcp gem dependency.
54
-
55
- **Cause:** Ruby version is too old (< 3.2).
56
-
57
- **Solution:**
58
-
59
- ```bash
60
- # Check your Ruby version
61
- ruby -v # Should be 3.2.0 or higher
62
-
63
- # Upgrade Ruby, then reinstall
64
- gem install simplecov-mcp
65
- ```
66
-
67
- ### Multiple versions causing conflicts
68
-
69
- **Symptom:** "wrong number of arguments" or other unexpected errors.
70
-
71
- **Solution:** Clean up and reinstall:
72
-
73
- ```bash
74
- gem uninstall simplecov-mcp
75
- # Select "All versions" if prompted
76
- gem install simplecov-mcp
77
- ```
78
-
79
13
  ## Running Issues
80
14
 
81
15
  ### Running the Test Suite with RVM (Codex macOS)
@@ -114,10 +48,10 @@ Codex's macOS sandbox forbids `/bin/ps`; RVM shells need it. When you run `bundl
114
48
 
115
49
  ### Stale Coverage Errors
116
50
 
117
- `--stale error` (or `staleness: 'error'`) compares file mtimes and line counts to the coverage snapshot. When it fails:
51
+ `--staleness error` (or `staleness: 'error'`) compares file mtimes and line counts to the coverage snapshot. When it fails:
118
52
 
119
53
  - Regenerate coverage (`bundle exec rspec`) so the snapshot matches current sources.
120
- - Or drop back to warning-only behaviour using `--stale off` / `staleness: 'off'`.
54
+ - Or drop back to warning-only behaviour using `--staleness off` / `staleness: 'off'`.
121
55
 
122
56
  If you only care about a subset of files, supply `--tracked-globs` (CLI) or `tracked_globs:` (API) so new files outside those globs do not trigger staleness.
123
57
 
@@ -131,9 +65,11 @@ The model looks up files by absolute path, then cwd-relative path, then basename
131
65
 
132
66
  ## MCP Server Issues
133
67
 
134
- ### MCP Server Won't Start
68
+ ### MCP Integration Not Working
135
69
 
136
- **Symptom:** AI assistant reports "Could not connect to MCP server".
70
+ **Symptoms:**
71
+ - AI assistant reports "Could not connect to MCP server"
72
+ - AI says "I don't have access to simplecov-mcp tools"
137
73
 
138
74
  **Diagnostic steps:**
139
75
 
@@ -149,13 +85,16 @@ The model looks up files by absolute path, then cwd-relative path, then basename
149
85
  ```
150
86
  Should return JSON-RPC response.
151
87
 
152
- 3. **Check Ruby version in MCP context:**
88
+ 3. **Verify MCP server is configured:**
153
89
  ```bash
154
- # The version your MCP client sees might differ from your shell
155
- $(which simplecov-mcp) --version
90
+ claude mcp list # For Claude Code
91
+ codex mcp list # For Codex
92
+ tail -f simplecov_mcp.log # Check logs
156
93
  ```
157
94
 
158
- 4. **Use absolute path in MCP config:**
95
+ 4. **Restart AI assistant** - Config changes often require restart
96
+
97
+ 5. **Use absolute path in MCP config:**
159
98
  ```bash
160
99
  # Find absolute path
161
100
  which simplecov-mcp
@@ -163,29 +102,10 @@ The model looks up files by absolute path, then cwd-relative path, then basename
163
102
  # Update your MCP client config to use this path
164
103
  ```
165
104
 
166
- ### MCP Tools Not Available in AI Assistant
167
-
168
- **Symptom:** AI says "I don't have access to simplecov-mcp tools".
169
-
170
- **Solutions:**
171
-
172
- 1. **Restart AI assistant** - Config changes often require restart
173
-
174
- 2. **Verify MCP server is configured:**
175
- ```bash
176
- # For Claude Code
177
- claude mcp list
178
-
179
- # Check logs
180
- tail -f ~/simplecov_mcp.log
181
- ```
105
+ 6. **Use CLI as fallback:**
182
106
 
183
- 3. **Try CLI fallback:**
184
- ```bash
185
- # If MCP isn't working, use CLI with --json
186
- simplecov-mcp list --json
187
- simplecov-mcp summary lib/file.rb --json
188
- ```
107
+ If MCP still isn't working, you can use the CLI with `-fJ` flag instead.
108
+ See **[CLI Fallback for LLMs](CLI_FALLBACK_FOR_LLMS.md)** for complete guidance.
189
109
 
190
110
  ### Path Issues with Version Managers
191
111
 
@@ -248,9 +168,9 @@ echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"version_to
248
168
 
249
169
  If the above doesn't solve your problem:
250
170
 
251
- 1. **Check error mode** - Run with `--error-mode trace` for full stack traces:
171
+ 1. **Check error mode** - Run with `--error-mode debug` for full stack traces:
252
172
  ```bash
253
- simplecov-mcp --error-mode trace summary lib/file.rb
173
+ simplecov-mcp --error-mode debug summary lib/simplecov_mcp/cli.rb
254
174
  ```
255
175
 
256
176
  2. **Check logs:**
@@ -259,7 +179,7 @@ If the above doesn't solve your problem:
259
179
  tail -50 simplecov_mcp.log
260
180
 
261
181
  # Or specify custom log location
262
- simplecov-mcp --log-file /tmp/debug.log summary lib/file.rb
182
+ simplecov-mcp --log-file /tmp/debug.log summary lib/simplecov_mcp/cli.rb
263
183
  ```
264
184
 
265
185
  3. **Search existing issues:**
@@ -272,5 +192,6 @@ If the above doesn't solve your problem:
272
192
 
273
193
  - [Installation Guide](INSTALLATION.md) - Setup and PATH configuration
274
194
  - [CLI Usage](CLI_USAGE.md) - Command-line options and examples
195
+ - [CLI Fallback for LLMs](CLI_FALLBACK_FOR_LLMS.md) - Using CLI when MCP isn't available
275
196
  - [MCP Integration](MCP_INTEGRATION.md) - MCP server configuration
276
197
  - [Error Handling](ERROR_HANDLING.md) - Understanding error modes
@@ -0,0 +1,472 @@
1
+ # V2.0 Breaking Changes Guide
2
+
3
+ This document describes all breaking changes introduced in version 2.0.0 of simplecov-mcp. These changes improve consistency, clarity, and alignment with Ruby conventions.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ - [Command Line Interface Changes](#command-line-interface-changes)
10
+ - [Options Must Precede Subcommands](#options-must-precede-subcommands)
11
+ - [--stale Renamed to --staleness](#--stale-renamed-to---staleness)
12
+ - [--source-context Renamed to --context-lines](#--source-context-renamed-to---context-lines)
13
+ - [--source Now Requires Explicit Mode](#--source-now-requires-explicit-mode)
14
+ - [--json Replaced with --format](#--json-replaced-with---format)
15
+ - [Error Mode Values Changed](#error-mode-values-changed)
16
+ - [--success-predicate Replaced with validate Subcommand](#--success-predicate-replaced-with-validate-subcommand)
17
+ - [Default Sort Order Changed](#default-sort-order-changed)
18
+ - [MCP Tool Changes](#mcp-tool-changes)
19
+ - [stale Parameter Renamed to staleness](#stale-parameter-renamed-to-staleness)
20
+ - [Error Mode Values Changed](#error-mode-values-changed-1)
21
+ - [MCP Tool Arguments Use Symbols](#mcp-tool-arguments-use-symbols)
22
+ - [Ruby API Changes](#ruby-api-changes)
23
+ - [CLIConfig Renamed to AppConfig](#cliconfig-renamed-to-appconfig)
24
+ - [AppConfig Field Changes](#appconfig-field-changes)
25
+ - [Behavioral Changes](#behavioral-changes)
26
+ - [Context Lines Validation](#context-lines-validation)
27
+ - [Migration Guide](#migration-guide)
28
+
29
+ ---
30
+
31
+ ## Command Line Interface Changes
32
+
33
+ ### Options Must Precede Subcommands
34
+
35
+ **Change:** Global options must now appear *before* the subcommand, not after.
36
+
37
+ **Rationale:** This aligns with standard Unix command conventions (e.g., `git`, `docker`) and simplifies argument parsing.
38
+
39
+ **Before (v1.x):**
40
+ ```bash
41
+ simplecov-mcp list --resultset coverage --format json
42
+ simplecov-mcp summary lib/foo.rb --json
43
+ ```
44
+
45
+ **After (v2.x):**
46
+ ```bash
47
+ simplecov-mcp --resultset coverage --format json list
48
+ simplecov-mcp --format json summary lib/foo.rb
49
+ ```
50
+
51
+ **Migration:** Move all global options (flags like `-r`, `-f`, `-S`, etc.) before the subcommand name.
52
+
53
+ ---
54
+
55
+ ### --stale Renamed to --staleness
56
+
57
+ **Change:** The `--stale` option has been renamed to `--staleness`. The short form `-S` is preserved.
58
+
59
+ **Rationale:** Better describes what the option controls (staleness detection mode) and aligns with internal naming conventions.
60
+
61
+ **Before (v1.x):**
62
+ ```bash
63
+ simplecov-mcp --stale error list
64
+ ```
65
+
66
+ **After (v2.x):**
67
+ ```bash
68
+ simplecov-mcp --staleness error list
69
+ # OR use the short form:
70
+ simplecov-mcp -S error list
71
+ ```
72
+
73
+ **Migration:** Replace `--stale` with `--staleness` (or continue using `-S`).
74
+
75
+ ---
76
+
77
+ ### --source-context Renamed to --context-lines
78
+
79
+ **Change:** The `--source-context` option has been renamed to `--context-lines`.
80
+
81
+ **Rationale:** More concise and clearer about what the option controls.
82
+
83
+ **Before (v1.x):**
84
+ ```bash
85
+ simplecov-mcp --source uncovered --source-context 3 uncovered lib/foo.rb
86
+ ```
87
+
88
+ **After (v2.x):**
89
+ ```bash
90
+ simplecov-mcp --source uncovered --context-lines 3 uncovered lib/foo.rb
91
+ # OR use the short form:
92
+ simplecov-mcp -s uncovered -c 3 uncovered lib/foo.rb
93
+ ```
94
+
95
+ **Migration:** Replace `--source-context` with `--context-lines` (or use `-c`).
96
+
97
+ ---
98
+
99
+ ### --source Now Requires Explicit Mode
100
+
101
+ **Change:** The `--source` option now requires an explicit mode argument (`full` or `uncovered`).
102
+
103
+ **Rationale:** Eliminates ambiguity about what source display mode is being used.
104
+
105
+ **Before (v1.x):**
106
+ ```bash
107
+ # Implied 'full' mode
108
+ simplecov-mcp --source summary lib/foo.rb
109
+ ```
110
+
111
+ **After (v2.x):**
112
+ ```bash
113
+ # Must specify mode explicitly
114
+ simplecov-mcp --source full summary lib/foo.rb
115
+ # OR
116
+ simplecov-mcp --source uncovered summary lib/foo.rb
117
+ ```
118
+
119
+ **Migration:** Add an explicit mode (`full` or `uncovered`) after `--source`.
120
+
121
+ ---
122
+
123
+ ### --json Replaced with --format
124
+
125
+ **Change:** The `--json` flag (and related `-j`, `-J`, `--pretty-json` flags) have been removed. Use `--format` instead.
126
+
127
+ **Rationale:** Supports multiple output formats beyond JSON (YAML, awesome_print, etc.) with a consistent interface.
128
+
129
+ **Before (v1.x):**
130
+ ```bash
131
+ simplecov-mcp --json list
132
+ simplecov-mcp -j summary lib/foo.rb
133
+ simplecov-mcp --pretty-json list
134
+ ```
135
+
136
+ **After (v2.x):**
137
+ ```bash
138
+ simplecov-mcp --format json list
139
+ simplecov-mcp -f j summary lib/foo.rb # Short form
140
+ simplecov-mcp --format pretty-json list
141
+ simplecov-mcp -f J list # Short form for pretty-json
142
+ ```
143
+
144
+ **Available formats:**
145
+ - `table` (default) - Human-readable table format
146
+ - `json` or `j` - Single-line JSON
147
+ - `pretty-json` or `J` - Pretty-printed JSON
148
+ - `yaml` or `y` - YAML format
149
+ - `awesome-print` or `ap` - Colored awesome_print format (requires `awesome_print` gem)
150
+
151
+ **Migration:** Replace `--json` with `--format json` (or `-f j`). Replace `--pretty-json` with `--format pretty-json` (or `-f J`).
152
+
153
+ ---
154
+
155
+ ### Error Mode Values Changed
156
+
157
+ **Change:** Error mode enum values have been renamed for clarity:
158
+ - `on` → `log`
159
+ - `trace` → `debug`
160
+
161
+ The old values are **no longer supported**.
162
+
163
+ **Rationale:** More descriptive names that better communicate what each mode does.
164
+
165
+ **Before (v1.x):**
166
+ ```bash
167
+ simplecov-mcp --error-mode on list
168
+ simplecov-mcp --error-mode trace list
169
+ ```
170
+
171
+ **After (v2.x):**
172
+ ```bash
173
+ simplecov-mcp --error-mode log list
174
+ simplecov-mcp --error-mode debug list
175
+ # OR use short forms:
176
+ simplecov-mcp --error-mode l list
177
+ simplecov-mcp --error-mode d list
178
+ ```
179
+
180
+ **Error modes:**
181
+ - `off` (or `o`) - Silent, no error logging
182
+ - `log` (or `l`) - Log errors to file (default)
183
+ - `debug` (or `d`) - Verbose logging with backtraces
184
+
185
+ **Migration:** Replace `--error-mode on` with `--error-mode log`. Replace `--error-mode trace` with `--error-mode debug`.
186
+
187
+ ---
188
+
189
+ ### --success-predicate Replaced with validate Subcommand
190
+
191
+ **Change:** The `--success-predicate` flag has been removed. Use the `validate` subcommand instead.
192
+
193
+ **Rationale:** Better fits the subcommand paradigm and provides a clearer interface for policy validation.
194
+
195
+ **Before (v1.x):**
196
+ ```bash
197
+ simplecov-mcp --success-predicate policy.rb
198
+ ```
199
+
200
+ **After (v2.x):**
201
+ ```bash
202
+ # File-based policy
203
+ simplecov-mcp validate policy.rb
204
+
205
+ # Inline policy (new feature)
206
+ simplecov-mcp validate -i '->(m) { m.all_files.all? { |f| f["percentage"] >= 80 } }'
207
+ ```
208
+
209
+ **Migration:** Replace `--success-predicate FILE` with `validate FILE`.
210
+
211
+ ---
212
+
213
+ ### Default Sort Order Changed
214
+
215
+ **Change:** The default sort order for the `list` command changed from `ascending` to `descending`.
216
+
217
+ **Rationale:** Most users want to see best-covered files first, not worst-covered files first.
218
+
219
+ **Before (v1.x):**
220
+ ```bash
221
+ # Shows worst coverage first by default
222
+ simplecov-mcp list
223
+ ```
224
+
225
+ **After (v2.x):**
226
+ ```bash
227
+ # Shows best coverage first by default
228
+ simplecov-mcp list
229
+
230
+ # To get old behavior (worst first):
231
+ simplecov-mcp --sort-order ascending list
232
+ simplecov-mcp -o a list # Short form
233
+ ```
234
+
235
+ **Migration:** If you relied on ascending order (worst coverage first), explicitly specify `--sort-order ascending` or `-o a`.
236
+
237
+ ---
238
+
239
+ ## MCP Tool Changes
240
+
241
+ ### stale Parameter Renamed to staleness
242
+
243
+ **Change:** All MCP tools that accepted a `stale` parameter now use `staleness` instead.
244
+
245
+ **Rationale:** Aligns with the `CoverageModel` API and CLI option naming.
246
+
247
+ **Before (v1.x):**
248
+ ```json
249
+ {
250
+ "jsonrpc": "2.0",
251
+ "method": "tools/call",
252
+ "params": {
253
+ "name": "coverage_summary_tool",
254
+ "arguments": {
255
+ "path": "lib/foo.rb",
256
+ "stale": "error"
257
+ }
258
+ }
259
+ }
260
+ ```
261
+
262
+ **After (v2.x):**
263
+ ```json
264
+ {
265
+ "jsonrpc": "2.0",
266
+ "method": "tools/call",
267
+ "params": {
268
+ "name": "coverage_summary_tool",
269
+ "arguments": {
270
+ "path": "lib/foo.rb",
271
+ "staleness": "error"
272
+ }
273
+ }
274
+ }
275
+ ```
276
+
277
+ **Affected tools:** All file-based tools (`coverage_summary_tool`, `coverage_detailed_tool`, `coverage_raw_tool`, `uncovered_lines_tool`) and aggregate tools (`all_files_coverage_tool`, `coverage_totals_tool`).
278
+
279
+ **Migration:** Replace `"stale"` with `"staleness"` in all MCP tool calls.
280
+
281
+ ---
282
+
283
+ ### Error Mode Values Changed
284
+
285
+ **Change:** Error mode enum values changed from `['off', 'on', 'trace']` to `['off', 'log', 'debug']`.
286
+
287
+ **Rationale:** More descriptive names matching CLI changes.
288
+
289
+ **Before (v1.x):**
290
+ ```json
291
+ {
292
+ "error_mode": "on"
293
+ }
294
+ ```
295
+
296
+ **After (v2.x):**
297
+ ```json
298
+ {
299
+ "error_mode": "log"
300
+ }
301
+ ```
302
+
303
+ **Migration:** Replace `"on"` with `"log"`, replace `"trace"` with `"debug"`.
304
+
305
+ ---
306
+
307
+ ### MCP Tool Arguments Use Symbols
308
+
309
+ **Change:** Internally, MCP tools now normalize enum arguments to symbols (`:off`, `:error`, `:log`, `:debug`) for consistency with the Ruby API.
310
+
311
+ **Impact:** This is mostly an internal change. MCP clients still send strings in JSON, but if you're using the tools programmatically in Ruby, be aware of the symbol usage.
312
+
313
+ **Migration:** No action needed for MCP clients. For Ruby API users, see [Ruby API Changes](#ruby-api-changes).
314
+
315
+ ---
316
+
317
+ ## Ruby API Changes
318
+
319
+ ### CLIConfig Renamed to AppConfig
320
+
321
+ **Change:** The `CLIConfig` class has been renamed to `AppConfig`.
322
+
323
+ **Rationale:** The configuration is now used by both CLI and MCP modes, not just CLI.
324
+
325
+ **Before (v1.x):**
326
+ ```ruby
327
+ require 'simplecov_mcp/cli_config'
328
+ config = SimpleCovMcp::CLIConfig.new(root: '.', json: true)
329
+ ```
330
+
331
+ **After (v2.x):**
332
+ ```ruby
333
+ require 'simplecov_mcp/app_config'
334
+ config = SimpleCovMcp::AppConfig.new(root: '.', format: :json)
335
+ ```
336
+
337
+ **Migration:** Replace `CLIConfig` with `AppConfig` in your code. Update require statements from `'simplecov_mcp/cli_config'` to `'simplecov_mcp/app_config'`.
338
+
339
+ ---
340
+
341
+ ### AppConfig Field Changes
342
+
343
+ **Change:** Several `AppConfig` fields have been renamed or changed:
344
+
345
+ | Old Field (v1.x) | New Field (v2.x) | Type Change |
346
+ |-----------------------|------------------|--------------------------------------|
347
+ | `json` | `format` | `Boolean` → `Symbol` (`:json`, `:table`, etc.) |
348
+ | `stale_mode` | `staleness` | Name change only |
349
+ | `success_predicate` | (removed) | Moved to `validate` subcommand |
350
+ | (new) | `show_version` | New field for `-v`/`--version` |
351
+
352
+ **Default value changes:**
353
+ - `sort_order`: Changed from `:ascending` to `:descending`
354
+ - `error_mode`: Changed from `:on` to `:log`
355
+
356
+ **Before (v1.x):**
357
+ ```ruby
358
+ config = SimpleCovMcp::CLIConfig.new(
359
+ json: true,
360
+ stale_mode: :error,
361
+ error_mode: :on,
362
+ sort_order: :ascending
363
+ )
364
+ ```
365
+
366
+ **After (v2.x):**
367
+ ```ruby
368
+ config = SimpleCovMcp::AppConfig.new(
369
+ format: :json,
370
+ staleness: :error,
371
+ error_mode: :log,
372
+ sort_order: :descending # New default
373
+ )
374
+ ```
375
+
376
+ **Migration:** Update field names when constructing `AppConfig`. Note the new defaults.
377
+
378
+ ---
379
+
380
+ ## Behavioral Changes
381
+
382
+ ### Context Lines Validation
383
+
384
+ **Change:** The `--context-lines` option (formerly `--source-context`) now raises an `ArgumentError` if given a negative value. Previously, negative values were silently clamped to zero.
385
+
386
+ **Rationale:** Fail fast and provide clear feedback for invalid input.
387
+
388
+ **Before (v1.x):**
389
+ ```bash
390
+ # Silently clamped to 0
391
+ simplecov-mcp --source-context -5 uncovered lib/foo.rb
392
+ ```
393
+
394
+ **After (v2.x):**
395
+ ```bash
396
+ # Raises ArgumentError
397
+ simplecov-mcp --context-lines -5 uncovered lib/foo.rb
398
+ # Error: Context lines must be non-negative (got: -5)
399
+ ```
400
+
401
+ **Migration:** Ensure `--context-lines` values are non-negative (>= 0).
402
+
403
+ ---
404
+
405
+ ## Migration Guide
406
+
407
+ ### Quick Checklist
408
+
409
+ - [ ] Move all global options before subcommands in CLI invocations
410
+ - [ ] Replace `--stale` with `--staleness` (or continue using `-S`)
411
+ - [ ] Replace `--source-context` with `--context-lines` (or use `-c`)
412
+ - [ ] Add explicit mode to `--source` (either `full` or `uncovered`)
413
+ - [ ] Replace `--json` with `--format json` (or `-f j`)
414
+ - [ ] Replace `--error-mode on` with `--error-mode log`
415
+ - [ ] Replace `--error-mode trace` with `--error-mode debug`
416
+ - [ ] Replace `--success-predicate FILE` with `validate FILE`
417
+ - [ ] Update MCP tool calls: rename `stale` to `staleness`
418
+ - [ ] Update MCP tool calls: replace error mode `"on"` with `"log"`, `"trace"` with `"debug"`
419
+ - [ ] Update Ruby code: rename `CLIConfig` to `AppConfig`
420
+ - [ ] Update Ruby code: rename `json` field to `format`, `stale_mode` to `staleness`
421
+ - [ ] Explicitly set `--sort-order ascending` if you need worst-coverage-first sorting
422
+ - [ ] Ensure `--context-lines` values are non-negative
423
+
424
+ ### Script Migration Example
425
+
426
+ **Before (v1.x):**
427
+ ```bash
428
+ #!/bin/bash
429
+ simplecov-mcp list --json --stale error --sort-order ascending
430
+ simplecov-mcp summary lib/foo.rb --json
431
+ simplecov-mcp uncovered lib/bar.rb --source=uncovered --source-context 3
432
+ simplecov-mcp --success-predicate policy.rb
433
+ ```
434
+
435
+ **After (v2.x):**
436
+ ```bash
437
+ #!/bin/bash
438
+ simplecov-mcp --format json --staleness error --sort-order ascending list
439
+ simplecov-mcp --format json summary lib/foo.rb
440
+ simplecov-mcp --source uncovered --context-lines 3 uncovered lib/bar.rb
441
+ simplecov-mcp validate policy.rb
442
+ ```
443
+
444
+ ### Environment Variable Migration
445
+
446
+ **Before (v1.x):**
447
+ ```bash
448
+ export SIMPLECOV_MCP_OPTS="--stale error --json"
449
+ ```
450
+
451
+ **After (v2.x):**
452
+ ```bash
453
+ export SIMPLECOV_MCP_OPTS="--staleness error --format json"
454
+ ```
455
+
456
+ ---
457
+
458
+ ## Getting Help
459
+
460
+ If you encounter issues migrating to v2.0:
461
+
462
+ 1. Check the [TROUBLESHOOTING.md](TROUBLESHOOTING.md) guide
463
+ 2. Review the [CLI_USAGE.md](CLI_USAGE.md) for complete CLI reference
464
+ 3. See [MCP_INTEGRATION.md](MCP_INTEGRATION.md) for MCP tool documentation
465
+ 4. Open an issue at https://github.com/keithrbennett/simplecov-mcp/issues
466
+
467
+ ---
468
+
469
+ **See also:**
470
+ - [RELEASE_NOTES.md](../../RELEASE_NOTES.md) - Full release notes with new features
471
+ - [CLI_USAGE.md](CLI_USAGE.md) - Complete CLI reference
472
+ - [MCP_INTEGRATION.md](MCP_INTEGRATION.md) - MCP tool reference
data/exe/simplecov-mcp CHANGED
@@ -14,7 +14,7 @@ begin
14
14
  $stderr.puts 'Please run with a supported Ruby version (e.g., via rbenv, rvm, asdf).'
15
15
  exit 1
16
16
  end
17
- rescue StandardError
17
+ rescue
18
18
  # If anything goes wrong, let the app load and potentially fail with a more specific error.
19
19
  end
20
20