@pi-chamber/web 1.0.3-rc.1 → 1.0.4-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/DiagramView-DfZMQkXY.js +1 -0
- package/dist/assets/{DiffView-CXg8TAtI.js → DiffView-BjWUdbL5.js} +6 -6
- package/dist/assets/FileSaveConflictDialog-u5L4k_5k.js +3 -0
- package/dist/assets/FilesView-qP1ypN9J.js +6 -0
- package/dist/assets/GitHubDetailScaffold-zCKCy5OJ.js +11 -0
- package/dist/assets/GitHubLinkPicker-CwxKY3lN.js +1 -0
- package/dist/assets/GitHubListPrimitives-Ck3zllel.js +1 -0
- package/dist/assets/GitView-y2k2i4gR.js +9 -0
- package/dist/assets/IssuesSurface-HWgR87N3.js +7 -0
- package/dist/assets/JsonTreeView-DSuC4naV.js +1 -0
- package/dist/assets/{MarkdownRendererImpl-CeYMkg1A.js → MarkdownRendererImpl-CT5ln9em.js} +5 -5
- package/dist/assets/PatchDiff-DArTeWeK.js +1 -0
- package/dist/assets/PierreDiffViewer-DQKujzLb.js +134 -0
- package/dist/assets/PullRequestsSurface-Cfb1wSvC.js +2 -0
- package/dist/assets/SessionSwitcherContent-DEGJyZBl.js +1 -0
- package/dist/assets/SessionSwitcherDropdown-cC9wVBH7.js +2 -0
- package/dist/assets/SessionUnreadDot-CELKNVIM.js +1 -0
- package/dist/assets/SettingsView-CZvRRgJe.js +6 -0
- package/dist/assets/SettingsWindow-CZM1dmVb.js +1 -0
- package/dist/assets/ToolOutputDialog-DClOSbJc.js +8 -0
- package/dist/assets/ToolPartDiffPreview-BaFiGUDE.js +1 -0
- package/dist/assets/{VirtualizedFileDiff-CV_Cpmqu.js → VirtualizedFileDiff-D6KbvKc6.js} +3 -3
- package/dist/assets/Virtualizer-wpC51ZBQ.js +1 -0
- package/dist/assets/collapsible-DhV9d4dT.js +1 -0
- package/dist/assets/computeVirtualFileMetrics-CeMpF2xC.js +3 -0
- package/dist/assets/{contextFileOpenGuard-BA2pkQY_.js → contextFileOpenGuard-Ck5u_kAP.js} +1 -1
- package/dist/assets/gitStatusPredicates-DEBSqUNE.js +1 -0
- package/dist/assets/githubLink-DT7i2NlH.js +10 -0
- package/dist/assets/index-6IO1AcJI.js +10 -0
- package/dist/assets/index-BAmzAlNx.css +1 -0
- package/dist/assets/index-eDf4LKLY.js +1 -0
- package/dist/assets/main-BczEScAA.js +2 -0
- package/dist/assets/main-CHLNMYeJ.js +136 -0
- package/dist/assets/markdownCore-C4Gk5Zht.js +2 -0
- package/dist/assets/miniChat-Do3hE87Z.js +2 -0
- package/dist/assets/mobile-CTnihwfa.js +2 -0
- package/dist/assets/permissionStore-B9Hkrqny.js +1 -0
- package/dist/assets/pi-session-focus-preference-LDVCJ_YR.js +10 -0
- package/dist/assets/renderDiffWithHighlighter-CDsgOnkH.js +1 -0
- package/dist/assets/renderElectronMiniChatApp-DSa3gYqR.js +2 -0
- package/dist/assets/renderFileWithHighlighter-TpKRyfCY.js +1 -0
- package/dist/assets/renderMobileApp-CPE-3uMl.js +11 -0
- package/dist/assets/runtimeEndpointReset-CzJfovWI.js +62 -0
- package/dist/assets/{runtimeSurface-BdndJV2m.js → runtimeSurface-DW_Ia4q3.js} +1 -1
- package/dist/assets/shell-CjFT_Tl9.js +1 -0
- package/dist/assets/sprite-HGQGInUp.js +6510 -0
- package/dist/assets/useAppFontEffects-CG3_yteE.js +212 -0
- package/dist/assets/{useFilesViewSearch-CI5Gy1cp.js → useFilesViewSearch-C_LzYIgD.js} +1 -1
- package/dist/assets/useGitHubRemoteSearch-DsxWOzKZ.js +1 -0
- package/dist/assets/useSwitcherItems-BmoCnS9W.js +1 -0
- package/dist/assets/vendor-base-ui-DIkTOIJS.js +1 -0
- package/dist/assets/{vendor-beautiful-mermaid-D3YCkKz7.js → vendor-beautiful-mermaid-DApbjBp2.js} +1 -1
- package/dist/assets/vendor-boot-DyL2td56.js +69 -0
- package/dist/assets/vendor-codemirror-autocomplete-DsFn4GLp.js +1 -0
- package/dist/assets/vendor-codemirror-lang-angular-B_NMmBbS.js +1 -0
- package/dist/assets/vendor-codemirror-lang-cpp-GOE7Gjd0.js +1 -0
- package/dist/assets/vendor-codemirror-lang-css-Dwf2XpnZ.js +1 -0
- package/dist/assets/vendor-codemirror-lang-go-C2KHbcll.js +7 -0
- package/dist/assets/vendor-codemirror-lang-html-DcKqyeGk.js +1 -0
- package/dist/assets/vendor-codemirror-lang-java-6eGbyB2k.js +1 -0
- package/dist/assets/vendor-codemirror-lang-javascript-DpTUrvx8.js +13 -0
- package/dist/assets/vendor-codemirror-lang-jinja-xSUJjXhr.js +1 -0
- package/dist/assets/vendor-codemirror-lang-json-CLGxdOCz.js +1 -0
- package/dist/assets/vendor-codemirror-lang-less-6nXi1rS9.js +1 -0
- package/dist/assets/vendor-codemirror-lang-liquid-B9hmb9P8.js +1 -0
- package/dist/assets/vendor-codemirror-lang-markdown-DmFP9s6x.js +1 -0
- package/dist/assets/vendor-codemirror-lang-php-DC6To8iX.js +1 -0
- package/dist/assets/vendor-codemirror-lang-python-yuxIkjit.js +3 -0
- package/dist/assets/vendor-codemirror-lang-rust-di1Sjz-0.js +1 -0
- package/dist/assets/vendor-codemirror-lang-sass-BWpV9NPV.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-sql-HpQWHJjv.js → vendor-codemirror-lang-sql-C_RazIaB.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-vue-BYL0r7KR.js +1 -0
- package/dist/assets/vendor-codemirror-lang-wast-BiVarhcz.js +1 -0
- package/dist/assets/vendor-codemirror-lang-xml-Cn1lY1ts.js +1 -0
- package/dist/assets/vendor-codemirror-lang-yaml-BZ6mZw9L.js +1 -0
- package/dist/assets/vendor-codemirror-language-data-DglcKYWT.js +2 -0
- package/dist/assets/vendor-codemirror-search-DaE6R5gH.js +2 -0
- package/dist/assets/{vendor-elkjs-mzfkf0ML.js → vendor-elkjs-D27273Ms.js} +1 -1
- package/dist/assets/{vendor-heic2any-BHsbokcA.js → vendor-heic2any-pq-UTQQR.js} +1 -1
- package/dist/assets/vendor-lezer-cpp-Dt99h3WT.js +1 -0
- package/dist/assets/vendor-lezer-css-DNU_fzPI.js +1 -0
- package/dist/assets/vendor-lezer-go-BEFtcNyS.js +1 -0
- package/dist/assets/vendor-lezer-html-DDGRhRUz.js +1 -0
- package/dist/assets/vendor-lezer-java-DmfZtW09.js +1 -0
- package/dist/assets/vendor-lezer-javascript-oje4tdp_.js +1 -0
- package/dist/assets/vendor-lezer-json-BRXb_bDX.js +1 -0
- package/dist/assets/vendor-lezer-lr-BU2qmu_5.js +1 -0
- package/dist/assets/{vendor-lezer-markdown-C6g-d6P3.js → vendor-lezer-markdown-CicYv7V9.js} +4 -4
- package/dist/assets/vendor-lezer-php-COORrTpE.js +1 -0
- package/dist/assets/vendor-lezer-python-Cuvm9X9Y.js +1 -0
- package/dist/assets/vendor-lezer-rust-C_zOfHbX.js +1 -0
- package/dist/assets/vendor-lezer-sass-DWP4w7O1.js +1 -0
- package/dist/assets/vendor-lezer-xml-Br6nOYeG.js +1 -0
- package/dist/assets/vendor-lezer-yaml-CYQmm6Sb.js +1 -0
- package/dist/assets/{vendor-lru_map-Cy8fTs3_.js → vendor-lru_map-DOPmc7GU.js} +1 -1
- package/dist/assets/{vendor-qrcode-B0KNSajT.js → vendor-qrcode-Dv4uniC1.js} +1 -1
- package/dist/assets/vendor-react-DASdDPIk.js +1 -0
- package/dist/assets/{vendor-react-drawio-BYDptOsj.js → vendor-react-drawio-Duu5LgQA.js} +1 -1
- package/dist/assets/{vendor-replit-codemirror-vim-DaSwPsXt.js → vendor-replit-codemirror-vim-CZy3BUVv.js} +15 -15
- package/dist/assets/vendor-zustand-CUi8eEds.js +6 -0
- package/dist/assets/{web-components-Cdnmh4Xb.js → web-components-CH3-XV-n.js} +4 -4
- package/dist/index.html +7 -9
- package/dist/mini-chat.html +6 -8
- package/dist/mobile.html +6 -8
- package/package.json +1 -1
- package/server/index.js +3 -1
- package/server/lib/fs/DOCUMENTATION.md +1 -1
- package/server/lib/fs/routes.js +1 -50
- package/server/lib/git/DOCUMENTATION.md +18 -11
- package/server/lib/git/index.js +8 -3
- package/server/lib/git/routes.js +0 -129
- package/server/lib/git/service.js +40 -152
- package/server/lib/git/service.test.js +42 -18
- package/server/lib/github/DOCUMENTATION.md +271 -0
- package/server/lib/github/cache.js +164 -0
- package/server/lib/github/checks.js +230 -0
- package/server/lib/github/client.js +305 -0
- package/server/lib/github/context.js +177 -0
- package/server/lib/github/contracts.test.js +235 -0
- package/server/lib/github/correctness.test.js +356 -0
- package/server/lib/github/credential.js +46 -0
- package/server/lib/github/errors.js +151 -0
- package/server/lib/github/gh-cli.js +336 -0
- package/server/lib/github/index.js +27 -0
- package/server/lib/github/issues.js +495 -0
- package/server/lib/github/pulls.js +699 -0
- package/server/lib/github/repo-scope.js +688 -0
- package/server/lib/github/routes.js +599 -0
- package/server/lib/github/security.test.js +275 -0
- package/server/lib/github/templates.js +153 -0
- package/server/lib/package-manager-detect-child.js +12 -0
- package/server/lib/package-manager.js +366 -92
- package/server/lib/package-manager.test.js +109 -0
- package/server/lib/pi/routes-extension-events.test.js +268 -4
- package/server/lib/pi/routes.js +109 -25
- package/server/lib/pi/routes.test.js +118 -0
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +5 -3
- package/server/lib/pi/session-daemon/extension-bridge-draft.test.js +222 -0
- package/server/lib/pi/session-daemon/extension-bridge.js +415 -42
- package/server/lib/pi/session-daemon/extension-name.js +87 -0
- package/server/lib/pi/session-daemon/extension-name.test.js +143 -0
- package/server/lib/pi/session-daemon/extension-theme.js +142 -0
- package/server/lib/pi/session-daemon/extension-theme.test.js +117 -0
- package/server/lib/pi/session-daemon/extension-tool-render.js +365 -0
- package/server/lib/pi/session-daemon/extension-tool-render.test.js +607 -0
- package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +322 -2
- package/server/lib/pi/session-daemon/session-daemon-list-live.test.js +244 -0
- package/server/lib/pi/session-daemon/session-daemon.js +204 -33
- package/server/lib/pi/session-daemon/session-daemon.test.js +218 -0
- package/server/lib/pi/ui-settings-store.js +1 -1
- package/server/lib/static-cache-control.js +18 -0
- package/server/lib/static-cache-control.test.js +25 -0
- package/server/lib/workspace/host.js +2 -0
- package/dist/assets/DiagramView-CXjieF51.js +0 -1
- package/dist/assets/FileSaveConflictDialog-a-HOCgyP.js +0 -3
- package/dist/assets/FilesView-Dcd9ltOX.js +0 -6
- package/dist/assets/GitView-DF2nsuSA.js +0 -8
- package/dist/assets/JsonTreeView-BRU2mRTd.js +0 -1
- package/dist/assets/PatchDiff-kSTpjhu6.js +0 -1
- package/dist/assets/SessionSwitcherContent-BsXDFt24.js +0 -1
- package/dist/assets/SessionSwitcherDropdown-D8fSObHr.js +0 -2
- package/dist/assets/SessionUnreadDot-BpsHyrri.js +0 -1
- package/dist/assets/SettingsView-OEl7QmXC.js +0 -6
- package/dist/assets/SettingsWindow-BMBCj_L_.js +0 -1
- package/dist/assets/ToolOutputDialog-KOVdmTqm.js +0 -8
- package/dist/assets/ToolPartDiffPreview-B9xuVvkm.js +0 -1
- package/dist/assets/Virtualizer-BSHVMKgK.js +0 -1
- package/dist/assets/collapsible-BH1vXEAI.js +0 -1
- package/dist/assets/computeVirtualFileMetrics-yHZbtf5H.js +0 -3
- package/dist/assets/gitStatusPredicates-CpGQLvMK.js +0 -134
- package/dist/assets/index-5fyXnZFi.css +0 -1
- package/dist/assets/index-C-sV_9sb.js +0 -8
- package/dist/assets/index-D_FGGnQQ.js +0 -1
- package/dist/assets/isDiffPlainText-BNyusJZz.js +0 -1
- package/dist/assets/isFilePlainText-CMAUe7qD.js +0 -1
- package/dist/assets/main-BMLgZ5yn.js +0 -2
- package/dist/assets/main-DNq1n9F_.js +0 -135
- package/dist/assets/markdownCore-CZWcaNr2.js +0 -3
- package/dist/assets/miniChat-B2AgUZqL.js +0 -2
- package/dist/assets/mobile-BsGiRUUg.js +0 -2
- package/dist/assets/permissionStore-iKN1K2_x.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-UV9dnnbf.js +0 -2
- package/dist/assets/renderMobileApp-BMifduGA.js +0 -11
- package/dist/assets/runtimeEndpointReset-CkvC02dQ.js +0 -53
- package/dist/assets/useAppFontEffects-CclUs9KY.js +0 -6722
- package/dist/assets/usePushVisibilityBeacon-aDmGZrTW.js +0 -10
- package/dist/assets/useSwitcherItems-BZKyNjhp.js +0 -1
- package/dist/assets/vendor-aria-hidden-DvXkyWUv.js +0 -1
- package/dist/assets/vendor-base-ui-DXSHfszQ.js +0 -1
- package/dist/assets/vendor-class-variance-authority-5VPnzWs2.js +0 -1
- package/dist/assets/vendor-cmdk-zXx6sGnS.js +0 -1
- package/dist/assets/vendor-codemirror-autocomplete-wd6iRebq.js +0 -1
- package/dist/assets/vendor-codemirror-commands-CNlncqrr.js +0 -1
- package/dist/assets/vendor-codemirror-lang-angular-DU_4KiiW.js +0 -1
- package/dist/assets/vendor-codemirror-lang-cpp-CmIT9Z5_.js +0 -1
- package/dist/assets/vendor-codemirror-lang-css-djiuoTi8.js +0 -1
- package/dist/assets/vendor-codemirror-lang-go-COZSwZYW.js +0 -7
- package/dist/assets/vendor-codemirror-lang-html-CKHqhW5R.js +0 -1
- package/dist/assets/vendor-codemirror-lang-java-CNMP5hyC.js +0 -1
- package/dist/assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js +0 -13
- package/dist/assets/vendor-codemirror-lang-jinja-DaKn_b1k.js +0 -1
- package/dist/assets/vendor-codemirror-lang-json-CZ07HmNC.js +0 -1
- package/dist/assets/vendor-codemirror-lang-less-wJdQiDBf.js +0 -1
- package/dist/assets/vendor-codemirror-lang-liquid-0z48Roi8.js +0 -1
- package/dist/assets/vendor-codemirror-lang-markdown-DtcZDGqe.js +0 -1
- package/dist/assets/vendor-codemirror-lang-php-W8plS-JQ.js +0 -1
- package/dist/assets/vendor-codemirror-lang-python-DzzokVau.js +0 -3
- package/dist/assets/vendor-codemirror-lang-rust-C4ulBVpf.js +0 -1
- package/dist/assets/vendor-codemirror-lang-sass-BkZJYEwS.js +0 -1
- package/dist/assets/vendor-codemirror-lang-vue-DiBPljCc.js +0 -1
- package/dist/assets/vendor-codemirror-lang-wast-DoABsogh.js +0 -1
- package/dist/assets/vendor-codemirror-lang-xml-BhLJhOCH.js +0 -1
- package/dist/assets/vendor-codemirror-lang-yaml-D95i1Y5R.js +0 -1
- package/dist/assets/vendor-codemirror-language-BByA_dGF.js +0 -3
- package/dist/assets/vendor-codemirror-language-data-C6LBD7qA.js +0 -2
- package/dist/assets/vendor-codemirror-search-BV44140v.js +0 -2
- package/dist/assets/vendor-codemirror-state-CNWM3Q8V.js +0 -5
- package/dist/assets/vendor-codemirror-view-Ct4T37Ue.js +0 -4
- package/dist/assets/vendor-crelt-C8TCjufn.js +0 -1
- package/dist/assets/vendor-detect-node-es-l0sNRNKZ.js +0 -1
- package/dist/assets/vendor-dnd-kit-accessibility-DZKKhs9S.js +0 -1
- package/dist/assets/vendor-dnd-kit-core-C9qcAm_1.js +0 -5
- package/dist/assets/vendor-dnd-kit-sortable-D8ozj8M-.js +0 -1
- package/dist/assets/vendor-dnd-kit-utilities-DTY1C6ST.js +0 -1
- package/dist/assets/vendor-floating-ui-core-CXmKXOXc.js +0 -1
- package/dist/assets/vendor-floating-ui-dom-WyXykhNi.js +0 -1
- package/dist/assets/vendor-floating-ui-react-dom-BZOGXAGe.js +0 -1
- package/dist/assets/vendor-floating-ui-utils-BzXdqYpP.js +0 -1
- package/dist/assets/vendor-framer-motion-CfplGuM0.js +0 -1
- package/dist/assets/vendor-get-nonce-C-Z93AgS.js +0 -1
- package/dist/assets/vendor-lezer-common-B3-cUCR_.js +0 -1
- package/dist/assets/vendor-lezer-cpp-BleAU9o-.js +0 -1
- package/dist/assets/vendor-lezer-css-C5xB6jxd.js +0 -1
- package/dist/assets/vendor-lezer-go-CXK1UKk8.js +0 -1
- package/dist/assets/vendor-lezer-highlight-CDMHUZ74.js +0 -1
- package/dist/assets/vendor-lezer-html-C0I1p52t.js +0 -1
- package/dist/assets/vendor-lezer-java-D_zzj-NV.js +0 -1
- package/dist/assets/vendor-lezer-javascript-D7Tj24ot.js +0 -1
- package/dist/assets/vendor-lezer-json-Iaex0UN-.js +0 -1
- package/dist/assets/vendor-lezer-lr-bhwg1HMg.js +0 -1
- package/dist/assets/vendor-lezer-php-_DHrbsZG.js +0 -1
- package/dist/assets/vendor-lezer-python-CvuFxeZl.js +0 -1
- package/dist/assets/vendor-lezer-rust-Lqgd5SAo.js +0 -1
- package/dist/assets/vendor-lezer-sass-Dnm2lY4t.js +0 -1
- package/dist/assets/vendor-lezer-xml-hUDuAyS5.js +0 -1
- package/dist/assets/vendor-lezer-yaml-BNIl6S_O.js +0 -1
- package/dist/assets/vendor-marijn-find-cluster-break-DXwl3gUT.js +0 -1
- package/dist/assets/vendor-motion-dom-DhJ-sYS5.js +0 -1
- package/dist/assets/vendor-motion-l0sNRNKZ.js +0 -1
- package/dist/assets/vendor-motion-utils-CKEGc_YG.js +0 -1
- package/dist/assets/vendor-radix-ui-primitive-Dc_FVRD7.js +0 -1
- package/dist/assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js +0 -1
- package/dist/assets/vendor-radix-ui-react-context-CFsX-AUC.js +0 -1
- package/dist/assets/vendor-radix-ui-react-dialog-D2yhEu2p.js +0 -5
- package/dist/assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js +0 -1
- package/dist/assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js +0 -1
- package/dist/assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js +0 -1
- package/dist/assets/vendor-radix-ui-react-id-D2kS9K1j.js +0 -1
- package/dist/assets/vendor-radix-ui-react-portal-YgCRIyi7.js +0 -1
- package/dist/assets/vendor-radix-ui-react-presence-D432pCMB.js +0 -1
- package/dist/assets/vendor-radix-ui-react-primitive-DkH8dMOR.js +0 -1
- package/dist/assets/vendor-radix-ui-react-slot-BIDFZX0-.js +0 -1
- package/dist/assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js +0 -1
- package/dist/assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js +0 -1
- package/dist/assets/vendor-radix-ui-react-use-effect-event-D94va83M.js +0 -1
- package/dist/assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js +0 -1
- package/dist/assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js +0 -1
- package/dist/assets/vendor-react-B5Z1Mdn3.js +0 -9
- package/dist/assets/vendor-react-remove-scroll-bar-CSAHp1YF.js +0 -38
- package/dist/assets/vendor-react-remove-scroll-vR1dy1aP.js +0 -4
- package/dist/assets/vendor-react-style-singleton-Ctw6HnYx.js +0 -1
- package/dist/assets/vendor-reselect-l0sNRNKZ.js +0 -1
- package/dist/assets/vendor-scheduler-7OC5HNn7.js +0 -1
- package/dist/assets/vendor-simplewebauthn-browser-VDA66rT_.js +0 -2
- package/dist/assets/vendor-sonner-BDtm25td.js +0 -1
- package/dist/assets/vendor-style-mod-NZ5MEPvj.js +0 -3
- package/dist/assets/vendor-tanstack-react-virtual-2skouoFw.js +0 -1
- package/dist/assets/vendor-tanstack-virtual-core-Dubg10g5.js +0 -1
- package/dist/assets/vendor-tslib-De9GV7Vy.js +0 -1
- package/dist/assets/vendor-use-callback-ref-CVVuCyLj.js +0 -1
- package/dist/assets/vendor-use-sidecar-Vv4V8Nd1.js +0 -1
- package/dist/assets/vendor-use-sync-external-store-D0AXkdQC.js +0 -1
- package/dist/assets/vendor-w3c-keyname-Vcq4gwWv.js +0 -1
- package/dist/assets/vendor-zustand-GVb4H8HE.js +0 -6
- package/server/lib/git/credentials.js +0 -41
- package/server/lib/git/identity-storage.js +0 -122
- /package/dist/assets/{vendor-katex-CNckGUMB.js → vendor-katex-DZG0Ov6p.js} +0 -0
- /package/dist/assets/{vendor-katex-Cp579UoJ.css → vendor-katex-css-Cp579UoJ.css} +0 -0
- /package/dist/assets/{vendor-xterm-xterm-CrXqRur4.js → vendor-xterm-xterm-B-qIQCd3.js} +0 -0
- /package/dist/assets/{vendor-xterm-xterm-DDGTF8rc.css → vendor-xterm-xterm-css-DDGTF8rc.css} +0 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { containsSecret, redactSecrets } from './errors.js';
|
|
4
|
+
import { createGitHubClient } from './client.js';
|
|
5
|
+
import { buildIssueContext, UNTRUSTED_POSTAMBLE } from './context.js';
|
|
6
|
+
import { createCredentialStore, fingerprintToken } from './credential.js';
|
|
7
|
+
import { createGhCli } from './gh-cli.js';
|
|
8
|
+
import { createRepoScopeResolver, parseRemoteUrl, redactRemoteUrl } from './repo-scope.js';
|
|
9
|
+
import { registerGitHubRoutes } from './routes.js';
|
|
10
|
+
|
|
11
|
+
const SECRET = 'gho_security_test_secret_0123456789';
|
|
12
|
+
const HOST = 'github.com';
|
|
13
|
+
const credentialFor = (token = SECRET) => ({ host: HOST, token, fingerprint: fingerprintToken(HOST, token) });
|
|
14
|
+
|
|
15
|
+
const jsonResponse = ({ status = 200, body = {}, headers = {} } = {}) => ({
|
|
16
|
+
status,
|
|
17
|
+
headers: new Headers({ 'content-type': 'application/json', ...headers }),
|
|
18
|
+
text: async () => JSON.stringify(body),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('secret redaction', () => {
|
|
22
|
+
it('redacts every occurrence and detects leaks, ignoring short values', () => {
|
|
23
|
+
const text = `token=${SECRET} then ${SECRET} again`;
|
|
24
|
+
const redacted = redactSecrets(text, [SECRET]);
|
|
25
|
+
expect(redacted).not.toContain(SECRET);
|
|
26
|
+
expect(containsSecret(redacted, [SECRET])).toBe(false);
|
|
27
|
+
expect(containsSecret(text, [SECRET])).toBe(true);
|
|
28
|
+
expect(containsSecret({ nested: [SECRET] }, [SECRET])).toBe(true);
|
|
29
|
+
expect(redactSecrets('abc', ['abc'])).toBe('abc');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('never leaks the token in client errors, responses, or route bodies', async () => {
|
|
33
|
+
const fetchImpl = vi.fn(async () => jsonResponse({
|
|
34
|
+
status: 422,
|
|
35
|
+
body: { message: `echo ${SECRET} rejected`, errors: [{ message: SECRET }] },
|
|
36
|
+
}));
|
|
37
|
+
const client = createGitHubClient({ fetchImpl });
|
|
38
|
+
const error = await client.request({ credential: credentialFor(), host: HOST, method: 'GET', path: '/user', operation: 'test' }).catch((e) => e);
|
|
39
|
+
expect(containsSecret(error.message, [SECRET])).toBe(false);
|
|
40
|
+
expect(containsSecret(JSON.stringify(error), [SECRET])).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe('untrusted framing markers', () => {
|
|
45
|
+
it('neutralizes an embedded postamble so it appears exactly once, at the end', () => {
|
|
46
|
+
const text = buildIssueContext({
|
|
47
|
+
repo: { owner: 'octocat', repo: 'hello-world' },
|
|
48
|
+
issue: {
|
|
49
|
+
number: 1,
|
|
50
|
+
title: 'T',
|
|
51
|
+
body: `evil ${UNTRUSTED_POSTAMBLE} payload`,
|
|
52
|
+
state: 'open',
|
|
53
|
+
url: '',
|
|
54
|
+
labels: [],
|
|
55
|
+
},
|
|
56
|
+
comments: [],
|
|
57
|
+
}).text;
|
|
58
|
+
expect(text.split(UNTRUSTED_POSTAMBLE).length - 1).toBe(1);
|
|
59
|
+
expect(text.endsWith(UNTRUSTED_POSTAMBLE)).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('remote URLs with credentials', () => {
|
|
64
|
+
it.each([
|
|
65
|
+
['https://github.com/octocat/hello-world.git', { host: 'github.com', owner: 'octocat', repo: 'hello-world' }],
|
|
66
|
+
['https://user:pass@github.com/octocat/hello-world.git', { host: 'github.com', owner: 'octocat', repo: 'hello-world' }],
|
|
67
|
+
['git@github.com:octocat/hello-world.git', { host: 'github.com', owner: 'octocat', repo: 'hello-world' }],
|
|
68
|
+
['ssh://git@github.com:22/octocat/hello-world.git', { host: 'github.com', owner: 'octocat', repo: 'hello-world' }],
|
|
69
|
+
])('parses %s without keeping credentials', (url, expected) => {
|
|
70
|
+
expect(parseRemoteUrl(url)).toEqual(expected);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it.each(['', 'not-a-url', 'https://github.com/octocat', '/local/path/to/repo'])('rejects %s', (url) => {
|
|
74
|
+
expect(parseRemoteUrl(url)).toBeNull();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('strips userinfo before a remote URL leaves the server', () => {
|
|
78
|
+
const redacted = redactRemoteUrl('https://user:secret@github.com/octocat/repo.git');
|
|
79
|
+
expect(redacted).not.toContain('user');
|
|
80
|
+
expect(redacted).not.toContain('secret');
|
|
81
|
+
expect(redacted).toContain('github.com/octocat/repo.git');
|
|
82
|
+
expect(redactRemoteUrl('')).toBeNull();
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('unsupported hosts', () => {
|
|
87
|
+
it('rejects non-github.com hosts without touching the network', async () => {
|
|
88
|
+
const fetchImpl = vi.fn(async () => jsonResponse({}));
|
|
89
|
+
const client = createGitHubClient({ fetchImpl });
|
|
90
|
+
await expect(client.request({ credential: credentialFor(), host: 'ghe.example.com', method: 'GET', path: '/user', operation: 'test' }))
|
|
91
|
+
.rejects.toMatchObject({ kind: 'unavailable', reason: 'not-github' });
|
|
92
|
+
expect(fetchImpl).not.toHaveBeenCalled();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const SCOPE = {
|
|
97
|
+
directory: '/repo',
|
|
98
|
+
topLevel: '/repo',
|
|
99
|
+
branch: 'feature-x',
|
|
100
|
+
repositories: [
|
|
101
|
+
{
|
|
102
|
+
kind: 'containing', path: '/repo', relativePath: '.', host: 'github.com',
|
|
103
|
+
owner: 'octocat', repo: 'hello-world', remote: 'origin', submodule: false, fork: false,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
truncated: false,
|
|
107
|
+
defaultSelection: 'github.com/octocat/hello-world',
|
|
108
|
+
fetchedAt: 0,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const createHarness = ({ pulls = {}, scope = SCOPE } = {}) => {
|
|
112
|
+
const routes = new Map();
|
|
113
|
+
const app = {
|
|
114
|
+
get: (path, handler) => { routes.set(`GET ${path}`, handler); },
|
|
115
|
+
post: (path, handler) => { routes.set(`POST ${path}`, handler); },
|
|
116
|
+
patch: (path, handler) => { routes.set(`PATCH ${path}`, handler); },
|
|
117
|
+
delete: (path, handler) => { routes.set(`DELETE ${path}`, handler); },
|
|
118
|
+
};
|
|
119
|
+
const realScope = createRepoScopeResolver();
|
|
120
|
+
registerGitHubRoutes(app, {
|
|
121
|
+
scopeResolver: { ...realScope, resolveScope: async () => structuredClone(scope), invalidate: () => {} },
|
|
122
|
+
credential: {
|
|
123
|
+
withPinnedCredential: async (host, task) => task({ host, token: SECRET, fingerprint: 'fp-test' }),
|
|
124
|
+
getViewer: async () => 'octocat',
|
|
125
|
+
invalidateViewer: () => {},
|
|
126
|
+
},
|
|
127
|
+
pulls: {
|
|
128
|
+
listPulls: async () => ({ items: [] }),
|
|
129
|
+
getPull: async () => ({ pr: null }),
|
|
130
|
+
listPullComments: async () => ({ comments: [], nextCursor: null }),
|
|
131
|
+
listFiles: async () => ({ files: [] }),
|
|
132
|
+
getPullHeadSha: async () => 'abc123',
|
|
133
|
+
invalidate: () => {},
|
|
134
|
+
...pulls,
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
const call = async (method, path, { query = {}, params = {}, body = {} } = {}) => {
|
|
138
|
+
const handler = routes.get(`${method} ${path}`);
|
|
139
|
+
if (!handler) throw new Error(`no route ${method} ${path}`);
|
|
140
|
+
let statusCode = 200;
|
|
141
|
+
let payload = null;
|
|
142
|
+
const res = {
|
|
143
|
+
status(code) { statusCode = code; return this; },
|
|
144
|
+
json(value) { payload = value; return this; },
|
|
145
|
+
};
|
|
146
|
+
await handler({ query, params, body }, res);
|
|
147
|
+
return { statusCode, payload };
|
|
148
|
+
};
|
|
149
|
+
return { call };
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
describe('repo allow-list', () => {
|
|
153
|
+
it('serves allow-listed repos case-insensitively and rejects anything else', async () => {
|
|
154
|
+
const listPulls = vi.fn(async () => ({ items: [] }));
|
|
155
|
+
const { call } = createHarness({ pulls: { listPulls } });
|
|
156
|
+
const ok = await call('GET', '/api/github/pulls', {
|
|
157
|
+
query: { directory: '/repo', repo: 'github.com/Octocat/Hello-World' },
|
|
158
|
+
});
|
|
159
|
+
expect(ok.statusCode).toBe(200);
|
|
160
|
+
expect(listPulls).toHaveBeenCalledTimes(1);
|
|
161
|
+
const denied = await call('GET', '/api/github/pulls', {
|
|
162
|
+
query: { directory: '/repo', repo: 'github.com/evil/victim' },
|
|
163
|
+
});
|
|
164
|
+
expect(denied.statusCode).toBe(403);
|
|
165
|
+
expect(denied.payload).toEqual({ error: { kind: 'unavailable', reason: 'no-access' } });
|
|
166
|
+
// The service is never reached for an out-of-scope repo.
|
|
167
|
+
expect(listPulls).toHaveBeenCalledTimes(1);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it('requires directory and well-formed repo params', async () => {
|
|
171
|
+
const { call } = createHarness();
|
|
172
|
+
expect((await call('GET', '/api/github/pulls', { query: { repo: 'github.com/octocat/hello-world' } })).statusCode).toBe(400);
|
|
173
|
+
expect((await call('GET', '/api/github/pulls', { query: { directory: '/repo' } })).statusCode).toBe(400);
|
|
174
|
+
expect((await call('GET', '/api/github/pulls', { query: { directory: '/repo', repo: 'nope' } })).statusCode).toBe(400);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('matches scope entries and rejects unknown refs without git', async () => {
|
|
178
|
+
const resolver = createRepoScopeResolver();
|
|
179
|
+
const scope = {
|
|
180
|
+
directory: '/repo',
|
|
181
|
+
repositories: [{ kind: 'containing', host: 'github.com', owner: 'octocat', repo: 'hello-world' }],
|
|
182
|
+
};
|
|
183
|
+
expect(resolver.matchAllowedRepo(scope, 'github.com/Octocat/Hello-World')).toBeTruthy();
|
|
184
|
+
expect(resolver.matchAllowedRepo(scope, 'github.com/octocat/other')).toBeNull();
|
|
185
|
+
expect(resolver.matchAllowedRepo(scope, 'not a ref')).toBeNull();
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it('maps taxonomy errors to HTTP statuses without secrets', async () => {
|
|
189
|
+
for (const [reason, status] of [['gh-unauthenticated', 503], ['no-access', 404]]) {
|
|
190
|
+
const { call } = createHarness({ pulls: { listPulls: async () => { throw (await import('./errors.js')).unavailable(reason); } } });
|
|
191
|
+
const { statusCode, payload } = await call('GET', '/api/github/pulls', {
|
|
192
|
+
query: { directory: '/repo', repo: 'github.com/octocat/hello-world' },
|
|
193
|
+
});
|
|
194
|
+
expect(statusCode).toBe(status);
|
|
195
|
+
expect(payload).toEqual({ error: { kind: 'unavailable', reason } });
|
|
196
|
+
expect(containsSecret(JSON.stringify(payload), [SECRET])).toBe(false);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
describe('gh CLI is the only credential source', () => {
|
|
202
|
+
const createFakeExec = ({ token = SECRET } = {}) => {
|
|
203
|
+
const calls = [];
|
|
204
|
+
const execFileAsync = vi.fn(async (binary, args) => {
|
|
205
|
+
calls.push({ binary, args });
|
|
206
|
+
if (args[0] === '--version') return { stdout: 'gh version 2.46.0 (2025-12-13)\n', stderr: '' };
|
|
207
|
+
if (args[0] === 'auth' && args[1] === 'status') {
|
|
208
|
+
if (args.includes('--json')) {
|
|
209
|
+
const error = new Error('unknown flag: --json');
|
|
210
|
+
error.stderr = 'unknown flag: --json';
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
return { stdout: 'github.com\n ✓ Logged in to github.com account octocat\n', stderr: '' };
|
|
214
|
+
}
|
|
215
|
+
if (args[0] === 'auth' && args[1] === 'token') return { stdout: `${token}\n`, stderr: '' };
|
|
216
|
+
throw new Error(`unexpected gh invocation: ${args.join(' ')}`);
|
|
217
|
+
});
|
|
218
|
+
return { execFileAsync, calls };
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
it('only ever runs version/status/token reads via arg arrays, never auth mutations or git config writes', async () => {
|
|
222
|
+
const fake = createFakeExec();
|
|
223
|
+
const cli = createGhCli({ execFileAsync: fake.execFileAsync, env: { GH_BINARY: '/fake/gh' }, platform: 'linux' });
|
|
224
|
+
await cli.getVersion();
|
|
225
|
+
await cli.getAuthState();
|
|
226
|
+
await cli.getToken('github.com');
|
|
227
|
+
expect(fake.calls.length).toBeGreaterThan(0);
|
|
228
|
+
for (const { binary, args } of fake.calls) {
|
|
229
|
+
expect(binary).toBe('/fake/gh');
|
|
230
|
+
expect(Array.isArray(args)).toBe(true);
|
|
231
|
+
const flat = args.join(' ');
|
|
232
|
+
expect(flat).not.toMatch(/switch|login|logout|setup-git|credential|git-?config/);
|
|
233
|
+
}
|
|
234
|
+
const verbs = fake.calls.map(({ args }) => args.slice(0, 2).join(' '));
|
|
235
|
+
expect(verbs).toContain('--version');
|
|
236
|
+
expect(verbs.some((verb) => verb === 'auth status')).toBe(true);
|
|
237
|
+
expect(verbs.some((verb) => verb === 'auth token')).toBe(true);
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
it('maps token failures to gh-unauthenticated without raw output', async () => {
|
|
241
|
+
const fake = createFakeExec();
|
|
242
|
+
fake.execFileAsync.mockImplementationOnce(async () => ({ stdout: 'gh version 2.46.0\n', stderr: '' }));
|
|
243
|
+
fake.execFileAsync.mockImplementation(async (binary, args) => {
|
|
244
|
+
if (args[0] === '--version') return { stdout: 'gh version 2.46.0\n', stderr: '' };
|
|
245
|
+
if (args[0] === 'auth' && args[1] === 'token') {
|
|
246
|
+
const error = new Error('auth failed');
|
|
247
|
+
error.stderr = `host output containing ${SECRET}`;
|
|
248
|
+
throw error;
|
|
249
|
+
}
|
|
250
|
+
return { stdout: '', stderr: '' };
|
|
251
|
+
});
|
|
252
|
+
const cli = createGhCli({ execFileAsync: fake.execFileAsync, env: { GH_BINARY: '/fake/gh' }, platform: 'linux' });
|
|
253
|
+
const failure = await cli.getToken('github.com').catch((error) => error);
|
|
254
|
+
expect(failure).toMatchObject({ kind: 'unavailable', reason: 'gh-unauthenticated' });
|
|
255
|
+
expect(containsSecret(failure.message, [SECRET])).toBe(false);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it('pins one token per operation so a mid-operation account switch cannot mix credentials', async () => {
|
|
259
|
+
let current = 'gho_account_A_secret_1111';
|
|
260
|
+
const store = createCredentialStore({ ghCli: { getToken: async () => current } });
|
|
261
|
+
const operationToken = await store.withPinnedCredential('github.com', async (cred) => {
|
|
262
|
+
current = 'gho_account_B_secret_2222';
|
|
263
|
+
return cred.token;
|
|
264
|
+
});
|
|
265
|
+
expect(operationToken).toBe('gho_account_A_secret_1111');
|
|
266
|
+
const nextToken = await store.withPinnedCredential('github.com', async (cred) => cred.token);
|
|
267
|
+
expect(nextToken).toBe('gho_account_B_secret_2222');
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it('fingerprints never contain the token', () => {
|
|
271
|
+
const fingerprint = fingerprintToken(HOST, SECRET);
|
|
272
|
+
expect(fingerprint).toMatch(/^[0-9a-f]{64}$/);
|
|
273
|
+
expect(containsSecret(fingerprint, [SECRET])).toBe(false);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/** Issue-template listing (markdown only; YAML forms skipped). See DOCUMENTATION.md. */
|
|
2
|
+
|
|
3
|
+
import { createTtlCache, readWithStaleFallback, repoCachePrefix, repoInvalidatePredicate } from './cache.js';
|
|
4
|
+
|
|
5
|
+
export const TEMPLATES_TTL_MS = 5 * 60_000;
|
|
6
|
+
const MAX_TEMPLATES = 20;
|
|
7
|
+
const READ_CONCURRENCY = 4;
|
|
8
|
+
const MAX_TEMPLATE_CHARS = 20_000;
|
|
9
|
+
const TEMPLATE_DIR = '.github/ISSUE_TEMPLATE';
|
|
10
|
+
const LEGACY_TEMPLATE_FILES = ['.github/ISSUE_TEMPLATE.md', '.github/issue_template.md'];
|
|
11
|
+
|
|
12
|
+
const isMarkdownTemplate = (name) => typeof name === 'string' && name.toLowerCase().endsWith('.md');
|
|
13
|
+
|
|
14
|
+
/** Strip a leading YAML front-matter block (`---` … `---`) so template
|
|
15
|
+
* metadata never lands in a new issue body. Returns the body unchanged when
|
|
16
|
+
* no front matter is present. */
|
|
17
|
+
export const stripTemplateFrontMatter = (text) => {
|
|
18
|
+
if (typeof text !== 'string') return '';
|
|
19
|
+
if (!text.startsWith('---')) return text;
|
|
20
|
+
const end = text.indexOf('\n---', 3);
|
|
21
|
+
if (end < 0) return text;
|
|
22
|
+
const after = text.slice(end + 4);
|
|
23
|
+
return after.replace(/^\r?\n/, '');
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Template display name: front-matter `name:` when present, else the
|
|
27
|
+
* filename without `.md` (dashes/underscores become spaces). */
|
|
28
|
+
export const templateDisplayName = (filename, body) => {
|
|
29
|
+
const base = String(filename || 'template').replace(/\.md$/i, '');
|
|
30
|
+
const match = typeof body === 'string' && body.startsWith('---')
|
|
31
|
+
? body.slice(0, 2000).match(/^name\s*:\s*(.+?)\s*$/m)
|
|
32
|
+
: null;
|
|
33
|
+
const frontName = match ? String(match[1]).replace(/^['"]|['"]$/g, '').trim() : '';
|
|
34
|
+
if (frontName) return frontName;
|
|
35
|
+
return base.replace(/[-_]+/g, ' ').trim() || base;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const decodeBase64Content = (entry) => {
|
|
39
|
+
if (typeof entry?.content !== 'string' || entry.encoding !== 'base64') return null;
|
|
40
|
+
try {
|
|
41
|
+
return Buffer.from(entry.content.replace(/\s+/g, ''), 'base64').toString('utf8');
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const truncateBody = (body) => {
|
|
48
|
+
if (body.length <= MAX_TEMPLATE_CHARS) return { body, truncated: false };
|
|
49
|
+
return {
|
|
50
|
+
body: `${body.slice(0, MAX_TEMPLATE_CHARS)}…[truncated ${body.length - MAX_TEMPLATE_CHARS} chars]`,
|
|
51
|
+
truncated: true,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const isNoAccess = (error) => error?.kind === 'unavailable' && error?.reason === 'no-access';
|
|
56
|
+
|
|
57
|
+
export const createTemplatesService = ({ client, now = Date.now } = {}) => {
|
|
58
|
+
if (!client || typeof client.request !== 'function') {
|
|
59
|
+
throw new Error('createTemplatesService requires client');
|
|
60
|
+
}
|
|
61
|
+
const cache = createTtlCache({ ttlMs: TEMPLATES_TTL_MS, maxEntries: 200, now });
|
|
62
|
+
|
|
63
|
+
const repoKey = (credential, repo) => repoCachePrefix(credential, repo);
|
|
64
|
+
|
|
65
|
+
const readContents = (credential, repo, path) => client.request({
|
|
66
|
+
credential,
|
|
67
|
+
host: repo.host,
|
|
68
|
+
method: 'GET',
|
|
69
|
+
path: `/repos/${repo.owner}/${repo.repo}/contents/${path}`,
|
|
70
|
+
operation: 'issue templates',
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const listIssueTemplates = async (credential, repo) => {
|
|
74
|
+
const key = `${repoKey(credential, repo)}:templates`;
|
|
75
|
+
const load = async () => {
|
|
76
|
+
let dirEntries = null;
|
|
77
|
+
try {
|
|
78
|
+
const response = await readContents(credential, repo, TEMPLATE_DIR);
|
|
79
|
+
if (Array.isArray(response.body)) dirEntries = response.body;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
if (!isNoAccess(error)) throw error;
|
|
82
|
+
// Missing directory or unreadable repo — distinguish below.
|
|
83
|
+
dirEntries = null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let candidates = [];
|
|
87
|
+
if (dirEntries) {
|
|
88
|
+
candidates = dirEntries
|
|
89
|
+
.filter((entry) => entry?.type === 'file' && isMarkdownTemplate(entry.name) && typeof entry.path === 'string')
|
|
90
|
+
.map((entry) => ({ filename: entry.name, path: entry.path }));
|
|
91
|
+
} else {
|
|
92
|
+
// Template directory absent: probe the legacy single files. A real
|
|
93
|
+
// access failure surfaces here as no-access instead of empty.
|
|
94
|
+
for (const legacy of LEGACY_TEMPLATE_FILES) {
|
|
95
|
+
try {
|
|
96
|
+
const response = await readContents(credential, repo, legacy);
|
|
97
|
+
if (response.body?.type === 'file') {
|
|
98
|
+
candidates.push({ filename: legacy.split('/').pop(), path: legacy });
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (!isNoAccess(error)) throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (candidates.length === 0) {
|
|
106
|
+
// Contents reads report no-access for both "missing" and "forbidden".
|
|
107
|
+
// One repo lookup tells them apart: readable repo → no templates.
|
|
108
|
+
await client.request({
|
|
109
|
+
credential,
|
|
110
|
+
host: repo.host,
|
|
111
|
+
method: 'GET',
|
|
112
|
+
path: `/repos/${repo.owner}/${repo.repo}`,
|
|
113
|
+
operation: 'issue templates',
|
|
114
|
+
});
|
|
115
|
+
return { templates: [] };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const bounded = candidates.slice(0, MAX_TEMPLATES);
|
|
120
|
+
// Candidate file reads run with a small concurrency cap; results keep
|
|
121
|
+
// candidate priority order via indexed writes. One unreadable template
|
|
122
|
+
// must not erase the readable ones.
|
|
123
|
+
const slots = new Array(bounded.length).fill(null);
|
|
124
|
+
const readCandidate = async (candidate, index) => {
|
|
125
|
+
try {
|
|
126
|
+
const response = await readContents(credential, repo, candidate.path);
|
|
127
|
+
const raw = decodeBase64Content(response.body) ?? '';
|
|
128
|
+
const { body, truncated } = truncateBody(stripTemplateFrontMatter(raw));
|
|
129
|
+
slots[index] = {
|
|
130
|
+
filename: candidate.filename,
|
|
131
|
+
name: templateDisplayName(candidate.filename, raw),
|
|
132
|
+
body,
|
|
133
|
+
truncated,
|
|
134
|
+
};
|
|
135
|
+
} catch {
|
|
136
|
+
slots[index] = null;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
for (let start = 0; start < bounded.length; start += READ_CONCURRENCY) {
|
|
140
|
+
await Promise.all(bounded.slice(start, start + READ_CONCURRENCY).map((candidate, offset) => readCandidate(candidate, start + offset)));
|
|
141
|
+
}
|
|
142
|
+
return { templates: slots.filter((slot) => slot !== null), ...(candidates.length > bounded.length ? { truncated: true } : {}) };
|
|
143
|
+
};
|
|
144
|
+
const { value, fetchedAt, stale } = await readWithStaleFallback(cache, key, load);
|
|
145
|
+
return { repo: { ...repo }, ...value, fetchedAt, ...(stale ? { stale: true } : {}) };
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const invalidate = (credential = null, repo = null) => {
|
|
149
|
+
cache.invalidate(repoInvalidatePredicate({ fingerprint: credential?.fingerprint || '', repo }));
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
return { listIssueTemplates, invalidate };
|
|
153
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Child-process entry for non-blocking package-manager detection. The server
|
|
2
|
+
// spawns this once so the dozens of probe processes are forked from this small
|
|
3
|
+
// process instead of the large server process (each fork from the server
|
|
4
|
+
// blocks its event loop). Prints the detection details as JSON on stdout.
|
|
5
|
+
import { detectPackageManagerDetails } from './package-manager.js';
|
|
6
|
+
|
|
7
|
+
const invokedPath = process.env.PICHAMBER_DETECT_INVOKED_PATH;
|
|
8
|
+
if (invokedPath) {
|
|
9
|
+
process.argv[1] = invokedPath;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
process.stdout.write(JSON.stringify(detectPackageManagerDetails()));
|