@mikaelkaron/skills-cherry-pick-filter 0.2.3 → 0.4.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.
@@ -60,9 +60,10 @@ All human-readable output goes to stderr. stdout emits one picked commit SHA per
60
60
  this.logToStderr(`Checking out '${targetBranch}' from origin...`);
61
61
  const checkoutResult = tryExec(`git checkout --track origin/${targetBranch}`);
62
62
  if (!checkoutResult.ok) {
63
- this.logToStderr(`Error: failed to checkout '${targetBranch}' from origin.`);
64
63
  this.logToStderr(checkoutResult.output);
65
- this.exit(1);
64
+ this.error(`failed to checkout '${targetBranch}' from origin.`, {
65
+ exit: 1,
66
+ });
66
67
  }
67
68
  exec(`git checkout ${currentBranch}`);
68
69
  }
@@ -115,7 +116,7 @@ All human-readable output goes to stderr. stdout emits one picked commit SHA per
115
116
  this.logToStderr(`Split each commit with:`);
116
117
  this.logToStderr(` git rebase -i ${mixed[0].sha.slice(0, 9)}^\n`);
117
118
  this.logToStderr(`Then re-run: git cherry-pick-filter ${targetBranch} ${filters.map((f) => `--filter ${f}`).join(" ")}`);
118
- this.exit(1);
119
+ this.error(`${mixed.length} mixed commit(s) detected — split before syncing.`, { exit: 1 });
119
120
  }
120
121
  const verb = dryRun ? "Would pick" : "Ready to pick";
121
122
  this.logToStderr(`${verb} ${candidates.length} commit${candidates.length === 1 ? "" : "s"}:`);
@@ -137,11 +138,12 @@ All human-readable output goes to stderr. stdout emits one picked commit SHA per
137
138
  picked++;
138
139
  }
139
140
  else {
140
- this.logToStderr(`\nCherry-pick failed: ${sha.slice(0, 9)} ${subject}\n`);
141
141
  this.logToStderr("Resolve the conflict then run:");
142
142
  this.logToStderr(" git cherry-pick --continue");
143
143
  this.logToStderr(" git cherry-pick --abort (to cancel)");
144
- this.exit(1);
144
+ this.error(`cherry-pick failed: ${sha.slice(0, 9)} ${subject}`, {
145
+ exit: 1,
146
+ });
145
147
  }
146
148
  }
147
149
  exec(`git checkout ${currentBranch}`);
package/dist/lib/git.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { execSync } from "node:child_process";
2
2
  export function exec(cmd) {
3
- return execSync(cmd, { encoding: "utf8", stdio: ["pipe", "pipe", "inherit"] }).trim();
3
+ return execSync(cmd, {
4
+ encoding: "utf8",
5
+ stdio: ["pipe", "pipe", "inherit"],
6
+ }).trim();
4
7
  }
5
8
  export function tryExec(cmd) {
6
9
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikaelkaron/skills-cherry-pick-filter",
3
- "version": "0.2.3",
3
+ "version": "0.4.0",
4
4
  "bin": {
5
5
  "mks-cherry-pick-filter": "bin/run.js"
6
6
  },
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "scripts": {
17
17
  "build": "tsc",
18
+ "pretest": "npm run build",
18
19
  "test": "node --experimental-strip-types --test 'test/**/*.test.ts'",
19
20
  "test:types": "tsc -p test/tsconfig.json"
20
21
  },