reviewkit 0.1.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 (85) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +23 -0
  3. data/CODE_OF_CONDUCT.md +123 -0
  4. data/CONTRIBUTING.md +44 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +335 -0
  7. data/Rakefile +7 -0
  8. data/SECURITY.md +18 -0
  9. data/app/assets/builds/reviewkit/application.css +2 -0
  10. data/app/assets/javascripts/reviewkit/application.js +12 -0
  11. data/app/assets/javascripts/reviewkit/controllers/file_nav_controller.js +24 -0
  12. data/app/assets/javascripts/reviewkit/controllers/review_index_controller.js +84 -0
  13. data/app/assets/tailwind/reviewkit/application.css +865 -0
  14. data/app/controllers/reviewkit/application_controller.rb +80 -0
  15. data/app/controllers/reviewkit/comments_controller.rb +147 -0
  16. data/app/controllers/reviewkit/review_threads_controller.rb +277 -0
  17. data/app/controllers/reviewkit/reviews_controller.rb +142 -0
  18. data/app/helpers/reviewkit/application_helper.rb +12 -0
  19. data/app/helpers/reviewkit/asset_helper.rb +39 -0
  20. data/app/helpers/reviewkit/diff_helper.rb +230 -0
  21. data/app/helpers/reviewkit/flash_helper.rb +36 -0
  22. data/app/helpers/reviewkit/frame_helper.rb +37 -0
  23. data/app/helpers/reviewkit/icon_helper.rb +107 -0
  24. data/app/helpers/reviewkit/review_thread_helper.rb +54 -0
  25. data/app/models/concerns/reviewkit/notifies_lifecycle_events.rb +39 -0
  26. data/app/models/reviewkit/application_record.rb +7 -0
  27. data/app/models/reviewkit/comment.rb +29 -0
  28. data/app/models/reviewkit/current.rb +7 -0
  29. data/app/models/reviewkit/document.rb +79 -0
  30. data/app/models/reviewkit/review.rb +66 -0
  31. data/app/models/reviewkit/review_thread.rb +75 -0
  32. data/app/services/reviewkit/diffs/intraline_budget.rb +40 -0
  33. data/app/services/reviewkit/diffs/intraline_diff.rb +220 -0
  34. data/app/services/reviewkit/diffs/split_diff.rb +112 -0
  35. data/app/services/reviewkit/reviews/create.rb +57 -0
  36. data/app/views/layouts/reviewkit/application.html.erb +15 -0
  37. data/app/views/reviewkit/comments/_comment.html.erb +53 -0
  38. data/app/views/reviewkit/comments/_edit_form.html.erb +26 -0
  39. data/app/views/reviewkit/comments/_form.html.erb +16 -0
  40. data/app/views/reviewkit/review_threads/_bucket.html.erb +53 -0
  41. data/app/views/reviewkit/review_threads/_bucket_frame.html.erb +13 -0
  42. data/app/views/reviewkit/review_threads/_bucket_row.html.erb +55 -0
  43. data/app/views/reviewkit/review_threads/_edit_form.html.erb +29 -0
  44. data/app/views/reviewkit/review_threads/_thread.html.erb +87 -0
  45. data/app/views/reviewkit/reviews/_document.html.erb +41 -0
  46. data/app/views/reviewkit/reviews/_document_split.html.erb +73 -0
  47. data/app/views/reviewkit/reviews/_document_unified.html.erb +57 -0
  48. data/app/views/reviewkit/reviews/_edit_form.html.erb +35 -0
  49. data/app/views/reviewkit/reviews/_index_content.html.erb +160 -0
  50. data/app/views/reviewkit/reviews/_review_sidebar.html.erb +70 -0
  51. data/app/views/reviewkit/reviews/_show_content.html.erb +164 -0
  52. data/app/views/reviewkit/reviews/index.html.erb +11 -0
  53. data/app/views/reviewkit/reviews/show.html.erb +11 -0
  54. data/app/views/reviewkit/shared/_flash.html.erb +10 -0
  55. data/bin/console +4 -0
  56. data/bin/lint +4 -0
  57. data/bin/rails +14 -0
  58. data/bin/setup +9 -0
  59. data/bin/test +4 -0
  60. data/config/importmap.rb +6 -0
  61. data/config/routes.rb +24 -0
  62. data/db/migrate/20260331181500_create_reviewkit_reviews.rb +19 -0
  63. data/db/migrate/20260331181600_create_reviewkit_documents.rb +23 -0
  64. data/db/migrate/20260331181700_create_reviewkit_review_threads.rb +23 -0
  65. data/db/migrate/20260331181800_create_reviewkit_comments.rb +15 -0
  66. data/db/migrate/20260401093000_add_description_to_reviewkit_reviews.rb +7 -0
  67. data/lib/generators/reviewkit/controllers/controllers_generator.rb +24 -0
  68. data/lib/generators/reviewkit/controllers/templates/comments_controller_extension.rb +13 -0
  69. data/lib/generators/reviewkit/controllers/templates/review_threads_controller_extension.rb +13 -0
  70. data/lib/generators/reviewkit/controllers/templates/reviews_controller_extension.rb +19 -0
  71. data/lib/generators/reviewkit/install/install_generator.rb +52 -0
  72. data/lib/generators/reviewkit/install/templates/importmap.rb +3 -0
  73. data/lib/generators/reviewkit/install/templates/reviewkit.rb +19 -0
  74. data/lib/generators/reviewkit/models/models_generator.rb +24 -0
  75. data/lib/generators/reviewkit/models/templates/comment_extension.rb +21 -0
  76. data/lib/generators/reviewkit/models/templates/review_extension.rb +22 -0
  77. data/lib/generators/reviewkit/models/templates/review_thread_extension.rb +21 -0
  78. data/lib/generators/reviewkit/views/views_generator.rb +15 -0
  79. data/lib/reviewkit/configuration.rb +33 -0
  80. data/lib/reviewkit/engine.rb +67 -0
  81. data/lib/reviewkit/version.rb +5 -0
  82. data/lib/reviewkit.rb +26 -0
  83. data/lib/tasks/reviewkit_tasks.rake +12 -0
  84. data/sig/reviewkit.rbs +129 -0
  85. metadata +238 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 60c611254e29010fc0ef3d4f6d9001ba303c9f35c1cfe8c3a023df0abe0a89cd
