local-diff-reviewer 3.0.9 → 3.0.10
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/start.js +68 -1
- package/dist/web/assets/{arc-BN1MUvYX.js → arc-BSLmS7QL.js} +1 -1
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-BmzLWma4.js → architectureDiagram-3BPJPVTR-BYS4zjbs.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-C5PzmBsz.js → blockDiagram-GPEHLZMM-PmlAizTj.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-De6jIXZ4.js → c4Diagram-AAUBKEIU-CbuIUxBl.js} +1 -1
- package/dist/web/assets/channel-CmWwTUGo.js +1 -0
- package/dist/web/assets/{chunk-2J33WTMH-BY2Lh0gI.js → chunk-2J33WTMH-9RQh96-h.js} +1 -1
- package/dist/web/assets/{chunk-3OPIFGDE-D_ZP_Eau.js → chunk-3OPIFGDE-DsWGTKCT.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-C9JcHCUb.js → chunk-4BX2VUAB-BEWv--B6.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-D1w_qtlt.js → chunk-55IACEB6-FQtgl8QA.js} +1 -1
- package/dist/web/assets/{chunk-5ZQYHXKU-xh6dZwn1.js → chunk-5ZQYHXKU-BakogfYY.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-BlZDj39R.js → chunk-727SXJPM-DH6Pmel3.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-BDqL4lnF.js → chunk-AQP2D5EJ-C3H1-cjU.js} +1 -1
- package/dist/web/assets/{chunk-BSJP7CBP-4OwONifc.js → chunk-BSJP7CBP-ot3nfttV.js} +1 -1
- package/dist/web/assets/{chunk-CSCIHK7Q-BUnXZpWL.js → chunk-CSCIHK7Q-DU2XRhoi.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-CHEXj6MZ.js → chunk-FMBD7UC4-vFABKE4n.js} +1 -1
- package/dist/web/assets/{chunk-KSCS5N6A-DyUBzHwf.js → chunk-KSCS5N6A-Cyihy6vg.js} +1 -1
- package/dist/web/assets/{chunk-L5ZTLDWV-CyDMmYr9.js → chunk-L5ZTLDWV-1-azreHq.js} +1 -1
- package/dist/web/assets/{chunk-LZXEDZCA-CJtEA7oR.js → chunk-LZXEDZCA-CtT9i9tB.js} +2 -2
- package/dist/web/assets/{chunk-ND2GUHAM-Drsfd8bu.js → chunk-ND2GUHAM-DBTROLaS.js} +1 -1
- package/dist/web/assets/{chunk-NZK2D7GU-DwrLBn7t.js → chunk-NZK2D7GU-BIB9cXcy.js} +1 -1
- package/dist/web/assets/{chunk-O5CBEL6O-QjK8YZ4m.js → chunk-O5CBEL6O-D2jWf1jO.js} +1 -1
- package/dist/web/assets/chunk-QZHKN3VN-BRcGdJaW.js +1 -0
- package/dist/web/assets/chunk-WU5MYG2G-CU2gWTHX.js +1 -0
- package/dist/web/assets/{chunk-XPW4576I-Bm-EHLzD.js → chunk-XPW4576I-Dn0McE6u.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-CiLEawz2.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-DIfJKG9o.js +1 -0
- package/dist/web/assets/{cose-bilkent-S5V4N54A-Cg18QDrN.js → cose-bilkent-S5V4N54A-CFgYIdZc.js} +1 -1
- package/dist/web/assets/{dagre-BM42HDAG-BeOEGVgS.js → dagre-BM42HDAG-DW9dRv5W.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-DMmRjetm.js → diagram-2AECGRRQ-CNqjHCOr.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-COWKayaZ.js → diagram-5GNKFQAL-GlReVWQT.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-XQoPejwc.js → diagram-KO2AKTUF-BAhEPBnL.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-CEGIBKcH.js → diagram-LMA3HP47-BXic13O6.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-BHbp8sGQ.js → diagram-OG6HWLK6-CMHvKcdI.js} +1 -1
- package/dist/web/assets/{dist-ykXh2P-g.js → dist-DzagEH4V.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-BDqEeEP_.js → erDiagram-TEJ5UH35-CV_KA5SE.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-DCcnUzbl.js → flowDiagram-I6XJVG4X-Ds3vbrS-.js} +1 -1
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-CAqdYRQk.js → ganttDiagram-6RSMTGT7-BGmxRLNf.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-DCg4O6V8.js → gitGraphDiagram-PVQCEYII-BOw_MMB6.js} +1 -1
- package/dist/web/assets/index-Ci6CsMGU.css +1 -0
- package/dist/web/assets/{index-Ch87WKMD.js → index-dCkMyylZ.js} +25 -25
- package/dist/web/assets/{infoDiagram-5YYISTIA-GCJR4rlG.js → infoDiagram-5YYISTIA-ley6Hm2n.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-DKSvXxDd.js → ishikawaDiagram-YF4QCWOH-B39CSvE8.js} +1 -1
- package/dist/web/assets/{journeyDiagram-JHISSGLW-CwqQ67Qb.js → journeyDiagram-JHISSGLW-DHj6gXNu.js} +1 -1
- package/dist/web/assets/{kanban-definition-UN3LZRKU-D8S77jyF.js → kanban-definition-UN3LZRKU-YmyzUsC6.js} +1 -1
- package/dist/web/assets/{line-B4VzWWYA.js → line-Dp2JHSw-.js} +1 -1
- package/dist/web/assets/{linear-Dtkf7EWw.js → linear-BGxRqmrd.js} +1 -1
- package/dist/web/assets/{mermaid-parser.core-D8y6lLat.js → mermaid-parser.core-bUg8VhRH.js} +1 -1
- package/dist/web/assets/{mermaid.core-BkC0MK1p.js → mermaid.core-DLvn7hAi.js} +3 -3
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-s430WvLK.js → mindmap-definition-RKZ34NQL-DedTfPIo.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-D-H4zNrB.js → pieDiagram-4H26LBE5-7UETwr_6.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-DC_iUg7Z.js → quadrantDiagram-W4KKPZXB-CZNMkjx2.js} +1 -1
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-BWpTl4NP.js → requirementDiagram-4Y6WPE33-QKvaPdIO.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP--LlJB4C3.js → sankeyDiagram-5OEKKPKP-BTsrp14L.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-vTUz9_uS.js → sequenceDiagram-3UESZ5HK-Ou4mt4DX.js} +1 -1
- package/dist/web/assets/{src-DJBI_xsT.js → src-BoL9WGRu.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-CTdxX5xI.js → stateDiagram-AJRCARHV-BnN_03nu.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-PUcRnDWi.js +1 -0
- package/dist/web/assets/{timeline-definition-PNZ67QCA-utxel59P.js → timeline-definition-PNZ67QCA-CB7BJuqZ.js} +1 -1
- package/dist/web/assets/{vennDiagram-CIIHVFJN-BOaEP9sx.js → vennDiagram-CIIHVFJN-BZqQy9fg.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-D6P01N0M.js → wardleyDiagram-YWT4CUSO-BOU8Yt-c.js} +1 -1
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-ClIQGns3.js → xychartDiagram-2RQKCTM6-DGfvr1AY.js} +1 -1
- package/dist/web/index.html +2 -2
- package/docs/images/diff-review-ui.jpg +0 -0
- package/package.json +1 -1
- package/dist/web/assets/channel-BPka0CHr.js +0 -1
- package/dist/web/assets/chunk-QZHKN3VN-BAEZltDe.js +0 -1
- package/dist/web/assets/chunk-WU5MYG2G-gIPE0t8J.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-GNVRVdNS.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CK66FWNY.js +0 -1
- package/dist/web/assets/index-CQG_VDif.css +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-D5sjTGIA.js +0 -1
package/dist/cli/start.js
CHANGED
|
@@ -494,6 +494,23 @@ async function readDiffFileContents(file, mode, repoRoot) {
|
|
|
494
494
|
newTotalLines: newLines.length
|
|
495
495
|
};
|
|
496
496
|
}
|
|
497
|
+
async function readDiffImageContent(file, mode, repoRoot, side) {
|
|
498
|
+
const path = side === "old" ? file.oldPath : file.path;
|
|
499
|
+
if (!path || path === "/dev/null") return null;
|
|
500
|
+
if (!isSafeRepoPath(repoRoot, path)) {
|
|
501
|
+
throw new Error(`Unsafe file path: ${path}`);
|
|
502
|
+
}
|
|
503
|
+
if (side === "old") {
|
|
504
|
+
if (file.status === "added") return null;
|
|
505
|
+
if (mode.kind === "staged") return gitShowBuffer(`HEAD:${path}`, repoRoot);
|
|
506
|
+
if (mode.kind === "revision") return gitShowBuffer(`${mode.base}:${path}`, repoRoot);
|
|
507
|
+
return gitShowBuffer(`HEAD:${path}`, repoRoot);
|
|
508
|
+
}
|
|
509
|
+
if (file.status === "deleted") return null;
|
|
510
|
+
if (mode.kind === "staged") return gitShowBuffer(`:${path}`, repoRoot);
|
|
511
|
+
if (mode.kind === "revision") return gitShowBuffer(`${mode.target}:${path}`, repoRoot);
|
|
512
|
+
return readFile2(join2(repoRoot, path));
|
|
513
|
+
}
|
|
497
514
|
function parseReviewMode(args) {
|
|
498
515
|
const filtered = args.filter(Boolean);
|
|
499
516
|
if (filtered.length === 0 || filtered[0] === "working") return { kind: "working" };
|
|
@@ -512,6 +529,9 @@ function isSafeRepoPath(repoRoot, path) {
|
|
|
512
529
|
async function gitShow(revPath, repoRoot) {
|
|
513
530
|
return execGitStdout(["show", revPath], repoRoot);
|
|
514
531
|
}
|
|
532
|
+
async function gitShowBuffer(revPath, repoRoot) {
|
|
533
|
+
return execGitBuffer(["show", revPath], repoRoot);
|
|
534
|
+
}
|
|
515
535
|
async function readDiffSideContent(file, mode, repoRoot, side) {
|
|
516
536
|
const path = side === "old" ? file.oldPath : file.path;
|
|
517
537
|
if (!path || path === "/dev/null") return "";
|
|
@@ -522,7 +542,7 @@ async function readDiffSideContent(file, mode, repoRoot, side) {
|
|
|
522
542
|
if (file.status === "added") return "";
|
|
523
543
|
if (mode.kind === "staged") return gitShow(`HEAD:${path}`, repoRoot);
|
|
524
544
|
if (mode.kind === "revision") return gitShow(`${mode.base}:${path}`, repoRoot);
|
|
525
|
-
return
|
|
545
|
+
return gitShow(`HEAD:${path}`, repoRoot);
|
|
526
546
|
}
|
|
527
547
|
if (file.status === "deleted") return "";
|
|
528
548
|
if (mode.kind === "staged") return gitShow(`:${path}`, repoRoot);
|
|
@@ -541,6 +561,26 @@ async function execGitStdout(args, cwd) {
|
|
|
541
561
|
const { stdout } = await execGit(args, cwd);
|
|
542
562
|
return stdout;
|
|
543
563
|
}
|
|
564
|
+
async function execGitBuffer(args, cwd) {
|
|
565
|
+
return new Promise((resolve3, reject) => {
|
|
566
|
+
execFile(
|
|
567
|
+
"git",
|
|
568
|
+
args,
|
|
569
|
+
{
|
|
570
|
+
cwd,
|
|
571
|
+
encoding: "buffer",
|
|
572
|
+
maxBuffer: 1024 * 1024 * 80
|
|
573
|
+
},
|
|
574
|
+
(error, stdout) => {
|
|
575
|
+
if (error) {
|
|
576
|
+
reject(error);
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
resolve3(stdout);
|
|
580
|
+
}
|
|
581
|
+
);
|
|
582
|
+
});
|
|
583
|
+
}
|
|
544
584
|
async function execGit(args, cwd) {
|
|
545
585
|
const { stdout, stderr } = await execFileAsync("git", args, {
|
|
546
586
|
cwd,
|
|
@@ -883,6 +923,33 @@ async function startServer(state, port = 4966) {
|
|
|
883
923
|
next(error);
|
|
884
924
|
}
|
|
885
925
|
});
|
|
926
|
+
app.get("/api/diff-file-image", async (req, res, next) => {
|
|
927
|
+
try {
|
|
928
|
+
const filePath = String(req.query.path ?? "");
|
|
929
|
+
const side = req.query.side === "old" ? "old" : req.query.side === "new" ? "new" : null;
|
|
930
|
+
if (!filePath || !side) {
|
|
931
|
+
res.status(400).json({ error: "File path and side are required" });
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
const file = state.diffFiles.find((item) => item.path === filePath || item.oldPath === filePath);
|
|
935
|
+
if (!file) {
|
|
936
|
+
res.status(404).json({ error: "Diff file not found" });
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
const contents = await readDiffImageContent(file, state.session.mode, state.session.repoRoot, side);
|
|
940
|
+
if (!contents) {
|
|
941
|
+
res.status(404).json({ error: "Image not found on requested side" });
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
const targetPath = side === "old" ? file.oldPath : file.path;
|
|
945
|
+
if (targetPath) {
|
|
946
|
+
res.type(targetPath);
|
|
947
|
+
}
|
|
948
|
+
res.send(contents);
|
|
949
|
+
} catch (error) {
|
|
950
|
+
next(error);
|
|
951
|
+
}
|
|
952
|
+
});
|
|
886
953
|
app.get("/api/markdown-asset", (req, res) => {
|
|
887
954
|
const relativePath = String(req.query.path ?? "").trim();
|
|
888
955
|
if (!relativePath) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./path-BJQEcSo7.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-
|
|
1
|
+
import{n as e,t}from"./path-BJQEcSo7.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-DzagEH4V.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(e,t,n,r,i,a,o){var c=e-n,l=t-r,u=(o?a:-a)/d(c*c+l*l),f=u*l,p=-u*c,m=e+f,h=t+p,g=n+f,_=r+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=i-a,w=m*_-g*h,T=(x<0?-1:1)*d(s(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(i/C-1),y11:D*(i/C-1)}}function x(){var s=m,x=h,S=e(0),C=null,w=g,T=_,E=v,D=null,O=t(k);function k(){var e,t,m=+s.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-r,_=T.apply(this,arguments)-r,v=l(_-g),k=_>g;if(D||=e=O(),h<m&&(t=h,h=m,m=t),!(h>1e-12))D.moveTo(0,0);else if(v>c-1e-12)D.moveTo(h*u(g),h*a(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*u(_),m*a(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):d(m*m+h*h)),R=p(l(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=o(L/m*a(I)),W=o(L/h*a(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*u(A),K=h*a(A),q=m*u(N),J=m*a(N);if(R>1e-12){var Y=h*u(j),X=h*a(j),Z=m*u(M),Q=m*a(M),$;if(v<i)if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/a(f((ee*ne+te*re)/(d(ee*ee+te*te)*d(ne*ne+re*re)))/2),ae=d($[0]*$[0]+$[1]*$[1]);z=p(R,(m-ae)/(ie-1)),B=p(R,(h-ae)/(ie+1))}else z=B=0}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,h,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,n(H.y11,H.x11),n(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,m,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,n(H.y11,H.x11),n(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),e)return D=null,e+``||null}return k.centroid=function(){var e=(+s.apply(this,arguments)+ +x.apply(this,arguments))/2,t=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-i/2;return[u(t)*e,a(t)*e]},k.innerRadius=function(t){return arguments.length?(s=typeof t==`function`?t:e(+t),k):s},k.outerRadius=function(t){return arguments.length?(x=typeof t==`function`?t:e(+t),k):x},k.cornerRadius=function(t){return arguments.length?(S=typeof t==`function`?t:e(+t),k):S},k.padRadius=function(t){return arguments.length?(C=t==null?null:typeof t==`function`?t:e(+t),k):C},k.startAngle=function(t){return arguments.length?(w=typeof t==`function`?t:e(+t),k):w},k.endAngle=function(t){return arguments.length?(T=typeof t==`function`?t:e(+t),k):T},k.padAngle=function(t){return arguments.length?(E=typeof t==`function`?t:e(+t),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};
|