patchy-cli 0.0.4-pr.154.e427e8f → 0.0.4
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 +41 -114
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,66 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# patchy
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An opinionated command-line tool for managing Git patch workflows.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## How it works
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Patchy helps you manage `.diff` patches for a repository you want to modify.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## What is Patchy?
|
|
12
|
-
|
|
13
|
-
Patchy helps you **generate** and **apply** `.diff` patches for a git repo you've cloned on your machine.
|
|
14
|
-
|
|
15
|
-
It's opinionated and has [conventions](#patch-file-layout) about how the `.diff` files are stored.
|
|
16
|
-
|
|
17
|
-
## Example
|
|
18
|
-
|
|
19
|
-
Starting a patch-based fork of https://github.com/octocat/spoon-knife.
|
|
20
|
-
|
|
21
|
-
### Setup Patchy
|
|
22
|
-
|
|
23
|
-
Create a folder for the fork: `mkdir spoon-knife-fork && cd spoon-knife-fork`
|
|
24
|
-
|
|
25
|
-
- [Install Patchy](#install)
|
|
26
|
-
- Run `patchy init`
|
|
27
|
-
- press enter to select all the default options
|
|
28
|
-
|
|
29
|
-
`patchy init` creates your config: `./patchy.json` ([full reference](#patchyjson))
|
|
9
|
+
`patchy.json` (see [full config reference](#patchyjson) below)
|
|
30
10
|
```json5
|
|
31
11
|
{
|
|
32
12
|
"repo_url": "https://github.com/octocat/spoon-knife",
|
|
33
13
|
"patches_dir": "./patches/",
|
|
34
14
|
"clones_dir": "./clones/",
|
|
35
15
|
"repo_dir": "spoon-knife",
|
|
36
|
-
"ref": "main"
|
|
37
16
|
}
|
|
38
17
|
```
|
|
39
18
|
|
|
40
|
-
|
|
19
|
+
Initialize Patchy with:
|
|
20
|
+
```bash
|
|
21
|
+
patchy init
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
You can `patchy repo clone` the repo into `./clones/` to complete the setup.
|
|
25
|
+
|
|
26
|
+
Now you'll have
|
|
41
27
|
|
|
42
28
|
```
|
|
43
29
|
./
|
|
44
30
|
├── patches/
|
|
45
31
|
├── clones/
|
|
46
32
|
│ └── spoon-knife/
|
|
47
|
-
│
|
|
33
|
+
│ ├── path/to/existingFile.txt
|
|
48
34
|
└── patchy.json
|
|
49
35
|
```
|
|
50
36
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
We can now make changes directly in the cloned spoon-knife repo:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
echo "edit existing file" >> clones/spoon-knife/path/to/existingFile.txt
|
|
57
|
-
echo "new file" > clones/spoon-knife/path/to/newFile.txt
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Generate patches:
|
|
61
|
-
|
|
62
|
-
To generate the patches for the changes run `patchy generate`:
|
|
37
|
+
Now you can make changes directly to `./clones/spoon-knife`
|
|
63
38
|
|
|
39
|
+
And generate patches with `patchy generate`
|
|
64
40
|
|
|
65
41
|
```
|
|
66
42
|
./
|
|
@@ -73,37 +49,36 @@ To generate the patches for the changes run `patchy generate`:
|
|
|
73
49
|
│ └── path/to/newFile.txt
|
|
74
50
|
└── patchy.json
|
|
75
51
|
```
|
|
52
|
+
|
|
76
53
|
- **Edits** are stored as `.diff` files e.g. `existingFile.txt.diff`.
|
|
77
|
-
- **New files** are copied as regular files e.g. `newFile.txt
|
|
54
|
+
- **New files** are copied as regular files e.g. `newFile.txt`.
|
|
78
55
|
|
|
79
|
-
|
|
56
|
+
You can reapply your changes later with:
|
|
80
57
|
|
|
81
|
-
|
|
58
|
+
`patchy apply`
|
|
82
59
|
|
|
83
|
-
|
|
84
|
-
./
|
|
85
|
-
├── clones/
|
|
86
|
-
│ └── spoon-knife/ <<< reset
|
|
87
|
-
│ ├── path/to/existingFile.txt
|
|
88
|
-
├── patches/
|
|
89
|
-
│ ├── path/to/existingFile.txt.diff
|
|
90
|
-
│ └── path/to/newFile.txt
|
|
91
|
-
└── patchy.json
|
|
92
|
-
```
|
|
60
|
+
### `patchy.json`
|
|
93
61
|
|
|
94
|
-
|
|
62
|
+
```jsonc
|
|
63
|
+
{
|
|
64
|
+
// Git URL to clone from.
|
|
65
|
+
"repo_url": "https://github.com/example/repo.git", // Override: --repo-url | env: PATCHY_REPO_URL
|
|
95
66
|
|
|
67
|
+
// Path to repo you're generating patches from or applying patches to.
|
|
68
|
+
"repo_dir": "~/repos/repo", // Override: --repo-dir | env: PATCHY_REPO_DIR
|
|
69
|
+
|
|
70
|
+
// Directory containing patch files.
|
|
71
|
+
"patches_dir": "./patches/", // Override: --patches-dir | env: PATCHY_PATCHES_DIR
|
|
72
|
+
|
|
73
|
+
// Parent directory for cloning repos. You can easily clone more repos here from repo_url.
|
|
74
|
+
"clones_dir": "./clones/", // Override: --clones-dir | env: PATCHY_CLONES_DIR
|
|
75
|
+
|
|
76
|
+
// Git ref to checkout (branch, tag, SHA).
|
|
77
|
+
"ref": "main" // Override: --ref | env: PATCHY_REF
|
|
78
|
+
}
|
|
96
79
|
```
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
│ └── spoon-knife/
|
|
100
|
-
│ ├── path/to/existingFile.txt (modified)
|
|
101
|
-
│ └── path/to/newFile.txt (added)
|
|
102
|
-
├── patches/
|
|
103
|
-
│ ├── path/to/existingFile.txt.diff
|
|
104
|
-
│ └── path/to/newFile.txt
|
|
105
|
-
└── patchy.json
|
|
106
|
-
```
|
|
80
|
+
|
|
81
|
+
Precedence: CLI flags > Environment variables > `patchy.json`
|
|
107
82
|
|
|
108
83
|
## Getting started
|
|
109
84
|
|
|
@@ -129,60 +104,14 @@ Or use directly without installing:
|
|
|
129
104
|
npx patchy-cli@latest
|
|
130
105
|
```
|
|
131
106
|
|
|
132
|
-
### Initialize
|
|
107
|
+
### Initialize patchy
|
|
133
108
|
|
|
134
|
-
Run this command to initialize
|
|
109
|
+
Run this command to initialize patchy in your project:
|
|
135
110
|
|
|
136
111
|
```sh
|
|
137
112
|
patchy init
|
|
138
113
|
```
|
|
139
114
|
|
|
140
|
-
## `patchy.json` reference
|
|
141
|
-
|
|
142
|
-
```jsonc
|
|
143
|
-
{
|
|
144
|
-
// Git URL to clone from.
|
|
145
|
-
"repo_url": "https://github.com/example/repo.git", // Override: --repo-url | env: PATCHY_REPO_URL
|
|
146
|
-
|
|
147
|
-
// Path to repo you're generating patches from or applying patches to.
|
|
148
|
-
"repo_dir": "~/repos/repo", // Override: --repo-dir | env: PATCHY_REPO_DIR
|
|
149
|
-
|
|
150
|
-
// Directory containing patch files.
|
|
151
|
-
"patches_dir": "./patches/", // Override: --patches-dir | env: PATCHY_PATCHES_DIR
|
|
152
|
-
|
|
153
|
-
// Parent directory for cloning repos. You can easily clone more repos here from repo_url.
|
|
154
|
-
"clones_dir": "./clones/", // Override: --clones-dir | env: PATCHY_CLONES_DIR
|
|
155
|
-
|
|
156
|
-
// Git ref to checkout (branch, tag, SHA).
|
|
157
|
-
"ref": "main" // Override: --ref | env: PATCHY_REF
|
|
158
|
-
}
|
|
159
|
-
```
|
|
160
|
-
Precedence: CLI flags > Environment variables > `patchy.json`
|
|
161
|
-
|
|
162
|
-
`patchy.json` use jsonc, so comments are allowed.
|
|
163
|
-
|
|
164
|
-
## Patch file layout
|
|
165
|
-
|
|
166
|
-
The `patches/` directory (customizable via [`patches_dir`](#patchyjson)) uses the same folder structure as `repo_dir`:
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
./
|
|
170
|
-
├── patches/
|
|
171
|
-
│ ├── path/to/existingFile.txt.diff
|
|
172
|
-
│ └── path/to/newFile.txt
|
|
173
|
-
├── clones/
|
|
174
|
-
│ └── repo-clone-1/
|
|
175
|
-
│ ├── path/to/existingFile.txt (modified)
|
|
176
|
-
│ └── path/to/newFile.txt (added)
|
|
177
|
-
└── patchy.json
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
**Two types of patch files:**
|
|
181
|
-
- **`.diff` files** — For modified existing files (generated via `git diff HEAD`)
|
|
182
|
-
- **Plain files** — For newly added files (copied verbatim for easier inspection and editing)
|
|
183
|
-
|
|
184
|
-
`patchy generate` automatically removes stale files in `patches/` that no longer correspond to changes in `repo_dir`.
|
|
185
|
-
|
|
186
115
|
## Commands
|
|
187
116
|
|
|
188
117
|
### `patchy generate`
|
|
@@ -193,8 +122,6 @@ Generate `.diff` files and new files into `./patches/` based on current `git dif
|
|
|
193
122
|
patchy generate [--repo-dir] [--patches-dir] [--dry-run]
|
|
194
123
|
```
|
|
195
124
|
|
|
196
|
-
Note: `patchy generate` is destructive and will remove any unneeded files in your `./patches/` folder.
|
|
197
|
-
|
|
198
125
|
### `patchy apply`
|
|
199
126
|
|
|
200
127
|
Apply patch files from `patches/` into `repo_dir`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "patchy-cli",
|
|
3
|
-
"version": "0.0.4
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "A CLI tool for managing Git patch workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"url": "https://github.com/richardgill/patchy"
|
|
61
61
|
},
|
|
62
62
|
"optionalDependencies": {
|
|
63
|
-
"patchy-cli-linux-x64": "0.0.4
|
|
64
|
-
"patchy-cli-linux-arm64": "0.0.4
|
|
65
|
-
"patchy-cli-darwin-x64": "0.0.4
|
|
66
|
-
"patchy-cli-darwin-arm64": "0.0.4
|
|
67
|
-
"patchy-cli-windows-x64": "0.0.4
|
|
63
|
+
"patchy-cli-linux-x64": "0.0.4",
|
|
64
|
+
"patchy-cli-linux-arm64": "0.0.4",
|
|
65
|
+
"patchy-cli-darwin-x64": "0.0.4",
|
|
66
|
+
"patchy-cli-darwin-arm64": "0.0.4",
|
|
67
|
+
"patchy-cli-windows-x64": "0.0.4"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|