@mikaelkaron/skills-cherry-pick-filter 1.0.1 → 2.0.0
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 +102 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
2
|
+
|
|
3
|
+
# @mikaelkaron/skills-cherry-pick-filter
|
|
4
|
+
|
|
5
|
+
Sync a working branch to a clean target branch by cherry-picking commits that don't touch filtered path prefixes.
|
|
6
|
+
|
|
7
|
+
Part of the [skills monorepo](../../README.md).
|
|
8
|
+
|
|
9
|
+
## What it does
|
|
10
|
+
|
|
11
|
+
`mks-cherry-pick-filter` analyses commits on your current branch that are not yet on the target branch, then:
|
|
12
|
+
|
|
13
|
+
1. **Skips** commits where every changed file matches a filtered path prefix (e.g. `.planning/` notes, AI context files).
|
|
14
|
+
2. **Picks** the remaining code-only commits onto the target branch in order.
|
|
15
|
+
3. **Halts** before picking anything if it finds mixed commits — commits that touch both filtered paths and code paths — and reports exactly which files to split.
|
|
16
|
+
|
|
17
|
+
Human-readable output goes to stderr. When stdout is piped (not a TTY), one picked commit SHA is written per line, making it easy to chain with other git commands.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @mikaelkaron/skills-cherry-pick-filter
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Requires Node.js >= 22.18 and `git` on `PATH`.
|
|
26
|
+
|
|
27
|
+
### As an mks plugin
|
|
28
|
+
|
|
29
|
+
If you use the `mks` CLI from this monorepo, install the package and it will be picked up automatically as the `cherry-pick-filter` plugin.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
mks-cherry-pick-filter <targetBranch> --filter <prefix> [--filter <prefix>] [--dry-run]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Arguments
|
|
38
|
+
|
|
39
|
+
| Argument | Description |
|
|
40
|
+
| -------------- | -------------------------------------------------- |
|
|
41
|
+
| `targetBranch` | Branch to cherry-pick code commits onto (required) |
|
|
42
|
+
|
|
43
|
+
### Flags
|
|
44
|
+
|
|
45
|
+
| Flag | Description | Default |
|
|
46
|
+
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
|
|
47
|
+
| `--filter <prefix>` | Path prefix to filter out. Repeatable. Commits where ALL changed files match are skipped; commits where SOME files match cause the command to abort. | — (required) |
|
|
48
|
+
| `--dry-run` | Analyse and list commits without cherry-picking | `false` |
|
|
49
|
+
|
|
50
|
+
## Examples
|
|
51
|
+
|
|
52
|
+
Sync current branch to `beta`, filtering out `.planning/` commits:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
mks-cherry-pick-filter beta --filter .planning/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Filter multiple path prefixes:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
mks-cherry-pick-filter beta --filter .planning/ --filter .agents/
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Dry run — analyse without cherry-picking:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
mks-cherry-pick-filter beta --filter .planning/ --dry-run
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Capture picked SHAs for downstream use:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
mks-cherry-pick-filter beta --filter .planning/ | xargs git log --oneline
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Mixed commit detection
|
|
77
|
+
|
|
78
|
+
If a commit touches files both inside and outside the filter prefixes, the command:
|
|
79
|
+
|
|
80
|
+
- Lists every such commit with its filtered files and code files.
|
|
81
|
+
- Exits without cherry-picking anything.
|
|
82
|
+
- Prints the `git rebase -i` command to split each mixed commit.
|
|
83
|
+
|
|
84
|
+
Resolve all mixed commits first, then re-run.
|
|
85
|
+
|
|
86
|
+
## Branch resolution
|
|
87
|
+
|
|
88
|
+
If `targetBranch` does not exist locally, the command checks `origin` and automatically tracks it before proceeding. If it is not found there either, the command exits with an error.
|
|
89
|
+
|
|
90
|
+
## Environment
|
|
91
|
+
|
|
92
|
+
| Variable | Description |
|
|
93
|
+
| --------- | ------------------------------------------------------------ |
|
|
94
|
+
| `GIT_CMD` | Override the `git` executable path (defaults to `which git`) |
|
|
95
|
+
|
|
96
|
+
## Running tests
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm test
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Tests use a bundled fixture repository (`test/fixtures/repo.bundle`) and run against the compiled output.
|
package/oclif.manifest.json
CHANGED