difit 4.0.2 → 4.0.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/README.ja.md +1 -0
- package/README.ko.md +1 -0
- package/README.md +1 -0
- package/README.zh.md +1 -0
- package/dist/cli/index.js +38 -28
- package/dist/cli/index.test.js +162 -77
- package/dist/cli/utils.js +4 -0
- package/dist/cli/utils.test.js +6 -1
- package/dist/client/assets/_baseFor-DKyA49xd.js +1 -0
- package/dist/client/assets/arc-COOp7iVe.js +1 -0
- package/dist/client/assets/architecture-YZFGNWBL-Cs2Q6RQP.js +1 -0
- package/dist/client/assets/architectureDiagram-Q4EWVU46-BO4dVPUA.js +36 -0
- package/dist/client/assets/blockDiagram-DXYQGD6D-CtNJnEWN.js +132 -0
- package/dist/client/assets/c4Diagram-AHTNJAMY-BqG-1m6C.js +10 -0
- package/dist/client/assets/channel-_xDT1u3-.js +1 -0
- package/dist/client/assets/chunk-2KRD3SAO-DqP2NJNd.js +1 -0
- package/dist/client/assets/chunk-336JU56O-D1qa7Qzb.js +2 -0
- package/dist/client/assets/chunk-426QAEUC-6J_A_wvD.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-CW45MZFx.js → chunk-4BX2VUAB-BT78EnQ6.js} +1 -1
- package/dist/client/assets/chunk-4TB4RGXK-C4w_Bwzw.js +206 -0
- package/dist/client/assets/{chunk-55IACEB6-Busc3sfI.js → chunk-55IACEB6-z3MQSTaj.js} +1 -1
- package/dist/client/assets/chunk-5FUZZQ4R-Chei69aj.js +62 -0
- package/dist/client/assets/chunk-5PVQY5BW-HgRiIs0X.js +2 -0
- package/dist/client/assets/chunk-67CJDMHE-B2q10-fp.js +1 -0
- package/dist/client/assets/chunk-7N4EOEYR-DPgxysWq.js +1 -0
- package/dist/client/assets/chunk-AA7GKIK3-BqmVmKLq.js +1 -0
- package/dist/client/assets/chunk-BSJP7CBP-CaIgleFn.js +1 -0
- package/dist/client/assets/chunk-CFjPhJqf.js +1 -0
- package/dist/client/assets/chunk-CIAEETIT-ByD-tlNF.js +1 -0
- package/dist/client/assets/{chunk-KX2RTZJC-DrhxxMOx.js → chunk-EDXVE4YY-d3RUKKAj.js} +1 -1
- package/dist/client/assets/chunk-ENJZ2VHE-CNq5Qmg9.js +10 -0
- package/dist/client/assets/{chunk-FMBD7UC4-BSsJVlRg.js → chunk-FMBD7UC4-DYfHJ6MV.js} +1 -1
- package/dist/client/assets/chunk-FOC6F5B3-BRpSWlZj.js +1 -0
- package/dist/client/assets/chunk-ICPOFSXX-B_MThwG6.js +122 -0
- package/dist/client/assets/chunk-K5T4RW27-DmamW1Ds.js +94 -0
- package/dist/client/assets/chunk-KGLVRYIC-CRbg4c4z.js +1 -0
- package/dist/client/assets/chunk-LIHQZDEY-CHQPSdB3.js +1 -0
- package/dist/client/assets/chunk-ORNJ4GCN-CIsQ4Zi4.js +1 -0
- package/dist/client/assets/{chunk-NQ4KR5QH-BZ86r2qK.js → chunk-OYMX7WX6-Cxi0kdGg.js} +25 -14
- package/dist/client/assets/chunk-QZHKN3VN-C0QzfgZ8.js +1 -0
- package/dist/client/assets/{chunk-PU5JKC2W-PQmA4K_y.js → chunk-U2HBQHQK-V_hneCfR.js} +6 -6
- package/dist/client/assets/{chunk-PQ6SQG4A-C9acTu_E.js → chunk-X2U36JSP-De4pvO-I.js} +1 -1
- package/dist/client/assets/{chunk-XPW4576I-CcqR6BsE.js → chunk-XPW4576I-B_osXKp6.js} +2 -2
- package/dist/client/assets/{chunk-JSJVCQXG-UCJub_Eo.js → chunk-YZCP3GAM-C_kqXssD.js} +1 -1
- package/dist/client/assets/chunk-ZZ45TVLE-B_xtlma5.js +1 -0
- package/dist/client/assets/classDiagram-6PBFFD2Q-5XrS-DAQ.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-Covl2vKy.js +1 -0
- package/dist/client/assets/clone-rhRH8pyW.js +1 -0
- package/dist/client/assets/cose-bilkent-S5V4N54A-BvXFc7Rr.js +1 -0
- package/dist/client/assets/cytoscape.esm-DRReFUEO.js +321 -0
- package/dist/client/assets/dagre-DU-XBdcU.js +1 -0
- package/dist/client/assets/dagre-KV5264BT-BWYGReXF.js +4 -0
- package/dist/client/assets/diagram-5BDNPKRD-DpUUhvWz.js +10 -0
- package/dist/client/assets/diagram-G4DWMVQ6-BJoTrUAx.js +24 -0
- package/dist/client/assets/diagram-MMDJMWI5-CAk1GW5g.js +43 -0
- package/dist/client/assets/diagram-TYMM5635-Cct6g7FA.js +24 -0
- package/dist/client/assets/dist-61sCfOmN.js +1 -0
- package/dist/client/assets/{erDiagram-INFDFZHY-ByL02DP-.js → erDiagram-SMLLAGMA-DHs2bXUj.js} +33 -18
- package/dist/client/assets/flatten-mnWyE-RB.js +1 -0
- package/dist/client/assets/flowDiagram-DWJPFMVM-DLu-6dfC.js +162 -0
- package/dist/client/assets/ganttDiagram-T4ZO3ILL-CMIzlKAR.js +292 -0
- package/dist/client/assets/gitGraph-7Q5UKJZL-A_wWsXju.js +1 -0
- package/dist/client/assets/gitGraphDiagram-UUTBAWPF-Bc_rL3_k.js +106 -0
- package/dist/client/assets/graphlib-BVMK0xYE.js +1 -0
- package/dist/client/assets/{index-Cn4K2uvR.css → index-Cq_APK7Y.css} +1 -1
- package/dist/client/assets/index-RcU838Ah.js +79 -0
- package/dist/client/assets/info-OMHHGYJF-Bv3kK2Bb.js +1 -0
- package/dist/client/assets/{infoDiagram-LFFYTUFH-CnmYkyCb.js → infoDiagram-42DDH7IO-Cf8u4jgP.js} +1 -1
- package/dist/client/assets/isEmpty-CiiIHfXR.js +1 -0
- package/dist/client/assets/ishikawaDiagram-UXIWVN3A-7n7DvfEb.js +70 -0
- package/dist/client/assets/{journeyDiagram-4ABVD52K-aRoH36nV.js → journeyDiagram-VCZTEJTY-BMkeQqJb.js} +2 -2
- package/dist/client/assets/{kanban-definition-K7BYSVSG-BGtGv5yb.js → kanban-definition-6JOO6SKY-B8KkeZLS.js} +2 -2
- package/dist/client/assets/katex-FOM3xZj7.js +257 -0
- package/dist/client/assets/line-CVpcI6kj.js +1 -0
- package/dist/client/assets/{linear-HJOLPv7E.js → linear-DmhiOOKU.js} +1 -1
- package/dist/client/assets/mermaid-parser.core-CnJ9Tv8l.js +4 -0
- package/dist/client/assets/mermaid.core-R7nXpPx-.js +11 -0
- package/dist/client/assets/{mindmap-definition-YRQLILUH-B8jMe7ir.js → mindmap-definition-QFDTVHPH-CwcHocMZ.js} +39 -11
- package/dist/client/assets/{ordinal-DIg8h6NI.js → ordinal-k--hYEme.js} +1 -1
- package/dist/client/assets/packet-4T2RLAQJ-D2q3-9ae.js +1 -0
- package/dist/client/assets/pie-ZZUOXDRM-GivlQcUF.js +1 -0
- package/dist/client/assets/pieDiagram-DEJITSTG-BVAn8Lmr.js +30 -0
- package/dist/client/assets/preload-helper-DSXbuxSR.js +1 -0
- package/dist/client/assets/prism-haskell-BP3SRvzt.js +1 -0
- package/dist/client/assets/prism-nix-CO4UPu3E.js +1 -0
- package/dist/client/assets/{quadrantDiagram-337W2JSQ-CQ1QKsru.js → quadrantDiagram-34T5L4WZ-C2XZ_zxa.js} +1 -1
- package/dist/client/assets/radar-PYXPWWZC-C9pD6VNR.js +1 -0
- package/dist/client/assets/reduce-BTlHjXna.js +1 -0
- package/dist/client/assets/requirementDiagram-MS252O5E-CfO16pkI.js +84 -0
- package/dist/client/assets/{sankeyDiagram-WA2Y5GQK-BQVbT6bS.js → sankeyDiagram-XADWPNL6-D_4_234M.js} +1 -1
- package/dist/client/assets/sequenceDiagram-FGHM5R23-B-yHKMuK.js +157 -0
- package/dist/client/assets/src-CjDs0_Ij.js +1 -0
- package/dist/client/assets/stateDiagram-FHFEXIEX-BeG2di4I.js +1 -0
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-DvcSq7KE.js +1 -0
- package/dist/client/assets/timeline-definition-GMOUNBTQ-DhtnMGcE.js +120 -0
- package/dist/client/assets/treeView-SZITEDCU-BSNk8_yV.js +1 -0
- package/dist/client/assets/treemap-W4RFUUIX-ym4zQztE.js +1 -0
- package/dist/client/assets/vennDiagram-DHZGUBPP-CBn69TcQ.js +34 -0
- package/dist/client/assets/wardley-RL74JXVD-B02H6ReJ.js +1 -0
- package/dist/client/assets/wardleyDiagram-NUSXRM2D-CEoSJmN1.js +20 -0
- package/dist/client/assets/{xychartDiagram-JWTSCODW-DeYZhM2j.js → xychartDiagram-5P7HB3ND-BZ_X9tkn.js} +6 -6
- package/dist/client/index.html +4 -2
- package/dist/server/git-diff-tui.d.ts +2 -2
- package/dist/server/git-diff-tui.js +14 -11
- package/dist/server/git-diff-tui.test.js +20 -4
- package/dist/server/git-diff.d.ts +3 -2
- package/dist/server/git-diff.js +30 -7
- package/dist/server/git-diff.test.js +60 -5
- package/dist/server/server.d.ts +2 -3
- package/dist/server/server.js +80 -55
- package/dist/server/server.test.js +110 -60
- package/dist/tui/App.d.ts +2 -2
- package/dist/tui/App.js +4 -3
- package/dist/types/diff.d.ts +8 -0
- package/dist/utils/diffSelection.d.ts +6 -0
- package/dist/utils/diffSelection.js +30 -0
- package/package.json +9 -9
- package/dist/client/assets/_basePickBy-hOr-yGsE.js +0 -1
- package/dist/client/assets/_baseUniq-b7bzdUSn.js +0 -1
- package/dist/client/assets/arc-D65wG9gm.js +0 -1
- package/dist/client/assets/architecture-PBZL5I3N-DFdrPtRG.js +0 -1
- package/dist/client/assets/architectureDiagram-2XIMDMQ5-CXJTJFYJ.js +0 -36
- package/dist/client/assets/blockDiagram-WCTKOSBZ-B60owdAn.js +0 -132
- package/dist/client/assets/c4Diagram-IC4MRINW-4tg2D_Vt.js +0 -10
- package/dist/client/assets/channel-DogeU0Wo.js +0 -1
- package/dist/client/assets/chunk-7E7YKBS2-BVR-8Pma.js +0 -1
- package/dist/client/assets/chunk-7R4GIKGN-DneC7PwP.js +0 -80
- package/dist/client/assets/chunk-C72U2L5F-CJr98gus.js +0 -1
- package/dist/client/assets/chunk-EGIJ26TM-iD_CSqpR.js +0 -1
- package/dist/client/assets/chunk-GEFDOKGD-eDUrsRgt.js +0 -2
- package/dist/client/assets/chunk-GLR3WWYH-NUOKNaxd.js +0 -2
- package/dist/client/assets/chunk-HHEYEP7N-DhuxpkmW.js +0 -1
- package/dist/client/assets/chunk-KYZI473N-Brv52ZeO.js +0 -53
- package/dist/client/assets/chunk-L3YUKLVL-BkBigLhQ.js +0 -1
- package/dist/client/assets/chunk-MX3YWQON-DHRoNbgW.js +0 -1
- package/dist/client/assets/chunk-O4XLMI2P-Sr33dk8c.js +0 -7
- package/dist/client/assets/chunk-OZEHJAEY-3F2ff7sj.js +0 -1
- package/dist/client/assets/chunk-QZHKN3VN-DMRW-mur.js +0 -1
- package/dist/client/assets/chunk-R5LLSJPH-ChexuO_S.js +0 -1
- package/dist/client/assets/chunk-WL4C6EOR-oxNV_hhM.js +0 -189
- package/dist/client/assets/chunk-XIRO2GV7-C9gOnffv.js +0 -1
- package/dist/client/assets/chunk-XZSTWKYB-C5JJ0TZR.js +0 -94
- package/dist/client/assets/chunk-YBOYWFTD-B6kAkNgH.js +0 -1
- package/dist/client/assets/classDiagram-VBA2DB6C-DlDUg6JI.js +0 -1
- package/dist/client/assets/classDiagram-v2-RAHNMMFH-BxzJfV1S.js +0 -1
- package/dist/client/assets/clone-DuY6BQEm.js +0 -1
- package/dist/client/assets/cose-bilkent-S5V4N54A-hlDud6Ym.js +0 -1
- package/dist/client/assets/cytoscape.esm-B3gzQ1NF.js +0 -321
- package/dist/client/assets/dagre-BwDYerGQ.js +0 -1
- package/dist/client/assets/dagre-KLK3FWXG-KnkMUlUE.js +0 -4
- package/dist/client/assets/diagram-E7M64L7V-DcTCIFUG.js +0 -24
- package/dist/client/assets/diagram-IFDJBPK2-COcDQunj.js +0 -43
- package/dist/client/assets/diagram-P4PSJMXO-DmgET9pD.js +0 -24
- package/dist/client/assets/dist-v55TM3-O.js +0 -1
- package/dist/client/assets/flowDiagram-PKNHOUZH-CW-lseYE.js +0 -162
- package/dist/client/assets/ganttDiagram-A5KZAMGK-BxLjKRld.js +0 -292
- package/dist/client/assets/gitGraph-HDMCJU4V-CjAGJiCH.js +0 -1
- package/dist/client/assets/gitGraphDiagram-K3NZZRJ6-DLEDjokx.js +0 -65
- package/dist/client/assets/graphlib-WkJoBgka.js +0 -1
- package/dist/client/assets/index-CizZxdOT.js +0 -79
- package/dist/client/assets/info-3K5VOQVL-CB6KpH1K.js +0 -1
- package/dist/client/assets/isArrayLikeObject-icl0H0jo.js +0 -1
- package/dist/client/assets/isEmpty-Du8sNmkE.js +0 -1
- package/dist/client/assets/ishikawaDiagram-PHBUUO56-zycn1mVK.js +0 -70
- package/dist/client/assets/katex-BJrMXEjr.js +0 -261
- package/dist/client/assets/line-Cm3ZuldI.js +0 -1
- package/dist/client/assets/math-CNhlSIO3.js +0 -1
- package/dist/client/assets/mermaid-parser.core-BvMqHn4b.js +0 -4
- package/dist/client/assets/mermaid.core-C4SvQTx9.js +0 -11
- package/dist/client/assets/packet-RMMSAZCW-CzbC-tXD.js +0 -1
- package/dist/client/assets/pie-UPGHQEXC-CmhYIo8p.js +0 -1
- package/dist/client/assets/pieDiagram-SKSYHLDU-CGWbtgxq.js +0 -30
- package/dist/client/assets/radar-KQ55EAFF-BCa9lsCc.js +0 -1
- package/dist/client/assets/requirementDiagram-Z7DCOOCP-Co1LyL5T.js +0 -73
- package/dist/client/assets/sequenceDiagram-2WXFIKYE-DGIEkdPm.js +0 -145
- package/dist/client/assets/src-DsmFf7gO.js +0 -1
- package/dist/client/assets/stateDiagram-RAJIS63D-DgjKbXnG.js +0 -1
- package/dist/client/assets/stateDiagram-v2-FVOUBMTO-gPrpjL74.js +0 -1
- package/dist/client/assets/timeline-definition-YZTLITO2-Dz2dVWjY.js +0 -61
- package/dist/client/assets/treemap-KZPCXAKY-DXiPfAB6.js +0 -1
- package/dist/client/assets/vennDiagram-LZ73GAT5-IIH5S1B6.js +0 -34
- /package/dist/client/assets/{array-DOVTz2Mq.js → array-BNor45A1.js} +0 -0
- /package/dist/client/assets/{defaultLocale-Ck2Xxk-C.js → defaultLocale-DPzUsThw.js} +0 -0
- /package/dist/client/assets/{init-Bft5Ffpj.js → init-C0L3woqb.js} +0 -0
- /package/dist/client/assets/{path-DfRbCp9y.js → path-sMK4d_s9.js} +0 -0
- /package/dist/client/assets/{prism-bash-6uMTC0Q2.js → prism-bash-iQBez6et.js} +0 -0
- /package/dist/client/assets/{prism-csharp-Dkc2OSmh.js → prism-csharp-C1RDHXRk.js} +0 -0
- /package/dist/client/assets/{prism-dart-iZy_wlz-.js → prism-dart-nIH9vDUM.js} +0 -0
- /package/dist/client/assets/{prism-elixir-BIzI9WJK.js → prism-elixir-DUMUOd7H.js} +0 -0
- /package/dist/client/assets/{prism-hcl-Bx2FGBKG.js → prism-hcl-C-ZHJGEE.js} +0 -0
- /package/dist/client/assets/{prism-java-DBXf7fH0.js → prism-java-scuShSv5.js} +0 -0
- /package/dist/client/assets/{prism-markup-templating-DS0ksKLt.js → prism-markup-templating-BFXREXfb.js} +0 -0
- /package/dist/client/assets/{prism-perl-BlhPiMfT.js → prism-perl-BBDKnHRR.js} +0 -0
- /package/dist/client/assets/{prism-php-DVtOAJsW.js → prism-php-DjIafOi_.js} +0 -0
- /package/dist/client/assets/{prism-protobuf-BUsrNVvv.js → prism-protobuf-BE1MoFmZ.js} +0 -0
- /package/dist/client/assets/{prism-ruby-Saes64I6.js → prism-ruby-CZ-lrXfL.js} +0 -0
- /package/dist/client/assets/{prism-scala-ANOINMog.js → prism-scala-DgnxHuDn.js} +0 -0
- /package/dist/client/assets/{prism-solidity-C5Mx5y66.js → prism-solidity-5fSUcW9Y.js} +0 -0
- /package/dist/client/assets/{prism-sql-D5pwK0Dp.js → prism-sql-CKkohPI_.js} +0 -0
- /package/dist/client/assets/{prism-vim-BSZSu-gX.js → prism-vim-CkRmxTmK.js} +0 -0
- /package/dist/client/assets/{rough.esm-KjoEK0it.js → rough.esm-DeLgKbOI.js} +0 -0
package/dist/cli/index.test.js
CHANGED
|
@@ -82,40 +82,43 @@ describe('CLI index.ts', () => {
|
|
|
82
82
|
{
|
|
83
83
|
name: 'default arguments',
|
|
84
84
|
args: [],
|
|
85
|
-
|
|
86
|
-
expectedBase: 'HEAD^',
|
|
85
|
+
expectedSelection: { targetCommitish: 'HEAD', baseCommitish: 'HEAD^' },
|
|
87
86
|
},
|
|
88
87
|
{
|
|
89
88
|
name: 'single commit argument',
|
|
90
89
|
args: ['main'],
|
|
91
|
-
|
|
92
|
-
expectedBase: 'main^',
|
|
90
|
+
expectedSelection: { targetCommitish: 'main', baseCommitish: 'main^' },
|
|
93
91
|
},
|
|
94
92
|
{
|
|
95
93
|
name: 'two commit arguments',
|
|
96
94
|
args: ['main', 'develop'],
|
|
97
|
-
|
|
98
|
-
expectedBase: 'develop',
|
|
95
|
+
expectedSelection: { targetCommitish: 'main', baseCommitish: 'develop' },
|
|
99
96
|
},
|
|
100
97
|
{
|
|
101
98
|
name: 'special: working',
|
|
102
99
|
args: ['working'],
|
|
103
|
-
|
|
104
|
-
expectedBase: 'staged',
|
|
100
|
+
expectedSelection: { targetCommitish: 'working', baseCommitish: 'staged' },
|
|
105
101
|
},
|
|
106
102
|
{
|
|
107
103
|
name: 'special: staged',
|
|
108
104
|
args: ['staged'],
|
|
109
|
-
|
|
110
|
-
expectedBase: 'HEAD',
|
|
105
|
+
expectedSelection: { targetCommitish: 'staged', baseCommitish: 'HEAD' },
|
|
111
106
|
},
|
|
112
107
|
{
|
|
113
108
|
name: 'special: dot',
|
|
114
109
|
args: ['.'],
|
|
115
|
-
|
|
116
|
-
expectedBase: 'HEAD',
|
|
110
|
+
expectedSelection: { targetCommitish: '.', baseCommitish: 'HEAD' },
|
|
117
111
|
},
|
|
118
|
-
|
|
112
|
+
{
|
|
113
|
+
name: 'merge-base comparison',
|
|
114
|
+
args: ['.', 'origin/main', '--merge-base'],
|
|
115
|
+
expectedSelection: {
|
|
116
|
+
targetCommitish: '.',
|
|
117
|
+
baseCommitish: 'origin/main',
|
|
118
|
+
baseMode: 'merge-base',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
])('$name', async ({ args, expectedSelection }) => {
|
|
119
122
|
mockFindUntrackedFiles.mockResolvedValue([]);
|
|
120
123
|
const program = new Command();
|
|
121
124
|
// Simulate command execution
|
|
@@ -126,6 +129,7 @@ describe('CLI index.ts', () => {
|
|
|
126
129
|
.option('--host <host>', 'host', '')
|
|
127
130
|
.option('--no-open', 'no-open')
|
|
128
131
|
.option('--mode <mode>', 'mode', normalizeDiffViewMode, DEFAULT_DIFF_VIEW_MODE)
|
|
132
|
+
.option('--merge-base', 'merge-base')
|
|
129
133
|
.option('--tui', 'tui')
|
|
130
134
|
.option('--pr <url>', 'pr')
|
|
131
135
|
.action(async (commitish, _compareWith, options) => {
|
|
@@ -152,8 +156,9 @@ describe('CLI index.ts', () => {
|
|
|
152
156
|
// Skip prompt logic for test
|
|
153
157
|
}
|
|
154
158
|
await startServer({
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
selection: options.mergeBase
|
|
160
|
+
? { targetCommitish, baseCommitish, baseMode: 'merge-base' }
|
|
161
|
+
: { targetCommitish, baseCommitish },
|
|
157
162
|
preferredPort: options.port,
|
|
158
163
|
host: options.host,
|
|
159
164
|
openBrowser: options.open,
|
|
@@ -162,8 +167,7 @@ describe('CLI index.ts', () => {
|
|
|
162
167
|
});
|
|
163
168
|
await program.parseAsync([...args], { from: 'user' });
|
|
164
169
|
expect(mockStartServer).toHaveBeenCalledWith({
|
|
165
|
-
|
|
166
|
-
baseCommitish: expectedBase,
|
|
170
|
+
selection: expectedSelection,
|
|
167
171
|
preferredPort: undefined,
|
|
168
172
|
host: '',
|
|
169
173
|
openBrowser: true,
|
|
@@ -218,6 +222,11 @@ describe('CLI index.ts', () => {
|
|
|
218
222
|
args: ['--context', '5'],
|
|
219
223
|
expectedOptions: { context: 5 },
|
|
220
224
|
},
|
|
225
|
+
{
|
|
226
|
+
name: '--merge-base option',
|
|
227
|
+
args: ['--merge-base'],
|
|
228
|
+
expectedOptions: { mergeBase: true },
|
|
229
|
+
},
|
|
221
230
|
])('$name', async ({ args, expectedOptions }) => {
|
|
222
231
|
mockFindUntrackedFiles.mockResolvedValue([]);
|
|
223
232
|
const program = new Command();
|
|
@@ -230,6 +239,7 @@ describe('CLI index.ts', () => {
|
|
|
230
239
|
.option('--mode <mode>', 'mode', normalizeDiffViewMode, DEFAULT_DIFF_VIEW_MODE)
|
|
231
240
|
.option('--tui', 'tui')
|
|
232
241
|
.option('--pr <url>', 'pr')
|
|
242
|
+
.option('--merge-base', 'merge-base')
|
|
233
243
|
.option('--clean', 'start with a clean slate by clearing all existing comments')
|
|
234
244
|
.option('--keep-alive', 'keep server running even after browser disconnects')
|
|
235
245
|
.option('--context <lines>', 'context', parseInt)
|
|
@@ -237,8 +247,9 @@ describe('CLI index.ts', () => {
|
|
|
237
247
|
let targetCommitish = commitish;
|
|
238
248
|
let baseCommitish = commitish + '^';
|
|
239
249
|
await startServer({
|
|
240
|
-
|
|
241
|
-
|
|
250
|
+
selection: options.mergeBase
|
|
251
|
+
? { targetCommitish, baseCommitish, baseMode: 'merge-base' }
|
|
252
|
+
: { targetCommitish, baseCommitish },
|
|
242
253
|
preferredPort: options.port,
|
|
243
254
|
host: options.host,
|
|
244
255
|
openBrowser: options.open,
|
|
@@ -250,8 +261,9 @@ describe('CLI index.ts', () => {
|
|
|
250
261
|
});
|
|
251
262
|
await program.parseAsync([...args], { from: 'user' });
|
|
252
263
|
const expectedCall = {
|
|
253
|
-
|
|
254
|
-
|
|
264
|
+
selection: expectedOptions.mergeBase
|
|
265
|
+
? { targetCommitish: 'HEAD', baseCommitish: 'HEAD^', baseMode: 'merge-base' }
|
|
266
|
+
: { targetCommitish: 'HEAD', baseCommitish: 'HEAD^' },
|
|
255
267
|
preferredPort: expectedOptions.port,
|
|
256
268
|
host: expectedOptions.host || '',
|
|
257
269
|
openBrowser: expectedOptions.open !== false,
|
|
@@ -278,8 +290,7 @@ describe('CLI index.ts', () => {
|
|
|
278
290
|
return;
|
|
279
291
|
}
|
|
280
292
|
await startServer({
|
|
281
|
-
targetCommitish: commitish,
|
|
282
|
-
baseCommitish: `${commitish}^`,
|
|
293
|
+
selection: { targetCommitish: commitish, baseCommitish: `${commitish}^` },
|
|
283
294
|
contextLines: options.context,
|
|
284
295
|
});
|
|
285
296
|
});
|
|
@@ -343,6 +354,98 @@ describe('CLI index.ts', () => {
|
|
|
343
354
|
expect(mockStartServer).not.toHaveBeenCalled();
|
|
344
355
|
});
|
|
345
356
|
});
|
|
357
|
+
describe('--merge-base option', () => {
|
|
358
|
+
it('rejects --merge-base with --pr', async () => {
|
|
359
|
+
const prUrl = 'https://github.com/owner/repo/pull/123';
|
|
360
|
+
const program = new Command();
|
|
361
|
+
program
|
|
362
|
+
.argument('[commit-ish]', 'commit-ish', 'HEAD')
|
|
363
|
+
.argument('[compare-with]', 'compare-with')
|
|
364
|
+
.option('--merge-base', 'merge-base')
|
|
365
|
+
.option('--pr <url>', 'pr')
|
|
366
|
+
.action(async (commitish, _compareWith, options) => {
|
|
367
|
+
if (options.pr && commitish === 'HEAD' && !_compareWith && options.mergeBase) {
|
|
368
|
+
console.error('Error: --merge-base option cannot be used with --pr');
|
|
369
|
+
process.exit(1);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
await startServer({
|
|
373
|
+
stdinDiff: getPrPatch(options.pr),
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
await program.parseAsync(['--pr', prUrl, '--merge-base'], { from: 'user' });
|
|
377
|
+
expect(console.error).toHaveBeenCalledWith('Error: --merge-base option cannot be used with --pr');
|
|
378
|
+
expect(process.exit).toHaveBeenCalledWith(1);
|
|
379
|
+
expect(mockGetPrPatch).not.toHaveBeenCalled();
|
|
380
|
+
expect(mockStartServer).not.toHaveBeenCalled();
|
|
381
|
+
});
|
|
382
|
+
it('rejects --merge-base with stdin diff', async () => {
|
|
383
|
+
const program = new Command();
|
|
384
|
+
program
|
|
385
|
+
.argument('[commit-ish]', 'commit-ish', 'HEAD')
|
|
386
|
+
.argument('[compare-with]', 'compare-with')
|
|
387
|
+
.option('--merge-base', 'merge-base')
|
|
388
|
+
.option('--tui', 'tui')
|
|
389
|
+
.action(async (commitish, _compareWith, options) => {
|
|
390
|
+
const readFromStdin = shouldReadStdin({
|
|
391
|
+
commitish,
|
|
392
|
+
hasPositionalArgs: program.args.length > 0,
|
|
393
|
+
hasPrOption: false,
|
|
394
|
+
hasTuiOption: Boolean(options.tui),
|
|
395
|
+
});
|
|
396
|
+
if (readFromStdin && options.mergeBase) {
|
|
397
|
+
console.error('Error: --merge-base option cannot be used with stdin diff');
|
|
398
|
+
process.exit(1);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
await startServer({
|
|
402
|
+
stdinDiff: 'diff --git a/file.ts b/file.ts',
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
await program.parseAsync(['-', '--merge-base'], { from: 'user' });
|
|
406
|
+
expect(console.error).toHaveBeenCalledWith('Error: --merge-base option cannot be used with stdin diff');
|
|
407
|
+
expect(process.exit).toHaveBeenCalledWith(1);
|
|
408
|
+
expect(mockStartServer).not.toHaveBeenCalled();
|
|
409
|
+
});
|
|
410
|
+
it('rejects --merge-base when the resolved base is a special argument', async () => {
|
|
411
|
+
const program = new Command();
|
|
412
|
+
program
|
|
413
|
+
.argument('[commit-ish]', 'commit-ish', 'HEAD')
|
|
414
|
+
.argument('[compare-with]', 'compare-with')
|
|
415
|
+
.option('--merge-base', 'merge-base')
|
|
416
|
+
.action(async (commitish, _compareWith, options) => {
|
|
417
|
+
let baseCommitish;
|
|
418
|
+
if (_compareWith) {
|
|
419
|
+
baseCommitish = _compareWith;
|
|
420
|
+
}
|
|
421
|
+
else if (commitish === 'working') {
|
|
422
|
+
baseCommitish = 'staged';
|
|
423
|
+
}
|
|
424
|
+
else if (commitish === 'staged' || commitish === '.') {
|
|
425
|
+
baseCommitish = 'HEAD';
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
baseCommitish = commitish + '^';
|
|
429
|
+
}
|
|
430
|
+
const selection = options.mergeBase
|
|
431
|
+
? { targetCommitish: commitish, baseCommitish, baseMode: 'merge-base' }
|
|
432
|
+
: { targetCommitish: commitish, baseCommitish };
|
|
433
|
+
if (options.mergeBase &&
|
|
434
|
+
(selection.baseCommitish === 'working' ||
|
|
435
|
+
selection.baseCommitish === 'staged' ||
|
|
436
|
+
selection.baseCommitish === '.')) {
|
|
437
|
+
console.error(`Error: --merge-base requires a commit-ish base, but resolved base was "${selection.baseCommitish}"`);
|
|
438
|
+
process.exit(1);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
await startServer({ selection });
|
|
442
|
+
});
|
|
443
|
+
await program.parseAsync(['working', '--merge-base'], { from: 'user' });
|
|
444
|
+
expect(console.error).toHaveBeenCalledWith('Error: --merge-base requires a commit-ish base, but resolved base was "staged"');
|
|
445
|
+
expect(process.exit).toHaveBeenCalledWith(1);
|
|
446
|
+
expect(mockStartServer).not.toHaveBeenCalled();
|
|
447
|
+
});
|
|
448
|
+
});
|
|
346
449
|
describe('Version option', () => {
|
|
347
450
|
it('supports --version flag', async () => {
|
|
348
451
|
const program = new Command();
|
|
@@ -394,8 +497,7 @@ describe('CLI index.ts', () => {
|
|
|
394
497
|
// Skip prompt logic for test
|
|
395
498
|
}
|
|
396
499
|
await startServer({
|
|
397
|
-
targetCommitish: commitish,
|
|
398
|
-
baseCommitish: 'staged',
|
|
500
|
+
selection: { targetCommitish: commitish, baseCommitish: 'staged' },
|
|
399
501
|
preferredPort: options.port,
|
|
400
502
|
host: options.host,
|
|
401
503
|
openBrowser: options.open,
|
|
@@ -424,8 +526,7 @@ describe('CLI index.ts', () => {
|
|
|
424
526
|
await findUntrackedFiles(git);
|
|
425
527
|
}
|
|
426
528
|
await startServer({
|
|
427
|
-
targetCommitish: commitish,
|
|
428
|
-
baseCommitish: commitish + '^',
|
|
529
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
429
530
|
preferredPort: options.port,
|
|
430
531
|
host: options.host,
|
|
431
532
|
openBrowser: options.open,
|
|
@@ -459,8 +560,7 @@ describe('CLI index.ts', () => {
|
|
|
459
560
|
}
|
|
460
561
|
}
|
|
461
562
|
await startServer({
|
|
462
|
-
targetCommitish: commitish,
|
|
463
|
-
baseCommitish: 'staged',
|
|
563
|
+
selection: { targetCommitish: commitish, baseCommitish: 'staged' },
|
|
464
564
|
preferredPort: options.port,
|
|
465
565
|
host: options.host,
|
|
466
566
|
openBrowser: options.open,
|
|
@@ -496,8 +596,7 @@ describe('CLI index.ts', () => {
|
|
|
496
596
|
}
|
|
497
597
|
}
|
|
498
598
|
await startServer({
|
|
499
|
-
targetCommitish: commitish,
|
|
500
|
-
baseCommitish: 'staged',
|
|
599
|
+
selection: { targetCommitish: commitish, baseCommitish: 'staged' },
|
|
501
600
|
preferredPort: options.port,
|
|
502
601
|
host: options.host,
|
|
503
602
|
openBrowser: options.open,
|
|
@@ -717,8 +816,7 @@ describe('CLI index.ts', () => {
|
|
|
717
816
|
.action(async (commitish, options) => {
|
|
718
817
|
const commentImports = actualParseCommentOptions(options.comment);
|
|
719
818
|
await startServer({
|
|
720
|
-
targetCommitish: commitish,
|
|
721
|
-
baseCommitish: `${commitish}^`,
|
|
819
|
+
selection: { targetCommitish: commitish, baseCommitish: `${commitish}^` },
|
|
722
820
|
preferredPort: options.port,
|
|
723
821
|
host: options.host,
|
|
724
822
|
openBrowser: options.open,
|
|
@@ -731,8 +829,7 @@ describe('CLI index.ts', () => {
|
|
|
731
829
|
'{"type":"thread","filePath":"src/example.ts","position":{"side":"new","line":10},"body":"Imported comment"}',
|
|
732
830
|
], { from: 'user' });
|
|
733
831
|
expect(mockStartServer).toHaveBeenCalledWith({
|
|
734
|
-
targetCommitish: 'HEAD',
|
|
735
|
-
baseCommitish: 'HEAD^',
|
|
832
|
+
selection: { targetCommitish: 'HEAD', baseCommitish: 'HEAD^' },
|
|
736
833
|
preferredPort: undefined,
|
|
737
834
|
host: '',
|
|
738
835
|
openBrowser: true,
|
|
@@ -814,8 +911,7 @@ describe('CLI index.ts', () => {
|
|
|
814
911
|
.option('--clean', 'start with a clean slate by clearing all existing comments')
|
|
815
912
|
.action(async (commitish, _compareWith, options) => {
|
|
816
913
|
const { url } = await startServer({
|
|
817
|
-
targetCommitish: commitish,
|
|
818
|
-
baseCommitish: commitish + '^',
|
|
914
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
819
915
|
preferredPort: options.port,
|
|
820
916
|
host: options.host,
|
|
821
917
|
openBrowser: options.open,
|
|
@@ -854,8 +950,7 @@ describe('CLI index.ts', () => {
|
|
|
854
950
|
.option('--clean', 'start with a clean slate by clearing all existing comments')
|
|
855
951
|
.action(async (commitish, _compareWith, options) => {
|
|
856
952
|
const { url } = await startServer({
|
|
857
|
-
targetCommitish: commitish,
|
|
858
|
-
baseCommitish: commitish + '^',
|
|
953
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
859
954
|
preferredPort: options.port,
|
|
860
955
|
host: options.host,
|
|
861
956
|
openBrowser: options.open,
|
|
@@ -897,8 +992,7 @@ describe('CLI index.ts', () => {
|
|
|
897
992
|
.option('--keep-alive', 'keep server running even after browser disconnects')
|
|
898
993
|
.action(async (commitish, _compareWith, options) => {
|
|
899
994
|
const { url } = await startServer({
|
|
900
|
-
targetCommitish: commitish,
|
|
901
|
-
baseCommitish: commitish + '^',
|
|
995
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
902
996
|
preferredPort: options.port,
|
|
903
997
|
host: options.host,
|
|
904
998
|
openBrowser: options.open,
|
|
@@ -939,8 +1033,7 @@ describe('CLI index.ts', () => {
|
|
|
939
1033
|
.option('--keep-alive', 'keep server running even after browser disconnects')
|
|
940
1034
|
.action(async (commitish, _compareWith, options) => {
|
|
941
1035
|
const { url } = await startServer({
|
|
942
|
-
targetCommitish: commitish,
|
|
943
|
-
baseCommitish: commitish + '^',
|
|
1036
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
944
1037
|
preferredPort: options.port,
|
|
945
1038
|
host: options.host,
|
|
946
1039
|
openBrowser: options.open,
|
|
@@ -981,8 +1074,7 @@ describe('CLI index.ts', () => {
|
|
|
981
1074
|
.option('--pr <url>', 'pr')
|
|
982
1075
|
.action(async (commitish, _compareWith, options) => {
|
|
983
1076
|
const { url, isEmpty } = await startServer({
|
|
984
|
-
targetCommitish: commitish,
|
|
985
|
-
baseCommitish: commitish + '^',
|
|
1077
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
986
1078
|
preferredPort: options.port,
|
|
987
1079
|
host: options.host,
|
|
988
1080
|
openBrowser: options.open,
|
|
@@ -1024,8 +1116,7 @@ describe('CLI index.ts', () => {
|
|
|
1024
1116
|
.option('--pr <url>', 'pr')
|
|
1025
1117
|
.action(async (commitish, _compareWith, options) => {
|
|
1026
1118
|
const { url, isEmpty } = await startServer({
|
|
1027
|
-
targetCommitish: commitish,
|
|
1028
|
-
baseCommitish: commitish + '^',
|
|
1119
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
1029
1120
|
preferredPort: options.port,
|
|
1030
1121
|
host: options.host,
|
|
1031
1122
|
openBrowser: options.open,
|
|
@@ -1058,8 +1149,7 @@ describe('CLI index.ts', () => {
|
|
|
1058
1149
|
.option('--pr <url>', 'pr')
|
|
1059
1150
|
.action(async (commitish, _compareWith, options) => {
|
|
1060
1151
|
await startServer({
|
|
1061
|
-
targetCommitish: commitish,
|
|
1062
|
-
baseCommitish: commitish + '^',
|
|
1152
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
1063
1153
|
preferredPort: options.port,
|
|
1064
1154
|
host: options.host,
|
|
1065
1155
|
openBrowser: options.open,
|
|
@@ -1085,8 +1175,7 @@ describe('CLI index.ts', () => {
|
|
|
1085
1175
|
.option('--pr <url>', 'pr')
|
|
1086
1176
|
.action(async (commitish, _compareWith, options) => {
|
|
1087
1177
|
await startServer({
|
|
1088
|
-
targetCommitish: commitish,
|
|
1089
|
-
baseCommitish: commitish + '^',
|
|
1178
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
1090
1179
|
preferredPort: options.port,
|
|
1091
1180
|
host: options.host,
|
|
1092
1181
|
openBrowser: options.open,
|
|
@@ -1144,16 +1233,14 @@ describe('CLI index.ts', () => {
|
|
|
1144
1233
|
const render = mockRender;
|
|
1145
1234
|
const TuiApp = mockTuiApp;
|
|
1146
1235
|
render(React.createElement(TuiApp, {
|
|
1147
|
-
targetCommitish: commitish,
|
|
1148
|
-
baseCommitish: commitish + '^',
|
|
1236
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
1149
1237
|
mode: options.mode,
|
|
1150
1238
|
}));
|
|
1151
1239
|
}
|
|
1152
1240
|
});
|
|
1153
1241
|
await program.parseAsync(['main', '--tui'], { from: 'user' });
|
|
1154
1242
|
expectRenderedTuiProps({
|
|
1155
|
-
targetCommitish: 'main',
|
|
1156
|
-
baseCommitish: 'main^',
|
|
1243
|
+
selection: { targetCommitish: 'main', baseCommitish: 'main^' },
|
|
1157
1244
|
mode: 'split',
|
|
1158
1245
|
});
|
|
1159
1246
|
});
|
|
@@ -1175,8 +1262,7 @@ describe('CLI index.ts', () => {
|
|
|
1175
1262
|
const render = mockRender;
|
|
1176
1263
|
const TuiApp = mockTuiApp;
|
|
1177
1264
|
render(React.createElement(TuiApp, {
|
|
1178
|
-
targetCommitish: commitish,
|
|
1179
|
-
baseCommitish: commitish + '^',
|
|
1265
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
1180
1266
|
mode: options.mode,
|
|
1181
1267
|
contextLines: options.context,
|
|
1182
1268
|
}));
|
|
@@ -1184,8 +1270,7 @@ describe('CLI index.ts', () => {
|
|
|
1184
1270
|
});
|
|
1185
1271
|
await program.parseAsync(['--tui', '--context', '2'], { from: 'user' });
|
|
1186
1272
|
expectRenderedTuiProps({
|
|
1187
|
-
targetCommitish: 'HEAD',
|
|
1188
|
-
baseCommitish: 'HEAD^',
|
|
1273
|
+
selection: { targetCommitish: 'HEAD', baseCommitish: 'HEAD^' },
|
|
1189
1274
|
mode: 'split',
|
|
1190
1275
|
contextLines: 2,
|
|
1191
1276
|
});
|
|
@@ -1211,16 +1296,14 @@ describe('CLI index.ts', () => {
|
|
|
1211
1296
|
const render = mockRender;
|
|
1212
1297
|
const TuiApp = mockTuiApp;
|
|
1213
1298
|
render(React.createElement(TuiApp, {
|
|
1214
|
-
targetCommitish: commitish,
|
|
1215
|
-
baseCommitish: commitish + '^',
|
|
1299
|
+
selection: { targetCommitish: commitish, baseCommitish: commitish + '^' },
|
|
1216
1300
|
mode: options.mode,
|
|
1217
1301
|
}));
|
|
1218
1302
|
}
|
|
1219
1303
|
});
|
|
1220
1304
|
await program.parseAsync(['--tui', '--mode', 'unified'], { from: 'user' });
|
|
1221
1305
|
expectRenderedTuiProps({
|
|
1222
|
-
targetCommitish: 'HEAD',
|
|
1223
|
-
baseCommitish: 'HEAD^',
|
|
1306
|
+
selection: { targetCommitish: 'HEAD', baseCommitish: 'HEAD^' },
|
|
1224
1307
|
mode: 'unified',
|
|
1225
1308
|
});
|
|
1226
1309
|
});
|
|
@@ -1252,16 +1335,14 @@ describe('CLI index.ts', () => {
|
|
|
1252
1335
|
baseCommitish = commitish + '^';
|
|
1253
1336
|
}
|
|
1254
1337
|
render(React.createElement(TuiApp, {
|
|
1255
|
-
targetCommitish,
|
|
1256
|
-
baseCommitish,
|
|
1338
|
+
selection: { targetCommitish, baseCommitish },
|
|
1257
1339
|
mode: options.mode,
|
|
1258
1340
|
}));
|
|
1259
1341
|
}
|
|
1260
1342
|
});
|
|
1261
1343
|
await program.parseAsync(['working', '--tui', '--mode', 'unified'], { from: 'user' });
|
|
1262
1344
|
expectRenderedTuiProps({
|
|
1263
|
-
targetCommitish: 'working',
|
|
1264
|
-
baseCommitish: 'staged',
|
|
1345
|
+
selection: { targetCommitish: 'working', baseCommitish: 'staged' },
|
|
1265
1346
|
mode: 'unified',
|
|
1266
1347
|
});
|
|
1267
1348
|
});
|
|
@@ -1361,8 +1442,10 @@ describe('CLI index.ts', () => {
|
|
|
1361
1442
|
diffMode = DiffMode.DEFAULT;
|
|
1362
1443
|
}
|
|
1363
1444
|
await startServer({
|
|
1364
|
-
|
|
1365
|
-
|
|
1445
|
+
selection: {
|
|
1446
|
+
targetCommitish: commitish,
|
|
1447
|
+
baseCommitish: compareWith || commitish + '^',
|
|
1448
|
+
},
|
|
1366
1449
|
preferredPort: options.port,
|
|
1367
1450
|
host: options.host,
|
|
1368
1451
|
openBrowser: options.open,
|
|
@@ -1407,8 +1490,10 @@ describe('CLI index.ts', () => {
|
|
|
1407
1490
|
diffMode = DiffMode.DEFAULT;
|
|
1408
1491
|
}
|
|
1409
1492
|
await startServer({
|
|
1410
|
-
|
|
1411
|
-
|
|
1493
|
+
selection: {
|
|
1494
|
+
targetCommitish: commitish,
|
|
1495
|
+
baseCommitish: compareWith || commitish + '^',
|
|
1496
|
+
},
|
|
1412
1497
|
preferredPort: options.port,
|
|
1413
1498
|
host: options.host,
|
|
1414
1499
|
openBrowser: options.open,
|
|
@@ -1419,8 +1504,7 @@ describe('CLI index.ts', () => {
|
|
|
1419
1504
|
await program.parseAsync(['HEAD', 'main'], { from: 'user' });
|
|
1420
1505
|
expect(mockStartServer).toHaveBeenCalledWith(expect.objectContaining({
|
|
1421
1506
|
diffMode: 'default', // HEAD with comparison is still DEFAULT mode
|
|
1422
|
-
targetCommitish: 'HEAD',
|
|
1423
|
-
baseCommitish: 'main',
|
|
1507
|
+
selection: { targetCommitish: 'HEAD', baseCommitish: 'main' },
|
|
1424
1508
|
}));
|
|
1425
1509
|
});
|
|
1426
1510
|
it('enables watch mode for dot with comparison', async () => {
|
|
@@ -1454,8 +1538,10 @@ describe('CLI index.ts', () => {
|
|
|
1454
1538
|
diffMode = DiffMode.DEFAULT;
|
|
1455
1539
|
}
|
|
1456
1540
|
await startServer({
|
|
1457
|
-
|
|
1458
|
-
|
|
1541
|
+
selection: {
|
|
1542
|
+
targetCommitish: commitish,
|
|
1543
|
+
baseCommitish: compareWith || commitish + '^',
|
|
1544
|
+
},
|
|
1459
1545
|
preferredPort: options.port,
|
|
1460
1546
|
host: options.host,
|
|
1461
1547
|
openBrowser: options.open,
|
|
@@ -1466,8 +1552,7 @@ describe('CLI index.ts', () => {
|
|
|
1466
1552
|
await program.parseAsync(['.', 'origin/main'], { from: 'user' });
|
|
1467
1553
|
expect(mockStartServer).toHaveBeenCalledWith(expect.objectContaining({
|
|
1468
1554
|
diffMode: 'dot', // Dot with comparison should still be DOT mode (watch enabled)
|
|
1469
|
-
targetCommitish: '.',
|
|
1470
|
-
baseCommitish: 'origin/main',
|
|
1555
|
+
selection: { targetCommitish: '.', baseCommitish: 'origin/main' },
|
|
1471
1556
|
}));
|
|
1472
1557
|
});
|
|
1473
1558
|
});
|
package/dist/cli/utils.js
CHANGED
package/dist/cli/utils.test.js
CHANGED
|
@@ -167,15 +167,19 @@ describe('CLI Utils', () => {
|
|
|
167
167
|
});
|
|
168
168
|
it('should validate HEAD references', () => {
|
|
169
169
|
expect(validateCommitish('HEAD')).toBe(true);
|
|
170
|
+
expect(validateCommitish('HEAD~')).toBe(true);
|
|
170
171
|
expect(validateCommitish('HEAD~1')).toBe(true);
|
|
171
172
|
expect(validateCommitish('HEAD~10')).toBe(true);
|
|
173
|
+
expect(validateCommitish('HEAD~~')).toBe(true);
|
|
172
174
|
expect(validateCommitish('HEAD^')).toBe(true);
|
|
173
175
|
expect(validateCommitish('HEAD^1')).toBe(true);
|
|
174
176
|
expect(validateCommitish('HEAD^2')).toBe(true);
|
|
177
|
+
expect(validateCommitish('HEAD~^')).toBe(true);
|
|
175
178
|
expect(validateCommitish('HEAD~2^1')).toBe(true);
|
|
176
179
|
});
|
|
177
180
|
it('should validate @ references (Git alias for HEAD)', () => {
|
|
178
181
|
expect(validateCommitish('@')).toBe(true);
|
|
182
|
+
expect(validateCommitish('@~')).toBe(true);
|
|
179
183
|
expect(validateCommitish('@~1')).toBe(true);
|
|
180
184
|
expect(validateCommitish('@~10')).toBe(true);
|
|
181
185
|
expect(validateCommitish('@^')).toBe(true);
|
|
@@ -203,6 +207,7 @@ describe('CLI Utils', () => {
|
|
|
203
207
|
});
|
|
204
208
|
it('should validate branch and remote refs with revision suffixes', () => {
|
|
205
209
|
expect(validateCommitish('main^')).toBe(true);
|
|
210
|
+
expect(validateCommitish('main~')).toBe(true);
|
|
206
211
|
expect(validateCommitish('origin/main~2')).toBe(true);
|
|
207
212
|
expect(validateCommitish('codex/comment-thread^')).toBe(true);
|
|
208
213
|
expect(validateCommitish('feature/new-feature^2')).toBe(true);
|
|
@@ -214,7 +219,6 @@ describe('CLI Utils', () => {
|
|
|
214
219
|
it('should reject invalid input', () => {
|
|
215
220
|
expect(validateCommitish('')).toBe(false);
|
|
216
221
|
expect(validateCommitish(' ')).toBe(false);
|
|
217
|
-
expect(validateCommitish('HEAD~')).toBe(false);
|
|
218
222
|
expect(validateCommitish('abc')).toBe(true); // short hashes are valid
|
|
219
223
|
// Invalid branch names according to git rules
|
|
220
224
|
expect(validateCommitish('-feature')).toBe(false); // cannot start with dash
|
|
@@ -247,6 +251,7 @@ describe('CLI Utils', () => {
|
|
|
247
251
|
describe('format validation', () => {
|
|
248
252
|
it('should accept valid commitish formats', () => {
|
|
249
253
|
expect(validateDiffArguments('HEAD', 'HEAD^')).toEqual({ valid: true });
|
|
254
|
+
expect(validateDiffArguments('HEAD~', 'HEAD~^')).toEqual({ valid: true });
|
|
250
255
|
expect(validateDiffArguments('main', 'develop')).toEqual({ valid: true });
|
|
251
256
|
expect(validateDiffArguments('abc123', 'def456')).toEqual({ valid: true });
|
|
252
257
|
expect(validateDiffArguments('working')).toEqual({ valid: true });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){this.__data__=[],this.size=0}function t(e,t){return e===t||e!==e&&t!==t}function n(e,n){for(var r=e.length;r--;)if(t(e[r][0],n))return r;return-1}var r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}function a(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}function o(e){return n(this.__data__,e)>-1}function s(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function c(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=e,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s;function l(){this.__data__=new c,this.size=0}function ee(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function te(e){return this.__data__.get(e)}function ne(e){return this.__data__.has(e)}var u=typeof global==`object`&&global&&global.Object===Object&&global,re=typeof self==`object`&&self&&self.Object===Object&&self,d=u||re||Function(`return this`)(),f=d.Symbol,p=Object.prototype,ie=p.hasOwnProperty,ae=p.toString,m=f?f.toStringTag:void 0;function oe(e){var t=ie.call(e,m),n=e[m];try{e[m]=void 0;var r=!0}catch{}var i=ae.call(e);return r&&(t?e[m]=n:delete e[m]),i}var se=Object.prototype.toString;function ce(e){return se.call(e)}var le=`[object Null]`,ue=`[object Undefined]`,h=f?f.toStringTag:void 0;function g(e){return e==null?e===void 0?ue:le:h&&h in Object(e)?oe(e):ce(e)}function _(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var de=`[object AsyncFunction]`,fe=`[object Function]`,pe=`[object GeneratorFunction]`,me=`[object Proxy]`;function v(e){if(!_(e))return!1;var t=g(e);return t==fe||t==pe||t==de||t==me}var y=d[`__core-js_shared__`],b=function(){var e=/[^.]+$/.exec(y&&y.keys&&y.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function he(e){return!!b&&b in e}var ge=Function.prototype.toString;function x(e){if(e!=null){try{return ge.call(e)}catch{}try{return e+``}catch{}}return``}var _e=/[\\^$.*+?()[\]{}|]/g,ve=/^\[object .+?Constructor\]$/,ye=Function.prototype,be=Object.prototype,xe=ye.toString,Se=be.hasOwnProperty,Ce=RegExp(`^`+xe.call(Se).replace(_e,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function we(e){return!_(e)||he(e)?!1:(v(e)?Ce:ve).test(x(e))}function Te(e,t){return e?.[t]}function S(e,t){var n=Te(e,t);return we(n)?n:void 0}var C=S(d,`Map`),w=S(Object,`create`);function T(){this.__data__=w?w(null):{},this.size=0}function E(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var D=`__lodash_hash_undefined__`,O=Object.prototype.hasOwnProperty;function Ee(e){var t=this.__data__;if(w){var n=t[e];return n===D?void 0:n}return O.call(t,e)?t[e]:void 0}var De=Object.prototype.hasOwnProperty;function Oe(e){var t=this.__data__;return w?t[e]!==void 0:De.call(t,e)}var ke=`__lodash_hash_undefined__`;function Ae(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=w&&t===void 0?ke:t,this}function k(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}k.prototype.clear=T,k.prototype.delete=E,k.prototype.get=Ee,k.prototype.has=Oe,k.prototype.set=Ae;function je(){this.size=0,this.__data__={hash:new k,map:new(C||c),string:new k}}function Me(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function A(e,t){var n=e.__data__;return Me(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Ne(e){var t=A(this,e).delete(e);return this.size-=+!!t,t}function Pe(e){return A(this,e).get(e)}function Fe(e){return A(this,e).has(e)}function Ie(e,t){var n=A(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function j(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}j.prototype.clear=je,j.prototype.delete=Ne,j.prototype.get=Pe,j.prototype.has=Fe,j.prototype.set=Ie;var Le=200;function Re(e,t){var n=this.__data__;if(n instanceof c){var r=n.__data__;if(!C||r.length<Le-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new j(r)}return n.set(e,t),this.size=n.size,this}function M(e){this.size=(this.__data__=new c(e)).size}M.prototype.clear=l,M.prototype.delete=ee,M.prototype.get=te,M.prototype.has=ne,M.prototype.set=Re;var ze=d.Uint8Array,N=Array.isArray;function Be(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function P(e){return typeof e==`object`&&!!e}var Ve=`[object Arguments]`;function F(e){return P(e)&&g(e)==Ve}var I=Object.prototype,He=I.hasOwnProperty,Ue=I.propertyIsEnumerable,L=F(function(){return arguments}())?F:function(e){return P(e)&&He.call(e,`callee`)&&!Ue.call(e,`callee`)};function We(){return!1}var R=typeof exports==`object`&&exports&&!exports.nodeType&&exports,z=R&&typeof module==`object`&&module&&!module.nodeType&&module,B=z&&z.exports===R?d.Buffer:void 0,V=(B?B.isBuffer:void 0)||We,Ge=9007199254740991,Ke=/^(?:0|[1-9]\d*)$/;function H(e,t){var n=typeof e;return t??=Ge,!!t&&(n==`number`||n!=`symbol`&&Ke.test(e))&&e>-1&&e%1==0&&e<t}var qe=9007199254740991;function U(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=qe}var Je=`[object Arguments]`,Ye=`[object Array]`,Xe=`[object Boolean]`,Ze=`[object Date]`,Qe=`[object Error]`,$e=`[object Function]`,et=`[object Map]`,tt=`[object Number]`,nt=`[object Object]`,rt=`[object RegExp]`,it=`[object Set]`,at=`[object String]`,ot=`[object WeakMap]`,st=`[object ArrayBuffer]`,ct=`[object DataView]`,lt=`[object Float32Array]`,ut=`[object Float64Array]`,dt=`[object Int8Array]`,ft=`[object Int16Array]`,pt=`[object Int32Array]`,mt=`[object Uint8Array]`,ht=`[object Uint8ClampedArray]`,gt=`[object Uint16Array]`,_t=`[object Uint32Array]`,W={};W[lt]=W[ut]=W[dt]=W[ft]=W[pt]=W[mt]=W[ht]=W[gt]=W[_t]=!0,W[Je]=W[Ye]=W[st]=W[Xe]=W[ct]=W[Ze]=W[Qe]=W[$e]=W[et]=W[tt]=W[nt]=W[rt]=W[it]=W[at]=W[ot]=!1;function vt(e){return P(e)&&U(e.length)&&!!W[g(e)]}function G(e){return function(t){return e(t)}}var K=typeof exports==`object`&&exports&&!exports.nodeType&&exports,q=K&&typeof module==`object`&&module&&!module.nodeType&&module,J=q&&q.exports===K&&u.process,Y=function(){try{return q&&q.require&&q.require(`util`).types||J&&J.binding&&J.binding(`util`)}catch{}}(),X=Y&&Y.isTypedArray,Z=X?G(X):vt,yt=Object.prototype.hasOwnProperty;function bt(e,t){var n=N(e),r=!n&&L(e),i=!n&&!r&&V(e),a=!n&&!r&&!i&&Z(e),o=n||r||i||a,s=o?Be(e.length,String):[],c=s.length;for(var l in e)(t||yt.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||H(l,c)))&&s.push(l);return s}var xt=Object.prototype;function St(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||xt)}function Ct(e,t){return function(n){return e(t(n))}}function wt(e){return e!=null&&U(e.length)&&!v(e)}var Tt=`Expected a function`;function Q(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(Tt);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Q.Cache||j),n}Q.Cache=j;function $(e){return e}function Et(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var Dt=Et();export{v as C,d as D,f as E,t as O,x as S,g as T,ze as _,Ct as a,C as b,Z as c,U as d,H as f,N as g,P as h,wt as i,Y as l,L as m,$ as n,St as o,V as p,Q as r,bt as s,Dt as t,G as u,M as v,_ as w,S as x,j as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./path-sMK4d_s9.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-61sCfOmN.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-K5T4RW27-DmamW1Ds.js";import{n as e}from"./chunk-7N4EOEYR-DPgxysWq.js";export{e as createArchitectureServices};
|