open-azdo 0.3.3 → 0.3.4

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/open-azdo.js CHANGED
@@ -66831,7 +66831,7 @@ var extractDiffLineMaps = (diffText) => {
66831
66831
  };
66832
66832
  var buildTargetRefCandidates = (targetBranch) => {
66833
66833
  const normalized = targetBranch.replace(/^refs\/heads\//, "");
66834
- return [targetBranch, `refs/remotes/origin/${normalized}`, `refs/heads/${normalized}`, normalized];
66834
+ return [`refs/remotes/origin/${normalized}`, targetBranch, `refs/heads/${normalized}`, normalized];
66835
66835
  };
66836
66836
  var runGit = (workspace, operation, args2, allowNonZeroExit = false) => exports_Effect.gen(function* () {
66837
66837
  const git = yield* GitExec;
@@ -66842,6 +66842,7 @@ var runGit = (workspace, operation, args2, allowNonZeroExit = false) => exports_
66842
66842
  allowNonZeroExit
66843
66843
  });
66844
66844
  });
66845
+ var resolveCommitRef = (workspace, operation, ref) => runGit(workspace, operation, ["rev-parse", "--verify", `${ref}^{commit}`]).pipe(exports_Effect.map((result4) => result4.stdout.trim()));
66845
66846
  var resolveHeadReviewedSourceCommitCandidate = (workspace) => runGit(workspace, "Git.resolveReviewedSourceCommit.revList", ["rev-list", "--parents", "-n", "1", "HEAD"]).pipe(exports_Effect.map((result4) => {
66846
66847
  const hashes = result4.stdout.trim().split(/\s+/);
66847
66848
  return hashes.length === 3 ? "HEAD^2" : "HEAD";
@@ -66876,6 +66877,36 @@ var isAncestor = ({ workspace, ancestorRef, headRef }) => exports_Effect.gen(fun
66876
66877
  remediation: "Use `checkout: self` with `fetchDepth: 0` so the relevant commit history is available locally."
66877
66878
  });
66878
66879
  });
