@brrock/patchsync
v0.1.1
Published
CLI for PatchSync local patch maintenance.
Readme
@brrock/patchsync
CLI for PatchSync local patch maintenance.
This package exposes one binary:
patchsyncThe CLI currently supports five local workflows:
patchsync init [root]patchsync order [config]patchsync prepare [config] [patch_name]patchsync prepare [patch_name]patchsync prepare [patch_order_number]patchsync capture <patch_name> [config]patchsync verify [config]
What It Does
patchsync is the local companion to the main PatchSync GitHub Action. It helps
you work on a patch stack from a clean upstream clone without manually invoking
repo maintenance entrypoints yourself.
initscaffolds a new PatchSync layout and workflow filesorderscans the configured patch directory, sorts what it finds, and prints the exact patch application orderprepareclones the configured upstream repo into.patchsync-local/targetand applies patches in ordercaptureturns your edits in.patchsync-local/targetinto a patch file under the configured patch directoryverifyruns the PatchSync action entrypoint in local check mode
Requirements
- Bun
- A PatchSync config file, typically
patchsync.config.json - A repo laid out for PatchSync patch maintenance
The CLI reads target.repo, target.ref, and patches.dir from the config
file, so it is meant to be run from a PatchSync-managed repository.
Usage
Scaffold a new PatchSync repo:
patchsync init .That creates patchsync.config.json, LATEST_SUPPORTED_COMMIT, the initial
patches/ layout, and .github/workflows/patchsync.yml if they do not already
exist.
Show help:
patchsync --helpPrepare a scratch tree for one patch:
patchsync order patchsync.config.json
patchsync prepare 02-fix-buildCapture changes back into the patch stack:
patchsync capture 02-fix-build patchsync.config.jsonVerify the full stack locally:
patchsync verify patchsync.config.jsonTypical Flow
patchsync order patchsync.config.json
patchsync prepare 02-fix-build
# edit files under .patchsync-local/target
patchsync capture 02-fix-build patchsync.config.json
patchsync verify patchsync.config.jsonUse zero-padded numeric prefixes in patch directory names so the order stays obvious:
patches/
01-base-port/
02-fix-build/
03-add-feature-flag/Patch entries stack on top of each other. PatchSync starts from clean upstream, applies the first entry, then applies the second entry on top of that result, and continues until the stack is complete.
patchsync prepare stops right before the selected patch. You can select it by name or by the order number shown by patchsync order:
patchsync prepare 02-fix-build
patchsync prepare 2Development
From the monorepo root:
bun install
bun run build:cliFrom this package directory:
bun run buildThe built entrypoint is:
dist/main.jsFor broader PatchSync setup, configuration, and GitHub Action behavior, see the repo root README.
