pullfrog 0.1.105 → 0.1.106

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/dist/cli.mjs CHANGED
@@ -112919,7 +112919,7 @@ var import_picocolors = __toESM(require_picocolors(), 1);
112919
112919
  // package.json
112920
112920
  var package_default = {
112921
112921
  name: "pullfrog",
112922
- version: "0.1.105",
112922
+ version: "0.1.106",
112923
112923
  cliContractVersion: "1",
112924
112924
  type: "module",
112925
112925
  bin: {
@@ -118421,7 +118421,7 @@ import { chmodSync, createWriteStream, existsSync as existsSync4, mkdirSync } fr
118421
118421
  import { join as join2 } from "node:path";
118422
118422
  import { pipeline } from "node:stream/promises";
118423
118423
  function resolveNpm() {
118424
- const npmCli = process.env.npm_execpath;
118424
+ const npmCli = process.env.NPM_EXECPATH;
118425
118425
  if (npmCli?.endsWith("npm-cli.js")) return { command: process.execPath, args: [npmCli] };
118426
118426
  return { command: "npm", args: [] };
118427
118427
  }
@@ -193695,14 +193695,15 @@ function computeIncrementalDiff(params) {
193695
193695
  const tips = [`origin/${params.baseBranch}`, ...params.formerBaseTips];
193696
193696
  const oldBase = versionBase({ sha: params.beforeSha, tips });
193697
193697
  const newBase = versionBase({ sha: params.headSha, tips });
193698
+ const replayed = oldBase === newBase ? null : replay({ sha: params.beforeSha, from: oldBase, onto: newBase });
193698
193699
  const raw2 = $(
193699
193700
  "sh",
193700
193701
  [
193701
193702
  "-c",
193702
193703
  'git range-diff --no-color --creation-factor=1000 "$1..$(git commit-tree "$2^{tree}" -p "$1" -m x)" "$3..$(git commit-tree "$4^{tree}" -p "$3" -m x)"',
193703
193704
  "--",
193704
- oldBase,
193705
- params.beforeSha,
193705
+ replayed ? newBase : oldBase,
193706
+ replayed ?? params.beforeSha,
193706
193707
  newBase,
193707
193708
  params.headSha
193708
193709
  ],
@@ -193737,6 +193738,22 @@ function versionBase(params) {
193737
193738
  }
193738
193739
  return best.sha;
193739
193740
  }
193741
+ function replay(params) {
193742
+ try {
193743
+ return git([
193744
+ "merge-tree",
193745
+ "--write-tree",
193746
+ `--merge-base=${params.from}`,
193747
+ params.onto,
193748
+ params.sha
193749
+ ]);
193750
+ } catch {
193751
+ log2.info(
193752
+ `\xBB incremental diff: ${params.sha.slice(0, 7)} does not replay onto the new base; comparing each on its own`
193753
+ );
193754
+ return null;
193755
+ }
193756
+ }
193740
193757
  function isDiffPrefix(ch) {
193741
193758
  return ch === " " || ch === "+" || ch === "-";
193742
193759
  }
@@ -200996,11 +201013,25 @@ import { execFileSync as execFileSync7, execSync as execSync2 } from "node:child
200996
201013
  import { mkdtempSync as mkdtempSync3, readdirSync, realpathSync as realpathSync2, rmSync as rmSync4, unlinkSync as unlinkSync2 } from "node:fs";
200997
201014
  import { tmpdir as tmpdir3 } from "node:os";
200998
201015
  import { join as join16 } from "node:path";
201016
+ var TEMP_DIR_STATE = "temp_dir";
200999
201017
  function createTempDirectory() {
201000
201018
  const path4 = mkdtempSync3(join16(tmpdir3(), "pullfrog-"));
201001
201019
  process.env.PULLFROG_TEMP_DIR = path4;
201002
201020
  log2.info(`\xBB created temp dir at ${path4}`);
201003
- return { path: path4, [Symbol.dispose]: () => removeTempDirectory(path4) };
201021
+ const tracked = process.env.RUNNER_ENVIRONMENT !== "github-hosted";
201022
+ if (tracked) saveSecretState(TEMP_DIR_STATE, path4);
201023
+ return {
201024
+ path: path4,
201025
+ [Symbol.dispose]: () => {
201026
+ if (removeTempDirectory(path4) && tracked) saveSecretState(TEMP_DIR_STATE, "");
201027
+ }
201028
+ };
201029
+ }
201030
+ function removeAbandonedTempDirectory() {
201031
+ const path4 = getState(TEMP_DIR_STATE);
201032
+ if (!path4) return;
201033
+ log2.info(`\xBB removing temp dir left by an interrupted run at ${path4}`);
201034
+ removeTempDirectory(path4);
201004
201035
  }
201005
201036
  function removeTempDirectory(path4) {
201006
201037
  try {
@@ -201011,10 +201042,12 @@ function removeTempDirectory(path4) {
201011
201042
  rmSync4(path4, { recursive: true, force: true });
201012
201043
  }
201013
201044
  log2.debug(`\xBB removed temp dir at ${path4}`);
201045
+ return true;
201014
201046
  } catch (err) {
201015
201047
  log2.warning(
201016
201048
  `\xBB could not remove temp dir at ${path4}: ${err instanceof Error ? err.message : String(err)}`
201017
201049
  );
201050
+ return false;
201018
201051
  }
201019
201052
  }
201020
201053
  function wipeRunnerLeakSurface() {
@@ -209665,6 +209698,7 @@ async function runCli5(params) {
209665
209698
  async function run(args2) {
209666
209699
  if (args2.includes("--post") && !args2.includes("token")) {
209667
209700
  await runOAuthWriteback().catch((error63) => warning(`oauth post-hook: ${error63}`));
209701
+ removeAbandonedTempDirectory();
209668
209702
  return;
209669
209703
  }
209670
209704
  try {
@@ -210066,7 +210100,7 @@ function resolveTarget2(repo) {
210066
210100
  return { owner: match3[1], repo: match3[2] };
210067
210101
  }
210068
210102
  function cliVersion() {
210069
- const parts = /^(\d+)\.(\d+)\.(\d+)$/.exec("0.1.105");
210103
+ const parts = /^(\d+)\.(\d+)\.(\d+)$/.exec("0.1.106");
210070
210104
  if (!parts) return "0.0.0";
210071
210105
  return `${Number(parts[1])}.${Number(parts[2])}.${Number(parts[3])}`;
210072
210106
  }
@@ -210263,7 +210297,7 @@ async function runCli9(input2) {
210263
210297
  }
210264
210298
 
210265
210299
  // cli.ts
210266
- var VERSION10 = "0.1.105";
210300
+ var VERSION10 = "0.1.106";
210267
210301
  var bin = basename2(process.argv[1] || "");
210268
210302
  var PROG = bin === "pf" || bin === "pullfrog" ? bin : "pullfrog";
210269
210303
  var rawArgs = process.argv.slice(2);
package/dist/index.js CHANGED
@@ -111839,7 +111839,7 @@ import { chmodSync, createWriteStream, existsSync as existsSync3, mkdirSync } fr
111839
111839
  import { join } from "node:path";
111840
111840
  import { pipeline } from "node:stream/promises";
111841
111841
  function resolveNpm() {
111842
- const npmCli = process.env.npm_execpath;
111842
+ const npmCli = process.env.NPM_EXECPATH;
111843
111843
  if (npmCli?.endsWith("npm-cli.js")) return { command: process.execPath, args: [npmCli] };
111844
111844
  return { command: "npm", args: [] };
111845
111845
  }
@@ -112171,7 +112171,7 @@ var import_semver = __toESM(require_semver2(), 1);
112171
112171
  // package.json
112172
112172
  var package_default = {
112173
112173
  name: "pullfrog",
112174
- version: "0.1.105",
112174
+ version: "0.1.106",
112175
112175
  cliContractVersion: "1",
112176
112176
  type: "module",
112177
112177
  bin: {
@@ -190177,14 +190177,15 @@ function computeIncrementalDiff(params) {
190177
190177
  const tips = [`origin/${params.baseBranch}`, ...params.formerBaseTips];
190178
190178
  const oldBase = versionBase({ sha: params.beforeSha, tips });
190179
190179
  const newBase = versionBase({ sha: params.headSha, tips });
190180
+ const replayed = oldBase === newBase ? null : replay({ sha: params.beforeSha, from: oldBase, onto: newBase });
190180
190181
  const raw2 = $(
190181
190182
  "sh",
190182
190183
  [
190183
190184
  "-c",
190184
190185
  'git range-diff --no-color --creation-factor=1000 "$1..$(git commit-tree "$2^{tree}" -p "$1" -m x)" "$3..$(git commit-tree "$4^{tree}" -p "$3" -m x)"',
190185
190186
  "--",
190186
- oldBase,
190187
- params.beforeSha,
190187
+ replayed ? newBase : oldBase,
190188
+ replayed ?? params.beforeSha,
190188
190189
  newBase,
190189
190190
  params.headSha
190190
190191
  ],
@@ -190219,6 +190220,22 @@ function versionBase(params) {
190219
190220
  }
190220
190221
  return best.sha;
190221
190222
  }
190223
+ function replay(params) {
190224
+ try {
190225
+ return git([
190226
+ "merge-tree",
190227
+ "--write-tree",
190228
+ `--merge-base=${params.from}`,
190229
+ params.onto,
190230
+ params.sha
190231
+ ]);
190232
+ } catch {
190233
+ log.info(
190234
+ `\xBB incremental diff: ${params.sha.slice(0, 7)} does not replay onto the new base; comparing each on its own`
190235
+ );
190236
+ return null;
190237
+ }
190238
+ }
190222
190239
  function isDiffPrefix(ch) {
190223
190240
  return ch === " " || ch === "+" || ch === "-";
190224
190241
  }
@@ -197478,11 +197495,19 @@ import { execFileSync as execFileSync6, execSync as execSync2 } from "node:child
197478
197495
  import { mkdtempSync as mkdtempSync2, readdirSync, realpathSync as realpathSync2, rmSync as rmSync2, unlinkSync as unlinkSync2 } from "node:fs";
197479
197496
  import { tmpdir as tmpdir2 } from "node:os";
197480
197497
  import { join as join15 } from "node:path";
197498
+ var TEMP_DIR_STATE = "temp_dir";
197481
197499
  function createTempDirectory() {
197482
197500
  const path4 = mkdtempSync2(join15(tmpdir2(), "pullfrog-"));
197483
197501
  process.env.PULLFROG_TEMP_DIR = path4;
197484
197502
  log.info(`\xBB created temp dir at ${path4}`);
197485
- return { path: path4, [Symbol.dispose]: () => removeTempDirectory(path4) };
197503
+ const tracked = process.env.RUNNER_ENVIRONMENT !== "github-hosted";
197504
+ if (tracked) saveSecretState(TEMP_DIR_STATE, path4);
197505
+ return {
197506
+ path: path4,
197507
+ [Symbol.dispose]: () => {
197508
+ if (removeTempDirectory(path4) && tracked) saveSecretState(TEMP_DIR_STATE, "");
197509
+ }
197510
+ };
197486
197511
  }
197487
197512
  function removeTempDirectory(path4) {
197488
197513
  try {
@@ -197493,10 +197518,12 @@ function removeTempDirectory(path4) {
197493
197518
  rmSync2(path4, { recursive: true, force: true });
197494
197519
  }
197495
197520
  log.debug(`\xBB removed temp dir at ${path4}`);
197521
+ return true;
197496
197522
  } catch (err) {
197497
197523
  log.warning(
197498
197524
  `\xBB could not remove temp dir at ${path4}: ${err instanceof Error ? err.message : String(err)}`
197499
197525
  );
197526
+ return false;
197500
197527
  }
197501
197528
  }
197502
197529
  function wipeRunnerLeakSurface() {
package/dist/internal.js CHANGED
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  // package.json
9
9
  var package_default = {
10
10
  name: "pullfrog",
11
- version: "0.1.105",
11
+ version: "0.1.106",
12
12
  cliContractVersion: "1",
13
13
  type: "module",
14
14
  bin: {
@@ -14,6 +14,8 @@ export declare function createTempDirectory(): {
14
14
  path: string;
15
15
  [Symbol.dispose]: () => void;
16
16
  };
17
+ /** the `post:` hook's half of `createTempDirectory`: removes the directory a cancelled run left. */
18
+ export declare function removeAbandonedTempDirectory(): void;
17
19
  /**
18
20
  * snapshot-and-delete the GHA runner's known credential leak surfaces inside
19
21
  * `$RUNNER_TEMP` before the agent spawns. without this, a shell-capable agent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pullfrog",
3
- "version": "0.1.105",
3
+ "version": "0.1.106",
4
4
  "cliContractVersion": "1",
5
5
  "type": "module",
6
6
  "bin": {