You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow the Installed Package's Own Install Scripts on Every npm Install - #4268
From npm 12 on, now npm's latest, a global install skips a package's install scripts unless the allow-scripts config names that package. @opencode/cli and @anthropic-ai/claude-code each carry a postinstall. Without it the install still exits 0, so the installer reports a clean step, but opencode then refuses to start.
Each npm install the agent installers run names the one package it installs, as npm install -g --allow-scripts=<pkg> <pkg>@latest. That covers:
the Linux package_step upgrade
the Windows Get-PackageStep upgrade, through a new Get-NpmInstallArgument helper
the Windows managed opencode install and its Source string
The flag allows that package's scripts for that one run and writes no user config. bun installs are unchanged. The help texts and docs/host-setup.md say the npm install allows the one package's scripts.
The open points the issue raised
Older npm: the flag is harmless. Measured against the real @opencode/cli from the registry in throwaway prefixes, npm 12.2.3, 11.21.3, 10.9.11 and 9.9.4 each install a working opencode v2.3.2 with no warning. Without the flag, npm 12.2.3 prints had install scripts blocked, and opencode --version fails with @opencode/cli's postinstall script was not run.
npm 11's warning: under npm 11.19 to 11.21 the install-scripts warning is advisory, and the scripts still run. The skipped-script symptom is npm 12's.
Surfacing a remaining warning: not added. With the flag, the installed package's own scripts run and npm prints nothing. A transitive dependency's warning still reaches the step's output as npm prints it.
Dry run and remedies:[dry run], running: and every run: remedy print the full command, flag included, since each one is built from the same arguments.
Verification
tests/test_install_agents.py: the npm command expectations carry the flag, on both platforms, while the bun ones do not. 128 tests OK (1 skipped). test_cli_usage.py, test_bootstrap.py and test_host_gate.py pass, as do spec/validate.py, shellcheck, shfmt, PSScriptAnalyzer and the prose gate.
Native Linux: an npm-owned codex sat in a throwaway global prefix first on PATH. install-agents.sh --upgrade --yes codex ran npm install -g --allow-scripts=@openai/codex @openai/codex@latest and moved it from 0.169.1 to 0.170.0. A second run printed Nothing changed.
Windows is not verified natively. The tests run the .ps1 whole under pwsh on Linux against stub tools. On a Windows host with an npm-owned opencode, run host-setup\windows\install-agents.ps1 -Upgrade -DryRun opencode. Expect npm install -g --allow-scripts=@opencode/cli @opencode/cli@latest. Then run -Upgrade opencode, and expect opencode --version to answer with no install-scripts warning printed.
Local passes
Two recorded passes. The first raised four introduced findings, all fixed in af7b03b:
a Linux comment naming opencode, which never upgrades through npm there
the latest-tag rationale split away from the npm branch
two help sentences over the length cap
The second pass was clean.
The comments label covers the new comment lines. Each states why the flag is there, a reason the code cannot carry.
npm-managed agent installs and upgrades now allow the selected package’s install scripts to run, including when upgrading to the latest version. This also applies to OpenCode installs on Windows.
Documentation
Updated setup guidance and command help to describe npm’s install-script behavior and the latest-tag install behavior.
From npm 12 on, a global install skips a package's install scripts unless
allow-scripts names it. opencode's postinstall is then never run: the install
exits 0, the installer reports a clean step, and `opencode --version` fails
with "@opencode/cli's postinstall script was not run". claude-code carries a
postinstall too.
Each npm install the agent installers run now names the one package it
installs, `npm install -g --allow-scripts=<pkg> <pkg>@latest`: the Linux
and Windows upgrade steps and the Windows managed opencode install. It allows
that package's scripts for that run and writes no user config. bun's install
is unchanged.
Measured against the real @opencode/cli in throwaway prefixes: without the
flag npm 12.2.3 blocks the postinstall and the binary refuses to run. With
it, npm 12.2.3, 11.21.3, 10.9.11 and 9.9.4 each install a working binary
with no warning.
Closes#4264
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ntences
The Linux npm branch names claude-code, since opencode never upgrades through
npm there, and the latest-tag rationale again covers npm and bun alike. Each
help text states the npm allowance as its own sentence.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A recorded local strict-review pass covers head af7b03b01e57ae3c7051c0b6bbabcd7ade8c0b16, the content this pull request carries at that commit against develop, and it recorded 0 findings.
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Linux and Windows agent installers now pass package-scoped --allow-scripts arguments to npm installs or upgrades. The Windows OpenCode install uses the shared argument builder. Documentation, help text, and tests reflect the command changes. Bun commands and removal commands remain unchanged.
Linux npm upgrades now include --allow-scripts for the selected package. Windows npm upgrades and the OpenCode install use a shared argument builder to allow scripts for the specified package. Help text and setup documentation describe the behavior.
ptr727/ProjectTemplate#4095: Updates Linux and Windows agent upgrade paths that this change modifies to add the npm allowance.
ptr727/ProjectTemplate#4096: Promotes changes that include the npm upgrade command paths modified by this PR.
Merge Risk: Minimal · previous review af7b0
The change lets npm run install scripts only for the package being installed or upgraded by the agent installers, with docs and tests updated to match. No concrete merge-blocking risk was found. Windows behavior was tested only with stub tools on Linux, so a dry-run on a Windows host is a reasonable final check.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "Allow the Installed Package's Own Install Scripts on Every npm Install" matches the main change. The PR adds a package-scoped --allow-scripts=<package> flag to npm install and upgrade com…
Linked Issues check
Directly linked issue #4264 asks for a package-scoped --allow-scripts on each npm install or upgrade the agent installers run. The raw summary places the flag on the Linux package_step upgrade, the Wi…
Out of Scope Changes check
The changes described are the npm install argument change on Linux and Windows, the shared Windows argument helper, help text in both installers, docs/host-setup.md, and the matching test expectations…
Full details: Title check
Explanation
The title "Allow the Installed Package's Own Install Scripts on Every npm Install" matches the main change. The PR adds a package-scoped --allow-scripts=<package> flag to npm install and upgrade commands in the Linux and Windows agent installers, and updates tests and docs to match. The title is specific and concise. It does not mention the Windows opencode install or the bun exclusion, but those are secondary details.
Full details: Linked Issues check
Explanation
Directly linked issue #4264 asks for a package-scoped --allow-scripts on each npm install or upgrade the agent installers run. The raw summary places the flag on the Linux package_step upgrade, the Windows Get-PackageStep upgrade (via the new Get-NpmInstallArgument helper), and the Windows managed opencode install and its Source string. Bun paths and removals are unchanged, which matches the issue's scope. The reviewed head's host-setup/linux/install-agents.sh --help text states that npm installs allow the one package's install scripts, which npm 12 otherwise skips. The raw summary says tests/test_install_agents.py expects the flag on npm commands on both platforms and not on bun commands, which covers the issue's test requirement and its dry-run and remedy consistency point. The issue's open point on surfacing remaining install-scripts warnings is answered in the PR description: no warning surfacing was added, with the reasoning given. Older npm behavior is reported as measured in the PR description; this assessment did not re-run those measurements. Limitation: repository diff reads were unavailable in this review (changed blobs missing from the checkout), so the Windows and Linux code changes rest on the supplied summary and PR description, plus the partially readable Linux file help text. Windows behavior is not verified natively, as the PR author states.
Full details: Out of Scope Changes check
Explanation
The changes described are the npm install argument change on Linux and Windows, the shared Windows argument helper, help text in both installers, docs/host-setup.md, and the matching test expectations in tests/test_install_agents.py. Each traces to an objective in #4264: the npm command construction, the help and remedy text that shows the same command, and the tests that check it. The docs change describes the same npm behavior. No unrelated functional change appears in the supplied summary. Diff reads were unavailable, so this rests on the summary and PR description rather than a full diff read.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 4e956a7 and af7b03b.
Files selected for processing: 4
docs/host-setup.md
host-setup/linux/install-agents.sh
host-setup/windows/install-agents.ps1
tests/test_install_agents.py
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The change still has an active verification gap: the new managed opencode install path is tested only in dry-run mode, leaving real npm execution and argument handling unverified.
This pull request updates the agent installers so npm global installs allow the installed package's own scripts, preventing required postinstall scripts from being skipped while leaving bun behavior unchanged.
Changes:
Adds package-scoped --allow-scripts arguments to Linux and Windows npm installs.
Centralizes Windows npm argument construction for upgrades and managed opencode installation.
Updates command expectations and documentation for the new npm behavior.
File
Description
tests/test_install_agents.py
Updates Linux and Windows test expectations for package-scoped npm script allowances.
host-setup/windows/install-agents.ps1
Adds reusable npm argument construction for Windows upgrades and managed opencode installation.
host-setup/linux/install-agents.sh
Adds the package-scoped npm script allowance to Linux package upgrades.
docs/host-setup.md
Documents that npm permits install scripts for the package being installed.
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.46%. Comparing base (b38e084) to head (d7a45c4). ⚠️ Report is 244 commits behind head on develop.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
The managed install was covered only by a dry run, so a real run now asserts
npm receives the helper's arguments whole.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A recorded local strict-review pass covers head d7a45c452b38514a6e86e71eedd6f72b0b1d8bfb, the content this pull request carries at that commit against develop, and it recorded 0 findings.
…a pre-test Hook (#4270)
## Summary
Promotes three changes from develop to main:
- #4267: every ruff call that can reach a downstream repository's root
`hub_fetch_run.py` passes `--extend-exclude ./hub_fetch_run.py
--force-exclude`. That covers the hook snippets, the Python VS Code
tasks, `validate-task.yml`, the `pypi-build-default` action and the
`python-codestyle` skill. No repository adds the helper to its own ruff
config.
- #4268: each npm install the agent installers run passes
`--allow-scripts=<pkg>` for the one package it installs. npm 12
otherwise skips the package's `postinstall`, which leaves opencode
unable to start while the step reports clean.
- #4269: a new opt-in caller hook, `.github/actions/pre-test`, runs in
each `unit-test` leg before the .NET SDK setup, where a .NET test
project exists and the caller carries the hook. ptr727/PhotoCleaner#277
is waiting on it.
## Open after release
- **Native Windows check of #4268.** On a Windows host with an npm-owned
opencode, run `host-setup\windows\install-agents.ps1 -Upgrade -DryRun
opencode`. Expect `npm install -g --allow-scripts=@opencode/cli
@opencode/cli@latest`. Then run `-Upgrade opencode`, and expect
`opencode --version` to answer with no `install-scripts` warning. Linux
was verified natively, and the flag was measured against the real
package on npm 9 through 12.
- **Downstream proof of #4269.** ptr727/PhotoCleaner#277 adds the hook
and bumps its pin once this is released.
Closes#4263Closes#4264Closes#4265
🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commentsPermits the comment lines the pull request adds or edits, which the prose gate otherwise refuses
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #4264.
From npm 12 on, now npm's
latest, a global install skips a package's install scripts unless theallow-scriptsconfig names that package.@opencode/cliand@anthropic-ai/claude-codeeach carry apostinstall. Without it the install still exits 0, so the installer reports a clean step, but opencode then refuses to start.Each npm install the agent installers run names the one package it installs, as
npm install -g --allow-scripts=<pkg> <pkg>@latest. That covers:package_stepupgradeGet-PackageStepupgrade, through a newGet-NpmInstallArgumenthelperSourcestringThe flag allows that package's scripts for that one run and writes no user config. bun installs are unchanged. The help texts and
docs/host-setup.mdsay the npm install allows the one package's scripts.The open points the issue raised
@opencode/clifrom the registry in throwaway prefixes, npm 12.2.3, 11.21.3, 10.9.11 and 9.9.4 each install a workingopencode v2.3.2with no warning. Without the flag, npm 12.2.3 printshad install scripts blocked, andopencode --versionfails with@opencode/cli's postinstall script was not run.install-scriptswarning is advisory, and the scripts still run. The skipped-script symptom is npm 12's.[dry run],running:and everyrun:remedy print the full command, flag included, since each one is built from the same arguments.Verification
tests/test_install_agents.py: the npm command expectations carry the flag, on both platforms, while the bun ones do not. 128 tests OK (1 skipped).test_cli_usage.py,test_bootstrap.pyandtest_host_gate.pypass, as dospec/validate.py, shellcheck, shfmt, PSScriptAnalyzer and the prose gate.PATH.install-agents.sh --upgrade --yes codexrannpm install -g --allow-scripts=@openai/codex @openai/codex@latestand moved it from 0.169.1 to 0.170.0. A second run printedNothing changed..ps1whole under pwsh on Linux against stub tools. On a Windows host with an npm-owned opencode, runhost-setup\windows\install-agents.ps1 -Upgrade -DryRun opencode. Expectnpm install -g --allow-scripts=@opencode/cli @opencode/cli@latest. Then run-Upgrade opencode, and expectopencode --versionto answer with noinstall-scriptswarning printed.Local passes
Two recorded passes. The first raised four
introducedfindings, all fixed in af7b03b:The second pass was clean.
The
commentslabel covers the new comment lines. Each states why the flag is there, a reason the code cannot carry.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation