@testmuai/kane-cli 0.2.10 → 0.2.11

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 (55) hide show
  1. package/dist/ChromeProfilePicker-YIDCOJVA.js +2 -0
  2. package/dist/CliFeedbackPrompt-T5LVDBVG.js +2 -0
  3. package/dist/{CliUploadProgress-ZVRZFMGT.js → CliUploadProgress-YJW7DHBT.js} +1 -1
  4. package/dist/{ConfigView-XCWDFTNS.js → ConfigView-5L75H3A6.js} +1 -1
  5. package/dist/FolderPicker-LEE4Y5JF.js +2 -0
  6. package/dist/{HelpView-DOYUDPWZ.js → HelpView-SIIWVMWF.js} +1 -1
  7. package/dist/{LinksBox-FR4WLNX4.js → LinksBox-M72NCTRJ.js} +1 -1
  8. package/dist/ProfilesView-6MW5P6M4.js +2 -0
  9. package/dist/ProjectPicker-57G2ILEN.js +2 -0
  10. package/dist/SingleShotApp-UD4M2CZC.js +2 -0
  11. package/dist/{WhoamiView-AP6NXPTL.js → WhoamiView-ZKNSYOLI.js} +1 -1
  12. package/dist/{changelog-DFV22SXX.js → changelog-TWE6QJ5S.js} +1 -1
  13. package/dist/{chunk-UNQM5247.js → chunk-2O7RIXHD.js} +1 -1
  14. package/dist/{chunk-5WXHT4JD.js → chunk-55EYPGTJ.js} +1 -1
  15. package/dist/{chunk-75XK2HKS.js → chunk-7ONI2K3S.js} +1 -1
  16. package/dist/{chunk-43D3E7EA.js → chunk-C4KI7FLV.js} +1 -1
  17. package/dist/chunk-CKMDFVL6.js +5 -0
  18. package/dist/{chunk-SOUKF5VL.js → chunk-D3YS6JDD.js} +1 -1
  19. package/dist/{chunk-FK2AWXZN.js → chunk-HHNLJWO5.js} +1 -1
  20. package/dist/{chunk-7E2QYCMX.js → chunk-ID77BNBM.js} +1 -1
  21. package/dist/chunk-IQYKSZAW.js +20 -0
  22. package/dist/chunk-J3ZXTHAH.js +103 -0
  23. package/dist/chunk-LBW6EFWN.js +2 -0
  24. package/dist/chunk-M5TQDTQN.js +2 -0
  25. package/dist/{chunk-PXIG2FKV.js → chunk-NDMXYUJM.js} +1 -1
  26. package/dist/chunk-TMTSY6CU.js +2 -0
  27. package/dist/chunk-XQL5WHKR.js +2 -0
  28. package/dist/chunk-Y3MXIITZ.js +2 -0
  29. package/dist/chunk-Y4AOKSSQ.js +2 -0
  30. package/dist/chunk-YUUZDFT7.js +2 -0
  31. package/dist/chunk-Z3JYUFJ4.js +2 -0
  32. package/dist/index.js +46 -57
  33. package/dist/{logging-WJPMWUL5.js → logging-JWPN5HMJ.js} +1 -1
  34. package/dist/login-flow-WXMKYI5G.js +2 -0
  35. package/dist/{pipeline-ZSNZGJIH.js → pipeline-6DGALO2W.js} +1 -1
  36. package/dist/{tms-client-VH42IFUF.js → tms-client-CTH4NVFM.js} +1 -1
  37. package/dist/validate-basic-RV5TSUKJ.js +2 -0
  38. package/dist/{version-check-AGBPWJQA.js → version-check-FOMPCS47.js} +1 -1
  39. package/package.json +5 -5
  40. package/dist/ChromeProfilePicker-VPCR7EPX.js +0 -2
  41. package/dist/CliFeedbackPrompt-CKWGADHU.js +0 -2
  42. package/dist/FolderPicker-DN4OV6BI.js +0 -2
  43. package/dist/LoginWizard-NJ22OXIH.js +0 -2
  44. package/dist/ProfilesView-ENBYW7PJ.js +0 -2
  45. package/dist/ProjectPicker-43LFS6S6.js +0 -2
  46. package/dist/chunk-5PATFYIN.js +0 -2
  47. package/dist/chunk-6REBTGNQ.js +0 -106
  48. package/dist/chunk-7H6IY5KC.js +0 -2
  49. package/dist/chunk-FBK6UISI.js +0 -2
  50. package/dist/chunk-HFQ7T5KT.js +0 -2
  51. package/dist/chunk-KJAVR2NX.js +0 -2
  52. package/dist/chunk-OILYCYAD.js +0 -2
  53. package/dist/chunk-YSOCZU7T.js +0 -2
  54. package/dist/chunk-YTG6V347.js +0 -2
  55. package/dist/login-flow-5WUX5JKU.js +0 -2
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-5WXHT4JD.js";import"./chunk-75XK2HKS.js";import"./chunk-UR6MHSHU.js";export{a as RemoteLogger,b as createRemoteLogger};
2
+ import{a,b}from"./chunk-55EYPGTJ.js";import"./chunk-7ONI2K3S.js";import"./chunk-UR6MHSHU.js";export{a as RemoteLogger,b as createRemoteLogger};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-J3ZXTHAH.js";import"./chunk-CKMDFVL6.js";import"./chunk-2O7RIXHD.js";import"./chunk-7ONI2K3S.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-SOUKF5VL.js";import"./chunk-L5Y2GUO6.js";import"./chunk-HFQ7T5KT.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{a as UploadPipeline};
2
+ import{a}from"./chunk-D3YS6JDD.js";import"./chunk-L5Y2GUO6.js";import"./chunk-YUUZDFT7.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{a as UploadPipeline};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-HFQ7T5KT.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{a as TmsClient};
2
+ import{a}from"./chunk-YUUZDFT7.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{a as TmsClient};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as t}from"./chunk-2O7RIXHD.js";import"./chunk-7ONI2K3S.js";import"./chunk-UR6MHSHU.js";async function a(n,e,o){let{TmsClient:r}=await import("./tms-client-CTH4NVFM.js"),i=new r(t(n).tmsBaseUrl,e,o);for await(let m of i.listProjectsStream({perPage:1,maxPages:1}))return}export{a as validateBasicAuth};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-43D3E7EA.js";import"./chunk-75XK2HKS.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
2
+ import{a,b,c,d}from"./chunk-C4KI7FLV.js";import"./chunk-7ONI2K3S.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testmuai/kane-cli",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "KaneAI Terminal UI — browser automation testing agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,10 +23,10 @@
23
23
  "sharp": "^0.34.5"
