shakapacker 9.6.0 → 9.6.1
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/.claude/commands/address-review.md +153 -0
- data/CHANGELOG.md +12 -1
- data/README.md +2 -0
- data/docs/node_package_api.md +71 -0
- data/docs/releasing.md +2 -1
- data/lib/shakapacker/env.rb +17 -3
- data/lib/shakapacker/version.rb +1 -1
- data/package.json +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab1c412375101856684b59c852ff2fefc594d51ec5fc2ce152e3114db96a88a2
|
|
4
|
+
data.tar.gz: c9755e1c089d5c93277ae38c7764518d03807496cbdb8f9e9c616e6a4ae2e9f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 713f0fb0b2252407071faedfe5d88769f193130f43a8876d222da61b730291a067610b60be06954f3194889a6354b4f3184da0cbb6ee6670b355b61017332d12
|
|
7
|
+
data.tar.gz: 7daa5bc48e9c82d394716acc4e4cb8bc2611d83d03f2d0b3ccff385e7255c883767b9daf23c9437dcf8ffc1ec8778bbcfe2be6d0fac89762ac043af05ad68178
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Fetch GitHub PR review comments and create todos to address them
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Fetch review comments from a GitHub PR in this repository and create a todo list to address each comment.
|
|
6
|
+
|
|
7
|
+
# Instructions
|
|
8
|
+
|
|
9
|
+
## Step 1: Determine the Repository
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If this command fails, ensure `gh` CLI is installed and authenticated (`gh auth status`).
|
|
16
|
+
|
|
17
|
+
## Step 2: Parse User Input
|
|
18
|
+
|
|
19
|
+
Extract the PR number and optional review/comment ID from the user's message:
|
|
20
|
+
|
|
21
|
+
**Supported formats:**
|
|
22
|
+
|
|
23
|
+
- PR number only: `12345`
|
|
24
|
+
- PR URL: `https://github.com/org/repo/pull/12345`
|
|
25
|
+
- Specific PR review: `https://github.com/org/repo/pull/12345#pullrequestreview-123456789`
|
|
26
|
+
- Specific issue comment: `https://github.com/org/repo/pull/12345#issuecomment-123456789`
|
|
27
|
+
|
|
28
|
+
**URL parsing:**
|
|
29
|
+
|
|
30
|
+
- Extract org/repo from URL path: `github.com/{org}/{repo}/pull/{PR_NUMBER}`
|
|
31
|
+
- Extract fragment ID after `#` (e.g., `pullrequestreview-123456789` → `123456789`)
|
|
32
|
+
- If a full GitHub URL is provided, use the org/repo from the URL instead of the current repo
|
|
33
|
+
|
|
34
|
+
## Step 3: Fetch Review Comments
|
|
35
|
+
|
|
36
|
+
**If a specific issue comment ID is provided (`#issuecomment-...`):**
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
gh api repos/${REPO}/issues/comments/{COMMENT_ID} | jq '{body: .body, user: .user.login, html_url: .html_url}'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**If a specific review ID is provided (`#pullrequestreview-...`):**
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
gh api repos/${REPO}/pulls/{PR_NUMBER}/reviews/{REVIEW_ID}/comments | jq '[.[] | {id: .id, path: .path, body: .body, line: .line, start_line: .start_line, user: .user.login}]'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**If only PR number is provided (fetch all PR review comments):**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
gh api repos/${REPO}/pulls/{PR_NUMBER}/comments | jq '[.[] | {id: .id, path: .path, body: .body, line: .line, start_line: .start_line, user: .user.login, in_reply_to_id: .in_reply_to_id}]'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Filtering comments:**
|
|
55
|
+
|
|
56
|
+
- Skip comments where `in_reply_to_id` is set (these are replies, not top-level comments)
|
|
57
|
+
- Skip bot-generated comments (check if `user` ends with `[bot]`)
|
|
58
|
+
- Focus on actionable feedback, not acknowledgments or thank-you messages
|
|
59
|
+
|
|
60
|
+
**Error handling:**
|
|
61
|
+
|
|
62
|
+
- If the API returns 404, the PR/comment doesn't exist - inform the user
|
|
63
|
+
- If the API returns 403, check authentication with `gh auth status`
|
|
64
|
+
- If the response is empty, inform the user no review comments were found
|
|
65
|
+
|
|
66
|
+
## Step 4: Create Todo List
|
|
67
|
+
|
|
68
|
+
Parse the response and create a todo list with TodoWrite containing:
|
|
69
|
+
|
|
70
|
+
- One todo per actionable review comment/suggestion
|
|
71
|
+
- For file-specific comments: `"{file}:{line} - {comment_summary} (@{username})"` (content)
|
|
72
|
+
- For general comments: Parse the comment body and extract actionable items
|
|
73
|
+
- Format activeForm: `"Addressing {brief description}"`
|
|
74
|
+
- All todos should start with status: `"pending"`
|
|
75
|
+
|
|
76
|
+
## Step 5: Present to User
|
|
77
|
+
|
|
78
|
+
Present the todos to the user - **DO NOT automatically start addressing them**:
|
|
79
|
+
|
|
80
|
+
- Show a summary of how many actionable items were found
|
|
81
|
+
- List the todos clearly
|
|
82
|
+
- Wait for the user to tell you which ones to address
|
|
83
|
+
|
|
84
|
+
## Step 6: Address Items and Reply
|
|
85
|
+
|
|
86
|
+
When addressing items, after completing each todo item, reply to the original review comment explaining how it was addressed.
|
|
87
|
+
|
|
88
|
+
**For issue comments (general PR comments):**
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
gh api repos/${REPO}/issues/{PR_NUMBER}/comments -X POST -f body="<response>"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**For PR review comments (file-specific, replying to a thread):**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
gh api repos/${REPO}/pulls/{PR_NUMBER}/comments/{COMMENT_ID}/replies -X POST -f body="<response>"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**For standalone review comments (not in a thread):**
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
gh api repos/${REPO}/pulls/{PR_NUMBER}/comments -X POST -f body="<response>" -f commit_id="<COMMIT_SHA>" -f path="<FILE_PATH>" -f line=<LINE_NUMBER> -f side="RIGHT"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Note: `side` is required when using `line`. Use `"RIGHT"` for the PR commit side (most common) or `"LEFT"` for the base commit side.
|
|
107
|
+
|
|
108
|
+
The response should briefly explain:
|
|
109
|
+
|
|
110
|
+
- What was changed
|
|
111
|
+
- Which commit(s) contain the fix
|
|
112
|
+
- Any relevant details or decisions made
|
|
113
|
+
|
|
114
|
+
# Example Usage
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
/address-review https://github.com/org/repo/pull/12345#pullrequestreview-123456789
|
|
118
|
+
/address-review https://github.com/org/repo/pull/12345#issuecomment-123456789
|
|
119
|
+
/address-review 12345
|
|
120
|
+
/address-review https://github.com/org/repo/pull/12345
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
# Example Output
|
|
124
|
+
|
|
125
|
+
After fetching comments, present them like this:
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
Found 3 actionable review comments:
|
|
129
|
+
|
|
130
|
+
1. ⬜ src/helper.rb:45 - Add error handling for nil case (@reviewer1)
|
|
131
|
+
2. ⬜ src/config.rb:12 - Consider using constant instead of magic number (@reviewer1)
|
|
132
|
+
3. ⬜ General comment - Update documentation to reflect API changes (@reviewer2)
|
|
133
|
+
|
|
134
|
+
Which items would you like me to address? (e.g., "all", "1,2", or "1")
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
# Important Notes
|
|
138
|
+
|
|
139
|
+
- Automatically detect the repository using `gh repo view` for the current working directory
|
|
140
|
+
- If a GitHub URL is provided, extract the org/repo from the URL
|
|
141
|
+
- Include file path and line number in each todo for easy navigation (when available)
|
|
142
|
+
- Include the reviewer's username in the todo text
|
|
143
|
+
- If a comment doesn't have a specific line number, note it as "general comment"
|
|
144
|
+
- **NEVER automatically address all review comments** - always wait for user direction
|
|
145
|
+
- When given a specific review URL, no need to ask for more information
|
|
146
|
+
- **ALWAYS reply to comments after addressing them** to close the feedback loop
|
|
147
|
+
- For large review comments (like detailed code reviews), parse and extract the actionable items into separate todos
|
|
148
|
+
|
|
149
|
+
# Known Limitations
|
|
150
|
+
|
|
151
|
+
- Rate limiting: GitHub API has rate limits; if you hit them, wait a few minutes
|
|
152
|
+
- Private repos: Requires appropriate `gh` authentication scope
|
|
153
|
+
- Large PRs: PRs with many comments may require pagination (not currently handled)
|
data/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,16 @@
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [v9.6.1] - March 8, 2026
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- **Fixed `Env#current` crashing when Rails is not loaded**. [PR #963](https://github.com/shakacode/shakapacker/pull/963) by [ihabadham](https://github.com/ihabadham). Added `defined?(Rails)` guard to `Shakapacker::Env#current` so it falls back to `RAILS_ENV`/`RACK_ENV` environment variables when called from non-Rails Ruby processes (e.g., `bin/dev` scripts). Previously, this would raise a `NameError` and silently fall back to `"production"`.
|
|
17
|
+
|
|
18
|
+
### Documentation
|
|
19
|
+
|
|
20
|
+
- **Added Node package API documentation**. [PR #900](https://github.com/shakacode/shakapacker/pull/900) by [justin808](https://github.com/justin808). New guide (`docs/node_package_api.md`) documenting the JavaScript API exports, configuration objects, import entrypoints for webpack and rspack, and built-in third-party support resources.
|
|
21
|
+
|
|
12
22
|
## [v9.6.0] - March 7, 2026
|
|
13
23
|
|
|
14
24
|
### Security
|
|
@@ -866,7 +876,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
|
|
|
866
876
|
|
|
867
877
|
See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
|
|
868
878
|
|
|
869
|
-
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.6.
|
|
879
|
+
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.6.1...main
|
|
880
|
+
[v9.6.1]: https://github.com/shakacode/shakapacker/compare/v9.6.0...v9.6.1
|
|
870
881
|
[v9.6.0]: https://github.com/shakacode/shakapacker/compare/v9.5.0...v9.6.0
|
|
871
882
|
[v9.5.0]: https://github.com/shakacode/shakapacker/compare/v9.4.0...v9.5.0
|
|
872
883
|
[v9.4.0]: https://github.com/shakacode/shakapacker/compare/v9.3.4...v9.4.0
|
data/README.md
CHANGED
|
@@ -317,6 +317,8 @@ At its core, Shakapacker's essential function is to:
|
|
|
317
317
|
|
|
318
318
|
**📖 For a comprehensive guide to all configuration options, see the [Configuration Guide](./docs/configuration.md)**
|
|
319
319
|
|
|
320
|
+
**📦 For Node package exports and config object docs, see the [Node Package API Guide](./docs/node_package_api.md)**
|
|
321
|
+
|
|
320
322
|
This includes documentation for:
|
|
321
323
|
|
|
322
324
|
- All `config/shakapacker.yml` options (including `assets_bundler_config_path`)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Node Package API
|
|
2
|
+
|
|
3
|
+
Shakapacker ships a Node package that exposes configuration and helper utilities
|
|
4
|
+
for both webpack and rspack.
|
|
5
|
+
|
|
6
|
+
## Import Paths
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
// Webpack entrypoint
|
|
10
|
+
const shakapacker = require("shakapacker")
|
|
11
|
+
|
|
12
|
+
// Rspack entrypoint
|
|
13
|
+
const rspack = require("shakapacker/rspack")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Webpack Exports (`shakapacker`)
|
|
17
|
+
|
|
18
|
+
| Export | Type | Description |
|
|
19
|
+
|--------|------|-------------|
|
|
20
|
+
| `config` | object | Parsed `config/shakapacker.yml` plus computed fields |
|
|
21
|
+
| `devServer` | object | Dev server configuration |
|
|
22
|
+
| `generateWebpackConfig(extraConfig?)` | function | Generates final webpack config and merges optional overrides |
|
|
23
|
+
| `baseConfig` | object | Base config object from `package/environments/base` |
|
|
24
|
+
| `env` | object | Environment metadata (`railsEnv`, `nodeEnv`, booleans) |
|
|
25
|
+
| `rules` | array | Loader rules for current bundler |
|
|
26
|
+
| `moduleExists(name)` | function | Returns whether module can be resolved |
|
|
27
|
+
| `canProcess(rule, fn)` | function | Runs callback only if loader dependency is available |
|
|
28
|
+
| `inliningCss` | boolean | Whether CSS should be inlined in current dev-server mode |
|
|
29
|
+
| `merge`, `mergeWithCustomize`, `mergeWithRules`, `unique` | functions | Re-exported from `webpack-merge` |
|
|
30
|
+
|
|
31
|
+
## Rspack Exports (`shakapacker/rspack`)
|
|
32
|
+
|
|
33
|
+
| Export | Type | Description |
|
|
34
|
+
|--------|------|-------------|
|
|
35
|
+
| `config` | object | Parsed `config/shakapacker.yml` plus computed fields |
|
|
36
|
+
| `devServer` | object | Dev server configuration |
|
|
37
|
+
| `generateRspackConfig(extraConfig?)` | function | Generates final rspack config and merges optional overrides |
|
|
38
|
+
| `baseConfig` | object | Base config object |
|
|
39
|
+
| `env` | object | Environment metadata (`railsEnv`, `nodeEnv`, booleans) |
|
|
40
|
+
| `rules` | array | Rspack loader rules |
|
|
41
|
+
| `moduleExists(name)` | function | Returns whether module can be resolved |
|
|
42
|
+
| `canProcess(rule, fn)` | function | Runs callback only if loader dependency is available |
|
|
43
|
+
| `inliningCss` | boolean | Whether CSS should be inlined in current dev-server mode |
|
|
44
|
+
| `merge`, `mergeWithCustomize`, `mergeWithRules`, `unique` | functions | Re-exported from `webpack-merge` |
|
|
45
|
+
|
|
46
|
+
## `config` Object
|
|
47
|
+
|
|
48
|
+
`config` includes:
|
|
49
|
+
|
|
50
|
+
- Raw values from `config/shakapacker.yml` (`source_path`, `public_output_path`, `javascript_transpiler`, etc.)
|
|
51
|
+
- Computed absolute paths (`outputPath`, `publicPath`, `manifestPath`, `publicPathWithoutCDN`)
|
|
52
|
+
- Optional sections like `dev_server` and `integrity`
|
|
53
|
+
|
|
54
|
+
For the full key list and types, see:
|
|
55
|
+
|
|
56
|
+
- [`package/types.ts`](../package/types.ts)
|
|
57
|
+
- [Configuration Guide](./configuration.md)
|
|
58
|
+
|
|
59
|
+
## Built-in Third-Party Support
|
|
60
|
+
|
|
61
|
+
Installer defaults include support for:
|
|
62
|
+
|
|
63
|
+
- Bundlers: webpack, rspack
|
|
64
|
+
- JavaScript transpilers: SWC (default), Babel, esbuild
|
|
65
|
+
- Common style/tooling loaders: css, sass, less, stylus, file/raw rules
|
|
66
|
+
- Common optimization/plugins for webpack/rspack production builds
|
|
67
|
+
|
|
68
|
+
Dependency presets used by the installer are defined in:
|
|
69
|
+
|
|
70
|
+
- [`lib/install/package.json`](../lib/install/package.json)
|
|
71
|
+
|
data/docs/releasing.md
CHANGED
|
@@ -108,7 +108,8 @@ The `create_release` task automatically:
|
|
|
108
108
|
- Prompts for RubyGems OTP (2FA code)
|
|
109
109
|
6. **Updates spec/dummy lockfiles:**
|
|
110
110
|
- Runs `bundle install` to update `Gemfile.lock`
|
|
111
|
-
- Runs `
|
|
111
|
+
- Runs `yarn install` to refresh the Yarn-managed dummy app lockfile
|
|
112
|
+
- Runs `npm install` to keep `package-lock.json` in sync for npm compatibility/testing
|
|
112
113
|
7. **Commits and pushes lockfile changes** automatically
|
|
113
114
|
8. **Creates GitHub release** from CHANGELOG.md (if the matching section exists)
|
|
114
115
|
|
data/lib/shakapacker/env.rb
CHANGED
|
@@ -13,16 +13,30 @@ class Shakapacker::Env
|
|
|
13
13
|
|
|
14
14
|
def inquire
|
|
15
15
|
fallback_env_warning if config_path.exist? && !current
|
|
16
|
-
current || FALLBACK_ENV.inquiry
|
|
16
|
+
(current || FALLBACK_ENV).inquiry
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
private
|
|
20
20
|
def current
|
|
21
|
-
Rails.env
|
|
21
|
+
env = if defined?(Rails) && Rails.respond_to?(:env)
|
|
22
|
+
Rails.env
|
|
23
|
+
else
|
|
24
|
+
ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || Shakapacker::DEFAULT_ENV
|
|
25
|
+
end
|
|
26
|
+
env.presence_in(available_environments)
|
|
22
27
|
end
|
|
23
28
|
|
|
24
29
|
def fallback_env_warning
|
|
25
|
-
|
|
30
|
+
env_value = if defined?(Rails) && Rails.respond_to?(:env)
|
|
31
|
+
Rails.env
|
|
32
|
+
else
|
|
33
|
+
ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || Shakapacker::DEFAULT_ENV
|
|
34
|
+
end
|
|
35
|
+
logger.info "RAILS_ENV=#{env_value} environment is not defined in #{config_path}, falling back to #{FALLBACK_ENV} environment"
|
|
36
|
+
rescue NameError, NoMethodError
|
|
37
|
+
# Logger may not be fully functional without Rails (e.g., ActiveSupport::IsolatedExecutionState
|
|
38
|
+
# is not available). Fall back to puts, matching Configuration#log_fallback.
|
|
39
|
+
puts "RAILS_ENV=#{env_value} environment is not defined in #{config_path}, falling back to #{FALLBACK_ENV} environment"
|
|
26
40
|
end
|
|
27
41
|
|
|
28
42
|
def available_environments
|
data/lib/shakapacker/version.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shakapacker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 9.6.
|
|
4
|
+
version: 9.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -145,6 +145,7 @@ executables: []
|
|
|
145
145
|
extensions: []
|
|
146
146
|
extra_rdoc_files: []
|
|
147
147
|
files:
|
|
148
|
+
- ".claude/commands/address-review.md"
|
|
148
149
|
- ".claude/commands/update-changelog.md"
|
|
149
150
|
- ".github/FUNDING.yml"
|
|
150
151
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
|
@@ -198,6 +199,7 @@ files:
|
|
|
198
199
|
- docs/early_hints.md
|
|
199
200
|
- docs/early_hints_manual_api.md
|
|
200
201
|
- docs/feature_testing.md
|
|
202
|
+
- docs/node_package_api.md
|
|
201
203
|
- docs/optional-peer-dependencies.md
|
|
202
204
|
- docs/peer-dependencies.md
|
|
203
205
|
- docs/precompile_hook.md
|
|
@@ -426,7 +428,7 @@ homepage: https://github.com/shakacode/shakapacker
|
|
|
426
428
|
licenses:
|
|
427
429
|
- MIT
|
|
428
430
|
metadata:
|
|
429
|
-
source_code_uri: https://github.com/shakacode/shakapacker/tree/v9.6.
|
|
431
|
+
source_code_uri: https://github.com/shakacode/shakapacker/tree/v9.6.1
|
|
430
432
|
rdoc_options: []
|
|
431
433
|
require_paths:
|
|
432
434
|
- lib
|