revdeck 0.19.1 → 0.20.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/dist/mcp.js CHANGED
@@ -306,7 +306,7 @@ async function readTextNoFollow(file, maxBytes = 4 * 1024 * 1024) {
306
306
  }
307
307
 
308
308
  // src/version.ts
309
- var VERSION = "0.19.1";
309
+ var VERSION = "0.20.0";
310
310
 
311
311
  // src/client.ts
312
312
  var RpcError = class extends Error {
@@ -857,25 +857,40 @@ function renderContext(review, rules, options = {}) {
857
857
  const push = (line = "") => {
858
858
  lines.push(line);
859
859
  };
860
- push(`# ${t("\u0420\u0435\u0432\u044C\u044E", "Review")} ${review.info.ref.project}#${review.info.ref.number}: ${review.info.title}`);
861
- push(review.info.webUrl);
862
- const own = isOwnReview(review);
860
+ const local = review.info.local;
861
+ if (local) push(`# ${t("\u0420\u0435\u0432\u044C\u044E \u0432\u0435\u0442\u043A\u0438", "Branch review")} \`${local.branch}\``);
862
+ else push(`# ${t("\u0420\u0435\u0432\u044C\u044E", "Review")} ${review.info.ref.project}#${review.info.ref.number}: ${review.info.title}`);
863
+ if (review.info.webUrl) push(review.info.webUrl);
864
+ const own = local ? null : isOwnReview(review);
863
865
  const ownSuffix = own === null ? "" : own ? ` \xB7 ${t("\u044D\u0442\u043E \u0432\u0430\u0448 MR", "your MR")}` : ` \xB7 ${t("\u0447\u0443\u0436\u043E\u0439 MR", "someone else's MR")}`;
864
- push(`${review.info.sourceBranch} \u2192 ${review.info.targetBranch} \xB7 ${review.info.state} \xB7 ${t("\u0430\u0432\u0442\u043E\u0440", "by")} ${review.info.author}${ownSuffix}`);
866
+ const stateLabel = local ? t("\u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 diff", "local diff") : review.info.state;
867
+ push(`${review.info.sourceBranch} \u2192 ${review.info.targetBranch} \xB7 ${stateLabel} \xB7 ${t("\u0430\u0432\u0442\u043E\u0440", "by")} ${review.info.author}${ownSuffix}`);
865
868
  push("");
866
869
  const merge = review.info.merge;
867
870
  const targetBranch = review.info.targetBranch;
868
871
  const shortSha = (sha) => sha ? sha.slice(0, 12) : "?";
869
872
  push(`## ${t("\u0412\u0435\u0442\u043A\u0430 \u0438 \u0431\u0430\u0437\u0430 \u0441\u0440\u0430\u0432\u043D\u0435\u043D\u0438\u044F", "Branch and comparison base")}`);
870
873
  push(
871
- `${t("\u041A\u0443\u0434\u0430 \u043C\u0435\u0440\u0436\u0438\u0442\u0441\u044F", "Merges into")}: ${targetBranch ? `\`${targetBranch}\`` : t("\u043D\u0435 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u043C\u043E (\u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 diff)", "not applicable (local diff)")}`
874
+ `${local ? t("\u0411\u0430\u0437\u0430 \u0441\u0440\u0430\u0432\u043D\u0435\u043D\u0438\u044F", "Compared against") : t("\u041A\u0443\u0434\u0430 \u043C\u0435\u0440\u0436\u0438\u0442\u0441\u044F", "Merges into")}: ${targetBranch ? `\`${targetBranch}\`` : t("\u043D\u0435 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u043C\u043E (\u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 diff)", "not applicable (local diff)")}`
872
875
  );
873
876
  push(`${t("\u0418\u0441\u0442\u043E\u0447\u043D\u0438\u043A", "Source")}: \`${review.info.sourceBranch || "?"}\``);
874
877
  if (review.info.commit.base || review.info.commit.head) {
875
878
  push(`${t("\u0421\u043D\u0438\u043C\u043E\u043A diff", "Diff snapshot")}: \`${shortSha(review.info.commit.base)}\` \u2192 \`${shortSha(review.info.commit.head)}\``);
876
879
  }
877
880
  push(`${t("\u0421\u043D\u0438\u043C\u043E\u043A \u043E\u0431\u043D\u043E\u0432\u043B\u0451\u043D", "Snapshot updated")}: ${when(review.syncedAt, language)}`);
878
- if (!targetBranch) {
881
+ if (local) {
882
+ push(`${t("\u0421\u0442\u0430\u0442\u0443\u0441 \u043C\u0435\u0440\u0436\u0430", "Merge status")}: ${t("\u043D\u0435 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u043C (\u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 diff)", "not applicable (local diff)")}`);
883
+ push(t(
884
+ "> \u042D\u0442\u043E \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 diff \u0431\u0435\u0437 \u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u044B: \u0442\u0440\u0435\u0434\u043E\u0432, \u0440\u0435\u0430\u043A\u0446\u0438\u0439, CI-checks \u0438 approvals \u043D\u0435\u0442. \u0417\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F \u043D\u0435 \u043F\u0443\u0431\u043B\u0438\u043A\u0443\u044E\u0442\u0441\u044F, \u043E\u0442\u0447\u0451\u0442 \u2014 \u0435\u0434\u0438\u043D\u0441\u0442\u0432\u0435\u043D\u043D\u044B\u0439 \u0430\u0440\u0442\u0435\u0444\u0430\u043A\u0442.",
885
+ "> This is a local diff without a platform: there are no threads, reactions, CI checks or approvals. Findings are not published; the report is the only artifact."
886
+ ));
887
+ if (local.dirty > 0) {
888
+ push(t(
889
+ `> \u0412 \u0440\u0430\u0431\u043E\u0447\u0435\u0439 \u043A\u043E\u043F\u0438\u0438 ${local.dirty} \u0444\u0430\u0439\u043B\u043E\u0432 \u0441 \u043D\u0435\u0437\u0430\u043A\u043E\u043C\u043C\u0438\u0447\u0435\u043D\u043D\u044B\u043C\u0438 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F\u043C\u0438 \u2014 \u043E\u043D\u0438 \u043D\u0435 \u0432\u0445\u043E\u0434\u044F\u0442 \u0432 diff.`,
890
+ `> The working copy has ${local.dirty} files with uncommitted changes \u2014 they are not part of the diff.`
891
+ ));
892
+ }
893
+ } else if (!targetBranch) {
879
894
  push(`${t("\u0421\u0442\u0430\u0442\u0443\u0441 \u043C\u0435\u0440\u0436\u0430", "Merge status")}: ${t("\u043D\u0435 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u043C", "not applicable")}`);
880
895
  } else if (!merge) {
881
896
  push(`${t("\u0421\u0442\u0430\u0442\u0443\u0441 \u043C\u0435\u0440\u0436\u0430", "Merge status")}: ${t("\u043D\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u043B\u0441\u044F", "not checked")}`);
@@ -884,8 +899,8 @@ function renderContext(review, rules, options = {}) {
884
899
  "> No merge status was reported: do not claim there are no findings until the target and conflicts are checked."
885
900
  ));
886
901
  } else {
887
- const stateLabel = merge.state === "clean" ? t("\u0447\u0438\u0441\u0442\u043E", "clean") : merge.state === "conflict" ? t("\u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442", "conflict") : merge.state === "behind" ? t("\u043E\u0442\u0441\u0442\u0430\u0451\u0442 \u043E\u0442 target", "behind target") : merge.state === "unknown" ? t("\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043D", "unknown") : t("\u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u0430 \u043D\u0435 \u0441\u043E\u043E\u0431\u0449\u0438\u043B\u0430", "not reported");
888
- push(`${t("\u0421\u0442\u0430\u0442\u0443\u0441 \u043C\u0435\u0440\u0436\u0430", "Merge status")}: ${stateLabel}${merge.detail ? ` \xB7 ${merge.detail}` : ""}`);
902
+ const stateLabel2 = merge.state === "clean" ? t("\u0447\u0438\u0441\u0442\u043E", "clean") : merge.state === "conflict" ? t("\u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442", "conflict") : merge.state === "behind" ? t("\u043E\u0442\u0441\u0442\u0430\u0451\u0442 \u043E\u0442 target", "behind target") : merge.state === "unknown" ? t("\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043D", "unknown") : t("\u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u0430 \u043D\u0435 \u0441\u043E\u043E\u0431\u0449\u0438\u043B\u0430", "not reported");
903
+ push(`${t("\u0421\u0442\u0430\u0442\u0443\u0441 \u043C\u0435\u0440\u0436\u0430", "Merge status")}: ${stateLabel2}${merge.detail ? ` \xB7 ${merge.detail}` : ""}`);
889
904
  if (merge.targetSha) push(`${t("Target head", "Target head")}: \`${shortSha(merge.targetSha)}\``);
890
905
  if (merge.state === "conflict") {
891
906
  push(t(
@@ -956,11 +971,19 @@ function renderContext(review, rules, options = {}) {
956
971
  }
957
972
  push("");
958
973
  if (options.scenario === "feedback") {
959
- push(`## ${t("\u0421\u0446\u0435\u043D\u0430\u0440\u0438\u0439: \u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F \u043A \u0441\u0432\u043E\u0435\u043C\u0443 MR", "Scenario: feedback on your own MR")}`);
960
- push(t(
961
- "\u041F\u0440\u043E\u0446\u0435\u0434\u0443\u0440\u0430: `Feedback.md` \u0438\u0437 skill revdeck. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0441\u0432\u0435\u0440\u044C\u0442\u0435 \u0440\u0430\u0431\u043E\u0447\u0443\u044E \u0432\u0435\u0442\u043A\u0443 \u0441 MR, \u0437\u0430\u0442\u0435\u043C \u0440\u0430\u0437\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u0435 \u0442\u0440\u0435\u0434\u044B \u0438 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438 \u043A \u0441\u0442\u0440\u043E\u043A\u0430\u043C.",
962
- "Procedure: `Feedback.md` from the revdeck skill. First verify the working branch matches the MR, then work through open threads and line comments."
963
- ));
974
+ const local2 = Boolean(review.info.local);
975
+ push(
976
+ local2 ? `## ${t("\u0421\u0446\u0435\u043D\u0430\u0440\u0438\u0439: \u0434\u043E\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u0441\u0432\u043E\u0435\u0439 \u0432\u0435\u0442\u043A\u0438", "Scenario: improving your branch")}` : `## ${t("\u0421\u0446\u0435\u043D\u0430\u0440\u0438\u0439: \u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F \u043A \u0441\u0432\u043E\u0435\u043C\u0443 MR", "Scenario: feedback on your own MR")}`
977
+ );
978
+ push(
979
+ local2 ? t(
980
+ "\u041F\u0440\u043E\u0446\u0435\u0434\u0443\u0440\u0430: `Feedback.md` \u0438\u0437 skill revdeck. \u0421\u0432\u0435\u0440\u044C\u0442\u0435 diff \u0441 \u0431\u0430\u0437\u043E\u0439, \u043E\u0442\u043C\u0435\u0442\u044C\u0442\u0435 \u043D\u0435\u0437\u0430\u043A\u043E\u043C\u043C\u0438\u0447\u0435\u043D\u043D\u043E\u0435 \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043D\u044B\u0435 \u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F; \u043E\u0442\u0447\u0451\u0442 \u0441\u043E\u0431\u0438\u0440\u0430\u0435\u0442 \u0447\u0435\u043B\u043E\u0432\u0435\u043A.",
981
+ "Procedure: `Feedback.md` from the revdeck skill. Check the diff against the base, note uncommitted changes and work through the findings; the human builds the report."
982
+ ) : t(
983
+ "\u041F\u0440\u043E\u0446\u0435\u0434\u0443\u0440\u0430: `Feedback.md` \u0438\u0437 skill revdeck. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0441\u0432\u0435\u0440\u044C\u0442\u0435 \u0440\u0430\u0431\u043E\u0447\u0443\u044E \u0432\u0435\u0442\u043A\u0443 \u0441 MR, \u0437\u0430\u0442\u0435\u043C \u0440\u0430\u0437\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u0435 \u0442\u0440\u0435\u0434\u044B \u0438 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438 \u043A \u0441\u0442\u0440\u043E\u043A\u0430\u043C.",
984
+ "Procedure: `Feedback.md` from the revdeck skill. First verify the working branch matches the MR, then work through open threads and line comments."
985
+ )
986
+ );
964
987
  push("");
965
988
  } else if (options.scenario === "review") {
966
989
  push(`## ${t("\u0421\u0446\u0435\u043D\u0430\u0440\u0438\u0439: \u0440\u0435\u0432\u044C\u044E \u0447\u0443\u0436\u043E\u0433\u043E MR", "Scenario: reviewing someone else's MR")}`);
@@ -1853,6 +1876,30 @@ Next: ${next}.`;
1853
1876
  }
1854
1877
  }
1855
1878
  );
1879
+ server.registerTool(
1880
+ "revdeck_local",
1881
+ {
1882
+ title: "Review the current branch",
1883
+ description: "Open or refresh a local review of the current branch against its base (origin/HEAD, provider.base or the base argument): diff, rules and a stable review id. No platform is used: threads, checks, approvals and publishing are unavailable. Use the returned id with revdeck_context and revdeck_draft_findings; the markdown report is built by the human in CLI.",
1884
+ inputSchema: {
1885
+ base: z2.string().min(1).max(255).optional().describe("Base ref to compare against, for example origin/main or develop")
1886
+ }
1887
+ },
1888
+ async ({ base }) => {
1889
+ try {
1890
+ const current2 = await scope();
1891
+ const result = await call("reviews.openLocal", {
1892
+ root: daemonRoot(current2.root),
1893
+ ...base ? { base } : {}
1894
+ });
1895
+ const review = result.review;
1896
+ return ok(`${summarize(review)}
1897
+ Next: revdeck_context(review="${review.id}", scenario="feedback").`, { reviewId: review.id });
1898
+ } catch (error) {
1899
+ return failure(error);
1900
+ }
1901
+ }
1902
+ );
1856
1903
  server.registerTool(
1857
1904
  "revdeck_feature",
1858
1905
  {