mercy 1.5.0 → 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 (145) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +89 -9
  3. data/.claude/agents/architect.md +48 -0
  4. data/.claude/agents/infra.md +36 -0
  5. data/.claude/agents/ruby.md +45 -0
  6. data/.claude/configuration/arcanum-repo-config.json +3 -0
  7. data/.claude/scripts/check_infra.sh +6 -0
  8. data/.claude/scripts/check_ruby.sh +7 -0
  9. data/.claude/settings.json +10 -0
  10. data/.github/commit_message_template-2.0.md +32 -0
  11. data/.github/commit_message_template.md +10 -0
  12. data/.github/copilot-instructions.md +1 -0
  13. data/.github/pull_request_template.md +17 -0
  14. data/.gitignore +8 -0
  15. data/.rubocop.yml +39 -0
  16. data/.rubocop_todo.yml +60 -0
  17. data/AGENTS.md +58 -0
  18. data/CLAUDE.md +1 -0
  19. data/Dockerfile +21 -0
  20. data/Gemfile +26 -1
  21. data/README.md +13 -4
  22. data/Rakefile +11 -3
  23. data/config/check_specs.yml +7 -0
  24. data/config/rubycritc.rb +12 -0
  25. data/config/yardstick.rb +13 -0
  26. data/config/yardstick.yml +41 -0
  27. data/docker-compose.yml +14 -9
  28. data/docs/agents/arcanum-split-issue.md +9 -0
  29. data/docs/agents/architecture.md +61 -0
  30. data/docs/agents/contributing.md +195 -0
  31. data/docs/agents/flow.md +5 -0
  32. data/docs/agents/folder-structure.md +26 -0
  33. data/docs/agents/issue-enhancement.md +10 -0
  34. data/docs/agents/issues/.gitkeep +1 -0
  35. data/docs/agents/plans/.gitkeep +1 -0
  36. data/lib/arstotzka/type_cast_ext.rb +52 -2
  37. data/lib/mercy/class_methods.rb +77 -7
  38. data/lib/mercy/concern.rb +105 -1
  39. data/lib/mercy/period_parser.rb +46 -3
  40. data/lib/mercy/report/active_record.rb +20 -16
  41. data/lib/mercy/report/error.rb +6 -4
  42. data/lib/mercy/report/multiple.rb +26 -22
  43. data/lib/mercy/report/range.rb +6 -4
  44. data/lib/mercy/report.rb +38 -7
  45. data/lib/mercy/report_builder.rb +2 -0
  46. data/lib/mercy/report_config.rb +5 -0
  47. data/lib/mercy/status.rb +7 -1
  48. data/lib/mercy/status_builder.rb +2 -0
  49. data/lib/mercy/version.rb +3 -1
  50. data/lib/mercy.rb +2 -0
  51. data/mercy.gemspec +19 -25
  52. data/scripts/bump_version.sh +62 -0
  53. data/scripts/check_readme.sh +6 -0
  54. data/scripts/rubycritic.sh +10 -0
  55. data/spec/dummy/.ruby-version +1 -0
  56. data/spec/dummy/Rakefile +10 -0
  57. data/spec/dummy/app/channels/application_cable/channel.rb +6 -0
  58. data/spec/dummy/app/channels/application_cable/connection.rb +6 -0
  59. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  60. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  61. data/spec/dummy/app/controllers/document_report_controller.rb +34 -0
  62. data/spec/dummy/app/controllers/example_report_controller.rb +27 -0
  63. data/spec/dummy/app/helpers/application_helper.rb +4 -0
  64. data/spec/dummy/app/jobs/application_job.rb +4 -0
  65. data/spec/dummy/app/mailers/application_mailer.rb +6 -0
  66. data/spec/dummy/app/models/application_record.rb +5 -0
  67. data/spec/dummy/app/models/concerns/.keep +0 -0
  68. data/spec/dummy/app/models/document.rb +9 -0
  69. data/spec/dummy/app/models/dummy_report.rb +6 -0
  70. data/spec/dummy/app/models/mercy/report/doc_type_error.rb +20 -0
  71. data/spec/dummy/app/models/mercy/report/dummy1.rb +19 -0
  72. data/spec/dummy/app/models/mercy/report/dummy_report.rb +11 -0
  73. data/spec/dummy/app/models/mercy/report/multiple/dummy.rb +28 -0
  74. data/spec/dummy/app/models/mercy/report/multiple/successes.rb +28 -0
  75. data/spec/dummy/app/models/mercy/report/success.rb +18 -0
  76. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  77. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  78. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  79. data/spec/dummy/bin/bundle +5 -0
  80. data/spec/dummy/bin/rails +6 -0
  81. data/spec/dummy/bin/rake +6 -0
  82. data/spec/dummy/bin/setup +38 -0
  83. data/spec/dummy/bin/update +33 -0
  84. data/spec/dummy/bin/yarn +11 -0
  85. data/spec/dummy/config/application.rb +24 -0
  86. data/spec/dummy/config/boot.rb +7 -0
  87. data/spec/dummy/config/cable.yml +10 -0
  88. data/spec/dummy/config/database.yml +20 -0
  89. data/spec/dummy/config/environment.rb +7 -0
  90. data/spec/dummy/config/environments/development.rb +55 -0
  91. data/spec/dummy/config/environments/production.rb +95 -0
  92. data/spec/dummy/config/environments/test.rb +52 -0
  93. data/spec/dummy/config/initializers/application_controller_renderer.rb +10 -0
  94. data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
  95. data/spec/dummy/config/initializers/content_security_policy.rb +27 -0
  96. data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
  97. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  98. data/spec/dummy/config/initializers/inflections.rb +18 -0
  99. data/spec/dummy/config/initializers/mime_types.rb +6 -0
  100. data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
  101. data/spec/dummy/config/locales/en.yml +33 -0
  102. data/spec/dummy/config/puma.rb +36 -0
  103. data/spec/dummy/config/routes.rb +16 -0
  104. data/spec/dummy/config/spring.rb +8 -0
  105. data/spec/dummy/config/storage.yml +34 -0
  106. data/spec/dummy/config.ru +7 -0
  107. data/spec/dummy/db/migrate/20190508170435_create_documents.rb +13 -0
  108. data/spec/dummy/db/schema.rb +27 -0
  109. data/spec/dummy/log/.keep +0 -0
  110. data/spec/dummy/package.json +5 -0
  111. data/spec/dummy/public/404.html +67 -0
  112. data/spec/dummy/public/422.html +67 -0
  113. data/spec/dummy/public/500.html +66 -0
  114. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  115. data/spec/dummy/public/apple-touch-icon.png +0 -0
  116. data/spec/dummy/public/favicon.ico +0 -0
  117. data/spec/dummy/storage/.keep +0 -0
  118. data/spec/dummy/tmp/.keep +0 -0
  119. data/spec/dummy/tmp/storage/.keep +0 -0
  120. data/spec/integration/controller/error_report_controller_spec.rb +196 -0
  121. data/spec/integration/controller/multiple_report_spec.rb +86 -0
  122. data/spec/integration/controller/range_report_spec.rb +194 -0
  123. data/spec/integration/yard/arstotzka/type_cast_spec.rb +43 -0
  124. data/spec/integration/yard/controller/example_report_controller_spec.rb +95 -0
  125. data/spec/integration/yard/mercy/period_parser_spec.rb +21 -0
  126. data/spec/lib/arstotzka/type_cast_spec.rb +10 -9
  127. data/spec/lib/mercy/period_parser_spec.rb +10 -9
  128. data/spec/lib/mercy/report/error_spec.rb +93 -70
  129. data/spec/lib/mercy/report/multiple_spec.rb +9 -57
  130. data/spec/lib/mercy/report/range_spec.rb +70 -41
  131. data/spec/lib/mercy/report_builder_spec.rb +34 -17
  132. data/spec/lib/mercy/report_config_spec.rb +48 -0
  133. data/spec/lib/mercy/report_spec.rb +5 -15
  134. data/spec/lib/mercy/status_builder_spec.rb +33 -22
  135. data/spec/lib/mercy/status_spec.rb +69 -49
  136. data/spec/spec_helper.rb +18 -7
  137. data/spec/support/fixture_helpers.rb +4 -2
  138. data/spec/support/models/arstotzka/type_cast/dummy.rb +9 -0
  139. data/spec/support/shared_contexts/document_setup.rb +31 -0
  140. data/spec/support/shared_examples/time_parser.rb +2 -0
  141. metadata +123 -109
  142. data/spec/lib/mercy/report/report_config_spec.rb +0 -39
  143. data/spec/support/models/document.rb +0 -6
  144. data/spec/support/report/dummy.rb +0 -15
  145. data/spec/support/schema.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ea2e29aaca202d99f4b6d0d8ea3a9515b0ee8c80