66880
+ var hasTargetMergeCommitInRange = ({
66881
+ workspace,
66882
+ baseRef,
66883
+ headRef,
66884
+ currentTargetRef
66885
+ }) => exports_Effect.gen(function* () {
66886
+ const history = yield* runGit(workspace, "Git.hasTargetMergeCommitInRange.revList", [
66887
+ "rev-list",
66888
+ "--first-parent",
66889
+ "--parents",
66890
+ `${baseRef}..${headRef}`
66891
+ ]);
66892
+ for (const line of history.stdout.split(`
66893
+ `).map((entry) => entry.trim()).filter(Boolean)) {
66894
+ const [, , ...mergedParents] = line.split(/\s+/);
66895
+ if (mergedParents.length === 0) {
66896
+ continue;
66897
+ }
66898
+ for (const mergedParent of mergedParents) {
66899
+ if (yield* isAncestor({
66900
+ workspace,
66901
+ ancestorRef: mergedParent,
66902
+ headRef: currentTargetRef
66903
+ })) {
66904
+ return true;
66905
+ }
66906
+ }
66907
+ }
66908
+ return false;
66909
+ });
66879
66910
  var resolveDiffRange = ({ workspace, baseRef, headRef }) => exports_Effect.gen(function* () {
66880
66911
  const diff = yield* runGit(workspace, "Git.resolveDiffRange.diff", [
66881
66912
  "diff",
@@ -66924,6 +66955,8 @@ var resolveTargetRef = ({ workspace, targetBranch }) => exports_Effect.gen(funct
66924
66955
  });
66925
66956
  });
66926
66957
  var resolvePullRequestDiff = (input) => exports_Effect.gen(function* () {
66958
+ const targetRef = yield* resolveTargetRef(input);
66959
+ const targetCommit = yield* resolveCommitRef(input.workspace, "Git.resolvePullRequestDiff.targetCommit", targetRef);
66927
66960
  const parents = yield* runGit(input.workspace, "Git.resolvePullRequestDiff.revList", [
66928
66961
  "rev-list",
66929
66962
  "--parents",
@@ -66934,10 +66967,10 @@ var resolvePullRequestDiff = (input) => exports_Effect.gen(function* () {
66934
66967
  const hashes = parents.stdout.trim().split(/\s+/);
66935
66968
  let baseRef = "";
66936
66969
  const headRef = "HEAD";
66937
- if (hashes.length === 3) {
66938
- baseRef = "HEAD^1";
66970
+ const matchingTargetParent = hashes.slice(1).find((hash3) => hash3 === targetCommit);
66971
+ if (matchingTargetParent) {
66972
+ baseRef = matchingTargetParent;
66939
66973
  } else {
66940
- const targetRef = yield* resolveTargetRef(input);
66941
66974
  const mergeBase = yield* runGit(input.workspace, "Git.resolvePullRequestDiff.mergeBase", [
66942
66975
  "merge-base",
66943
66976
  targetRef,
@@ -70159,7 +70192,16 @@ var withSubscriptionLifetime = (client2, lifetime) => ({
70159
70192
  })
70160
70193
  });
70161
70194
  var sessionStatusKey = (status) => status.type === "retry" ? `${status.type}:${status.attempt}` : status.type;
70162
- var TOOL_TITLE_INPUT_KEYS = ["title", "filePath", "path", "command", "query", "url"];
70195
+ var TOOL_TITLE_INPUT_KEYS = ["title", "filePath", "command", "query", "pattern", "path", "url"];
70196
+ var TOOL_PROGRESS_ICONS = {
70197
+ bash: "\uD83D\uDD27",
70198
+ read: "\uD83D\uDCD6",
70199
+ glob: "\u2731",
70200
+ edit: "\u270F\uFE0F",
70201
+ grep: "\uD83D\uDD0E",
70202
+ list: "\uD83D\uDCC2",
70203
+ webfetch: "\uD83C\uDF10"
70204
+ };
70163
70205
  var titleFromToolInput = (input) => {
70164
70206
  for (const key of TOOL_TITLE_INPUT_KEYS) {
70165
70207
  const candidate = input[key];
@@ -70199,14 +70241,13 @@ var getToolProgressFields = (part) => {
70199
70241
  ...durationMs !== undefined ? { durationMs } : {}
70200
70242
  };
70201
70243
  };
70244
+ var getToolProgressIcon = (toolName) => TOOL_PROGRESS_ICONS[toolName] ?? "\u2699\uFE0F";
70202
70245
  var getToolProgressMessage = (phase, part, fields) => {
70203
70246
  const title = fields.title ? truncateForLog(String(fields.title), 160) : undefined;
70204
- const icon = part.tool === "bash" ? "\uD83D\uDD27" : part.tool === "read" ? "\uD83D\uDCD6" : part.tool === "edit" ? "\u270F\uFE0F" : part.tool === "grep" ? "\uD83D\uDD0E" : part.tool === "list" ? "\uD83D\uDCC2" : part.tool === "webfetch" ? "\uD83C\uDF10" : "\u2699\uFE0F";
70247
+ const icon = getToolProgressIcon(part.tool);
70205
70248
  switch (phase) {
70206
70249
  case "started":
70207
70250
  return title ? `${icon} ${title}` : `${icon} ${part.tool}`;
70208
- case "completed":
70209
- return title ? `${icon} done: ${title}` : `${icon} done`;
70210
70251
  case "failed":
70211
70252
  return title ? `\u26A0\uFE0F ${part.tool}: ${title}` : `\u26A0\uFE0F ${part.tool}`;
70212
70253
  }
@@ -71761,6 +71802,38 @@ var resolveReviewScope = ({
71761
71802
  return;
71762
71803
  }));
71763
71804
  if (previousCommitIsAncestor === true) {
71805
+ const followUpContainsTargetMerge = yield* hasTargetMergeCommitInRange({
71806
+ workspace: config.workspace,
71807
+ baseRef: previousReviewedCommit,
71808
+ headRef: reviewedSourceCommit,
71809
+ currentTargetRef: fullPullRequestDiff.baseRef
71810
+ }).pipe(exports_Effect.orElseSucceed(() => {
71811
+ return;
71812
+ }));
71813
+ if (followUpContainsTargetMerge === true) {
71814
+ yield* logInfo2("Follow-up range includes a merge from the target branch. Falling back to a full review to avoid reviewing target-only merge changes.", {
71815
+ previousReviewedCommit,
71816
+ reviewedSourceCommit,
71817
+ currentPullRequestBaseRef: fullPullRequestDiff.baseRef
71818
+ });
71819
+ return {
71820
+ reviewMode: "full",
71821
+ scopedDiff: fullPullRequestDiff,
71822
+ previousReviewedCommit
71823
+ };
71824
+ }
71825
+ if (followUpContainsTargetMerge === undefined) {
71826
+ yield* logInfo2("Could not validate whether the follow-up range includes a merge from the target branch. Falling back to a full review.", {
71827
+ previousReviewedCommit,
71828
+ reviewedSourceCommit,
71829
+ currentPullRequestBaseRef: fullPullRequestDiff.baseRef
71830
+ });
71831
+ return {
71832
+ reviewMode: "full",
71833
+ scopedDiff: fullPullRequestDiff,
71834
+ previousReviewedCommit
71835
+ };
71836
+ }
71764
71837
  return {
71765
71838
  reviewMode: "follow-up",
71766
71839
  scopedDiff: yield* resolveDiffRange({
@@ -73076,7 +73149,7 @@ var sandboxCaptureCommand = make34("capture", sandboxCaptureCommandConfig).pipe(
73076
73149
  var sandboxCommand = make34("sandbox").pipe(withDescription3("Sandbox tooling for live capture and local preview."), withSubcommands([sandboxCaptureCommand]));
73077
73150
  var openAzdoCli = make34("open-azdo").pipe(withDescription3("Secure Azure DevOps pull-request review CLI powered by OpenCode."), withSubcommands([reviewCommand, sandboxCommand]));
73078
73151
  // package.json
73079
- var version2 = "0.3.3";
73152
+ var version2 = "0.3.4";
73080
73153
 
73081
73154
  // src/Main.ts
73082
73155
  var cliProgram = run3(openAzdoCli, { version: version2 }).pipe(exports_Effect.scoped, exports_Effect.provide(BaseRuntimeLayer));
@@ -73085,4 +73158,4 @@ var main = () => runMain2(cliProgram, { disableErrorReporting: true });
73085
73158
  // bin/open-azdo.ts
73086
73159
  main();
73087
73160
 
73088
- //# debugId=19FF78D0D39C785464756E2164756E21
73161
+ //# debugId=2B0BDD0B7FAF788564756E2164756E21