patchy-cli 0.0.2-pr.115.f44a5c0-pr.115.f44a5c0 → 0.0.2
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 +62 -74
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -2,35 +2,70 @@
|
|
|
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
|
+
1. Clone repo → `~/target-1`
|
|
8
|
+
2. Make some edits (the patches!)
|
|
9
|
+
3. Create a repo for your patches → `~/my-patches`
|
|
10
|
+
3. `patchy generate --repo ~/target-1` → Creates `~/my-patches/patches/*.diff`
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
Then reapply your changes later with:
|
|
13
|
+
|
|
14
|
+
5. `patchy apply --repo ~/target-1` → `~/target-1` (patches applied)
|
|
10
15
|
|
|
11
|
-
```sh
|
|
12
|
-
patchy init
|
|
13
|
-
```
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
### `patches/` folder structure
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Patch files are stored in the same folder structure as the target repo:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
~/target-1/
|
|
23
|
+
└── path/in/repo/existingFile.txt
|
|
24
|
+
```
|
|
18
25
|
|
|
19
26
|
```
|
|
20
27
|
my-patch-repo/
|
|
21
28
|
├── patches/
|
|
22
|
-
│ ├── path/in/repo/
|
|
23
|
-
│
|
|
24
|
-
|
|
29
|
+
│ ├── path/in/repo/existingFile.txt.diff
|
|
30
|
+
│ └── path/in/repo/newFile.txt
|
|
31
|
+
└── patchy.json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- **Edits** are stored as `.diff` files e.g. `existingFile.txt.diff`.
|
|
35
|
+
- **New files** are stored as regular files e.g. `newFile.txt`.
|
|
36
|
+
|
|
37
|
+
### `patchy.json`
|
|
38
|
+
|
|
39
|
+
```jsonc
|
|
40
|
+
{
|
|
41
|
+
// Git URL to clone from.
|
|
42
|
+
"repo_url": "https://github.com/example/repo.git", // Override: --repo-url | env: PATCHY_REPO_URL
|
|
43
|
+
|
|
44
|
+
// Path to repo you're generating patches from or applying patches to.
|
|
45
|
+
"repo_dir": "~/repos/repo", // Override: --repo-dir | env: PATCHY_REPO_DIR
|
|
25
46
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
47
|
+
// Directory containing patch files.
|
|
48
|
+
"patches_dir": "./patches/", // Override: --patches-dir | env: PATCHY_PATCHES_DIR
|
|
49
|
+
|
|
50
|
+
// Parent directory for cloning repos. You can easily clone more repos here from repo_url.
|
|
51
|
+
"repo_base_dir": "~/repos", // Override: --repo-base-dir | env: PATCHY_REPO_BASE_DIR
|
|
52
|
+
|
|
53
|
+
// Git ref to checkout (branch, tag, SHA).
|
|
54
|
+
"ref": "main" // Override: --ref | env: PATCHY_REF
|
|
55
|
+
}
|
|
29
56
|
```
|
|
30
57
|
|
|
31
|
-
|
|
58
|
+
Precedence: CLI flags > Environment variables > `patchy.json`
|
|
59
|
+
|
|
60
|
+
## Getting started
|
|
32
61
|
|
|
33
|
-
|
|
62
|
+
### Installation
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
curl -fsSL https://raw.githubusercontent.com/richardgill/patchy/main/install | bash
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or via npm:
|
|
34
69
|
|
|
35
70
|
**Install script (recommended):**
|
|
36
71
|
|
|
@@ -50,37 +85,30 @@ Or use directly without installing:
|
|
|
50
85
|
npx patchy-cli --version
|
|
51
86
|
```
|
|
52
87
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
These flags are accepted by **all commands**:
|
|
88
|
+
### Initialize patchy
|
|
56
89
|
|
|
57
|
-
|
|
58
|
-
| ----------------- | ---------------------- | ------------------------------------------------ |
|
|
59
|
-
| `--repo-dir` | `PATCHY_REPO_DIR` | Path to the Git repo you're patching |
|
|
60
|
-
| `--repo-base-dir` | `PATCHY_REPO_BASE_DIR` | Parent directory where upstream repos are cloned |
|
|
61
|
-
| `--patches-dir` | `PATCHY_PATCHES_DIR` | Path to your patch files (default: `./patches/`) |
|
|
62
|
-
| `--config` | `PATCHY_CONFIG` | JSON config file (default: `patchy.json`) |
|
|
63
|
-
| `--verbose` | `PATCHY_VERBOSE` | Enable verbose log output |
|
|
64
|
-
| `--dry-run` | `PATCHY_DRY_RUN` | Simulate the command without writing files |
|
|
90
|
+
Run this command to initialize patchy in your project:
|
|
65
91
|
|
|
66
|
-
|
|
92
|
+
```sh
|
|
93
|
+
patchy init
|
|
94
|
+
```
|
|
67
95
|
|
|
68
96
|
## Commands
|
|
69
97
|
|
|
70
|
-
### `patchy
|
|
98
|
+
### `patchy generate`
|
|
71
99
|
|
|
72
|
-
|
|
100
|
+
Generate `.diff` files and new files into `./patches/` based on current `git diff` in `repo_dir`.
|
|
73
101
|
|
|
74
102
|
```sh
|
|
75
|
-
patchy
|
|
103
|
+
patchy generate [--repo-dir] [--patches-dir] [--dry-run]
|
|
76
104
|
```
|
|
77
105
|
|
|
78
|
-
### `patchy
|
|
106
|
+
### `patchy apply`
|
|
79
107
|
|
|
80
|
-
|
|
108
|
+
Apply patch files from `patches/` into `repo_dir`.
|
|
81
109
|
|
|
82
110
|
```sh
|
|
83
|
-
patchy
|
|
111
|
+
patchy apply [--repo-dir] [--patches-dir] [--dry-run]
|
|
84
112
|
```
|
|
85
113
|
|
|
86
114
|
### `patchy repo reset`
|
|
@@ -107,46 +135,6 @@ Clone a repository into a subdirectory of `repo_base_dir`. The target directory
|
|
|
107
135
|
patchy repo clone [--repo-base-dir] [--ref] [--repo-url]
|
|
108
136
|
```
|
|
109
137
|
|
|
110
|
-
## Configuration (`patchy.json`)
|
|
111
|
-
|
|
112
|
-
Optional file to set default values:
|
|
113
|
-
|
|
114
|
-
```json
|
|
115
|
-
{
|
|
116
|
-
"repo_url": "https://github.com/richardgill/upstream.git",
|
|
117
|
-
"repo_dir": "upstream-repo",
|
|
118
|
-
"repo_base_dir": "../clones",
|
|
119
|
-
"patches_dir": "patches/",
|
|
120
|
-
"ref": "main"
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
All options may be set with environment variables as well e.g. `PATCHY_REPO_URL`.
|
|
125
|
-
|
|
126
|
-
### Precedence Order
|
|
127
|
-
|
|
128
|
-
1. CLI flags
|
|
129
|
-
2. Environment variables
|
|
130
|
-
3. `--config` (defaults to `./patchy.json`)
|
|
131
|
-
|
|
132
|
-
## Example Workflow
|
|
133
|
-
|
|
134
|
-
```sh
|
|
135
|
-
# Clone the upstream repo
|
|
136
|
-
patchy repo clone --repo-url https://github.com/richardgill/upstream.git --repo-base-dir ../clones
|
|
137
|
-
|
|
138
|
-
# Check out upstream repo at a specific version
|
|
139
|
-
patchy repo checkout --ref v1.2.3 --repo-dir ../clones/upstream
|
|
140
|
-
|
|
141
|
-
# Generate patches from current state of repo_dir
|
|
142
|
-
patchy generate --repo-dir ../clones/upstream
|
|
143
|
-
|
|
144
|
-
# Later, apply patches cleanly to fresh repo
|
|
145
|
-
patchy repo reset --repo-dir ../clones/upstream
|
|
146
|
-
patchy repo checkout --ref main --repo-dir upstream
|
|
147
|
-
patchy apply --repo-dir ../clones/upstream
|
|
148
|
-
```
|
|
149
|
-
|
|
150
138
|
## License
|
|
151
139
|
|
|
152
140
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "patchy-cli",
|
|
3
|
-
"version": "0.0.2
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "A CLI tool for managing Git patch workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"url": "https://github.com/richardgill/patchy"
|
|
60
60
|
},
|
|
61
61
|
"optionalDependencies": {
|
|
62
|
-
"patchy-cli-linux-x64": "0.0.2
|
|
63
|
-
"patchy-cli-linux-arm64": "0.0.2
|
|
64
|
-
"patchy-cli-darwin-x64": "0.0.2
|
|
65
|
-
"patchy-cli-darwin-arm64": "0.0.2
|
|
66
|
-
"patchy-cli-windows-x64": "0.0.2
|
|
62
|
+
"patchy-cli-linux-x64": "0.0.2",
|
|
63
|
+
"patchy-cli-linux-arm64": "0.0.2",
|
|
64
|
+
"patchy-cli-darwin-x64": "0.0.2",
|
|
65
|
+
"patchy-cli-darwin-arm64": "0.0.2",
|
|
66
|
+
"patchy-cli-windows-x64": "0.0.2"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|