4
- data.tar.gz: 8b1bfb1ac1ab08640814ded69b186c6b1664c6d0
2
+ SHA256:
3
+ metadata.gz: 64177603aa5886d5b7b65aa92e535ce29f2db21f59f06c961cb7b37605bc545d
4
+ data.tar.gz: 20e25e8d1e17dd19c279e77c46a042e5372143331442607c402c2c2baf075c2d
5
5
  SHA512:
6
- metadata.gz: 60d0ff4fe15a81f17e59f203a7839f68d1fe82fa2ae178f7a1785e626eb0c12c9e030b3cfb6bd97b882090f8b8bca48e99beaf0f4e184938ee07e45d01811e1c
7
- data.tar.gz: a3c670ed0b56a98f534ba6c62af5df0c9ae32c302243db676d3b5f8cbaec013b3d01c4ac1eaa0436f160d0d5de05fe2f242f297d8807fc685c9f610512c0d67b
6
+ metadata.gz: 0aa87ae79605f13c1b3b60c0fa4343eff9c681d62b1a8d891ca83f1a9aca02ea021eb147b07d15551914660405a29204449a875b4a7b428fa4bbdd7d66195da9
7
+ data.tar.gz: 0c7ce82a6b1671dc8b77b41a47b8651fb78bab4fea25d0ce0982b7b77c41733b42ba3469452025948de46625a57383df645e4e3e9e472127d052b3212dbc8b8c
data/.circleci/config.yml CHANGED
@@ -1,13 +1,93 @@
1
- version: 2
1
+ version: 2.1
2
+ workflows:
3
+ test-and-build:
4
+ jobs:
5
+ - test:
6
+ filters:
7
+ tags:
8
+ only: /.*/
9
+ - checks:
10
+ filters:
11
+ tags:
12
+ only: /.*/
13
+ - coverage-final:
14
+ requires: [test]
15
+ filters:
16
+ tags:
17
+ only: /.*/
18
+ - build-and-release:
19
+ requires: [test, checks, coverage-final]
20
+ filters:
21
+ tags:
22
+ only: /\d+\.\d+\.\d+/
23
+ branches:
24
+ only:
25
+ - master
2
26
  jobs:
