patchy-cli 0.0.20 → 0.0.21-pr.227.6226056
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.
- package/README.md +54 -93
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://github.com/richardgill/patchy">
|
|
3
|
-
<img width="
|
|
3
|
+
<img width="120" src="./assets/logo.png" alt="Patchy logo">
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
<br/>
|
|
@@ -15,114 +15,43 @@
|
|
|
15
15
|
|
|
16
16
|
A CLI for generating and applying patches to git repositories.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Why Patchy?
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
For long-lived git forks with no plans to merge upstream:
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
- A **git fork** stores your changes as commits.
|
|
23
|
+
- **Patches** store them as `.diff`
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
Patch files are a clean way to store long-lived changes - human-readable, easy to review and version. But managing them can be cumbersome.
|
|
25
26
|
|
|
26
|
-
Patchy
|
|
27
|
+
Patchy makes managing patches easy: make changes to a clone → save them as patches → reapply anytime.
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
## How it works
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Starting a patch-based fork of https://github.com/octocat/spoon-knife.
|
|
33
|
-
|
|
34
|
-
### Setup Patchy
|
|
35
|
-
|
|
36
|
-
Create a folder for the fork: `mkdir spoon-knife-fork && cd spoon-knife-fork`
|
|
37
|
-
|
|
38
|
-
- [Install Patchy](#installation)
|
|
39
|
-
- Run `patchy init`
|
|
40
|
-
- press enter to select all the default options
|
|
41
|
-
|
|
42
|
-
`patchy init` creates your config: `./patchy.json` ([full reference](#patchyjson-reference))
|
|
43
|
-
```json5
|
|
44
|
-
{
|
|
45
|
-
"source_repo": "https://github.com/octocat/spoon-knife",
|
|
46
|
-
"patches_dir": "./patches/",
|
|
47
|
-
"clones_dir": "./clones/",
|
|
48
|
-
"target_repo": "spoon-knife",
|
|
49
|
-
"base_revision": "d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9",
|
|
50
|
-
"upstream_branch": "main"
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
`patchy init` also creates an empty `./patches` folder and clones the spoon-knife repo into `./clones`:
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
./
|
|
58
|
-
├── patches/
|
|
59
|
-
├── clones/
|
|
60
|
-
│ └── spoon-knife/
|
|
61
|
-
│ └── path/to/existingFile.txt
|
|
62
|
-
└── patchy.json
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Make changes to the cloned repo
|
|
66
|
-
|
|
67
|
-
We can now make changes directly in the cloned spoon-knife repo:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
echo "edit existing file" >> clones/spoon-knife/path/to/existingFile.txt
|
|
71
|
-
echo "new file" > clones/spoon-knife/path/to/newFile.txt
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Generate patches:
|
|
75
|
-
|
|
76
|
-
To generate the patches for the changes run `patchy generate`:
|
|
77
|
-
|
|
78
|
-
Patchy will prompt you to create your first **patch set**, let's name it: 'first-patch-set'
|
|
31
|
+
`patchy init` sets up your project:
|
|
79
32
|
|
|
80
33
|
```
|
|
81
|
-
|
|
34
|
+
├── patchy.json ← config (source: github.com/org/repo, base: v2.1.0)
|
|
82
35
|
├── clones/
|
|
83
|
-
│ └──
|
|
84
|
-
|
|
85
|
-
│ └── path/to/newFile.txt
|
|
86
|
-
├── patches/
|
|
87
|
-
│ └── 001-first-patch-set/ (created)
|
|
88
|
-
│ ├── path/to/existingFile.txt.diff (generated)
|
|
89
|
-
│ └── path/to/newFile.txt (generated)
|
|
90
|
-
└── patchy.json
|
|
36
|
+
│ └── upstream-repo/ ← a clone of the source repo - your working copy
|
|
37
|
+
└── patches/ ← empty for now - your patches live here
|
|
91
38
|
```
|
|
92
39
|
|
|
93
|
-
|
|
94
|
-
- **New files** are copied as regular files e.g. `newFile.txt` (easier to inspect and edit directly).
|
|
40
|
+
The workflow:
|
|
95
41
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Reset the current upstream repo with `patchy repo reset`, which will reset everything to `base_revision`:
|
|
42
|
+
1. Make changes directly in `clones/upstream-repo/`
|
|
43
|
+
2. Run `patchy generate` to generate patches:
|
|
99
44
|
|
|
100
45
|
```
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
├── patches/
|
|
106
|
-
│ └── 001-first-patch-set/
|
|
107
|
-
│ ├── path/to/existingFile.txt.diff
|
|
108
|
-
│ └── path/to/newFile.txt
|
|
109
|
-
└── patchy.json
|
|
46
|
+
patches/
|
|
47
|
+
└── 001-feature-name/
|
|
48
|
+
├── src/file.ts.diff ← edits to existing files
|
|
49
|
+
└── src/newFile.ts ← new files (no .diff suffix)
|
|
110
50
|
```
|
|
111
51
|
|
|
112
|
-
|
|
52
|
+
3. Run `patchy apply` to reapply your patches to `clones/upstream-repo/` anytime
|
|
113
53
|
|
|
114
|
-
|
|
115
|
-
./
|
|
116
|
-
├── clones/
|
|
117
|
-
│ └── spoon-knife/
|
|
118
|
-
│ ├── path/to/existingFile.txt (modified)
|
|
119
|
-
│ └── path/to/newFile.txt (added)
|
|
120
|
-
├── patches/
|
|
121
|
-
│ └── 001-first-patch-set/
|
|
122
|
-
│ ├── path/to/existingFile.txt.diff
|
|
123
|
-
│ └── path/to/newFile.txt
|
|
124
|
-
└── patchy.json
|
|
125
|
-
```
|
|
54
|
+
See the [example walkthrough](./docs/example.md) for a step-by-step guide.
|
|
126
55
|
|
|
127
56
|
## Getting started
|
|
128
57
|
|
|
@@ -227,6 +156,8 @@ patches/
|
|
|
227
156
|
└── patchy-post-apply # runs after patches
|
|
228
157
|
```
|
|
229
158
|
|
|
159
|
+
Patch sets support scripts without diffs, enabling pure automation steps.
|
|
160
|
+
|
|
230
161
|
### Hook execution
|
|
231
162
|
|
|
232
163
|
- Hooks run with `cwd` set to `target_repo`
|
|
@@ -258,6 +189,8 @@ If `--patch-set` is not provided (and not set via env/config), prompts to select
|
|
|
258
189
|
|
|
259
190
|
Note: `patchy generate` is destructive and will remove any unneeded files in the patch set directory.
|
|
260
191
|
|
|
192
|
+
---
|
|
193
|
+
|
|
261
194
|
### `patchy apply`
|
|
262
195
|
|
|
263
196
|
Apply patch files from `patches/` into `target_repo`. Patch sets are applied in alphabetical order.
|
|
@@ -270,7 +203,25 @@ patchy apply [--only <patch-set>] [--until <patch-set>] [--auto-commit=<mode>] [
|
|
|
270
203
|
|------|-------------|
|
|
271
204
|
| `--only <name>` | Apply only the specified patch set |
|
|
272
205
|
| `--until <name>` | Apply patch sets up to and including the specified one |
|
|
273
|
-
| `--auto-commit=<mode>` | Control auto-commit behavior
|
|
206
|
+
| `--auto-commit=<mode>` | Control auto-commit behavior (see below) |
|
|
207
|
+
|
|
208
|
+
#### Auto-commit behavior
|
|
209
|
+
|
|
210
|
+
Each patch set creates a single commit with message `Apply patch set: <name>`. The `--auto-commit` flag controls when commits happen:
|
|
211
|
+
|
|
212
|
+
| Mode | Behavior |
|
|
213
|
+
|------|----------|
|
|
214
|
+
| `interactive` (default) | Commits all patch sets automatically, prompts for the last one |
|
|
215
|
+
| `all` | Commits every patch set immediately after applying |
|
|
216
|
+
| `skip-last` | Commits all except the last patch set |
|
|
217
|
+
| `off` | No commits are made |
|
|
218
|
+
|
|
219
|
+
**Notes:**
|
|
220
|
+
- In non-interactive environments (e.g., CI), `interactive` mode auto-commits everything
|
|
221
|
+
- Commits are skipped if any patch in the set fails to apply
|
|
222
|
+
- `--dry-run` skips all commits
|
|
223
|
+
|
|
224
|
+
---
|
|
274
225
|
|
|
275
226
|
### `patchy repo reset`
|
|
276
227
|
|
|
@@ -280,6 +231,8 @@ Hard reset the Git working tree of `target_repo` to `base_revision`. Discards al
|
|
|
280
231
|
patchy repo reset [--base-revision] [--target-repo]
|
|
281
232
|
```
|
|
282
233
|
|
|
234
|
+
---
|
|
235
|
+
|
|
283
236
|
### `patchy repo clone`
|
|
284
237
|
|
|
285
238
|
Clone a repository into a subdirectory of `clones_dir` and checkout `base_revision`. The target directory is derived from the repo name.
|
|
@@ -288,6 +241,8 @@ Clone a repository into a subdirectory of `clones_dir` and checkout `base_revisi
|
|
|
288
241
|
patchy repo clone [--source-repo] [--clones-dir] [--base-revision]
|
|
289
242
|
```
|
|
290
243
|
|
|
244
|
+
---
|
|
245
|
+
|
|
291
246
|
### `patchy base [revision]`
|
|
292
247
|
|
|
293
248
|
View or update the `base_revision` in config.
|
|
@@ -297,6 +252,8 @@ patchy base # Interactive
|
|
|
297
252
|
patchy base abc123def # Set base_revision to the specified SHA or tag
|
|
298
253
|
```
|
|
299
254
|
|
|
255
|
+
---
|
|
256
|
+
|
|
300
257
|
### `patchy prime`
|
|
301
258
|
|
|
302
259
|
Prints a prompt you can include in your `AGENTS.md` / `CLAUDE.md`.
|
|
@@ -313,6 +270,8 @@ patchy prime >> CLAUDE.md
|
|
|
313
270
|
|
|
314
271
|
Outputs a brief description of Patchy, key paths, and essential commands to help AI coding agents understand your project's patch workflow.
|
|
315
272
|
|
|
273
|
+
---
|
|
274
|
+
|
|
316
275
|
### `patchy config get <key>`
|
|
317
276
|
|
|
318
277
|
Output a single config value (raw, no label). Useful for shell scripts.
|
|
@@ -345,6 +304,8 @@ patchy config get verbose # false
|
|
|
345
304
|
- Unset raw keys exit with code 1
|
|
346
305
|
- Unset computed keys (e.g., `patch_set_path` when `patch_set` is not set) output an empty line
|
|
347
306
|
|
|
307
|
+
---
|
|
308
|
+
|
|
348
309
|
### `patchy config list`
|
|
349
310
|
|
|
350
311
|
Output all config values as aligned key-value pairs.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "patchy-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21-pr.227.6226056",
|
|
4
4
|
"description": "A CLI tool for managing Git patch workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -64,14 +64,13 @@
|
|
|
64
64
|
"url": "https://github.com/richardgill/patchy"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"patchy-cli-linux-x64": "0.0.
|
|
68
|
-
"patchy-cli-linux-arm64": "0.0.
|
|
69
|
-
"patchy-cli-darwin-x64": "0.0.
|
|
70
|
-
"patchy-cli-darwin-arm64": "0.0.
|
|
71
|
-
"patchy-cli-windows-x64": "0.0.
|
|
67
|
+
"patchy-cli-linux-x64": "0.0.21-pr.227.6226056",
|
|
68
|
+
"patchy-cli-linux-arm64": "0.0.21-pr.227.6226056",
|
|
69
|
+
"patchy-cli-darwin-x64": "0.0.21-pr.227.6226056",
|
|
70
|
+
"patchy-cli-darwin-arm64": "0.0.21-pr.227.6226056",
|
|
71
|
+
"patchy-cli-windows-x64": "0.0.21-pr.227.6226056"
|
|
72
72
|
},
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
|
-
}
|
|
76
|
-
"packageManager": "bun@1.3.4"
|
|
75
|
+
}
|
|
77
76
|
}
|