@self-review/serve 1.45.0 → 2.0.3
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.md +84 -17
- package/dist/cli.js +209 -196
- package/dist/cli.js.map +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-CRvWpEsk.js +1 -0
- package/dist/client/assets/{arc-LxCcHggQ.js → arc-PsXBAWZS.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-C3DgmaC3.js +36 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-BUrTsHao.js +129 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-CpZNs6lz.js +38 -0
- package/dist/client/assets/channel-mzvzhynH.js +1 -0
- package/dist/client/assets/{chunk-QZHKN3VN-GT04-vw7.js → chunk-2Q5K7J3B-BcKcR0LE.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-tB9OepVI.js → chunk-5VM5RSS4-C7oHjssV.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-BlPczT9-.js +1 -0
- package/dist/client/assets/chunk-IMKFNOWR-JWhBhxWO.js +231 -0
- package/dist/client/assets/{chunk-4BX2VUAB-D2GfUqwd.js → chunk-JWPE2WC7-BHqPUvha.js} +1 -1
- package/dist/client/assets/chunk-POPQ4Y6H-F7oDRNF5.js +1 -0
- package/dist/client/assets/chunk-SVP7TREG-BXZpN96Q.js +88 -0
- package/dist/client/assets/chunk-TICWLB2K-DNvFXi10.js +206 -0
- package/dist/client/assets/{chunk-55IACEB6-C68L7s0h.js → chunk-XXDRQBXY-DOvXkBHK.js} +1 -1
- package/dist/client/assets/classDiagram-ZZMXUADV-BAE1ijM-.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-BAE1ijM-.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-Ds41oEbD.js → cose-bilkent-JH36ORCC-DPJK_EQL.js} +1 -1
- package/dist/client/assets/cynefin-OW5HDTMX-JBAmnTQp.js +166 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CsYygsrr.js +62 -0
- package/dist/client/assets/cytoscape.esm-BB4DxJjf.js +321 -0
- package/dist/client/assets/dagre-GXQ25YYZ-Dbz4M33p.js +4 -0
- package/dist/client/assets/diagram-S7CK7UJ4-Biv-Q_jb.js +30 -0
- package/dist/client/assets/diagram-UQ7AKVKN-JRvoicym.js +41 -0
- package/dist/client/assets/diagram-VSXAHHWV-VAXOLPk0.js +3 -0
- package/dist/client/assets/diagram-VX7I27RA-DRmE-ol9.js +24 -0
- package/dist/client/assets/diagram-Z3DM3KII-CavqQl_8.js +24 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-70cdWXxf.js +1 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-Ha04LW0x.js +99 -0
- package/dist/client/assets/flowDiagram-HODETNUW-BRLi1S7q.js +168 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BfBVCQ3A.js +292 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-D-GiQOxC.js +106 -0
- package/dist/client/assets/index-hcoT-WH0.css +1 -0
- package/dist/client/assets/index-vUb9LsiF.js +285 -0
- package/dist/client/assets/infoDiagram-27XIBGKW-KEMBoX9p.js +2 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-CBS0T3w-.js +70 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-AN4puIAJ.js +139 -0
- package/dist/client/assets/{kanban-definition-3W4ZIXB7-D-BINTOt.js → kanban-definition-UXKFOSKX-BWQivApD.js} +8 -8
- package/dist/client/assets/katex-HP8lGamR.js +257 -0
- package/dist/client/assets/layout-B7etliRi.js +1 -0
- package/dist/client/assets/{linear-CNmY37sq.js → linear-DYVJ9r-o.js} +1 -1
- package/dist/client/assets/mermaid.core-B9m3791z.js +310 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-BwhaRhOg.js +96 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-B6zVpKjE.js +1 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-DGmD4H1L.js +39 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-CrKpGbBm.js +7 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-DLcnTQsv.js +1 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-bqG-UOfq.js +84 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-DGRQqw-s.js +40 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-CW-ivDp5.js +162 -0
- package/dist/client/assets/sizeCapture-INFHLROL-BbHjPnUF.js +1 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-BproWKBe.js +1 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-Ck8yo6ic.js +1 -0
- package/dist/client/assets/swimlanes-42K2YHIH-OG2jZQn8.js +1 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CgYw65ZN.js +8 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-DQeIsWHU.js +120 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-CzLpoCxP.js +34 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-Bga8iF2e.js +78 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-BMPq9UWm.js +7 -0
- package/dist/client/index.html +2 -2
- package/package.json +3 -3
- package/dist/client/assets/_basePickBy-DzL66huQ.js +0 -1
- package/dist/client/assets/_baseUniq-D_kA9hnK.js +0 -1
- package/dist/client/assets/architectureDiagram-VXUJARFQ-BmSW2FCh.js +0 -36
- package/dist/client/assets/blockDiagram-VD42YOAC-Duz6oS5b.js +0 -122
- package/dist/client/assets/c4Diagram-YG6GDRKO-Bv4P72yB.js +0 -10
- package/dist/client/assets/channel-ydExFSqY.js +0 -1
- package/dist/client/assets/chunk-B4BG7PRW-BtVwfswM.js +0 -165
- package/dist/client/assets/chunk-DI55MBZ5-BDdO91wt.js +0 -220
- package/dist/client/assets/chunk-QN33PNHL-HjKgp1PB.js +0 -1
- package/dist/client/assets/chunk-TZMSLE5B-DpxXSXMp.js +0 -1
- package/dist/client/assets/classDiagram-2ON5EDUG-Dg8dmmRD.js +0 -1
- package/dist/client/assets/classDiagram-v2-WZHVMYZB-Dg8dmmRD.js +0 -1
- package/dist/client/assets/clone-Bq6xpRgi.js +0 -1
- package/dist/client/assets/cytoscape.esm-5J0xJHOV.js +0 -321
- package/dist/client/assets/dagre-6UL2VRFP-DZiEousR.js +0 -4
- package/dist/client/assets/diagram-PSM6KHXK-0_alnUMs.js +0 -24
- package/dist/client/assets/diagram-QEK2KX5R-KFaKVdU8.js +0 -43
- package/dist/client/assets/diagram-S2PKOQOG-C2Dy10VG.js +0 -24
- package/dist/client/assets/erDiagram-Q2GNP2WA-_P7rrcgu.js +0 -60
- package/dist/client/assets/flowDiagram-NV44I4VS-BvC6gSn5.js +0 -162
- package/dist/client/assets/ganttDiagram-JELNMOA3-DjzuVPeB.js +0 -267
- package/dist/client/assets/gitGraphDiagram-V2S2FVAM-B9fPDqqA.js +0 -65
- package/dist/client/assets/graph-BqLQdgDA.js +0 -1
- package/dist/client/assets/index-CAXQd1OO.js +0 -286
- package/dist/client/assets/index-CmSvc3Wo.css +0 -1
- package/dist/client/assets/infoDiagram-HS3SLOUP-DiMCwlkY.js +0 -2
- package/dist/client/assets/journeyDiagram-XKPGCS4Q-Dn5WdzPP.js +0 -139
- package/dist/client/assets/katex-DhXJpUyf.js +0 -261
- package/dist/client/assets/layout-Bo5pDIcD.js +0 -1
- package/dist/client/assets/mermaid.core-DfADLZQ1.js +0 -250
- package/dist/client/assets/mindmap-definition-VGOIOE7T-H5HwEwuX.js +0 -68
- package/dist/client/assets/pieDiagram-ADFJNKIX-RiZa5XQN.js +0 -30
- package/dist/client/assets/quadrantDiagram-AYHSOK5B-CFFX55h2.js +0 -7
- package/dist/client/assets/requirementDiagram-UZGBJVZJ-B6JBcV1I.js +0 -64
- package/dist/client/assets/sankeyDiagram-TZEHDZUN-GZT80dnc.js +0 -10
- package/dist/client/assets/sequenceDiagram-WL72ISMW-CbUqoUma.js +0 -145
- package/dist/client/assets/stateDiagram-FKZM4ZOC-LEb-ZQVV.js +0 -1
- package/dist/client/assets/stateDiagram-v2-4FDKWEC3-BYGHA8iw.js +0 -1
- package/dist/client/assets/timeline-definition-IT6M3QCI-Cm1Kd50N.js +0 -61
- package/dist/client/assets/treemap-GDKQZRPO-CWXk-dEb.js +0 -160
- package/dist/client/assets/xychartDiagram-PRI3JC2R-BUllxp6G.js +0 -7
- package/dist/core/src/apply-suggestion.d.ts +0 -76
- package/dist/core/src/apply-suggestion.d.ts.map +0 -1
- package/dist/core/src/apply-suggestion.js +0 -109
- package/dist/core/src/apply-suggestion.js.map +0 -1
- package/dist/core/src/config.d.ts +0 -3
- package/dist/core/src/config.d.ts.map +0 -1
- package/dist/core/src/config.js +0 -196
- package/dist/core/src/config.js.map +0 -1
- package/dist/core/src/diff-parser.d.ts +0 -3
- package/dist/core/src/diff-parser.d.ts.map +0 -1
- package/dist/core/src/diff-parser.js +0 -236
- package/dist/core/src/diff-parser.js.map +0 -1
- package/dist/core/src/directory-scanner.d.ts +0 -18
- package/dist/core/src/directory-scanner.d.ts.map +0 -1
- package/dist/core/src/directory-scanner.js +0 -99
- package/dist/core/src/directory-scanner.js.map +0 -1
- package/dist/core/src/fetch-comments.d.ts +0 -69
- package/dist/core/src/fetch-comments.d.ts.map +0 -1
- package/dist/core/src/fetch-comments.js +0 -180
- package/dist/core/src/fetch-comments.js.map +0 -1
- package/dist/core/src/file-type-utils.d.ts +0 -16
- package/dist/core/src/file-type-utils.d.ts.map +0 -1
- package/dist/core/src/file-type-utils.js +0 -106
- package/dist/core/src/file-type-utils.js.map +0 -1
- package/dist/core/src/forge-provider.d.ts +0 -123
- package/dist/core/src/forge-provider.d.ts.map +0 -1
- package/dist/core/src/forge-provider.js +0 -68
- package/dist/core/src/forge-provider.js.map +0 -1
- package/dist/core/src/fs-utils.d.ts +0 -7
- package/dist/core/src/fs-utils.d.ts.map +0 -1
- package/dist/core/src/fs-utils.js +0 -20
- package/dist/core/src/fs-utils.js.map +0 -1
- package/dist/core/src/git-diff-args.d.ts +0 -38
- package/dist/core/src/git-diff-args.d.ts.map +0 -1
- package/dist/core/src/git-diff-args.js +0 -170
- package/dist/core/src/git-diff-args.js.map +0 -1
- package/dist/core/src/git-diff-loader.d.ts +0 -14
- package/dist/core/src/git-diff-loader.d.ts.map +0 -1
- package/dist/core/src/git-diff-loader.js +0 -30
- package/dist/core/src/git-diff-loader.js.map +0 -1
- package/dist/core/src/git.d.ts +0 -52
- package/dist/core/src/git.d.ts.map +0 -1
- package/dist/core/src/git.js +0 -191
- package/dist/core/src/git.js.map +0 -1
- package/dist/core/src/github-provider.d.ts +0 -7
- package/dist/core/src/github-provider.d.ts.map +0 -1
- package/dist/core/src/github-provider.js +0 -151
- package/dist/core/src/github-provider.js.map +0 -1
- package/dist/core/src/gitlab-provider.d.ts +0 -10
- package/dist/core/src/gitlab-provider.d.ts.map +0 -1
- package/dist/core/src/gitlab-provider.js +0 -207
- package/dist/core/src/gitlab-provider.js.map +0 -1
- package/dist/core/src/guide-loader.d.ts +0 -23
- package/dist/core/src/guide-loader.d.ts.map +0 -1
- package/dist/core/src/guide-loader.js +0 -95
- package/dist/core/src/guide-loader.js.map +0 -1
- package/dist/core/src/guide-parser.d.ts +0 -34
- package/dist/core/src/guide-parser.d.ts.map +0 -1
- package/dist/core/src/guide-parser.js +0 -136
- package/dist/core/src/guide-parser.js.map +0 -1
- package/dist/core/src/guide-schema.d.ts +0 -2
- package/dist/core/src/guide-schema.d.ts.map +0 -1
- package/dist/core/src/guide-schema.js +0 -202
- package/dist/core/src/guide-schema.js.map +0 -1
- package/dist/core/src/ignore-filter.d.ts +0 -8
- package/dist/core/src/ignore-filter.d.ts.map +0 -1
- package/dist/core/src/ignore-filter.js +0 -16
- package/dist/core/src/ignore-filter.js.map +0 -1
- package/dist/core/src/index.d.ts +0 -38
- package/dist/core/src/index.d.ts.map +0 -1
- package/dist/core/src/index.js +0 -54
- package/dist/core/src/index.js.map +0 -1
- package/dist/core/src/materializer.d.ts +0 -60
- package/dist/core/src/materializer.d.ts.map +0 -1
- package/dist/core/src/materializer.js +0 -255
- package/dist/core/src/materializer.js.map +0 -1
- package/dist/core/src/payload-sizing.d.ts +0 -20
- package/dist/core/src/payload-sizing.d.ts.map +0 -1
- package/dist/core/src/payload-sizing.js +0 -74
- package/dist/core/src/payload-sizing.js.map +0 -1
- package/dist/core/src/remote-mode.d.ts +0 -89
- package/dist/core/src/remote-mode.d.ts.map +0 -1
- package/dist/core/src/remote-mode.js +0 -193
- package/dist/core/src/remote-mode.js.map +0 -1
- package/dist/core/src/review-handlers.d.ts +0 -160
- package/dist/core/src/review-handlers.d.ts.map +0 -1
- package/dist/core/src/review-handlers.js +0 -463
- package/dist/core/src/review-handlers.js.map +0 -1
- package/dist/core/src/staged-untracked.d.ts +0 -12
- package/dist/core/src/staged-untracked.d.ts.map +0 -1
- package/dist/core/src/staged-untracked.js +0 -21
- package/dist/core/src/staged-untracked.js.map +0 -1
- package/dist/core/src/startup-mode.d.ts +0 -6
- package/dist/core/src/startup-mode.d.ts.map +0 -1
- package/dist/core/src/startup-mode.js +0 -73
- package/dist/core/src/startup-mode.js.map +0 -1
- package/dist/core/src/synthetic-diff.d.ts +0 -21
- package/dist/core/src/synthetic-diff.d.ts.map +0 -1
- package/dist/core/src/synthetic-diff.js +0 -104
- package/dist/core/src/synthetic-diff.js.map +0 -1
- package/dist/core/src/thread-mapper.d.ts +0 -39
- package/dist/core/src/thread-mapper.d.ts.map +0 -1
- package/dist/core/src/thread-mapper.js +0 -217
- package/dist/core/src/thread-mapper.js.map +0 -1
- package/dist/core/src/types.d.ts +0 -2
- package/dist/core/src/types.d.ts.map +0 -1
- package/dist/core/src/types.js +0 -2
- package/dist/core/src/types.js.map +0 -1
- package/dist/core/src/xml-parser.d.ts +0 -15
- package/dist/core/src/xml-parser.d.ts.map +0 -1
- package/dist/core/src/xml-parser.js +0 -237
- package/dist/core/src/xml-parser.js.map +0 -1
- package/dist/core/src/xml-serializer.d.ts +0 -4
- package/dist/core/src/xml-serializer.d.ts.map +0 -1
- package/dist/core/src/xml-serializer.js +0 -923
- package/dist/core/src/xml-serializer.js.map +0 -1
- package/dist/react/src/ReviewPanel.d.ts +0 -72
- package/dist/react/src/ReviewPanel.d.ts.map +0 -1
- package/dist/react/src/ReviewPanel.js +0 -51
- package/dist/react/src/ReviewPanel.js.map +0 -1
- package/dist/react/src/SingleFileReview.d.ts +0 -49
- package/dist/react/src/SingleFileReview.d.ts.map +0 -1
- package/dist/react/src/SingleFileReview.js +0 -41
- package/dist/react/src/SingleFileReview.js.map +0 -1
- package/dist/react/src/adapter.d.ts +0 -72
- package/dist/react/src/adapter.d.ts.map +0 -1
- package/dist/react/src/adapter.js +0 -2
- package/dist/react/src/adapter.js.map +0 -1
- package/dist/react/src/components/Comments/AttachmentDropZone.d.ts +0 -10
- package/dist/react/src/components/Comments/AttachmentDropZone.d.ts.map +0 -1
- package/dist/react/src/components/Comments/AttachmentDropZone.js +0 -52
- package/dist/react/src/components/Comments/AttachmentDropZone.js.map +0 -1
- package/dist/react/src/components/Comments/AttachmentImage.d.ts +0 -6
- package/dist/react/src/components/Comments/AttachmentImage.d.ts.map +0 -1
- package/dist/react/src/components/Comments/AttachmentImage.js +0 -50
- package/dist/react/src/components/Comments/AttachmentImage.js.map +0 -1
- package/dist/react/src/components/Comments/AttachmentThumbnail.d.ts +0 -6
- package/dist/react/src/components/Comments/AttachmentThumbnail.d.ts.map +0 -1
- package/dist/react/src/components/Comments/AttachmentThumbnail.js +0 -16
- package/dist/react/src/components/Comments/AttachmentThumbnail.js.map +0 -1
- package/dist/react/src/components/Comments/CategorySelector.d.ts +0 -6
- package/dist/react/src/components/Comments/CategorySelector.d.ts.map +0 -1
- package/dist/react/src/components/Comments/CategorySelector.js +0 -27
- package/dist/react/src/components/Comments/CategorySelector.js.map +0 -1
- package/dist/react/src/components/Comments/CommentDisplay.d.ts +0 -7
- package/dist/react/src/components/Comments/CommentDisplay.d.ts.map +0 -1
- package/dist/react/src/components/Comments/CommentDisplay.js +0 -103
- package/dist/react/src/components/Comments/CommentDisplay.js.map +0 -1
- package/dist/react/src/components/Comments/CommentInput.d.ts +0 -11
- package/dist/react/src/components/Comments/CommentInput.d.ts.map +0 -1
- package/dist/react/src/components/Comments/CommentInput.js +0 -81
- package/dist/react/src/components/Comments/CommentInput.js.map +0 -1
- package/dist/react/src/components/Comments/ComposerCore.d.ts +0 -49
- package/dist/react/src/components/Comments/ComposerCore.d.ts.map +0 -1
- package/dist/react/src/components/Comments/ComposerCore.js +0 -91
- package/dist/react/src/components/Comments/ComposerCore.js.map +0 -1
- package/dist/react/src/components/Comments/EmojiAutocomplete.d.ts +0 -14
- package/dist/react/src/components/Comments/EmojiAutocomplete.d.ts.map +0 -1
- package/dist/react/src/components/Comments/EmojiAutocomplete.js +0 -19
- package/dist/react/src/components/Comments/EmojiAutocomplete.js.map +0 -1
- package/dist/react/src/components/Comments/ReplyDisplay.d.ts +0 -22
- package/dist/react/src/components/Comments/ReplyDisplay.d.ts.map +0 -1
- package/dist/react/src/components/Comments/ReplyDisplay.js +0 -38
- package/dist/react/src/components/Comments/ReplyDisplay.js.map +0 -1
- package/dist/react/src/components/Comments/ReplyInput.d.ts +0 -9
- package/dist/react/src/components/Comments/ReplyInput.d.ts.map +0 -1
- package/dist/react/src/components/Comments/ReplyInput.js +0 -47
- package/dist/react/src/components/Comments/ReplyInput.js.map +0 -1
- package/dist/react/src/components/Comments/SuggestionApplyControl.d.ts +0 -27
- package/dist/react/src/components/Comments/SuggestionApplyControl.d.ts.map +0 -1
- package/dist/react/src/components/Comments/SuggestionApplyControl.js +0 -103
- package/dist/react/src/components/Comments/SuggestionApplyControl.js.map +0 -1
- package/dist/react/src/components/Comments/SuggestionBlock.d.ts +0 -26
- package/dist/react/src/components/Comments/SuggestionBlock.d.ts.map +0 -1
- package/dist/react/src/components/Comments/SuggestionBlock.js +0 -33
- package/dist/react/src/components/Comments/SuggestionBlock.js.map +0 -1
- package/dist/react/src/components/Comments/SuggestionPanel.d.ts +0 -8
- package/dist/react/src/components/Comments/SuggestionPanel.d.ts.map +0 -1
- package/dist/react/src/components/Comments/SuggestionPanel.js +0 -12
- package/dist/react/src/components/Comments/SuggestionPanel.js.map +0 -1
- package/dist/react/src/components/DiffViewer/DiffContentArea.d.ts +0 -35
- package/dist/react/src/components/DiffViewer/DiffContentArea.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/DiffContentArea.js +0 -40
- package/dist/react/src/components/DiffViewer/DiffContentArea.js.map +0 -1
- package/dist/react/src/components/DiffViewer/DiffViewer.d.ts +0 -4
- package/dist/react/src/components/DiffViewer/DiffViewer.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/DiffViewer.js +0 -110
- package/dist/react/src/components/DiffViewer/DiffViewer.js.map +0 -1
- package/dist/react/src/components/DiffViewer/EmptyDiffMessage.d.ts +0 -6
- package/dist/react/src/components/DiffViewer/EmptyDiffMessage.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/EmptyDiffMessage.js +0 -18
- package/dist/react/src/components/DiffViewer/EmptyDiffMessage.js.map +0 -1
- package/dist/react/src/components/DiffViewer/EmptyLinePane.d.ts +0 -2
- package/dist/react/src/components/DiffViewer/EmptyLinePane.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/EmptyLinePane.js +0 -5
- package/dist/react/src/components/DiffViewer/EmptyLinePane.js.map +0 -1
- package/dist/react/src/components/DiffViewer/ExpandContextBar.d.ts +0 -10
- package/dist/react/src/components/DiffViewer/ExpandContextBar.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/ExpandContextBar.js +0 -16
- package/dist/react/src/components/DiffViewer/ExpandContextBar.js.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSection.d.ts +0 -9
- package/dist/react/src/components/DiffViewer/FileSection.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSection.js +0 -137
- package/dist/react/src/components/DiffViewer/FileSection.js.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSectionBody.d.ts +0 -13
- package/dist/react/src/components/DiffViewer/FileSectionBody.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSectionBody.js +0 -8
- package/dist/react/src/components/DiffViewer/FileSectionBody.js.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSectionHeader.d.ts +0 -16
- package/dist/react/src/components/DiffViewer/FileSectionHeader.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSectionHeader.js +0 -53
- package/dist/react/src/components/DiffViewer/FileSectionHeader.js.map +0 -1
- package/dist/react/src/components/DiffViewer/FrontMatterTable.d.ts +0 -6
- package/dist/react/src/components/DiffViewer/FrontMatterTable.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/FrontMatterTable.js +0 -30
- package/dist/react/src/components/DiffViewer/FrontMatterTable.js.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideChapterDivider.d.ts +0 -20
- package/dist/react/src/components/DiffViewer/GuideChapterDivider.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideChapterDivider.js +0 -27
- package/dist/react/src/components/DiffViewer/GuideChapterDivider.js.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewContent.d.ts +0 -16
- package/dist/react/src/components/DiffViewer/GuideOverviewContent.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewContent.js +0 -56
- package/dist/react/src/components/DiffViewer/GuideOverviewContent.js.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewDialog.d.ts +0 -12
- package/dist/react/src/components/DiffViewer/GuideOverviewDialog.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewDialog.js +0 -13
- package/dist/react/src/components/DiffViewer/GuideOverviewDialog.js.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewPanel.d.ts +0 -8
- package/dist/react/src/components/DiffViewer/GuideOverviewPanel.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewPanel.js +0 -16
- package/dist/react/src/components/DiffViewer/GuideOverviewPanel.js.map +0 -1
- package/dist/react/src/components/DiffViewer/HunkHeader.d.ts +0 -5
- package/dist/react/src/components/DiffViewer/HunkHeader.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/HunkHeader.js +0 -5
- package/dist/react/src/components/DiffViewer/HunkHeader.js.map +0 -1
- package/dist/react/src/components/DiffViewer/InlineCommentSlot.d.ts +0 -18
- package/dist/react/src/components/DiffViewer/InlineCommentSlot.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/InlineCommentSlot.js +0 -13
- package/dist/react/src/components/DiffViewer/InlineCommentSlot.js.map +0 -1
- package/dist/react/src/components/DiffViewer/MarkdownCode.d.ts +0 -9
- package/dist/react/src/components/DiffViewer/MarkdownCode.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/MarkdownCode.js +0 -24
- package/dist/react/src/components/DiffViewer/MarkdownCode.js.map +0 -1
- package/dist/react/src/components/DiffViewer/MermaidBlock.d.ts +0 -4
- package/dist/react/src/components/DiffViewer/MermaidBlock.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/MermaidBlock.js +0 -51
- package/dist/react/src/components/DiffViewer/MermaidBlock.js.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedImageView.d.ts +0 -8
- package/dist/react/src/components/DiffViewer/RenderedImageView.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedImageView.js +0 -46
- package/dist/react/src/components/DiffViewer/RenderedImageView.js.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedMarkdownView.d.ts +0 -16
- package/dist/react/src/components/DiffViewer/RenderedMarkdownView.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedMarkdownView.js +0 -324
- package/dist/react/src/components/DiffViewer/RenderedMarkdownView.js.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedSvgView.d.ts +0 -7
- package/dist/react/src/components/DiffViewer/RenderedSvgView.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedSvgView.js +0 -21
- package/dist/react/src/components/DiffViewer/RenderedSvgView.js.map +0 -1
- package/dist/react/src/components/DiffViewer/SplitView.d.ts +0 -23
- package/dist/react/src/components/DiffViewer/SplitView.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/SplitView.js +0 -137
- package/dist/react/src/components/DiffViewer/SplitView.js.map +0 -1
- package/dist/react/src/components/DiffViewer/SyntaxLine.d.ts +0 -49
- package/dist/react/src/components/DiffViewer/SyntaxLine.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/SyntaxLine.js +0 -73
- package/dist/react/src/components/DiffViewer/SyntaxLine.js.map +0 -1
- package/dist/react/src/components/DiffViewer/UnifiedView.d.ts +0 -23
- package/dist/react/src/components/DiffViewer/UnifiedView.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/UnifiedView.js +0 -96
- package/dist/react/src/components/DiffViewer/UnifiedView.js.map +0 -1
- package/dist/react/src/components/DiffViewer/diff-utils.d.ts +0 -31
- package/dist/react/src/components/DiffViewer/diff-utils.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/diff-utils.js +0 -134
- package/dist/react/src/components/DiffViewer/diff-utils.js.map +0 -1
- package/dist/react/src/components/DiffViewer/useDragSelection.d.ts +0 -25
- package/dist/react/src/components/DiffViewer/useDragSelection.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/useDragSelection.js +0 -210
- package/dist/react/src/components/DiffViewer/useDragSelection.js.map +0 -1
- package/dist/react/src/components/DiffViewer/useExpandContext.d.ts +0 -15
- package/dist/react/src/components/DiffViewer/useExpandContext.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/useExpandContext.js +0 -209
- package/dist/react/src/components/DiffViewer/useExpandContext.js.map +0 -1
- package/dist/react/src/components/FileTree.d.ts +0 -2
- package/dist/react/src/components/FileTree.d.ts.map +0 -1
- package/dist/react/src/components/FileTree.js +0 -93
- package/dist/react/src/components/FileTree.js.map +0 -1
- package/dist/react/src/components/FileTreeEntry.d.ts +0 -13
- package/dist/react/src/components/FileTreeEntry.d.ts.map +0 -1
- package/dist/react/src/components/FileTreeEntry.js +0 -21
- package/dist/react/src/components/FileTreeEntry.js.map +0 -1
- package/dist/react/src/components/FileTreeToggle.d.ts +0 -15
- package/dist/react/src/components/FileTreeToggle.d.ts.map +0 -1
- package/dist/react/src/components/FileTreeToggle.js +0 -16
- package/dist/react/src/components/FileTreeToggle.js.map +0 -1
- package/dist/react/src/components/GuideRouteHud.d.ts +0 -10
- package/dist/react/src/components/GuideRouteHud.d.ts.map +0 -1
- package/dist/react/src/components/GuideRouteHud.js +0 -43
- package/dist/react/src/components/GuideRouteHud.js.map +0 -1
- package/dist/react/src/components/GuideRouteMap.d.ts +0 -20
- package/dist/react/src/components/GuideRouteMap.d.ts.map +0 -1
- package/dist/react/src/components/GuideRouteMap.js +0 -58
- package/dist/react/src/components/GuideRouteMap.js.map +0 -1
- package/dist/react/src/components/GuideStation.d.ts +0 -28
- package/dist/react/src/components/GuideStation.d.ts.map +0 -1
- package/dist/react/src/components/GuideStation.js +0 -24
- package/dist/react/src/components/GuideStation.js.map +0 -1
- package/dist/react/src/components/HintOverlay.d.ts +0 -13
- package/dist/react/src/components/HintOverlay.d.ts.map +0 -1
- package/dist/react/src/components/HintOverlay.js +0 -27
- package/dist/react/src/components/HintOverlay.js.map +0 -1
- package/dist/react/src/components/KeyboardNavigationManager.d.ts +0 -2
- package/dist/react/src/components/KeyboardNavigationManager.d.ts.map +0 -1
- package/dist/react/src/components/KeyboardNavigationManager.js +0 -8
- package/dist/react/src/components/KeyboardNavigationManager.js.map +0 -1
- package/dist/react/src/components/Layout.d.ts +0 -2
- package/dist/react/src/components/Layout.d.ts.map +0 -1
- package/dist/react/src/components/Layout.js +0 -63
- package/dist/react/src/components/Layout.js.map +0 -1
- package/dist/react/src/components/ReviewProgress.d.ts +0 -2
- package/dist/react/src/components/ReviewProgress.d.ts.map +0 -1
- package/dist/react/src/components/ReviewProgress.js +0 -25
- package/dist/react/src/components/ReviewProgress.js.map +0 -1
- package/dist/react/src/components/Toolbar.d.ts +0 -6
- package/dist/react/src/components/Toolbar.d.ts.map +0 -1
- package/dist/react/src/components/Toolbar.js +0 -61
- package/dist/react/src/components/Toolbar.js.map +0 -1
- package/dist/react/src/components/TruncatedPath.d.ts +0 -7
- package/dist/react/src/components/TruncatedPath.d.ts.map +0 -1
- package/dist/react/src/components/TruncatedPath.js +0 -15
- package/dist/react/src/components/TruncatedPath.js.map +0 -1
- package/dist/react/src/components/ui/badge.d.ts +0 -10
- package/dist/react/src/components/ui/badge.d.ts.map +0 -1
- package/dist/react/src/components/ui/badge.js +0 -21
- package/dist/react/src/components/ui/badge.js.map +0 -1
- package/dist/react/src/components/ui/button.d.ts +0 -11
- package/dist/react/src/components/ui/button.d.ts.map +0 -1
- package/dist/react/src/components/ui/button.js +0 -32
- package/dist/react/src/components/ui/button.js.map +0 -1
- package/dist/react/src/components/ui/dialog.d.ts +0 -12
- package/dist/react/src/components/ui/dialog.d.ts.map +0 -1
- package/dist/react/src/components/ui/dialog.js +0 -23
- package/dist/react/src/components/ui/dialog.js.map +0 -1
- package/dist/react/src/components/ui/input.d.ts +0 -4
- package/dist/react/src/components/ui/input.d.ts.map +0 -1
- package/dist/react/src/components/ui/input.js +0 -9
- package/dist/react/src/components/ui/input.js.map +0 -1
- package/dist/react/src/components/ui/separator.d.ts +0 -6
- package/dist/react/src/components/ui/separator.d.ts.map +0 -1
- package/dist/react/src/components/ui/separator.js +0 -8
- package/dist/react/src/components/ui/separator.js.map +0 -1
- package/dist/react/src/components/ui/table.d.ts +0 -11
- package/dist/react/src/components/ui/table.d.ts.map +0 -1
- package/dist/react/src/components/ui/table.js +0 -21
- package/dist/react/src/components/ui/table.js.map +0 -1
- package/dist/react/src/components/ui/textarea.d.ts +0 -4
- package/dist/react/src/components/ui/textarea.d.ts.map +0 -1
- package/dist/react/src/components/ui/textarea.js +0 -9
- package/dist/react/src/components/ui/textarea.js.map +0 -1
- package/dist/react/src/components/ui/toggle-group.d.ts +0 -22
- package/dist/react/src/components/ui/toggle-group.d.ts.map +0 -1
- package/dist/react/src/components/ui/toggle-group.js +0 -48
- package/dist/react/src/components/ui/toggle-group.js.map +0 -1
- package/dist/react/src/components/ui/tooltip.d.ts +0 -16
- package/dist/react/src/components/ui/tooltip.d.ts.map +0 -1
- package/dist/react/src/components/ui/tooltip.js +0 -21
- package/dist/react/src/components/ui/tooltip.js.map +0 -1
- package/dist/react/src/context/ConfigContext.d.ts +0 -26
- package/dist/react/src/context/ConfigContext.d.ts.map +0 -1
- package/dist/react/src/context/ConfigContext.js +0 -150
- package/dist/react/src/context/ConfigContext.js.map +0 -1
- package/dist/react/src/context/DiffNavigationContext.d.ts +0 -16
- package/dist/react/src/context/DiffNavigationContext.d.ts.map +0 -1
- package/dist/react/src/context/DiffNavigationContext.js +0 -79
- package/dist/react/src/context/DiffNavigationContext.js.map +0 -1
- package/dist/react/src/context/GuideContext.d.ts +0 -28
- package/dist/react/src/context/GuideContext.d.ts.map +0 -1
- package/dist/react/src/context/GuideContext.js +0 -64
- package/dist/react/src/context/GuideContext.js.map +0 -1
- package/dist/react/src/context/ReviewAdapterContext.d.ts +0 -9
- package/dist/react/src/context/ReviewAdapterContext.d.ts.map +0 -1
- package/dist/react/src/context/ReviewAdapterContext.js +0 -10
- package/dist/react/src/context/ReviewAdapterContext.js.map +0 -1
- package/dist/react/src/context/ReviewContext.d.ts +0 -60
- package/dist/react/src/context/ReviewContext.d.ts.map +0 -1
- package/dist/react/src/context/ReviewContext.js +0 -233
- package/dist/react/src/context/ReviewContext.js.map +0 -1
- package/dist/react/src/hooks/useDiffNavigation.d.ts +0 -4
- package/dist/react/src/hooks/useDiffNavigation.d.ts.map +0 -1
- package/dist/react/src/hooks/useDiffNavigation.js +0 -5
- package/dist/react/src/hooks/useDiffNavigation.js.map +0 -1
- package/dist/react/src/hooks/useEmojiAutocomplete.d.ts +0 -24
- package/dist/react/src/hooks/useEmojiAutocomplete.d.ts.map +0 -1
- package/dist/react/src/hooks/useEmojiAutocomplete.js +0 -175
- package/dist/react/src/hooks/useEmojiAutocomplete.js.map +0 -1
- package/dist/react/src/hooks/useKeyboardNavigation.d.ts +0 -15
- package/dist/react/src/hooks/useKeyboardNavigation.d.ts.map +0 -1
- package/dist/react/src/hooks/useKeyboardNavigation.js +0 -227
- package/dist/react/src/hooks/useKeyboardNavigation.js.map +0 -1
- package/dist/react/src/hooks/useReviewBridge.d.ts +0 -15
- package/dist/react/src/hooks/useReviewBridge.d.ts.map +0 -1
- package/dist/react/src/hooks/useReviewBridge.js +0 -43
- package/dist/react/src/hooks/useReviewBridge.js.map +0 -1
- package/dist/react/src/hooks/useReviewState.d.ts +0 -16
- package/dist/react/src/hooks/useReviewState.d.ts.map +0 -1
- package/dist/react/src/hooks/useReviewState.js +0 -101
- package/dist/react/src/hooks/useReviewState.js.map +0 -1
- package/dist/react/src/index.d.ts +0 -25
- package/dist/react/src/index.d.ts.map +0 -1
- package/dist/react/src/index.js +0 -22
- package/dist/react/src/index.js.map +0 -1
- package/dist/react/src/lib/utils.d.ts +0 -3
- package/dist/react/src/lib/utils.d.ts.map +0 -1
- package/dist/react/src/lib/utils.js +0 -6
- package/dist/react/src/lib/utils.js.map +0 -1
- package/dist/react/src/utils/category-utils.d.ts +0 -17
- package/dist/react/src/utils/category-utils.d.ts.map +0 -1
- package/dist/react/src/utils/category-utils.js +0 -23
- package/dist/react/src/utils/category-utils.js.map +0 -1
- package/dist/react/src/utils/comment-anchors.d.ts +0 -4
- package/dist/react/src/utils/comment-anchors.d.ts.map +0 -1
- package/dist/react/src/utils/comment-anchors.js +0 -17
- package/dist/react/src/utils/comment-anchors.js.map +0 -1
- package/dist/react/src/utils/diff-styles.d.ts +0 -12
- package/dist/react/src/utils/diff-styles.d.ts.map +0 -1
- package/dist/react/src/utils/diff-styles.js +0 -46
- package/dist/react/src/utils/diff-styles.js.map +0 -1
- package/dist/react/src/utils/emoji-data.d.ts +0 -8
- package/dist/react/src/utils/emoji-data.d.ts.map +0 -1
- package/dist/react/src/utils/emoji-data.js +0 -43
- package/dist/react/src/utils/emoji-data.js.map +0 -1
- package/dist/react/src/utils/file-type-utils.d.ts +0 -20
- package/dist/react/src/utils/file-type-utils.d.ts.map +0 -1
- package/dist/react/src/utils/file-type-utils.js +0 -110
- package/dist/react/src/utils/file-type-utils.js.map +0 -1
- package/dist/react/src/utils/front-matter.d.ts +0 -14
- package/dist/react/src/utils/front-matter.d.ts.map +0 -1
- package/dist/react/src/utils/front-matter.js +0 -40
- package/dist/react/src/utils/front-matter.js.map +0 -1
- package/dist/react/src/utils/guide-accents.d.ts +0 -46
- package/dist/react/src/utils/guide-accents.d.ts.map +0 -1
- package/dist/react/src/utils/guide-accents.js +0 -100
- package/dist/react/src/utils/guide-accents.js.map +0 -1
- package/dist/react/src/utils/guide-display.d.ts +0 -48
- package/dist/react/src/utils/guide-display.d.ts.map +0 -1
- package/dist/react/src/utils/guide-display.js +0 -75
- package/dist/react/src/utils/guide-display.js.map +0 -1
- package/dist/react/src/utils/image-utils.d.ts +0 -3
- package/dist/react/src/utils/image-utils.d.ts.map +0 -1
- package/dist/react/src/utils/image-utils.js +0 -33
- package/dist/react/src/utils/image-utils.js.map +0 -1
- package/dist/react/src/utils/passive-content.d.ts +0 -9
- package/dist/react/src/utils/passive-content.d.ts.map +0 -1
- package/dist/react/src/utils/passive-content.js +0 -135
- package/dist/react/src/utils/passive-content.js.map +0 -1
- package/dist/react/src/utils/remark-emoji.d.ts +0 -3
- package/dist/react/src/utils/remark-emoji.d.ts.map +0 -1
- package/dist/react/src/utils/remark-emoji.js +0 -38
- package/dist/react/src/utils/remark-emoji.js.map +0 -1
- package/dist/serve/src/args.d.ts +0 -15
- package/dist/serve/src/args.d.ts.map +0 -1
- package/dist/serve/src/args.js +0 -65
- package/dist/serve/src/args.js.map +0 -1
- package/dist/serve/src/cli.d.ts +0 -3
- package/dist/serve/src/cli.d.ts.map +0 -1
- package/dist/serve/src/cli.js +0 -81
- package/dist/serve/src/cli.js.map +0 -1
- package/dist/serve/src/client/adapter.d.ts +0 -25
- package/dist/serve/src/client/adapter.d.ts.map +0 -1
- package/dist/serve/src/client/adapter.js +0 -190
- package/dist/serve/src/client/adapter.js.map +0 -1
- package/dist/serve/src/client/index.d.ts +0 -2
- package/dist/serve/src/client/index.d.ts.map +0 -1
- package/dist/serve/src/client/index.js +0 -135
- package/dist/serve/src/client/index.js.map +0 -1
- package/dist/serve/src/lifecycle.d.ts +0 -27
- package/dist/serve/src/lifecycle.d.ts.map +0 -1
- package/dist/serve/src/lifecycle.js +0 -73
- package/dist/serve/src/lifecycle.js.map +0 -1
- package/dist/serve/src/server.d.ts +0 -34
- package/dist/serve/src/server.d.ts.map +0 -1
- package/dist/serve/src/server.js +0 -430
- package/dist/serve/src/server.js.map +0 -1
- package/dist/serve/src/startup.d.ts +0 -19
- package/dist/serve/src/startup.d.ts.map +0 -1
- package/dist/serve/src/startup.js +0 -117
- package/dist/serve/src/startup.js.map +0 -1
- package/dist/serve/src/validate.d.ts +0 -44
- package/dist/serve/src/validate.d.ts.map +0 -1
- package/dist/serve/src/validate.js +0 -295
- package/dist/serve/src/validate.js.map +0 -1
- package/dist/types/src/index.d.ts +0 -417
- package/dist/types/src/index.d.ts.map +0 -1
- package/dist/types/src/index.js +0 -5
- package/dist/types/src/index.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -4,176 +4,124 @@
|
|
|
4
4
|
import { createRequire } from "module";
|
|
5
5
|
|
|
6
6
|
// src/args.ts
|
|
7
|
+
import { extractApplicationOptions } from "@self-review/core";
|
|
7
8
|
var VALUE_FLAGS = {
|
|
8
9
|
"--output": "outputPath",
|
|
9
10
|
"-o": "outputPath",
|
|
10
11
|
"--resume-from": "resumeFrom"
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
13
|
+
var BOOLEAN_FLAGS = {
|
|
14
|
+
"--help": "help",
|
|
15
|
+
"-h": "help",
|
|
16
|
+
"--version": "version",
|
|
17
|
+
"-v": "version"
|
|
18
|
+
};
|
|
18
19
|
function parseServeArgs(argv) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const { values, flags, rest } = extractApplicationOptions(argv, {
|
|
21
|
+
valueFlags: VALUE_FLAGS,
|
|
22
|
+
booleanFlags: BOOLEAN_FLAGS
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
gitDiffArgs: rest,
|
|
26
|
+
outputPath: values.outputPath,
|
|
27
|
+
resumeFrom: values.resumeFrom,
|
|
28
|
+
help: flags.help,
|
|
29
|
+
version: flags.version
|
|
25
30
|
};
|
|
26
|
-
for (let i = 0; i < argv.length; i++) {
|
|
27
|
-
const arg = argv[i];
|
|
28
|
-
if (arg === "--help" || arg === "-h") {
|
|
29
|
-
args.help = true;
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if (arg === "--version" || arg === "-v") {
|
|
33
|
-
args.version = true;
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
const equals = arg.indexOf("=");
|
|
37
|
-
if (equals > 0) {
|
|
38
|
-
const field2 = VALUE_FLAGS[arg.slice(0, equals)];
|
|
39
|
-
if (field2) {
|
|
40
|
-
args[field2] = requireValue(arg.slice(0, equals), arg.slice(equals + 1));
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const field = VALUE_FLAGS[arg];
|
|
45
|
-
if (field) {
|
|
46
|
-
if (i + 1 >= argv.length) {
|
|
47
|
-
throw new Error(`${arg} requires a file path argument`);
|
|
48
|
-
}
|
|
49
|
-
args[field] = requireValue(arg, argv[i + 1]);
|
|
50
|
-
i++;
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
args.gitDiffArgs.push(arg);
|
|
54
|
-
}
|
|
55
|
-
return args;
|
|
56
31
|
}
|
|
57
32
|
|
|
58
33
|
// src/startup.ts
|
|
59
34
|
import { resolve } from "path";
|
|
60
35
|
import {
|
|
61
|
-
|
|
62
|
-
checkWritability,
|
|
36
|
+
commitDiffData,
|
|
63
37
|
computePayloadStats,
|
|
64
38
|
countTotalLines,
|
|
65
|
-
createIgnoreFilter,
|
|
66
39
|
createReviewSession,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
loadGitDiffWithUntracked,
|
|
40
|
+
inspectOutputPath,
|
|
41
|
+
loadConfigWithProvenance,
|
|
70
42
|
loadGuide,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
43
|
+
loadLocalReview,
|
|
44
|
+
loadResumeDocument,
|
|
45
|
+
publishOptionsFor,
|
|
46
|
+
resolveOutputTarget,
|
|
47
|
+
resolveStartupDiffArgs,
|
|
48
|
+
resolveStartupSource
|
|
75
49
|
} from "@self-review/core";
|
|
76
|
-
|
|
77
|
-
const mode = determineMode(gitDiffArgs);
|
|
78
|
-
console.error(`[serve] Startup mode: ${mode}`);
|
|
79
|
-
if (mode === "git") {
|
|
80
|
-
const { files, repository } = await loadGitDiffWithUntracked(gitDiffArgs);
|
|
81
|
-
const shouldKeep = createIgnoreFilter(config.ignore);
|
|
82
|
-
return {
|
|
83
|
-
files: files.filter((f) => shouldKeep(f.newPath || f.oldPath)),
|
|
84
|
-
source: { type: "git", gitDiffArgs: gitDiffArgs.join(" "), repository }
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
if (mode === "file") {
|
|
88
|
-
const fileArg = gitDiffArgs.find((a) => a !== "--" && !a.startsWith("-"));
|
|
89
|
-
const sourcePath = resolve(process.cwd(), fileArg);
|
|
90
|
-
return { files: await scanFile(sourcePath), source: { type: "file", sourcePath } };
|
|
91
|
-
}
|
|
92
|
-
if (mode === "directory") {
|
|
93
|
-
const dirArg = gitDiffArgs.find((a) => a !== "--" && !a.startsWith("-"));
|
|
94
|
-
const sourcePath = resolve(process.cwd(), dirArg);
|
|
95
|
-
return {
|
|
96
|
-
files: await scanDirectory(sourcePath, config.ignore),
|
|
97
|
-
source: { type: "directory", sourcePath }
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
throw new Error(
|
|
101
|
-
"Nothing to review: this is not a git repository and no path was given. Run self-review-serve inside a git repository, or pass a directory or file to review."
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
function containmentRoot(payload) {
|
|
105
|
-
return payload.source.type === "git" ? payload.source.repository : process.cwd();
|
|
106
|
-
}
|
|
50
|
+
var log = (message) => console.error(`[serve] ${message}`);
|
|
107
51
|
async function resolveSession(args) {
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
52
|
+
const cwd = process.cwd();
|
|
53
|
+
const loadedConfig = loadConfigWithProvenance({ cwd });
|
|
54
|
+
const output = resolveOutputTarget(args.outputPath, loadedConfig, cwd);
|
|
55
|
+
const problem = inspectOutputPath(output.path, publishOptionsFor(output));
|
|
56
|
+
if (problem) {
|
|
111
57
|
throw new Error(
|
|
112
|
-
`Output path is not writable: ${
|
|
58
|
+
`Output path is not writable (${problem.code}): ${problem.message} Pass a writable path with --output, or set output-file in .self-review.yaml.`
|
|
113
59
|
);
|
|
114
60
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
61
|
+
log(`Output path: ${output.path} (${output.origin})`);
|
|
62
|
+
const { gitDiffArgs, config } = resolveStartupDiffArgs(args.gitDiffArgs, loadedConfig, cwd);
|
|
63
|
+
const source = resolveStartupSource(gitDiffArgs, cwd);
|
|
64
|
+
log(`Startup mode: ${source.mode}`);
|
|
65
|
+
if (source.mode === "welcome") {
|
|
66
|
+
throw new Error(
|
|
67
|
+
"Nothing to review: this is not a git repository and no path was given. Run self-review-serve inside a git repository, or pass a directory or file to review."
|
|
68
|
+
);
|
|
119
69
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
70
|
+
const { payload: diffData, identity } = await loadLocalReview(
|
|
71
|
+
source,
|
|
72
|
+
gitDiffArgs,
|
|
73
|
+
config,
|
|
74
|
+
cwd,
|
|
75
|
+
log
|
|
76
|
+
);
|
|
77
|
+
log(`Loaded ${diffData.files.length} files`);
|
|
124
78
|
const stats = computePayloadStats(diffData.files.length, countTotalLines(diffData.files), config);
|
|
125
79
|
if (stats.exceedsAny) {
|
|
126
|
-
|
|
127
|
-
`
|
|
80
|
+
log(
|
|
81
|
+
`Large payload: ${stats.fileCount} files, ${stats.totalLines} lines (thresholds ${config.maxFiles} files, ${config.maxTotalLines} lines) \u2014 serving file contents on demand`
|
|
128
82
|
);
|
|
129
83
|
diffData.isLargePayload = true;
|
|
130
84
|
}
|
|
131
85
|
const session = createReviewSession();
|
|
132
86
|
if (args.resumeFrom) {
|
|
133
|
-
const resumePath = resolve(
|
|
134
|
-
let parsed;
|
|
87
|
+
const resumePath = resolve(cwd, args.resumeFrom);
|
|
135
88
|
try {
|
|
136
|
-
|
|
89
|
+
loadResumeDocument(session, resumePath);
|
|
137
90
|
} catch (error) {
|
|
138
91
|
throw new Error(
|
|
139
92
|
`Could not read the resume file ${resumePath}: ` + (error instanceof Error ? error.message : String(error))
|
|
140
93
|
);
|
|
141
94
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
console.error(
|
|
145
|
-
`[serve] Resumed ${parsed.comments.length} comments and ${parsed.viewedFiles.length} viewed files from ${resumePath}`
|
|
95
|
+
log(
|
|
96
|
+
`Resumed ${session.resumeComments.length} comments and ${session.resumeViewedFiles.length} viewed files from ${resumePath}`
|
|
146
97
|
);
|
|
98
|
+
for (const diagnostic of session.resumeImportDiagnostics) {
|
|
99
|
+
log(`Resume import: ${diagnostic}`);
|
|
100
|
+
}
|
|
147
101
|
}
|
|
148
102
|
const guideData = await loadGuide(
|
|
149
|
-
|
|
103
|
+
output.path,
|
|
150
104
|
config,
|
|
151
105
|
diffData.files.map((f) => f.newPath || f.oldPath)
|
|
152
106
|
);
|
|
153
107
|
if (guideData) {
|
|
154
|
-
|
|
108
|
+
log(`Walkthrough guide loaded: ${guideData.groups.length} groups`);
|
|
155
109
|
}
|
|
156
|
-
session
|
|
110
|
+
commitDiffData(session, diffData, identity);
|
|
157
111
|
session.guideData = guideData;
|
|
158
112
|
session.config = config;
|
|
159
|
-
session.outputPathInfo = { resolvedOutputPath:
|
|
160
|
-
return { session,
|
|
113
|
+
session.outputPathInfo = { resolvedOutputPath: output.path, outputPathWritable: true };
|
|
114
|
+
return { session, output };
|
|
161
115
|
}
|
|
162
116
|
|
|
163
117
|
// src/lifecycle.ts
|
|
164
|
-
import * as fs from "fs";
|
|
165
|
-
import { serializeReview, takeReviewState } from "@self-review/core";
|
|
166
|
-
async function writeReviewOutput(state, outputPath) {
|
|
167
|
-
const xml = await serializeReview(state, outputPath);
|
|
168
|
-
fs.writeFileSync(outputPath, xml + "\n", "utf-8");
|
|
169
|
-
}
|
|
170
118
|
function shutdown(server, exit, code) {
|
|
171
119
|
server.closeAllConnections();
|
|
172
120
|
server.close();
|
|
173
121
|
exit(code);
|
|
174
122
|
}
|
|
175
123
|
function completeReviewOnSubmit(options) {
|
|
176
|
-
const { server,
|
|
124
|
+
const { server, exit = process.exit } = options;
|
|
177
125
|
let completing = false;
|
|
178
126
|
server.on("request", (req, res) => {
|
|
179
127
|
if (req.method !== "POST" || pathnameOf(req.url) !== "/api/review") {
|
|
@@ -184,7 +132,8 @@ function completeReviewOnSubmit(options) {
|
|
|
184
132
|
return;
|
|
185
133
|
}
|
|
186
134
|
completing = true;
|
|
187
|
-
|
|
135
|
+
console.error("[serve] Review complete; stopping.");
|
|
136
|
+
shutdown(server, exit, 0);
|
|
188
137
|
});
|
|
189
138
|
});
|
|
190
139
|
}
|
|
@@ -195,52 +144,38 @@ function pathnameOf(url) {
|
|
|
195
144
|
return null;
|
|
196
145
|
}
|
|
197
146
|
}
|
|
198
|
-
async function complete(server, session, outputPath, exit) {
|
|
199
|
-
const state = takeReviewState(session);
|
|
200
|
-
if (!state) {
|
|
201
|
-
console.error("[serve] Review submission accepted but no state was recorded");
|
|
202
|
-
shutdown(server, exit, 1);
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
try {
|
|
206
|
-
await writeReviewOutput(state, outputPath);
|
|
207
|
-
} catch (error) {
|
|
208
|
-
console.error(
|
|
209
|
-
`[serve] Error saving review: ${error instanceof Error ? error.message : String(error)}`
|
|
210
|
-
);
|
|
211
|
-
shutdown(server, exit, 1);
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
console.error(`[serve] Review written to ${outputPath}`);
|
|
215
|
-
shutdown(server, exit, 0);
|
|
216
|
-
}
|
|
217
147
|
|
|
218
148
|
// src/server.ts
|
|
219
|
-
import * as
|
|
149
|
+
import * as fs2 from "fs";
|
|
220
150
|
import * as http from "http";
|
|
221
151
|
import * as path2 from "path";
|
|
222
152
|
import { fileURLToPath } from "url";
|
|
223
153
|
import {
|
|
154
|
+
authorizeReviewedPath,
|
|
224
155
|
getDiffLoad,
|
|
225
156
|
getConfigLoad,
|
|
226
157
|
getResumeLoad,
|
|
227
158
|
getFileHunks,
|
|
228
159
|
loadImage,
|
|
160
|
+
parseAttachmentReference,
|
|
229
161
|
readAttachment,
|
|
230
162
|
expandContext,
|
|
231
163
|
submitReviewState,
|
|
232
|
-
applySuggestionForSession
|
|
164
|
+
applySuggestionForSession,
|
|
165
|
+
publishOptionsFor as publishOptionsFor2,
|
|
166
|
+
publishReview,
|
|
167
|
+
ReviewPublishError
|
|
233
168
|
} from "@self-review/core";
|
|
234
169
|
|
|
235
170
|
// src/validate.ts
|
|
236
|
-
import * as
|
|
171
|
+
import * as fs from "fs";
|
|
237
172
|
import * as path from "path";
|
|
238
173
|
function realpathDeepestExisting(absolute) {
|
|
239
174
|
const missing = [];
|
|
240
175
|
let current = absolute;
|
|
241
176
|
for (; ; ) {
|
|
242
177
|
try {
|
|
243
|
-
const real =
|
|
178
|
+
const real = fs.realpathSync(current);
|
|
244
179
|
return missing.length === 0 ? real : path.join(real, ...missing);
|
|
245
180
|
} catch {
|
|
246
181
|
const parent = path.dirname(current);
|
|
@@ -255,7 +190,7 @@ function realpathDeepestExisting(absolute) {
|
|
|
255
190
|
function containPath(root, candidate) {
|
|
256
191
|
let resolvedRoot;
|
|
257
192
|
try {
|
|
258
|
-
resolvedRoot =
|
|
193
|
+
resolvedRoot = fs.realpathSync(root);
|
|
259
194
|
} catch {
|
|
260
195
|
return null;
|
|
261
196
|
}
|
|
@@ -461,10 +396,30 @@ function decodeFileAttachments(files) {
|
|
|
461
396
|
return { ok: true, value: decodedFiles };
|
|
462
397
|
}
|
|
463
398
|
|
|
399
|
+
// src/capability.ts
|
|
400
|
+
import { randomBytes, timingSafeEqual } from "crypto";
|
|
401
|
+
function generateCapability() {
|
|
402
|
+
return randomBytes(32).toString("base64url");
|
|
403
|
+
}
|
|
404
|
+
function capabilityMatches(expected, presented) {
|
|
405
|
+
const a = Buffer.from(expected, "utf-8");
|
|
406
|
+
const b = Buffer.from(presented, "utf-8");
|
|
407
|
+
return a.length === b.length && timingSafeEqual(a, b);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// src/protocol.ts
|
|
411
|
+
var MAX_REVIEW_BODY_BYTES = 32 * 1024 * 1024;
|
|
412
|
+
var CAPABILITY_FRAGMENT_KEY = "cap";
|
|
413
|
+
var CAPABILITY_SCHEME = "Bearer";
|
|
414
|
+
function formatLaunchUrl(listenerUrl, capability) {
|
|
415
|
+
return `${listenerUrl}#${CAPABILITY_FRAGMENT_KEY}=${capability}`;
|
|
416
|
+
}
|
|
417
|
+
|
|
464
418
|
// src/server.ts
|
|
465
|
-
|
|
419
|
+
function defaultClientDir() {
|
|
420
|
+
return fileURLToPath(new URL("./client/", import.meta.url));
|
|
421
|
+
}
|
|
466
422
|
var MAX_EXPAND_CONTEXT_BODY_BYTES = 64 * 1024;
|
|
467
|
-
var MAX_REVIEW_BODY_BYTES = 32 * 1024 * 1024;
|
|
468
423
|
var CONTENT_TYPES = {
|
|
469
424
|
".html": "text/html; charset=utf-8",
|
|
470
425
|
".js": "text/javascript; charset=utf-8",
|
|
@@ -548,14 +503,34 @@ function sendJson(res, status, value, headers = {}) {
|
|
|
548
503
|
function sendError(res, status, error) {
|
|
549
504
|
sendJson(res, status, { error }, status === 413 ? { connection: "close" } : {});
|
|
550
505
|
}
|
|
551
|
-
function
|
|
506
|
+
function presentsCapability(req, capability) {
|
|
507
|
+
const header = req.headers.authorization;
|
|
508
|
+
if (header === void 0) return false;
|
|
509
|
+
const space = header.indexOf(" ");
|
|
510
|
+
if (space === -1) return false;
|
|
511
|
+
if (header.slice(0, space).toLowerCase() !== CAPABILITY_SCHEME.toLowerCase()) return false;
|
|
512
|
+
return capabilityMatches(capability, header.slice(space + 1).trim());
|
|
513
|
+
}
|
|
514
|
+
function sendUnauthorized(res) {
|
|
515
|
+
sendJson(res, 401, { error: "unauthorized" }, { "www-authenticate": CAPABILITY_SCHEME });
|
|
516
|
+
}
|
|
517
|
+
var REVIEWED_PATH_ERROR = "path must name a file in the reviewed diff";
|
|
518
|
+
function requireReviewedPath(ctx, filePath, what = "path") {
|
|
519
|
+
if (authorizeReviewedPath(ctx.session, filePath).ok) return true;
|
|
520
|
+
sendError(
|
|
521
|
+
ctx.res,
|
|
522
|
+
400,
|
|
523
|
+
what === "path" ? REVIEWED_PATH_ERROR : `${what} must name a file in the reviewed diff`
|
|
524
|
+
);
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
function requireReviewedQueryPath(ctx) {
|
|
552
528
|
const raw = ctx.url.searchParams.get("path");
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
sendError(ctx.res, 400, "path must be a file under the repository root");
|
|
529
|
+
if (raw === null) {
|
|
530
|
+
sendError(ctx.res, 400, REVIEWED_PATH_ERROR);
|
|
556
531
|
return null;
|
|
557
532
|
}
|
|
558
|
-
return
|
|
533
|
+
return requireReviewedPath(ctx, raw) ? raw : null;
|
|
559
534
|
}
|
|
560
535
|
function readJsonBody(req, maxBytes) {
|
|
561
536
|
const contentType = req.headers["content-type"] ?? "";
|
|
@@ -607,26 +582,25 @@ var routes = {
|
|
|
607
582
|
sendJson(res, 200, getResumeLoad(session));
|
|
608
583
|
},
|
|
609
584
|
"GET /api/file": async (ctx) => {
|
|
610
|
-
const
|
|
611
|
-
if (
|
|
612
|
-
sendJson(ctx.res, 200, getFileHunks(ctx.session,
|
|
585
|
+
const filePath = requireReviewedQueryPath(ctx);
|
|
586
|
+
if (filePath === null) return;
|
|
587
|
+
sendJson(ctx.res, 200, getFileHunks(ctx.session, filePath));
|
|
613
588
|
},
|
|
614
589
|
"GET /api/image": async (ctx) => {
|
|
615
|
-
const
|
|
616
|
-
if (
|
|
617
|
-
sendJson(ctx.res, 200, await loadImage(ctx.session,
|
|
590
|
+
const filePath = requireReviewedQueryPath(ctx);
|
|
591
|
+
if (filePath === null) return;
|
|
592
|
+
sendJson(ctx.res, 200, await loadImage(ctx.session, filePath));
|
|
618
593
|
},
|
|
619
594
|
"GET /api/attachment": async (ctx) => {
|
|
620
|
-
const assetRoot = ctx.session.outputPathInfo ? path2.dirname(ctx.session.outputPathInfo.resolvedOutputPath) : ctx.repositoryRoot;
|
|
621
595
|
const raw = ctx.url.searchParams.get("path");
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
sendError(ctx.res, 400, "path must be a file under the output directory");
|
|
596
|
+
if (raw === null || parseAttachmentReference(raw) === null) {
|
|
597
|
+
sendError(ctx.res, 400, "path must name a file in the .self-review-assets directory");
|
|
625
598
|
return;
|
|
626
599
|
}
|
|
627
|
-
const
|
|
628
|
-
if (
|
|
629
|
-
|
|
600
|
+
const result = await readAttachment(ctx.session, raw);
|
|
601
|
+
if (!result.ok) {
|
|
602
|
+
const status = result.reason === "not-authorized" ? 400 : result.reason === "too-large" ? 413 : 404;
|
|
603
|
+
sendError(ctx.res, status, status === 404 ? "attachment not found" : result.message);
|
|
630
604
|
return;
|
|
631
605
|
}
|
|
632
606
|
const { res } = ctx;
|
|
@@ -635,9 +609,10 @@ var routes = {
|
|
|
635
609
|
"cache-control": "no-store",
|
|
636
610
|
...SECURITY_HEADERS
|
|
637
611
|
});
|
|
638
|
-
res.end(Buffer.from(data));
|
|
612
|
+
res.end(Buffer.from(result.data));
|
|
639
613
|
},
|
|
640
|
-
"POST /api/expand-context": async (
|
|
614
|
+
"POST /api/expand-context": async (ctx) => {
|
|
615
|
+
const { req, res, session } = ctx;
|
|
641
616
|
const body = await readJsonBody(req, MAX_EXPAND_CONTEXT_BODY_BYTES);
|
|
642
617
|
if (!body.ok) {
|
|
643
618
|
sendError(res, body.status, body.error);
|
|
@@ -648,17 +623,13 @@ var routes = {
|
|
|
648
623
|
sendError(res, 400, parsed.error);
|
|
649
624
|
return;
|
|
650
625
|
}
|
|
651
|
-
if (
|
|
652
|
-
sendError(res, 400, "filePath must be a file under the repository root");
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
626
|
+
if (!requireReviewedPath(ctx, parsed.value.filePath, "filePath")) return;
|
|
655
627
|
sendJson(res, 200, await expandContext(session, parsed.value));
|
|
656
628
|
},
|
|
657
|
-
// The one route that rewrites a file in the reviewed tree. Core refuses
|
|
658
|
-
//
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
"POST /api/apply-suggestion": async ({ req, res, session, repositoryRoot }) => {
|
|
629
|
+
// The one route that rewrites a file in the reviewed tree. Core refuses unless the anchored lines still
|
|
630
|
+
// match the suggestion's recorded original byte for byte, and resolves the destination itself.
|
|
631
|
+
"POST /api/apply-suggestion": async (ctx) => {
|
|
632
|
+
const { req, res, session } = ctx;
|
|
662
633
|
const body = await readJsonBody(req, MAX_EXPAND_CONTEXT_BODY_BYTES);
|
|
663
634
|
if (!body.ok) {
|
|
664
635
|
sendError(res, body.status, body.error);
|
|
@@ -669,13 +640,11 @@ var routes = {
|
|
|
669
640
|
sendError(res, 400, parsed.error);
|
|
670
641
|
return;
|
|
671
642
|
}
|
|
672
|
-
if (
|
|
673
|
-
sendError(res, 400, "filePath must be a file under the repository root");
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
643
|
+
if (!requireReviewedPath(ctx, parsed.value.filePath, "filePath")) return;
|
|
676
644
|
sendJson(res, 200, applySuggestionForSession(session, parsed.value));
|
|
677
645
|
},
|
|
678
|
-
|
|
646
|
+
// The completion: a 200 means the file is on disk; a failure leaves the server up for a retry.
|
|
647
|
+
"POST /api/review": async ({ req, res, session, output }) => {
|
|
679
648
|
const body = await readJsonBody(req, MAX_REVIEW_BODY_BYTES);
|
|
680
649
|
if (!body.ok) {
|
|
681
650
|
sendError(res, body.status, body.error);
|
|
@@ -687,9 +656,39 @@ var routes = {
|
|
|
687
656
|
return;
|
|
688
657
|
}
|
|
689
658
|
submitReviewState(session, parsed.value);
|
|
690
|
-
|
|
659
|
+
const outcome = await publishSubmittedReview(parsed.value, output, session);
|
|
660
|
+
if (outcome.ok) {
|
|
661
|
+
sendJson(res, 200, outcome);
|
|
662
|
+
} else {
|
|
663
|
+
sendJson(res, publishFailureStatus(outcome.code), outcome);
|
|
664
|
+
}
|
|
691
665
|
}
|
|
692
666
|
};
|
|
667
|
+
async function publishSubmittedReview(state, output, session) {
|
|
668
|
+
const options = publishOptionsFor2(output, session.attachmentOrigins);
|
|
669
|
+
try {
|
|
670
|
+
const { outputPath } = await publishReview(state, output.path, options);
|
|
671
|
+
console.error(`[serve] Review written to ${outputPath}`);
|
|
672
|
+
return { ok: true, outputPath };
|
|
673
|
+
} catch (error) {
|
|
674
|
+
if (!(error instanceof ReviewPublishError)) throw error;
|
|
675
|
+
console.error(`[serve] Review not saved (${error.code}): ${error.message}`);
|
|
676
|
+
for (const detail of error.details) {
|
|
677
|
+
console.error(`[serve] ${detail}`);
|
|
678
|
+
}
|
|
679
|
+
console.error(
|
|
680
|
+
"[serve] The review is still open in the browser. Fix the problem and press Finish Review again."
|
|
681
|
+
);
|
|
682
|
+
return { ok: false, code: error.code, message: error.message, details: [...error.details] };
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
var DOCUMENT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
686
|
+
"validation-failed",
|
|
687
|
+
"xml-illegal-character"
|
|
688
|
+
]);
|
|
689
|
+
function publishFailureStatus(code) {
|
|
690
|
+
return DOCUMENT_ERROR_CODES.has(code) ? 422 : 500;
|
|
691
|
+
}
|
|
693
692
|
var ROUTE_PATHS = new Set(Object.keys(routes).map((key) => key.split(" ")[1]));
|
|
694
693
|
async function serveStatic(res, clientDir, pathname) {
|
|
695
694
|
let decoded;
|
|
@@ -707,12 +706,12 @@ async function serveStatic(res, clientDir, pathname) {
|
|
|
707
706
|
}
|
|
708
707
|
let data;
|
|
709
708
|
try {
|
|
710
|
-
const stat = await
|
|
709
|
+
const stat = await fs2.promises.stat(resolved);
|
|
711
710
|
if (!stat.isFile()) {
|
|
712
711
|
sendError(res, 404, "not found");
|
|
713
712
|
return;
|
|
714
713
|
}
|
|
715
|
-
data = await
|
|
714
|
+
data = await fs2.promises.readFile(resolved);
|
|
716
715
|
} catch {
|
|
717
716
|
sendError(res, 404, "not found");
|
|
718
717
|
return;
|
|
@@ -725,7 +724,7 @@ async function serveStatic(res, clientDir, pathname) {
|
|
|
725
724
|
res.end(data);
|
|
726
725
|
}
|
|
727
726
|
function createReviewServer(options) {
|
|
728
|
-
const { session,
|
|
727
|
+
const { session, output, capability, clientDir = defaultClientDir() } = options;
|
|
729
728
|
return http.createServer(async (req, res) => {
|
|
730
729
|
const method = req.method ?? "GET";
|
|
731
730
|
let url;
|
|
@@ -739,10 +738,14 @@ function createReviewServer(options) {
|
|
|
739
738
|
sendError(res, 403, "forbidden");
|
|
740
739
|
return;
|
|
741
740
|
}
|
|
741
|
+
if (url.pathname.startsWith("/api/") && !presentsCapability(req, capability)) {
|
|
742
|
+
sendUnauthorized(res);
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
742
745
|
try {
|
|
743
746
|
const handler = routes[`${method} ${url.pathname}`];
|
|
744
747
|
if (handler) {
|
|
745
|
-
await handler({ req, res, url, session,
|
|
748
|
+
await handler({ req, res, url, session, output });
|
|
746
749
|
} else if (ROUTE_PATHS.has(url.pathname)) {
|
|
747
750
|
sendError(res, 405, "method not allowed");
|
|
748
751
|
} else if (url.pathname.startsWith("/api/")) {
|
|
@@ -795,15 +798,22 @@ Examples:
|
|
|
795
798
|
self-review-serve main..feature-branch
|
|
796
799
|
self-review-serve --resume-from review.xml # resume a previous review
|
|
797
800
|
|
|
798
|
-
The URL is printed to stderr on start.
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
801
|
+
The URL is printed to stderr on start. Open exactly that URL: the part after
|
|
802
|
+
'#' is this session's key, drawn fresh each start, and the browser keeps it
|
|
803
|
+
out of the address bar once the page has loaded. A reloaded or retyped
|
|
804
|
+
address has no key and the page says so; if the URL is lost, stop this
|
|
805
|
+
process and start it again. Over ssh, forward the port (ssh -L) and open the
|
|
806
|
+
same URL against the forwarded port, keeping the '#' part.
|
|
802
807
|
|
|
803
|
-
The
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
808
|
+
The output path is fixed by the arguments above and cannot be changed from
|
|
809
|
+
the browser. Completing the review writes that file and stops this process.
|
|
810
|
+
Nothing is saved before then, and closing the tab once you have written a
|
|
811
|
+
comment warns you first. If the file cannot be written, the browser says why
|
|
812
|
+
and keeps the review; fix the problem and press Finish Review again.
|
|
813
|
+
|
|
814
|
+
The listener binds to 127.0.0.1, refuses any request that names another host
|
|
815
|
+
or origin so a web page cannot reach it, and refuses any API request without
|
|
816
|
+
the key, so another account on the same host cannot either.
|
|
807
817
|
`.trim();
|
|
808
818
|
function printVersion() {
|
|
809
819
|
try {
|
|
@@ -824,13 +834,16 @@ async function main() {
|
|
|
824
834
|
printVersion();
|
|
825
835
|
return;
|
|
826
836
|
}
|
|
827
|
-
const { session,
|
|
828
|
-
const
|
|
829
|
-
|
|
837
|
+
const { session, output } = await resolveSession(args);
|
|
838
|
+
const capability = generateCapability();
|
|
839
|
+
const server = createReviewServer({ session, output, capability });
|
|
840
|
+
completeReviewOnSubmit({ server });
|
|
830
841
|
const { url } = await listenLoopback(server);
|
|
831
|
-
console.error(`[serve] Review ready at ${url}`);
|
|
832
|
-
console.error(`[serve] Completing the review writes ${
|
|
833
|
-
console.error(
|
|
842
|
+
console.error(`[serve] Review ready at ${formatLaunchUrl(url, capability)}`);
|
|
843
|
+
console.error(`[serve] Completing the review writes ${output.path} and stops this process.`);
|
|
844
|
+
console.error(
|
|
845
|
+
"[serve] The listener is loopback-only. The part of the URL after # is this session's key: open the URL exactly as printed, and do not share it."
|
|
846
|
+
);
|
|
834
847
|
}
|
|
835
848
|
main().catch((error) => {
|
|
836
849
|
console.error(`[serve] ${error instanceof Error ? error.message : String(error)}`);
|