3
- build:
27
+ test:
4
28
  docker:
5
- - image: circleci/ruby:2.4.1
29
+ - image: darthjee/circleci_ruby_3412:1.0.0
30
+ environment:
31
+ PROJECT: mercy
6
32
  steps:
7
33
  - checkout
8
- - run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
9
- - run: chmod +x ./cc-test-reporter
10
- - run: ./cc-test-reporter before-build
11
- - run: bundle install
12
- - run: bundle exec rspec
13
- - run: ./cc-test-reporter after-build --exit-code $?
34
+ - run:
35
+ name: Bundle Install
36
+ command: bundle install
37
+ - run:
38
+ name: RSpec
39
+ command: CI=true bundle exec rspec
40
+ - run:
41
+ name: Upload coverage to Codacy (partial)
42
+ command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -r coverage/lcov/project.lcov
43
+ coverage-final:
44
+ docker:
45
+ - image: darthjee/circleci_ruby_3412:1.0.0
46
+ steps:
47
+ - run:
48
+ name: Finalize coverage on Codacy
49
+ command: bash <(curl -Ls https://coverage.codacy.com/get.sh) final
50
+ checks:
51
+ docker:
52
+ - image: darthjee/circleci_ruby_3412:1.0.0
53
+ environment:
54
+ PROJECT: mercy
55
+ steps:
56
+ - checkout
57
+ - run:
58
+ name: Bundle Install
59
+ command: bundle install
60
+ - run:
61
+ name: Rubocop
62
+ command: rubocop
63
+ - run:
64
+ name: Yardstick coverage check
65
+ command: bundle exec rake verify_measurements
66
+ - run:
67
+ name: Check version documentation
68
+ command: check_readme.sh
69
+ - run:
70
+ name: Rubycritcs check
71
+ command: rubycritic.sh
72
+ - run:
73
+ name: Check unit tests
74
+ command: check_specs
75
+ build-and-release:
76
+ docker:
77
+ - image: darthjee/circleci_ruby_3412:1.0.0
78
+ environment:
79
+ PROJECT: mercy
80
+ steps:
81
+ - checkout
82
+ - run:
83
+ name: Bundle Install
84
+ command: bundle install
85
+ - run:
86
+ name: Signin
87
+ command: build_gem.sh signin
88
+ - run:
89
+ name: Build Gem
90
+ command: build_gem.sh build
91
+ - run:
92
+ name: Push Gem
93
+ command: build_gem.sh push
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: architect
3
+ description: Mercy architect and coordinator. Use for cross-cutting tasks, multi-agent coordination, documentation, root-level files, or any task that spans more than one agent's scope.
4
+ tools: Read, Edit, Write, Bash, Agent
5
+ ---
6
+
7
+ You are the architect and coordinator for the Mercy project — a Ruby gem providing a Rails controller concern for configurable health-check reports rendered as JSON.
8
+
9
+ ## Your scope
10
+
11
+ - `docs/agents/` — all project documentation
12
+ - Root-level files: `README.md`, `AGENTS.md`, `CLAUDE.md`, `LICENSE`, `.gitignore`, `.github/`
13
+ - Cross-cutting decisions that span multiple layers
14
+ - Coordination of the other specialist agents
15
+
16
+ ## Specialist agents
17
+
18
+ Delegate implementation, exploration, and planning work to the right agent. Never implement, explore, or plan what belongs to a specialist yourself.
19
+
20
+ | Agent | Scope |
21
+ |-------|-------|
22
+ | `ruby` | `lib/`, `spec/`, `config/`, gemspec, Rakefile, RuboCop configs — gem code, specs and code-quality config |
23
+ | `infra` | `Dockerfile`, `docker-compose.yml`, `.circleci/`, `scripts/` — containers, CI pipeline and CI scripts |
24
+
25
+ ## How to coordinate
26
+
27
+ When a task spans multiple agents:
28
+
29
+ 1. **Break it down** — identify which parts belong to which agent.
30
+ 2. **Delegate exploration first** — before proposing an approach, dispatch the specialist(s) whose scope covers the relevant area to investigate, rather than reading the code yourself.
31
+ 3. **Sequence or parallelize** — if agents' outputs are independent, run them in parallel; if one depends on the other, sequence them.
32
+ 4. **Integrate** — after specialist agents finish, verify cross-cutting concerns.
33
+ 5. **Update docs** — reflect any architectural change in `docs/agents/`.
34
+
35
+ ## Documentation (`docs/agents/`)
36
+
37
+ | File | Contents |
38
+ |------|----------|
39
+ | [Folder Structure](../../docs/agents/folder-structure.md) | Top-level directory layout and the role of each folder. |
40
+ | [Architecture](../../docs/agents/architecture.md) | Source layout, modules, code style, and implementation guidelines. |
41
+ | [Flow](../../docs/agents/flow.md) | Main runtime flow of the application. |
42
+ | [Contributing](../../docs/agents/contributing.md) | Commit guidelines, PR standards, code organization, and refactoring rules. |
43
+ | [Plans](../../docs/agents/plans/) | Implementation plans for ongoing or upcoming features. |
44
+ | [Issues](../../docs/agents/issues/) | Detailed specs for open issues. |
45
+
46
+ Keep documentation up to date after any architectural change. When a new agent is created or its scope changes, update this file and `AGENTS.md`.
47
+
48
+ Note: a version bump in `lib/mercy/version.rb` (owned by `ruby`) requires updating the rubydoc link in `README.md` (owned by you).
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: infra
3
+ description: Mercy infra specialist. Use for any task involving Docker (Dockerfile, docker-compose.yml), CircleCI (.circleci/), or CI helper scripts (scripts/).
4
+ tools: Read, Edit, Write, Bash
5
+ ---
6
+
7
+ You are the infra specialist for the Mercy project — a Ruby gem providing a Rails controller concern for configurable health-check reports rendered as JSON.
8
+
9
+ ## Your scope
10
+
11
+ You own:
12
+
13
+ - `Dockerfile` — multi-stage image built from `darthjee/ruby_gems` / `darthjee/scripts`
14
+ - `docker-compose.yml` — `base_build`, `mercy` (rspec) and `test_all` (rspec + yard + yardstick) services
15
+ - `.circleci/` — CircleCI pipeline (`build` job: rspec, rubocop, coverage report, yardstick, README version check, rubycritic)
16
+ - `scripts/` — CI helper scripts (`check_readme.sh`, `rubycritic.sh`)
17
+
18
+ Do NOT touch `lib/`, `spec/`, `config/`, the gemspec, Rakefile or RuboCop configs (owned by `ruby`), nor `docs/agents/` or root documentation files (owned by `architect`).
19
+
20
+ ## Stack
21
+
22
+ - Docker, docker-compose (v3)
23
+ - CircleCI 2.0 (`darthjee/circleci_ruby_gems` image, Code Climate test reporter)
24
+ - Bash
25
+
26
+ ## Commands
27
+
28
+ ```bash
29
+ docker-compose build base_build
30
+ docker-compose run --rm test_all
31
+ ```
32
+
33
+ ## Conventions
34
+
35
+ - Keep local Docker commands and CircleCI steps equivalent; when a CI step is added or changed, update the CI Checks table in `docs/agents/contributing.md` (coordinate with `architect`).
36
+ - Scripts use `#!/bin/bash` and must be executable.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: ruby
3
+ description: Mercy ruby specialist. Use for any task involving Ruby code, the gem's library (lib/), RSpec specs (spec/), the dummy Rails app, YARD docs, RuboCop, yardstick/rubycritic config, the gemspec or Rakefile.
4
+ tools: Read, Edit, Write, Bash
5
+ ---
6
+
7
+ You are the ruby specialist for the Mercy project — a Ruby gem providing a Rails controller concern for configurable health-check reports rendered as JSON.
8
+
9
+ ## Your scope
10
+
11
+ You own:
12
+
13
+ - `lib/` — gem source (`Mercy` concern, builders, reports, Arstotzka type-cast extension)
14
+ - `spec/` — unit specs (`spec/lib/`), integration specs (`spec/integration/`), dummy Rails app (`spec/dummy/`), shared support (`spec/support/`)
15
+ - `config/` — yardstick and rubycritic configuration
16
+ - `mercy.gemspec`, `Gemfile`, `Rakefile`, `.rspec`, `.rubocop.yml`, `.rubocop_todo.yml`
17
+
18
+ Do NOT touch `Dockerfile`, `docker-compose.yml`, `.circleci/`, `scripts/` (owned by `infra`), `docs/agents/` or root documentation files (owned by `architect`).
19
+
20
+ ## Stack
21
+
22
+ - Ruby (>= 2.5), ActiveSupport 5 (`ActiveSupport::Concern`), ActiveRecord
23
+ - arstotzka, darthjee-core_ext, darthjee-active_ext
24
+ - RSpec / rspec-rails, sqlite3 (dummy app), SimpleCov
25
+ - RuboCop 0.58.1 + rubocop-rspec, YARD + yardstick, rubycritic
26
+
27
+ ## Commands
28
+
29
+ Run inside Docker:
30
+
31
+ ```bash
32
+ docker-compose run --rm mercy /bin/bash -c 'bundle exec rspec'
33
+ docker-compose run --rm mercy /bin/bash -c 'rubocop'
34
+ docker-compose run --rm mercy /bin/bash -c 'yard && bundle exec rake yardstick_measure && bundle exec rake verify_measurements'
35
+ ```
36
+
37
+ ## Conventions
38
+
39
+ - Every Ruby file starts with `# frozen_string_literal: true`.
40
+ - File paths mirror namespaces in snake_case (`lib/mercy/report/range.rb` → `Mercy::Report::Range`); specs mirror them under `spec/lib/` with `_spec.rb`.
41
+ - Public methods before `private`; small, single-responsibility methods.
42
+ - Every public class/method is documented with YARD; yardstick thresholds must hold.
43
+ - New report types subclass `Mercy::Report` / `Mercy::Report::ActiveRecord` and define `ALLOWED_PARAMETERS`, `DEFAULT_OPTION`, `error?` and `as_json`.
44
+ - When bumping `lib/mercy/version.rb`, the README's rubydoc link must be updated too (`scripts/check_readme.sh`) — coordinate with `architect`.
45
+ - See `docs/agents/contributing.md` and `docs/agents/architecture.md`.
@@ -0,0 +1,3 @@
1
+ {
2
+ "version": "2.4.0"
3
+ }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ set -x
4
+
5
+ docker-compose build base_build
6
+ docker-compose run --rm test_all
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ set -x
4
+
5
+ docker-compose run --rm mercy /bin/bash -c 'bundle exec rspec'
6
+ docker-compose run --rm mercy /bin/bash -c 'rubocop'
7
+ docker-compose run --rm mercy /bin/bash -c 'yard && bundle exec rake yardstick_measure && bundle exec rake verify_measurements'
@@ -0,0 +1,10 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(auto-fix-all/scripts/wait_ci_and_merge.sh *)",
5
+ "Bash(auto-fix-issue/scripts/commit_change.sh *)",
6
+ "Bash(auto-fix-issue/scripts/run_checks.sh *)",
7
+ "Bash(git add *)"
8
+ ]
9
+ }
10
+ }
@@ -0,0 +1,32 @@
1
+ ```text
2
+ <type>(<scope>): <subject> (issue #<id>)
3
+
4
+ <optional body: what was done and why, if not obvious>
5
+
6
+ Addresses-Comment: <optional: URL of the PR comment this commit addresses>
7
+
8
+ Co-Authored-By: <AI model name> <AI model email>
9
+ Co-Authored-By: <agent> agent <agent email>
10
+ ```
11
+
12
+ Note: unlike the model line above (always the running AI model's own
13
+ canonical noreply address), the agent line's email is independently
14
+ configurable per agent via the "git.email" key (a template such as
15
+ "you+{agent}@example.com", with "{agent}" substituted for the actual
16
+ agent name, e.g. "architect" or "backend") in
17
+ .claude/state/arcanum-config.json (local) or
18
+ .claude/configuration/arcanum-repo-config.json (repo) — see
19
+ docs/guides/arcanum-repo-config.md. When "git.email" is unset, the agent
20
+ line falls back to the same address as the model line, reproducing the
21
+ old, single-shared-email template's output.
22
+
23
+ The model line above can be omitted entirely by setting the
24
+ "git.omit_model_coauthor" key to "true" in the same three locations
25
+ (local state, repo config, or global config — see
26
+ docs/guides/arcanum-repo-config.md) — the agent line is always still
27
+ emitted regardless of this setting.
28
+
29
+ This file's mere presence (as "commit_message_template-2.0.md", not its
30
+ content) is what switches the commit scripts onto this new, two-distinct-
31
+ email behavior — the content itself is never parsed at runtime, it is
32
+ purely human-facing documentation of the shape above.
@@ -0,0 +1,10 @@
1
+ ```text
2
+ <type>(<scope>): <subject> (issue #<id>)
3
+
4
+ <optional body: what was done and why, if not obvious>
5
+
6
+ Addresses-Comment: <optional: URL of the PR comment this commit addresses>
7
+
8
+ Co-Authored-By: <AI model name> <AI model email>
9
+ Co-Authored-By: <agent> agent <AI model email>
10
+ ```
@@ -0,0 +1 @@
1
+ See [AGENTS.md](../AGENTS.md) for project instructions.
@@ -0,0 +1,17 @@
1
+ ## Summary
2
+
3
+ <!-- One sentence describing what this PR does -->
4
+
5
+ ## Problem
6
+
7
+ <!-- What problem does this solve? Why is this change needed? -->
8
+
9
+ ## Solution
10
+
11
+ <!-- How was the problem solved? What approach was taken? -->
12
+
13
+ ## Details
14
+
15
+ <!-- Optional: implementation notes, migration steps, caveats. Remove this section if not needed. -->
16
+
17
+ Fixes #
data/.gitignore CHANGED
@@ -1,3 +1,11 @@
1
1
  coverage
