@taqwright/lime-cli 0.12.0 → 0.12.1

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 (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var _=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(t){throw n=0,t}};var ue=_((Gi,Fn)=>{Fn.exports={name:"@taqwright/lime-cli",version:"0.12.0",description:"Thin CLI client for the LIME server \u2014 fire a natural-language QA Agent goal against a connected device and write back a taqwright spec.",license:"SEE LICENSE IN LICENSE",author:"Taqwright",homepage:"https://www.taqwright.ai",bugs:{url:"https://www.taqwright.ai/contact"},keywords:["appium","mobile-testing","e2e","qa","test-automation","taqwright","lime","cli"],bin:{"lime-cli":"dist/index.js"},main:"dist/index.js",files:["dist"],publishConfig:{access:"public"},scripts:{"lime-cli":"node src/index.js",start:"node src/index.js",test:"node --test test/*.test.js",bundle:"esbuild src/index.js --bundle --platform=node --target=node18 --minify --outfile=dist/index.js",prepack:"npm run bundle",prepublishOnly:"npm test"},engines:{node:">=18"},devDependencies:{esbuild:"^0.28.1"}}});var D=_((Ji,Me)=>{"use strict";var Kn="https://www.taqwright.ai";Me.exports={POLL_INTERVAL_MS:1e3,POLL_TIMEOUT_MS:18e5,BOOT_POLL_INTERVAL_MS:5e3,BOOT_TIMEOUT_MS:3e5,CONNECT_POLL_INTERVAL_MS:2e3,CONNECT_TIMEOUT_MS:3e5,DEFAULT_SERVER:Kn,HTTP_TIMEOUT_MS:3e5,MAX_RESPONSE_BYTES:52428800}});var Z=_((Xi,Ke)=>{"use strict";var{URL:Hn}=require("url"),{HTTP_TIMEOUT_MS:qe,MAX_RESPONSE_BYTES:Ue}=D(),{version:Vn}=ue();function Be(e){let n=String(e||"").replace(/^\[|\]$/g,"").toLowerCase();return n==="localhost"||n==="127.0.0.1"||n==="::1"||n.endsWith(".localhost")}var Wn=["just a moment","attention required! | cloudflare","checking your browser","/cdn-cgi/challenge-platform","cf-error-details","cf-browser-verification","_incapsula_resource"];function Fe(e,n){if(!n||typeof n!="string")return null;let t=n.slice(0,4e3).toLowerCase();return Wn.some(r=>t.includes(r))?`the LIME server is behind a bot challenge that blocked this request (HTTP ${e}). The request never reached LIME \u2014 it was stopped at the edge, so your token and arguments are probably fine. CI runners use datacenter IPs, which Cloudflare's Bot Fight Mode challenges by default; it cannot be excepted with a WAF skip rule, so the server's operator has to turn it off or move to Super Bot Fight Mode (which supports skip rules) for the /api/ paths.`:null}var pe=class{constructor(n,t){this.server=n,this.token=t,this.update=null}_url(n){return/^https?:\/\//i.test(n)?n:`${this.server}${n}`}json(n,t,r,s={}){let i=r?JSON.stringify(r):null,o={...s};return i&&(o["Content-Type"]="application/json",o["Content-Length"]=Buffer.byteLength(i)),this._send(n,this._url(t),o,i)}raw(n,t,r,s={}){let i={...s,"Content-Type":"application/octet-stream","Content-Length":r.length};return this._send(n,this._url(t),i,r)}_send(n,t,r,s){let i=new Hn(t);if(i.protocol==="http:"&&!Be(i.hostname))return Promise.reject(new Error(`refusing to send your LIME_CI_TOKEN over cleartext http to ${i.hostname} \u2014 use https (http is allowed only for localhost).`));let o=i.protocol==="https:"?require("https"):require("http"),a={method:n,hostname:i.hostname,port:i.port||(i.protocol==="https:"?443:80),path:i.pathname+(i.search||""),headers:{...r,Authorization:`Bearer ${this.token}`,Origin:`${i.protocol}//${i.host}`,"X-Lime-Cli-Version":Vn}};return new Promise((l,d)=>{let c=o.request(a,u=>{let p=u.headers["x-lime-cli-update"];p&&(this.update={status:String(p),latest:u.headers["x-lime-cli-latest"]||null});let h="",y=0;u.setEncoding("utf8"),u.on("data",A=>{if(y+=Buffer.byteLength(A),y>Ue){c.destroy(new Error(`Server response exceeded ${Ue} bytes`));return}h+=A}),u.on("end",()=>{let A;try{A=h?JSON.parse(h):{}}catch{let T=Fe(u.statusCode,h);return d(new Error(T||`Server returned non-JSON (${u.statusCode}): ${h.substring(0,200)}`))}l({status:u.statusCode,body:A})})});c.setTimeout(qe,()=>{c.destroy(new Error(`request timed out after ${qe/1e3}s`))}),c.on("error",d),s&&c.write(s),c.end()})}};function Yn(e,n){if(!e.body||!e.body.success)throw new Error(`${n} \u2014 ${e.body&&e.body.error||"unknown"}`);return e.body}Ke.exports={isLoopbackHost:Be,HttpClient:pe,expectSuccess:Yn,describeEdgeBlock:Fe}});var Ve=_((zi,He)=>{"use strict";var he="npm install -g @taqwright/lime-cli@latest",Gn=/^\d+\.\d+\.\d+([-.+][0-9A-Za-z.-]{1,20})?$/;function Jn({status:e,current:n,latest:t,env:r=process.env}){return r.LIME_NO_UPDATE_NOTICE==="1"?null:e==="required"?`lime-cli: ${n} is no longer supported by this server. Run: ${he}`:e==="available"&&typeof t=="string"&&Gn.test(t)?`lime-cli: update available: ${n} \u2192 ${t}. Run: ${he}`:null}He.exports={formatUpdateNotice:Jn,INSTALL_COMMAND:he}});var M=_((Zi,We)=>{"use strict";var Xn={browserstack:{label:"BrowserStack",envUsername:"BROWSERSTACK_USERNAME",envAccessKey:"BROWSERSTACK_ACCESS_KEY",hubHost:"hub.browserstack.com"},lambdatest:{label:"LambdaTest",envUsername:"LT_USERNAME",envAccessKey:"LT_ACCESS_KEY",hubHost:"mobile-hub.lambdatest.com"}};function zn({provider:e,platform:n,device:t,os:r,appUrl:s,username:i,accessKey:o,capabilities:a}){let l={connectionMode:"cloud",cloudProvider:e||"browserstack",cloudUsername:i,cloudAccessKey:o,platform:n,deviceName:t,deviceOsVersion:r,cloudAppUrl:s,automationName:n==="ios"?"XCUITest":"UiAutomator2"};return a&&(l.cloudCapabilities=a),l}We.exports={CLOUD_PROVIDERS:Xn,buildCloudSettingsPayload:zn}});var ge=_((Qi,Ge)=>{"use strict";var Q=require("fs"),fe=require("path"),Zn=["taqwright","webdriverio-js","appium-java-junit5","appium-python-pytest","appium-ruby-rspec","appium-csharp-nunit"],Qn={taqwright:"deterministic","webdriverio-js":"gemini","appium-java-junit5":"gemini","appium-python-pytest":"gemini","appium-ruby-rspec":"gemini","appium-csharp-nunit":"gemini"},P={taqwright:"taqwright (native)","webdriverio-js":"WebdriverIO (JavaScript)","appium-java-junit5":"Appium Java (JUnit 5)","appium-python-pytest":"Appium Python (pytest)","appium-ruby-rspec":"Appium Ruby (RSpec)","appium-csharp-nunit":"Appium C# (NUnit)"},er=5*1024*1024,me={exists:e=>Q.existsSync(e),readText:e=>{try{return Q.statSync(e).size>er?null:Q.readFileSync(e,"utf8")}catch{return null}},list:e=>{try{return Q.readdirSync(e)}catch{return[]}}};function tr(e,n){let t=e.readText(fe.join(n,"package.json"));if(!t)return{};try{let r=JSON.parse(t);return{...r.dependencies||{},...r.devDependencies||{}}}catch{return{}}}var nr=new Set(["node_modules","dist","build","target","bin","obj","vendor","out","coverage"]);function rr(e,n){let t=new Set([""]),r=[];try{r=e.list(n)}catch{r=[]}for(let s of r)s.startsWith(".")||nr.has(s)||t.add(s);return[...t]}function sr(e,n,t){let r=t?fe.join(n,t):n,s=u=>fe.join(r,u),i=u=>t?`${t}/${u}`:u,o=[],a=tr(e,r),l=[];try{l=e.list(r)}catch{l=[]}(a["@taqwright/taqwright"]||a.taqwright||e.exists(s("taqwright.config.ts"))||e.exists(s("taqwright.config.js")))&&o.push({id:"taqwright",label:P.taqwright,reason:"taqwright dependency/config found",manifest:i("package.json")});let d=l.some(u=>/^wdio\.conf\.(js|ts|mjs|cjs)$/.test(u));(a.webdriverio||a["@wdio/cli"]||d)&&o.push({id:"webdriverio-js",label:P["webdriverio-js"],reason:d?"wdio.conf.* found":"webdriverio dependency found",manifest:i("package.json")});for(let u of["pom.xml","build.gradle","build.gradle.kts"]){let p=e.readText(s(u));if(p&&/io\.appium|java-client/.test(p)){o.push({id:"appium-java-junit5",label:P["appium-java-junit5"],reason:`io.appium:java-client in ${i(u)}`,manifest:i(u)});break}}for(let u of["requirements.txt","pyproject.toml"]){let p=e.readText(s(u));if(p&&/appium-python-client/i.test(p)){o.push({id:"appium-python-pytest",label:P["appium-python-pytest"],reason:`Appium-Python-Client in ${i(u)}`,manifest:i(u)});break}}let c=e.readText(s("Gemfile"));c&&/appium_lib(_core)?/.test(c)&&o.push({id:"appium-ruby-rspec",label:P["appium-ruby-rspec"],reason:"appium_lib in Gemfile",manifest:i("Gemfile")});for(let u of l){if(!/\.csproj$/i.test(u))continue;let p=e.readText(s(u));if(p&&/Appium\.WebDriver/i.test(p)){o.push({id:"appium-csharp-nunit",label:P["appium-csharp-nunit"],reason:`Appium.WebDriver in ${i(u)}`,manifest:i(u)});break}}return o}function Ye(e,n=me){let t=new Map;for(let r of rr(n,e))for(let s of sr(n,e,r))t.has(s.id)||t.set(s.id,s);return[...t.values()]}function ir(e,n=me){let t=Ye(e,n);return t.some(r=>r.id==="taqwright")||t.push({id:"taqwright",label:P.taqwright,reason:"default output"}),t}function or(e){let{requested:n,configured:t,remembered:r,offeredIds:s,detectedRealIds:i,taqwrightDetected:o,javaSignal:a}=e,l=d=>!!d&&s.includes(d);return l(n)?n:l(t)?t:l(r)&&(i.includes(r)||r==="taqwright"&&o)?r:i.length?i[0]:o?"taqwright":a?"appium-java-junit5":"taqwright"}Ge.exports={FRAMEWORK_IDS:Zn,FRAMEWORK_ENGINES:Qn,FRAMEWORK_LABELS:P,nodeFs:me,detectFrameworks:Ye,rankFrameworks:ir,pickDefaultFramework:or}});var Se=_((eo,Qe)=>{"use strict";var we=require("path"),{nodeFs:ar}=ge(),Je={taqwright:"tests","webdriverio-js":"test/specs","appium-java-junit5":"src/test/java","appium-python-pytest":"tests","appium-ruby-rspec":"spec","appium-csharp-nunit":"Tests"},cr="tests",lr={taqwright:".spec.ts","webdriverio-js":".spec.ts","appium-java-junit5":".java","appium-python-pytest":".py","appium-ruby-rspec":"_spec.rb","appium-csharp-nunit":".cs"},dr=new Set(["appium-python-pytest","appium-ruby-rspec"]);function ye(e){return Je[e]||cr}function be(e){let n=(e||"").split(/[^A-Za-z0-9]+/).filter(Boolean);return n.length?n.map(t=>/^[A-Z0-9]+$/.test(t)?t[0]+t.slice(1).toLowerCase():t[0].toUpperCase()+t.slice(1)).join(""):""}function Ee(e){return(e||"").replace(/([a-z0-9])([A-Z])/g,"$1_$2").split(/[^A-Za-z0-9]+/).filter(Boolean).join("_").toLowerCase()}function ur(e){return Ee(e).split("_").filter(Boolean).join("-")}var pr=6,hr=new Set(["and","or","the","a","an","to","of","in","on","at","as","with","for","then","into","from","by","that","is"]),fr=/@|\d{6,}/;function mr(e){let n=String(e||"").trim().split(/\s+/).filter(Boolean).filter(t=>!fr.test(t)).slice(0,pr);for(;n.length>1&&hr.has(n[n.length-1].toLowerCase());)n.pop();return be(n.join(" "))||"RecordedTest"}function gr(e){let n=String(e||"").trim();return n?/[A-Za-z]/.test(n)?n.length>80?"Keep the name under 80 characters.":/[/\\]/.test(n)?"Use the destination field for the folder.":null:"Use at least one letter.":"Enter a test name."}function wr(e){if(e==null||e==="")return null;let n=String(e);return n!==n.trim()?"must not have leading or trailing spaces.":n.length>120?"is longer than any key LIME mints (120 characters).":/^[a-z0-9][a-z0-9._/:-]*$/.test(n)?n.includes("..")?'must not contain "..".':null:"is not a scenario key \u2014 expected lower-case letters, digits and . _ - / : only."}function Xe(e,n){let t;return dr.has(e)?t=Ee(n):t=be(n),`${t}${lr[e]||""}`}function H(e){return String(e||"").split(/[/\\]+/).filter(n=>n&&n!=="."&&n!=="..").join("/")}function yr(e){if(e==null)return null;let n=String(e);return n.trim()===""?null:/^([A-Za-z]:)?[/\\]/.test(n)?"must be a path inside the project, not an absolute path.":n.split(/[/\\]+/).includes("..")?'must not contain ".." \u2014 the test belongs inside the project.':null}function ve(e){let n=H(e).split("/");return n.pop(),n.join("/")}function ze(e){let n=/(?:^|\/)src\/(?:test|main)\/java\/(.+)$/.exec(H(e));return n&&n[1].split("/").filter(Boolean).join(".")||void 0}function br(e){let n=H(e),t=n.search(/\/src\/(?:test|main)\/java(?:\/|$)/);return t>0?n.slice(0,t):""}function Er(e){let n=new Map;for(let r of e){let s=ve(r);n.set(s,(n.get(s)||0)+1)}if(!n.size)return null;let t=[...n.entries()].sort((r,s)=>s[1]-r[1]||r[0].localeCompare(s[0]));return{dir:t[0][0],count:t[0][1]}}var Ze={taqwright:{segment:"tests",file:/\.spec\.(ts|js)$/},"webdriverio-js":{segment:"test/specs",file:/\.(ts|js)$/},"appium-java-junit5":{segment:"src/test/java",file:/\.java$/},"appium-python-pytest":{segment:"tests",file:/^(test_.+|.+_test)\.py$/},"appium-ruby-rspec":{segment:"spec",file:/_spec\.rb$/},"appium-csharp-nunit":{segment:"",file:/Tests\.cs$/}},vr=new Set(["node_modules","dist","build","target","bin","obj","vendor","out","coverage",".git"]),Sr=2e4;function Tr(e,n,t=ar){let r=Ze[n];if(!r)return[];let s=[],i=Sr,o=a=>{if(i<=0)return;let l=a?we.join(e,a):e,d=[];try{d=t.list(l)}catch{return}for(let c of d){if(i--<=0)return;if(c.startsWith(".")||vr.has(c))continue;let u=a?`${a}/${c}`:c;if(t.isDir?t.isDir(we.join(e,u)):t.list(we.join(e,u)).length>0){o(u);continue}r.file.test(c)&&(r.segment&&!`/${ve(u)}/`.includes(`/${r.segment}/`)||s.push(u))}};return o(""),s.sort()}function Ar(e){let{framework:n,testName:t}=e,r=Xe(n,t),s=(a,l,d=0)=>{let c=H(a),u=n==="appium-java-junit5"?ze(c):void 0;return{dir:c,fileName:r,...u?{packageName:u}:{},source:l,neighbourCount:d}};if(e.remembered!=null)return s(e.remembered,"remembered");let i=Er(e.existingTests||[]);if(i&&i.dir)return s(i.dir,"existing",i.count);let o=e.detection&&e.detection.manifest?ve(e.detection.manifest):"";return o?s(`${o}/${ye(n)}`,"module"):s(ye(n),"convention")}Qe.exports={CONVENTIONAL_DIRS:Je,TEST_PATTERNS:Ze,conventionalDir:ye,pascalCase:be,snakeCase:Ee,kebabCase:ur,testNameFromGoal:mr,validateTestName:gr,validateDest:yr,validateScenarioKey:wr,fileNameFor:Xe,normalizeDir:H,javaPackageOf:ze,moduleRootOf:br,findExistingTests:Tr,resolveExportTarget:Ar}});var rt=_((to,nt)=>{"use strict";var{CLOUD_PROVIDERS:ee}=M(),{validateScenarioKey:Ir}=Se();function Rr(e){let n=Object.create(null);for(let t=0;t<e.length;t++){let r=e[t];if(!r.startsWith("--"))continue;let s=r.slice(2),i=e[t+1];i===void 0||i.startsWith("--")?n[s]=!0:(n[s]=i,t++)}return n}var tt=["export","adapt","verify","check-locators","check-pom","disconnect","report"];function kr(e){let n=Array.isArray(e)?e:[],t=[];for(let r=0;r<n.length;r+=1){let s=String(n[r]==null?"":n[r]);!s||s.startsWith("-")||(r>0?String(n[r-1]||""):"").startsWith("--")||t.push(s)}return t}function _r(e){let n=e[0];return n&&tt.includes(n)?{command:n,rest:e.slice(1)}:{command:"run",rest:e}}function $r(e="taqwright"){return e==="json"?"recorded-steps.json":"RecordedTest.spec.ts"}function Or(e,n=process.env){let t=[],r=!!e["list-devices"],s=!!e["keep-session"],i=!!e["no-boot"],o=e["lime-dir"]===!0?".lime":typeof e["lime-dir"]=="string"&&e["lime-dir"].trim()?e["lime-dir"].trim():void 0,a=e.format?String(e.format).toLowerCase():"taqwright";if(["taqwright","json"].includes(a)||t.push(`--format must be taqwright or json (got "${e.format}")`),r)return{errors:t,listDevices:r,keepSession:s,noBoot:i,format:a,limeDir:o};(!e.goal||typeof e.goal!="string"||!e.goal.trim())&&t.push("--goal is required");let l;e.project!==void 0&&(typeof e.project!="string"||!e.project.trim()?t.push("--project requires a project name"):l=e.project.trim());let d;if(e.scenario!==void 0){let g=typeof e.scenario=="string"?e.scenario.trim():"",w=g?Ir(g):"requires a scenario key";w?t.push(`--scenario ${w}`):d=g}for(let g of["gemini-key","qwen-key"])e[g]!==void 0&&t.push(`--${g} is no longer supported: runs use the AI key provisioned for your LIME account`);if(e["max-steps"]!==void 0){let g=Number(e["max-steps"]);(!Number.isFinite(g)||g<1||g>200)&&t.push("--max-steps must be a number between 1 and 200")}let c;e.platform&&(c=String(e.platform).toLowerCase(),["android","ios"].includes(c)||t.push(`--platform must be android or ios (got "${e.platform}")`));let u=!!e.cloud,p=typeof e.os=="string"?e.os:void 0,h=typeof e["app-url"]=="string"?e["app-url"]:void 0,y=typeof e.app=="string"?e.app:void 0,A=typeof e.caps=="string"&&e.caps.trim()?e.caps.trim():void 0,b,T,I;if(u&&(b=e.cloud===!0?"browserstack":String(e.cloud).toLowerCase(),ee[b]||t.push(`--cloud must be ${Object.keys(ee).join(" or ")} (got "${e.cloud}")`)),u){(!e.device||typeof e.device!="string")&&t.push('--cloud requires --device (the cloud device name, e.g. "Google Pixel 8")'),c||t.push("--cloud requires --platform (android or ios)"),p||t.push("--cloud requires --os (the device OS version, e.g. 14.0)"),y?t.push("--app is not supported for cloud runs. Upload the build to your provider \u2014 LambdaTest: POST https://manual-api.lambdatest.com/app/upload/realDevice (-F appFile=@<file>), BrowserStack: POST https://api-cloud.browserstack.com/app-automate/upload (-F file=@<file>) \u2014 then pass the returned id with --app-url. (--app is still supported for local runs, where it clean-reinstalls on the agent device.)"):h||t.push("--cloud requires --app-url <bs://\u2026 | lt://\u2026> (the id from your provider\u2019s app upload API)"),e["app-url"]!==void 0&&(typeof e["app-url"]!="string"||!e["app-url"].trim())&&t.push("--app-url requires a bs:// or lt:// app id"),h&&ee[b]&&(b==="browserstack"&&h.startsWith("lt://")?t.push(`--app-url "${h}" is a LambdaTest app id, but the provider is browserstack`):b==="lambdatest"&&h.startsWith("bs://")&&t.push(`--app-url "${h}" is a BrowserStack app id, but the provider is lambdatest`)),e["cloud-username"]!==void 0&&(typeof e["cloud-username"]!="string"||!e["cloud-username"].trim())&&t.push("--cloud-username requires a value"),e["cloud-access-key"]!==void 0&&(typeof e["cloud-access-key"]!="string"||!e["cloud-access-key"].trim())&&t.push("--cloud-access-key requires a value"),e.caps!==void 0&&(typeof e.caps!="string"||!e.caps.trim())&&t.push("--caps requires a path to a JSON file");let g=ee[b];g&&(T=typeof e["cloud-username"]=="string"&&e["cloud-username"].trim()||n[g.envUsername]||void 0,I=typeof e["cloud-access-key"]=="string"&&e["cloud-access-key"].trim()||n[g.envAccessKey]||void 0,T||t.push(`cloud runs require a username \u2014 pass --cloud-username or set ${g.envUsername} (credentials are never read from your LIME account for CLI runs)`),I||t.push(`cloud runs require an access key \u2014 pass --cloud-access-key or set ${g.envAccessKey}`))}else e.app!==void 0&&(typeof e.app!="string"||!e.app.trim()?t.push("--app requires a path to an APK"):e.device?c&&c!=="android"&&t.push("--app is Android only"):t.push("--app requires --device (lime-cli must connect to a device to reinstall the app)")),e["app-url"]!==void 0&&t.push("--app-url requires --cloud"),e.os!==void 0&&t.push("--os requires --cloud"),e["cloud-username"]!==void 0&&t.push("--cloud-username requires --cloud"),e["cloud-access-key"]!==void 0&&t.push("--cloud-access-key requires --cloud"),e.caps!==void 0&&t.push("--caps requires --cloud");return{errors:t,listDevices:r,keepSession:s,noBoot:i,limeDir:o,device:e.device,platform:c,projectName:l,scenarioKey:d,app:y,cloud:u,cloudProvider:b,cloudUsername:T,cloudAccessKey:I,os:p,appUrl:h,capsPath:A,format:a}}var et=["browserstack","lambdatest","appium"];function xr(e){let n=[],t=[];for(let[r,s]of Object.entries(e||{}))!s||typeof s!="object"||Array.isArray(s)?n.push(`--caps block "${r}" must be a JSON object, e.g. { "${r}": { "someCap": true } }`):et.includes(r)||t.push(`--caps block "${r}" is not one of ${et.join("/")} \u2014 it will be ignored (typo?)`);return{errors:n,warnings:t}}nt.exports={parseArgs:Rr,parseCommand:_r,positionalPaths:kr,validateArgs:Or,extToFilename:$r,validateCapsObject:xr,COMMANDS:tt}});var ot=_((no,it)=>{"use strict";var{DEFAULT_SERVER:Nr}=D(),st={export:`lime-cli export \u2014 work out what this repo is, and where the test belongs.
2
+ "use strict";var _=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(t){throw n=0,t}};var ue=_((Gi,Fn)=>{Fn.exports={name:"@taqwright/lime-cli",version:"0.12.1",description:"Thin CLI client for the LIME server \u2014 fire a natural-language QA Agent goal against a connected device and write back a taqwright spec.",license:"SEE LICENSE IN LICENSE",author:"Taqwright",homepage:"https://www.taqwright.ai",bugs:{url:"https://www.taqwright.ai/contact"},keywords:["appium","mobile-testing","e2e","qa","test-automation","taqwright","lime","cli"],bin:{"lime-cli":"dist/index.js"},main:"dist/index.js",files:["dist"],publishConfig:{access:"public"},scripts:{"lime-cli":"node src/index.js",start:"node src/index.js",test:"node --test test/*.test.js",bundle:"esbuild src/index.js --bundle --platform=node --target=node18 --minify --outfile=dist/index.js",prepack:"npm run bundle",prepublishOnly:"npm test"},engines:{node:">=18"},devDependencies:{esbuild:"^0.28.1"}}});var D=_((Ji,Me)=>{"use strict";var Kn="https://www.taqwright.ai";Me.exports={POLL_INTERVAL_MS:1e3,POLL_TIMEOUT_MS:18e5,BOOT_POLL_INTERVAL_MS:5e3,BOOT_TIMEOUT_MS:3e5,CONNECT_POLL_INTERVAL_MS:2e3,CONNECT_TIMEOUT_MS:3e5,DEFAULT_SERVER:Kn,HTTP_TIMEOUT_MS:3e5,MAX_RESPONSE_BYTES:52428800}});var Z=_((Xi,Ke)=>{"use strict";var{URL:Hn}=require("url"),{HTTP_TIMEOUT_MS:qe,MAX_RESPONSE_BYTES:Ue}=D(),{version:Vn}=ue();function Be(e){let n=String(e||"").replace(/^\[|\]$/g,"").toLowerCase();return n==="localhost"||n==="127.0.0.1"||n==="::1"||n.endsWith(".localhost")}var Wn=["just a moment","attention required! | cloudflare","checking your browser","/cdn-cgi/challenge-platform","cf-error-details","cf-browser-verification","_incapsula_resource"];function Fe(e,n){if(!n||typeof n!="string")return null;let t=n.slice(0,4e3).toLowerCase();return Wn.some(r=>t.includes(r))?`the LIME server is behind a bot challenge that blocked this request (HTTP ${e}). The request never reached LIME \u2014 it was stopped at the edge, so your token and arguments are probably fine. CI runners use datacenter IPs, which Cloudflare's Bot Fight Mode challenges by default; it cannot be excepted with a WAF skip rule, so the server's operator has to turn it off or move to Super Bot Fight Mode (which supports skip rules) for the /api/ paths.`:null}var pe=class{constructor(n,t){this.server=n,this.token=t,this.update=null}_url(n){return/^https?:\/\//i.test(n)?n:`${this.server}${n}`}json(n,t,r,s={}){let i=r?JSON.stringify(r):null,o={...s};return i&&(o["Content-Type"]="application/json",o["Content-Length"]=Buffer.byteLength(i)),this._send(n,this._url(t),o,i)}raw(n,t,r,s={}){let i={...s,"Content-Type":"application/octet-stream","Content-Length":r.length};return this._send(n,this._url(t),i,r)}_send(n,t,r,s){let i=new Hn(t);if(i.protocol==="http:"&&!Be(i.hostname))return Promise.reject(new Error(`refusing to send your LIME_CI_TOKEN over cleartext http to ${i.hostname} \u2014 use https (http is allowed only for localhost).`));let o=i.protocol==="https:"?require("https"):require("http"),a={method:n,hostname:i.hostname,port:i.port||(i.protocol==="https:"?443:80),path:i.pathname+(i.search||""),headers:{...r,Authorization:`Bearer ${this.token}`,Origin:`${i.protocol}//${i.host}`,"X-Lime-Cli-Version":Vn}};return new Promise((l,d)=>{let c=o.request(a,u=>{let p=u.headers["x-lime-cli-update"];p&&(this.update={status:String(p),latest:u.headers["x-lime-cli-latest"]||null});let h="",y=0;u.setEncoding("utf8"),u.on("data",A=>{if(y+=Buffer.byteLength(A),y>Ue){c.destroy(new Error(`Server response exceeded ${Ue} bytes`));return}h+=A}),u.on("end",()=>{let A;try{A=h?JSON.parse(h):{}}catch{let T=Fe(u.statusCode,h);return d(new Error(T||`Server returned non-JSON (${u.statusCode}): ${h.substring(0,200)}`))}l({status:u.statusCode,body:A})})});c.setTimeout(qe,()=>{c.destroy(new Error(`request timed out after ${qe/1e3}s`))}),c.on("error",d),s&&c.write(s),c.end()})}};function Yn(e,n){if(!e.body||!e.body.success)throw new Error(`${n} \u2014 ${e.body&&e.body.error||"unknown"}`);return e.body}Ke.exports={isLoopbackHost:Be,HttpClient:pe,expectSuccess:Yn,describeEdgeBlock:Fe}});var Ve=_((zi,He)=>{"use strict";var he="npm install -g @taqwright/lime-cli@latest",Gn=/^\d+\.\d+\.\d+([-.+][0-9A-Za-z.-]{1,20})?$/;function Jn({status:e,current:n,latest:t,env:r=process.env}){return r.LIME_NO_UPDATE_NOTICE==="1"?null:e==="required"?`lime-cli: ${n} is no longer supported by this server. Run: ${he}`:e==="available"&&typeof t=="string"&&Gn.test(t)?`lime-cli: update available: ${n} \u2192 ${t}. Run: ${he}`:null}He.exports={formatUpdateNotice:Jn,INSTALL_COMMAND:he}});var M=_((Zi,We)=>{"use strict";var Xn={browserstack:{label:"BrowserStack",envUsername:"BROWSERSTACK_USERNAME",envAccessKey:"BROWSERSTACK_ACCESS_KEY",hubHost:"hub.browserstack.com"},lambdatest:{label:"LambdaTest",envUsername:"LT_USERNAME",envAccessKey:"LT_ACCESS_KEY",hubHost:"mobile-hub.lambdatest.com"}};function zn({provider:e,platform:n,device:t,os:r,appUrl:s,username:i,accessKey:o,capabilities:a}){let l={connectionMode:"cloud",cloudProvider:e||"browserstack",cloudUsername:i,cloudAccessKey:o,platform:n,deviceName:t,deviceOsVersion:r,cloudAppUrl:s,automationName:n==="ios"?"XCUITest":"UiAutomator2"};return a&&(l.cloudCapabilities=a),l}We.exports={CLOUD_PROVIDERS:Xn,buildCloudSettingsPayload:zn}});var ge=_((Qi,Ge)=>{"use strict";var Q=require("fs"),fe=require("path"),Zn=["taqwright","webdriverio-js","appium-java-junit5","appium-python-pytest","appium-ruby-rspec","appium-csharp-nunit"],Qn={taqwright:"deterministic","webdriverio-js":"gemini","appium-java-junit5":"gemini","appium-python-pytest":"gemini","appium-ruby-rspec":"gemini","appium-csharp-nunit":"gemini"},P={taqwright:"taqwright (native)","webdriverio-js":"WebdriverIO (JavaScript)","appium-java-junit5":"Appium Java (JUnit 5)","appium-python-pytest":"Appium Python (pytest)","appium-ruby-rspec":"Appium Ruby (RSpec)","appium-csharp-nunit":"Appium C# (NUnit)"},er=5*1024*1024,me={exists:e=>Q.existsSync(e),readText:e=>{try{return Q.statSync(e).size>er?null:Q.readFileSync(e,"utf8")}catch{return null}},list:e=>{try{return Q.readdirSync(e)}catch{return[]}}};function tr(e,n){let t=e.readText(fe.join(n,"package.json"));if(!t)return{};try{let r=JSON.parse(t);return{...r.dependencies||{},...r.devDependencies||{}}}catch{return{}}}var nr=new Set(["node_modules","dist","build","target","bin","obj","vendor","out","coverage"]);function rr(e,n){let t=new Set([""]),r=[];try{r=e.list(n)}catch{r=[]}for(let s of r)s.startsWith(".")||nr.has(s)||t.add(s);return[...t]}function sr(e,n,t){let r=t?fe.join(n,t):n,s=u=>fe.join(r,u),i=u=>t?`${t}/${u}`:u,o=[],a=tr(e,r),l=[];try{l=e.list(r)}catch{l=[]}(a["@taqwright/taqwright"]||a.taqwright||e.exists(s("taqwright.config.ts"))||e.exists(s("taqwright.config.js")))&&o.push({id:"taqwright",label:P.taqwright,reason:"taqwright dependency/config found",manifest:i("package.json")});let d=l.some(u=>/^wdio\.conf\.(js|ts|mjs|cjs)$/.test(u));(a.webdriverio||a["@wdio/cli"]||d)&&o.push({id:"webdriverio-js",label:P["webdriverio-js"],reason:d?"wdio.conf.* found":"webdriverio dependency found",manifest:i("package.json")});for(let u of["pom.xml","build.gradle","build.gradle.kts"]){let p=e.readText(s(u));if(p&&/io\.appium|java-client/.test(p)){o.push({id:"appium-java-junit5",label:P["appium-java-junit5"],reason:`io.appium:java-client in ${i(u)}`,manifest:i(u)});break}}for(let u of["requirements.txt","pyproject.toml"]){let p=e.readText(s(u));if(p&&/appium-python-client/i.test(p)){o.push({id:"appium-python-pytest",label:P["appium-python-pytest"],reason:`Appium-Python-Client in ${i(u)}`,manifest:i(u)});break}}let c=e.readText(s("Gemfile"));c&&/appium_lib(_core)?/.test(c)&&o.push({id:"appium-ruby-rspec",label:P["appium-ruby-rspec"],reason:"appium_lib in Gemfile",manifest:i("Gemfile")});for(let u of l){if(!/\.csproj$/i.test(u))continue;let p=e.readText(s(u));if(p&&/Appium\.WebDriver/i.test(p)){o.push({id:"appium-csharp-nunit",label:P["appium-csharp-nunit"],reason:`Appium.WebDriver in ${i(u)}`,manifest:i(u)});break}}return o}function Ye(e,n=me){let t=new Map;for(let r of rr(n,e))for(let s of sr(n,e,r))t.has(s.id)||t.set(s.id,s);return[...t.values()]}function ir(e,n=me){let t=Ye(e,n);return t.some(r=>r.id==="taqwright")||t.push({id:"taqwright",label:P.taqwright,reason:"default output"}),t}function or(e){let{requested:n,configured:t,remembered:r,offeredIds:s,detectedRealIds:i,taqwrightDetected:o,javaSignal:a}=e,l=d=>!!d&&s.includes(d);return l(n)?n:l(t)?t:l(r)&&(i.includes(r)||r==="taqwright"&&o)?r:i.length?i[0]:o?"taqwright":a?"appium-java-junit5":"taqwright"}Ge.exports={FRAMEWORK_IDS:Zn,FRAMEWORK_ENGINES:Qn,FRAMEWORK_LABELS:P,nodeFs:me,detectFrameworks:Ye,rankFrameworks:ir,pickDefaultFramework:or}});var Se=_((eo,Qe)=>{"use strict";var we=require("path"),{nodeFs:ar}=ge(),Je={taqwright:"tests","webdriverio-js":"test/specs","appium-java-junit5":"src/test/java","appium-python-pytest":"tests","appium-ruby-rspec":"spec","appium-csharp-nunit":"Tests"},cr="tests",lr={taqwright:".spec.ts","webdriverio-js":".spec.ts","appium-java-junit5":".java","appium-python-pytest":".py","appium-ruby-rspec":"_spec.rb","appium-csharp-nunit":".cs"},dr=new Set(["appium-python-pytest","appium-ruby-rspec"]);function ye(e){return Je[e]||cr}function be(e){let n=(e||"").split(/[^A-Za-z0-9]+/).filter(Boolean);return n.length?n.map(t=>/^[A-Z0-9]+$/.test(t)?t[0]+t.slice(1).toLowerCase():t[0].toUpperCase()+t.slice(1)).join(""):""}function Ee(e){return(e||"").replace(/([a-z0-9])([A-Z])/g,"$1_$2").split(/[^A-Za-z0-9]+/).filter(Boolean).join("_").toLowerCase()}function ur(e){return Ee(e).split("_").filter(Boolean).join("-")}var pr=6,hr=new Set(["and","or","the","a","an","to","of","in","on","at","as","with","for","then","into","from","by","that","is"]),fr=/@|\d{6,}/;function mr(e){let n=String(e||"").trim().split(/\s+/).filter(Boolean).filter(t=>!fr.test(t)).slice(0,pr);for(;n.length>1&&hr.has(n[n.length-1].toLowerCase());)n.pop();return be(n.join(" "))||"RecordedTest"}function gr(e){let n=String(e||"").trim();return n?/[A-Za-z]/.test(n)?n.length>80?"Keep the name under 80 characters.":/[/\\]/.test(n)?"Use the destination field for the folder.":null:"Use at least one letter.":"Enter a test name."}function wr(e){if(e==null||e==="")return null;let n=String(e);return n!==n.trim()?"must not have leading or trailing spaces.":n.length>120?"is longer than any key LIME mints (120 characters).":/^[a-z0-9][a-z0-9._/:-]*$/.test(n)?n.includes("..")?'must not contain "..".':null:"is not a scenario key \u2014 expected lower-case letters, digits and . _ - / : only."}function Xe(e,n){let t;return dr.has(e)?t=Ee(n):t=be(n),`${t}${lr[e]||""}`}function H(e){return String(e||"").split(/[/\\]+/).filter(n=>n&&n!=="."&&n!=="..").join("/")}function yr(e){if(e==null)return null;let n=String(e);return n.trim()===""?null:/^([A-Za-z]:)?[/\\]/.test(n)?"must be a path inside the project, not an absolute path.":n.split(/[/\\]+/).includes("..")?'must not contain ".." \u2014 the test belongs inside the project.':null}function ve(e){let n=H(e).split("/");return n.pop(),n.join("/")}function ze(e){let n=/(?:^|\/)src\/(?:test|main)\/java\/(.+)$/.exec(H(e));return n&&n[1].split("/").filter(Boolean).join(".")||void 0}function br(e){let n=H(e),t=n.search(/\/src\/(?:test|main)\/java(?:\/|$)/);return t>0?n.slice(0,t):""}function Er(e){let n=new Map;for(let r of e){let s=ve(r);n.set(s,(n.get(s)||0)+1)}if(!n.size)return null;let t=[...n.entries()].sort((r,s)=>s[1]-r[1]||r[0].localeCompare(s[0]));return{dir:t[0][0],count:t[0][1]}}var Ze={taqwright:{segment:"tests",file:/\.spec\.(ts|js)$/},"webdriverio-js":{segment:"test/specs",file:/\.(ts|js)$/},"appium-java-junit5":{segment:"src/test/java",file:/\.java$/},"appium-python-pytest":{segment:"tests",file:/^(test_.+|.+_test)\.py$/},"appium-ruby-rspec":{segment:"spec",file:/_spec\.rb$/},"appium-csharp-nunit":{segment:"",file:/Tests\.cs$/}},vr=new Set(["node_modules","dist","build","target","bin","obj","vendor","out","coverage",".git"]),Sr=2e4;function Tr(e,n,t=ar){let r=Ze[n];if(!r)return[];let s=[],i=Sr,o=a=>{if(i<=0)return;let l=a?we.join(e,a):e,d=[];try{d=t.list(l)}catch{return}for(let c of d){if(i--<=0)return;if(c.startsWith(".")||vr.has(c))continue;let u=a?`${a}/${c}`:c;if(t.isDir?t.isDir(we.join(e,u)):t.list(we.join(e,u)).length>0){o(u);continue}r.file.test(c)&&(r.segment&&!`/${ve(u)}/`.includes(`/${r.segment}/`)||s.push(u))}};return o(""),s.sort()}function Ar(e){let{framework:n,testName:t}=e,r=Xe(n,t),s=(a,l,d=0)=>{let c=H(a),u=n==="appium-java-junit5"?ze(c):void 0;return{dir:c,fileName:r,...u?{packageName:u}:{},source:l,neighbourCount:d}};if(e.remembered!=null)return s(e.remembered,"remembered");let i=Er(e.existingTests||[]);if(i&&i.dir)return s(i.dir,"existing",i.count);let o=e.detection&&e.detection.manifest?ve(e.detection.manifest):"";return o?s(`${o}/${ye(n)}`,"module"):s(ye(n),"convention")}Qe.exports={CONVENTIONAL_DIRS:Je,TEST_PATTERNS:Ze,conventionalDir:ye,pascalCase:be,snakeCase:Ee,kebabCase:ur,testNameFromGoal:mr,validateTestName:gr,validateDest:yr,validateScenarioKey:wr,fileNameFor:Xe,normalizeDir:H,javaPackageOf:ze,moduleRootOf:br,findExistingTests:Tr,resolveExportTarget:Ar}});var rt=_((to,nt)=>{"use strict";var{CLOUD_PROVIDERS:ee}=M(),{validateScenarioKey:Ir}=Se();function Rr(e){let n=Object.create(null);for(let t=0;t<e.length;t++){let r=e[t];if(!r.startsWith("--"))continue;let s=r.slice(2),i=e[t+1];i===void 0||i.startsWith("--")?n[s]=!0:(n[s]=i,t++)}return n}var tt=["export","adapt","verify","check-locators","check-pom","disconnect","report"];function kr(e){let n=Array.isArray(e)?e:[],t=[];for(let r=0;r<n.length;r+=1){let s=String(n[r]==null?"":n[r]);!s||s.startsWith("-")||(r>0?String(n[r-1]||""):"").startsWith("--")||t.push(s)}return t}function _r(e){let n=e[0];return n&&tt.includes(n)?{command:n,rest:e.slice(1)}:{command:"run",rest:e}}function $r(e="taqwright"){return e==="json"?"recorded-steps.json":"RecordedTest.spec.ts"}function Or(e,n=process.env){let t=[],r=!!e["list-devices"],s=!!e["keep-session"],i=!!e["no-boot"],o=e["lime-dir"]===!0?".lime":typeof e["lime-dir"]=="string"&&e["lime-dir"].trim()?e["lime-dir"].trim():void 0,a=e.format?String(e.format).toLowerCase():"taqwright";if(["taqwright","json"].includes(a)||t.push(`--format must be taqwright or json (got "${e.format}")`),r)return{errors:t,listDevices:r,keepSession:s,noBoot:i,format:a,limeDir:o};(!e.goal||typeof e.goal!="string"||!e.goal.trim())&&t.push("--goal is required");let l;e.project!==void 0&&(typeof e.project!="string"||!e.project.trim()?t.push("--project requires a project name"):l=e.project.trim());let d;if(e.scenario!==void 0){let g=typeof e.scenario=="string"?e.scenario.trim():"",w=g?Ir(g):"requires a scenario key";w?t.push(`--scenario ${w}`):d=g}for(let g of["gemini-key","qwen-key"])e[g]!==void 0&&t.push(`--${g} is no longer supported: runs use the AI key provisioned for your LIME account`);if(e["max-steps"]!==void 0){let g=Number(e["max-steps"]);(!Number.isFinite(g)||g<1||g>200)&&t.push("--max-steps must be a number between 1 and 200")}let c;e.platform&&(c=String(e.platform).toLowerCase(),["android","ios"].includes(c)||t.push(`--platform must be android or ios (got "${e.platform}")`));let u=!!e.cloud,p=typeof e.os=="string"?e.os:void 0,h=typeof e["app-url"]=="string"?e["app-url"]:void 0,y=typeof e.app=="string"?e.app:void 0,A=typeof e.caps=="string"&&e.caps.trim()?e.caps.trim():void 0,b,T,I;if(u&&(b=e.cloud===!0?"browserstack":String(e.cloud).toLowerCase(),ee[b]||t.push(`--cloud must be ${Object.keys(ee).join(" or ")} (got "${e.cloud}")`)),u){(!e.device||typeof e.device!="string")&&t.push('--cloud requires --device (the cloud device name, e.g. "Google Pixel 8")'),c||t.push("--cloud requires --platform (android or ios)"),p||t.push("--cloud requires --os (the device OS version, e.g. 14.0)"),y?t.push("--app is not supported for cloud runs. Upload the build to your provider \u2014 LambdaTest: POST https://manual-api.lambdatest.com/app/upload/realDevice (-F appFile=@<file>), BrowserStack: POST https://api-cloud.browserstack.com/app-automate/upload (-F file=@<file>) \u2014 then pass the returned id with --app-url. (--app is still supported for local runs, where it clean-reinstalls on the agent device.)"):h||t.push("--cloud requires --app-url <bs://\u2026 | lt://\u2026> (the id from your provider\u2019s app upload API)"),e["app-url"]!==void 0&&(typeof e["app-url"]!="string"||!e["app-url"].trim())&&t.push("--app-url requires a bs:// or lt:// app id"),h&&ee[b]&&(b==="browserstack"&&h.startsWith("lt://")?t.push(`--app-url "${h}" is a LambdaTest app id, but the provider is browserstack`):b==="lambdatest"&&h.startsWith("bs://")&&t.push(`--app-url "${h}" is a BrowserStack app id, but the provider is lambdatest`)),e["cloud-username"]!==void 0&&(typeof e["cloud-username"]!="string"||!e["cloud-username"].trim())&&t.push("--cloud-username requires a value"),e["cloud-access-key"]!==void 0&&(typeof e["cloud-access-key"]!="string"||!e["cloud-access-key"].trim())&&t.push("--cloud-access-key requires a value"),e.caps!==void 0&&(typeof e.caps!="string"||!e.caps.trim())&&t.push("--caps requires a path to a JSON file");let g=ee[b];g&&(T=typeof e["cloud-username"]=="string"&&e["cloud-username"].trim()||n[g.envUsername]||void 0,I=typeof e["cloud-access-key"]=="string"&&e["cloud-access-key"].trim()||n[g.envAccessKey]||void 0,T||t.push(`cloud runs require a username \u2014 pass --cloud-username or set ${g.envUsername} (credentials are never read from your LIME account for CLI runs)`),I||t.push(`cloud runs require an access key \u2014 pass --cloud-access-key or set ${g.envAccessKey}`))}else e.app!==void 0&&(typeof e.app!="string"||!e.app.trim()?t.push("--app requires a path to an APK"):e.device?c&&c!=="android"&&t.push("--app is Android only"):t.push("--app requires --device (lime-cli must connect to a device to reinstall the app)")),e["app-url"]!==void 0&&t.push("--app-url requires --cloud"),e.os!==void 0&&t.push("--os requires --cloud"),e["cloud-username"]!==void 0&&t.push("--cloud-username requires --cloud"),e["cloud-access-key"]!==void 0&&t.push("--cloud-access-key requires --cloud"),e.caps!==void 0&&t.push("--caps requires --cloud");return{errors:t,listDevices:r,keepSession:s,noBoot:i,limeDir:o,device:e.device,platform:c,projectName:l,scenarioKey:d,app:y,cloud:u,cloudProvider:b,cloudUsername:T,cloudAccessKey:I,os:p,appUrl:h,capsPath:A,format:a}}var et=["browserstack","lambdatest","appium"];function xr(e){let n=[],t=[];for(let[r,s]of Object.entries(e||{}))!s||typeof s!="object"||Array.isArray(s)?n.push(`--caps block "${r}" must be a JSON object, e.g. { "${r}": { "someCap": true } }`):et.includes(r)||t.push(`--caps block "${r}" is not one of ${et.join("/")} \u2014 it will be ignored (typo?)`);return{errors:n,warnings:t}}nt.exports={parseArgs:Rr,parseCommand:_r,positionalPaths:kr,validateArgs:Or,extToFilename:$r,validateCapsObject:xr,COMMANDS:tt}});var ot=_((no,it)=>{"use strict";var{DEFAULT_SERVER:Nr}=D(),st={export:`lime-cli export \u2014 work out what this repo is, and where the test belongs.
3
3
 
4
4
  Detects the test framework from the project's own manifests (pytest, JUnit, RSpec, WebdriverIO,
5
5
  C#, taqwright), picks the directory its existing tests live in, and writes the adaptation brief.
@@ -379,7 +379,7 @@ ${dt(e)}`);if(t&&o.platform!==t)throw new Error(`Device "${n}" matched on ${o.pl
379
379
  `)}function ss(e){if(!e)return null;let n=new RegExp(`${ie}\\s*:\\s*(PASS|FAIL)`,"i").exec(e);return n?n[1].toUpperCase()==="PASS":null}function vt(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,final:!1}}function C(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function is(e){return e.type==="assistant"?(e.message||{}).usage||{}:e.usage||{}}function St(e,n){if(!n||typeof n!="object"||n.type!=="assistant"&&n.type!=="result")return e;let t=is(n);if(n.type==="result"){let r=!!n.usage&&typeof n.usage=="object";return{inputTokens:r?C(t.input_tokens):e.inputTokens,outputTokens:r?C(t.output_tokens):e.outputTokens,cacheReadTokens:r?C(t.cache_read_input_tokens):e.cacheReadTokens,cacheCreationTokens:r?C(t.cache_creation_input_tokens):e.cacheCreationTokens,costUsd:C(n.total_cost_usd),durationMs:C(n.duration_ms),turns:C(n.num_turns),final:!0}}return{...e,inputTokens:e.inputTokens+C(t.input_tokens),outputTokens:e.outputTokens+C(t.output_tokens),cacheReadTokens:e.cacheReadTokens+C(t.cache_read_input_tokens),cacheCreationTokens:e.cacheCreationTokens+C(t.cache_creation_input_tokens)}}function se(e){let n=Math.max(0,Math.round(C(e)));return n<1e3?String(n):n<1e6?`${(n/1e3).toFixed(1)}k`:`${(n/1e6).toFixed(1)}M`}function os(e){let n=[`\u2191 ${se(e.inputTokens)}`,`\u2193 ${se(e.outputTokens)}`],t=e.cacheReadTokens+e.cacheCreationTokens;t>0&&n.push(`cache ${se(t)}`);let r=n.join(" ");if(e.final){let s=[];typeof e.durationMs=="number"&&e.durationMs>0&&s.push(`${(e.durationMs/1e3).toFixed(1)}s`),typeof e.turns=="number"&&e.turns>0&&s.push(`${e.turns} turn${e.turns===1?"":"s"}`),s.length&&(r+=` \xB7 ${s.join(" \xB7 ")}`)}return r}function as(e,n){if(e!=="Edit"&&e!=="MultiEdit"&&e!=="Write"&&e!=="NotebookEdit")return null;let t=n||{},r=t.file_path||t.path;return r&&String(r).trim()?r:null}function cs(e,n){let t=n||{},r=t.file_path||t.path;switch(e){case"Edit":case"MultiEdit":case"Write":case"NotebookEdit":return r?`Editing ${r}`:"Editing a file";case"Read":return r?`Reading ${r}`:"Reading a file";case"Bash":return t.command?`Running: ${String(t.command).slice(0,80)}`:"Running a command";case"Grep":return t.pattern?`Searching for ${t.pattern}`:"Searching";case"Glob":return t.pattern?`Finding ${t.pattern}`:"Finding files";default:return e||"Working"}}function ls(){let e=vt();return{push(n){let t;try{t=JSON.parse(n)}catch{return null}if(!t||typeof t!="object")return null;let r={};if(t.type==="assistant"&&t.message&&Array.isArray(t.message.content)){let s=[],i=[];for(let o of t.message.content)if(o&&o.type==="text"&&typeof o.text=="string"&&o.text.trim())s.push({kind:"text",text:o.text.trim()});else if(o&&o.type==="tool_use"){let a=String(o.name||"");s.push({kind:"tool",text:cs(a,o.input)});let l=as(a,o.input);l&&i.push(l)}s.length&&(r.entries=s),i.length&&(r.files=i)}else t.type==="result"&&typeof t.result=="string"&&(r.summary=t.result);return(t.type==="assistant"||t.type==="result")&&(e=St(e,t),r.usage=e),r}}}var Tt={id:"claude-code",label:"Claude Code",probe:["claude","--version"],buildInvocation(e){return{command:"claude",args:["-p",`Read ${e} and follow it exactly to adapt the generated test to this project.`]}},buildStreamInvocation(e,n="acceptEdits",t=[]){return{command:"claude",args:["-p",`Read ${e} and follow it exactly.`,"--output-format","stream-json","--verbose","--permission-mode",n,...t.flatMap(r=>["--add-dir",r])]}},createParser:ls};function ds(){let e=[];return{push(t){let r=t.trim();return r?(e.push(r),e.length>400&&e.shift(),{entries:[{kind:"text",text:r}]}):null},finish(){return e.length?{summary:e.join(`
380
380
  `)}:null}}}var At={id:"copilot",label:"GitHub Copilot CLI",probe:["copilot","--version"],buildInvocation(e){return{command:"copilot",args:["-p",`Read ${e} and follow it exactly to adapt the generated test to this project.`]}},buildStreamInvocation(e,n="acceptEdits",t=[]){let r=["-p",`Read ${e} and follow it exactly.`,"--allow-all-tools","--allow-all-paths","--allow-all-urls"];n==="bypassPermissions"&&r.push("--autopilot","--max-autopilot-continues","20");for(let s of t)r.push("--add-dir",s);return{command:"copilot",args:r}},createParser:ds},It=[Tt,At];function us(e,n=It){for(let t of n){let r=e(t.probe[0]);if(r)return{adapter:t,binPath:r}}return null}Rt.exports={ADAPT_BRIEF_PATH:es,RECORDED_STEPS_PATH:V,VERIFY_BRIEF_PATH:ts,VERIFY_TARGET_PATH:bt,APP_DOCS_DIR:Et,VERIFY_RESULT_MARKER:ie,normalizePlatform:Ie,buildAdaptBrief:ns,buildVerifyBrief:rs,parseVerifyResult:ss,emptyUsage:vt,accumulate:St,formatTokens:se,formatUsageLine:os,claudeCodeAdapter:Tt,copilotCliAdapter:At,ADAPTERS:It,resolveAdapter:us}});var Ot=_((ao,$t)=>{"use strict";var{spawn:ps}=require("child_process"),kt=require("path"),{CLOUD_PROVIDERS:hs}=M(),{stripControl:fs}=re(),ms=["LIME_CI_TOKEN","GEMINI_API_KEY","QWEN_API_KEY"];function gs(){return Object.values(hs).flatMap(e=>[e.envUsername,e.envAccessKey])}function _t(e=process.env){let n=new Set([...ms,...gs()]),t={};for(let[r,s]of Object.entries(e))n.has(r)||(t[r]=s);return t}function ws(e,n=process.env){let t=require("fs"),r=(n.PATH||"").split(kt.delimiter).filter(Boolean),s=process.platform==="win32"?(n.PATHEXT||".EXE;.CMD;.BAT").split(";"):[""];for(let i of r)for(let o of s){let a=kt.join(i,e+o);try{return t.accessSync(a,t.constants.X_OK),a}catch{}}return null}function ys(e){let{adapter:n,binPath:t,briefPath:r,cwd:s,permissionMode:i="acceptEdits",addDirs:o=[],env:a={},spawn:l=ps,onEntry:d=null,write:c=T=>process.stdout.write(T)}=e,{args:u}=n.buildStreamInvocation(r,i,o),p=n.createParser(),h=[],y=null,A="",b="";return new Promise(T=>{let I;try{I=l(t,u,{cwd:s,env:{..._t(process.env),...a},stdio:["ignore","pipe","pipe"]})}catch(m){return T({code:1,summary:"",files:h,usage:y,stderr:b,error:m.message})}let g=m=>{if(m){for(let v of m.entries||[])c(` ${v.kind==="tool"?"\xB7":"\u203A"} ${fs(v.text)}
381
381
  `),d&&d(v);for(let v of m.files||[])h.includes(v)||h.push(v);m.usage&&(y=m.usage),typeof m.summary=="string"&&(A=m.summary)}},w="";I.stdout.on("data",m=>{w+=m.toString("utf8");let v;for(;(v=w.indexOf(`
382
- `))!==-1;){let O=w.slice(0,v).replace(/\r$/,"");w=w.slice(v+1),O&&g(p.push(O))}}),I.stderr.on("data",m=>{b+=m.toString("utf8")});let E=!1,S=m=>{E||(E=!0,T(m))};I.on("error",m=>{S({code:1,summary:A,files:h,usage:y,stderr:b,error:m.message})}),I.on("close",m=>{w.trim()&&g(p.push(w.trim())),p.finish&&g(p.finish()),S({code:m===null?1:m,summary:A,files:h,usage:y,stderr:b,error:null})})})}$t.exports={runAgent:ys,resolveBin:ws,scrubEnv:_t}});var Pt=_((co,jt)=>{"use strict";var f=String.raw`(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")`;function bs(e){return String(e??"").replace(/\\(.)/g,"$1")}var oe={taqwright:[{re:new RegExp(String.raw`getByLabel\(\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`getByText\(\s*${f}`,"g"),using:"xpath",wrap:e=>`//*[@text='${e}']`},{re:new RegExp(String.raw`getByPlaceholder\(\s*${f}`,"g"),using:"xpath",wrap:e=>`//*[@hint='${e}']`},{re:new RegExp(String.raw`getById\(\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`getByXpath\(\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`getByUiSelector\(\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`getByClassChain\(\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`getByPredicate\(\s*${f}`,"g"),using:"-ios predicate string"}],"appium-python-pytest":[{re:new RegExp(String.raw`ACCESSIBILITY_ID\s*,\s*value\s*=\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`\bXPATH\s*,\s*value\s*=\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bID\s*,\s*value\s*=\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`ANDROID_UIAUTOMATOR\s*,\s*value\s*=\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`IOS_CLASS_CHAIN\s*,\s*value\s*=\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`IOS_PREDICATE\s*,\s*value\s*=\s*${f}`,"g"),using:"-ios predicate string"},{re:new RegExp(String.raw`ACCESSIBILITY_ID\s*,\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`\bXPATH\s*,\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bID\s*,\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`ANDROID_UIAUTOMATOR\s*,\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`IOS_CLASS_CHAIN\s*,\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`IOS_PREDICATE\s*,\s*${f}`,"g"),using:"-ios predicate string"}],"appium-java-junit5":[{re:new RegExp(String.raw`accessibility\s*=\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`uiAutomator\s*=\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`iOSNsPredicate\s*=\s*${f}`,"g"),using:"-ios predicate string"},{re:new RegExp(String.raw`iOSClassChain\s*=\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`xpath\s*=\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bid\s*=\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`AccessibilityId\(\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`AndroidUIAutomator\(\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`accessibilityId\(\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`\bxpath\(\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bid\(\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`androidUIAutomator\(\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`iOSClassChain\(\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`iOSNsPredicateString\(\s*${f}`,"g"),using:"-ios predicate string"}],"appium-ruby-rspec":[{re:new RegExp(String.raw`accessibility_id:\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`xpath:\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bid:\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`uiautomator:\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`class_chain:\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`predicate:\s*${f}`,"g"),using:"-ios predicate string"},{re:new RegExp(String.raw`:accessibility_id\s*,\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`:xpath\s*,\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`:id\s*,\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`:uiautomator\s*,\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`:class_chain\s*,\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`:predicate\s*,\s*${f}`,"g"),using:"-ios predicate string"}],"appium-csharp-nunit":[{re:new RegExp(String.raw`AccessibilityId\(\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`XPath\(\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bId\(\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`AndroidUIAutomator\(\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`IosClassChain\(\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`IosNSPredicate\(\s*${f}`,"g"),using:"-ios predicate string"}],"webdriverio-js":[{re:new RegExp(String.raw`\$\(\s*${f}`,"g"),using:null}]},xt={taqwright:/\.getBy[A-Z]\w*\s*\(/,"appium-python-pytest":/\bfind_elements?\s*\(/,"appium-java-junit5":/\bfindElements?\s*\(|@\w*FindBy\s*\(/,"appium-ruby-rspec":/\bfind_elements?\s*\(/,"appium-csharp-nunit":/\bFindElements?\s*\(/,"webdriverio-js":/\$\$?\s*\(/};function Nt(e,n){let t=xt[n];if(!t)return[];let r=[];for(let s of String(e??"").split(`
382
+ `))!==-1;){let O=w.slice(0,v).replace(/\r$/,"");w=w.slice(v+1),O&&g(p.push(O))}}),I.stderr.on("data",m=>{b+=m.toString("utf8")});let E=!1,S=m=>{E||(E=!0,T(m))};I.on("error",m=>{S({code:1,summary:A,files:h,usage:y,stderr:b,error:m.message})}),I.on("close",m=>{w.trim()&&g(p.push(w.trim())),p.finish&&g(p.finish()),S({code:m===null?1:m,summary:A,files:h,usage:y,stderr:b,error:null})})})}$t.exports={runAgent:ys,resolveBin:ws,scrubEnv:_t}});var Pt=_((co,jt)=>{"use strict";var f=String.raw`(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")`;function bs(e){return String(e??"").replace(/\\(.)/g,"$1")}var oe={taqwright:[{re:new RegExp(String.raw`getByLabel\(\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`getByText\(\s*${f}`,"g"),using:"xpath",wrap:e=>`//*[@text='${e}']`},{re:new RegExp(String.raw`getByPlaceholder\(\s*${f}`,"g"),using:"xpath",wrap:e=>`//*[@hint='${e}']`},{re:new RegExp(String.raw`getById\(\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`getByXpath\(\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`getByUiSelector\(\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`getByClassChain\(\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`getByPredicate\(\s*${f}`,"g"),using:"-ios predicate string"}],"appium-python-pytest":[{re:new RegExp(String.raw`ACCESSIBILITY_ID\s*,\s*value\s*=\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`\bXPATH\s*,\s*value\s*=\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bID\s*,\s*value\s*=\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`ANDROID_UIAUTOMATOR\s*,\s*value\s*=\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`IOS_CLASS_CHAIN\s*,\s*value\s*=\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`IOS_PREDICATE\s*,\s*value\s*=\s*${f}`,"g"),using:"-ios predicate string"},{re:new RegExp(String.raw`ACCESSIBILITY_ID\s*,\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`\bXPATH\s*,\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bID\s*,\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`ANDROID_UIAUTOMATOR\s*,\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`IOS_CLASS_CHAIN\s*,\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`IOS_PREDICATE\s*,\s*${f}`,"g"),using:"-ios predicate string"}],"appium-java-junit5":[{re:new RegExp(String.raw`(?<=[(,]\s*)accessibility\s*=\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`(?<=[(,]\s*)uiAutomator\s*=\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`(?<=[(,]\s*)iOSNsPredicate\s*=\s*${f}`,"g"),using:"-ios predicate string"},{re:new RegExp(String.raw`(?<=[(,]\s*)iOSClassChain\s*=\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`(?<=[(,]\s*)xpath\s*=\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`(?<=[(,]\s*)id\s*=\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`AccessibilityId\(\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`AndroidUIAutomator\(\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`accessibilityId\(\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`\bxpath\(\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bid\(\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`androidUIAutomator\(\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`iOSClassChain\(\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`iOSNsPredicateString\(\s*${f}`,"g"),using:"-ios predicate string"}],"appium-ruby-rspec":[{re:new RegExp(String.raw`accessibility_id:\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`xpath:\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bid:\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`uiautomator:\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`class_chain:\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`predicate:\s*${f}`,"g"),using:"-ios predicate string"},{re:new RegExp(String.raw`:accessibility_id\s*,\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`:xpath\s*,\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`:id\s*,\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`:uiautomator\s*,\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`:class_chain\s*,\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`:predicate\s*,\s*${f}`,"g"),using:"-ios predicate string"}],"appium-csharp-nunit":[{re:new RegExp(String.raw`AccessibilityId\(\s*${f}`,"g"),using:"accessibility id"},{re:new RegExp(String.raw`XPath\(\s*${f}`,"g"),using:"xpath"},{re:new RegExp(String.raw`\bId\(\s*${f}`,"g"),using:"id"},{re:new RegExp(String.raw`AndroidUIAutomator\(\s*${f}`,"g"),using:"-android uiautomator"},{re:new RegExp(String.raw`IosClassChain\(\s*${f}`,"g"),using:"-ios class chain"},{re:new RegExp(String.raw`IosNSPredicate\(\s*${f}`,"g"),using:"-ios predicate string"}],"webdriverio-js":[{re:new RegExp(String.raw`\$\(\s*${f}`,"g"),using:null}]},xt={taqwright:/\.getBy[A-Z]\w*\s*\(/,"appium-python-pytest":/\bfind_elements?\s*\(/,"appium-java-junit5":/\bfindElements?\s*\(|@\w*FindBy\s*\(/,"appium-ruby-rspec":/\bfind_elements?\s*\(/,"appium-csharp-nunit":/\bFindElements?\s*\(/,"webdriverio-js":/\$\$?\s*\(/};function Nt(e,n){let t=xt[n];if(!t)return[];let r=[];for(let s of String(e??"").split(`
383
383
  `))t.test(s)&&((_e(s,n)||[]).length||r.push(s.trim().slice(0,160)));return r}var Lt=Object.keys(oe);function Es(e){let n=String(e||"");return n.startsWith("~")?{using:"accessibility id",value:n.slice(1)}:n.startsWith("//")||n.startsWith("(")?{using:"xpath",value:n}:n.startsWith("android=")?{using:"-android uiautomator",value:n.slice(8)}:n.startsWith("-ios class chain:")?{using:"-ios class chain",value:n.slice(17).trim()}:n.startsWith("-ios predicate string:")?{using:"-ios predicate string",value:n.slice(22).trim()}:n.startsWith("id=")?{using:"id",value:n.slice(3)}:{using:"unknown",value:n}}function Ct(e){let n=e&&Array.isArray(e.steps)?e.steps:[],t=[];for(let r of n)if(!(!r||typeof r!="object"))for(let s of["locator","targetLocator"]){let i=r[s]&&r[s].appium;!i||typeof i!="object"||typeof i.using!="string"||typeof i.value!="string"||!i.using||t.push({using:i.using,value:i.value})}return t}function _e(e,n){let t=oe[n];if(!t)return null;let r=String(e??""),s=[];for(let i of t){i.re.lastIndex=0;let o;for(;(o=i.re.exec(r))!==null;){let a=bs(o[1]!=null?o[1]:o[2]);if(a!=null)if(i.using===null){let l=Es(a);s.push({using:l.using,value:l.value,at:o.index})}else s.push({using:i.using,value:i.wrap?i.wrap(a):a,at:o.index})}}return s.sort((i,o)=>i.at-o.at).map(i=>({using:i.using,value:i.value}))}function vs(e){let n=String(e??"").split(`
384
384
  `),t=new Map,r="";for(let s of n){if(s.startsWith("+++ ")){let i=s.slice(4).trim();r=i==="/dev/null"?"":i.replace(/^[ab]\//,"");continue}s.startsWith("--- ")||s.startsWith("@@")||s.startsWith("diff --git")||s.startsWith("index ")||!s.startsWith("+")||!r||(t.has(r)||t.set(r,[]),t.get(r).push(s.slice(1)))}return[...t.entries()].map(([s,i])=>({path:s,source:i.join(`
385
385
  `)}))}var ke=e=>`${e.using}\0${e.value}`;function Ss({steps:e,framework:n,files:t}={}){let r=Ct(e),s=Array.isArray(t)?t.filter(Boolean):[];if(!oe[n])return{ok:!1,unscannable:!0,abstained:!1,unknown:[],unused:[],unreadable:[],reason:`lime-cli cannot read locators in "${n||"an unknown framework"}", so the generated test could not be checked against the recording. Readable: ${Lt.join(", ")}.`};if(!r.length)return{ok:!0,unscannable:!1,abstained:!0,unknown:[],unused:[],unreadable:[],reason:"the recording carries no portable locators, so there was nothing to check against"};let i=new Set(r.map(ke)),o=new Set,a=[],l=[];for(let c of s){for(let p of Nt(c.source,n))l.push({file:c.path||"",line:p});let u=_e(c.source,n)||[];for(let p of u){let h=ke(p);if(i.has(h)){o.add(h);continue}a.some(y=>y.using===p.using&&y.value===p.value&&y.file===c.path)||a.push({using:p.using,value:p.value,file:c.path||""})}}let d=r.filter(c=>!o.has(ke(c)));return{ok:a.length===0,unscannable:!1,abstained:!1,unknown:a,unused:d,unreadable:l,reason:a.length?`${a.length} locator${a.length===1?"":"s"} in the generated test did not come from the recording`:""}}function Ts(e){if(!e)return"";if(e.unscannable)return`lime-cli: ${e.reason}`;let n=[];for(let r of e.unknown)n.push(` ${r.file}: ${r.using} "${r.value}" \u2014 not in the recording`);let t=(e.unreadable||[]).map(r=>` ${r.file}: could not read the locator on \`${r.line}\``);return n.length?["lime-cli: the generated test uses locators nobody recorded.",...t,...n," A locator that was not recorded was invented. Fix it by hand, or re-run the goal so"," the step is recorded, rather than letting the test assert something nobody observed."].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqwright/lime-cli",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Thin CLI client for the LIME server — fire a natural-language QA Agent goal against a connected device and write back a taqwright spec.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Taqwright",