@testmuai/kane-cli 0.10.4 → 0.10.5

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.
Files changed (235) hide show
  1. package/dist/{ChatSurface-DN7VVN3Y.js → ChatSurface-WKYH5MYP.js} +1 -1
  2. package/dist/{ChromeProfilePicker-TVGWXTUU.js → ChromeProfilePicker-ROQIRMWR.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-L5ILK66U.js → CliFeedbackPrompt-55OKAT4W.js} +1 -1
  4. package/dist/{CliUploadProgress-IU6BQLMV.js → CliUploadProgress-NK2U3CKQ.js} +1 -1
  5. package/dist/{ConfigView-LU5IRRQU.js → ConfigView-7A5JTKLF.js} +1 -1
  6. package/dist/{EvidenceViewOffer-DNTARDEL.js → EvidenceViewOffer-U7J5ZRVK.js} +1 -1
  7. package/dist/{FolderPicker-6E5GE2K2.js → FolderPicker-R4QDIFTW.js} +1 -1
  8. package/dist/{InfoBox-SFFPLWCV.js → InfoBox-SRQ4TSUT.js} +1 -1
  9. package/dist/{LinksBox-6YDTIO6I.js → LinksBox-7BWLLQVR.js} +1 -1
  10. package/dist/{ProfilesView-6C5HJQ3Y.js → ProfilesView-TQTJR4WQ.js} +1 -1
  11. package/dist/{ProjectPicker-YIQIVXGK.js → ProjectPicker-A5SXNDUL.js} +1 -1
  12. package/dist/{SaveSessionPrompt-X3N6OGYB.js → SaveSessionPrompt-IECYZMXW.js} +1 -1
  13. package/dist/SingleShotApp-MN5IE6EU.js +2 -0
  14. package/dist/{SummaryBox-T7PDXDKS.js → SummaryBox-WFOS6GON.js} +1 -1
  15. package/dist/{TestMdRunView-HRJSBP2C.js → TestMdRunView-URNSXIVC.js} +1 -1
  16. package/dist/TestrunEvidenceTable-SZPZMW3J.js +2 -0
  17. package/dist/{WhoamiView-WGCWD7GP.js → WhoamiView-G6QP4SID.js} +1 -1
  18. package/dist/{app-download-ZS6ZMX2Z.js → app-download-UGLDWWTX.js} +1 -1
  19. package/dist/{assurance-job-QO4VJJCL.js → assurance-job-V5QB36WJ.js} +1 -1
  20. package/dist/{binary-CCCTW3QQ.js → binary-32FXH6PQ.js} +1 -1
  21. package/dist/{bind-JU4XPDN3.js → bind-3PB77PWJ.js} +1 -1
  22. package/dist/{bootstrap-BV7HAARR.js → bootstrap-A2O4UZUJ.js} +1 -1
  23. package/dist/{catalog-ZAROGOJA.js → catalog-P5IOIVYP.js} +1 -1
  24. package/dist/{catalog-client-QLHCEPPZ.js → catalog-client-LR2KPSU7.js} +1 -1
  25. package/dist/{changelog-6L7W76ZH.js → changelog-GKIKDJ32.js} +1 -1
  26. package/dist/{chunk-FTP2K6RS.js → chunk-2AHQ3D3D.js} +1 -1
  27. package/dist/{chunk-SZQNYDST.js → chunk-2G7UYQOW.js} +1 -1
  28. package/dist/{chunk-3O2RPYPM.js → chunk-2MBNAW2G.js} +1 -1
  29. package/dist/{chunk-SO3IXFAJ.js → chunk-2NP3THOE.js} +1 -1
  30. package/dist/{chunk-YZP4F23B.js → chunk-37KFCYHG.js} +1 -1
  31. package/dist/{chunk-Z4O5HOFX.js → chunk-3RJRCAUX.js} +3 -3
  32. package/dist/{chunk-PBVNX43X.js → chunk-4DM5EWEV.js} +1 -1
  33. package/dist/{chunk-QYWWL7M7.js → chunk-5K7PCSTP.js} +1 -1
  34. package/dist/{chunk-LCBDNZL3.js → chunk-5LKDOE3P.js} +1 -1
  35. package/dist/{chunk-ZVSZ6DIQ.js → chunk-5OFHMBZC.js} +2 -2
  36. package/dist/{chunk-SMSQVGLH.js → chunk-63BFLTJI.js} +1 -1
  37. package/dist/{chunk-PMYN3XMN.js → chunk-642GD7E6.js} +1 -1
  38. package/dist/{chunk-HMGM4KO6.js → chunk-66C5A2F5.js} +1 -1
  39. package/dist/{chunk-3HGKFRFL.js → chunk-6OL5EVRC.js} +1 -1
  40. package/dist/{chunk-LLDEAV3W.js → chunk-6PZ3SVWE.js} +1 -1
  41. package/dist/{chunk-7V6JPZBM.js → chunk-6VG2FG67.js} +1 -1
  42. package/dist/{chunk-Q5B54TR5.js → chunk-6WN4WSXR.js} +1 -1
  43. package/dist/{chunk-TO2ROHIJ.js → chunk-76MKY7FG.js} +2 -2
  44. package/dist/{chunk-2CJ75THZ.js → chunk-77BZTEHJ.js} +1 -1
  45. package/dist/chunk-7TSM2FCL.js +5 -0
  46. package/dist/{chunk-ECPSBI2Z.js → chunk-A5C7HIAH.js} +1 -1
  47. package/dist/{chunk-BV7NUIRT.js → chunk-AXOSLGQ4.js} +1 -1
  48. package/dist/{chunk-DJ76NDW6.js → chunk-BDZWRJAL.js} +1 -1
  49. package/dist/{chunk-6PURZLKM.js → chunk-BFRWZPIK.js} +1 -1
  50. package/dist/{chunk-MWLRLQ27.js → chunk-BLHFNL5K.js} +1 -1
  51. package/dist/chunk-BRWCWZE3.js +2 -0
  52. package/dist/{chunk-IQMJJN52.js → chunk-BZEW7CSM.js} +1 -1
  53. package/dist/{chunk-TXRWH6HL.js → chunk-C466XER3.js} +2 -2
  54. package/dist/{chunk-55W3WAAL.js → chunk-C4UME2PA.js} +1 -1
  55. package/dist/{chunk-ZHENGHYZ.js → chunk-CBPACEYQ.js} +1 -1
  56. package/dist/{chunk-IDWAG6L4.js → chunk-CJGQFKLJ.js} +1 -1
  57. package/dist/{chunk-4G2T54FE.js → chunk-CQBLJTDU.js} +1 -1
  58. package/dist/{chunk-BPTWMV5L.js → chunk-CVVUBCB7.js} +1 -1
  59. package/dist/{chunk-4WFN23DE.js → chunk-EIQSXD7B.js} +1 -1
  60. package/dist/{chunk-AFOP7DVG.js → chunk-EP4WGGMY.js} +1 -1
  61. package/dist/{chunk-S5PIVHPC.js → chunk-F4GWIX66.js} +1 -1
  62. package/dist/{chunk-GMSWZIAS.js → chunk-FHULYIG3.js} +1 -1
  63. package/dist/{chunk-JE5M5QIK.js → chunk-FKA5SWWF.js} +1 -1
  64. package/dist/{chunk-WHMCVH3T.js → chunk-FLGOQ6Q6.js} +1 -1
  65. package/dist/{chunk-ABNQL3PQ.js → chunk-FNBHP75S.js} +1 -1
  66. package/dist/{chunk-GJYMR4RT.js → chunk-FOURJ24E.js} +1 -1
  67. package/dist/{chunk-UZKVV3LW.js → chunk-FOUUD3LI.js} +1 -1
  68. package/dist/{chunk-CVVZ6NWR.js → chunk-FP6JCXOS.js} +1 -1
  69. package/dist/{chunk-WMIR4UXG.js → chunk-H23ZMHHC.js} +1 -1
  70. package/dist/{chunk-ZFKR5I3J.js → chunk-HHF7AM3D.js} +1 -1
  71. package/dist/{chunk-6CMBA5SG.js → chunk-HTJDMLZS.js} +1 -1
  72. package/dist/{chunk-DRWHVVW6.js → chunk-HY5BBSYX.js} +1 -1
  73. package/dist/{chunk-RG3FNO37.js → chunk-IPXITNFD.js} +1 -1
  74. package/dist/{chunk-EWSNJ3IX.js → chunk-IT6M7OMG.js} +1 -1
  75. package/dist/{chunk-5OGYXLOR.js → chunk-ITG5WMQG.js} +1 -1
  76. package/dist/{chunk-MZ4GTIO2.js → chunk-J3YID4A5.js} +1 -1
  77. package/dist/{chunk-TELSHQ3W.js → chunk-J44FV6CH.js} +1 -1
  78. package/dist/{chunk-JYSIPTX3.js → chunk-J5D4IGAM.js} +1 -1
  79. package/dist/{chunk-WB4JZ67W.js → chunk-J5QFO7LW.js} +1 -1
  80. package/dist/{chunk-EOLMWSLX.js → chunk-JGQ3VB44.js} +1 -1
  81. package/dist/{chunk-MOAZZKIZ.js → chunk-JVXEAO62.js} +1 -1
  82. package/dist/{chunk-YWQNZRJG.js → chunk-JYH7CTF7.js} +1 -1
  83. package/dist/{chunk-FH4FWIET.js → chunk-JZ7GFPKZ.js} +1 -1
  84. package/dist/{chunk-I3G3IUKY.js → chunk-KUSHV5SR.js} +1 -1
  85. package/dist/{chunk-NMCE7VR2.js → chunk-LMOW4NM5.js} +1 -1
  86. package/dist/{chunk-UVBPUZC4.js → chunk-LPJX5L3F.js} +1 -1
  87. package/dist/{chunk-4FA44D6S.js → chunk-LWP7E5FU.js} +1 -1
  88. package/dist/{chunk-MQU6EA44.js → chunk-LXYXCANZ.js} +1 -1
  89. package/dist/{chunk-5HJRYEOT.js → chunk-MAQVRBUQ.js} +1 -1
  90. package/dist/{chunk-4WKFM72U.js → chunk-MBNSCXVK.js} +1 -1
  91. package/dist/{chunk-P7V24ZXP.js → chunk-MIQ6J5YG.js} +1 -1
  92. package/dist/{chunk-454IWKHT.js → chunk-MUL2QFG2.js} +1 -1
  93. package/dist/{chunk-DBMDAWTA.js → chunk-N4XUGIAK.js} +1 -1
  94. package/dist/{chunk-ACBNVGVJ.js → chunk-NAUIJF72.js} +1 -1
  95. package/dist/{chunk-QFA6JPVE.js → chunk-NFDVDEOH.js} +2 -2
  96. package/dist/{chunk-BIXABKSK.js → chunk-NGBXXBHP.js} +1 -1
  97. package/dist/{chunk-RNKJXVG2.js → chunk-NIBNVPAE.js} +1 -1
  98. package/dist/{chunk-DAV4ONGS.js → chunk-NNVHWFLI.js} +1 -1
  99. package/dist/{chunk-QOXUGYEA.js → chunk-NZ7UCAN6.js} +1 -1
  100. package/dist/{chunk-HGKAUG7L.js → chunk-OPR5XIPT.js} +1 -1
  101. package/dist/{chunk-QXZGBYGQ.js → chunk-PCL2FYPE.js} +1 -1
  102. package/dist/{chunk-KJZD2ADR.js → chunk-PE3CEG6E.js} +1 -1
  103. package/dist/{chunk-3VSAAB2W.js → chunk-PKXWYYVK.js} +1 -1
  104. package/dist/{chunk-56NUPYFG.js → chunk-PSBR2LVL.js} +1 -1
  105. package/dist/{chunk-H6QHG62O.js → chunk-PZOQ2IQK.js} +1 -1
  106. package/dist/{chunk-2VLM4L3S.js → chunk-Q4QCSO6Y.js} +1 -1
  107. package/dist/{chunk-MNELOQ4J.js → chunk-QJ5XHVS5.js} +1 -1
  108. package/dist/{chunk-JJDD4HPX.js → chunk-QRUAI2ST.js} +1 -1
  109. package/dist/{chunk-2KPJ62RZ.js → chunk-QWEQ742S.js} +1 -1
  110. package/dist/{chunk-DXXHCLFC.js → chunk-R6S4EJ5R.js} +1 -1
  111. package/dist/{chunk-7WWCIS2B.js → chunk-RHQLDNZL.js} +1 -1
  112. package/dist/{chunk-X3O4VGTM.js → chunk-RM5ZVDVR.js} +1 -1
  113. package/dist/{chunk-4KFSSETE.js → chunk-RU3SWHRE.js} +1 -1
  114. package/dist/{chunk-662MCICY.js → chunk-S5UITUBB.js} +1 -1
  115. package/dist/{chunk-T5FQRUI2.js → chunk-SACFQNUH.js} +7 -7
  116. package/dist/{chunk-EG3B52WU.js → chunk-SDIHDYWT.js} +1 -1
  117. package/dist/{chunk-GPIVYCHQ.js → chunk-SFHDRKUX.js} +1 -1
  118. package/dist/{chunk-EWK3UPEN.js → chunk-SLISNOG6.js} +1 -1
  119. package/dist/{chunk-OSEXVHEN.js → chunk-TC2PHBPH.js} +1 -1
  120. package/dist/{chunk-FQ2AMM3E.js → chunk-TPCW5OU5.js} +1 -1
  121. package/dist/{chunk-P43YHCF3.js → chunk-UJYC2XDD.js} +1 -1
  122. package/dist/chunk-UV7FPIBL.js +2 -0
  123. package/dist/{chunk-A74JRNNX.js → chunk-UWEBI76C.js} +1 -1
  124. package/dist/{chunk-LV7OWLJK.js → chunk-UWQ4KXLB.js} +1 -1
  125. package/dist/{chunk-73EHVDL5.js → chunk-V24LUINK.js} +1 -1
  126. package/dist/{chunk-OX3ZAGCH.js → chunk-V3IWCGZT.js} +1 -1
  127. package/dist/{chunk-4QV2RL6P.js → chunk-VEE2O524.js} +1 -1
  128. package/dist/{chunk-3JATEWA5.js → chunk-VJRXJJML.js} +2 -2
  129. package/dist/{chunk-JM45SLKV.js → chunk-VKIUHHNT.js} +2 -2
  130. package/dist/{chunk-7KASYSFM.js → chunk-W3PQMIXE.js} +1 -1
  131. package/dist/{chunk-S74NLCFZ.js → chunk-WAC5WISH.js} +1 -1
  132. package/dist/{chunk-KLY6IQD5.js → chunk-XJV5SF3X.js} +3 -3
  133. package/dist/{chunk-ATCJ7EHL.js → chunk-XRJH4UF3.js} +1 -1
  134. package/dist/{chunk-SBW3QVHN.js → chunk-Y3RDLUH5.js} +5 -5
  135. package/dist/{chunk-BXAPTB2H.js → chunk-YF22VTR5.js} +3 -3
  136. package/dist/{chunk-TLYFHPNM.js → chunk-YLI7DQMJ.js} +2 -2
  137. package/dist/{chunk-BK3LWNKB.js → chunk-YQXOD7SV.js} +3 -3
  138. package/dist/{chunk-PHKJIJ7D.js → chunk-YTWBNACA.js} +1 -1
  139. package/dist/{chunk-QEBVYQNC.js → chunk-YUFXE6WU.js} +1 -1
  140. package/dist/{commands-X5T6YANK.js → commands-TRAUFCRZ.js} +1 -1
  141. package/dist/{config-F5Q6QX27.js → config-O3BWQUP4.js} +1 -1
  142. package/dist/{cover-cmd-PWUZU4HK.js → cover-cmd-SAWVP7TL.js} +1 -1
  143. package/dist/{credentials-D5KQMHCK.js → credentials-NNNODDXF.js} +1 -1
  144. package/dist/{deps-bundle-R7FNIV4M.js → deps-bundle-CXKBCA7W.js} +1 -1
  145. package/dist/{deps-resolve-IF6P6NWI.js → deps-resolve-K7XNTRZX.js} +1 -1
  146. package/dist/{design-chat-HYK3HNIM.js → design-chat-S4KYE6PP.js} +1 -1
  147. package/dist/{design-headless-DR7WB37W.js → design-headless-DDAFAJNR.js} +1 -1
  148. package/dist/{design-remote-TGUNEWEM.js → design-remote-UITWJ72Q.js} +2 -2
  149. package/dist/device-env-SBTHFSVK.js +2 -0
  150. package/dist/doctor-SRMLENYN.js +2 -0
  151. package/dist/{evidence-SRWISQMQ.js → evidence-FOWW3MOS.js} +1 -1
  152. package/dist/{evolve-cmd-2BALEYZU.js → evolve-cmd-MDK2H4JY.js} +1 -1
  153. package/dist/{evolve-remote-OHOUWO65.js → evolve-remote-4G7YFC5H.js} +1 -1
  154. package/dist/{explain-cmd-VTDAMXAW.js → explain-cmd-Q4NLNJFB.js} +1 -1
  155. package/dist/{explore-UZWQRJ7H.js → explore-MWUMVGRM.js} +1 -1
  156. package/dist/{explore-context-tty-PAKJVDJU.js → explore-context-tty-QLMZGYBX.js} +1 -1
  157. package/dist/{explore-entry-ZOPO7DBZ.js → explore-entry-QMCVGRP4.js} +4 -4
  158. package/dist/{explore-live-RUAAZGX4.js → explore-live-QIET6WO4.js} +1 -1
  159. package/dist/{explore-run-tty-DYLMHI7F.js → explore-run-tty-6UTBRCEF.js} +2 -2
  160. package/dist/{extract-bind-WPICR4IC.js → extract-bind-UTERWZMW.js} +3 -3
  161. package/dist/{extract-chat-KVUB5HPM.js → extract-chat-4WBNRVPG.js} +1 -1
  162. package/dist/{extract-cmd-OJ7LXSKL.js → extract-cmd-SYZX6CML.js} +2 -2
  163. package/dist/{extract-headless-OQJSUSG4.js → extract-headless-QBF77JWP.js} +1 -1
  164. package/dist/{folder-flags-MEZUAXTT.js → folder-flags-IJ556UET.js} +1 -1
  165. package/dist/{gaps-cmd-2R4RMWN6.js → gaps-cmd-E55OGZ7P.js} +1 -1
  166. package/dist/{gate-SM4HPJLA.js → gate-5UIJVMHL.js} +1 -1
  167. package/dist/{generate-headless-XR3RVULC.js → generate-headless-VYD2QIUO.js} +2 -2
  168. package/dist/{impact-cmd-EL3QSOAF.js → impact-cmd-3P6SKFJC.js} +2 -2
  169. package/dist/index.js +20 -20
  170. package/dist/{ingest-cmd-N3USC7TW.js → ingest-cmd-HMTLO5MB.js} +3 -3
  171. package/dist/{ingest-remote-2VKWAFJZ.js → ingest-remote-NIW5VAGW.js} +1 -1
  172. package/dist/install-KJDAGU2R.js +2 -0
  173. package/dist/{interactive-bind-F7QTQOKC.js → interactive-bind-K3ZQFHLH.js} +2 -2
  174. package/dist/{interactive-remote-A33J4KMP.js → interactive-remote-SGM76D6M.js} +1 -1
  175. package/dist/{lattice-auth-IJT542IF.js → lattice-auth-DCAVEQKY.js} +1 -1
  176. package/dist/{lifecycle-cmd-OKUFZKEX.js → lifecycle-cmd-Y5DH2PL5.js} +1 -1
  177. package/dist/{list-cmd-7OTI66MQ.js → list-cmd-RYHICCUV.js} +1 -1
  178. package/dist/{list-commands-FZPVH76I.js → list-commands-QFTIQE6Q.js} +1 -1
  179. package/dist/{list-remote-BQ4NILCA.js → list-remote-PWAQBF57.js} +1 -1
  180. package/dist/login-flow-W7RAVXSD.js +2 -0
  181. package/dist/{maintenance-cmd-BLV7K4RK.js → maintenance-cmd-JNP2KCSI.js} +1 -1
  182. package/dist/{mobile-prompts-5TGLJUBV.js → mobile-prompts-SP2RULD7.js} +1 -1
  183. package/dist/{onboarding-F4EIJ4GD.js → onboarding-YPIKXNYA.js} +1 -1
  184. package/dist/{persist-recorded-session-WYMOHDTB.js → persist-recorded-session-BWGA7WXR.js} +1 -1
  185. package/dist/{pipeline-XYM6HIDZ.js → pipeline-YE4IRKQX.js} +1 -1
  186. package/dist/{policy-commands-AOLVAZZD.js → policy-commands-MSJIPHDB.js} +1 -1
  187. package/dist/{prepare-target-P4AZWC37.js → prepare-target-G7LU4LYX.js} +1 -1
  188. package/dist/{pull-cmd-C4HMYD4I.js → pull-cmd-G3PVSSFP.js} +1 -1
  189. package/dist/{pull-route-MHW5PWDW.js → pull-route-5JQUUSU7.js} +1 -1
  190. package/dist/real-device-run-425XK527.js +2 -0
  191. package/dist/{reconcile-cmd-VXY737OT.js → reconcile-cmd-QJBYZVUB.js} +4 -4
  192. package/dist/{reconcile-remote-UGW2433E.js → reconcile-remote-JMV26DLX.js} +2 -2
  193. package/dist/{recording-banner-EPOTSMYF.js → recording-banner-VZ67EWWQ.js} +1 -1
  194. package/dist/{registry-WTWTFRXD.js → registry-3YMKU5GC.js} +1 -1
  195. package/dist/{remote-entry-SPA4CSJJ.js → remote-entry-6LQRYR5F.js} +1 -1
  196. package/dist/{remote-mode-QO6BDGXM.js → remote-mode-35BQUMEL.js} +1 -1
  197. package/dist/{remote-words-TAZT4YBT.js → remote-words-QXVFVHOB.js} +1 -1
  198. package/dist/{require-project-folder-WBCAVVMB.js → require-project-folder-O2XCXDRE.js} +1 -1
  199. package/dist/{resolve-run-intent-RBOCIYEA.js → resolve-run-intent-QCRZPYXM.js} +1 -1
  200. package/dist/{resolver-3BGIXYYJ.js → resolver-LWXOB7PH.js} +1 -1
  201. package/dist/{review-cmd-WE6I5XTY.js → review-cmd-PYU7YCAC.js} +1 -1
  202. package/dist/{run-remote-6Y62RWMJ.js → run-remote-PS45MTHW.js} +1 -1
  203. package/dist/{run-startup-gate-Q7FP2IRE.js → run-startup-gate-YBQB2JLF.js} +1 -1
  204. package/dist/{run-test-md-24MBKBC6.js → run-test-md-XYOCVA6F.js} +2 -2
  205. package/dist/session-worker.js +2 -2
  206. package/dist/{sessions-cmd-5NS5P4CP.js → sessions-cmd-WUWZYZJW.js} +1 -1
  207. package/dist/{sessions-remote-75PDRPOY.js → sessions-remote-4J7ITZB4.js} +1 -1
  208. package/dist/{skill-installer-7PK64TZE.js → skill-installer-54ZAFNOB.js} +1 -1
  209. package/dist/{store-AVYBL5HB.js → store-2F26FIUS.js} +1 -1
  210. package/dist/{store-choice-ZWU3PDNL.js → store-choice-ZE7AZMRC.js} +1 -1
  211. package/dist/{store-guard-ETUXXG7X.js → store-guard-X5FIEZWZ.js} +1 -1
  212. package/dist/{sync-cmd-CSTMT6E6.js → sync-cmd-TAVE44DU.js} +1 -1
  213. package/dist/{sync-setup-Y53K6TJ6.js → sync-setup-M65RX34Y.js} +1 -1
  214. package/dist/tcg-generate-OXZF7TNQ.js +2 -0
  215. package/dist/{testmd-actions-BE4YJ6ZZ.js → testmd-actions-4OHRME2Z.js} +1 -1
  216. package/dist/{testmd-sync-QZWVWTZZ.js → testmd-sync-HM24JCS7.js} +1 -1
  217. package/dist/token-refresh-3SEDPIXO.js +2 -0
  218. package/dist/{validate-basic-QWPESO74.js → validate-basic-HWDR665U.js} +1 -1
  219. package/dist/{version-check-EOYWTY3Z.js → version-check-DRE5KT7F.js} +1 -1
  220. package/dist/{view-cmd-KG4HI334.js → view-cmd-3UKV3YEX.js} +1 -1
  221. package/dist/{walk-session-WM4S2JMV.js → walk-session-W6OLG5NT.js} +1 -1
  222. package/dist/{with-telemetry-RJM3JKL6.js → with-telemetry-BF4BGK5S.js} +1 -1
  223. package/package.json +11 -11
  224. package/dist/SingleShotApp-MXNJPU6A.js +0 -2
  225. package/dist/TestrunEvidenceTable-OGMWTJQF.js +0 -2
  226. package/dist/chunk-APXJRWIJ.js +0 -2
  227. package/dist/chunk-V57R4X3O.js +0 -5
  228. package/dist/chunk-YKOZBFR3.js +0 -2
  229. package/dist/device-env-LZB3PKMA.js +0 -2
  230. package/dist/doctor-PLFEA2HM.js +0 -2
  231. package/dist/install-3IEM3I3X.js +0 -2
  232. package/dist/login-flow-BYQ7SYGB.js +0 -2
  233. package/dist/real-device-run-WAOWKEFJ.js +0 -2
  234. package/dist/tcg-generate-VQLI6NGK.js +0 -2
  235. package/dist/token-refresh-PZ3TOKAL.js +0 -2
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
3
- import{c as br}from"./chunk-MNELOQ4J.js";import{a as Ns,b as ys,c as js,d as vc,e as Tc,f as Sc}from"./chunk-KLY6IQD5.js";import"./chunk-RG3FNO37.js";import"./chunk-662MCICY.js";import{a as jc,b as Oc,c as Yc,d as Pc,e as Hc,f as Lc,g as zc,h as Jc,i as Xc}from"./chunk-JYSIPTX3.js";import{b as qc}from"./chunk-ZFKR5I3J.js";import{a as kc,b as xc,c as Vc,d as Fc,e as Gc,f as Uc,h as Cr}from"./chunk-LV7OWLJK.js";import"./chunk-3MSXQU2C.js";import"./chunk-MWLRLQ27.js";import{c as yc}from"./chunk-T5FQRUI2.js";import"./chunk-4WFN23DE.js";import"./chunk-MOAZZKIZ.js";import{a as Wc,b as Zc}from"./chunk-7LYLJ75Z.js";import{b as Kc}from"./chunk-5OGYXLOR.js";import"./chunk-4KFSSETE.js";import"./chunk-EWK3UPEN.js";import"./chunk-AFOP7DVG.js";import{b as Qc,c as fn,d as ne}from"./chunk-ZUZ6QJRA.js";import"./chunk-KGNE5CIM.js";import"./chunk-6PURZLKM.js";import{a as Nc}from"./chunk-P7V24ZXP.js";import"./chunk-YDPTSDIJ.js";import"./chunk-4WKFM72U.js";import"./chunk-MQU6EA44.js";import"./chunk-3AGP2BVN.js";import{a as Za,b as Ka,c as $a}from"./chunk-3JATEWA5.js";import{A as fr,B as fc,C as hc,D as No,E as wc,G as Bc,H as An,I as Qn,J as pn,K as wr,L as Dc,M as ko,a as Wi,b as bo,c as Co,d as $s,e as xa,f as Va,g as Fa,h as Ga,i as Ua,j as ja,k as Oa,l as pr,m as nc,n as tc,o as Et,p as rc,q as oc,r as ic,s as sc,t as ac,u as cc,v as lc,w as pc,x as Qo,y as Ro}from"./chunk-BK3LWNKB.js";import{a as gr,b as Xa,c as qa,d as mr,e as Ar,f as en}from"./chunk-OSEXVHEN.js";import{a as uc,c as gc,d as mc,f as Ac}from"./chunk-FQ2AMM3E.js";import{a as ur,b as Ya}from"./chunk-ZVSZ6DIQ.js";import"./chunk-SO3IXFAJ.js";import{a as $e}from"./chunk-HMGM4KO6.js";import"./chunk-A74JRNNX.js";import"./chunk-DRWHVVW6.js";import"./chunk-WD52ZNQY.js";import{a as Ee}from"./chunk-S5PIVHPC.js";import{k as wt,n as Ec}from"./chunk-BV7NUIRT.js";import{b as es}from"./chunk-V57R4X3O.js";import"./chunk-W3USRQX6.js";import{b as bt,c as hr}from"./chunk-5XVWT6UK.js";import"./chunk-DAV4ONGS.js";import"./chunk-H6QHG62O.js";import"./chunk-ABNQL3PQ.js";import"./chunk-BSRSXYDZ.js";import"./chunk-CB4ARIHR.js";import{a as Wa}from"./chunk-UZKVV3LW.js";import{c as La,j as Sn}from"./chunk-V4SL74TK.js";import{b as Le}from"./chunk-77ZZQJLX.js";import"./chunk-JIRNI5TB.js";import"./chunk-UTM7D4PI.js";import{a as ts,b as rs,c as os,d as Mo,e as lr,f as _a}from"./chunk-55W3WAAL.js";import{a as mt,c as ea,d as na,e as ta,f as ra,g as oa}from"./chunk-QYWWL7M7.js";import{a as Xs,c as qs,d as _s,e as Io}from"./chunk-SBW3QVHN.js";import"./chunk-MZ4GTIO2.js";import{a as ns}from"./chunk-2VLM4L3S.js";import"./chunk-5Y2G4NC7.js";import"./chunk-4FA44D6S.js";import"./chunk-PHKJIJ7D.js";import{d as ec}from"./chunk-BHSHGWBL.js";import"./chunk-S3DAAAE5.js";import{b as dc}from"./chunk-PBVNX43X.js";import"./chunk-DJ76NDW6.js";import{D as Ia,E as Ma,F as _n,G as nt,M as dr,e as je,g as ia,k as aa,n as ca,o as da,p as la,q as ua,r as er,v as pa,w as fa,x as ha}from"./chunk-TO2ROHIJ.js";import"./chunk-5HJRYEOT.js";import{b as mn,d as Na,e as ya,f as ka}from"./chunk-CVVZ6NWR.js";import"./chunk-PEHVBCXM.js";import{c as ir,d as sr}from"./chunk-ZIRSTOEV.js";import{a as ft}from"./chunk-TCK7WR3M.js";import"./chunk-WMGKUERB.js";import"./chunk-QLGQDNA3.js";import"./chunk-2EKLTUY2.js";import"./chunk-IINZZ4BZ.js";import"./chunk-EWSNJ3IX.js";import{a as Ra,b as et}from"./chunk-X3O4VGTM.js";import{b as Pa}from"./chunk-BIXABKSK.js";import"./chunk-7V6JPZBM.js";import"./chunk-IDWAG6L4.js";import{b as Zt,c as Kt,d as vn}from"./chunk-YZP4F23B.js";import"./chunk-72KYMWQ5.js";import"./chunk-CCOD4GQJ.js";import{e as ks,f as xs,h as wo}from"./chunk-JQ64X2TO.js";import"./chunk-TDPWFYTJ.js";import{a as Ha}from"./chunk-JJDD4HPX.js";import{a as gn}from"./chunk-73Y6T2UK.js";import{d as Ba}from"./chunk-XMPTFXPW.js";import{f as Do,g as vo,k as ma}from"./chunk-TXRWH6HL.js";import"./chunk-EG3B52WU.js";import{d as ga,e as Aa,f as nr,g as tr,h as Xn,i as rr,j as or,k as qn}from"./chunk-TLYFHPNM.js";import{b as Ne,c as Kn,d as sa}from"./chunk-Z36KVIRR.js";import{a as Wn,b as Zn,d as $t,f as Bo}from"./chunk-Q4JV4U65.js";import"./chunk-UVBPUZC4.js";import"./chunk-LCBDNZL3.js";import"./chunk-P43YHCF3.js";import"./chunk-SMXABALN.js";import{b as xe}from"./chunk-QXZGBYGQ.js";import{a as Fs,b as Gs,g as qt,h as _t}from"./chunk-PMYN3XMN.js";import{a as Xt,b as Tn,c as Vs}from"./chunk-VE3SUJMA.js";import{a as Us}from"./chunk-GPIVYCHQ.js";import"./chunk-RFHMDQXZ.js";import{f as fs,j as hs}from"./chunk-Q5B54TR5.js";import"./chunk-SMSQVGLH.js";import{a as Dn}from"./chunk-4QV2RL6P.js";import{a as Ss,b as Qs,e as Rs}from"./chunk-WHMCVH3T.js";import{a as on,b as Lt,c as zt,e as Bs,f as Ds,h as vs,i as Ts}from"./chunk-F2F257PU.js";import{a as gt,c as Cs,d as ho,f as Is,g as Ms}from"./chunk-5D7ENQTQ.js";import{b as ms,c as As,e as ps}from"./chunk-SZQNYDST.js";import{a as Es,b as un,c as Bn,d as fo,e as Pt,h as Ht,i as ws,k as bs}from"./chunk-ECPSBI2Z.js";import"./chunk-FTP2K6RS.js";import"./chunk-WLEWXE6L.js";import{b as ut}from"./chunk-NMCE7VR2.js";import{h as gs}from"./chunk-MTMHB5LF.js";import{b as Ln,d as At,e as zn}from"./chunk-GMSWZIAS.js";import{e as Wt}from"./chunk-SB26HQO7.js";import"./chunk-QEBVYQNC.js";import"./chunk-6CMBA5SG.js";import{a as Pn}from"./chunk-FCD3NYOM.js";import"./chunk-3G2LSTK5.js";import{a as ds,b as ls,d as us}from"./chunk-454IWKHT.js";import{e as cs}from"./chunk-2KPJ62RZ.js";import{a as as}from"./chunk-MMBBQ4OZ.js";import{j as Ut}from"./chunk-JM45SLKV.js";import{a as jt,b as Ot,c as Yt}from"./chunk-TZXXJWHA.js";import"./chunk-4G2T54FE.js";import"./chunk-OX3ZAGCH.js";import{a as Mn,b as Gt}from"./chunk-WN5VKKJ3.js";import"./chunk-KJZD2ADR.js";import"./chunk-3O2RPYPM.js";import"./chunk-RNKJXVG2.js";import{a as Yn}from"./chunk-HCBYKLMW.js";import{a as is,d as ss}from"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import{a as Gi}from"./chunk-S74NLCFZ.js";import{i as Rc}from"./chunk-56NUPYFG.js";import"./chunk-LZPYIFHZ.js";import"./chunk-GRQKMOKE.js";import"./chunk-3CFAE36M.js";import"./chunk-GBQ4K25P.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import"./chunk-C3DMMAFP.js";import"./chunk-AQ2OG2EF.js";import"./chunk-REKHAN53.js";import{a as bc,c as Cc,h as Ic,j as Mc}from"./chunk-32MFECUA.js";import"./chunk-4IEQNX7F.js";import{b as Er,c as yo}from"./chunk-UVL6XQHU.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import{b as za,c as Ja}from"./chunk-EHB55V23.js";import"./chunk-TD6GCEIK.js";import"./chunk-TFSWG7AS.js";import"./chunk-JBUKEIYL.js";import"./chunk-W5EDS4DF.js";import"./chunk-XB6BJPDL.js";import"./chunk-ZCIWQHCO.js";import"./chunk-5ORBAYTU.js";import"./chunk-ATCJ7EHL.js";import{a as ht}from"./chunk-PVN64537.js";import{B as cr,Ha as $n,r as Ta,s as Sa,w as Qa}from"./chunk-7WWCIS2B.js";import"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-4C7WVQOD.js";import{R as wa,S as ba,p as Ea,vb as Ca}from"./chunk-5EAJO372.js";import"./chunk-DBMW3VUN.js";import{f as To}from"./chunk-KU3YHPWZ.js";import"./chunk-OKCVG7AG.js";import"./chunk-XDAFRUAJ.js";import"./chunk-7V4BQSSV.js";import{a as So}from"./chunk-QXQ7KVEN.js";import{a as Da,d as ar,e as va}from"./chunk-DXXHCLFC.js";import{e as Ws,g as Zs,h as Ks}from"./chunk-IQMJJN52.js";import"./chunk-QSCXXNC2.js";import{a as Hs}from"./chunk-APXJRWIJ.js";import{c as Ls,g as pt,h as Jn,i as zs,l as Js}from"./chunk-CBEMXSWF.js";import"./chunk-G4K3TP2I.js";import"./chunk-YJAQZMJT.js";import"./chunk-6PIIUAZF.js";import"./chunk-ZAQGIC33.js";import{l as Fi}from"./chunk-HYJVYYAZ.js";import{a as Os,b as Ys,d as Ps}from"./chunk-XTQUCCJH.js";import{a as Jt,b as Hn,c as Eo}from"./chunk-VZ7KXRXB.js";import{a as lt}from"./chunk-4QTH7VYE.js";import"./chunk-GMTHZUZ3.js";import{a as he}from"./chunk-73EHVDL5.js";import{a as Ae}from"./chunk-YWQNZRJG.js";import{a as De,b as oe,j as co,q as lo,z as ae}from"./chunk-YKOZBFR3.js";import{a as Ui}from"./chunk-WTMCDYR3.js";import{d as ji,i as Oi,j as Yi,m as On,n as Pi,o as uo,p as Hi,q as M,r as dt,s as Li,t as go,u as zi}from"./chunk-WMXBRC4B.js";import"./chunk-ZCRZFAOT.js";import"./chunk-RZ4F3BHX.js";import"./chunk-U5V3L5QH.js";import"./chunk-E47GFYXA.js";import{a as Ie,b as ce,c as In,i as mo,j as Vt}from"./chunk-33DWJV67.js";import{a as Ji}from"./chunk-FOJHSG5M.js";import{a as jn}from"./chunk-6YGTRKDT.js";import{b as ln}from"./chunk-2XW33VOK.js";import"./chunk-7HO4NX5W.js";import{a as Ao,b as Zi,c as Ki,f as po,h as rn,j as Xi,m as Ft,n as qi,o as _i,p as $i}from"./chunk-A7RJQJNT.js";import{e as He}from"./chunk-UR6MHSHU.js";var _c=He(jn(),1);var Ct=class extends _c.default.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(n,t){M(1,`Uncaught exception: ${n.name}: ${n.message}`,!0,`${n.stack??""}
3
+ import{c as br}from"./chunk-QJ5XHVS5.js";import{a as Ns,b as ys,c as js,d as vc,e as Tc,f as Sc}from"./chunk-XJV5SF3X.js";import"./chunk-IPXITNFD.js";import"./chunk-S5UITUBB.js";import{a as jc,b as Oc,c as Yc,d as Pc,e as Hc,f as Lc,g as zc,h as Jc,i as Xc}from"./chunk-J5D4IGAM.js";import{b as qc}from"./chunk-HHF7AM3D.js";import{a as kc,b as xc,c as Vc,d as Fc,e as Gc,f as Uc,h as Cr}from"./chunk-UWQ4KXLB.js";import"./chunk-3MSXQU2C.js";import"./chunk-BLHFNL5K.js";import{c as yc}from"./chunk-SACFQNUH.js";import"./chunk-EIQSXD7B.js";import"./chunk-JVXEAO62.js";import{a as Wc,b as Zc}from"./chunk-7LYLJ75Z.js";import{b as Kc}from"./chunk-ITG5WMQG.js";import"./chunk-RU3SWHRE.js";import"./chunk-SLISNOG6.js";import"./chunk-EP4WGGMY.js";import{b as Qc,c as fn,d as ne}from"./chunk-ZUZ6QJRA.js";import"./chunk-KGNE5CIM.js";import"./chunk-BFRWZPIK.js";import{a as Nc}from"./chunk-MIQ6J5YG.js";import"./chunk-YDPTSDIJ.js";import"./chunk-MBNSCXVK.js";import"./chunk-LXYXCANZ.js";import"./chunk-3AGP2BVN.js";import{a as Za,b as Ka,c as $a}from"./chunk-VJRXJJML.js";import{A as fr,B as fc,C as hc,D as No,E as wc,G as Bc,H as An,I as Qn,J as pn,K as wr,L as Dc,M as ko,a as Wi,b as bo,c as Co,d as $s,e as xa,f as Va,g as Fa,h as Ga,i as Ua,j as ja,k as Oa,l as pr,m as nc,n as tc,o as Et,p as rc,q as oc,r as ic,s as sc,t as ac,u as cc,v as lc,w as pc,x as Qo,y as Ro}from"./chunk-YQXOD7SV.js";import{a as gr,b as Xa,c as qa,d as mr,e as Ar,f as en}from"./chunk-TC2PHBPH.js";import{a as uc,c as gc,d as mc,f as Ac}from"./chunk-TPCW5OU5.js";import{a as ur,b as Ya}from"./chunk-5OFHMBZC.js";import"./chunk-2NP3THOE.js";import{a as $e}from"./chunk-66C5A2F5.js";import"./chunk-UWEBI76C.js";import"./chunk-HY5BBSYX.js";import"./chunk-WD52ZNQY.js";import{a as Ee}from"./chunk-F4GWIX66.js";import{k as wt,n as Ec}from"./chunk-AXOSLGQ4.js";import{b as es}from"./chunk-7TSM2FCL.js";import"./chunk-W3USRQX6.js";import{b as bt,c as hr}from"./chunk-5XVWT6UK.js";import"./chunk-NNVHWFLI.js";import"./chunk-PZOQ2IQK.js";import"./chunk-FNBHP75S.js";import"./chunk-BSRSXYDZ.js";import"./chunk-CB4ARIHR.js";import{a as Wa}from"./chunk-FOUUD3LI.js";import{c as La,j as Sn}from"./chunk-V4SL74TK.js";import{b as Le}from"./chunk-77ZZQJLX.js";import"./chunk-JIRNI5TB.js";import"./chunk-UTM7D4PI.js";import{a as ts,b as rs,c as os,d as Mo,e as lr,f as _a}from"./chunk-C4UME2PA.js";import{a as mt,c as ea,d as na,e as ta,f as ra,g as oa}from"./chunk-5K7PCSTP.js";import{a as Xs,c as qs,d as _s,e as Io}from"./chunk-Y3RDLUH5.js";import"./chunk-J3YID4A5.js";import{a as ns}from"./chunk-Q4QCSO6Y.js";import"./chunk-5Y2G4NC7.js";import"./chunk-LWP7E5FU.js";import"./chunk-YTWBNACA.js";import{d as ec}from"./chunk-BHSHGWBL.js";import"./chunk-S3DAAAE5.js";import{b as dc}from"./chunk-4DM5EWEV.js";import"./chunk-BDZWRJAL.js";import{D as Ia,E as Ma,F as _n,G as nt,M as dr,e as je,g as ia,k as aa,n as ca,o as da,p as la,q as ua,r as er,v as pa,w as fa,x as ha}from"./chunk-76MKY7FG.js";import"./chunk-MAQVRBUQ.js";import{b as mn,d as Na,e as ya,f as ka}from"./chunk-FP6JCXOS.js";import"./chunk-PEHVBCXM.js";import{c as ir,d as sr}from"./chunk-ZIRSTOEV.js";import{a as ft}from"./chunk-TCK7WR3M.js";import"./chunk-WMGKUERB.js";import"./chunk-QLGQDNA3.js";import"./chunk-2EKLTUY2.js";import"./chunk-IINZZ4BZ.js";import"./chunk-IT6M7OMG.js";import{a as Ra,b as et}from"./chunk-RM5ZVDVR.js";import{b as Pa}from"./chunk-NGBXXBHP.js";import"./chunk-6VG2FG67.js";import"./chunk-CJGQFKLJ.js";import{b as Zt,c as Kt,d as vn}from"./chunk-37KFCYHG.js";import"./chunk-72KYMWQ5.js";import"./chunk-CCOD4GQJ.js";import{e as ks,f as xs,h as wo}from"./chunk-JQ64X2TO.js";import"./chunk-TDPWFYTJ.js";import{a as Ha}from"./chunk-QRUAI2ST.js";import{a as gn}from"./chunk-73Y6T2UK.js";import{d as Ba}from"./chunk-XMPTFXPW.js";import{f as Do,g as vo,k as ma}from"./chunk-C466XER3.js";import"./chunk-SDIHDYWT.js";import{d as ga,e as Aa,f as nr,g as tr,h as Xn,i as rr,j as or,k as qn}from"./chunk-YLI7DQMJ.js";import{b as Ne,c as Kn,d as sa}from"./chunk-Z36KVIRR.js";import{a as Wn,b as Zn,d as $t,f as Bo}from"./chunk-Q4JV4U65.js";import"./chunk-LPJX5L3F.js";import"./chunk-5LKDOE3P.js";import"./chunk-UJYC2XDD.js";import"./chunk-SMXABALN.js";import{b as xe}from"./chunk-PCL2FYPE.js";import{a as Fs,b as Gs,g as qt,h as _t}from"./chunk-642GD7E6.js";import{a as Xt,b as Tn,c as Vs}from"./chunk-VE3SUJMA.js";import{a as Us}from"./chunk-SFHDRKUX.js";import"./chunk-RFHMDQXZ.js";import{f as fs,j as hs}from"./chunk-6WN4WSXR.js";import"./chunk-63BFLTJI.js";import{a as Dn}from"./chunk-VEE2O524.js";import{a as Ss,b as Qs,e as Rs}from"./chunk-FLGOQ6Q6.js";import{a as on,b as Lt,c as zt,e as Bs,f as Ds,h as vs,i as Ts}from"./chunk-F2F257PU.js";import{a as gt,c as Cs,d as ho,f as Is,g as Ms}from"./chunk-5D7ENQTQ.js";import{b as ms,c as As,e as ps}from"./chunk-2G7UYQOW.js";import{a as Es,b as un,c as Bn,d as fo,e as Pt,h as Ht,i as ws,k as bs}from"./chunk-A5C7HIAH.js";import"./chunk-2AHQ3D3D.js";import"./chunk-WLEWXE6L.js";import{b as ut}from"./chunk-LMOW4NM5.js";import{h as gs}from"./chunk-MTMHB5LF.js";import{b as Ln,d as At,e as zn}from"./chunk-FHULYIG3.js";import{e as Wt}from"./chunk-SB26HQO7.js";import"./chunk-YUFXE6WU.js";import"./chunk-HTJDMLZS.js";import{a as Pn}from"./chunk-FCD3NYOM.js";import"./chunk-3G2LSTK5.js";import{a as ds,b as ls,d as us}from"./chunk-MUL2QFG2.js";import{e as cs}from"./chunk-QWEQ742S.js";import{a as as}from"./chunk-MMBBQ4OZ.js";import{j as Ut}from"./chunk-VKIUHHNT.js";import{a as jt,b as Ot,c as Yt}from"./chunk-TZXXJWHA.js";import"./chunk-CQBLJTDU.js";import"./chunk-V3IWCGZT.js";import{a as Mn,b as Gt}from"./chunk-WN5VKKJ3.js";import"./chunk-PE3CEG6E.js";import"./chunk-2MBNAW2G.js";import"./chunk-NIBNVPAE.js";import{a as Yn}from"./chunk-HCBYKLMW.js";import{a as is,d as ss}from"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import{a as Gi}from"./chunk-WAC5WISH.js";import{i as Rc}from"./chunk-PSBR2LVL.js";import"./chunk-LZPYIFHZ.js";import"./chunk-GRQKMOKE.js";import"./chunk-3CFAE36M.js";import"./chunk-GBQ4K25P.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import"./chunk-C3DMMAFP.js";import"./chunk-AQ2OG2EF.js";import"./chunk-REKHAN53.js";import{a as bc,c as Cc,h as Ic,j as Mc}from"./chunk-32MFECUA.js";import"./chunk-4IEQNX7F.js";import{b as Er,c as yo}from"./chunk-UVL6XQHU.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import{b as za,c as Ja}from"./chunk-EHB55V23.js";import"./chunk-TD6GCEIK.js";import"./chunk-TFSWG7AS.js";import"./chunk-JBUKEIYL.js";import"./chunk-W5EDS4DF.js";import"./chunk-XB6BJPDL.js";import"./chunk-ZCIWQHCO.js";import"./chunk-5ORBAYTU.js";import"./chunk-XRJH4UF3.js";import{a as ht}from"./chunk-PVN64537.js";import{B as cr,Ha as $n,r as Ta,s as Sa,w as Qa}from"./chunk-RHQLDNZL.js";import"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-4C7WVQOD.js";import{R as wa,S as ba,p as Ea,vb as Ca}from"./chunk-5EAJO372.js";import"./chunk-DBMW3VUN.js";import{f as To}from"./chunk-KU3YHPWZ.js";import"./chunk-OKCVG7AG.js";import"./chunk-XDAFRUAJ.js";import"./chunk-7V4BQSSV.js";import{a as So}from"./chunk-QXQ7KVEN.js";import{a as Da,d as ar,e as va}from"./chunk-R6S4EJ5R.js";import{e as Ws,g as Zs,h as Ks}from"./chunk-BZEW7CSM.js";import"./chunk-QSCXXNC2.js";import{a as Hs}from"./chunk-UV7FPIBL.js";import{c as Ls,g as pt,h as Jn,i as zs,l as Js}from"./chunk-CBEMXSWF.js";import"./chunk-G4K3TP2I.js";import"./chunk-YJAQZMJT.js";import"./chunk-6PIIUAZF.js";import"./chunk-ZAQGIC33.js";import{l as Fi}from"./chunk-HYJVYYAZ.js";import{a as Os,b as Ys,d as Ps}from"./chunk-XTQUCCJH.js";import{a as Jt,b as Hn,c as Eo}from"./chunk-VZ7KXRXB.js";import{a as lt}from"./chunk-4QTH7VYE.js";import"./chunk-GMTHZUZ3.js";import{a as he}from"./chunk-V24LUINK.js";import{a as Ae}from"./chunk-JYH7CTF7.js";import{A as ae,a as De,b as oe,k as co,r as lo}from"./chunk-BRWCWZE3.js";import{a as Ui}from"./chunk-WTMCDYR3.js";import{d as ji,i as Oi,j as Yi,m as On,n as Pi,o as uo,p as Hi,q as M,r as dt,s as Li,t as go,u as zi}from"./chunk-WMXBRC4B.js";import"./chunk-ZCRZFAOT.js";import"./chunk-RZ4F3BHX.js";import"./chunk-U5V3L5QH.js";import"./chunk-E47GFYXA.js";import{a as Ie,b as ce,c as In,i as mo,j as Vt}from"./chunk-33DWJV67.js";import{a as Ji}from"./chunk-FOJHSG5M.js";import{a as jn}from"./chunk-6YGTRKDT.js";import{b as ln}from"./chunk-2XW33VOK.js";import"./chunk-7HO4NX5W.js";import{a as Ao,b as Zi,c as Ki,f as po,h as rn,j as Xi,m as Ft,n as qi,o as _i,p as $i}from"./chunk-A7RJQJNT.js";import{e as He}from"./chunk-UR6MHSHU.js";var _c=He(jn(),1);var Ct=class extends _c.default.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(n,t){M(1,`Uncaught exception: ${n.name}: ${n.message}`,!0,`${n.stack??""}
4
4
  ${t.componentStack??""}`)}render(){return this.state.failed?null:this.props.children}};var Fn=He(jn(),1);import pe from"process";import*as Wu from"tls";function $c(){let e=Wu;if(typeof e.getCACertificates!="function"||typeof e.setDefaultCACertificates!="function")return[];try{let n=r=>typeof r=="string",t=e.getCACertificates("default").filter(n),i=e.getCACertificates("system").filter(n),o=[...new Set([...t,...i])];return e.setDefaultCACertificates(o),o}catch{return[]}}import{createHash as Zu}from"crypto";import{mkdirSync as Ku,readdirSync as Xu,renameSync as qu,rmSync as rd,statSync as xo,utimesSync as _u,writeFileSync as $u}from"fs";import{join as Ir}from"path";var ed=`
5
5
  # Issuer: CN=COMODO ECC Certification Authority O=COMODO CA Limited
6
6
  # Subject: CN=COMODO ECC Certification Authority O=COMODO CA Limited
@@ -3980,11 +3980,11 @@ ${e.match(/.{1,64}/g).join(`
3980
3980
  Run an objective with: kane-cli run "<objective>"
3981
3981
  List all commands: kane-cli --help
3982
3982
  `}function vd(e,n){let t=e.indexOf("--"),i=t===-1?e:e.slice(0,t);return n.stdin&&n.stdout&&!i.includes("--agent")}function Dr(e){let n=e.indexOf("--"),t=n===-1?e:e.slice(0,n),i;for(let o=0;o<t.length;o++)t[o]==="--mode"?i=t[++o]:t[o].startsWith("--mode=")&&(i=t[o].slice(7));return i==="agent"}function Td(e,n,t=50){let i=!1,o=(r,a)=>{if(!a)return;let s=r.line(a);s!=null&&n(s)};return{eager(){for(let r of e)r.promise.then(a=>{i||o(r,a)}).catch(()=>{})},async bounded(){if(i)return;let r=new Promise(s=>{setTimeout(()=>s(null),t).unref?.()}),a=await Promise.all(e.map(s=>Promise.race([s.promise.catch(()=>null),r])));i=!0,a.forEach((s,l)=>o(e[l],s))},silence(){i=!0}}}function Sd(e,n,t=!1){return n||e==="context"||e==="explore"?"silence":e==="design"?"bounded":"eager"}import{join as Ag}from"path";function Qd(e){let n=e.command("testmd").description("Manage test.md files (run, list, status, delete, export, sync)").action(async()=>{process.stdin.isTTY||(process.stderr.write(`error: testmd requires a sub-action in non-TTY mode (run | list | status | delete | export | sync)
3983
- `),process.exit(2));let{runListTui:t,resolveCurrentOrgId:i}=await import("./testmd-actions-BE4YJ6ZZ.js"),o=await i({});o.ok||process.exit(o.code),process.exit(await t(o.orgId))});pg(n),fg(n),hg(n),Eg(n),wg(n),bg(n)}function jo(e,n){return n.concat(e)}function pg(e){e.command("run <path>").description("Run a test from a *_test.md file").option("--url <url>","Start URL for the first step (overrides frontmatter url: and config default_url)").option("--override-start-url <url>","Retarget the test's start: replay opens <url> instead of the start URL the test recorded, and authoring/heal starts there (http/https only). Later navigations and URL assertions are not rewritten. A run that passes after a heal, or any --push, records and commits the steps as they ran, so the first step's recording then points at <url>; add --local to keep a CI run from writing anything back. For CI against a PR build, e.g. http://localhost:3000").option("--headless","Run Chrome in headless mode").option("--max-steps <n>","Max agent steps","50").option("--timeout <seconds>","Kill after N seconds").option("--cdp-endpoint <url>","Connect to existing Chrome via CDP").option("--ws-endpoint <url>","Playwright WebSocket endpoint").option("--global-context <file>",`Override global context (default: ${Ag(oe,"global-memory.md")})`).option("--local-context <file>","Override local context (default: .testmuai/context.md in cwd)").addOption(new ne("--model <name>","Model override").hideHelp()).option("--variables <json>","Inline variables JSON").option("--variables-file <path>","Load variables from file").option("--dataset-id <id>","Test Manager dataset whose row supplies the ${column} parameters (overrides the file's dataset:)").option("--dataset-version <id>","The dataset version the row belongs to (row ids are re-minted on every dataset edit); omitted reads the dataset's latest version").option("--dataset-row <_id>","The row to use, by its _id as Test Manager shows it (overrides the file's dataset.row; a missing or unknown id lists the rows)").option("--session-context <json>","Session context JSON (prior runs)").addOption(new ne("--cft","Use Playwright Chromium instead of managed Chrome").hideHelp()).option("--username <user>","Basic auth username (skip OAuth)").option("--access-key <key>","Basic auth access key").option("--env <name>","Environment (prod or stage)").option("--mode <name>","Run mode: action | testing | agent (same as --agent)").option("--assertion-mode <mode>","Assertion mode: dom (default \u2014 DOM extraction & assertions, vision fallback) | visual (vision only)").option("--final-validation <on|off>","Final validation: append the system cp_final checkpoint. Overrides config (default: off)").option("--agent","Agent mode: plain NDJSON output, no colors/UI").option("--task-skills","Enable domain-specific task skills (experimental)").addOption(new ne("--local","Skip TMS integration (no uploads, no variables/secrets push)").hideHelp()).option("--allow-missing-url","Non-TTY only: proceed from the browser's current page instead of failing when the first step has no start URL (frontmatter url:/--url still used)").option("--code-export","Generate code export after upload").option("--code-language <lang>","Code-export language (python|javascript)").option("--name <name>","Persist session under this name").option("--target <name>","Where to run: desktop | emulator | simulator (default: the file's `target:`, else desktop)").option("--device-name <name>","Which device, when the target is mobile: the name as `kane-cli devices list` shows it. The OS version comes from --os-version or the file's os_version:. On a real device (`target: android|ios`): a name or pattern from `kane-cli devices list --target android|ios --remote`; unset = the hub picks any free device").option("--os-version <version>","The device's OS version (e.g. 17.5, 14). Alone = re-version the file's device (or any device on that version). Unset on a real device = any version").option("--app <path|AppId>","App under test, when the target is mobile: a build (.apk / .zip of the .app; on a real device .apk / .aab / .ipa) or an APP\u2026 id from your uploads. Overrides the file's `app:`").option("--no-stream","On a real device: do not show its live view (default: its own window at a terminal; never for an agent)").option("--tunnel",on.tunnel).option("--tunnel-name <name>",on.tunnelName).option("--skip-code-validation","Skip post-codegen validation").option("--no-skip-code-validation","Force post-codegen validation").option("--on-lock-conflict <mode>","lock conflict policy: readonly|fail|wait",n=>{if(n!=="readonly"&&n!=="fail"&&n!=="wait")throw new Error(`--on-lock-conflict must be readonly|fail|wait, got: ${n}`);return n}).option("--push","always commit at end-of-run (no retry semantics)").option("--no-adaptive-heal","disable adaptive heal \u2014 a replay miss becomes terminal instead of re-authoring the failing tail (default: heal on, 3 attempts then a full re-author)").addOption(new ne("--retry","(retired) adaptive heal is on by default").hideHelp()).addOption(new ne("--retry-count <n>","(retired) heal budget is fixed at 3").argParser(n=>{let t=parseInt(n,10);if(Number.isNaN(t)||t<0)throw new Error(`--retry-count must be a non-negative integer, got: ${n}`);return n}).hideHelp()).option("--author","re-author every step in place on the test's existing identity and commit a new version (a never-authored test takes the first-run path)").option("--policy <file>","Judge the sealed evidence pack against this policy YAML (repeatable). Each verdict is written to <pack>.verdicts/<policy-id>.verdict.json; a failing verdict exits 1, an errored one 3",jo,[]).option("--policy-id <id>","Judge the sealed evidence pack against this Test Manager policy (latest version; repeatable; see `kane-cli policy list`). Combines with --policy",jo,[]).addOption(new ne("--assurance-case <caseId:tc>","the Test Manager case the dispatching laptop found for this designed test").hideHelp()).addOption(new ne("--no-evidence-publish","skip the replay evidence publish (blob upload + TMS /evidence/ingest) \u2014 the run leaves no execution record in TMS").hideHelp()).addOption(new ne("--no-testmd-sync","skip the testmd bundle push before the commit \u2014 the caller owns the bundle for that commit").hideHelp()).option("--bug-detection <mode>","detect product bugs while authoring: off|stop|continue (stop halts the run on a confirmed bug; continue records it and keeps going). Overrides `config set-bug-detection`. Authoring steps only \u2014 replay failures always investigate.",n=>{if(n!=="off"&&n!=="stop"&&n!=="continue")throw new Error(`--bug-detection must be off, stop or continue, got: ${n}`);return n}).option("--assertion-failure-mode <mode>","What a failed assertion does while authoring: stop|continue (stop ends the run at the failed checkpoint; continue marks it failed and keeps going \u2014 a failed final verification still ends the run). Authoring only; replay always stops. Overrides `config set-assertion-failure-mode`.",n=>{if(n!=="stop"&&n!=="continue")throw new Error(`--assertion-failure-mode must be stop or continue, got: ${n}`);return n}).action(async(n,t)=>{let{retiredRetryFlagsNotice:i}=await import("./replay-policy-A62KXE6Y.js"),o=i(t);o&&process.stderr.write(o+`
3984
- `);let{runTestMdFile:r}=await import("./run-test-md-24MBKBC6.js"),a=await r(n,t),{exitAfterCommandSend:s}=await import("./command-span-HZSKIZH7.js");await s(a)})}function fg(e){e.command("list").description("List *_test.md files in the working directory (recursive)").option("--root <dir>","Root directory to scan (default: cwd)").option("--ignore <name>","Skip a directory by name (repeatable)",jo,[]).option("--json","Force NDJSON output even on TTY").action(async n=>{let{runListAction:t,resolveCurrentOrgId:i}=await import("./testmd-actions-BE4YJ6ZZ.js"),o=await i({json:!!n.json});o.ok||process.exit(o.code),process.exit(await t(n,o.orgId))})}function hg(e){e.command("status <path>").description("Print local meta.json for a *_test.md (no live TMS check in v1)").action(async n=>{let{runStatusAction:t,resolveCurrentOrgId:i}=await import("./testmd-actions-BE4YJ6ZZ.js"),o=await i({});o.ok||process.exit(o.code),process.exit(await t(n,o.orgId))})}function Eg(e){e.command("delete <path>").description("Remove output-<stem>/ and the *_test.md source file (TMS untouched)").option("--yes","Skip confirmation prompt (required in non-TTY)").action(async(n,t)=>{let{runDeleteAction:i,resolveCurrentOrgId:o}=await import("./testmd-actions-BE4YJ6ZZ.js"),r=await o({});r.ok||process.exit(r.code),process.exit(await i(n,!!t.yes,r.orgId))})}function wg(e){e.command("export <path>").description("Generate standalone test code (Playwright)").option("--language <lang>","python|javascript (falls back to tui-config)").option("--output <dir>","Override output dir (default: output-<stem>/playwright-<lang>-code/)").option("--force","Overwrite an existing local export").action(async(n,t)=>{let{runExportAction:i,resolveCurrentOrgId:o}=await import("./testmd-actions-BE4YJ6ZZ.js"),r=await o({});r.ok||process.exit(r.code),process.exit(await i(n,t,r.orgId))})}function bg(e){e.command("sync <path>").description("Zip the testmd + imports + replay outputs and push {commit_id}-testmd.zip to cloud").option("--env <name>","Environment (prod or stage)").option("--username <user>","Basic auth username (skip OAuth)").option("--access-key <key>","Basic auth access key").action(async(n,t)=>{let{runSyncAction:i,resolveSyncAuth:o}=await import("./testmd-actions-BE4YJ6ZZ.js"),r=await o(t);r.ok||process.exit(r.code),process.exit(await i(n,r))})}async function Oo(e){if(e==="agent")return;let{warnIfBehind:n}=await import("./store-guard-ETUXXG7X.js"),{contextDir:t}=await import("./paths-UMIX3RJF.js");await n(t(process.cwd()),i=>process.stderr.write(i+`
3985
- `))}function Rd(e){let n=e.command("context").description("Add your documents as sources, find the use-cases in them, and list what's there").action((l,d)=>{d.args.length>0&&d.error(`error: unknown command '${d.args[0]}'`,{exitCode:2,code:"commander.unknownCommand"}),d.help()});n.command("ingest <src...>").description("Add source files and find the use-cases in them, in one step. At a terminal it goes on into the chat; with --mode ci, or with no terminal, it only adds the files").option("--as <id>","Add this file as a new version of the source with this id; what came from the old version goes out of date (one file only)").option("--mode <mode>","interactive | agent | ci | override \u2014 how the use-cases are found; with ci, or with no terminal and no --mode, it only adds the files").option("--plan","Stop once the use-cases are proposed: print them, and save nothing").option("--force","Find the use-cases again, even in a version of the file that was already read").option("--trust <dial>","auto (the default) saves new use-cases to review later | hold keeps them back for you to review first (with no terminal only)").option("--project <id>","In a folder not set up yet: share its work with this Test Manager project, without asking").option("--local","In a folder not set up yet: keep its work in this folder, without asking").action(async(l,d)=>{let{ingestCommand:c}=await import("./ingest-cmd-N3USC7TW.js");process.exit(await c(l,d))}),n.command("extract").description("Find the use-cases in the sources you've added, in a chat with the agent").option("--plan","Stop once the use-cases are proposed: print them, and save nothing").option("--apply <path>","Not available yet; it will save a proposal printed by --plan (for now it refuses)").option("--mode <mode>","How it asks you: interactive | agent | ci | override. At a terminal it's the chat; with no terminal, --mode is required").option("--json","With --mode override or ci: write the NDJSON stream --mode agent writes (one shape for scripts)").option("--force","Read the sources again, even ones whose current version was already read").option("--resume <sid>","Resume the paused session with this id").option("--project <id>","In a folder not set up yet: share its work with this Test Manager project, without asking").option("--local","In a folder not set up yet: keep its work in this folder, without asking").option("--message <text>","With --resume: answer the open questions, or steer, in your own words; the agent works out what you mean").option("--source <id>","Read only the source with this id; the way to read a conversation source (its id starts su-conv-), which a plain extract skips").option("--queued","(removed) extract reads every source not read yet on its own; for one release this flag refuses and says what to do").option("--trust <dial>","auto (the default) saves what's new to review later | hold keeps everything new back for you to review first, with no terminal only (the chat refuses it); ci refuses this flag").option("--answer <pairs...>","With --resume --mode agent: answer an open question by its id, as <question id>=<option number, from 1, or your own words>; repeat it for more").option("--with-source <ref>","With --resume: add this file or page first, and set the open questions aside; the agent reads it, says what it settled, and asks again what's still open").action(async l=>{let{extractCommand:d}=await import("./extract-cmd-OJ7LXSKL.js");process.exit(await d(l))}),n.command("sessions [action] [sid]").summary("List the sessions you can resume, and show, clean, save or discard one").description("List the sessions you can resume. With a session's id, `show` prints its open questions and the defaults it assumed, and `clean` removes it (with no id, `clean` removes every expired session). In a folder linked to a shared project, `save` saves a finished session to the project, and `discard` throws a session's work away").option("--all","clean: remove ALL sessions (incl. corrupt), not just expired").option("--json","JSON output").option("--mode <mode>","save, discard: agent prints one JSON event per line, with the result last").option("--yes","save, discard: agree up front, without being asked; needed in agent mode or with no terminal").action(async(l,d,c)=>{let{sessionsCommand:u}=await import("./sessions-cmd-5NS5P4CP.js");process.exit(await Ee("sessions",()=>u(l,c,d)))});let t="interactive | agent | ci | override \u2014 agent prints one JSON event per line, with the result last",i=(l,d)=>[...d,l],o=async(l,d,c,u="sync")=>{let{syncCommand:g}=await import("./sync-cmd-CSTMT6E6.js");process.exit(await Ee(u,()=>g(l,d,c),{mode:c.mode}))},r=l=>{s.opts().answer.length>0&&l.error("error: unknown option '--answer' (it belongs to kane-cli context sync [name] and kane-cli context pull)",{exitCode:2,code:"kane.answerOnSubcommand"})},a=l=>({...s.opts().mode!==void 0?{mode:s.opts().mode}:{},...l}),s=n.command("sync [name]").description("Bring this folder and a location level: finish a rebase left open, take the location's new work, then send yours. Subcommands: setup, add, list, remove, status, doctor").option("--answer <id=choice>","Answer a rebase decision with no terminal, as <decision id>=<keep-theirs | apply-mine | apply-mine-as-new>; repeat it for more; only while a rebase is open",i,[]).option("--mode <mode>",t).action(async(l,d)=>o(l,[],{...d,answer:d.answer.length>0?d.answer:void 0}));s.command("setup").description("Guided setup: share context through GitHub, S3 or a folder, or join your team").option("--mode <mode>",t).action(async(l,d)=>{r(d);let{setupCommand:c}=await import("./sync-setup-Y53K6TJ6.js");process.exit(await c(a(l)))}),s.command("add <name> <descriptor>").description("Check a location (a GitHub repository, S3 bucket or folder), and bind this folder's context store to it under <name>").option("--credential-env <VAR>","s3: read the access key from $VAR_ID and the secret from $VAR_SECRET, stored under the user config dir with mode 0600").option("--credential-file <path>","s3: read a JSON file {accessKeyId, secretAccessKey}, stored under the user config dir with mode 0600").option("--mode <mode>",t).action(async(l,d,c,u)=>{r(u),await o("add",[l,d],a(c))}),s.command("list").description("The locations this folder's context store is bound to").option("--json","JSON output").option("--mode <mode>",t).action(async(l,d)=>{r(d),await o("list",[],a(l))}),s.command("remove <name>").description("Forget a location (the note of what was last seen there is kept)").option("--mode <mode>",t).action(async(l,d,c)=>{r(c),await o("remove",[l],a(d))}),s.command("status [name]").description("Compare this folder's context store with a location, and list the rebase decisions still open; changes nothing").option("--show <n>","Show one moved change in full, by its number in the list").option("--json","JSON output: the relation, rebase_id, decisions").option("--mode <mode>",t).action(async(l,d,c)=>{r(c),await o("status",l===void 0?[]:[l],a(d))}),s.command("doctor").description("Show the state of this folder's context store: a reset that didn't finish, its saved changes, and every rebase with its id; changes nothing unless asked").option("--abort","Undo an interrupted reset (before its import); else close the open rebase, keeping what was reapplied").option("--export <dir>","Build the store as it was before the rebase in <dir>, as a store of its own, with everything it held").option("--from <rebase-id>","With --export: which rebase (default: the open one, else the only one)").option("--json","JSON output").option("--mode <mode>",t).action(async(l,d)=>{r(d),await o("doctor",[],a(l))}),n.command("pull [name]").description("Bring your shared project's tests into this folder (in a folder linked to one), or take the new work shared at a location, checked in full before it's added. A rebase left open is finished first").option("--rebase","When you and the location both added work since you were last level: your changes since then are kept aside, the location's are taken, then yours are applied again; nothing at the location is rewritten").option("--yes","Agree to replace this folder's changes since you were last level (they're kept first); it doesn't answer rebase decisions").option("--answer <id=choice>","Answer a rebase decision with no terminal, as <decision id>=<keep-theirs | apply-mine | apply-mine-as-new>; repeat it for more; only while a rebase is open",i,[]).option("--project <id>","In a folder that isn't set up yet: join this shared project, reading no documents, then bring its tests").option("--use-case <id>","Only this use-case's tests, with the tests they use").option("--overwrite","Replace the test files you changed here with the project's").option("--mode <mode>",t).action(async(l,d)=>{let[{pullRoute:c},{chooseStore:u}]=await Promise.all([import("./pull-route-MHW5PWDW.js"),import("./store-choice-ZWU3PDNL.js")]),g=c(l,d,u(process.cwd()));if(typeof g!="string"){let{printRefusal:w}=await import("./gate-SM4HPJLA.js");process.exit(w(g,"pull",d.mode==="agent"))}if(g==="project"){let{runProjectPull:w}=await import("./pull-cmd-C4HMYD4I.js"),{project:D,useCase:O,overwrite:V,mode:v}=d;process.exit(await Ee("pull",()=>w({...v!==void 0?{mode:v}:{},...D!==void 0?{project:D}:{},...O!==void 0?{useCase:O}:{},...V?{overwrite:V}:{}}),{mode:d.mode}))}let{pullCommand:m}=await import("./sync-cmd-CSTMT6E6.js"),{mode:f,rebase:A,yes:h,answer:p}=d;process.exit(await Ee("pull",()=>m(l,{...f!==void 0?{mode:f}:{},...A!==void 0?{rebase:A}:{},...h!==void 0?{yes:h}:{},answer:p.length>0?p:void 0}),{mode:d.mode}))}),n.command("impact",{hidden:!0}).description("Trace a changelog, a PR diff or PR text to the tests of your shared project it touches (in a folder linked to one)").requiredOption("--input <file...>","The change to trace: a file, or - to read it from stdin; give more than one to trace them together").option("--mode <mode>",t).action(async l=>{let{runImpact:d}=await import("./impact-cmd-EL3QSOAF.js"),{input:c,mode:u}=l;process.exit(await Ee("impact",g=>d({input:c,...u!==void 0?{mode:u}:{}},void 0,void 0,{telemetry:g}),{mode:l.mode}))}),n.command("push [name]").description("Send this folder's new work, with its files and proposals, to a location; it refuses while the location has work this folder hasn't pulled yet").option("--mode <mode>","interactive | agent | ci | override \u2014 agent prints one JSON event per line, with the result last").action(async(l,d)=>{let{pushCommand:c}=await import("./sync-cmd-CSTMT6E6.js");process.exit(await Ee("push",()=>c(l,d),{mode:d.mode}))}),n.command("clone [descriptor] [dir]").description("Copy the context shared at a location into a new store in [dir] (default: the last part of the location's name), and remember the location as `origin`").option("--credential-env <VAR>","s3: read the access key from $VAR_ID and the secret from $VAR_SECRET, stored under `origin` for the clone").option("--credential-file <path>","s3: read a JSON file {accessKeyId, secretAccessKey}, stored under `origin` for the clone").option("--mode <mode>","interactive | agent | ci | override \u2014 agent prints one JSON event per line, with the result last").action(async(l,d,c)=>{let{cloneCommand:u}=await import("./sync-cmd-CSTMT6E6.js");process.exit(await Ee("clone",()=>u(l,d,c),{mode:c.mode}))}),n.command("fsck").description("Check this folder's context store for damage: every saved change is verified, and what the store shows is checked against them").option("--json","Print the whole report as one JSON object (each problem with its code, detail and the ids of the changes it's in)").action(async l=>{let{fsckCommand:d}=await import("./maintenance-cmd-BLV7K4RK.js");process.exit(await Ee("fsck",c=>d(c,l)))}),n.command("locks",{hidden:!0}).description("Show held context/UC locks and waiters (read-only)").option("--json","Machine output (plain array, no NDJSON envelope \u2014 not a room verb)").action(async l=>{let{runLocksCommand:d}=await import("./locks-cmd-76IU4JB7.js"),{contextDir:c}=await import("./paths-UMIX3RJF.js");process.exit(d(c(process.cwd()),l,u=>process.stdout.write(u+`
3986
- `)))}),n.command("rebuild").description("Rebuild what this folder's context store shows from its saved changes, after checking them; nothing saved is lost").option("--yes","Don't ask first (needed with no terminal)").action(async l=>{let{rebuildCommand:d}=await import("./maintenance-cmd-BLV7K4RK.js");process.exit(await Ee("rebuild",()=>d(l),{write:!0}))}),n.command("list").description("List the sources, the use-cases, and what was designed from them").option("--type <t>","Only this kind: source | usecase").option("--inferred","Only items waiting for review").option("--stale","Only items out of date, or left with no source").option("--undesigned","Only the use-cases with no test yet (no live test automates a scenario of theirs)").option("--all","Include the older versions of items").option("--json","JSON output").option("--mode <mode>","agent: the --json lines").action(async l=>{let{listCommand:d}=await import("./list-cmd-7OTI66MQ.js");process.exit(await Ee("list",()=>d(l)))}),n.command("view").description("Draw the context as a page you can explore, and open it in your browser (as it is now)").option("--out <path>","Write the HTML to <path> instead of a temp file").option("--open","Open the browser even with no terminal (when piped)").option("--no-open","Write the file but do not open the browser").option("--json","Print the computed view payload as JSON and exit (no HTML)").action(async l=>{let{viewCommand:d}=await import("./view-cmd-KG4HI334.js");process.exit(await Ee("view",()=>d(l)))}),n.command("retire <source_id>").description("Retire a source, so it no longer counts; `kane-cli context revert` undoes it").option("--reason <text>","Why this source is being retired").option("--yes","Don't ask first (needed with no terminal)").option("--mode <mode>",t).action(async(l,d)=>{let{retireCommand:c}=await import("./lifecycle-cmd-OKUFZKEX.js");process.exit(await Ee("retire",async()=>(await Oo(d.mode),c(l,d)),{write:!0,mode:d.mode}))}),n.command("name [ref] [short-name]").description("Give an item a short name to type in place of its id (lower-case words joined by hyphens); --backfill gives every unnamed item an id like uc-3").option("--backfill","Give every unnamed item an id by its kind (uc-, sc-, ac-, t-\u2026)").option("--yes","Don't ask before --backfill (needed with no terminal)").option("--mode <mode>",t).action(async(l,d,c)=>{let{nameCommand:u,nameBackfillCommand:g}=await import("./lifecycle-cmd-OKUFZKEX.js");c.backfill&&process.exit(await Ee("namebackfill",()=>g(c),{mode:c.mode,streamVerb:"name"})),process.exit(await Ee("name",async()=>(await Oo(c.mode),u(l,d,c)),{write:!0,mode:c.mode}))}),n.command("revert <seq>").description("Undo a saved change by saving its opposite; nothing saved before it is rewritten").option("--reason <text>","Why this record is being reverted").option("--yes","Don't ask first (needed with no terminal)").option("--mode <mode>",t).action(async(l,d)=>{let{revertCommand:c}=await import("./lifecycle-cmd-OKUFZKEX.js");process.exit(await Ee("revert",async()=>(await Oo(d.mode),c(l,d)),{write:!0,mode:d.mode}))}),n.command("review").description("Go through the items waiting for review; your verdicts are saved together, as one change").option("--queue <q>","Which items: derived, waiting for review (the default) | skipped | archived | drift").option("--json","One JSON object per line: the drift list, and what each --verdicts entry did").option("--verdicts <file>",'Verdicts from a file, a JSON array of {"ref", "resolution", ...}, applied all together or not at all; works with or without a terminal').option("--allow-archive","Archive items with no terminal (needs --because; --mode ci refuses it)").option("--because <reason>","The reason saved with archives made with no terminal (needed with --allow-archive)").option("--mode <m>","agent | ci \u2014 ci never archives, whatever the flags").option("--approve <refs...>","Approve these items, by any id they're shown with (like uc-3)").option("--skip <refs...>","Skip these items; they stay waiting for review").option("--defer <refs...>","Defer these items; they stay waiting for review").action(async l=>{let{reviewCommand:d}=await import("./review-cmd-WE6I5XTY.js");process.exit(await Ee("review",()=>d(l)))}),n.command("explain <ref>").description("Show why an item reads as it does and where it came from, using what was recorded when it was made (runs no AI)").option("--json","JSON output").action(async(l,d)=>{let{explainCommand:c}=await import("./explain-cmd-VTDAMXAW.js");process.exit(await Ee("explain",()=>c(l,d)))})}function Nd(e){let n=e.command("design").description("Design tests: turn an approved use-case into acceptance criteria, scenarios, and one test for each scenario").action((t,i)=>{i.args.length>0&&i.error(`error: unknown command '${i.args[0]}'`,{exitCode:2}),i.help()});n.command("tests").description("Design the tests for one use-case; at a terminal, in a chat with the agent").option("--use-case <ref>","The use-case to design, by its id (like uc-3); with --resume it can be left out, since the session remembers it").option("--max <n>","The most scenarios to design, each with its test (with no --max, the agent estimates and asks you)",t=>Number(t)).option("--strength <s>","How thoroughly scenarios combine the options: pairwise (every pair of values) | 3-wise (every three)").option("--mode <mode>","How it asks you: interactive | agent | ci | override. At a terminal it's the chat; with no terminal, --mode is required").option("--json","With --mode override or ci: write the NDJSON stream --mode agent writes (one shape for scripts)").option("--force","Design a use-case again though it already has a design; any of its scenarios and tests that no longer fit are replaced").option("--resume <sid>","Resume the paused session with this id").option("--message <text>","With --resume: answer the open questions, or steer, in your own words; the agent works out what you mean").option("--plan","Print what each step would save, and save nothing").option("--allow-unreviewed","Design against an unreviewed use-case without approving it first").option("--phase <name>","Start the design at this step (grounding | acs | scenarios | wiring | tests), from what the earlier steps saved").option("--answer <pairs...>","With --resume --mode agent: answer an open question by its id, as <question id>=<option number, from 1, or your own words>; repeat it for more").action(async t=>{{let{jsonModeRefusal:a}=await import("./headless-io-FFM5T6KL.js"),s=a("design",t.mode,t.json);s!==null&&(process.stderr.write(`${s}
3987
- `),process.exit(2))}if(t.mode==null||["interactive","agent","ci","override"].includes(t.mode)){let{linkedAnswerRefused:a}=await import("./gate-SM4HPJLA.js"),s=a(t,"design tests");s!==null&&process.exit(s)}let{remoteEntry:i}=await import("./remote-entry-SPA4CSJJ.js"),o=await i("design tests",t.mode==="agent"||t.json===!0,t.resume);if(o!==null){if("exit"in o&&process.exit(o.exit),t.mode!=null&&!["interactive","agent","ci","override"].includes(t.mode)){let{designTestsCommand:d}=await import("./bind-JU4XPDN3.js");process.exit(await d(t))}let{remoteMode:a}=await import("./remote-mode-QO6BDGXM.js"),s=a("design",t.mode,"design tests");if(typeof s=="object"&&process.exit(s.exit),s==="agent"||s==="override"){let{bindDesignRemote:d}=await import("./design-remote-TGUNEWEM.js");process.exit(await d(t,o.choice,s))}let{bindDesignRemoteInteractive:l}=await import("./design-remote-TGUNEWEM.js");process.exit(await l(t,o.choice))}let{designTestsCommand:r}=await import("./bind-JU4XPDN3.js");process.exit(await r(t))}),n.command("explain <ref>").description("Show why a designed item reads as it does, from the reasoning recorded at design time (runs no AI)").action(async t=>{let{designExplainCommand:i}=await import("./explain-cmd-A5YMPXAJ.js");process.exit(await i(t))})}function yd(e){let n=e.command("maintain").description("Keep your tests true to your sources as they change").action((t,i)=>{i.args.length>0&&i.error(`error: unknown command '${i.args[0]}'`,{exitCode:2}),i.help()});n.command("evolve [ref]").description("Design a use-case's tests again, named by the use-case or by one of its tests, scenarios or criteria; what the change doesn't touch is kept as it is, and it shows what changed").option("--from-stale","Design again every use-case whose tests are out of date, asking about each one").option("--because <reason>","Design it again though it's up to date; your reason is saved as why it changed").option("--mode <mode>","interactive | agent \u2014 at a terminal, it asks first, showing which tests the change reaches; agent prints one JSON event per line, and the question pauses the run (exit 3) until it's answered with --answer").option("--answer <pairs...>","With --mode agent: answer a paused run's question by its id, as evolve:<use-case>=<1|2> (1 goes ahead, 2 declines); repeat it for more").action(async(t,i)=>{let{evolveCommand:o}=await import("./evolve-cmd-2BALEYZU.js");process.exit(await o(t,i))}),n.command("reconcile").description("Bring in a source's new version: the agent reads what changed, and every change it proposes waits for you to approve, reject or defer it; nothing is saved without your verdict (at a terminal, you review them in the chat)").option("--from <file>","The NEW version of the source document (a file path)").option("--source-id <id>","`kane-cli context list --type source` lists them: the source this file is a new version of").option("--plan","Preview: the new version is recorded, and every other change is kept in a saved plan; no use-case or test changes").option("--apply [path]","Go through a saved plan (removals stay in the plan): with no path, the latest one, once you approve it; a path picks one; with --from, the plan is worked out again").option("--mode <mode>","interactive | agent | ci | override \u2014 at a terminal, you review in the chat; with no terminal, --mode is required").option("--json","With --mode override or ci: write the NDJSON stream --mode agent writes (one shape for scripts)").action(async t=>{let{reconcileCommand:i}=await import("./reconcile-cmd-VXY737OT.js");process.exit(await i(t))})}function kd(e){e.command("cover").description("Coverage: how much of your use-cases your tests have proven").enablePositionalOptions().option("--from <pack>","Read one run's own coverage from its evidence pack (a folder, a sealed file, or an execution id)").option("--json","Machine-readable output").option("--mode <mode>","interactive | agent | ci \u2014 agent and ci print one JSON event per line, with the result and its next commands last").action(async(t,i)=>{i.args.length>0&&i.error(`error: unknown command '${i.args[0]}'`,{exitCode:2});let{coverCommand:o}=await import("./cover-cmd-PWUZU4HK.js");process.exit(await Ee("cover",()=>o(t)))}).command("gaps [uc]").description("Each use-case's coverage and the work left to raise it; pass a use-case id for its criteria").option("--stage <stage>","design | cover | all (default all)").option("--top <n>","Bound pending rows per use-case in the --json document (table output is never truncated)",t=>Number(t)).option("--rollup <rollup>","No longer changes the figure; accepted for one release").option("--json","Machine-readable nested document").option("--mode <mode>","interactive | agent | ci \u2014 agent and ci print one JSON event per line, with the result and its next commands last").action(async(t,i)=>{let{gapsCommand:o}=await import("./gaps-cmd-2R4RMWN6.js");process.exit(await Ee("gaps",()=>o(t,i)))})}var Ai=He(jn(),1);var We=He(jn(),1);function Vd(e){return{members:e.map(n=>({...n,status:"pending"})),summary:null,done:null}}function xd(e,n){return typeof n!="string"||n.length===0?!1:n===e.relPath||n.endsWith("/"+e.relPath)}function Cg(e){return e==="passed"?"passed":"failed"}function Fd(e,n){switch(n.type){case"testrun_member_start":case"testrun_authored_member_start":return{...e,members:e.members.map(t=>xd(t,n.path)?{...t,status:"running"}:t)};case"testrun_member_end":case"testrun_authored_member_end":return{...e,members:e.members.map(t=>xd(t,n.path)?{...t,status:Cg(n.status),durationS:n.duration_s}:t)};case"testrun_summary":return{...e,summary:{execution:n.execution??null,authored:n.authored??[],totals:n.totals,durationS:n.duration_s,upload:n.upload,cancelled:!!n.cancelled}};case"testrun_done":return{...e,done:{executionId:n.execution_id,overallStatus:n.overall_status}};default:return e}}var ie=He(Yn(),1);function Ud(e){return e<60?`${e.toFixed(1)}s`:`${Math.floor(e/60)}m ${Math.round(e%60)}s`}function Gd({member:e}){let n=e.status==="running",t=e.status==="passed",i=e.status==="failed",o=e.durationS!=null?Ud(e.durationS):"";return(0,ie.jsxs)(Ie,{children:[(0,ie.jsx)(Ie,{width:3,children:n?(0,ie.jsx)(ns,{}):t?(0,ie.jsx)(ce,{color:ae.green,bold:!0,children:"\u2713"}):i?(0,ie.jsx)(ce,{color:ae.red,bold:!0,children:"\u2717"}):(0,ie.jsx)(ce,{color:ae.muted,children:"\u25CB"})}),(0,ie.jsxs)(Ie,{flexGrow:1,children:[(0,ie.jsx)(ce,{color:i?ae.red:ae.dim,children:e.relPath}),e.memberClass==="author"&&(0,ie.jsx)(ce,{color:ae.purple,children:" authoring"})]}),(0,ie.jsx)(Ie,{width:8,justifyContent:"flex-end",children:(0,ie.jsx)(ce,{color:ae.dim,children:o})})]})}function Ig({summary:e}){let n=e.totals,t=e.cancelled?"cancelled":n.failed>0||n.broken>0?"failed":"passed",i=t==="cancelled"?ae.orange:t==="passed"?ae.green:ae.red,o=t==="cancelled"?"!":t==="passed"?"\u2713":"\u2717",r=t.toUpperCase(),a=`${n.passed} passed \xB7 ${n.failed} failed \xB7 ${n.broken} broken \xB7 ${n.skipped} skipped \xB7 ${n.authored} authored`;return(0,ie.jsx)(Ie,{flexDirection:"column",marginTop:1,children:(0,ie.jsxs)(Ie,{borderStyle:"round",borderColor:i,flexDirection:"column",paddingX:2,paddingY:1,children:[(0,ie.jsxs)(ce,{bold:!0,color:i,children:[o," ",r]}),(0,ie.jsx)(ce,{color:ae.dim,children:a}),e.execution&&(0,ie.jsxs)(ce,{color:ae.dim,children:["execution ",e.execution.id,": ",e.execution.status]}),e.authored.length>0&&(0,ie.jsxs)(ce,{color:ae.dim,children:["authored: ",e.authored.length," test(s)"]}),(0,ie.jsxs)(ce,{color:ae.dim,children:[Ud(e.durationS)," \xB7 upload: ",e.upload]})]})})}function jd({members:e,title:n,env:t,dispatchRef:i,onDone:o}){let{exit:r}=Vt(),{append:a}=Gt(),[s,l]=(0,We.useState)(()=>Vd(e)),[d,c]=(0,We.useState)(()=>new Set),u=(0,We.useRef)(!1),g=(0,We.useRef)(!1);(0,We.useEffect)(()=>(i.current=f=>l(A=>Fd(A,f)),()=>{i.current=null}),[]),(0,We.useEffect)(()=>{g.current||(g.current=!0,a((0,ie.jsxs)(Ie,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,ie.jsx)(ce,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,ie.jsx)(ce,{color:ae.dim,children:" \u2502 "}),(0,ie.jsx)(ce,{color:ae.dim,children:`testrun \xB7 ${n} \xB7 ${t}`})]})))},[]),(0,We.useEffect)(()=>{let f=s.members.filter(A=>(A.status==="passed"||A.status==="failed")&&!d.has(A.relPath));if(f.length!==0){for(let A of f)a((0,ie.jsx)(Gd,{member:A},A.relPath));c(A=>{let h=new Set(A);for(let p of f)h.add(p.relPath);return h})}},[s.members,d,a]),(0,We.useEffect)(()=>{s.done&&!u.current&&(u.current=!0,o?.(),r())},[s.done,r,o]);let m=s.members.filter(f=>!d.has(f.relPath));return(0,ie.jsxs)(Ie,{flexDirection:"column",children:[m.length>0&&(0,ie.jsx)(Ie,{flexDirection:"column",children:m.map(f=>(0,ie.jsx)(Gd,{member:f},f.relPath))}),s.summary&&(0,ie.jsx)(Ig,{summary:s.summary})]})}import{existsSync as Bg}from"fs";import{resolve as Dg,relative as vg}from"path";import{existsSync as Mg}from"fs";import{relative as Yo,resolve as Od}from"path";var ve=class extends Error{};function Yd(e,n,t=[],i=[]){let o=[...yo(Er(e))],r=[],a=[];for(let s of n){let l=s.trim().toLowerCase();if(!l)continue;let d=o.filter(([g])=>g.toLowerCase()===l),c=d.flatMap(([,g])=>g);if(c.length!==1)return $n.fromContextNotYet([],null);let u=Yo(e,c[0]);a.includes(u)||(r.push(d[0][0]),a.push(u))}if(a.length===0)return $n.fromContextNotYet([],null);for(let s of t)a.some(l=>Od(e,l)===Od(e,s))||a.push(s);return $n.fromContextNotYet(r,a,i)}function Pd(e,n){let t=gn(e);if(!Mg(t))throw new ve(`--from-context needs an assurance store at ${t} \u2014 run the design flow there first, or run from the project root that holds .context`);let i=Ca(t),o=yo(Er(e)),r=[];for(let a of n){let s=a.trim();if(!s)continue;let l=ba(i,s,To.TEST);if(l!==null)throw new ve(`--from-context: ${l}`);let d=i.resolve(wa(i,s,To.TEST));if(!d)throw new ve(`--from-context: unknown id '${s}' \u2014 it does not resolve in the assurance graph`);if(i.superseded.has(d.tip))throw new ve(`--from-context: '${s}' is tombstoned (retired with no live successor) \u2014 redesign the suite or select a live test id`);let c=i.getNode(d.tip);if(c?.label!=="test")throw new ve(`--from-context: '${s}' is a ${c?.label??"unknown"} node, not a test \u2014 only test ids select members`);let u=s.toLowerCase(),g=o.get(u)??o.get(s)??[];if(g.length===0)throw new ve(`--from-context: '${s}' has no minted test file under ${Er(e)} \u2014 re-run the design for this suite, or restore the deleted file`);if(g.length>1)throw new ve(`--from-context: '${s}' is claimed by ${g.length} files (${g.map(m=>Yo(e,m)).join(", ")}) \u2014 remove the duplicates`);r.push({path:g[0],relPath:Yo(e,g[0]),contextId:u})}return r}async function Hd(e){let n=e.cwd??process.cwd(),t=e.fromContext?.length?Pd(n,e.fromContext):[],i;if(e.paths&&e.paths.length>0||t.length>0){let a=(e.paths??[]).map(s=>{let l=Dg(n,s);if(!Bg(l)||!l.endsWith("_test.md"))throw new ve(`not a *_test.md file: ${s}`);return{path:l,relPath:vg(n,l)}});i=[...t,...a]}else i=(await ur({root:n})).results.map(s=>({path:s.path,relPath:s.relPath}));if(e.match){let a;try{a=new RegExp(e.match)}catch(s){throw new ve(`invalid --match regex: ${s instanceof Error?s.message:s}`)}i=i.filter(s=>a.test(s.relPath))}let o=new Set,r=[];for(let a of i){if(o.has(a.path))continue;o.add(a.path);let s=Ya(a.path);r.push({...a,tags:s.tags,...s.mobileTarget?{mobile:!0,...s.mobileTarget.realDevice?{realDevice:!0}:{},platform:s.mobileTarget.platform,...s.mobileTarget.os_version?{osVersion:s.mobileTarget.os_version}:{},...s.mobileTarget.device_name?{deviceName:s.mobileTarget.device_name}:{},...s.mobileTarget.app?{app:s.mobileTarget.app}:{}}:{}})}if(e.tags&&e.tags.length>0){let a=new Set(e.tags.map(s=>s.toLowerCase()));return r.filter(s=>s.tags.some(l=>a.has(l))).sort((s,l)=>s.relPath.localeCompare(l.relPath))}return r.sort((a,s)=>a.relPath.localeCompare(s.relPath))}import{readFileSync as Tg}from"fs";import{join as Sg}from"path";function vr(e){try{return JSON.parse(Tg(Sg(Le(e),".internal","meta.json"),"utf8"))}catch{return null}}var En=e=>typeof e=="string"&&e?e:void 0;function Ld(e,n){let t=vr(e.path);return t?En(t.project_id):n?.linkedOf?.(e.path)??n?.profile?.id}function Qg(e,n){if(!n)return[];try{return Ic(Sn(e.path),n.index)}catch{return[]}}function zd(e,n){let t=Qg(e,n);return t.length===0?e:{...e,unresolved:t}}function Jd(e,n={}){let t=[],i,o=n.projects?.folder?.id,r=o!==void 0&&e.some(c=>Ld(c,n.projects)===o)?o:void 0,a;for(let c of e){if(c.mobile&&!c.realDevice&&n.grid){t.push({...c,memberClass:En(vr(c.path)?.test_id)?"replay":"author",failure:"virtual_device_on_grid"});continue}if(c.mobile&&!c.realDevice&&!n.remote&&(a??=(n.host??jt)().supported,!a)){t.push({...c,memberClass:En(vr(c.path)?.test_id)?"replay":"author",failure:"mobile_host_unsupported"});continue}let u=vr(c.path);if(!u){let p=Ld(c,n.projects);if(r===void 0&&p&&(r=p),p&&r&&p!==r){t.push({...c,projectId:p,memberClass:"author",failure:"project_mismatch"});continue}t.push(zd({...c,...p?{projectId:p}:{},memberClass:"author"},n.variables));continue}let g={testcaseId:En(u.testcase_id),folderId:En(u.folder_id),commitId:En(u.commit_id),sessionName:En(u.session_name),tcId:La(u.tc_id)},m=En(u.test_id),f=typeof u.org_id=="string"?u.org_id:void 0,A=typeof u.project_id=="string"?u.project_id:void 0,h=m?"replay":"author";if(i===void 0&&f&&(i=f),r===void 0&&A&&(r=A),f&&i&&f!==i){t.push({...c,...g,testId:m,orgId:f,projectId:A,memberClass:h,failure:"org_mismatch"});continue}if(A&&r&&A!==r){t.push({...c,...g,testId:m,orgId:f,projectId:A,memberClass:h,failure:"project_mismatch"});continue}t.push(zd({...c,...g,testId:m,orgId:f,projectId:A,memberClass:h},n.variables))}let s=t.length>0&&t.every(c=>!c.failure),l=Mc(t.map(c=>c.unresolved??[])),d=n.projects&&(n.projects.folder||n.projects.profile)?{projects:{...n.projects.folder?{folder:n.projects.folder}:{},...n.projects.profile?{profile:n.projects.profile}:{}}}:{};return{checks:t,valid:s,orgId:i,projectId:r,...l.length?{unresolved:l}:{},...d}}function Rg(e){return e.tags?.length?`testrun --tags ${e.tags.join(",")}`:e.match?`testrun --match ${e.match}`:e.paths?.length?`testrun ${e.paths.length} paths`:"testrun"}async function Wd(e,n={}){let t=await Hd(e),i=e.cwd??process.cwd(),o=Jd(t,{...n,variables:{index:Ja(za(i))},...e.remote?{remote:!0}:{},...e.grid?{grid:!0}:{},...e.projects?{projects:e.projects}:{}}),r=Number(e.parallel??1),a=Number.isFinite(r)&&r>=1?Math.floor(r):1;if(a>1&&!e.remote&&t.some(s=>s.mobile&&!s.realDevice))throw new ve("Mobile tests can only run one at a time on your local device. Please remove --parallel and try again.");if(e.deviceOverride&&new Set(t.filter(l=>l.mobile&&l.platform).map(l=>l.platform)).size>1)throw new ve("this run has both Android and iOS tests, so one --device-name/--os-version cannot apply to all of them. Select one platform with --match or --tags, or drop --device-name/--os-version.");return{...o,parallel:a,parallelClamped:!1,onFailure:e.onFailure??"continue",title:e.name??Rg(e)}}import{basename as Ng,dirname as yg,sep as kg}from"path";function Zd(e){let n=et(e),t=new Ae,i=t.loadProfileConfig(t.getActiveProfile()??"default",t.getDefaultEnv())??{};return{...n.kind==="remote"?{folder:{id:n.projectId,name:n.projectName},linkedOf:o=>mn(o)?.projectId??null}:{},...i.project_id?{profile:{id:i.project_id,...i.project_name?{name:i.project_name}:{}}}:{}}}var Po="these tests are in different Test Manager projects, and a run counts for one project only";function Kd(e){if(!e.checks.some(l=>l.failure==="project_mismatch"))return null;let n=e.projects?.folder,t=l=>[n,e.projects?.profile].find(d=>d?.id===l)??{id:l},i=new Map;for(let l of e.checks){if(!l.projectId||l.failure&&l.failure!=="project_mismatch")continue;let d=i.get(l.projectId)??{project:t(l.projectId),thisFolder:l.projectId===n?.id,tests:[]};d.tests.push(l.relPath),i.set(l.projectId,d)}let o=[...i.values()].sort((l,d)=>Number(d.thisFolder)-Number(l.thisFolder)),r=o.find(l=>l.thisFolder)??i.get(e.projectId??"")??o[0],a=`the tests of ${Ho(r.project)}${r.thisFolder?", this folder's project":""}`,s=`kane-cli testrun run ${xg(r.tests,e.checks.map(l=>l.relPath))}`;return{groups:o,remedy:`to run ${a}`,next:{cmd:s,why:`run ${a}`}}}var Ho=e=>e.name!==void 0?`"${e.name}"`:`the project ${e.id}`;function xg(e,n){let t=e.map(So).join(" ");if(e.length<=5)return t;let i=Vg(e),o=new RegExp(i);return n.every(r=>o.test(r)===e.includes(r))?`--match ${So(i)}`:t}function Vg(e){let n=r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=new Set(e.map(r=>yg(r)));if(t.size>1)return`^(?:${e.map(n).join("|")})$`;let i=[...t][0],o=e.map(r=>Ng(r).replace(/_test\.md$/,""));return`^${i==="."?"":n(i+kg)}(?:${o.map(n).join("|")})_test\\.md$`}function Xd(e){let n=[`error: ${Po}`];for(let t of e.groups)n.push(` ${t.thisFolder?`this folder's project, ${Ho(t.project)}`:Ho(t.project)}:`,...t.tests.map(i=>` ${i}`));n.push(`next: ${e.remedy}, run:`,` ${e.next.cmd}`,""),process.stderr.write(n.map(t=>`${t}
3983
+ `),process.exit(2));let{runListTui:t,resolveCurrentOrgId:i}=await import("./testmd-actions-4OHRME2Z.js"),o=await i({});o.ok||process.exit(o.code),process.exit(await t(o.orgId))});pg(n),fg(n),hg(n),Eg(n),wg(n),bg(n)}function jo(e,n){return n.concat(e)}function pg(e){e.command("run <path>").description("Run a test from a *_test.md file").option("--url <url>","Start URL for the first step (overrides frontmatter url: and config default_url)").option("--override-start-url <url>","Retarget the test's start: replay opens <url> instead of the start URL the test recorded, and authoring/heal starts there (http/https only). Later navigations and URL assertions are not rewritten. A run that passes after a heal, or any --push, records and commits the steps as they ran, so the first step's recording then points at <url>; add --local to keep a CI run from writing anything back. For CI against a PR build, e.g. http://localhost:3000").option("--headless","Run Chrome in headless mode").option("--max-steps <n>","Max agent steps","50").option("--timeout <seconds>","Kill after N seconds").option("--cdp-endpoint <url>","Connect to existing Chrome via CDP").option("--ws-endpoint <url>","Playwright WebSocket endpoint").option("--global-context <file>",`Override global context (default: ${Ag(oe,"global-memory.md")})`).option("--local-context <file>","Override local context (default: .testmuai/context.md in cwd)").addOption(new ne("--model <name>","Model override").hideHelp()).option("--variables <json>","Inline variables JSON").option("--variables-file <path>","Load variables from file").option("--dataset-id <id>","Test Manager dataset whose row supplies the ${column} parameters (overrides the file's dataset:)").option("--dataset-version <id>","The dataset version the row belongs to (row ids are re-minted on every dataset edit); omitted reads the dataset's latest version").option("--dataset-row <_id>","The row to use, by its _id as Test Manager shows it (overrides the file's dataset.row; a missing or unknown id lists the rows)").option("--session-context <json>","Session context JSON (prior runs)").addOption(new ne("--cft","Use Playwright Chromium instead of managed Chrome").hideHelp()).option("--username <user>","Basic auth username (skip OAuth)").option("--access-key <key>","Basic auth access key").option("--env <name>","Environment (prod or stage)").option("--mode <name>","Run mode: action | testing | agent (same as --agent)").option("--assertion-mode <mode>","Assertion mode: dom (default \u2014 DOM extraction & assertions, vision fallback) | visual (vision only)").option("--final-validation <on|off>","Final validation: append the system cp_final checkpoint. Overrides config (default: off)").option("--agent","Agent mode: plain NDJSON output, no colors/UI").option("--task-skills","Enable domain-specific task skills (experimental)").addOption(new ne("--local","Skip TMS integration (no uploads, no variables/secrets push)").hideHelp()).option("--allow-missing-url","Non-TTY only: proceed from the browser's current page instead of failing when the first step has no start URL (frontmatter url:/--url still used)").option("--code-export","Generate code export after upload").option("--code-language <lang>","Code-export language (python|javascript)").option("--name <name>","Persist session under this name").option("--target <name>","Where to run: desktop | emulator | simulator (default: the file's `target:`, else desktop)").option("--device-name <name>","Which device, when the target is mobile: the name as `kane-cli devices list` shows it. The OS version comes from --os-version or the file's os_version:. On a real device (`target: android|ios`): a name or pattern from `kane-cli devices list --target android|ios --remote`; unset = the hub picks any free device").option("--os-version <version>","The device's OS version (e.g. 17.5, 14). Alone = re-version the file's device (or any device on that version). Unset on a real device = any version").option("--app <path|AppId>","App under test, when the target is mobile: a build (.apk / .zip of the .app; on a real device .apk / .aab / .ipa) or an APP\u2026 id from your uploads. Overrides the file's `app:`").option("--no-stream","On a real device: do not show its live view (default: its own window at a terminal; never for an agent)").option("--tunnel",on.tunnel).option("--tunnel-name <name>",on.tunnelName).option("--skip-code-validation","Skip post-codegen validation").option("--no-skip-code-validation","Force post-codegen validation").option("--on-lock-conflict <mode>","lock conflict policy: readonly|fail|wait",n=>{if(n!=="readonly"&&n!=="fail"&&n!=="wait")throw new Error(`--on-lock-conflict must be readonly|fail|wait, got: ${n}`);return n}).option("--push","always commit at end-of-run (no retry semantics)").option("--no-adaptive-heal","disable adaptive heal \u2014 a replay miss becomes terminal instead of re-authoring the failing tail (default: heal on, 3 attempts then a full re-author)").addOption(new ne("--retry","(retired) adaptive heal is on by default").hideHelp()).addOption(new ne("--retry-count <n>","(retired) heal budget is fixed at 3").argParser(n=>{let t=parseInt(n,10);if(Number.isNaN(t)||t<0)throw new Error(`--retry-count must be a non-negative integer, got: ${n}`);return n}).hideHelp()).option("--author","re-author every step in place on the test's existing identity and commit a new version (a never-authored test takes the first-run path)").option("--policy <file>","Judge the sealed evidence pack against this policy YAML (repeatable). Each verdict is written to <pack>.verdicts/<policy-id>.verdict.json; a failing verdict exits 1, an errored one 3",jo,[]).option("--policy-id <id>","Judge the sealed evidence pack against this Test Manager policy (latest version; repeatable; see `kane-cli policy list`). Combines with --policy",jo,[]).addOption(new ne("--assurance-case <caseId:tc>","the Test Manager case the dispatching laptop found for this designed test").hideHelp()).addOption(new ne("--no-evidence-publish","skip the replay evidence publish (blob upload + TMS /evidence/ingest) \u2014 the run leaves no execution record in TMS").hideHelp()).addOption(new ne("--no-testmd-sync","skip the testmd bundle push before the commit \u2014 the caller owns the bundle for that commit").hideHelp()).option("--bug-detection <mode>","detect product bugs while authoring: off|stop|continue (stop halts the run on a confirmed bug; continue records it and keeps going). Overrides `config set-bug-detection`. Authoring steps only \u2014 replay failures always investigate.",n=>{if(n!=="off"&&n!=="stop"&&n!=="continue")throw new Error(`--bug-detection must be off, stop or continue, got: ${n}`);return n}).option("--assertion-failure-mode <mode>","What a failed assertion does while authoring: stop|continue (stop ends the run at the failed checkpoint; continue marks it failed and keeps going \u2014 a failed final verification still ends the run). Authoring only; replay always stops. Overrides `config set-assertion-failure-mode`.",n=>{if(n!=="stop"&&n!=="continue")throw new Error(`--assertion-failure-mode must be stop or continue, got: ${n}`);return n}).action(async(n,t)=>{let{retiredRetryFlagsNotice:i}=await import("./replay-policy-A62KXE6Y.js"),o=i(t);o&&process.stderr.write(o+`
3984
+ `);let{runTestMdFile:r}=await import("./run-test-md-XYOCVA6F.js"),a=await r(n,t),{exitAfterCommandSend:s}=await import("./command-span-HZSKIZH7.js");await s(a)})}function fg(e){e.command("list").description("List *_test.md files in the working directory (recursive)").option("--root <dir>","Root directory to scan (default: cwd)").option("--ignore <name>","Skip a directory by name (repeatable)",jo,[]).option("--json","Force NDJSON output even on TTY").action(async n=>{let{runListAction:t,resolveCurrentOrgId:i}=await import("./testmd-actions-4OHRME2Z.js"),o=await i({json:!!n.json});o.ok||process.exit(o.code),process.exit(await t(n,o.orgId))})}function hg(e){e.command("status <path>").description("Print local meta.json for a *_test.md (no live TMS check in v1)").action(async n=>{let{runStatusAction:t,resolveCurrentOrgId:i}=await import("./testmd-actions-4OHRME2Z.js"),o=await i({});o.ok||process.exit(o.code),process.exit(await t(n,o.orgId))})}function Eg(e){e.command("delete <path>").description("Remove output-<stem>/ and the *_test.md source file (TMS untouched)").option("--yes","Skip confirmation prompt (required in non-TTY)").action(async(n,t)=>{let{runDeleteAction:i,resolveCurrentOrgId:o}=await import("./testmd-actions-4OHRME2Z.js"),r=await o({});r.ok||process.exit(r.code),process.exit(await i(n,!!t.yes,r.orgId))})}function wg(e){e.command("export <path>").description("Generate standalone test code (Playwright)").option("--language <lang>","python|javascript (falls back to tui-config)").option("--output <dir>","Override output dir (default: output-<stem>/playwright-<lang>-code/)").option("--force","Overwrite an existing local export").action(async(n,t)=>{let{runExportAction:i,resolveCurrentOrgId:o}=await import("./testmd-actions-4OHRME2Z.js"),r=await o({});r.ok||process.exit(r.code),process.exit(await i(n,t,r.orgId))})}function bg(e){e.command("sync <path>").description("Zip the testmd + imports + replay outputs and push {commit_id}-testmd.zip to cloud").option("--env <name>","Environment (prod or stage)").option("--username <user>","Basic auth username (skip OAuth)").option("--access-key <key>","Basic auth access key").action(async(n,t)=>{let{runSyncAction:i,resolveSyncAuth:o}=await import("./testmd-actions-4OHRME2Z.js"),r=await o(t);r.ok||process.exit(r.code),process.exit(await i(n,r))})}async function Oo(e){if(e==="agent")return;let{warnIfBehind:n}=await import("./store-guard-X5FIEZWZ.js"),{contextDir:t}=await import("./paths-UMIX3RJF.js");await n(t(process.cwd()),i=>process.stderr.write(i+`
3985
+ `))}function Rd(e){let n=e.command("context").description("Add your documents as sources, find the use-cases in them, and list what's there").action((l,d)=>{d.args.length>0&&d.error(`error: unknown command '${d.args[0]}'`,{exitCode:2,code:"commander.unknownCommand"}),d.help()});n.command("ingest <src...>").description("Add source files and find the use-cases in them, in one step. At a terminal it goes on into the chat; with --mode ci, or with no terminal, it only adds the files").option("--as <id>","Add this file as a new version of the source with this id; what came from the old version goes out of date (one file only)").option("--mode <mode>","interactive | agent | ci | override \u2014 how the use-cases are found; with ci, or with no terminal and no --mode, it only adds the files").option("--plan","Stop once the use-cases are proposed: print them, and save nothing").option("--force","Find the use-cases again, even in a version of the file that was already read").option("--trust <dial>","auto (the default) saves new use-cases to review later | hold keeps them back for you to review first (with no terminal only)").option("--project <id>","In a folder not set up yet: share its work with this Test Manager project, without asking").option("--local","In a folder not set up yet: keep its work in this folder, without asking").action(async(l,d)=>{let{ingestCommand:c}=await import("./ingest-cmd-HMTLO5MB.js");process.exit(await c(l,d))}),n.command("extract").description("Find the use-cases in the sources you've added, in a chat with the agent").option("--plan","Stop once the use-cases are proposed: print them, and save nothing").option("--apply <path>","Not available yet; it will save a proposal printed by --plan (for now it refuses)").option("--mode <mode>","How it asks you: interactive | agent | ci | override. At a terminal it's the chat; with no terminal, --mode is required").option("--json","With --mode override or ci: write the NDJSON stream --mode agent writes (one shape for scripts)").option("--force","Read the sources again, even ones whose current version was already read").option("--resume <sid>","Resume the paused session with this id").option("--project <id>","In a folder not set up yet: share its work with this Test Manager project, without asking").option("--local","In a folder not set up yet: keep its work in this folder, without asking").option("--message <text>","With --resume: answer the open questions, or steer, in your own words; the agent works out what you mean").option("--source <id>","Read only the source with this id; the way to read a conversation source (its id starts su-conv-), which a plain extract skips").option("--queued","(removed) extract reads every source not read yet on its own; for one release this flag refuses and says what to do").option("--trust <dial>","auto (the default) saves what's new to review later | hold keeps everything new back for you to review first, with no terminal only (the chat refuses it); ci refuses this flag").option("--answer <pairs...>","With --resume --mode agent: answer an open question by its id, as <question id>=<option number, from 1, or your own words>; repeat it for more").option("--with-source <ref>","With --resume: add this file or page first, and set the open questions aside; the agent reads it, says what it settled, and asks again what's still open").action(async l=>{let{extractCommand:d}=await import("./extract-cmd-SYZX6CML.js");process.exit(await d(l))}),n.command("sessions [action] [sid]").summary("List the sessions you can resume, and show, clean, save or discard one").description("List the sessions you can resume. With a session's id, `show` prints its open questions and the defaults it assumed, and `clean` removes it (with no id, `clean` removes every expired session). In a folder linked to a shared project, `save` saves a finished session to the project, and `discard` throws a session's work away").option("--all","clean: remove ALL sessions (incl. corrupt), not just expired").option("--json","JSON output").option("--mode <mode>","save, discard: agent prints one JSON event per line, with the result last").option("--yes","save, discard: agree up front, without being asked; needed in agent mode or with no terminal").action(async(l,d,c)=>{let{sessionsCommand:u}=await import("./sessions-cmd-WUWZYZJW.js");process.exit(await Ee("sessions",()=>u(l,c,d)))});let t="interactive | agent | ci | override \u2014 agent prints one JSON event per line, with the result last",i=(l,d)=>[...d,l],o=async(l,d,c,u="sync")=>{let{syncCommand:g}=await import("./sync-cmd-TAVE44DU.js");process.exit(await Ee(u,()=>g(l,d,c),{mode:c.mode}))},r=l=>{s.opts().answer.length>0&&l.error("error: unknown option '--answer' (it belongs to kane-cli context sync [name] and kane-cli context pull)",{exitCode:2,code:"kane.answerOnSubcommand"})},a=l=>({...s.opts().mode!==void 0?{mode:s.opts().mode}:{},...l}),s=n.command("sync [name]").description("Bring this folder and a location level: finish a rebase left open, take the location's new work, then send yours. Subcommands: setup, add, list, remove, status, doctor").option("--answer <id=choice>","Answer a rebase decision with no terminal, as <decision id>=<keep-theirs | apply-mine | apply-mine-as-new>; repeat it for more; only while a rebase is open",i,[]).option("--mode <mode>",t).action(async(l,d)=>o(l,[],{...d,answer:d.answer.length>0?d.answer:void 0}));s.command("setup").description("Guided setup: share context through GitHub, S3 or a folder, or join your team").option("--mode <mode>",t).action(async(l,d)=>{r(d);let{setupCommand:c}=await import("./sync-setup-M65RX34Y.js");process.exit(await c(a(l)))}),s.command("add <name> <descriptor>").description("Check a location (a GitHub repository, S3 bucket or folder), and bind this folder's context store to it under <name>").option("--credential-env <VAR>","s3: read the access key from $VAR_ID and the secret from $VAR_SECRET, stored under the user config dir with mode 0600").option("--credential-file <path>","s3: read a JSON file {accessKeyId, secretAccessKey}, stored under the user config dir with mode 0600").option("--mode <mode>",t).action(async(l,d,c,u)=>{r(u),await o("add",[l,d],a(c))}),s.command("list").description("The locations this folder's context store is bound to").option("--json","JSON output").option("--mode <mode>",t).action(async(l,d)=>{r(d),await o("list",[],a(l))}),s.command("remove <name>").description("Forget a location (the note of what was last seen there is kept)").option("--mode <mode>",t).action(async(l,d,c)=>{r(c),await o("remove",[l],a(d))}),s.command("status [name]").description("Compare this folder's context store with a location, and list the rebase decisions still open; changes nothing").option("--show <n>","Show one moved change in full, by its number in the list").option("--json","JSON output: the relation, rebase_id, decisions").option("--mode <mode>",t).action(async(l,d,c)=>{r(c),await o("status",l===void 0?[]:[l],a(d))}),s.command("doctor").description("Show the state of this folder's context store: a reset that didn't finish, its saved changes, and every rebase with its id; changes nothing unless asked").option("--abort","Undo an interrupted reset (before its import); else close the open rebase, keeping what was reapplied").option("--export <dir>","Build the store as it was before the rebase in <dir>, as a store of its own, with everything it held").option("--from <rebase-id>","With --export: which rebase (default: the open one, else the only one)").option("--json","JSON output").option("--mode <mode>",t).action(async(l,d)=>{r(d),await o("doctor",[],a(l))}),n.command("pull [name]").description("Bring your shared project's tests into this folder (in a folder linked to one), or take the new work shared at a location, checked in full before it's added. A rebase left open is finished first").option("--rebase","When you and the location both added work since you were last level: your changes since then are kept aside, the location's are taken, then yours are applied again; nothing at the location is rewritten").option("--yes","Agree to replace this folder's changes since you were last level (they're kept first); it doesn't answer rebase decisions").option("--answer <id=choice>","Answer a rebase decision with no terminal, as <decision id>=<keep-theirs | apply-mine | apply-mine-as-new>; repeat it for more; only while a rebase is open",i,[]).option("--project <id>","In a folder that isn't set up yet: join this shared project, reading no documents, then bring its tests").option("--use-case <id>","Only this use-case's tests, with the tests they use").option("--overwrite","Replace the test files you changed here with the project's").option("--mode <mode>",t).action(async(l,d)=>{let[{pullRoute:c},{chooseStore:u}]=await Promise.all([import("./pull-route-5JQUUSU7.js"),import("./store-choice-ZE7AZMRC.js")]),g=c(l,d,u(process.cwd()));if(typeof g!="string"){let{printRefusal:w}=await import("./gate-5UIJVMHL.js");process.exit(w(g,"pull",d.mode==="agent"))}if(g==="project"){let{runProjectPull:w}=await import("./pull-cmd-G3PVSSFP.js"),{project:D,useCase:O,overwrite:V,mode:v}=d;process.exit(await Ee("pull",()=>w({...v!==void 0?{mode:v}:{},...D!==void 0?{project:D}:{},...O!==void 0?{useCase:O}:{},...V?{overwrite:V}:{}}),{mode:d.mode}))}let{pullCommand:m}=await import("./sync-cmd-TAVE44DU.js"),{mode:f,rebase:A,yes:h,answer:p}=d;process.exit(await Ee("pull",()=>m(l,{...f!==void 0?{mode:f}:{},...A!==void 0?{rebase:A}:{},...h!==void 0?{yes:h}:{},answer:p.length>0?p:void 0}),{mode:d.mode}))}),n.command("impact",{hidden:!0}).description("Trace a changelog, a PR diff or PR text to the tests of your shared project it touches (in a folder linked to one)").requiredOption("--input <file...>","The change to trace: a file, or - to read it from stdin; give more than one to trace them together").option("--mode <mode>",t).action(async l=>{let{runImpact:d}=await import("./impact-cmd-3P6SKFJC.js"),{input:c,mode:u}=l;process.exit(await Ee("impact",g=>d({input:c,...u!==void 0?{mode:u}:{}},void 0,void 0,{telemetry:g}),{mode:l.mode}))}),n.command("push [name]").description("Send this folder's new work, with its files and proposals, to a location; it refuses while the location has work this folder hasn't pulled yet").option("--mode <mode>","interactive | agent | ci | override \u2014 agent prints one JSON event per line, with the result last").action(async(l,d)=>{let{pushCommand:c}=await import("./sync-cmd-TAVE44DU.js");process.exit(await Ee("push",()=>c(l,d),{mode:d.mode}))}),n.command("clone [descriptor] [dir]").description("Copy the context shared at a location into a new store in [dir] (default: the last part of the location's name), and remember the location as `origin`").option("--credential-env <VAR>","s3: read the access key from $VAR_ID and the secret from $VAR_SECRET, stored under `origin` for the clone").option("--credential-file <path>","s3: read a JSON file {accessKeyId, secretAccessKey}, stored under `origin` for the clone").option("--mode <mode>","interactive | agent | ci | override \u2014 agent prints one JSON event per line, with the result last").action(async(l,d,c)=>{let{cloneCommand:u}=await import("./sync-cmd-TAVE44DU.js");process.exit(await Ee("clone",()=>u(l,d,c),{mode:c.mode}))}),n.command("fsck").description("Check this folder's context store for damage: every saved change is verified, and what the store shows is checked against them").option("--json","Print the whole report as one JSON object (each problem with its code, detail and the ids of the changes it's in)").action(async l=>{let{fsckCommand:d}=await import("./maintenance-cmd-JNP2KCSI.js");process.exit(await Ee("fsck",c=>d(c,l)))}),n.command("locks",{hidden:!0}).description("Show held context/UC locks and waiters (read-only)").option("--json","Machine output (plain array, no NDJSON envelope \u2014 not a room verb)").action(async l=>{let{runLocksCommand:d}=await import("./locks-cmd-76IU4JB7.js"),{contextDir:c}=await import("./paths-UMIX3RJF.js");process.exit(d(c(process.cwd()),l,u=>process.stdout.write(u+`
3986
+ `)))}),n.command("rebuild").description("Rebuild what this folder's context store shows from its saved changes, after checking them; nothing saved is lost").option("--yes","Don't ask first (needed with no terminal)").action(async l=>{let{rebuildCommand:d}=await import("./maintenance-cmd-JNP2KCSI.js");process.exit(await Ee("rebuild",()=>d(l),{write:!0}))}),n.command("list").description("List the sources, the use-cases, and what was designed from them").option("--type <t>","Only this kind: source | usecase").option("--inferred","Only items waiting for review").option("--stale","Only items out of date, or left with no source").option("--undesigned","Only the use-cases with no test yet (no live test automates a scenario of theirs)").option("--all","Include the older versions of items").option("--json","JSON output").option("--mode <mode>","agent: the --json lines").action(async l=>{let{listCommand:d}=await import("./list-cmd-RYHICCUV.js");process.exit(await Ee("list",()=>d(l)))}),n.command("view").description("Draw the context as a page you can explore, and open it in your browser (as it is now)").option("--out <path>","Write the HTML to <path> instead of a temp file").option("--open","Open the browser even with no terminal (when piped)").option("--no-open","Write the file but do not open the browser").option("--json","Print the computed view payload as JSON and exit (no HTML)").action(async l=>{let{viewCommand:d}=await import("./view-cmd-3UKV3YEX.js");process.exit(await Ee("view",()=>d(l)))}),n.command("retire <source_id>").description("Retire a source, so it no longer counts; `kane-cli context revert` undoes it").option("--reason <text>","Why this source is being retired").option("--yes","Don't ask first (needed with no terminal)").option("--mode <mode>",t).action(async(l,d)=>{let{retireCommand:c}=await import("./lifecycle-cmd-Y5DH2PL5.js");process.exit(await Ee("retire",async()=>(await Oo(d.mode),c(l,d)),{write:!0,mode:d.mode}))}),n.command("name [ref] [short-name]").description("Give an item a short name to type in place of its id (lower-case words joined by hyphens); --backfill gives every unnamed item an id like uc-3").option("--backfill","Give every unnamed item an id by its kind (uc-, sc-, ac-, t-\u2026)").option("--yes","Don't ask before --backfill (needed with no terminal)").option("--mode <mode>",t).action(async(l,d,c)=>{let{nameCommand:u,nameBackfillCommand:g}=await import("./lifecycle-cmd-Y5DH2PL5.js");c.backfill&&process.exit(await Ee("namebackfill",()=>g(c),{mode:c.mode,streamVerb:"name"})),process.exit(await Ee("name",async()=>(await Oo(c.mode),u(l,d,c)),{write:!0,mode:c.mode}))}),n.command("revert <seq>").description("Undo a saved change by saving its opposite; nothing saved before it is rewritten").option("--reason <text>","Why this record is being reverted").option("--yes","Don't ask first (needed with no terminal)").option("--mode <mode>",t).action(async(l,d)=>{let{revertCommand:c}=await import("./lifecycle-cmd-Y5DH2PL5.js");process.exit(await Ee("revert",async()=>(await Oo(d.mode),c(l,d)),{write:!0,mode:d.mode}))}),n.command("review").description("Go through the items waiting for review; your verdicts are saved together, as one change").option("--queue <q>","Which items: derived, waiting for review (the default) | skipped | archived | drift").option("--json","One JSON object per line: the drift list, and what each --verdicts entry did").option("--verdicts <file>",'Verdicts from a file, a JSON array of {"ref", "resolution", ...}, applied all together or not at all; works with or without a terminal').option("--allow-archive","Archive items with no terminal (needs --because; --mode ci refuses it)").option("--because <reason>","The reason saved with archives made with no terminal (needed with --allow-archive)").option("--mode <m>","agent | ci \u2014 ci never archives, whatever the flags").option("--approve <refs...>","Approve these items, by any id they're shown with (like uc-3)").option("--skip <refs...>","Skip these items; they stay waiting for review").option("--defer <refs...>","Defer these items; they stay waiting for review").action(async l=>{let{reviewCommand:d}=await import("./review-cmd-PYU7YCAC.js");process.exit(await Ee("review",()=>d(l)))}),n.command("explain <ref>").description("Show why an item reads as it does and where it came from, using what was recorded when it was made (runs no AI)").option("--json","JSON output").action(async(l,d)=>{let{explainCommand:c}=await import("./explain-cmd-Q4NLNJFB.js");process.exit(await Ee("explain",()=>c(l,d)))})}function Nd(e){let n=e.command("design").description("Design tests: turn an approved use-case into acceptance criteria, scenarios, and one test for each scenario").action((t,i)=>{i.args.length>0&&i.error(`error: unknown command '${i.args[0]}'`,{exitCode:2}),i.help()});n.command("tests").description("Design the tests for one use-case; at a terminal, in a chat with the agent").option("--use-case <ref>","The use-case to design, by its id (like uc-3); with --resume it can be left out, since the session remembers it").option("--max <n>","The most scenarios to design, each with its test (with no --max, the agent estimates and asks you)",t=>Number(t)).option("--strength <s>","How thoroughly scenarios combine the options: pairwise (every pair of values) | 3-wise (every three)").option("--mode <mode>","How it asks you: interactive | agent | ci | override. At a terminal it's the chat; with no terminal, --mode is required").option("--json","With --mode override or ci: write the NDJSON stream --mode agent writes (one shape for scripts)").option("--force","Design a use-case again though it already has a design; any of its scenarios and tests that no longer fit are replaced").option("--resume <sid>","Resume the paused session with this id").option("--message <text>","With --resume: answer the open questions, or steer, in your own words; the agent works out what you mean").option("--plan","Print what each step would save, and save nothing").option("--allow-unreviewed","Design against an unreviewed use-case without approving it first").option("--phase <name>","Start the design at this step (grounding | acs | scenarios | wiring | tests), from what the earlier steps saved").option("--answer <pairs...>","With --resume --mode agent: answer an open question by its id, as <question id>=<option number, from 1, or your own words>; repeat it for more").action(async t=>{{let{jsonModeRefusal:a}=await import("./headless-io-FFM5T6KL.js"),s=a("design",t.mode,t.json);s!==null&&(process.stderr.write(`${s}
3987
+ `),process.exit(2))}if(t.mode==null||["interactive","agent","ci","override"].includes(t.mode)){let{linkedAnswerRefused:a}=await import("./gate-5UIJVMHL.js"),s=a(t,"design tests");s!==null&&process.exit(s)}let{remoteEntry:i}=await import("./remote-entry-6LQRYR5F.js"),o=await i("design tests",t.mode==="agent"||t.json===!0,t.resume);if(o!==null){if("exit"in o&&process.exit(o.exit),t.mode!=null&&!["interactive","agent","ci","override"].includes(t.mode)){let{designTestsCommand:d}=await import("./bind-3PB77PWJ.js");process.exit(await d(t))}let{remoteMode:a}=await import("./remote-mode-35BQUMEL.js"),s=a("design",t.mode,"design tests");if(typeof s=="object"&&process.exit(s.exit),s==="agent"||s==="override"){let{bindDesignRemote:d}=await import("./design-remote-UITWJ72Q.js");process.exit(await d(t,o.choice,s))}let{bindDesignRemoteInteractive:l}=await import("./design-remote-UITWJ72Q.js");process.exit(await l(t,o.choice))}let{designTestsCommand:r}=await import("./bind-3PB77PWJ.js");process.exit(await r(t))}),n.command("explain <ref>").description("Show why a designed item reads as it does, from the reasoning recorded at design time (runs no AI)").action(async t=>{let{designExplainCommand:i}=await import("./explain-cmd-A5YMPXAJ.js");process.exit(await i(t))})}function yd(e){let n=e.command("maintain").description("Keep your tests true to your sources as they change").action((t,i)=>{i.args.length>0&&i.error(`error: unknown command '${i.args[0]}'`,{exitCode:2}),i.help()});n.command("evolve [ref]").description("Design a use-case's tests again, named by the use-case or by one of its tests, scenarios or criteria; what the change doesn't touch is kept as it is, and it shows what changed").option("--from-stale","Design again every use-case whose tests are out of date, asking about each one").option("--because <reason>","Design it again though it's up to date; your reason is saved as why it changed").option("--mode <mode>","interactive | agent \u2014 at a terminal, it asks first, showing which tests the change reaches; agent prints one JSON event per line, and the question pauses the run (exit 3) until it's answered with --answer").option("--answer <pairs...>","With --mode agent: answer a paused run's question by its id, as evolve:<use-case>=<1|2> (1 goes ahead, 2 declines); repeat it for more").action(async(t,i)=>{let{evolveCommand:o}=await import("./evolve-cmd-MDK2H4JY.js");process.exit(await o(t,i))}),n.command("reconcile").description("Bring in a source's new version: the agent reads what changed, and every change it proposes waits for you to approve, reject or defer it; nothing is saved without your verdict (at a terminal, you review them in the chat)").option("--from <file>","The NEW version of the source document (a file path)").option("--source-id <id>","`kane-cli context list --type source` lists them: the source this file is a new version of").option("--plan","Preview: the new version is recorded, and every other change is kept in a saved plan; no use-case or test changes").option("--apply [path]","Go through a saved plan (removals stay in the plan): with no path, the latest one, once you approve it; a path picks one; with --from, the plan is worked out again").option("--mode <mode>","interactive | agent | ci | override \u2014 at a terminal, you review in the chat; with no terminal, --mode is required").option("--json","With --mode override or ci: write the NDJSON stream --mode agent writes (one shape for scripts)").action(async t=>{let{reconcileCommand:i}=await import("./reconcile-cmd-QJBYZVUB.js");process.exit(await i(t))})}function kd(e){e.command("cover").description("Coverage: how much of your use-cases your tests have proven").enablePositionalOptions().option("--from <pack>","Read one run's own coverage from its evidence pack (a folder, a sealed file, or an execution id)").option("--json","Machine-readable output").option("--mode <mode>","interactive | agent | ci \u2014 agent and ci print one JSON event per line, with the result and its next commands last").action(async(t,i)=>{i.args.length>0&&i.error(`error: unknown command '${i.args[0]}'`,{exitCode:2});let{coverCommand:o}=await import("./cover-cmd-SAWVP7TL.js");process.exit(await Ee("cover",()=>o(t)))}).command("gaps [uc]").description("Each use-case's coverage and the work left to raise it; pass a use-case id for its criteria").option("--stage <stage>","design | cover | all (default all)").option("--top <n>","Bound pending rows per use-case in the --json document (table output is never truncated)",t=>Number(t)).option("--rollup <rollup>","No longer changes the figure; accepted for one release").option("--json","Machine-readable nested document").option("--mode <mode>","interactive | agent | ci \u2014 agent and ci print one JSON event per line, with the result and its next commands last").action(async(t,i)=>{let{gapsCommand:o}=await import("./gaps-cmd-E55OGZ7P.js");process.exit(await Ee("gaps",()=>o(t,i)))})}var Ai=He(jn(),1);var We=He(jn(),1);function Vd(e){return{members:e.map(n=>({...n,status:"pending"})),summary:null,done:null}}function xd(e,n){return typeof n!="string"||n.length===0?!1:n===e.relPath||n.endsWith("/"+e.relPath)}function Cg(e){return e==="passed"?"passed":"failed"}function Fd(e,n){switch(n.type){case"testrun_member_start":case"testrun_authored_member_start":return{...e,members:e.members.map(t=>xd(t,n.path)?{...t,status:"running"}:t)};case"testrun_member_end":case"testrun_authored_member_end":return{...e,members:e.members.map(t=>xd(t,n.path)?{...t,status:Cg(n.status),durationS:n.duration_s}:t)};case"testrun_summary":return{...e,summary:{execution:n.execution??null,authored:n.authored??[],totals:n.totals,durationS:n.duration_s,upload:n.upload,cancelled:!!n.cancelled}};case"testrun_done":return{...e,done:{executionId:n.execution_id,overallStatus:n.overall_status}};default:return e}}var ie=He(Yn(),1);function Ud(e){return e<60?`${e.toFixed(1)}s`:`${Math.floor(e/60)}m ${Math.round(e%60)}s`}function Gd({member:e}){let n=e.status==="running",t=e.status==="passed",i=e.status==="failed",o=e.durationS!=null?Ud(e.durationS):"";return(0,ie.jsxs)(Ie,{children:[(0,ie.jsx)(Ie,{width:3,children:n?(0,ie.jsx)(ns,{}):t?(0,ie.jsx)(ce,{color:ae.green,bold:!0,children:"\u2713"}):i?(0,ie.jsx)(ce,{color:ae.red,bold:!0,children:"\u2717"}):(0,ie.jsx)(ce,{color:ae.muted,children:"\u25CB"})}),(0,ie.jsxs)(Ie,{flexGrow:1,children:[(0,ie.jsx)(ce,{color:i?ae.red:ae.dim,children:e.relPath}),e.memberClass==="author"&&(0,ie.jsx)(ce,{color:ae.purple,children:" authoring"})]}),(0,ie.jsx)(Ie,{width:8,justifyContent:"flex-end",children:(0,ie.jsx)(ce,{color:ae.dim,children:o})})]})}function Ig({summary:e}){let n=e.totals,t=e.cancelled?"cancelled":n.failed>0||n.broken>0?"failed":"passed",i=t==="cancelled"?ae.orange:t==="passed"?ae.green:ae.red,o=t==="cancelled"?"!":t==="passed"?"\u2713":"\u2717",r=t.toUpperCase(),a=`${n.passed} passed \xB7 ${n.failed} failed \xB7 ${n.broken} broken \xB7 ${n.skipped} skipped \xB7 ${n.authored} authored`;return(0,ie.jsx)(Ie,{flexDirection:"column",marginTop:1,children:(0,ie.jsxs)(Ie,{borderStyle:"round",borderColor:i,flexDirection:"column",paddingX:2,paddingY:1,children:[(0,ie.jsxs)(ce,{bold:!0,color:i,children:[o," ",r]}),(0,ie.jsx)(ce,{color:ae.dim,children:a}),e.execution&&(0,ie.jsxs)(ce,{color:ae.dim,children:["execution ",e.execution.id,": ",e.execution.status]}),e.authored.length>0&&(0,ie.jsxs)(ce,{color:ae.dim,children:["authored: ",e.authored.length," test(s)"]}),(0,ie.jsxs)(ce,{color:ae.dim,children:[Ud(e.durationS)," \xB7 upload: ",e.upload]})]})})}function jd({members:e,title:n,env:t,dispatchRef:i,onDone:o}){let{exit:r}=Vt(),{append:a}=Gt(),[s,l]=(0,We.useState)(()=>Vd(e)),[d,c]=(0,We.useState)(()=>new Set),u=(0,We.useRef)(!1),g=(0,We.useRef)(!1);(0,We.useEffect)(()=>(i.current=f=>l(A=>Fd(A,f)),()=>{i.current=null}),[]),(0,We.useEffect)(()=>{g.current||(g.current=!0,a((0,ie.jsxs)(Ie,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,ie.jsx)(ce,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,ie.jsx)(ce,{color:ae.dim,children:" \u2502 "}),(0,ie.jsx)(ce,{color:ae.dim,children:`testrun \xB7 ${n} \xB7 ${t}`})]})))},[]),(0,We.useEffect)(()=>{let f=s.members.filter(A=>(A.status==="passed"||A.status==="failed")&&!d.has(A.relPath));if(f.length!==0){for(let A of f)a((0,ie.jsx)(Gd,{member:A},A.relPath));c(A=>{let h=new Set(A);for(let p of f)h.add(p.relPath);return h})}},[s.members,d,a]),(0,We.useEffect)(()=>{s.done&&!u.current&&(u.current=!0,o?.(),r())},[s.done,r,o]);let m=s.members.filter(f=>!d.has(f.relPath));return(0,ie.jsxs)(Ie,{flexDirection:"column",children:[m.length>0&&(0,ie.jsx)(Ie,{flexDirection:"column",children:m.map(f=>(0,ie.jsx)(Gd,{member:f},f.relPath))}),s.summary&&(0,ie.jsx)(Ig,{summary:s.summary})]})}import{existsSync as Bg}from"fs";import{resolve as Dg,relative as vg}from"path";import{existsSync as Mg}from"fs";import{relative as Yo,resolve as Od}from"path";var ve=class extends Error{};function Yd(e,n,t=[],i=[]){let o=[...yo(Er(e))],r=[],a=[];for(let s of n){let l=s.trim().toLowerCase();if(!l)continue;let d=o.filter(([g])=>g.toLowerCase()===l),c=d.flatMap(([,g])=>g);if(c.length!==1)return $n.fromContextNotYet([],null);let u=Yo(e,c[0]);a.includes(u)||(r.push(d[0][0]),a.push(u))}if(a.length===0)return $n.fromContextNotYet([],null);for(let s of t)a.some(l=>Od(e,l)===Od(e,s))||a.push(s);return $n.fromContextNotYet(r,a,i)}function Pd(e,n){let t=gn(e);if(!Mg(t))throw new ve(`--from-context needs an assurance store at ${t} \u2014 run the design flow there first, or run from the project root that holds .context`);let i=Ca(t),o=yo(Er(e)),r=[];for(let a of n){let s=a.trim();if(!s)continue;let l=ba(i,s,To.TEST);if(l!==null)throw new ve(`--from-context: ${l}`);let d=i.resolve(wa(i,s,To.TEST));if(!d)throw new ve(`--from-context: unknown id '${s}' \u2014 it does not resolve in the assurance graph`);if(i.superseded.has(d.tip))throw new ve(`--from-context: '${s}' is tombstoned (retired with no live successor) \u2014 redesign the suite or select a live test id`);let c=i.getNode(d.tip);if(c?.label!=="test")throw new ve(`--from-context: '${s}' is a ${c?.label??"unknown"} node, not a test \u2014 only test ids select members`);let u=s.toLowerCase(),g=o.get(u)??o.get(s)??[];if(g.length===0)throw new ve(`--from-context: '${s}' has no minted test file under ${Er(e)} \u2014 re-run the design for this suite, or restore the deleted file`);if(g.length>1)throw new ve(`--from-context: '${s}' is claimed by ${g.length} files (${g.map(m=>Yo(e,m)).join(", ")}) \u2014 remove the duplicates`);r.push({path:g[0],relPath:Yo(e,g[0]),contextId:u})}return r}async function Hd(e){let n=e.cwd??process.cwd(),t=e.fromContext?.length?Pd(n,e.fromContext):[],i;if(e.paths&&e.paths.length>0||t.length>0){let a=(e.paths??[]).map(s=>{let l=Dg(n,s);if(!Bg(l)||!l.endsWith("_test.md"))throw new ve(`not a *_test.md file: ${s}`);return{path:l,relPath:vg(n,l)}});i=[...t,...a]}else i=(await ur({root:n})).results.map(s=>({path:s.path,relPath:s.relPath}));if(e.match){let a;try{a=new RegExp(e.match)}catch(s){throw new ve(`invalid --match regex: ${s instanceof Error?s.message:s}`)}i=i.filter(s=>a.test(s.relPath))}let o=new Set,r=[];for(let a of i){if(o.has(a.path))continue;o.add(a.path);let s=Ya(a.path);r.push({...a,tags:s.tags,...s.mobileTarget?{mobile:!0,...s.mobileTarget.realDevice?{realDevice:!0}:{},platform:s.mobileTarget.platform,...s.mobileTarget.os_version?{osVersion:s.mobileTarget.os_version}:{},...s.mobileTarget.device_name?{deviceName:s.mobileTarget.device_name}:{},...s.mobileTarget.app?{app:s.mobileTarget.app}:{}}:{}})}if(e.tags&&e.tags.length>0){let a=new Set(e.tags.map(s=>s.toLowerCase()));return r.filter(s=>s.tags.some(l=>a.has(l))).sort((s,l)=>s.relPath.localeCompare(l.relPath))}return r.sort((a,s)=>a.relPath.localeCompare(s.relPath))}import{readFileSync as Tg}from"fs";import{join as Sg}from"path";function vr(e){try{return JSON.parse(Tg(Sg(Le(e),".internal","meta.json"),"utf8"))}catch{return null}}var En=e=>typeof e=="string"&&e?e:void 0;function Ld(e,n){let t=vr(e.path);return t?En(t.project_id):n?.linkedOf?.(e.path)??n?.profile?.id}function Qg(e,n){if(!n)return[];try{return Ic(Sn(e.path),n.index)}catch{return[]}}function zd(e,n){let t=Qg(e,n);return t.length===0?e:{...e,unresolved:t}}function Jd(e,n={}){let t=[],i,o=n.projects?.folder?.id,r=o!==void 0&&e.some(c=>Ld(c,n.projects)===o)?o:void 0,a;for(let c of e){if(c.mobile&&!c.realDevice&&n.grid){t.push({...c,memberClass:En(vr(c.path)?.test_id)?"replay":"author",failure:"virtual_device_on_grid"});continue}if(c.mobile&&!c.realDevice&&!n.remote&&(a??=(n.host??jt)().supported,!a)){t.push({...c,memberClass:En(vr(c.path)?.test_id)?"replay":"author",failure:"mobile_host_unsupported"});continue}let u=vr(c.path);if(!u){let p=Ld(c,n.projects);if(r===void 0&&p&&(r=p),p&&r&&p!==r){t.push({...c,projectId:p,memberClass:"author",failure:"project_mismatch"});continue}t.push(zd({...c,...p?{projectId:p}:{},memberClass:"author"},n.variables));continue}let g={testcaseId:En(u.testcase_id),folderId:En(u.folder_id),commitId:En(u.commit_id),sessionName:En(u.session_name),tcId:La(u.tc_id)},m=En(u.test_id),f=typeof u.org_id=="string"?u.org_id:void 0,A=typeof u.project_id=="string"?u.project_id:void 0,h=m?"replay":"author";if(i===void 0&&f&&(i=f),r===void 0&&A&&(r=A),f&&i&&f!==i){t.push({...c,...g,testId:m,orgId:f,projectId:A,memberClass:h,failure:"org_mismatch"});continue}if(A&&r&&A!==r){t.push({...c,...g,testId:m,orgId:f,projectId:A,memberClass:h,failure:"project_mismatch"});continue}t.push(zd({...c,...g,testId:m,orgId:f,projectId:A,memberClass:h},n.variables))}let s=t.length>0&&t.every(c=>!c.failure),l=Mc(t.map(c=>c.unresolved??[])),d=n.projects&&(n.projects.folder||n.projects.profile)?{projects:{...n.projects.folder?{folder:n.projects.folder}:{},...n.projects.profile?{profile:n.projects.profile}:{}}}:{};return{checks:t,valid:s,orgId:i,projectId:r,...l.length?{unresolved:l}:{},...d}}function Rg(e){return e.tags?.length?`testrun --tags ${e.tags.join(",")}`:e.match?`testrun --match ${e.match}`:e.paths?.length?`testrun ${e.paths.length} paths`:"testrun"}async function Wd(e,n={}){let t=await Hd(e),i=e.cwd??process.cwd(),o=Jd(t,{...n,variables:{index:Ja(za(i))},...e.remote?{remote:!0}:{},...e.grid?{grid:!0}:{},...e.projects?{projects:e.projects}:{}}),r=Number(e.parallel??1),a=Number.isFinite(r)&&r>=1?Math.floor(r):1;if(a>1&&!e.remote&&t.some(s=>s.mobile&&!s.realDevice))throw new ve("Mobile tests can only run one at a time on your local device. Please remove --parallel and try again.");if(e.deviceOverride&&new Set(t.filter(l=>l.mobile&&l.platform).map(l=>l.platform)).size>1)throw new ve("this run has both Android and iOS tests, so one --device-name/--os-version cannot apply to all of them. Select one platform with --match or --tags, or drop --device-name/--os-version.");return{...o,parallel:a,parallelClamped:!1,onFailure:e.onFailure??"continue",title:e.name??Rg(e)}}import{basename as Ng,dirname as yg,sep as kg}from"path";function Zd(e){let n=et(e),t=new Ae,i=t.loadProfileConfig(t.getActiveProfile()??"default",t.getDefaultEnv())??{};return{...n.kind==="remote"?{folder:{id:n.projectId,name:n.projectName},linkedOf:o=>mn(o)?.projectId??null}:{},...i.project_id?{profile:{id:i.project_id,...i.project_name?{name:i.project_name}:{}}}:{}}}var Po="these tests are in different Test Manager projects, and a run counts for one project only";function Kd(e){if(!e.checks.some(l=>l.failure==="project_mismatch"))return null;let n=e.projects?.folder,t=l=>[n,e.projects?.profile].find(d=>d?.id===l)??{id:l},i=new Map;for(let l of e.checks){if(!l.projectId||l.failure&&l.failure!=="project_mismatch")continue;let d=i.get(l.projectId)??{project:t(l.projectId),thisFolder:l.projectId===n?.id,tests:[]};d.tests.push(l.relPath),i.set(l.projectId,d)}let o=[...i.values()].sort((l,d)=>Number(d.thisFolder)-Number(l.thisFolder)),r=o.find(l=>l.thisFolder)??i.get(e.projectId??"")??o[0],a=`the tests of ${Ho(r.project)}${r.thisFolder?", this folder's project":""}`,s=`kane-cli testrun run ${xg(r.tests,e.checks.map(l=>l.relPath))}`;return{groups:o,remedy:`to run ${a}`,next:{cmd:s,why:`run ${a}`}}}var Ho=e=>e.name!==void 0?`"${e.name}"`:`the project ${e.id}`;function xg(e,n){let t=e.map(So).join(" ");if(e.length<=5)return t;let i=Vg(e),o=new RegExp(i);return n.every(r=>o.test(r)===e.includes(r))?`--match ${So(i)}`:t}function Vg(e){let n=r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=new Set(e.map(r=>yg(r)));if(t.size>1)return`^(?:${e.map(n).join("|")})$`;let i=[...t][0],o=e.map(r=>Ng(r).replace(/_test\.md$/,""));return`^${i==="."?"":n(i+kg)}(?:${o.map(n).join("|")})_test\\.md$`}function Xd(e){let n=[`error: ${Po}`];for(let t of e.groups)n.push(` ${t.thisFolder?`this folder's project, ${Ho(t.project)}`:Ho(t.project)}:`,...t.tests.map(i=>` ${i}`));n.push(`next: ${e.remedy}, run:`,` ${e.next.cmd}`,""),process.stderr.write(n.map(t=>`${t}
3988
3988
  `).join(""))}function qd(e,n){return{type:"error",code:"PROJECT_MISMATCH",message:Po,projects:e.groups.map(t=>({project_id:t.project.id,name:t.project.name??null,this_folder:t.thisFolder,tests:t.tests})),...cr({code:"PROJECT_MISMATCH",message:Po,remedy:`${e.remedy}, run:
3989
3989
  ${e.next.cmd}`,next:[e.next]},n)}}var _d=e=>et(e).kind==="remote";async function Lo(e){return(await ur({root:e})).results.length===0}var $d=["error: no tests here yet","next: to bring the project's tests into this folder, run:"," kane-cli context pull"];function el(e,n){if(e.checks.length===0)return n.nothingHere?{type:"error",code:"NO_TESTS",message:"no tests here yet",next:[{cmd:"kane-cli context pull --mode agent",why:"brings the project's tests into this folder"}]}:{type:"error",code:"NO_TESTS",message:"no *_test.md files selected"};let t=e.checks.filter(i=>i.failure);return{type:"error",code:"PLAN_INVALID",message:`plan invalid \u2014 ${t.length} offending test(s)`,offenders:t.map(i=>({path:i.relPath,failure:i.failure}))}}import{basename as Fg,join as ul}from"path";import{readFileSync as ml,existsSync as Gg}from"fs";import{promises as It}from"fs";import{existsSync as Mt}from"fs";import{join as wn}from"path";async function zo(e){let n=e.status??"skipped",t=wn(e.packDir,"tests",e.testId),i=wn(t,"steps"),o=wn(t,"logs");await It.mkdir(i,{recursive:!0});let r=wn(i,".keep");Mt(r)||await It.writeFile(r,""),await It.mkdir(o,{recursive:!0});let a=wn(o,"testrun.log");Mt(a)||await It.writeFile(a,e.reason+`
3990
3990
  `);let s=wn(t,e.definition.path);Mt(s)||await It.writeFile(s,e.definition.content);let l=wn(o,"meta.yaml");if(!Mt(l)){let c=await pa(o);await ua(e.packDir,e.testId,da(c))}let d=wn(t,"result.yaml");Mt(d)||await la(e.packDir,e.testId,ca({testId:e.testId,status:n,definitionPath:e.definition.path,externalId:ia(e.externalIdInput),tags:e.tags,environment:{},steps:[]}))}async function Tr(e,n,t){let i=[],o=new Array(e.length).fill(!1),r=0,a=!1,s,l=!1,d=()=>{i.length<e.length&&(l=!0)};t.signal&&(t.signal.aborted?d():t.signal.addEventListener("abort",d,{once:!0}));async function c(){for(;;){if(a||t.signal?.aborted||r>=e.length)return;let g=r++,m=e[g];o[g]=!0;try{t.onStart?.(m);let f=await n(m);i.push({item:m,result:f}),t.onEnd?.(m,f),t.failFast&&t.isFailure(f)&&(a=!0)}catch(f){s=s??f,a=!0}}}let u=Math.max(1,Math.min(t.parallel,e.length));try{await Promise.all(Array.from({length:u},()=>c()))}finally{t.signal?.removeEventListener("abort",d)}if(s)throw s;return{done:i,skipped:e.filter((g,m)=>!o[m]),cancelled:l}}function Sr(e){return{...e?.sessionId?{session_id:e.sessionId}:{},...e?.logPath?{log_path:e.logPath}:{}}}function nl(e,n){return e!=="passed"&&n?{failure:n}:{}}function tl(e){return{type:"testrun_plan",members:e.checks.map(n=>({path:n.path,test_id:n.testId,tags:n.tags,...n.mobile?{mobile:!0}:{},...n.contextId?{context_id:n.contextId}:{},...n.failure?{failure:n.failure}:{},...n.unresolved?.length?{unresolved:n.unresolved}:{}})),valid:e.valid,parallel:e.parallel,...e.parallelClamped?{parallel_clamped:!0}:{}}}function rl(e,n,t){return{type:"testrun_start",execution_id:e,members:n.checks.map(i=>i.relPath),parallel:n.parallel,...t?{override_start_url:t}:{}}}function Qr(e,n){return{type:"testrun_member_start",path:e.path,test_id:e.testId,...e.contextId?{context_id:e.contextId}:{},...Sr(n)}}function Rr(e,n){return{type:"testrun_member_end",path:e.path,test_id:e.testId,status:n.overallStatus,duration_s:n.durationS,...e.contextId?{context_id:e.contextId}:{},...Sr(n),...nl(n.overallStatus,n.failure)}}function Nr(e,n){return{type:"testrun_authored_member_start",path:e.path,...Sr(n)}}function yr(e){return{type:"testrun_authored_member_end",path:e.relPath,...e.testId?{test_id:e.testId}:{},status:e.overallStatus,duration_s:e.durationS,...Sr(e),...nl(e.overallStatus,e.failure)}}function ol(e){return{type:"testrun_progress",running:e.running,pending:e.pending,done:e.done,total:e.total}}function kr(e,n){return{type:"testrun_member_event",member:e,event:n}}function rt(e,n){return{type:"testrun_evidence_ingest",status:e.ok?"ok":"failed",evidence_id:n,...e.stage?{stage:e.stage}:{},...e.verdictsRejected!==void 0?{verdicts:"rejected",verdicts_error:e.verdictsRejected}:{}}}function xr(e){return{type:"testrun_summary",execution:e.execution,authored:e.authored,totals:e.totals,duration_s:e.durationS,upload:e.upload,cancelled:e.cancelled,...e.remote?{remote:e.remote}:{}}}function Nn(e,n,t){return{type:"testrun_done",execution_id:e,overall_status:n,...t?{coverage:t}:{}}}function il(e){return{type:"remote_start",backend:e.backend,env:e.env,...e.logPath?{log_path:e.logPath}:{}}}function sl(e){return{type:"remote_device",platform:e.platform,slug:e.slug,name:e.name,os_version:e.osVersion,...e.avdId?{avd_id:e.avdId}:{},...e.pool?{pool:e.pool}:{}}}function al(e){return{type:"remote_app",path:e.path,app_id:e.appId,source:e.source}}function cl(e){return{type:"remote_device_hint",reason:e.reason,detail:e.detail}}function dl(e){return{type:"remote_member_device",path:e.path,kind:e.kind,platform:e.platform,...e.name?{name:e.name}:{},...e.osVersion?{os_version:e.osVersion}:{},name_source:e.nameSource,os_version_source:e.osVersionSource}}function Jo(e){return{type:"remote_dispatched",job_id:e.jobId,job_url:e.jobUrl,...e.runnerVersion?{runner_version:e.runnerVersion}:{}}}function bn(e){return{type:"reconcile_merge_degraded",code:"RECONCILE_MERGE_DEGRADED",reason:e.reason,...e.detail?{detail:e.detail}:{},...e.excludedPack?{excluded_pack:e.excludedPack}:{},...e.standaloneIds?{standalone_execution_ids:e.standaloneIds}:{}}}function Bt(e){return{type:"remote_import_tape",path:e.path,status:e.status,...e.reason?{reason:e.reason}:{},...e.dispatchCommit?{dispatch_commit:e.dispatchCommit}:{},...e.gridCommit?{grid_commit:e.gridCommit}:{},...e.localCommit?{local_commit:e.localCommit}:{}}}function sn(e){return{type:"remote_exec_sync",code:{skipped:"REMOTE_EXEC_SYNC_SKIPPED",warning:"REMOTE_EXEC_SYNC_WARNING",failed:"REMOTE_EXEC_SYNC_FAILED"}[e.status],status:e.status,reason:e.reason,...e.detail?{detail:e.detail}:{},...e.executionId?{execution_id:e.executionId}:{}}}function Wo(e){return{type:"remote_coverage",code:{skipped:"REMOTE_COVERAGE_SKIPPED",failed:"REMOTE_COVERAGE_FAILED"}[e.status],status:e.status,reason:e.reason,...e.detail?{detail:e.detail}:{}}}function yn(e){return{type:"remote_error",code:e.code,detail:e.detail}}function Dt(e){return{type:"remote_done",status:e.status,exit:e.exit,job_id:e.jobId,sessions_path:e.sessionsPath,...e.coverage?{coverage:e.coverage}:{}}}function ll(e,n){let t=e.unresolved??[];return t.length>0?hr(t,{cwd:n}):null}var ot=e=>e.overallStatus==="failed"||e.overallStatus==="broken"||e.overallStatus==="interrupted";function gl(e){try{return ml(e,"utf8")}catch{return""}}async function Al(e,n){let t=n.cwd??process.cwd(),i=Date.now(),o=Kn();n.onExecutionId?.(o);let r=C=>({execution_id:o,test_id:C.testId,testcase_id:C.testcaseId,project_id:C.projectId,folder_id:C.folderId,org_id:C.orgId,commit_id:C.commitId,session_name:C.sessionName,tc_id:C.tcId,user_name:n.operator?.userName,user_email:n.operator?.userEmail}),a=await aa({execution_id:o,title:e.title,started:new Date().toISOString(),producerVersion:De,run_kind:"author",origin:"testrun",pid:process.pid,...n.overrideStartUrl?{overrideStartUrl:n.overrideStartUrl}:{}},t);n.emit(rl(o,e,n.overrideStartUrl));let s=[...new Set(e.checks.flatMap(C=>C.tags))];n.log?.("info","TESTRUN_START","Testrun started",{execution_id:o,member_count:e.checks.length,parallel:e.parallel,on_failure:e.onFailure,tags:s});let l=0,d=e.checks.map(C=>({key:C.path,value:C})),c=new Set,u=0,g=()=>n.emit(ol({running:[...c],pending:d.length-u-c.size,done:u,total:d.length})),m=await Tr(d,C=>n.executeMember(C.value,l++),{parallel:e.parallel,failFast:e.onFailure==="fail-fast",isFailure:ot,signal:n.signal,onStart:C=>{n.emit(Qr(C.value,n.memberLog?.(C.value))),c.add(C.value.relPath),g()},onEnd:(C,Q)=>{n.emit(Rr(C.value,Q)),c.delete(C.value.relPath),u++,g(),n.log?.("info","TESTRUN_MEMBER_END","Testrun member ended",{execution_id:o,member_test_id:C.value.testId??je(C.value.relPath),status:Q.overallStatus,result_code:Q.resultCode??null,duration_s:Q.durationS,run_kind:Q.runKind,session_id:Q.sessionId??null,log_path:Q.logPath??null,...Q.overallStatus!=="passed"&&Q.failure?{error:Q.failure.message,...Q.failure.step_index!==void 0?{failed_step:Q.failure.step_index}:{}}:{}})}}),f=m.done.find(C=>ot(C.result));for(let C of m.skipped)await zo({packDir:a,testId:je(C.value.relPath),definition:{path:"test.md",content:gl(C.value.path)},externalIdInput:r(C.value),tags:C.value.tags,reason:m.cancelled?"skipped: testrun cancelled":`skipped: fail-fast after ${f?Fg(f.item.value.path):"failure"}`});let A=new Map(m.done.map(C=>[C.item.value.relPath,C.result]));for(let C of e.checks){let Q=je(C.relPath);if(Gg(ul(a,"tests",Q,"result.yaml")))continue;let X=A.get(C.relPath);await zo({packDir:a,testId:Q,definition:{path:"test.md",content:gl(C.path)},externalIdInput:r(C),tags:C.tags,reason:`member ended '${X?.overallStatus??"broken"}' before writing its result (chrome-slot failure or pre-run crash \u2014 see member session logs)`+(X?.failure?.message?`: ${X.failure.message}`:""),status:"broken"}),X&&!ot(X)&&(X.overallStatus="broken",X.exitCode=2)}let h=m.done.flatMap(C=>C.result.pendingInvestigations??[]);if(h.length>0){n.emit({type:"testrun_investigations_wait",count:h.length});let C=h.map(Y=>Y.exited),Q,X=!1;try{await Promise.race([Promise.allSettled(C),new Promise(Y=>{Q=setTimeout(()=>{X=!0,Y()},n.investigationTimeoutMs??12e4)})])}finally{clearTimeout(Q)}if(X){for(let we of h)try{we.cancel()}catch{}let Y;try{await Promise.race([Promise.allSettled(C),new Promise(we=>{Y=setTimeout(we,15e3)})])}finally{clearTimeout(Y)}}}let p=ft(gn(t));try{let C=Y=>Y==="passed"||Y==="failed"||Y==="skipped"?Y:"broken",Q=Y=>{try{let we=Hn(ml(ul(a,"tests",Y,"result.yaml"),"utf8"));return ir(we.steps??[])}catch{return[]}},X=sr({projectDir:t,store:p,members:m.done.map(Y=>({path:Y.item.value.path,verdict:C(Y.result.overallStatus),acs:Q(Y.result.testId),executionId:o,startedAt:new Date().toISOString(),durationMs:Math.round(Y.result.durationS*1e3),mode:"testrun",local:!n.shouldPublish}))});for(let Y of X.warnings)n.log?.("warn","TESTRUN_EXEC_SYNC_WARNING",Y,{execution_id:o})}catch(C){n.log?.("warn","TESTRUN_EXEC_SYNC_FAILED","Testrun exec-sync failed",{execution_id:o,error:String(C)})}let w;try{if(w=await(n.coverageWriter??_n)(a,(n.coverageSource??nt)(t),{executionId:o}),w.status==="skipped"||w.status==="failed"){let C=w.status==="skipped"?w.reason:w.detail;n.log?.(w.status==="skipped"?"info":"warn","TESTRUN_COVERAGE_SKIPPED",`Testrun coverage/usecases.yaml not written: ${C}`,{execution_id:o,reason:C})}}catch(C){w={status:"failed",detail:String(C)},n.log?.("warn","TESTRUN_COVERAGE_WRITER_THREW","Testrun coverage writer threw",{execution_id:o,error:String(C)})}await zn(a,await n.catalog??Ln());let D=await Zn(a,new Date().toISOString()),O;try{let C=await Wn(Ne(o,t),"L1");O=C.valid,C.valid||n.log?.("warn","EVIDENCE_INVALID","Sealed testrun pack failed L1 validation",{execution_id:o,first_code:String(C.diagnostics?.[0]?.code??""),surface:"testrun"})}catch(C){n.log?.("warn","TESTRUN_VALIDATION_ERROR","Testrun pack validation threw",{execution_id:o,error:String(C)})}let V;n.policies?.length&&!m.cancelled&&(V=await Xn(Ne(o,t),n.policies),n.log?.(V.result==="pass"?"info":"warn","EVIDENCE_VERDICT","Testrun policy verdict",{execution_id:o,result:V.result,error:V.error}));let v="skipped";if(n.shouldPublish&&!m.cancelled&&n.publish){let C=e.checks[0],Q=await n.publish({testId:C.testId,sessionId:o,executionId:o,sealedPackPath:Ne(o,t),projectId:e.projectId,...V?qn(n.policies,V):{}});v=Q.ok?"ok":"failed",n.emit(rt(Q,o))}else n.shouldPublish&&m.cancelled&&n.log?.("info","PUBLISH_SKIPPED","Testrun evidence publish skipped",{surface:"testrun",reason:"cancel"});n.deferCoverage||n.emit(An(w,Ne(o,t)));let b=new Map(m.done.map(C=>[C.item.value.path,C.result]));for(let C of e.checks){let Q=b.get(C.path);await er(Le(C.path),{execution_id:o,run_kind:Q?.runKind??"author",status:Q?ot(Q)?Q.overallStatus==="failed"?"failed":"broken":"passed":"skipped",valid:O,uploaded:v==="ok",at:new Date().toISOString()})}let F={tests:e.checks.length,passed:m.done.filter(C=>!ot(C.result)).length,failed:m.done.filter(C=>C.result.overallStatus==="failed").length,broken:m.done.filter(C=>["broken","interrupted"].includes(C.result.overallStatus)).length,skipped:m.skipped.length,creditsConsumed:m.done.reduce((C,Q)=>C+(Q.result.creditsConsumed??0),0)};n.log?.("info","TESTRUN_SUMMARY","Testrun summary",{execution_id:o,totals:{passed:F.passed,failed:F.failed,broken:F.broken,skipped:F.skipped},upload:v});let G=m.done.some(C=>ot(C.result)),B=m.cancelled?3:G?1:0;return n.log?.("info","TESTRUN_DONE","Testrun done",{execution_id:o,exit_code:B}),{exitCode:B,executionId:o,totals:F,upload:v,coverage:w,...V?{verdict:V}:{}}}import{readFileSync as Ug}from"fs";import{resolve as jg}from"path";function pl(e,n){if(e.mobile)return n;let{deviceName:t,osVersion:i,...o}=n;return o}function Vr(e){return{sessionId:e.sessionId,logPath:jg(e.sessionDir,"events.ndjson")}}function Og(e,n){return{testId:e,overallStatus:n.overallStatus,exitCode:n.exitCode,durationS:n.durationS??0,...n.creditsConsumed!==void 0?{creditsConsumed:n.creditsConsumed}:{},runKind:Dc(!!n.anyAuthorStepRan),resultCode:n.resultCode??null,...n.pendingInvestigations?.length?{pendingInvestigations:n.pendingInvestigations}:{}}}function fl(e){let n=e.cdpEndpoint!==void 0?{...e.passThroughOpts,cdpEndpoint:e.cdpEndpoint}:{...e.passThroughOpts};return{path:e.abs,cwd:e.cwd,opts:n,isAgent:!0,disableAskUser:!0,resolved:e.cdpEndpoint!==void 0?{...e.resolved,chrome:{...e.resolved.chrome,cdp_endpoint:e.cdpEndpoint}}:e.resolved,resolvedAuth:e.resolvedAuth,cliOverrides:{},environment:e.environment,envConfig:e.envConfig,profile:e.profile,model:e.model,creds:e.creds,configStore:e.configStore,session:e.session,skipGlobalRemoteLogger:!0,evidenceAttach:e.attach,suppressEvidenceOffer:!0,coordinatorPublishes:!0,onFatalExit:t=>{throw new Error(`project/folder gate failed: ${t.split(`
@@ -4121,7 +4121,7 @@ ${o.join(`
4121
4121
  `),!(!e.isAgent&&!e.cancelled&&!!process.stdin.isTTY&&!!process.stderr.isTTY)){process.stderr.write(`
4122
4122
  Evidence \u2014 view locally:
4123
4123
  `);for(let s of t(i))process.stderr.write(` ${s}
4124
- `);return}let{renderTestrunEvidenceTable:a}=await import("./TestrunEvidenceTable-OGMWTJQF.js");await a({rows:i,env:e.environment})}function HA(e){let n=process.listeners("SIGINT");process.removeAllListeners("SIGINT");let t=()=>e.abort();return process.on("SIGINT",t),()=>{process.removeListener("SIGINT",t);for(let i of n)process.on("SIGINT",i)}}function LA(e){let n=null;try{let o=Ws(),r=Ys(o);n=No({sessionId:fi(),identity:{org_id:r.org_id??"",user_id:r.user_id??"",machine_id:r.machine_id,email:null,email_domain:"",user_type:r.user_id||r.org_id?r.user_type??"unknown":"anonymous",env:r.env,plan:r.plan??"unknown"},invocationMode:e?"agent":"cli",getToken:async()=>null}),n.start()}catch{n=null}return{log:(o,r,a,s)=>{try{n?.log(o,r,a,s)}catch{}},shutdown:async()=>{try{await n?.shutdown()}catch{}}}}function zA(e){let n=null;try{let o=e.resolvedAuth.resolvedCreds;o&&(n=No({sessionId:e.sessionId??fi(),identity:{org_id:String(o.org_id??""),user_id:String(o.user_id??""),machine_id:Os(),email:o.email??null,email_domain:o.email_domain??"unknown",user_type:o.user_type??"unknown",env:e.environment,plan:o.plan??"unknown"},invocationMode:e.isAgent?"agent":"cli",getToken:async()=>e.resolvedAuth.token??null}),n.start())}catch{n=null}return{log:(o,r,a,s)=>{try{n?.log(o,r,a,s)}catch{}},shutdown:async()=>{try{await n?.shutdown()}catch{}}}}function JA(e,n){return e?en:n||(t=>WA(t))}function WA(e){switch(e.type){case"testrun_start":process.stdout.write(`
4124
+ `);return}let{renderTestrunEvidenceTable:a}=await import("./TestrunEvidenceTable-SZPZMW3J.js");await a({rows:i,env:e.environment})}function HA(e){let n=process.listeners("SIGINT");process.removeAllListeners("SIGINT");let t=()=>e.abort();return process.on("SIGINT",t),()=>{process.removeListener("SIGINT",t);for(let i of n)process.on("SIGINT",i)}}function LA(e){let n=null;try{let o=Ws(),r=Ys(o);n=No({sessionId:fi(),identity:{org_id:r.org_id??"",user_id:r.user_id??"",machine_id:r.machine_id,email:null,email_domain:"",user_type:r.user_id||r.org_id?r.user_type??"unknown":"anonymous",env:r.env,plan:r.plan??"unknown"},invocationMode:e?"agent":"cli",getToken:async()=>null}),n.start()}catch{n=null}return{log:(o,r,a,s)=>{try{n?.log(o,r,a,s)}catch{}},shutdown:async()=>{try{await n?.shutdown()}catch{}}}}function zA(e){let n=null;try{let o=e.resolvedAuth.resolvedCreds;o&&(n=No({sessionId:e.sessionId??fi(),identity:{org_id:String(o.org_id??""),user_id:String(o.user_id??""),machine_id:Os(),email:o.email??null,email_domain:o.email_domain??"unknown",user_type:o.user_type??"unknown",env:e.environment,plan:o.plan??"unknown"},invocationMode:e.isAgent?"agent":"cli",getToken:async()=>e.resolvedAuth.token??null}),n.start())}catch{n=null}return{log:(o,r,a,s)=>{try{n?.log(o,r,a,s)}catch{}},shutdown:async()=>{try{await n?.shutdown()}catch{}}}}function JA(e,n){return e?en:n||(t=>WA(t))}function WA(e){switch(e.type){case"testrun_start":process.stdout.write(`
4125
4125
  running ${e.members.length} test(s) (parallel=${e.parallel})
4126
4126
  `);break;case"testrun_member_start":process.stdout.write(` -> ${e.path}${e.log_path?` (log: ${e.log_path})`:""}
4127
4127
  `);break;case"testrun_progress":process.stdout.write(` [${e.done}/${e.total} done, ${e.running.length} running, ${e.pending} pending]
@@ -4193,8 +4193,8 @@ Test files:
4193
4193
 
4194
4194
  Docs https://www.testmuai.com/support/docs/kane-cli-introduction
4195
4195
  Bugs https://github.com/LambdaTest/kane-cli/issues
4196
- `),t.on("command:*",o=>{t.error(`error: unknown command '${o[0]}'`,{exitCode:2,code:"commander.unknownCommand"})}),t.command("login").description("Authenticate (interactive; --oauth opens the browser, or --username/--access-key for basic auth)").option("--oauth","Login via OAuth (opens browser)").option("--username <user>","Basic auth username").option("--access-key <key>","Basic auth access key").addOption(new ne("--env <name>","Environment (prod or stage)").default("prod").hideHelp()).option("--profile <name>","Profile name","default").option("--project-id <id>","Project ID (skip picker)").option("--folder-id <id>","Folder ID (skip picker)").addOption(new ne("--model <name>","Model").default("v16-alpha").hideHelp()).option("--chrome-profile <path>","Chrome profile path").action(async o=>{let r=new Ae,a=new xe,s=o.env,l=o.profile;if(!process.stdin.isTTY||o.oauth||o.username){if(r.setDefaultEnv(s),o.oauth)await new Us(l,s,r).login(),console.log(`Logged in as ${l} [${s}] via OAuth`);else if(o.username&&o.accessKey){try{let{validateBasicAuth:w}=await import("./validate-basic-QWPESO74.js");await w(s,o.username,o.accessKey)}catch{console.error("Credentials not valid. Please use valid credentials."),M(1,"Invalid basic-auth credentials");return}r.saveBasicAuth(l,s,{username:o.username,access_key:o.accessKey}),console.log(`Logged in as ${l} [${s}] via basic auth`)}else console.error("Provide --oauth, or --username and --access-key"),M(1,"Missing --oauth or credentials for login");r.setActiveProfile(l),a.set("model",o.model),o.chromeProfile&&a.set("chrome_profile_path",o.chromeProfile);let p=null;if(o.username&&o.accessKey)p={username:o.username,access_key:o.accessKey};else try{let D=await $e({creds:r,env:s,log:()=>{}});D.resolvedCreds&&(p={username:D.resolvedCreds.username,access_key:D.resolvedCreds.access_key})}catch{}if(o.projectId&&(Tn(r,a,l,s,{projectId:o.projectId}),console.log(`Project set to ${o.projectId}`)),o.folderId&&(Tn(r,a,l,s,{folderId:o.folderId}),console.log(`Folder set to ${o.folderId}`)),p&&(!o.projectId||!o.folderId))try{let w=await Fs({creds:r,config:a,profile:l,env:s,tmsCreds:p,log:()=>{}});o.projectId||console.log(`Auto-selected project: ${w.projectName} (${w.projectId})`),o.folderId||console.log(`Auto-selected folder: ${w.folderName} (${w.folderId})`)}catch(w){console.warn(`Could not auto-select project/folder: ${w instanceof Error?w.message:w}`)}Xt(r,a,l,s),console.log("Setup complete."),M(0,"Setup complete")}let{SingleShotApp:d}=await import("./SingleShotApp-MXNJPU6A.js"),{ScrollbackProvider:c}=await import("./scrollback-GGNBDFQV.js"),{render:u}=await import("./build-5ZN47FAT.js"),g=await import("./react-QWOAB3TB.js"),m={current:null},f={current:!1},{waitUntilExit:A,unmount:h}=u(g.default.createElement(c,null,g.default.createElement(d,{resultRef:m,mode:"login",loginCompleteRef:f})),{exitOnCtrlC:!1});dt(()=>h()),await A();try{process.stdin.setRawMode?.(!1)}catch{}process.stdout.write("\x1B[?25h"),f.current&&console.log("Login setup complete."),process.exit(0)}),t.command("logout").description("Revoke tokens and delete the stored profile credentials").action(async()=>{let o=new Ae,r=o.getActiveProfile();if(!r){console.log("No active profile to logout");return}let a=o.getDefaultEnv(),s=await js(o,r,a);process.once("exit",()=>Ps(s.env));let l=new xe;s.switchedTo?(Xt(o,l,s.switchedTo.profile,s.switchedTo.env),console.log(`Logged out ${s.profile} [${s.env}]. Switched to ${s.switchedTo.profile} [${s.switchedTo.env}]`)):(l.save({project_id:null,project_name:null,folder_id:null,folder_name:null}),console.log(`Logged out ${s.profile} [${s.env}]. No profiles remaining.`))}),t.command("whoami").description("Show the authenticated identity, active profile, and environment").option("--profile <name>","Profile name").action(async o=>{let r=new Ae,a=o.profile??r.getActiveProfile()??"default",s=r.getDefaultEnv(),l=r.loadCredentials(a,s),d=r.loadBasicAuth(a,s),c="none",u=d?.username,g,m,f;if(d?c="basic":l&&(c="oauth"),c==="none")g="missing";else try{let D=await $e({creds:r,env:s,log:()=>{}});if(D.resolvedCreds)m="verified",g="valid",u=D.resolvedCreds.username??u;else{let{classifyAuthFailure:O}=await import("./resolver-3BGIXYYJ.js");O(D.resolver.lastError)==="auth"?(m="rejected",g="expired",f="Credentials rejected by the server \u2014 re-login or rotate your access key"):(m="unreachable",f=D.resolver.lastError?.message)}}catch(D){let O=D;O.code==="refresh_failed"?(m="rejected",g="expired",f="OAuth token refresh failed \u2014 run 'kane-cli login'"):O.code==="not_authenticated"?(c="none",g="missing"):(m="unreachable",f=O.message)}let{WhoamiView:A}=await import("./WhoamiView-WGCWD7GP.js"),{render:h}=await import("./build-5ZN47FAT.js"),p=await import("./react-QWOAB3TB.js"),{waitUntilExit:w}=h(p.default.createElement(A,{profile:a,env:s,authenticated:m==="verified",authMethod:c,username:u,tokenStatus:g,serverStatus:m,detail:f}));await w(),c==="none"?M(1,"whoami: not-authenticated"):m&&m!=="verified"&&M(m==="unreachable"?3:1,`whoami: ${m}`)}),t.command("config <action> [value]").description("Show or change settings ("+["show","set-target",...Br,"set-mode","set-assertion-mode","set-network-ws","set-network-sse","set-bug-detection","set-assertion-failure-mode","set-final-validation","set-url","reset-url","set-window","chrome-profile","project","folder","reset"].join(", ")+")").option("--agent","Print `show` as JSON (on by itself with no terminal)").action(async(o,r,a)=>{let s=new xe,l=new Ae,d=Dd(o,{hostSupportsMobile:n,mobileMessage:Yt(),target:ln(s.load().mobile)});if(d){process.stderr.write(d.message),M(d.exitCode,`config ${o} unavailable off a mobile host`);return}if(o==="show"){let c=s.load(),u=l.getActiveProfile()??"default",g=l.getDefaultEnv(),m=l.loadProfileConfig(u,g)??{},f=m.project_id??c.project_id??null,A=m.project_name??c.project_name??null,h=m.folder_id??c.folder_id??null,p=m.folder_name??c.folder_name??null,w=l.loadBasicAuth(u,g),D=l.loadCredentials(u,g),O=w?`basic (${w.username})`:D?"oauth":"not configured",{resolveSessionTarget:V}=await import("./session-target-DD53UXO7.js"),{CHOOSE_MOBILE_KIND_FIX:v}=await import("./resolve-run-intent-RBOCIYEA.js"),{deviceRefName:b,deviceRefOsVersion:F}=await import("./device-ref-LAZWPRQN.js"),G=V(c.mobile?.tui_target,c.mobile?.default_target?.kind),B=G.kind==="unset"?"desktop":G.kind==="choose-mobile"?`mobile (legacy \u2014 run \`${v}\`)`:G.kind;if(!!a?.agent||!process.stdin.isTTY||!process.stdout.isTTY){let ge=he(g);process.stdout.write(`${JSON.stringify({profile:u,env:g,auth:O,project_id:f,project_name:A,folder_id:h,folder_name:p,model:c.model,mode:c.mode,assertion_mode:c.assertion_mode,network_ws:c.network_ws,network_sse:c.network_sse,bug_detection:c.bug_detection,assertion_failure_mode:c.assertion_failure_mode,final_validation:c.final_validation,window_size:`${c.window_size.width}x${c.window_size.height}`,chrome_profile:c.chrome_profile_path,default_url:c.default_url??co,target:B,device_name:b(c.mobile?.default_target),os_version:F(c.mobile?.default_target),app:c.mobile?.default_app??null,...Object.fromEntries(gt.map(y=>[y.key,ho(c.mobile,y.target)])),device_stream:c.mobile?.device_stream!==!1,controller_base_url:ge.controllerBaseUrl,tms_base_url:ge.tmsBaseUrl})}
4197
- `),M(0,"config show complete");return}let{ConfigView:Q}=await import("./ConfigView-LU5IRRQU.js"),{render:X}=await import("./build-5ZN47FAT.js"),Y=await import("./react-QWOAB3TB.js"),{waitUntilExit:we}=X(Y.default.createElement(Q,{model:c.model,authLabel:O,profile:u,env:g,defaultUrl:c.default_url??co,projectId:f,projectName:A,folderId:h,folderName:p,windowSize:`${c.window_size.width}x${c.window_size.height}`,chromeProfile:c.chrome_profile_path,target:B,deviceName:b(c.mobile?.default_target),osVersion:F(c.mobile?.default_target),appLabel:c.mobile?.default_app??null,deviceSettings:(()=>{let ge=ln(c.mobile);return ge?[{label:Cs(ge).label,value:ho(c.mobile,ge)?"on":"off"}]:[]})()}));await we()}else if(o==="set-window"&&r){let c=r.split("x").map(Number),[u,g]=c;!u||!g||!Number.isInteger(u)||!Number.isInteger(g)?console.error("Invalid format. Use: kane-cli config set-window WIDTHxHEIGHT"):u<800||u>3840?console.error(`Width must be between 800 and 3840 (got ${u})`):g<600||g>2160?console.error(`Height must be between 600 and 2160 (got ${g})`):(s.set("window_size",{width:u,height:g}),console.log(`Window size set to ${u}x${g}`))}else if(o==="set-mode"){if(r!=="action"&&r!=="testing"){console.error("Mode must be 'action' or 'testing'."),M(1,"Invalid mode");return}s.set("mode",r),console.log(`Mode set to ${r}`)}else if(o==="set-assertion-mode"){if(r!=="visual"&&r!=="dom"){console.error("Assertion mode must be 'visual' or 'dom'."),M(1,"Invalid assertion-mode");return}s.set("assertion_mode",r),console.log(`Assertion mode set to ${r}`)}else if(o==="set-network-ws"){if(r!=="on"&&r!=="off"){console.error("WebSocket capture must be 'on' or 'off'."),M(1,"Invalid network-ws value");return}s.set("network_ws",r==="on"),console.log(`WebSocket capture set to ${r}`)}else if(o==="set-network-sse"){if(r!=="on"&&r!=="off"){console.error("SSE capture must be 'on' or 'off'."),M(1,"Invalid network-sse value");return}s.set("network_sse",r==="on"),console.log(`SSE capture set to ${r}`)}else if(o==="set-bug-detection"){if(r!=="off"&&r!=="stop"&&r!=="continue"){console.error("Bug detection must be 'off', 'stop' or 'continue'."),M(1,"Invalid bug-detection value");return}s.set("bug_detection",r),console.log(`Bug detection set to ${r}`)}else if(o==="set-assertion-failure-mode"){if(r!=="stop"&&r!=="continue"){console.error("Assertion failure mode must be 'stop' or 'continue'."),M(1,"Invalid assertion-failure-mode value");return}s.set("assertion_failure_mode",r),console.log(`Assertion failure mode set to ${r}`)}else if(o==="set-final-validation"){if(r!=="on"&&r!=="off"){console.error("Final validation must be 'on' or 'off'."),M(1,"Invalid final-validation value");return}s.set("final_validation",r==="on"),console.log(`Final validation set to ${r}`)}else if(o==="set-target"){if(!Ki(r)){console.error(`Target must be one of ${Ao.join(", ")}.`),M(1,"Invalid target");return}if(Ft(r)){let{mobileHostSupport:u}=await import("./host-7GZPBA74.js"),g=u();if(!g.supported){console.error(g.reason),M(1,"unsupported host for mobile target");return}}let c=ln(s.load().mobile);s.setMobile(c===r?{tui_target:r}:{tui_target:r,default_target:void 0,default_app:void 0}),console.log(`Target set to ${r}`)}else if(o==="set-device-name"||o==="set-os-version"){let c=o==="set-device-name"?"device name":"OS version",u=o==="set-device-name"?"set-os-version":"set-device-name";if(!r){console.error(o==="set-device-name"?'Usage: kane-cli config set-device-name "<name>"':"Usage: kane-cli config set-os-version <version>"),M(1,`Missing ${c}`);return}let g=s.load().mobile,m=ln(g);if(!m){console.error(wi(n)),M(1,`no mobile target for ${o}`);return}if(po(m)){let B=o==="set-device-name"?{name:r.trim()}:{os_version:r.trim()},C=g?.default_target?.kind===m?g.default_target:void 0,Q={platform:rn(m),kind:m,...C?.name?{name:C.name}:{},...C?.os_version?{os_version:C.os_version}:{},...B},{checkRealDevice:X}=await import("./catalog-ZAROGOJA.js"),Y=await X(l.getDefaultEnv(),m,{...Q.name?{deviceName:Q.name}:{},...Q.os_version?{osVersion:Q.os_version}:{}});if(Y.kind==="refused"){console.error(Y.detail),M(1,"real device not available");return}Y.kind==="unchecked"&&console.error(`warning: ${Y.reason} \u2014 the device is not checked.`),s.setMobile({default_target:Q}),console.log(`${c[0].toUpperCase()}${c.slice(1)} set to ${r.trim()} (${Xi(m)})`);return}let f=g?.default_target?.kind===m?g.default_target:void 0,A=o==="set-device-name"?r.trim():f?.name?.trim()??"",h=o==="set-os-version"?r.trim():f?.os_version?.trim()??"";if(!A||!h){s.setMobile({default_target:{platform:rn(m),kind:m,...A?{name:A}:{},...h?{os_version:h}:{}}}),console.log(`${c[0].toUpperCase()}${c.slice(1)} saved. Complete the pair: kane-cli config ${u} "<value>" \u2014 see kane-cli devices list --target ${m}`);return}let{resolveTarget:p}=await import("./registry-WTWTFRXD.js"),w;try{w=await p({device:{name:A,osVersion:h},platform:rn(m),interactive:!1})}catch(B){console.error(B instanceof Error?B.message:String(B)),console.error(`Run \`kane-cli doctor --target ${m}\` to check the mobile toolchain.`),M(1,"device discovery failed");return}if(!w.ok){console.error(w.message),M(1,"device not found");return}let D=w.target;if(D.kind!==m){console.error(`${D.displayName} is a ${D.kind}, but the session target is ${m}.`),M(1,"device kind mismatch");return}let{toAppSpec:O}=await import("./prepare-target-P4AZWC37.js"),{appSuitsTarget:V}=await import("./resolve-run-intent-RBOCIYEA.js"),v=g?.default_app,b=v?O(v):null,F=!!v&&(!b||!V(b,m)),{deviceRefOf:G}=await import("./device-ref-LAZWPRQN.js");s.setMobile({default_target:G(D),...F?{default_app:void 0}:{}}),console.log(`Device set to ${A} (${D.osVersion??h}) \u2014 ${D.platform} \xB7 ${D.kind}`),F&&console.log(`Saved app ${v} does not suit a ${m} \u2014 cleared. Set one: kane-cli config set-app`)}else if(o==="set-app"){if(!r){console.error("Usage: kane-cli config set-app </path/to/build | AppId>"),M(1,"Missing app");return}let c=s.load().mobile,u=ln(c);if(!u){console.error(wi(n)),M(1,"no mobile target for set-app");return}if(!po(u)&&c?.default_target?.kind!==u){console.error('Set a device first: kane-cli config set-device-name "<name>" && kane-cli config set-os-version "<version>"'),M(1,"no device for set-app");return}let{toAppSpec:g}=await import("./prepare-target-P4AZWC37.js"),{appProblemFor:m}=await import("./resolve-run-intent-RBOCIYEA.js"),f=m(u,r,r);if(f){console.error(f),M(1,"app does not suit target");return}let A=g(r);if(A.kind!=="app_id"){let{access:h}=await import("fs/promises");if(!await h(A.value).then(()=>!0,()=>!1)){console.error(`${A.value} is not there.`),M(1,"app build missing");return}}s.setMobile({default_app:A.value}),console.log(`App set to ${A.value}`)}else if(gt.some(c=>c.command===o)){let c=o;if(r!=="on"&&r!=="off"){console.error(`Usage: kane-cli config ${o} on|off`),M(1,`Invalid ${o} value`);return}let u=ln(s.load().mobile);if(!u){console.error(wi(n)),M(1,`no mobile target for ${o}`);return}let g=gt.find(m=>m.command===c&&m.target===u);if(!g){let m=gt.filter(A=>A.command===c),f=m.map(A=>A.target);console.error(`${Is(m[0])} applies to ${f.join(" and ")} sessions only \u2014 your target is ${u}. Switch with: kane-cli config set-target ${f.join("|")}`),M(1,`${o} does not apply to ${u}`);return}s.setMobile({[g.key]:r==="on"}),console.log(`${Ms(g)} set to ${r}`)}else if(o==="set-device-stream"){if(r!=="on"&&r!=="off"){console.error("Usage: kane-cli config set-device-stream on|off"),M(1,"Invalid set-device-stream value");return}s.setMobile({device_stream:r==="on"}),console.log(`Real-device live view set to ${r}`)}else if(o==="set-url"){if(!r){console.error("Usage: kane-cli config set-url <url>"),M(1,"Missing URL");return}let c=Ua(r);if(!c){console.error(`Invalid URL: ${r}`),M(1,"Invalid URL");return}s.set("default_url",c),console.log(`Default URL set to ${c}`)}else if(o==="reset-url")s.set("default_url",Ga),console.log("Default URL reset \u2014 runs take the URL from --url, the test, or the objective");else if(o==="chrome-profile"){if(r||!process.stdin.isTTY){r||(console.error("Usage: kane-cli config chrome-profile <path>"),M(1,"Missing chrome-profile path")),s.set("chrome_profile_path",r),console.log(`Chrome profile set to ${r}`);return}let{ChromeProfilePicker:c}=await import("./ChromeProfilePicker-TVGWXTUU.js"),{render:u}=await import("./build-5ZN47FAT.js"),g=await import("./react-QWOAB3TB.js");await new Promise(m=>{let{unmount:f}=u(g.default.createElement(c,{currentPath:s.load().chrome_profile_path,onSelect:A=>{s.set("chrome_profile_path",A),console.log(`Chrome profile set to ${A}`),f(),m()},onCancel:()=>{f(),m()}}))})}else if(o==="project"){if(r||!process.stdin.isTTY){r||(console.error("Usage: kane-cli config project <project-id>"),M(1,"Missing project ID"));let V=l.getActiveProfile()??"default",v=l.getDefaultEnv();Tn(l,s,V,v,{projectId:r}),console.log(`Project set to ${r}`);return}let c=l.getDefaultEnv(),u=he(c),g=l.getActiveProfile()??"default",{resolveTmsBasicAuth:m,formatAuthResolutionError:f}=await import("./list-commands-FZPVH76I.js"),A=await m(g,c,{});if(!A.ok){let{message:V}=f(g,c,A);process.stderr.write(V),M(2,`${A.reason} for "${g}" [${c}]`);return}let{ProjectPicker:h}=await import("./ProjectPicker-YIQIVXGK.js"),{AuthResolver:p}=await import("./resolver-3BGIXYYJ.js"),{render:w}=await import("./build-5ZN47FAT.js"),D=await import("./react-QWOAB3TB.js"),O=new p(u.controllerBaseUrl,async()=>null,{username:A.creds.username,access_key:A.creds.access_key});await O.resolve(),await new Promise(V=>{let{unmount:v}=w(D.default.createElement(h,{resolver:O,currentProjectId:s.load().project_id,env:c,onSelect:(b,F)=>{let G=l.getActiveProfile()??"default",B=l.getDefaultEnv();Tn(l,s,G,B,{projectId:b,projectName:F}),console.log(`Project set to ${F} (${b})`),v(),V()},onCancel:()=>{v(),V()}}))})}else if(o==="folder"){if(r||!process.stdin.isTTY){if(r||(console.error("Usage: kane-cli config folder <folder-id>"),M(1,"Missing folder ID")),!s.load().project_id){console.log("Select a project first: kane-cli config project <id>");return}let b=l.getActiveProfile()??"default",F=l.getDefaultEnv();Tn(l,s,b,F,{folderId:r}),console.log(`Folder set to ${r}`);return}let c=s.load();if(!c.project_id){console.log("Select a project first: kane-cli config project");return}let u=l.getDefaultEnv(),g=he(u),m=l.getActiveProfile()??"default",{resolveTmsBasicAuth:f,formatAuthResolutionError:A}=await import("./list-commands-FZPVH76I.js"),h=await f(m,u,{});if(!h.ok){let{message:v}=A(m,u,h);process.stderr.write(v),M(2,`${h.reason} for "${m}" [${u}]`);return}let{FolderPicker:p}=await import("./FolderPicker-6E5GE2K2.js"),{AuthResolver:w}=await import("./resolver-3BGIXYYJ.js"),{render:D}=await import("./build-5ZN47FAT.js"),O=await import("./react-QWOAB3TB.js"),V=new w(g.controllerBaseUrl,async()=>null,{username:h.creds.username,access_key:h.creds.access_key});await V.resolve(),await new Promise(v=>{let{unmount:b}=D(O.default.createElement(p,{resolver:V,projectId:c.project_id,currentFolderId:c.folder_id,env:u,onSelect:(F,G)=>{let B=l.getActiveProfile()??"default",C=l.getDefaultEnv();Tn(l,s,B,C,{folderId:F,folderName:G}),console.log(`Folder set to ${G} (${F})`),b(),v()},onCancel:()=>{b(),v()}}))})}else console.log(`Usage: kane-cli config show|set-target|${[...Br].join("|")}|set-url|reset-url|set-window|set-mode|set-assertion-mode|set-network-ws|set-network-sse|set-bug-detection|set-assertion-failure-mode|set-final-validation|chrome-profile|project|folder`)}),t.command("run").description("Run a browser or mobile objective (inline natural-language string)").argument("[objective]","Test objective (use {{var}} to reference variables); omitted under --analyzer-only").option("--headless","Run Chrome in headless mode").option("--max-steps <n>","Maximum agent steps","50").option("--timeout <seconds>","Kill run after N seconds").option("--url <url>","Start URL for the run").option("--cdp-endpoint <url>","Connect to existing Chrome CDP endpoint").option("--ws-endpoint <url>","Connect via Playwright WebSocket (e.g. LambdaTest wss:// URL)").option("--global-context <file>",`Override global context markdown (default: ${ze(oe,"global-memory.md")})`).option("--local-context <file>","Override local context markdown (default: .testmuai/context.md in cwd)").addOption(new ne("--model <name>","Model override").hideHelp()).option("--variables <json>",`Inline variables JSON, e.g. '{"user": {"value": "alice"}}'`).option("--variables-file <path>","Load variables from a JSON file").option("--dataset-id <id>","Test Manager dataset whose row supplies the ${column} parameters").option("--dataset-version <id>","The dataset version the row belongs to (row ids are re-minted on every dataset edit); omitted reads the dataset's latest version").option("--dataset-row <_id>","The row to use, by its _id as Test Manager shows it (required with a dataset; a missing or unknown id lists the rows)").option("--session-context <json>","Session context JSON (prior runs)").addOption(new ne("--cft","Use Playwright Chromium instead of managed Chrome").hideHelp()).option("--username <user>","Basic auth username (skip OAuth)").option("--access-key <key>","Basic auth access key (skip OAuth)").option("--env <name>","Environment (prod or stage)").option("--mode <name>","Run mode: 'action' (strict \u2014 hard-stop on auth/blocked/error) or 'testing' (lenient \u2014 fall through), or 'agent' (same as --agent). Overrides config; default: testing.").option("--assertion-mode <mode>","Assertion mode: 'dom' (default \u2014 DOM-based extraction & assertions, vision fallback) or 'visual' (vision model only). Overrides config.").option("--final-validation <on|off>","Final validation: append the system cp_final checkpoint verifying the objective as a whole. Overrides config (default: off).").option("--agent","Agent mode: plain NDJSON output, no colors/UI").option("--task-skills","Enable domain-specific task skills (experimental)").option("--network-ws","Capture WebSocket frames for assertions/extraction (experimental)").option("--network-sse","Capture Server-Sent Events messages (Chromium-only) for assertions/extraction (experimental)").option("--bug-detection <mode>","Detect product bugs while authoring: off|stop|continue (stop halts the run on a confirmed bug; continue records it and keeps going). Overrides `config set-bug-detection`.",o=>{if(o!=="off"&&o!=="stop"&&o!=="continue")throw new Error("--bug-detection must be off, stop or continue");return o}).option("--assertion-failure-mode <mode>","What a failed assertion does while authoring: stop|continue (stop ends the run at the failed checkpoint; continue marks it failed and keeps going \u2014 a failed final verification still ends the run). Authoring only; replay always stops. Overrides `config set-assertion-failure-mode`.",o=>{if(o!=="stop"&&o!=="continue")throw new Error(`--assertion-failure-mode must be stop or continue, got: ${o}`);return o}).addOption(new ne("--local","Skip TMS integration (no uploads, no variables/secrets push)").hideHelp()).option("--allow-missing-url","Non-TTY only: proceed from the browser's current page instead of failing when no start URL resolves (a provided --url is still used)").option("--analyzer-only","Judge each --condition against the current page and report verdicts on run_end. No objective, no actions, nothing saved. Agent mode only").option("--condition <text>","A condition to judge under --analyzer-only (repeatable; order is preserved in condition_results)",(o,r)=>[...r,o],[]).option("--code-export","Generate code export after upload").option("--code-language <lang>","Code export language: python (default) | javascript").option("--name <name>","Persist the session under this name (validated [a-zA-Z0-9_-]+)").option("--chrome-profile <path>","Chrome user-data-dir for this run (overrides stored config)").option("--target <name>",`Where to run: ${Ao.join(" | ")} (default: the saved session target)`).option("--device-name <name>","Which device, when the target is mobile: the name as `kane-cli devices list` shows it. On an emulator/simulator it needs --os-version; on a real device either half alone is enough").option("--os-version <version>","The device's OS version (e.g. 17.5, 14). Alone = any device on that version").option("--app <path|AppId>","App under test, when the target is mobile: a build (.apk / .zip / .aab / .ipa, by target) or an APP\u2026 id from your uploads").option("--no-stream","On a real device: do not show its live view (default: its own window at a terminal; never for an agent)").option("--tunnel",on.tunnel).option("--tunnel-name <name>",on.tunnelName).addOption(new ne("--appium-url <url>","Appium server URL override (default: runner-managed local server)").hideHelp()).addOption(new ne("--appium-session-id <id>","Attach to an existing Appium session on --appium-url instead of provisioning a device (needs --target android|ios)").hideHelp()).option("--skip-code-validation","Skip post-codegen worker-side validation").option("--no-skip-code-validation","Force post-codegen worker-side validation (web only)").addHelpText("after",`
4196
+ `),t.on("command:*",o=>{t.error(`error: unknown command '${o[0]}'`,{exitCode:2,code:"commander.unknownCommand"})}),t.command("login").description("Authenticate (interactive; --oauth opens the browser, or --username/--access-key for basic auth)").option("--oauth","Login via OAuth (opens browser)").option("--username <user>","Basic auth username").option("--access-key <key>","Basic auth access key").addOption(new ne("--env <name>","Environment (prod or stage)").default("prod").hideHelp()).option("--profile <name>","Profile name","default").option("--project-id <id>","Project ID (skip picker)").option("--folder-id <id>","Folder ID (skip picker)").addOption(new ne("--model <name>","Model").default("v16-alpha").hideHelp()).option("--chrome-profile <path>","Chrome profile path").action(async o=>{let r=new Ae,a=new xe,s=o.env,l=o.profile;if(!process.stdin.isTTY||o.oauth||o.username){if(r.setDefaultEnv(s),o.oauth)await new Us(l,s,r).login(),console.log(`Logged in as ${l} [${s}] via OAuth`);else if(o.username&&o.accessKey){try{let{validateBasicAuth:w}=await import("./validate-basic-HWDR665U.js");await w(s,o.username,o.accessKey)}catch{console.error("Credentials not valid. Please use valid credentials."),M(1,"Invalid basic-auth credentials");return}r.saveBasicAuth(l,s,{username:o.username,access_key:o.accessKey}),console.log(`Logged in as ${l} [${s}] via basic auth`)}else console.error("Provide --oauth, or --username and --access-key"),M(1,"Missing --oauth or credentials for login");r.setActiveProfile(l),a.set("model",o.model),o.chromeProfile&&a.set("chrome_profile_path",o.chromeProfile);let p=null;if(o.username&&o.accessKey)p={username:o.username,access_key:o.accessKey};else try{let D=await $e({creds:r,env:s,log:()=>{}});D.resolvedCreds&&(p={username:D.resolvedCreds.username,access_key:D.resolvedCreds.access_key})}catch{}if(o.projectId&&(Tn(r,a,l,s,{projectId:o.projectId}),console.log(`Project set to ${o.projectId}`)),o.folderId&&(Tn(r,a,l,s,{folderId:o.folderId}),console.log(`Folder set to ${o.folderId}`)),p&&(!o.projectId||!o.folderId))try{let w=await Fs({creds:r,config:a,profile:l,env:s,tmsCreds:p,log:()=>{}});o.projectId||console.log(`Auto-selected project: ${w.projectName} (${w.projectId})`),o.folderId||console.log(`Auto-selected folder: ${w.folderName} (${w.folderId})`)}catch(w){console.warn(`Could not auto-select project/folder: ${w instanceof Error?w.message:w}`)}Xt(r,a,l,s),console.log("Setup complete."),M(0,"Setup complete")}let{SingleShotApp:d}=await import("./SingleShotApp-MN5IE6EU.js"),{ScrollbackProvider:c}=await import("./scrollback-GGNBDFQV.js"),{render:u}=await import("./build-5ZN47FAT.js"),g=await import("./react-QWOAB3TB.js"),m={current:null},f={current:!1},{waitUntilExit:A,unmount:h}=u(g.default.createElement(c,null,g.default.createElement(d,{resultRef:m,mode:"login",loginCompleteRef:f})),{exitOnCtrlC:!1});dt(()=>h()),await A();try{process.stdin.setRawMode?.(!1)}catch{}process.stdout.write("\x1B[?25h"),f.current&&console.log("Login setup complete."),process.exit(0)}),t.command("logout").description("Revoke tokens and delete the stored profile credentials").action(async()=>{let o=new Ae,r=o.getActiveProfile();if(!r){console.log("No active profile to logout");return}let a=o.getDefaultEnv(),s=await js(o,r,a);process.once("exit",()=>Ps(s.env));let l=new xe;s.switchedTo?(Xt(o,l,s.switchedTo.profile,s.switchedTo.env),console.log(`Logged out ${s.profile} [${s.env}]. Switched to ${s.switchedTo.profile} [${s.switchedTo.env}]`)):(l.save({project_id:null,project_name:null,folder_id:null,folder_name:null}),console.log(`Logged out ${s.profile} [${s.env}]. No profiles remaining.`))}),t.command("whoami").description("Show the authenticated identity, active profile, and environment").option("--profile <name>","Profile name").action(async o=>{let r=new Ae,a=o.profile??r.getActiveProfile()??"default",s=r.getDefaultEnv(),l=r.loadCredentials(a,s),d=r.loadBasicAuth(a,s),c="none",u=d?.username,g,m,f;if(d?c="basic":l&&(c="oauth"),c==="none")g="missing";else try{let D=await $e({creds:r,env:s,log:()=>{}});if(D.resolvedCreds)m="verified",g="valid",u=D.resolvedCreds.username??u;else{let{classifyAuthFailure:O}=await import("./resolver-LWXOB7PH.js");O(D.resolver.lastError)==="auth"?(m="rejected",g="expired",f="Credentials rejected by the server \u2014 re-login or rotate your access key"):(m="unreachable",f=D.resolver.lastError?.message)}}catch(D){let O=D;O.code==="refresh_failed"?(m="rejected",g="expired",f="OAuth token refresh failed \u2014 run 'kane-cli login'"):O.code==="not_authenticated"?(c="none",g="missing"):(m="unreachable",f=O.message)}let{WhoamiView:A}=await import("./WhoamiView-G6QP4SID.js"),{render:h}=await import("./build-5ZN47FAT.js"),p=await import("./react-QWOAB3TB.js"),{waitUntilExit:w}=h(p.default.createElement(A,{profile:a,env:s,authenticated:m==="verified",authMethod:c,username:u,tokenStatus:g,serverStatus:m,detail:f}));await w(),c==="none"?M(1,"whoami: not-authenticated"):m&&m!=="verified"&&M(m==="unreachable"?3:1,`whoami: ${m}`)}),t.command("config <action> [value]").description("Show or change settings ("+["show","set-target",...Br,"set-mode","set-assertion-mode","set-network-ws","set-network-sse","set-bug-detection","set-assertion-failure-mode","set-final-validation","set-url","reset-url","set-window","chrome-profile","project","folder","reset"].join(", ")+")").option("--agent","Print `show` as JSON (on by itself with no terminal)").action(async(o,r,a)=>{let s=new xe,l=new Ae,d=Dd(o,{hostSupportsMobile:n,mobileMessage:Yt(),target:ln(s.load().mobile)});if(d){process.stderr.write(d.message),M(d.exitCode,`config ${o} unavailable off a mobile host`);return}if(o==="show"){let c=s.load(),u=l.getActiveProfile()??"default",g=l.getDefaultEnv(),m=l.loadProfileConfig(u,g)??{},f=m.project_id??c.project_id??null,A=m.project_name??c.project_name??null,h=m.folder_id??c.folder_id??null,p=m.folder_name??c.folder_name??null,w=l.loadBasicAuth(u,g),D=l.loadCredentials(u,g),O=w?`basic (${w.username})`:D?"oauth":"not configured",{resolveSessionTarget:V}=await import("./session-target-DD53UXO7.js"),{CHOOSE_MOBILE_KIND_FIX:v}=await import("./resolve-run-intent-QCRZPYXM.js"),{deviceRefName:b,deviceRefOsVersion:F}=await import("./device-ref-LAZWPRQN.js"),G=V(c.mobile?.tui_target,c.mobile?.default_target?.kind),B=G.kind==="unset"?"desktop":G.kind==="choose-mobile"?`mobile (legacy \u2014 run \`${v}\`)`:G.kind;if(!!a?.agent||!process.stdin.isTTY||!process.stdout.isTTY){let ge=he(g);process.stdout.write(`${JSON.stringify({profile:u,env:g,auth:O,project_id:f,project_name:A,folder_id:h,folder_name:p,model:c.model,mode:c.mode,assertion_mode:c.assertion_mode,network_ws:c.network_ws,network_sse:c.network_sse,bug_detection:c.bug_detection,assertion_failure_mode:c.assertion_failure_mode,final_validation:c.final_validation,window_size:`${c.window_size.width}x${c.window_size.height}`,chrome_profile:c.chrome_profile_path,default_url:c.default_url??co,target:B,device_name:b(c.mobile?.default_target),os_version:F(c.mobile?.default_target),app:c.mobile?.default_app??null,...Object.fromEntries(gt.map(y=>[y.key,ho(c.mobile,y.target)])),device_stream:c.mobile?.device_stream!==!1,controller_base_url:ge.controllerBaseUrl,tms_base_url:ge.tmsBaseUrl})}
4197
+ `),M(0,"config show complete");return}let{ConfigView:Q}=await import("./ConfigView-7A5JTKLF.js"),{render:X}=await import("./build-5ZN47FAT.js"),Y=await import("./react-QWOAB3TB.js"),{waitUntilExit:we}=X(Y.default.createElement(Q,{model:c.model,authLabel:O,profile:u,env:g,defaultUrl:c.default_url??co,projectId:f,projectName:A,folderId:h,folderName:p,windowSize:`${c.window_size.width}x${c.window_size.height}`,chromeProfile:c.chrome_profile_path,target:B,deviceName:b(c.mobile?.default_target),osVersion:F(c.mobile?.default_target),appLabel:c.mobile?.default_app??null,deviceSettings:(()=>{let ge=ln(c.mobile);return ge?[{label:Cs(ge).label,value:ho(c.mobile,ge)?"on":"off"}]:[]})()}));await we()}else if(o==="set-window"&&r){let c=r.split("x").map(Number),[u,g]=c;!u||!g||!Number.isInteger(u)||!Number.isInteger(g)?console.error("Invalid format. Use: kane-cli config set-window WIDTHxHEIGHT"):u<800||u>3840?console.error(`Width must be between 800 and 3840 (got ${u})`):g<600||g>2160?console.error(`Height must be between 600 and 2160 (got ${g})`):(s.set("window_size",{width:u,height:g}),console.log(`Window size set to ${u}x${g}`))}else if(o==="set-mode"){if(r!=="action"&&r!=="testing"){console.error("Mode must be 'action' or 'testing'."),M(1,"Invalid mode");return}s.set("mode",r),console.log(`Mode set to ${r}`)}else if(o==="set-assertion-mode"){if(r!=="visual"&&r!=="dom"){console.error("Assertion mode must be 'visual' or 'dom'."),M(1,"Invalid assertion-mode");return}s.set("assertion_mode",r),console.log(`Assertion mode set to ${r}`)}else if(o==="set-network-ws"){if(r!=="on"&&r!=="off"){console.error("WebSocket capture must be 'on' or 'off'."),M(1,"Invalid network-ws value");return}s.set("network_ws",r==="on"),console.log(`WebSocket capture set to ${r}`)}else if(o==="set-network-sse"){if(r!=="on"&&r!=="off"){console.error("SSE capture must be 'on' or 'off'."),M(1,"Invalid network-sse value");return}s.set("network_sse",r==="on"),console.log(`SSE capture set to ${r}`)}else if(o==="set-bug-detection"){if(r!=="off"&&r!=="stop"&&r!=="continue"){console.error("Bug detection must be 'off', 'stop' or 'continue'."),M(1,"Invalid bug-detection value");return}s.set("bug_detection",r),console.log(`Bug detection set to ${r}`)}else if(o==="set-assertion-failure-mode"){if(r!=="stop"&&r!=="continue"){console.error("Assertion failure mode must be 'stop' or 'continue'."),M(1,"Invalid assertion-failure-mode value");return}s.set("assertion_failure_mode",r),console.log(`Assertion failure mode set to ${r}`)}else if(o==="set-final-validation"){if(r!=="on"&&r!=="off"){console.error("Final validation must be 'on' or 'off'."),M(1,"Invalid final-validation value");return}s.set("final_validation",r==="on"),console.log(`Final validation set to ${r}`)}else if(o==="set-target"){if(!Ki(r)){console.error(`Target must be one of ${Ao.join(", ")}.`),M(1,"Invalid target");return}if(Ft(r)){let{mobileHostSupport:u}=await import("./host-7GZPBA74.js"),g=u();if(!g.supported){console.error(g.reason),M(1,"unsupported host for mobile target");return}}let c=ln(s.load().mobile);s.setMobile(c===r?{tui_target:r}:{tui_target:r,default_target:void 0,default_app:void 0}),console.log(`Target set to ${r}`)}else if(o==="set-device-name"||o==="set-os-version"){let c=o==="set-device-name"?"device name":"OS version",u=o==="set-device-name"?"set-os-version":"set-device-name";if(!r){console.error(o==="set-device-name"?'Usage: kane-cli config set-device-name "<name>"':"Usage: kane-cli config set-os-version <version>"),M(1,`Missing ${c}`);return}let g=s.load().mobile,m=ln(g);if(!m){console.error(wi(n)),M(1,`no mobile target for ${o}`);return}if(po(m)){let B=o==="set-device-name"?{name:r.trim()}:{os_version:r.trim()},C=g?.default_target?.kind===m?g.default_target:void 0,Q={platform:rn(m),kind:m,...C?.name?{name:C.name}:{},...C?.os_version?{os_version:C.os_version}:{},...B},{checkRealDevice:X}=await import("./catalog-P5IOIVYP.js"),Y=await X(l.getDefaultEnv(),m,{...Q.name?{deviceName:Q.name}:{},...Q.os_version?{osVersion:Q.os_version}:{}});if(Y.kind==="refused"){console.error(Y.detail),M(1,"real device not available");return}Y.kind==="unchecked"&&console.error(`warning: ${Y.reason} \u2014 the device is not checked.`),s.setMobile({default_target:Q}),console.log(`${c[0].toUpperCase()}${c.slice(1)} set to ${r.trim()} (${Xi(m)})`);return}let f=g?.default_target?.kind===m?g.default_target:void 0,A=o==="set-device-name"?r.trim():f?.name?.trim()??"",h=o==="set-os-version"?r.trim():f?.os_version?.trim()??"";if(!A||!h){s.setMobile({default_target:{platform:rn(m),kind:m,...A?{name:A}:{},...h?{os_version:h}:{}}}),console.log(`${c[0].toUpperCase()}${c.slice(1)} saved. Complete the pair: kane-cli config ${u} "<value>" \u2014 see kane-cli devices list --target ${m}`);return}let{resolveTarget:p}=await import("./registry-3YMKU5GC.js"),w;try{w=await p({device:{name:A,osVersion:h},platform:rn(m),interactive:!1})}catch(B){console.error(B instanceof Error?B.message:String(B)),console.error(`Run \`kane-cli doctor --target ${m}\` to check the mobile toolchain.`),M(1,"device discovery failed");return}if(!w.ok){console.error(w.message),M(1,"device not found");return}let D=w.target;if(D.kind!==m){console.error(`${D.displayName} is a ${D.kind}, but the session target is ${m}.`),M(1,"device kind mismatch");return}let{toAppSpec:O}=await import("./prepare-target-G7LU4LYX.js"),{appSuitsTarget:V}=await import("./resolve-run-intent-QCRZPYXM.js"),v=g?.default_app,b=v?O(v):null,F=!!v&&(!b||!V(b,m)),{deviceRefOf:G}=await import("./device-ref-LAZWPRQN.js");s.setMobile({default_target:G(D),...F?{default_app:void 0}:{}}),console.log(`Device set to ${A} (${D.osVersion??h}) \u2014 ${D.platform} \xB7 ${D.kind}`),F&&console.log(`Saved app ${v} does not suit a ${m} \u2014 cleared. Set one: kane-cli config set-app`)}else if(o==="set-app"){if(!r){console.error("Usage: kane-cli config set-app </path/to/build | AppId>"),M(1,"Missing app");return}let c=s.load().mobile,u=ln(c);if(!u){console.error(wi(n)),M(1,"no mobile target for set-app");return}if(!po(u)&&c?.default_target?.kind!==u){console.error('Set a device first: kane-cli config set-device-name "<name>" && kane-cli config set-os-version "<version>"'),M(1,"no device for set-app");return}let{toAppSpec:g}=await import("./prepare-target-G7LU4LYX.js"),{appProblemFor:m}=await import("./resolve-run-intent-QCRZPYXM.js"),f=m(u,r,r);if(f){console.error(f),M(1,"app does not suit target");return}let A=g(r);if(A.kind!=="app_id"){let{access:h}=await import("fs/promises");if(!await h(A.value).then(()=>!0,()=>!1)){console.error(`${A.value} is not there.`),M(1,"app build missing");return}}s.setMobile({default_app:A.value}),console.log(`App set to ${A.value}`)}else if(gt.some(c=>c.command===o)){let c=o;if(r!=="on"&&r!=="off"){console.error(`Usage: kane-cli config ${o} on|off`),M(1,`Invalid ${o} value`);return}let u=ln(s.load().mobile);if(!u){console.error(wi(n)),M(1,`no mobile target for ${o}`);return}let g=gt.find(m=>m.command===c&&m.target===u);if(!g){let m=gt.filter(A=>A.command===c),f=m.map(A=>A.target);console.error(`${Is(m[0])} applies to ${f.join(" and ")} sessions only \u2014 your target is ${u}. Switch with: kane-cli config set-target ${f.join("|")}`),M(1,`${o} does not apply to ${u}`);return}s.setMobile({[g.key]:r==="on"}),console.log(`${Ms(g)} set to ${r}`)}else if(o==="set-device-stream"){if(r!=="on"&&r!=="off"){console.error("Usage: kane-cli config set-device-stream on|off"),M(1,"Invalid set-device-stream value");return}s.setMobile({device_stream:r==="on"}),console.log(`Real-device live view set to ${r}`)}else if(o==="set-url"){if(!r){console.error("Usage: kane-cli config set-url <url>"),M(1,"Missing URL");return}let c=Ua(r);if(!c){console.error(`Invalid URL: ${r}`),M(1,"Invalid URL");return}s.set("default_url",c),console.log(`Default URL set to ${c}`)}else if(o==="reset-url")s.set("default_url",Ga),console.log("Default URL reset \u2014 runs take the URL from --url, the test, or the objective");else if(o==="chrome-profile"){if(r||!process.stdin.isTTY){r||(console.error("Usage: kane-cli config chrome-profile <path>"),M(1,"Missing chrome-profile path")),s.set("chrome_profile_path",r),console.log(`Chrome profile set to ${r}`);return}let{ChromeProfilePicker:c}=await import("./ChromeProfilePicker-ROQIRMWR.js"),{render:u}=await import("./build-5ZN47FAT.js"),g=await import("./react-QWOAB3TB.js");await new Promise(m=>{let{unmount:f}=u(g.default.createElement(c,{currentPath:s.load().chrome_profile_path,onSelect:A=>{s.set("chrome_profile_path",A),console.log(`Chrome profile set to ${A}`),f(),m()},onCancel:()=>{f(),m()}}))})}else if(o==="project"){if(r||!process.stdin.isTTY){r||(console.error("Usage: kane-cli config project <project-id>"),M(1,"Missing project ID"));let V=l.getActiveProfile()??"default",v=l.getDefaultEnv();Tn(l,s,V,v,{projectId:r}),console.log(`Project set to ${r}`);return}let c=l.getDefaultEnv(),u=he(c),g=l.getActiveProfile()??"default",{resolveTmsBasicAuth:m,formatAuthResolutionError:f}=await import("./list-commands-QFTIQE6Q.js"),A=await m(g,c,{});if(!A.ok){let{message:V}=f(g,c,A);process.stderr.write(V),M(2,`${A.reason} for "${g}" [${c}]`);return}let{ProjectPicker:h}=await import("./ProjectPicker-A5SXNDUL.js"),{AuthResolver:p}=await import("./resolver-LWXOB7PH.js"),{render:w}=await import("./build-5ZN47FAT.js"),D=await import("./react-QWOAB3TB.js"),O=new p(u.controllerBaseUrl,async()=>null,{username:A.creds.username,access_key:A.creds.access_key});await O.resolve(),await new Promise(V=>{let{unmount:v}=w(D.default.createElement(h,{resolver:O,currentProjectId:s.load().project_id,env:c,onSelect:(b,F)=>{let G=l.getActiveProfile()??"default",B=l.getDefaultEnv();Tn(l,s,G,B,{projectId:b,projectName:F}),console.log(`Project set to ${F} (${b})`),v(),V()},onCancel:()=>{v(),V()}}))})}else if(o==="folder"){if(r||!process.stdin.isTTY){if(r||(console.error("Usage: kane-cli config folder <folder-id>"),M(1,"Missing folder ID")),!s.load().project_id){console.log("Select a project first: kane-cli config project <id>");return}let b=l.getActiveProfile()??"default",F=l.getDefaultEnv();Tn(l,s,b,F,{folderId:r}),console.log(`Folder set to ${r}`);return}let c=s.load();if(!c.project_id){console.log("Select a project first: kane-cli config project");return}let u=l.getDefaultEnv(),g=he(u),m=l.getActiveProfile()??"default",{resolveTmsBasicAuth:f,formatAuthResolutionError:A}=await import("./list-commands-QFTIQE6Q.js"),h=await f(m,u,{});if(!h.ok){let{message:v}=A(m,u,h);process.stderr.write(v),M(2,`${h.reason} for "${m}" [${u}]`);return}let{FolderPicker:p}=await import("./FolderPicker-R4QDIFTW.js"),{AuthResolver:w}=await import("./resolver-LWXOB7PH.js"),{render:D}=await import("./build-5ZN47FAT.js"),O=await import("./react-QWOAB3TB.js"),V=new w(g.controllerBaseUrl,async()=>null,{username:h.creds.username,access_key:h.creds.access_key});await V.resolve(),await new Promise(v=>{let{unmount:b}=D(O.default.createElement(p,{resolver:V,projectId:c.project_id,currentFolderId:c.folder_id,env:u,onSelect:(F,G)=>{let B=l.getActiveProfile()??"default",C=l.getDefaultEnv();Tn(l,s,B,C,{folderId:F,folderName:G}),console.log(`Folder set to ${G} (${F})`),b(),v()},onCancel:()=>{b(),v()}}))})}else console.log(`Usage: kane-cli config show|set-target|${[...Br].join("|")}|set-url|reset-url|set-window|set-mode|set-assertion-mode|set-network-ws|set-network-sse|set-bug-detection|set-assertion-failure-mode|set-final-validation|chrome-profile|project|folder`)}),t.command("run").description("Run a browser or mobile objective (inline natural-language string)").argument("[objective]","Test objective (use {{var}} to reference variables); omitted under --analyzer-only").option("--headless","Run Chrome in headless mode").option("--max-steps <n>","Maximum agent steps","50").option("--timeout <seconds>","Kill run after N seconds").option("--url <url>","Start URL for the run").option("--cdp-endpoint <url>","Connect to existing Chrome CDP endpoint").option("--ws-endpoint <url>","Connect via Playwright WebSocket (e.g. LambdaTest wss:// URL)").option("--global-context <file>",`Override global context markdown (default: ${ze(oe,"global-memory.md")})`).option("--local-context <file>","Override local context markdown (default: .testmuai/context.md in cwd)").addOption(new ne("--model <name>","Model override").hideHelp()).option("--variables <json>",`Inline variables JSON, e.g. '{"user": {"value": "alice"}}'`).option("--variables-file <path>","Load variables from a JSON file").option("--dataset-id <id>","Test Manager dataset whose row supplies the ${column} parameters").option("--dataset-version <id>","The dataset version the row belongs to (row ids are re-minted on every dataset edit); omitted reads the dataset's latest version").option("--dataset-row <_id>","The row to use, by its _id as Test Manager shows it (required with a dataset; a missing or unknown id lists the rows)").option("--session-context <json>","Session context JSON (prior runs)").addOption(new ne("--cft","Use Playwright Chromium instead of managed Chrome").hideHelp()).option("--username <user>","Basic auth username (skip OAuth)").option("--access-key <key>","Basic auth access key (skip OAuth)").option("--env <name>","Environment (prod or stage)").option("--mode <name>","Run mode: 'action' (strict \u2014 hard-stop on auth/blocked/error) or 'testing' (lenient \u2014 fall through), or 'agent' (same as --agent). Overrides config; default: testing.").option("--assertion-mode <mode>","Assertion mode: 'dom' (default \u2014 DOM-based extraction & assertions, vision fallback) or 'visual' (vision model only). Overrides config.").option("--final-validation <on|off>","Final validation: append the system cp_final checkpoint verifying the objective as a whole. Overrides config (default: off).").option("--agent","Agent mode: plain NDJSON output, no colors/UI").option("--task-skills","Enable domain-specific task skills (experimental)").option("--network-ws","Capture WebSocket frames for assertions/extraction (experimental)").option("--network-sse","Capture Server-Sent Events messages (Chromium-only) for assertions/extraction (experimental)").option("--bug-detection <mode>","Detect product bugs while authoring: off|stop|continue (stop halts the run on a confirmed bug; continue records it and keeps going). Overrides `config set-bug-detection`.",o=>{if(o!=="off"&&o!=="stop"&&o!=="continue")throw new Error("--bug-detection must be off, stop or continue");return o}).option("--assertion-failure-mode <mode>","What a failed assertion does while authoring: stop|continue (stop ends the run at the failed checkpoint; continue marks it failed and keeps going \u2014 a failed final verification still ends the run). Authoring only; replay always stops. Overrides `config set-assertion-failure-mode`.",o=>{if(o!=="stop"&&o!=="continue")throw new Error(`--assertion-failure-mode must be stop or continue, got: ${o}`);return o}).addOption(new ne("--local","Skip TMS integration (no uploads, no variables/secrets push)").hideHelp()).option("--allow-missing-url","Non-TTY only: proceed from the browser's current page instead of failing when no start URL resolves (a provided --url is still used)").option("--analyzer-only","Judge each --condition against the current page and report verdicts on run_end. No objective, no actions, nothing saved. Agent mode only").option("--condition <text>","A condition to judge under --analyzer-only (repeatable; order is preserved in condition_results)",(o,r)=>[...r,o],[]).option("--code-export","Generate code export after upload").option("--code-language <lang>","Code export language: python (default) | javascript").option("--name <name>","Persist the session under this name (validated [a-zA-Z0-9_-]+)").option("--chrome-profile <path>","Chrome user-data-dir for this run (overrides stored config)").option("--target <name>",`Where to run: ${Ao.join(" | ")} (default: the saved session target)`).option("--device-name <name>","Which device, when the target is mobile: the name as `kane-cli devices list` shows it. On an emulator/simulator it needs --os-version; on a real device either half alone is enough").option("--os-version <version>","The device's OS version (e.g. 17.5, 14). Alone = any device on that version").option("--app <path|AppId>","App under test, when the target is mobile: a build (.apk / .zip / .aab / .ipa, by target) or an APP\u2026 id from your uploads").option("--no-stream","On a real device: do not show its live view (default: its own window at a terminal; never for an agent)").option("--tunnel",on.tunnel).option("--tunnel-name <name>",on.tunnelName).addOption(new ne("--appium-url <url>","Appium server URL override (default: runner-managed local server)").hideHelp()).addOption(new ne("--appium-session-id <id>","Attach to an existing Appium session on --appium-url instead of provisioning a device (needs --target android|ios)").hideHelp()).option("--skip-code-validation","Skip post-codegen worker-side validation").option("--no-skip-code-validation","Force post-codegen worker-side validation (web only)").addHelpText("after",`
4198
4198
  Variables:
4199
4199
  Variables are loaded in order (later wins):
4200
4200
  1. Global: ${ze(oe,"variables")}/*.json
@@ -4221,24 +4221,24 @@ Context Files:
4221
4221
  `),process.exit(2);return}{let E=Lt(r);if("error"in E){process.stderr.write(`error: ${E.error}
4222
4222
  `),process.exit(2);return}}let a=!!r.analyzerOnly,s=r.condition??[];{let E=ld({analyzerOnly:a,objective:o,conditions:s,agent:!!r.agent,isTTY:!!process.stdin.isTTY,codeExport:r.codeExport,name:r.name,target:r.target,app:r.app,deviceName:r.deviceName,osVersion:r.osVersion});if(E){process.stderr.write(`error: ${E}
4223
4223
  `),process.exit(2);return}}if(a){let E=gd(r);E.length&&process.stderr.write(`info: --analyzer-only ignores ${E.join(", ")}
4224
- `),Object.assign(r,ud()),o=Ad(s)}o=o??"",(r.agent||!process.stdin.isTTY)&&mr("run");{let{objectiveVariableGate:E}=await import("./objective-variable-gate-V5HHFOUS.js"),{formatUnresolvedReceipt:R,unresolvedVariablesEvent:x}=await import("./variable-receipt-7PRKDTRJ.js"),P=E({objective:o,cwd:process.cwd(),globalDir:ze(oe,"variables"),opts:{variables:r.variables,variablesFile:r.variablesFile,sessionContext:r.sessionContext}});P.length>0&&(!!r.agent||!process.stdin.isTTY?en(x(P,{cwd:process.cwd()})):process.stderr.write(R(P,{cwd:process.cwd()})))}let l=new Ae,d=new xe,c=d.load();r.chromeProfile&&(c.chrome_profile_path=r.chromeProfile);let u;if(r.mode===void 0)u=c.mode==="action"?"action":"testing";else if(r.mode==="action"||r.mode==="testing")u=r.mode;else{console.error("Invalid --mode. Must be 'action' or 'testing'."),M(2,"Invalid --mode");return}let g;if(r.assertionMode===void 0)g=c.assertion_mode==="dom"?"dom":"visual";else if(r.assertionMode==="visual"||r.assertionMode==="dom")g=r.assertionMode;else{console.error("Invalid --assertion-mode. Must be 'visual' or 'dom'."),M(2,"Invalid --assertion-mode");return}let m;if(r.finalValidation!==void 0){if(r.finalValidation!=="on"&&r.finalValidation!=="off"){console.error("Invalid --final-validation. Must be 'on' or 'off'."),M(2,"Invalid --final-validation");return}m=r.finalValidation==="on"}let f=new vn;Ar()?.attachSessionDir(f.sessionDir);let{printRecordingBanner:A}=await import("./recording-banner-EPOTSMYF.js");await A({isAgent:!!r.agent||!process.stdin.isTTY,sessionId:f.sessionId,sessionName:r.name??null,testPath:r.name?ze(process.cwd(),".testmuai","tests",`${r.name}_test.md`):null,outputPath:r.name?ze(process.cwd(),".testmuai","tests",`output-${r.name}`):null});let h=!!(r.username&&r.accessKey);if(await Ha({isInteractive:!!process.stdin.isTTY&&!r.agent&&!h,creds:l,config:d}),!h){let E=l.getActiveProfile(),R=l.getDefaultEnv();E&&(l.loadBasicAuth(E,R)||l.loadCredentials(E,R))||(console.error("Not authenticated. Run: kane-cli login --oauth, or kane-cli login --username <user> --access-key <key>"),Jn("AUTH_NOT_AUTHENTICATED"),M(1,"Not authenticated"))}let p=`${l.getActiveProfile()??"no profile"}/${l.getDefaultEnv()}`,w=[],D=r.env??l.getDefaultEnv(),O=null,V=[],v=(E,R,x,P)=>{O?O(E,R,x,P):V.push([E,R,x,P])},b;try{b=await $e({creds:l,env:D,usernameFlag:r.username,accessKeyFlag:r.accessKey,log:v})}catch(E){throw E instanceof ht&&(console.error(E.code==="not_authenticated"?"Not authenticated. Run: kane-cli login":"Token refresh failed. Run: kane-cli login"),Jn(E.code==="not_authenticated"?"AUTH_NOT_AUTHENTICATED":"AUTH_REFRESH_FAILED"),M(2,E.code==="not_authenticated"?"Not authenticated":"Token refresh failed")),E}let F=!!b.basicAuth,G=b.basicAuth?.username,B=b.basicAuth?.access_key,C=b.token,Q=b.resolver,X=b.resolvedCreds;b.basicAuth&&w.push(`Auth: ${b.basicAuth.username}`);let Y=null;{let E=null;try{E=ks({datasetId:r.datasetId,datasetVersion:r.datasetVersion,datasetRow:r.datasetRow},void 0)}catch(R){console.error(`error: ${R.message}`),M(2,R.message)}if(E){b.basicAuth||(console.error("error: --dataset-id needs Test Manager credentials \u2014 run 'kane-cli login' or pass --username/--access-key"),M(2,"dataset needs Test Manager credentials"));try{Y=await pc({selection:E,tmsBaseUrl:he(D).tmsBaseUrl,auth:b.basicAuth,saveDir:f.sessionDir,log:(x,P,z,Te)=>f.log(x,P,z,Te)})}catch(x){console.error(`error: ${x.message}`),M(2,x.message)}let R=Cc([{text:o,usedBy:{file:bc,step:1}}],Y.columns,E.id);R.length>0&&(!!r.agent||!process.stdin.isTTY?en(hr(R,{cwd:process.cwd()})):process.stderr.write(bt(R,{cwd:process.cwd()})))}}let we=l.getActiveProfile()??"default",ge=l.getDefaultEnv();Vs(l,d,we,ge);let y=d.load(),N=b.basicAuth??(b.resolvedCreds?{username:b.resolvedCreds.username,access_key:b.resolvedCreds.access_key}:null);if(N){let E=!!r.agent||!process.stdin.isTTY,R=await _t({creds:l,config:d,profile:we,env:ge,tmsCreds:N,isLocal:!!r.local,log:v});R.status==="cancelled"&&(console.error("error: project/folder configuration failed. See remediation above, or use --local."),M(2,"project/folder gate failed")),R.status==="ok"&&R.autoDefaulted&&E&&en(qt(R.autoDefaulted)),y=d.load()}else r.local||(console.error("Project and folder must be configured. Run `kane-cli login` to set up auth, or pass --username/--access-key, then `kane-cli config project <id>` / `kane-cli config folder <id>`."),M(2,"no TMS credentials for project/folder gate"));let{resolveRunIntent:q,formatRunningOn:H,missingPieceMessage:ee,staleAppMessage:Z,CHOOSE_MOBILE_KIND_MESSAGE:I}=await import("./resolve-run-intent-RBOCIYEA.js"),{mobileHostSupport:U}=await import("./host-7GZPBA74.js"),L=Ba()&&!r.agent,{attachTargetFromFlags:k,formatAttachBanner:Ge}=await import("./attach-target-V6LECVES.js"),ke=k({appiumUrl:r.appiumUrl,appiumSessionId:r.appiumSessionId,target:r.target,deviceName:r.deviceName,osVersion:r.osVersion,app:r.app});if(ke.kind==="invalid"){console.error(`error: ${ke.message}`),M(2,"attach run not fully specified");return}let Re=ke.kind==="attach"?ke.device:null,Ue=q({flags:{target:Re?void 0:r.target,deviceName:r.deviceName,osVersion:r.osVersion,app:r.app},saved:Re?void 0:c.mobile,host:U()});if(Ue.kind==="choose-mobile-kind")if(L){let{promptMobileKind:E}=await import("./mobile-prompts-5TGLJUBV.js"),R=await E();if(!R){M(2,"target selection cancelled");return}d.setMobile({tui_target:R}),Ue=q({flags:{target:R,deviceName:r.deviceName,osVersion:r.osVersion,app:r.app},saved:d.load().mobile,host:U()})}else{console.error(`error: ${I}`),M(2,"ambiguous legacy session target");return}if(Ue.kind==="invalid"){console.error(`error: ${Ue.message}`),M(2,"invalid run target");return}if(Ue.kind==="choose-mobile-kind"){M(2,"ambiguous legacy session target");return}for(let E of Ue.warnings)console.error(`warning: ${E}`);let qe=Ue.kind==="mobile"?Ue:null,_e=Ue.kind==="real-device"?Ue:null;if((qe||_e)&&r.codeLanguage?.toLowerCase()==="javascript"){console.error("error: --code-language javascript is not supported on a mobile target \u2014 mobile code export is Appium + Python only. Drop the flag, or pass --code-language python."),M(2,"javascript code export on a mobile target");return}let nn=qe||_e||Re?"device":"web";try{fr(r,c.code_export,nn==="device")}catch(E){console.error(`error: ${E.message}`),M(2,"invalid code export options");return}if(f.setCompletionMetadata({runType:"run",target:Re?Re.platform==="ios"?"simulator":"emulator":qe?.target??_e?.target??"desktop"}),f.setRunTarget(Wi(Re?Re.platform==="ios"?"simulator":"emulator":qe?.target??_e?.target??"desktop",{wsEndpoint:r.wsEndpoint})),Re?console.error(Ge(Re)):!qe&&!_e&&console.error(H({target:"desktop"})),!a&&!hd({target:r.target,deviceName:r.deviceName,osVersion:r.osVersion,app:r.app,cdpEndpoint:r.cdpEndpoint,wsEndpoint:r.wsEndpoint,cft:r.cft,url:r.url})){let E=nn==="device"?"mobile":"web",R=await Ns({objective:o,sessionTarget:E,controllerBaseUrl:he(D).controllerBaseUrl,authHeader:b.basicAuth?lt(b.basicAuth.username,b.basicAuth.access_key):`Bearer ${b.token}`}),x=Ed(ys(R,E));x&&console.error(x),v("info","CLASSIFY_VERDICT","Objective classified",{session_target:E,target:R?.target??null,confidence:R?.confidence??null,warned:!!x})}let tn=nn==="device"?null:ja({flag:r.url,configDefault:c.default_url}),Qt=nn==="device"?!1:Oa({resolvedUrl:tn,local:r.local,allowMissingUrl:r.allowMissingUrl,isTTY:!!process.stdin.isTTY}),K=mc({objective:o,globalDir:ze(oe,"variables"),localDir:ze(process.cwd(),".testmuai","variables"),file:r.variablesFile,inline:r.variables,parameters:Y?.parameters,onLoadError:E=>console.error(E)}),be;if(r.sessionContext)try{be=JSON.parse(r.sessionContext)}catch{console.error("Invalid --session-context JSON"),M(2,"Invalid --session-context JSON")}let Gn=r.globalContext??ze(oe,"global-memory.md"),Rt=r.localContext??ze(process.cwd(),".testmuai","context.md"),Oe=Qo(Gn),S=Qo(Rt),j={},te=async E=>{let{promptApp:R}=await import("./mobile-prompts-5TGLJUBV.js"),{AppClient:x}=await import("./app-client-2RR5ATI6.js"),P=G&&B?z=>new x(Dn(D),{username:G,accessKey:B}).list({type:E,...z}):void 0;return R({kind:E,...P?{listApps:P}:{}})},_=async E=>{let R=E.app;if(!R){if(!L)throw console.error(`error: ${ee(E.target,"app")}`),M(2,"real-device run missing app"),new Error("real-device run missing app");let z=await te(E.target);if(!z)throw M(2,"app selection cancelled"),new Error("app selection cancelled");R={value:z,source:"saved"},(r.target===void 0||ln(d.load().mobile)===E.target)&&d.setMobile({tui_target:E.target,default_app:z})}let{prepareRealDeviceRun:x,deviceStreamMode:P}=await import("./real-device-run-WAOWKEFJ.js");try{return await x({log:(z,Te,ue,se)=>f.log(z,Te,ue,se),target:E.target,selection:{...E.deviceName?{deviceName:E.deviceName}:{},...E.osVersion?{osVersion:E.osVersion}:{},app:R},env:D,sessionDir:f.sessionDir,auth:b,mobile:c.mobile,testName:r.name??o??"kane-cli run",tunnel:zt(r),write:z=>console.error(z),stream:P({interactive:L,flag:r.stream,mobile:c.mobile})})}catch(z){throw console.error(`error: ${z.message}`),M(2,"real-device preparation failed"),z}},re=await ic(nn,{prepareDevice:async()=>{if(Re)return{device:Re};if(_e)return j.real=await _(_e),{device:j.real.device,...j.real.appId?{appRef:j.real.appId,appId:j.real.appId}:{}};let E=qe,{isAppId:R}=await import("./app-download-ZS6ZMX2Z.js"),{evidenceAppName:x}=await import("./device-env-LZB3PKMA.js"),{access:P}=await import("fs/promises"),z=E.app?.value,Te=!1,ue=!1,se=E.app?.source==="saved"&&!R(E.app.value)?await P(E.app.value).then(()=>!1,()=>!0):!1;if(L){if(E.missing.includes("app")||se){se&&console.error(`${E.app.value} is no longer there \u2014 choose the app under test.`);let W=await te(E.target);if(!W)throw M(2,"app selection cancelled"),new Error("app selection cancelled");z=W,Te=!0}}else{let W=E.missing.map(Qe=>ee(E.target,Qe));if(se&&W.push(Z(E.app.value,E.target)),W.length>0){for(let Qe of W)console.error(`error: ${Qe}`);M(2,"mobile run not fully specified")}}let me,Se=Mr();try{me=await hs({log:(W,Qe,Pe,ct)=>f.log(W,Qe,Pe,ct),device:E.deviceSelector,platform:rn(E.target),app:z,defaults:c.mobile,interactive:L,agent:!!r.agent,appiumUrl:r.appiumUrl,...L?{pickTarget:async W=>{let{promptDevice:Qe}=await import("./mobile-prompts-5TGLJUBV.js"),Pe=W.filter(Je=>Je.kind===E.target),ct=await Qe(Pe.length>0?Pe:W,E.target,c.mobile?.default_target);return ct&&(ue=!0),ct}}:{},...!r.local&&G&&B&&X?.org_id?{cloudUpload:{env:D,orgId:String(X.org_id),userId:String(X.user_id??""),baseUrl:Dn(D),auth:{username:G,accessKey:B}}}:{},onProgress:Se.onProgress})}catch(W){Se.done(),W instanceof fs?(console.error(W.doctorText),console.error(`
4225
- ${W.message}`)):console.error(W instanceof Error?W.message:String(W)),M(2,"mobile target preparation failed")}Se.done(),me.device.app_package||(console.error(`error: ${ee(E.target,"app")}`),M(2,"mobile run missing app binding"));let Ye=E.device?.source==="flag";if(Te||ue||!Ye){let{deviceRefOf:W}=await import("./device-ref-LAZWPRQN.js");d.setMobile({...r.target===void 0?{tui_target:E.target}:{},...Ye?{}:{default_target:W(me.target)},...Te&&z?{default_app:z}:{}})}j.current=me;let J=z??me.appRef??me.device.app_package??"";return j.appLabel=x(J)??"",{device:me.device,...me.appRef?{appRef:me.appRef}:{},...me.appId?{appId:me.appId}:{}}},prepareWeb:async()=>{try{let E=Et()?await rc(b):null;return await oc({config:c,startUrl:tn??void 0,headless:r.headless,cft:r.cft,wsEndpoint:r.wsEndpoint,cdpEndpoint:r.cdpEndpoint,...E?{ltGrid:{name:(o??"kane-cli run").slice(0,200),...E}}:{}})}catch(E){console.error(Qs(E));let R=E instanceof Ss?"Chrome not found at standard paths":`Chrome failed: ${E instanceof Error?E.message:E}`;M(2,R)}}}),ye=re.kind==="web"?re.chrome:{instance:null,tempDir:null};ye.instance&&On("chrome",()=>{ye.instance.kill()});let Be=null,Un=ye.cdpEndpoint??r.cdpEndpoint;if(Un&&!r.cft&&!r.wsEndpoint&&(Be=$s({headless:r.headless,cdpEndpoint:Un,chromePid:ye.instance?.process.pid}),Be&&On("marker-overlay",()=>Be.kill())),re.kind==="device"&&j.current&&qe){let E=H({target:qe.target,deviceLabel:j.current.target.displayName,appLabel:j.appLabel??""});L||console.error(E),w.push(E)}else r.cft?w.push("CfT mode: Playwright will manage its own browser"):r.wsEndpoint?w.push(`Playwright WS endpoint (${r.wsEndpoint.slice(0,60)}...)`):r.cdpEndpoint?w.push(`CDP connected (${r.cdpEndpoint})`):ye.cdpEndpoint&&w.push(`Chrome ready (${ye.cdpEndpoint})`);let T=f;T.start({model:r.model??c.model,environment:D,profile:l.getActiveProfile(),surface:"run",runType:"run"}),!r.local&&b.resolvedCreds?.user_id!==void 0&&T.setCompletionIdentity(Number(b.resolvedCreds.user_id)),r.name&&T.setSessionName(r.name),b.resolvedCreds?.org_id!==void 0&&T.setOrgId(String(b.resolvedCreds.org_id)),b.resolvedCreds?.plan!==void 0&&T.setPlan(b.resolvedCreds.plan??null),T.setUserIdentity(b.resolvedCreds?.username??null,b.resolvedCreds?.email??null),O=(E,R,x,P)=>T.log(E,R,x,P);for(let E of V)T.log(...E);V.length=0;let dn=F&&G&&B?{username:G,accessKey:B}:C??null,Ce=null;if(dn!==null){let E=await wc({env:D,tmsCreds:b.resolvedCreds??null,resolver:b.resolver,auth:dn,getToken:async()=>b.token??null,session:T,log:(R,x,P,z)=>T.log(R,x,P,z),skipScreenshotQueue:r.local,invocationMode:r.agent||!process.stdin.isTTY?"agent":"cli"});Ce=E.screenshotQueue,E.remoteLogger&&(On("remote-logger",()=>E.remoteLogger.shutdownSync()),Oi(E.remoteLogger),ji(Hs()))}let Nt=b.basicAuth&&!r.local?await Ac({variables:K,auth:b.basicAuth,orgId:String(b.resolvedCreds?.org_id??""),env:D,localMode:!!r.local,log:(E,R,x,P)=>T.log(E,R,x,P)}):{};T.setAuteurVariables(K.auteur),T.setFirstRun(K.auteurObjective,tn??"");let{startInlineEvidence:$,noteInlineSpawn:yt,inlineEvidenceBlock:$r,finalizeInlineEvidence:eo,createCdpBrowserCapture:Pu,writeAuteurDataset:Hu}=await import("./evidence-SRWISQMQ.js"),no=Pu(ye.cdpEndpoint),de=a?null:await $({objectiveOrName:r.name??o,sessionId:T.sessionId,title:r.name??o,producerVersion:De,pid:process.pid,surfaces:tn?[tn]:void 0,packRootDir:ze(T.sessionDir,"evidence")}),kt=async(E={})=>(T.flushRecorder(),de&&Y&&Hu(de.packTestDir,Y.evidenceRecord,(R,x,P,z)=>T.log(R,x,P,z)),await eo(de,{saved:!!T.sessionName,local:!!r.local,deviceName:j.current?.target.displayName,deviceModel:j.current?.target.modelIdentifier,environment:D,deviceApp:j.appLabel||void 0,recordedTestPath:T.recorder?.lastWrittenPath??null,externalIdInput:{...Y?Y.externalId:{},session_id:T.sessionId,commit_id:T.sessionId,test_id:T.testId??void 0,testcase_id:E.testcaseId??T.testcaseId??void 0,project_id:y.project_id??void 0,folder_id:y.folder_id??void 0,org_id:T.orgId??void 0,session_name:T.sessionName??void 0,user_name:T.userName??void 0,user_email:T.userEmail??void 0,sharable_link:nc(he(D).testManagerUiUrl,y.project_id,E.testcaseId??T.testcaseId,E.shareId)},cdpBrowserCapture:no,model:r.model??c.model,tuiLogPath:ze(T.sessionDir,"tui.log"),log:(R,x,P,z)=>T.log(R,x,P,z)}));if(!r.local&&b.basicAuth&&y.project_id){let E=he(D),R=await hc({tmsBaseUrl:E.tmsBaseUrl,environment:D,auth:b.basicAuth,objective:K.auteurObjective,url:tn??"",projectId:y.project_id,folderId:y.folder_id??"",hasCustomProfile:!!c.chrome_profile_path,...re.kind==="device"?{mobile:fc({platform:re.device.platform,target:re.device.target,mobile:c.mobile,appId:re.appId,deviceName:j.current?.target.displayName??j.real?.deviceName,deviceModel:j.current?.target.modelIdentifier,osVersion:j.current?.target.osVersion??j.real?.osVersion,udid:re.device.udid})}:{},log:(x,P,z,Te)=>T.log(x,P,z,Te),onNotCreated:x=>{T.setSaveBlocker(x),process.stderr.write(`warn: ${es(x)}
4224
+ `),Object.assign(r,ud()),o=Ad(s)}o=o??"",(r.agent||!process.stdin.isTTY)&&mr("run");{let{objectiveVariableGate:E}=await import("./objective-variable-gate-V5HHFOUS.js"),{formatUnresolvedReceipt:R,unresolvedVariablesEvent:x}=await import("./variable-receipt-7PRKDTRJ.js"),P=E({objective:o,cwd:process.cwd(),globalDir:ze(oe,"variables"),opts:{variables:r.variables,variablesFile:r.variablesFile,sessionContext:r.sessionContext}});P.length>0&&(!!r.agent||!process.stdin.isTTY?en(x(P,{cwd:process.cwd()})):process.stderr.write(R(P,{cwd:process.cwd()})))}let l=new Ae,d=new xe,c=d.load();r.chromeProfile&&(c.chrome_profile_path=r.chromeProfile);let u;if(r.mode===void 0)u=c.mode==="action"?"action":"testing";else if(r.mode==="action"||r.mode==="testing")u=r.mode;else{console.error("Invalid --mode. Must be 'action' or 'testing'."),M(2,"Invalid --mode");return}let g;if(r.assertionMode===void 0)g=c.assertion_mode==="dom"?"dom":"visual";else if(r.assertionMode==="visual"||r.assertionMode==="dom")g=r.assertionMode;else{console.error("Invalid --assertion-mode. Must be 'visual' or 'dom'."),M(2,"Invalid --assertion-mode");return}let m;if(r.finalValidation!==void 0){if(r.finalValidation!=="on"&&r.finalValidation!=="off"){console.error("Invalid --final-validation. Must be 'on' or 'off'."),M(2,"Invalid --final-validation");return}m=r.finalValidation==="on"}let f=new vn;Ar()?.attachSessionDir(f.sessionDir);let{printRecordingBanner:A}=await import("./recording-banner-VZ67EWWQ.js");await A({isAgent:!!r.agent||!process.stdin.isTTY,sessionId:f.sessionId,sessionName:r.name??null,testPath:r.name?ze(process.cwd(),".testmuai","tests",`${r.name}_test.md`):null,outputPath:r.name?ze(process.cwd(),".testmuai","tests",`output-${r.name}`):null});let h=!!(r.username&&r.accessKey);if(await Ha({isInteractive:!!process.stdin.isTTY&&!r.agent&&!h,creds:l,config:d}),!h){let E=l.getActiveProfile(),R=l.getDefaultEnv();E&&(l.loadBasicAuth(E,R)||l.loadCredentials(E,R))||(console.error("Not authenticated. Run: kane-cli login --oauth, or kane-cli login --username <user> --access-key <key>"),Jn("AUTH_NOT_AUTHENTICATED"),M(1,"Not authenticated"))}let p=`${l.getActiveProfile()??"no profile"}/${l.getDefaultEnv()}`,w=[],D=r.env??l.getDefaultEnv(),O=null,V=[],v=(E,R,x,P)=>{O?O(E,R,x,P):V.push([E,R,x,P])},b;try{b=await $e({creds:l,env:D,usernameFlag:r.username,accessKeyFlag:r.accessKey,log:v})}catch(E){throw E instanceof ht&&(console.error(E.code==="not_authenticated"?"Not authenticated. Run: kane-cli login":"Token refresh failed. Run: kane-cli login"),Jn(E.code==="not_authenticated"?"AUTH_NOT_AUTHENTICATED":"AUTH_REFRESH_FAILED"),M(2,E.code==="not_authenticated"?"Not authenticated":"Token refresh failed")),E}let F=!!b.basicAuth,G=b.basicAuth?.username,B=b.basicAuth?.access_key,C=b.token,Q=b.resolver,X=b.resolvedCreds;b.basicAuth&&w.push(`Auth: ${b.basicAuth.username}`);let Y=null;{let E=null;try{E=ks({datasetId:r.datasetId,datasetVersion:r.datasetVersion,datasetRow:r.datasetRow},void 0)}catch(R){console.error(`error: ${R.message}`),M(2,R.message)}if(E){b.basicAuth||(console.error("error: --dataset-id needs Test Manager credentials \u2014 run 'kane-cli login' or pass --username/--access-key"),M(2,"dataset needs Test Manager credentials"));try{Y=await pc({selection:E,tmsBaseUrl:he(D).tmsBaseUrl,auth:b.basicAuth,saveDir:f.sessionDir,log:(x,P,z,Te)=>f.log(x,P,z,Te)})}catch(x){console.error(`error: ${x.message}`),M(2,x.message)}let R=Cc([{text:o,usedBy:{file:bc,step:1}}],Y.columns,E.id);R.length>0&&(!!r.agent||!process.stdin.isTTY?en(hr(R,{cwd:process.cwd()})):process.stderr.write(bt(R,{cwd:process.cwd()})))}}let we=l.getActiveProfile()??"default",ge=l.getDefaultEnv();Vs(l,d,we,ge);let y=d.load(),N=b.basicAuth??(b.resolvedCreds?{username:b.resolvedCreds.username,access_key:b.resolvedCreds.access_key}:null);if(N){let E=!!r.agent||!process.stdin.isTTY,R=await _t({creds:l,config:d,profile:we,env:ge,tmsCreds:N,isLocal:!!r.local,log:v});R.status==="cancelled"&&(console.error("error: project/folder configuration failed. See remediation above, or use --local."),M(2,"project/folder gate failed")),R.status==="ok"&&R.autoDefaulted&&E&&en(qt(R.autoDefaulted)),y=d.load()}else r.local||(console.error("Project and folder must be configured. Run `kane-cli login` to set up auth, or pass --username/--access-key, then `kane-cli config project <id>` / `kane-cli config folder <id>`."),M(2,"no TMS credentials for project/folder gate"));let{resolveRunIntent:q,formatRunningOn:H,missingPieceMessage:ee,staleAppMessage:Z,CHOOSE_MOBILE_KIND_MESSAGE:I}=await import("./resolve-run-intent-QCRZPYXM.js"),{mobileHostSupport:U}=await import("./host-7GZPBA74.js"),L=Ba()&&!r.agent,{attachTargetFromFlags:k,formatAttachBanner:Ge}=await import("./attach-target-V6LECVES.js"),ke=k({appiumUrl:r.appiumUrl,appiumSessionId:r.appiumSessionId,target:r.target,deviceName:r.deviceName,osVersion:r.osVersion,app:r.app});if(ke.kind==="invalid"){console.error(`error: ${ke.message}`),M(2,"attach run not fully specified");return}let Re=ke.kind==="attach"?ke.device:null,Ue=q({flags:{target:Re?void 0:r.target,deviceName:r.deviceName,osVersion:r.osVersion,app:r.app},saved:Re?void 0:c.mobile,host:U()});if(Ue.kind==="choose-mobile-kind")if(L){let{promptMobileKind:E}=await import("./mobile-prompts-SP2RULD7.js"),R=await E();if(!R){M(2,"target selection cancelled");return}d.setMobile({tui_target:R}),Ue=q({flags:{target:R,deviceName:r.deviceName,osVersion:r.osVersion,app:r.app},saved:d.load().mobile,host:U()})}else{console.error(`error: ${I}`),M(2,"ambiguous legacy session target");return}if(Ue.kind==="invalid"){console.error(`error: ${Ue.message}`),M(2,"invalid run target");return}if(Ue.kind==="choose-mobile-kind"){M(2,"ambiguous legacy session target");return}for(let E of Ue.warnings)console.error(`warning: ${E}`);let qe=Ue.kind==="mobile"?Ue:null,_e=Ue.kind==="real-device"?Ue:null;if((qe||_e)&&r.codeLanguage?.toLowerCase()==="javascript"){console.error("error: --code-language javascript is not supported on a mobile target \u2014 mobile code export is Appium + Python only. Drop the flag, or pass --code-language python."),M(2,"javascript code export on a mobile target");return}let nn=qe||_e||Re?"device":"web";try{fr(r,c.code_export,nn==="device")}catch(E){console.error(`error: ${E.message}`),M(2,"invalid code export options");return}if(f.setCompletionMetadata({runType:"run",target:Re?Re.platform==="ios"?"simulator":"emulator":qe?.target??_e?.target??"desktop"}),f.setRunTarget(Wi(Re?Re.platform==="ios"?"simulator":"emulator":qe?.target??_e?.target??"desktop",{wsEndpoint:r.wsEndpoint})),Re?console.error(Ge(Re)):!qe&&!_e&&console.error(H({target:"desktop"})),!a&&!hd({target:r.target,deviceName:r.deviceName,osVersion:r.osVersion,app:r.app,cdpEndpoint:r.cdpEndpoint,wsEndpoint:r.wsEndpoint,cft:r.cft,url:r.url})){let E=nn==="device"?"mobile":"web",R=await Ns({objective:o,sessionTarget:E,controllerBaseUrl:he(D).controllerBaseUrl,authHeader:b.basicAuth?lt(b.basicAuth.username,b.basicAuth.access_key):`Bearer ${b.token}`}),x=Ed(ys(R,E));x&&console.error(x),v("info","CLASSIFY_VERDICT","Objective classified",{session_target:E,target:R?.target??null,confidence:R?.confidence??null,warned:!!x})}let tn=nn==="device"?null:ja({flag:r.url,configDefault:c.default_url}),Qt=nn==="device"?!1:Oa({resolvedUrl:tn,local:r.local,allowMissingUrl:r.allowMissingUrl,isTTY:!!process.stdin.isTTY}),K=mc({objective:o,globalDir:ze(oe,"variables"),localDir:ze(process.cwd(),".testmuai","variables"),file:r.variablesFile,inline:r.variables,parameters:Y?.parameters,onLoadError:E=>console.error(E)}),be;if(r.sessionContext)try{be=JSON.parse(r.sessionContext)}catch{console.error("Invalid --session-context JSON"),M(2,"Invalid --session-context JSON")}let Gn=r.globalContext??ze(oe,"global-memory.md"),Rt=r.localContext??ze(process.cwd(),".testmuai","context.md"),Oe=Qo(Gn),S=Qo(Rt),j={},te=async E=>{let{promptApp:R}=await import("./mobile-prompts-SP2RULD7.js"),{AppClient:x}=await import("./app-client-2RR5ATI6.js"),P=G&&B?z=>new x(Dn(D),{username:G,accessKey:B}).list({type:E,...z}):void 0;return R({kind:E,...P?{listApps:P}:{}})},_=async E=>{let R=E.app;if(!R){if(!L)throw console.error(`error: ${ee(E.target,"app")}`),M(2,"real-device run missing app"),new Error("real-device run missing app");let z=await te(E.target);if(!z)throw M(2,"app selection cancelled"),new Error("app selection cancelled");R={value:z,source:"saved"},(r.target===void 0||ln(d.load().mobile)===E.target)&&d.setMobile({tui_target:E.target,default_app:z})}let{prepareRealDeviceRun:x,deviceStreamMode:P}=await import("./real-device-run-425XK527.js");try{return await x({log:(z,Te,ue,se)=>f.log(z,Te,ue,se),target:E.target,selection:{...E.deviceName?{deviceName:E.deviceName}:{},...E.osVersion?{osVersion:E.osVersion}:{},app:R},env:D,sessionDir:f.sessionDir,auth:b,mobile:c.mobile,testName:r.name??o??"kane-cli run",tunnel:zt(r),write:z=>console.error(z),stream:P({interactive:L,flag:r.stream,mobile:c.mobile})})}catch(z){throw console.error(`error: ${z.message}`),M(2,"real-device preparation failed"),z}},re=await ic(nn,{prepareDevice:async()=>{if(Re)return{device:Re};if(_e)return j.real=await _(_e),{device:j.real.device,...j.real.appId?{appRef:j.real.appId,appId:j.real.appId}:{}};let E=qe,{isAppId:R}=await import("./app-download-UGLDWWTX.js"),{evidenceAppName:x}=await import("./device-env-SBTHFSVK.js"),{access:P}=await import("fs/promises"),z=E.app?.value,Te=!1,ue=!1,se=E.app?.source==="saved"&&!R(E.app.value)?await P(E.app.value).then(()=>!1,()=>!0):!1;if(L){if(E.missing.includes("app")||se){se&&console.error(`${E.app.value} is no longer there \u2014 choose the app under test.`);let W=await te(E.target);if(!W)throw M(2,"app selection cancelled"),new Error("app selection cancelled");z=W,Te=!0}}else{let W=E.missing.map(Qe=>ee(E.target,Qe));if(se&&W.push(Z(E.app.value,E.target)),W.length>0){for(let Qe of W)console.error(`error: ${Qe}`);M(2,"mobile run not fully specified")}}let me,Se=Mr();try{me=await hs({log:(W,Qe,Pe,ct)=>f.log(W,Qe,Pe,ct),device:E.deviceSelector,platform:rn(E.target),app:z,defaults:c.mobile,interactive:L,agent:!!r.agent,appiumUrl:r.appiumUrl,...L?{pickTarget:async W=>{let{promptDevice:Qe}=await import("./mobile-prompts-SP2RULD7.js"),Pe=W.filter(Je=>Je.kind===E.target),ct=await Qe(Pe.length>0?Pe:W,E.target,c.mobile?.default_target);return ct&&(ue=!0),ct}}:{},...!r.local&&G&&B&&X?.org_id?{cloudUpload:{env:D,orgId:String(X.org_id),userId:String(X.user_id??""),baseUrl:Dn(D),auth:{username:G,accessKey:B}}}:{},onProgress:Se.onProgress})}catch(W){Se.done(),W instanceof fs?(console.error(W.doctorText),console.error(`
4225
+ ${W.message}`)):console.error(W instanceof Error?W.message:String(W)),M(2,"mobile target preparation failed")}Se.done(),me.device.app_package||(console.error(`error: ${ee(E.target,"app")}`),M(2,"mobile run missing app binding"));let Ye=E.device?.source==="flag";if(Te||ue||!Ye){let{deviceRefOf:W}=await import("./device-ref-LAZWPRQN.js");d.setMobile({...r.target===void 0?{tui_target:E.target}:{},...Ye?{}:{default_target:W(me.target)},...Te&&z?{default_app:z}:{}})}j.current=me;let J=z??me.appRef??me.device.app_package??"";return j.appLabel=x(J)??"",{device:me.device,...me.appRef?{appRef:me.appRef}:{},...me.appId?{appId:me.appId}:{}}},prepareWeb:async()=>{try{let E=Et()?await rc(b):null;return await oc({config:c,startUrl:tn??void 0,headless:r.headless,cft:r.cft,wsEndpoint:r.wsEndpoint,cdpEndpoint:r.cdpEndpoint,...E?{ltGrid:{name:(o??"kane-cli run").slice(0,200),...E}}:{}})}catch(E){console.error(Qs(E));let R=E instanceof Ss?"Chrome not found at standard paths":`Chrome failed: ${E instanceof Error?E.message:E}`;M(2,R)}}}),ye=re.kind==="web"?re.chrome:{instance:null,tempDir:null};ye.instance&&On("chrome",()=>{ye.instance.kill()});let Be=null,Un=ye.cdpEndpoint??r.cdpEndpoint;if(Un&&!r.cft&&!r.wsEndpoint&&(Be=$s({headless:r.headless,cdpEndpoint:Un,chromePid:ye.instance?.process.pid}),Be&&On("marker-overlay",()=>Be.kill())),re.kind==="device"&&j.current&&qe){let E=H({target:qe.target,deviceLabel:j.current.target.displayName,appLabel:j.appLabel??""});L||console.error(E),w.push(E)}else r.cft?w.push("CfT mode: Playwright will manage its own browser"):r.wsEndpoint?w.push(`Playwright WS endpoint (${r.wsEndpoint.slice(0,60)}...)`):r.cdpEndpoint?w.push(`CDP connected (${r.cdpEndpoint})`):ye.cdpEndpoint&&w.push(`Chrome ready (${ye.cdpEndpoint})`);let T=f;T.start({model:r.model??c.model,environment:D,profile:l.getActiveProfile(),surface:"run",runType:"run"}),!r.local&&b.resolvedCreds?.user_id!==void 0&&T.setCompletionIdentity(Number(b.resolvedCreds.user_id)),r.name&&T.setSessionName(r.name),b.resolvedCreds?.org_id!==void 0&&T.setOrgId(String(b.resolvedCreds.org_id)),b.resolvedCreds?.plan!==void 0&&T.setPlan(b.resolvedCreds.plan??null),T.setUserIdentity(b.resolvedCreds?.username??null,b.resolvedCreds?.email??null),O=(E,R,x,P)=>T.log(E,R,x,P);for(let E of V)T.log(...E);V.length=0;let dn=F&&G&&B?{username:G,accessKey:B}:C??null,Ce=null;if(dn!==null){let E=await wc({env:D,tmsCreds:b.resolvedCreds??null,resolver:b.resolver,auth:dn,getToken:async()=>b.token??null,session:T,log:(R,x,P,z)=>T.log(R,x,P,z),skipScreenshotQueue:r.local,invocationMode:r.agent||!process.stdin.isTTY?"agent":"cli"});Ce=E.screenshotQueue,E.remoteLogger&&(On("remote-logger",()=>E.remoteLogger.shutdownSync()),Oi(E.remoteLogger),ji(Hs()))}let Nt=b.basicAuth&&!r.local?await Ac({variables:K,auth:b.basicAuth,orgId:String(b.resolvedCreds?.org_id??""),env:D,localMode:!!r.local,log:(E,R,x,P)=>T.log(E,R,x,P)}):{};T.setAuteurVariables(K.auteur),T.setFirstRun(K.auteurObjective,tn??"");let{startInlineEvidence:$,noteInlineSpawn:yt,inlineEvidenceBlock:$r,finalizeInlineEvidence:eo,createCdpBrowserCapture:Pu,writeAuteurDataset:Hu}=await import("./evidence-FOWW3MOS.js"),no=Pu(ye.cdpEndpoint),de=a?null:await $({objectiveOrName:r.name??o,sessionId:T.sessionId,title:r.name??o,producerVersion:De,pid:process.pid,surfaces:tn?[tn]:void 0,packRootDir:ze(T.sessionDir,"evidence")}),kt=async(E={})=>(T.flushRecorder(),de&&Y&&Hu(de.packTestDir,Y.evidenceRecord,(R,x,P,z)=>T.log(R,x,P,z)),await eo(de,{saved:!!T.sessionName,local:!!r.local,deviceName:j.current?.target.displayName,deviceModel:j.current?.target.modelIdentifier,environment:D,deviceApp:j.appLabel||void 0,recordedTestPath:T.recorder?.lastWrittenPath??null,externalIdInput:{...Y?Y.externalId:{},session_id:T.sessionId,commit_id:T.sessionId,test_id:T.testId??void 0,testcase_id:E.testcaseId??T.testcaseId??void 0,project_id:y.project_id??void 0,folder_id:y.folder_id??void 0,org_id:T.orgId??void 0,session_name:T.sessionName??void 0,user_name:T.userName??void 0,user_email:T.userEmail??void 0,sharable_link:nc(he(D).testManagerUiUrl,y.project_id,E.testcaseId??T.testcaseId,E.shareId)},cdpBrowserCapture:no,model:r.model??c.model,tuiLogPath:ze(T.sessionDir,"tui.log"),log:(R,x,P,z)=>T.log(R,x,P,z)}));if(!r.local&&b.basicAuth&&y.project_id){let E=he(D),R=await hc({tmsBaseUrl:E.tmsBaseUrl,environment:D,auth:b.basicAuth,objective:K.auteurObjective,url:tn??"",projectId:y.project_id,folderId:y.folder_id??"",hasCustomProfile:!!c.chrome_profile_path,...re.kind==="device"?{mobile:fc({platform:re.device.platform,target:re.device.target,mobile:c.mobile,appId:re.appId,deviceName:j.current?.target.displayName??j.real?.deviceName,deviceModel:j.current?.target.modelIdentifier,osVersion:j.current?.target.osVersion??j.real?.osVersion,udid:re.device.udid})}:{},log:(x,P,z,Te)=>T.log(x,P,z,Te),onNotCreated:x=>{T.setSaveBlocker(x),process.stderr.write(`warn: ${es(x)}
4226
4226
  `)}});R&&T.setTestId(R)}T.setResolvedGlobal({mode:u,max_steps:parseInt(r.maxSteps,10),timeout:r.timeout?parseInt(r.timeout,10):void 0,target:sc(re,{cdpEndpoint:r.cdpEndpoint,wsEndpoint:r.wsEndpoint}),app:cc(re),os_version:re.kind==="device"?j.current?.target.osVersion??j.real?.osVersion:void 0,device_name:ac(re,j.current?.target)??j.real?.deviceName,chrome_profile:c.chrome_profile_path||void 0,cdp_endpoint:r.cdpEndpoint||void 0,ws_endpoint:r.wsEndpoint||void 0,headless:r.headless,global_context:Oe??void 0,local_context:S??void 0,variables:Object.keys(wo(K.auteur)).length>0?wo(K.auteur):void 0,dataset:Y?xs(Y.selection.id,Y.rowId):void 0});let Ti=gc(K.auteur,K.auteurObjective),xt=lc({objective:K.auteurObjective,conditions:a?pd(K.auteurObjective,s.length):void 0,url:tn??void 0,requireStartUrl:Qt,model:r.model??c.model,chrome:ye,auth:b,sessionId:T.sessionId,runIndex:0,projectId:r.local?null:y.project_id,windowSize:c.window_size,maxSteps:parseInt(r.maxSteps,10),headless:r.headless,disableAskUser:!process.stdin.isTTY,enableTaskSkills:r.taskSkills,networkWs:r.networkWs,networkSse:r.networkSse,bugDetection:r.bugDetection??c.bug_detection,assertionFailureMode:r.assertionFailureMode??c.assertion_failure_mode,variables:Object.keys(Ti).length>0?Ti:void 0,globalContext:Oe??void 0,localContext:S??void 0,sessionContext:be,device:re.kind==="device"?re.device:void 0,evidence:$r(de)}),to=xa(),Si=Ce?(E,R,x,P)=>{if(de&&P){to.track(Va(de.packTestDir,P,Ce,(z,Te,ue,se)=>T.log(z,Te,ue,se)));return}Fa(T.sessionDir,R,E,Ce,(z,Te,ue,se)=>T.log(z,Te,ue,se),x)}:void 0;if(!process.stdin.isTTY&&!r.agent&&(r.agent=!0),r.agent){let E=en;Be?.setRunActive(!0);let R;T.logRunStart(0,K.auteurObjective,xt.url??"");try{R=await dd(xt,{environment:D,mode:u,assertionMode:g,finalValidation:m,log:(J,W,Qe,Pe)=>T.log(J,W,Qe,Pe),...j.real?{onRunnerEvent:j.real.announce}:{}},{reportVerdict:!!j.real,onStepEnd:Si,onStepLog:(J,W,Qe)=>T.logStep(J,W,Qe),onReasoning:J=>Be?.setStepText(J),onStepComplete:()=>Be?.setStepComplete(),kind:a?"evaluate":"author",timeoutSeconds:a&&r.timeout?parseInt(r.timeout,10):void 0,onTimeout:()=>process.stderr.write(`Timeout: ${r.timeout}s exceeded \u2014 stopping the analyzer run
4227
- `)})}catch(J){throw T.log("error","RUNNER_ERROR","Runner error occurred",{error:J instanceof Error?J.message:String(J)}),T.logRunEnd(0,"error",void 0,void 0,null),J}finally{Be?.setRunActive(!1)}let{lastRunEnd:x,stepsTotal:P,hadError:z,bifurcationFlows:Te}=R;z&&T.log("error","RUNNER_ERROR","Runner error occurred",{error:R.errorMessage??""}),a&&R.timedOut&&(E({type:"run_end",status:"failed",run_id:"run-0",reason:`Timeout: ${r.timeout}s exceeded`,condition_results:s.map(()=>null),condition_reasons:s.map(()=>"timed out before a verdict"),condition_sub_checks:s.map(()=>null)}),T.logRunEnd(0,"timeout",void 0,`Timeout: ${r.timeout}s exceeded`,null),await T.finish({status:"cancelled",reason:"timeout"}),await cn(3,`Analyzer run: Timeout after ${r.timeout}s`)),yt(de,R.evidence,x);let ue=Fo(x,z);if(T.logRunEnd(0,ue,x?.duration,x?.summary,x?.result_code),x){let J=bo(x,0,Te);T.addRunResult(Co(x,K.auteurObjective,0,J),x.total_runs);let W=x.status==="passed"?"passed":z?"error":"failed";T.addFlow({runIndex:0,objective:K.auteurObjective,status:W,summary:x.summary??"",duration:x.duration??0,steps:P,stepsPassed:W==="passed"?P:0,stepsFailed:W==="passed"?0:P,reason:x.reason,creditsConsumed:x.credits_consumed})}de&&await no(),uo("chrome","Agent run completed");let se;if(T.log("info","DIRECT_UPLOAD_START","Starting direct upload (agent mode)",{agent_mode:!0,last_run_end:!!x,local:!!r.local,mobile:re.kind==="device"}),x&&!r.local)try{let J=he(D),W=y.project_id;if(b.basicAuth){let{UploadPipeline:Qe}=await import("./pipeline-XYM6HIDZ.js");Ce&&(await to.settle(),await Ce.drain());let Pe=Ro({mobile:re.kind==="device",session:T,env:D,auth:b,variables:K,variableIds:Nt,testParams:Y?.testParams,projectId:W,folderId:y.folder_id,totalSteps:P,totalDuration:x.duration??0,screenshotExtMap:Ce?.getExtMap(),codeExport:fr({codeExport:r.codeExport,codeLanguage:r.codeLanguage,skipCodeValidation:r.skipCodeValidation},c.code_export,re.kind==="device"),onProgress:()=>{},log:(Cn,io,so,ao)=>T.log(Cn,io,so,ao),shouldUploadArtifacts:!r.local,shouldReplaceLocalOutput:!1,shouldCommit:!1,isFirstRun:!0,evidence:de?{executionId:de.executionId,packTestDir:de.packTestDir,sealedPackPath:de.packDir,sealFn:kt}:void 0}),Je=await new Qe(Pe).execute();Je.success&&(Je.testcaseId&&T.setTestcaseId(Je.testcaseId),Je.testcaseId&&Je.shareId&&W&&(se=pr(J.testManagerUiUrl,W,Je.testcaseId,Je.shareId)));let Vi=null;try{let{persistRecordedSession:Cn}=await import("./persist-recorded-session-WYMOHDTB.js");Vi=await Cn(T,{testcaseId:T.testcaseId??void 0,projectId:y.project_id??void 0,folderId:y.folder_id??void 0,codeExportDir:Je.codeExportDir,mobile:re.kind==="device",packTestDir:de?.packTestDir})}catch(Cn){T.log("error","DIRECT_PERSIST_ERROR","Persist failed in agent mode",{error:String(Cn)})}let{syncPersistedBundle:Ju}=await import("./testmd-sync-QZWVWTZZ.js");await Ju({recordedTestPath:Vi?.recordedTestPath,uploadSucceeded:Je.success,local:!!r.local,sessionId:T.sessionId,basicAuth:b.basicAuth,controllerBaseUrl:J.controllerBaseUrl,log:(Cn,io,so,ao)=>T.log(Cn,io,so,ao),onAgentEvent:E})}}catch(J){T.log("error","DIRECT_UPLOAD_ERROR","Upload failed in agent mode",{error:J instanceof Error?J.message:String(J)})}let me=await kt({});if(de&&me?.sealed){for(let W of pn(me.coverage))process.stderr.write(W+`
4228
- `);let{offerEvidenceView:J}=await import("./evidence-SRWISQMQ.js");await J({packPath:de.packDir,env:D,isTTY:!1,log:W=>process.stderr.write(W+`
4227
+ `)})}catch(J){throw T.log("error","RUNNER_ERROR","Runner error occurred",{error:J instanceof Error?J.message:String(J)}),T.logRunEnd(0,"error",void 0,void 0,null),J}finally{Be?.setRunActive(!1)}let{lastRunEnd:x,stepsTotal:P,hadError:z,bifurcationFlows:Te}=R;z&&T.log("error","RUNNER_ERROR","Runner error occurred",{error:R.errorMessage??""}),a&&R.timedOut&&(E({type:"run_end",status:"failed",run_id:"run-0",reason:`Timeout: ${r.timeout}s exceeded`,condition_results:s.map(()=>null),condition_reasons:s.map(()=>"timed out before a verdict"),condition_sub_checks:s.map(()=>null)}),T.logRunEnd(0,"timeout",void 0,`Timeout: ${r.timeout}s exceeded`,null),await T.finish({status:"cancelled",reason:"timeout"}),await cn(3,`Analyzer run: Timeout after ${r.timeout}s`)),yt(de,R.evidence,x);let ue=Fo(x,z);if(T.logRunEnd(0,ue,x?.duration,x?.summary,x?.result_code),x){let J=bo(x,0,Te);T.addRunResult(Co(x,K.auteurObjective,0,J),x.total_runs);let W=x.status==="passed"?"passed":z?"error":"failed";T.addFlow({runIndex:0,objective:K.auteurObjective,status:W,summary:x.summary??"",duration:x.duration??0,steps:P,stepsPassed:W==="passed"?P:0,stepsFailed:W==="passed"?0:P,reason:x.reason,creditsConsumed:x.credits_consumed})}de&&await no(),uo("chrome","Agent run completed");let se;if(T.log("info","DIRECT_UPLOAD_START","Starting direct upload (agent mode)",{agent_mode:!0,last_run_end:!!x,local:!!r.local,mobile:re.kind==="device"}),x&&!r.local)try{let J=he(D),W=y.project_id;if(b.basicAuth){let{UploadPipeline:Qe}=await import("./pipeline-YE4IRKQX.js");Ce&&(await to.settle(),await Ce.drain());let Pe=Ro({mobile:re.kind==="device",session:T,env:D,auth:b,variables:K,variableIds:Nt,testParams:Y?.testParams,projectId:W,folderId:y.folder_id,totalSteps:P,totalDuration:x.duration??0,screenshotExtMap:Ce?.getExtMap(),codeExport:fr({codeExport:r.codeExport,codeLanguage:r.codeLanguage,skipCodeValidation:r.skipCodeValidation},c.code_export,re.kind==="device"),onProgress:()=>{},log:(Cn,io,so,ao)=>T.log(Cn,io,so,ao),shouldUploadArtifacts:!r.local,shouldReplaceLocalOutput:!1,shouldCommit:!1,isFirstRun:!0,evidence:de?{executionId:de.executionId,packTestDir:de.packTestDir,sealedPackPath:de.packDir,sealFn:kt}:void 0}),Je=await new Qe(Pe).execute();Je.success&&(Je.testcaseId&&T.setTestcaseId(Je.testcaseId),Je.testcaseId&&Je.shareId&&W&&(se=pr(J.testManagerUiUrl,W,Je.testcaseId,Je.shareId)));let Vi=null;try{let{persistRecordedSession:Cn}=await import("./persist-recorded-session-BWGA7WXR.js");Vi=await Cn(T,{testcaseId:T.testcaseId??void 0,projectId:y.project_id??void 0,folderId:y.folder_id??void 0,codeExportDir:Je.codeExportDir,mobile:re.kind==="device",packTestDir:de?.packTestDir})}catch(Cn){T.log("error","DIRECT_PERSIST_ERROR","Persist failed in agent mode",{error:String(Cn)})}let{syncPersistedBundle:Ju}=await import("./testmd-sync-HM24JCS7.js");await Ju({recordedTestPath:Vi?.recordedTestPath,uploadSucceeded:Je.success,local:!!r.local,sessionId:T.sessionId,basicAuth:b.basicAuth,controllerBaseUrl:J.controllerBaseUrl,log:(Cn,io,so,ao)=>T.log(Cn,io,so,ao),onAgentEvent:E})}}catch(J){T.log("error","DIRECT_UPLOAD_ERROR","Upload failed in agent mode",{error:J instanceof Error?J.message:String(J)})}let me=await kt({});if(de&&me?.sealed){for(let W of pn(me.coverage))process.stderr.write(W+`
4228
+ `);let{offerEvidenceView:J}=await import("./evidence-FOWW3MOS.js");await J({packPath:de.packDir,env:D,isTTY:!1,log:W=>process.stderr.write(W+`
4229
4229
  `)})}let Se=de?me?.coverage:void 0;if(Se&&E(An(Se,de.packDir)),x){let J={...x};se&&(J.test_url=se),Se&&(J.coverage=Qn(Se)),E(J)}if(await T.finish({status:Go(ue)}),!x){let J=Vo(null,z);await cn(J.code,J.reason,{testFailed:!1})}if(a){let J=fd(x,s.length);await cn(J,J===0?"Analyzer run: every condition judged":J===3?`Analyzer run: ${x.reason??""}`:"Analyzer run: some conditions could not be judged")}let Ye=Vo(x,z);await cn(Ye.code,Ye.reason)}let fe=null,st=0,at=!1,Qi=null,Ri=0,Ni={current:null},Lu=N?{authHeader:lt(N.username,N.access_key),sessionId:T.sessionId,controllerBaseUrl:he(D).controllerBaseUrl}:null;T.logRunStart(0,K.auteurObjective,xt.url??"");let yi,{waitUntilExit:zu}=In(bi.default.createElement(Mn,null,bi.default.createElement(cd,{config:xt,describeContext:Lu,spawnOpts:{environment:D,mode:u,assertionMode:g,finalValidation:m,log:(E,R,x,P)=>T.log(E,R,x,P),...j.real?{onRunnerEvent:j.real.announce}:{}},reportVerdict:!!j.real,cancelRef:Ni,banner:{model:r.model??c.model,auth:p,status:w},onComplete:E=>{fe=E.lastRunEnd,st=E.stepsTotal,at=E.hadError,yi=E.errorMessage,Qi=E.bifurcationFlows,Ri=E.describeCredits,yt(de,E.evidence,E.lastRunEnd)},onStepEnd:Si,onReasoning:E=>Be?.setStepText(E),onStepLog:(E,R,x)=>T.logStep(E,R,x),onStepComplete:()=>Be?.setStepComplete()})),{stdout:process.stderr,exitOnCtrlC:!1}),ro;if(r.timeout){let E=parseInt(r.timeout,10)*1e3;ro=setTimeout(()=>{console.error(`
4230
- Timeout: ${r.timeout}s exceeded \u2014 cancelling...`),Ni.current?.()},E)}Be?.setRunActive(!0);try{await zu()}finally{Be?.setRunActive(!1)}ro&&clearTimeout(ro),at&&T.log("error","RUNNER_ERROR","Runner error occurred",{error:yi??""});let ki=Fo(fe,at);if(T.logRunEnd(0,ki,fe?.duration,fe?.summary,fe?.result_code),fe){let E=bo(fe,0,Qi);T.addRunResult(Co(fe,K.auteurObjective,0,E),fe.total_runs);let R=fe.status==="passed"?"passed":at?"error":"failed";T.addFlow({runIndex:0,objective:K.auteurObjective,status:R,summary:fe.summary??"",duration:fe.duration??0,steps:st,stepsPassed:R==="passed"?st:0,stepsFailed:R==="passed"?0:st,reason:fe.reason,creditsConsumed:(fe.credits_consumed??0)+Ri})}de&&await no(),uo("chrome","Ink run completed");{let E=u==="testing",R=T.nextRunIndex()>0;if(E&&!r.name&&R&&process.stdin.isTTY)try{let{renderSavePrompt:x,defaultSessionTimestamp:P}=await import("./SaveSessionPrompt-X3N6OGYB.js"),z=await x(P());z&&T.setSessionName(z)}catch(x){T.log("warn","DIRECT_SAVE_PROMPT_FAILED","Save prompt failed",{error:String(x)})}}if(T.log("info","DIRECT_UPLOAD_START","Starting direct upload (ink mode)",{ink_mode:!0,last_event:!!fe,local:!!r.local,mobile:re.kind==="device"}),fe&&!r.local)try{let E=he(D),R=y.project_id;if(b.basicAuth){let{UploadPipeline:x}=await import("./pipeline-XYM6HIDZ.js");Ce&&(T.log("info","SCREENSHOT_UPLOAD_DRAIN","Draining screenshot upload queue before pipeline"),await to.settle(),await Ce.drain(),T.log("info","SCREENSHOT_UPLOAD_DRAINED","Screenshot upload queue drained"));let P=Ro({mobile:re.kind==="device",session:T,env:D,auth:b,variables:K,variableIds:Nt,testParams:Y?.testParams,projectId:y.project_id,folderId:y.folder_id,totalSteps:st,totalDuration:fe.duration??0,screenshotExtMap:Ce?.getExtMap(),codeExport:fr({codeExport:r.codeExport,codeLanguage:r.codeLanguage,skipCodeValidation:r.skipCodeValidation},c.code_export,re.kind==="device"),onProgress:()=>{},log:(se,me,Se,Ye)=>T.log(se,me,Se,Ye),shouldUploadArtifacts:!r.local,shouldReplaceLocalOutput:!1,shouldCommit:!1,isFirstRun:!0,evidence:de?{executionId:de.executionId,packTestDir:de.packTestDir,sealedPackPath:de.packDir,sealFn:kt}:void 0}),z=new x(P),{renderUploadProgress:Te}=await import("./CliUploadProgress-IU6BQLMV.js"),ue=await Te(z,se=>{if(se.testcaseId&&se.shareId&&R)return pr(E.testManagerUiUrl,R,se.testcaseId,se.shareId)});if(ue.success){ue.testcaseId&&T.setTestcaseId(ue.testcaseId);let se=null;try{let{persistRecordedSession:J}=await import("./persist-recorded-session-WYMOHDTB.js");se=await J(T,{testcaseId:T.testcaseId??void 0,projectId:y.project_id??void 0,folderId:y.folder_id??void 0,codeExportDir:ue.codeExportDir,mobile:re.kind==="device",packTestDir:de?.packTestDir})}catch(J){T.log("error","DIRECT_PERSIST_ERROR","Persist failed in ink mode",{error:String(J)})}let{syncPersistedBundle:me}=await import("./testmd-sync-QZWVWTZZ.js");await me({recordedTestPath:se?.recordedTestPath,uploadSucceeded:ue.success,local:!!r.local,sessionId:T.sessionId,basicAuth:b.basicAuth,controllerBaseUrl:E.controllerBaseUrl,log:(J,W,Qe,Pe)=>T.log(J,W,Qe,Pe)});let Se=ue.testcaseId&&ue.shareId&&R?pr(E.testManagerUiUrl,R,ue.testcaseId,ue.shareId):void 0,Ye=ue.testcaseId&&R?tc(E.testManagerUiUrl,R,ue.testcaseId):void 0;if(Se||Ye||ue.codeExportDir||se){let{LinksBox:J}=await import("./LinksBox-6YDTIO6I.js"),{render:W}=await import("./build-5ZN47FAT.js"),Qe=await import("./react-QWOAB3TB.js"),{waitUntilExit:Pe}=W(Qe.default.createElement(J,{recordedTestPath:se?.recordedTestPath,outputDir:se?.outputDir,shareableLink:Se,testCaseLink:Ye,codeExportDir:ue.codeExportDir}),{stdout:process.stderr});await Pe()}}if(T.testId){let{renderFeedbackPrompt:se}=await import("./CliFeedbackPrompt-L5ILK66U.js"),me=await se();if(me)try{await Tc({tmsBaseUrl:E.tmsBaseUrl,username:b.basicAuth.username,accessKey:b.basicAuth.access_key,testId:T.testId,feedbackType:me,log:(Se,Ye,J,W)=>T.log(Se,Ye,J,W)})}catch(Se){T.log("warn","FEEDBACK_FAILED","Feedback submission failed",{error:String(Se)})}}}}catch(E){T.log("error","DIRECT_UPLOAD_FAILED","Direct upload failed (ink mode)",{error:E instanceof Error?E.stack??E.message:String(E)}),console.error(`Upload failed: ${E}`)}let xi=await kt({});if(de&&xi?.sealed){for(let P of pn(xi.coverage))process.stderr.write(P+`
4231
- `);let{offerEvidenceView:E}=await import("./evidence-SRWISQMQ.js"),R=fe?.reason??"",x=R.includes("Cancel")||R.includes("Timeout");await E({packPath:de.packDir,env:D,isTTY:!!process.stdin.isTTY&&!!process.stderr.isTTY&&!x,log:P=>process.stderr.write(P+`
4232
- `)})}await T.finish({status:Go(ki)}),fe||await cn(at?2:1,"Run ended with no result",{testFailed:!1});let oo=fe.reason??"";(oo.includes("Cancel")||oo.includes("Timeout"))&&await cn(3,`Run: ${oo}`),fe.status==="passed"&&await cn(0,"Run passed"),await cn(1,"Run failed")}catch(a){await Hi(),await cn(2,`CLI error: ${a instanceof Error?a.message:String(a)}`)}}),Qd(t),Rd(t),Nd(t),yd(t),yc(t),kd(t),t.addCommand(vu()),t.addCommand(Nu()),ma(t),n&&Cd(t),xu(t),t.command("install <target> [version]").description("Install kane-cli agent skill into Claude Code / Codex CLI / Gemini CLI (version defaults to latest compatible)").action(async(o,r)=>{if(o==="plugin"){let c=r;if(!c){console.error("error: usage: kane-cli install plugin <name>"),M(2,"install plugin: missing name");return}let{installPlugin:u}=await import("./install-3IEM3I3X.js"),g=u(c,{});if(g.status==="failed"){console.error(`error: ${g.error}`),M(/unknown plugin/i.test(g.error??"")?2:1,`install plugin: ${g.status}`);return}let{ensureHyperexecuteBinary:m}=await import("./binary-CCCTW3QQ.js"),f=c==="remote-execution"?await m(oe):void 0;process.stdin.isTTY?(process.stderr.write(`${g.status==="already-installed"?"already installed":"installed"} ${g.name}@${g.version} \u2192 ${g.dir}
4230
+ Timeout: ${r.timeout}s exceeded \u2014 cancelling...`),Ni.current?.()},E)}Be?.setRunActive(!0);try{await zu()}finally{Be?.setRunActive(!1)}ro&&clearTimeout(ro),at&&T.log("error","RUNNER_ERROR","Runner error occurred",{error:yi??""});let ki=Fo(fe,at);if(T.logRunEnd(0,ki,fe?.duration,fe?.summary,fe?.result_code),fe){let E=bo(fe,0,Qi);T.addRunResult(Co(fe,K.auteurObjective,0,E),fe.total_runs);let R=fe.status==="passed"?"passed":at?"error":"failed";T.addFlow({runIndex:0,objective:K.auteurObjective,status:R,summary:fe.summary??"",duration:fe.duration??0,steps:st,stepsPassed:R==="passed"?st:0,stepsFailed:R==="passed"?0:st,reason:fe.reason,creditsConsumed:(fe.credits_consumed??0)+Ri})}de&&await no(),uo("chrome","Ink run completed");{let E=u==="testing",R=T.nextRunIndex()>0;if(E&&!r.name&&R&&process.stdin.isTTY)try{let{renderSavePrompt:x,defaultSessionTimestamp:P}=await import("./SaveSessionPrompt-IECYZMXW.js"),z=await x(P());z&&T.setSessionName(z)}catch(x){T.log("warn","DIRECT_SAVE_PROMPT_FAILED","Save prompt failed",{error:String(x)})}}if(T.log("info","DIRECT_UPLOAD_START","Starting direct upload (ink mode)",{ink_mode:!0,last_event:!!fe,local:!!r.local,mobile:re.kind==="device"}),fe&&!r.local)try{let E=he(D),R=y.project_id;if(b.basicAuth){let{UploadPipeline:x}=await import("./pipeline-YE4IRKQX.js");Ce&&(T.log("info","SCREENSHOT_UPLOAD_DRAIN","Draining screenshot upload queue before pipeline"),await to.settle(),await Ce.drain(),T.log("info","SCREENSHOT_UPLOAD_DRAINED","Screenshot upload queue drained"));let P=Ro({mobile:re.kind==="device",session:T,env:D,auth:b,variables:K,variableIds:Nt,testParams:Y?.testParams,projectId:y.project_id,folderId:y.folder_id,totalSteps:st,totalDuration:fe.duration??0,screenshotExtMap:Ce?.getExtMap(),codeExport:fr({codeExport:r.codeExport,codeLanguage:r.codeLanguage,skipCodeValidation:r.skipCodeValidation},c.code_export,re.kind==="device"),onProgress:()=>{},log:(se,me,Se,Ye)=>T.log(se,me,Se,Ye),shouldUploadArtifacts:!r.local,shouldReplaceLocalOutput:!1,shouldCommit:!1,isFirstRun:!0,evidence:de?{executionId:de.executionId,packTestDir:de.packTestDir,sealedPackPath:de.packDir,sealFn:kt}:void 0}),z=new x(P),{renderUploadProgress:Te}=await import("./CliUploadProgress-NK2U3CKQ.js"),ue=await Te(z,se=>{if(se.testcaseId&&se.shareId&&R)return pr(E.testManagerUiUrl,R,se.testcaseId,se.shareId)});if(ue.success){ue.testcaseId&&T.setTestcaseId(ue.testcaseId);let se=null;try{let{persistRecordedSession:J}=await import("./persist-recorded-session-BWGA7WXR.js");se=await J(T,{testcaseId:T.testcaseId??void 0,projectId:y.project_id??void 0,folderId:y.folder_id??void 0,codeExportDir:ue.codeExportDir,mobile:re.kind==="device",packTestDir:de?.packTestDir})}catch(J){T.log("error","DIRECT_PERSIST_ERROR","Persist failed in ink mode",{error:String(J)})}let{syncPersistedBundle:me}=await import("./testmd-sync-HM24JCS7.js");await me({recordedTestPath:se?.recordedTestPath,uploadSucceeded:ue.success,local:!!r.local,sessionId:T.sessionId,basicAuth:b.basicAuth,controllerBaseUrl:E.controllerBaseUrl,log:(J,W,Qe,Pe)=>T.log(J,W,Qe,Pe)});let Se=ue.testcaseId&&ue.shareId&&R?pr(E.testManagerUiUrl,R,ue.testcaseId,ue.shareId):void 0,Ye=ue.testcaseId&&R?tc(E.testManagerUiUrl,R,ue.testcaseId):void 0;if(Se||Ye||ue.codeExportDir||se){let{LinksBox:J}=await import("./LinksBox-7BWLLQVR.js"),{render:W}=await import("./build-5ZN47FAT.js"),Qe=await import("./react-QWOAB3TB.js"),{waitUntilExit:Pe}=W(Qe.default.createElement(J,{recordedTestPath:se?.recordedTestPath,outputDir:se?.outputDir,shareableLink:Se,testCaseLink:Ye,codeExportDir:ue.codeExportDir}),{stdout:process.stderr});await Pe()}}if(T.testId){let{renderFeedbackPrompt:se}=await import("./CliFeedbackPrompt-55OKAT4W.js"),me=await se();if(me)try{await Tc({tmsBaseUrl:E.tmsBaseUrl,username:b.basicAuth.username,accessKey:b.basicAuth.access_key,testId:T.testId,feedbackType:me,log:(Se,Ye,J,W)=>T.log(Se,Ye,J,W)})}catch(Se){T.log("warn","FEEDBACK_FAILED","Feedback submission failed",{error:String(Se)})}}}}catch(E){T.log("error","DIRECT_UPLOAD_FAILED","Direct upload failed (ink mode)",{error:E instanceof Error?E.stack??E.message:String(E)}),console.error(`Upload failed: ${E}`)}let xi=await kt({});if(de&&xi?.sealed){for(let P of pn(xi.coverage))process.stderr.write(P+`
4231
+ `);let{offerEvidenceView:E}=await import("./evidence-FOWW3MOS.js"),R=fe?.reason??"",x=R.includes("Cancel")||R.includes("Timeout");await E({packPath:de.packDir,env:D,isTTY:!!process.stdin.isTTY&&!!process.stderr.isTTY&&!x,log:P=>process.stderr.write(P+`
4232
+ `)})}await T.finish({status:Go(ki)}),fe||await cn(at?2:1,"Run ended with no result",{testFailed:!1});let oo=fe.reason??"";(oo.includes("Cancel")||oo.includes("Timeout"))&&await cn(3,`Run: ${oo}`),fe.status==="passed"&&await cn(0,"Run passed"),await cn(1,"Run failed")}catch(a){await Hi(),await cn(2,`CLI error: ${a instanceof Error?a.message:String(a)}`)}}),Qd(t),Rd(t),Nd(t),yd(t),yc(t),kd(t),t.addCommand(vu()),t.addCommand(Nu()),ma(t),n&&Cd(t),xu(t),t.command("install <target> [version]").description("Install kane-cli agent skill into Claude Code / Codex CLI / Gemini CLI (version defaults to latest compatible)").action(async(o,r)=>{if(o==="plugin"){let c=r;if(!c){console.error("error: usage: kane-cli install plugin <name>"),M(2,"install plugin: missing name");return}let{installPlugin:u}=await import("./install-KJDAGU2R.js"),g=u(c,{});if(g.status==="failed"){console.error(`error: ${g.error}`),M(/unknown plugin/i.test(g.error??"")?2:1,`install plugin: ${g.status}`);return}let{ensureHyperexecuteBinary:m}=await import("./binary-32FXH6PQ.js"),f=c==="remote-execution"?await m(oe):void 0;process.stdin.isTTY?(process.stderr.write(`${g.status==="already-installed"?"already installed":"installed"} ${g.name}@${g.version} \u2192 ${g.dir}
4233
4233
  `),f&&(f.status==="failed"?process.stderr.write(`\u26A0 hyperexecute binary download failed (${f.error}) \u2014 re-run \`kane-cli install plugin ${g.name}\`
4234
4234
  `):process.stderr.write(`\u2713 hyperexecute binary ${f.status} \u2192 ${f.path}
4235
4235
  `)),process.stderr.write(`run \`kane-cli plugin doctor ${g.name}\` to check readiness for --remote
4236
4236
  `)):process.stdout.write(JSON.stringify({type:"plugin_install_result",status:g.status,name:g.name,version:g.version,dir:g.dir,error:g.error,binary:f})+`
4237
- `),M(0,`install plugin: ${g.status}`);return}if(o!=="skill"){console.error(`error: unknown install target '${o}'. Supported: skill, plugin`),M(2,`unknown install target '${o}'`);return}let{installSkill:a,formatInstallResult:s}=await import("./skill-installer-7PK64TZE.js"),l=await a(r);!process.stdin.isTTY?process.stdout.write(JSON.stringify({type:"skill_install_result",status:l.status,version:l.version,installed_targets:l.installedTargets,error:l.error})+`
4237
+ `),M(0,`install plugin: ${g.status}`);return}if(o!=="skill"){console.error(`error: unknown install target '${o}'. Supported: skill, plugin`),M(2,`unknown install target '${o}'`);return}let{installSkill:a,formatInstallResult:s}=await import("./skill-installer-54ZAFNOB.js"),l=await a(r);!process.stdin.isTTY?process.stdout.write(JSON.stringify({type:"skill_install_result",status:l.status,version:l.version,installed_targets:l.installedTargets,error:l.error})+`
4238
4238
  `):process.stderr.write(s(l)+`
4239
- `),M(l.status==="failed"?1:0,`install skill: ${l.status}`)}),t.command("profiles [action] [name]").description("Manage auth profiles (list | switch | delete)").option("--env <name>","Environment for switch/delete").action(async(o,r,a)=>{let s=new Ae;if(o==="list"||!o&&!process.stdin.isTTY){let u=s.listProfiles();if(u.length===0){console.log("No profiles configured. Run: kane-cli login");return}let g=s.getActiveProfile(),m=s.getDefaultEnv();for(let f of u){let A=f.profile===g&&f.env===m?" (active)":"";console.log(`${f.profile} [${f.env}]${A}`)}return}if(o==="switch"&&r){let u=a?.env??s.getDefaultEnv();s.setActiveProfile(r),s.setDefaultEnv(u),Xt(s,new xe,r,u),console.log(`Switched to ${r} [${u}]`);return}if(o==="delete"&&r){let u=a?.env??s.getDefaultEnv();s.deleteProfileFull(r,u),console.log(`Deleted profile ${r} [${u}]`);return}process.stdin.isTTY||(console.error("Usage: kane-cli profiles list|switch|delete <name> [--env <env>]"),M(1,"Invalid profiles usage"));let{ProfilesView:l}=await import("./ProfilesView-6C5HJQ3Y.js"),{render:d}=await import("./build-5ZN47FAT.js"),c=await import("./react-QWOAB3TB.js");await new Promise(u=>{let{unmount:g}=d(c.default.createElement(l,{creds:s,onSwitch:(m,f)=>{s.setActiveProfile(m),s.setDefaultEnv(f),console.log(`Switched to ${m} [${f}]`)},onCancel:()=>{g(),u()}}))})}),t.command("feedback").description("Send thumbs-up/down feedback for a completed test run").requiredOption("--test-id <id>","Test ID").requiredOption("--feedback-type <type>","Feedback type: positive or negative").option("--details <text>","Feedback details (max 500 characters)").option("--username <user>","Basic auth username").option("--access-key <key>","Basic auth access key").option("--env <name>","Environment (prod or stage)").action(async o=>{o.feedbackType!=="positive"&&o.feedbackType!=="negative"&&(console.error('Error: --feedback-type must be "positive" or "negative"'),M(1,'Invalid --feedback-type (must be "positive" or "negative")')),o.details&&o.details.length>500&&(console.error("Error: --details must be 500 characters or fewer"),M(1,"--details exceeds 500 character limit"));let r=new Ae,a=o.env??r.getDefaultEnv(),s=he(a),l,d;try{let c=await $e({creds:r,env:a,usernameFlag:o.username,accessKeyFlag:o.accessKey,log:()=>{}});l=c.resolvedCreds?.username??c.basicAuth?.username,d=c.resolvedCreds?.access_key??c.basicAuth?.access_key}catch{console.error("Not authenticated. Run: kane-cli login"),Jn("AUTH_NOT_AUTHENTICATED"),M(2,"Not authenticated for feedback")}(!l||!d)&&(console.error(JSON.stringify({error:"Could not resolve TMS credentials"})),M(1,"Could not resolve TMS credentials for feedback"));try{let{TmsClient:c}=await import("./tms-client-J4OCD3EP.js"),g=await new c(s.tmsBaseUrl,l,d).submitFeedback({instruction_id:"",test_id:o.testId,feedback_type:o.feedbackType,details:o.details,mode:"agent"});console.log(JSON.stringify(g)),M(0,"Feedback submitted")}catch(c){console.error(JSON.stringify({error:c instanceof Error?c.message:String(c)})),M(1,`Feedback failed: ${c instanceof Error?c.message:String(c)}`)}}),t.command("balance").description("Check credit balance").option("--profile <name>","Profile name").option("--username <user>","Basic auth username").option("--access-key <key>","Basic auth access key").option("--env <name>","Environment (prod or stage)").action(async o=>{let r=new Ae,a=o.env??r.getDefaultEnv(),s=he(a),l=null;try{let d=await $e({creds:r,env:a,usernameFlag:o.username,accessKeyFlag:o.accessKey,log:()=>{}}),c=d.resolvedCreds??(d.basicAuth?{username:d.basicAuth.username,access_key:d.basicAuth.access_key}:null);c&&(l={username:c.username,accessKey:c.access_key})}catch{console.error(`Not authenticated [${a}]. Run "kane-cli login" first.`),Jn("AUTH_NOT_AUTHENTICATED"),M(2,`Not authenticated for balance [${a}]`)}l||(console.error(`Could not resolve credentials [${a}]. Run "kane-cli login" again.`),Jn("AUTH_NO_CREDENTIALS"),M(2,`Could not resolve credentials for balance [${a}]`));try{let{ControllerClient:d}=await import("./controller-client-PB3AZAGG.js"),u=await new d(s.controllerBaseUrl,l).getCreditBalance();console.log(`Available credits: ${u.available_credits}`),M(0,"Balance retrieved")}catch(d){console.error(`Error: ${d instanceof Error?d.message:String(d)}`),M(1,`Balance check failed: ${d instanceof Error?d.message:String(d)}`)}}),t.command("generate").summary("Generate Test Manager test cases from a prompt").description("Generate Test Manager test cases from a prompt: full screen at a terminal; when piped, or with --agent, --refine or --save, as plain text or JSON lines").argument("[objective]",'Generation prompt (e.g. "checkout flow on staging"). Required for new + --refine; omit for --save.').option("--refine","Refine an existing request with <objective>. Requires --req.").option("--save","Save an existing request to disk. Requires --req; --out optional (defaults to <cwd>/.testmuai/tests). Takes no objective.").option("--req <id>","The request id to --refine or --save.").option("--out <dir>","Save target dir (only with --save; default <cwd>/.testmuai/tests).").option("--agent","Print one JSON event per line (on by itself with no terminal)").option("--name <name>","Name for this generation: sets the session name (like run/testmd) AND the --save suite folder (overrides the auto-derived name)").option("--scenario-limit <n>","Max number of scenarios to generate (1-20)").option("--per-scenario-limit <n>","Max test cases per scenario (1-20)").option("--memory","Enable memory enhancement for generation").option("--project <id>","Test Manager project id (by default, your organisation's or the one set in config)").option("--folder <id>","Test Manager folder id").option("--env <name>","Environment (prod or stage)").option("--username <user>","Basic auth username (skip OAuth)").option("--access-key <key>","Basic auth access key").option("--files <paths>","Comma-separated local files to attach (allowlisted types, \u226450MB each, \u226410; new/refine only)").action(async(o,r)=>{let a=r.scenarioLimit?parseInt(r.scenarioLimit,10):void 0,s=r.perScenarioLimit?parseInt(r.perScenarioLimit,10):void 0,{decideGenerateMode:l,resolveGenerateOp:d,defaultOutDir:c,buildHeadlessDeps:u,runGenerateHeadless:g,parseFilesFlag:m}=await import("./generate-headless-XR3RVULC.js"),f=d({objective:o,refine:r.refine,save:r.save,req:r.req,out:r.out});if("error"in f){process.stderr.write(`error: ${f.error}
4239
+ `),M(l.status==="failed"?1:0,`install skill: ${l.status}`)}),t.command("profiles [action] [name]").description("Manage auth profiles (list | switch | delete)").option("--env <name>","Environment for switch/delete").action(async(o,r,a)=>{let s=new Ae;if(o==="list"||!o&&!process.stdin.isTTY){let u=s.listProfiles();if(u.length===0){console.log("No profiles configured. Run: kane-cli login");return}let g=s.getActiveProfile(),m=s.getDefaultEnv();for(let f of u){let A=f.profile===g&&f.env===m?" (active)":"";console.log(`${f.profile} [${f.env}]${A}`)}return}if(o==="switch"&&r){let u=a?.env??s.getDefaultEnv();s.setActiveProfile(r),s.setDefaultEnv(u),Xt(s,new xe,r,u),console.log(`Switched to ${r} [${u}]`);return}if(o==="delete"&&r){let u=a?.env??s.getDefaultEnv();s.deleteProfileFull(r,u),console.log(`Deleted profile ${r} [${u}]`);return}process.stdin.isTTY||(console.error("Usage: kane-cli profiles list|switch|delete <name> [--env <env>]"),M(1,"Invalid profiles usage"));let{ProfilesView:l}=await import("./ProfilesView-TQTJR4WQ.js"),{render:d}=await import("./build-5ZN47FAT.js"),c=await import("./react-QWOAB3TB.js");await new Promise(u=>{let{unmount:g}=d(c.default.createElement(l,{creds:s,onSwitch:(m,f)=>{s.setActiveProfile(m),s.setDefaultEnv(f),console.log(`Switched to ${m} [${f}]`)},onCancel:()=>{g(),u()}}))})}),t.command("feedback").description("Send thumbs-up/down feedback for a completed test run").requiredOption("--test-id <id>","Test ID").requiredOption("--feedback-type <type>","Feedback type: positive or negative").option("--details <text>","Feedback details (max 500 characters)").option("--username <user>","Basic auth username").option("--access-key <key>","Basic auth access key").option("--env <name>","Environment (prod or stage)").action(async o=>{o.feedbackType!=="positive"&&o.feedbackType!=="negative"&&(console.error('Error: --feedback-type must be "positive" or "negative"'),M(1,'Invalid --feedback-type (must be "positive" or "negative")')),o.details&&o.details.length>500&&(console.error("Error: --details must be 500 characters or fewer"),M(1,"--details exceeds 500 character limit"));let r=new Ae,a=o.env??r.getDefaultEnv(),s=he(a),l,d;try{let c=await $e({creds:r,env:a,usernameFlag:o.username,accessKeyFlag:o.accessKey,log:()=>{}});l=c.resolvedCreds?.username??c.basicAuth?.username,d=c.resolvedCreds?.access_key??c.basicAuth?.access_key}catch{console.error("Not authenticated. Run: kane-cli login"),Jn("AUTH_NOT_AUTHENTICATED"),M(2,"Not authenticated for feedback")}(!l||!d)&&(console.error(JSON.stringify({error:"Could not resolve TMS credentials"})),M(1,"Could not resolve TMS credentials for feedback"));try{let{TmsClient:c}=await import("./tms-client-J4OCD3EP.js"),g=await new c(s.tmsBaseUrl,l,d).submitFeedback({instruction_id:"",test_id:o.testId,feedback_type:o.feedbackType,details:o.details,mode:"agent"});console.log(JSON.stringify(g)),M(0,"Feedback submitted")}catch(c){console.error(JSON.stringify({error:c instanceof Error?c.message:String(c)})),M(1,`Feedback failed: ${c instanceof Error?c.message:String(c)}`)}}),t.command("balance").description("Check credit balance").option("--profile <name>","Profile name").option("--username <user>","Basic auth username").option("--access-key <key>","Basic auth access key").option("--env <name>","Environment (prod or stage)").action(async o=>{let r=new Ae,a=o.env??r.getDefaultEnv(),s=he(a),l=null;try{let d=await $e({creds:r,env:a,usernameFlag:o.username,accessKeyFlag:o.accessKey,log:()=>{}}),c=d.resolvedCreds??(d.basicAuth?{username:d.basicAuth.username,access_key:d.basicAuth.access_key}:null);c&&(l={username:c.username,accessKey:c.access_key})}catch{console.error(`Not authenticated [${a}]. Run "kane-cli login" first.`),Jn("AUTH_NOT_AUTHENTICATED"),M(2,`Not authenticated for balance [${a}]`)}l||(console.error(`Could not resolve credentials [${a}]. Run "kane-cli login" again.`),Jn("AUTH_NO_CREDENTIALS"),M(2,`Could not resolve credentials for balance [${a}]`));try{let{ControllerClient:d}=await import("./controller-client-PB3AZAGG.js"),u=await new d(s.controllerBaseUrl,l).getCreditBalance();console.log(`Available credits: ${u.available_credits}`),M(0,"Balance retrieved")}catch(d){console.error(`Error: ${d instanceof Error?d.message:String(d)}`),M(1,`Balance check failed: ${d instanceof Error?d.message:String(d)}`)}}),t.command("generate").summary("Generate Test Manager test cases from a prompt").description("Generate Test Manager test cases from a prompt: full screen at a terminal; when piped, or with --agent, --refine or --save, as plain text or JSON lines").argument("[objective]",'Generation prompt (e.g. "checkout flow on staging"). Required for new + --refine; omit for --save.').option("--refine","Refine an existing request with <objective>. Requires --req.").option("--save","Save an existing request to disk. Requires --req; --out optional (defaults to <cwd>/.testmuai/tests). Takes no objective.").option("--req <id>","The request id to --refine or --save.").option("--out <dir>","Save target dir (only with --save; default <cwd>/.testmuai/tests).").option("--agent","Print one JSON event per line (on by itself with no terminal)").option("--name <name>","Name for this generation: sets the session name (like run/testmd) AND the --save suite folder (overrides the auto-derived name)").option("--scenario-limit <n>","Max number of scenarios to generate (1-20)").option("--per-scenario-limit <n>","Max test cases per scenario (1-20)").option("--memory","Enable memory enhancement for generation").option("--project <id>","Test Manager project id (by default, your organisation's or the one set in config)").option("--folder <id>","Test Manager folder id").option("--env <name>","Environment (prod or stage)").option("--username <user>","Basic auth username (skip OAuth)").option("--access-key <key>","Basic auth access key").option("--files <paths>","Comma-separated local files to attach (allowlisted types, \u226450MB each, \u226410; new/refine only)").action(async(o,r)=>{let a=r.scenarioLimit?parseInt(r.scenarioLimit,10):void 0,s=r.perScenarioLimit?parseInt(r.perScenarioLimit,10):void 0,{decideGenerateMode:l,resolveGenerateOp:d,defaultOutDir:c,buildHeadlessDeps:u,runGenerateHeadless:g,parseFilesFlag:m}=await import("./generate-headless-VYD2QIUO.js"),f=d({objective:o,refine:r.refine,save:r.save,req:r.req,out:r.out});if("error"in f){process.stderr.write(`error: ${f.error}
4240
4240
  `),M(2,`generate: ${f.error}`);return}let A=f.op,h=m(r.files);if(A==="save"&&h){process.stderr.write(`error: --files is not valid with --save
4241
- `),M(2,"generate: --files not valid with --save");return}let{headless:p,mode:w}=l(r,!!process.stdin.isTTY);if(!p){let{runGenerate:V}=await import("./tcg-generate-VQLI6NGK.js");await V({objective:o,scenarioLimit:a,perScenarioLimit:s});return}let D=await u({mode:w,env:r.env,projectId:r.project,folderId:r.folder,username:r.username,accessKey:r.accessKey,name:r.name}),O=await g({op:A,objective:o,reqId:r.req,outDir:A==="save"?r.out?Ep(process.cwd(),r.out):c():void 0,suiteName:r.name,scenarioLimit:a,perScenarioLimit:s,memory:r.memory,files:h},D);M(O,"generate complete")}),t.command("changelog").description("Show recent release notes").option("--all","Show all releases instead of latest 5").action(async o=>{let{fetchChangelog:r,formatChangelog:a}=await import("./changelog-6L7W76ZH.js"),s=await r({all:o.all});console.log(a(s))}),t.addCommand(Cp()),t.addCommand(bp()),Ls(Zs),Js(t,(o,r)=>Ks({verb:o,mode:r,contextRoot:null,sessionId:Ui()})),Ec(t),t}async function cn(e,n,t={}){return await zs(e,t),M(e,n)}async function St(e){Rc();let n=wp(),t=["node","kane-cli",...e];if(!Dr(e)){n.parse(t);return}let{parseAsAgent:i,streamVerbFor:o}=await import("./agent-parse-CAS45UKA.js"),r=await i(n,t,o(e));r!==null&&process.exit(r)}function bp(){let e=new fn("policy").description("Evidence verdict policies: the metrics they can use, the policies in Test Manager, and creating one. Judge with a stored policy via --policy-id on testmd run, testrun run, evidence verdict and evidence merge."),n="Force NDJSON output (auto-on when stdin or stdout is not a TTY)",t=i=>i.option("--profile <name>","Profile name (default: active)").option("--env <name>","Environment (prod or stage)").option("--username <user>","Basic auth username (skip stored creds)").option("--access-key <key>","Basic auth access key").option("--agent",n);return e.command("metrics-list").description("List every metric a policy can gate on (built-in metrics plus the kane-cli catalog)").option("--pack <target>","list what one pack supports: execution id, sealed .evidence path, or `latest`").option("--env <name>","environment whose kane-cli catalog to list (prod or stage)").option("--agent",n).action(async i=>{let{runPolicyMetricsList:o}=await import("./policy-commands-AOLVAZZD.js"),{isAgentMode:r}=await import("./list-commands-FZPVH76I.js"),{CredentialsManager:a}=await import("./credentials-D5KQMHCK.js"),s=i.env??new a().getDefaultEnv()??"prod";process.exitCode=await o({env:s,pack:i.pack},process.cwd(),{agent:r(i)})}),t(e.command("list").description("List the policies in Test Manager (latest versions) for the profile's project").option("--project <id>","project whose policies to list (default: the profile's project)").option("--all-projects","list every policy in the organization").option("--search <term>","name search").option("--limit <n>","policies per page (1-200, default 10)").option("--page <n>","page number (default 1)")).action(async i=>{let{runPolicyList:o,policyProject:r,policyTmsContext:a}=await import("./policy-commands-AOLVAZZD.js"),{isAgentMode:s}=await import("./list-commands-FZPVH76I.js"),l=await a(i);if(!l)return;let d=s(i);process.exitCode=await o({projectId:r(i.project,l.profileProject,!!i.allProjects),search:i.search,limit:i.limit,page:i.page,agent:d},{client:l.client,agent:d})}),t(e.command("create").description("Lint a policy YAML file and store it in Test Manager (a new version when its policy id already exists)").argument("<file>","policy YAML file").option("--project <id>","project the policy is scoped to (default: the profile's project)")).action(async(i,o)=>{let{runPolicyCreate:r,policyProject:a,policyTmsContext:s}=await import("./policy-commands-AOLVAZZD.js"),{isAgentMode:l}=await import("./list-commands-FZPVH76I.js"),{evidenceCatalogFor:d}=await import("./catalog-client-QLHCEPPZ.js"),c=await s(o);if(!c)return;let u=l(o);process.exitCode=await r(i,{projectId:a(o.project,c.profileProject,!1),catalogYaml:(await d(c.envName)).yaml,agent:u},process.cwd(),{client:c.client,agent:u})}),e}function Cp(){let e=new fn("evidence").description("Evidence pack operations");return e.command("validate").argument("<target>","execution id, pack dir, or sealed .evidence").option("--profile <profile>","L0 | L1","L1").option("--json","machine-readable",!1).action(async(n,t)=>{let{runEvidenceValidate:i}=await import("./evidence-SRWISQMQ.js");process.exitCode=await i(n,{profile:t.profile,json:t.json})}),e.command("lint-policy").description("Check policy YAML files against the policy format and the kane-cli metric catalog").argument("<files...>","policy YAML file(s)").option("--json","machine-readable",!1).option("--env <name>","environment whose metric catalog to check against (prod or stage)").action(async(n,t)=>{let{runEvidenceLintPolicy:i}=await import("./commands-X5T6YANK.js"),{CredentialsManager:o}=await import("./credentials-D5KQMHCK.js"),r=t.env??new o().getDefaultEnv()??"prod";process.exitCode=await i(n,{json:t.json,env:r})}),e.command("verdict").description("Judge a sealed pack against policies; each verdict is written to <pack>.verdicts/<policy-id>.verdict.json (exit 0 pass, 1 fail, 3 errored)").argument("<pack>","execution id, sealed .evidence path, or `latest`").option("--policy <file>","policy YAML to judge against (repeatable)",(n,t)=>t.concat(n),[]).option("--policy-id <id>","Test Manager policy to judge against, latest version (repeatable; see `kane-cli policy list`)",(n,t)=>t.concat(n),[]).option("--json","machine-readable verdict summary and documents",!1).option("--env <name>","environment a --policy-id is read from (prod or stage)").action(async(n,t)=>{let{runEvidenceVerdict:i}=await import("./commands-X5T6YANK.js"),{CredentialsManager:o}=await import("./credentials-D5KQMHCK.js"),r=t.env??new o().getDefaultEnv()??"prod";process.exitCode=await i(n,{policy:t.policy,policyId:t.policyId,json:t.json,env:r})}),e.command("serve").argument("<paths...>","sealed .evidence file(s) to serve to the hosted viewer").option("--port <n>","pin the local port (default: ephemeral)",n=>parseInt(n,10)).option("--viewer-url <base>","override the hosted viewer base URL").option("--env <name>","environment (prod or stage)").action(async(n,t)=>{let{runEvidenceServe:i}=await import("./evidence-SRWISQMQ.js"),{CredentialsManager:o}=await import("./credentials-D5KQMHCK.js"),r=t.env??new o().getDefaultEnv()??"prod";process.exitCode=await i(n,{port:t.port,viewerUrl:t.viewerUrl,env:r})}),e.command("merge").argument("<targets...>","execution ids or pack paths (order-significant)").option("--run-id <id>","run_id for the merged pack (required \u2014 identity is the caller's fact)").option("-o, --out <path>","output path (default: .testmuai/evidence/<run-id>.evidence)").option("--rules <path>","merge-rules.yaml (replaces the kane defaults wholesale)").option("--on-collision <action>","error | prefer-first | prefer-latest | discard").option("--title <title>","merged run title (default: first eligible pack's)").option("--no-finalize","keep the merged pack live instead of sealing it").option("--json","machine-readable MergeReport",!1).option("--env <name>","environment (prod or stage)").option("--policy <file>","judge the sealed merged pack against this policy YAML (repeatable); each verdict is written to <pack>.verdicts/<policy-id>.verdict.json; a failing verdict exits 1, an errored one 3",(n,t)=>t.concat(n),[]).option("--policy-id <id>","judge the sealed merged pack against this Test Manager policy, latest version (repeatable; see `kane-cli policy list`)",(n,t)=>t.concat(n),[]).action(async(n,t)=>{let{runEvidenceMerge:i}=await import("./evidence-SRWISQMQ.js"),{CredentialsManager:o}=await import("./credentials-D5KQMHCK.js"),r=t.env??new o().getDefaultEnv()??"prod";process.exitCode=await i(n,{runId:t.runId,out:t.out,rules:t.rules,onCollision:t.onCollision,title:t.title,finalize:t.finalize,json:t.json,env:r,policy:t.policy,policyId:t.policyId})}),e}function Vu(e){let n,t,i,o=[];for(let r=0;r<e.length;r++){let a=e[r];if(a==="--code-export")n=!0;else if(a==="--skip-code-validation"){let s=e[r+1]?.toLowerCase();s==="true"||s==="false"?(i=s==="true",r++):i=!0}else if(a==="--skip-code-validation=true"||a==="--skip-code-validation=false")i=a.endsWith("=true");else if(a==="--no-skip-code-validation")i=!1;else if(a==="--code-language"){let s=e[r+1];s!==void 0&&(t=s,r++)}else a.startsWith("--code-language=")?t=a.slice(16):o.push(a)}return{codeExport:n,codeLanguage:t,skipCodeValidation:i,filteredArgs:o}}function Fu(e){return e[0]==="run"?!0:e[0]==="context"?e[1]==="ingest"||e[1]==="extract":(e[0]==="testmd"||e[0]==="testrun")&&e[1]==="run"}function Ci(e,n){let t=e[0];if(t!=="run"&&!(t==="testmd"&&e[1]==="run"))return e;let i=[...e];return n.codeExport&&i.push("--code-export"),n.codeLanguage&&i.push("--code-language",n.codeLanguage),n.skipCodeValidation===!0&&i.push("--skip-code-validation"),n.skipCodeValidation===!1&&i.push("--no-skip-code-validation"),i}function Zr(e,n){let t=e.split(".").map(o=>Number(o)||0),i=n.split(".").map(o=>Number(o)||0);for(let o=0;o<3;o++){let r=t[o]??0,a=i[o]??0;if(r<a)return-1;if(r>a)return 1}return 0}var Ip=[{version:"0.2.11",description:"Code export is now enabled by default (Python remains the default language; JavaScript is also available). Default run mode is now 'testing'.",apply:e=>{let n=[];return e.code_export.enabled===!1&&n.push({field:"code_export.enabled",from:!1,to:!0,description:"Code export is now enabled by default."}),e.mode==="action"&&n.push({field:"mode",from:"action",to:"testing",description:"Default run mode is now 'testing'."}),{cfg:{...e,code_export:{...e.code_export,enabled:!0},mode:"testing"},changes:n}}},{version:"0.5.1",description:"Assertions now read the DOM first (falling back to vision when the value isn't in the DOM). Default assertion mode is now 'dom'.",apply:e=>{let n=[];return e.assertion_mode==="visual"&&n.push({field:"assertion_mode",from:"visual",to:"dom",description:"Default assertion mode is now 'dom' (DOM-first, vision fallback)."}),{cfg:{...e,assertion_mode:"dom"},changes:n}}}];function Gu(e,n=De,t=Ip){let i=e.exists(),o=e.load();if(!i)return e.set("last_seen_version",n),{changes:[],fromVersion:n,toVersion:n,appliedVersions:[]};let r=o.last_seen_version||"0.0.0";if(Zr(r,n)>=0)return{changes:[],fromVersion:r,toVersion:r,appliedVersions:[]};let a=t.filter(u=>Zr(r,u.version)<0&&Zr(u.version,n)<=0).sort((u,g)=>Zr(u.version,g.version)),s=o,l=[],d=[];for(let u of a){let{cfg:g,changes:m}=u.apply(s);s=g,l.push(...m),d.push(u.version)}let c={...s,last_seen_version:n};return e.writeRaw(c),{changes:l,fromVersion:r,toVersion:n,appliedVersions:d}}function Uu(e){return e.changes.length===0?"":[`kane-cli updated to ${e.toVersion}. Default settings changed:`,...e.changes.map(t=>` \u2022 ${t.description} (${t.field}: ${JSON.stringify(t.from)} \u2192 ${JSON.stringify(t.to)})`),"","Use /config to review or revert any of these."].join(`
4241
+ `),M(2,"generate: --files not valid with --save");return}let{headless:p,mode:w}=l(r,!!process.stdin.isTTY);if(!p){let{runGenerate:V}=await import("./tcg-generate-OXZF7TNQ.js");await V({objective:o,scenarioLimit:a,perScenarioLimit:s});return}let D=await u({mode:w,env:r.env,projectId:r.project,folderId:r.folder,username:r.username,accessKey:r.accessKey,name:r.name}),O=await g({op:A,objective:o,reqId:r.req,outDir:A==="save"?r.out?Ep(process.cwd(),r.out):c():void 0,suiteName:r.name,scenarioLimit:a,perScenarioLimit:s,memory:r.memory,files:h},D);M(O,"generate complete")}),t.command("changelog").description("Show recent release notes").option("--all","Show all releases instead of latest 5").action(async o=>{let{fetchChangelog:r,formatChangelog:a}=await import("./changelog-GKIKDJ32.js"),s=await r({all:o.all});console.log(a(s))}),t.addCommand(Cp()),t.addCommand(bp()),Ls(Zs),Js(t,(o,r)=>Ks({verb:o,mode:r,contextRoot:null,sessionId:Ui()})),Ec(t),t}async function cn(e,n,t={}){return await zs(e,t),M(e,n)}async function St(e){Rc();let n=wp(),t=["node","kane-cli",...e];if(!Dr(e)){n.parse(t);return}let{parseAsAgent:i,streamVerbFor:o}=await import("./agent-parse-CAS45UKA.js"),r=await i(n,t,o(e));r!==null&&process.exit(r)}function bp(){let e=new fn("policy").description("Evidence verdict policies: the metrics they can use, the policies in Test Manager, and creating one. Judge with a stored policy via --policy-id on testmd run, testrun run, evidence verdict and evidence merge."),n="Force NDJSON output (auto-on when stdin or stdout is not a TTY)",t=i=>i.option("--profile <name>","Profile name (default: active)").option("--env <name>","Environment (prod or stage)").option("--username <user>","Basic auth username (skip stored creds)").option("--access-key <key>","Basic auth access key").option("--agent",n);return e.command("metrics-list").description("List every metric a policy can gate on (built-in metrics plus the kane-cli catalog)").option("--pack <target>","list what one pack supports: execution id, sealed .evidence path, or `latest`").option("--env <name>","environment whose kane-cli catalog to list (prod or stage)").option("--agent",n).action(async i=>{let{runPolicyMetricsList:o}=await import("./policy-commands-MSJIPHDB.js"),{isAgentMode:r}=await import("./list-commands-QFTIQE6Q.js"),{CredentialsManager:a}=await import("./credentials-NNNODDXF.js"),s=i.env??new a().getDefaultEnv()??"prod";process.exitCode=await o({env:s,pack:i.pack},process.cwd(),{agent:r(i)})}),t(e.command("list").description("List the policies in Test Manager (latest versions) for the profile's project").option("--project <id>","project whose policies to list (default: the profile's project)").option("--all-projects","list every policy in the organization").option("--search <term>","name search").option("--limit <n>","policies per page (1-200, default 10)").option("--page <n>","page number (default 1)")).action(async i=>{let{runPolicyList:o,policyProject:r,policyTmsContext:a}=await import("./policy-commands-MSJIPHDB.js"),{isAgentMode:s}=await import("./list-commands-QFTIQE6Q.js"),l=await a(i);if(!l)return;let d=s(i);process.exitCode=await o({projectId:r(i.project,l.profileProject,!!i.allProjects),search:i.search,limit:i.limit,page:i.page,agent:d},{client:l.client,agent:d})}),t(e.command("create").description("Lint a policy YAML file and store it in Test Manager (a new version when its policy id already exists)").argument("<file>","policy YAML file").option("--project <id>","project the policy is scoped to (default: the profile's project)")).action(async(i,o)=>{let{runPolicyCreate:r,policyProject:a,policyTmsContext:s}=await import("./policy-commands-MSJIPHDB.js"),{isAgentMode:l}=await import("./list-commands-QFTIQE6Q.js"),{evidenceCatalogFor:d}=await import("./catalog-client-LR2KPSU7.js"),c=await s(o);if(!c)return;let u=l(o);process.exitCode=await r(i,{projectId:a(o.project,c.profileProject,!1),catalogYaml:(await d(c.envName)).yaml,agent:u},process.cwd(),{client:c.client,agent:u})}),e}function Cp(){let e=new fn("evidence").description("Evidence pack operations");return e.command("validate").argument("<target>","execution id, pack dir, or sealed .evidence").option("--profile <profile>","L0 | L1","L1").option("--json","machine-readable",!1).action(async(n,t)=>{let{runEvidenceValidate:i}=await import("./evidence-FOWW3MOS.js");process.exitCode=await i(n,{profile:t.profile,json:t.json})}),e.command("lint-policy").description("Check policy YAML files against the policy format and the kane-cli metric catalog").argument("<files...>","policy YAML file(s)").option("--json","machine-readable",!1).option("--env <name>","environment whose metric catalog to check against (prod or stage)").action(async(n,t)=>{let{runEvidenceLintPolicy:i}=await import("./commands-TRAUFCRZ.js"),{CredentialsManager:o}=await import("./credentials-NNNODDXF.js"),r=t.env??new o().getDefaultEnv()??"prod";process.exitCode=await i(n,{json:t.json,env:r})}),e.command("verdict").description("Judge a sealed pack against policies; each verdict is written to <pack>.verdicts/<policy-id>.verdict.json (exit 0 pass, 1 fail, 3 errored)").argument("<pack>","execution id, sealed .evidence path, or `latest`").option("--policy <file>","policy YAML to judge against (repeatable)",(n,t)=>t.concat(n),[]).option("--policy-id <id>","Test Manager policy to judge against, latest version (repeatable; see `kane-cli policy list`)",(n,t)=>t.concat(n),[]).option("--json","machine-readable verdict summary and documents",!1).option("--env <name>","environment a --policy-id is read from (prod or stage)").action(async(n,t)=>{let{runEvidenceVerdict:i}=await import("./commands-TRAUFCRZ.js"),{CredentialsManager:o}=await import("./credentials-NNNODDXF.js"),r=t.env??new o().getDefaultEnv()??"prod";process.exitCode=await i(n,{policy:t.policy,policyId:t.policyId,json:t.json,env:r})}),e.command("serve").argument("<paths...>","sealed .evidence file(s) to serve to the hosted viewer").option("--port <n>","pin the local port (default: ephemeral)",n=>parseInt(n,10)).option("--viewer-url <base>","override the hosted viewer base URL").option("--env <name>","environment (prod or stage)").action(async(n,t)=>{let{runEvidenceServe:i}=await import("./evidence-FOWW3MOS.js"),{CredentialsManager:o}=await import("./credentials-NNNODDXF.js"),r=t.env??new o().getDefaultEnv()??"prod";process.exitCode=await i(n,{port:t.port,viewerUrl:t.viewerUrl,env:r})}),e.command("merge").argument("<targets...>","execution ids or pack paths (order-significant)").option("--run-id <id>","run_id for the merged pack (required \u2014 identity is the caller's fact)").option("-o, --out <path>","output path (default: .testmuai/evidence/<run-id>.evidence)").option("--rules <path>","merge-rules.yaml (replaces the kane defaults wholesale)").option("--on-collision <action>","error | prefer-first | prefer-latest | discard").option("--title <title>","merged run title (default: first eligible pack's)").option("--no-finalize","keep the merged pack live instead of sealing it").option("--json","machine-readable MergeReport",!1).option("--env <name>","environment (prod or stage)").option("--policy <file>","judge the sealed merged pack against this policy YAML (repeatable); each verdict is written to <pack>.verdicts/<policy-id>.verdict.json; a failing verdict exits 1, an errored one 3",(n,t)=>t.concat(n),[]).option("--policy-id <id>","judge the sealed merged pack against this Test Manager policy, latest version (repeatable; see `kane-cli policy list`)",(n,t)=>t.concat(n),[]).action(async(n,t)=>{let{runEvidenceMerge:i}=await import("./evidence-FOWW3MOS.js"),{CredentialsManager:o}=await import("./credentials-NNNODDXF.js"),r=t.env??new o().getDefaultEnv()??"prod";process.exitCode=await i(n,{runId:t.runId,out:t.out,rules:t.rules,onCollision:t.onCollision,title:t.title,finalize:t.finalize,json:t.json,env:r,policy:t.policy,policyId:t.policyId})}),e}function Vu(e){let n,t,i,o=[];for(let r=0;r<e.length;r++){let a=e[r];if(a==="--code-export")n=!0;else if(a==="--skip-code-validation"){let s=e[r+1]?.toLowerCase();s==="true"||s==="false"?(i=s==="true",r++):i=!0}else if(a==="--skip-code-validation=true"||a==="--skip-code-validation=false")i=a.endsWith("=true");else if(a==="--no-skip-code-validation")i=!1;else if(a==="--code-language"){let s=e[r+1];s!==void 0&&(t=s,r++)}else a.startsWith("--code-language=")?t=a.slice(16):o.push(a)}return{codeExport:n,codeLanguage:t,skipCodeValidation:i,filteredArgs:o}}function Fu(e){return e[0]==="run"?!0:e[0]==="context"?e[1]==="ingest"||e[1]==="extract":(e[0]==="testmd"||e[0]==="testrun")&&e[1]==="run"}function Ci(e,n){let t=e[0];if(t!=="run"&&!(t==="testmd"&&e[1]==="run"))return e;let i=[...e];return n.codeExport&&i.push("--code-export"),n.codeLanguage&&i.push("--code-language",n.codeLanguage),n.skipCodeValidation===!0&&i.push("--skip-code-validation"),n.skipCodeValidation===!1&&i.push("--no-skip-code-validation"),i}function Zr(e,n){let t=e.split(".").map(o=>Number(o)||0),i=n.split(".").map(o=>Number(o)||0);for(let o=0;o<3;o++){let r=t[o]??0,a=i[o]??0;if(r<a)return-1;if(r>a)return 1}return 0}var Ip=[{version:"0.2.11",description:"Code export is now enabled by default (Python remains the default language; JavaScript is also available). Default run mode is now 'testing'.",apply:e=>{let n=[];return e.code_export.enabled===!1&&n.push({field:"code_export.enabled",from:!1,to:!0,description:"Code export is now enabled by default."}),e.mode==="action"&&n.push({field:"mode",from:"action",to:"testing",description:"Default run mode is now 'testing'."}),{cfg:{...e,code_export:{...e.code_export,enabled:!0},mode:"testing"},changes:n}}},{version:"0.5.1",description:"Assertions now read the DOM first (falling back to vision when the value isn't in the DOM). Default assertion mode is now 'dom'.",apply:e=>{let n=[];return e.assertion_mode==="visual"&&n.push({field:"assertion_mode",from:"visual",to:"dom",description:"Default assertion mode is now 'dom' (DOM-first, vision fallback)."}),{cfg:{...e,assertion_mode:"dom"},changes:n}}}];function Gu(e,n=De,t=Ip){let i=e.exists(),o=e.load();if(!i)return e.set("last_seen_version",n),{changes:[],fromVersion:n,toVersion:n,appliedVersions:[]};let r=o.last_seen_version||"0.0.0";if(Zr(r,n)>=0)return{changes:[],fromVersion:r,toVersion:r,appliedVersions:[]};let a=t.filter(u=>Zr(r,u.version)<0&&Zr(u.version,n)<=0).sort((u,g)=>Zr(u.version,g.version)),s=o,l=[],d=[];for(let u of a){let{cfg:g,changes:m}=u.apply(s);s=g,l.push(...m),d.push(u.version)}let c={...s,last_seen_version:n};return e.writeRaw(c),{changes:l,fromVersion:r,toVersion:n,appliedVersions:d}}function Uu(e){return e.changes.length===0?"":[`kane-cli updated to ${e.toVersion}. Default settings changed:`,...e.changes.map(t=>` \u2022 ${t.description} (${t.field}: ${JSON.stringify(t.from)} \u2192 ${JSON.stringify(t.to)})`),"","Use /config to review or revert any of these."].join(`
4242
4242
  `)}zi();Ea(De);sd();var Mp=$c();!pe.env.SSL_CERT_FILE&&!pe.env.SSL_CERT_DIR&&Fi(od(Mp));var Yu=ar().catch(()=>null),Bp=br().catch(()=>null);Ma(void 0,Yi);var Kr=null,vi=()=>Kr||(Kr=Gu(new xe),Kr),qr=pe.argv.slice(2),Dp=qr.includes("--dev"),Ii=qr.includes("--local"),vp=qr.includes("--tui");Dp&&(pe.env.KANE_DEV_MODE="1");var Tp=qr.filter(e=>!["--dev","--local","--tui"].includes(e));function Sp(e){let n=[],t;for(let i=0;i<e.length;i++){let o=e[i];if(o==="--name"&&i+1<e.length){t=e[i+1],i++;continue}if(o.startsWith("--name=")){t=o.slice(7);continue}n.push(o)}return{name:t,rest:n}}var _r=Vu(Tp),Xe=_r.filteredArgs,Mi=_r.codeExport,Bi=_r.codeLanguage,Di=_r.skipCodeValidation,Xr=Td([{promise:Yu,line:e=>{let n=e;return`
4243
4243
  Update available: ${n.current} \u2192 ${n.latest} \u2014 run \`${Da()}\` to update
4244
4244
 
@@ -4248,7 +4248,7 @@ Update available: ${n.current} \u2192 ${n.latest} \u2014 run \`${Da()}\` to upda
4248
4248
  ${e}
4249
4249
 
4250
4250
  `)},Qp=new Set(["--help","-h","--version","-V"]),Rp=Xe[0]==="help"||Xe.some(e=>Qp.has(e));if(Rp)St(Xe);else if(vp){pe.stdin.isTTY||(pe.stderr.write(`Error: --tui mode requires an interactive terminal (TTY).
4251
- `),pe.exit(1)),ju();{let{beginCommandSpan:i,setCommandBootstrap:o,setCommandStartHook:r}=await import("./command-span-HZSKIZH7.js"),{replaySpoolEarly:a,telemetryBootstrap:s}=await import("./bootstrap-BV7HAARR.js");r(a);let{supportId:l}=await import("./support-id-RISKXA53.js");o((d,c)=>s({verb:d,mode:c,contextRoot:null,sessionId:l()})),i("tui","interactive")}let{name:e}=Sp(Xe);if(e){let{validateNameOrThrow:i}=await import("./name-validator-5YGJXLZ7.js");try{i(e)}catch(o){pe.stderr.write(`error: ${o.message}
4251
+ `),pe.exit(1)),ju();{let{beginCommandSpan:i,setCommandBootstrap:o,setCommandStartHook:r}=await import("./command-span-HZSKIZH7.js"),{replaySpoolEarly:a,telemetryBootstrap:s}=await import("./bootstrap-A2O4UZUJ.js");r(a);let{supportId:l}=await import("./support-id-RISKXA53.js");o((d,c)=>s({verb:d,mode:c,contextRoot:null,sessionId:l()})),i("tui","interactive")}let{name:e}=Sp(Xe);if(e){let{validateNameOrThrow:i}=await import("./name-validator-5YGJXLZ7.js");try{i(e)}catch(o){pe.stderr.write(`error: ${o.message}
4252
4252
  `),pe.exit(2)}}let{waitUntilExit:n,unmount:t}=In(Fn.default.createElement(Mn,null,Fn.default.createElement(Ct,null,Fn.default.createElement(Sc,{localMode:Ii,codeExport:Mi,codeLanguage:Bi,skipCodeValidation:Di,updatePromise:Yu,migrationResult:vi(),sessionName:e}))),{exitOnCtrlC:!1});dt(()=>t()),go(()=>{try{pe.stdin.setRawMode?.(!1)}catch{}pe.stdout.write("\x1B[?25h")}),n().then(()=>{M(0,"TUI session ended")})}else if(Xe.length>0){let e=Xe[0],n=Ot(),t=Uo(n).has(e),i=e.startsWith("-");if(!t&&!i){let{message:l,exitCode:d}=Bd(e,{hostSupportsMobile:n,mobileMessage:Yt()});pe.stderr.write(l),pe.exit(d)}if(Dr(Xe))Xr.silence(),vi();else{let l=e==="explore"&&vd(Xe,{stdin:!!pe.stdin.isTTY,stdout:!!pe.stdout.isTTY}),d=Sd(e,!1,l);d==="silence"?Xr.silence():d==="bounded"?await Xr.bounded():ju(),Ou()}let a=Ii&&Fu(Xe)?[...Xe,"--local"]:Xe,s=Ci(a,{codeExport:Mi,codeLanguage:Bi,skipCodeValidation:Di});await St(s)}else{pe.stdin.isTTY||(pe.stderr.write(`Error: kane-cli requires an interactive terminal (TTY) when run without arguments.
4253
4253
  Usage: kane-cli "objective" for non-interactive mode.
4254
4254
  `),pe.exit(1));let e={current:null},{waitUntilExit:n,unmount:t}=In(Fn.default.createElement(Mn,null,Fn.default.createElement(Ct,null,Fn.default.createElement(Pa,{resultRef:e}))),{exitOnCtrlC:!1});dt(()=>t()),go(()=>{try{pe.stdin.setRawMode?.(!1)}catch{}pe.stdout.write("\x1B[?25h")}),n().then(()=>{Li();let i=e.current;if(!i){M(0,"Single-shot session ended (no objective)");return}let o=i.objective.trim();if(o==="--help"||o==="-h"||o==="help"){St(["--help"]);return}Ou();let r=["run",i.objective];Ii&&r.push("--local"),St(Ci(r,{codeExport:Mi,codeLanguage:Bi,skipCodeValidation:Di}))})}