@testmuai/kane-cli 0.8.16 → 0.8.17
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/{ChatSurface-5JEEFY34.js → ChatSurface-X2HLVN2I.js} +1 -1
- package/dist/{ChromeProfilePicker-6IVAYCWJ.js → ChromeProfilePicker-YU7HL6Z5.js} +1 -1
- package/dist/{CliFeedbackPrompt-K4IN7S6J.js → CliFeedbackPrompt-7FEEVGCU.js} +1 -1
- package/dist/{CliUploadProgress-MI4H4LKT.js → CliUploadProgress-OTVPBGW4.js} +1 -1
- package/dist/{ConfigView-CJY5MB6H.js → ConfigView-UKHUASHL.js} +1 -1
- package/dist/EvidenceViewOffer-LIPGXO23.js +2 -0
- package/dist/FolderPicker-OTQYRAYC.js +2 -0
- package/dist/{InfoBox-RP6RDCG7.js → InfoBox-2TYT2ROK.js} +1 -1
- package/dist/{LinksBox-QOQJ3S2I.js → LinksBox-7AS6D7MX.js} +1 -1
- package/dist/{ProfilesView-BZEBT6R5.js → ProfilesView-F4MFHZ7Y.js} +1 -1
- package/dist/{ProjectPicker-J42MEJRQ.js → ProjectPicker-QLGZM35L.js} +1 -1
- package/dist/{SaveSessionPrompt-MKAIUVX7.js → SaveSessionPrompt-T4MS76FY.js} +1 -1
- package/dist/SingleShotApp-4CDTAF3H.js +2 -0
- package/dist/{SummaryBox-JQJKGYDM.js → SummaryBox-IX32QPWM.js} +1 -1
- package/dist/TestMdRunView-MRMY3RW5.js +2 -0
- package/dist/{TestrunEvidenceTable-FYDS3ZVU.js → TestrunEvidenceTable-OK2HAENB.js} +1 -1
- package/dist/{WhoamiView-F4PPB7SN.js → WhoamiView-AHMNIIXZ.js} +1 -1
- package/dist/{app-download-RA4CGTC5.js → app-download-CF4JLXWV.js} +1 -1
- package/dist/{auth-TAT427C3.js → auth-D4BDPJPR.js} +1 -1
- package/dist/{binary-OFPMBJ34.js → binary-NWVJK542.js} +1 -1
- package/dist/{bind-LY362KX7.js → bind-LWN72YES.js} +4 -4
- package/dist/bootstrap-63FBDEEU.js +2 -0
- package/dist/bridge-UMXGHAJF.js +2 -0
- package/dist/{changelog-ZC3LHV2Z.js → changelog-GIZLIFMN.js} +1 -1
- package/dist/chat-committer-6D7AQI6Z.js +2 -0
- package/dist/chat-controller-UJQ6Z4RE.js +2 -0
- package/dist/{chunk-CVNHUDT4.js → chunk-233MYVFS.js} +1 -1
- package/dist/{chunk-MU3I453X.js → chunk-2LCWGWYC.js} +1 -1
- package/dist/{chunk-Z5DGFN7R.js → chunk-2LKNUXRN.js} +1 -1
- package/dist/{chunk-ZLIYWELJ.js → chunk-2STKZSVF.js} +1 -1
- package/dist/chunk-3UI5VTQS.js +4 -0
- package/dist/{chunk-4PWYSDZR.js → chunk-3UIZVDOF.js} +1 -1
- package/dist/chunk-3VAU3PNU.js +2 -0
- package/dist/{chunk-ICUTARPB.js → chunk-3YBT4UGQ.js} +1 -1
- package/dist/{chunk-4LVZLLTN.js → chunk-47QKRIPY.js} +3 -3
- package/dist/{chunk-AAT4O22C.js → chunk-4ASBXR6Q.js} +1 -1
- package/dist/{chunk-2GWMENG5.js → chunk-4OQ7GEIA.js} +1 -1
- package/dist/{chunk-BY2MU3ZS.js → chunk-4PWAODKJ.js} +1 -1
- package/dist/{chunk-23MVD7GY.js → chunk-5HDM7GDO.js} +1 -1
- package/dist/{chunk-VATOIZYG.js → chunk-5LSPHA3P.js} +5 -5
- package/dist/chunk-5MKY3WMF.js +3 -0
- package/dist/{chunk-C6JFTSIQ.js → chunk-5UHM7CKR.js} +1 -1
- package/dist/{chunk-FQFVAFWK.js → chunk-5X7JIGG7.js} +1 -1
- package/dist/{chunk-HYCOX7AB.js → chunk-5ZU7S4E7.js} +2 -2
- package/dist/{chunk-WPNNRMTP.js → chunk-637S3COE.js} +1 -1
- package/dist/{chunk-GX3FPJUG.js → chunk-63DYVWNX.js} +1 -1
- package/dist/{chunk-QXUPBIV3.js → chunk-64TO3MD7.js} +36 -36
- package/dist/{chunk-E44OHYDS.js → chunk-6CYF7Q5W.js} +2 -2
- package/dist/{chunk-TBYYPGHF.js → chunk-6OKOMKYR.js} +1 -1
- package/dist/{chunk-SF5QPR6T.js → chunk-75SSVUGS.js} +1 -1
- package/dist/{chunk-AHXOKBVE.js → chunk-7N6OCHPC.js} +1 -1
- package/dist/chunk-7U7HOEZO.js +2 -0
- package/dist/{chunk-7O54QURK.js → chunk-AACQE24F.js} +1 -1
- package/dist/{chunk-GCMJDOAE.js → chunk-AG2MVCNK.js} +1 -1
- package/dist/{chunk-NPKB7EK3.js → chunk-AH4QWIYU.js} +1 -1
- package/dist/{chunk-FYJ62EVY.js → chunk-AIR2WVXM.js} +1 -1
- package/dist/{chunk-O3ZKP4DY.js → chunk-AW34ZNNO.js} +1 -1
- package/dist/chunk-B6NU3SNG.js +368 -0
- package/dist/{chunk-OYY566GN.js → chunk-BNZQKQOE.js} +1 -1
- package/dist/{chunk-QMZLIHBS.js → chunk-CCNPXTC6.js} +2 -2
- package/dist/{chunk-CDWUZ54U.js → chunk-CCW3VQIY.js} +1 -1
- package/dist/{chunk-W4Y3PG7F.js → chunk-D2F5T3NX.js} +1 -1
- package/dist/{chunk-JQW2QFSX.js → chunk-D6E6KRVX.js} +1 -1
- package/dist/chunk-D7WG7SRA.js +2 -0
- package/dist/{chunk-Q7LZ5QJV.js → chunk-DFK5QYB5.js} +1 -1
- package/dist/{chunk-EMAKLNDV.js → chunk-DQRVB5EU.js} +1 -1
- package/dist/{chunk-H6S7L2I2.js → chunk-DT2LIX5S.js} +1 -1
- package/dist/{chunk-PDTFQGQF.js → chunk-E6X5BVXC.js} +1 -1
- package/dist/{chunk-MD3S2RXN.js → chunk-EIMHIZKF.js} +1 -1
- package/dist/chunk-EVFFDODK.js +5 -0
- package/dist/{chunk-3IXEARDX.js → chunk-F2OBORCG.js} +1 -1
- package/dist/chunk-FY7TCYPK.js +6 -0
- package/dist/{chunk-7QUFOWMU.js → chunk-GBXF4JE6.js} +1 -1
- package/dist/{chunk-U7BVK5IX.js → chunk-GIC56KI3.js} +1 -1
- package/dist/{chunk-IYOPWIG4.js → chunk-GT6Y2SEY.js} +2 -2
- package/dist/{chunk-ULGFPKC7.js → chunk-HLUOLWEJ.js} +1 -1
- package/dist/{chunk-O3XBIURC.js → chunk-HS7OIRGU.js} +1 -1
- package/dist/{chunk-NADKZKGS.js → chunk-I6RTGDZ7.js} +1 -1
- package/dist/{chunk-MZYPDLD3.js → chunk-ICFJVEEA.js} +1 -1
- package/dist/{chunk-Z4KRSLAM.js → chunk-IDLJHKJX.js} +1 -1
- package/dist/{chunk-J2LWXO55.js → chunk-IGI4T3VC.js} +1 -1
- package/dist/{chunk-KPL2XHYF.js → chunk-IHD2WXKT.js} +1 -1
- package/dist/{chunk-TGBXIV7O.js → chunk-IHUF6UP4.js} +1 -1
- package/dist/chunk-IICT4VOU.js +2 -0
- package/dist/{chunk-HBMNUT6E.js → chunk-IKB2JKMA.js} +1 -1
- package/dist/{chunk-SWTJMTBY.js → chunk-IPQAKIJO.js} +1 -1
- package/dist/{chunk-UEG4LJD6.js → chunk-IZ3PYWUL.js} +1 -1
- package/dist/{chunk-U466V5JN.js → chunk-JGCB4OUP.js} +1 -1
- package/dist/chunk-JPOYZCTX.js +2 -0
- package/dist/chunk-JQ64X2TO.js +2 -0
- package/dist/{chunk-UAFCBZ3P.js → chunk-JWOPRJIO.js} +1 -1
- package/dist/{chunk-WECVT7WE.js → chunk-JWPBLVPW.js} +1 -1
- package/dist/chunk-K2UJYY2U.js +2 -0
- package/dist/{chunk-ALCE5RLK.js → chunk-KDNNMU7Q.js} +1 -1
- package/dist/chunk-KJQNAOOE.js +6 -0
- package/dist/{chunk-DSWHEEHN.js → chunk-KMF2PPJ5.js} +1 -1
- package/dist/{chunk-NN6UG2BE.js → chunk-KQCGBDPM.js} +1 -1
- package/dist/{chunk-ZYEFWJNZ.js → chunk-KRI5NSGQ.js} +1 -1
- package/dist/{chunk-3MVEGB2I.js → chunk-KWANVHJX.js} +1 -1
- package/dist/{chunk-7P6FSGRD.js → chunk-KX5IV5FL.js} +2 -2
- package/dist/{chunk-WML5KSGQ.js → chunk-L2SJRAK4.js} +1 -1
- package/dist/{chunk-TWZ6NZWE.js → chunk-LO47W2DO.js} +4 -4
- package/dist/chunk-LSDWPG6C.js +2 -0
- package/dist/{chunk-G2ZMNVYN.js → chunk-MDM2LJFN.js} +1 -1
- package/dist/{chunk-Z2GDSCPS.js → chunk-MTCLFYNH.js} +1 -1
- package/dist/{chunk-IJTSA34Q.js → chunk-N55U4S4W.js} +1 -1
- package/dist/chunk-NFLQWKFR.js +8 -0
- package/dist/{chunk-OPL2MIQG.js → chunk-NJ4BXZBX.js} +1 -1
- package/dist/{chunk-6HCY5LJO.js → chunk-OCWS5YVO.js} +3 -3
- package/dist/{chunk-F2XTOZTN.js → chunk-PHR2OSWD.js} +1 -1
- package/dist/{chunk-TU6IMGWO.js → chunk-Q4YYAN6E.js} +1 -1
- package/dist/{chunk-55YDTPB7.js → chunk-Q6F23V7L.js} +1 -1
- package/dist/chunk-QSCXXNC2.js +2 -0
- package/dist/{chunk-IZ5CTC6M.js → chunk-RBFCGUR3.js} +1 -1
- package/dist/{chunk-3N6IAVD5.js → chunk-RDHWNSDP.js} +1 -1
- package/dist/{chunk-OUWOLCCS.js → chunk-RGJIGNB3.js} +1 -1
- package/dist/{chunk-TCAHDVII.js → chunk-RRY5IXOB.js} +1 -1
- package/dist/{chunk-BK42G6RI.js → chunk-RSXCS474.js} +1 -1
- package/dist/{chunk-AGKE5WF3.js → chunk-SDJNWR4D.js} +1 -1
- package/dist/{chunk-YCH7H7JX.js → chunk-SEEEGDVK.js} +1 -1
- package/dist/{chunk-5ACSALRU.js → chunk-TISVRTL7.js} +2 -2
- package/dist/{chunk-GGD7NKPL.js → chunk-TMOSERKN.js} +2 -2
- package/dist/{chunk-VOTIGXQ4.js → chunk-U2LDPUDZ.js} +1 -1
- package/dist/chunk-U6OTFMIT.js +4 -0
- package/dist/{chunk-KYZKPNPQ.js → chunk-UQNRUAES.js} +1 -1
- package/dist/{chunk-V4JR5JCK.js → chunk-UTIP6SMW.js} +1 -1
- package/dist/chunk-UUYYTJG2.js +6 -0
- package/dist/{chunk-XGL3RSI5.js → chunk-UXJZUGKL.js} +1 -1
- package/dist/{chunk-52WM3XYO.js → chunk-V4B5QA3U.js} +1 -1
- package/dist/chunk-VIO7CCFW.js +5 -0
- package/dist/{chunk-BCJNIDS3.js → chunk-VIYV6NIW.js} +1 -1
- package/dist/{chunk-IE3OO5GI.js → chunk-VVOKM2VO.js} +1 -1
- package/dist/{chunk-3LXN6AV5.js → chunk-WC54SZUO.js} +1 -1
- package/dist/{chunk-CR7UWQ76.js → chunk-WDK5ETMA.js} +1 -1
- package/dist/chunk-WESMQEPO.js +2 -0
- package/dist/{chunk-ECIGXPLN.js → chunk-WKIYI6MB.js} +1 -1
- package/dist/{chunk-KZG4E5RM.js → chunk-WVHMPIDQ.js} +1 -1
- package/dist/chunk-XLSOQLVT.js +2 -0
- package/dist/chunk-YOVKKZVZ.js +2 -0
- package/dist/chunk-ZLWURCJ7.js +2 -0
- package/dist/{chunk-5VZAWKDF.js → chunk-ZQ6KWTJ2.js} +1 -1
- package/dist/{chunk-IQDZ6YMY.js → chunk-ZRRBZUDJ.js} +1 -1
- package/dist/committer-2QPBANRD.js +2 -0
- package/dist/{config-WETHR632.js → config-WKLEWUPU.js} +1 -1
- package/dist/cover-cmd-7TSQJFGM.js +3 -0
- package/dist/{credentials-RQPAP5KY.js → credentials-FLY3ZXVX.js} +1 -1
- package/dist/{deps-bundle-F47ZDYIM.js → deps-bundle-CAKK3EO5.js} +1 -1
- package/dist/{deps-resolve-URKD4QCB.js → deps-resolve-MSLEFPVD.js} +1 -1
- package/dist/descriptor-3JJUOHBM.js +2 -0
- package/dist/design-committer-D44GSUXY.js +2 -0
- package/dist/dispatch-SXS276ZT.js +2 -0
- package/dist/{doctor-J44UKALC.js → doctor-EZPQTFJM.js} +1 -1
- package/dist/{docx-convert-WPZS6OIC.js → docx-convert-SQRTF7XS.js} +1 -1
- package/dist/{dossier-UGJMYYAB.js → dossier-7HVC6BNK.js} +1 -1
- package/dist/evidence-GUOURW6F.js +2 -0
- package/dist/evolve-cmd-LJJFOXXP.js +2 -0
- package/dist/{explain-H5HJEDEF.js → explain-NEFBUX5G.js} +1 -1
- package/dist/{explain-cmd-USGRZFBY.js → explain-cmd-5LLIJKM2.js} +1 -1
- package/dist/{explain-cmd-R45I5MT7.js → explain-cmd-ENSJNQK7.js} +1 -1
- package/dist/{extract-bind-X4QRQX53.js → extract-bind-CGU6WVS7.js} +3 -3
- package/dist/{extract-cmd-RKEE32FN.js → extract-cmd-7N7CCGN6.js} +2 -2
- package/dist/feeder-66TUPB2R.js +2 -0
- package/dist/gaps-cmd-BNUGDF5N.js +3 -0
- package/dist/{gate-E3BLIUEA.js → gate-OYRDJMF6.js} +1 -1
- package/dist/{generate-headless-LSQHOR3G.js → generate-headless-7TJYESUU.js} +2 -2
- package/dist/index.js +155 -158
- package/dist/ingest-OSNNM3DH.js +2 -0
- package/dist/ingest-cmd-B4T5CW5R.js +2 -0
- package/dist/install-6KJ2MZX3.js +2 -0
- package/dist/interactive-bind-HUZDSGFX.js +26 -0
- package/dist/lifecycle-cmd-GIVLSUPE.js +2 -0
- package/dist/list-cmd-KEKKQDUF.js +3 -0
- package/dist/{list-commands-Q77CAQJ2.js → list-commands-SMBBT5CY.js} +1 -1
- package/dist/logical-ids-GLVM2SVR.js +2 -0
- package/dist/login-flow-5ZIG7JXT.js +2 -0
- package/dist/maintenance-cmd-MLQ3IRFV.js +2 -0
- package/dist/{mobile-prompts-PPPPKRS2.js → mobile-prompts-EEPPPA6S.js} +1 -1
- package/dist/{objective-variable-gate-BCKULIFQ.js → objective-variable-gate-AEBWIGH7.js} +1 -1
- package/dist/open-provider-OTZ37JB6.js +2 -0
- package/dist/{pdf-convert-5H4HQNN3.js → pdf-convert-RLXSXFWN.js} +1 -1
- package/dist/{persist-recorded-session-MK4HCDOY.js → persist-recorded-session-IRWGMXGI.js} +1 -1
- package/dist/phase-seed-H7KXNQO6.js +2 -0
- package/dist/pipeline-OV3TWKSZ.js +2 -0
- package/dist/prepare-target-35OI7XBL.js +2 -0
- package/dist/readmodel-FVLRQWZ7.js +2 -0
- package/dist/reconcile-cmd-NBBDE7DJ.js +2 -0
- package/dist/reconcile-deps-DJNIY7TP.js +4 -0
- package/dist/reconcile-engine-Z2XKUCQ7.js +2 -0
- package/dist/recording-banner-GCR6A46M.js +2 -0
- package/dist/{records-TJJJWBUD.js → records-LMCVKPE5.js} +1 -1
- package/dist/registry-V3ULHPLM.js +2 -0
- package/dist/{require-project-folder-ZLKONKKP.js → require-project-folder-YBB5T3OE.js} +1 -1
- package/dist/{resolve-run-intent-3SXUS676.js → resolve-run-intent-XGZN6OQ6.js} +1 -1
- package/dist/{resolver-G7NGWACO.js → resolver-WNV53IOL.js} +1 -1
- package/dist/revert-NOUECRW4.js +2 -0
- package/dist/review-cmd-ZXTLZ4GE.js +5 -0
- package/dist/run-YWKZGZVL.js +2 -0
- package/dist/run-YZP2PTNW.js +2 -0
- package/dist/run-test-md-N43FRXB6.js +17 -0
- package/dist/{sessions-cmd-DV442ZCY.js → sessions-cmd-IV25N2L7.js} +1 -1
- package/dist/skill-installer-G7Z5ZDAQ.js +3 -0
- package/dist/{spawner-H6IDWY5U.js → spawner-ABB7B5CQ.js} +1 -1
- package/dist/store-guard-YIQQF4LC.js +2 -0
- package/dist/{structured-answers-NADW6D44.js → structured-answers-3C2DCFFF.js} +1 -1
- package/dist/sync-cmd-4AKHO5EG.js +2 -0
- package/dist/sync-setup-E7UV25KK.js +2 -0
- package/dist/tcg-generate-XJN5OMIJ.js +2 -0
- package/dist/testmd-actions-WFDWYEAU.js +2 -0
- package/dist/{testmd-sync-2CXNIPJ7.js → testmd-sync-I2E6W6JL.js} +1 -1
- package/dist/token-refresh-NADDXLYM.js +2 -0
- package/dist/{validate-basic-MN5NDCT2.js → validate-basic-WZY6A3KD.js} +1 -1
- package/dist/{variable-receipt-SIABUC74.js → variable-receipt-JONRYHCY.js} +1 -1
- package/dist/verdicts-JMVS6HNJ.js +2 -0
- package/dist/{version-check-TDGK5REB.js → version-check-CD7DHZI2.js} +1 -1
- package/dist/{view-cmd-RLO7AP4X.js → view-cmd-ASH2UFUW.js} +1 -1
- package/dist/walk-session-ZPXR7ASG.js +2 -0
- package/dist/with-telemetry-QXCHDKPW.js +2 -0
- package/package.json +11 -11
- package/dist/EvidenceViewOffer-ABKTGD4K.js +0 -2
- package/dist/FolderPicker-RQIVS7ZR.js +0 -2
- package/dist/SingleShotApp-TZZ2J7ZO.js +0 -2
- package/dist/TestMdRunView-2YVGGFLU.js +0 -2
- package/dist/bootstrap-RCDB5OWA.js +0 -2
- package/dist/bridge-E2NGMJYM.js +0 -2
- package/dist/chat-committer-HDE3TP5I.js +0 -2
- package/dist/chat-controller-3EPK7UZG.js +0 -2
- package/dist/chunk-3AVBUEBL.js +0 -8
- package/dist/chunk-4PMZ5FCD.js +0 -2
- package/dist/chunk-4WEVTED6.js +0 -3
- package/dist/chunk-7XMDCGIZ.js +0 -3
- package/dist/chunk-AKX4VRRR.js +0 -2
- package/dist/chunk-CRZUBDJ3.js +0 -6
- package/dist/chunk-FFVNISYH.js +0 -2
- package/dist/chunk-FWPRUGJJ.js +0 -368
- package/dist/chunk-GP7WD4UY.js +0 -4
- package/dist/chunk-HOA4VWSD.js +0 -5
- package/dist/chunk-JUJ4SAGH.js +0 -2
- package/dist/chunk-L2TV4G56.js +0 -4
- package/dist/chunk-NMBFAIXZ.js +0 -2
- package/dist/chunk-O25AL4B7.js +0 -5
- package/dist/chunk-RCYYE6ED.js +0 -2
- package/dist/chunk-TNBF5OMZ.js +0 -2
- package/dist/chunk-UHT5SVP5.js +0 -2
- package/dist/chunk-VWOAEF7J.js +0 -2
- package/dist/chunk-YMLC55J4.js +0 -2
- package/dist/chunk-YYYQ5MVD.js +0 -6
- package/dist/committer-IYQPXG6C.js +0 -2
- package/dist/cover-cmd-J3CTQT3R.js +0 -3
- package/dist/descriptor-PWUUNYV7.js +0 -2
- package/dist/design-committer-J57IAAA5.js +0 -2
- package/dist/dispatch-KOZAJQDW.js +0 -2
- package/dist/evidence-KRNDKDCT.js +0 -2
- package/dist/evolve-cmd-CEYGGIWA.js +0 -2
- package/dist/feeder-RSHMGW6B.js +0 -2
- package/dist/gaps-cmd-WL6P6YKS.js +0 -3
- package/dist/ingest-QGLVY7ND.js +0 -2
- package/dist/ingest-cmd-TQ4ARSDE.js +0 -2
- package/dist/install-47CRHVU6.js +0 -2
- package/dist/interactive-bind-FPC4RYEW.js +0 -26
- package/dist/lifecycle-cmd-DB5EFO2O.js +0 -2
- package/dist/list-cmd-UWGJRGKF.js +0 -3
- package/dist/logical-ids-DN6IZSUM.js +0 -2
- package/dist/login-flow-RSNR5HY2.js +0 -2
- package/dist/maintenance-cmd-EJ2RAMWB.js +0 -2
- package/dist/open-provider-XIGABCD3.js +0 -2
- package/dist/phase-seed-HKJ2EF7R.js +0 -2
- package/dist/pipeline-XDWHEZ5S.js +0 -2
- package/dist/prepare-target-NR3MTLLI.js +0 -2
- package/dist/readmodel-IBFRM6EO.js +0 -2
- package/dist/reconcile-cmd-VJPEY7YD.js +0 -2
- package/dist/reconcile-deps-T5YX6HRG.js +0 -4
- package/dist/reconcile-engine-GELPXSLV.js +0 -2
- package/dist/recording-banner-3ET3PMSV.js +0 -3
- package/dist/registry-3XMA4FOC.js +0 -2
- package/dist/revert-6BBBK3I4.js +0 -2
- package/dist/review-cmd-6DNGXV5E.js +0 -5
- package/dist/run-MUVZVTTC.js +0 -2
- package/dist/run-UJLRTKTO.js +0 -2
- package/dist/run-test-md-RI5RXVFU.js +0 -17
- package/dist/skill-installer-CAO2NJZP.js +0 -3
- package/dist/store-guard-PIA2DYZX.js +0 -2
- package/dist/sync-cmd-VFVTFIIJ.js +0 -2
- package/dist/sync-setup-R7BZDE24.js +0 -2
- package/dist/tcg-generate-QADJKNYZ.js +0 -2
- package/dist/testmd-actions-EXSVQRHQ.js +0 -2
- package/dist/token-refresh-5TVNSL4U.js +0 -2
- package/dist/verdicts-ZXXBKTOZ.js +0 -2
- package/dist/walk-session-ATWNUGHX.js +0 -2
- package/dist/with-telemetry-CLSDKQAG.js +0 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as we}from"./chunk-YKTYVJBN.js";import{b as he,c as ye,d as be,e as Ee,f as _e,p as T}from"./chunk-
|
|
2
|
+
import{a as we}from"./chunk-YKTYVJBN.js";import{b as he,c as ye,d as be,e as Ee,f as _e,p as T}from"./chunk-7N6OCHPC.js";import{a as J,b as F}from"./chunk-2UIHS2FH.js";import{a as M}from"./chunk-N2P4MI32.js";import{b as B,d as W}from"./chunk-VVOKM2VO.js";import{z as j}from"./chunk-IICT4VOU.js";import{g as N}from"./chunk-RDHWNSDP.js";import{x as ge}from"./chunk-PHR2OSWD.js";var A="https://integrations.lambdatest.com",E=class extends Error{constructor(e,r){super(r);this.code=e;this.name="LisError"}};function ft(t){let n=t.TESTMUAI_ENV==="stage"?"stage":"prod";return`${ge[n].shareApiBaseUrl}/lis/api/v1`}function gt(t){let n=t.env??process.env,e=t.auth?.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH;if(e)return{authorization:`Basic ${e}`};let r=t.auth?.TESTMUAI_API_KEY||n.TESTMUAI_API_KEY;return r?{authorization:`Bearer ${r}`}:{}}function k(t){let n=t.split(`
|
|
3
3
|
`,1)[0].replace(/[\u0000-\u001f\u007f-\u009f]/g,"");return n.length>200?`${n.slice(0,200)}\u2026`:n}function ht(t,n,e="the issue"){return t===401||t===403?new E("LIS_AUTH","credentials rejected \u2014 run `kane-cli login` and retry"):t>=500?new E("LIS_UNAVAILABLE",`the integrations service returned an error (HTTP ${t}) \u2014 retry later`):new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${e}: ${k(n)||`HTTP ${t}`}`)}function C(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{throw new E("LIS_UNAVAILABLE","the integrations service returned a malformed response \u2014 retry later")}}function ce(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{return{}}}function Le(t){return ce(t).code}function S(t,n="the issue",e="Atlassian"){let r=ce(t),s=e==="Atlassian"?"Confluence":e;switch(r.code){case"TOKEN_EXPIRED":return new E("LIS_SETUP",`your ${e} connection needs a resync \u2014 reconnect at ${A} and retry`);case"NOT_INSTALLED":return new E("LIS_SETUP",`no ${e} connection for this account \u2014 create one at ${A} and retry`);case"SCOPE_MISSING":return new E("LIS_SETUP",`the connection has no ${s} access \u2014 reconnect with ${s} at ${A} and retry`);case"FORBIDDEN":return new E("LIS_FORBIDDEN",`you don't have access to ${n}`);case"NOT_FOUND":return new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${n}: ${k(r.message??"")||"not found"}`);case"PAYLOAD_TOO_LARGE":return new E("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");case"INVALID_PAYLOAD":return new E("LIS_UNAVAILABLE",`the integrations service rejected the request (${k(r.message??"")||"invalid payload"}) \u2014 retry later`);case"NOT_SUPPORTED":return new E("LIS_UNAVAILABLE","the integrations service does not support this operation yet");case"UPSTREAM_ERROR":case"UPSTREAM_TIMEOUT":return new E("LIS_UNAVAILABLE",`${e} is not responding through the integrations service \u2014 retry later`);default:return ht(t.status,r.message??"",n)}}var yt=3e4,bt=5;async function $(t,n,e){let r=e.env??process.env,s=e.fetchImpl??fetch;for(let o=0;;o++){let l=new AbortController,u=setTimeout(()=>l.abort(),yt);try{let i=await s(`${ft(r)}${t}`,{...n,headers:{"content-type":"application/json",...gt(e),...n.headers??{}},signal:l.signal}),c=await Promise.race([i.arrayBuffer(),new Promise((d,p)=>{l.signal.addEventListener("abort",()=>p(new DOMException("aborted","AbortError")),{once:!0})})]),a={status:i.status,ok:i.ok,headers:i.headers,bytes:Buffer.from(c)};if(a.status===429){if(o>0)throw new E("LIS_RATE_LIMITED","the integrations service is busy \u2014 try again in a moment");let d=ce(a).data?.retry_after_sec,p=Math.min(Math.max(typeof d=="number"&&Number.isFinite(d)?d:1,0),bt);clearTimeout(u),await new Promise(b=>setTimeout(b,p*1e3));continue}return a}catch(i){throw i instanceof E?i:l.signal.aborted?new E("LIS_UNAVAILABLE","the integrations service did not respond within 30 seconds \u2014 retry later"):new E("LIS_UNAVAILABLE",`could not reach the integrations service (${k(i instanceof Error?i.message:String(i))}) \u2014 check your connection and retry`)}finally{clearTimeout(u)}}}function V(t){let n=t.headers.get("content-type")??"application/octet-stream";if(n.includes("json"))try{let e=JSON.parse(t.bytes.toString("utf8")),r=e.content??e.data?.content;if(typeof r=="string")return{bytes:Buffer.from(r,"base64"),mediaType:e.mime_type??e.data?.mime_type??"application/octet-stream"}}catch{}return{bytes:t.bytes,mediaType:n}}async function H(t={}){let n=await $("/jira/info",{method:"GET"},t);if(!n.ok)throw S(n);let e=C(n),r=(e.data?.SELECTED_PROJECTS??[]).map(s=>s?.key).filter(s=>typeof s=="string"&&s.length>0);return{installed:e.data?.INSTALLED==="YES",selectAll:e.data?.SELECT_ALL===!0,selectedProjects:r,capabilities:{document:e.data?.capabilities?.document===!0,comments:e.data?.capabilities?.comments===!0}}}async function z(t,n={}){let e=await $("/jira/issue?details=true",{method:"POST",body:JSON.stringify({plugin_code:"jira",issueKey:t})},n);if(!e.ok)throw S(e);let r=C(e);if(r.type==="error"||!r.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue: ${k(r.message??"")||"issue not found or not accessible"}`);return r.data}var Ie=100,Et=5e3,_t=60;async function X(t,n={}){let e=[],r=new Set,s=null,o=0;for(let l=0;;l++){if(l>=_t)throw new E("LIS_UNAVAILABLE","the integrations service kept returning comment pages without finishing \u2014 retry later");let u=await $("/jira/issue/comments",{method:"POST",body:JSON.stringify({resource_id:t,max_results:Ie,cursor:s,start_at:o,order_by:"created",fetch_all:!1})},n);if(!u.ok)throw S(u,"the issue's comments");let i=C(u);if(i.type==="error"||!i.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue's comments: ${k(i.message??"")||"unavailable"}`);for(let w of i.data.comments??[]){let g=String(w.id);r.has(g)||(r.add(g),e.push(w))}let c=i.data.pagination;if(!c?.has_more)return e;if(e.length>=Et)throw new E("JIRA_ISSUE_UNAVAILABLE","the issue has more comments than can be ingested \u2014 cannot build a complete identity");let a=c.next_cursor??null,d=c.next_start_at!=null,p=d?c.next_start_at:o+Ie;if(!(a!=null&&a!==s||a==null&&d&&p!==o))throw new E("LIS_UNAVAILABLE","the integrations service returned a non-advancing comments page \u2014 retry later");s=a,o=p}}async function Z(t,n={}){let e=await $("/jira/attachment",{method:"POST",body:JSON.stringify({attachment_id:t})},n);if(!e.ok){if(Le(e)===void 0){if(e.status===413)throw new E("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");if(e.status===404)throw new E("JIRA_NOT_CONNECTED",`Jira is not connected for this account \u2014 connect it at ${A} and retry`)}throw S(e,`attachment ${t}`)}return V(e)}var q="kane.source.jira/2";function Ae(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t)){let n=t.map(Ae).filter(e=>e!==null);return n.length===0?null:n.join(", ")}if(t!==null&&typeof t=="object"){let n=t;for(let e of["name","value","displayName"])if(typeof n[e]=="string")return n[e];return null}return null}function ve(t,n,e){let r=[],s={},o=t.additional_fields??{};for(let a of Object.keys(o).sort()){let d=Ae(o[a]);if(d===null){r.push(`field "${a}" has no stable text form \u2014 dropped from the envelope`);continue}s[a]=d}let l=[...t.attachments??[]].map(a=>({id:String(a.id),filename:a.filename??"",media_type:a.mime_type??"application/octet-stream",size:a.size??0})).sort((a,d)=>{let p=Number(a.id),b=Number(d.id);return Number.isFinite(p)&&Number.isFinite(b)?p-b:a.id<d.id?-1:a.id>d.id?1:0}),u=e.map(a=>({id:String(a.id),author:a.author?.display_name??"",body:a.body??"",created:a.created??""})).sort((a,d)=>{if(a.created!==d.created)return a.created<d.created?-1:1;let p=Number(a.id),b=Number(d.id);return Number.isFinite(p)&&Number.isFinite(b)&&p!==b?p-b:a.id<d.id?-1:a.id>d.id?1:0}),i=t.key;if(!/^[A-Za-z][A-Za-z0-9_]*-\d+$/.test(i))throw new Error(`cannot build a stable identity for issue key "${i}" \u2014 expected a PROJECT-NUMBER key`);let c={schema:q,site:n,project:i.slice(0,i.lastIndexOf("-")),issue:{id:t.id,key:i},content:{summary:t.summary??"",description:t.description??"",fields:s},attachments:l,comments:u};return{bytes:Buffer.from(JSON.stringify(c),"utf8"),envelope:c,warnings:r}}var Se=64,wt=16,Lt=6e6,It=5e7,At=12e6,vt={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},St=new Set(["png","jpeg","webp"]);function $e(t){return async n=>{let e;try{e=JSON.parse(n.toString("utf8"))}catch{throw new Error("JIRA_ENVELOPE_SCHEMA: source bytes are not a kane jira envelope")}if(e.schema!==q)throw new Error(`JIRA_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${q}`);let r=[],s=new Map,o=[],l=0,u=new Map,i=[];for(let d=0;d<e.attachments.length;d++){let p=e.attachments[d],b=`i${d+1}`,w=`attachment:${p.filename}`,g=v=>`[img#${b}] ${p.filename} (${p.media_type}, ${p.size} bytes${v?"":" \u2014 not delivered"})`,h=(v,R,x)=>{r.push({ref:b,loc:w,media_type:v,...x?.blob?{blob:x.blob}:{},...x?.appearance?{appearance:x.appearance}:{},delivery:R,...x?.duplicate_of?{duplicate_of:x.duplicate_of}:{}})};if(!p.media_type.startsWith("image/")){h(p.media_type,"unsupported-vision-media-type"),i.push(g(!1));continue}let _;try{_=await t.fetchAttachment(p.id)}catch{h(p.media_type,"external-image-not-fetched"),i.push(g(!1));continue}let y=_.bytes,m=J(y),f=vt[m.format],I=B(y);if(s.set(I,y),!St.has(m.format)){let v=m.format==="gif"||m.format==="bmp"||m.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";h(f,v,{blob:I}),i.push(g(!1));continue}if(m.width===void 0||m.height===void 0||m.width*m.height>It){h(f,"undecodable",{blob:I}),i.push(g(!1));continue}let L;if(m.format==="png"||m.format==="jpeg"){let v=F(y,m.format);if(v===null){h(f,"undecodable",{blob:I}),i.push(g(!1));continue}L=M(v.data,{width:v.width,height:v.height,channels:v.channels})}if(m.width<Se||m.height<Se){h(f,"below-dimension-floor",{blob:I,appearance:L}),i.push(g(!1));continue}let O=u.get(I);if(O!==void 0){h(f,"duplicate",{blob:I,appearance:L,duplicate_of:O}),i.push(g(!1));continue}if(y.byteLength>Lt){h(f,"image-too-large",{blob:I,appearance:L}),i.push(g(!1));continue}if(l+y.byteLength>At){h(f,"vision-byte-budget-reached",{blob:I,appearance:L}),i.push(g(!1));continue}if(o.length>=wt){h(f,"image-cap-reached",{blob:I,appearance:L}),i.push(g(!1));continue}u.set(I,b),l+=y.byteLength,o.push(b),h(f,"selected",{blob:I,appearance:L}),i.push(g(!0))}let c=[];c.push(`${e.issue.key} \xB7 ${e.site}/${e.project}`,`Summary: ${e.content.summary}`),e.content.description!==""&&c.push("",...e.content.description.split(`
|
|
4
4
|
`));let a=Object.keys(e.content.fields);return a.length>0&&c.push("","--- fields ---",...a.map(d=>`${d}: ${e.content.fields[d]}`)),i.length>0&&c.push("","--- attachments ---",...i),e.comments.length>0&&(c.push("","--- comments ---"),e.comments.forEach((d,p)=>{p>0&&c.push(""),c.push(`[${p+1}] ${d.author} \xB7 ${d.created}`,...d.body.split(`
|
|
5
5
|
`))})),{projection:c.join(`
|
|
6
6
|
`)+`
|
|
7
|
-
`,inventory:r,blobs:s,delivered:o,converter:{name:"jira-convert",version:"2",policy:"v1"}}}}var $t=/^[A-Za-z][A-Za-z0-9_]*-\d+$/;function Q(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.lastIndexOf("browse");if(r===-1||r+1>=e.length)return null;let s=e[r+1];return $t.test(s)?{site:n.hostname,issueKey:s.toUpperCase()}:null}function ee(t,n){let e=j(t),r=e.heads.get(n);return r==null?null:Ce(t,e,r)}function te(t,n){let r=ee(t,n)?.site;return typeof r=="string"&&r.length>0?r:null}function ke(t,n,e,r){let s=j(t);for(let[o,l]of s.heads){if(l==null||s.mediaOf(l).format!==n)continue;let u=Ce(t,s,l);if(u===null)continue;let i=u;for(let c of e){if(i===null||typeof i!="object"){i=void 0;break}i=i[c]}if(i===r)return o}return null}function Ce(t,n,e){let r=n.getNode(e)?.content?.blob;if(typeof r!="string")return null;let s=W(t,r);if(s===null)return null;try{let o=JSON.parse(s.toString("utf8"));return o!==null&&typeof o=="object"?o:null}catch{return null}}var Re={jira:"a jira issue source",confluence:"a confluence page source",linear:"a linear issue source","linear-doc":"a linear document source",web:"a web page source"};function P(t,n,e){let r=j(t),s=r.heads.get(n);if(s==null)return null;let o=r.mediaOf(s).format;if(o===e)return null;let l=Re[o]??`${o} content`;return`source '${n}' is already backed by ${l}, not ${Re[e]??e} \u2014 retire it first (kane-cli context retire ${n}) or ingest under a different id with --as`}async function Rt(t,n,e,r,s){let o=Q(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Jira issue URL (https://<site>/browse/KEY-123)`),{code:1};let l=s?.lis??{jiraInfo:H,jiraIssue:z,jiraAttachment:Z,jiraComments:X};try{let i={auth:await(s?.authEnv??(await import("./auth-
|
|
7
|
+
`,inventory:r,blobs:s,delivered:o,converter:{name:"jira-convert",version:"2",policy:"v1"}}}}var $t=/^[A-Za-z][A-Za-z0-9_]*-\d+$/;function Q(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.lastIndexOf("browse");if(r===-1||r+1>=e.length)return null;let s=e[r+1];return $t.test(s)?{site:n.hostname,issueKey:s.toUpperCase()}:null}function ee(t,n){let e=j(t),r=e.heads.get(n);return r==null?null:Ce(t,e,r)}function te(t,n){let r=ee(t,n)?.site;return typeof r=="string"&&r.length>0?r:null}function ke(t,n,e,r){let s=j(t);for(let[o,l]of s.heads){if(l==null||s.mediaOf(l).format!==n)continue;let u=Ce(t,s,l);if(u===null)continue;let i=u;for(let c of e){if(i===null||typeof i!="object"){i=void 0;break}i=i[c]}if(i===r)return o}return null}function Ce(t,n,e){let r=n.getNode(e)?.content?.blob;if(typeof r!="string")return null;let s=W(t,r);if(s===null)return null;try{let o=JSON.parse(s.toString("utf8"));return o!==null&&typeof o=="object"?o:null}catch{return null}}var Re={jira:"a jira issue source",confluence:"a confluence page source",linear:"a linear issue source","linear-doc":"a linear document source",web:"a web page source"};function P(t,n,e){let r=j(t),s=r.heads.get(n);if(s==null)return null;let o=r.mediaOf(s).format;if(o===e)return null;let l=Re[o]??`${o} content`;return`source '${n}' is already backed by ${l}, not ${Re[e]??e} \u2014 retire it first (kane-cli context retire ${n}) or ingest under a different id with --as`}async function Rt(t,n,e,r,s){let o=Q(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Jira issue URL (https://<site>/browse/KEY-123)`),{code:1};let l=s?.lis??{jiraInfo:H,jiraIssue:z,jiraAttachment:Z,jiraComments:X};try{let i={auth:await(s?.authEnv??(await import("./auth-D4BDPJPR.js")).resolveLisAuthEnv)(),env:process.env},c=await l.jiraInfo(i);if(!c.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${A} and retry`),{code:1};if(c.capabilities.comments===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read issue comments yet \u2014 resync it at ${A} and retry`),{code:1};let a=o.issueKey.slice(0,o.issueKey.lastIndexOf("-"));if(!c.selectAll&&c.selectedProjects.length>0&&!c.selectedProjects.includes(a))return(e.err??e.out)(`error: ${t}: project ${a} is not in the integration's selected projects (${c.selectedProjects.join(", ")}) \u2014 add it at ${A}`),{code:1};let d=await l.jiraIssue(o.issueKey,i),p=await l.jiraComments(o.issueKey,i),b=o.site;if(d.host)try{b=new URL(d.host).hostname}catch{b=d.host.replace(/^https?:\/\//,"").replace(/[/:].*$/,"")}let{bytes:w,warnings:g}=ve(d,b,p),h=n??o.issueKey.toLowerCase();N(h);let _=P(r,h,"jira");if(_!==null)return(e.err??e.out)(`error: ${t}: ${_}`),{code:1};let y=te(r,h);if(y!==null&&y!==b)return(e.err??e.out)(`error: ${t}: source '${h}' was ingested from ${y}, but this read serves ${b} \u2014 retire it first (kane-cli context retire ${h}) or ingest under a different id with --as`),{code:1};let m=await T({contextDir:r,bytes:w,media:he,sourceId:h,label:t,confirmSameSource:e.isTTY?f=>e.confirm(`identical content already ingested as ${f} \u2014 treat as the same source?`):void 0,converters:{jira:$e({fetchAttachment:f=>l.jiraAttachment(f,i)})}});e.out(U(e.isTTY,m,o.issueKey));for(let f of g)e.out(`warning: ${f}`);for(let f of m.warnings??[])e.out(`warning: ${f}`);if(m.composite){let f=m.composite.delivered+m.composite.omitted;e.out(`${m.source_id}: jira, ${f} attachments, ${m.composite.delivered} images delivered (${m.composite.omitted} omitted)`)}return{code:0,result:{status:m.status,source_id:m.source_id,source_cid:m.cid,...m.gitignore?{gitignore:m.gitignore}:{}}}}catch(u){return u instanceof E?((e.err??e.out)(`error: ${t}: ${u.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${kt(u instanceof Error?u.message:String(u))}`),{code:1})}}function kt(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the issue's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the description or attachments in Jira and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the issue's text is too large to ingest \u2014 trim the description in Jira and retry":t}var Oe={name:"jira",hint:"Jira issue URLs (https://<site>/browse/KEY-123)",match:t=>Q(t)!==null,ingest:Rt,sourceIdFor:t=>{let n=Q(t);return n?n.issueKey.toLowerCase():null}};async function Ne(t,n={}){let e=await $("/jira/document",{method:"POST",body:JSON.stringify({resource_id:t,format:"markdown"})},n);if(!e.ok)throw S(e,"the page");let r=C(e);if(r.type==="error"||!r.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the page: ${k(r.message??"")||"page not found or not accessible"}`);return r.data}async function Te(t,n={}){let e=await $("/jira/attachment",{method:"POST",body:JSON.stringify({source:"confluence",download:t})},n);if(!e.ok)throw S(e,"the page's attachment");return{bytes:V(e).bytes}}var ne="kane.source.confluence/1";function Pe(t,n){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this page \u2014 the integrations service returned no page id");let e=[...t.labels??[]].filter(o=>typeof o=="string").sort(),r=[...t.attachments??[]].map(o=>({id:String(o.id),filename:o.filename??"",media_type:o.mime_type??"application/octet-stream",size:o.size??0})).sort((o,l)=>o.id<l.id?-1:o.id>l.id?1:0),s={schema:ne,site:n,page:{id:t.id},space:{key:t.space?.key??""},title:t.title??"",labels:e,content:{body:t.body??""},attachments:r};return{bytes:Buffer.from(JSON.stringify(s),"utf8"),envelope:s,warnings:[]}}var Ue=64,Ct=16,Ot=6e6,Nt=5e7,Tt=12e6,Pt={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},Ut=new Set(["png","jpeg","webp"]);function xe(t){let n=new Map(Object.entries(t.downloads));return async e=>{let r;try{r=JSON.parse(e.toString("utf8"))}catch{throw new Error("CONFLUENCE_ENVELOPE_SCHEMA: source bytes are not a kane confluence envelope")}if(r.schema!==ne)throw new Error(`CONFLUENCE_ENVELOPE_SCHEMA: unknown envelope schema "${r.schema}" \u2014 this CLI understands ${ne}`);let s=[],o=new Map,l=[],u=0,i=new Map,c=[];for(let d=0;d<r.attachments.length;d++){let p=r.attachments[d],b=`i${d+1}`,w=`attachment:${p.filename}`,g=R=>`[img#${b}] ${p.filename} (${p.media_type}, ${p.size} bytes${R?"":" \u2014 not delivered"})`,h=(R,x,D)=>{s.push({ref:b,loc:w,media_type:R,...D?.blob?{blob:D.blob}:{},...D?.appearance?{appearance:D.appearance}:{},delivery:x,...D?.duplicate_of?{duplicate_of:D.duplicate_of}:{}})};if(!p.media_type.startsWith("image/")){h(p.media_type,"unsupported-vision-media-type"),c.push(g(!1));continue}let _=n.get(p.id);if(!_){h(p.media_type,"external-image-not-fetched"),c.push(g(!1));continue}let y;try{y=await t.fetchAttachment({id:p.id,download:_})}catch{h(p.media_type,"external-image-not-fetched"),c.push(g(!1));continue}let m=y.bytes,f=J(m),I=Pt[f.format],L=B(m);if(o.set(L,m),!Ut.has(f.format)){let R=f.format==="gif"||f.format==="bmp"||f.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";h(I,R,{blob:L}),c.push(g(!1));continue}if(f.width===void 0||f.height===void 0||f.width*f.height>Nt){h(I,"undecodable",{blob:L}),c.push(g(!1));continue}let O;if(f.format==="png"||f.format==="jpeg"){let R=F(m,f.format);if(R===null){h(I,"undecodable",{blob:L}),c.push(g(!1));continue}O=M(R.data,{width:R.width,height:R.height,channels:R.channels})}if(f.width<Ue||f.height<Ue){h(I,"below-dimension-floor",{blob:L,appearance:O}),c.push(g(!1));continue}let v=i.get(L);if(v!==void 0){h(I,"duplicate",{blob:L,appearance:O,duplicate_of:v}),c.push(g(!1));continue}if(m.byteLength>Ot){h(I,"image-too-large",{blob:L,appearance:O}),c.push(g(!1));continue}if(u+m.byteLength>Tt){h(I,"vision-byte-budget-reached",{blob:L,appearance:O}),c.push(g(!1));continue}if(l.length>=Ct){h(I,"image-cap-reached",{blob:L,appearance:O}),c.push(g(!1));continue}i.set(L,b),u+=m.byteLength,l.push(b),h(I,"selected",{blob:L,appearance:O}),c.push(g(!0))}let a=[];return a.push(`${r.title} \xB7 ${r.site} \xB7 ${r.space.key}`),r.labels.length>0&&a.push(`labels: ${r.labels.join(", ")}`),r.content.body!==""&&a.push("",...r.content.body.split(`
|
|
8
8
|
`)),c.length>0&&a.push("","--- attachments ---",...c),{projection:a.join(`
|
|
9
9
|
`)+`
|
|
10
|
-
`,inventory:s,blobs:o,delivered:l,converter:{name:"confluence-convert",version:"1",policy:"v1"}}}}var xt=/^[A-Za-z0-9~][A-Za-z0-9._~-]*$/;function re(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.indexOf("wiki");if(r===-1||e[r+1]!=="spaces"||e[r+3]!=="pages")return null;let s=e[r+2],o=e[r+4];return s===void 0||o===void 0||!xt.test(s)||!/^\d+$/.test(o)?null:{site:n.hostname,spaceKey:s,pageId:o}}async function Dt(t,n,e,r,s){let o=re(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Confluence page URL (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)`),{code:1};let l=s?.lis??{jiraInfo:H,jiraIssue:z,jiraAttachment:Z,jiraComments:X},u=s?.confluence??{confluenceDocument:Ne,confluenceAttachment:Te};try{let c={auth:await(s?.authEnv??(await import("./auth-TAT427C3.js")).resolveLisAuthEnv)(),env:process.env},a=await l.jiraInfo(c);if(!a.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${A} and retry`),{code:1};if(a.capabilities.document===!1)return(e.err??e.out)(`error: ${t}: the connection has no Confluence access \u2014 reconnect with Confluence at ${A} and retry`),{code:1};let d=await u.confluenceDocument(o.pageId,c),p=o.site;if(d.url)try{p=new URL(d.url).hostname}catch{}let{bytes:b,warnings:w}=Pe(d,p),g=n??`page-${o.pageId}`;N(g);let h=P(r,g,"confluence");if(h!==null)return(e.err??e.out)(`error: ${t}: ${h}`),{code:1};let _=te(r,g);if(_!==null&&_!==p)return(e.err??e.out)(`error: ${t}: source '${g}' was ingested from ${_}, but this read serves ${p} \u2014 retire it first (kane-cli context retire ${g}) or ingest under a different id with --as`),{code:1};let y=Object.fromEntries((d.attachments??[]).filter(f=>typeof f.download=="string"&&f.download.length>0).map(f=>[String(f.id),f.download])),m=await T({contextDir:r,bytes:b,media:ye,sourceId:g,label:t,confirmSameSource:e.isTTY?f=>e.confirm(`identical content already ingested as ${f} \u2014 treat as the same source?`):void 0,converters:{confluence:xe({downloads:y,fetchAttachment:f=>u.confluenceAttachment(f.download,c)})}});e.out(U(e.isTTY,m,`${o.spaceKey}/${o.pageId}`));for(let f of w)e.out(`warning: ${f}`);for(let f of m.warnings??[])e.out(`warning: ${f}`);if(m.composite){let f=m.composite.delivered+m.composite.omitted;e.out(`${m.source_id}: confluence, ${f} attachments, ${m.composite.delivered} images delivered (${m.composite.omitted} omitted)`)}return{code:0,result:{status:m.status,source_id:m.source_id,source_cid:m.cid,...m.gitignore?{gitignore:m.gitignore}:{}}}}catch(i){return i instanceof E?((e.err??e.out)(`error: ${t}: ${i.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${jt(i instanceof Error?i.message:String(i))}`),{code:1})}}function jt(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the page in Confluence and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page's text is too large to ingest \u2014 trim the page in Confluence and retry":t}var De={name:"confluence",hint:"Confluence page URLs (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)",match:t=>re(t)!==null,ingest:Dt,sourceIdFor:t=>{let n=re(t);return n?`page-${n.pageId}`:null}};async function je(t={}){let n=await $("/linear-app/info",{method:"GET"},t);if(!n.ok)throw S(n,"the connection","Linear");let e=C(n);return{installed:e.data?.INSTALLED==="YES",capabilities:{issue:e.data?.capabilities?.issue===!0,comments:e.data?.capabilities?.comments===!0,document:e.data?.capabilities?.document===!0}}}async function Be(t,n={}){let e=await $("/linear-app/issue?details=true",{method:"POST",body:JSON.stringify({plugin_code:"linear-app",issueKey:t})},n);if(!e.ok)throw S(e,"the issue","Linear");let r=C(e);if(r.type==="error"||!r.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue: ${k(r.message??"")||"issue not found or not accessible"}`);return r.data}var Bt=100,Mt=5e3,Jt=60;async function Me(t,n={}){let e=[],r=new Set,s=null;for(let o=0;;o++){if(o>=Jt)throw new E("LIS_UNAVAILABLE","the integrations service kept returning comment pages without finishing \u2014 retry later");let l=await $("/linear-app/issue/comments",{method:"POST",body:JSON.stringify({resource_id:t,max_results:Bt,...s===null?{}:{cursor:s},fetch_all:!1})},n);if(!l.ok)throw S(l,"the issue's comments","Linear");let u=C(l);if(u.type==="error"||!u.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue's comments: ${k(u.message??"")||"unavailable"}`);if(u.data.partial)throw new E("JIRA_ISSUE_UNAVAILABLE","the integrations service returned an incomplete comment set \u2014 retry later");for(let a of u.data.comments??[]){if(typeof a.id!="string"||a.id==="")throw new E("JIRA_ISSUE_UNAVAILABLE","the integrations service returned an incomplete comment set \u2014 a comment row has no comment id");r.has(a.id)||(r.add(a.id),e.push(a))}let i=u.data.pagination;if(!i?.has_more)return e;if(e.length>=Mt)throw new E("JIRA_ISSUE_UNAVAILABLE","the issue has more comments than can be ingested \u2014 cannot build a complete identity");let c=i.next_cursor??null;if(c==null||c===s)throw new E("LIS_UNAVAILABLE","the integrations service returned a non-advancing comments page \u2014 retry later");s=c}}async function Je(t,n={}){let e=await $("/linear-app/document",{method:"POST",body:JSON.stringify({resource_id:t,format:"markdown"})},n);if(!e.ok)throw S(e,"the document","Linear");let r=C(e);if(r.type==="error"||!r.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the document: ${k(r.message??"")||"document not found or not accessible"}`);return r.data}async function Fe(t,n={}){let e=await $("/linear-app/attachment",{method:"POST",body:JSON.stringify({attachment_id:t})},n);if(!e.ok)throw S(e,"the attachment","Linear");return{bytes:V(e).bytes}}var oe="kane.source.linear/1",ie="kane.source.linear-doc/1",Ft=/https:\/\/uploads\.linear\.app\/[^\s)"'`]+/g;function G(t){return t.replace(Ft,n=>{let e=n.indexOf("?");return e===-1?n:n.slice(0,e)})}function Ve(t,n){return t.id<n.id?-1:t.id>n.id?1:0}function Vt(t,n){return Ve(t,n)||(t.filename<n.filename?-1:t.filename>n.filename?1:0)||(t.url<n.url?-1:t.url>n.url?1:0)}function Ge(t,n,e){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this issue \u2014 the integrations service returned no issue id");let r=t.key;if(!/^[A-Za-z][A-Za-z0-9]*-\d+$/.test(r)){let c=String(r).replace(/[\u0000-\u001f\u007f-\u009f]/g,"").slice(0,80);throw new Error(`cannot build a stable identity for issue key "${c}" \u2014 expected a TEAM-NUMBER key`)}let s={},o=[...t.labels??[]].filter(c=>typeof c=="string").sort();o.length>0&&(s.labels=o.join(", ")),typeof t.priority=="string"&&t.priority!==""&&(s.priority=t.priority),typeof t.project=="string"&&t.project!==""&&(s.project=t.project),typeof t.status=="string"&&t.status!==""&&(s.status=t.status);let l=(t.attachments??[]).map(c=>({id:c.id!=null&&String(c.id)!==""?String(c.id):G(c.download??""),filename:c.filename??"",url:G(c.download??"")})).sort(Vt),u=n.map(c=>({id:String(c.id),author:c.author?.display_name??"",body:G(c.body??""),created:c.created??""})).sort((c,a)=>c.created!==a.created?c.created<a.created?-1:1:Ve(c,a)),i={schema:oe,site:e,team:r.slice(0,r.lastIndexOf("-")),issue:{uuid:t.id,key:r},content:{title:t.summary??"",description:G(t.description??""),fields:s},attachments:l,comments:u};return{bytes:Buffer.from(JSON.stringify(i),"utf8"),envelope:i,warnings:[]}}function Ye(t,n,e){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this document \u2014 the integrations service returned no document id");let r=(t.attachments??[]).map(o=>({url:G(o.download??String(o.id??"")),filename:o.filename??""})).sort((o,l)=>o.url<l.url?-1:o.url>l.url?1:0),s={schema:ie,site:n,document:{uuid:t.id,slug_id:e},project:{id:t.space?.key??""},title:t.title??"",content:{body:G(t.body??"")},attachments:r};return{bytes:Buffer.from(JSON.stringify(s),"utf8"),envelope:s,warnings:[]}}var Ke=64,Gt=16,Yt=6e6,Kt=5e7,Wt=12e6,se=64,We="https://uploads.linear.app/",Ht=/https:\/\/uploads\.linear\.app\/[^\s)"'`]+/g,zt={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},Xt=new Set(["png","jpeg","webp"]);async function He(t,n){let e=[],r=new Map,s=[],o=0,l=new Map,u=[];for(let i=0;i<t.length;i++){let c=t[i],a=`i${i+1}`,d=f=>`[img#${a}] ${c.label}${f?"":" \u2014 not delivered"}`,p=(f,I,L)=>{e.push({ref:a,loc:c.loc,media_type:f,...L?.blob?{blob:L.blob}:{},...L?.appearance?{appearance:L.appearance}:{},delivery:I,...L?.duplicate_of?{duplicate_of:L.duplicate_of}:{}})},b;try{b=await n(c.url)}catch{p("application/octet-stream","external-image-not-fetched"),u.push(d(!1));continue}let w=b.bytes,g=J(w),h=zt[g.format],_=B(w);if(r.set(_,w),!Xt.has(g.format)){let f=g.format==="gif"||g.format==="bmp"||g.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";p(h,f,{blob:_}),u.push(d(!1));continue}if(g.width===void 0||g.height===void 0||g.width*g.height>Kt){p(h,"undecodable",{blob:_}),u.push(d(!1));continue}let y;if(g.format==="png"||g.format==="jpeg"){let f=F(w,g.format);if(f===null){p(h,"undecodable",{blob:_}),u.push(d(!1));continue}y=M(f.data,{width:f.width,height:f.height,channels:f.channels})}if(g.width<Ke||g.height<Ke){p(h,"below-dimension-floor",{blob:_,appearance:y}),u.push(d(!1));continue}let m=l.get(_);if(m!==void 0){p(h,"duplicate",{blob:_,appearance:y,duplicate_of:m}),u.push(d(!1));continue}if(w.byteLength>Yt){p(h,"image-too-large",{blob:_,appearance:y}),u.push(d(!1));continue}if(o+w.byteLength>Wt){p(h,"vision-byte-budget-reached",{blob:_,appearance:y}),u.push(d(!1));continue}if(s.length>=Gt){p(h,"image-cap-reached",{blob:_,appearance:y}),u.push(d(!1));continue}l.set(_,a),o+=w.byteLength,s.push(a),p(h,"selected",{blob:_,appearance:y}),u.push(d(!0))}return{inventory:e,blobs:r,delivered:s,lines:u}}function Zt(t){let n=new Set,e=[];for(let r of t.match(Ht)??[])n.has(r)||(n.add(r),e.push(r));return e}function ze(t){return async n=>{let e;try{e=JSON.parse(n.toString("utf8"))}catch{throw new Error("LINEAR_ENVELOPE_SCHEMA: source bytes are not a kane linear envelope")}if(e.schema!==oe)throw new Error(`LINEAR_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${oe}`);let r=[],s=new Set;for(let a of Zt(e.content.description))s.add(a),r.push({url:a,label:a,loc:`body:${a}`});let o=[];for(let a of e.attachments)if(a.url.startsWith(We)){if(s.has(a.url)){if(a.filename!==""){let d=r.find(p=>p.url===a.url);d!==void 0&&d.label===d.url&&(d.label=a.filename)}continue}s.add(a.url),r.push({url:a.url,label:a.filename||a.url,loc:`attachment:${a.filename||a.url}`})}else a.url!==""&&o.push(`[${o.length+1}] ${a.filename||a.url} \u2014 ${a.url}`);let l=Math.max(0,r.length-se),u=await He(r.slice(0,se),t.fetchAttachment);l>0&&u.lines.push(`${l} more upload links not examined`);let i=[];i.push(`${e.issue.key} \xB7 ${e.site}`,`Title: ${e.content.title}`),e.content.description!==""&&i.push("",...e.content.description.split(`
|
|
10
|
+
`,inventory:s,blobs:o,delivered:l,converter:{name:"confluence-convert",version:"1",policy:"v1"}}}}var xt=/^[A-Za-z0-9~][A-Za-z0-9._~-]*$/;function re(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.indexOf("wiki");if(r===-1||e[r+1]!=="spaces"||e[r+3]!=="pages")return null;let s=e[r+2],o=e[r+4];return s===void 0||o===void 0||!xt.test(s)||!/^\d+$/.test(o)?null:{site:n.hostname,spaceKey:s,pageId:o}}async function Dt(t,n,e,r,s){let o=re(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Confluence page URL (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)`),{code:1};let l=s?.lis??{jiraInfo:H,jiraIssue:z,jiraAttachment:Z,jiraComments:X},u=s?.confluence??{confluenceDocument:Ne,confluenceAttachment:Te};try{let c={auth:await(s?.authEnv??(await import("./auth-D4BDPJPR.js")).resolveLisAuthEnv)(),env:process.env},a=await l.jiraInfo(c);if(!a.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${A} and retry`),{code:1};if(a.capabilities.document===!1)return(e.err??e.out)(`error: ${t}: the connection has no Confluence access \u2014 reconnect with Confluence at ${A} and retry`),{code:1};let d=await u.confluenceDocument(o.pageId,c),p=o.site;if(d.url)try{p=new URL(d.url).hostname}catch{}let{bytes:b,warnings:w}=Pe(d,p),g=n??`page-${o.pageId}`;N(g);let h=P(r,g,"confluence");if(h!==null)return(e.err??e.out)(`error: ${t}: ${h}`),{code:1};let _=te(r,g);if(_!==null&&_!==p)return(e.err??e.out)(`error: ${t}: source '${g}' was ingested from ${_}, but this read serves ${p} \u2014 retire it first (kane-cli context retire ${g}) or ingest under a different id with --as`),{code:1};let y=Object.fromEntries((d.attachments??[]).filter(f=>typeof f.download=="string"&&f.download.length>0).map(f=>[String(f.id),f.download])),m=await T({contextDir:r,bytes:b,media:ye,sourceId:g,label:t,confirmSameSource:e.isTTY?f=>e.confirm(`identical content already ingested as ${f} \u2014 treat as the same source?`):void 0,converters:{confluence:xe({downloads:y,fetchAttachment:f=>u.confluenceAttachment(f.download,c)})}});e.out(U(e.isTTY,m,`${o.spaceKey}/${o.pageId}`));for(let f of w)e.out(`warning: ${f}`);for(let f of m.warnings??[])e.out(`warning: ${f}`);if(m.composite){let f=m.composite.delivered+m.composite.omitted;e.out(`${m.source_id}: confluence, ${f} attachments, ${m.composite.delivered} images delivered (${m.composite.omitted} omitted)`)}return{code:0,result:{status:m.status,source_id:m.source_id,source_cid:m.cid,...m.gitignore?{gitignore:m.gitignore}:{}}}}catch(i){return i instanceof E?((e.err??e.out)(`error: ${t}: ${i.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${jt(i instanceof Error?i.message:String(i))}`),{code:1})}}function jt(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the page in Confluence and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page's text is too large to ingest \u2014 trim the page in Confluence and retry":t}var De={name:"confluence",hint:"Confluence page URLs (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)",match:t=>re(t)!==null,ingest:Dt,sourceIdFor:t=>{let n=re(t);return n?`page-${n.pageId}`:null}};async function je(t={}){let n=await $("/linear-app/info",{method:"GET"},t);if(!n.ok)throw S(n,"the connection","Linear");let e=C(n);return{installed:e.data?.INSTALLED==="YES",capabilities:{issue:e.data?.capabilities?.issue===!0,comments:e.data?.capabilities?.comments===!0,document:e.data?.capabilities?.document===!0}}}async function Be(t,n={}){let e=await $("/linear-app/issue?details=true",{method:"POST",body:JSON.stringify({plugin_code:"linear-app",issueKey:t})},n);if(!e.ok)throw S(e,"the issue","Linear");let r=C(e);if(r.type==="error"||!r.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue: ${k(r.message??"")||"issue not found or not accessible"}`);return r.data}var Bt=100,Mt=5e3,Jt=60;async function Me(t,n={}){let e=[],r=new Set,s=null;for(let o=0;;o++){if(o>=Jt)throw new E("LIS_UNAVAILABLE","the integrations service kept returning comment pages without finishing \u2014 retry later");let l=await $("/linear-app/issue/comments",{method:"POST",body:JSON.stringify({resource_id:t,max_results:Bt,...s===null?{}:{cursor:s},fetch_all:!1})},n);if(!l.ok)throw S(l,"the issue's comments","Linear");let u=C(l);if(u.type==="error"||!u.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue's comments: ${k(u.message??"")||"unavailable"}`);if(u.data.partial)throw new E("JIRA_ISSUE_UNAVAILABLE","the integrations service returned an incomplete comment set \u2014 retry later");for(let a of u.data.comments??[]){if(typeof a.id!="string"||a.id==="")throw new E("JIRA_ISSUE_UNAVAILABLE","the integrations service returned an incomplete comment set \u2014 a comment row has no comment id");r.has(a.id)||(r.add(a.id),e.push(a))}let i=u.data.pagination;if(!i?.has_more)return e;if(e.length>=Mt)throw new E("JIRA_ISSUE_UNAVAILABLE","the issue has more comments than can be ingested \u2014 cannot build a complete identity");let c=i.next_cursor??null;if(c==null||c===s)throw new E("LIS_UNAVAILABLE","the integrations service returned a non-advancing comments page \u2014 retry later");s=c}}async function Je(t,n={}){let e=await $("/linear-app/document",{method:"POST",body:JSON.stringify({resource_id:t,format:"markdown"})},n);if(!e.ok)throw S(e,"the document","Linear");let r=C(e);if(r.type==="error"||!r.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the document: ${k(r.message??"")||"document not found or not accessible"}`);return r.data}async function Fe(t,n={}){let e=await $("/linear-app/attachment",{method:"POST",body:JSON.stringify({attachment_id:t})},n);if(!e.ok)throw S(e,"the attachment","Linear");return{bytes:V(e).bytes}}var oe="kane.source.linear/1",ie="kane.source.linear-doc/1",Ft=/https:\/\/uploads\.linear\.app\/[^\s)"'`]+/g;function G(t){return t.replace(Ft,n=>{let e=n.indexOf("?");return e===-1?n:n.slice(0,e)})}function Ve(t,n){return t.id<n.id?-1:t.id>n.id?1:0}function Vt(t,n){return Ve(t,n)||(t.filename<n.filename?-1:t.filename>n.filename?1:0)||(t.url<n.url?-1:t.url>n.url?1:0)}function Ge(t,n,e){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this issue \u2014 the integrations service returned no issue id");let r=t.key;if(!/^[A-Za-z][A-Za-z0-9]*-\d+$/.test(r)){let c=String(r).replace(/[\u0000-\u001f\u007f-\u009f]/g,"").slice(0,80);throw new Error(`cannot build a stable identity for issue key "${c}" \u2014 expected a TEAM-NUMBER key`)}let s={},o=[...t.labels??[]].filter(c=>typeof c=="string").sort();o.length>0&&(s.labels=o.join(", ")),typeof t.priority=="string"&&t.priority!==""&&(s.priority=t.priority),typeof t.project=="string"&&t.project!==""&&(s.project=t.project),typeof t.status=="string"&&t.status!==""&&(s.status=t.status);let l=(t.attachments??[]).map(c=>({id:c.id!=null&&String(c.id)!==""?String(c.id):G(c.download??""),filename:c.filename??"",url:G(c.download??"")})).sort(Vt),u=n.map(c=>({id:String(c.id),author:c.author?.display_name??"",body:G(c.body??""),created:c.created??""})).sort((c,a)=>c.created!==a.created?c.created<a.created?-1:1:Ve(c,a)),i={schema:oe,site:e,team:r.slice(0,r.lastIndexOf("-")),issue:{uuid:t.id,key:r},content:{title:t.summary??"",description:G(t.description??""),fields:s},attachments:l,comments:u};return{bytes:Buffer.from(JSON.stringify(i),"utf8"),envelope:i,warnings:[]}}function Ye(t,n,e){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this document \u2014 the integrations service returned no document id");let r=(t.attachments??[]).map(o=>({url:G(o.download??String(o.id??"")),filename:o.filename??""})).sort((o,l)=>o.url<l.url?-1:o.url>l.url?1:0),s={schema:ie,site:n,document:{uuid:t.id,slug_id:e},project:{id:t.space?.key??""},title:t.title??"",content:{body:G(t.body??"")},attachments:r};return{bytes:Buffer.from(JSON.stringify(s),"utf8"),envelope:s,warnings:[]}}var Ke=64,Gt=16,Yt=6e6,Kt=5e7,Wt=12e6,se=64,We="https://uploads.linear.app/",Ht=/https:\/\/uploads\.linear\.app\/[^\s)"'`]+/g,zt={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},Xt=new Set(["png","jpeg","webp"]);async function He(t,n){let e=[],r=new Map,s=[],o=0,l=new Map,u=[];for(let i=0;i<t.length;i++){let c=t[i],a=`i${i+1}`,d=f=>`[img#${a}] ${c.label}${f?"":" \u2014 not delivered"}`,p=(f,I,L)=>{e.push({ref:a,loc:c.loc,media_type:f,...L?.blob?{blob:L.blob}:{},...L?.appearance?{appearance:L.appearance}:{},delivery:I,...L?.duplicate_of?{duplicate_of:L.duplicate_of}:{}})},b;try{b=await n(c.url)}catch{p("application/octet-stream","external-image-not-fetched"),u.push(d(!1));continue}let w=b.bytes,g=J(w),h=zt[g.format],_=B(w);if(r.set(_,w),!Xt.has(g.format)){let f=g.format==="gif"||g.format==="bmp"||g.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";p(h,f,{blob:_}),u.push(d(!1));continue}if(g.width===void 0||g.height===void 0||g.width*g.height>Kt){p(h,"undecodable",{blob:_}),u.push(d(!1));continue}let y;if(g.format==="png"||g.format==="jpeg"){let f=F(w,g.format);if(f===null){p(h,"undecodable",{blob:_}),u.push(d(!1));continue}y=M(f.data,{width:f.width,height:f.height,channels:f.channels})}if(g.width<Ke||g.height<Ke){p(h,"below-dimension-floor",{blob:_,appearance:y}),u.push(d(!1));continue}let m=l.get(_);if(m!==void 0){p(h,"duplicate",{blob:_,appearance:y,duplicate_of:m}),u.push(d(!1));continue}if(w.byteLength>Yt){p(h,"image-too-large",{blob:_,appearance:y}),u.push(d(!1));continue}if(o+w.byteLength>Wt){p(h,"vision-byte-budget-reached",{blob:_,appearance:y}),u.push(d(!1));continue}if(s.length>=Gt){p(h,"image-cap-reached",{blob:_,appearance:y}),u.push(d(!1));continue}l.set(_,a),o+=w.byteLength,s.push(a),p(h,"selected",{blob:_,appearance:y}),u.push(d(!0))}return{inventory:e,blobs:r,delivered:s,lines:u}}function Zt(t){let n=new Set,e=[];for(let r of t.match(Ht)??[])n.has(r)||(n.add(r),e.push(r));return e}function ze(t){return async n=>{let e;try{e=JSON.parse(n.toString("utf8"))}catch{throw new Error("LINEAR_ENVELOPE_SCHEMA: source bytes are not a kane linear envelope")}if(e.schema!==oe)throw new Error(`LINEAR_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${oe}`);let r=[],s=new Set;for(let a of Zt(e.content.description))s.add(a),r.push({url:a,label:a,loc:`body:${a}`});let o=[];for(let a of e.attachments)if(a.url.startsWith(We)){if(s.has(a.url)){if(a.filename!==""){let d=r.find(p=>p.url===a.url);d!==void 0&&d.label===d.url&&(d.label=a.filename)}continue}s.add(a.url),r.push({url:a.url,label:a.filename||a.url,loc:`attachment:${a.filename||a.url}`})}else a.url!==""&&o.push(`[${o.length+1}] ${a.filename||a.url} \u2014 ${a.url}`);let l=Math.max(0,r.length-se),u=await He(r.slice(0,se),t.fetchAttachment);l>0&&u.lines.push(`${l} more upload links not examined`);let i=[];i.push(`${e.issue.key} \xB7 ${e.site}`,`Title: ${e.content.title}`),e.content.description!==""&&i.push("",...e.content.description.split(`
|
|
11
11
|
`));let c=Object.keys(e.content.fields);return c.length>0&&i.push("","--- fields ---",...c.map(a=>`${a}: ${e.content.fields[a]}`)),u.lines.length>0&&i.push("","--- images ---",...u.lines),o.length>0&&i.push("","--- links ---",...o),e.comments.length>0&&(i.push("","--- comments ---"),e.comments.forEach((a,d)=>{d>0&&i.push(""),i.push(`[${d+1}] ${a.author} \xB7 ${a.created}`,...a.body.split(`
|
|
12
12
|
`))})),{projection:i.join(`
|
|
13
13
|
`)+`
|
|
14
14
|
`,inventory:u.inventory,blobs:u.blobs,delivered:u.delivered,converter:{name:"linear-convert",version:"1",policy:"v1"}}}}function Xe(t){return async n=>{let e;try{e=JSON.parse(n.toString("utf8"))}catch{throw new Error("LINEAR_DOC_ENVELOPE_SCHEMA: source bytes are not a kane linear document envelope")}if(e.schema!==ie)throw new Error(`LINEAR_DOC_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${ie}`);let r=new Set,s=[];for(let i of e.attachments)!i.url.startsWith(We)||r.has(i.url)||(r.add(i.url),s.push({url:i.url,label:i.filename||i.url,loc:`body:${i.url}`}));let o=Math.max(0,s.length-se),l=await He(s.slice(0,se),t.fetchAttachment);o>0&&l.lines.push(`${o} more upload links not examined`);let u=[];return u.push(`${e.title} \xB7 ${e.site}`),e.content.body!==""&&u.push("",...e.content.body.split(`
|
|
15
15
|
`)),l.lines.length>0&&u.push("","--- images ---",...l.lines),{projection:u.join(`
|
|
16
16
|
`)+`
|
|
17
|
-
`,inventory:l.inventory,blobs:l.blobs,delivered:l.delivered,converter:{name:"linear-doc-convert",version:"1",policy:"v1"}}}}var qt=/^[A-Za-z][A-Za-z0-9]*-\d+$/,Qt=/-([0-9a-f]{12})$/;function ue(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}return n.hostname.toLowerCase()!=="linear.app"?null:n.pathname.split("/").filter(Boolean)}function Ze(t){let n=ue(t);return n===null||n.length<3?null:{workspace:n[0],segs:n}}function Y(t){let n=Ze(t);if(n===null||n.segs[1]!=="issue")return null;let e=n.segs[2];return qt.test(e)?{workspace:n.workspace,key:e}:null}function K(t){let n=Ze(t);if(n===null||n.segs[1]!=="document")return null;let e=n.segs[2].match(Qt);return e===null?null:{workspace:n.workspace,slugId:e[1]}}var en=new Set(["project","team","view","initiative","cycle","roadmap","inbox","triage","my-issues"]),qe=new Set(["docs","features","method","blog","customers","pricing","integrations","developers","changelog","about","careers","security","download","contact","now","switch","homepage"]);function le(t){let n=ue(t);return n===null||n.length<2||!en.has(n[1])||qe.has(n[0].toLowerCase())?null:{workspace:n[0],section:n[1]}}function de(t){let n=ue(t);return n===null||n.length<2||n[1]!=="issue"&&n[1]!=="document"||qe.has(n[0].toLowerCase())||Y(t)!==null||K(t)!==null?null:{workspace:n[0],section:n[1]}}function Qe(t){let n=Y(t);return n?n.key.toLowerCase():null}function et(t){let n=K(t);return n?`doc-${n.slugId}`:null}var tt={linearInfo:je,linearIssue:Be,linearComments:Me,linearDocument:Je,linearAttachment:Fe};function nt(t,n){if(t)try{let e=new URL(t).pathname.split("/").filter(Boolean)[0];if(e)return`linear.app/${e.toLowerCase()}`}catch{}return`linear.app/${n.toLowerCase()}`}function rt(t,n,e,r,s,o){let l=ee(t,r);if(l!==null&&typeof l.schema=="string"&&l.schema.startsWith(`kane.source.${n}/`)){let i=l;for(let c of e)i=i!==null&&typeof i=="object"?i[c]:void 0;if(typeof i=="string"&&i!==""&&i!==s)return`source '${r}' was ingested from a different ${o} that used this key \u2014 the key was recycled; retire it first (kane-cli context retire ${r}) or ingest under a different id with --as`}let u=ke(t,n,e,s);return u!==null&&u!==r?`this ${o} is already ingested as '${u}' (its key changed) \u2014 reconcile that source, or retire it to re-ingest under the new key`:null}function ot(t,n,e,r){let s=ee(t,e);if(s===null||typeof s.schema!="string"||!s.schema.startsWith(`kane.source.${n}/`))return null;let o=s.site;return typeof o!="string"||o.length===0||o===r?null:`source '${e}' was ingested from ${o}, but this read serves ${r} \u2014 retire it first (kane-cli context retire ${e}) or ingest under a different id with --as`}async function tn(t,n,e,r,s){let o=Y(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Linear issue URL (https://linear.app/<workspace>/issue/KEY-123)`),{code:1};let l=s?.linear??tt;try{let i={auth:await(s?.authEnv??(await import("./auth-TAT427C3.js")).resolveLisAuthEnv)(),env:process.env},c=await l.linearInfo(i);if(!c.installed)return(e.err??e.out)(`error: ${t}: no Linear connection for this account \u2014 create one at ${A} and retry`),{code:1};if(c.capabilities.issue===!1||c.capabilities.comments===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read issues or their comments yet \u2014 resync it at ${A} and retry`),{code:1};let a=await l.linearIssue(o.key,i),d=await l.linearComments(o.key,i),p=nt(a.host,o.workspace),{bytes:b,envelope:w,warnings:g}=Ge(a,d,p),h=n??o.key.toLowerCase();N(h);let _=rt(r,"linear",["issue","uuid"],h,w.issue.uuid,"issue")??P(r,h,"linear")??ot(r,"linear",h,p);if(_!==null)return(e.err??e.out)(`error: ${t}: ${_}`),{code:1};let y=await T({contextDir:r,bytes:b,media:Ee,sourceId:h,label:t,confirmSameSource:e.isTTY?m=>e.confirm(`identical content already ingested as ${m} \u2014 treat as the same source?`):void 0,converters:{linear:ze({fetchAttachment:m=>l.linearAttachment(m,i)})}});e.out(U(e.isTTY,y,w.issue.key));for(let m of g)e.out(`warning: ${m}`);for(let m of y.warnings??[])e.out(`warning: ${m}`);if(y.composite){let m=y.composite.delivered+y.composite.omitted;e.out(`${y.source_id}: linear, ${m} images, ${y.composite.delivered} delivered (${y.composite.omitted} omitted)`)}return{code:0,result:{status:y.status,source_id:y.source_id,source_cid:y.cid,...y.gitignore?{gitignore:y.gitignore}:{}}}}catch(u){return u instanceof E?((e.err??e.out)(`error: ${t}: ${u.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${it(u instanceof Error?u.message:String(u),"issue","Linear")}`),{code:1})}}async function nn(t,n,e,r,s){let o=K(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Linear document URL (https://linear.app/<workspace>/document/<slug>)`),{code:1};let l=s?.linear??tt;try{let i={auth:await(s?.authEnv??(await import("./auth-TAT427C3.js")).resolveLisAuthEnv)(),env:process.env},c=await l.linearInfo(i);if(!c.installed)return(e.err??e.out)(`error: ${t}: no Linear connection for this account \u2014 create one at ${A} and retry`),{code:1};if(c.capabilities.document===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read documents yet \u2014 resync it at ${A} and retry`),{code:1};let a=await l.linearDocument(o.slugId,i),d=nt(a.url,o.workspace),{bytes:p,envelope:b,warnings:w}=Ye(a,d,o.slugId),g=n??`doc-${o.slugId}`;N(g);let h=rt(r,"linear-doc",["document","uuid"],g,b.document.uuid,"document")??P(r,g,"linear-doc")??ot(r,"linear-doc",g,d);if(h!==null)return(e.err??e.out)(`error: ${t}: ${h}`),{code:1};let _=await T({contextDir:r,bytes:p,media:_e,sourceId:g,label:t,confirmSameSource:e.isTTY?y=>e.confirm(`identical content already ingested as ${y} \u2014 treat as the same source?`):void 0,converters:{linearDoc:Xe({fetchAttachment:y=>l.linearAttachment(y,i)})}});e.out(U(e.isTTY,_,b.title||`document ${o.slugId}`));for(let y of w)e.out(`warning: ${y}`);for(let y of _.warnings??[])e.out(`warning: ${y}`);if(_.composite){let y=_.composite.delivered+_.composite.omitted;e.out(`${_.source_id}: linear document, ${y} images, ${_.composite.delivered} delivered (${_.composite.omitted} omitted)`)}return{code:0,result:{status:_.status,source_id:_.source_id,source_cid:_.cid,..._.gitignore?{gitignore:_.gitignore}:{}}}}catch(u){return u instanceof E?((e.err??e.out)(`error: ${t}: ${u.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${it(u instanceof Error?u.message:String(u),"document","Linear")}`),{code:1})}}function it(t,n,e){let r=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return r?`the ${n}'s content is too large to ingest (${r[1]}; the limit is ${r[2]}) \u2014 trim the ${n} in ${e} and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?`the ${n}'s text is too large to ingest \u2014 trim the ${n} in ${e} and retry`:t}var st={name:"linear",hint:"Linear issue URLs (https://linear.app/<workspace>/issue/KEY-123)",match:t=>Y(t)!==null,ingest:tn,sourceIdFor:Qe},at={name:"linear-doc",hint:"Linear document URLs (https://linear.app/<workspace>/document/<slug>)",match:t=>K(t)!==null,ingest:nn,sourceIdFor:et},ct={name:"linear-page",hint:"Linear issue or document URLs (other linear.app pages are not ingestable)",match:t=>le(t)!==null||de(t)!==null,ingest:async(t,n,e)=>{let r=le(t);if(r===null){let s=de(t);return s!==null?((e.err??e.out)(`error: ${t}: this Linear ${s.section} link is incomplete or malformed \u2014 use the full form (https://linear.app/${s.workspace}/issue/KEY-123 or https://linear.app/${s.workspace}/document/<slug>-<id>)`),{code:1}):((e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Linear workspace page`),{code:1})}return(e.err??e.out)(`error: ${t}: this Linear page can't be ingested \u2014 only issue and document URLs are supported; ingest the project's issues or documents individually (https://linear.app/${r.workspace}/issue/KEY-123)`),{code:1}},sourceIdFor:()=>null};var rn=new Set(["invalid_url","target_disallowed","page_not_found","page_access_blocked","page_paywalled","unsupported_content_type","page_too_large","page_timeout","scrape_unavailable","scrape_rate_limited","internal_error","credit_denied"]);async function ut(t,n){let e=n.env??process.env,r=n.fetchImpl??fetch,s=we(e),o={"Content-Type":"application/json"},l=await n.authEnv(),u=l.TESTMUAI_BASIC_AUTH??e.TESTMUAI_BASIC_AUTH,i=l.TESTMUAI_API_KEY??e.TESTMUAI_API_KEY;u?o.Authorization=`Basic ${u}`:i&&(o.Authorization=`Bearer ${i}`);let c;try{c=await r(`${s}/assurance/web/scrape`,{method:"POST",headers:o,body:JSON.stringify({url:t}),signal:AbortSignal.timeout(n.timeoutMs??55e3)})}catch{return{ok:!1,kind:"transport_unreachable"}}if(c.status===401)return{ok:!1,kind:"auth_rejected"};let a;try{a=await c.json()}catch{return{ok:!1,kind:c.status===404?"route_missing":"malformed_response"}}if(c.ok){let p=a.page;return p===void 0||typeof p.markdown!="string"||p.markdown===""||typeof p.final_url!="string"||p.final_url===""||typeof p.projection?.kind!="string"||typeof p.projection?.version!="string"?{ok:!1,kind:"malformed_response"}:{ok:!0,page:p}}let d=a.code;return typeof d=="string"&&rn.has(d)?{ok:!1,kind:d}:c.status===404?{ok:!1,kind:"route_missing"}:c.status===403?{ok:!1,kind:"auth_rejected"}:{ok:!1,kind:"malformed_response"}}var pe="kane.source.web/1";function lt(t,n,e){if(e==="")throw new Error("cannot build a web source from an empty page projection");if(n.kind===""||n.version==="")throw new Error("cannot build a stable identity without a server-reported projection kind/version");let r={schema:pe,url:t,projection:{kind:n.kind,version:n.version},content:{markdown:e}};return{bytes:Buffer.from(JSON.stringify(r),"utf8"),envelope:r}}var on=new Set(["markdown"]);function dt(){return async t=>{let n;try{n=JSON.parse(t.toString("utf8"))}catch{throw new Error("this web source's stored envelope is not readable \u2014 re-ingest the page")}if(n.schema!==pe)throw new Error(`unknown web envelope schema '${String(n.schema)}' \u2014 re-ingest the page with this CLI version`);if(!on.has(n.projection?.kind??""))throw new Error(`unknown web projection kind '${String(n.projection?.kind)}' \u2014 update kane-cli to read this source`);if(typeof n.content?.markdown!="string"||n.content.markdown==="")throw new Error("this web source's stored envelope carries no content \u2014 re-ingest the page");return{projection:n.content.markdown,inventory:[],blobs:new Map,delivered:[],converter:{name:"web-convert",version:"1",policy:"markdown-passthrough"}}}}import{createHash as sn}from"crypto";function pt(t){return ae(t)!==null}function ae(t){if(!/^https?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}return n.hostname===""?null:(n.hash="",n.username="",n.password="",n.toString())}function me(t){let n=ae(t);if(n===null)return null;let e=new URL(n),r=(e.hostname+e.pathname).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40).replace(/-+$/,""),s=sn("sha256").update(n,"utf8").digest("hex").slice(0,8);return`${r||"page"}-${s}`}function an(t,n){let e=j(t),r=e.heads.get(n);if(r==null)return null;let s=e.getNode(r)?.content?.blob;if(typeof s!="string")return null;let o=W(t,s);if(o===null)return null;try{let l=JSON.parse(o.toString("utf8"));return l.schema!=="kane.source.web/1"?null:typeof l.url=="string"&&l.url.length>0?l.url:null}catch{return null}}function fe(t){switch(t){case"invalid_url":return"this is not a valid public HTTP or HTTPS page URL \u2014 check the address and try again";case"target_disallowed":return"that address cannot be fetched because it does not point to an allowed public web page";case"page_not_found":return"the page could not be found \u2014 check that the URL is correct and that the page still exists";case"page_access_blocked":return"the page refused automated access, so its contents could not be ingested \u2014 use a publicly accessible version of the page";case"page_paywalled":return"the page is behind a paywall or sign-in screen, so its full contents could not be ingested \u2014 use a publicly accessible copy";case"unsupported_content_type":return"the URL does not point to an HTML web page \u2014 download the document and ingest the supported file instead";case"page_too_large":return"the page contains too much text to ingest as a single source \u2014 use a narrower page or trim the content first";case"page_timeout":return"the page took too long to load \u2014 try again later";case"scrape_unavailable":case"scrape_rate_limited":case"internal_error":return"the page ingest service is temporarily unavailable \u2014 try again later";case"credit_denied":return"the page could not be ingested \u2014 your organization is out of credits";case"auth_rejected":return"your credentials were rejected \u2014 run `kane-cli login` and retry";case"route_missing":return"ingesting web pages is not available in your environment yet \u2014 nothing is wrong with the URL; try again later";case"transport_unreachable":return"the page ingest service could not be reached \u2014 check your connection and try again";case"malformed_response":return"the page ingest service returned a response that could not be read safely \u2014 try again later"}}function cn(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page contains too much text to ingest as a single source (${n[1]}; the limit is ${n[2]}) \u2014 use a narrower page or trim the content first`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page contains too much text to ingest as a single source \u2014 use a narrower page or trim the content first":t}async function un(t,n,e,r,s){let o=ae(t);if(o===null)return(e.err??e.out)(`error: ${t}: ${fe("invalid_url")}`),{code:1};let l=me(t),u=n??l;if(u===null)return(e.err??e.out)(`error: ${t}: ${fe("invalid_url")}`),{code:1};try{N(u)}catch(b){return(e.err??e.out)(`error: ${t}: ${b instanceof Error?b.message:String(b)}`),{code:1}}let i=P(r,u,"web");if(i!==null)return(e.err??e.out)(`error: ${t}: ${i}`),{code:1};let c=an(r,u);if(c!==null&&c!==o){if(!e.isTTY)return(e.err??e.out)(`error: ${t}: source '${u}' was ingested from ${c} \u2014 re-run on a TTY to adopt the new URL as its next version, or ingest under a different id with --as`),{code:1};if(!await e.confirm(`source '${u}' was ingested from ${c} \u2014 treat ${o} as its new version (replaces the current version; items built on it go stale)?`))return e.out(`skipped ${t} \u2014 ingest under a different id with --as to keep both pages`),{code:1}}let a=s?.web?.scrape??ut,d=s?.authEnv??(async()=>(await import("./spawner-H6IDWY5U.js")).resolveAgentAuthEnv()),p=await a(o,{authEnv:d});if(!p.ok)return(e.err??e.out)(`error: ${t}: ${fe(p.kind)}`),{code:1};try{let{bytes:b}=lt(o,p.page.projection,p.page.markdown),w=await T({contextDir:r,bytes:b,media:be,sourceId:u,label:o,confirmSameSource:e.isTTY?h=>e.confirm(`identical content already ingested as ${h} \u2014 treat as the same source?`):void 0,converters:{web:dt()}}),g=new URL(o).hostname+new URL(o).pathname;e.out(U(e.isTTY,w,g));for(let h of w.warnings??[])e.out(`warning: ${h}`);return e.isTTY&&p.page.title&&e.out(` title: ${p.page.title}`),{code:0,result:{status:w.status,source_id:w.source_id,source_cid:w.cid,...w.gitignore?{gitignore:w.gitignore}:{}}}}catch(b){return(e.err??e.out)(`error: ${t}: ${cn(b instanceof Error?b.message:String(b))}`),{code:1}}}var mt={name:"web",hint:"any public web page URL (https://\u2026)",match:pt,ingest:un,sourceIdFor:me};function U(t,n,e){return t?n.status==="created"?`landed ${n.source_id} (${e}) \u2014 new source`:n.status==="versioned"?`landed ${n.source_id} (${e}) \u2014 new version; dependents go stale`:`${n.source_id} unchanged \u2014 already landed`:`${n.status} ${n.source_id} source ${n.cid} blob ${n.blob}`}var ln=[Oe,De,st,at,ct,mt];function Kr(t){return/^https?:\/\/.+/i.test(t)}function Wr(t){return ln.find(n=>n.match(t))??null}export{U as a,ln as b,Kr as c,Wr as d};
|
|
17
|
+
`,inventory:l.inventory,blobs:l.blobs,delivered:l.delivered,converter:{name:"linear-doc-convert",version:"1",policy:"v1"}}}}var qt=/^[A-Za-z][A-Za-z0-9]*-\d+$/,Qt=/-([0-9a-f]{12})$/;function ue(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}return n.hostname.toLowerCase()!=="linear.app"?null:n.pathname.split("/").filter(Boolean)}function Ze(t){let n=ue(t);return n===null||n.length<3?null:{workspace:n[0],segs:n}}function Y(t){let n=Ze(t);if(n===null||n.segs[1]!=="issue")return null;let e=n.segs[2];return qt.test(e)?{workspace:n.workspace,key:e}:null}function K(t){let n=Ze(t);if(n===null||n.segs[1]!=="document")return null;let e=n.segs[2].match(Qt);return e===null?null:{workspace:n.workspace,slugId:e[1]}}var en=new Set(["project","team","view","initiative","cycle","roadmap","inbox","triage","my-issues"]),qe=new Set(["docs","features","method","blog","customers","pricing","integrations","developers","changelog","about","careers","security","download","contact","now","switch","homepage"]);function le(t){let n=ue(t);return n===null||n.length<2||!en.has(n[1])||qe.has(n[0].toLowerCase())?null:{workspace:n[0],section:n[1]}}function de(t){let n=ue(t);return n===null||n.length<2||n[1]!=="issue"&&n[1]!=="document"||qe.has(n[0].toLowerCase())||Y(t)!==null||K(t)!==null?null:{workspace:n[0],section:n[1]}}function Qe(t){let n=Y(t);return n?n.key.toLowerCase():null}function et(t){let n=K(t);return n?`doc-${n.slugId}`:null}var tt={linearInfo:je,linearIssue:Be,linearComments:Me,linearDocument:Je,linearAttachment:Fe};function nt(t,n){if(t)try{let e=new URL(t).pathname.split("/").filter(Boolean)[0];if(e)return`linear.app/${e.toLowerCase()}`}catch{}return`linear.app/${n.toLowerCase()}`}function rt(t,n,e,r,s,o){let l=ee(t,r);if(l!==null&&typeof l.schema=="string"&&l.schema.startsWith(`kane.source.${n}/`)){let i=l;for(let c of e)i=i!==null&&typeof i=="object"?i[c]:void 0;if(typeof i=="string"&&i!==""&&i!==s)return`source '${r}' was ingested from a different ${o} that used this key \u2014 the key was recycled; retire it first (kane-cli context retire ${r}) or ingest under a different id with --as`}let u=ke(t,n,e,s);return u!==null&&u!==r?`this ${o} is already ingested as '${u}' (its key changed) \u2014 reconcile that source, or retire it to re-ingest under the new key`:null}function ot(t,n,e,r){let s=ee(t,e);if(s===null||typeof s.schema!="string"||!s.schema.startsWith(`kane.source.${n}/`))return null;let o=s.site;return typeof o!="string"||o.length===0||o===r?null:`source '${e}' was ingested from ${o}, but this read serves ${r} \u2014 retire it first (kane-cli context retire ${e}) or ingest under a different id with --as`}async function tn(t,n,e,r,s){let o=Y(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Linear issue URL (https://linear.app/<workspace>/issue/KEY-123)`),{code:1};let l=s?.linear??tt;try{let i={auth:await(s?.authEnv??(await import("./auth-D4BDPJPR.js")).resolveLisAuthEnv)(),env:process.env},c=await l.linearInfo(i);if(!c.installed)return(e.err??e.out)(`error: ${t}: no Linear connection for this account \u2014 create one at ${A} and retry`),{code:1};if(c.capabilities.issue===!1||c.capabilities.comments===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read issues or their comments yet \u2014 resync it at ${A} and retry`),{code:1};let a=await l.linearIssue(o.key,i),d=await l.linearComments(o.key,i),p=nt(a.host,o.workspace),{bytes:b,envelope:w,warnings:g}=Ge(a,d,p),h=n??o.key.toLowerCase();N(h);let _=rt(r,"linear",["issue","uuid"],h,w.issue.uuid,"issue")??P(r,h,"linear")??ot(r,"linear",h,p);if(_!==null)return(e.err??e.out)(`error: ${t}: ${_}`),{code:1};let y=await T({contextDir:r,bytes:b,media:Ee,sourceId:h,label:t,confirmSameSource:e.isTTY?m=>e.confirm(`identical content already ingested as ${m} \u2014 treat as the same source?`):void 0,converters:{linear:ze({fetchAttachment:m=>l.linearAttachment(m,i)})}});e.out(U(e.isTTY,y,w.issue.key));for(let m of g)e.out(`warning: ${m}`);for(let m of y.warnings??[])e.out(`warning: ${m}`);if(y.composite){let m=y.composite.delivered+y.composite.omitted;e.out(`${y.source_id}: linear, ${m} images, ${y.composite.delivered} delivered (${y.composite.omitted} omitted)`)}return{code:0,result:{status:y.status,source_id:y.source_id,source_cid:y.cid,...y.gitignore?{gitignore:y.gitignore}:{}}}}catch(u){return u instanceof E?((e.err??e.out)(`error: ${t}: ${u.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${it(u instanceof Error?u.message:String(u),"issue","Linear")}`),{code:1})}}async function nn(t,n,e,r,s){let o=K(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Linear document URL (https://linear.app/<workspace>/document/<slug>)`),{code:1};let l=s?.linear??tt;try{let i={auth:await(s?.authEnv??(await import("./auth-D4BDPJPR.js")).resolveLisAuthEnv)(),env:process.env},c=await l.linearInfo(i);if(!c.installed)return(e.err??e.out)(`error: ${t}: no Linear connection for this account \u2014 create one at ${A} and retry`),{code:1};if(c.capabilities.document===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read documents yet \u2014 resync it at ${A} and retry`),{code:1};let a=await l.linearDocument(o.slugId,i),d=nt(a.url,o.workspace),{bytes:p,envelope:b,warnings:w}=Ye(a,d,o.slugId),g=n??`doc-${o.slugId}`;N(g);let h=rt(r,"linear-doc",["document","uuid"],g,b.document.uuid,"document")??P(r,g,"linear-doc")??ot(r,"linear-doc",g,d);if(h!==null)return(e.err??e.out)(`error: ${t}: ${h}`),{code:1};let _=await T({contextDir:r,bytes:p,media:_e,sourceId:g,label:t,confirmSameSource:e.isTTY?y=>e.confirm(`identical content already ingested as ${y} \u2014 treat as the same source?`):void 0,converters:{linearDoc:Xe({fetchAttachment:y=>l.linearAttachment(y,i)})}});e.out(U(e.isTTY,_,b.title||`document ${o.slugId}`));for(let y of w)e.out(`warning: ${y}`);for(let y of _.warnings??[])e.out(`warning: ${y}`);if(_.composite){let y=_.composite.delivered+_.composite.omitted;e.out(`${_.source_id}: linear document, ${y} images, ${_.composite.delivered} delivered (${_.composite.omitted} omitted)`)}return{code:0,result:{status:_.status,source_id:_.source_id,source_cid:_.cid,..._.gitignore?{gitignore:_.gitignore}:{}}}}catch(u){return u instanceof E?((e.err??e.out)(`error: ${t}: ${u.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${it(u instanceof Error?u.message:String(u),"document","Linear")}`),{code:1})}}function it(t,n,e){let r=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return r?`the ${n}'s content is too large to ingest (${r[1]}; the limit is ${r[2]}) \u2014 trim the ${n} in ${e} and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?`the ${n}'s text is too large to ingest \u2014 trim the ${n} in ${e} and retry`:t}var st={name:"linear",hint:"Linear issue URLs (https://linear.app/<workspace>/issue/KEY-123)",match:t=>Y(t)!==null,ingest:tn,sourceIdFor:Qe},at={name:"linear-doc",hint:"Linear document URLs (https://linear.app/<workspace>/document/<slug>)",match:t=>K(t)!==null,ingest:nn,sourceIdFor:et},ct={name:"linear-page",hint:"Linear issue or document URLs (other linear.app pages are not ingestable)",match:t=>le(t)!==null||de(t)!==null,ingest:async(t,n,e)=>{let r=le(t);if(r===null){let s=de(t);return s!==null?((e.err??e.out)(`error: ${t}: this Linear ${s.section} link is incomplete or malformed \u2014 use the full form (https://linear.app/${s.workspace}/issue/KEY-123 or https://linear.app/${s.workspace}/document/<slug>-<id>)`),{code:1}):((e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Linear workspace page`),{code:1})}return(e.err??e.out)(`error: ${t}: this Linear page can't be ingested \u2014 only issue and document URLs are supported; ingest the project's issues or documents individually (https://linear.app/${r.workspace}/issue/KEY-123)`),{code:1}},sourceIdFor:()=>null};var rn=new Set(["invalid_url","target_disallowed","page_not_found","page_access_blocked","page_paywalled","unsupported_content_type","page_too_large","page_timeout","scrape_unavailable","scrape_rate_limited","internal_error","credit_denied"]);async function ut(t,n){let e=n.env??process.env,r=n.fetchImpl??fetch,s=we(e),o={"Content-Type":"application/json"},l=await n.authEnv(),u=l.TESTMUAI_BASIC_AUTH??e.TESTMUAI_BASIC_AUTH,i=l.TESTMUAI_API_KEY??e.TESTMUAI_API_KEY;u?o.Authorization=`Basic ${u}`:i&&(o.Authorization=`Bearer ${i}`);let c;try{c=await r(`${s}/assurance/web/scrape`,{method:"POST",headers:o,body:JSON.stringify({url:t}),signal:AbortSignal.timeout(n.timeoutMs??55e3)})}catch{return{ok:!1,kind:"transport_unreachable"}}if(c.status===401)return{ok:!1,kind:"auth_rejected"};let a;try{a=await c.json()}catch{return{ok:!1,kind:c.status===404?"route_missing":"malformed_response"}}if(c.ok){let p=a.page;return p===void 0||typeof p.markdown!="string"||p.markdown===""||typeof p.final_url!="string"||p.final_url===""||typeof p.projection?.kind!="string"||typeof p.projection?.version!="string"?{ok:!1,kind:"malformed_response"}:{ok:!0,page:p}}let d=a.code;return typeof d=="string"&&rn.has(d)?{ok:!1,kind:d}:c.status===404?{ok:!1,kind:"route_missing"}:c.status===403?{ok:!1,kind:"auth_rejected"}:{ok:!1,kind:"malformed_response"}}var pe="kane.source.web/1";function lt(t,n,e){if(e==="")throw new Error("cannot build a web source from an empty page projection");if(n.kind===""||n.version==="")throw new Error("cannot build a stable identity without a server-reported projection kind/version");let r={schema:pe,url:t,projection:{kind:n.kind,version:n.version},content:{markdown:e}};return{bytes:Buffer.from(JSON.stringify(r),"utf8"),envelope:r}}var on=new Set(["markdown"]);function dt(){return async t=>{let n;try{n=JSON.parse(t.toString("utf8"))}catch{throw new Error("this web source's stored envelope is not readable \u2014 re-ingest the page")}if(n.schema!==pe)throw new Error(`unknown web envelope schema '${String(n.schema)}' \u2014 re-ingest the page with this CLI version`);if(!on.has(n.projection?.kind??""))throw new Error(`unknown web projection kind '${String(n.projection?.kind)}' \u2014 update kane-cli to read this source`);if(typeof n.content?.markdown!="string"||n.content.markdown==="")throw new Error("this web source's stored envelope carries no content \u2014 re-ingest the page");return{projection:n.content.markdown,inventory:[],blobs:new Map,delivered:[],converter:{name:"web-convert",version:"1",policy:"markdown-passthrough"}}}}import{createHash as sn}from"crypto";function pt(t){return ae(t)!==null}function ae(t){if(!/^https?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}return n.hostname===""?null:(n.hash="",n.username="",n.password="",n.toString())}function me(t){let n=ae(t);if(n===null)return null;let e=new URL(n),r=(e.hostname+e.pathname).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40).replace(/-+$/,""),s=sn("sha256").update(n,"utf8").digest("hex").slice(0,8);return`${r||"page"}-${s}`}function an(t,n){let e=j(t),r=e.heads.get(n);if(r==null)return null;let s=e.getNode(r)?.content?.blob;if(typeof s!="string")return null;let o=W(t,s);if(o===null)return null;try{let l=JSON.parse(o.toString("utf8"));return l.schema!=="kane.source.web/1"?null:typeof l.url=="string"&&l.url.length>0?l.url:null}catch{return null}}function fe(t){switch(t){case"invalid_url":return"this is not a valid public HTTP or HTTPS page URL \u2014 check the address and try again";case"target_disallowed":return"that address cannot be fetched because it does not point to an allowed public web page";case"page_not_found":return"the page could not be found \u2014 check that the URL is correct and that the page still exists";case"page_access_blocked":return"the page refused automated access, so its contents could not be ingested \u2014 use a publicly accessible version of the page";case"page_paywalled":return"the page is behind a paywall or sign-in screen, so its full contents could not be ingested \u2014 use a publicly accessible copy";case"unsupported_content_type":return"the URL does not point to an HTML web page \u2014 download the document and ingest the supported file instead";case"page_too_large":return"the page contains too much text to ingest as a single source \u2014 use a narrower page or trim the content first";case"page_timeout":return"the page took too long to load \u2014 try again later";case"scrape_unavailable":case"scrape_rate_limited":case"internal_error":return"the page ingest service is temporarily unavailable \u2014 try again later";case"credit_denied":return"the page could not be ingested \u2014 your organization is out of credits";case"auth_rejected":return"your credentials were rejected \u2014 run `kane-cli login` and retry";case"route_missing":return"ingesting web pages is not available in your environment yet \u2014 nothing is wrong with the URL; try again later";case"transport_unreachable":return"the page ingest service could not be reached \u2014 check your connection and try again";case"malformed_response":return"the page ingest service returned a response that could not be read safely \u2014 try again later"}}function cn(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page contains too much text to ingest as a single source (${n[1]}; the limit is ${n[2]}) \u2014 use a narrower page or trim the content first`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page contains too much text to ingest as a single source \u2014 use a narrower page or trim the content first":t}async function un(t,n,e,r,s){let o=ae(t);if(o===null)return(e.err??e.out)(`error: ${t}: ${fe("invalid_url")}`),{code:1};let l=me(t),u=n??l;if(u===null)return(e.err??e.out)(`error: ${t}: ${fe("invalid_url")}`),{code:1};try{N(u)}catch(b){return(e.err??e.out)(`error: ${t}: ${b instanceof Error?b.message:String(b)}`),{code:1}}let i=P(r,u,"web");if(i!==null)return(e.err??e.out)(`error: ${t}: ${i}`),{code:1};let c=an(r,u);if(c!==null&&c!==o){if(!e.isTTY)return(e.err??e.out)(`error: ${t}: source '${u}' was ingested from ${c} \u2014 re-run on a TTY to adopt the new URL as its next version, or ingest under a different id with --as`),{code:1};if(!await e.confirm(`source '${u}' was ingested from ${c} \u2014 treat ${o} as its new version (replaces the current version; items built on it go stale)?`))return e.out(`skipped ${t} \u2014 ingest under a different id with --as to keep both pages`),{code:1}}let a=s?.web?.scrape??ut,d=s?.authEnv??(async()=>(await import("./spawner-ABB7B5CQ.js")).resolveAgentAuthEnv()),p=await a(o,{authEnv:d});if(!p.ok)return(e.err??e.out)(`error: ${t}: ${fe(p.kind)}`),{code:1};try{let{bytes:b}=lt(o,p.page.projection,p.page.markdown),w=await T({contextDir:r,bytes:b,media:be,sourceId:u,label:o,confirmSameSource:e.isTTY?h=>e.confirm(`identical content already ingested as ${h} \u2014 treat as the same source?`):void 0,converters:{web:dt()}}),g=new URL(o).hostname+new URL(o).pathname;e.out(U(e.isTTY,w,g));for(let h of w.warnings??[])e.out(`warning: ${h}`);return e.isTTY&&p.page.title&&e.out(` title: ${p.page.title}`),{code:0,result:{status:w.status,source_id:w.source_id,source_cid:w.cid,...w.gitignore?{gitignore:w.gitignore}:{}}}}catch(b){return(e.err??e.out)(`error: ${t}: ${cn(b instanceof Error?b.message:String(b))}`),{code:1}}}var mt={name:"web",hint:"any public web page URL (https://\u2026)",match:pt,ingest:un,sourceIdFor:me};function U(t,n,e){return t?n.status==="created"?`landed ${n.source_id} (${e}) \u2014 new source`:n.status==="versioned"?`landed ${n.source_id} (${e}) \u2014 new version; dependents go stale`:`${n.source_id} unchanged \u2014 already landed`:`${n.status} ${n.source_id} source ${n.cid} blob ${n.blob}`}var ln=[Oe,De,st,at,ct,mt];function Kr(t){return/^https?:\/\/.+/i.test(t)}function Wr(t){return ln.find(n=>n.match(t))??null}export{U as a,ln as b,Kr as c,Wr as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{f}from"./chunk-XLSOQLVT.js";function k(s,n){let t=null;for(let[i,e]of s.designOf)i!==n&&s.tipOf(i)!==n||(t==null||e.seq>t.seq)&&(t={...e,designed_at_cid:i});return t}function $(s,n){let t=new Map;for(let[d,o]of s.superseded)o!=null&&t.set(o,d);let i=[n],e=n;for(;t.has(e);)e=t.get(e),i.unshift(e);return i}function w(s,n,t){let i=s.resolve(n);if(!i){let r=[...s.names.keys()].filter(m=>m.startsWith("uc-")).sort().slice(0,6);return{ok:!1,code:2,message:`unknown use-case '${n}' \u2014 no live node by that logical id or cid${r.length?` (known: ${r.join(", ")})`:""}`}}let e=i.tip;if(s.superseded.has(e)&&s.superseded.get(e)===null)return{ok:!1,code:2,message:`use-case '${n}' was removed (tombstoned) \u2014 nothing to design`};let d=s.nodeLabel.get(e);if(d!==f.USECASE)return{ok:!1,code:2,message:`'${n}' is a ${d??"missing node"}, not a use-case \u2014 design runs per use-case`};let o=s.nameOf.get(e)??s.nameOf.get(i.cid)??e.slice(0,19);if(s.trust.get(e)==="archived"){let r=s.archivedReason.get(e);return{ok:!1,code:2,message:`use-case '${o}' is archived${r?` (${r})`:""} \u2014 design runs only over live use-cases`}}let c=k(s,e);if(c==null||t)return{ok:!0};let l=$(s,e),a=l.length;if(c.designed_at_cid===e)return{ok:!1,code:2,message:`'${o}' is already designed @ v${a} \u2014 current; use --force to redesign`,wall:{kind:"already-designed",display:o,currentV:a}};let u=l.indexOf(c.designed_at_cid),g=u>=0?`v${u+1}`:"an earlier version";return{ok:!1,code:2,message:`'${o}' was designed @ ${g} \u2014 the use-case is now @ v${a} (STALE); use --force to redesign`,wall:{kind:"designed-stale",display:o,currentV:a,designedV:g}}}export{k as a,w as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as t}from"./chunk-
|
|
2
|
+
import{a as t}from"./chunk-IHD2WXKT.js";async function l(e){let o=e.credentials.expires_at,i=e.thresholdSeconds??300;if(o-Date.now()/1e3>=i)return null;let r=e.creds.loadClient(e.profile,e.env);if(!r)return null;let n=await new t(e.env).refreshToken(e.credentials.refresh_token,r.client_id),s=Math.floor(Date.now()/1e3)+n.expires_in;return e.creds.saveCredentials(e.profile,e.env,{access_token:n.access_token,refresh_token:n.refresh_token,expires_at:s,scope:n.scope}),{accessToken:n.access_token,refreshToken:n.refresh_token,expiresAt:s,scope:n.scope}}export{l as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as f,d as l}from"./chunk-
|
|
2
|
+
import{b as f,d as l}from"./chunk-3YBT4UGQ.js";import{a as p}from"./chunk-TZXXJWHA.js";function d(t,e,o){return{id:`${t}.internal`,label:e,required:!0,status:"fail",detail:o instanceof Error?o.message:String(o)}}async function k(t,e={}){let o=p();if(!o.supported)return{sections:[{platform:"host",checks:[{id:"host.platform",label:"host",required:!0,status:"fail",detail:o.reason}]}]};let n=t?f().filter(r=>r.toLowerCase()===t.toLowerCase()):f(),{managedDeps:i}=await import("./deps-bundle-CAKK3EO5.js"),s=n.flatMap(r=>r==="android"?["emulator"]:r==="ios"?["simulator"]:[]);await Promise.allSettled(s.map(r=>i().warmResolveCache(r)));let c=[];for(let r of n){let u=l(r);if(!u)continue;let a;try{a=await u.checks(e)}catch(h){a=[d(r,"toolchain check",h)]}c.push({platform:r,checks:a})}return{sections:c}}function m(t){return t==="pass"?"\u2713":t==="fail"?"\u2717":"\u2139"}function x(t){return t.charAt(0).toUpperCase()+t.slice(1)}function C(t){let e=[];if(t.sections.length===0)return"No mobile platforms are supported on this host.";for(let o of t.sections){e.length>0&&e.push(""),e.push(`${x(o.platform)} toolchain`);let n=o.checks.filter(s=>s.status!=="info"),i=new Set;for(let s of n){let c=s.detail?` \u2014 ${s.detail}`:"";if(e.push(` ${m(s.status)} ${s.label}${c}`),s.status==="fail"&&s.fixText&&!i.has(s.fixText)){i.add(s.fixText);for(let r of s.fixText.split(`
|
|
3
3
|
`))e.push(` fix: ${r}`)}}}return e.join(`
|
|
4
4
|
`)}function w(t){return t.sections.length===0?!0:t.sections.every(e=>e.checks.some(o=>o.required&&o.status==="fail"&&!o.fixedByBundle))}function b(t){for(let e of t.sections)for(let o of e.checks)if(o.required&&o.status!=="pass")return 2;return 0}export{k as a,C as b,w as c,b as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as d,g as B,k as ee}from"./chunk-YLQHY4A7.js";import{P as Z}from"./chunk-
|
|
2
|
+
import{a as d,g as B,k as ee}from"./chunk-YLQHY4A7.js";import{P as Z}from"./chunk-RDHWNSDP.js";import{b as A}from"./chunk-PHR2OSWD.js";import{createHash as Ie,randomBytes as F}from"crypto";import{mkdirSync as xe,mkdtempSync as P,rmSync as $,existsSync as ve,renameSync as ke}from"fs";import{tmpdir as j}from"os";import{join as _,dirname as ce}from"path";import{spawn as te}from"child_process";function N(n,e=process.env){let t=n.replace(/https?:\/\/[^\s/@]+:[^\s/@]+@/gi,"https://[redacted]@").replace(/(authorization\s*[:=])[^\r\n]+/gi,"$1 [redacted]"),r=e.KANE_SYNC_GIT_TOKEN;if(r)for(let i of[r,Buffer.from(`x-access-token:${r}`).toString("base64")])t=t.split(i).join("[redacted]");return t}function be(n,e){if(n.GIT_SSH_COMMAND)return re(n.GIT_SSH_COMMAND);if(!n.GIT_SSH)return e?re(e):"ssh -o BatchMode=yes"}function re(n){return/(^|\s)-o\s*BatchMode=yes(\s|$)/.test(n)?n:`${n} -o BatchMode=yes`}var _e=/^(?:ssh:\/\/|[^/\s@:]+@[^/\s:]+:)/i,ie=new Map;function Ae(n,e){let t=[e??"",n.GIT_CONFIG_GLOBAL??"",n.HOME??""].join("\0"),r=ie.get(t);return r===void 0&&(r=se(["config","--get","core.sshCommand"],n,e,12e4).then(i=>i.code===0&&i.stdout.toString().trim()||void 0,()=>{}),ie.set(t,r)),r}var ne=new Set(["fetch","push","clone","ls-remote"]);function Ce(n,e,t){if(t!==void 0)return t;if(!n.some(i=>ne.has(i)))return 12e4;let r=e.KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS;if(r!==void 0){if(!/^\d+$/.test(r)||Number(r)<60||Number(r)>3600)throw new Error("KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS must be 60 to 3600");return Number(r)*1e3}return 9e5}function Ne(n){if(n.some(t=>/^(--force(?:-with-lease|-if-includes)?(?:=|$)|--mirror(?:=|$)|--delete(?:=|$)|-f$)/.test(t)))throw new Error("Git location cannot force, mirror or delete");let e=n.indexOf("push");if(e>=0){let t=n.slice(e+1);if(t.length!==3||t[0]!=="--porcelain"||!/^[0-9a-f]{40,64}:refs\/(heads|kane\/probe)\/[A-Za-z0-9._/-]+$/.test(t[2]))throw new Error("Git location requires an exact commit SHA and explicit ref")}}var H=async(n,e={})=>{Ne(n);let t={...process.env,...e.env};for(let h of["GIT_DIR","GIT_WORK_TREE","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_CONFIG_PARAMETERS"])delete t[h];e.env?.GIT_INDEX_FILE&&(t.GIT_INDEX_FILE=e.env.GIT_INDEX_FILE);let r=[["core.autocrlf","false"],["core.eol","lf"],["core.symlinks","false"],["core.hooksPath","/dev/null"],["gc.autoDetach","false"],["gc.pruneExpire","3.days.ago"],["maintenance.auto","false"],["push.followTags","false"],["push.gpgSign","false"],["commit.gpgSign","false"]],i=t.KANE_SYNC_GIT_HTTP_POST_BUFFER;if(i!==void 0){if(!/^\d+$/.test(i)||Number(i)<1048576||Number(i)>536870912)throw new Error("KANE_SYNC_GIT_HTTP_POST_BUFFER must be 1048576 to 536870912 bytes; use it only for a proxy that rejects chunked uploads");r.push(["http.postBuffer",i])}for(let h of Object.keys(t))h.startsWith("GIT_TRACE")&&delete t[h];let s=n.find(h=>h.startsWith("https://"));if(t.KANE_SYNC_GIT_TOKEN&&s){let h=new URL(s);r.push([`http.${h.origin}${h.pathname}.extraheader`,""],[`http.${h.origin}${h.pathname}.extraheader`,`AUTHORIZATION: basic ${Buffer.from(`x-access-token:${t.KANE_SYNC_GIT_TOKEN}`).toString("base64")}`],["credential.helper",""])}for(let h of Object.keys(t))/^GIT_CONFIG_(COUNT|KEY_\d+|VALUE_\d+)$/.test(h)&&delete t[h];let a=!t.GIT_SSH_COMMAND&&!t.GIT_SSH&&n.some(h=>ne.has(h))&&n.some(h=>_e.test(h))?await Ae({...t},e.cwd):void 0;r.forEach(([h,u],g)=>{t[`GIT_CONFIG_KEY_${g}`]=h,t[`GIT_CONFIG_VALUE_${g}`]=u}),t.GIT_CONFIG_COUNT=String(r.length),t.GIT_TERMINAL_PROMPT="0",t.GCM_INTERACTIVE="never",t.GIT_ASKPASS="",t.SSH_ASKPASS="";let c=be(t,a);return c!==void 0&&(t.GIT_SSH_COMMAND=c),t.GIT_NO_REPLACE_OBJECTS="1",se(n,t,e.cwd,Ce(n,t,e.timeout),e.input)};function se(n,e,t,r,i){return new Promise((s,o)=>{let a=te("git",n,{cwd:t,env:e,windowsHide:!0,detached:process.platform!=="win32",stdio:["pipe","pipe","pipe"]}),c=[],h=0,u="",g=!1,w=()=>{if(process.platform==="win32"&&a.pid)te("taskkill",["/pid",String(a.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).on("error",()=>a.kill("SIGKILL"));else try{a.pid&&process.kill(-a.pid,"SIGKILL")}catch{a.kill("SIGKILL")}},S=setTimeout(()=>{g=!0,w()},r);a.stdout.on("data",l=>{h+=l.length,h>128*1024*1024?w():c.push(l)}),a.stderr.on("data",l=>{u.length<64e3&&(u+=l.toString())}),a.stdin.on("error",()=>{}),a.on("error",l=>{clearTimeout(S),o(new d("SYNC_GIT_REQUIRED",`Git could not start: ${N(l.message,e)}`,"Install Git 2.31 or newer, then run the command again: https://git-scm.com/downloads"))}),a.on("close",l=>{clearTimeout(S),s({code:g||h>128*1024*1024?124:l??1,stdout:Buffer.concat(c),stderr:N(g?"Git operation timed out":u,e)})}),a.stdin.end(i)})}async function oe(n=H){let e=await n(["--version"],{timeout:1e4}),t=/git version (\d+)\.(\d+)/.exec(e.stdout.toString());if(e.code||!t||+t[1]<2||+t[1]==2&&+t[2]<31)throw new d("SYNC_GIT_REQUIRED","This location needs Git 2.31 or newer.","Install or update Git, then run setup again: https://git-scm.com/downloads")}function ae(n){let e=/^([^/@:]+)@([^/:]+):/.exec(n);if(e)return{user:e[1],host:e[2]};try{let t=new URL(n);return{host:t.hostname||"the server",user:t.username||"git",port:t.port||void 0}}catch{return{host:"the server",user:"git"}}}function gt(n){let e=/^[^/@:]+@([^/:]+):/.exec(n);if(e)return e[1].toLowerCase();try{return new URL(n).hostname.toLowerCase()}catch{return""}}function Y(n,e){let{host:t,user:r,port:i}=ae(e),s=N(n).trim().split(`
|
|
3
3
|
`).slice(-2).join(" ").trim();return/Host key verification failed|REMOTE HOST IDENTIFICATION HAS CHANGED/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`this computer has not accepted ${t}'s SSH host key yet`,remedy:`in a terminal run: ssh -T ${i?`-p ${i} `:""}${r}@${t} and answer yes, then run the command again`,diagnostic:s}:/Permission denied \(publickey/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`${t} did not accept your SSH key`,remedy:"load it with ssh-add, or ask the repository owner to grant your account access",diagnostic:s}:/could not read Username|Authentication failed|Access denied|Invalid username or (password|token)|returned error: 401|returned error: 403/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`sign in is needed, or your account has no access to this repository on ${t}`,remedy:"sign in through Git, or ask the owner to grant your account access",diagnostic:s}:/Could not resolve host|Connection refused|Connection timed out|timed out|Network is unreachable|Failed to connect/i.test(n)?{code:"SYNC_LOCATION_UNREACHABLE",message:`${t} could not be reached`,remedy:"check the address and your network, then run the command again",diagnostic:s}:/not found|does not appear to be a git repository|Repository not found/i.test(n)?{code:"SYNC_LOCATION_UNREACHABLE",message:"no repository answered at that address, or your account cannot see it; a private repository looks missing until access is granted",remedy:"check the address, then run the command again",diagnostic:s}:{code:"SYNC_LOCATION_UNREACHABLE",message:`git could not read the repository on ${t}`,remedy:"check the address and your access, then run the command again",...s?{diagnostic:s}:{}}}function M(n,e){return(n.startsWith(e)?n:n.charAt(0).toUpperCase()+n.slice(1))+"."}function yt(n,e){let t=Y(n,e),{host:r}=ae(e),i=t.remedy.replace(/,? ?(and )?then run the command again$/,"");return i?`${M(t.message,r)} ${M(i,r)}`:M(t.message,r)}var Oe=Buffer.from(`* -text -filter -ident -working-tree-encoding
|
|
4
4
|
`),Re="refs/kane/tip",Pe=/unexpected disconnect|hung up unexpectedly|Connection reset|Connection timed out|timed out|Could not resolve host|Failed to connect|RPC failed|Broken pipe|early EOF/i,$e={GIT_AUTHOR_NAME:"kane-cli context",GIT_AUTHOR_EMAIL:"context@kane-cli.invalid",GIT_COMMITTER_NAME:"kane-cli context",GIT_COMMITTER_EMAIL:"context@kane-cli.invalid"},G=class n{constructor(e){this.options=e;this.exec=e.exec??H,this.prefix=e.prefix?`${e.prefix}/`:"";let t=Ie("sha256").update(JSON.stringify([e.url,e.branch,this.prefix])).digest("hex");if(this.repo=_(e.cacheDir??_(A,"context-sync","mirrors"),`${t}.git`),this.ref=e.ref??`refs/heads/${e.branch}`,!/^refs\/(heads|kane\/probe)\/[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(this.ref)||this.ref.includes(".."))throw new Error("Invalid Git location ref")}kind="git";contractVersion=1;ceilingTier=1;exec;repo;ref;prefix;ready;tip=null;tree=new Map;async run(e,t={}){let r=await this.exec(["--git-dir",this.repo,...e],t);if(r.code)throw new Error(`Git ${e[0]} failed: ${r.stderr||"unable to read the location"}`);return r.stdout}async transfer(e){let t=await this.exec(["--git-dir",this.repo,...e]);if(t.code){let r=Y(t.stderr||"",this.options.url);throw new d(r.code,r.message,r.remedy,r.diagnostic)}return t.stdout}get name(){return this.options.name??"<name>"}takenRemedy(e){return e===1?`${this.name} holds a different history: to work on it, clone it with kane-cli context clone <descriptor of ${this.name}> <dir>; to share this store, add an empty location`:`kane-cli context pull ${this.name} --rebase`}init(){return this.ready??=(async()=>{if(await oe(this.exec),xe(ce(this.repo),{recursive:!0}),!ve(this.repo)){let e=P(_(ce(this.repo),".init-"));try{let t=await this.exec(["init","--bare",e]);if(t.code)throw new Error(`Cannot open Git cache: ${t.stderr}`);try{ke(e,this.repo)}catch(r){if(!["EEXIST","ENOTEMPTY"].includes(r.code??""))throw r}}finally{$(e,{recursive:!0,force:!0})}}if((await this.run(["rev-parse","--is-bare-repository"])).toString().trim()!=="true")throw new Error("The Git cache must be a bare repository");await this.refresh()})()}async refresh(){let t=(await this.transfer(["ls-remote",this.options.url,this.ref])).toString().trim();if(!t){this.tip=null,this.tree=new Map;return}let r=t.split(/\s+/)[0];if(!/^[0-9a-f]{40,64}$/.test(r))throw new Error("Git returned an invalid ref");if(r===this.tip)return;let i=`refs/kane/snapshots/${F(16).toString("hex")}`;await this.transfer(["fetch","--no-tags","--no-write-fetch-head",this.options.url,`${this.ref}:${i}`]);let s=(await this.run(["rev-parse",i])).toString().trim();await this.run(["update-ref",Re,s]),await this.run(["update-ref","-d",i]);let o=await this.readTree(s);this.tip=s,this.tree=o}contextKeys(e){let t=new Map;for(let[r,i]of e)r.startsWith(`${this.prefix}kane-context/`)&&t.set(r,i);return t}async readTree(e){let t=await this.run(["ls-tree","-rz","--full-tree",e]),r=new Map;for(let i of t.toString().split("\0").filter(Boolean)){let s=/^(\d+) (\w+) ([0-9a-f]+)\t([\s\S]+)$/.exec(i);if(!s)throw new Error("Git returned an invalid tree entry");if(s[4].startsWith(`${this.prefix}kane-context/`)&&(s[1]!=="100644"||s[2]!=="blob"))throw new d("SYNC_OBJECT_CORRUPT","Context storage contains a link or non-file object.","Ask the repository owner to restore the original context files.");r.set(s[4],s[3])}return r}key(e){if(!/^[a-zA-Z0-9_~./-]+$/.test(e)||e.split("/").some(t=>!t||t==="."||t===".."||t.toLowerCase()===".git"))throw new Error("Invalid context storage key");return this.prefix+e}async head(e){return await this.init(),this.tree.has(this.key(e))}async get(e){await this.init();let t=this.tree.get(this.key(e));return t?this.run(["cat-file","blob",t]):null}async list(e){return await this.init(),e&&e.replace(/\/$/,"")&&this.key(e.replace(/\/$/,"")),[...this.tree.keys()].filter(t=>t.startsWith(this.prefix+e)).map(t=>t.slice(this.prefix.length)).sort()}async beginTransaction(){await this.init();let e=new Map(this.tree),t=this.tip,r=new Map,i=!1,s=()=>{if(i)throw new Error("Git transaction is closed")},o=async a=>{s();let c=this.key(a),h=r.get(c),u=e.get(c);return h?Buffer.from(h):u?this.run(["cat-file","blob",u]):null};return{get:o,head:async a=>await o(a)!==null,stageIfAbsent:async(a,c)=>{s();let h=this.key(a);if(e.has(h)||r.has(h))return"exists";if(c.length>1e8)throw new d("SYNC_LOCATION_REFUSED_WRITE","A context object is too large for this Git location.","Use an S3 location for this context.");return r.set(h,Buffer.from(c)),"staged"},abort:async()=>{i=!0,r.clear()},commit:async()=>{s();try{if(!r.size)return{created:[]};let a=this.prefix+"kane-context/.gitattributes";e.has(a)||r.set(a,Oe);let c=new Map;for(let[l,m]of r)c.set(l,(await this.run(["hash-object","-w","--no-filters","--stdin"],{input:m})).toString().trim());let h=this.contextKeys(e),u=()=>{this.assertUnchanged(h);for(let[l,m]of this.contextKeys(this.tree))h.set(l,m)},g=!1,w="",S=0;for(let l=0;l<4;l++){u();for(let f of this.tree.keys())if(!(!f.startsWith(this.prefix)||e.has(f)||c.has(f))&&B(f.slice(this.prefix.length))!==null)throw new d("SYNC_BEHIND","the location gained records after this batch was prepared; nothing was published","run kane-cli context pull, then push again");let m=new Map;for(let[f,T]of c){let C=this.tree.get(f);if(C&&C!==T){let R=B(f.slice(this.prefix.length));throw R?new d("SYNC_POSITION_TAKEN",g?`position ${R} on ${this.name} now holds different work; an earlier publication could not be confirmed`:`position ${R} on ${this.name} was published by another writer; this batch was not published`,this.takenRemedy(R)):new d("SYNC_OBJECT_CORRUPT",`existing context object ${f} differs from the intended bytes`,"the object needs a person to look; nothing was published")}C||m.set(f,T)}if(!m.size)return await this.verifyPublication(c),{created:[]};t=this.tip;let I=await this.build(t,m);await this.checkAttributes(I,[...r.keys()]),S++;let E=await this.exec(["--git-dir",this.repo,"push","--porcelain",this.options.url,`${I}:${this.ref}`]),y=N(E.stdout.toString()+`
|
|
5
5
|
`+E.stderr);w=y.trim();let O=E.code!==0&&/\[rejected\]|\[remote rejected\]/.test(y),p=E.code!==0&&(E.code===124||Pe.test(y));g||=p;try{await this.refresh()}catch{throw new d("SYNC_PUBLICATION_UNKNOWN","we could not confirm whether your context was uploaded; your local work is safe","check the connection and retry; kane-cli compares the published data before writing again")}if(u(),[...c].every(([f,T])=>this.tree.get(f)===T)){await this.verifyPublication(c);let f=E.code===0&&!E.stdout.toString().split(`
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as K}from"./chunk-7U7HOEZO.js";import{a as U,b as Y,c as q}from"./chunk-KJQNAOOE.js";import{a as B}from"./chunk-KDNNMU7Q.js";import{d as j}from"./chunk-WESMQEPO.js";import{j as N,n as F,z as k}from"./chunk-IICT4VOU.js";import{a as L,b as V,c as G}from"./chunk-3UI5VTQS.js";import{F as I}from"./chunk-RDHWNSDP.js";import{f as v,g as x,i as H}from"./chunk-XLSOQLVT.js";function te(t,e,n,i,s){let f=n.rows.filter(u=>{let d=i.get(u.temp_ref);return d!==void 0&&d!=="reject"});if(f.length===0)return{record:null,errors:null};let o={version:1,read_basis:e.latestHash,source:{source_id:n.source_id,source_cid:e.heads.get(n.source_id)??""},use_cases:f.map(u=>u.uc)},p=new Map;for(let u of f){let d=i.get(u.temp_ref);typeof d=="object"?p.set(u.temp_ref,{resolution:"edited",edit:d.edited}):p.set(u.temp_ref,{resolution:u.uc.matches_existing&&u.uc.changed?"edited":"approved"})}let g=q(o,e,n.staged_source_cid);if(g.errors!==null)return{record:null,errors:g.errors};let r=g.proposal,l=o.source.source_cid?D(t,e,o.source.source_cid):null;if(l!==null){r=Y(r,l);let u=N(r,U(l),e);if(u.length>0)return{record:null,errors:[{code:"HELD_CITES_STALE",detail:"the source moved after this plan staged \u2014 its quotes no longer verify against the current head; re-run kane-cli maintain reconcile to re-stage"},...u]}}let m=`held-${(e.latestHash??"root").slice(-12)}-${f.length}`;return F({contextDir:t,graph:e,proposal:r,proposalId:m,verdicts:p,by:s,autoName:!0})}function Z(t,e,n=[]){let i=K(t,e),s=new Set,f=[],o=l=>{!l||s.has(l)||(s.add(l),f.push(y(t,l)))};for(let l of i.pairs)o(l.scenario),o(l.test);for(let[l,m]of i.verifies){o(l);for(let u of m)o(u)}if(n.length===0)return{stale_refs:f};let p=l=>`${String(l.props.source_id)}\0${String(l.props.anchor)}`,g=new Set;for(let{cid:l}of t.byLabel(v.USECASE))if(t.tipOf(l)===e)for(let m of t.edgesInto(l)){if(m.type!==x.DERIVES)continue;let u=m.props.claim;typeof u=="string"&&n.includes(u)&&g.add(p(m))}if(g.size===0)return{stale_refs:f};let r=new Set;for(let[l,m]of i.verifies)if(t.edgesInto(l).some(d=>d.type===x.DERIVES&&g.has(p(d)))){r.add(y(t,l));for(let d of m)r.add(y(t,d))}return{stale_refs:f,...r.size>0?{direct_refs:[...r]}:{}}}var X="this release plans changes only \u2014 blast-radius impact and drift meaning-checks are not measured, and REMOVE rows are never executed automatically",ne="suite untouched; graph updated";function M(t,e){return!t.superseded.has(e)&&t.trust.get(e)!=="archived"}function y(t,e,n=new Set){let i=t.nameOf.get(e);if(i!==void 0)return i;if(n.has(e))return e;n.add(e);for(let[s,f]of t.superseded){if(f!==e)continue;let o=y(t,s,n);if(o!==s)return o}return e}function C(t){return String(t).slice(0,19)}function A(t,e,n){let i=t.edgesFrom(e).find(s=>s.type===n);return i?t.tipOf(i.dst):null}function z(t,e){let n=t.nodeLabel.get(e);if(n===v.USECASE)return e;if(n===v.SCENARIO)return A(t,e,x.BELONGS_TO);if(n===v.AC){let i=A(t,e,x.SCOPED_TO);return i?t.nodeLabel.get(i)===v.USECASE?i:A(t,i,x.BELONGS_TO):null}if(n===v.TEST){let i=A(t,e,x.AUTOMATES);return i?A(t,i,x.BELONGS_TO):null}return null}function J(t,e){let n=[],i=new Map;for(let s of t.derivesInto(e))i.set(String(s.props.source_id),s);for(let[s,f]of i){let o=t.heads.get(s);if(o==null){n.push(`DERIVES pin ${s} @ ${C(f.props.source_cid)} \u2014 source retired`);continue}if(o!==f.props.source_cid){let p=t.convChains.get(s)?.chain;if(p&&p.includes(String(f.props.source_cid)))continue;n.push(`DERIVES pin ${s} @ ${C(f.props.source_cid)} \u2014 source head moved to ${C(o)}`)}}for(let s of t.edgesFrom(e))H(s.type)?.pin?.comparesTo==="dst_tip"&&t.superseded.has(s.dst)&&n.push(`${s.type} pin \u2192 ${y(t,s.dst)} \u2014 target superseded`);return n.join("; ")||"structural pin broken"}var se=new Set([v.USECASE,v.SCENARIO,v.AC,v.TEST]);function $(t,e){return t.ref<e.ref?-1:t.ref>e.ref?1:0}function D(t,e,n){let i=B(t,e,n);return i===null?null:i.toString("utf8")}function oe(t,e,n,i,s){let f=n.props.quote;if(typeof f=="string"&&f.length>0)return G(f,i);let o=String(n.props.source_cid);s.has(o)||s.set(o,D(t,e,o));let p=s.get(o);if(p===null)return!1;let g=V(p,String(n.props.anchor));return g===null?!1:g.split(`
|
|
3
|
+
`).some(r=>r.trim().length>0&&i.includes(r.trim()))}function re(t,e,n){let i=L(String(e.props.anchor));if(i?.kind!=="img-part")return!1;let f=(t.mediaOf(String(e.props.source_cid)).images??[]).find(r=>r.ref===i.ref),o=f?.blob;if(o===void 0)return!1;let p=t.mediaOf(n).images??[];if(p.some(r=>r.blob===o))return!0;let g=f?.appearance;return g!==void 0&&p.filter(r=>r.appearance===g).length===1}var W=128*1024,Q=64*1024;function ie(t,e){let n=t.split(`
|
|
4
|
+
`),i=e.split(`
|
|
5
|
+
`),s=0;for(;s<n.length&&s<i.length&&n[s]===i[s];)s++;let f=n.length,o=i.length;for(;f>s&&o>s&&n[f-1]===i[o-1];)f--,o--;if(f===s&&o===s)return"";let p=n.slice(s,f),g=i.slice(s,o),l=ce(p,g,2e3),m=[];if(l===null)m.push(`@@ old L${s+1}-L${f} \u2192 new L${s+1}-L${o} @@`,...p.map(u=>`- ${u}`),...g.map(u=>`+ ${u}`));else{let u=l.map((a,h)=>a.op==="="?-1:h).filter(a=>a>=0),d=0;for(;d<u.length;){let a=d;for(;a+1<u.length&&u[a+1]-u[a]<=3;)a++;let h=Math.max(u[d]-1,0),R=Math.min(u[a]+1,l.length-1),b=l.slice(h,R+1),S=s+(b[0].ai??0)+1,_=s+(b[0].bi??0)+1,c=b.filter(E=>E.op!=="+").length,w=b.filter(E=>E.op!=="-").length;m.push(`@@ old L${S}-L${S+Math.max(c-1,0)} \u2192 new L${_}-L${_+Math.max(w-1,0)} @@`);for(let E of b)m.push(E.op==="="?` ${E.line}`:`${E.op} ${E.line}`);d=a+1}}return m.join(`
|
|
6
|
+
`)}function ce(t,e,n){let i=t.length,s=e.length,f=Math.min(i+s,n),o=new Map([[1,0]]),p=[],g=!1;for(let u=0;u<=f&&!g;u++){p.push(new Map(o));for(let d=-u;d<=u;d+=2){let a=d===-u||d!==u&&(o.get(d-1)??0)<(o.get(d+1)??0)?o.get(d+1)??0:(o.get(d-1)??0)+1,h=a-d;for(;a<i&&h<s&&t[a]===e[h];)a++,h++;if(o.set(d,a),a>=i&&h>=s){g=!0;break}}}if(!g)return null;let r=i,l=s,m=[];for(let u=p.length-1;u>0;u--){let d=p[u],a=r-l,h=a===-u||a!==u&&(d.get(a-1)??0)<(d.get(a+1)??0)?a+1:a-1,R=d.get(h)??0,b=R-h;for(;r>R&&l>b;)m.push({op:"=",line:t[r-1],ai:r-1,bi:l-1}),r--,l--;u>0&&(r===R?(m.push({op:"+",line:e[l-1],ai:r,bi:l-1}),l--):(m.push({op:"-",line:t[r-1],ai:r-1,bi:l}),r--))}for(;r>0&&l>0;)m.push({op:"=",line:t[r-1],ai:r-1,bi:l-1}),r--,l--;for(;r>0;)m.push({op:"-",line:t[r-1],ai:r-1,bi:0}),r--;for(;l>0;)m.push({op:"+",line:e[l-1],ai:0,bi:l-1}),l--;return m.reverse()}function ae(t){let e=Buffer.byteLength(t,"utf8");if(e<=W+Q)return{diff:t,truncated:!1};let n=Buffer.from(t,"utf8"),i=W;for(;i>0&&(n[i]&192)===128;)i--;let s=e-Q;for(;s<e&&(n[s]&192)===128;)s++;let f=n.subarray(0,i).toString("utf8"),o=n.subarray(s).toString("utf8");return{diff:`${f}
|
|
7
|
+
\u2026 [diff truncated: ${e-i-(e-s)} bytes omitted] \u2026
|
|
8
|
+
${o}`,truncated:!0}}function de(t,e){let n=k(t),i=n.heads.get(e);if(typeof i!="string")return null;let s=[];for(let d of I(t).records){let a=d.source_head_moves?.[e];a!==void 0&&a!==s[s.length-1]&&s.push(a)}let f=s.lastIndexOf(i),o=f>0?s[f-1]:null;if(typeof o!="string"||o===i)return null;let p=D(t,n,o),g=D(t,n,i);if(p===null||g===null)return null;let{diff:r,truncated:l}=ae(ie(p,g)),m=new Set,u=[];for(let d of n.edgesFrom(o))d.type!==x.DERIVES||n.nodeLabel.get(d.dst)!==v.USECASE||m.has(d.dst)||(m.add(d.dst),u.push({id:d.dst,title:String(n.getNode(d.dst)?.content.title??"")}));return{source_id:e,old_head:o,new_head:i,diff:r,...l?{truncated:!0}:{},prior_ucs:u}}function le(t,e,n){let i=t.getNode(e)?.content??{},s=t.getNode(n)?.content??{},o=[...new Set([...Object.keys(i),...Object.keys(s)])].sort().filter(p=>JSON.stringify(i[p])!==JSON.stringify(s[p]));return o.length>0?`updated: ${o.join(", ")}`:"updated"}function ue(t,e,n,i,s,f,o){let p=new Set((o?.rows??[]).map(a=>a.matched_cid).filter(a=>!!a)),g=[];for(let[a,h]of n.superseded)h===null||a===h||e.superseded.has(a)||n.nodeLabel.get(a)===v.USECASE&&g.push({kind:"MODIFY",ref:y(n,a),old_cid:a,new_cid:h,summary:le(n,a,h)});let r=f.map(a=>({kind:"ADD",ref:y(n,a),cid:a}));for(let a of o?.rows??[])a.kind==="MODIFY"&&a.matched_cid?g.push({kind:"MODIFY",ref:y(n,a.matched_cid),old_cid:a.matched_cid,new_cid:null,summary:`${a.why} (staged)`}):a.kind==="ADD"&&r.push({kind:"ADD",ref:a.title,cid:null});let l=[],m=D(t,n,s),u=new Map;for(let{cid:a}of n.byLabel(v.USECASE)){if(!M(n,a)||p.has(a))continue;let h=n.derivesInto(a),R=h.filter(_=>String(_.props.source_id)===i);R.length===0||R.some(_=>_.props.source_cid===s)||R.some(_=>{let c=String(_.props.anchor),w=L(c);return w?.kind==="img-whole"?!1:w?.kind==="img-part"?re(n,_,s):m!==null&&oe(t,n,_,m,u)})||h.some(_=>{let c=String(_.props.source_id);if(c===i)return!1;let w=n.heads.get(c);return w!=null})||l.push({kind:"ARCHIVE",ref:y(n,a),cid:a,why:`evidence decayed: no quote from ${i} relocates into @${C(s)}, no other live source, no fresh evidence this run`,impact:Z(n,n.tipOf(a))})}let d=(a,h)=>a.ref<h.ref?-1:a.ref>h.ref?1:0;return[...g.sort(d),...r.sort(d),...l.sort(d)]}function Re(t,e,n,i,s){let f=e.rows.find(d=>d.temp_ref===n);if(!f)return{ok:!1,message:`held item ${n} missing from the plan artifact`};let o=f,p=k(t);if(o.matched_cid){let d=p.tipOf(o.matched_cid);if(p.superseded.get(d)===null)return{ok:!1,message:`use-case for "${o.title}" was retired meanwhile \u2014 nothing to update`};d!==o.matched_cid&&(o={...o,matched_cid:d,uc:{...o.uc,matches_existing:{cid:d}}})}let g=s?{edited:s}:"approve",r=te(t,p,{source_id:e.source_id,...e.staged_source_cid!==void 0?{staged_source_cid:e.staged_source_cid}:{},rows:[o]},new Map([[o.temp_ref,g]]),i);if(r.errors)return{ok:!1,message:r.errors.map(d=>`${d.code}: ${d.detail}`).join("; ")};let l=k(t),m=o.matched_cid?l.tipOf(o.matched_cid):r.record?.nodes.find(d=>d.label==="usecase")?.cid??r.record?.review[0]?.id;return{ok:!0,ref:m?y(l,m):o.title,kind:o.kind}}async function ye(t,e,n,i={}){let s=k(t),f=s.heads.get(e)??null,o=new Set(s.staleList().filter(c=>c.state==="stale").map(c=>c.cid)),p=await n.reingest(e);if(p.status==="unchanged"&&!i.resumeHeld)return{source_id:e,changed:!1,head:{status:p.status,before:f,after:p.cid},note:`nothing to reconcile \u2014 ${e} is unchanged`,skipped_arms:X,changeset:[],rows:[]};let g=i.resumeHeld?{minted:[],matched:[],held:i.resumeHeld}:await n.reextract(e),r=k(t),l=g.minted.map(c=>{let w=y(r,c);return{kind:"ADD",origin:"content-change",ref:w,reason:`new use-case extracted from ${e}`,provenance:`extraction commit \u2014 DERIVES ${e} @ ${C(p.cid)}`,action:`kane-cli design tests --use-case ${w}`}}),m=r.staleList().filter(c=>c.state==="stale"&&!o.has(c.cid)&&M(r,c.cid)).map(c=>c.cid),u=m.map(c=>{let w=y(r,c),E=se.has(r.nodeLabel.get(c)??"");return{kind:"MODIFY",origin:"structural-stale",ref:w,reason:"stale (structural)",provenance:J(r,c),action:E?`kane-cli maintain evolve ${w}`:`kane-cli design explain ${w}`}}),d=[],a=[];for(let c of g.held?.rows??[])if(c.kind==="ADD")d.push({kind:"ADD",origin:"content-change",ref:c.title,held_ref:c.temp_ref,reason:`${c.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${e} @ ${C(p.cid)}`,action:"approve to commit + design"});else{let w=c.matched_cid?r.tipOf(c.matched_cid):null,E=w?r.getNode(w)?.content.criteria??[]:[],T=(c.uc.updated?.criteria??[]).map(O=>typeof O=="string"?O:O.text),ee=[...T.filter(O=>!E.includes(O)),...c.uc.updated?.criteria!==void 0?E.filter(O=>!T.includes(O)):[]],P=w?Z(r,w,ee):void 0;a.push({kind:"MODIFY",origin:"content-change",ref:c.matched_cid?y(r,c.matched_cid):c.title,held_ref:c.temp_ref,reason:`${c.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${e} @ ${C(p.cid)}`,action:"approve to commit the updated version (old\u2192new redirect)",...P?{impact:P}:{}})}let h=new Set;for(let c of[...g.minted,...g.matched])h.add(r.tipOf(c));for(let c of g.held?.rows??[])c.matched_cid&&h.add(r.tipOf(c.matched_cid));for(let c of m){let w=z(r,r.tipOf(c));w&&r.nodeLabel.get(w)===v.USECASE&&h.add(r.tipOf(w))}let R=[];for(let c of await j(r,"design")){if(c.kind!=="no-verifies")continue;let w=r.resolve(c.ref);if(!w)continue;let E=z(r,w.tip);!E||!h.has(r.tipOf(E))||R.push({kind:"ADD",origin:"content-change",ref:c.ref,reason:c.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${y(r,E)}`,action:c.ready_command})}let b=[];for(let{cid:c}of r.byLabel(v.USECASE))M(r,c)&&r.stale(c)==="orphaned"&&b.push({kind:"REMOVE",ref:y(r,c),reason:"orphaned \u2014 no live source evidences this use-case",provenance:J(r,c),action:"plan-only \u2014 REMOVE is not executed in this release"});let S=new Set,_=[...l.sort($),...d.sort($),...R.sort($),...a.sort($),...u.sort($),...b.sort($)].filter(c=>{let w=`${c.kind}\0${c.ref}`;return S.has(w)?!1:(S.add(w),!0)});return{source_id:e,changed:!0,head:{status:p.status,before:f,after:p.cid},note:ne,skipped_arms:X,changeset:ue(t,s,r,e,p.cid,g.minted,g.held),rows:_,...g.held?{held:g.held}:{}}}function be(t,e){return async n=>{let{ingestFile:i}=await import("./ingest-OSNNM3DH.js"),{convertPdf:s}=await import("./pdf-convert-RLXSXFWN.js"),{convertDocx:f}=await import("./docx-convert-SQRTF7XS.js"),o=await i({contextDir:t,filePath:e,asId:n,converters:{pdf:s,docx:f}});return{status:o.status,cid:o.cid}}}function xe(t,e,n,i){return async()=>{let f=(i??(await import("./dispatch-SXS276ZT.js")).findProvider)(e);if(!f)throw new Error(`the remote re-ingest failed \u2014 no provider matches '${e}'`);let o=await f.ingest(e,void 0,{out:n.out,err:n.err,confirm:async()=>!0,isTTY:!1},t,void 0);if(o.code!==0||!o.result)throw new Error("the remote re-ingest failed \u2014 fix the reported problem and re-run");return{status:o.result.status,cid:o.result.source_cid}}}function ke(t,e={}){return async n=>{let i=[],[{runExtract:s},{resolveAgentAuthEnv:f},{runAgent:o},{preflightTurn:p}]=await Promise.all([import("./run-YWKZGZVL.js"),import("./spawner-ABB7B5CQ.js"),import("./bridge-UMXGHAJF.js"),import("./turn-preflight-JGYT7LXP.js")]),g=await f(),r=new Set(k(t).byLabel(v.USECASE).map(S=>S.cid)),l=de(t,n)??void 0,m=0,u=await s({mode:"override",source:n,...l?{changeContext:l}:{}},{contextDir:t,agent:o,preflightTurn:()=>p(g),ask:async()=>[],review:async S=>{if(!e.stage)return new Map(S.map(c=>[c.temp_ref,{resolution:c.matches_existing&&c.changed?"edited":"skipped"}]));let _=new Map;for(let c of S){if(c.matches_existing&&!c.changed){_.set(c.temp_ref,{resolution:"skipped"});continue}i.push({kind:c.matches_existing?"MODIFY":"ADD",temp_ref:c.temp_ref,title:c.title,why:c.matches_existing?`updated: ${Object.keys(c.updated??{}).join(", ")||"content"}`:`newly extracted from ${n}`,...c.matches_existing?{matched_cid:c.matches_existing.cid,updated:c.updated}:{},uc:c}),_.set(c.temp_ref,{resolution:"rejected"})}return _},confirmStale:async()=>!1,out:S=>e.hostOut?.(S),progress:S=>e.hostProgress?.(S),emit:S=>{S.type==="commit"&&typeof S.assumed=="number"&&(m+=S.assumed),e.hostEmit?.(S)},isTTY:!1,auth:g});if(u!==0)throw new Error(`reconcile: re-extract of ${n} failed (exit ${u})`);let d=k(t),a=d.heads.get(n),h=[],R=[];if(typeof a=="string"){let S=new Set;for(let _ of d.edgesFrom(a))_.type!==x.DERIVES||d.nodeLabel.get(_.dst)!==v.USECASE||S.has(_.dst)||(S.add(_.dst),!(e.stage&&d.trust.get(_.dst)==="archived")&&(r.has(_.dst)?R:h).push(_.dst))}let b=k(t).heads.get(n);return{minted:h,matched:R,defaultsTaken:m,...e.stage?{held:{source_id:n,...b!=null?{staged_source_cid:b}:{},rows:i}}:{}}}}export{te as a,Z as b,X as c,ne as d,M as e,z as f,se as g,ie as h,ae as i,de as j,Re as k,ye as l,be as m,xe as n,ke as o};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as B}from"./chunk-
|
|
2
|
+
import{a as B}from"./chunk-D6E6KRVX.js";import{F,M as T,m as O}from"./chunk-RDHWNSDP.js";function P(h){let{contextDir:x,graph:f,seq:r,by:i}=h,{records:u,hashes:v}=F(x);if(!Number.isInteger(r)||r<1||r>u.length)return{record:null,warnings:[],errors:[{code:"UNKNOWN_SEQ",detail:`no record ${r} (chain has ${u.length})`}]};let d=u[r-1],p=u.slice(0,r-1),c=h.reason??`revert of record ${r}`,n=[],l=[],g=[],m=[],w={},C=new Set(d.nodes.map(e=>e.cid)),k=new Map;for(let e of u)for(let t of e.edges)k.has(t.ecid)||k.set(t.ecid,t);let N=e=>u.slice(r).some(t=>t.supersessions.some(s=>s.kind==="edge"&&s.ecid===e)),$=new Set,y=new Set;for(let e of d.nodes){if(f.superseded.has(e.cid)){$.add(e.cid),n.push(`${e.cid} was already superseded after record ${r} \u2014 left as is`);continue}y.add(e.cid),l.push({kind:"node",old:e.cid,new:null,reason:c,by:i})}let R=new Set;for(let e of d.edges){if(f.superseded.has(e.ecid)){n.push(`edge ${e.ecid} was already retracted after record ${r} \u2014 left as is`);continue}if(($.has(e.src)||$.has(e.dst))&&!y.has(e.src)&&!y.has(e.dst)){n.push(`edge ${e.ecid} was minted with a kept node \u2014 left as is`);continue}l.push({kind:"edge",ecid:e.ecid,reason:c,by:i}),R.add(e.ecid)}let _=new Set;for(let e of d.supersessions){if(e.kind!=="node")continue;if(u.slice(r).some(s=>s.supersessions.some(o=>o.kind==="node"&&o.old===e.old))){n.push(`supersession of ${e.old.slice(0,19)} was changed again after record ${r} \u2014 later state kept`);continue}let t;for(let s of p)for(let o of s.supersessions)o.kind==="node"&&o.old===e.old&&(t=o.new===o.old?void 0:o.new);t===void 0?(l.push({kind:"node",old:e.old,new:e.old,reason:c,by:i}),_.add(e.old)):l.push({kind:"node",old:e.old,new:t,reason:c,by:i})}for(let e of d.supersessions)if(!(e.kind!=="edge"||!e.revoke)){if(N(e.ecid)){n.push(`edge ${e.ecid} was touched again after record ${r} \u2014 later state kept`);continue}l.push({kind:"edge",ecid:e.ecid,reason:c,by:i}),R.add(e.ecid)}let j=[];for(let e of d.supersessions){if(e.kind!=="edge"||e.revoke)continue;if(N(e.ecid)){n.push(`edge ${e.ecid} was touched again after record ${r} \u2014 later state kept`);continue}let t=!1;for(let I of p)for(let S of I.supersessions)S.kind==="edge"&&S.ecid===e.ecid&&(t=!S.revoke);if(t){n.push(`edge ${e.ecid} was already retracted before record ${r} \u2014 left retracted`);continue}let s=k.get(e.ecid);if(!s){n.push(`edge ${e.ecid} is unknown to the chain \u2014 left retracted`);continue}if(f.superseded.has(s.src)&&!_.has(s.src)){n.push(`edge ${e.ecid} would revive from a superseded source \u2014 left retracted`);continue}let o=f.tipOf(s.dst);if(f.superseded.has(o)&&!_.has(o)){n.push(`edge ${e.ecid} would point at a retired destination \u2014 left retracted`);continue}let a=B(f,{type:s.type,src:s.src,dst:s.dst},{pending:j,retracted:R},`revert revive ${s.type}`);if(a){n.push(`edge ${e.ecid} left retracted \u2014 reviving it would double an occupied slot (${a.detail})`);continue}l.push({kind:"edge",ecid:e.ecid,reason:c,by:i,revoke:!0}),j.push({src:s.src,dst:s.dst,type:s.type})}let b=u.slice(r);for(let e of Object.keys(d.source_head_moves)){if(b.some(s=>e in s.source_head_moves)){n.push(`head of ${e} was moved again after record ${r} \u2014 later state kept`);continue}let t=null;for(let s of p)e in s.source_head_moves&&(t=s.source_head_moves[e]);w[e]=t}let E=new Set;for(let e of d.review){if(E.has(e.id)||C.has(e.id))continue;if(E.add(e.id),b.some(o=>o.review.some(a=>a.id===e.id))){n.push(`trust of ${e.id.slice(0,19)} was reviewed again after record ${r} \u2014 later state kept`);continue}let t=null,s=null;for(let o of p)for(let a of o.review)a.id===e.id&&(t=a.resolution==="reset"?null:a.resolution,s=a.reason);t==="approved"||t==="edited"?g.push({id:e.id,kind:"review-item",resolution:"approved",edit:null,reason:c,by:i}):t==="rejected"?g.push({id:e.id,kind:"review-item",resolution:"rejected",edit:null,reason:s??c,by:i}):g.push({id:e.id,kind:"review-item",resolution:"reset",edit:null,reason:c,by:i})}for(let e of d.names??[]){if(b.some(s=>(s.names??[]).some(o=>o.slug===e.slug))){n.push(`slug "${e.slug}" was reassigned after record ${r} \u2014 later state kept`);continue}let t;for(let s of p)for(let o of s.names??[])o.slug===e.slug&&(t=o.cid);t!==void 0?m.push({cid:t,slug:e.slug,by:i}):n.push(`slug "${e.slug}" was first assigned by record ${r} \u2014 unassignment unsupported, reassign manually`)}return l.length===0&&g.length===0&&m.length===0&&Object.keys(w).length===0?{record:null,warnings:n,errors:[{code:"NOTHING_TO_REVERT",detail:`record ${r} left no compensable facts`}]}:(d.extraction_of&&n.push(`extraction cache for ${d.extraction_of.slice(0,19)} stays \u2014 re-extract with --force`),{record:T(x,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:g,supersessions:l,...m.length>0?{names:m}:{},source_head_moves:w},{expectPrev:v[v.length-1]??null,intent:{v:1,verb:"revert",args:O({seq:r,reason:h.reason??null,by:i}),pins:{target:{seq:r,hash:v[r-1]}}},provenance:h.provenance}).record,warnings:n,errors:null})}export{P as a};
|