24
24
  },
25
25
  "optionalDependencies": {
26
- "@testmuai/kane-cli-darwin-arm64": "0.2.10",
27
- "@testmuai/kane-cli-darwin-x64": "0.2.10",
28
- "@testmuai/kane-cli-linux-x64": "0.2.10",
29
- "@testmuai/kane-cli-win-x64": "0.2.10"
26
+ "@testmuai/kane-cli-darwin-arm64": "0.2.11",
27
+ "@testmuai/kane-cli-darwin-x64": "0.2.11",
28
+ "@testmuai/kane-cli-linux-x64": "0.2.11",
29
+ "@testmuai/kane-cli-win-x64": "0.2.11"
30
30
  },
31
31
  "publishConfig": {
32
32
  "registry": "https://registry.npmjs.org",
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-5PATFYIN.js";import"./chunk-HCBYKLMW.js";import"./chunk-75XK2HKS.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as r}from"./chunk-7H6IY5KC.js";import"./chunk-HCBYKLMW.js";import"./chunk-75XK2HKS.js";import{c as e}from"./chunk-C44QQJR4.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 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-KJAVR2NX.js";import"./chunk-YTG6V347.js";import"./chunk-UNQM5247.js";import"./chunk-HCBYKLMW.js";import"./chunk-75XK2HKS.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-HFQ7T5KT.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-YSOCZU7T.js";import"./chunk-HCBYKLMW.js";import"./chunk-75XK2HKS.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as LoginWizard,a as getWizardSteps};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-FBK6UISI.js";import"./chunk-HCBYKLMW.js";import"./chunk-75XK2HKS.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-OILYCYAD.js";import"./chunk-YTG6V347.js";import"./chunk-UNQM5247.js";import"./chunk-HCBYKLMW.js";import"./chunk-75XK2HKS.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-HFQ7T5KT.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as S}from"./chunk-HCBYKLMW.js";import{k as p,t}from"./chunk-75XK2HKS.js";import{a as m,b as n,i as y}from"./chunk-C44QQJR4.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};
@@ -1,106 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as V}from"./chunk-UNQM5247.js";import{c as K,l as _,m as B,n as E,o as Y,p as G,q as X,r as q}from"./chunk-75XK2HKS.js";import{createServer as qe}from"http";import{randomBytes as Ve}from"crypto";import{URL as Qe}from"url";import ce from"process";import{Buffer as le}from"buffer";import de from"path";import{fileURLToPath as Ue}from"url";import{promisify as He}from"util";import fe from"child_process";import je,{constants as ze}from"fs/promises";import re from"process";import te,{constants as Se}from"fs/promises";import ee from"process";import be from"os";import L from"fs";import ve from"fs";import Q from"fs";var T;function we(){try{return Q.statSync("/.dockerenv"),!0}catch{return!1}}function ye(){try{return Q.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function F(){return T===void 0&&(T=we()||ye()),T}var O,xe=()=>{try{return ve.statSync("/run/.containerenv"),!0}catch{return!1}};function h(){return O===void 0&&(O=xe()||F()),O}var Z=()=>{if(ee.platform!=="linux")return!1;if(be.release().toLowerCase().includes("microsoft"))return!h();try{if(L.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!h()}catch{}return L.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||L.existsSync("/run/WSL")?!h():!1},m=ee.env.__IS_WSL_TEST__?Z:Z();var Pe=(()=>{let o="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",t=!1;try{await te.access(r,Se.F_OK),t=!0}catch{}if(!t)return o;let i=await te.readFile(r,{encoding:"utf8"}),n=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return n?(e=n.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):o}})(),Ce=async()=>`${await Pe()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,I=async()=>m?Ce():`${re.env.SYSTEMROOT||re.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;function p(o,e,r){let t=i=>Object.defineProperty(o,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(o,e,{configurable:!0,enumerable:!0,get(){let i=r();return t(i),i},set(i){t(i)}}),o}import{promisify as $e}from"util";import N from"process";import{execFile as Re}from"child_process";import{promisify as Ae}from"util";import ke from"process";import{execFile as _e}from"child_process";var Be=Ae(_e);async function M(){if(ke.platform!=="darwin")throw new Error("macOS only");let{stdout:o}=await Be("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(o)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}import Ee from"process";import{promisify as Te}from"util";import{execFile as Fe,execFileSync as Pr}from"child_process";var Oe=Te(Fe);async function oe(o,{humanReadableOutput:e=!0,signal:r}={}){if(Ee.platform!=="darwin")throw new Error("macOS only");let t=e?[]:["-ss"],i={};r&&(i.signal=r);let{stdout:n}=await Oe("osascript",["-e",o,t],i);return n.trim()}async function $(o){return oe(`tell application "Finder" to set app_path to application file id "${o}" as string
3
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as Le}from"util";import{execFile as Ie}from"child_process";var Me=Le(Ie),P={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},Er=new Map(Object.entries(P)),R=class extends Error{};async function D(o=Me){let{stdout:e}=await o("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new R(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:t}=r.groups,i=t.lastIndexOf("."),n=t.lastIndexOf("-"),a=i===-1?void 0:t.slice(0,i),s=n===-1?void 0:t.slice(0,n);return P[t]??P[a]??P[s]??{name:t,id:t}}var De=$e(Re),Ne=o=>o.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function U(){if(N.platform==="darwin"){let o=await M();return{name:await $(o),id:o}}if(N.platform==="linux"){let{stdout:o}=await De("xdg-mime",["query","default","x-scheme-handler/http"]),e=o.trim();return{name:Ne(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(N.platform==="win32")return D();throw new Error("Only macOS, Linux, and Windows are supported")}var We=He(fe.execFile),H=de.dirname(Ue(import.meta.url)),ie=de.join(H,"xdg-open"),{platform:v,arch:ne}=ce;async function Je(){let o=await I(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=le.from(e,"utf16le").toString("base64"),{stdout:t}=await We(o,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),i=t.trim(),n={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return n[i]?{id:n[i]}:{}}var se=async(o,e)=>{let r;for(let t of o)try{return await e(t)}catch(i){r=i}throw r},C=async o=>{if(o={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...o},Array.isArray(o.app))return se(o.app,s=>C({...o,app:s}));let{name:e,arguments:r=[]}=o.app??{};if(r=[...r],Array.isArray(e))return se(e,s=>C({...o,app:{name:s,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let s={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},c={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},l=m?await Je():await U();if(l.id in s){let f=s[l.id];return e==="browserPrivate"&&r.push(c[f]),C({...o,app:{name:w[f],arguments:r}})}throw new Error(`${l.name} is not supported as a default browser`)}let t,i=[],n={};if(v==="darwin")t="open",o.wait&&i.push("--wait-apps"),o.background&&i.push("--background"),o.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(v==="win32"||m&&!h()&&!e){t=await I(),i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),m||(n.windowsVerbatimArguments=!0);let s=["Start"];o.wait&&s.push("-Wait"),e?(s.push(`"\`"${e}\`""`),o.target&&r.push(o.target)):o.target&&s.push(`"${o.target}"`),r.length>0&&(r=r.map(c=>`"\`"${c}\`""`),s.push("-ArgumentList",r.join(","))),o.target=le.from(s.join(" "),"utf16le").toString("base64")}else{if(e)t=e;else{let s=!H||H==="/",c=!1;try{await je.access(ie,ze.X_OK),c=!0}catch{}t=ce.versions.electron??(v==="android"||s||!c)?"xdg-open":ie}r.length>0&&i.push(...r),o.wait||(n.stdio="ignore",n.detached=!0)}v==="darwin"&&r.length>0&&i.push("--args",...r),o.target&&i.push(o.target);let a=fe.spawn(t,i,n);return o.wait?new Promise((s,c)=>{a.once("error",c),a.once("close",l=>{if(!o.allowNonzeroExitCode&&l>0){c(new Error(`Exited with code ${l}`));return}s(a)})}):(a.unref(),a)},Ke=(o,e)=>{if(typeof o!="string")throw new TypeError("Expected a `target`");return C({...e,target:o})};function ae(o){if(typeof o=="string"||Array.isArray(o))return o;let{[ne]:e}=o;if(!e)throw new Error(`${ne} is not supported`);return e}function A({[v]:o},{wsl:e}){if(e&&m)return ae(e);if(!o)throw new Error(`${v} is not supported`);return ae(o)}var w={};p(w,"chrome",()=>A({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));p(w,"brave",()=>A({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));p(w,"firefox",()=>A({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));p(w,"edge",()=>A({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));p(w,"browser",()=>"browser");p(w,"browserPrivate",()=>"browserPrivate");var ue=Ke;import{createHash as Ye,randomBytes as Ge}from"crypto";var x=class{authBaseUrl;consentUrl;constructor(e="prod"){let r=V(e);this.authBaseUrl=r.authBaseUrl,this.consentUrl=r.consentUrl}static generatePkce(){let e=Ge(96).toString("base64url").slice(0,128),r=Ye("sha256").update(e).digest("base64url");return[e,r]}buildAuthorizationUrl(e,r,t,i){let n=new URLSearchParams({response_type:"code",client_id:e,redirect_uri:i,scope:q,code_challenge:r,code_challenge_method:"S256",state:t});return`${this.consentUrl}/oauth2?${n.toString()}`}async registerClient(e){let r=await fetch(`${this.authBaseUrl}/oauth2/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_name:X,redirect_uris:[e],grant_types:["authorization_code"],response_types:["code"],client_type:"public",application_type:"native"})});if(!r.ok)throw new Error(`DCR failed: ${r.status} ${await r.text()}`);return r.json()}async exchangeCode(e,r,t,i){let n=await fetch(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:e,redirect_uri:i,client_id:r,code_verifier:t})});if(!n.ok)throw new Error(`Token exchange failed: ${n.status}`);return n.json()}async refreshToken(e,r){let t=await fetch(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:e,client_id:r})});if(!t.ok)throw new Error(`Token refresh failed: ${t.status}`);return t.json()}async revokeToken(e,r,t="access_token"){await fetch(`${this.authBaseUrl}/oauth2/revoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,token_type_hint:t,client_id:r})})}async validateToken(e){let r=new AbortController,t=setTimeout(()=>r.abort(),1e4);try{let i=await fetch(`${this.authBaseUrl}/api/user`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json","Content-Type":"application/json"},signal:r.signal});return clearTimeout(t),i.ok}catch{return clearTimeout(t),!1}}};import{readFileSync as b,writeFileSync as me,mkdirSync as pe,readdirSync as j,unlinkSync as u,existsSync as z,chmodSync as ge}from"fs";import{join as d,dirname as Xe}from"path";var k=class{baseDir;profilesDir;configFile;constructor(e=K){this.baseDir=e,this.profilesDir=d(e,"profiles"),this.configFile=d(e,"config.json")}readConfig(){try{return JSON.parse(b(this.configFile,"utf-8"))}catch{return{}}}writeConfig(e){pe(this.baseDir,{recursive:!0,mode:448}),me(this.configFile,JSON.stringify(e,null,2)+`
4
- `),ge(this.configFile,384)}getActiveProfile(){return this.readConfig().active_profile??null}setActiveProfile(e){let r=this.readConfig();r.active_profile=e,this.writeConfig(r)}getDefaultEnv(){return this.readConfig().default_env??"prod"}setDefaultEnv(e){let r=this.readConfig();r.default_env=e,this.writeConfig(r)}credentialsPath(e,r){return d(this.profilesDir,e,r,"credentials")}clientPath(e,r){return d(this.profilesDir,e,r,"client.json")}basicAuthPath(e,r){return d(this.profilesDir,e,r,"basic-auth")}profileConfigPath(e,r){return d(this.profilesDir,e,r,"profile-config.json")}saveProfileConfig(e,r,t){let i=this.loadProfileConfig(e,r)??{};this.writeSecure(this.profileConfigPath(e,r),{...i,...t})}loadProfileConfig(e,r){try{return JSON.parse(b(this.profileConfigPath(e,r),"utf-8"))}catch{return null}}writeSecure(e,r){try{pe(Xe(e),{recursive:!0,mode:448}),me(e,JSON.stringify(r,null,2)+`
5
- `),ge(e,384)}catch(t){let i=t instanceof Error?t.message:String(t);process.stderr.write(`[auth] Failed to save credentials: ${i}
6
- `)}}saveCredentials(e,r,t){this.writeSecure(this.credentialsPath(e,r),t)}loadCredentials(e,r){try{return JSON.parse(b(this.credentialsPath(e,r),"utf-8"))}catch{return null}}saveClient(e,r,t){this.writeSecure(this.clientPath(e,r),t)}loadClient(e,r){try{return JSON.parse(b(this.clientPath(e,r),"utf-8"))}catch{return null}}getActiveCredentials(){let e=this.getActiveProfile();if(!e)return{credentials:null,profile:null,env:null};let r=this.getDefaultEnv();return{credentials:this.loadCredentials(e,r),profile:e,env:r}}saveBasicAuth(e,r,t){this.writeSecure(this.basicAuthPath(e,r),t)}loadBasicAuth(e,r){try{return JSON.parse(b(this.basicAuthPath(e,r),"utf-8"))}catch{return null}}deleteBasicAuth(e,r){try{u(this.basicAuthPath(e,r))}catch{}}resolveAuth(){let e=this.getActiveProfile();if(!e)return null;let r=this.getDefaultEnv(),t=this.loadBasicAuth(e,r);return t?{method:"basic",...t,profile:e,env:r}:this.loadCredentials(e,r)?{method:"oauth",profile:e,env:r}:null}listProfiles(){let e=[];try{for(let r of j(this.profilesDir)){let t=d(this.profilesDir,r);try{for(let i of j(t)){let n=d(t,i),a=z(d(n,"credentials")),s=z(d(n,"client.json")),c=z(d(n,"basic-auth"));(a||s||c)&&e.push({profile:r,env:i})}}catch{}}}catch{}return e}deleteProfile(e,r){try{u(this.credentialsPath(e,r))}catch{}if(this.getActiveProfile()===e){let t=this.readConfig();delete t.active_profile,this.writeConfig(t)}}deleteProfileFull(e,r){if(r){try{u(this.credentialsPath(e,r))}catch{}try{u(this.clientPath(e,r))}catch{}try{u(this.basicAuthPath(e,r))}catch{}try{u(this.profileConfigPath(e,r))}catch{}}else try{let t=d(this.profilesDir,e);for(let i of j(t)){try{u(d(t,i,"credentials"))}catch{}try{u(d(t,i,"client.json"))}catch{}try{u(d(t,i,"basic-auth"))}catch{}try{u(d(t,i,"profile-config.json"))}catch{}}}catch{}}};var he=class{profile;environment;creds;oauth;constructor(e="default",r="prod",t){this.profile=e,this.environment=r,this.creds=t??new k,this.oauth=new x(r)}async login(){let{server:e,port:r}=await this.startCallbackServer(),t=G(r);try{let i=this.creds.loadClient(this.profile,this.environment),n=i?.redirect_uris;(!i||!n?.includes(t))&&(i=await this.oauth.registerClient(t),this.creds.saveClient(this.profile,this.environment,i));let a=i.client_id,[s,c]=x.generatePkce(),l=Ve(32).toString("hex"),f=this.oauth.buildAuthorizationUrl(a,c,l,t),g=await this.waitForCallback(e,r,f,l);if(!g)throw new Error("Login cancelled or timed out");let y=await this.oauth.exchangeCode(g,a,s,t),S={access_token:y.access_token,refresh_token:y.refresh_token,expires_at:Math.floor(Date.now()/1e3)+y.expires_in,scope:y.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,S),this.creds.setActiveProfile(this.profile),S}catch(i){throw e.close(),i}}startCallbackServer(){return new Promise((e,r)=>{let t=B,i=()=>{let n=qe();n.on("error",a=>{a.code==="EADDRINUSE"&&t<E?(t++,i()):r(new Error(`Failed to start callback server: ${a.message}. Ports ${B}-${E} are all in use.`))}),n.listen(t,_,()=>{e({server:n,port:t})})};i()})}waitForCallback(e,r,t,i){return new Promise(n=>{let a=!1,s=setTimeout(()=>c(null),12e4),c=l=>{a||(a=!0,clearTimeout(s),e.close(),n(l))};e.on("request",(l,f)=>{let g=new Qe(l.url??"/",`http://${_}:${r}`);if(g.pathname!==Y){f.writeHead(404),f.end();return}let y=g.searchParams.get("state"),S=g.searchParams.get("code");if(g.searchParams.get("error")){f.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),f.end(W({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),c(null);return}if(y!==i){f.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),f.end(W({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),c(null);return}f.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),f.end(W({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),c(S)}),ue(t).catch(l=>{let f=l instanceof Error?l.message:String(l);process.stderr.write(`[auth] Could not open browser: ${f}
7
- Please open this URL manually: ${t}
8
- `)})})}};function W(o){let e=o.state==="success",r=e?"#22c55e":"#ef4444",t=e?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",i=e?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',n=o.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
9
- <html lang="en">
10
- <head>
11
- <meta charset="utf-8" />
12
- <meta name="viewport" content="width=device-width, initial-scale=1" />
13
- <title>${J(o.title)} \xB7 KaneAI</title>
14
- <style>
15
- :root {
16
- color-scheme: light dark;
17
- --bg: #f7f7f8;
18
- --card: #ffffff;
19
- --fg: #0a0a0a;
20
- --muted: #6b7280;
21
- --border: rgba(0, 0, 0, 0.06);
22
- --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
23
- }
24
- @media (prefers-color-scheme: dark) {
25
- :root {
26
- --bg: #0a0a0a;
27
- --card: #141416;
28
- --fg: #f5f5f7;
29
- --muted: #9ca3af;
30
- --border: rgba(255, 255, 255, 0.08);
31
- --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
32
- }
33
- }
34
- * { box-sizing: border-box; }
35
- html, body { height: 100%; }
36
- body {
37
- margin: 0;
38
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
39
- background: var(--bg);
40
- color: var(--fg);
41
- display: flex;
42
- align-items: center;
43
- justify-content: center;
44
- padding: 24px;
45
- -webkit-font-smoothing: antialiased;
46
- }
47
- .card {
48
- width: 100%;
49
- max-width: 420px;
50
- background: var(--card);
51
- border: 1px solid var(--border);
52
- border-radius: 16px;
53
- box-shadow: var(--shadow);
54
- padding: 40px 32px 32px;
55
- text-align: center;
56
- animation: rise 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
57
- }
58
- @keyframes rise {
59
- from { opacity: 0; transform: translateY(8px); }
60
- to { opacity: 1; transform: translateY(0); }
61
- }
62
- .icon {
63
- width: 64px;
64
- height: 64px;
65
- margin: 0 auto 20px;
66
- border-radius: 999px;
67
- display: flex;
68
- align-items: center;
69
- justify-content: center;
70
- background: ${t};
71
- color: ${r};
72
- }
73
- h1 {
74
- font-size: 22px;
75
- font-weight: 600;
76
- letter-spacing: -0.01em;
77
- margin: 0 0 8px;
78
- }
79
- p {
80
- margin: 0;
81
- color: var(--muted);
82
- font-size: 14.5px;
83
- line-height: 1.5;
84
- }
85
- .brand {
86
- margin-top: 28px;
87
- padding-top: 20px;
88
- border-top: 1px solid var(--border);
89
- font-size: 12px;
90
- letter-spacing: 0.08em;
91
- text-transform: uppercase;
92
- color: var(--muted);
93
- }
94
- .brand strong { color: var(--fg); font-weight: 600; letter-spacing: 0.08em; }
95
- </style>
96
- </head>
97
- <body>
98
- <main class="card" role="status" aria-live="polite">
99
- <div class="icon">${i}</div>
100
- <h1>${J(o.title)}</h1>
101
- <p>${J(o.message)}</p>
102
- <div class="brand"><strong>KaneAI</strong> \xB7 CLI</div>
103
- </main>
104
- ${n}
105
- </body>
106
- </html>`}function J(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}export{k as a,x as b,he as c};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-75XK2HKS.js";import{a as p,b as r,i as a}from"./chunk-C44QQJR4.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 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as P}from"./chunk-HCBYKLMW.js";import{t as i}from"./chunk-75XK2HKS.js";import{a,b as l,i as h}from"./chunk-C44QQJR4.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 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as h}from"./chunk-DXKKUGFG.js";var m=class extends h{constructor(e,t,s){super(e,{username:t,accessKey:s})}async listProjects(e){let i=[],r=!1;for(let a=1;a<=100;a++){let n=`${this.baseUrl}/v1/projects?page=${a}&per_page=200&sort=created_at`,o=await fetch(n,{method:"GET",headers:this.headers()});if(!o.ok)throw new Error(`List projects failed: ${o.status} ${await o.text()}`);let d=(await o.json()).data??[];if(e&&!r&&d.length>0){let c=d[0];e("info","PROJECT_SAMPLE","Project list sample",{project_id:c.project_id,name:c.name}),r=!0}if(i.push(...d),d.length<200)break}return i}async getDefaultFolder(e){let t=await fetch(`${this.baseUrl}/v1/projects/${e}/folder/default`,{method:"GET",headers:this.headers()});if(!t.ok)throw new Error(`Get default folder failed: ${t.status} ${await t.text()}`);return(await t.json()).id}async listFolders(e){let t=await fetch(`${this.baseUrl}/v1/folder/entity/${e}`,{method:"GET",headers:this.headers()});if(!t.ok)throw new Error(`List folders failed: ${t.status} ${await t.text()}`);return(await t.json()).data??[]}async createProject(e){let t=await fetch(`${this.baseUrl}/v1/projects`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({name:e,description:"",tags:[],source:"KTM"})});if(!t.ok)throw new Error(`Create project failed: ${t.status} ${await t.text()}`);return{id:(await t.json()).id,name:e}}async createFolder(e,t){let s=await fetch(`${this.baseUrl}/v1/folder`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({folders:[{name:t,description:"",entity_id:e,entity_type:"project"}]})});if(!s.ok)throw new Error(`Create folder failed: ${s.status} ${await s.text()}`);return{id:(await s.json()).id,name:t}}async createAtmTest(e,t){let s=t?`Bearer ${t}`:this.authHeader,i=await fetch(`${this.baseUrl}/kane-cli/v1/test`,{method:"POST",headers:{Authorization:s,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e)});if(!i.ok)throw new Error(`Create ATM test failed: ${i.status} ${await i.text()}`);let r=await i.json();if(!r.test_id)throw new Error("Create ATM test returned no test_id");return r.test_id}async endTest(e,t,s){let i=s?`Bearer ${s}`:this.authHeader,r=new URLSearchParams({commit_id:t.commit_id,time_taken:String(t.time_taken),steps_count:String(t.steps_count),commit_message:t.commit_message}),a={};t.objectives&&t.objectives.length>0&&(a.objectives=t.objectives);let n=await fetch(`${this.baseUrl}/kane-cli/v1/test/${e}?${r.toString()}`,{method:"DELETE",headers:{Authorization:i,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(a)});if(!n.ok)throw new Error(`End test failed: ${n.status} ${await n.text()}`);let o=await n.json();return{testcase_id:o.data?.testcase_id??"",test_id:o.data?.test_id??e,project_id:o.data?.project_id??""}}async submitFeedback(e,t){let s=t?`Bearer ${t}`:this.authHeader,i={instruction_id:e.instruction_id,test_id:e.test_id,feedback_type:e.feedback_type,mode:e.mode??"human"};e.details&&(i.details=e.details);let r=await fetch(`${this.baseUrl}/atm/v1/generative-feedback`,{method:"POST",headers:{Authorization:s,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(`Submit feedback failed: ${r.status} ${await r.text()}`);return await r.json()}};export{m as a};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as I}from"./chunk-YTG6V347.js";import{a as v}from"./chunk-UNQM5247.js";import{a as S}from"./chunk-HCBYKLMW.js";import{t as a}from"./chunk-75XK2HKS.js";import{a as l,b as i,i as F}from"./chunk-C44QQJR4.js";import{a as O}from"./chunk-6YGTRKDT.js";import{a as y}from"./chunk-HFQ7T5KT.js";import{e as N}from"./chunk-UR6MHSHU.js";var o=N(O(),1);var e=N(S(),1);function U(r,m,x,u){return{id:r,label:`${m} (${r}) \xB7 ${x} tests`,isActive:r===u}}function q({resolver:r,projectId:m,currentFolderId:x,env:u,onSelect:B,onCancel:C}){let[_,A]=(0,o.useState)([]),[$,b]=(0,o.useState)(!0),[k,w]=(0,o.useState)(null),[f,d]=(0,o.useState)("list"),[L,E]=(0,o.useState)(""),[P,g]=(0,o.useState)(null),p=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{if(!r){w("Login first to browse folders"),b(!1);return}(async()=>{try{let t=r.cached??await r.resolve();if(!t){w("Login first to browse folders"),b(!1);return}let n=v(u),h=(await new y(n.tmsBaseUrl,t.username,t.access_key).listFolders(m)).map(T=>U(T.id,T.name,T.test_cases_count,x));A(h),h.length===0&&(p.current=!0,d("naming"))}catch(t){w(t instanceof Error?t.message:String(t))}finally{b(!1)}})()},[r,m,x,u]),F((t,n)=>{if(f==="naming"){if(n.escape){E(""),g(null),p.current?C():d("list");return}if(n.return){let c=L.trim();if(!c){g("Name cannot be empty");return}if(!m){g("No project selected \u2014 pick a project first");return}g(null),d("creating"),(async()=>{try{if(!r)throw new Error("Not authenticated");let s=r.cached??await r.resolve();if(!s)throw new Error("Not authenticated");let h=v(u),R=await new y(h.tmsBaseUrl,s.username,s.access_key).createFolder(m,c);B(R.id,R.name)}catch(s){g(s instanceof Error?s.message:String(s)),d("naming")}})();return}if(n.backspace||n.delete){E(c=>c.slice(0,-1));return}n.tab||n.ctrl||n.meta||t&&E(c=>c+t)}}),f==="naming"||f==="creating"?(0,e.jsxs)(l,{flexDirection:"column",borderStyle:"round",borderColor:a.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:a.primary,bold:!0,children:"Create new folder"}),p.current&&(0,e.jsx)(l,{marginTop:1,children:(0,e.jsx)(i,{color:a.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(l,{marginTop:1,children:[(0,e.jsx)(i,{color:a.dim,children:"Name: "}),(0,e.jsx)(i,{children:L}),f==="naming"&&(0,e.jsx)(i,{inverse:!0,children:" "})]}),P&&(0,e.jsx)(l,{marginTop:1,children:(0,e.jsx)(i,{color:a.red,children:P})}),f==="creating"&&(0,e.jsx)(l,{marginTop:1,children:(0,e.jsx)(i,{color:a.dim,children:"Creating..."})}),f==="naming"&&(0,e.jsx)(l,{marginTop:1,children:(0,e.jsxs)(i,{color:a.dim,children:["\u21B5 create \xB7 esc ",p.current?"cancel":"back"]})})]}):(0,e.jsx)(I,{title:"Folders",items:_,loading:$,error:k,itemNoun:"folders",onTab:()=>{p.current=!1,d("naming")},extraHint:"tab to create new",onSelect:t=>{let n=t.label.split(" (")[0];B(t.id,n)},onCancel:C})}export{U as a,q as b};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as S}from"./chunk-YTG6V347.js";import{a as E}from"./chunk-UNQM5247.js";import{a as R}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-75XK2HKS.js";import{a as m,b as i,i as L}from"./chunk-C44QQJR4.js";import{a as O}from"./chunk-6YGTRKDT.js";import{a as w}from"./chunk-HFQ7T5KT.js";import{e as b}from"./chunk-UR6MHSHU.js";var o=b(O(),1);var e=b(R(),1);function U(r,p,u){return{id:r,label:`${p} (${r})`,isActive:r===u}}function q({resolver:r,currentProjectId:p,env:u,onSelect:N,onCancel:y}){let[I,A]=(0,o.useState)([]),[_,h]=(0,o.useState)(!0),[$,j]=(0,o.useState)(null),[l,f]=(0,o.useState)("list"),[v,T]=(0,o.useState)(""),[B,d]=(0,o.useState)(null),g=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{if(!r){j("Login first to browse projects"),h(!1);return}(async()=>{try{let t=r.cached??await r.resolve();if(!t){j("Login first to browse projects"),h(!1);return}let n=E(u),x=(await new w(n.tmsBaseUrl,t.username,t.access_key).listProjects()).map(P=>U(P.project_id,P.name,p));A(x),x.length===0&&(g.current=!0,f("naming"))}catch(t){j(t instanceof Error?t.message:String(t))}finally{h(!1)}})()},[r,p,u]),L((t,n)=>{if(l==="naming"){if(n.escape){T(""),d(null),g.current?y():f("list");return}if(n.return){let c=v.trim();if(!c){d("Name cannot be empty");return}d(null),f("creating"),(async()=>{try{if(!r)throw new Error("Not authenticated");let a=r.cached??await r.resolve();if(!a)throw new Error("Not authenticated");let x=E(u),C=await new w(x.tmsBaseUrl,a.username,a.access_key).createProject(c);N(C.id,C.name)}catch(a){d(a instanceof Error?a.message:String(a)),f("naming")}})();return}if(n.backspace||n.delete){T(c=>c.slice(0,-1));return}n.tab||n.ctrl||n.meta||t&&T(c=>c+t)}}),l==="naming"||l==="creating"?(0,e.jsxs)(m,{flexDirection:"column",borderStyle:"round",borderColor:s.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:s.primary,bold:!0,children:"Create new project"}),g.current&&(0,e.jsx)(m,{marginTop:1,children:(0,e.jsx)(i,{color:s.dim,children:"No projects yet \u2014 let's create one."})}),(0,e.jsxs)(m,{marginTop:1,children:[(0,e.jsx)(i,{color:s.dim,children:"Name: "}),(0,e.jsx)(i,{children:v}),l==="naming"&&(0,e.jsx)(i,{inverse:!0,children:" "})]}),B&&(0,e.jsx)(m,{marginTop:1,children:(0,e.jsx)(i,{color:s.red,children:B})}),l==="creating"&&(0,e.jsx)(m,{marginTop:1,children:(0,e.jsx)(i,{color:s.dim,children:"Creating..."})}),l==="naming"&&(0,e.jsx)(m,{marginTop:1,children:(0,e.jsxs)(i,{color:s.dim,children:["\u21B5 create \xB7 esc ",g.current?"cancel":"back"]})})]}):(0,e.jsx)(S,{title:"Projects",items:I,loading:_,error:$,itemNoun:"projects",onTab:()=>{g.current=!1,f("naming")},extraHint:"tab to create new",onSelect:t=>{let n=t.label.replace(` (${t.id})`,"");N(t.id,n)},onCancel:y})}export{U as a,q as b};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as E}from"./chunk-HCBYKLMW.js";import{t as r}from"./chunk-75XK2HKS.js";import{a as i,b as t,i as M}from"./chunk-C44QQJR4.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 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as R}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-75XK2HKS.js";import{a as n,b as r,i as F}from"./chunk-C44QQJR4.js";import{a as y}from"./chunk-6YGTRKDT.js";import{e as w}from"./chunk-UR6MHSHU.js";var p=w(y(),1);var e=w(R(),1),x=5;function O(d,c){if(!c)return d;let m=c.toLowerCase();return d.filter(b=>b.label.toLowerCase().includes(m))}function z({title:d,items:c,loading:m=!1,loadingText:b,error:h=null,itemNoun:I="items",onSelect:M,onCancel:P,defaultActiveId:L,onTab:S,extraHint:E}){let[g,a]=(0,p.useState)(0),[T,f]=(0,p.useState)(0),[s,B]=(0,p.useState)("");(0,p.useEffect)(()=>{if(c.length===0)return;let l=L?c.findIndex(o=>o.id===L):c.findIndex(o=>o.isActive);l>=0&&(f(Math.floor(l/x)),a(l%x))},[c,L]);let u=O(c,s),v=T*x,D=Math.min(v+x,u.length),A=Math.ceil(u.length/x),X=D-v,C=u.slice(v,D);return F((l,o)=>{if(h){o.escape&&P();return}if(o.escape){s?(B(""),a(0),f(0)):P();return}if(o.tab&&S){S();return}if(o.upArrow){g>0?a(i=>i-1):T>0&&(f(i=>i-1),a(x-1));return}if(o.downArrow){g<X-1?a(i=>i+1):T<A-1&&(f(i=>i+1),a(0));return}if(o.return&&C[g]){M(C[g]);return}if(o.backspace||o.delete){B(i=>i.slice(0,-1)),a(0),f(0);return}l&&!o.ctrl&&!o.meta&&(B(i=>i+l),a(0),f(0))},{isActive:!m}),m?(0,e.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:t.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(r,{color:t.primary,bold:!0,children:d}),(0,e.jsx)(n,{marginTop:1,children:(0,e.jsx)(r,{color:t.secondary,children:b??`Loading ${I}\u2026`})})]}):h?(0,e.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:t.statusFail,paddingX:2,paddingY:1,children:[(0,e.jsx)(r,{color:t.statusFail,bold:!0,children:d}),(0,e.jsx)(n,{marginTop:1,children:(0,e.jsx)(r,{color:t.statusFail,children:h})}),(0,e.jsx)(n,{marginTop:1,children:(0,e.jsx)(r,{color:t.dim,children:"esc back"})})]}):(0,e.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:t.primary,paddingX:2,paddingY:1,children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(r,{color:t.primary,bold:!0,children:d}),(0,e.jsxs)(r,{color:t.dim,children:[" (",u.length,s?`/${c.length}`:""," ",I,")"]})]}),s&&(0,e.jsxs)(n,{marginTop:1,children:[(0,e.jsx)(r,{color:t.secondary,children:"filter: "}),(0,e.jsx)(r,{children:s}),(0,e.jsx)(r,{color:t.dimmed,children:"\u2588"})]}),(0,e.jsx)(n,{flexDirection:"column",marginTop:1,children:u.length===0?(0,e.jsxs)(r,{color:t.dim,children:["No ",I,' match "',s,'"']}):C.map((l,o)=>{let i=o===g,Y=i?"\u276F ":" ",$=l.isActive?t.statusPass:i?t.primary:void 0;return(0,e.jsxs)(r,{color:$,children:[Y,l.label,l.isActive?" \u25CF selected":""]},l.id)})}),A>1&&(0,e.jsx)(n,{marginTop:1,children:(0,e.jsxs)(r,{color:t.dim,children:["Page ",T+1,"/",A]})}),(0,e.jsx)(n,{marginTop:1,children:(0,e.jsxs)(r,{color:t.dim,children:["\u2191\u2193 navigate \xB7 type to search \xB7 \u21B5 select \xB7 esc ",s?"clear":"back",S&&E?` \xB7 ${E}`:""]})})]})}export{z as a};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as a}from"./chunk-6REBTGNQ.js";import"./chunk-UNQM5247.js";import"./chunk-75XK2HKS.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};