socket-patch apply
Reapply agent mode patches after installing dependencies
socket-patch apply is for agent mode only. Agent mode edits the installed packages in place, and a fresh install puts the original files back, so apply has to run after every dependency install, locally and in CI.
Hosted and vendored modes don't need this command: the package manager installs the patched package itself. They replace agent mode for every ecosystem except Deno. To move a project over, see Agent mode and socket patch.
- What it reads. The patches recorded in
.socket/manifest.json, with their files in.socket/blobs/. With both committed,socket-patch apply --offlineneeds no network. --checkverifies that every patch is in place without changing anything, and exits with an error if one is not. Use it in CI.- Mismatched files fail. A file that is neither the original nor the patched version is not overwritten.
--forceskips that check. - Packages that are vendored, or that you patch with another tool, are skipped.
socket-patch apply # after every install
socket-patch apply --offline # never download; fail if patch data is missing
socket-patch apply --check # verify only
socket-patch apply --dry-run # previewsocket-patch apply -h
-h prints the common options shown here. socket-patch apply --help prints every option.
$ socket-patch apply -h
Reapply agent-mode patches after installing dependencies
Usage: socket-patch apply [OPTIONS]
Options:
-f, --force Skip pre-application hash verification (apply even if package version differs)
--check Read-only: verify that every manifest patch is in place (each installed copy
hashes to the patched bytes; Go: the committed `replace`-redirects match the
manifest), exiting non-zero on drift. For CI / GitHub-App auditing. Lock-free and
offline-safe: it never fetches or writes. Vendored patches are `vendor --check`'s
job
--vex <VEX> Write OpenVEX to this path after a successful run [env: SOCKET_VEX=]
-h, --help Print help (see more with '--help')
-V, --version Print version
Global options:
--cwd <CWD> Working directory [env: SOCKET_CWD=] [default: .]
-e, --ecosystems <ECOSYSTEMS> Restrict to these ecosystems (comma-separated): npm, pypi, cargo,
gem, golang, maven, composer, nuget, deno [env: SOCKET_ECOSYSTEMS=]
--offline Disable network access; fail if remote data is needed [env:
SOCKET_OFFLINE=]
-j, --json Emit machine-readable JSON output [env: SOCKET_JSON=]
--dry-run Preview the operation without making any mutations [env:
SOCKET_DRY_RUN=]Updated about 3 hours ago
Did this page help you?