diffprism 0.48.2 → 1.0.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseDiff
3
- } from "./chunk-QGWYCEJN.js";
3
+ } from "./chunk-3GMPE2ZR.js";
4
4
  import {
5
5
  analyze
6
6
  } from "./chunk-DHCVZGHE.js";
@@ -3780,66 +3780,16 @@ function normalizePr(rawDiff, prMetadata, options) {
3780
3780
  }
3781
3781
 
3782
3782
  // packages/github/src/submit.ts
3783
- async function submitGitHubReview(client, owner, repo, prNumber, result) {
3784
- if (result.decision === "dismissed") {
3785
- return null;
3786
- }
3787
- const eventMap = {
3788
- approved: "APPROVE",
3789
- changes_requested: "REQUEST_CHANGES",
3790
- approved_with_comments: "COMMENT"
3791
- };
3792
- const event = eventMap[result.decision];
3793
- if (!event) {
3794
- return null;
3795
- }
3796
- const comments = result.comments.filter((c) => c.file && c.line > 0).map((c) => formatReviewComment(c));
3797
- const body = buildReviewBody(result);
3783
+ async function submitGitHubReview(client, owner, repo, prNumber, review) {
3798
3784
  const { data } = await client.pulls.createReview({
3799
3785
  owner,
3800
3786
  repo,
3801
3787
  pull_number: prNumber,
3802
- event,
3803
- body,
3804
- comments
3788
+ event: review.event,
3789
+ ...review.body ? { body: review.body } : {},
3790
+ comments: review.comments
3805
3791
  });
3806
- return { reviewId: data.id };
3807
- }
3808
- function formatReviewComment(comment) {
3809
- const typePrefix = getCommentTypePrefix(comment.type);
3810
- return {
3811
- path: comment.file,
3812
- line: comment.line,
3813
- body: `${typePrefix}${comment.body}`
3814
- };
3815
- }
3816
- function getCommentTypePrefix(type) {
3817
- switch (type) {
3818
- case "must_fix":
3819
- return "**Must Fix:** ";
3820
- case "suggestion":
3821
- return "**Suggestion:** ";
3822
- case "question":
3823
- return "**Question:** ";
3824
- case "nitpick":
3825
- return "**Nitpick:** ";
3826
- default:
3827
- return "";
3828
- }
3829
- }
3830
- function buildReviewBody(result) {
3831
- const parts = [];
3832
- if (result.summary) {
3833
- parts.push(result.summary);
3834
- }
3835
- if (result.comments.length > 0) {
3836
- const inlineCount = result.comments.filter((c) => c.file && c.line > 0).length;
3837
- if (inlineCount > 0) {
3838
- parts.push(`*${inlineCount} inline comment${inlineCount !== 1 ? "s" : ""} attached.*`);
3839
- }
3840
- }
3841
- parts.push("\n---\n*Reviewed with [DiffPrism](https://github.com/anthropics/diffprism)*");
3842
- return parts.join("\n\n");
3792
+ return { reviewId: data.id, url: data.html_url };
3843
3793
  }
3844
3794
 
3845
3795
  export {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  demo
3
- } from "./chunk-7UQM4WBZ.js";
4
- import "./chunk-EPUCA2N5.js";
5
- import "./chunk-QGWYCEJN.js";
3
+ } from "./chunk-CJ6LV2XV.js";
4
+ import "./chunk-CU2BAL6Q.js";
5
+ import "./chunk-3GMPE2ZR.js";
6
6
  import "./chunk-DHCVZGHE.js";
7
7
  import "./chunk-JSBRDJBE.js";
8
8
  export {