2
2
  pkg
3
3
  Gemfile.lock
4
+ doc
5
+ .yardoc
6
+ measurement
7
+ rubycritic
8
+ **/.*.swp
9
+ **/*.log
10
+ .claude/state/
11
+ spec/dummy/tmp
data/.rubocop.yml ADDED
@@ -0,0 +1,39 @@
1
+ plugins:
2
+ - rubocop-rspec
3
+ - rubocop-rake
4
+
5
+ inherit_from: .rubocop_todo.yml
6
+
7
+ AllCops:
8
+ TargetRubyVersion: 3.4
9
+ NewCops: enable
10
+ SuggestExtensions: false
11
+ Exclude:
12
+ - 'spec/dummy/bin/**/*'
13
+ - 'spec/dummy/db/schema.rb'
14
+
15
+ Metrics/BlockLength:
16
+ Exclude:
17
+ - 'spec/**/*_spec.rb'
18
+ - 'spec/support/shared_*/**/*.rb'
19
+ - '*.gemspec'
20
+
21
+ RSpec/AlignLeftLetBrace:
22
+ Enabled: true
23
+
24
+ Layout/LineLength:
25
+ Max: 100
26
+ Exclude:
27
+ - 'spec/spec_helper.rb'
28
+ - 'spec/dummy/config/**/*.rb'
29
+
30
+ RSpec/SpecFilePathFormat:
31
+ Exclude:
32
+ - 'spec/integration/controller/**/*.rb'
33
+
34
+ RSpec/MultipleMemoizedHelpers:
35
+ Enabled: false
36
+
37
+ Layout/HashAlignment:
38
+ EnforcedColonStyle: [key, table]
39
+ EnforcedHashRocketStyle: [key, table]
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,60 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2019-05-07 17:55:11 +0000 using RuboCop version 0.58.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: CountComments, ExcludedMethods.
11
+ # ExcludedMethods: refine
12
+ Metrics/BlockLength:
13
+ Max: 28
14
+
15
+ # Offense count: 11
16
+ # Configuration parameters: AggregateFailuresByDefault.
17
+ RSpec/MultipleExpectations:
18
+ Max: 3
19
+
20
+ # Offense count: 111
21
+ RSpec/NamedSubject:
22
+ Exclude:
23
+ - 'spec/lib/arstotzka/type_cast_spec.rb'
24
+ - 'spec/lib/mercy/report/error_spec.rb'
25
+ - 'spec/lib/mercy/report/multiple_spec.rb'
26
+ - 'spec/lib/mercy/report/range_spec.rb'
27
+ - 'spec/lib/mercy/report_builder_spec.rb'
28
+ - 'spec/lib/mercy/report_config_spec.rb'
29
+ - 'spec/lib/mercy/report_spec.rb'
30
+ - 'spec/lib/mercy/status_builder_spec.rb'
31
+ - 'spec/lib/mercy/status_spec.rb'
32
+ - 'spec/support/shared_examples/time_parser.rb'
33
+
34
+ # Offense count: 48
35
+ RSpec/NestedGroups:
36
+ Max: 6
37
+
38
+ # Offense count: 14
39
+ Style/Documentation:
40
+ Exclude:
41
+ - 'spec/**/*'
42
+ - 'test/**/*'
43
+ - 'lib/arstotzka/type_cast_ext.rb'
44
+ - 'lib/mercy.rb'
45
+ - 'lib/mercy/class_methods.rb'
46
+ - 'lib/mercy/concern.rb'
47
+ - 'lib/mercy/period_parser.rb'
48
+ - 'lib/mercy/report.rb'
49
+ - 'lib/mercy/report/active_record.rb'
50
+ - 'lib/mercy/report/error.rb'
51
+ - 'lib/mercy/report/multiple.rb'
52
+ - 'lib/mercy/report/range.rb'
53
+ - 'lib/mercy/report_builder.rb'
54
+ - 'lib/mercy/report_config.rb'
55
+ - 'lib/mercy/status.rb'
56
+ - 'lib/mercy/status_builder.rb'
57
+ - 'spec/dummy/**/*.rb'
58
+
59
+ Gemspec/RequireMFA:
60
+ Enabled: false
data/AGENTS.md ADDED
@@ -0,0 +1,58 @@
1
+ # Project Instructions
2
+
3
+ Mercy is a Ruby gem for easy server health checks: a Rails controller concern
4
+ (`include Mercy`, `status_report`, `render_status`) that builds configurable
5
+ reports (`Error`, `Range`, `Multiple`) over ActiveRecord scopes and renders them
6
+ as a JSON status.
7
+
8
+ ## Stack
9
+
10
+ - Ruby (>= 2.5)
11
+ - ActiveSupport 5 / Rails controller concern, ActiveRecord
12
+ - arstotzka, darthjee-core_ext, darthjee-active_ext
13
+ - RSpec, RuboCop, YARD (yardstick), SimpleCov
14
+ - Docker (docker-compose) and CircleCI
15
+
16
+ ## Conventions
17
+
18
+ - Tests are written with RSpec (unit and integration specs under `spec/`).
19
+ - RuboCop must pass.
20
+ - Public API is documented with YARD (checked with yardstick).
21
+ - Every Ruby file starts with `# frozen_string_literal: true`.
22
+
23
+ ## Documentation
24
+
25
+ All project documentation lives under [`docs/agents/`](docs/agents/):
26
+
27
+ | File | Contents |
28
+ |------|----------|
29
+ | [Folder Structure](docs/agents/folder-structure.md) | Top-level directory layout and the role of each folder. |
30
+ | [Architecture](docs/agents/architecture.md) | Source layout, modules, code style, and implementation guidelines. |
31
+ | [Flow](docs/agents/flow.md) | Main runtime flow of the application. |
32
+ | [Contributing](docs/agents/contributing.md) | Commit guidelines, PR standards, code organization, and refactoring rules. |
33
+ | [Plans](docs/agents/plans/) | Implementation plans for ongoing or upcoming features. |
34
+ | [Issues](docs/agents/issues/) | Detailed specs for open issues. |
35
+
36
+ ### Issues (`docs/agents/issues/`)
37
+
38
+ Each file documents an issue in detail. Naming convention:
39
+
40
+ ```
41
+ docs/agents/issues/<issue_id>_<issue_name>.md
42
+ ```
43
+
44
+ Example: `docs/agents/issues/5_release_docker_image.md` for issue #5.
45
+
46
+ ### Plans (`docs/agents/plans/`)
47
+
48
+ Each plan is a directory named after the issue ID and topic, containing one or more related files:
49
+
50
+ ```
51
+ docs/agents/plans/<issue_id>_<topic>/<related_files>.md
52
+ ```
53
+
54
+ Example: `docs/agents/plans/12_add-auth/plan.md` for issue #12.
55
+
56
+ ## Commit Attribution
57
+
58
+ Commit co-author trailers follow arcanum's resolved `git.omit_model_coauthor` and `git.remove_coauthors` config (check them with `/arcanum-check-config`); this overrides Claude Code's own attribution reminder for every commit, including ones written by hand.
data/CLAUDE.md ADDED
@@ -0,0 +1 @@
1
+ See [AGENTS.md](AGENTS.md) for project instructions.
data/Dockerfile ADDED
@@ -0,0 +1,21 @@
1
+ FROM darthjee/scripts:0.15.0 as scripts
2
+
3
+ FROM darthjee/ruby_3412:1.0.0 as base
4
+
5
+ COPY --chown=app:app ./ /home/app/app/
6
+
7
+ ######################################
8
+
9
+ FROM base as builder
10
+
11
+ COPY --chown=app:app --from=scripts /home/scripts/builder/bundle_builder.sh /usr/local/sbin/bundle_builder.sh
12
+
13
+ ENV HOME_DIR /home/app
14
+ RUN bundle_builder.sh
15
+
16
+ #######################
17
+ #FINAL IMAGE
18
+ FROM base
19
+
20
+ COPY --chown=app:app --from=builder /home/app/bundle/ /usr/local/bundle/
21
+ RUN bundle install
data/Gemfile CHANGED
@@ -1,4 +1,29 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
7
+ gem 'activerecord', '7.2.4'
8
+ gem 'bundler', '>= 4.0.24'
9
+ gem 'pry', '0.14.2'
10
+ gem 'pry-nav', '1.0.0'
11
+ gem 'rails', '7.2.4'
12
+ gem 'rake', '13.4.2'
13
+ gem 'reek', '6.5.0'
14
+ gem 'rspec', '3.13.2'
15
+ gem 'rspec-core', '3.13.7'
16
+ gem 'rspec-expectations', '3.13.6'
17
+ gem 'rspec-mocks', '3.13.9'
18
+ gem 'rspec-rails', '8.0.4'
19
+ gem 'rspec-support', '3.13.8'
20
+ gem 'rubocop', '1.92.2'
21
+ gem 'rubocop-rake', '0.7.1'
22
+ gem 'rubocop-rspec', '3.10.2'
23
+ gem 'rubycritic', '5.0.0'
24
+ gem 'simplecov', '0.22.0'
25
+ gem 'simplecov-html', '0.13.2'
26
+ gem 'simplecov-lcov', '0.9.0'
27
+ gem 'sqlite3', '2.10.2'
28
+ gem 'yard', '0.9.45'
29
+ gem 'yardstick', '0.9.9'
data/README.md CHANGED
@@ -1,15 +1,24 @@
1
1
  Mercy