4
+ data.tar.gz: 6c2313db19efb6452a4875cb5458e2ad77b060fae880f9b9a3241bc63325da16
5
+ SHA512:
6
+ metadata.gz: 2815eb4a720089dfad2cbbb3bf0b0c4d646527452301a1852b3559e3cbb1b9f4dcc0e655eed03113e1da6d77b8afb657e2b6a85fdee2f52955f76646d1cefbb9
7
+ data.tar.gz: 5d64199562f2f080fd226fa80fde98327180cd450a418f4387722a7431344ef525197fec96eaa28750fbec15ce394a85239029c55959a785606edff17baa8ad0
data/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.1.0] - 2026-03-31
6
+
7
+ - Initial release of the `reviewkit` mountable Rails engine
8
+ - Added split diff rendering with syntax highlighting
9
+ - Added threaded line comments with resolve / reopen flows
10
+ - Added TailwindCSS and Turbo-powered shipped UI
11
+ - Added install and view-copy generators
12
+ - Added model and controller extension generators for host apps
13
+ - Added Launch-friendly metadata support on reviews, documents, threads, and comments
14
+ - Added RSpec, SimpleCov, RuboCop, and CI coverage
15
+ - Added a Rails-only asset workflow with no Node or npm requirement
16
+ - Reworked actor persistence to use Rails-native polymorphic associations instead of `*_gid` columns
17
+ - Replaced the custom hook DSL with standard Rails callbacks, `Reviewkit::Current`, and `ActiveSupport::Notifications`
18
+ - Added protected controller extension points for params, scopes, redirects, and flow behavior
19
+ - Added a RubyGems Trusted Publishing workflow and trimmed the released gem payload to engine runtime files only
20
+ - Added a public documentation site at `https://reviewkit.dhairyagabhawala.com`
21
+ - Added a contributor code of conduct and public release metadata cleanup
22
+ - Consolidated the RSpec engine dummy app under `spec/dummy` and removed generated placeholder mailer/job classes
23
+ - Narrowed the declared Rails dependency to the CI-verified `8.1` line
@@ -0,0 +1,123 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and maintainers pledge to make participation in
6
+ our community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes
24
+ - Focusing on what is best not just for us as individuals, but for the overall
25
+ community
26
+
27
+ Examples of unacceptable behavior include:
28
+
29
+ - The use of sexualized language or imagery, and sexual attention or
30
+ advances of any kind
31
+ - Trolling, insulting or derogatory comments, and personal or political attacks
32
+ - Public or private harassment
33
+ - Publishing others' private information, such as a physical or email
34
+ address, without their explicit permission
35
+ - Other conduct which could reasonably be considered inappropriate in a
36
+ professional setting
37
+
38
+ ## Enforcement Responsibilities
39
+
40
+ Community leaders are responsible for clarifying and enforcing our standards of
41
+ acceptable behavior and will take appropriate and fair corrective action in
42
+ response to any behavior that they deem inappropriate, threatening, offensive,
43
+ or harmful.
44
+
45
+ Community leaders have the right and responsibility to remove, edit, or reject
46
+ comments, commits, code, wiki edits, issues, and other contributions that are
47
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
48
+ decisions when appropriate.
49
+
50
+ ## Scope
51
+
52
+ This Code of Conduct applies within all community spaces, and also applies when
53
+ an individual is officially representing the community in public spaces.
54
+ Examples of representing our community include using an official email address,
55
+ posting via an official social media account, or acting as an appointed
56
+ representative at an online or offline event.
57
+
58
+ ## Enforcement
59
+
60
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
61
+ reported to the community leaders responsible for enforcement at
62
+ `gabhawaladhairya@gmail.com`.
63
+ All complaints will be reviewed and investigated promptly and fairly.
64
+
65
+ All community leaders are obligated to respect the privacy and security of the
66
+ reporter of any incident.
67
+
68
+ ## Enforcement Guidelines
69
+
70
+ Community leaders will follow these Community Impact Guidelines in determining
71
+ the consequences for any action they deem in violation of this Code of Conduct:
72
+
73
+ ### 1. Correction
74
+
75
+ **Community Impact**: Use of inappropriate language or other behavior deemed
76
+ unprofessional or unwelcome in the community.
77
+
78
+ **Consequence**: A private, written warning from community leaders, providing
79
+ clarity around the nature of the violation and an explanation of why the
80
+ behavior was inappropriate. A public apology may be requested.
81
+
82
+ ### 2. Warning
83
+
84
+ **Community Impact**: A violation through a single incident or series
85
+ of actions.
86
+
87
+ **Consequence**: A warning with consequences for continued behavior. No
88
+ interaction with the people involved, including unsolicited interaction with
89
+ those enforcing the Code of Conduct, for a specified period of time. This
90
+ includes avoiding interactions in community spaces as well as external channels
91
+ like social media. Violating these terms may lead to a temporary or
92
+ permanent ban.
93
+
94
+ ### 3. Temporary Ban
95
+
96
+ **Community Impact**: A serious violation of community standards, including
97
+ sustained inappropriate behavior.
98
+
99
+ **Consequence**: A temporary ban from any sort of interaction or public
100
+ communication with the community for a specified period of time. No public or
101
+ private interaction with the people involved, including unsolicited interaction
102
+ with those enforcing the Code of Conduct, is allowed during this period.
103
+ Violating these terms may lead to a permanent ban.
104
+
105
+ ### 4. Permanent Ban
106
+
107
+ **Community Impact**: Demonstrating a pattern of violation of community
108
+ standards, including sustained inappropriate behavior, harassment of an
109
+ individual, or aggression toward or disparagement of classes of individuals.
110
+
111
+ **Consequence**: A permanent ban from any sort of public interaction within
112
+ the community.
113
+
114
+ ## Attribution
115
+
116
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117
+ version 2.1, available at
118
+ https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
119
+
120
+ Community Impact Guidelines were inspired by
121
+ https://github.com/mozilla/diversity.
122
+
123
+ [homepage]: https://www.contributor-covenant.org
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,44 @@
1
+ # Contributing
2
+
3
+ Please review the [Code of Conduct](CODE_OF_CONDUCT.md) before participating.
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ bin/setup
9
+ ```
10
+
11
+ That will:
12
+
13
+ - install Ruby gems
14
+ - build the shipped frontend assets
15
+ - prepare the dummy app database
16
+
17
+ ## Development Workflow
18
+
19
+ - implement changes in the engine under `app/`, `lib/`, and `db/`
20
+ - use `spec/dummy` as the host application for manual verification
21
+ - keep shipped CSS up to date with `bundle exec rake reviewkit:build_assets` when frontend styling changes land
22
+
23
+ ## Verification
24
+
25
+ Before opening a pull request, run:
26
+
27
+ ```bash
28
+ bin/test
29
+ bin/lint
30
+ bundle exec bin/rails app:zeitwerk:check
31
+ bundle exec rake reviewkit:build_assets
32
+ ```
33
+
34
+ ## Scope Guidelines
35
+
36
+ - keep `Reviewkit` generic and host-app friendly
37
+ - store domain-specific context, such as Adobe Launch resource identifiers, in metadata instead of adding vendor-specific columns unless the engine truly needs them
38
+ - preserve the shipped UI as a polished default, even when adding override points for host applications
39
+
40
+ ## Pull Requests
41
+
42
+ - include tests for new behavior
43
+ - update documentation when public behavior changes
44
+ - add a changelog entry for user-visible changes
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright TODO: Write your name
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,335 @@
1
+ <p align="center">
2
+ <img src=".github/assets/reviewkit-icon.jpeg" alt="ReactorSDK" width="100">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="https://github.com/dhairyagabha/reviewkit/actions/workflows/ci.yml">
7
+ <img src="https://github.com/dhairyagabha/reviewkit/actions/workflows/ci.yml/badge.svg" alt="CI">
8
+ </a>
9
+ <a href="https://rubygems.org/gems/reviewkit">
10
+ <img src="https://img.shields.io/gem/v/reviewkit.svg" alt="RubyGems version">
11
+ </a>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://reviewkit.dhairyagabhawala.com">Documentation</a>
16
+ ·
17
+ <a href="https://reviewkit.dhairyagabhawala.com/examples/live-demo">See the demo</a>
18
+ ·
19
+ <a href="https://github.com/dhairyagabha/reviewkit/blob/main/CHANGELOG.md">Changelog</a>
20
+ ·
21
+ <a href="https://rubygems.org/gems/reviewkit">RubyGems</a>
22
+ ·
23
+ <a href="https://github.com/dhairyagabha/reviewkit">GitHub</a>
24
+ </p>
25
+
26
+ # Reviewkit
27
+
28
+ `reviewkit` is a mountable Rails engine for Git-like review workflows. It stores immutable review documents, renders split and unified diffs, supports threaded line comments, and ships a Rails-only UI built with Turbo, Stimulus, importmap, TailwindCSS, and Rouge.
29
+
30
+ The engine stays intentionally generic. Host applications bring their own review source, metadata, permissions, and workflow logic while Reviewkit handles the review surface itself.
31
+
32
+ ## Features
33
+
34
+ - Split and unified diff rendering for virtual files or real files
35
+ - Threaded line comments with resolve, reopen, and outdated states
36
+ - Immutable review snapshots built from host-provided content
37
+ - Searchable review index and Git-style file review UI
38
+ - Turbo Frame embedding and Turbo Stream updates
39
+ - Rails-only frontend runtime with no Node requirement
40
+ - JSON metadata on reviews, documents, threads, and comments
41
+ - Rails-native extension via generated model and controller concerns
42
+ - `ActiveSupport::Notifications` events for lifecycle and status changes
43
+
44
+ ## Requirements
45
+
46
+ - Ruby `>= 3.2.0`
47
+ - Rails `>= 8.1.2`, `< 8.2`
48
+
49
+ CI currently verifies Ruby `3.2`, `3.3`, `3.4`, and `4.0` against the Rails `8.1` line, so the published dependency matches that support window.
50
+
51
+ ## Installation
52
+
53
+ Add the gem to your Rails app:
54
+
55
+ ```ruby
56
+ gem "reviewkit"
57
+ ```
58
+
59
+ Then install it:
60
+
61
+ ```bash
62
+ bundle install
63
+ bin/rails generate reviewkit:install
64
+ bin/rails db:migrate
65
+ ```
66
+
67
+ The installer:
68
+
69
+ - copies `config/initializers/reviewkit.rb`
70
+ - mounts `Reviewkit::Engine` unless disabled
71
+ - installs the engine migrations into the host app
72
+ - creates a minimal `config/importmap.rb` when one does not exist
73
+
74
+ By default the engine mounts at `/reviewkit`:
75
+
76
+ ```ruby
77
+ mount Reviewkit::Engine => "/reviewkit"
78
+ ```
79
+
80
+ If you want local copies of the shipped UI templates:
81
+
82
+ ```bash
83
+ bin/rails generate reviewkit:views
84
+ ```
85
+
86
+ ## Create a Review
87
+
88
+ Host applications provide immutable review documents. The main entry point is `Reviewkit::Reviews::Create`.
89
+
90
+ ```ruby
91
+ review = Reviewkit::Reviews::Create.call(
92
+ title: "Checkout submission hardening",
93
+ description: "Review the guard clauses and status changes before merge.",
94
+ creator: current_user,
95
+ external_reference: "PR-42",
96
+ status: "open",
97
+ metadata: {
98
+ branch: "feature/checkout-guard",
99
+ base_branch: "main",
100
+ commit_sha: "9f3c1d2"
101
+ },
102
+ review_attributes: {
103
+ review_type: "code"
104
+ },
105
+ documents: [
106
+ {
107
+ path: "app/services/checkouts/submit_order.rb",
108
+ language: "ruby",
109
+ old_content: "def call(order)\n order.submit!\nend\n",
110
+ new_content: "def call(order)\n return false unless order.ready?\n\n order.submit!\nend\n",
111
+ metadata: {
112
+ resource_id: "submit_order",
113
+ revision_id: "9f3c1d2",
114
+ base_revision_id: "8b21e6a"
115
+ }
116
+ }
117
+ ]
118
+ )
119
+ ```
120
+
121
+ Once created, the mounted UI is available at:
122
+
123
+ ```text
124
+ /reviewkit/reviews/:id
125
+ ```
126
+
127
+ ## Configuration
128
+
129
+ Reviewkit keeps configuration deliberately small:
130
+
131
+ ```ruby
132
+ Reviewkit.configure do |config|
133
+ config.current_actor = lambda do |controller|
134
+ controller.respond_to?(:current_user, true) ? controller.send(:current_user) : nil
135
+ end
136
+
137
+ config.authorize_action = lambda do |_controller, action, record = nil, **_context|
138
+ true
139
+ end
140
+
141
+ config.layout = "reviewkit/application"
142
+ config.intraline_limits.max_review_files = 50
143
+ config.intraline_limits.max_changed_lines = 50
144
+ config.intraline_limits.max_line_length = 500
145
+ end
146
+ ```
147
+
148
+ The most important knobs are:
149
+
150
+ - `config.current_actor` for comments, thread resolution, and notification context
151
+ - `config.authorize_action` for engine permissions
152
+ - `config.layout` for full-page rendering
153
+ - `config.intraline_limits` for conservative intraline diff budgets on large reviews
154
+
155
+ ## RBS Signatures
156
+
157
+ Reviewkit ships RBS for the public engine surface in [`sig/reviewkit.rbs`](sig/reviewkit.rbs).
158
+
159
+ The signatures cover:
160
+
161
+ - `Reviewkit.configure` and `Reviewkit.config`
162
+ - `Reviewkit::Configuration` and `Reviewkit::Configuration::IntralineLimits`
163
+ - `Reviewkit::Current`
164
+ - `Reviewkit::Reviews::Create`
165
+ - the core review records' public workflow helpers
166
+
167
+ ## Records and Workflow
168
+
169
+ Reviewkit ships four core records:
170
+
171
+ - `Reviewkit::Review`
172
+ - `Reviewkit::Document`
173
+ - `Reviewkit::ReviewThread`
174
+ - `Reviewkit::Comment`
175
+
176
+ Review statuses:
177
+
178
+ - `draft`
179
+ - `open`
180
+ - `approved`
181
+ - `rejected`
182
+ - `closed`
183
+
184
+ Document statuses:
185
+
186
+ - `added`
187
+ - `removed`
188
+ - `modified`
189
+ - `unchanged`
190
+
191
+ Thread statuses:
192
+
193
+ - `open`
194
+ - `resolved`
195
+ - `outdated`
196
+
197
+ ## Extend It the Rails Way
198
+
199
+ Reviewkit is designed to be extended with normal Rails patterns:
200
+
201
+ - use Active Record callbacks in host-side model concerns
202
+ - override protected controller methods in host-side controller concerns
203
+ - copy views only when you need UI changes
204
+ - keep domain-specific fields in host migrations and JSON metadata
205
+
206
+ Generate host-side extension concerns:
207
+
208
+ ```bash
209
+ bin/rails generate reviewkit:models
210
+ bin/rails generate reviewkit:controllers
211
+ ```
212
+
213
+ After adding a host column like `review_type`, extend the engine through those concerns instead of forking the engine.
214
+
215
+ Keep host extensions in the normal Rails autoloaded concern paths:
216
+
217
+ - `app/models/concerns/reviewkit`
218
+ - `app/controllers/concerns/reviewkit`
219
+
220
+ The engine's `to_prepare` hooks look up those constants by name, so keeping them in the generated concern paths avoids manual requires and keeps development reloading clean.
221
+
222
+ Example controller extension:
223
+
224
+ ```ruby
225
+ module Reviewkit
226
+ module ReviewsControllerExtension
227
+ protected
228
+
229
+ def permitted_review_attributes
230
+ super + %i[review_type]
231
+ end
232
+ end
233
+ end
234
+ ```
235
+
236
+ ## Embed Reviews in Turbo Frames
237
+
238
+ Reviewkit review pages can be embedded inside host layouts with Turbo Frames:
239
+
240
+ ```erb
241
+ <%= turbo_frame_tag "reviewkit_review", src: reviewkit.review_path(review) %>
242
+ ```
243
+
244
+ Frame requests:
245
+
246
+ - skip the full-page engine layout
247
+ - keep inline comment, reply, and thread state updates working
248
+ - preserve Turbo-driven document switching
249
+
250
+ ## Metadata
251
+
252
+ Reviewkit intentionally keeps integration context in JSON metadata rather than dedicated vendor-specific columns.
253
+
254
+ Typical examples:
255
+
256
+ ```ruby
257
+ review.metadata = {
258
+ branch: "feature/checkout-guard",
259
+ base_branch: "main"
260
+ }
261
+
262
+ document.metadata = {
263
+ resource_id: "submit_order",
264
+ revision_id: "9f3c1d2"
265
+ }
266
+
267
+ thread.metadata = {
268
+ resource_id: "submit_order",
269
+ side: "new"
270
+ }
271
+ ```
272
+
273
+ ## Notifications
274
+
275
+ Reviewkit emits observational `ActiveSupport::Notifications` events for review, thread, and comment lifecycle/status changes.
276
+
277
+ These are useful for:
278
+
279
+ - analytics
280
+ - auditing
281
+ - background workflows
282
+
283
+ Host applications should still prefer normal Rails callbacks for domain behavior attached to their own model extensions.
284
+
285
+ ## Documentation
286
+
287
+ Full guides, live demos, API details, extension examples, and troubleshooting are available at:
288
+
289
+ - https://reviewkit.dhairyagabhawala.com
290
+
291
+ Recommended starting points:
292
+
293
+ - https://reviewkit.dhairyagabhawala.com/docs/installation
294
+ - https://reviewkit.dhairyagabhawala.com/docs/quick-start
295
+ - https://reviewkit.dhairyagabhawala.com/docs/host-integration
296
+ - https://reviewkit.dhairyagabhawala.com/examples/live-demo
297
+
298
+ ## Development
299
+
300
+ ```bash
301
+ bin/setup
302
+ bin/test
303
+ bin/lint
304
+ bundle exec bin/rails app:zeitwerk:check
305
+ bundle exec rake reviewkit:build_assets
306
+ ```
307
+
308
+ The dummy host app used for engine verification lives under `spec/dummy`.
309
+
310
+ ## Release Workflow
311
+
312
+ Reviewkit is prepared for RubyGems Trusted Publishing with GitHub Actions.
313
+
314
+ Before the first public release:
315
+
316
+ 1. Create the gem on RubyGems.org.
317
+ 2. Add this repository as a trusted publisher for the gem.
318
+ 3. Create a protected `release` environment in GitHub if you want an approval gate before publish.
319
+
320
+ After that, publish by pushing a SemVer tag:
321
+
322
+ ```bash
323
+ git tag v0.1.0
324
+ git push origin v0.1.0
325
+ ```
326
+
327
+ ## Contributing
328
+
329
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development and contribution guidelines.
330
+
331
+ Please follow the [Code of Conduct](CODE_OF_CONDUCT.md) when participating in issues, discussions, and pull requests.
332
+
333
+ ## License
334
+
335
+ The gem is available as open source under the terms of the [MIT License](MIT-LICENSE).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+ load File.expand_path("lib/tasks/reviewkit_tasks.rake", __dir__)
6
+
7
+ require "bundler/gem_tasks"
data/SECURITY.md ADDED
@@ -0,0 +1,18 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a Vulnerability
4
+
5
+ Please do not open public GitHub issues for security-sensitive problems.
6
+
7
+ Instead, report vulnerabilities privately to:
8
+
9
+ - `gabhawaladhairya@gmail.com`
10
+
11
+ When reporting an issue, include:
12
+
13
+ - a clear description of the problem
14
+ - affected versions or commit ranges if known
15
+ - reproduction steps or proof of concept if possible
16
+ - impact assessment
17
+
18
+ We will acknowledge reports as quickly as possible and work with you on coordinated disclosure.