@dunnewold-labs/mr-manager 0.4.39 → 0.4.40

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 (2) hide show
  1. package/dist/index.mjs +25 -13
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -185,7 +185,7 @@ import { fileURLToPath } from "url";
185
185
  // cli/package.json
186
186
  var package_default = {
187
187
  name: "@dunnewold-labs/mr-manager",
188
- version: "0.4.39",
188
+ version: "0.4.40",
189
189
  description: "Mr. Manager - Task and project management CLI",
190
190
  bin: {
191
191
  mr: "./dist/index.mjs"
@@ -5893,25 +5893,37 @@ var reviewCommand = new Command25("review").description("Run an automated code r
5893
5893
  }
5894
5894
  }
5895
5895
  log(`Reviewing branch: ${paint8("cyan", branch)} against ${paint8("dim", baseBranch)}`);
5896
- try {
5897
- diff = execSync5(`git diff ${baseBranch}...${branch} -- . ':!*.lock' ':!package-lock.json' ':!pnpm-lock.yaml'`, {
5898
- cwd: projectPath,
5899
- encoding: "utf-8",
5900
- maxBuffer: 10 * 1024 * 1024
5901
- }).trim();
5902
- } catch (err) {
5896
+ const pathspec = `-- . ':!*.lock' ':!package-lock.json' ':!pnpm-lock.yaml'`;
5897
+ const tryDiff = (range) => {
5903
5898
  try {
5904
- execSync5(`git fetch origin ${baseBranch}`, { cwd: projectPath, encoding: "utf-8", stdio: "pipe" });
5905
- diff = execSync5(`git diff origin/${baseBranch}...${branch} -- . ':!*.lock' ':!package-lock.json' ':!pnpm-lock.yaml'`, {
5899
+ return execSync5(`git diff ${range} ${pathspec}`, {
5906
5900
  cwd: projectPath,
5907
5901
  encoding: "utf-8",
5908
- maxBuffer: 10 * 1024 * 1024
5902
+ maxBuffer: 10 * 1024 * 1024,
5903
+ stdio: ["ignore", "pipe", "pipe"]
5909
5904
  }).trim();
5910
5905
  } catch {
5911
- logErr(`Failed to get diff between ${baseBranch} and ${branch}: ${err.message}`);
5912
- process.exit(1);
5906
+ return null;
5907
+ }
5908
+ };
5909
+ const tryFetch = (ref) => {
5910
+ try {
5911
+ execSync5(`git fetch origin ${ref}`, { cwd: projectPath, encoding: "utf-8", stdio: "pipe" });
5912
+ } catch {
5913
5913
  }
5914
+ };
5915
+ let result = tryDiff(`${baseBranch}...${branch}`);
5916
+ if (result === null) {
5917
+ tryFetch(baseBranch);
5918
+ tryFetch(branch);
5919
+ result = tryDiff(`origin/${baseBranch}...${branch}`) ?? tryDiff(`origin/${baseBranch}...origin/${branch}`) ?? tryDiff(`${baseBranch}...origin/${branch}`);
5920
+ }
5921
+ if (result === null) {
5922
+ logErr(`Failed to get diff between ${baseBranch} and ${branch} in ${projectPath}.`);
5923
+ logErr(`Branch may not exist locally or on origin. Try fetching it manually, or attach a PR URL to the review.`);
5924
+ process.exit(1);
5914
5925
  }
5926
+ diff = result;
5915
5927
  }
5916
5928
  log(`Project: ${paint8("cyan", project.name)}`);
5917
5929
  if (!diff) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dunnewold-labs/mr-manager",
3
- "version": "0.4.39",
3
+ "version": "0.4.40",
4
4
  "description": "Mr. Manager - Task and project management CLI",
5
5
  "bin": {
6
6
  "mr": "./dist/index.mjs"