2
2
  ==========
3
3
 
4
- ![mercy](https://raw.githubusercontent.com/darthjee/mercy/master/mercy.jpg)
5
-
6
4
  [![Code Climate](https://codeclimate.com/github/darthjee/mercy/badges/gpa.svg)](https://codeclimate.com/github/darthjee/mercy)
7
5
  [![Test Coverage](https://codeclimate.com/github/darthjee/mercy/badges/coverage.svg)](https://codeclimate.com/github/darthjee/mercy/coverage)
8
6
  [![Issue Count](https://codeclimate.com/github/darthjee/mercy/badges/issue_count.svg)](https://codeclimate.com/github/darthjee/mercy)
7
+ [![Gem Version](https://badge.fury.io/rb/mercy.svg)](https://badge.fury.io/rb/mercy)
8
+
9
+ ![mercy](https://raw.githubusercontent.com/darthjee/mercy/main/mercy.jpg)
9
10
 
10
11
  This gem tries to make server monitoring easier and more reliable by adding an easly configurable
11
12
  report and making it avaliable in a controller
12
13
 
14
+ Yard Documentation
15
+ -------------------
16
+ [https://www.rubydoc.info/gems/mercy/2.0.0](https://www.rubydoc.info/gems/mercy/2.0.0)
17
+
18
+ **Current Release**: [2.0.0](https://github.com/darthjee/mercy/tree/2.0.0)
19
+
20
+ **Next release**: [2.1.0](https://github.com/darthjee/mercy/compare/2.0.0...main)
21
+
13
22
  Getting started
14
23
  ---------------
15
24
  1. Add Mercy to your `Gemfile` and `bundle install`:
@@ -59,14 +68,14 @@ with error and render the report
59
68
 
60
69
  Remembering that each report may have its onw parameters
61
70
 
62
- - ```Mercy::Error```
71
+ - ```Mercy::Report::Error```
63
72
  - scope: scope to be fetched when trying to find objects with error (default: :with_error)
64
73
  - external_key: column to be exposed as id for the objects with error
65
74
  - threshold: default report threshold (default: 0.02)
66
75
  - base_scope: scope to be universal sample
67
76
  - uniq: when the output ids should not be repeated
68
77
  - limit: limit of ids to be outputed
69
- - ```Mercy::Range```
78
+ - ```Mercy::Report::Range```
70
79
  - scope: scope of the query to be counted
71
80
  - maximum: max value accepted in the range
72
81
  - minimum: minimum value accepted in the range
data/Rakefile CHANGED
@@ -1,7 +1,15 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'yardstick/rake/measurement'
6
+ require './config/yardstick'
7
+ require './config/rubycritc'
3
8
 
4
9
  RSpec::Core::RakeTask.new
5
10
 
6
- task :default => :spec
11
+ desc 'Run specs'
12
+ task default: :spec
13
+
14
+ desc 'Run specs'
7
15
  task test: :spec
@@ -0,0 +1,7 @@
1
+ ignore:
2
+ - lib/arstotzka/type_cast_ext.rb
3
+ - lib/mercy.rb
4
+ - lib/mercy/class_methods.rb
5
+ - lib/mercy/concern.rb
6
+ - lib/mercy/report/active_record.rb
7
+ - lib/mercy/version.rb
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubycritic/rake_task'
4
+
5
+ RubyCritic::RakeTask.new do |task|
6
+ options = %w[
7
+ --path rubycritic/
8
+ --no-browser
9
+ ]
10
+ task.options = options.join(' ')
11
+ task.paths = %w[lib]
12
+ end