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.
- checksums.yaml +4 -4
- data/README.md +98 -50
- data/docs/{ARCHITECTURE.md → dev/ARCHITECTURE.md} +11 -10
- data/docs/dev/BRANCH_ONLY_COVERAGE.md +158 -0
- data/docs/{DEVELOPMENT.md → dev/DEVELOPMENT.md} +2 -1
- data/docs/dev/README.md +10 -0
- data/docs/dev/RELEASING.md +146 -0
- data/docs/{arch-decisions → dev/arch-decisions}/001-x-arch-decision.md +3 -1
- data/docs/{arch-decisions → dev/arch-decisions}/002-x-arch-decision.md +7 -5
- data/docs/{arch-decisions → dev/arch-decisions}/003-x-arch-decision.md +2 -0
- data/docs/{arch-decisions → dev/arch-decisions}/004-x-arch-decision.md +6 -2
- data/docs/{arch-decisions → dev/arch-decisions}/005-x-arch-decision.md +4 -2
- data/docs/{arch-decisions → dev/arch-decisions}/README.md +3 -3
- data/docs/{presentations → dev/presentations}/simplecov-mcp-presentation.md +28 -22
- data/docs/fixtures/demo_project/README.md +9 -0
- data/docs/{ADVANCED_USAGE.md → user/ADVANCED_USAGE.md} +129 -319
- data/docs/user/CLI_FALLBACK_FOR_LLMS.md +34 -0
- data/docs/user/CLI_USAGE.md +750 -0
- data/docs/{ERROR_HANDLING.md → user/ERROR_HANDLING.md} +12 -12
- data/docs/user/EXAMPLES.md +588 -0
- data/docs/user/INSTALLATION.md +130 -0
- data/docs/{LIBRARY_API.md → user/LIBRARY_API.md} +90 -32
- data/docs/{MCP_INTEGRATION.md → user/MCP_INTEGRATION.md} +36 -34
- data/docs/user/README.md +14 -0
- data/docs/{TROUBLESHOOTING.md → user/TROUBLESHOOTING.md} +21 -100
- data/docs/user/V2-BREAKING-CHANGES.md +472 -0
- data/exe/simplecov-mcp +1 -1
- data/lib/simplecov_mcp/{cli_config.rb → app_config.rb} +12 -12
- data/lib/simplecov_mcp/app_context.rb +1 -1
- data/lib/simplecov_mcp/base_tool.rb +66 -38
- data/lib/simplecov_mcp/cli.rb +67 -123
- data/lib/simplecov_mcp/commands/base_command.rb +16 -27
- data/lib/simplecov_mcp/commands/command_factory.rb +8 -2
- data/lib/simplecov_mcp/commands/detailed_command.rb +16 -2
- data/lib/simplecov_mcp/commands/list_command.rb +1 -1
- data/lib/simplecov_mcp/commands/raw_command.rb +18 -2
- data/lib/simplecov_mcp/commands/summary_command.rb +20 -3
- data/lib/simplecov_mcp/commands/totals_command.rb +53 -0
- data/lib/simplecov_mcp/commands/uncovered_command.rb +24 -5
- data/lib/simplecov_mcp/commands/validate_command.rb +60 -0
- data/lib/simplecov_mcp/commands/version_command.rb +19 -4
- data/lib/simplecov_mcp/config_parser.rb +32 -0
- data/lib/simplecov_mcp/constants.rb +3 -3
- data/lib/simplecov_mcp/coverage_reporter.rb +31 -0
- data/lib/simplecov_mcp/error_handler.rb +81 -40
- data/lib/simplecov_mcp/error_handler_factory.rb +2 -2
- data/lib/simplecov_mcp/errors.rb +12 -19
- data/lib/simplecov_mcp/formatters/source_formatter.rb +23 -19
- data/lib/simplecov_mcp/formatters.rb +51 -0
- data/lib/simplecov_mcp/mcp_server.rb +9 -7
- data/lib/simplecov_mcp/mode_detector.rb +6 -5
- data/lib/simplecov_mcp/model.rb +122 -88
- data/lib/simplecov_mcp/option_normalizers.rb +39 -18
- data/lib/simplecov_mcp/option_parser_builder.rb +82 -65
- data/lib/simplecov_mcp/option_parsers/env_options_parser.rb +3 -5
- data/lib/simplecov_mcp/option_parsers/error_helper.rb +18 -17
- data/lib/simplecov_mcp/path_relativizer.rb +17 -14
- data/lib/simplecov_mcp/predicate_evaluator.rb +72 -0
- data/lib/simplecov_mcp/presenters/base_coverage_presenter.rb +1 -3
- data/lib/simplecov_mcp/presenters/coverage_detailed_presenter.rb +1 -3
- data/lib/simplecov_mcp/presenters/coverage_raw_presenter.rb +1 -3
- data/lib/simplecov_mcp/presenters/coverage_summary_presenter.rb +1 -3
- data/lib/simplecov_mcp/presenters/coverage_uncovered_presenter.rb +1 -3
- data/lib/simplecov_mcp/presenters/project_coverage_presenter.rb +1 -3
- data/lib/simplecov_mcp/presenters/project_totals_presenter.rb +27 -0
- data/lib/simplecov_mcp/resolvers/coverage_line_resolver.rb +14 -18
- data/lib/simplecov_mcp/resolvers/resultset_path_resolver.rb +7 -9
- data/lib/simplecov_mcp/resultset_loader.rb +20 -25
- data/lib/simplecov_mcp/staleness_checker.rb +50 -46
- data/lib/simplecov_mcp/table_formatter.rb +64 -0
- data/lib/simplecov_mcp/tools/all_files_coverage_tool.rb +20 -50
- data/lib/simplecov_mcp/tools/coverage_detailed_tool.rb +13 -7
- data/lib/simplecov_mcp/tools/coverage_raw_tool.rb +12 -7
- data/lib/simplecov_mcp/tools/coverage_summary_tool.rb +13 -8
- data/lib/simplecov_mcp/tools/coverage_table_tool.rb +20 -60
- data/lib/simplecov_mcp/tools/coverage_totals_tool.rb +44 -0
- data/lib/simplecov_mcp/tools/help_tool.rb +38 -66
- data/lib/simplecov_mcp/tools/uncovered_lines_tool.rb +13 -8
- data/lib/simplecov_mcp/tools/validate_tool.rb +72 -0
- data/lib/simplecov_mcp/tools/version_tool.rb +7 -14
- data/lib/simplecov_mcp/util.rb +18 -12
- data/lib/simplecov_mcp/version.rb +1 -1
- data/lib/simplecov_mcp.rb +23 -29
- data/spec/all_files_coverage_tool_spec.rb +4 -3
- data/spec/{cli_config_spec.rb → app_config_spec.rb} +31 -26
- data/spec/base_tool_spec.rb +17 -14
- data/spec/cli/show_default_report_spec.rb +2 -2
- data/spec/cli_enumerated_options_spec.rb +31 -9
- data/spec/cli_error_spec.rb +46 -23
- data/spec/cli_format_spec.rb +123 -0
- data/spec/cli_json_options_spec.rb +50 -0
- data/spec/cli_source_spec.rb +11 -63
- data/spec/cli_spec.rb +82 -97
- data/spec/cli_usage_spec.rb +15 -15
- data/spec/commands/base_command_spec.rb +12 -92
- data/spec/commands/command_factory_spec.rb +7 -3
- data/spec/commands/detailed_command_spec.rb +10 -24
- data/spec/commands/list_command_spec.rb +28 -0
- data/spec/commands/raw_command_spec.rb +43 -20
- data/spec/commands/summary_command_spec.rb +10 -23
- data/spec/commands/totals_command_spec.rb +34 -0
- data/spec/commands/uncovered_command_spec.rb +29 -23
- data/spec/commands/validate_command_spec.rb +213 -0
- data/spec/commands/version_command_spec.rb +38 -0
- data/spec/constants_spec.rb +3 -3
- data/spec/coverage_reporter_spec.rb +102 -0
- data/spec/coverage_table_tool_spec.rb +21 -10
- data/spec/coverage_totals_tool_spec.rb +37 -0
- data/spec/error_handler_spec.rb +120 -4
- data/spec/error_mode_spec.rb +18 -22
- data/spec/errors_edge_cases_spec.rb +101 -28
- data/spec/errors_stale_spec.rb +34 -0
- data/spec/file_based_mcp_tools_spec.rb +6 -6
- data/spec/fixtures/project1/lib/bar.rb +2 -0
- data/spec/fixtures/project1/lib/foo.rb +2 -0
- data/spec/help_tool_spec.rb +2 -18
- data/spec/integration_spec.rb +103 -161
- data/spec/logging_fallback_spec.rb +3 -3
- data/spec/mcp_server_integration_spec.rb +1 -1
- data/spec/mcp_server_spec.rb +70 -53
- data/spec/mode_detector_spec.rb +46 -41
- data/spec/model_error_handling_spec.rb +139 -78
- data/spec/model_staleness_spec.rb +13 -13
- data/spec/option_normalizers_spec.rb +111 -112
- data/spec/option_parsers/env_options_parser_spec.rb +25 -37
- data/spec/option_parsers/error_helper_spec.rb +56 -56
- data/spec/path_relativizer_spec.rb +15 -0
- data/spec/presenters/coverage_detailed_presenter_spec.rb +1 -1
- data/spec/presenters/coverage_summary_presenter_spec.rb +1 -1
- data/spec/presenters/coverage_uncovered_presenter_spec.rb +1 -1
- data/spec/presenters/project_coverage_presenter_spec.rb +9 -8
- data/spec/presenters/project_totals_presenter_spec.rb +144 -0
- data/spec/resolvers/coverage_line_resolver_spec.rb +261 -36
- data/spec/resolvers/resultset_path_resolver_spec.rb +13 -8
- data/spec/shared_examples/file_based_mcp_tools.rb +23 -18
- data/spec/shared_examples/formatted_command_examples.rb +64 -0
- data/spec/simple_cov_mcp_module_spec.rb +24 -3
- data/spec/simplecov_mcp/formatters/source_formatter_spec.rb +267 -0
- data/spec/simplecov_mcp/formatters_spec.rb +76 -0
- data/spec/simplecov_mcp/presenters/base_coverage_presenter_spec.rb +79 -0
- data/spec/simplecov_mcp_model_spec.rb +97 -47
- data/spec/simplecov_mcp_opts_spec.rb +42 -39
- data/spec/spec_helper.rb +27 -92
- data/spec/staleness_checker_spec.rb +10 -9
- data/spec/staleness_more_spec.rb +4 -4
- data/spec/support/cli_helpers.rb +22 -0
- data/spec/support/control_flow_helpers.rb +20 -0
- data/spec/support/fake_mcp.rb +40 -0
- data/spec/support/io_helpers.rb +29 -0
- data/spec/support/mcp_helpers.rb +35 -0
- data/spec/support/mcp_runner.rb +10 -8
- data/spec/support/mocking_helpers.rb +30 -0
- data/spec/table_format_spec.rb +70 -0
- data/spec/tools/validate_tool_spec.rb +132 -0
- data/spec/tools_error_handling_spec.rb +34 -48
- data/spec/util_spec.rb +5 -4
- data/spec/version_spec.rb +7 -7
- data/spec/version_tool_spec.rb +20 -22
- metadata +90 -23
- data/docs/BRANCH_ONLY_COVERAGE.md +0 -81
- data/docs/CLI_USAGE.md +0 -637
- data/docs/EXAMPLES.md +0 -430
- data/docs/INSTALLATION.md +0 -352
- data/spec/cli_success_predicate_spec.rb +0 -141
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
This document provides a checklist for releasing new versions of simplecov-mcp.
|
|
4
|
+
|
|
5
|
+
## Pre-Release Checklist
|
|
6
|
+
|
|
7
|
+
### 1. Documentation Review
|
|
8
|
+
|
|
9
|
+
- [ ] **RELEASE_NOTES.md**: Update version header
|
|
10
|
+
- Update the version section header to final version (e.g., `## v#{version}`)
|
|
11
|
+
- For major releases: Ensure all breaking changes are documented with migration examples
|
|
12
|
+
- Verify new features and bug fixes are listed
|
|
13
|
+
|
|
14
|
+
- [ ] **README.md**: Verify examples and feature list are current
|
|
15
|
+
|
|
16
|
+
- [ ] **Documentation**: Ensure all docs in `docs/` are up to date
|
|
17
|
+
|
|
18
|
+
### 2. Code Quality
|
|
19
|
+
|
|
20
|
+
- [ ] **Tests**: All tests passing (`bundle exec rspec`)
|
|
21
|
+
- Verify via git hooks or run manually
|
|
22
|
+
- Check coverage is still excellent (>95%)
|
|
23
|
+
|
|
24
|
+
- [ ] **Linting**: No Rubocop violations (`bundle exec rubocop`)
|
|
25
|
+
- Verify via git hooks or run manually
|
|
26
|
+
|
|
27
|
+
- [ ] **Version**: Update `lib/simplecov_mcp/version.rb` to release version
|
|
28
|
+
- Remove `.pre.X` suffix for stable releases
|
|
29
|
+
|
|
30
|
+
### 3. Cleanup
|
|
31
|
+
|
|
32
|
+
- [ ] **Untracked files**: Review `git status` for files that should be:
|
|
33
|
+
- Added to `.gitignore` (temp files, local experiments, AI reports)
|
|
34
|
+
- Committed (valuable documentation or examples)
|
|
35
|
+
- Deleted (obsolete files)
|
|
36
|
+
|
|
37
|
+
- [ ] **Temporary files**: Remove or ignore:
|
|
38
|
+
- `*.txt` files (r.txt, rubocop.txt, todo.txt, etc.)
|
|
39
|
+
- Experimental config files (`.rubocop.yml.new`, etc.)
|
|
40
|
+
- Local notes (CODING_AGENT_NOTES.md, architecture_insights.md, etc.)
|
|
41
|
+
- Work-in-progress directories (screencast/, untracked-ai-reports/, etc.)
|
|
42
|
+
|
|
43
|
+
### 4. Build Verification
|
|
44
|
+
|
|
45
|
+
- [ ] **Build gem**: Verify gem builds without errors
|
|
46
|
+
```bash
|
|
47
|
+
gem build simplecov-mcp.gemspec
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- [ ] **Test installation**: Install and test locally
|
|
51
|
+
```bash
|
|
52
|
+
gem install simplecov-mcp-*.gem
|
|
53
|
+
simplecov-mcp --version
|
|
54
|
+
simplecov-mcp --help
|
|
55
|
+
# Test on actual project
|
|
56
|
+
cd /path/to/test/project
|
|
57
|
+
simplecov-mcp list
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 5. Git Release
|
|
61
|
+
|
|
62
|
+
- [ ] **Commit changes**: Commit version bump and RELEASE_NOTES.md updates
|
|
63
|
+
```bash
|
|
64
|
+
git add lib/simplecov_mcp/version.rb RELEASE_NOTES.md
|
|
65
|
+
git commit -m "Release version #{version}"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- [ ] **Create tag**: Tag the release
|
|
69
|
+
```bash
|
|
70
|
+
git tag -a v#{version} -m "Version #{version}"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- [ ] **Push**: Push commits and tags
|
|
74
|
+
```bash
|
|
75
|
+
git push origin main --follow-tags
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 6. Publish Gem
|
|
79
|
+
|
|
80
|
+
- [ ] **Build final gem**: Build from tagged version
|
|
81
|
+
```bash
|
|
82
|
+
gem build simplecov-mcp.gemspec
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- [ ] **Push to RubyGems**: Publish the gem
|
|
86
|
+
```bash
|
|
87
|
+
gem push simplecov-mcp-#{version}.gem
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- [ ] **Verify publication**: Check gem appears on RubyGems.org
|
|
91
|
+
- Visit https://rubygems.org/gems/simplecov-mcp
|
|
92
|
+
- Verify new version is listed
|
|
93
|
+
- Check that documentation links work
|
|
94
|
+
|
|
95
|
+
### 7. GitHub Release
|
|
96
|
+
|
|
97
|
+
- [ ] **Create GitHub release**: Go to https://github.com/keithrbennett/simplecov-mcp/releases/new
|
|
98
|
+
- Select the tag you just pushed
|
|
99
|
+
- Title: `Version #{version}`
|
|
100
|
+
- Description: Copy relevant sections from RELEASE_NOTES.md
|
|
101
|
+
- Attach the `.gem` file (optional)
|
|
102
|
+
|
|
103
|
+
### 8. Post-Release
|
|
104
|
+
|
|
105
|
+
- [ ] **Announcement**: Consider announcing on:
|
|
106
|
+
- Ruby Weekly
|
|
107
|
+
- Reddit (r/ruby)
|
|
108
|
+
- Slack/Discord communities
|
|
109
|
+
- Social media
|
|
110
|
+
|
|
111
|
+
- [ ] **Update dependencies**: For projects using this gem
|
|
112
|
+
- Update your own projects to use new version
|
|
113
|
+
- Test integration
|
|
114
|
+
|
|
115
|
+
- [ ] **Prepare for next release**:
|
|
116
|
+
- Optionally create a new section in RELEASE_NOTES.md for next version
|
|
117
|
+
- Consider bumping to next pre-release version if starting new development cycle
|
|
118
|
+
|
|
119
|
+
## Version Numbering
|
|
120
|
+
|
|
121
|
+
Follow [Semantic Versioning](https://semver.org/):
|
|
122
|
+
|
|
123
|
+
- **Major (X.0.0)**: Breaking changes
|
|
124
|
+
- **Minor (0.X.0)**: New features, backward compatible
|
|
125
|
+
- **Patch (0.0.X)**: Bug fixes, backward compatible
|
|
126
|
+
- **Pre-release (X.Y.Z.pre.N)**: Development versions
|
|
127
|
+
|
|
128
|
+
## Rollback Procedure
|
|
129
|
+
|
|
130
|
+
If a critical issue is discovered after release:
|
|
131
|
+
|
|
132
|
+
1. **Yank the gem** (removes from RubyGems but preserves install history):
|
|
133
|
+
```bash
|
|
134
|
+
gem yank simplecov-mcp -v #{version}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
2. **Fix the issue** in a new patch version
|
|
138
|
+
|
|
139
|
+
3. **Release the fixed version** following this checklist
|
|
140
|
+
|
|
141
|
+
4. **Communicate**: Update GitHub release notes and announce the issue + fix
|
|
142
|
+
|
|
143
|
+
## Notes
|
|
144
|
+
|
|
145
|
+
- GitHub Actions runs tests and Rubocop on every commit (via hooks)
|
|
146
|
+
- Pre-commit hooks ensure code quality before commits
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# ADR 001: Dual-Mode Operation (CLI and MCP Server)
|
|
2
2
|
|
|
3
|
+
[Back to main README](../../README.md)
|
|
4
|
+
|
|
3
5
|
## Status
|
|
4
6
|
|
|
5
7
|
Accepted
|
|
@@ -40,7 +42,7 @@ The implementation is in `lib/simplecov_mcp.rb:34-52`:
|
|
|
40
42
|
|
|
41
43
|
```ruby
|
|
42
44
|
def run(argv)
|
|
43
|
-
env_opts =
|
|
45
|
+
env_opts = extract_env_opts
|
|
44
46
|
full_argv = env_opts + argv
|
|
45
47
|
|
|
46
48
|
if ModeDetector.cli_mode?(full_argv)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# ADR 002: Context-Aware Error Handling Strategy
|
|
2
2
|
|
|
3
|
+
[Back to main README](../../README.md)
|
|
4
|
+
|
|
3
5
|
## Status
|
|
4
6
|
|
|
5
7
|
Accepted
|
|
@@ -56,9 +58,9 @@ The `ErrorHandler` class (lib/simplecov_mcp/error_handler.rb:7) provides configu
|
|
|
56
58
|
class ErrorHandler
|
|
57
59
|
attr_accessor :error_mode, :logger
|
|
58
60
|
|
|
59
|
-
VALID_ERROR_MODES = [:off, :
|
|
61
|
+
VALID_ERROR_MODES = [:off, :log, :debug].freeze
|
|
60
62
|
|
|
61
|
-
def initialize(error_mode: :
|
|
63
|
+
def initialize(error_mode: :log, logger: nil)
|
|
62
64
|
@error_mode = error_mode
|
|
63
65
|
@logger = logger
|
|
64
66
|
end
|
|
@@ -84,7 +86,7 @@ The `ErrorHandlerFactory` (lib/simplecov_mcp/error_handler_factory.rb:4) creates
|
|
|
84
86
|
|
|
85
87
|
```ruby
|
|
86
88
|
module ErrorHandlerFactory
|
|
87
|
-
def self.for_cli(error_mode: :
|
|
89
|
+
def self.for_cli(error_mode: :log)
|
|
88
90
|
ErrorHandler.new(error_mode: error_mode)
|
|
89
91
|
end
|
|
90
92
|
|
|
@@ -92,8 +94,8 @@ module ErrorHandlerFactory
|
|
|
92
94
|
ErrorHandler.new(error_mode: :off) # No logging
|
|
93
95
|
end
|
|
94
96
|
|
|
95
|
-
def self.for_mcp_server(error_mode: :
|
|
96
|
-
ErrorHandler.new(error_mode: :
|
|
97
|
+
def self.for_mcp_server(error_mode: :log)
|
|
98
|
+
ErrorHandler.new(error_mode: :log) # Logs to file
|
|
97
99
|
end
|
|
98
100
|
end
|
|
99
101
|
```
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# ADR 004: Ruby `instance_eval` for Success Predicates
|
|
2
2
|
|
|
3
|
+
[Back to main README](../../README.md)
|
|
4
|
+
|
|
3
5
|
## Status
|
|
4
6
|
|
|
5
7
|
Accepted
|
|
@@ -90,7 +92,7 @@ def run_success_predicate
|
|
|
90
92
|
exit(result ? 0 : 1) # 0 = success, 1 = failure
|
|
91
93
|
rescue => e
|
|
92
94
|
warn "Success predicate error: #{e.message}"
|
|
93
|
-
warn e.backtrace.first(5).join("\n") if config.error_mode == :
|
|
95
|
+
warn e.backtrace.first(5).join("\n") if config.error_mode == :debug
|
|
94
96
|
exit 2 # Exit code 2 for predicate errors
|
|
95
97
|
end
|
|
96
98
|
```
|
|
@@ -126,7 +128,9 @@ end
|
|
|
126
128
|
```
|
|
127
129
|
|
|
128
130
|
**Class example:**
|
|
131
|
+
|
|
129
132
|
```ruby
|
|
133
|
+
|
|
130
134
|
class CoveragePolicy
|
|
131
135
|
def call(model)
|
|
132
136
|
api_files = model.all_files.select { |f| f['file'].start_with?('lib/api/') }
|
|
@@ -134,7 +138,7 @@ class CoveragePolicy
|
|
|
134
138
|
end
|
|
135
139
|
end
|
|
136
140
|
|
|
137
|
-
|
|
141
|
+
AllFilesAboveThreshold.new
|
|
138
142
|
```
|
|
139
143
|
|
|
140
144
|
The predicate receives a full `CoverageModel` instance with access to:
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# ADR 005: No SimpleCov Runtime Dependency
|
|
2
2
|
|
|
3
|
+
[Back to main README](../../README.md)
|
|
4
|
+
|
|
3
5
|
## Status
|
|
4
6
|
|
|
5
7
|
Replaced – simplecov-mcp now requires SimpleCov at runtime so that multi-suite resultsets can be merged using SimpleCov’s combine helpers.
|
|
@@ -71,8 +73,8 @@ def summary(arr)
|
|
|
71
73
|
total += 1
|
|
72
74
|
covered += 1 if hits.to_i > 0
|
|
73
75
|
end
|
|
74
|
-
|
|
75
|
-
{ 'covered' => covered, 'total' => total, '
|
|
76
|
+
percentage = total.zero? ? 100.0 : ((covered.to_f * 100.0 / total) * 100).round / 100.0
|
|
77
|
+
{ 'covered' => covered, 'total' => total, 'percentage' => percentage }
|
|
76
78
|
end
|
|
77
79
|
|
|
78
80
|
def uncovered(arr)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Architecture Decision Records
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Back to main README](../../README.md)
|
|
4
4
|
|
|
5
5
|
## What is an ADR?
|
|
6
6
|
|
|
@@ -20,10 +20,10 @@ A short phrase describing the decision (e.g., "Dual-Mode Operation: CLI and MCP
|
|
|
20
20
|
- **Superseded**: Replaced by a newer decision
|
|
21
21
|
|
|
22
22
|
### Context
|
|
23
|
-
The background, problem statement, and constraints that led to
|
|
23
|
+
The background, problem statement, and constraints that led to the decision.
|
|
24
24
|
|
|
25
25
|
### Decision
|
|
26
|
-
The architectural
|
|
26
|
+
The architectural choice that was made.
|
|
27
27
|
|
|
28
28
|
### Consequences
|
|
29
29
|
The implications of this decision, both positive and negative. This includes:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
[Back to main README](../../README.md)
|
|
2
|
+
|
|
1
3
|
---
|
|
2
4
|
marp: true
|
|
3
5
|
theme: default
|
|
@@ -69,24 +71,17 @@ echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"coverage_s
|
|
|
69
71
|
|
|
70
72
|
## MCP Tools (Functions) Available
|
|
71
73
|
|
|
72
|
-
| Tool | Purpose |
|
|
73
|
-
|
|
74
|
-
| `all_files_coverage_tool` | Project-wide coverage data |
|
|
75
|
-
| `coverage_detailed_tool` | Per-line hit counts |
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
|
|
80
|
-
|
|
|
81
|
-
|
|
82
|
-
|
|
|
83
|
-
| coverage_detailed_tool | Per-line hit counts | simplecov-mcp detailed lib/simplecov_mcp/model.rb |
|
|
84
|
-
| coverage_raw_tool | Raw SimpleCov lines array | simplecov-mcp raw lib/simplecov_mcp/model.rb |
|
|
85
|
-
| coverage_summary_tool | Get coverage % for a file | simplecov-mcp summary lib/simplecov_mcp/model.rb |
|
|
86
|
-
| coverage_table_tool | Formatted coverage table | simplecov-mcp table |
|
|
87
|
-
| help_tool | Tool usage guidance | simplecov-mcp help |
|
|
88
|
-
| uncovered_lines_tool | Find missing test coverage | simplecov-mcp uncovered lib/simplecov_mcp/model.rb |
|
|
89
|
-
| version_tool | Display version info | simplecov-mcp version |
|
|
74
|
+
| Tool | Purpose | Example CLI Command |
|
|
75
|
+
|---------------------------|----------------------------|------------------------------------------------------|
|
|
76
|
+
| `all_files_coverage_tool` | Project-wide coverage data | `simplecov-mcp list` |
|
|
77
|
+
| `coverage_detailed_tool` | Per-line hit counts | `simplecov-mcp detailed lib/simplecov_mcp/model.rb` |
|
|
78
|
+
| `coverage_raw_tool` | Raw SimpleCov lines array | `simplecov-mcp raw lib/simplecov_mcp/model.rb` |
|
|
79
|
+
| `coverage_summary_tool` | Get coverage % for a file | `simplecov-mcp summary lib/simplecov_mcp/model.rb` |
|
|
80
|
+
| `coverage_table_tool` | Formatted coverage table | `simplecov-mcp list` |
|
|
81
|
+
| `coverage_totals_tool` | Aggregated line totals | `simplecov-mcp totals` |
|
|
82
|
+
| `help_tool` | Tool usage guidance | `simplecov-mcp --help` |
|
|
83
|
+
| `uncovered_lines_tool` | Find missing test coverage | `simplecov-mcp uncovered lib/simplecov_mcp/cli.rb` |
|
|
84
|
+
| `version_tool` | Display version info | `simplecov-mcp version` |
|
|
90
85
|
|
|
91
86
|
---
|
|
92
87
|
|
|
@@ -104,7 +99,17 @@ simplecov-mcp summary lib/simplecov_mcp/cli.rb
|
|
|
104
99
|
simplecov-mcp uncovered lib/simplecov_mcp/cli.rb --source=uncovered --source-context 3
|
|
105
100
|
|
|
106
101
|
# JSON for scripts
|
|
107
|
-
simplecov-mcp
|
|
102
|
+
simplecov-mcp -fJ | jq '.files[] | select(.percentage < 80)'
|
|
103
|
+
|
|
104
|
+
# Ruby alternative:
|
|
105
|
+
simplecov-mcp -fJ | ruby -r json -e '
|
|
106
|
+
JSON.parse($stdin.read)["files"].select { |f| f["percentage"] < 80 }.each do |f|
|
|
107
|
+
puts JSON.pretty_generate(f)
|
|
108
|
+
end
|
|
109
|
+
'
|
|
110
|
+
|
|
111
|
+
# Rexe alternative:
|
|
112
|
+
simplecov-mcp -fJ | rexe -ij -mb -oJ 'self["files"].select { |f| f["percentage"] < 80 }'
|
|
108
113
|
```
|
|
109
114
|
|
|
110
115
|
---
|
|
@@ -119,7 +124,7 @@ simplecov-mcp --resultset coverage-all/
|
|
|
119
124
|
simplecov-mcp --sort-order d
|
|
120
125
|
|
|
121
126
|
# Staleness checking (file newer than coverage?)
|
|
122
|
-
simplecov-mcp --
|
|
127
|
+
simplecov-mcp --staleness error
|
|
123
128
|
|
|
124
129
|
# Track new files missing from coverage
|
|
125
130
|
simplecov-mcp --tracked-globs "lib/**/tools/*.rb"
|
|
@@ -155,7 +160,7 @@ puts "Missing lines: #{uncovered['uncovered'].inspect}"
|
|
|
155
160
|
## Custom Threshold Git Pre-Commit Hook
|
|
156
161
|
|
|
157
162
|
```ruby
|
|
158
|
-
|
|
163
|
+
require 'simplecov_mcp'
|
|
159
164
|
|
|
160
165
|
files = SimpleCovMcp::CoverageModel.new.all_files
|
|
161
166
|
critical, other = files.partition { |f| f['file'].include?('/lib/critical/') }
|
|
@@ -177,7 +182,7 @@ end
|
|
|
177
182
|
## Architecture Overview
|
|
178
183
|
|
|
179
184
|
```
|
|
180
|
-
lib/
|
|
185
|
+
lib/simplecov_mcp
|
|
181
186
|
├── base_tool.rb
|
|
182
187
|
├── cli.rb
|
|
183
188
|
├── error_handler_factory.rb
|
|
@@ -193,6 +198,7 @@ lib/simple_cov_mcp
|
|
|
193
198
|
│ ├── coverage_raw_tool.rb
|
|
194
199
|
│ ├── coverage_summary_tool.rb
|
|
195
200
|
│ ├── coverage_table_tool.rb
|
|
201
|
+
│ ├── coverage_totals_tool.rb
|
|
196
202
|
│ ├── help_tool.rb
|
|
197
203
|
│ ├── uncovered_lines_tool.rb
|
|
198
204
|
│ └── version_tool.rb
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Demo project fixture
|
|
2
|
+
|
|
3
|
+
This small demo project powers the documentation examples that rely on partial coverage and tracked globs.
|
|
4
|
+
|
|
5
|
+
- Location: `docs/fixtures/demo_project`
|
|
6
|
+
- Resultset: `.resultset.json` in this directory
|
|
7
|
+
- Suggested alias for docs: `alias smcp='simplecov-mcp --root docs/fixtures/demo_project'`
|
|
8
|
+
|
|
9
|
+
Files include controllers, models, payments services, background jobs, and an API client. A few files are intentionally missing from the resultset so the `--tracked-globs` examples surface gaps.
|