patchy-cli 0.0.9 → 0.0.10-pr.201.67b5de9

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.
Files changed (3) hide show
  1. package/README.md +26 -16
  2. package/package.json +9 -9
  3. package/schema.json +4 -1
package/README.md CHANGED
@@ -46,7 +46,8 @@ Create a folder for the fork: `mkdir spoon-knife-fork && cd spoon-knife-fork`
46
46
  "patches_dir": "./patches/",
47
47
  "clones_dir": "./clones/",
48
48
  "target_repo": "spoon-knife",
49
- "ref": "main"
49
+ "base_revision": "d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9",
50
+ "upstream_branch": "main"
50
51
  }
51
52
  ```
52
53
 
@@ -94,7 +95,7 @@ Patchy will prompt you to create your first **patch set**, let's name it: 'first
94
95
 
95
96
  ### Reapplying patches:
96
97
 
97
- Reset the current upstream repo `patchy repo reset main`, which will reset everything to `main`:
98
+ Reset the current upstream repo with `patchy repo reset`, which will reset everything to `base_revision`:
98
99
 
99
100
  ```
100
101
  ./
@@ -138,7 +139,7 @@ Or via npm:
138
139
 
139
140
  ```sh
140
141
  npm install -g patchy-cli
141
- patchy-cli
142
+ patchy
142
143
  ```
143
144
 
144
145
  Or use directly without installing:
@@ -175,8 +176,11 @@ patchy init
175
176
  // If not set, prompts interactively or errors in non-interactive mode.
176
177
  "patch_set": "001-security-fixes", // Override: --patch-set | env: PATCHY_PATCH_SET
177
178
 
178
- // Git ref to checkout (branch, tag, SHA).
179
- "ref": "main" // Override: --ref | env: PATCHY_REF
179
+ // Git SHA or tag to use as the base for patches.
180
+ "base_revision": "abc123def", // Override: --base-revision | env: PATCHY_BASE_REVISION
181
+
182
+ // Remote branch to track for updates (e.g., "main"). Used by `patchy base` to find new commits/tags.
183
+ "upstream_branch": "main" // Override: --upstream-branch | env: PATCHY_UPSTREAM_BRANCH
180
184
  }
181
185
  ```
182
186
  Precedence: CLI flags > Environment variables > `patchy.json`
@@ -185,7 +189,7 @@ Precedence: CLI flags > Environment variables > `patchy.json`
185
189
 
186
190
  ## Patch file layout
187
191
 
188
- The `patches/` directory (customizable via [`patches_dir`](#patchyjson-reference)) uses the same folder structure as `target_repo`:
192
+ Patches are stored in the `patches/` directory (customizable via [`patches_dir`](#patchyjson-reference)):
189
193
 
190
194
  ```
191
195
  ./
