@runcofactor/cli 0.55.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-RHHS7HT4.js → account-CZYZD2JS.js} +5 -5
- package/dist/{alert-B5WEOKHP.js → alert-JQ4SDEB7.js} +8 -8
- package/dist/{api-catalog-UXONX3BR.js → api-catalog-IWQC35P2.js} +5 -5
- package/dist/{api-key-J3A4TJKN.js → api-key-GUDXIIEA.js} +5 -5
- package/dist/{attachment-ZQW7DR4G.js → attachment-CPZYOBUB.js} +5 -5
- package/dist/{auth-HQGKUZBS.js → auth-DS6MBVEI.js} +3 -3
- package/dist/{benchmark-TIKJA32J.js → benchmark-6HPCIQHD.js} +5 -5
- package/dist/{blackcat-Z5LNV2GS.js → blackcat-V3L63WFE.js} +3 -3
- package/dist/{chunk-JQG3V5E3.js → chunk-2E3STBHS.js} +2 -2
- package/dist/{chunk-KL2ARGH6.js → chunk-2OHYMT3A.js} +3 -3
- package/dist/{chunk-KL2ARGH6.js.map → chunk-2OHYMT3A.js.map} +1 -1
- package/dist/{chunk-W6DL4IP6.js → chunk-3LGCHNBC.js} +2 -2
- package/dist/{chunk-BJHAVM7Z.js → chunk-4MFMPC5P.js} +46 -2
- package/dist/chunk-4MFMPC5P.js.map +1 -0
- package/dist/{chunk-MB4FS35J.js → chunk-56HFZHQM.js} +8 -8
- package/dist/{chunk-CZDQVQ57.js → chunk-5OYWNS6D.js} +20 -9
- package/dist/chunk-5OYWNS6D.js.map +1 -0
- package/dist/{chunk-YTXZUWMN.js → chunk-62EXS76C.js} +6 -6
- package/dist/{chunk-QVMGXMP5.js → chunk-6ILWJFKY.js} +368 -6
- package/dist/chunk-6ILWJFKY.js.map +1 -0
- package/dist/{chunk-6X6ZTDXP.js → chunk-BDOL622T.js} +4 -4
- package/dist/{chunk-L4JQ236V.js → chunk-C3CXVX2B.js} +4 -4
- package/dist/{chunk-33U56YGD.js → chunk-CWICLBLU.js} +2 -1
- package/dist/{chunk-33U56YGD.js.map → chunk-CWICLBLU.js.map} +1 -1
- package/dist/{chunk-XM3WTJ7Y.js → chunk-DEVD2WD2.js} +2 -2
- package/dist/{chunk-WWUEKQLR.js → chunk-EWK44F6V.js} +3 -3
- package/dist/chunk-EWK44F6V.js.map +1 -0
- package/dist/{chunk-CQSQNDMV.js → chunk-FNHPTTRF.js} +7 -5
- package/dist/chunk-FNHPTTRF.js.map +1 -0
- package/dist/{chunk-Z72GWGH2.js → chunk-GCD4EHCD.js} +6 -6
- package/dist/{chunk-3KBYI6RR.js → chunk-H6ZMKNP7.js} +3 -3
- package/dist/{chunk-5OKCT6LF.js → chunk-IEWAH7W3.js} +5 -5
- package/dist/{chunk-TGI2AAOZ.js → chunk-IV4HRGKX.js} +77 -12
- package/dist/chunk-IV4HRGKX.js.map +1 -0
- package/dist/{chunk-635IQV6B.js → chunk-J2ZQULU3.js} +2 -2
- package/dist/{chunk-ZZZ33KTO.js → chunk-K2IDR6FR.js} +3 -3
- package/dist/{chunk-YEH7UIUY.js → chunk-KTZRI27M.js} +4 -4
- package/dist/{chunk-RV7FZ4ID.js → chunk-L644NMDI.js} +3 -3
- package/dist/{chunk-RV7FZ4ID.js.map → chunk-L644NMDI.js.map} +1 -1
- package/dist/{chunk-3TZABC7D.js → chunk-LFT7GUWS.js} +63 -17
- package/dist/chunk-LFT7GUWS.js.map +1 -0
- package/dist/{chunk-QHRWXCON.js → chunk-O7B2IYCZ.js} +11 -11
- package/dist/chunk-O7B2IYCZ.js.map +1 -0
- package/dist/{chunk-U3MRXQZS.js → chunk-RHWPZKRV.js} +24 -1
- package/dist/chunk-RHWPZKRV.js.map +1 -0
- package/dist/{chunk-OU4I3MEH.js → chunk-UJSW72LG.js} +3 -3
- package/dist/{chunk-R2CRH6JQ.js → chunk-VACACCD6.js} +3 -3
- package/dist/{chunk-EGWVL5XA.js → chunk-VMAR67FF.js} +2 -2
- package/dist/{chunk-ZH7HWVEE.js → chunk-VMJ7TBVM.js} +2 -2
- package/dist/chunk-WRRA4ATV.js +332 -0
- package/dist/chunk-WRRA4ATV.js.map +1 -0
- package/dist/{chunk-XWJJYZQC.js → chunk-XHEVDABB.js} +2 -2
- package/dist/{chunk-SCQVBLNR.js → chunk-XHGF6VC6.js} +4 -4
- package/dist/{credential-2IEZDTH3.js → credential-GJW7LGYP.js} +5 -5
- package/dist/{credential-template-S5WSOI3P.js → credential-template-UWBYKKWD.js} +5 -5
- package/dist/dev-PBW7BSOD.js +605 -0
- package/dist/dev-PBW7BSOD.js.map +1 -0
- package/dist/{digest-HQGL7H6E.js → digest-XEHGCJM4.js} +8 -8
- package/dist/{docs-CJQZVERZ.js → docs-KH4BCEQF.js} +5 -5
- package/dist/{doctor-EGK5AB77.js → doctor-FOXXE5SK.js} +3 -3
- package/dist/{environment-MWVXYEDU.js → environment-EBDPQTIS.js} +7 -7
- package/dist/{eval-F4NORBQI.js → eval-QZSSEICV.js} +67 -27
- package/dist/eval-QZSSEICV.js.map +1 -0
- package/dist/{exploration-JC7R7KTJ.js → exploration-LCGKRGOQ.js} +5 -5
- package/dist/{exploratory-test-BHK5FTMJ.js → exploratory-test-SGECQGIX.js} +6 -6
- package/dist/{external-run-UL5CKG54.js → external-run-2AJAI5O7.js} +9 -9
- package/dist/{feature-flag-NMO25TZN.js → feature-flag-P7N4WQIH.js} +5 -5
- package/dist/{feedback-3JNPSUXS.js → feedback-LAT7TQ2T.js} +6 -6
- package/dist/{flow-AYE4RTZN.js → flow-NH2DC6AP.js} +5 -5
- package/dist/{github-DM2DCXRY.js → github-FCEKBLXI.js} +6 -6
- package/dist/index.js +106 -408
- package/dist/index.js.map +1 -1
- package/dist/{init-CPDT5XAU.js → init-5U5EZOAW.js} +5 -5
- package/dist/{install-JZRNCHMO.js → install-X3UNVXKY.js} +5 -5
- package/dist/{issues-GRFJB52C.js → issues-4P6I3YQW.js} +8 -8
- package/dist/{knobs-3Y4QXWAD.js → knobs-JKTWJ6ZG.js} +5 -5
- package/dist/{landing-ABYL5WVG.js → landing-6AGLKI66.js} +7 -7
- package/dist/{list-WG5QB4NK.js → list-TWP2RP33.js} +5 -5
- package/dist/{local-KX24OR5Z.js → local-D75QE5TB.js} +7 -7
- package/dist/{login-MLJQAIFK.js → login-RBET4TIP.js} +5 -5
- package/dist/{mcp-DDTO54XD.js → mcp-562SUUMK.js} +11 -11
- package/dist/{metrics-BJLLOSPQ.js → metrics-4WF2GEPA.js} +5 -5
- package/dist/{monitor-E2CKGHPM.js → monitor-WJXH54H2.js} +5 -5
- package/dist/{perf-IX7JOMUE.js → perf-C6N6P7YG.js} +12 -361
- package/dist/perf-C6N6P7YG.js.map +1 -0
- package/dist/{product-2ECWM2JN.js → product-CYEQ7HOB.js} +5 -5
- package/dist/{product-map-O542LZQL.js → product-map-MSDLIFZY.js} +7 -7
- package/dist/{prompts-Y7O4XJ5P.js → prompts-ME53WPN4.js} +5 -5
- package/dist/{proofs-TNOBLSRP.js → proofs-D3G6ZUFP.js} +11 -9
- package/dist/{property-TZCGOZQG.js → property-5GLJNAVB.js} +29 -10
- package/dist/property-5GLJNAVB.js.map +1 -0
- package/dist/{psql-M66YSUXW.js → psql-EXAUDU3W.js} +5 -5
- package/dist/{record-3JINBRAR.js → record-EE7NGNKY.js} +6 -6
- package/dist/{redis-FOIBINYA.js → redis-M4EYWKOJ.js} +5 -5
- package/dist/{release-B4VWMVEI.js → release-4KUWVWWC.js} +5 -5
- package/dist/{runbook-EYMSE37E.js → runbook-AHU77ANQ.js} +5 -5
- package/dist/{sandbox-R6EMGOKR.js → sandbox-FBLJEYA2.js} +1910 -1629
- package/dist/sandbox-FBLJEYA2.js.map +1 -0
- package/dist/{scenarios-W7YNLBVO.js → scenarios-TU656T2B.js} +5 -5
- package/dist/{schedule-EDHQJUUZ.js → schedule-DXJI6SYO.js} +8 -8
- package/dist/{session-4N62APNQ.js → session-RUFTJHF4.js} +10 -10
- package/dist/{skill-XFGMNOVM.js → skill-ZK76GQ47.js} +7 -7
- package/dist/{skill-XFGMNOVM.js.map → skill-ZK76GQ47.js.map} +1 -1
- package/dist/skills/cofactor-debug-run/SKILL.md +2 -1
- package/dist/skills/cofactor-debug-run/history/2.0.10.md +320 -0
- package/dist/skills/cofactor-debug-run/version.json +1 -1
- package/dist/{slack-RUAXG6TB.js → slack-M3OKDVMY.js} +6 -6
- package/dist/{spec-ZZKMW7ER.js → spec-5MXEBLYR.js} +5 -5
- package/dist/{src-OKSAEHQS.js → src-2X5OQRPJ.js} +4 -4
- package/dist/{src-DGIVA22K.js → src-72EFBA2R.js} +3 -3
- package/dist/{src-ECZWYNSV.js → src-KH6WSBJV.js} +5 -5
- package/dist/{src-CQ2YAW7F.js → src-VLV36QYH.js} +127 -20
- package/dist/src-VLV36QYH.js.map +1 -0
- package/dist/{start-OCZGILRL.js → start-PDYBRB5T.js} +5 -5
- package/dist/{status-YTJ6YITG.js → status-VMVPVCDA.js} +5 -5
- package/dist/{tag-KBG4SWRL.js → tag-7KTDLPVU.js} +6 -6
- package/dist/{task-O6XRMHYE.js → task-QLFYZNKR.js} +6 -6
- package/dist/{teams-NFUHS7XI.js → teams-Y7BXCY6P.js} +7 -7
- package/dist/{test-suite-6BH3DESN.js → test-suite-6U22AYFG.js} +15 -14
- package/dist/test-suite-6U22AYFG.js.map +1 -0
- package/dist/{tickets-JU2STK4B.js → tickets-CQDJDNPY.js} +5 -5
- package/dist/{trace-NMSGKASJ.js → trace-QDORWXYX.js} +8 -8
- package/dist/{triage-JGECJJU5.js → triage-GY7M3UGG.js} +6 -6
- package/dist/{trigger-OSPEVCCQ.js → trigger-DLFAORX4.js} +9 -9
- package/dist/{update-check-FNP6RFZO.js → update-check-ES6XQ7OF.js} +4 -4
- package/dist/{upgrade-3PPBXFAT.js → upgrade-WKEOW5GS.js} +5 -5
- package/dist/{usage-QMCU2JIO.js → usage-E6FDTR3W.js} +7 -7
- package/dist/{utilities-7VHWTSJT.js → utilities-4Z6YX3L5.js} +6 -6
- package/dist/{visual-WIZSPTVK.js → visual-TA6LPVDJ.js} +5 -5
- package/dist/{workflow-23HKTJLS.js → workflow-B5FXS2CJ.js} +58 -31
- package/dist/workflow-B5FXS2CJ.js.map +1 -0
- package/dist/{workflow-cache-ACGM3BOI.js → workflow-cache-MNLEMRMM.js} +16 -16
- package/dist/{workflow-cache-convergence-resolve-KEQDQMKL.js → workflow-cache-convergence-resolve-G5HJM6MF.js} +5 -5
- package/dist/{workflow-debug-TVLBNRCB.js → workflow-debug-TNBUGSBK.js} +11 -11
- package/dist/{workflow-feedback-GB5VPGE2.js → workflow-feedback-G2ZXAUGI.js} +5 -5
- package/dist/{workflow-fork-2IPJNR76.js → workflow-fork-6HHOMC2D.js} +5 -5
- package/dist/{workflow-promotion-QEQUXVUT.js → workflow-promotion-RG7L6JZT.js} +5 -5
- package/dist/{workflow-proposals-KHGTPMD4.js → workflow-proposals-ZNF2F3UE.js} +5 -5
- package/dist/{workflow-revisions-F5KQEEXB.js → workflow-revisions-TP64Z6FO.js} +5 -5
- package/dist/{workflow-status-66HC5MEA.js → workflow-status-5RG3JX56.js} +5 -5
- package/package.json +3 -2
- package/dist/chunk-3TZABC7D.js.map +0 -1
- package/dist/chunk-BJHAVM7Z.js.map +0 -1
- package/dist/chunk-CQSQNDMV.js.map +0 -1
- package/dist/chunk-CZDQVQ57.js.map +0 -1
- package/dist/chunk-QHRWXCON.js.map +0 -1
- package/dist/chunk-QVMGXMP5.js.map +0 -1
- package/dist/chunk-TGI2AAOZ.js.map +0 -1
- package/dist/chunk-U3MRXQZS.js.map +0 -1
- package/dist/chunk-WWUEKQLR.js.map +0 -1
- package/dist/eval-F4NORBQI.js.map +0 -1
- package/dist/perf-IX7JOMUE.js.map +0 -1
- package/dist/property-TZCGOZQG.js.map +0 -1
- package/dist/sandbox-R6EMGOKR.js.map +0 -1
- package/dist/src-CQ2YAW7F.js.map +0 -1
- package/dist/test-suite-6BH3DESN.js.map +0 -1
- package/dist/workflow-23HKTJLS.js.map +0 -1
- /package/dist/{account-RHHS7HT4.js.map → account-CZYZD2JS.js.map} +0 -0
- /package/dist/{alert-B5WEOKHP.js.map → alert-JQ4SDEB7.js.map} +0 -0
- /package/dist/{api-catalog-UXONX3BR.js.map → api-catalog-IWQC35P2.js.map} +0 -0
- /package/dist/{api-key-J3A4TJKN.js.map → api-key-GUDXIIEA.js.map} +0 -0
- /package/dist/{attachment-ZQW7DR4G.js.map → attachment-CPZYOBUB.js.map} +0 -0
- /package/dist/{auth-HQGKUZBS.js.map → auth-DS6MBVEI.js.map} +0 -0
- /package/dist/{benchmark-TIKJA32J.js.map → benchmark-6HPCIQHD.js.map} +0 -0
- /package/dist/{blackcat-Z5LNV2GS.js.map → blackcat-V3L63WFE.js.map} +0 -0
- /package/dist/{chunk-JQG3V5E3.js.map → chunk-2E3STBHS.js.map} +0 -0
- /package/dist/{chunk-W6DL4IP6.js.map → chunk-3LGCHNBC.js.map} +0 -0
- /package/dist/{chunk-MB4FS35J.js.map → chunk-56HFZHQM.js.map} +0 -0
- /package/dist/{chunk-YTXZUWMN.js.map → chunk-62EXS76C.js.map} +0 -0
- /package/dist/{chunk-6X6ZTDXP.js.map → chunk-BDOL622T.js.map} +0 -0
- /package/dist/{chunk-L4JQ236V.js.map → chunk-C3CXVX2B.js.map} +0 -0
- /package/dist/{chunk-XM3WTJ7Y.js.map → chunk-DEVD2WD2.js.map} +0 -0
- /package/dist/{chunk-Z72GWGH2.js.map → chunk-GCD4EHCD.js.map} +0 -0
- /package/dist/{chunk-3KBYI6RR.js.map → chunk-H6ZMKNP7.js.map} +0 -0
- /package/dist/{chunk-5OKCT6LF.js.map → chunk-IEWAH7W3.js.map} +0 -0
- /package/dist/{chunk-635IQV6B.js.map → chunk-J2ZQULU3.js.map} +0 -0
- /package/dist/{chunk-ZZZ33KTO.js.map → chunk-K2IDR6FR.js.map} +0 -0
- /package/dist/{chunk-YEH7UIUY.js.map → chunk-KTZRI27M.js.map} +0 -0
- /package/dist/{chunk-OU4I3MEH.js.map → chunk-UJSW72LG.js.map} +0 -0
- /package/dist/{chunk-R2CRH6JQ.js.map → chunk-VACACCD6.js.map} +0 -0
- /package/dist/{chunk-EGWVL5XA.js.map → chunk-VMAR67FF.js.map} +0 -0
- /package/dist/{chunk-ZH7HWVEE.js.map → chunk-VMJ7TBVM.js.map} +0 -0
- /package/dist/{chunk-XWJJYZQC.js.map → chunk-XHEVDABB.js.map} +0 -0
- /package/dist/{chunk-SCQVBLNR.js.map → chunk-XHGF6VC6.js.map} +0 -0
- /package/dist/{credential-2IEZDTH3.js.map → credential-GJW7LGYP.js.map} +0 -0
- /package/dist/{credential-template-S5WSOI3P.js.map → credential-template-UWBYKKWD.js.map} +0 -0
- /package/dist/{digest-HQGL7H6E.js.map → digest-XEHGCJM4.js.map} +0 -0
- /package/dist/{docs-CJQZVERZ.js.map → docs-KH4BCEQF.js.map} +0 -0
- /package/dist/{doctor-EGK5AB77.js.map → doctor-FOXXE5SK.js.map} +0 -0
- /package/dist/{environment-MWVXYEDU.js.map → environment-EBDPQTIS.js.map} +0 -0
- /package/dist/{exploration-JC7R7KTJ.js.map → exploration-LCGKRGOQ.js.map} +0 -0
- /package/dist/{exploratory-test-BHK5FTMJ.js.map → exploratory-test-SGECQGIX.js.map} +0 -0
- /package/dist/{external-run-UL5CKG54.js.map → external-run-2AJAI5O7.js.map} +0 -0
- /package/dist/{feature-flag-NMO25TZN.js.map → feature-flag-P7N4WQIH.js.map} +0 -0
- /package/dist/{feedback-3JNPSUXS.js.map → feedback-LAT7TQ2T.js.map} +0 -0
- /package/dist/{flow-AYE4RTZN.js.map → flow-NH2DC6AP.js.map} +0 -0
- /package/dist/{github-DM2DCXRY.js.map → github-FCEKBLXI.js.map} +0 -0
- /package/dist/{init-CPDT5XAU.js.map → init-5U5EZOAW.js.map} +0 -0
- /package/dist/{install-JZRNCHMO.js.map → install-X3UNVXKY.js.map} +0 -0
- /package/dist/{issues-GRFJB52C.js.map → issues-4P6I3YQW.js.map} +0 -0
- /package/dist/{knobs-3Y4QXWAD.js.map → knobs-JKTWJ6ZG.js.map} +0 -0
- /package/dist/{landing-ABYL5WVG.js.map → landing-6AGLKI66.js.map} +0 -0
- /package/dist/{list-WG5QB4NK.js.map → list-TWP2RP33.js.map} +0 -0
- /package/dist/{local-KX24OR5Z.js.map → local-D75QE5TB.js.map} +0 -0
- /package/dist/{login-MLJQAIFK.js.map → login-RBET4TIP.js.map} +0 -0
- /package/dist/{mcp-DDTO54XD.js.map → mcp-562SUUMK.js.map} +0 -0
- /package/dist/{metrics-BJLLOSPQ.js.map → metrics-4WF2GEPA.js.map} +0 -0
- /package/dist/{monitor-E2CKGHPM.js.map → monitor-WJXH54H2.js.map} +0 -0
- /package/dist/{product-2ECWM2JN.js.map → product-CYEQ7HOB.js.map} +0 -0
- /package/dist/{product-map-O542LZQL.js.map → product-map-MSDLIFZY.js.map} +0 -0
- /package/dist/{prompts-Y7O4XJ5P.js.map → prompts-ME53WPN4.js.map} +0 -0
- /package/dist/{proofs-TNOBLSRP.js.map → proofs-D3G6ZUFP.js.map} +0 -0
- /package/dist/{psql-M66YSUXW.js.map → psql-EXAUDU3W.js.map} +0 -0
- /package/dist/{record-3JINBRAR.js.map → record-EE7NGNKY.js.map} +0 -0
- /package/dist/{redis-FOIBINYA.js.map → redis-M4EYWKOJ.js.map} +0 -0
- /package/dist/{release-B4VWMVEI.js.map → release-4KUWVWWC.js.map} +0 -0
- /package/dist/{runbook-EYMSE37E.js.map → runbook-AHU77ANQ.js.map} +0 -0
- /package/dist/{scenarios-W7YNLBVO.js.map → scenarios-TU656T2B.js.map} +0 -0
- /package/dist/{schedule-EDHQJUUZ.js.map → schedule-DXJI6SYO.js.map} +0 -0
- /package/dist/{session-4N62APNQ.js.map → session-RUFTJHF4.js.map} +0 -0
- /package/dist/{slack-RUAXG6TB.js.map → slack-M3OKDVMY.js.map} +0 -0
- /package/dist/{spec-ZZKMW7ER.js.map → spec-5MXEBLYR.js.map} +0 -0
- /package/dist/{src-DGIVA22K.js.map → src-2X5OQRPJ.js.map} +0 -0
- /package/dist/{src-ECZWYNSV.js.map → src-72EFBA2R.js.map} +0 -0
- /package/dist/{src-OKSAEHQS.js.map → src-KH6WSBJV.js.map} +0 -0
- /package/dist/{start-OCZGILRL.js.map → start-PDYBRB5T.js.map} +0 -0
- /package/dist/{status-YTJ6YITG.js.map → status-VMVPVCDA.js.map} +0 -0
- /package/dist/{tag-KBG4SWRL.js.map → tag-7KTDLPVU.js.map} +0 -0
- /package/dist/{task-O6XRMHYE.js.map → task-QLFYZNKR.js.map} +0 -0
- /package/dist/{teams-NFUHS7XI.js.map → teams-Y7BXCY6P.js.map} +0 -0
- /package/dist/{tickets-JU2STK4B.js.map → tickets-CQDJDNPY.js.map} +0 -0
- /package/dist/{trace-NMSGKASJ.js.map → trace-QDORWXYX.js.map} +0 -0
- /package/dist/{triage-JGECJJU5.js.map → triage-GY7M3UGG.js.map} +0 -0
- /package/dist/{trigger-OSPEVCCQ.js.map → trigger-DLFAORX4.js.map} +0 -0
- /package/dist/{update-check-FNP6RFZO.js.map → update-check-ES6XQ7OF.js.map} +0 -0
- /package/dist/{upgrade-3PPBXFAT.js.map → upgrade-WKEOW5GS.js.map} +0 -0
- /package/dist/{usage-QMCU2JIO.js.map → usage-E6FDTR3W.js.map} +0 -0
- /package/dist/{utilities-7VHWTSJT.js.map → utilities-4Z6YX3L5.js.map} +0 -0
- /package/dist/{visual-WIZSPTVK.js.map → visual-TA6LPVDJ.js.map} +0 -0
- /package/dist/{workflow-cache-ACGM3BOI.js.map → workflow-cache-MNLEMRMM.js.map} +0 -0
- /package/dist/{workflow-cache-convergence-resolve-KEQDQMKL.js.map → workflow-cache-convergence-resolve-G5HJM6MF.js.map} +0 -0
- /package/dist/{workflow-debug-TVLBNRCB.js.map → workflow-debug-TNBUGSBK.js.map} +0 -0
- /package/dist/{workflow-feedback-GB5VPGE2.js.map → workflow-feedback-G2ZXAUGI.js.map} +0 -0
- /package/dist/{workflow-fork-2IPJNR76.js.map → workflow-fork-6HHOMC2D.js.map} +0 -0
- /package/dist/{workflow-promotion-QEQUXVUT.js.map → workflow-promotion-RG7L6JZT.js.map} +0 -0
- /package/dist/{workflow-proposals-KHGTPMD4.js.map → workflow-proposals-ZNF2F3UE.js.map} +0 -0
- /package/dist/{workflow-revisions-F5KQEEXB.js.map → workflow-revisions-TP64Z6FO.js.map} +0 -0
- /package/dist/{workflow-status-66HC5MEA.js.map → workflow-status-5RG3JX56.js.map} +0 -0
|
@@ -24,35 +24,35 @@ import {
|
|
|
24
24
|
serializeNodeDecisionLog,
|
|
25
25
|
timelineActionCode,
|
|
26
26
|
traceActionWithPreview
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-KTZRI27M.js";
|
|
28
28
|
import {
|
|
29
29
|
materializeRunWorkspace
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
30
|
+
} from "./chunk-56HFZHQM.js";
|
|
31
|
+
import "./chunk-3LGCHNBC.js";
|
|
32
|
+
import "./chunk-GCD4EHCD.js";
|
|
33
33
|
import "./chunk-PBTGJYM5.js";
|
|
34
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-H6ZMKNP7.js";
|
|
35
35
|
import {
|
|
36
36
|
apiRequest,
|
|
37
37
|
promptInput
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import "./chunk-
|
|
38
|
+
} from "./chunk-EWK44F6V.js";
|
|
39
|
+
import "./chunk-K2IDR6FR.js";
|
|
40
40
|
import "./chunk-S3Q7MDCS.js";
|
|
41
41
|
import {
|
|
42
42
|
getArgValue,
|
|
43
43
|
hasFlag
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-4MFMPC5P.js";
|
|
45
45
|
import {
|
|
46
46
|
writeRawOutput
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-2OHYMT3A.js";
|
|
48
48
|
import "./chunk-AK7WEGGB.js";
|
|
49
49
|
import "./chunk-5QHORHJT.js";
|
|
50
50
|
import {
|
|
51
51
|
parseTraceArchive
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-2E3STBHS.js";
|
|
53
53
|
import {
|
|
54
54
|
matchAssertionSpecsToVerifySteps
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-RHWPZKRV.js";
|
|
56
56
|
import "./chunk-TOWZAG3I.js";
|
|
57
57
|
|
|
58
58
|
// src/workflow-cache.ts
|
|
@@ -621,7 +621,7 @@ async function handleWorkflowCache(argv, apiUrl, token) {
|
|
|
621
621
|
await handleConvergenceReport(rest, apiUrl, token);
|
|
622
622
|
return;
|
|
623
623
|
case "convergence-resolve": {
|
|
624
|
-
const { handleConvergenceResolve } = await import("./workflow-cache-convergence-resolve-
|
|
624
|
+
const { handleConvergenceResolve } = await import("./workflow-cache-convergence-resolve-G5HJM6MF.js");
|
|
625
625
|
await handleConvergenceResolve(rest, apiUrl, token);
|
|
626
626
|
return;
|
|
627
627
|
}
|
|
@@ -1594,7 +1594,7 @@ async function handleSubstrate(argv) {
|
|
|
1594
1594
|
process2.exit(1);
|
|
1595
1595
|
}
|
|
1596
1596
|
const actionIndex = Number(actionIndexRaw);
|
|
1597
|
-
const { SubstrateMaterializer: SubstrateMaterializer2 } = await import("./src-
|
|
1597
|
+
const { SubstrateMaterializer: SubstrateMaterializer2 } = await import("./src-KH6WSBJV.js");
|
|
1598
1598
|
const path3 = await import("path");
|
|
1599
1599
|
const traceZipPath = path3.join(workspace, "browser", "trace.zip");
|
|
1600
1600
|
const materializer = new SubstrateMaterializer2({
|
|
@@ -1630,8 +1630,8 @@ async function handleLocator(argv) {
|
|
|
1630
1630
|
}
|
|
1631
1631
|
}
|
|
1632
1632
|
const actionIndex = Number(actionIndexRaw);
|
|
1633
|
-
const { HeadlessDomSession: HeadlessDomSession2, SubstrateMaterializer: SubstrateMaterializer2, LocatorVerifier: LocatorVerifier2, buildLocator } = await import("./src-
|
|
1634
|
-
const { parseSnapshot } = await import("./src-
|
|
1633
|
+
const { HeadlessDomSession: HeadlessDomSession2, SubstrateMaterializer: SubstrateMaterializer2, LocatorVerifier: LocatorVerifier2, buildLocator } = await import("./src-KH6WSBJV.js");
|
|
1634
|
+
const { parseSnapshot } = await import("./src-2X5OQRPJ.js");
|
|
1635
1635
|
const path3 = await import("path");
|
|
1636
1636
|
const session = new HeadlessDomSession2();
|
|
1637
1637
|
const traceZipPath = path3.join(workspace, "browser", "trace.zip");
|
|
@@ -1804,4 +1804,4 @@ export {
|
|
|
1804
1804
|
readCacheRecipeFile,
|
|
1805
1805
|
timelineActionCode
|
|
1806
1806
|
};
|
|
1807
|
-
//# sourceMappingURL=workflow-cache-
|
|
1807
|
+
//# sourceMappingURL=workflow-cache-MNLEMRMM.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { createRequire as __cr } from "module"; import { fileURLToPath as __fup } from "url"; import { dirname as __dn } from "path"; const require = __cr(import.meta.url); const __filename = __fup(import.meta.url); const __dirname = __dn(__filename);
|
|
2
2
|
import {
|
|
3
3
|
apiRequest
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EWK44F6V.js";
|
|
5
5
|
import "./chunk-S3Q7MDCS.js";
|
|
6
6
|
import {
|
|
7
7
|
getArgValue,
|
|
8
8
|
hasFlag
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4MFMPC5P.js";
|
|
10
10
|
import {
|
|
11
11
|
writeRawOutput
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-2OHYMT3A.js";
|
|
13
|
+
import "./chunk-RHWPZKRV.js";
|
|
14
14
|
import "./chunk-TOWZAG3I.js";
|
|
15
15
|
|
|
16
16
|
// src/workflow-cache-convergence-resolve.ts
|
|
@@ -42,4 +42,4 @@ async function handleConvergenceResolve(argv, apiUrl, token) {
|
|
|
42
42
|
export {
|
|
43
43
|
handleConvergenceResolve
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=workflow-cache-convergence-resolve-
|
|
45
|
+
//# sourceMappingURL=workflow-cache-convergence-resolve-G5HJM6MF.js.map
|
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
handleWorkflowDebug,
|
|
5
5
|
materializeRunWorkspace,
|
|
6
6
|
resolveWorkflowIdForRun
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-56HFZHQM.js";
|
|
8
|
+
import "./chunk-3LGCHNBC.js";
|
|
9
|
+
import "./chunk-GCD4EHCD.js";
|
|
10
|
+
import "./chunk-H6ZMKNP7.js";
|
|
11
|
+
import "./chunk-EWK44F6V.js";
|
|
12
|
+
import "./chunk-K2IDR6FR.js";
|
|
13
13
|
import "./chunk-S3Q7MDCS.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-4MFMPC5P.js";
|
|
15
|
+
import "./chunk-2OHYMT3A.js";
|
|
16
16
|
import "./chunk-AK7WEGGB.js";
|
|
17
17
|
import "./chunk-5QHORHJT.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-2E3STBHS.js";
|
|
19
|
+
import "./chunk-RHWPZKRV.js";
|
|
20
20
|
import "./chunk-TOWZAG3I.js";
|
|
21
21
|
export {
|
|
22
22
|
formatRetention,
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
materializeRunWorkspace,
|
|
25
25
|
resolveWorkflowIdForRun
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=workflow-debug-
|
|
27
|
+
//# sourceMappingURL=workflow-debug-TNBUGSBK.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { createRequire as __cr } from "module"; import { fileURLToPath as __fup } from "url"; import { dirname as __dn } from "path"; const require = __cr(import.meta.url); const __filename = __fup(import.meta.url); const __dirname = __dn(__filename);
|
|
2
2
|
import {
|
|
3
3
|
apiRequest
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EWK44F6V.js";
|
|
5
5
|
import "./chunk-S3Q7MDCS.js";
|
|
6
6
|
import {
|
|
7
7
|
getArgValue,
|
|
8
8
|
hasFlag
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4MFMPC5P.js";
|
|
10
10
|
import {
|
|
11
11
|
writeRawOutput
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-2OHYMT3A.js";
|
|
13
|
+
import "./chunk-RHWPZKRV.js";
|
|
14
14
|
import "./chunk-TOWZAG3I.js";
|
|
15
15
|
|
|
16
16
|
// src/workflow-feedback.ts
|
|
@@ -154,4 +154,4 @@ async function handleWorkflowFeedback(argv, apiUrl, token) {
|
|
|
154
154
|
export {
|
|
155
155
|
handleWorkflowFeedback
|
|
156
156
|
};
|
|
157
|
-
//# sourceMappingURL=workflow-feedback-
|
|
157
|
+
//# sourceMappingURL=workflow-feedback-G2ZXAUGI.js.map
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
apiRequest,
|
|
7
7
|
getPositionalArg
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EWK44F6V.js";
|
|
9
9
|
import "./chunk-S3Q7MDCS.js";
|
|
10
10
|
import {
|
|
11
11
|
getArgValue,
|
|
12
12
|
hasFlag
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4MFMPC5P.js";
|
|
14
14
|
import {
|
|
15
15
|
writeRawOutput
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-2OHYMT3A.js";
|
|
17
|
+
import "./chunk-RHWPZKRV.js";
|
|
18
18
|
import "./chunk-TOWZAG3I.js";
|
|
19
19
|
|
|
20
20
|
// src/workflow-fork.ts
|
|
@@ -239,4 +239,4 @@ export {
|
|
|
239
239
|
buildForkNodeMap,
|
|
240
240
|
handleWorkflowFork
|
|
241
241
|
};
|
|
242
|
-
//# sourceMappingURL=workflow-fork-
|
|
242
|
+
//# sourceMappingURL=workflow-fork-6HHOMC2D.js.map
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
getPositionalArg,
|
|
6
6
|
getScalarArgValue,
|
|
7
7
|
resolveTestSuite
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EWK44F6V.js";
|
|
9
9
|
import "./chunk-S3Q7MDCS.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-4MFMPC5P.js";
|
|
11
11
|
import {
|
|
12
12
|
writeRawOutput
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-2OHYMT3A.js";
|
|
14
14
|
import {
|
|
15
15
|
parsePromoteOn
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RHWPZKRV.js";
|
|
17
17
|
import "./chunk-TOWZAG3I.js";
|
|
18
18
|
|
|
19
19
|
// src/workflow-promotion.ts
|
|
@@ -59,4 +59,4 @@ function usageError(message) {
|
|
|
59
59
|
export {
|
|
60
60
|
handleWorkflowPromotion
|
|
61
61
|
};
|
|
62
|
-
//# sourceMappingURL=workflow-promotion-
|
|
62
|
+
//# sourceMappingURL=workflow-promotion-RG7L6JZT.js.map
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
} from "./chunk-DEK6B6LX.js";
|
|
7
7
|
import {
|
|
8
8
|
apiRequest
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EWK44F6V.js";
|
|
10
10
|
import "./chunk-S3Q7MDCS.js";
|
|
11
11
|
import {
|
|
12
12
|
getArgValue,
|
|
13
13
|
hasFlag
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4MFMPC5P.js";
|
|
15
15
|
import {
|
|
16
16
|
writeRawOutput
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-2OHYMT3A.js";
|
|
18
|
+
import "./chunk-RHWPZKRV.js";
|
|
19
19
|
import "./chunk-TOWZAG3I.js";
|
|
20
20
|
|
|
21
21
|
// src/workflow-proposals.ts
|
|
@@ -379,4 +379,4 @@ export {
|
|
|
379
379
|
_internalsForTesting,
|
|
380
380
|
handleWorkflowProposals
|
|
381
381
|
};
|
|
382
|
-
//# sourceMappingURL=workflow-proposals-
|
|
382
|
+
//# sourceMappingURL=workflow-proposals-ZNF2F3UE.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { createRequire as __cr } from "module"; import { fileURLToPath as __fup } from "url"; import { dirname as __dn } from "path"; const require = __cr(import.meta.url); const __filename = __fup(import.meta.url); const __dirname = __dn(__filename);
|
|
2
2
|
import {
|
|
3
3
|
apiRequest
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EWK44F6V.js";
|
|
5
5
|
import "./chunk-S3Q7MDCS.js";
|
|
6
6
|
import {
|
|
7
7
|
getArgValue,
|
|
8
8
|
hasFlag
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4MFMPC5P.js";
|
|
10
10
|
import {
|
|
11
11
|
writeRawOutput
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-2OHYMT3A.js";
|
|
13
|
+
import "./chunk-RHWPZKRV.js";
|
|
14
14
|
import "./chunk-TOWZAG3I.js";
|
|
15
15
|
|
|
16
16
|
// src/workflow-revisions.ts
|
|
@@ -75,4 +75,4 @@ async function handleWorkflowRevisions(argv, apiUrl, token) {
|
|
|
75
75
|
export {
|
|
76
76
|
handleWorkflowRevisions
|
|
77
77
|
};
|
|
78
|
-
//# sourceMappingURL=workflow-revisions-
|
|
78
|
+
//# sourceMappingURL=workflow-revisions-TP64Z6FO.js.map
|
|
@@ -2,18 +2,18 @@ import { createRequire as __cr } from "module"; import { fileURLToPath as __fup
|
|
|
2
2
|
import {
|
|
3
3
|
apiRequest,
|
|
4
4
|
readTextOrFile
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EWK44F6V.js";
|
|
6
6
|
import "./chunk-S3Q7MDCS.js";
|
|
7
7
|
import {
|
|
8
8
|
getArgValue,
|
|
9
9
|
hasFlag
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4MFMPC5P.js";
|
|
11
11
|
import {
|
|
12
12
|
writeRawOutput
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-2OHYMT3A.js";
|
|
14
14
|
import {
|
|
15
15
|
WORKFLOW_MANAGEMENT_STATUSES
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RHWPZKRV.js";
|
|
17
17
|
import "./chunk-TOWZAG3I.js";
|
|
18
18
|
|
|
19
19
|
// src/workflow-status.ts
|
|
@@ -282,4 +282,4 @@ export {
|
|
|
282
282
|
handleWorkflowEvents,
|
|
283
283
|
handleWorkflowStatus
|
|
284
284
|
};
|
|
285
|
-
//# sourceMappingURL=workflow-status-
|
|
285
|
+
//# sourceMappingURL=workflow-status-5RG3JX56.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runcofactor/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.56.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@firecrawl/pdf-inspector": "1.25.2",
|
|
48
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
48
|
+
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
49
49
|
"@napi-rs/canvas": "1.0.13",
|
|
50
50
|
"eventsource-parser": "^4.0.0",
|
|
51
51
|
"playwright": "1.62.1",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"zod": "^4.4.3"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
+
"@chatsdet/ade-relay-protocol": "workspace:*",
|
|
57
58
|
"@chatsdet/browser-core": "workspace:*",
|
|
58
59
|
"@chatsdet/canary-spec": "workspace:*",
|
|
59
60
|
"@chatsdet/content": "workspace:*",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/proofs.ts"],"sourcesContent":["/**\n * `cofactor proofs`: the Cofactor tests a pull request lists as proving it.\n *\n * - `attach`, `detach` and `render` record criteria and their evidence and print\n * the block for the pull request description, so nobody hand-formats one.\n * - `check` evaluates the pull request's proofs; `status` shows them.\n *\n * Backed by `/proofs/*` in `apps/api/src/proofs/routes.ts`.\n *\n * @module proofs\n */\n\nimport process from 'node:process';\nimport { execFileSync } from 'node:child_process';\nimport { appendFile, readFile } from 'node:fs/promises';\nimport { formatProofNone, type ProofVerdict } from '@chatsdet/types';\nimport { printServedGuide } from './guide.js';\nimport { getArgValue, hasFlag, resolveConfig } from './auth.js';\nimport { apiRequest, getArgValues, readStdin, readTextOrFile } from './cli-helpers.js';\nimport { writeRawOutput } from './brand.js';\nimport { resolveApplicationId } from './environment.js';\n\ntype ApiResult<T> = { ok: boolean; error?: string; data?: T };\ntype ProofStatusView = {\n proof: { headSha: string };\n verdict: ProofVerdict;\n};\n\nconst HELP = [\n 'Usage: cofactor proofs <sub-command>',\n '',\n ' guide [--json] Print the offline guide to proving a change with tests (no login needed)',\n ' status --repo <owner/repo> --pr <n> [--json] Proofs attached to the pull request',\n ' attach --pr <n> --application <app> --criterion <n> (--test <wf_…> --run <wrun_…> | --perf-run <prun_…> | --eval-run <aerun_…>) --asserted <text> [--text <text> --detail <text>] [--node <id> --base <sha>] [--sha <sha> --tree <tree>]',\n ' Perf evidence must be completed, faster or no-change, and on --sha; a slower run is refused. Attach a newer run and detach stale evidence.',\n ' Eval evidence must be a completed, full, passing run on --sha; a partial, failing or other-commit run is refused. Attach as many eval runs as you have; every one must pass.',\n ' A test with any visual_checkpoint node is a UI test; attach runs it at the PR base and shows checkpoint diffs.',\n ' An approved test that is not a fork is cited as an existing test: its run proves it still works, and it is never promoted.',\n ' attach --pr <n> --application <app> --criterion <n> --manual --notes <text|@file> [--artifact <https-url>]... [--text <text> --detail <text>] [--sha <sha>]',\n ' Only when Cofactor cannot prove the criterion: say what you did and why. Passes the check, marked manual; never promotes anything.',\n ' render --pr <n> Print the pull request proof block: a stoplight per criterion as of the head the server tracks for the PR, with run links',\n ' render --none \"<reason>\" The block for a pull request with no observable criterion (dependency bump, docs-only change): say why',\n ' detach --pr <n> --criterion <n> [--test <wf_…>|--perf-run <prun_…>|--eval-run <aerun_…>|--manual] Remove a criterion or one evidence item',\n ' check --pr <n> --sha <sha> [--body-file <path>|--body -] Evaluate the pull request proofs',\n].join('\\n');\n\nexport async function runProofs(argv: string[]): Promise<void> {\n const [subCommand, ...rest] = argv;\n if (!subCommand || subCommand === 'help' || hasFlag(argv, '--help', '-h')) {\n console.log(HELP);\n return;\n }\n if (subCommand === 'guide') {\n await printServedGuide('proofs', rest);\n return;\n }\n if (subCommand === 'render' && hasFlag(rest, '--none')) return handleRenderNone(rest);\n const { apiUrl, token } = await resolveConfig(argv);\n switch (subCommand) {\n case 'status':\n return handleStatus(rest, apiUrl, token);\n case 'attach':\n return handleAttach(rest, apiUrl, token);\n case 'render':\n return handleRender(rest, apiUrl, token);\n case 'detach':\n return handleDetach(rest, apiUrl, token);\n case 'check':\n return handleCheck(rest, apiUrl, token);\n default:\n console.error(`Unknown proofs sub-command: ${subCommand}\\n\\n${HELP}`);\n process.exit(1);\n }\n}\n\nasync function handleStatus(argv: string[], apiUrl: string, token: string): Promise<void> {\n const pr = getArgValue(argv, '--pr');\n if (!pr) {\n console.error('Usage: cofactor proofs status --repo <owner/repo> --pr <number> [--json]');\n process.exit(1);\n }\n const repo = resolveRepo(argv);\n const query = new URLSearchParams({ repo, pr });\n const res = await apiRequest<ApiResult<{ proof: ProofStatusView | null }>>(\n apiUrl,\n token,\n 'GET',\n `/proofs/status?${query}`\n );\n if (!res.ok || !res.data) {\n console.error(`Error: ${res.error ?? 'could not read the pull request proofs'}`);\n process.exit(1);\n }\n if (hasFlag(argv, '--json')) {\n writeRawOutput(JSON.stringify(res.data, null, 2));\n return;\n }\n const proof = res.data.proof;\n if (!proof) {\n console.log(`#${pr} has no attached proof criteria.`);\n return;\n }\n console.log(`#${pr} proof status at ${proof.proof.headSha}:`);\n writeRawOutput(proof.verdict.summaryMarkdown);\n}\n\nasync function handleAttach(argv: string[], apiUrl: string, token: string): Promise<void> {\n if (hasFlag(argv, '--manual')) return handleAttachManual(argv, apiUrl, token);\n const pr = requiredNumber(argv, '--pr');\n const criterion = requiredNumber(argv, '--criterion');\n const application = getArgValue(argv, '--application');\n const test = getArgValue(argv, '--test');\n const run = getArgValue(argv, '--run');\n const perfRun = getArgValue(argv, '--perf-run');\n const evalRun = getArgValue(argv, '--eval-run');\n const asserted = getArgValue(argv, '--asserted');\n const subjectCount =\n Number(test !== undefined || run !== undefined) + Number(perfRun !== undefined) + Number(evalRun !== undefined);\n if (['--test', '--run', '--perf-run', '--eval-run'].some((flag) => flagCount(argv, flag) > 1))\n usageError('Pass each evidence subject flag at most once.');\n if (\n (hasFlag(argv, '--test') && !test) || (hasFlag(argv, '--run') && !run) ||\n (hasFlag(argv, '--perf-run') && !perfRun) || (hasFlag(argv, '--eval-run') && !evalRun)\n )\n usageError('--test, --run, --perf-run and --eval-run each require a value.');\n if (!application || !asserted || subjectCount !== 1 || (test === undefined) !== (run === undefined))\n usageError('Usage: cofactor proofs attach --pr <n> --application <app> --criterion <n> (--test <wf_…> --run <wrun_…> | --perf-run <prun_…> | --eval-run <aerun_…>) --asserted <text> [--text <text> --detail <text>]');\n if ((perfRun !== undefined || evalRun !== undefined) && (hasFlag(argv, '--node') || hasFlag(argv, '--tree') || hasFlag(argv, '--base')))\n usageError('--node, --tree and --base can only be used with --test.');\n const applicationId = await resolveApplicationId(argv, apiUrl, token);\n const repo = resolveRepo(argv);\n const body: Record<string, unknown> = { repo, application: applicationId, pr, criterion, asserted };\n if (perfRun !== undefined || evalRun !== undefined) {\n body.sha = resolveCleanCheckoutSha(argv);\n if (perfRun !== undefined) body.perfRun = perfRun;\n else body.evalRun = evalRun;\n } else {\n const { sha, tree } = resolveCheckoutCommit(argv);\n const base = getArgValue(argv, '--base') ?? resolveDefaultBaseCommit();\n Object.assign(body, { test, run, sha, tree, ...(base ? { base } : {}) });\n }\n const text = getArgValue(argv, '--text');\n const detail = getArgValue(argv, '--detail');\n const node = getArgValue(argv, '--node');\n if (text !== undefined) body.text = text;\n if (detail !== undefined) body.detail = detail;\n if (node !== undefined) body.node = node;\n const res = await apiRequest<ApiResult<{ proofId: string; criterion: unknown; evidence: unknown }>>(\n apiUrl,\n token,\n 'POST',\n '/proofs/attach',\n body\n );\n if (!res.ok || !res.data) return fail(res.error ?? 'could not attach proof evidence');\n writeRawOutput(JSON.stringify(res.data, null, 2));\n}\n\nconst MANUAL_USAGE =\n 'Usage: cofactor proofs attach --pr <n> --application <app> --criterion <n> --manual --notes <text|@file> [--artifact <https-url>]... [--text <text> --detail <text>]';\n\n/** M23: the agent's own account of a criterion Cofactor could not prove. */\nasync function handleAttachManual(argv: string[], apiUrl: string, token: string): Promise<void> {\n const conflicting = ['--test', '--run', '--perf-run', '--eval-run', '--asserted', '--node', '--tree', '--base'].filter((flag) => hasFlag(argv, flag));\n if (conflicting.length > 0)\n usageError(`--manual takes --notes instead of a test, run or asserted line; remove ${conflicting.join(', ')}.`);\n const pr = requiredNumber(argv, '--pr');\n const criterion = requiredNumber(argv, '--criterion');\n const application = getArgValue(argv, '--application');\n const notesValue = getArgValue(argv, '--notes');\n if (!application || !notesValue) usageError(`--manual requires --application and --notes.\\n${MANUAL_USAGE}`);\n const notes = readTextOrFile(notesValue).trim();\n if (!notes) usageError('--manual requires non-empty --notes: what you did, and why Cofactor could not prove it.');\n const artifacts = hasFlag(argv, '--artifact') ? getArgValues(argv, '--artifact') : [];\n const applicationId = await resolveApplicationId(argv, apiUrl, token);\n const body: Record<string, unknown> = {\n repo: resolveRepo(argv),\n application: applicationId,\n pr,\n criterion,\n manual: true,\n notes,\n artifacts,\n sha: resolveCleanCheckoutSha(argv),\n };\n const text = getArgValue(argv, '--text');\n const detail = getArgValue(argv, '--detail');\n if (text !== undefined) body.text = text;\n if (detail !== undefined) body.detail = detail;\n const res = await apiRequest<ApiResult<{ proofId: string; criterion: unknown; evidence: unknown }>>(\n apiUrl,\n token,\n 'POST',\n '/proofs/attach',\n body\n );\n if (!res.ok || !res.data) return fail(res.error ?? 'could not attach manual evidence');\n writeRawOutput(JSON.stringify(res.data, null, 2));\n}\n\n/** `render --none`: needs no login or server; the reason is the whole block. */\nfunction handleRenderNone(argv: string[]): void {\n const reason = getArgValue(argv, '--none')?.trim();\n if (!reason) return fail('--none takes a reason: say why no test is possible, and what would make one possible.');\n if (reason.includes('<!--') || reason.includes('-->')) return fail('the reason cannot contain an HTML comment marker.');\n writeRawOutput(formatProofNone(reason));\n}\n\nasync function handleRender(argv: string[], apiUrl: string, token: string): Promise<void> {\n const pr = requiredNumber(argv, '--pr');\n const repo = resolveRepo(argv);\n const query = new URLSearchParams({ repo, pr: String(pr) });\n const res = await apiRequest<ApiResult<{ body: string }>>(\n apiUrl,\n token,\n 'GET',\n `/proofs/render?${query}`\n );\n if (!res.ok || !res.data) return fail(res.error ?? 'could not render pull request proofs');\n writeRawOutput(res.data.body);\n}\n\nasync function handleDetach(argv: string[], apiUrl: string, token: string): Promise<void> {\n const pr = requiredNumber(argv, '--pr');\n const criterion = requiredNumber(argv, '--criterion');\n const repo = resolveRepo(argv);\n const test = getArgValue(argv, '--test');\n const perfRun = getArgValue(argv, '--perf-run');\n const evalRun = getArgValue(argv, '--eval-run');\n const manual = hasFlag(argv, '--manual');\n if (['--test', '--perf-run', '--eval-run'].some((flag) => flagCount(argv, flag) > 1))\n usageError('Pass each evidence subject flag at most once.');\n if (Number(test !== undefined) + Number(perfRun !== undefined) + Number(evalRun !== undefined) + Number(manual) > 1)\n usageError('Pass at most one of --test, --perf-run, --eval-run and --manual.');\n if ((hasFlag(argv, '--test') && !test) || (hasFlag(argv, '--perf-run') && !perfRun) || (hasFlag(argv, '--eval-run') && !evalRun))\n usageError('--test, --perf-run and --eval-run each require a value.');\n const res = await apiRequest<ApiResult<{ deleted: true }>>(\n apiUrl,\n token,\n 'POST',\n '/proofs/detach',\n { repo, pr, criterion, ...(test ? { test } : {}), ...(perfRun ? { perfRun } : {}), ...(evalRun ? { evalRun } : {}), ...(manual ? { manual: true } : {}) }\n );\n if (!res.ok || !res.data) return fail(res.error ?? 'could not detach proof criterion');\n writeRawOutput(JSON.stringify(res.data, null, 2));\n}\n\nasync function handleCheck(argv: string[], apiUrl: string, token: string): Promise<void> {\n const pr = requiredNumber(argv, '--pr');\n const sha = getArgValue(argv, '--sha');\n if (!sha) usageError('Usage: cofactor proofs check --pr <n> --sha <sha> [--body-file <path>|--body -]');\n const repo = resolveRepo(argv);\n const bodyInput = getArgValue(argv, '--body');\n const bodyFile = getArgValue(argv, '--body-file');\n if (bodyInput !== undefined && (bodyInput !== '-' || bodyFile !== undefined)) {\n usageError('Use --body - for stdin or --body-file <path>.');\n }\n if (bodyInput === undefined && bodyFile === undefined) {\n usageError('Pass the pull request body with --body - or --body-file <path>.');\n }\n let body: string;\n try {\n body = bodyInput === '-' ? await readStdin() : await readFile(bodyFile!, 'utf8');\n } catch (error) {\n return fail(`could not read pull request body: ${error instanceof Error ? error.message : String(error)}`);\n }\n const res = await apiRequest<ApiResult<ProofVerdict | null>>(\n apiUrl,\n token,\n 'POST',\n '/proofs/check',\n { repo, pr, sha, body }\n );\n if (!res.ok) return fail(res.error ?? 'could not check pull request proofs');\n const verdict = res.data;\n if (!verdict) return;\n if (verdict.summaryMarkdown) {\n writeRawOutput(verdict.summaryMarkdown);\n const summaryFile = process.env.GITHUB_STEP_SUMMARY;\n if (summaryFile) {\n try {\n await appendFile(summaryFile, `${verdict.summaryMarkdown}\\n`, 'utf8');\n } catch (error) {\n return fail(`could not append GitHub step summary: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n }\n if (verdict.conclusion === 'failure') process.exit(1);\n}\n\n/** Resolve an explicit repo, Actions context, or the checkout's origin remote. */\nexport function resolveRepo(argv: string[]): string {\n const explicit = getArgValue(argv, '--repo');\n const candidate = explicit ?? process.env.GITHUB_REPOSITORY ?? originRepository();\n const repo = parseRepository(candidate);\n if (!repo) usageError('Could not determine a GitHub repository. Pass --repo <owner/repo> or set GITHUB_REPOSITORY.');\n return repo;\n}\n\nexport function parseRepository(value: string): string | null {\n const normalized = value.trim();\n const bare = normalized.match(/^([^/\\s:]+)\\/([^/\\s:]+?)(?:\\.git)?$/i);\n if (bare) return `${bare[1]}/${bare[2]}`.toLowerCase();\n const scp = normalized.match(/^git@github\\.com:([^/\\s:]+)\\/([^/\\s:]+?)(?:\\.git)?$/i);\n if (scp) return `${scp[1]}/${scp[2]}`.toLowerCase();\n try {\n const url = new URL(normalized);\n if (!['http:', 'https:', 'ssh:'].includes(url.protocol) || url.hostname.toLowerCase() !== 'github.com') return null;\n const path = url.pathname.match(/^\\/([^/\\s]+)\\/([^/\\s]+?)(?:\\.git)?\\/?$/i);\n return path ? `${path[1]}/${path[2]}`.toLowerCase() : null;\n } catch {\n return null;\n }\n}\n\nfunction originRepository(): string {\n try {\n return execFileSync('git', ['remote', 'get-url', 'origin'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();\n } catch {\n return '';\n }\n}\n\nfunction resolveCheckoutCommit(argv: string[]): { sha: string; tree: string } {\n const explicitSha = getArgValue(argv, '--sha');\n const explicitTree = getArgValue(argv, '--tree');\n if (explicitSha !== undefined && explicitTree !== undefined) {\n return { sha: explicitSha, tree: explicitTree };\n }\n if (gitOutput(['status', '--porcelain'])) {\n return fail('the working tree is dirty; commit and push, sync, and run again');\n }\n const sha = explicitSha ?? gitRevision('HEAD');\n const tree = explicitTree ?? gitRevision('HEAD^{tree}');\n return { sha, tree };\n}\n\nfunction resolveCleanCheckoutSha(argv: string[]): string {\n if (gitOutput(['status', '--porcelain'])) return fail('the working tree is dirty; commit and push, sync, and run again');\n return getArgValue(argv, '--sha') ?? gitRevision('HEAD');\n}\n\nfunction resolveDefaultBaseCommit(): string | undefined {\n try {\n const defaultRef = execFileSync('git', ['symbolic-ref', 'refs/remotes/origin/HEAD'], {\n encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'],\n }).trim();\n return execFileSync('git', ['merge-base', 'HEAD', defaultRef], {\n encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'],\n }).trim() || undefined;\n } catch {\n // The server resolves its current base when the CLI cannot compute a merge base.\n process.stderr.write('Could not resolve the default base commit; the server will resolve the current base.\\n');\n return undefined;\n }\n}\n\nfunction gitOutput(args: string[]): string {\n try {\n return execFileSync('git', args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();\n } catch {\n return fail('could not inspect the working tree; run this command from a git checkout');\n }\n}\n\nfunction gitRevision(revision: string): string {\n try {\n return execFileSync('git', ['rev-parse', revision], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();\n } catch {\n return fail(`could not resolve ${revision}; run this command from a git checkout`);\n }\n}\n\nfunction requiredNumber(argv: string[], flag: string): number {\n const value = getArgValue(argv, flag);\n const parsed = value ? Number(value) : Number.NaN;\n if (!Number.isSafeInteger(parsed) || parsed < 1) usageError(`${flag} must be a positive integer.`);\n return parsed;\n}\n\nfunction flagCount(argv: string[], flag: string): number {\n return argv.filter((arg) => arg === flag).length;\n}\n\nfunction usageError(message: string): never {\n console.error(`Error: ${message}`);\n process.exit(1);\n}\n\nfunction fail(message: string): never {\n console.error(`Error: ${message}`);\n process.exit(1);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,OAAO,aAAa;AAC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wt.ts","../src/default-urls.ts"],"sourcesContent":["import fs from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\nimport process from 'node:process';\nimport { readBrandEnv } from './brand.js';\nimport { setActingTarget } from './api-fetch.js';\nimport { DEFAULT_API_URL, DEFAULT_APP_URL } from './default-urls.js';\nimport { isFreeTextFlag, isFreeTextValue } from './argv.js';\n\nexport type StoredAuth = {\n token?: string;\n apiUrl?: string;\n orgId?: string;\n orgName?: string;\n /**\n * The org's vanity app subdomain at login time, when it has one. Cached so\n * printed links land on the org's own host without a lookup per command.\n *\n * May go stale if the org is later renamed; retired labels redirect to the\n * current host, so a stale value costs a redirect rather than a dead link.\n */\n appSubdomain?: string | null;\n /**\n * Which environment this session belongs to (`production` | `dev` | `local` |\n * custom). Purely for display/filtering — `apiUrl` already encodes the env —\n * so the same org can hold a session in more than one environment at once.\n */\n envLabel?: string;\n};\n\n/** Multi-profile auth file format */\ntype MultiProfileAuth = {\n profiles: Record<string, StoredAuth>;\n default: string;\n};\n\n/** Legacy flat format (single profile) */\ntype LegacyAuth = StoredAuth;\n\n/**\n * Resolve where the multi-profile auth file lives. Honors a\n * `CANARY_CONFIG_DIR` / `COFACTOR_CONFIG_DIR` override (for non-standard config\n * locations and tests), else the default `~/.config/canary-cli`.\n */\nfunction getAuthPaths(): { dir: string; file: string } {\n const dir = readBrandEnv('CANARY_CONFIG_DIR') ?? defaultConfigDir();\n return { dir, file: path.join(dir, 'auth.json') };\n}\n\n/** The standard config directory, ignoring any `CANARY_CONFIG_DIR` override. */\nexport function defaultConfigDir(): string {\n return path.join(os.homedir(), '.config', 'canary-cli');\n}\n\n/** The config directory this invocation reads and writes sessions in. */\nexport function activeConfigDir(): string {\n return getAuthPaths().dir;\n}\n\n/* ── Shared argv helpers ─────────────────────────────────────────────── */\n\nexport function getArgValue(argv: string[], key: string): string | undefined {\n for (let i = 0; i < argv.length; i++) {\n const token = argv[i];\n if (token === key) return i < argv.length - 1 ? argv[i + 1] : undefined;\n if (token.startsWith(`${key}=`)) return token.slice(key.length + 1);\n }\n return undefined;\n}\n\n/** The flag an argument starts with, without its value: errors must not echo a fused `--token`. */\nfunction flagName(token: string): string {\n return token.trim().split(/[\\s=]/)[0];\n}\n\n/** Global flags that always take a value; a missing value must never fall back to the default profile. */\nexport const GLOBAL_VALUE_FLAGS = ['--org', '--env', '--api-url', '--target-org', '--token'];\n\n/**\n * Reject argv that the flag parser would silently misread, before any command\n * resolves credentials. An ignored `--org` / `--env` quietly retargets the\n * default profile (often prod), so these are hard errors:\n * - one token holding several flags (`\"--org X --env dev\"`, from an unquoted\n * zsh variable, which zsh does not word-split);\n * - a global value flag with no value, or whose value holds another flag.\n * The free-text value of a flag such as `--description` is not checked, so\n * `--description \"--org Acme\"` passes, unless it starts with `--org=`, which\n * getArgValue would read as the selector. zsh drops an empty unquoted `$DESC`, so\n * `--description $DESC $SEL` also passes, with the selector as the description:\n * the argv is identical, and that case is accepted. Errors name the flag only:\n * a fused `--token` would otherwise print the credential.\n */\nexport function assertWellFormedGlobalFlags(argv: string[]): void {\n const refuse = (message: string): never => {\n console.error(`Error: ${message}`);\n process.exit(1);\n };\n for (let i = 0; i < argv.length; i++) {\n const token = argv[i];\n if (isFreeTextValue(argv, i)) {\n // getArgValue reads any `--org=...` word as the selector, even as another flag's value.\n if (token.includes('=') && GLOBAL_VALUE_FLAGS.includes(token.split('=')[0])) {\n refuse(`the value of ${argv[i - 1]} starts with ${flagName(token)}=, which the CLI would read as ${flagName(token)}.`);\n }\n continue;\n }\n if (/^\\s+--/.test(token)) {\n refuse(\n `an argument starting \" ${flagName(token)}\" has leading whitespace, so its flag would be ignored. Remove the leading space.`\n );\n }\n if (!token.startsWith('--')) continue;\n const [name, ...inline] = token.split('=');\n // `--description=x --org A` is free text the user attached with `=`; `--limit=1 --org A` is fused.\n const freeTextInline = inline.length > 0 && isFreeTextFlag(name);\n if (/\\s/.test(name) || (!freeTextInline && /\\s--[\\w-]+/.test(token))) {\n refuse(\n `${flagName(token)} reached the CLI fused with what follows it, as ONE argument, so it would be ignored. ` +\n 'The shell did not split it (zsh does not word-split an unquoted $VAR). ' +\n 'Pass each flag and value as its own argument. If this is the value of another flag, attach it with = ' +\n '(--flag=--org ...) or pass it as its own argument after that flag.'\n );\n }\n if (!GLOBAL_VALUE_FLAGS.includes(name)) continue;\n const value = inline.length > 0 ? inline.join('=') : argv[i + 1];\n if (!value || (inline.length === 0 && value.startsWith('--'))) refuse(`${name} requires a value.`);\n if (/^\\s|\\s--[\\w-]+/.test(value)) {\n refuse(`the value of ${name} holds another flag or leading whitespace; pass each flag and value as its own argument.`);\n }\n }\n}\n\nexport function hasFlag(argv: string[], ...flags: string[]): boolean {\n return flags.some((flag) => argv.includes(flag));\n}\n\n/* ── Environment / profile mapping ───────────────────────────────────── */\n\n/** Map --env values to profile names for multi-profile auth storage */\nexport function envToProfile(env: string): string {\n if (env === 'prod' || env === 'production') return 'production';\n if (env === 'dev') return 'dev';\n if (env === 'local') return 'local';\n return env;\n}\n\nconst VALID_ENVS = ['prod', 'dev', 'local'];\n\n/** Environment URL mappings shared across CLI commands */\nexport const ENV_URLS: Record<string, { api: string; app: string }> = {\n prod: {\n api: DEFAULT_API_URL,\n app: DEFAULT_APP_URL,\n },\n production: {\n api: DEFAULT_API_URL,\n app: DEFAULT_APP_URL,\n },\n dev: {\n api: 'https://api.dev.runcofactor.com',\n app: 'https://app.dev.runcofactor.com',\n },\n local: {\n api: 'http://localhost:3000',\n app: 'http://localhost:5173',\n },\n};\n\n/** Reverse of `ENV_URLS`: the env label (`production`|`dev`|`local`) for an API\n * URL, or `undefined` for a custom URL. Used to tag stored sessions. */\nexport function envLabelForApiUrl(apiUrl: string): string | undefined {\n for (const [key, urls] of Object.entries(ENV_URLS)) {\n if (urls.api === apiUrl) return envToProfile(key);\n }\n return undefined;\n}\n\n/**\n * Storage key for an org's session, scoped by environment so the same org can\n * be logged into prod and dev at once without one clobbering the other\n * (`org-123@dev` vs `org-123@production`).\n */\nexport function orgProfileKey(orgId: string, envLabel?: string): string {\n return envLabel ? `${orgId}@${envLabel}` : orgId;\n}\n\n/**\n * Derive the web-app URL for a given API URL, always on the cofactor domain.\n *\n * Canary is retired as a brand, so anything we print should send people to\n * cofactor even when the session itself was established against a trycanary\n * host (those hosts stay live and keep working — only the printed link moves).\n * localhost is left alone: there is no cofactor equivalent of a dev server.\n */\nexport function resolveAppUrl(apiUrl: string): string {\n const derived = (() => {\n for (const env of Object.values(ENV_URLS)) {\n if (env.api === apiUrl) return env.app;\n }\n // Fallback for custom API URLs: replace \"api.\" at protocol boundary or \"/api\" path\n return apiUrl.replace(/(:\\/\\/)api\\./, '$1app.').replace(/:3000\\b/, ':5173');\n })();\n return derived.replace(/\\btrycanary\\.ai\\b/, 'runcofactor.com');\n}\n\n/**\n * A DNS label, matching the shape the API validates an `app_subdomain` against\n * (and the web app's `TENANT_LABEL_PATTERN`). Keep the two in sync.\n */\nconst TENANT_LABEL_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;\n\n/**\n * The app URL to print for a session — the org's own host when it has a vanity\n * subdomain, otherwise the shared one.\n *\n * A link to the shared host is not wrong so much as unhelpful for an org with\n * its own host: the shared host resolves whichever org the browser session\n * happens to be on, which may not be the org the command was run against.\n *\n * A label that isn't a DNS label falls back to the shared host rather than\n * being spliced in. Today the only writer is our own API, which validates it —\n * but `hostname = \"cf/evil.\" + host` does not throw, it silently truncates the\n * host to `cf` and drops our domain entirely, so failing closed is cheap\n * insurance against a link that points somewhere unintended.\n */\nexport function resolveOrgAppUrl(apiUrl: string, appSubdomain?: string | null): string {\n const appUrl = resolveAppUrl(apiUrl);\n if (!appSubdomain || !TENANT_LABEL_PATTERN.test(appSubdomain)) return appUrl;\n\n const url = new URL(appUrl);\n // Only the cofactor app hosts carry per-org subdomains; a localhost or\n // custom host has nowhere to put the label.\n if (!url.hostname.startsWith('app.') || !url.hostname.endsWith('.runcofactor.com')) {\n return appUrl;\n }\n url.hostname = `${appSubdomain}.${url.hostname}`;\n return url.toString().replace(/\\/$/, '');\n}\n\nfunction isMultiProfile(data: unknown): data is MultiProfileAuth {\n return typeof data === 'object' && data !== null && 'profiles' in data;\n}\n\n/** Read the raw auth file and normalize to multi-profile format */\nasync function readAuthFile(configDir?: string): Promise<MultiProfileAuth | null> {\n try {\n const content = await fs.readFile(configDir ? path.join(configDir, 'auth.json') : getAuthPaths().file, 'utf8');\n const data = JSON.parse(content) as unknown;\n\n if (isMultiProfile(data)) {\n return data;\n }\n\n // Legacy flat format — treat as the \"default\" profile\n const legacy = data as LegacyAuth;\n return {\n profiles: { default: legacy },\n default: 'default',\n };\n } catch {\n return null;\n }\n}\n\nexport async function readStoredAuth(profile?: string): Promise<StoredAuth | null> {\n const auth = await readAuthFile();\n if (!auth) return null;\n\n const key = profile ?? auth.default;\n return auth.profiles[key] ?? null;\n}\n\nexport async function readStoredToken(profile?: string): Promise<string | null> {\n const auth = await readStoredAuth(profile);\n return auth?.token ?? null;\n}\n\nexport async function readStoredApiUrl(profile?: string): Promise<string | null> {\n const auth = await readStoredAuth(profile);\n return auth?.apiUrl ?? null;\n}\n\n/** Return all stored tokens across every profile */\nexport async function readAllStoredTokens(): Promise<string[]> {\n const auth = await readAuthFile();\n if (!auth) return [];\n return Object.values(auth.profiles)\n .map((p) => p.token)\n .filter((t): t is string => !!t);\n}\n\nexport async function saveAuth(auth: StoredAuth, profile?: string): Promise<string> {\n const { dir: AUTH_DIR, file: AUTH_FILE } = getAuthPaths();\n await fs.mkdir(AUTH_DIR, { recursive: true, mode: 0o700 });\n\n // Read existing file (may be legacy or multi-profile)\n let existing: MultiProfileAuth;\n try {\n const content = await fs.readFile(AUTH_FILE, 'utf8');\n const data = JSON.parse(content) as unknown;\n\n if (isMultiProfile(data)) {\n existing = data;\n } else {\n // Migrate legacy flat format into profiles.default\n existing = {\n profiles: { default: data as LegacyAuth },\n default: 'default',\n };\n }\n } catch {\n existing = { profiles: {}, default: 'default' };\n }\n\n const key = profile ?? 'default';\n existing.profiles[key] = auth;\n\n // Set default to this profile if no default exists yet\n if (!existing.profiles[existing.default]) {\n existing.default = key;\n }\n\n await fs.writeFile(AUTH_FILE, JSON.stringify(existing, null, 2), {\n encoding: 'utf8',\n mode: 0o600,\n });\n // writeFile's mode only applies on creation; enforce 0600 on overwrite too.\n await fs.chmod(AUTH_FILE, 0o600).catch(() => {});\n return AUTH_FILE;\n}\n\n/* ── Multi-org session lookup ────────────────────────────────────────── */\n\nexport type StoredProfile = { key: string; auth: StoredAuth };\n\n/** Enumerate every stored session (profile) plus the current default key. */\nexport async function readAllProfiles(): Promise<{\n profiles: StoredProfile[];\n default: string;\n}> {\n const auth = await readAuthFile();\n if (!auth) return { profiles: [], default: 'default' };\n return {\n profiles: Object.entries(auth.profiles).map(([key, a]) => ({ key, auth: a })),\n default: auth.default,\n };\n}\n\nexport type SessionMatch =\n | { kind: 'match'; key: string; auth: StoredAuth }\n | { kind: 'none' }\n | { kind: 'ambiguous'; candidates: StoredProfile[] };\n\n/**\n * Find the stored session for an org, selected by `orgId` (exact) or `orgName`\n * (case-insensitive). When `env` is given it narrows to sessions in that\n * environment, so the same org can be logged in across prod/dev without clashing.\n * Returns `ambiguous` when a bare name matches sessions in multiple envs.\n * `apiUrl` replaces the env filter: it selects a login made with a custom `--api-url`\n * (no env label) by exact API URL, so callers pass `env` or `apiUrl`, never both.\n */\nexport async function findSessionByOrg(\n selector: string,\n env?: string,\n configDir?: string,\n apiUrl?: string\n): Promise<SessionMatch> {\n const auth = await readAuthFile(configDir);\n if (!auth) return { kind: 'none' };\n\n const sel = selector.toLowerCase();\n const all = Object.entries(auth.profiles).map(([key, a]) => ({ key, auth: a }));\n\n // Exact orgId match is unambiguous — prefer it over name matches.\n const byId = all.filter(({ auth: a }) => a.orgId === selector);\n let candidates = byId.length > 0 ? byId : all.filter(({ auth: a }) => a.orgName?.toLowerCase() === sel);\n\n // When --env is given, restrict to sessions in that environment — ALWAYS, even\n // for a single candidate. Otherwise a lone prod session would resolve under\n // `--env dev` and its token would be sent to the dev host (fail-open). No\n // match in the requested env → fall through to `none` so the caller errors.\n if (apiUrl) {\n // A login made with a custom --api-url carries no env label; match its host exactly.\n candidates = candidates.filter(({ auth: a }) => a.apiUrl === apiUrl);\n } else if (env) {\n const wantEnv = envToProfile(env);\n const wantApi = ENV_URLS[env]?.api;\n candidates = candidates.filter(\n ({ auth: a }) => a.envLabel === wantEnv || (!!wantApi && a.apiUrl === wantApi)\n );\n }\n\n // Collapse duplicate profiles that point at the SAME session: login mirrors a\n // session under both an org-scoped key (`org@env`) and the env-name key (for\n // `--env` lookups), so identical entries must not read as an ambiguous\n // multi-env match. Comparison is by token — the JWT is the real identity — so a\n // future refactor must not \"fix\" this into trusting local orgName/orgId fields.\n // The org-scoped key sorts first (written first), so it survives as representative.\n if (candidates.length > 1) {\n const seen = new Map<string, StoredProfile>();\n for (const c of candidates) {\n const idKey = c.auth.token ?? c.key;\n if (!seen.has(idKey)) seen.set(idKey, c);\n }\n candidates = [...seen.values()];\n }\n\n // `login` writes the org-scoped key (`orgProfileKey`) on every login, but the\n // env-name mirror (`production`, `dev`, …) only on `login --env`. After\n // `login --org X --env prod` then a plain `login --org X`, the mirror holds an\n // older token for the same org and env, and `--org X --env prod` failed as\n // ambiguous. The org-scoped key is the latest login for that org and env, so\n // it wins over its own mirror — deliberately, even if that login was another\n // user. The mirror's orgId/envLabel only decide which entry is discarded; the\n // survivor already passed the selector and env filter above.\n if (candidates.length > 1) {\n const keys = new Set(candidates.map((c) => c.key));\n const isShadowedEnvMirror = ({ key, auth: a }: StoredProfile) =>\n !!a.orgId && !!a.envLabel && key === a.envLabel && keys.has(orgProfileKey(a.orgId, a.envLabel));\n candidates = candidates.filter((c) => !isShadowedEnvMirror(c));\n }\n\n if (candidates.length === 0) return { kind: 'none' };\n if (candidates.length === 1) return { kind: 'match', key: candidates[0].key, auth: candidates[0].auth };\n return { kind: 'ambiguous', candidates };\n}\n\n/** Point the persistent `default` at an existing profile key. */\nexport async function setDefaultProfile(key: string): Promise<void> {\n const auth = await readAuthFile();\n if (!auth || !auth.profiles[key]) {\n throw new Error(`No stored session for profile \"${key}\".`);\n }\n auth.default = key;\n const { dir: AUTH_DIR, file: AUTH_FILE } = getAuthPaths();\n await fs.mkdir(AUTH_DIR, { recursive: true, mode: 0o700 });\n await fs.writeFile(AUTH_FILE, JSON.stringify(auth, null, 2), {\n encoding: 'utf8',\n mode: 0o600,\n });\n // writeFile's mode only applies on creation; enforce 0600 on overwrite too.\n await fs.chmod(AUTH_FILE, 0o600).catch(() => {});\n}\n\n/* ── Shared config resolution ────────────────────────────────────────── */\n\ntype ResolvedConfig = {\n apiUrl: string;\n token: string;\n /**\n * The selected org's vanity app subdomain, when the invocation resolved to a\n * stored session that has one. Carried here so any command can print a link\n * on the org's own host via {@link resolveOrgAppUrl} without re-reading the\n * auth file or widening its own signature.\n *\n * Undefined for token-only auth (`--token`, `CANARY_API_TOKEN`), where there\n * is no stored profile to read it from — those callers get the shared host,\n * which is the same link they get today.\n */\n appSubdomain?: string | null;\n};\n\n/**\n * Which stored session an invocation targets, before falling back to `--env`\n * profile / default. Returns the org selector string when one is in play (from\n * `--org` or `CANARY_ORG`), else `null`. With `--env` the selector still applies:\n * the (org, env) pair must resolve to one session or the command fails, so\n * `CANARY_ORG` is never silently dropped.\n */\nexport function getOrgSelector(argv: string[]): string | null {\n return getArgValue(argv, '--org') || (readBrandEnv('CANARY_ORG') ?? null);\n}\n\n/**\n * The API URL for this invocation, with no token and no `--org` session: `--api-url`, then `--env`,\n * then the env var, then the stored login's URL, then production. An unknown `--env` falls through:\n * `resolveConfig` rejects it before getting here, but callers that skip it (guides, which need no\n * login) get no validation and no `--org` session lookup.\n */\nexport async function resolveApiUrl(argv: string[]): Promise<string> {\n const env = getArgValue(argv, '--env');\n const profile = env ? envToProfile(env) : undefined;\n return (\n getArgValue(argv, '--api-url') ??\n (env ? ENV_URLS[env]?.api : undefined) ??\n readBrandEnv('CANARY_API_URL') ??\n (await readStoredApiUrl(profile)) ??\n DEFAULT_API_URL\n );\n}\n\nasync function resolveConfigInternal(\n argv: string[],\n opts: { required: boolean }\n): Promise<ResolvedConfig | null> {\n const env = getArgValue(argv, '--env');\n const profile = env ? envToProfile(env) : undefined;\n\n if (env && !ENV_URLS[env]) {\n if (opts.required) {\n console.error(`Unknown environment: ${env}`);\n console.error(`Valid environments: ${VALID_ENVS.join(', ')}`);\n process.exit(1);\n }\n return null;\n }\n\n // `--org <name|id>` (or CANARY_ORG) picks one of your logged-in sessions to\n // act as. It's an opt-in selector layered on top of the existing --env /\n // default resolution — a bare command with no --org behaves exactly as before.\n const orgSelector = getOrgSelector(argv);\n let selectedAuth: StoredAuth | null = null;\n if (orgSelector) {\n const match = await findSessionByOrg(orgSelector, env);\n if (match.kind === 'none') {\n if (opts.required) {\n printNoSessionForOrg(orgSelector, await readAllProfiles());\n process.exit(1);\n }\n return null;\n }\n if (match.kind === 'ambiguous') {\n if (opts.required) {\n printAmbiguousOrg(orgSelector, match.candidates);\n process.exit(1);\n }\n return null;\n }\n selectedAuth = match.auth;\n }\n\n let apiUrl: string;\n if (selectedAuth) {\n // The selected session's host is authoritative: never silently repoint an\n // org's bearer token to a different host via --api-url / CANARY_API_URL.\n apiUrl = selectedAuth.apiUrl ?? DEFAULT_API_URL;\n const explicitApiUrl = getArgValue(argv, '--api-url');\n if (explicitApiUrl && explicitApiUrl !== apiUrl) {\n if (opts.required) {\n console.error(`Error: the \"${orgSelector}\" session uses ${apiUrl}, but --api-url is ${explicitApiUrl}.`);\n console.error('Omit --api-url, or log that org in against the other host.');\n process.exit(1);\n }\n return null;\n }\n } else {\n apiUrl = await resolveApiUrl(argv);\n }\n\n const explicitToken = getArgValue(argv, '--token');\n\n // The session the token actually came from, when it came from one at all.\n // Tracked rather than re-derived afterwards: a `??` chain over \"selected\n // session, else stored profile\" cannot tell \"this org has no subdomain\"\n // (a real `null`) from \"no session was selected\", and would graft an\n // unrelated org's vanity host onto the link — the wrong org entirely.\n let tokenSource: StoredAuth | null = null;\n\n let token: string | null;\n if (explicitToken) {\n token = explicitToken;\n } else if (selectedAuth) {\n // An --org / CANARY_ORG selection points at a specific stored session.\n token = selectedAuth.token ?? readBrandEnv('CANARY_API_TOKEN') ?? null;\n if (selectedAuth.token) tokenSource = selectedAuth;\n if (!token && opts.required) {\n console.error(`Error: No token stored for org \"${orgSelector}\".`);\n console.error(`Run: canary login --org \"${orgSelector}\"`);\n process.exit(1);\n }\n } else if (profile) {\n const storedAuth = await readStoredAuth(profile);\n token = storedAuth?.token ?? readBrandEnv('CANARY_API_TOKEN') ?? null;\n if (storedAuth?.token) tokenSource = storedAuth;\n if (!token && opts.required) {\n console.error(`Error: No token found for \"${env}\" profile.`);\n console.error(`Run: canary login --env ${env}`);\n process.exit(1);\n }\n } else {\n const envToken = readBrandEnv('CANARY_API_TOKEN');\n if (envToken) {\n token = envToken;\n } else {\n const storedAuth = await readStoredAuth();\n token = storedAuth?.token ?? null;\n if (storedAuth?.token) tokenSource = storedAuth;\n }\n if (!token && opts.required) {\n console.error('Error: No API token found.');\n console.error('Run: canary login');\n process.exit(1);\n }\n }\n\n // An explicit --org/CANARY_ORG selection names the org outright, so it wins\n // even when its stored session held no token and the credential came from the\n // environment — `apiUrl` above already treats the selection as authoritative\n // in exactly that case, and the two must not disagree about which org this\n // invocation is acting as. Otherwise only the session that supplied the\n // credential names a host; token-only auth names no org and keeps the shared\n // one, the same link it produced before.\n const appSubdomain = (selectedAuth ?? tokenSource)?.appSubdomain ?? null;\n\n const source = selectedAuth ?? tokenSource;\n setActingTarget({\n orgName: source?.orgName ?? null,\n orgId: source?.orgId ?? null,\n env: source?.envLabel ?? env ?? null,\n apiUrl,\n });\n\n return token ? { apiUrl, token, appSubdomain } : null;\n}\n\n/** Error output when `--org`/`CANARY_ORG` names an org with no stored session. */\nexport function printNoSessionForOrg(\n selector: string,\n all: { profiles: StoredProfile[] }\n): void {\n console.error(`Error: No logged-in session for org \"${selector}\".`);\n const withOrg = all.profiles.filter((p) => p.auth.orgName || p.auth.orgId);\n if (withOrg.length > 0) {\n console.error('\\nLogged-in orgs:');\n for (const { auth: a } of withOrg) {\n const envLabel = a.envLabel ? ` [${a.envLabel}]` : '';\n console.error(` - ${a.orgName ?? '(unnamed)'} (${a.orgId ?? '?'})${envLabel}`);\n }\n }\n console.error(`\\nTo add one: canary login --org \"${selector}\"`);\n console.error(\n 'Note: --org selects which of your orgs to act as. Superadmin commands that\\n' +\n 'target a different org use --target-org instead.'\n );\n}\n\n/** Error output when a selector matches more than one session. Distinguishes an\n * env split (same org in prod+dev → narrow with --env) from a genuine name clash\n * across distinct orgs (→ select by org ID, --env won't help). */\nexport function printAmbiguousOrg(selector: string, candidates: StoredProfile[]): void {\n const distinctOrgs = new Set(candidates.map((c) => c.auth.orgId ?? c.key));\n if (distinctOrgs.size <= 1) {\n console.error(`Error: Org \"${selector}\" is logged into multiple environments. Narrow with --env:`);\n } else {\n console.error(`Error: \"${selector}\" matches multiple orgs. Select by org ID:`);\n }\n for (const { auth: a } of candidates) {\n const envLabel = a.envLabel ?? '(unknown env)';\n console.error(` - ${a.orgName ?? '(unnamed)'} (${a.orgId ?? '?'}) [${envLabel}]`);\n }\n}\n\n/**\n * Resolve API URL and auth token from argv flags, env vars, and stored profiles.\n * Used by knobs, feature-flag, release, and debug-session commands.\n */\nexport async function resolveConfig(argv: string[]): Promise<ResolvedConfig> {\n return (await resolveConfigInternal(argv, { required: true }))!;\n}\n\nexport async function resolveOptionalConfig(argv: string[]): Promise<ResolvedConfig | null> {\n return resolveConfigInternal(argv, { required: false });\n}\n\n/**\n * Where the effective auth token would come from for this invocation:\n * - `flag` — explicit `--token`\n * - `env` — CANARY_API_TOKEN / COFACTOR_API_TOKEN\n * - `stored` — an interactive `canary login` session in auth.json\n * - `none` — no token resolvable\n *\n * Mirrors the precedence in `resolveConfigInternal` exactly (which differs by\n * whether a profile is selected). `stored` is the only \"logged in interactively\"\n * source; `flag`/`env` are API-key style auth used by CI/automation.\n */\nexport async function resolveAuthSource(\n argv: string[]\n): Promise<'flag' | 'env' | 'stored' | 'none'> {\n const env = getArgValue(argv, '--env');\n if (env && !ENV_URLS[env]) return 'none';\n const profile = env ? envToProfile(env) : undefined;\n\n if (getArgValue(argv, '--token')) return 'flag';\n\n const orgSelector = getOrgSelector(argv);\n if (orgSelector) {\n const match = await findSessionByOrg(orgSelector, env);\n if (match.kind === 'match' && match.auth.token) return 'stored';\n if (readBrandEnv('CANARY_API_TOKEN')) return 'env';\n return 'none';\n }\n\n if (profile) {\n // With a profile, stored auth wins over the env var.\n if (await readStoredToken(profile)) return 'stored';\n if (readBrandEnv('CANARY_API_TOKEN')) return 'env';\n return 'none';\n }\n\n // Without a profile, the env var wins over stored auth.\n if (readBrandEnv('CANARY_API_TOKEN')) return 'env';\n if (await readStoredToken()) return 'stored';\n return 'none';\n}\n","/**\n * Central fetch wrapper for the Canary CLI.\n *\n * Exists to classify failures so corporate-proxy interference (Zscaler,\n * Netskope, Cloudflare Access, etc.) is distinguishable from real auth\n * expiry. Every non-2xx or transport error gets a specific, actionable\n * message instead of the historical blanket \"session may have expired.\"\n *\n * Set CANARY_DEBUG=1 (or pass --debug to the CLI) to log every request\n * and its classification — this is what affected users should share\n * with us or their IT/Zscaler admin.\n */\n\nimport process from 'node:process';\nimport { debug, isDebug } from './debug.js';\nimport { decodeJwtPayload } from './jwt.js';\n\n/** Header every canary API response carries. Absence => response did not come from our API. */\nconst CANARY_REQUEST_ID_HEADER = 'x-canary-request-id';\n\n/** Default per-request timeout. Zscaler-half-opened sockets have been observed\n * hanging indefinitely; the CLI should give up and classify rather than hang. */\nconst DEFAULT_TIMEOUT_MS = 30_000;\n\n/** Treat a JWT exp within this grace window as still valid — tolerates the\n * typical handful of seconds of client-clock skew so we don't mislabel a\n * 30-second-fast clock as `token-revoked`. */\nconst JWT_EXP_SKEW_SEC = 60;\n\n/**\n * Best-effort scrub of `Bearer <token>` and bare three-segment JWTs from\n * error text before we print it. Doctor output is explicitly coached to be\n * shared with IT — if a proxy block page reflects the Authorization header,\n * we do not want the token in that paste.\n */\nfunction redactSecrets(text: string): string {\n return text\n .replace(/Bearer\\s+[A-Za-z0-9._-]+/gi, 'Bearer [redacted]')\n .replace(/\\beyJ[A-Za-z0-9_-]{6,}\\.[A-Za-z0-9_-]{6,}\\.[A-Za-z0-9_-]{6,}\\b/g, '[redacted-jwt]');\n}\n\n/** Strip query string — query params sometimes carry one-time tokens. */\nfunction redactUrl(url: string): string {\n const q = url.indexOf('?');\n return q === -1 ? url : `${url.slice(0, q)}?[redacted]`;\n}\n\nexport type FailureKind =\n | 'tls'\n | 'network'\n | 'html-body'\n | 'proxy-injected-4xx'\n | 'token-revoked'\n | 'token-expired'\n | 'unauthorized'\n | 'http-error';\n\nexport interface ClassifiedFailure {\n kind: FailureKind;\n status: number | null;\n url: string;\n message: string;\n /**\n * Response body text. Full body for `http-error` (so callers can parse\n * structured error payloads); truncated snippet for proxy/TLS failures\n * where the body is likely an HTML block page.\n */\n body?: string;\n /** Best-effort content-type. */\n contentType?: string;\n /** Raw error object for transport failures. */\n cause?: unknown;\n /**\n * Value of `x-canary-request-id` on the response, if any. Present means\n * the response came from our API (even for `token-revoked` / `token-expired`\n * / `unauthorized`); absent means the response was injected or the request\n * never reached us.\n */\n requestId?: string | null;\n}\n\n/**\n * Node/undici TLS error codes that indicate a MITM proxy (Zscaler et al.)\n * is intercepting HTTPS without the user trusting the proxy's root CA.\n */\nconst TLS_CODES = new Set([\n 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',\n 'UNABLE_TO_GET_ISSUER_CERT',\n 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',\n 'SELF_SIGNED_CERT_IN_CHAIN',\n 'DEPTH_ZERO_SELF_SIGNED_CERT',\n 'CERT_HAS_EXPIRED',\n 'CERT_UNTRUSTED',\n 'ERR_TLS_CERT_ALTNAME_INVALID',\n 'CERT_SIGNATURE_FAILURE',\n]);\n\nfunction extractErrorCode(err: unknown): string | null {\n if (!err || typeof err !== 'object') return null;\n const withCode = err as { code?: unknown; cause?: unknown };\n if (typeof withCode.code === 'string') return withCode.code;\n if (withCode.cause) return extractErrorCode(withCode.cause);\n return null;\n}\n\nfunction looksLikeHtml(body: string, contentType: string | null): boolean {\n if (contentType && contentType.toLowerCase().includes('text/html')) return true;\n const trimmed = body.trimStart();\n return trimmed.startsWith('<!') || trimmed.startsWith('<html') || trimmed.startsWith('<HTML');\n}\n\n/** Decode JWT `exp` and compare to now (with a small skew grace); null if undecodable. */\nfunction jwtExpStatus(token: string | undefined): 'expired' | 'valid' | 'unknown' {\n if (!token) return 'unknown';\n const payload = decodeJwtPayload(token);\n const exp = payload && typeof payload.exp === 'number' ? (payload.exp as number) : null;\n if (exp === null) return 'unknown';\n const nowSec = Math.floor(Date.now() / 1000);\n return exp < nowSec - JWT_EXP_SKEW_SEC ? 'expired' : 'valid';\n}\n\n/** Warn once per process when sending Authorization to a non-local http:// URL. */\nlet warnedAboutPlaintext = false;\nfunction maybeWarnPlaintextAuth(url: string, hasAuthHeader: boolean): void {\n if (!hasAuthHeader || warnedAboutPlaintext) return;\n if (!url.startsWith('http://')) return;\n try {\n const host = new URL(url).hostname;\n if (host === 'localhost' || host === '127.0.0.1' || host === '::1') return;\n } catch {\n return;\n }\n warnedAboutPlaintext = true;\n process.stderr.write(\n `[canary] WARNING: sending Authorization over plaintext http:// (${url}). ` +\n 'Your API token may be exposed to the network. Use https:// in CANARY_API_URL.\\n'\n );\n}\n\nfunction hasAuthHeader(init: RequestInit): boolean {\n const h = init.headers;\n if (!h) return false;\n if (h instanceof Headers) return h.has('authorization');\n if (Array.isArray(h)) return h.some(([k]) => k.toLowerCase() === 'authorization');\n return Object.keys(h).some((k) => k.toLowerCase() === 'authorization');\n}\n\n/** Who the current invocation resolved to act as; set by config resolution. */\nlet actingTarget: { orgName: string | null; orgId: string | null; env: string | null; apiUrl: string } | null = null;\nlet announcedWrite = false;\n\nexport function setActingTarget(target: NonNullable<typeof actingTarget>): void {\n actingTarget = target;\n}\n\n/** Name the org and environment a write is aimed at, once per process, so a misdirected write is visible. */\nfunction announceWriteTarget(url: string, method: string): void {\n if (announcedWrite || method === 'GET') return;\n announcedWrite = true;\n const t = actingTarget;\n const target = t?.apiUrl ?? url;\n let origin = target;\n try {\n origin = new URL(target).origin;\n } catch {\n // Malformed --api-url: print it raw; the request below classifies the failure.\n }\n process.stderr.write(\n `acting as ${t?.orgName ?? 'unknown org'} (${t?.orgId ?? 'unknown id'}) on ${t?.env ?? 'unknown env'} ${origin}\\n`\n );\n}\n\n/**\n * Wrap global `fetch` with classification. Always resolves — never throws —\n * so callers can make a single uniform decision from the returned shape.\n */\nexport async function apiFetch(\n url: string,\n init: RequestInit & { token?: string; timeoutMs?: number } = {}\n): Promise<\n | { ok: true; response: Response; requestId: string | null }\n | { ok: false; failure: ClassifiedFailure }\n> {\n const { token, timeoutMs, ...fetchInit } = init;\n maybeWarnPlaintextAuth(url, hasAuthHeader(fetchInit));\n announceWriteTarget(url, (fetchInit.method ?? 'GET').toUpperCase());\n debug(`→ ${fetchInit.method ?? 'GET'} ${redactUrl(url)}`);\n\n // Merge caller-supplied signal with our timeout so both can abort.\n // timeoutMs <= 0 disables the timeout (use for long-lived SSE streams).\n const timeout = timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const timeoutSignal = timeout > 0 ? AbortSignal.timeout(timeout) : null;\n const effectiveSignal =\n fetchInit.signal && timeoutSignal\n ? AbortSignal.any([fetchInit.signal, timeoutSignal])\n : (fetchInit.signal ?? timeoutSignal ?? undefined);\n\n let response: Response;\n try {\n response = await fetch(url, { ...fetchInit, signal: effectiveSignal });\n } catch (err) {\n const isTimeout =\n (err as { name?: string })?.name === 'TimeoutError' ||\n Boolean(timeoutSignal?.aborted);\n if (isTimeout) {\n const msg = `Request to ${redactUrl(url)} timed out after ${timeout}ms.`;\n debug(`✖ network timeout`);\n return {\n ok: false,\n failure: { kind: 'network', status: null, url, message: msg, cause: err },\n };\n }\n const code = extractErrorCode(err);\n if (code && TLS_CODES.has(code)) {\n const msg = [\n `TLS verification failed talking to ${redactUrl(url)} (${code}).`,\n 'A corporate proxy (Zscaler, Netskope, ZPA, Cloudflare Access) is likely intercepting HTTPS.',\n 'Fixes: point Node at the proxy\\'s root CA with',\n ' NODE_EXTRA_CA_CERTS=/path/to/corporate-root.pem canary …',\n 'or on Node 20+ enable the system trust store with',\n ' NODE_OPTIONS=--use-system-ca canary …',\n ].join('\\n');\n debug(`✖ tls ${code}`);\n return { ok: false, failure: { kind: 'tls', status: null, url, message: msg, cause: err } };\n }\n const msg = `Network error reaching ${redactUrl(url)}: ${String((err as Error).message ?? err)}`;\n debug(`✖ network ${msg}`);\n return { ok: false, failure: { kind: 'network', status: null, url, message: msg, cause: err } };\n }\n\n const requestId = response.headers.get(CANARY_REQUEST_ID_HEADER);\n const contentType = response.headers.get('content-type');\n debug(`← ${response.status} ${redactUrl(url)} (ct=${contentType ?? 'n/a'} rid=${requestId ?? 'none'})`);\n\n if (response.ok) {\n return { ok: true, response, requestId };\n }\n\n // Read body once so we can classify and still return something useful.\n // Scrub secrets before constructing user-facing `snippet`; `bodyText` is\n // kept intact for callers that parse structured JSON error bodies.\n const bodyText = await response.clone().text().catch(() => '');\n const snippet = redactSecrets(bodyText.slice(0, 200));\n\n // HTML on a JSON endpoint => proxy block page or captive portal.\n if (looksLikeHtml(bodyText, contentType)) {\n return {\n ok: false,\n failure: {\n kind: 'html-body',\n status: response.status,\n url,\n contentType: contentType ?? undefined,\n requestId,\n body: snippet,\n message: [\n `Got an HTML response from ${url} (status ${response.status}).`,\n 'A corporate proxy block page or captive portal is intercepting this request — the',\n 'response did not come from the Canary API.',\n 'Check that your proxy (e.g. Zscaler) allowlists the API hostname, and that any',\n 'required sign-in to the proxy itself is current.',\n snippet ? `First bytes: ${snippet.replace(/\\s+/g, ' ')}` : '',\n ]\n .filter(Boolean)\n .join('\\n'),\n },\n };\n }\n\n // 401/403 without our header => not our response.\n if ((response.status === 401 || response.status === 403) && !requestId) {\n return {\n ok: false,\n failure: {\n kind: 'proxy-injected-4xx',\n status: response.status,\n url,\n contentType: contentType ?? undefined,\n requestId,\n body: snippet,\n message: [\n `Got ${response.status} from ${url} but the response is missing the \\`${CANARY_REQUEST_ID_HEADER}\\` header.`,\n 'This response was almost certainly injected by a corporate proxy (Zscaler, Netskope,',\n 'Cloudflare Access) rather than returned by our API — retrying \"canary login\" will not fix it.',\n 'Ask your IT team to allowlist the API host, or re-auth to the proxy and try again.',\n ].join('\\n'),\n },\n };\n }\n\n if (response.status === 401) {\n const jwtStatus = jwtExpStatus(token);\n if (jwtStatus === 'valid') {\n return {\n ok: false,\n failure: {\n kind: 'token-revoked',\n status: 401,\n url,\n requestId,\n body: snippet,\n message: [\n 'Server rejected a token that is still valid locally (unexpired JWT).',\n 'Likely causes: the token was revoked, the server\\'s signing key rotated, or the',\n 'user/org was deactivated. `canary login` will issue a fresh token.',\n ].join('\\n'),\n },\n };\n }\n if (jwtStatus === 'expired') {\n return {\n ok: false,\n failure: {\n kind: 'token-expired',\n status: 401,\n url,\n requestId,\n body: snippet,\n message: 'Your stored token has expired. Run: canary login',\n },\n };\n }\n return {\n ok: false,\n failure: {\n kind: 'unauthorized',\n status: 401,\n url,\n requestId,\n body: snippet,\n message: 'Unauthorized. Run: canary login',\n },\n };\n }\n\n return {\n ok: false,\n failure: {\n kind: 'http-error',\n status: response.status,\n url,\n contentType: contentType ?? undefined,\n requestId,\n body: bodyText,\n message: `${response.status} ${response.statusText}${snippet ? `: ${snippet}` : ''}`,\n },\n };\n}\n\n/**\n * Kinds of failure the user can't recover from by retrying the same call —\n * no token on disk, proxy interception, TLS mismatch, rejected JWT. Callers\n * should `exitOnFailure` immediately for these. `http-error` is excluded\n * because the caller often needs to pretty-print a structured error body.\n */\nexport function isTerminalFailure(failure: ClassifiedFailure): boolean {\n return failure.kind !== 'http-error';\n}\n\n/**\n * Print a classified failure and exit(1). Use from command handlers that\n * have no way to recover — matches the historical behavior of the various\n * `if (res.status === 401) { console.error(...); process.exit(1); }` blocks.\n */\nexport function exitOnFailure(failure: ClassifiedFailure): never {\n process.stderr.write(`Error: ${failure.message}\\n`);\n if (isDebug() && failure.body && failure.kind !== 'html-body') {\n process.stderr.write(`[canary-debug] body: ${failure.body}\\n`);\n }\n process.exit(1);\n}\n\n/**\n * Drop-in for `fetch()` in CLI call sites that parse the body themselves:\n * exits the process for terminal failures (TLS/proxy/unauthorized) so the\n * user sees a diagnostic, and returns a Response otherwise — whether 2xx\n * or an HTTP error (so the caller can still inspect .status / .json()).\n */\nexport async function fetchOrExit(\n url: string,\n init: RequestInit & { token?: string; timeoutMs?: number } = {}\n): Promise<Response> {\n const result = await apiFetch(url, init);\n if (result.ok) return result.response;\n if (isTerminalFailure(result.failure)) exitOnFailure(result.failure);\n // http-error: reconstruct a Response the caller can json() / read status on.\n return new Response(result.failure.body ?? '', {\n status: result.failure.status ?? 500,\n headers: result.failure.contentType\n ? { 'content-type': result.failure.contentType }\n : undefined,\n });\n}\n","import process from 'node:process';\nimport { splitAtSeparator } from './argv.js';\n\n/**\n * Whether verbose CLI diagnostics are enabled. Opt-in only, so normal runs stay\n * quiet — set CANARY_DEBUG=1 (or =true) or pass --debug. Diagnostics always go\n * to stderr so they never pollute stdout-piped (`--json`) output.\n */\nexport function isDebug(): boolean {\n return (\n process.env.CANARY_DEBUG === '1' ||\n process.env.CANARY_DEBUG === 'true' ||\n splitAtSeparator(process.argv.slice(2)).options.includes('--debug')\n );\n}\n\n/** Write a diagnostic line to stderr, but only when debug mode is enabled. */\nexport function debug(line: string): void {\n if (isDebug()) {\n process.stderr.write(`[canary-debug] ${line}\\n`);\n }\n}\n","/**\n * POSIX-style split at the first `--`: `options` are the CLI's own words,\n * `passthrough` is the command after the separator, which no flag scanning\n * (help, version, config, telemetry) may read.\n */\nexport function splitAtSeparator(argv: string[]): { options: string[]; passthrough: string[] } {\n const separator = argv.indexOf('--');\n return {\n options: separator === -1 ? argv : argv.slice(0, separator),\n passthrough: separator === -1 ? [] : argv.slice(separator + 1),\n };\n}\n\n/**\n * Flags whose value is free text, so it may legitimately start with a flag-like\n * word: `--description \"--org Acme\"`. Only the word after one of these is exempt\n * from the fused-flag check; after any other flag (a switch, a typo, a flag this\n * list does not name) a fused `\"--org X --env prod\"` is still refused, and the\n * error names the escape. Keep it to flags whose value is a name or\n * prose (`--application` is a name lookup that fails loudly on a bad name): a\n * fused selector after a listed flag becomes its value instead of being refused.\n */\nconst FREE_TEXT_FLAGS = new Set([\n '--application', '--body', '--cleanup', '--content', '--description', '--label', '--message', '--name',\n '--preflight', '--prompt', '--query', '--reason', '--search', '--summary', '--title',\n]);\n\n/**\n * Whether `argv[i]` is the free-text value of the flag just before it. A word\n * that is itself a well-formed flag (`--x` or `--x=y`, no whitespace) is never\n * a value, so a bare trailing `--org` after `--description` is still checked.\n */\nexport function isFreeTextValue(argv: string[], i: number): boolean {\n return isFreeTextFlag(argv[i - 1] ?? '') && !/^--[\\w-]+(=\\S*)?$/.test(argv[i]);\n}\n\nexport function isFreeTextFlag(flag: string): boolean {\n return FREE_TEXT_FLAGS.has(flag);\n}\n","/**\n * JWT payload decoder for CLI superadmin detection.\n *\n * Decodes the payload section of a JWT locally (no signature verification,\n * no network calls). Used to conditionally show superadmin CLI commands.\n *\n * @module\n */\n\n/**\n * Decode the payload (second segment) of a JWT without verifying the signature.\n * Returns the parsed JSON object, or `null` if the token is malformed.\n */\nexport function decodeJwtPayload(token: string): Record<string, unknown> | null {\n try {\n const parts = token.split(\".\");\n if (parts.length !== 3) return null;\n\n const base64 = parts[1]!.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const json = Buffer.from(base64, \"base64\").toString(\"utf8\");\n const payload: unknown = JSON.parse(json);\n\n if (typeof payload !== \"object\" || payload === null || Array.isArray(payload)) {\n return null;\n }\n return payload as Record<string, unknown>;\n } catch {\n return null;\n }\n}\n\n/**\n * Returns `true` when the JWT's `is_superadmin` claim is exactly `true`.\n * Returns `false` for any invalid, missing, or non-superadmin token.\n */\nexport function isSuperadminToken(token: string | null | undefined): boolean {\n if (!token) return false;\n const payload = decodeJwtPayload(token);\n return payload?.is_superadmin === true;\n}\n","/**\n * Compiled-in default platform URLs for the CLI.\n *\n * Single source of truth — every command's final `??` fallback resolves here,\n * so the prod default lives in exactly one place. Runtime overrides still win\n * (`--api-url` / `--app-url` flags, `CANARY_API_URL` / `COFACTOR_API_URL` env,\n * `--env`, and stored profile). Both the `canary` and `cofactor` brands share\n * this default; `trycanary.ai` 301-redirects to `runcofactor.com`, so the old\n * host keeps working for anyone with it saved.\n */\nexport const DEFAULT_API_URL = 'https://api.runcofactor.com';\nexport const DEFAULT_APP_URL = 'https://app.runcofactor.com';\n"],"mappings":";;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAOA,cAAa;;;ACUpB,OAAOC,cAAa;;;ACbpB,OAAO,aAAa;;;ACKb,SAAS,iBAAiB,MAA8D;AAC7F,QAAM,YAAY,KAAK,QAAQ,IAAI;AACnC,SAAO;AAAA,IACL,SAAS,cAAc,KAAK,OAAO,KAAK,MAAM,GAAG,SAAS;AAAA,IAC1D,aAAa,cAAc,KAAK,CAAC,IAAI,KAAK,MAAM,YAAY,CAAC;AAAA,EAC/D;AACF;AAWA,IAAM,kBAAkB,oBAAI,IAAI;AAAA,EAC9B;AAAA,EAAiB;AAAA,EAAU;AAAA,EAAa;AAAA,EAAa;AAAA,EAAiB;AAAA,EAAW;AAAA,EAAa;AAAA,EAC9F;AAAA,EAAe;AAAA,EAAY;AAAA,EAAW;AAAA,EAAY;AAAA,EAAY;AAAA,EAAa;AAC7E,CAAC;AAOM,SAAS,gBAAgB,MAAgB,GAAoB;AAClE,SAAO,eAAe,KAAK,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,oBAAoB,KAAK,KAAK,CAAC,CAAC;AAC/E;AAEO,SAAS,eAAe,MAAuB;AACpD,SAAO,gBAAgB,IAAI,IAAI;AACjC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