@testmuai/kane-cli 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/{ChromeProfilePicker-SAXOTO5M.js → ChromeProfilePicker-IRZUDC2R.js} +1 -1
  2. package/dist/{CliFeedbackPrompt-5CNRJ2AC.js → CliFeedbackPrompt-RIIDDIY5.js} +1 -1
  3. package/dist/{CliUploadProgress-7KUXH55I.js → CliUploadProgress-QF57Z3FD.js} +1 -1
  4. package/dist/{ConfigView-5A2DPQNW.js → ConfigView-5R4G4OZ6.js} +1 -1
  5. package/dist/{FolderPicker-4RBXJLK2.js → FolderPicker-G4C4RCP2.js} +1 -1
  6. package/dist/{HelpView-DMXQKJYW.js → HelpView-2ZFLX7JC.js} +1 -1
  7. package/dist/{LinksBox-JQ2MF2QZ.js → LinksBox-623NMFSA.js} +1 -1
  8. package/dist/{LoginWizard-AKV22AJ5.js → LoginWizard-SSE5NJVU.js} +1 -1
  9. package/dist/{ProfilesView-WHPQWB42.js → ProfilesView-DBNO4RSU.js} +1 -1
  10. package/dist/{ProjectPicker-UJUXK3UA.js → ProjectPicker-AFQDF2VS.js} +1 -1
  11. package/dist/{WhoamiView-6EWBKXAF.js → WhoamiView-2VBZBQF7.js} +1 -1
  12. package/dist/{changelog-E4BNKPYL.js → changelog-XYK3P4RQ.js} +1 -1
  13. package/dist/{chunk-54CAWEGK.js → chunk-426ZAKPO.js} +1 -1
  14. package/dist/{chunk-PFVUFDRI.js → chunk-B4K7UTF2.js} +1 -1
  15. package/dist/{chunk-BGUDP4VU.js → chunk-BSMUBGQO.js} +1 -1
  16. package/dist/{chunk-TSMW6QW4.js → chunk-GTYF5DR6.js} +1 -1
  17. package/dist/{chunk-ISIBNO3G.js → chunk-IA4UI2BT.js} +1 -1
  18. package/dist/{chunk-TENTBVGG.js → chunk-JXLB6N6Q.js} +1 -1
  19. package/dist/{chunk-JMFLXNAG.js → chunk-KSHUUU2I.js} +1 -1
  20. package/dist/{chunk-6JPSYIY2.js → chunk-LZZDLYE3.js} +1 -1
  21. package/dist/{chunk-D3WSRUJS.js → chunk-RDG6MGL7.js} +1 -1
  22. package/dist/{chunk-Q47TGXAH.js → chunk-RPQV6H45.js} +1 -1
  23. package/dist/{chunk-BZFESAZK.js → chunk-S2FLPRVR.js} +1 -1
  24. package/dist/{chunk-GEG2YL4Q.js → chunk-XHPTLI5U.js} +1 -1
  25. package/dist/index.js +5 -5
  26. package/dist/{updater-5VMYLGW3.js → updater-H5HYMYRG.js} +1 -1
  27. package/dist/{version-check-54A7DQDT.js → version-check-KS7CP3M5.js} +1 -1
  28. package/package.json +4 -4
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-GEG2YL4Q.js";import"./chunk-HCBYKLMW.js";import"./chunk-D3WSRUJS.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
2
+ import{a,b,c}from"./chunk-XHPTLI5U.js";import"./chunk-HCBYKLMW.js";import"./chunk-RDG6MGL7.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as r}from"./chunk-ISIBNO3G.js";import"./chunk-HCBYKLMW.js";import"./chunk-D3WSRUJS.js";import{c as e}from"./chunk-Q7JVDEOV.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
2
+ import{a as r}from"./chunk-IA4UI2BT.js";import"./chunk-HCBYKLMW.js";import"./chunk-RDG6MGL7.js";import{c as e}from"./chunk-Q7JVDEOV.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as P,d as g,e as f}from"./chunk-JMFLXNAG.js";import{a as c}from"./chunk-HCBYKLMW.js";import"./chunk-D3WSRUJS.js";import{c as d}from"./chunk-Q7JVDEOV.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
2
+ import{c as P,d as g,e as f}from"./chunk-KSHUUU2I.js";import{a as c}from"./chunk-HCBYKLMW.js";import"./chunk-RDG6MGL7.js";import{c as d}from"./chunk-Q7JVDEOV.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f,b as l,c as r}from"./chunk-PFVUFDRI.js";import{a as d}from"./chunk-HCBYKLMW.js";import{r as o}from"./chunk-D3WSRUJS.js";import{a as t,j as m}from"./chunk-Q7JVDEOV.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(h(),1);var e=n(d(),1);function D({model:s,authLabel:p,profile:b,env:g,defaultUrl:a,projectId:v,folderId:w,windowSize:x,chromeProfile:C,setupComplete:i}){let{exit:u}=m();return(0,c.useEffect)(()=>{let B=setTimeout(()=>u(),50);return()=>clearTimeout(B)},[u]),(0,e.jsx)(t,{flexDirection:"column",children:(0,e.jsx)(f,{title:"Configuration",children:(0,e.jsxs)(t,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:p}),(0,e.jsx)(l,{label:" profile",value:b}),(0,e.jsx)(l,{label:" env",value:g}),(0,e.jsx)(r,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:a??"(none)",valueColor:a?o.cyan:o.dimmed}),(0,e.jsx)(l,{label:" model",value:s}),(0,e.jsx)(l,{label:" window",value:x}),(0,e.jsx)(l,{label:" project",value:v??"(none)"}),(0,e.jsx)(l,{label:" folder",value:w??"(none)"}),(0,e.jsx)(r,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:C,valueColor:o.dimmed}),(0,e.jsx)(r,{label:"Setup"}),(0,e.jsx)(l,{label:" status",value:i?"complete":"pending",valueColor:i?o.green:o.yellow})]})})})}export{D as ConfigView};
2
+ import{a as f,b as l,c as r}from"./chunk-B4K7UTF2.js";import{a as d}from"./chunk-HCBYKLMW.js";import{r as o}from"./chunk-RDG6MGL7.js";import{a as t,j as m}from"./chunk-Q7JVDEOV.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(h(),1);var e=n(d(),1);function D({model:s,authLabel:p,profile:b,env:g,defaultUrl:a,projectId:v,folderId:w,windowSize:x,chromeProfile:C,setupComplete:i}){let{exit:u}=m();return(0,c.useEffect)(()=>{let B=setTimeout(()=>u(),50);return()=>clearTimeout(B)},[u]),(0,e.jsx)(t,{flexDirection:"column",children:(0,e.jsx)(f,{title:"Configuration",children:(0,e.jsxs)(t,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:p}),(0,e.jsx)(l,{label:" profile",value:b}),(0,e.jsx)(l,{label:" env",value:g}),(0,e.jsx)(r,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:a??"(none)",valueColor:a?o.cyan:o.dimmed}),(0,e.jsx)(l,{label:" model",value:s}),(0,e.jsx)(l,{label:" window",value:x}),(0,e.jsx)(l,{label:" project",value:v??"(none)"}),(0,e.jsx)(l,{label:" folder",value:w??"(none)"}),(0,e.jsx)(r,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:C,valueColor:o.dimmed}),(0,e.jsx)(r,{label:"Setup"}),(0,e.jsx)(l,{label:" status",value:i?"complete":"pending",valueColor:i?o.green:o.yellow})]})})})}export{D as ConfigView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-6JPSYIY2.js";import"./chunk-Q47TGXAH.js";import"./chunk-I7YWZ3D2.js";import"./chunk-HCBYKLMW.js";import"./chunk-D3WSRUJS.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
2
+ import{a,b}from"./chunk-LZZDLYE3.js";import"./chunk-RPQV6H45.js";import"./chunk-I7YWZ3D2.js";import"./chunk-HCBYKLMW.js";import"./chunk-RDG6MGL7.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f}from"./chunk-HCBYKLMW.js";import{a as h,b as c,r as t}from"./chunk-D3WSRUJS.js";import{a as n,b as o,j as p,k as x}from"./chunk-Q7JVDEOV.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var b=u(T(),1);var e=u(f(),1),w="https://www.testmuai.com/support/docs/kane-cli-introduction",B="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:l}=p(),{stdout:i}=x(),s=i?.columns??80;return(0,b.useEffect)(()=>{let d=setTimeout(()=>l(),50);return()=>clearTimeout(d)},[l]),(0,e.jsxs)(n,{flexDirection:"column",children:[(0,e.jsxs)(n,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.purple,bold:!0,children:c}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",h]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsx)(m,{title:"USAGE",children:(0,e.jsxs)(o,{color:t.cyan,children:[" $ ",c," ","<command>"," [flags]"]})}),(0,e.jsxs)(m,{title:"COMMANDS",children:[(0,e.jsx)(a,{cmd:"run",args:"<objective>",desc:"Run a browser automation task",highlight:!0}),(0,e.jsx)(a,{cmd:"setup",desc:"First-time auth & configuration"}),(0,e.jsx)(a,{cmd:"login",desc:"OAuth PKCE login (opens browser)"}),(0,e.jsx)(a,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(a,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(a,{cmd:"config",args:"show|set-\u2026|reset",desc:"Manage configuration"}),(0,e.jsx)(a,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"})]}),(0,e.jsxs)(m,{title:"RUN FLAGS",children:[(0,e.jsx)(r,{long:"--url",arg:"<url>",desc:"Target URL"}),(0,e.jsx)(r,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(r,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(r,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(r,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(r,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(r,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(r,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(r,{long:"--cft",desc:"Use Playwright Chromium instead of managed Chrome"}),(0,e.jsx)(r,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(r,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(r,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(r,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(r,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(r,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(m,{title:"EXAMPLES",children:[(0,e.jsx)(g,{label:"Search",cmd:`${c} run "Search for laptop" --url https://amazon.in`}),(0,e.jsx)(g,{label:"Headless",cmd:`${c} run "Verify login" --url https://app.example.com --headless`}),(0,e.jsx)(g,{label:"Variables",cmd:`${c} run "Login as {{user}}" --url https://app.com --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(g,{label:"Agent",cmd:`${c} run "Add to cart" --url https://shop.com --agent | jq .status`})]}),(0,e.jsxs)(n,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(s-2,70))}),(0,e.jsxs)(n,{gap:3,children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Docs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:w})]}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Bugs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:B})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function m({title:l,children:i}){return(0,e.jsxs)(n,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(n,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dimmed,children:l})}),i]})}function a({cmd:l,args:i,desc:s,highlight:d}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsx)(n,{width:12,children:(0,e.jsx)(o,{color:d?t.purple:t.green,bold:!0,children:l})}),(0,e.jsx)(n,{width:28,children:i?(0,e.jsx)(o,{color:t.dimmed,children:i}):null}),(0,e.jsx)(o,{color:t.dimmed,children:s})]})}function r({long:l,arg:i,desc:s,highlight:d}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:26,children:[(0,e.jsx)(o,{color:d?t.purple:t.cyan,children:l}),i&&(0,e.jsxs)(o,{color:t.dimmed,children:[" ",i]})]}),(0,e.jsx)(o,{color:t.dimmed,children:s})]})}function g({label:l,cmd:i}){return(0,e.jsxs)(n,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dimmed,children:["# ",l]}),(0,e.jsxs)(o,{color:t.cyan,children:["$ ",i]})]})}export{L as HelpView};
2
+ import{a as f}from"./chunk-HCBYKLMW.js";import{a as h,b as c,r as t}from"./chunk-RDG6MGL7.js";import{a as n,b as o,j as p,k as x}from"./chunk-Q7JVDEOV.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var b=u(T(),1);var e=u(f(),1),w="https://www.testmuai.com/support/docs/kane-cli-introduction",B="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:l}=p(),{stdout:i}=x(),s=i?.columns??80;return(0,b.useEffect)(()=>{let d=setTimeout(()=>l(),50);return()=>clearTimeout(d)},[l]),(0,e.jsxs)(n,{flexDirection:"column",children:[(0,e.jsxs)(n,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.purple,bold:!0,children:c}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",h]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsx)(m,{title:"USAGE",children:(0,e.jsxs)(o,{color:t.cyan,children:[" $ ",c," ","<command>"," [flags]"]})}),(0,e.jsxs)(m,{title:"COMMANDS",children:[(0,e.jsx)(a,{cmd:"run",args:"<objective>",desc:"Run a browser automation task",highlight:!0}),(0,e.jsx)(a,{cmd:"setup",desc:"First-time auth & configuration"}),(0,e.jsx)(a,{cmd:"login",desc:"OAuth PKCE login (opens browser)"}),(0,e.jsx)(a,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(a,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(a,{cmd:"config",args:"show|set-\u2026|reset",desc:"Manage configuration"}),(0,e.jsx)(a,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"})]}),(0,e.jsxs)(m,{title:"RUN FLAGS",children:[(0,e.jsx)(r,{long:"--url",arg:"<url>",desc:"Target URL"}),(0,e.jsx)(r,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(r,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(r,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(r,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(r,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(r,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(r,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(r,{long:"--cft",desc:"Use Playwright Chromium instead of managed Chrome"}),(0,e.jsx)(r,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(r,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(r,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(r,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(r,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(r,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(m,{title:"EXAMPLES",children:[(0,e.jsx)(g,{label:"Search",cmd:`${c} run "Search for laptop" --url https://amazon.in`}),(0,e.jsx)(g,{label:"Headless",cmd:`${c} run "Verify login" --url https://app.example.com --headless`}),(0,e.jsx)(g,{label:"Variables",cmd:`${c} run "Login as {{user}}" --url https://app.com --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(g,{label:"Agent",cmd:`${c} run "Add to cart" --url https://shop.com --agent | jq .status`})]}),(0,e.jsxs)(n,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(s-2,70))}),(0,e.jsxs)(n,{gap:3,children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Docs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:w})]}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Bugs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:B})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function m({title:l,children:i}){return(0,e.jsxs)(n,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(n,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dimmed,children:l})}),i]})}function a({cmd:l,args:i,desc:s,highlight:d}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsx)(n,{width:12,children:(0,e.jsx)(o,{color:d?t.purple:t.green,bold:!0,children:l})}),(0,e.jsx)(n,{width:28,children:i?(0,e.jsx)(o,{color:t.dimmed,children:i}):null}),(0,e.jsx)(o,{color:t.dimmed,children:s})]})}function r({long:l,arg:i,desc:s,highlight:d}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:26,children:[(0,e.jsx)(o,{color:d?t.purple:t.cyan,children:l}),i&&(0,e.jsxs)(o,{color:t.dimmed,children:[" ",i]})]}),(0,e.jsx)(o,{color:t.dimmed,children:s})]})}function g({label:l,cmd:i}){return(0,e.jsxs)(n,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dimmed,children:["# ",l]}),(0,e.jsxs)(o,{color:t.cyan,children:["$ ",i]})]})}export{L as HelpView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-54CAWEGK.js";import"./chunk-HCBYKLMW.js";import"./chunk-D3WSRUJS.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
2
+ import{a}from"./chunk-426ZAKPO.js";import"./chunk-HCBYKLMW.js";import"./chunk-RDG6MGL7.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-BZFESAZK.js";import"./chunk-HCBYKLMW.js";import"./chunk-D3WSRUJS.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as LoginWizard,a as getWizardSteps};
2
+ import{a,b}from"./chunk-S2FLPRVR.js";import"./chunk-HCBYKLMW.js";import"./chunk-RDG6MGL7.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as LoginWizard,a as getWizardSteps};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-TENTBVGG.js";import"./chunk-HCBYKLMW.js";import"./chunk-D3WSRUJS.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
2
+ import{a,b}from"./chunk-JXLB6N6Q.js";import"./chunk-HCBYKLMW.js";import"./chunk-RDG6MGL7.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-BGUDP4VU.js";import"./chunk-Q47TGXAH.js";import"./chunk-I7YWZ3D2.js";import"./chunk-HCBYKLMW.js";import"./chunk-D3WSRUJS.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
2
+ import{a,b}from"./chunk-BSMUBGQO.js";import"./chunk-RPQV6H45.js";import"./chunk-I7YWZ3D2.js";import"./chunk-HCBYKLMW.js";import"./chunk-RDG6MGL7.js";import"./chunk-Q7JVDEOV.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as s,b as o}from"./chunk-PFVUFDRI.js";import{a as x}from"./chunk-HCBYKLMW.js";import{r as i}from"./chunk-D3WSRUJS.js";import{a as r,b as n,j as u}from"./chunk-Q7JVDEOV.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var p=t(B(),1);var e=t(x(),1);function R({profile:f,env:g,authenticated:a,authMethod:v,username:m,tokenStatus:l,expiresAt:c}){let{exit:d}=u();return(0,p.useEffect)(()=>{let b=setTimeout(()=>d(),50);return()=>clearTimeout(b)},[d]),(0,e.jsx)(r,{flexDirection:"column",children:(0,e.jsx)(s,{title:"Identity",variant:a?"success":"warning",children:(0,e.jsxs)(r,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{children:a?(0,e.jsx)(n,{color:i.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(n,{color:i.yellow,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(r,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(o,{label:"Profile",value:f}),(0,e.jsx)(o,{label:"Environment",value:g}),(0,e.jsx)(o,{label:"Method",value:v}),m&&(0,e.jsx)(o,{label:"User",value:m}),l&&(0,e.jsx)(o,{label:"Token",value:l,valueColor:l==="valid"?i.green:l==="expired"?i.red:i.dimmed}),c&&(0,e.jsx)(o,{label:"Expires",value:c})]})]})})})}export{R as WhoamiView};
2
+ import{a as s,b as o}from"./chunk-B4K7UTF2.js";import{a as x}from"./chunk-HCBYKLMW.js";import{r as i}from"./chunk-RDG6MGL7.js";import{a as r,b as n,j as u}from"./chunk-Q7JVDEOV.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var p=t(B(),1);var e=t(x(),1);function R({profile:f,env:g,authenticated:a,authMethod:v,username:m,tokenStatus:l,expiresAt:c}){let{exit:d}=u();return(0,p.useEffect)(()=>{let b=setTimeout(()=>d(),50);return()=>clearTimeout(b)},[d]),(0,e.jsx)(r,{flexDirection:"column",children:(0,e.jsx)(s,{title:"Identity",variant:a?"success":"warning",children:(0,e.jsxs)(r,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{children:a?(0,e.jsx)(n,{color:i.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(n,{color:i.yellow,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(r,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(o,{label:"Profile",value:f}),(0,e.jsx)(o,{label:"Environment",value:g}),(0,e.jsx)(o,{label:"Method",value:v}),m&&(0,e.jsx)(o,{label:"User",value:m}),l&&(0,e.jsx)(o,{label:"Token",value:l,valueColor:l==="valid"?i.green:l==="expired"?i.red:i.dimmed}),c&&(0,e.jsx)(o,{label:"Expires",value:c})]})]})})})}export{R as WhoamiView};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as i,f as c}from"./chunk-D3WSRUJS.js";import"./chunk-UR6MHSHU.js";import{readFileSync as h,writeFileSync as g,mkdirSync as u}from"fs";import{join as d}from"path";var l=d(i,"changelog-cache.json"),f=3600*1e3;function p(){try{let e=JSON.parse(h(l,"utf-8"));if(Date.now()-e.cachedAt<f)return e}catch{}return null}function y(e){try{u(i,{recursive:!0}),g(l,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function E(e){try{let t=p();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await fetch(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return y(s),e?.all?s:s.slice(0,5)}catch{return[]}}function A(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
2
+ import{c as i,f as c}from"./chunk-RDG6MGL7.js";import"./chunk-UR6MHSHU.js";import{readFileSync as h,writeFileSync as g,mkdirSync as u}from"fs";import{join as d}from"path";var l=d(i,"changelog-cache.json"),f=3600*1e3;function p(){try{let e=JSON.parse(h(l,"utf-8"));if(Date.now()-e.cachedAt<f)return e}catch{}return null}function y(e){try{u(i,{recursive:!0}),g(l,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function E(e){try{let t=p();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await fetch(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return y(s),e?.all?s:s.slice(0,5)}catch{return[]}}function A(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
3
3
  `).filter(a=>a.trim());for(let a of o)t.push(` ${a}`)}t.push("")}return t.join(`
4
4
  `)}export{E as fetchChangelog,A as formatChangelog};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as c}from"./chunk-HCBYKLMW.js";import{r as a}from"./chunk-D3WSRUJS.js";import{a as s,b as u,j as p}from"./chunk-Q7JVDEOV.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as l}from"./chunk-UR6MHSHU.js";var x=l(T(),1);function g(n,e){if(!e)return n;let i=n.trim()||e;return`\x1B]8;;${e}\x07${i}\x1B]8;;\x07`}var r=l(c(),1);function h({shareableLink:n,testCaseLink:e,codeExportDir:i,autoExit:m=!0}){let{exit:f}=p();(0,x.useEffect)(()=>{if(!m)return;let t=setTimeout(()=>f(),100);return()=>clearTimeout(t)},[f,m]);let o=[];return n&&o.push({label:"ShareLink",url:n}),e&&o.push({label:"TestCase",url:e}),i&&o.push({label:"CodeExport",url:i,linkUrl:`file://${i}`}),o.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:o.map(t=>(0,r.jsxs)(s,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(u,{color:a.primary,children:[t.label,":"]}),(0,r.jsx)(u,{color:a.dim,children:g(t.url,t.linkUrl??t.url)})]},t.label))})}export{h as a};
2
+ import{a as c}from"./chunk-HCBYKLMW.js";import{r as a}from"./chunk-RDG6MGL7.js";import{a as s,b as u,j as p}from"./chunk-Q7JVDEOV.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as l}from"./chunk-UR6MHSHU.js";var x=l(T(),1);function g(n,e){if(!e)return n;let i=n.trim()||e;return`\x1B]8;;${e}\x07${i}\x1B]8;;\x07`}var r=l(c(),1);function h({shareableLink:n,testCaseLink:e,codeExportDir:i,autoExit:m=!0}){let{exit:f}=p();(0,x.useEffect)(()=>{if(!m)return;let t=setTimeout(()=>f(),100);return()=>clearTimeout(t)},[f,m]);let o=[];return n&&o.push({label:"ShareLink",url:n}),e&&o.push({label:"TestCase",url:e}),i&&o.push({label:"CodeExport",url:i,linkUrl:`file://${i}`}),o.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:o.map(t=>(0,r.jsxs)(s,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(u,{color:a.primary,children:[t.label,":"]}),(0,r.jsx)(u,{color:a.dim,children:g(t.url,t.linkUrl??t.url)})]},t.label))})}export{h as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-HCBYKLMW.js";import{r as o}from"./chunk-D3WSRUJS.js";import{a as r,b as i}from"./chunk-Q7JVDEOV.js";import{e as a}from"./chunk-UR6MHSHU.js";var e=a(m(),1),u={default:o.muted,error:o.red,success:o.green,info:o.purple,warning:o.yellow};function T({title:t,titleColor:l,borderColor:d,variant:n="default",children:c,width:s,paddingX:x=2,paddingY:g=0,marginBottom:p=0}){let f=d??u[n],B=l??(n==="default"?o.purple:u[n]);return(0,e.jsxs)(r,{flexDirection:"column",marginBottom:p,children:[t&&(0,e.jsx)(r,{marginBottom:0,children:(0,e.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,e.jsx)(r,{borderStyle:"round",borderColor:f,flexDirection:"column",paddingX:x,paddingY:g,width:s,children:c})]})}function h({label:t,value:l,labelColor:d=o.dimmed,valueColor:n,labelWidth:c=14}){return(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:c,children:(0,e.jsx)(i,{color:d,children:t})}),(0,e.jsx)(i,{color:n,children:l})]})}function C({label:t}){return(0,e.jsx)(r,{marginTop:1,marginBottom:0,children:(0,e.jsx)(i,{bold:!0,children:t})})}export{T as a,h as b,C as c};
2
+ import{a as m}from"./chunk-HCBYKLMW.js";import{r as o}from"./chunk-RDG6MGL7.js";import{a as r,b as i}from"./chunk-Q7JVDEOV.js";import{e as a}from"./chunk-UR6MHSHU.js";var e=a(m(),1),u={default:o.muted,error:o.red,success:o.green,info:o.purple,warning:o.yellow};function T({title:t,titleColor:l,borderColor:d,variant:n="default",children:c,width:s,paddingX:x=2,paddingY:g=0,marginBottom:p=0}){let f=d??u[n],B=l??(n==="default"?o.purple:u[n]);return(0,e.jsxs)(r,{flexDirection:"column",marginBottom:p,children:[t&&(0,e.jsx)(r,{marginBottom:0,children:(0,e.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,e.jsx)(r,{borderStyle:"round",borderColor:f,flexDirection:"column",paddingX:x,paddingY:g,width:s,children:c})]})}function h({label:t,value:l,labelColor:d=o.dimmed,valueColor:n,labelWidth:c=14}){return(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:c,children:(0,e.jsx)(i,{color:d,children:t})}),(0,e.jsx)(i,{color:n,children:l})]})}function C({label:t}){return(0,e.jsx)(r,{marginTop:1,marginBottom:0,children:(0,e.jsx)(i,{bold:!0,children:t})})}export{T as a,h as b,C as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f,b as u}from"./chunk-Q47TGXAH.js";import{a as p}from"./chunk-I7YWZ3D2.js";import{a as m}from"./chunk-HCBYKLMW.js";import{a as E}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var r=a(E(),1);var g=a(m(),1);function b(e,o,n){return{id:e,label:`${o} (${e})`,isActive:e===n}}function N({resolver:e,currentProjectId:o,env:n,onSelect:j,onCancel:P}){let[d,v]=(0,r.useState)([]),[L,s]=(0,r.useState)(!0),[h,i]=(0,r.useState)(null);return(0,r.useEffect)(()=>{if(!e){i("Login first to browse projects"),s(!1);return}(async()=>{try{let t=e.cached;if(!t){i("Login first to browse projects"),s(!1);return}let c=f(n),y=await new p(c.tmsBaseUrl,t.username,t.access_key).listProjects();v(y.map(l=>b(l.project_id,l.name,o)))}catch(t){i(t instanceof Error?t.message:String(t))}finally{s(!1)}})()},[e,o,n]),(0,g.jsx)(u,{title:"Projects",items:d,loading:L,error:h,itemNoun:"projects",onSelect:t=>{let c=t.label.replace(` (${t.id})`,"");j(t.id,c)},onCancel:P})}export{b as a,N as b};
2
+ import{a as f,b as u}from"./chunk-RPQV6H45.js";import{a as p}from"./chunk-I7YWZ3D2.js";import{a as m}from"./chunk-HCBYKLMW.js";import{a as E}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var r=a(E(),1);var g=a(m(),1);function b(e,o,n){return{id:e,label:`${o} (${e})`,isActive:e===n}}function N({resolver:e,currentProjectId:o,env:n,onSelect:j,onCancel:P}){let[d,v]=(0,r.useState)([]),[L,s]=(0,r.useState)(!0),[h,i]=(0,r.useState)(null);return(0,r.useEffect)(()=>{if(!e){i("Login first to browse projects"),s(!1);return}(async()=>{try{let t=e.cached;if(!t){i("Login first to browse projects"),s(!1);return}let c=f(n),y=await new p(c.tmsBaseUrl,t.username,t.access_key).listProjects();v(y.map(l=>b(l.project_id,l.name,o)))}catch(t){i(t instanceof Error?t.message:String(t))}finally{s(!1)}})()},[e,o,n]),(0,g.jsx)(u,{title:"Projects",items:d,loading:L,error:h,itemNoun:"projects",onSelect:t=>{let c=t.label.replace(` (${t.id})`,"");j(t.id,c)},onCancel:P})}export{b as a,N as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as n,c as s,e as c}from"./chunk-D3WSRUJS.js";import{readFileSync as p,writeFileSync as f,mkdirSync as h}from"fs";import{join as d}from"path";var m=d(s,"version-check.json"),g=1440*60*1e3;function y(){try{let t=JSON.parse(p(m,"utf-8"));if(Date.now()-t.checkedAt<g)return t}catch{}return null}function C(t){try{h(s,{recursive:!0}),f(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,i){let a=t.split(".").map(Number),e=i.split(".").map(Number);for(let o=0;o<3;o++){let r=(e[o]??0)-(a[o]??0);if(r!==0)return r}return 0}function l(t,i){let a=t.split(".").map(Number),e=i.split(".").map(Number);return(e[0]??0)!==(a[0]??0)?"major":(e[1]??0)!==(a[1]??0)?"minor":"patch"}async function N(){try{let t=y();if(t)return u(n,t.latest)>0?{current:n,latest:t.latest,severity:l(n,t.latest)}:null;let i=new AbortController,a=setTimeout(()=>i.abort(),5e3),e=await fetch(c,{headers:{Accept:"application/json"},signal:i.signal});if(clearTimeout(a),!e.ok)return null;let r=(await e.json())["dist-tags"]?.latest;return r?(C(r),u(n,r)>0?{current:n,latest:r,severity:l(n,r)}:null):null}catch{return null}}export{u as a,l as b,N as c};
2
+ import{a as n,c as s,e as c}from"./chunk-RDG6MGL7.js";import{readFileSync as p,writeFileSync as f,mkdirSync as h}from"fs";import{join as d}from"path";var m=d(s,"version-check.json"),g=1440*60*1e3;function y(){try{let t=JSON.parse(p(m,"utf-8"));if(Date.now()-t.checkedAt<g)return t}catch{}return null}function C(t){try{h(s,{recursive:!0}),f(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,i){let a=t.split(".").map(Number),e=i.split(".").map(Number);for(let o=0;o<3;o++){let r=(e[o]??0)-(a[o]??0);if(r!==0)return r}return 0}function l(t,i){let a=t.split(".").map(Number),e=i.split(".").map(Number);return(e[0]??0)!==(a[0]??0)?"major":(e[1]??0)!==(a[1]??0)?"minor":"patch"}async function N(){try{let t=y();if(t)return u(n,t.latest)>0?{current:n,latest:t.latest,severity:l(n,t.latest)}:null;let i=new AbortController,a=setTimeout(()=>i.abort(),5e3),e=await fetch(c,{headers:{Accept:"application/json"},signal:i.signal});if(clearTimeout(a),!e.ok)return null;let r=(await e.json())["dist-tags"]?.latest;return r?(C(r),u(n,r)>0?{current:n,latest:r,severity:l(n,r)}:null):null}catch{return null}}export{u as a,l as b,N as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-HCBYKLMW.js";import{r as t}from"./chunk-D3WSRUJS.js";import{a as p,b as r,i as a}from"./chunk-Q7JVDEOV.js";import{a as f}from"./chunk-6YGTRKDT.js";import{e as s}from"./chunk-UR6MHSHU.js";var c=s(f(),1);var e=s(m(),1);function R({onSubmit:n}){let[o,l]=(0,c.useState)(0),u=(0,c.useRef)(!1);return a((x,i)=>{u.current||(i.leftArrow||i.rightArrow?l(d=>d===0?1:0):i.return?(u.current=!0,n(o===0?"positive":"negative")):i.escape&&(u.current=!0,n(null)))}),(0,e.jsxs)(p,{marginTop:1,children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.primary:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.primary:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "}),(0,e.jsx)(r,{color:t.dim,children:" \u2190/\u2192 select \xB7 Enter submit \xB7 Esc skip"})]})}export{R as a};
2
+ import{a as m}from"./chunk-HCBYKLMW.js";import{r as t}from"./chunk-RDG6MGL7.js";import{a as p,b as r,i as a}from"./chunk-Q7JVDEOV.js";import{a as f}from"./chunk-6YGTRKDT.js";import{e as s}from"./chunk-UR6MHSHU.js";var c=s(f(),1);var e=s(m(),1);function R({onSubmit:n}){let[o,l]=(0,c.useState)(0),u=(0,c.useRef)(!1);return a((x,i)=>{u.current||(i.leftArrow||i.rightArrow?l(d=>d===0?1:0):i.return?(u.current=!0,n(o===0?"positive":"negative")):i.escape&&(u.current=!0,n(null)))}),(0,e.jsxs)(p,{marginTop:1,children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.primary:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.primary:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "}),(0,e.jsx)(r,{color:t.dim,children:" \u2190/\u2192 select \xB7 Enter submit \xB7 Esc skip"})]})}export{R as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as P}from"./chunk-HCBYKLMW.js";import{r as i}from"./chunk-D3WSRUJS.js";import{a,b as l,i as h}from"./chunk-Q7JVDEOV.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var A=b(w(),1);var o=b(P(),1);function B(n,d,f,m,p){let x=f==="basic"&&m?`basic (${m})`:f,s=20,c=`${n} [${d}]`,u="\xB7".repeat(Math.max(2,s-c.length+3));return{label:`${c} ${u} ${x}`,profile:n,env:d,isActive:p}}function y({creds:n,onSwitch:d,onCancel:f}){let m=n.listProfiles(),p=n.getActiveProfile(),x=n.getDefaultEnv(),s=m.map(e=>{let t=n.loadBasicAuth(e.profile,e.env),r=n.loadCredentials(e.profile,e.env)!==null,g=t?"basic":r?"oauth":"none",v=t?t.username:null,T=e.profile===p&&e.env===x;return B(e.profile,e.env,g,v,T)}),[c,u]=(0,A.useState)(()=>{let e=s.findIndex(t=>t.isActive);return e>=0?e:0});return h((e,t)=>{if(t.escape){f();return}if(t.upArrow){u(r=>Math.max(0,r-1));return}if(t.downArrow){u(r=>Math.min(s.length-1,r+1));return}if(t.return&&s[c]){let r=s[c];r.isActive||d(r.profile,r.env),f();return}}),s.length===0?(0,o.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:i.primary,paddingX:2,paddingY:1,children:[(0,o.jsx)(l,{color:i.primary,bold:!0,children:"Profiles"}),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(l,{color:i.dim,children:"No profiles \u2014 use Login to create one"})}),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(l,{color:i.dim,children:"esc back"})})]}):(0,o.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:i.primary,paddingX:2,paddingY:1,children:[(0,o.jsx)(l,{color:i.primary,bold:!0,children:"Profiles"}),(0,o.jsx)(a,{flexDirection:"column",marginTop:1,children:s.map((e,t)=>{let r=t===c,g=r?"\u276F ":" ",v=e.isActive?i.statusPass:r?i.primary:void 0;return(0,o.jsxs)(l,{color:v,children:[g,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(l,{color:i.dim,children:"\u2191\u2193 navigate \xB7 \u21B5 switch \xB7 esc back"})})]})}export{B as a,y as b};
2
+ import{a as P}from"./chunk-HCBYKLMW.js";import{r as i}from"./chunk-RDG6MGL7.js";import{a,b as l,i as h}from"./chunk-Q7JVDEOV.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var A=b(w(),1);var o=b(P(),1);function B(n,d,f,m,p){let x=f==="basic"&&m?`basic (${m})`:f,s=20,c=`${n} [${d}]`,u="\xB7".repeat(Math.max(2,s-c.length+3));return{label:`${c} ${u} ${x}`,profile:n,env:d,isActive:p}}function y({creds:n,onSwitch:d,onCancel:f}){let m=n.listProfiles(),p=n.getActiveProfile(),x=n.getDefaultEnv(),s=m.map(e=>{let t=n.loadBasicAuth(e.profile,e.env),r=n.loadCredentials(e.profile,e.env)!==null,g=t?"basic":r?"oauth":"none",v=t?t.username:null,T=e.profile===p&&e.env===x;return B(e.profile,e.env,g,v,T)}),[c,u]=(0,A.useState)(()=>{let e=s.findIndex(t=>t.isActive);return e>=0?e:0});return h((e,t)=>{if(t.escape){f();return}if(t.upArrow){u(r=>Math.max(0,r-1));return}if(t.downArrow){u(r=>Math.min(s.length-1,r+1));return}if(t.return&&s[c]){let r=s[c];r.isActive||d(r.profile,r.env),f();return}}),s.length===0?(0,o.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:i.primary,paddingX:2,paddingY:1,children:[(0,o.jsx)(l,{color:i.primary,bold:!0,children:"Profiles"}),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(l,{color:i.dim,children:"No profiles \u2014 use Login to create one"})}),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(l,{color:i.dim,children:"esc back"})})]}):(0,o.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:i.primary,paddingX:2,paddingY:1,children:[(0,o.jsx)(l,{color:i.primary,bold:!0,children:"Profiles"}),(0,o.jsx)(a,{flexDirection:"column",marginTop:1,children:s.map((e,t)=>{let r=t===c,g=r?"\u276F ":" ",v=e.isActive?i.statusPass:r?i.primary:void 0;return(0,o.jsxs)(l,{color:v,children:[g,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(l,{color:i.dim,children:"\u2191\u2193 navigate \xB7 \u21B5 switch \xB7 esc back"})})]})}export{B as a,y as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as d}from"./chunk-HCBYKLMW.js";import{r as t}from"./chunk-D3WSRUJS.js";import{a as s,b as n}from"./chunk-Q7JVDEOV.js";import{a as f}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var c=u(f(),1);var R=u(f(),1);var m=u(f(),1);function b(o,r){let a=(0,m.useRef)(o);a.current=o,(0,m.useEffect)(()=>{if(r===null)return;let i=setInterval(()=>a.current(),r);return()=>clearInterval(i)},[r])}var B=u(d(),1),T=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function v({active:o=!0}){let[r,a]=(0,R.useState)(0);return b(()=>{a(i=>(i+1)%T.length)},o?80:null),(0,B.jsx)(n,{color:t.purple,children:o?T[r]:"\u25CF"})}var e=u(d(),1);function $(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function k(o,r,a,i){return o.map(p=>p.name===r?{...p,status:a,detail:i}:p)}function I(o){let r=o/1e3;if(r<60)return`${r.toFixed(1)}s`;let a=Math.floor(r/60),i=Math.round(r%60);return`${a}m ${i}s`}function O(o){let[r,a]=(0,c.useState)(0),i=c.default.useRef(Date.now());return(0,c.useEffect)(()=>{if(!o)return;i.current=Date.now();let p=setInterval(()=>{a(Date.now()-i.current)},100);return()=>clearInterval(p)},[o]),r}function y({steps:o,status:r,testUrl:a,error:i}){let p=O(r==="uploading");return r==="uploading"?(0,e.jsxs)(s,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(n,{color:t.primary,children:"\u2601 "}),(0,e.jsx)(n,{color:t.primary,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dimmed,children:[" ",I(p)]})]}),(0,e.jsx)(s,{flexDirection:"column",marginTop:1,children:o.filter(l=>l.status!=="skipped").map((l,E,P)=>{let D=E===P.length-1?"\u2514\u2500":"\u251C\u2500",g=l.status==="done",x=l.status==="running",S=l.status==="failed";return(0,e.jsxs)(s,{children:[(0,e.jsxs)(n,{color:t.dimmed,children:[" ",D," "]}),(0,e.jsx)(s,{width:3,children:x?(0,e.jsx)(v,{}):g?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):S?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:g?t.dim:x?t.base:S?t.red:t.muted,children:l.label}),l.detail&&(0,e.jsxs)(n,{color:t.dimmed,children:[" ",l.detail]})]},l.name)})}),(0,e.jsx)(s,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):r==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(s,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(s,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dimmed,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{b as a,v as b,$ as c,k as d,y as e};
2
+ import{a as d}from"./chunk-HCBYKLMW.js";import{r as t}from"./chunk-RDG6MGL7.js";import{a as s,b as n}from"./chunk-Q7JVDEOV.js";import{a as f}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var c=u(f(),1);var R=u(f(),1);var m=u(f(),1);function b(o,r){let a=(0,m.useRef)(o);a.current=o,(0,m.useEffect)(()=>{if(r===null)return;let i=setInterval(()=>a.current(),r);return()=>clearInterval(i)},[r])}var B=u(d(),1),T=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function v({active:o=!0}){let[r,a]=(0,R.useState)(0);return b(()=>{a(i=>(i+1)%T.length)},o?80:null),(0,B.jsx)(n,{color:t.purple,children:o?T[r]:"\u25CF"})}var e=u(d(),1);function $(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function k(o,r,a,i){return o.map(p=>p.name===r?{...p,status:a,detail:i}:p)}function I(o){let r=o/1e3;if(r<60)return`${r.toFixed(1)}s`;let a=Math.floor(r/60),i=Math.round(r%60);return`${a}m ${i}s`}function O(o){let[r,a]=(0,c.useState)(0),i=c.default.useRef(Date.now());return(0,c.useEffect)(()=>{if(!o)return;i.current=Date.now();let p=setInterval(()=>{a(Date.now()-i.current)},100);return()=>clearInterval(p)},[o]),r}function y({steps:o,status:r,testUrl:a,error:i}){let p=O(r==="uploading");return r==="uploading"?(0,e.jsxs)(s,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(n,{color:t.primary,children:"\u2601 "}),(0,e.jsx)(n,{color:t.primary,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dimmed,children:[" ",I(p)]})]}),(0,e.jsx)(s,{flexDirection:"column",marginTop:1,children:o.filter(l=>l.status!=="skipped").map((l,E,P)=>{let D=E===P.length-1?"\u2514\u2500":"\u251C\u2500",g=l.status==="done",x=l.status==="running",S=l.status==="failed";return(0,e.jsxs)(s,{children:[(0,e.jsxs)(n,{color:t.dimmed,children:[" ",D," "]}),(0,e.jsx)(s,{width:3,children:x?(0,e.jsx)(v,{}):g?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):S?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:g?t.dim:x?t.base:S?t.red:t.muted,children:l.label}),l.detail&&(0,e.jsxs)(n,{color:t.dimmed,children:[" ",l.detail]})]},l.name)})}),(0,e.jsx)(s,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):r==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(s,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(s,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dimmed,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{b as a,v as b,$ as c,k as d,y as e};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as u,b as g}from"./chunk-Q47TGXAH.js";import{a as d}from"./chunk-I7YWZ3D2.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as P}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var r=m(P(),1);var p=m(f(),1);function R(t,s,n,o){return{id:t,label:`${s} (${t}) \xB7 ${n} tests`,isActive:t===o}}function A({resolver:t,projectId:s,currentFolderId:n,env:o,onSelect:v,onCancel:L}){let[h,y]=(0,r.useState)([]),[E,i]=(0,r.useState)(!0),[b,l]=(0,r.useState)(null);return(0,r.useEffect)(()=>{if(!t){l("Login first to browse folders"),i(!1);return}(async()=>{try{let e=t.cached;if(!e){l("Login first to browse folders"),i(!1);return}let a=u(o),F=await new d(a.tmsBaseUrl,e.username,e.access_key).listFolders(s);y(F.map(c=>R(c.id,c.name,c.test_cases_count,n)))}catch(e){l(e instanceof Error?e.message:String(e))}finally{i(!1)}})()},[t,s,n,o]),(0,p.jsx)(g,{title:"Folders",items:h,loading:E,error:b,itemNoun:"folders",onSelect:e=>{let a=e.label.split(" (")[0];v(e.id,a)},onCancel:L})}export{R as a,A as b};
2
+ import{a as u,b as g}from"./chunk-RPQV6H45.js";import{a as d}from"./chunk-I7YWZ3D2.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as P}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var r=m(P(),1);var p=m(f(),1);function R(t,s,n,o){return{id:t,label:`${s} (${t}) \xB7 ${n} tests`,isActive:t===o}}function A({resolver:t,projectId:s,currentFolderId:n,env:o,onSelect:v,onCancel:L}){let[h,y]=(0,r.useState)([]),[E,i]=(0,r.useState)(!0),[b,l]=(0,r.useState)(null);return(0,r.useEffect)(()=>{if(!t){l("Login first to browse folders"),i(!1);return}(async()=>{try{let e=t.cached;if(!e){l("Login first to browse folders"),i(!1);return}let a=u(o),F=await new d(a.tmsBaseUrl,e.username,e.access_key).listFolders(s);y(F.map(c=>R(c.id,c.name,c.test_cases_count,n)))}catch(e){l(e instanceof Error?e.message:String(e))}finally{i(!1)}})()},[t,s,n,o]),(0,p.jsx)(g,{title:"Folders",items:h,loading:E,error:b,itemNoun:"folders",onSelect:e=>{let a=e.label.split(" (")[0];v(e.id,a)},onCancel:L})}export{R as a,A as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{homedir as s}from"os";import{join as t}from"path";var p="0.2.3",m="kane-cli",e=t(s(),".testmuai","kaneai"),l=t(e,"profiles"),i=t(e,"config.json"),d=t(e,"tui-config.json"),h="https://registry.npmjs.org/@testmuai/kane-cli",f="https://api.github.com/repos/LambdaTest/kane-cli/releases",_=9222,u=9230,A=t(e,"chrome-profile"),U=t(e,"chrome-profiles"),r="127.0.0.1",b=18392,g=18400,o="/callback";function x(a){return`http://${r}:${a}${o}`}var L="KANE CLI",E="*",R={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server"}},C={base:"#ffffff",primary:"#ff9500",secondary:"#888888",accent:"#ffffff",dim:"#666666",ambient:"#444444",statusPass:"#4ade80",statusFail:"#ef4444",purple:"#ff9500",cyan:"#ff9500",yellow:"#ff9500",green:"#4ade80",greenDim:"#666666",red:"#ef4444",redDim:"#666666",dimmed:"#666666",muted:"#444444"};export{p as a,m as b,e as c,d,h as e,f,_ as g,u as h,U as i,r as j,b as k,g as l,o as m,x as n,L as o,E as p,R as q,C as r};
2
+ import{homedir as s}from"os";import{join as t}from"path";var p="0.2.4",m="kane-cli",e=t(s(),".testmuai","kaneai"),l=t(e,"profiles"),i=t(e,"config.json"),d=t(e,"tui-config.json"),h="https://registry.npmjs.org/@testmuai/kane-cli",f="https://api.github.com/repos/LambdaTest/kane-cli/releases",_=9222,u=9230,A=t(e,"chrome-profile"),U=t(e,"chrome-profiles"),r="127.0.0.1",b=18392,g=18400,o="/callback";function x(a){return`http://${r}:${a}${o}`}var L="KANE CLI",E="*",R={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server"}},C={base:"#ffffff",primary:"#ff9500",secondary:"#888888",accent:"#ffffff",dim:"#666666",ambient:"#444444",statusPass:"#4ade80",statusFail:"#ef4444",purple:"#ff9500",cyan:"#ff9500",yellow:"#ff9500",green:"#4ade80",greenDim:"#666666",red:"#ef4444",redDim:"#666666",dimmed:"#666666",muted:"#444444"};export{p as a,m as b,e as c,d,h as e,f,_ as g,u as h,U as i,r as j,b as k,g as l,o as m,x as n,L as o,E as p,R as q,C as r};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as M}from"./chunk-HCBYKLMW.js";import{q as N,r as t}from"./chunk-D3WSRUJS.js";import{a as i,b as n,i as R}from"./chunk-Q7JVDEOV.js";import{a as P}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";function y(a="prod"){let r=N[a];return a!=="stage"?r:{authBaseUrl:process.env.KANE_STAGE_AUTH_URL??r.authBaseUrl,consentUrl:process.env.KANE_STAGE_CONSENT_URL??r.consentUrl,controllerBaseUrl:process.env.TESTMUAI_BASE_URL??r.controllerBaseUrl,tmsBaseUrl:process.env.KANE_STAGE_TMS_URL??r.tmsBaseUrl,secretsBaseUrl:process.env.KANE_STAGE_SECRETS_URL??r.secretsBaseUrl,testManagerUiUrl:process.env.KANE_STAGE_TEST_MANAGER_UI_URL??r.testManagerUiUrl,shareApiBaseUrl:process.env.KANE_STAGE_SHARE_API_URL??r.shareApiBaseUrl,v16ServerHost:process.env.KANE_STAGE_V16_SERVER_HOST??r.v16ServerHost}}var f=b(P(),1);var e=b(M(),1),g=5;function w(a,r){if(!r)return a;let u=r.toLowerCase();return a.filter(E=>E.label.toLowerCase().includes(u))}function Y({title:a,items:r,loading:u=!1,loadingText:E,error:U=null,itemNoun:A="items",onSelect:C,onCancel:L,defaultActiveId:S}){let[m,c]=(0,f.useState)(0),[T,p]=(0,f.useState)(0),[d,_]=(0,f.useState)("");(0,f.useEffect)(()=>{if(r.length===0)return;let l=S?r.findIndex(o=>o.id===S):r.findIndex(o=>o.isActive);l>=0&&(p(Math.floor(l/g)),c(l%g))},[r,S]);let x=w(r,d),B=T*g,I=Math.min(B+g,x.length),v=Math.ceil(x.length/g),G=I-B,h=x.slice(B,I);return R((l,o)=>{if(U){o.escape&&L();return}if(o.escape){d?(_(""),c(0),p(0)):L();return}if(o.upArrow){m>0?c(s=>s-1):T>0&&(p(s=>s-1),c(g-1));return}if(o.downArrow){m<G-1?c(s=>s+1):T<v-1&&(p(s=>s+1),c(0));return}if(o.return&&h[m]){C(h[m]);return}if(o.backspace||o.delete){_(s=>s.slice(0,-1)),c(0),p(0);return}l&&!o.ctrl&&!o.meta&&(_(s=>s+l),c(0),p(0))},{isActive:!u}),u?(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:t.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(n,{color:t.primary,bold:!0,children:a}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(n,{color:t.secondary,children:E??`Loading ${A}\u2026`})})]}):U?(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:t.statusFail,paddingX:2,paddingY:1,children:[(0,e.jsx)(n,{color:t.statusFail,bold:!0,children:a}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(n,{color:t.statusFail,children:U})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(n,{color:t.dim,children:"esc back"})})]}):(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:t.primary,paddingX:2,paddingY:1,children:[(0,e.jsxs)(i,{children:[(0,e.jsx)(n,{color:t.primary,bold:!0,children:a}),(0,e.jsxs)(n,{color:t.dim,children:[" (",x.length,d?`/${r.length}`:""," ",A,")"]})]}),d&&(0,e.jsxs)(i,{marginTop:1,children:[(0,e.jsx)(n,{color:t.secondary,children:"filter: "}),(0,e.jsx)(n,{children:d}),(0,e.jsx)(n,{color:t.dimmed,children:"\u2588"})]}),(0,e.jsx)(i,{flexDirection:"column",marginTop:1,children:x.length===0?(0,e.jsxs)(n,{color:t.dim,children:["No ",A,' match "',d,'"']}):h.map((l,o)=>{let s=o===m,H=s?"\u276F ":" ",K=l.isActive?t.statusPass:s?t.primary:void 0;return(0,e.jsxs)(n,{color:K,children:[H,l.label,l.isActive?" \u25CF selected":""]},l.id)})}),v>1&&(0,e.jsx)(i,{marginTop:1,children:(0,e.jsxs)(n,{color:t.dim,children:["Page ",T+1,"/",v]})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsxs)(n,{color:t.dim,children:["\u2191\u2193 navigate \xB7 type to search \xB7 \u21B5 select \xB7 esc ",d?"clear":"back"]})})]})}export{y as a,Y as b};
2
+ import{a as M}from"./chunk-HCBYKLMW.js";import{q as N,r as t}from"./chunk-RDG6MGL7.js";import{a as i,b as n,i as R}from"./chunk-Q7JVDEOV.js";import{a as P}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";function y(a="prod"){let r=N[a];return a!=="stage"?r:{authBaseUrl:process.env.KANE_STAGE_AUTH_URL??r.authBaseUrl,consentUrl:process.env.KANE_STAGE_CONSENT_URL??r.consentUrl,controllerBaseUrl:process.env.TESTMUAI_BASE_URL??r.controllerBaseUrl,tmsBaseUrl:process.env.KANE_STAGE_TMS_URL??r.tmsBaseUrl,secretsBaseUrl:process.env.KANE_STAGE_SECRETS_URL??r.secretsBaseUrl,testManagerUiUrl:process.env.KANE_STAGE_TEST_MANAGER_UI_URL??r.testManagerUiUrl,shareApiBaseUrl:process.env.KANE_STAGE_SHARE_API_URL??r.shareApiBaseUrl,v16ServerHost:process.env.KANE_STAGE_V16_SERVER_HOST??r.v16ServerHost}}var f=b(P(),1);var e=b(M(),1),g=5;function w(a,r){if(!r)return a;let u=r.toLowerCase();return a.filter(E=>E.label.toLowerCase().includes(u))}function Y({title:a,items:r,loading:u=!1,loadingText:E,error:U=null,itemNoun:A="items",onSelect:C,onCancel:L,defaultActiveId:S}){let[m,c]=(0,f.useState)(0),[T,p]=(0,f.useState)(0),[d,_]=(0,f.useState)("");(0,f.useEffect)(()=>{if(r.length===0)return;let l=S?r.findIndex(o=>o.id===S):r.findIndex(o=>o.isActive);l>=0&&(p(Math.floor(l/g)),c(l%g))},[r,S]);let x=w(r,d),B=T*g,I=Math.min(B+g,x.length),v=Math.ceil(x.length/g),G=I-B,h=x.slice(B,I);return R((l,o)=>{if(U){o.escape&&L();return}if(o.escape){d?(_(""),c(0),p(0)):L();return}if(o.upArrow){m>0?c(s=>s-1):T>0&&(p(s=>s-1),c(g-1));return}if(o.downArrow){m<G-1?c(s=>s+1):T<v-1&&(p(s=>s+1),c(0));return}if(o.return&&h[m]){C(h[m]);return}if(o.backspace||o.delete){_(s=>s.slice(0,-1)),c(0),p(0);return}l&&!o.ctrl&&!o.meta&&(_(s=>s+l),c(0),p(0))},{isActive:!u}),u?(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:t.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(n,{color:t.primary,bold:!0,children:a}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(n,{color:t.secondary,children:E??`Loading ${A}\u2026`})})]}):U?(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:t.statusFail,paddingX:2,paddingY:1,children:[(0,e.jsx)(n,{color:t.statusFail,bold:!0,children:a}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(n,{color:t.statusFail,children:U})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(n,{color:t.dim,children:"esc back"})})]}):(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:t.primary,paddingX:2,paddingY:1,children:[(0,e.jsxs)(i,{children:[(0,e.jsx)(n,{color:t.primary,bold:!0,children:a}),(0,e.jsxs)(n,{color:t.dim,children:[" (",x.length,d?`/${r.length}`:""," ",A,")"]})]}),d&&(0,e.jsxs)(i,{marginTop:1,children:[(0,e.jsx)(n,{color:t.secondary,children:"filter: "}),(0,e.jsx)(n,{children:d}),(0,e.jsx)(n,{color:t.dimmed,children:"\u2588"})]}),(0,e.jsx)(i,{flexDirection:"column",marginTop:1,children:x.length===0?(0,e.jsxs)(n,{color:t.dim,children:["No ",A,' match "',d,'"']}):h.map((l,o)=>{let s=o===m,H=s?"\u276F ":" ",K=l.isActive?t.statusPass:s?t.primary:void 0;return(0,e.jsxs)(n,{color:K,children:[H,l.label,l.isActive?" \u25CF selected":""]},l.id)})}),v>1&&(0,e.jsx)(i,{marginTop:1,children:(0,e.jsxs)(n,{color:t.dim,children:["Page ",T+1,"/",v]})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsxs)(n,{color:t.dim,children:["\u2191\u2193 navigate \xB7 type to search \xB7 \u21B5 select \xB7 esc ",d?"clear":"back"]})})]})}export{y as a,Y as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as E}from"./chunk-HCBYKLMW.js";import{r}from"./chunk-D3WSRUJS.js";import{a as i,b as t,i as M}from"./chunk-Q7JVDEOV.js";import{a as q}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var c=L(q(),1);var e=L(E(),1);function G(y){let m=[{id:"method",label:"Auth method",options:[{label:"Basic Auth",value:"basic"},{label:"OAuth (browser)",value:"oauth"}]}];return y&&m.push({id:"env",label:"Environment",options:[{label:"prod",value:"prod"},{label:"stage",value:"stage"}]}),m.push({id:"profile",label:"Profile"}),m.push({id:"credentials",label:"Credentials"}),m}function Z({devMode:y,profiles:m,onBasicLogin:F,onOAuthLogin:W,onComplete:R,onCancel:v}){let X=G(y),[B,S]=(0,c.useState)(0),[P,b]=(0,c.useState)(0),[T,w]=(0,c.useState)({}),[d,p]=(0,c.useState)("select"),[_,x]=(0,c.useState)(""),[u,A]=(0,c.useState)("username"),[z,Y]=(0,c.useState)(""),[k,C]=(0,c.useState)(null),[N,K]=(0,c.useState)(null),g=X[B],$=T.method??"basic",f=T.env??"prod",D=(0,c.useCallback)(()=>{let n=m.filter(l=>l.env===f).map(l=>({label:`${l.profile} [${l.env}]`,value:l.profile}));return n.push({label:"+ Create new",value:"__new__"}),n},[m,f]),I=(0,c.useCallback)(()=>{B===0?v():(S(a=>a-1),b(0),p("select"),x(""),C(null))},[B,v]),O=(0,c.useCallback)(a=>{$==="basic"?(p("text-input"),A("username"),x("")):(p("waiting"),W(a,f).then(()=>{K(`Logged in via OAuth as ${a} [${f}]`),p("done")}).catch(n=>{C(n.message),p("error")}))},[$,f,W]);M((a,n)=>{if(d==="done"){let o=T.profile??"default";R(o,f);return}if(d==="error"){v();return}if(d==="waiting"){n.escape&&v();return}if(d==="text-input"||d==="text-input-masked"){if(n.escape){I();return}if(n.return){let o=_.trim();if(!o)return;if(u==="profileName"){let s=o;w(V=>({...V,profile:s})),O(s);return}if(u==="username"){Y(o),x(""),A("accessKey"),p("text-input-masked");return}if(u==="accessKey"){let s=T.profile??"default";F(s,f,z,o),K(`Logged in as ${s} [${f}] via basic auth`),p("done");return}}if(n.backspace||n.delete){x(o=>o.slice(0,-1));return}a&&!n.ctrl&&!n.meta&&x(o=>o+a);return}if(n.escape){I();return}let l=g?.id==="profile"?D():g?.options??[];if(n.upArrow){b(o=>Math.max(0,o-1));return}if(n.downArrow){b(o=>Math.min(l.length-1,o+1));return}if(n.return&&l[P]){let o=l[P];if(g.id==="profile"){if(o.value==="__new__"){p("text-input"),A("profileName"),x("");return}w(s=>({...s,profile:o.value})),S(s=>s+1),b(0),O(o.value);return}w(s=>({...s,[g.id]:o.value})),S(s=>s+1),b(0)}});let h="Login";if(d==="done")return(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.statusPass,paddingX:2,paddingY:1,children:[(0,e.jsxs)(t,{color:r.statusPass,bold:!0,children:["\u2713 ",N]}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.dim,children:"press any key"})})]});if(d==="error")return(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.statusFail,paddingX:2,paddingY:1,children:[(0,e.jsx)(t,{color:r.statusFail,bold:!0,children:"Login failed"}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.statusFail,children:k})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.dim,children:"press any key"})})]});if(d==="waiting")return(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.primary,paddingX:2,paddingY:1,children:[(0,e.jsxs)(t,{color:r.primary,bold:!0,children:[h," \u203A OAuth"]}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.secondary,children:"Opening browser for login..."})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.primary,children:"Waiting for callback \u27F3"})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.dim,children:"esc cancel"})})]});if(d==="text-input"||d==="text-input-masked"){let a=u==="username"?"Username":u==="accessKey"?"Access Key":"Profile name",n=d==="text-input-masked"?"\u2022".repeat(_.length):_,l=u==="username"||u==="accessKey"?`${h} \u203A Basic Auth`:`${h} \u203A New Profile`;return(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(t,{color:r.primary,bold:!0,children:l}),u==="accessKey"&&(0,e.jsxs)(i,{marginTop:1,children:[(0,e.jsx)(t,{color:r.secondary,children:"Username: "}),(0,e.jsx)(t,{children:z})]}),(0,e.jsxs)(i,{marginTop:1,children:[(0,e.jsxs)(t,{color:r.secondary,children:[a,": "]}),(0,e.jsx)(t,{children:n}),(0,e.jsx)(t,{color:r.dimmed,children:"\u2588"})]}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.dim,children:"\u21B5 confirm \xB7 esc back"})})]})}let U=g?.id==="profile"?D():g?.options??[];return(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(t,{color:r.primary,bold:!0,children:h}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsxs)(t,{color:r.secondary,children:[g?.label,":"]})}),(0,e.jsx)(i,{flexDirection:"column",marginTop:1,children:U.map((a,n)=>{let l=n===P,o=l?"\u276F ":" ",s=a.value==="__new__"?r.statusPass:l?r.primary:void 0;return(0,e.jsxs)(t,{color:s,children:[o,a.label]},a.value)})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.dim,children:"\u2191\u2193 navigate \xB7 \u21B5 select \xB7 esc back"})})]})}export{G as a,Z as b};
2
+ import{a as E}from"./chunk-HCBYKLMW.js";import{r}from"./chunk-RDG6MGL7.js";import{a as i,b as t,i as M}from"./chunk-Q7JVDEOV.js";import{a as q}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var c=L(q(),1);var e=L(E(),1);function G(y){let m=[{id:"method",label:"Auth method",options:[{label:"Basic Auth",value:"basic"},{label:"OAuth (browser)",value:"oauth"}]}];return y&&m.push({id:"env",label:"Environment",options:[{label:"prod",value:"prod"},{label:"stage",value:"stage"}]}),m.push({id:"profile",label:"Profile"}),m.push({id:"credentials",label:"Credentials"}),m}function Z({devMode:y,profiles:m,onBasicLogin:F,onOAuthLogin:W,onComplete:R,onCancel:v}){let X=G(y),[B,S]=(0,c.useState)(0),[P,b]=(0,c.useState)(0),[T,w]=(0,c.useState)({}),[d,p]=(0,c.useState)("select"),[_,x]=(0,c.useState)(""),[u,A]=(0,c.useState)("username"),[z,Y]=(0,c.useState)(""),[k,C]=(0,c.useState)(null),[N,K]=(0,c.useState)(null),g=X[B],$=T.method??"basic",f=T.env??"prod",D=(0,c.useCallback)(()=>{let n=m.filter(l=>l.env===f).map(l=>({label:`${l.profile} [${l.env}]`,value:l.profile}));return n.push({label:"+ Create new",value:"__new__"}),n},[m,f]),I=(0,c.useCallback)(()=>{B===0?v():(S(a=>a-1),b(0),p("select"),x(""),C(null))},[B,v]),O=(0,c.useCallback)(a=>{$==="basic"?(p("text-input"),A("username"),x("")):(p("waiting"),W(a,f).then(()=>{K(`Logged in via OAuth as ${a} [${f}]`),p("done")}).catch(n=>{C(n.message),p("error")}))},[$,f,W]);M((a,n)=>{if(d==="done"){let o=T.profile??"default";R(o,f);return}if(d==="error"){v();return}if(d==="waiting"){n.escape&&v();return}if(d==="text-input"||d==="text-input-masked"){if(n.escape){I();return}if(n.return){let o=_.trim();if(!o)return;if(u==="profileName"){let s=o;w(V=>({...V,profile:s})),O(s);return}if(u==="username"){Y(o),x(""),A("accessKey"),p("text-input-masked");return}if(u==="accessKey"){let s=T.profile??"default";F(s,f,z,o),K(`Logged in as ${s} [${f}] via basic auth`),p("done");return}}if(n.backspace||n.delete){x(o=>o.slice(0,-1));return}a&&!n.ctrl&&!n.meta&&x(o=>o+a);return}if(n.escape){I();return}let l=g?.id==="profile"?D():g?.options??[];if(n.upArrow){b(o=>Math.max(0,o-1));return}if(n.downArrow){b(o=>Math.min(l.length-1,o+1));return}if(n.return&&l[P]){let o=l[P];if(g.id==="profile"){if(o.value==="__new__"){p("text-input"),A("profileName"),x("");return}w(s=>({...s,profile:o.value})),S(s=>s+1),b(0),O(o.value);return}w(s=>({...s,[g.id]:o.value})),S(s=>s+1),b(0)}});let h="Login";if(d==="done")return(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.statusPass,paddingX:2,paddingY:1,children:[(0,e.jsxs)(t,{color:r.statusPass,bold:!0,children:["\u2713 ",N]}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.dim,children:"press any key"})})]});if(d==="error")return(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.statusFail,paddingX:2,paddingY:1,children:[(0,e.jsx)(t,{color:r.statusFail,bold:!0,children:"Login failed"}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.statusFail,children:k})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.dim,children:"press any key"})})]});if(d==="waiting")return(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.primary,paddingX:2,paddingY:1,children:[(0,e.jsxs)(t,{color:r.primary,bold:!0,children:[h," \u203A OAuth"]}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.secondary,children:"Opening browser for login..."})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.primary,children:"Waiting for callback \u27F3"})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.dim,children:"esc cancel"})})]});if(d==="text-input"||d==="text-input-masked"){let a=u==="username"?"Username":u==="accessKey"?"Access Key":"Profile name",n=d==="text-input-masked"?"\u2022".repeat(_.length):_,l=u==="username"||u==="accessKey"?`${h} \u203A Basic Auth`:`${h} \u203A New Profile`;return(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(t,{color:r.primary,bold:!0,children:l}),u==="accessKey"&&(0,e.jsxs)(i,{marginTop:1,children:[(0,e.jsx)(t,{color:r.secondary,children:"Username: "}),(0,e.jsx)(t,{children:z})]}),(0,e.jsxs)(i,{marginTop:1,children:[(0,e.jsxs)(t,{color:r.secondary,children:[a,": "]}),(0,e.jsx)(t,{children:n}),(0,e.jsx)(t,{color:r.dimmed,children:"\u2588"})]}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.dim,children:"\u21B5 confirm \xB7 esc back"})})]})}let U=g?.id==="profile"?D():g?.options??[];return(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(t,{color:r.primary,bold:!0,children:h}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsxs)(t,{color:r.secondary,children:[g?.label,":"]})}),(0,e.jsx)(i,{flexDirection:"column",marginTop:1,children:U.map((a,n)=>{let l=n===P,o=l?"\u276F ":" ",s=a.value==="__new__"?r.statusPass:l?r.primary:void 0;return(0,e.jsxs)(t,{color:s,children:[o,a.label]},a.value)})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(t,{color:r.dim,children:"\u2191\u2193 navigate \xB7 \u21B5 select \xB7 esc back"})})]})}export{G as a,Z as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as S}from"./chunk-HCBYKLMW.js";import{i as p,r as t}from"./chunk-D3WSRUJS.js";import{a as m,b as n,i as y}from"./chunk-Q7JVDEOV.js";import{a as L}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var g=h(L(),1);import{readdirSync as D,mkdirSync as A,statSync as N}from"fs";import{join as P}from"path";var r=h(S(),1);function O(c){try{return D(c).filter(s=>{try{return N(P(c,s)).isDirectory()}catch{return!1}})}catch{return[]}}function E(c,s,f,T){return{name:c,path:s,label:c,isActive:T}}function F({currentPath:c,onSelect:s,onCancel:f}){let l=O(p).map(i=>{let e=P(p,i);return E(i,e,c,e===c)}),d=!c,B=l.length+2,[a,b]=(0,g.useState)(()=>{if(d)return 0;let i=l.findIndex(e=>e.isActive);return i>=0?i+1:0}),[v,C]=(0,g.useState)(!1),[I,x]=(0,g.useState)("");return y((i,e)=>{if(v){if(e.escape){C(!1),x("");return}if(e.return){let o=I.trim();if(o){let u=P(p,o);A(u,{recursive:!0}),s(u),f()}return}if(e.backspace||e.delete){x(o=>o.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&x(o=>o+i);return}if(e.escape){f();return}if(e.upArrow){b(o=>Math.max(0,o-1));return}if(e.downArrow){b(o=>Math.min(B-1,o+1));return}if(e.return){if(a===0){d||s(""),f();return}if(a===l.length+1){A(p,{recursive:!0}),C(!0),x("");return}let o=l[a-1];o&&!o.isActive&&s(o.path),f();return}}),v?(0,r.jsxs)(m,{flexDirection:"column",borderStyle:"round",borderColor:t.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(n,{color:t.primary,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(m,{marginTop:1,children:[(0,r.jsx)(n,{color:t.secondary,children:"Name: "}),(0,r.jsx)(n,{children:I}),(0,r.jsx)(n,{color:t.dimmed,children:"\u2588"})]}),(0,r.jsx)(m,{marginTop:1,children:(0,r.jsx)(n,{color:t.dim,children:"\u21B5 create \xB7 esc back"})})]}):(0,r.jsxs)(m,{flexDirection:"column",borderStyle:"round",borderColor:t.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(n,{color:t.primary,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(m,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(n,{color:d?t.statusPass:a===0?t.primary:t.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",d?" \u25CF active":""]}),l.map((i,e)=>{let u=e+1===a,R=u?"\u276F ":" ",w=i.isActive?t.statusPass:u?t.primary:void 0;return(0,r.jsxs)(n,{color:w,children:[R,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(n,{color:a===l.length+1?t.primary:t.dim,children:[a===l.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(m,{marginTop:1,children:(0,r.jsx)(n,{color:t.dim,children:"\u2191\u2193 navigate \xB7 \u21B5 select \xB7 esc back"})})]})}export{O as a,E as b,F as c};
2
+ import{a as S}from"./chunk-HCBYKLMW.js";import{i as p,r as t}from"./chunk-RDG6MGL7.js";import{a as m,b as n,i as y}from"./chunk-Q7JVDEOV.js";import{a as L}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var g=h(L(),1);import{readdirSync as D,mkdirSync as A,statSync as N}from"fs";import{join as P}from"path";var r=h(S(),1);function O(c){try{return D(c).filter(s=>{try{return N(P(c,s)).isDirectory()}catch{return!1}})}catch{return[]}}function E(c,s,f,T){return{name:c,path:s,label:c,isActive:T}}function F({currentPath:c,onSelect:s,onCancel:f}){let l=O(p).map(i=>{let e=P(p,i);return E(i,e,c,e===c)}),d=!c,B=l.length+2,[a,b]=(0,g.useState)(()=>{if(d)return 0;let i=l.findIndex(e=>e.isActive);return i>=0?i+1:0}),[v,C]=(0,g.useState)(!1),[I,x]=(0,g.useState)("");return y((i,e)=>{if(v){if(e.escape){C(!1),x("");return}if(e.return){let o=I.trim();if(o){let u=P(p,o);A(u,{recursive:!0}),s(u),f()}return}if(e.backspace||e.delete){x(o=>o.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&x(o=>o+i);return}if(e.escape){f();return}if(e.upArrow){b(o=>Math.max(0,o-1));return}if(e.downArrow){b(o=>Math.min(B-1,o+1));return}if(e.return){if(a===0){d||s(""),f();return}if(a===l.length+1){A(p,{recursive:!0}),C(!0),x("");return}let o=l[a-1];o&&!o.isActive&&s(o.path),f();return}}),v?(0,r.jsxs)(m,{flexDirection:"column",borderStyle:"round",borderColor:t.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(n,{color:t.primary,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(m,{marginTop:1,children:[(0,r.jsx)(n,{color:t.secondary,children:"Name: "}),(0,r.jsx)(n,{children:I}),(0,r.jsx)(n,{color:t.dimmed,children:"\u2588"})]}),(0,r.jsx)(m,{marginTop:1,children:(0,r.jsx)(n,{color:t.dim,children:"\u21B5 create \xB7 esc back"})})]}):(0,r.jsxs)(m,{flexDirection:"column",borderStyle:"round",borderColor:t.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(n,{color:t.primary,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(m,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(n,{color:d?t.statusPass:a===0?t.primary:t.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",d?" \u25CF active":""]}),l.map((i,e)=>{let u=e+1===a,R=u?"\u276F ":" ",w=i.isActive?t.statusPass:u?t.primary:void 0;return(0,r.jsxs)(n,{color:w,children:[R,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(n,{color:a===l.length+1?t.primary:t.dim,children:[a===l.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(m,{marginTop:1,children:(0,r.jsx)(n,{color:t.dim,children:"\u2191\u2193 navigate \xB7 \u21B5 select \xB7 esc back"})})]})}export{O as a,E as b,F as c};
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
3
- import{a as Cn,b as En}from"./chunk-PFVUFDRI.js";import{a as an,b as Gr,c as Zn,d as ts,e as ns}from"./chunk-JMFLXNAG.js";import{a as ss}from"./chunk-ISIBNO3G.js";import{c as Qr}from"./chunk-GEG2YL4Q.js";import{b as Yn}from"./chunk-BGUDP4VU.js";import{b as Qn}from"./chunk-6JPSYIY2.js";import{a as ce,b as Xn}from"./chunk-Q47TGXAH.js";import{a as cn}from"./chunk-NRQDE7HH.js";import{a as Zr,b as un}from"./chunk-YNF4MUQP.js";import{a as es}from"./chunk-GNMGQOGV.js";import{a as rs}from"./chunk-54CAWEGK.js";import{c as kn}from"./chunk-TSMW6QW4.js";import{a as ln}from"./chunk-3CJ6IY5O.js";import{a as It}from"./chunk-I7YWZ3D2.js";import{b as Xr}from"./chunk-BZFESAZK.js";import{b as Yr}from"./chunk-TENTBVGG.js";import{a as ae}from"./chunk-HCBYKLMW.js";import{a as Pt,c as _e,d as Wr,g as Kn,h as qn,j as Jn,k as zn,l as Gn,m as Kr,n as qr,o as Jr,p as zr,r as m}from"./chunk-D3WSRUJS.js";import{a as v,b as u,c as yn,d as Xt,i as Ze,j as Sn,k as Ot}from"./chunk-Q7JVDEOV.js";import{a as We}from"./chunk-6YGTRKDT.js";import{a as on,c as Ht,e as G}from"./chunk-UR6MHSHU.js";var xn=Ht(Rr=>{"use strict";var Nn=class extends Error{constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},kr=class extends Nn{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Rr.CommanderError=Nn;Rr.InvalidArgumentError=kr});var Fn=Ht(Tr=>{"use strict";var{InvalidArgumentError:da}=xn(),Ar=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new da(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function fa(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}Tr.Argument=Ar;Tr.humanReadableArgName=fa});var Pr=Ht(uo=>{"use strict";var{humanReadableArgName:ma}=Fn(),Or=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),this.sortSubcommands&&t.sort((n,s)=>n.name().localeCompare(s.name())),t}compareOptions(e,t){let r=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),r=e._getHelpOption();if(r&&!r.hidden){let n=r.short&&e._findOption(r.short),s=r.long&&e._findOption(r.long);!n&&!s?t.push(r):r.long&&!s?t.push(e.createOption(r.long,r.description)):r.short&&!n&&t.push(e.createOption(r.short,r.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let n=r.options.filter(s=>!s.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(r=>ma(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,n)=>Math.max(r,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,n)=>Math.max(r,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let n=e.parent;n;n=n.parent)r=n.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatHelp(e,t){let r=t.padWidth(e,t),n=t.helpWidth||80,s=2,a=2;function o(p,b){if(b){let g=`${p.padEnd(r+a)}${b}`;return t.wrap(g,n-s,r+a)}return p}function l(p){return p.join(`
3
+ import{a as Cn,b as En}from"./chunk-B4K7UTF2.js";import{a as an,b as Gr,c as Zn,d as ts,e as ns}from"./chunk-KSHUUU2I.js";import{a as ss}from"./chunk-IA4UI2BT.js";import{c as Qr}from"./chunk-XHPTLI5U.js";import{b as Yn}from"./chunk-BSMUBGQO.js";import{b as Qn}from"./chunk-LZZDLYE3.js";import{a as ce,b as Xn}from"./chunk-RPQV6H45.js";import{a as cn}from"./chunk-NRQDE7HH.js";import{a as Zr,b as un}from"./chunk-YNF4MUQP.js";import{a as es}from"./chunk-GNMGQOGV.js";import{a as rs}from"./chunk-426ZAKPO.js";import{c as kn}from"./chunk-GTYF5DR6.js";import{a as ln}from"./chunk-3CJ6IY5O.js";import{a as It}from"./chunk-I7YWZ3D2.js";import{b as Xr}from"./chunk-S2FLPRVR.js";import{b as Yr}from"./chunk-JXLB6N6Q.js";import{a as ae}from"./chunk-HCBYKLMW.js";import{a as Pt,c as _e,d as Wr,g as Kn,h as qn,j as Jn,k as zn,l as Gn,m as Kr,n as qr,o as Jr,p as zr,r as m}from"./chunk-RDG6MGL7.js";import{a as v,b as u,c as yn,d as Xt,i as Ze,j as Sn,k as Ot}from"./chunk-Q7JVDEOV.js";import{a as We}from"./chunk-6YGTRKDT.js";import{a as on,c as Ht,e as G}from"./chunk-UR6MHSHU.js";var xn=Ht(Rr=>{"use strict";var Nn=class extends Error{constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},kr=class extends Nn{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Rr.CommanderError=Nn;Rr.InvalidArgumentError=kr});var Fn=Ht(Tr=>{"use strict";var{InvalidArgumentError:da}=xn(),Ar=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new da(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function fa(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}Tr.Argument=Ar;Tr.humanReadableArgName=fa});var Pr=Ht(uo=>{"use strict";var{humanReadableArgName:ma}=Fn(),Or=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),this.sortSubcommands&&t.sort((n,s)=>n.name().localeCompare(s.name())),t}compareOptions(e,t){let r=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),r=e._getHelpOption();if(r&&!r.hidden){let n=r.short&&e._findOption(r.short),s=r.long&&e._findOption(r.long);!n&&!s?t.push(r):r.long&&!s?t.push(e.createOption(r.long,r.description)):r.short&&!n&&t.push(e.createOption(r.short,r.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let n=r.options.filter(s=>!s.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(r=>ma(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,n)=>Math.max(r,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,n)=>Math.max(r,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let n=e.parent;n;n=n.parent)r=n.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatHelp(e,t){let r=t.padWidth(e,t),n=t.helpWidth||80,s=2,a=2;function o(p,b){if(b){let g=`${p.padEnd(r+a)}${b}`;return t.wrap(g,n-s,r+a)}return p}function l(p){return p.join(`
4
4
  `).replace(/^/gm," ".repeat(s))}let c=[`Usage: ${t.commandUsage(e)}`,""],d=t.commandDescription(e);d.length>0&&(c=c.concat([t.wrap(d,n,0),""]));let h=t.visibleArguments(e).map(p=>o(t.argumentTerm(p),t.argumentDescription(p)));h.length>0&&(c=c.concat(["Arguments:",l(h),""]));let x=t.visibleOptions(e).map(p=>o(t.optionTerm(p),t.optionDescription(p)));if(x.length>0&&(c=c.concat(["Options:",l(x),""])),this.showGlobalOptions){let p=t.visibleGlobalOptions(e).map(b=>o(t.optionTerm(b),t.optionDescription(b)));p.length>0&&(c=c.concat(["Global Options:",l(p),""]))}let S=t.visibleCommands(e).map(p=>o(t.subcommandTerm(p),t.subcommandDescription(p)));return S.length>0&&(c=c.concat(["Commands:",l(S),""])),c.join(`
5
5
  `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,n=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",a=new RegExp(`[\\n][${s}]+`);if(e.match(a))return e;let o=t-r;if(o<n)return e;let l=e.slice(0,r),c=e.slice(r).replace(`\r
6
6
  `,`
@@ -41,8 +41,8 @@ tell application "System Events" to get value of property list item "CFBundleNam
41
41
  `)})}}},[B.bifurcationInfo,n,re]);let je=U.default.useRef(null),ge=U.default.useRef(0),pe=U.default.useRef(0);(0,U.useEffect)(()=>{if(B.lastRunEnd&&B.lastRunEnd!==je.current){je.current=B.lastRunEnd;let{status:_,duration:T,summary:R,reason:O,context:V}=B.lastRunEnd,z=B.steps.flatMap(xe=>{let lt=xe.children??[];return[xe,...lt]}),se=z.filter(xe=>xe.status==="passed").length,Ue=z.filter(xe=>xe.status==="failed").length,Se=z.filter(xe=>xe.status==="passed"||xe.status==="failed").length;ge.current+=Se,pe.current+=T??0,M({status:_,duration:T??0,summary:R??"",stepsPassed:se,stepsFailed:Ue,stepsTotal:Se,reason:O,finalState:B.lastRunEnd?.final_state}),n.logRunEnd(Z.current,_,T,R);let Pe=B.lastRunEnd?.total_runs??1,Le=B.lastRunEnd?.run_dir,Ve,Ce;if(Pe>1&&Le){let xe=ua(Le),lt=Z.current;Ve=Array.from({length:Pe},(Nr,wn)=>De(xe,String(lt+wn)));let gt=B.bifurcationInfo;gt&&!gt.isSingleFlow&&gt.flows.length===Pe&&(Ce=gt.flows)}n.addRunResult({index:Z.current,objective:Y.current,summary:R,status:_,context:V??{memory:{},variables:{},pointer:""},run_dir:Le,run_dirs:Ve,flow_objectives:Ce},B.lastRunEnd?.total_runs)}},[B.lastRunEnd,n,re]);let ut=(0,U.useRef)(null);(0,U.useEffect)(()=>{B.askingUser&&B.askingUser!==ut.current&&(ut.current=B.askingUser,de((0,H.jsxs)(v,{children:[(0,H.jsx)(u,{color:"#ff9500",children:"? "}),(0,H.jsx)(u,{color:"#ff9500",children:"Agent asks: "}),(0,H.jsx)(u,{children:B.askingUser})]}))),B.askingUser||(ut.current=null)},[B.askingUser,de]);let kt=(0,U.useRef)(null);(0,U.useEffect)(()=>{if(L&&!B.isRunning&&B.lastRunEnd){let _=`${B.lastRunEnd.status}-${B.lastRunEnd.summary?.slice(0,20)}`;if(kt.current===_)return;kt.current=_,de((0,H.jsx)(io,{data:L,color:L.status==="passed"?"#4ade80":"#ef4444"})),M(null)}},[L,B.isRunning,B.lastRunEnd,de]),(0,U.useEffect)(()=>{if(B.runError&&!B.isRunning){let _=B.runError.trim();n.log(`RUNNER_ERROR ${_.replace(/\n/g,"\\n")}`);let R=_.split(`
42
42
  `).slice(-8).join(`
43
43
  `);re({type:"error",text:`Runner error:
44
- ${R}`})}},[B.runError,B.isRunning,re,n]);let Rt=(0,U.useCallback)(async()=>{n.log("EXIT_UPLOAD starting exit upload pipeline"),k(Zn()),X({status:"uploading"});let _=ce(E),T=$.getResolvedBasicAuth(),R;if(T)n.log("EXIT_UPLOAD using resolved basic auth for controller"),R={username:T.username,accessKey:T.access_key};else{let Ce=await $.getToken();if(!Ce)return n.log("EXIT_UPLOAD aborted: no auth available"),null;R=Ce}let O=y??await me();if(!O)return n.log("EXIT_UPLOAD aborted: no TMS credentials"),n.setUploadStatus("failed","Could not get TMS credentials"),null;let V=n.generateCommitId();n.log(`EXIT_UPLOAD config: testId=${n.testId} commitId=${V} projectId=${K.project_id} sessionDir=${n.sessionDir} runDirs=${JSON.stringify(n.getRunDirs())}`);let z=T?.username??O.username,se=T?.access_key??O.access_key,Ue=n.getContext().prior_runs,Se=n.getRunObjectives(),Pe=[];for(let[Ce]of Object.entries(n.auteurVariables))if(Ce.startsWith("secrets.user.")){let xe=Ce.replace("secrets.user.","");Pe.push({key_name:xe,scope:"user"})}F.current&&(n.log("SCREENSHOT_UPLOAD draining queue before pipeline"),await F.current.drain(),n.log("SCREENSHOT_UPLOAD queue drained"));let Ve=await new es({controllerBaseUrl:_.controllerBaseUrl,tmsBaseUrl:_.tmsBaseUrl,auth:R,authResolver:$.getResolver()??void 0,sessionId:n.sessionId,sessionDir:n.sessionDir,testId:n.testId,commitId:V,projectId:K.project_id,folderId:K.folder_id,firstObjective:n.firstObjective??"KaneAI Test",firstUrl:n.firstUrl??"",runDirs:n.getRunDirs(),runObjectives:Se,startedAt:n.startedAt,endedAt:new Date().toISOString(),totalSteps:ge.current,totalDuration:pe.current,runStatuses:Ue.map(Ce=>Ce.status),orgId:O.org_id,userId:O.user_id,tmsUsername:z,tmsAccessKey:se,screenshotBaseUrl:n.screenshotBaseUrl,shareApiBaseUrl:_.shareApiBaseUrl,testManagerUiUrl:_.testManagerUiUrl,variables:Object.keys(n.auteurVariables).length>0?n.auteurVariables:void 0,variableIds:{},secrets:Pe,codeExport:e,onProgress:(Ce,xe,lt)=>{n.log(`EXIT_PROGRESS step=${Ce} status=${xe}${lt?` detail=${lt}`:""}`),k(gt=>ts(gt,Ce,xe,lt))},log:Ce=>n.log(Ce)}).execute();return Ve.success?(n.log(`EXIT_UPLOAD success: testId=${Ve.testId} testcaseId=${Ve.testcaseId??"none"} shareId=${Ve.shareId??"none"}`),n.setUploadStatus("uploaded"),Ve.testId&&n.setTestId(Ve.testId),Ve.testcaseId&&n.setTestcaseId(Ve.testcaseId)):(n.log(`EXIT_UPLOAD failed: ${Ve.error}`),n.setUploadStatus("failed",Ve.error)),Ve},[$,E,n,K,y,me]),At=(0,U.useCallback)(()=>{n.finish("complete"),un(),Be.killChrome(),setTimeout(()=>r(),1500)},[n,Be,r]),rt=(0,U.useCallback)(async _=>{if(j(!1),_&&n.testId){n.log(`EXIT feedback=${_}, submitting...`);try{let T=ce(E),R=$.getResolvedBasicAuth();R&&(await new It(T.tmsBaseUrl,R.username,R.access_key).submitFeedback({instruction_id:"",test_id:n.testId,feedback_type:_,mode:"human"}),n.log("EXIT feedback submitted"))}catch(T){n.log(`EXIT feedback failed: ${T}`)}}else n.log("EXIT feedback skipped");At()},[E,$,n,At]),mt=(0,U.useCallback)(()=>{if(Q)return;let _=n.nextRunIndex()>0;if(n.log(`EXIT hasRuns=${_} localMode=${i}`),!_||i){n.log(`EXIT quick exit \u2014 ${_?"local mode":"no runs"}`),n.finish("complete"),un(),Be.killChrome(),r();return}n.log("EXIT starting upload pipeline..."),te(!0),Rt().then(T=>{let R=ce(E),O=K.project_id;if(T?.testcaseId&&O){let V=`${R.testManagerUiUrl}/projects/${O}/test-cases/${T.testcaseId}`,z=T.shareId?`${V}/dashboard/share/${T.shareId}`:void 0,se=`${V}/dashboard?type=summary&agentView=true&fqdn=summary-page`;X({status:"success",testUrl:z,testCaseLink:se,codeExportDir:T.codeExportDir}),Zs({shareableLink:z,testCaseLink:se,codeExportDir:T.codeExportDir})}else X({status:T?.success?"success":"failed",error:T?.error});j(!0)}).catch(T=>{n.log(`EXIT_UPLOAD exception: ${T}`),n.setUploadStatus("failed",String(T)),X({status:"failed",error:String(T)}),j(!0)})},[Q,n,Be,r,i,Rt,E,K]);(0,U.useEffect)(()=>{if(!Q)return;let _=300*1e3,T=setTimeout(()=>{n.setUploadStatus("failed","Upload timed out after 5m"),n.finish("complete"),un(),Be.killChrome(),process.exit(0)},_);return()=>clearTimeout(T)},[Q,n,Be]);let Mt=U.default.useRef(0),Oe=U.default.useRef(null),be=U.default.useRef(0);Ze((_,T)=>{if(T.ctrl&&_==="c"){if(Q){be.current+=1,be.current>=2&&(n.setUploadStatus("pending","Force exit by user"),n.finish("complete"),un(),Be.killChrome(),process.exit(0));return}if(B.isRunning){B.cancelRun(),re({type:"info",text:"Run cancelled."}),Mt.current++,Oe.current&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{Mt.current=0},2e3),Mt.current>=2&&mt();return}if(Vt==="chat"){St("menu");return}mt()}});let st=U.default.useMemo(()=>{let _=$.creds.getActiveProfile()??"none",T=$.creds.getDefaultEnv();return[{id:"run",label:"Run",type:"submenu",children:[{id:"run-start",label:"Start Run",type:"action"},{id:"run-config",label:"Run Config",type:"submenu",children:[{id:"run-headless",label:"Headless",type:"select",currentValue:fe.headless?"on":"off",options:[{label:"off",value:"off"},{label:"on",value:"on"}],onValue:R=>{nt(O=>({...O,headless:R==="on"}))}},{id:"run-max-steps",label:"Max Steps",type:"text-input",currentValue:String(fe.maxSteps),onValue:R=>{let O=parseInt(R,10);O>0&&nt(V=>({...V,maxSteps:O}))}},{id:"run-timeout",label:"Timeout (sec)",type:"text-input",currentValue:fe.timeout?String(fe.timeout):"",placeholder:"0 = no timeout",onValue:R=>{let O=parseInt(R,10);nt(V=>({...V,timeout:isNaN(O)?0:O}))}},{id:"run-cdp",label:"CDP Endpoint",type:"text-input",currentValue:fe.cdpEndpoint,placeholder:"http://127.0.0.1:9222",onValue:R=>{nt(O=>({...O,cdpEndpoint:R}))}},{id:"run-ws",label:"WS Endpoint",type:"text-input",currentValue:fe.wsEndpoint,placeholder:"wss://...",onValue:R=>{nt(O=>({...O,wsEndpoint:R}))}}]}]},{id:"auth",label:"Auth",type:"submenu",children:[{id:"login",label:"Login",type:"action",onLoginWizard:()=>{}},{id:"logout",label:"Logout",type:"action",onAction:()=>{$.logout().then(R=>{Et();let O=$.creds.getActiveProfile(),V=$.creds.getDefaultEnv();ie(O,V),ne().catch(()=>{}),re(R?{type:"info",text:`Logged out: ${R.profile} [${R.env}]`}:{type:"info",text:"No active profile"})}).catch(()=>{re({type:"error",text:"Logout failed"})})}},{id:"whoami",label:"Who Am I",type:"action",onInfo:()=>{let R=$.creds.getActiveProfile()??"none",O=$.creds.getDefaultEnv(),V=$.creds.loadBasicAuth(R,O),z=V?"basic":$.creds.loadCredentials(R,O)?"oauth":"not configured";return{title:"Who Am I",sections:[{label:"Identity",entries:[{key:"Profile",value:R},{key:"Environment",value:O}]},{label:"Authentication",entries:[{key:"Method",value:z},...V?[{key:"Username",value:V.username}]:[]]},{label:"Token",entries:[{key:"Status",value:$.tokenValid?"valid":"not logged in",color:$.tokenValid?m.statusPass:m.statusFail}]}]}}},{id:"profiles",label:"Profiles",type:"action",onProfilesView:()=>{}}]},{id:"config",label:"Config",type:"submenu",children:[{id:"config-show",label:"Show",type:"action",onInfo:()=>({title:"Show Config",sections:[{label:"General",entries:[{key:"Model",value:"v16-alpha"}]},{label:"Browser",entries:[{key:"Window",value:`${K.window_size.width}x${K.window_size.height}`},{key:"Chrome Profile",value:K.chrome_profile_path?K.chrome_profile_path.split("/").pop()??K.chrome_profile_path:"(temporary)"}]},{label:"Project",entries:[{key:"Project",value:K.project_name?`${K.project_name} (${K.project_id})`:K.project_id??"(none)"},{key:"Folder",value:K.folder_name?`${K.folder_name} (${K.folder_id})`:K.folder_id??"(none)"},{key:"Default URL",value:K.default_url??"(none)"}]}]})},{id:"config-chrome",label:"Chrome Profile",type:"action",onChromeProfilePicker:()=>{}},{id:"config-project",label:"Project",type:"action",onProjectPicker:()=>{}},{id:"config-folder",label:"Folder",type:"action",...K.project_id?{onFolderPicker:()=>{}}:{onInfo:()=>({title:"Folder",sections:[{entries:[{key:"Status",value:"Select a project first",color:m.dim}]}]})}},{id:"config-url",label:"Default URL",type:"text-input",currentValue:K.default_url??"",onValue:R=>{s.set("default_url",R)}},{id:"config-window",label:"Window Size",type:"text-input",currentValue:`${K.window_size.width}x${K.window_size.height}`,placeholder:"WIDTHxHEIGHT",onValue:R=>{let O=R.split("x").map(Number);O[0]&&O[1]&&s.set("window_size",{width:O[0],height:O[1]})}}]},{id:"help",label:"Help",type:"submenu",children:[{id:"help-paths",label:"File Paths",type:"action",onInfo:()=>({title:"File Paths",sections:[{label:"Variables",entries:[{key:"Global dir",value:`${De(_e,"variables")}/*.json`},{key:"Local dir",value:"{cwd}/.testmuai/variables/*.json"},{key:"Format",value:'{ "key": { "value": "...", "secret": false } }'},{key:"Usage",value:"{{key}} in objectives"}]},{label:"Context Files",entries:[{key:"Global",value:De(_e,"global-memory.md")},{key:"Local",value:"{cwd}/.testmuai/context.md"}]},{label:"Config",entries:[{key:"TUI config",value:De(_e,"tui-config.json")},{key:"Auth",value:De(_e,"config.json")},{key:"Sessions",value:`${De(_e,"sessions")}/`}]}]})},{id:"help-variables",label:"Variables",type:"action",onInfo:()=>({title:"Variables",sections:[{label:"Loading Order (later wins)",entries:[{key:"1. Global",value:`${De(_e,"variables")}/*.json`},{key:"2. Local",value:"{cwd}/.testmuai/variables/*.json"},{key:"3. CLI",value:"--variables-file <path>"},{key:"4. Inline",value:`--variables '{"key": {"value": "..."}}"`}]},{label:"Format",entries:[{key:"Normal",value:'{ "username": { "value": "alice", "secret": false } }'},{key:"Secret",value:'{ "api_key": { "value": "sk-...", "secret": true } }'}]},{label:"Usage",entries:[{key:"Syntax",value:"{{key}} in objectives to reference variables"}]}]})},{id:"help-context",label:"Context Files",type:"action",onInfo:()=>({title:"Context Files",sections:[{entries:[{key:"Description",value:"Additional instructions for the agent"}]},{label:"Paths",entries:[{key:"Global",value:De(_e,"global-memory.md")},{key:"Local",value:"{cwd}/.testmuai/context.md"}]},{label:"CLI Overrides",entries:[{key:"Global",value:"--global-context <file>"},{key:"Local",value:"--local-context <file>"}]}]})}]},{id:"update",label:d?`Update (${d.current} \u2192 ${d.latest})`:"Update",type:"action",onAction:()=>{x||(S(!0),re({type:"info",text:"Checking for updates..."}),(async()=>{let{checkForUpdate:R}=await import("./version-check-54A7DQDT.js"),O=await R();if(!O){re({type:"info",text:`Already on latest version (${Pt})`}),S(!1);return}re({type:"info",text:`Update available: ${O.current} \u2192 ${O.latest}. Installing...`});let{runSelfUpdate:V}=await import("./updater-5VMYLGW3.js"),z=await V();z.success?re({type:"info",text:`\u2713 Updated to ${z.toVersion}. Restart kane-cli to use the new version.`}):re({type:"error",text:`Update failed: ${z.error}`}),S(!1)})())}},{id:"exit",label:"Exit",type:"action",onAction:()=>{mt()}}]},[$,s,K,re,mt,fe,Et,d,x]),pt=(0,U.useCallback)(_=>{if(B.askingUser){de((0,H.jsxs)(v,{children:[(0,H.jsx)(u,{color:"#888888",children:"\u2192 "}),(0,H.jsx)(u,{color:"#888888",children:"You answered: "}),(0,H.jsx)(u,{children:_})]})),B.sendAnswer(_);return}if(n.logCommand(_),B.isRunning){re({type:"error",text:"Run in progress. Ctrl+C to cancel."});return}de((0,H.jsxs)(v,{children:[(0,H.jsx)(u,{color:"#b388ff",children:"\u276F "}),(0,H.jsx)(u,{children:_})]}));let T=p??K.default_url;le(_,T||void 0)},[B,re,de,n,p,K,le]),_n="KaneAI CLI",ot=$.getAuthInfo(),ht=ot?ot.method==="basic"?"basic auth":"oauth":"not logged in";return zt?(0,H.jsxs)(v,{flexDirection:"column",children:[oe.length>0&&(0,H.jsx)(Xt,{items:oe,children:_=>(0,H.jsx)(v,{paddingX:1,children:_.content},_.id)}),!l&&(0,H.jsx)(ps,{onComplete:()=>{let _=$.creds.getActiveProfile(),T=$.creds.getDefaultEnv(),R=_?$.creds.loadCredentials(_,T):null,O=_?$.creds.loadBasicAuth(_,T):null,V=!!(R||O),z=O?.username??_??null;de((0,H.jsx)(An,{size:"full",helmetVisibleRows:8,textVisibleRows:7,showMeta:!0,version:Pt,authenticated:V,user:z})),c(!0),t&&t.then(se=>{se&&(h(se),re({type:"info",text:`Update available: ${se.current} \u2192 ${se.latest} \u2014 select Update from menu or run \`kane-cli update\``}))}).catch(()=>{})}}),l&&Vt==="menu"&&!Q&&(0,H.jsx)(v,{marginBottom:1,children:(0,H.jsxs)(v,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,H.jsx)(u,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,H.jsx)(u,{color:m.dimmed,children:" \u2502 "}),(0,H.jsx)(u,{color:"#ff9500",children:K.model}),(0,H.jsx)(u,{color:m.dimmed,children:" \u2502 "}),(0,H.jsx)(u,{color:m.dimmed,children:ht}),(0,H.jsx)(u,{color:m.dimmed,children:" \u2502 "}),(0,H.jsxs)(u,{color:m.dimmed,children:[Lt??"no profile","/",E]})]})}),l&&!Q&&(0,H.jsxs)(v,{flexDirection:"column",flexGrow:1,children:[Vt==="menu"&&(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(Ks,{items:st,onRunSelected:()=>St("chat"),renderLoginWizard:_=>{let T=ve?.phase??"wizard";if(T==="project")return(0,H.jsx)(Yn,{resolver:$.getResolver(),currentProjectId:null,env:ve.env,onSelect:(R,O)=>{$.creds.saveProfileConfig(ve.profile,ve.env,{project_id:R,project_name:O}),at(V=>V?{...V,phase:"folder"}:null)},onCancel:()=>{ie(ve.profile,ve.env),at(null),_()}});if(T==="folder"){let R=$.creds.loadProfileConfig(ve.profile,ve.env);return(0,H.jsx)(Qn,{resolver:$.getResolver(),projectId:R?.project_id??"",currentFolderId:null,env:ve.env,onSelect:(O,V)=>{$.creds.saveProfileConfig(ve.profile,ve.env,{folder_id:O,folder_name:V}),ie(ve.profile,ve.env),at(null),_()},onCancel:async()=>{let O=$.creds.loadProfileConfig(ve.profile,ve.env);if(O?.project_id)try{let z=$.getResolver()?.cached;if(z){let se=ce(ve.env),Se=await new It(se.tmsBaseUrl,z.username,z.access_key).getDefaultFolder(O.project_id);Se&&$.creds.saveProfileConfig(ve.profile,ve.env,{folder_id:Se,folder_name:"Default"})}}catch{}ie(ve.profile,ve.env),at(null),_()}})}return(0,H.jsx)(Xr,{devMode:process.env.KANE_DEV_MODE==="1",profiles:$.creds.listProfiles(),onBasicLogin:(R,O,V,z)=>{$.creds.saveBasicAuth(R,O,{username:V,access_key:z}),$.creds.setActiveProfile(R),$.creds.setDefaultEnv(O),$.setTokenValid(!0),Et()},onOAuthLogin:async(R,O)=>{$.creds.setDefaultEnv(O),await $.login(R),Et()},onComplete:(R,O)=>{ne(O).then(()=>{at({phase:"project",profile:R,env:O})}).catch(()=>{at({phase:"project",profile:R,env:O})})},onCancel:()=>{at(null),_()}})},renderProfilesView:_=>(0,H.jsx)(Yr,{creds:$.creds,onSwitch:(T,R)=>{$.creds.setActiveProfile(T),$.creds.setDefaultEnv(R),ie(T,R),Et(),ne(R).catch(()=>{}),re({type:"info",text:`Switched to ${T} [${R}]`})},onCancel:_}),renderChromeProfilePicker:_=>(0,H.jsx)(Qr,{currentPath:K.chrome_profile_path,onSelect:T=>{s.set("chrome_profile_path",T),Ct(s.load())},onCancel:_}),renderProjectPicker:_=>(0,H.jsx)(Yn,{resolver:$.getResolver(),currentProjectId:K.project_id,env:E,onSelect:(T,R)=>{s.save({project_id:T,project_name:R});let O=$.creds.getActiveProfile(),V=$.creds.getDefaultEnv();O&&$.creds.saveProfileConfig(O,V,{project_id:T,project_name:R}),Ct(s.load()),_()},onCancel:_}),renderFolderPicker:_=>(0,H.jsx)(Qn,{resolver:$.getResolver(),projectId:K.project_id??"",currentFolderId:K.folder_id,env:E,onSelect:(T,R)=>{s.save({folder_id:T,folder_name:R});let O=$.creds.getActiveProfile(),V=$.creds.getDefaultEnv();O&&$.creds.saveProfileConfig(O,V,{folder_id:T,folder_name:R}),Ct(s.load()),_()},onCancel:_})})}),Vt==="chat"&&(0,H.jsxs)(H.Fragment,{children:[B.isRunning&&B.steps.length>0&&(0,H.jsx)(Pn,{steps:B.steps,bifurcated:!!B.bifurcationInfo&&!B.bifurcationInfo.isSingleFlow,flows:B.bifurcationInfo?.flows,cmInitCounts:B.cmInitCounts,onStepCommit:de},`run-${Z.current}`),(0,H.jsx)(xs,{onSubmit:pt,onEscape:()=>{!B.isRunning&&!B.askingUser&&St("menu")},history:q,placeholder:B.askingUser?"Type your answer...":B.isRunning?"Run in progress... Ctrl+C to cancel":"Type an objective... (esc = menu)"})]})]}),l&&Q&&A&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ns,{steps:f,status:A.status,testUrl:A.testUrl,error:A.error}),A.status==="success"&&(0,H.jsx)(rs,{shareableLink:A.testUrl,testCaseLink:A.testCaseLink,codeExportDir:A.codeExportDir,autoExit:!1})]}),P&&(0,H.jsx)(ss,{onSubmit:rt}),l&&!Q&&(0,H.jsx)(os,{profile:Lt,environment:E,model:K.model,tokenValid:$.tokenValid,sessionId:n.sessionId,runCount:N,viewMode:Vt})]}):(0,H.jsx)(Fs,{onComplete:()=>{Ct(s.load()),sn(!0)}})}var So=G(yo(),1),{program:uf,createCommand:df,createArgument:ff,createOption:mf,CommanderError:pf,InvalidArgumentError:hf,InvalidOptionArgumentError:gf,Command:Co,Argument:xf,Option:Hn,Help:vf}=So.default;import{join as Qe}from"path";import{readFileSync as ko,readdirSync as Ra,existsSync as vn}from"fs";var Ro=G(We(),1);import{createInterface as ka}from"readline";function rn(i){process.stdout.write(JSON.stringify(i)+`
45
- `)}async function Eo(i,e,t){let r=Un(i,e);kn().then(h=>{h&&rn({type:"update_available",current:h.current,latest:h.latest,severity:h.severity})}).catch(()=>{});let n=ka({input:process.stdin});n.on("line",h=>{try{let x=JSON.parse(h);x.type==="user_response"?r.sendUserResponse(x.answer??""):x.type==="cancel"&&r.sendCancel(x.reason??"")}catch{}});let s=null,a=!1,o=0,l=null,c=0,d=!1;for await(let h of r.events)switch(h.type){case"run_start":d&&c++;break;case"step_start":{let x=h,S={step:x.index+1,status:"running",remark:x.objective??`Step ${x.index+1}`};x.child_id&&(S.child_id=x.child_id),rn(S);break}case"step_end":{let x=h;o++;let S={step:x.index+1,status:x.status==="passed"?"done":"failed",remark:x.summary??""};x.child_id&&(S.child_id=x.child_id),rn(S);let p=d?Math.max(0,c-1):0;t?.onStepEnd?.(x.index,p);break}case"bifurcation":{let x=h,S=x.flows??[],p=x.count??S.length;(x.is_single_flow??p<=1)||(l=S,d=!0,c=0),rn({type:"bifurcation",flows:S,count:p});break}case"ask_user":{let x=h;rn({type:"ask_user",question:x.question,step_index:x.step_index,...x.options?{options:x.options}:{}});break}case"run_end":{s=h;break}case"error":{a=!0,rn({type:"error",message:h.message});break}default:break}return n.close(),await r.exited,{lastRunEnd:s,stepsTotal:o,hadError:a,bifurcationFlows:l}}function Ao(i){let e=new Co;if(e.name("kane-cli").version(Pt),i[0]==="--help"||i[0]==="-h"||i[0]==="help"){(async()=>{let{HelpView:r}=await import("./HelpView-DMXQKJYW.js"),{render:n}=await import("./build-MFETN2BY.js"),s=await import("./react-QWOAB3TB.js"),{waitUntilExit:a}=n(s.default.createElement(r));await a(),process.exit(0)})();return}e.command("login").action(async()=>{let r=new Ee,{LoginWizard:n}=await import("./LoginWizard-AKV22AJ5.js"),{render:s}=await import("./build-MFETN2BY.js"),a=await import("./react-QWOAB3TB.js");await new Promise(o=>{let{unmount:l}=s(a.default.createElement(n,{devMode:process.env.KANE_DEV_MODE==="1",profiles:r.listProfiles(),onBasicLogin:(c,d,h,x)=>{r.saveBasicAuth(c,d,{username:h,access_key:x}),r.setActiveProfile(c),r.setDefaultEnv(d),l(),o()},onOAuthLogin:async(c,d)=>{r.setDefaultEnv(d),await new bt(c,d,r).login(),l(),o()},onCancel:()=>{l(),o()}}))})}),e.command("logout").action(async()=>{let r=new Ee,n=r.getActiveProfile();if(!n){console.log("No active profile to logout");return}let s=r.getDefaultEnv(),a=r.loadCredentials(n,s),o=r.loadClient(n,s);if(a&&o){let c=new Ge(s);try{await c.revokeToken(a.access_token,o.client_id,"access_token")}catch{}try{await c.revokeToken(a.refresh_token,o.client_id,"refresh_token")}catch{}}r.deleteProfileFull(n,s);let l=r.listProfiles();l.length>0?(r.setActiveProfile(l[0].profile),r.setDefaultEnv(l[0].env),console.log(`Logged out ${n} [${s}]. Switched to ${l[0].profile} [${l[0].env}]`)):console.log(`Logged out ${n} [${s}]. No profiles remaining.`)}),e.command("whoami").option("--profile <name>","Profile name").action(async r=>{let n=new Ee,s=r.profile??n.getActiveProfile()??"default",a=n.getDefaultEnv(),o=n.loadCredentials(s,a),l=n.loadBasicAuth(s,a),c="none",d,h,x;if(l)c="basic",d=l.username;else if(o){c="oauth";let w=o.expires_at,N=Date.now()/1e3;h=w>N?"valid":"expired",x=new Date(w*1e3).toISOString().slice(0,10)}else h="missing";let{WhoamiView:S}=await import("./WhoamiView-6EWBKXAF.js"),{render:p}=await import("./build-MFETN2BY.js"),b=await import("./react-QWOAB3TB.js"),{waitUntilExit:g}=p(b.default.createElement(S,{profile:s,env:a,authenticated:c!=="none",authMethod:c,username:d,tokenStatus:h,expiresAt:x}));await g()}),e.command("config <action> [value]").action(async(r,n)=>{let s=new et,a=new Ee;if(r==="show"){let o=s.load(),l=a.getActiveProfile()??"default",c=a.getDefaultEnv(),d=a.loadBasicAuth(l,c),h=a.loadCredentials(l,c),x=d?`basic (${d.username})`:h?"oauth":"not configured",{ConfigView:S}=await import("./ConfigView-5A2DPQNW.js"),{render:p}=await import("./build-MFETN2BY.js"),b=await import("./react-QWOAB3TB.js"),{waitUntilExit:g}=p(b.default.createElement(S,{model:o.model,authLabel:x,profile:l,env:c,defaultUrl:o.default_url,projectId:o.project_id,projectName:o.project_name,folderId:o.folder_id,windowSize:`${o.window_size.width}x${o.window_size.height}`,chromeProfile:o.chrome_profile_path,setupComplete:o.setup_complete}));await g()}else if(r==="set-url"&&n)s.set("default_url",n),console.log(`Default URL set to ${n}`);else if(r==="set-window"&&n){let o=n.split("x").map(Number);o[0]&&o[1]&&(s.set("window_size",{width:o[0],height:o[1]}),console.log(`Window size set to ${o[0]}x${o[1]}`))}else if(r==="chrome-profile"){let{ChromeProfilePicker:o}=await import("./ChromeProfilePicker-SAXOTO5M.js"),{render:l}=await import("./build-MFETN2BY.js"),c=await import("./react-QWOAB3TB.js");await new Promise(d=>{let{unmount:h}=l(c.default.createElement(o,{currentPath:s.load().chrome_profile_path,onSelect:x=>{s.set("chrome_profile_path",x),console.log(`Chrome profile set to ${x}`),h(),d()},onCancel:()=>{h(),d()}}))})}else if(r==="project"){let o=a.getDefaultEnv(),l=ce(o),c=a.loadBasicAuth(a.getActiveProfile()??"default",o);if(!c){console.log("Login first to browse projects");return}let{ProjectPicker:d}=await import("./ProjectPicker-UJUXK3UA.js"),{AuthResolver:h}=await import("./resolver-L3Z6FAOD.js"),{render:x}=await import("./build-MFETN2BY.js"),S=await import("./react-QWOAB3TB.js"),p=new h(l.controllerBaseUrl,async()=>null,c);await p.resolve(),await new Promise(b=>{let{unmount:g}=x(S.default.createElement(d,{resolver:p,currentProjectId:s.load().project_id,env:o,onSelect:(w,N)=>{s.set("project_id",w),s.set("project_name",N),console.log(`Project set to ${N} (${w})`),g(),b()},onCancel:()=>{g(),b()}}))})}else if(r==="folder"){let o=s.load();if(!o.project_id){console.log("Select a project first: kane-cli config project");return}let l=a.getDefaultEnv(),c=ce(l),d=a.loadBasicAuth(a.getActiveProfile()??"default",l);if(!d){console.log("Login first to browse folders");return}let{FolderPicker:h}=await import("./FolderPicker-4RBXJLK2.js"),{AuthResolver:x}=await import("./resolver-L3Z6FAOD.js"),{render:S}=await import("./build-MFETN2BY.js"),p=await import("./react-QWOAB3TB.js"),b=new x(c.controllerBaseUrl,async()=>null,d);await b.resolve(),await new Promise(g=>{let{unmount:w}=S(p.default.createElement(h,{resolver:b,projectId:o.project_id,currentFolderId:o.folder_id,env:l,onSelect:(N,W)=>{s.set("folder_id",N),s.set("folder_name",W),console.log(`Folder set to ${W} (${N})`),w(),g()},onCancel:()=>{w(),g()}}))})}else console.log("Usage: kane-cli config show|set-url|set-window|chrome-profile|project|folder")}),e.command("run").argument("<objective>","Test objective (use {{var}} to reference variables)").option("--url <url>","Target URL").option("--headless","Run Chrome in headless mode").option("--max-steps <n>","Maximum agent steps","30").option("--timeout <seconds>","Kill run after N seconds").option("--cdp-endpoint <url>","Connect to existing Chrome CDP endpoint").option("--ws-endpoint <url>","Connect via Playwright WebSocket (e.g. LambdaTest wss:// URL)").option("--global-context <file>",`Override global context markdown (default: ${Qe(_e,"global-memory.md")})`).option("--local-context <file>","Override local context markdown (default: .testmuai/context.md in cwd)").addOption(new Hn("--model <name>","Model override").hideHelp()).option("--variables <json>",`Inline variables JSON, e.g. '{"user": {"value": "alice"}}'`).option("--variables-file <path>","Load variables from a JSON file").option("--session-context <json>","Session context JSON (prior runs)").addOption(new Hn("--cft","Use Playwright Chromium instead of managed Chrome").hideHelp()).option("--username <user>","Basic auth username (skip OAuth)").option("--access-key <key>","Basic auth access key (skip OAuth)").option("--env <name>","Environment (prod or stage)").option("--agent","Agent mode: plain NDJSON output, no colors/UI").option("--task-skills","Enable domain-specific task skills (experimental)").addOption(new Hn("--local","Skip TMS integration (no uploads, no variables/secrets push)").hideHelp()).option("--code-export","Generate code export after upload").addHelpText("after",`
44
+ ${R}`})}},[B.runError,B.isRunning,re,n]);let Rt=(0,U.useCallback)(async()=>{n.log("EXIT_UPLOAD starting exit upload pipeline"),k(Zn()),X({status:"uploading"});let _=ce(E),T=$.getResolvedBasicAuth(),R;if(T)n.log("EXIT_UPLOAD using resolved basic auth for controller"),R={username:T.username,accessKey:T.access_key};else{let Ce=await $.getToken();if(!Ce)return n.log("EXIT_UPLOAD aborted: no auth available"),null;R=Ce}let O=y??await me();if(!O)return n.log("EXIT_UPLOAD aborted: no TMS credentials"),n.setUploadStatus("failed","Could not get TMS credentials"),null;let V=n.generateCommitId();n.log(`EXIT_UPLOAD config: testId=${n.testId} commitId=${V} projectId=${K.project_id} sessionDir=${n.sessionDir} runDirs=${JSON.stringify(n.getRunDirs())}`);let z=T?.username??O.username,se=T?.access_key??O.access_key,Ue=n.getContext().prior_runs,Se=n.getRunObjectives(),Pe=[];for(let[Ce]of Object.entries(n.auteurVariables))if(Ce.startsWith("secrets.user.")){let xe=Ce.replace("secrets.user.","");Pe.push({key_name:xe,scope:"user"})}F.current&&(n.log("SCREENSHOT_UPLOAD draining queue before pipeline"),await F.current.drain(),n.log("SCREENSHOT_UPLOAD queue drained"));let Ve=await new es({controllerBaseUrl:_.controllerBaseUrl,tmsBaseUrl:_.tmsBaseUrl,auth:R,authResolver:$.getResolver()??void 0,sessionId:n.sessionId,sessionDir:n.sessionDir,testId:n.testId,commitId:V,projectId:K.project_id,folderId:K.folder_id,firstObjective:n.firstObjective??"KaneAI Test",firstUrl:n.firstUrl??"",runDirs:n.getRunDirs(),runObjectives:Se,startedAt:n.startedAt,endedAt:new Date().toISOString(),totalSteps:ge.current,totalDuration:pe.current,runStatuses:Ue.map(Ce=>Ce.status),orgId:O.org_id,userId:O.user_id,tmsUsername:z,tmsAccessKey:se,screenshotBaseUrl:n.screenshotBaseUrl,shareApiBaseUrl:_.shareApiBaseUrl,testManagerUiUrl:_.testManagerUiUrl,variables:Object.keys(n.auteurVariables).length>0?n.auteurVariables:void 0,variableIds:{},secrets:Pe,codeExport:e,onProgress:(Ce,xe,lt)=>{n.log(`EXIT_PROGRESS step=${Ce} status=${xe}${lt?` detail=${lt}`:""}`),k(gt=>ts(gt,Ce,xe,lt))},log:Ce=>n.log(Ce)}).execute();return Ve.success?(n.log(`EXIT_UPLOAD success: testId=${Ve.testId} testcaseId=${Ve.testcaseId??"none"} shareId=${Ve.shareId??"none"}`),n.setUploadStatus("uploaded"),Ve.testId&&n.setTestId(Ve.testId),Ve.testcaseId&&n.setTestcaseId(Ve.testcaseId)):(n.log(`EXIT_UPLOAD failed: ${Ve.error}`),n.setUploadStatus("failed",Ve.error)),Ve},[$,E,n,K,y,me]),At=(0,U.useCallback)(()=>{n.finish("complete"),un(),Be.killChrome(),setTimeout(()=>r(),1500)},[n,Be,r]),rt=(0,U.useCallback)(async _=>{if(j(!1),_&&n.testId){n.log(`EXIT feedback=${_}, submitting...`);try{let T=ce(E),R=$.getResolvedBasicAuth();R&&(await new It(T.tmsBaseUrl,R.username,R.access_key).submitFeedback({instruction_id:"",test_id:n.testId,feedback_type:_,mode:"human"}),n.log("EXIT feedback submitted"))}catch(T){n.log(`EXIT feedback failed: ${T}`)}}else n.log("EXIT feedback skipped");At()},[E,$,n,At]),mt=(0,U.useCallback)(()=>{if(Q)return;let _=n.nextRunIndex()>0;if(n.log(`EXIT hasRuns=${_} localMode=${i}`),!_||i){n.log(`EXIT quick exit \u2014 ${_?"local mode":"no runs"}`),n.finish("complete"),un(),Be.killChrome(),r();return}n.log("EXIT starting upload pipeline..."),te(!0),Rt().then(T=>{let R=ce(E),O=K.project_id;if(T?.testcaseId&&O){let V=`${R.testManagerUiUrl}/projects/${O}/test-cases/${T.testcaseId}`,z=T.shareId?`${V}/dashboard/share/${T.shareId}`:void 0,se=`${V}/dashboard?type=summary&agentView=true&fqdn=summary-page`;X({status:"success",testUrl:z,testCaseLink:se,codeExportDir:T.codeExportDir}),Zs({shareableLink:z,testCaseLink:se,codeExportDir:T.codeExportDir})}else X({status:T?.success?"success":"failed",error:T?.error});j(!0)}).catch(T=>{n.log(`EXIT_UPLOAD exception: ${T}`),n.setUploadStatus("failed",String(T)),X({status:"failed",error:String(T)}),j(!0)})},[Q,n,Be,r,i,Rt,E,K]);(0,U.useEffect)(()=>{if(!Q)return;let _=300*1e3,T=setTimeout(()=>{n.setUploadStatus("failed","Upload timed out after 5m"),n.finish("complete"),un(),Be.killChrome(),process.exit(0)},_);return()=>clearTimeout(T)},[Q,n,Be]);let Mt=U.default.useRef(0),Oe=U.default.useRef(null),be=U.default.useRef(0);Ze((_,T)=>{if(T.ctrl&&_==="c"){if(Q){be.current+=1,be.current>=2&&(n.setUploadStatus("pending","Force exit by user"),n.finish("complete"),un(),Be.killChrome(),process.exit(0));return}if(B.isRunning){B.cancelRun(),re({type:"info",text:"Run cancelled."}),Mt.current++,Oe.current&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{Mt.current=0},2e3),Mt.current>=2&&mt();return}if(Vt==="chat"){St("menu");return}mt()}});let st=U.default.useMemo(()=>{let _=$.creds.getActiveProfile()??"none",T=$.creds.getDefaultEnv();return[{id:"run",label:"Run",type:"submenu",children:[{id:"run-start",label:"Start Run",type:"action"},{id:"run-config",label:"Run Config",type:"submenu",children:[{id:"run-headless",label:"Headless",type:"select",currentValue:fe.headless?"on":"off",options:[{label:"off",value:"off"},{label:"on",value:"on"}],onValue:R=>{nt(O=>({...O,headless:R==="on"}))}},{id:"run-max-steps",label:"Max Steps",type:"text-input",currentValue:String(fe.maxSteps),onValue:R=>{let O=parseInt(R,10);O>0&&nt(V=>({...V,maxSteps:O}))}},{id:"run-timeout",label:"Timeout (sec)",type:"text-input",currentValue:fe.timeout?String(fe.timeout):"",placeholder:"0 = no timeout",onValue:R=>{let O=parseInt(R,10);nt(V=>({...V,timeout:isNaN(O)?0:O}))}},{id:"run-cdp",label:"CDP Endpoint",type:"text-input",currentValue:fe.cdpEndpoint,placeholder:"http://127.0.0.1:9222",onValue:R=>{nt(O=>({...O,cdpEndpoint:R}))}},{id:"run-ws",label:"WS Endpoint",type:"text-input",currentValue:fe.wsEndpoint,placeholder:"wss://...",onValue:R=>{nt(O=>({...O,wsEndpoint:R}))}}]}]},{id:"auth",label:"Auth",type:"submenu",children:[{id:"login",label:"Login",type:"action",onLoginWizard:()=>{}},{id:"logout",label:"Logout",type:"action",onAction:()=>{$.logout().then(R=>{Et();let O=$.creds.getActiveProfile(),V=$.creds.getDefaultEnv();ie(O,V),ne().catch(()=>{}),re(R?{type:"info",text:`Logged out: ${R.profile} [${R.env}]`}:{type:"info",text:"No active profile"})}).catch(()=>{re({type:"error",text:"Logout failed"})})}},{id:"whoami",label:"Who Am I",type:"action",onInfo:()=>{let R=$.creds.getActiveProfile()??"none",O=$.creds.getDefaultEnv(),V=$.creds.loadBasicAuth(R,O),z=V?"basic":$.creds.loadCredentials(R,O)?"oauth":"not configured";return{title:"Who Am I",sections:[{label:"Identity",entries:[{key:"Profile",value:R},{key:"Environment",value:O}]},{label:"Authentication",entries:[{key:"Method",value:z},...V?[{key:"Username",value:V.username}]:[]]},{label:"Token",entries:[{key:"Status",value:$.tokenValid?"valid":"not logged in",color:$.tokenValid?m.statusPass:m.statusFail}]}]}}},{id:"profiles",label:"Profiles",type:"action",onProfilesView:()=>{}}]},{id:"config",label:"Config",type:"submenu",children:[{id:"config-show",label:"Show",type:"action",onInfo:()=>({title:"Show Config",sections:[{label:"General",entries:[{key:"Model",value:"v16-alpha"}]},{label:"Browser",entries:[{key:"Window",value:`${K.window_size.width}x${K.window_size.height}`},{key:"Chrome Profile",value:K.chrome_profile_path?K.chrome_profile_path.split("/").pop()??K.chrome_profile_path:"(temporary)"}]},{label:"Project",entries:[{key:"Project",value:K.project_name?`${K.project_name} (${K.project_id})`:K.project_id??"(none)"},{key:"Folder",value:K.folder_name?`${K.folder_name} (${K.folder_id})`:K.folder_id??"(none)"},{key:"Default URL",value:K.default_url??"(none)"}]}]})},{id:"config-chrome",label:"Chrome Profile",type:"action",onChromeProfilePicker:()=>{}},{id:"config-project",label:"Project",type:"action",onProjectPicker:()=>{}},{id:"config-folder",label:"Folder",type:"action",...K.project_id?{onFolderPicker:()=>{}}:{onInfo:()=>({title:"Folder",sections:[{entries:[{key:"Status",value:"Select a project first",color:m.dim}]}]})}},{id:"config-url",label:"Default URL",type:"text-input",currentValue:K.default_url??"",onValue:R=>{s.set("default_url",R)}},{id:"config-window",label:"Window Size",type:"text-input",currentValue:`${K.window_size.width}x${K.window_size.height}`,placeholder:"WIDTHxHEIGHT",onValue:R=>{let O=R.split("x").map(Number);O[0]&&O[1]&&s.set("window_size",{width:O[0],height:O[1]})}}]},{id:"help",label:"Help",type:"submenu",children:[{id:"help-paths",label:"File Paths",type:"action",onInfo:()=>({title:"File Paths",sections:[{label:"Variables",entries:[{key:"Global dir",value:`${De(_e,"variables")}/*.json`},{key:"Local dir",value:"{cwd}/.testmuai/variables/*.json"},{key:"Format",value:'{ "key": { "value": "...", "secret": false } }'},{key:"Usage",value:"{{key}} in objectives"}]},{label:"Context Files",entries:[{key:"Global",value:De(_e,"global-memory.md")},{key:"Local",value:"{cwd}/.testmuai/context.md"}]},{label:"Config",entries:[{key:"TUI config",value:De(_e,"tui-config.json")},{key:"Auth",value:De(_e,"config.json")},{key:"Sessions",value:`${De(_e,"sessions")}/`}]}]})},{id:"help-variables",label:"Variables",type:"action",onInfo:()=>({title:"Variables",sections:[{label:"Loading Order (later wins)",entries:[{key:"1. Global",value:`${De(_e,"variables")}/*.json`},{key:"2. Local",value:"{cwd}/.testmuai/variables/*.json"},{key:"3. CLI",value:"--variables-file <path>"},{key:"4. Inline",value:`--variables '{"key": {"value": "..."}}"`}]},{label:"Format",entries:[{key:"Normal",value:'{ "username": { "value": "alice", "secret": false } }'},{key:"Secret",value:'{ "api_key": { "value": "sk-...", "secret": true } }'}]},{label:"Usage",entries:[{key:"Syntax",value:"{{key}} in objectives to reference variables"}]}]})},{id:"help-context",label:"Context Files",type:"action",onInfo:()=>({title:"Context Files",sections:[{entries:[{key:"Description",value:"Additional instructions for the agent"}]},{label:"Paths",entries:[{key:"Global",value:De(_e,"global-memory.md")},{key:"Local",value:"{cwd}/.testmuai/context.md"}]},{label:"CLI Overrides",entries:[{key:"Global",value:"--global-context <file>"},{key:"Local",value:"--local-context <file>"}]}]})}]},{id:"update",label:d?`Update (${d.current} \u2192 ${d.latest})`:"Update",type:"action",onAction:()=>{x||(S(!0),re({type:"info",text:"Checking for updates..."}),(async()=>{let{checkForUpdate:R}=await import("./version-check-KS7CP3M5.js"),O=await R();if(!O){re({type:"info",text:`Already on latest version (${Pt})`}),S(!1);return}re({type:"info",text:`Update available: ${O.current} \u2192 ${O.latest}. Installing...`});let{runSelfUpdate:V}=await import("./updater-H5HYMYRG.js"),z=await V();z.success?re({type:"info",text:`\u2713 Updated to ${z.toVersion}. Restart kane-cli to use the new version.`}):re({type:"error",text:`Update failed: ${z.error}`}),S(!1)})())}},{id:"exit",label:"Exit",type:"action",onAction:()=>{mt()}}]},[$,s,K,re,mt,fe,Et,d,x]),pt=(0,U.useCallback)(_=>{if(B.askingUser){de((0,H.jsxs)(v,{children:[(0,H.jsx)(u,{color:"#888888",children:"\u2192 "}),(0,H.jsx)(u,{color:"#888888",children:"You answered: "}),(0,H.jsx)(u,{children:_})]})),B.sendAnswer(_);return}if(n.logCommand(_),B.isRunning){re({type:"error",text:"Run in progress. Ctrl+C to cancel."});return}de((0,H.jsxs)(v,{children:[(0,H.jsx)(u,{color:"#b388ff",children:"\u276F "}),(0,H.jsx)(u,{children:_})]}));let T=p??K.default_url;le(_,T||void 0)},[B,re,de,n,p,K,le]),_n="KaneAI CLI",ot=$.getAuthInfo(),ht=ot?ot.method==="basic"?"basic auth":"oauth":"not logged in";return zt?(0,H.jsxs)(v,{flexDirection:"column",children:[oe.length>0&&(0,H.jsx)(Xt,{items:oe,children:_=>(0,H.jsx)(v,{paddingX:1,children:_.content},_.id)}),!l&&(0,H.jsx)(ps,{onComplete:()=>{let _=$.creds.getActiveProfile(),T=$.creds.getDefaultEnv(),R=_?$.creds.loadCredentials(_,T):null,O=_?$.creds.loadBasicAuth(_,T):null,V=!!(R||O),z=O?.username??_??null;de((0,H.jsx)(An,{size:"full",helmetVisibleRows:8,textVisibleRows:7,showMeta:!0,version:Pt,authenticated:V,user:z})),c(!0),t&&t.then(se=>{se&&(h(se),re({type:"info",text:`Update available: ${se.current} \u2192 ${se.latest} \u2014 select Update from menu or run \`kane-cli update\``}))}).catch(()=>{})}}),l&&Vt==="menu"&&!Q&&(0,H.jsx)(v,{marginBottom:1,children:(0,H.jsxs)(v,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,H.jsx)(u,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,H.jsx)(u,{color:m.dimmed,children:" \u2502 "}),(0,H.jsx)(u,{color:"#ff9500",children:K.model}),(0,H.jsx)(u,{color:m.dimmed,children:" \u2502 "}),(0,H.jsx)(u,{color:m.dimmed,children:ht}),(0,H.jsx)(u,{color:m.dimmed,children:" \u2502 "}),(0,H.jsxs)(u,{color:m.dimmed,children:[Lt??"no profile","/",E]})]})}),l&&!Q&&(0,H.jsxs)(v,{flexDirection:"column",flexGrow:1,children:[Vt==="menu"&&(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(Ks,{items:st,onRunSelected:()=>St("chat"),renderLoginWizard:_=>{let T=ve?.phase??"wizard";if(T==="project")return(0,H.jsx)(Yn,{resolver:$.getResolver(),currentProjectId:null,env:ve.env,onSelect:(R,O)=>{$.creds.saveProfileConfig(ve.profile,ve.env,{project_id:R,project_name:O}),at(V=>V?{...V,phase:"folder"}:null)},onCancel:()=>{ie(ve.profile,ve.env),at(null),_()}});if(T==="folder"){let R=$.creds.loadProfileConfig(ve.profile,ve.env);return(0,H.jsx)(Qn,{resolver:$.getResolver(),projectId:R?.project_id??"",currentFolderId:null,env:ve.env,onSelect:(O,V)=>{$.creds.saveProfileConfig(ve.profile,ve.env,{folder_id:O,folder_name:V}),ie(ve.profile,ve.env),at(null),_()},onCancel:async()=>{let O=$.creds.loadProfileConfig(ve.profile,ve.env);if(O?.project_id)try{let z=$.getResolver()?.cached;if(z){let se=ce(ve.env),Se=await new It(se.tmsBaseUrl,z.username,z.access_key).getDefaultFolder(O.project_id);Se&&$.creds.saveProfileConfig(ve.profile,ve.env,{folder_id:Se,folder_name:"Default"})}}catch{}ie(ve.profile,ve.env),at(null),_()}})}return(0,H.jsx)(Xr,{devMode:process.env.KANE_DEV_MODE==="1",profiles:$.creds.listProfiles(),onBasicLogin:(R,O,V,z)=>{$.creds.saveBasicAuth(R,O,{username:V,access_key:z}),$.creds.setActiveProfile(R),$.creds.setDefaultEnv(O),$.setTokenValid(!0),Et()},onOAuthLogin:async(R,O)=>{$.creds.setDefaultEnv(O),await $.login(R),Et()},onComplete:(R,O)=>{ne(O).then(()=>{at({phase:"project",profile:R,env:O})}).catch(()=>{at({phase:"project",profile:R,env:O})})},onCancel:()=>{at(null),_()}})},renderProfilesView:_=>(0,H.jsx)(Yr,{creds:$.creds,onSwitch:(T,R)=>{$.creds.setActiveProfile(T),$.creds.setDefaultEnv(R),ie(T,R),Et(),ne(R).catch(()=>{}),re({type:"info",text:`Switched to ${T} [${R}]`})},onCancel:_}),renderChromeProfilePicker:_=>(0,H.jsx)(Qr,{currentPath:K.chrome_profile_path,onSelect:T=>{s.set("chrome_profile_path",T),Ct(s.load())},onCancel:_}),renderProjectPicker:_=>(0,H.jsx)(Yn,{resolver:$.getResolver(),currentProjectId:K.project_id,env:E,onSelect:(T,R)=>{s.save({project_id:T,project_name:R});let O=$.creds.getActiveProfile(),V=$.creds.getDefaultEnv();O&&$.creds.saveProfileConfig(O,V,{project_id:T,project_name:R}),Ct(s.load()),_()},onCancel:_}),renderFolderPicker:_=>(0,H.jsx)(Qn,{resolver:$.getResolver(),projectId:K.project_id??"",currentFolderId:K.folder_id,env:E,onSelect:(T,R)=>{s.save({folder_id:T,folder_name:R});let O=$.creds.getActiveProfile(),V=$.creds.getDefaultEnv();O&&$.creds.saveProfileConfig(O,V,{folder_id:T,folder_name:R}),Ct(s.load()),_()},onCancel:_})})}),Vt==="chat"&&(0,H.jsxs)(H.Fragment,{children:[B.isRunning&&B.steps.length>0&&(0,H.jsx)(Pn,{steps:B.steps,bifurcated:!!B.bifurcationInfo&&!B.bifurcationInfo.isSingleFlow,flows:B.bifurcationInfo?.flows,cmInitCounts:B.cmInitCounts,onStepCommit:de},`run-${Z.current}`),(0,H.jsx)(xs,{onSubmit:pt,onEscape:()=>{!B.isRunning&&!B.askingUser&&St("menu")},history:q,placeholder:B.askingUser?"Type your answer...":B.isRunning?"Run in progress... Ctrl+C to cancel":"Type an objective... (esc = menu)"})]})]}),l&&Q&&A&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ns,{steps:f,status:A.status,testUrl:A.testUrl,error:A.error}),A.status==="success"&&(0,H.jsx)(rs,{shareableLink:A.testUrl,testCaseLink:A.testCaseLink,codeExportDir:A.codeExportDir,autoExit:!1})]}),P&&(0,H.jsx)(ss,{onSubmit:rt}),l&&!Q&&(0,H.jsx)(os,{profile:Lt,environment:E,model:K.model,tokenValid:$.tokenValid,sessionId:n.sessionId,runCount:N,viewMode:Vt})]}):(0,H.jsx)(Fs,{onComplete:()=>{Ct(s.load()),sn(!0)}})}var So=G(yo(),1),{program:uf,createCommand:df,createArgument:ff,createOption:mf,CommanderError:pf,InvalidArgumentError:hf,InvalidOptionArgumentError:gf,Command:Co,Argument:xf,Option:Hn,Help:vf}=So.default;import{join as Qe}from"path";import{readFileSync as ko,readdirSync as Ra,existsSync as vn}from"fs";var Ro=G(We(),1);import{createInterface as ka}from"readline";function rn(i){process.stdout.write(JSON.stringify(i)+`
45
+ `)}async function Eo(i,e,t){let r=Un(i,e);kn().then(h=>{h&&rn({type:"update_available",current:h.current,latest:h.latest,severity:h.severity})}).catch(()=>{});let n=ka({input:process.stdin});n.on("line",h=>{try{let x=JSON.parse(h);x.type==="user_response"?r.sendUserResponse(x.answer??""):x.type==="cancel"&&r.sendCancel(x.reason??"")}catch{}});let s=null,a=!1,o=0,l=null,c=0,d=!1;for await(let h of r.events)switch(h.type){case"run_start":d&&c++;break;case"step_start":{let x=h,S={step:x.index+1,status:"running",remark:x.objective??`Step ${x.index+1}`};x.child_id&&(S.child_id=x.child_id),rn(S);break}case"step_end":{let x=h;o++;let S={step:x.index+1,status:x.status==="passed"?"done":"failed",remark:x.summary??""};x.child_id&&(S.child_id=x.child_id),rn(S);let p=d?Math.max(0,c-1):0;t?.onStepEnd?.(x.index,p);break}case"bifurcation":{let x=h,S=x.flows??[],p=x.count??S.length;(x.is_single_flow??p<=1)||(l=S,d=!0,c=0),rn({type:"bifurcation",flows:S,count:p});break}case"ask_user":{let x=h;rn({type:"ask_user",question:x.question,step_index:x.step_index,...x.options?{options:x.options}:{}});break}case"run_end":{s=h;break}case"error":{a=!0,rn({type:"error",message:h.message});break}default:break}return n.close(),await r.exited,{lastRunEnd:s,stepsTotal:o,hadError:a,bifurcationFlows:l}}function Ao(i){let e=new Co;if(e.name("kane-cli").version(Pt),i[0]==="--help"||i[0]==="-h"||i[0]==="help"){(async()=>{let{HelpView:r}=await import("./HelpView-2ZFLX7JC.js"),{render:n}=await import("./build-MFETN2BY.js"),s=await import("./react-QWOAB3TB.js"),{waitUntilExit:a}=n(s.default.createElement(r));await a(),process.exit(0)})();return}e.command("login").action(async()=>{let r=new Ee,{LoginWizard:n}=await import("./LoginWizard-SSE5NJVU.js"),{render:s}=await import("./build-MFETN2BY.js"),a=await import("./react-QWOAB3TB.js");await new Promise(o=>{let{unmount:l}=s(a.default.createElement(n,{devMode:process.env.KANE_DEV_MODE==="1",profiles:r.listProfiles(),onBasicLogin:(c,d,h,x)=>{r.saveBasicAuth(c,d,{username:h,access_key:x}),r.setActiveProfile(c),r.setDefaultEnv(d),l(),o()},onOAuthLogin:async(c,d)=>{r.setDefaultEnv(d),await new bt(c,d,r).login(),l(),o()},onCancel:()=>{l(),o()}}))})}),e.command("logout").action(async()=>{let r=new Ee,n=r.getActiveProfile();if(!n){console.log("No active profile to logout");return}let s=r.getDefaultEnv(),a=r.loadCredentials(n,s),o=r.loadClient(n,s);if(a&&o){let c=new Ge(s);try{await c.revokeToken(a.access_token,o.client_id,"access_token")}catch{}try{await c.revokeToken(a.refresh_token,o.client_id,"refresh_token")}catch{}}r.deleteProfileFull(n,s);let l=r.listProfiles();l.length>0?(r.setActiveProfile(l[0].profile),r.setDefaultEnv(l[0].env),console.log(`Logged out ${n} [${s}]. Switched to ${l[0].profile} [${l[0].env}]`)):console.log(`Logged out ${n} [${s}]. No profiles remaining.`)}),e.command("whoami").option("--profile <name>","Profile name").action(async r=>{let n=new Ee,s=r.profile??n.getActiveProfile()??"default",a=n.getDefaultEnv(),o=n.loadCredentials(s,a),l=n.loadBasicAuth(s,a),c="none",d,h,x;if(l)c="basic",d=l.username;else if(o){c="oauth";let w=o.expires_at,N=Date.now()/1e3;h=w>N?"valid":"expired",x=new Date(w*1e3).toISOString().slice(0,10)}else h="missing";let{WhoamiView:S}=await import("./WhoamiView-2VBZBQF7.js"),{render:p}=await import("./build-MFETN2BY.js"),b=await import("./react-QWOAB3TB.js"),{waitUntilExit:g}=p(b.default.createElement(S,{profile:s,env:a,authenticated:c!=="none",authMethod:c,username:d,tokenStatus:h,expiresAt:x}));await g()}),e.command("config <action> [value]").action(async(r,n)=>{let s=new et,a=new Ee;if(r==="show"){let o=s.load(),l=a.getActiveProfile()??"default",c=a.getDefaultEnv(),d=a.loadBasicAuth(l,c),h=a.loadCredentials(l,c),x=d?`basic (${d.username})`:h?"oauth":"not configured",{ConfigView:S}=await import("./ConfigView-5R4G4OZ6.js"),{render:p}=await import("./build-MFETN2BY.js"),b=await import("./react-QWOAB3TB.js"),{waitUntilExit:g}=p(b.default.createElement(S,{model:o.model,authLabel:x,profile:l,env:c,defaultUrl:o.default_url,projectId:o.project_id,projectName:o.project_name,folderId:o.folder_id,windowSize:`${o.window_size.width}x${o.window_size.height}`,chromeProfile:o.chrome_profile_path,setupComplete:o.setup_complete}));await g()}else if(r==="set-url"&&n)s.set("default_url",n),console.log(`Default URL set to ${n}`);else if(r==="set-window"&&n){let o=n.split("x").map(Number);o[0]&&o[1]&&(s.set("window_size",{width:o[0],height:o[1]}),console.log(`Window size set to ${o[0]}x${o[1]}`))}else if(r==="chrome-profile"){let{ChromeProfilePicker:o}=await import("./ChromeProfilePicker-IRZUDC2R.js"),{render:l}=await import("./build-MFETN2BY.js"),c=await import("./react-QWOAB3TB.js");await new Promise(d=>{let{unmount:h}=l(c.default.createElement(o,{currentPath:s.load().chrome_profile_path,onSelect:x=>{s.set("chrome_profile_path",x),console.log(`Chrome profile set to ${x}`),h(),d()},onCancel:()=>{h(),d()}}))})}else if(r==="project"){let o=a.getDefaultEnv(),l=ce(o),c=a.loadBasicAuth(a.getActiveProfile()??"default",o);if(!c){console.log("Login first to browse projects");return}let{ProjectPicker:d}=await import("./ProjectPicker-AFQDF2VS.js"),{AuthResolver:h}=await import("./resolver-L3Z6FAOD.js"),{render:x}=await import("./build-MFETN2BY.js"),S=await import("./react-QWOAB3TB.js"),p=new h(l.controllerBaseUrl,async()=>null,c);await p.resolve(),await new Promise(b=>{let{unmount:g}=x(S.default.createElement(d,{resolver:p,currentProjectId:s.load().project_id,env:o,onSelect:(w,N)=>{s.set("project_id",w),s.set("project_name",N),console.log(`Project set to ${N} (${w})`),g(),b()},onCancel:()=>{g(),b()}}))})}else if(r==="folder"){let o=s.load();if(!o.project_id){console.log("Select a project first: kane-cli config project");return}let l=a.getDefaultEnv(),c=ce(l),d=a.loadBasicAuth(a.getActiveProfile()??"default",l);if(!d){console.log("Login first to browse folders");return}let{FolderPicker:h}=await import("./FolderPicker-G4C4RCP2.js"),{AuthResolver:x}=await import("./resolver-L3Z6FAOD.js"),{render:S}=await import("./build-MFETN2BY.js"),p=await import("./react-QWOAB3TB.js"),b=new x(c.controllerBaseUrl,async()=>null,d);await b.resolve(),await new Promise(g=>{let{unmount:w}=S(p.default.createElement(h,{resolver:b,projectId:o.project_id,currentFolderId:o.folder_id,env:l,onSelect:(N,W)=>{s.set("folder_id",N),s.set("folder_name",W),console.log(`Folder set to ${W} (${N})`),w(),g()},onCancel:()=>{w(),g()}}))})}else console.log("Usage: kane-cli config show|set-url|set-window|chrome-profile|project|folder")}),e.command("run").argument("<objective>","Test objective (use {{var}} to reference variables)").option("--url <url>","Target URL").option("--headless","Run Chrome in headless mode").option("--max-steps <n>","Maximum agent steps","30").option("--timeout <seconds>","Kill run after N seconds").option("--cdp-endpoint <url>","Connect to existing Chrome CDP endpoint").option("--ws-endpoint <url>","Connect via Playwright WebSocket (e.g. LambdaTest wss:// URL)").option("--global-context <file>",`Override global context markdown (default: ${Qe(_e,"global-memory.md")})`).option("--local-context <file>","Override local context markdown (default: .testmuai/context.md in cwd)").addOption(new Hn("--model <name>","Model override").hideHelp()).option("--variables <json>",`Inline variables JSON, e.g. '{"user": {"value": "alice"}}'`).option("--variables-file <path>","Load variables from a JSON file").option("--session-context <json>","Session context JSON (prior runs)").addOption(new Hn("--cft","Use Playwright Chromium instead of managed Chrome").hideHelp()).option("--username <user>","Basic auth username (skip OAuth)").option("--access-key <key>","Basic auth access key (skip OAuth)").option("--env <name>","Environment (prod or stage)").option("--agent","Agent mode: plain NDJSON output, no colors/UI").option("--task-skills","Enable domain-specific task skills (experimental)").addOption(new Hn("--local","Skip TMS integration (no uploads, no variables/secrets push)").hideHelp()).option("--code-export","Generate code export after upload").addHelpText("after",`
46
46
  Variables:
47
47
  Variables are loaded in order (later wins):
48
48
  1. Global: ${Qe(_e,"variables")}/*.json
@@ -67,10 +67,10 @@ Context Files:
67
67
  `).action(async(r,n)=>{let s=new Ee,o=new et().load();!o.setup_complete&&!(n.username&&n.accessKey)&&(console.error("First-time setup required. Run: kane-cli setup --auth-method <oauth|basic>"),process.exit(1));let l=`${s.getActiveProfile()??"no profile"}/${s.getDefaultEnv()}`,c=[],d=n.env??s.getDefaultEnv(),h,x=!1,S=n.username,p=n.accessKey;if(n.username&&n.accessKey)x=!0,c.push(`Using basic auth (${n.username})`);else{let E=s.resolveAuth();E?.method==="basic"&&(x=!0,S=E.username,p=E.access_key,c.push(`Using basic auth from config (${E.username})`))}if(!x){let{credentials:E,profile:ie}=s.getActiveCredentials();if(E||(console.error("Not authenticated. Run: kane-cli login"),process.exit(2)),h=E.access_token,E.expires_at-Date.now()/1e3<300){let ne=s.loadClient(ie,d);if(ne)try{let me=await new Ge(d).refreshToken(E.refresh_token,ne.client_id);h=me.access_token,s.saveCredentials(ie,d,{access_token:h,refresh_token:me.refresh_token,expires_at:Math.floor(Date.now()/1e3)+me.expires_in,scope:me.scope})}catch{console.error("Token refresh failed. Run: kane-cli login"),process.exit(2)}}}let b=async()=>h??null,g=x&&S&&p?{username:S,access_key:p}:null,w=null,N=[],W=E=>{w?w(E):N.push(E)},Q=new cn(ce(d).controllerBaseUrl,b,g,W),te=await Q.resolve();te&&(x||(x=!0,S=te.username,p=te.access_key,c.push(`Resolved basic auth (${te.username})`)));let L=n.url??o.default_url,M=Qe(_e,"variables"),A=Qe(process.cwd(),".testmuai","variables"),X=Ln(M,A,E=>console.error(E)),f=n.variablesFile?ro(n.variablesFile):{},k=n.variables?so(n.variables):{},y={...X,...f,...k},C;if(n.sessionContext)try{C=JSON.parse(n.sessionContext)}catch{console.error("Invalid --session-context JSON"),process.exit(2)}let P=n.globalContext??Qe(_e,"global-memory.md"),j=n.localContext??Qe(process.cwd(),".testmuai","context.md"),F=Zt(P),Z=Zt(j),Y,ue=null,oe=null;if(n.cft)c.push("CfT mode: Playwright will manage its own browser");else if(n.wsEndpoint)Y=n.wsEndpoint,c.push(`Playwright WS endpoint (${Y.slice(0,60)}...)`);else if(n.cdpEndpoint){try{let E=await fetch(`${n.cdpEndpoint}/json/version`);if(!E.ok)throw new Error(`CDP returned ${E.status}`)}catch{console.error(`CDP endpoint not reachable: ${n.cdpEndpoint}`),process.exit(2)}Y=n.cdpEndpoint,c.push(`CDP connected (${Y})`)}else{let E;if(o.chrome_profile_path)E=o.chrome_profile_path.replace("~",process.env.HOME??"~");else{let{mkdtempSync:ie}=await import("fs"),{tmpdir:J}=await import("os");oe=ie(Qe(J(),"kane-clean-")),E=oe}c.push("Starting Chrome...");try{ue=await Bn({userDataDir:E,width:o.window_size.width,height:o.window_size.height,headless:n.headless,startUrl:L})}catch(ie){console.error(`Chrome failed: ${ie instanceof Error?ie.message:ie}`),process.exit(2)}Y=ue.cdpEndpoint,c.push(`Chrome ready (${Y})`)}let Te=Object.keys(y).length>0,{variables:de,objective:zt,keyMap:sn}=Te?Mn(y,r):{variables:{},objective:r,keyMap:{}},Vt=te?String(te.org_id):"",St=Object.entries(y).filter(([,E])=>E.secret);if(!n.local&&St.length>0&&x&&S&&p){let E=ce(d),ie=new en(E.secretsBaseUrl);for(let[J,ne]of St)ie.pushSecret({secretKey:J,secretValue:ne.value,username:S,accessKey:p,orgId:Vt}).then(()=>console.error(`Secret pushed: ${J}`)).catch(ye=>console.error(`Secret push failed (${J}): ${ye}`))}let fe={},nt=Object.entries(y).filter(([,E])=>!E.secret);if(!n.local&&nt.length>0&&x&&S&&p){let E=ce(d),ie=new tn(E.tmsBaseUrl,S,p);for(let[J,ne]of nt)try{let ye=await ie.upsertVariable({name:J,value:ne.value});fe[J]=ye.id,console.error(`Variable pushed: ${J} (id=${ye.id})`)}catch(ye){console.error(`Variable push failed (${J}): ${ye}`)}}let q=new Qt;q.start({model:n.model??o.model,environment:d,profile:s.getActiveProfile()}),w=E=>q.log(E);for(let E of N)q.log(E);N.length=0;let $={objective:zt,...L?{url:L}:{},model:n.model??o.model,...n.wsEndpoint?{ws_endpoint:Y}:Y?{cdp_endpoint:Y}:{},width:o.window_size.width,height:o.window_size.height,session_id:q.sessionId,run_index:0,stream:!0,...x&&S&&p?{username:S,access_key:p}:h?{auth:{type:"bearer",token:h}}:{},headless:n.headless??!1,max_steps:parseInt(n.maxSteps,10),disable_ask_user:!process.stdin.isTTY,variables:Object.keys(de).length>0?de:void 0,global_context:F??void 0,local_context:Z??void 0,enable_task_skills:n.taskSkills??!1,session_context:C},Be=null;if(!n.local)try{let{ControllerClient:E}=await import("./controller-client-PS5GDXE3.js"),ie;if(x&&S&&p)ie={username:S,accessKey:p};else if(h)ie=h;else throw new Error("No auth available");let ne=await new E(ce(d).controllerBaseUrl,ie).getScreenshotSas();q.setScreenshotSas(ne),Be=new nn(ne,3),q.log(`SCREENSHOT_SAS fetched OK base_url=${ne.base_url} container=${ne.container} expiry=${ne.expiry}`)}catch(E){q.log(`SCREENSHOT_SAS failed: ${E instanceof Error?E.message:String(E)}`)}let bn=Be?(E,ie)=>{try{let J=ie,ne=Qe(q.sessionDir,"runs",String(J),"run-test");if(!vn(ne)){q.log(`SCREENSHOT_UPLOAD skip step=${E} reason=runsDir_not_found path=${ne}`);return}let ye=ne;if(vn(Qe(ne,"screenshots")))ye=ne;else{let ge=Ra(ne).filter(pe=>vn(Qe(ne,pe,"screenshots")));if(ge.length===0){q.log(`SCREENSHOT_UPLOAD skip step=${E} reason=no_screenshots_dir`);return}ye=Qe(ne,ge[0])}let me=Qe(ye,"screenshots",`step_${String(E).padStart(3,"0")}.png`),ze=Qe(ye,"actions.ndjson");if(!vn(me)){q.log(`SCREENSHOT_UPLOAD skip step=${E} reason=screenshot_not_found path=${me}`);return}if(!vn(ze)){q.log(`SCREENSHOT_UPLOAD skip step=${E} reason=ndjson_not_found path=${ze}`);return}let re=ko(ze,"utf-8").trim().split(`
68
68
  `),le=re[re.length-1];if(!le){q.log(`SCREENSHOT_UPLOAD skip step=${E} reason=ndjson_empty`);return}let je=JSON.parse(le);if(je.action_id){let ge=ko(me);Be.enqueue(je.action_id,ge),q.log(`SCREENSHOT_UPLOAD enqueued step=${E} action_id=${je.action_id} size=${ge.length}`)}else q.log(`SCREENSHOT_UPLOAD skip step=${E} reason=no_action_id`)}catch(J){q.log(`SCREENSHOT_UPLOAD error step=${E}: ${J instanceof Error?J.message:String(J)}`)}}:void 0;if(n.agent){let E=le=>{process.stdout.write(JSON.stringify(le)+`
69
69
  `)},ie=await Eo($,{environment:d},{onStepEnd:bn}),{lastRunEnd:J,stepsTotal:ne,hadError:ye,bifurcationFlows:me}=ie;if(J){let le=J.total_runs??1,je=J.run_dir,ge,pe;if(le>1&&je){let{dirname:ut,join:kt}=await import("path"),Rt=ut(je);ge=Array.from({length:le},(At,rt)=>kt(Rt,String(rt))),me&&me.length===le&&(pe=me)}q.addRunResult({index:0,objective:r,summary:J.summary,status:J.status,context:J.context??{memory:{},variables:{},pointer:""},run_dir:je,run_dirs:ge,flow_objectives:pe},J.total_runs)}if(ue&&ue.kill(),oe)try{let{rmSync:le}=await import("fs");le(oe,{recursive:!0,force:!0})}catch{}let ze;if(q.log(`DIRECT_UPLOAD agent_mode=true lastRunEnd=${!!J} opts.local=${!!n.local}`),J&&!n.local)try{let le=ce(d),je=te??await Q.resolve(),ge=je?.username||S,pe=je?.access_key||p;q.log(`DIRECT_UPLOAD tmsUsername=${ge} tmsAccessKey=${!!pe} resolvedCreds=${!!te} basicUsername=${!!S}`);let ut=ge&&pe?{username:ge,accessKey:pe}:h??"";if(ge&&pe){let{TmsClient:kt}=await import("./tms-client-QWVBCUUT.js"),{UploadPipeline:Rt}=await import("./pipeline-7NY333ZT.js"),At=new kt(le.tmsBaseUrl,ge,pe),rt=o.project_id,mt=o.folder_id,Mt=n.url??o.default_url,Oe=null;if(rt)try{Oe=await At.createAtmTest({objective:r.slice(0,100),creation_mode:"KANECLI",playground_disabled:!!o.chrome_profile_path,testURL:Mt??o.default_url??"",project_id:rt,folder_id:mt??"",authoring_version:4})}catch{}let be=q.generateCommitId(),st=x&&S?S:ge,pt=x&&p?p:pe;Be&&await Be.drain();let ot=await new Rt({controllerBaseUrl:le.controllerBaseUrl,tmsBaseUrl:le.tmsBaseUrl,auth:ut,authResolver:Q,sessionId:q.sessionId,sessionDir:q.sessionDir,testId:Oe,commitId:be,projectId:rt,folderId:mt,firstObjective:zt,firstUrl:n.url??o.default_url??"",runDirs:q.getRunDirs(),runObjectives:q.getRunObjectives(),startedAt:q.startedAt,endedAt:new Date().toISOString(),totalSteps:ne,totalDuration:J.duration??0,runStatuses:[J.status],orgId:je?.org_id??0,userId:je?.user_id??0,tmsUsername:st,tmsAccessKey:pt,screenshotBaseUrl:q.screenshotBaseUrl,shareApiBaseUrl:le.shareApiBaseUrl,variables:nt.length>0?Object.fromEntries(nt.map(([ht,_])=>[ht,_])):void 0,variableIds:fe,secrets:St.map(([ht])=>({key_name:ht,scope:"user"})),codeExport:!!n.codeExport,onProgress:()=>{},log:ht=>q.log(ht)}).execute();ot.success&&(ot.testcaseId&&q.setTestcaseId(ot.testcaseId),ot.testcaseId&&ot.shareId&&rt&&(ze=`${le.testManagerUiUrl}/projects/${rt}/test-cases/${ot.testcaseId}/dashboard/share/${ot.shareId}`))}}catch(le){q.log(`DIRECT_UPLOAD agent error: ${le instanceof Error?le.message:String(le)}`)}if(J){let le={...J};ze&&(le.test_url=ze),E(le)}q.finish("complete"),J||process.exit(ye?2:1);let re=J.reason??"";(re.includes("Cancel")||re.includes("Timeout"))&&process.exit(3),J.status==="passed"&&process.exit(0),process.exit(1)}let B=null,K=0,Ct=!1,Gt=null,Et={current:null},{waitUntilExit:ve}=yn(Ro.default.createElement(ao,{config:$,spawnOpts:{environment:d},cancelRef:Et,banner:{model:n.model??o.model,auth:l,status:c},onComplete:E=>{B=E.lastRunEnd,K=E.stepsTotal,Ct=E.hadError,Gt=E.bifurcationFlows},onStepEnd:bn}),{stdout:process.stderr,exitOnCtrlC:!1}),at;if(n.timeout){let E=parseInt(n.timeout,10)*1e3;at=setTimeout(()=>{console.error(`
70
- Timeout: ${n.timeout}s exceeded \u2014 cancelling...`),Et.current?.()},E)}if(await ve(),at&&clearTimeout(at),B){let E=B.total_runs??1,ie=B.run_dir,J,ne;if(E>1&&ie){let{dirname:ye,join:me}=await import("path"),ze=ye(ie);J=Array.from({length:E},(re,le)=>me(ze,String(le))),Gt&&Gt.length===E&&(ne=Gt)}q.addRunResult({index:0,objective:r,summary:B.summary,status:B.status,context:B.context??{memory:{},variables:{},pointer:""},run_dir:ie,run_dirs:J,flow_objectives:ne},B.total_runs)}if(ue&&ue.kill(),oe)try{let{rmSync:E}=await import("fs");E(oe,{recursive:!0,force:!0})}catch{}if(q.log(`DIRECT_UPLOAD ink_mode=true lastEvent=${!!B} opts.local=${!!n.local}`),B&&!n.local)try{let E=ce(d),ie=te??await Q.resolve(),J=ie?.username||S,ne=ie?.access_key||p,ye=ie?.org_id??0,me=ie?.user_id??0;q.log(`DIRECT_UPLOAD tmsUsername=${J} tmsAccessKey=${!!ne} resolvedCreds=${!!te} basicUsername=${!!S} projectId=${o.project_id}`);let ze=J&&ne?{username:J,accessKey:ne}:h??"";if(J&&ne){let{TmsClient:re}=await import("./tms-client-QWVBCUUT.js"),{UploadPipeline:le}=await import("./pipeline-7NY333ZT.js"),je=new re(E.tmsBaseUrl,J,ne),ge=null,pe=o.project_id,ut=o.folder_id,kt=n.url??o.default_url;if(pe)try{ge=await je.createAtmTest({objective:r.slice(0,100),creation_mode:"KANECLI",playground_disabled:!!o.chrome_profile_path,testURL:kt??o.default_url??"",project_id:pe,folder_id:ut,authoring_version:4})}catch(be){console.error(`Test creation failed: ${be}`)}let Rt=q.generateCommitId(),At=x&&S?S:J,rt=x&&p?p:ne;Be&&(q.log("SCREENSHOT_UPLOAD draining queue before pipeline"),await Be.drain(),q.log("SCREENSHOT_UPLOAD queue drained"));let mt=new le({controllerBaseUrl:E.controllerBaseUrl,tmsBaseUrl:E.tmsBaseUrl,auth:ze,authResolver:Q,sessionId:q.sessionId,sessionDir:q.sessionDir,testId:ge,commitId:Rt,projectId:pe,folderId:ut,firstObjective:zt,firstUrl:n.url??o.default_url??"",runDirs:q.getRunDirs(),runObjectives:q.getRunObjectives(),startedAt:new Date().toISOString(),endedAt:new Date().toISOString(),totalSteps:K,totalDuration:B.duration??0,runStatuses:[B.status],orgId:ye,userId:me,tmsUsername:At,tmsAccessKey:rt,screenshotBaseUrl:q.screenshotBaseUrl,shareApiBaseUrl:E.shareApiBaseUrl,variables:nt.length>0?Object.fromEntries(nt.map(([be,st])=>[be,st])):void 0,variableIds:fe,secrets:St.map(([be])=>({key_name:be,scope:"user"})),codeExport:!!n.codeExport,onProgress:()=>{},log:be=>q.log(be)}),{renderUploadProgress:Mt}=await import("./CliUploadProgress-7KUXH55I.js"),Oe=await Mt(mt,be=>{if(be.testcaseId&&be.shareId&&pe)return`${E.testManagerUiUrl}/projects/${pe}/test-cases/${be.testcaseId}/dashboard/share/${be.shareId}`});if(Oe.success){Oe.testcaseId&&q.setTestcaseId(Oe.testcaseId);let be=Oe.testcaseId&&Oe.shareId&&pe?`${E.testManagerUiUrl}/projects/${pe}/test-cases/${Oe.testcaseId}/dashboard/share/${Oe.shareId}`:void 0,st=Oe.testcaseId&&pe?`${E.testManagerUiUrl}/projects/${pe}/test-cases/${Oe.testcaseId}/dashboard?type=summary&agentView=true&fqdn=summary-page`:void 0;if(be||st||Oe.codeExportDir){let{LinksBox:pt}=await import("./LinksBox-JQ2MF2QZ.js"),{render:_n}=await import("./build-MFETN2BY.js"),ot=await import("./react-QWOAB3TB.js"),{waitUntilExit:ht}=_n(ot.default.createElement(pt,{shareableLink:be,testCaseLink:st,codeExportDir:Oe.codeExportDir}),{stdout:process.stderr});await ht()}}if(ge){let{renderFeedbackPrompt:be}=await import("./CliFeedbackPrompt-5CNRJ2AC.js"),st=await be();if(st)try{let{TmsClient:pt}=await import("./tms-client-QWVBCUUT.js");await new pt(E.tmsBaseUrl,At,rt).submitFeedback({instruction_id:"",test_id:ge,feedback_type:st,mode:"human"}),q.log(`FEEDBACK submitted type=${st}`)}catch(pt){q.log(`FEEDBACK failed: ${pt}`)}}}}catch(E){q.log(`DIRECT_UPLOAD ink error: ${E instanceof Error?E.stack??E.message:String(E)}`),console.error(`Upload failed: ${E}`)}q.finish("complete"),B||process.exit(Ct?2:1);let Lt=B.reason??"";(Lt.includes("Cancel")||Lt.includes("Timeout"))&&process.exit(3),B.status==="passed"&&process.exit(0),process.exit(1)}),e.command("profiles").action(async()=>{let r=new Ee,{ProfilesView:n}=await import("./ProfilesView-WHPQWB42.js"),{render:s}=await import("./build-MFETN2BY.js"),a=await import("./react-QWOAB3TB.js");await new Promise(o=>{let{unmount:l}=s(a.default.createElement(n,{creds:r,onSwitch:(c,d)=>{r.setActiveProfile(c),r.setDefaultEnv(d),console.log(`Switched to ${c} [${d}]`)},onCancel:()=>{l(),o()}}))})}),e.command("setup").option("--auth-method <method>","Auth method: oauth or basic").option("--username <user>","Basic auth username").option("--access-key <key>","Basic auth access key").option("--model <name>","Model","v16-alpha").option("--chrome-profile <path>","Chrome profile path").option("--project-id <id>","Project ID for testing mode").option("--default-url <url>","Default URL").option("--env <name>","Environment (prod or stage)").action(async r=>{let n=new et,s=new Ee;r.env&&(s.setDefaultEnv(r.env),console.log(`Environment set to ${r.env}`)),(!r.authMethod||!["oauth","basic"].includes(r.authMethod))&&(console.error("--auth-method is required: oauth or basic"),process.exit(1)),r.authMethod==="basic"&&(!r.username||!r.accessKey)&&(console.error("--username and --access-key are required for basic auth"),process.exit(1)),n.set("model",r.model);let a="default";s.setActiveProfile(a);let o=s.getDefaultEnv();if(r.authMethod==="basic"?(s.saveBasicAuth(a,o,{username:r.username,access_key:r.accessKey}),console.log(`Basic auth saved for ${a}/${o}`)):(await new bt(a,o,s).login(),console.log(`OAuth login complete for ${a}/${o}`)),r.chromeProfile&&n.set("chrome_profile_path",r.chromeProfile),r.projectId)n.set("project_id",r.projectId);else try{let l=s.resolveAuth();if(l){let c=s.getDefaultEnv(),d=ce(c),h,x;if(l.method==="basic")h=l.username,x=l.access_key;else{let w=new Ge(c),N=s.getActiveCredentials(),W=s.loadClient(N.profile,N.env),Q=await w.refreshToken(N.credentials.refresh_token,W.client_id),{ControllerClient:te}=await import("./controller-client-PS5GDXE3.js"),M=await new te(d.controllerBaseUrl,Q.access_token).getTmsCredentials();h=M.username,x=M.access_key}let{TmsClient:S}=await import("./tms-client-QWVBCUUT.js"),g=(await new S(d.tmsBaseUrl,h,x).listProjects()).find(w=>w.name.toLowerCase().includes("kaneai"));g&&(n.set("project_id",g.project_id),console.log(`Auto-selected project: ${g.name} (${g.project_id})`))}}catch(l){console.warn(`Could not auto-select project: ${l instanceof Error?l.message:l}`)}r.defaultUrl?n.set("default_url",r.defaultUrl):n.set("default_url","https://kaneai-playground.lambdatest.io"),n.set("setup_complete",!0),console.log("Setup complete.")}),e.command("feedback").requiredOption("--test-id <id>","Test ID").requiredOption("--feedback-type <type>","Feedback type: positive or negative").option("--details <text>","Feedback details (max 500 characters)").option("--username <user>","Basic auth username").option("--access-key <key>","Basic auth access key").option("--env <name>","Environment (prod or stage)").action(async r=>{r.feedbackType!=="positive"&&r.feedbackType!=="negative"&&(console.error('Error: --feedback-type must be "positive" or "negative"'),process.exit(1)),r.details&&r.details.length>500&&(console.error("Error: --details must be 500 characters or fewer"),process.exit(1));let n=new Ee,s=r.env??n.getDefaultEnv(),a=ce(s),o=!1,l=r.username,c=r.accessKey,d;if(r.username&&r.accessKey)o=!0;else{let w=n.resolveAuth();w?.method==="basic"&&(o=!0,l=w.username,c=w.access_key)}if(!o){let{credentials:w}=n.getActiveCredentials();w||(console.error("Not authenticated. Run: kane-cli login"),process.exit(2)),d=w.access_token}let h=async()=>d??null,x=o&&l&&c?{username:l,access_key:c}:null,p=await new cn(a.controllerBaseUrl,h,x).resolve(),b=p?.username??l,g=p?.access_key??c;(!b||!g)&&(console.error(JSON.stringify({error:"Could not resolve TMS credentials"})),process.exit(1));try{let{TmsClient:w}=await import("./tms-client-QWVBCUUT.js"),W=await new w(a.tmsBaseUrl,b,g).submitFeedback({instruction_id:"",test_id:r.testId,feedback_type:r.feedbackType,details:r.details,mode:"agent"});console.log(JSON.stringify(W)),process.exit(0)}catch(w){console.error(JSON.stringify({error:w instanceof Error?w.message:String(w)})),process.exit(1)}}),e.command("help").action(()=>{e.help()}),e.command("update").description("Update kane-cli to the latest version").action(async()=>{let{checkForUpdate:r}=await import("./version-check-54A7DQDT.js"),{runSelfUpdate:n}=await import("./updater-5VMYLGW3.js");console.log("Checking for updates...");let s=await r();if(!s){console.log(`Already on latest version (${Pt})`);return}console.log(`Update available: ${s.current} \u2192 ${s.latest}
70
+ Timeout: ${n.timeout}s exceeded \u2014 cancelling...`),Et.current?.()},E)}if(await ve(),at&&clearTimeout(at),B){let E=B.total_runs??1,ie=B.run_dir,J,ne;if(E>1&&ie){let{dirname:ye,join:me}=await import("path"),ze=ye(ie);J=Array.from({length:E},(re,le)=>me(ze,String(le))),Gt&&Gt.length===E&&(ne=Gt)}q.addRunResult({index:0,objective:r,summary:B.summary,status:B.status,context:B.context??{memory:{},variables:{},pointer:""},run_dir:ie,run_dirs:J,flow_objectives:ne},B.total_runs)}if(ue&&ue.kill(),oe)try{let{rmSync:E}=await import("fs");E(oe,{recursive:!0,force:!0})}catch{}if(q.log(`DIRECT_UPLOAD ink_mode=true lastEvent=${!!B} opts.local=${!!n.local}`),B&&!n.local)try{let E=ce(d),ie=te??await Q.resolve(),J=ie?.username||S,ne=ie?.access_key||p,ye=ie?.org_id??0,me=ie?.user_id??0;q.log(`DIRECT_UPLOAD tmsUsername=${J} tmsAccessKey=${!!ne} resolvedCreds=${!!te} basicUsername=${!!S} projectId=${o.project_id}`);let ze=J&&ne?{username:J,accessKey:ne}:h??"";if(J&&ne){let{TmsClient:re}=await import("./tms-client-QWVBCUUT.js"),{UploadPipeline:le}=await import("./pipeline-7NY333ZT.js"),je=new re(E.tmsBaseUrl,J,ne),ge=null,pe=o.project_id,ut=o.folder_id,kt=n.url??o.default_url;if(pe)try{ge=await je.createAtmTest({objective:r.slice(0,100),creation_mode:"KANECLI",playground_disabled:!!o.chrome_profile_path,testURL:kt??o.default_url??"",project_id:pe,folder_id:ut,authoring_version:4})}catch(be){console.error(`Test creation failed: ${be}`)}let Rt=q.generateCommitId(),At=x&&S?S:J,rt=x&&p?p:ne;Be&&(q.log("SCREENSHOT_UPLOAD draining queue before pipeline"),await Be.drain(),q.log("SCREENSHOT_UPLOAD queue drained"));let mt=new le({controllerBaseUrl:E.controllerBaseUrl,tmsBaseUrl:E.tmsBaseUrl,auth:ze,authResolver:Q,sessionId:q.sessionId,sessionDir:q.sessionDir,testId:ge,commitId:Rt,projectId:pe,folderId:ut,firstObjective:zt,firstUrl:n.url??o.default_url??"",runDirs:q.getRunDirs(),runObjectives:q.getRunObjectives(),startedAt:new Date().toISOString(),endedAt:new Date().toISOString(),totalSteps:K,totalDuration:B.duration??0,runStatuses:[B.status],orgId:ye,userId:me,tmsUsername:At,tmsAccessKey:rt,screenshotBaseUrl:q.screenshotBaseUrl,shareApiBaseUrl:E.shareApiBaseUrl,variables:nt.length>0?Object.fromEntries(nt.map(([be,st])=>[be,st])):void 0,variableIds:fe,secrets:St.map(([be])=>({key_name:be,scope:"user"})),codeExport:!!n.codeExport,onProgress:()=>{},log:be=>q.log(be)}),{renderUploadProgress:Mt}=await import("./CliUploadProgress-QF57Z3FD.js"),Oe=await Mt(mt,be=>{if(be.testcaseId&&be.shareId&&pe)return`${E.testManagerUiUrl}/projects/${pe}/test-cases/${be.testcaseId}/dashboard/share/${be.shareId}`});if(Oe.success){Oe.testcaseId&&q.setTestcaseId(Oe.testcaseId);let be=Oe.testcaseId&&Oe.shareId&&pe?`${E.testManagerUiUrl}/projects/${pe}/test-cases/${Oe.testcaseId}/dashboard/share/${Oe.shareId}`:void 0,st=Oe.testcaseId&&pe?`${E.testManagerUiUrl}/projects/${pe}/test-cases/${Oe.testcaseId}/dashboard?type=summary&agentView=true&fqdn=summary-page`:void 0;if(be||st||Oe.codeExportDir){let{LinksBox:pt}=await import("./LinksBox-623NMFSA.js"),{render:_n}=await import("./build-MFETN2BY.js"),ot=await import("./react-QWOAB3TB.js"),{waitUntilExit:ht}=_n(ot.default.createElement(pt,{shareableLink:be,testCaseLink:st,codeExportDir:Oe.codeExportDir}),{stdout:process.stderr});await ht()}}if(ge){let{renderFeedbackPrompt:be}=await import("./CliFeedbackPrompt-RIIDDIY5.js"),st=await be();if(st)try{let{TmsClient:pt}=await import("./tms-client-QWVBCUUT.js");await new pt(E.tmsBaseUrl,At,rt).submitFeedback({instruction_id:"",test_id:ge,feedback_type:st,mode:"human"}),q.log(`FEEDBACK submitted type=${st}`)}catch(pt){q.log(`FEEDBACK failed: ${pt}`)}}}}catch(E){q.log(`DIRECT_UPLOAD ink error: ${E instanceof Error?E.stack??E.message:String(E)}`),console.error(`Upload failed: ${E}`)}q.finish("complete"),B||process.exit(Ct?2:1);let Lt=B.reason??"";(Lt.includes("Cancel")||Lt.includes("Timeout"))&&process.exit(3),B.status==="passed"&&process.exit(0),process.exit(1)}),e.command("profiles").action(async()=>{let r=new Ee,{ProfilesView:n}=await import("./ProfilesView-DBNO4RSU.js"),{render:s}=await import("./build-MFETN2BY.js"),a=await import("./react-QWOAB3TB.js");await new Promise(o=>{let{unmount:l}=s(a.default.createElement(n,{creds:r,onSwitch:(c,d)=>{r.setActiveProfile(c),r.setDefaultEnv(d),console.log(`Switched to ${c} [${d}]`)},onCancel:()=>{l(),o()}}))})}),e.command("setup").option("--auth-method <method>","Auth method: oauth or basic").option("--username <user>","Basic auth username").option("--access-key <key>","Basic auth access key").option("--model <name>","Model","v16-alpha").option("--chrome-profile <path>","Chrome profile path").option("--project-id <id>","Project ID for testing mode").option("--default-url <url>","Default URL").option("--env <name>","Environment (prod or stage)").action(async r=>{let n=new et,s=new Ee;r.env&&(s.setDefaultEnv(r.env),console.log(`Environment set to ${r.env}`)),(!r.authMethod||!["oauth","basic"].includes(r.authMethod))&&(console.error("--auth-method is required: oauth or basic"),process.exit(1)),r.authMethod==="basic"&&(!r.username||!r.accessKey)&&(console.error("--username and --access-key are required for basic auth"),process.exit(1)),n.set("model",r.model);let a="default";s.setActiveProfile(a);let o=s.getDefaultEnv();if(r.authMethod==="basic"?(s.saveBasicAuth(a,o,{username:r.username,access_key:r.accessKey}),console.log(`Basic auth saved for ${a}/${o}`)):(await new bt(a,o,s).login(),console.log(`OAuth login complete for ${a}/${o}`)),r.chromeProfile&&n.set("chrome_profile_path",r.chromeProfile),r.projectId)n.set("project_id",r.projectId);else try{let l=s.resolveAuth();if(l){let c=s.getDefaultEnv(),d=ce(c),h,x;if(l.method==="basic")h=l.username,x=l.access_key;else{let w=new Ge(c),N=s.getActiveCredentials(),W=s.loadClient(N.profile,N.env),Q=await w.refreshToken(N.credentials.refresh_token,W.client_id),{ControllerClient:te}=await import("./controller-client-PS5GDXE3.js"),M=await new te(d.controllerBaseUrl,Q.access_token).getTmsCredentials();h=M.username,x=M.access_key}let{TmsClient:S}=await import("./tms-client-QWVBCUUT.js"),g=(await new S(d.tmsBaseUrl,h,x).listProjects()).find(w=>w.name.toLowerCase().includes("kaneai"));g&&(n.set("project_id",g.project_id),console.log(`Auto-selected project: ${g.name} (${g.project_id})`))}}catch(l){console.warn(`Could not auto-select project: ${l instanceof Error?l.message:l}`)}r.defaultUrl?n.set("default_url",r.defaultUrl):n.set("default_url","https://kaneai-playground.lambdatest.io"),n.set("setup_complete",!0),console.log("Setup complete.")}),e.command("feedback").requiredOption("--test-id <id>","Test ID").requiredOption("--feedback-type <type>","Feedback type: positive or negative").option("--details <text>","Feedback details (max 500 characters)").option("--username <user>","Basic auth username").option("--access-key <key>","Basic auth access key").option("--env <name>","Environment (prod or stage)").action(async r=>{r.feedbackType!=="positive"&&r.feedbackType!=="negative"&&(console.error('Error: --feedback-type must be "positive" or "negative"'),process.exit(1)),r.details&&r.details.length>500&&(console.error("Error: --details must be 500 characters or fewer"),process.exit(1));let n=new Ee,s=r.env??n.getDefaultEnv(),a=ce(s),o=!1,l=r.username,c=r.accessKey,d;if(r.username&&r.accessKey)o=!0;else{let w=n.resolveAuth();w?.method==="basic"&&(o=!0,l=w.username,c=w.access_key)}if(!o){let{credentials:w}=n.getActiveCredentials();w||(console.error("Not authenticated. Run: kane-cli login"),process.exit(2)),d=w.access_token}let h=async()=>d??null,x=o&&l&&c?{username:l,access_key:c}:null,p=await new cn(a.controllerBaseUrl,h,x).resolve(),b=p?.username??l,g=p?.access_key??c;(!b||!g)&&(console.error(JSON.stringify({error:"Could not resolve TMS credentials"})),process.exit(1));try{let{TmsClient:w}=await import("./tms-client-QWVBCUUT.js"),W=await new w(a.tmsBaseUrl,b,g).submitFeedback({instruction_id:"",test_id:r.testId,feedback_type:r.feedbackType,details:r.details,mode:"agent"});console.log(JSON.stringify(W)),process.exit(0)}catch(w){console.error(JSON.stringify({error:w instanceof Error?w.message:String(w)})),process.exit(1)}}),e.command("help").action(()=>{e.help()}),e.command("update").description("Update kane-cli to the latest version").action(async()=>{let{checkForUpdate:r}=await import("./version-check-KS7CP3M5.js"),{runSelfUpdate:n}=await import("./updater-H5HYMYRG.js");console.log("Checking for updates...");let s=await r();if(!s){console.log(`Already on latest version (${Pt})`);return}console.log(`Update available: ${s.current} \u2192 ${s.latest}
71
71
  `),console.log("Updating @testmuai/kane-cli...");let a=await n(o=>{process.stdout.write(o)});a.success?(console.log(`
72
72
  \u2713 Updated to ${a.toVersion}`),console.log("\nRun `kane-cli changelog` to see what's new.")):console.error(`
73
- \u2717 Update failed: ${a.error}`)}),e.command("changelog").description("Show recent release notes").option("--all","Show all releases instead of latest 5").action(async r=>{let{fetchChangelog:n,formatChangelog:s}=await import("./changelog-E4BNKPYL.js"),a=await n({all:r.all});console.log(s(a))}),e.parse(["node","kane-cli",...i])}var To=kn().catch(()=>null),Wn=Ut.argv.slice(2),Aa=Wn.includes("--dev"),Ta=Wn.includes("--local"),Oa=Wn.includes("--code-export"),Po=Wn.filter(i=>i!=="--dev"),Pa=new Set(["--local","--code-export"]),Ia=Po.some(i=>!Pa.has(i));Aa&&(Ut.env.KANE_DEV_MODE="1");if(Ia)To.then(i=>{i&&Ut.stderr.write(`
73
+ \u2717 Update failed: ${a.error}`)}),e.command("changelog").description("Show recent release notes").option("--all","Show all releases instead of latest 5").action(async r=>{let{fetchChangelog:n,formatChangelog:s}=await import("./changelog-XYK3P4RQ.js"),a=await n({all:r.all});console.log(s(a))}),e.parse(["node","kane-cli",...i])}var To=kn().catch(()=>null),Wn=Ut.argv.slice(2),Aa=Wn.includes("--dev"),Ta=Wn.includes("--local"),Oa=Wn.includes("--code-export"),Po=Wn.filter(i=>i!=="--dev"),Pa=new Set(["--local","--code-export"]),Ia=Po.some(i=>!Pa.has(i));Aa&&(Ut.env.KANE_DEV_MODE="1");if(Ia)To.then(i=>{i&&Ut.stderr.write(`
74
74
  Update available: ${i.current} \u2192 ${i.latest} \u2014 run \`kane-cli update\`
75
75
 
76
76
  `)}),Ao(Po);else{Ut.on("SIGINT",()=>{Ut.exit(130)}),Ut.on("SIGTERM",async()=>{let{runExitCleanup:e}=await import("./exitCleanup-J3GVD6U2.js");e(),Ut.exit(143)});let{waitUntilExit:i}=yn(Oo.default.createElement(co,{localMode:Ta,codeExport:Oa,updatePromise:To}),{exitOnCtrlC:!1});i().then(()=>{Ut.exit(0)})}
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as a}from"./chunk-TSMW6QW4.js";import{a as s}from"./chunk-D3WSRUJS.js";import"./chunk-UR6MHSHU.js";import{execFile as l}from"child_process";async function p(i){let t=await a();if(!t)return{success:!0,fromVersion:s,toVersion:s};let o=`@testmuai/kane-cli@${t.latest}`;return new Promise(n=>{let r=l("npm",["install","-g",o],{timeout:12e4,env:{...process.env}});r.stdout?.on("data",e=>i?.(e)),r.stderr?.on("data",e=>i?.(e)),r.on("close",e=>{n(e===0?{success:!0,fromVersion:s,toVersion:t.latest}:{success:!1,fromVersion:s,toVersion:t.latest,error:`npm install exited with code ${e}. Try manually: npm install -g ${o}`})}),r.on("error",e=>{n({success:!1,fromVersion:s,toVersion:t.latest,error:`Failed to run npm: ${e.message}. Try manually: npm install -g ${o}`})})})}export{p as runSelfUpdate};
2
+ import{c as a}from"./chunk-GTYF5DR6.js";import{a as s}from"./chunk-RDG6MGL7.js";import"./chunk-UR6MHSHU.js";import{execFile as l}from"child_process";async function p(i){let t=await a();if(!t)return{success:!0,fromVersion:s,toVersion:s};let o=`@testmuai/kane-cli@${t.latest}`;return new Promise(n=>{let r=l("npm",["install","-g",o],{timeout:12e4,env:{...process.env}});r.stdout?.on("data",e=>i?.(e)),r.stderr?.on("data",e=>i?.(e)),r.on("close",e=>{n(e===0?{success:!0,fromVersion:s,toVersion:t.latest}:{success:!1,fromVersion:s,toVersion:t.latest,error:`npm install exited with code ${e}. Try manually: npm install -g ${o}`})}),r.on("error",e=>{n({success:!1,fromVersion:s,toVersion:t.latest,error:`Failed to run npm: ${e.message}. Try manually: npm install -g ${o}`})})})}export{p as runSelfUpdate};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-TSMW6QW4.js";import"./chunk-D3WSRUJS.js";import"./chunk-UR6MHSHU.js";export{c as checkForUpdate,a as compareVersions,b as getSeverity};
2
+ import{a,b,c}from"./chunk-GTYF5DR6.js";import"./chunk-RDG6MGL7.js";import"./chunk-UR6MHSHU.js";export{c as checkForUpdate,a as compareVersions,b as getSeverity};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testmuai/kane-cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "KaneAI Terminal UI — browser automation testing agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,9 +23,9 @@
23
23
  "sharp": "^0.34.5"
24
24
  },
25
25
  "optionalDependencies": {
26
- "@testmuai/kane-cli-darwin-arm64": "0.2.3",
27
- "@testmuai/kane-cli-linux-x64": "0.2.3",
28
- "@testmuai/kane-cli-win-x64": "0.2.3"
26
+ "@testmuai/kane-cli-darwin-arm64": "0.2.4",
27
+ "@testmuai/kane-cli-linux-x64": "0.2.4",
28
+ "@testmuai/kane-cli-win-x64": "0.2.4"
29
29
  },
30
30
  "publishConfig": {
31
31
  "registry": "https://registry.npmjs.org",