@@ -199,8 +203,11 @@ The `patches/` directory (customizable via [`patches_dir`](#patchyjson-reference
199
203
  │ └── path/to/newFile.txt (added)
200
204
  └── patchy.json
201
205
  ```
206
+
202
207
  Patches are grouped into **patch sets** for organizing related changes. Patch sets have numeric prefixes (e.g., `001-auth`, `002-ui`) and are applied in order.
203
208
 
209
+ Within each patch set files follow the same folder structure as in the `source_repo`.
210
+
204
211
  **Two types of patch files:**
205
212
  - **`.diff` files** — For modified existing files (generated via `git diff HEAD`)
206
213
  - **Plain files** — For newly added files (copied verbatim for easier inspection and editing)
@@ -223,39 +230,42 @@ Note: `patchy generate` is destructive and will remove any unneeded files in the
223
230
 
224
231
  ### `patchy apply`
225
232
 
226
- Apply patch files from `patches/` into `target_repo`. Patch sets are applied in alphabetical order.
233
+ Apply patch files from `patches/` into `target_repo`. Patch sets are applied in alphabetical order, with each patch set committed automatically.
227
234
 
228
235
  ```sh
229
- patchy apply [--only <patch-set>] [--until <patch-set>] [--target-repo] [--patches-dir] [--dry-run]
236
+ patchy apply [--only <patch-set>] [--until <patch-set>] [--all] [--edit] [--target-repo] [--patches-dir] [--dry-run]
230
237
  ```
231
238
 
232
239
  | Flag | Description |
233
240
  |------|-------------|
234
241
  | `--only <name>` | Apply only the specified patch set |
235
242
  | `--until <name>` | Apply patch sets up to and including the specified one |
243
+ | `--all` | Commit all patch sets without prompting |
244
+ | `--edit` | Leave the last patch set uncommitted for manual review |
236
245
 
237
246
  ### `patchy repo reset`
238
247
 
239
- Hard reset the Git working tree of `target_repo`. Discards local changes.
248
+ Hard reset the Git working tree of `target_repo` to `base_revision`. Discards all local changes and patch commits.
240
249
 
241
250
  ```sh
242
- patchy repo reset [--target-repo]
251
+ patchy repo reset [--base-revision] [--target-repo]
243
252
  ```
244
253
 
245
- ### `patchy repo checkout --ref <git-ref>`
254
+ ### `patchy repo clone`
246
255
 
247
- Check out a specific Git ref (branch, tag, or SHA) in `target_repo`.
256
+ Clone a repository into a subdirectory of `clones_dir` and checkout `base_revision`. The target directory is derived from the repo name.
248
257
 
249
258
  ```sh
250
- patchy repo checkout --ref main [--target-repo]
259
+ patchy repo clone [--source-repo] [--clones-dir] [--base-revision]
251
260
  ```
252
261
 
253
- ### `patchy repo clone`
262
+ ### `patchy base [revision]`
254
263
 
255
- Clone a repository into a subdirectory of `clones_dir`. The target directory is derived from the repo name.
264
+ View or update the `base_revision` in config.
256
265
 
257
266
  ```sh
258
- patchy repo clone [--source-repo] [--clones-dir] [--ref]
267
+ patchy base # Interactive
268
+ patchy base abc123def # Set base_revision to the specified SHA or tag
259
269
  ```
260
270
 
261
271
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchy-cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.10-pr.201.67b5de9",
4
4
  "description": "A CLI tool for managing Git patch workflows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,11 +16,11 @@
16
16
  "build-single": "bun run ./scripts/build.ts --single",
17
17
  "check": "bun run scripts/check.ts",
18
18
  "check-fix": "biome check --write --error-on-warnings --diagnostic-level=warn",
19
+ "misc-checks": "bun run scripts/misc-checks.ts",
19
20
  "changeset": "changeset",
20
21
  "changeset-version": "changeset version",
21
22
  "dev": "bun run src/cli.ts",
22
23
  "knip": "knip-bun",
23
- "lint-versions": "syncpack lint",
24
24
  "local-ci": "bun run scripts/local-ci.ts",
25
25
  "prepare": "[ -n \"$CI\" ] || lefthook install",
26
26
  "typecheck": "tsgo --noEmit",
@@ -29,11 +29,11 @@
29
29
  "test-coverage": "bun test --coverage"
30
30
  },
31
31
  "devDependencies": {
32
- "@biomejs/biome": "=2.3.8",
32
+ "@biomejs/biome": "=2.3.10",
33
33
  "@changesets/changelog-github": "=0.5.2",
34
34
  "@changesets/cli": "=2.29.8",
35
35
  "@types/node": "=24.10.3",
36
- "@typescript/native-preview": "=7.0.0-dev.20251213.1",
36
+ "@typescript/native-preview": "=7.0.0-dev.20251222.1",
37
37
  "bun-types": "=1.3.4",
38
38
  "knip": "=5.73.4",
39
39
  "lefthook": "=2.0.11",
@@ -64,11 +64,11 @@
64
64
  "url": "https://github.com/richardgill/patchy"
65
65
  },
66
66
  "optionalDependencies": {
67
- "patchy-cli-linux-x64": "0.0.9",
68
- "patchy-cli-linux-arm64": "0.0.9",
69
- "patchy-cli-darwin-x64": "0.0.9",
70
- "patchy-cli-darwin-arm64": "0.0.9",
71
- "patchy-cli-windows-x64": "0.0.9"
67
+ "patchy-cli-linux-x64": "0.0.10-pr.201.67b5de9",
68
+ "patchy-cli-linux-arm64": "0.0.10-pr.201.67b5de9",
69
+ "patchy-cli-darwin-x64": "0.0.10-pr.201.67b5de9",
70
+ "patchy-cli-darwin-arm64": "0.0.10-pr.201.67b5de9",
71
+ "patchy-cli-windows-x64": "0.0.10-pr.201.67b5de9"
72
72
  },
73
73
  "publishConfig": {
74
74
  "access": "public"
package/schema.json CHANGED
@@ -19,7 +19,10 @@
19
19
  "patch_set": {
20
20
  "type": "string"
21
21
  },
22
- "ref": {
22
+ "base_revision": {
23
+ "type": "string"
24
+ },
25
+ "upstream_branch": {
23
26
  "type": "string"
24
27
  },
25
28
  "verbose": {