Modify your fork of an upstream repository with surgical precision.
See IncusScripts which uses surgeon
to modify community-scripts for Proxmox
to run on Incus.
Use surgeon to keep your fork up-to-date with an upstream, but make modifications during the process.
For example:
- use the
injectmodule to add a license or credit to the upstream - use the
sedmodule to change a function invocation to a different one - use the
replacefilemodule to completely replace a single file
Codemods implement a small-ish interface so it's easy to add new ones. PR's accepted if you find something you need.
type CodeMod interface {
Apply(source string, target string, match string, args ...string) error
Validate(source string, target string, match string, args ...string) error
Description() string
Usage() string
}surgeon Modify your fork of an upstream repository with surgical precision.
See IncusScripts which uses surgeon
to modify community-scripts for Proxmox
to run on Incus.
git push/commit/stage the git commit/push/stage settings don't work correctly. Don't use them yet.
See installation documentation
upstream: https://some.repository.com/upstream/repo
stage: true
commit: true
push: false
modsdir: mymods
codemods:
- description: Modify URLS
mod: sed
match: cmd/*.go
args:
- github.com/upstream/repo
- github.com/myfork/repo
ignorelist:
- prefix: ct/
See a real world example
IncusScripts uses surgeon as a GitHub Action. See the action
We appreciate any contributions to the project—whether it's bug reports, feature requests, documentation improvements, or spreading the word. Your involvement helps keep the project alive and sustainable.
If you encounter any issues or have suggestions for improvement, file a new issue on our GitHub issues page. You can also submit pull requests with solutions or enhancements!
This project is licensed under the MIT License.