@taqwright/lime-cli 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Ce=$((zc,ur)=>{ur.exports={name:"@taqwright/lime-cli",version:"0.19.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 W=$((Zc,wt)=>{"use strict";var dr="https://www.taqwright.ai";wt.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:dr,HTTP_TIMEOUT_MS:3e5,MAX_RESPONSE_BYTES:52428800}});var me=$((Qc,St)=>{"use strict";var{URL:pr}=require("url"),{HTTP_TIMEOUT_MS:yt,MAX_RESPONSE_BYTES:bt}=W(),{version:hr}=Ce();function vt(e){let t=String(e||"").replace(/^\[|\]$/g,"").toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="::1"||t.endsWith(".localhost")}var fr=["just a moment","attention required! | cloudflare","checking your browser","/cdn-cgi/challenge-platform","cf-error-details","cf-browser-verification","_incapsula_resource"];function Et(e,t){if(!t||typeof t!="string")return null;let n=t.slice(0,4e3).toLowerCase();return fr.some(s=>n.includes(s))?`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 Le=class{constructor(t,n){this.server=t,this.token=n,this.update=null}_url(t){return/^https?:\/\//i.test(t)?t:`${this.server}${t}`}json(t,n,s,r={}){let i=s?JSON.stringify(s):null,o={...r};return i&&(o["Content-Type"]="application/json",o["Content-Length"]=Buffer.byteLength(i)),this._send(t,this._url(n),o,i)}raw(t,n,s,r={}){let i={...r,"Content-Type":"application/octet-stream","Content-Length":s.length};return this._send(t,this._url(n),i,s)}_send(t,n,s,r){let i=new pr(n);if(i.protocol==="http:"&&!vt(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:t,hostname:i.hostname,port:i.port||(i.protocol==="https:"?443:80),path:i.pathname+(i.search||""),headers:{...s,Authorization:`Bearer ${this.token}`,Origin:`${i.protocol}//${i.host}`,"X-Lime-Cli-Version":hr}};return new Promise((l,u)=>{let c=o.request(a,p=>{let d=p.headers["x-lime-cli-update"];d&&(this.update={status:String(d),latest:p.headers["x-lime-cli-latest"]||null});let h="",m=0;p.setEncoding("utf8"),p.on("data",y=>{if(m+=Buffer.byteLength(y),m>bt){c.destroy(new Error(`Server response exceeded ${bt} bytes`));return}h+=y}),p.on("end",()=>{let y;try{y=h?JSON.parse(h):{}}catch{let w=Et(p.statusCode,h);return u(new Error(w||`Server returned non-JSON (${p.statusCode}): ${h.substring(0,200)}`))}l({status:p.statusCode,body:y})})});c.setTimeout(yt,()=>{c.destroy(new Error(`request timed out after ${yt/1e3}s`))}),c.on("error",u),r&&c.write(r),c.end()})}};function mr(e,t){if(!e.body||!e.body.success)throw new Error(`${t} \u2014 ${e.body&&e.body.error||"unknown"}`);return e.body}St.exports={isLoopbackHost:vt,HttpClient:Le,expectSuccess:mr,describeEdgeBlock:Et}});var At=$((el,Tt)=>{"use strict";var Pe="npm install -g @taqwright/lime-cli@latest",gr=/^\d+\.\d+\.\d+([-.+][0-9A-Za-z.-]{1,20})?$/;function wr({status:e,current:t,latest:n,env:s=process.env}){return s.LIME_NO_UPDATE_NOTICE==="1"?null:e==="required"?`lime-cli: ${t} is no longer supported by this server. Run: ${Pe}`:e==="available"&&typeof n=="string"&&gr.test(n)?`lime-cli: update available: ${t} \u2192 ${n}. Run: ${Pe}`:null}Tt.exports={formatUpdateNotice:wr,INSTALL_COMMAND:Pe}});var J=$((tl,kt)=>{"use strict";var yr={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 br({provider:e,platform:t,device:n,os:s,appUrl:r,username:i,accessKey:o,capabilities:a}){let l={connectionMode:"cloud",cloudProvider:e||"browserstack",cloudUsername:i,cloudAccessKey:o,platform:t,deviceName:n,deviceOsVersion:s,cloudAppUrl:r,automationName:t==="ios"?"XCUITest":"UiAutomator2"};return a&&(l.cloudCapabilities=a),l}kt.exports={CLOUD_PROVIDERS:yr,buildCloudSettingsPayload:br}});var we=$((nl,It)=>{"use strict";var ge=require("fs"),De=require("path"),vr=["taqwright","webdriverio-js","appium-java-junit5","appium-python-pytest","appium-ruby-rspec","appium-csharp-nunit"],Er={taqwright:"deterministic","webdriverio-js":"gemini","appium-java-junit5":"gemini","appium-python-pytest":"gemini","appium-ruby-rspec":"gemini","appium-csharp-nunit":"gemini"},K={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)"},Sr=5*1024*1024,Me={exists:e=>ge.existsSync(e),readText:e=>{try{return ge.statSync(e).size>Sr?null:ge.readFileSync(e,"utf8")}catch{return null}},list:e=>{try{return ge.readdirSync(e)}catch{return[]}}};function Tr(e,t){let n=e.readText(De.join(t,"package.json"));if(!n)return{};try{let s=JSON.parse(n);return{...s.dependencies||{},...s.devDependencies||{}}}catch{return{}}}var Ar=new Set(["node_modules","dist","build","target","bin","obj","vendor","out","coverage"]);function kr(e,t){let n=new Set([""]),s=[];try{s=e.list(t)}catch{s=[]}for(let r of s)r.startsWith(".")||Ar.has(r)||n.add(r);return[...n]}function _r(e,t,n){let s=n?De.join(t,n):t,r=p=>De.join(s,p),i=p=>n?`${n}/${p}`:p,o=[],a=Tr(e,s),l=[];try{l=e.list(s)}catch{l=[]}(a["@taqwright/taqwright"]||a.taqwright||e.exists(r("taqwright.config.ts"))||e.exists(r("taqwright.config.js")))&&o.push({id:"taqwright",label:K.taqwright,reason:"taqwright dependency/config found",manifest:i("package.json")});let u=l.some(p=>/^wdio\.conf\.(js|ts|mjs|cjs)$/.test(p));(a.webdriverio||a["@wdio/cli"]||u)&&o.push({id:"webdriverio-js",label:K["webdriverio-js"],reason:u?"wdio.conf.* found":"webdriverio dependency found",manifest:i("package.json")});for(let p of["pom.xml","build.gradle","build.gradle.kts"]){let d=e.readText(r(p));if(d&&/io\.appium|java-client/.test(d)){o.push({id:"appium-java-junit5",label:K["appium-java-junit5"],reason:`io.appium:java-client in ${i(p)}`,manifest:i(p)});break}}for(let p of["requirements.txt","pyproject.toml"]){let d=e.readText(r(p));if(d&&/appium-python-client/i.test(d)){o.push({id:"appium-python-pytest",label:K["appium-python-pytest"],reason:`Appium-Python-Client in ${i(p)}`,manifest:i(p)});break}}let c=e.readText(r("Gemfile"));c&&/appium_lib(_core)?/.test(c)&&o.push({id:"appium-ruby-rspec",label:K["appium-ruby-rspec"],reason:"appium_lib in Gemfile",manifest:i("Gemfile")});for(let p of l){if(!/\.csproj$/i.test(p))continue;let d=e.readText(r(p));if(d&&/Appium\.WebDriver/i.test(d)){o.push({id:"appium-csharp-nunit",label:K["appium-csharp-nunit"],reason:`Appium.WebDriver in ${i(p)}`,manifest:i(p)});break}}return o}function _t(e,t=Me){let n=new Map;for(let s of kr(t,e))for(let r of _r(t,e,s))n.has(r.id)||n.set(r.id,r);return[...n.values()]}function Ir(e,t=Me){let n=_t(e,t);return n.some(s=>s.id==="taqwright")||n.push({id:"taqwright",label:K.taqwright,reason:"default output"}),n}function $r(e){let{requested:t,configured:n,remembered:s,offeredIds:r,detectedRealIds:i,taqwrightDetected:o,javaSignal:a}=e,l=u=>!!u&&r.includes(u);return l(t)?t:l(n)?n:l(s)&&(i.includes(s)||s==="taqwright"&&o)?s:i.length?i[0]:o?"taqwright":a?"appium-java-junit5":"taqwright"}It.exports={FRAMEWORK_IDS:vr,FRAMEWORK_ENGINES:Er,FRAMEWORK_LABELS:K,nodeFs:Me,detectFrameworks:_t,rankFrameworks:Ir,pickDefaultFramework:$r}});var ye=$((sl,Nt)=>{"use strict";var ie=require("path"),{nodeFs:Rr}=we(),Rt={taqwright:"tests","webdriverio-js":"test/specs","appium-java-junit5":"src/test/java","appium-python-pytest":"tests","appium-ruby-rspec":"spec","appium-csharp-nunit":"Tests"},jr="tests",xr={taqwright:".spec.ts","webdriverio-js":".spec.ts","appium-java-junit5":".java","appium-python-pytest":".py","appium-ruby-rspec":"_spec.rb","appium-csharp-nunit":".cs"},Or=new Set(["appium-python-pytest","appium-ruby-rspec"]);function qe(e){return Rt[e]||jr}function Ue(e){let t=(e||"").split(/[^A-Za-z0-9]+/).filter(Boolean);return t.length?t.map(n=>/^[A-Z0-9]+$/.test(n)?n[0]+n.slice(1).toLowerCase():n[0].toUpperCase()+n.slice(1)).join(""):""}function Be(e){return(e||"").replace(/([a-z0-9])([A-Z])/g,"$1_$2").split(/[^A-Za-z0-9]+/).filter(Boolean).join("_").toLowerCase()}function Nr(e){return Be(e).split("_").filter(Boolean).join("-")}var Cr=6,Lr=new Set(["and","or","the","a","an","to","of","in","on","at","as","with","for","then","into","from","by","that","is"]),Pr=/@|\d{6,}/;function Dr(e){let t=String(e||"").trim().split(/\s+/).filter(Boolean).filter(n=>!Pr.test(n)).slice(0,Cr);for(;t.length>1&&Lr.has(t[t.length-1].toLowerCase());)t.pop();return Ue(t.join(" "))||"RecordedTest"}function Mr(e){let t=String(e||"").trim();return t?/[A-Za-z]/.test(t)?t.length>80?"Keep the name under 80 characters.":/[/\\]/.test(t)?"Use the destination field for the folder.":null:"Use at least one letter.":"Enter a test name."}function qr(e){if(e==null||e==="")return null;let t=String(e);return t!==t.trim()?"must not have leading or trailing spaces.":t.length>120?"is longer than any key LIME mints (120 characters).":/^[a-z0-9][a-z0-9._/:-]*$/.test(t)?t.includes("..")?'must not contain "..".':null:"is not a scenario key \u2014 expected lower-case letters, digits and . _ - / : only."}function jt(e,t){let n;return Or.has(e)?n=Be(t):n=Ue(t),`${n}${xr[e]||""}`}function oe(e){return String(e||"").split(/[/\\]+/).filter(t=>t&&t!=="."&&t!=="..").join("/")}function Ur(e){if(e==null)return null;let t=String(e);return t.trim()===""?null:/^([A-Za-z]:)?[/\\]/.test(t)?"must be a path inside the project, not an absolute path.":t.split(/[/\\]+/).includes("..")?'must not contain ".." \u2014 the test belongs inside the project.':null}function Fe(e){let t=oe(e).split("/");return t.pop(),t.join("/")}function xt(e){let t=/(?:^|\/)src\/(?:test|main)\/java\/(.+)$/.exec(oe(e));return t&&t[1].split("/").filter(Boolean).join(".")||void 0}function Br(e){let t=oe(e),n=t.search(/\/src\/(?:test|main)\/java(?:\/|$)/);return n>0?t.slice(0,n):""}function Fr(e){let t=new Map;for(let s of e){let r=Fe(s);t.set(r,(t.get(r)||0)+1)}if(!t.size)return null;let n=[...t.entries()].sort((s,r)=>r[1]-s[1]||s[0].localeCompare(r[0]));return{dir:n[0][0],count:n[0][1]}}var Ot={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$/}},Kr=/@(?:org\.junit(?:\.jupiter\.api)?\.)?(?:Test|ParameterizedTest|RepeatedTest|TestFactory|TestTemplate)\b/,Hr=/^(?:Test\w*|\w*(?:Test|Tests|TestCase))\.java$/;function Wr(e,t,n){let s=n.readText?n.readText(e):null;return typeof s=="string"?Kr.test(s):Hr.test(t)}var Vr=new Set(["node_modules","dist","build","target","bin","obj","vendor","out","coverage",".git"]),Yr=2e4;function Gr(e,t,n=Rr){let s=Ot[t];if(!s)return[];let r=[],i=Yr,o=a=>{if(i<=0)return;let l=a?ie.join(e,a):e,u=[];try{u=n.list(l)}catch{return}for(let c of u){if(i--<=0)return;if(c.startsWith(".")||Vr.has(c))continue;let p=a?`${a}/${c}`:c;if(n.isDir?n.isDir(ie.join(e,p)):n.list(ie.join(e,p)).length>0){o(p);continue}s.file.test(c)&&(s.segment&&!`/${Fe(p)}/`.includes(`/${s.segment}/`)||t==="appium-java-junit5"&&!Wr(ie.join(e,p),c,n)||r.push(p))}};return o(""),r.sort()}var $t=["TestCase","Tests","Test","IT"];function Jr(e,t,n){if(e!=="appium-java-junit5"||!t||(t=t[0].toUpperCase()+t.slice(1),/^Test[A-Z0-9_]/.test(t)||$t.some(i=>t.endsWith(i))))return t;let s=new Map;for(let i of n||[]){let o=ie.posix.basename(String(i)).replace(/\.java$/,""),a=$t.find(l=>o.endsWith(l));a&&s.set(a,(s.get(a)||0)+1)}let r=[...s.entries()].sort((i,o)=>o[1]-i[1]||(i[0]==="Test"?-1:o[0]==="Test"?1:0));return t+(r.length?r[0][0]:"Test")}function Xr(e){let{framework:t,testName:n}=e,s=jt(t,n),r=(a,l,u=0)=>{let c=oe(a),p=t==="appium-java-junit5"?xt(c):void 0;return{dir:c,fileName:s,...p?{packageName:p}:{},source:l,neighbourCount:u}};if(e.remembered!=null)return r(e.remembered,"remembered");let i=Fr(e.existingTests||[]);if(i&&i.dir)return r(i.dir,"existing",i.count);let o=e.detection&&e.detection.manifest?Fe(e.detection.manifest):"";return o?r(`${o}/${qe(t)}`,"module"):r(qe(t),"convention")}Nt.exports={CONVENTIONAL_DIRS:Rt,TEST_PATTERNS:Ot,conventionalDir:qe,pascalCase:Ue,snakeCase:Be,kebabCase:Nr,testNameFromGoal:Dr,validateTestName:Mr,validateDest:Ur,validateScenarioKey:qr,fileNameFor:jt,normalizeDir:oe,javaPackageOf:xt,moduleRootOf:Br,findExistingTests:Gr,resolveExportTarget:Xr,conventionalTestName:Jr}});var Dt=$((rl,Pt)=>{"use strict";var{CLOUD_PROVIDERS:be}=J(),{validateScenarioKey:zr}=ye();function Zr(e){let t=Object.create(null);for(let n=0;n<e.length;n++){let s=e[n];if(!s.startsWith("--"))continue;let r=s.slice(2),i=e[n+1];i===void 0||i.startsWith("--")?t[r]=!0:(t[r]=i,n++)}return t}var Lt=["export","adapt","verify","check","check-locators","check-pom","disconnect","report","doctor","pr"];function Qr(e){let t=Array.isArray(e)?e:[],n=[];for(let s=0;s<t.length;s+=1){let r=String(t[s]==null?"":t[s]);!r||r.startsWith("-")||(s>0?String(t[s-1]||""):"").startsWith("--")||n.push(r)}return n}function ei(e){let t=e[0];return t&&Lt.includes(t)?{command:t,rest:e.slice(1)}:{command:"run",rest:e}}function ti(e="taqwright"){return e==="json"?"recorded-steps.json":"RecordedTest.spec.ts"}function ni(e,t=process.env){let n=[],s=!!e["list-devices"],r=!!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)||n.push(`--format must be taqwright or json (got "${e.format}")`),s)return{errors:n,listDevices:s,keepSession:r,noBoot:i,format:a,limeDir:o};(!e.goal||typeof e.goal!="string"||!e.goal.trim())&&n.push("--goal is required");let l;e.project!==void 0&&(typeof e.project!="string"||!e.project.trim()?n.push("--project requires a project name"):l=e.project.trim());let u;if(e.scenario!==void 0){let E=typeof e.scenario=="string"?e.scenario.trim():"",b=E?zr(E):"requires a scenario key";b?n.push(`--scenario ${b}`):u=E}for(let E of["gemini-key","qwen-key"])e[E]!==void 0&&n.push(`--${E} is no longer supported: runs use the AI key provisioned for your LIME account`);if(e["max-steps"]!==void 0){let E=Number(e["max-steps"]);(!Number.isFinite(E)||E<1||E>200)&&n.push("--max-steps must be a number between 1 and 200")}let c;e.platform&&(c=String(e.platform).toLowerCase(),["android","ios"].includes(c)||n.push(`--platform must be android or ios (got "${e.platform}")`));let p=!!e.cloud,d=typeof e.os=="string"?e.os:void 0,h=typeof e["app-url"]=="string"?e["app-url"]:void 0,m=typeof e.app=="string"?e.app:void 0,y=typeof e.caps=="string"&&e.caps.trim()?e.caps.trim():void 0,f,w,g;if(p&&(f=e.cloud===!0?"browserstack":String(e.cloud).toLowerCase(),be[f]||n.push(`--cloud must be ${Object.keys(be).join(" or ")} (got "${e.cloud}")`)),p){(!e.device||typeof e.device!="string")&&n.push('--cloud requires --device (the cloud device name, e.g. "Google Pixel 8")'),c||n.push("--cloud requires --platform (android or ios)"),d||n.push("--cloud requires --os (the device OS version, e.g. 14.0)"),m?n.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||n.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())&&n.push("--app-url requires a bs:// or lt:// app id"),h&&be[f]&&(f==="browserstack"&&h.startsWith("lt://")?n.push(`--app-url "${h}" is a LambdaTest app id, but the provider is browserstack`):f==="lambdatest"&&h.startsWith("bs://")&&n.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())&&n.push("--cloud-username requires a value"),e["cloud-access-key"]!==void 0&&(typeof e["cloud-access-key"]!="string"||!e["cloud-access-key"].trim())&&n.push("--cloud-access-key requires a value"),e.caps!==void 0&&(typeof e.caps!="string"||!e.caps.trim())&&n.push("--caps requires a path to a JSON file");let E=be[f];E&&(w=typeof e["cloud-username"]=="string"&&e["cloud-username"].trim()||t[E.envUsername]||void 0,g=typeof e["cloud-access-key"]=="string"&&e["cloud-access-key"].trim()||t[E.envAccessKey]||void 0,w||n.push(`cloud runs require a username \u2014 pass --cloud-username or set ${E.envUsername} (credentials are never read from your LIME account for CLI runs)`),g||n.push(`cloud runs require an access key \u2014 pass --cloud-access-key or set ${E.envAccessKey}`))}else e.app!==void 0&&(typeof e.app!="string"||!e.app.trim()?n.push("--app requires a path to an APK"):e.device?c&&c!=="android"&&n.push("--app is Android only"):n.push("--app requires --device (lime-cli must connect to a device to reinstall the app)")),e["app-url"]!==void 0&&n.push("--app-url requires --cloud"),e.os!==void 0&&n.push("--os requires --cloud"),e["cloud-username"]!==void 0&&n.push("--cloud-username requires --cloud"),e["cloud-access-key"]!==void 0&&n.push("--cloud-access-key requires --cloud"),e.caps!==void 0&&n.push("--caps requires --cloud");return{errors:n,listDevices:s,keepSession:r,noBoot:i,limeDir:o,device:e.device,platform:c,projectName:l,scenarioKey:u,app:m,cloud:p,cloudProvider:f,cloudUsername:w,cloudAccessKey:g,os:d,appUrl:h,capsPath:y,format:a}}var Ct=["browserstack","lambdatest","appium"];function si(e){let t=[],n=[];for(let[s,r]of Object.entries(e||{}))!r||typeof r!="object"||Array.isArray(r)?t.push(`--caps block "${s}" must be a JSON object, e.g. { "${s}": { "someCap": true } }`):Ct.includes(s)||n.push(`--caps block "${s}" is not one of ${Ct.join("/")} \u2014 it will be ignored (typo?)`);return{errors:t,warnings:n}}Pt.exports={parseArgs:Zr,parseCommand:ei,positionalPaths:Qr,validateArgs:ni,extToFilename:ti,validateCapsObject:si,COMMANDS:Lt}});var Bt=$((il,Ut)=>{"use strict";var ri=require("fs"),ii=require("path"),Mt=["LIME_CI_TOKEN","LIME_SERVER","LIME_NO_UPDATE_NOTICE","BROWSERSTACK_USERNAME","BROWSERSTACK_ACCESS_KEY","LT_USERNAME","LT_ACCESS_KEY"];function qt(e){let t={};for(let n of String(e||"").split(/\r?\n/)){let s=n.trim();if(!s||s.startsWith("#"))continue;let r=s.match(/^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(!r)continue;let i=r[2],o=i[0];(o==='"'||o==="'")&&i.indexOf(o,1)>0?i=i.slice(1,i.indexOf(o,1)):i=i.replace(/\s+#.*$/,"").trim(),t[r[1]]=i}return t}function oi(e,t=process.env){let n;try{n=ri.readFileSync(ii.join(e,".env"),"utf8")}catch{return[]}let s=qt(n),r=[];for(let i of Mt)t[i]!==void 0||!s[i]||(t[i]=s[i],r.push(i));return r}Ut.exports={parseDotEnv:qt,loadDotEnv:oi,DOTENV_KEYS:Mt}});var Ht=$((ol,Kt)=>{"use strict";var{DEFAULT_SERVER:ai}=W(),Ft={export:`lime-cli export \u2014 work out what this repo is, and where the test belongs.
2
+ "use strict";var $=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Ce=$((zc,ur)=>{ur.exports={name:"@taqwright/lime-cli",version:"0.20.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 W=$((Zc,wt)=>{"use strict";var dr="https://www.taqwright.ai";wt.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:dr,HTTP_TIMEOUT_MS:3e5,MAX_RESPONSE_BYTES:52428800}});var me=$((Qc,St)=>{"use strict";var{URL:pr}=require("url"),{HTTP_TIMEOUT_MS:yt,MAX_RESPONSE_BYTES:bt}=W(),{version:hr}=Ce();function vt(e){let t=String(e||"").replace(/^\[|\]$/g,"").toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="::1"||t.endsWith(".localhost")}var fr=["just a moment","attention required! | cloudflare","checking your browser","/cdn-cgi/challenge-platform","cf-error-details","cf-browser-verification","_incapsula_resource"];function Et(e,t){if(!t||typeof t!="string")return null;let n=t.slice(0,4e3).toLowerCase();return fr.some(s=>n.includes(s))?`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 Le=class{constructor(t,n){this.server=t,this.token=n,this.update=null}_url(t){return/^https?:\/\//i.test(t)?t:`${this.server}${t}`}json(t,n,s,r={}){let i=s?JSON.stringify(s):null,o={...r};return i&&(o["Content-Type"]="application/json",o["Content-Length"]=Buffer.byteLength(i)),this._send(t,this._url(n),o,i)}raw(t,n,s,r={}){let i={...r,"Content-Type":"application/octet-stream","Content-Length":s.length};return this._send(t,this._url(n),i,s)}_send(t,n,s,r){let i=new pr(n);if(i.protocol==="http:"&&!vt(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:t,hostname:i.hostname,port:i.port||(i.protocol==="https:"?443:80),path:i.pathname+(i.search||""),headers:{...s,Authorization:`Bearer ${this.token}`,Origin:`${i.protocol}//${i.host}`,"X-Lime-Cli-Version":hr}};return new Promise((l,u)=>{let c=o.request(a,p=>{let d=p.headers["x-lime-cli-update"];d&&(this.update={status:String(d),latest:p.headers["x-lime-cli-latest"]||null});let h="",m=0;p.setEncoding("utf8"),p.on("data",y=>{if(m+=Buffer.byteLength(y),m>bt){c.destroy(new Error(`Server response exceeded ${bt} bytes`));return}h+=y}),p.on("end",()=>{let y;try{y=h?JSON.parse(h):{}}catch{let w=Et(p.statusCode,h);return u(new Error(w||`Server returned non-JSON (${p.statusCode}): ${h.substring(0,200)}`))}l({status:p.statusCode,body:y})})});c.setTimeout(yt,()=>{c.destroy(new Error(`request timed out after ${yt/1e3}s`))}),c.on("error",u),r&&c.write(r),c.end()})}};function mr(e,t){if(!e.body||!e.body.success)throw new Error(`${t} \u2014 ${e.body&&e.body.error||"unknown"}`);return e.body}St.exports={isLoopbackHost:vt,HttpClient:Le,expectSuccess:mr,describeEdgeBlock:Et}});var At=$((el,Tt)=>{"use strict";var Pe="npm install -g @taqwright/lime-cli@latest",gr=/^\d+\.\d+\.\d+([-.+][0-9A-Za-z.-]{1,20})?$/;function wr({status:e,current:t,latest:n,env:s=process.env}){return s.LIME_NO_UPDATE_NOTICE==="1"?null:e==="required"?`lime-cli: ${t} is no longer supported by this server. Run: ${Pe}`:e==="available"&&typeof n=="string"&&gr.test(n)?`lime-cli: update available: ${t} \u2192 ${n}. Run: ${Pe}`:null}Tt.exports={formatUpdateNotice:wr,INSTALL_COMMAND:Pe}});var J=$((tl,kt)=>{"use strict";var yr={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 br({provider:e,platform:t,device:n,os:s,appUrl:r,username:i,accessKey:o,capabilities:a}){let l={connectionMode:"cloud",cloudProvider:e||"browserstack",cloudUsername:i,cloudAccessKey:o,platform:t,deviceName:n,deviceOsVersion:s,cloudAppUrl:r,automationName:t==="ios"?"XCUITest":"UiAutomator2"};return a&&(l.cloudCapabilities=a),l}kt.exports={CLOUD_PROVIDERS:yr,buildCloudSettingsPayload:br}});var we=$((nl,It)=>{"use strict";var ge=require("fs"),De=require("path"),vr=["taqwright","webdriverio-js","appium-java-junit5","appium-python-pytest","appium-ruby-rspec","appium-csharp-nunit"],Er={taqwright:"deterministic","webdriverio-js":"gemini","appium-java-junit5":"gemini","appium-python-pytest":"gemini","appium-ruby-rspec":"gemini","appium-csharp-nunit":"gemini"},K={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)"},Sr=5*1024*1024,Me={exists:e=>ge.existsSync(e),readText:e=>{try{return ge.statSync(e).size>Sr?null:ge.readFileSync(e,"utf8")}catch{return null}},list:e=>{try{return ge.readdirSync(e)}catch{return[]}}};function Tr(e,t){let n=e.readText(De.join(t,"package.json"));if(!n)return{};try{let s=JSON.parse(n);return{...s.dependencies||{},...s.devDependencies||{}}}catch{return{}}}var Ar=new Set(["node_modules","dist","build","target","bin","obj","vendor","out","coverage"]);function kr(e,t){let n=new Set([""]),s=[];try{s=e.list(t)}catch{s=[]}for(let r of s)r.startsWith(".")||Ar.has(r)||n.add(r);return[...n]}function _r(e,t,n){let s=n?De.join(t,n):t,r=p=>De.join(s,p),i=p=>n?`${n}/${p}`:p,o=[],a=Tr(e,s),l=[];try{l=e.list(s)}catch{l=[]}(a["@taqwright/taqwright"]||a.taqwright||e.exists(r("taqwright.config.ts"))||e.exists(r("taqwright.config.js")))&&o.push({id:"taqwright",label:K.taqwright,reason:"taqwright dependency/config found",manifest:i("package.json")});let u=l.some(p=>/^wdio\.conf\.(js|ts|mjs|cjs)$/.test(p));(a.webdriverio||a["@wdio/cli"]||u)&&o.push({id:"webdriverio-js",label:K["webdriverio-js"],reason:u?"wdio.conf.* found":"webdriverio dependency found",manifest:i("package.json")});for(let p of["pom.xml","build.gradle","build.gradle.kts"]){let d=e.readText(r(p));if(d&&/io\.appium|java-client/.test(d)){o.push({id:"appium-java-junit5",label:K["appium-java-junit5"],reason:`io.appium:java-client in ${i(p)}`,manifest:i(p)});break}}for(let p of["requirements.txt","pyproject.toml"]){let d=e.readText(r(p));if(d&&/appium-python-client/i.test(d)){o.push({id:"appium-python-pytest",label:K["appium-python-pytest"],reason:`Appium-Python-Client in ${i(p)}`,manifest:i(p)});break}}let c=e.readText(r("Gemfile"));c&&/appium_lib(_core)?/.test(c)&&o.push({id:"appium-ruby-rspec",label:K["appium-ruby-rspec"],reason:"appium_lib in Gemfile",manifest:i("Gemfile")});for(let p of l){if(!/\.csproj$/i.test(p))continue;let d=e.readText(r(p));if(d&&/Appium\.WebDriver/i.test(d)){o.push({id:"appium-csharp-nunit",label:K["appium-csharp-nunit"],reason:`Appium.WebDriver in ${i(p)}`,manifest:i(p)});break}}return o}function _t(e,t=Me){let n=new Map;for(let s of kr(t,e))for(let r of _r(t,e,s))n.has(r.id)||n.set(r.id,r);return[...n.values()]}function Ir(e,t=Me){let n=_t(e,t);return n.some(s=>s.id==="taqwright")||n.push({id:"taqwright",label:K.taqwright,reason:"default output"}),n}function $r(e){let{requested:t,configured:n,remembered:s,offeredIds:r,detectedRealIds:i,taqwrightDetected:o,javaSignal:a}=e,l=u=>!!u&&r.includes(u);return l(t)?t:l(n)?n:l(s)&&(i.includes(s)||s==="taqwright"&&o)?s:i.length?i[0]:o?"taqwright":a?"appium-java-junit5":"taqwright"}It.exports={FRAMEWORK_IDS:vr,FRAMEWORK_ENGINES:Er,FRAMEWORK_LABELS:K,nodeFs:Me,detectFrameworks:_t,rankFrameworks:Ir,pickDefaultFramework:$r}});var ye=$((sl,Nt)=>{"use strict";var ie=require("path"),{nodeFs:Rr}=we(),Rt={taqwright:"tests","webdriverio-js":"test/specs","appium-java-junit5":"src/test/java","appium-python-pytest":"tests","appium-ruby-rspec":"spec","appium-csharp-nunit":"Tests"},jr="tests",xr={taqwright:".spec.ts","webdriverio-js":".spec.ts","appium-java-junit5":".java","appium-python-pytest":".py","appium-ruby-rspec":"_spec.rb","appium-csharp-nunit":".cs"},Or=new Set(["appium-python-pytest","appium-ruby-rspec"]);function qe(e){return Rt[e]||jr}function Ue(e){let t=(e||"").split(/[^A-Za-z0-9]+/).filter(Boolean);return t.length?t.map(n=>/^[A-Z0-9]+$/.test(n)?n[0]+n.slice(1).toLowerCase():n[0].toUpperCase()+n.slice(1)).join(""):""}function Be(e){return(e||"").replace(/([a-z0-9])([A-Z])/g,"$1_$2").split(/[^A-Za-z0-9]+/).filter(Boolean).join("_").toLowerCase()}function Nr(e){return Be(e).split("_").filter(Boolean).join("-")}var Cr=6,Lr=new Set(["and","or","the","a","an","to","of","in","on","at","as","with","for","then","into","from","by","that","is"]),Pr=/@|\d{6,}/;function Dr(e){let t=String(e||"").trim().split(/\s+/).filter(Boolean).filter(n=>!Pr.test(n)).slice(0,Cr);for(;t.length>1&&Lr.has(t[t.length-1].toLowerCase());)t.pop();return Ue(t.join(" "))||"RecordedTest"}function Mr(e){let t=String(e||"").trim();return t?/[A-Za-z]/.test(t)?t.length>80?"Keep the name under 80 characters.":/[/\\]/.test(t)?"Use the destination field for the folder.":null:"Use at least one letter.":"Enter a test name."}function qr(e){if(e==null||e==="")return null;let t=String(e);return t!==t.trim()?"must not have leading or trailing spaces.":t.length>120?"is longer than any key LIME mints (120 characters).":/^[a-z0-9][a-z0-9._/:-]*$/.test(t)?t.includes("..")?'must not contain "..".':null:"is not a scenario key \u2014 expected lower-case letters, digits and . _ - / : only."}function jt(e,t){let n;return Or.has(e)?n=Be(t):n=Ue(t),`${n}${xr[e]||""}`}function oe(e){return String(e||"").split(/[/\\]+/).filter(t=>t&&t!=="."&&t!=="..").join("/")}function Ur(e){if(e==null)return null;let t=String(e);return t.trim()===""?null:/^([A-Za-z]:)?[/\\]/.test(t)?"must be a path inside the project, not an absolute path.":t.split(/[/\\]+/).includes("..")?'must not contain ".." \u2014 the test belongs inside the project.':null}function Fe(e){let t=oe(e).split("/");return t.pop(),t.join("/")}function xt(e){let t=/(?:^|\/)src\/(?:test|main)\/java\/(.+)$/.exec(oe(e));return t&&t[1].split("/").filter(Boolean).join(".")||void 0}function Br(e){let t=oe(e),n=t.search(/\/src\/(?:test|main)\/java(?:\/|$)/);return n>0?t.slice(0,n):""}function Fr(e){let t=new Map;for(let s of e){let r=Fe(s);t.set(r,(t.get(r)||0)+1)}if(!t.size)return null;let n=[...t.entries()].sort((s,r)=>r[1]-s[1]||s[0].localeCompare(r[0]));return{dir:n[0][0],count:n[0][1]}}var Ot={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$/}},Kr=/@(?:org\.junit(?:\.jupiter\.api)?\.)?(?:Test|ParameterizedTest|RepeatedTest|TestFactory|TestTemplate)\b/,Hr=/^(?:Test\w*|\w*(?:Test|Tests|TestCase))\.java$/;function Wr(e,t,n){let s=n.readText?n.readText(e):null;return typeof s=="string"?Kr.test(s):Hr.test(t)}var Vr=new Set(["node_modules","dist","build","target","bin","obj","vendor","out","coverage",".git"]),Yr=2e4;function Gr(e,t,n=Rr){let s=Ot[t];if(!s)return[];let r=[],i=Yr,o=a=>{if(i<=0)return;let l=a?ie.join(e,a):e,u=[];try{u=n.list(l)}catch{return}for(let c of u){if(i--<=0)return;if(c.startsWith(".")||Vr.has(c))continue;let p=a?`${a}/${c}`:c;if(n.isDir?n.isDir(ie.join(e,p)):n.list(ie.join(e,p)).length>0){o(p);continue}s.file.test(c)&&(s.segment&&!`/${Fe(p)}/`.includes(`/${s.segment}/`)||t==="appium-java-junit5"&&!Wr(ie.join(e,p),c,n)||r.push(p))}};return o(""),r.sort()}var $t=["TestCase","Tests","Test","IT"];function Jr(e,t,n){if(e!=="appium-java-junit5"||!t||(t=t[0].toUpperCase()+t.slice(1),/^Test[A-Z0-9_]/.test(t)||$t.some(i=>t.endsWith(i))))return t;let s=new Map;for(let i of n||[]){let o=ie.posix.basename(String(i)).replace(/\.java$/,""),a=$t.find(l=>o.endsWith(l));a&&s.set(a,(s.get(a)||0)+1)}let r=[...s.entries()].sort((i,o)=>o[1]-i[1]||(i[0]==="Test"?-1:o[0]==="Test"?1:0));return t+(r.length?r[0][0]:"Test")}function Xr(e){let{framework:t,testName:n}=e,s=jt(t,n),r=(a,l,u=0)=>{let c=oe(a),p=t==="appium-java-junit5"?xt(c):void 0;return{dir:c,fileName:s,...p?{packageName:p}:{},source:l,neighbourCount:u}};if(e.remembered!=null)return r(e.remembered,"remembered");let i=Fr(e.existingTests||[]);if(i&&i.dir)return r(i.dir,"existing",i.count);let o=e.detection&&e.detection.manifest?Fe(e.detection.manifest):"";return o?r(`${o}/${qe(t)}`,"module"):r(qe(t),"convention")}Nt.exports={CONVENTIONAL_DIRS:Rt,TEST_PATTERNS:Ot,conventionalDir:qe,pascalCase:Ue,snakeCase:Be,kebabCase:Nr,testNameFromGoal:Dr,validateTestName:Mr,validateDest:Ur,validateScenarioKey:qr,fileNameFor:jt,normalizeDir:oe,javaPackageOf:xt,moduleRootOf:Br,findExistingTests:Gr,resolveExportTarget:Xr,conventionalTestName:Jr}});var Dt=$((rl,Pt)=>{"use strict";var{CLOUD_PROVIDERS:be}=J(),{validateScenarioKey:zr}=ye();function Zr(e){let t=Object.create(null);for(let n=0;n<e.length;n++){let s=e[n];if(!s.startsWith("--"))continue;let r=s.slice(2),i=e[n+1];i===void 0||i.startsWith("--")?t[r]=!0:(t[r]=i,n++)}return t}var Lt=["export","adapt","verify","check","check-locators","check-pom","disconnect","report","doctor","pr"];function Qr(e){let t=Array.isArray(e)?e:[],n=[];for(let s=0;s<t.length;s+=1){let r=String(t[s]==null?"":t[s]);!r||r.startsWith("-")||(s>0?String(t[s-1]||""):"").startsWith("--")||n.push(r)}return n}function ei(e){let t=e[0];return t&&Lt.includes(t)?{command:t,rest:e.slice(1)}:{command:"run",rest:e}}function ti(e="taqwright"){return e==="json"?"recorded-steps.json":"RecordedTest.spec.ts"}function ni(e,t=process.env){let n=[],s=!!e["list-devices"],r=!!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)||n.push(`--format must be taqwright or json (got "${e.format}")`),s)return{errors:n,listDevices:s,keepSession:r,noBoot:i,format:a,limeDir:o};(!e.goal||typeof e.goal!="string"||!e.goal.trim())&&n.push("--goal is required");let l;e.project!==void 0&&(typeof e.project!="string"||!e.project.trim()?n.push("--project requires a project name"):l=e.project.trim());let u;if(e.scenario!==void 0){let E=typeof e.scenario=="string"?e.scenario.trim():"",b=E?zr(E):"requires a scenario key";b?n.push(`--scenario ${b}`):u=E}for(let E of["gemini-key","qwen-key"])e[E]!==void 0&&n.push(`--${E} is no longer supported: runs use the AI key provisioned for your LIME account`);if(e["max-steps"]!==void 0){let E=Number(e["max-steps"]);(!Number.isFinite(E)||E<1||E>200)&&n.push("--max-steps must be a number between 1 and 200")}let c;e.platform&&(c=String(e.platform).toLowerCase(),["android","ios"].includes(c)||n.push(`--platform must be android or ios (got "${e.platform}")`));let p=!!e.cloud,d=typeof e.os=="string"?e.os:void 0,h=typeof e["app-url"]=="string"?e["app-url"]:void 0,m=typeof e.app=="string"?e.app:void 0,y=typeof e.caps=="string"&&e.caps.trim()?e.caps.trim():void 0,f,w,g;if(p&&(f=e.cloud===!0?"browserstack":String(e.cloud).toLowerCase(),be[f]||n.push(`--cloud must be ${Object.keys(be).join(" or ")} (got "${e.cloud}")`)),p){(!e.device||typeof e.device!="string")&&n.push('--cloud requires --device (the cloud device name, e.g. "Google Pixel 8")'),c||n.push("--cloud requires --platform (android or ios)"),d||n.push("--cloud requires --os (the device OS version, e.g. 14.0)"),m?n.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||n.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())&&n.push("--app-url requires a bs:// or lt:// app id"),h&&be[f]&&(f==="browserstack"&&h.startsWith("lt://")?n.push(`--app-url "${h}" is a LambdaTest app id, but the provider is browserstack`):f==="lambdatest"&&h.startsWith("bs://")&&n.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())&&n.push("--cloud-username requires a value"),e["cloud-access-key"]!==void 0&&(typeof e["cloud-access-key"]!="string"||!e["cloud-access-key"].trim())&&n.push("--cloud-access-key requires a value"),e.caps!==void 0&&(typeof e.caps!="string"||!e.caps.trim())&&n.push("--caps requires a path to a JSON file");let E=be[f];E&&(w=typeof e["cloud-username"]=="string"&&e["cloud-username"].trim()||t[E.envUsername]||void 0,g=typeof e["cloud-access-key"]=="string"&&e["cloud-access-key"].trim()||t[E.envAccessKey]||void 0,w||n.push(`cloud runs require a username \u2014 pass --cloud-username or set ${E.envUsername} (credentials are never read from your LIME account for CLI runs)`),g||n.push(`cloud runs require an access key \u2014 pass --cloud-access-key or set ${E.envAccessKey}`))}else e.app!==void 0&&(typeof e.app!="string"||!e.app.trim()?n.push("--app requires a path to an APK"):e.device?c&&c!=="android"&&n.push("--app is Android only"):n.push("--app requires --device (lime-cli must connect to a device to reinstall the app)")),e["app-url"]!==void 0&&n.push("--app-url requires --cloud"),e.os!==void 0&&n.push("--os requires --cloud"),e["cloud-username"]!==void 0&&n.push("--cloud-username requires --cloud"),e["cloud-access-key"]!==void 0&&n.push("--cloud-access-key requires --cloud"),e.caps!==void 0&&n.push("--caps requires --cloud");return{errors:n,listDevices:s,keepSession:r,noBoot:i,limeDir:o,device:e.device,platform:c,projectName:l,scenarioKey:u,app:m,cloud:p,cloudProvider:f,cloudUsername:w,cloudAccessKey:g,os:d,appUrl:h,capsPath:y,format:a}}var Ct=["browserstack","lambdatest","appium"];function si(e){let t=[],n=[];for(let[s,r]of Object.entries(e||{}))!r||typeof r!="object"||Array.isArray(r)?t.push(`--caps block "${s}" must be a JSON object, e.g. { "${s}": { "someCap": true } }`):Ct.includes(s)||n.push(`--caps block "${s}" is not one of ${Ct.join("/")} \u2014 it will be ignored (typo?)`);return{errors:t,warnings:n}}Pt.exports={parseArgs:Zr,parseCommand:ei,positionalPaths:Qr,validateArgs:ni,extToFilename:ti,validateCapsObject:si,COMMANDS:Lt}});var Bt=$((il,Ut)=>{"use strict";var ri=require("fs"),ii=require("path"),Mt=["LIME_CI_TOKEN","LIME_SERVER","LIME_NO_UPDATE_NOTICE","BROWSERSTACK_USERNAME","BROWSERSTACK_ACCESS_KEY","LT_USERNAME","LT_ACCESS_KEY"];function qt(e){let t={};for(let n of String(e||"").split(/\r?\n/)){let s=n.trim();if(!s||s.startsWith("#"))continue;let r=s.match(/^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(!r)continue;let i=r[2],o=i[0];(o==='"'||o==="'")&&i.indexOf(o,1)>0?i=i.slice(1,i.indexOf(o,1)):i=i.replace(/\s+#.*$/,"").trim(),t[r[1]]=i}return t}function oi(e,t=process.env){let n;try{n=ri.readFileSync(ii.join(e,".env"),"utf8")}catch{return[]}let s=qt(n),r=[];for(let i of Mt)t[i]!==void 0||!s[i]||(t[i]=s[i],r.push(i));return r}Ut.exports={parseDotEnv:qt,loadDotEnv:oi,DOTENV_KEYS:Mt}});var Ht=$((ol,Kt)=>{"use strict";var{DEFAULT_SERVER:ai}=W(),Ft={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.
@@ -630,7 +630,7 @@ ${i.flatMap(o=>is(o,n)).join(`
630
630
  `),p++}return p?0:1}async function Za(e){let t=e.args||{},n=e.env||{},s=e.out||(l=>process.stdout.write(l)),r=e.warn||(l=>process.stderr.write(l)),i=String(t.kind||"");if(!ks.includes(i))return r(`lime-cli pr reply: --kind must be one of ${ks.join(", ")}.
631
631
  `),2;let o=Is({event:(e.readEvent||Os(n))(),env:n,args:t});if(!o.ok)return r(`lime-cli pr reply: skipped \u2014 ${o.reason}
632
632
  `),0;if(!e.http)return r(`lime-cli pr reply: skipped \u2014 LIME_CI_TOKEN is not set.
633
- `),0;let a={repo:o.repo,prNumber:o.prNumber,kind:i};i==="ack"&&(a.commentId=o.commentId),typeof t.tests=="string"&&(a.tests=xs(t.tests,{outcome:i!=="started"})),typeof t.goal=="string"&&t.goal.trim()&&Array.isArray(a.tests)&&(a.tests=a.tests.map(l=>{if(l.n!=null)return l;let{label:u,...c}=l;return{goal:t.goal.trim().slice(0,2e3),...c}})),typeof t.head=="string"&&/^[0-9a-f]{7,40}$/i.test(t.head.trim())&&(a.headSha=t.head.trim()),typeof t["run-url"]=="string"&&(a.runUrl=t["run-url"]),typeof t["test-pr-url"]=="string"&&(a.testPrUrl=t["test-pr-url"]);try{let l=await e.http.json("POST","/api/cli/pr/reply",a),u=l&&l.body;!u||!u.success?r(`lime-cli pr reply: LIME did not reply \u2014 ${O(String(u&&u.error||`HTTP ${l&&l.status}`))}
633
+ `),0;let a={repo:o.repo,prNumber:o.prNumber,kind:i};o.commentId&&(a.commentId=o.commentId),typeof t.tests=="string"&&(a.tests=xs(t.tests,{outcome:i!=="started"})),typeof t.goal=="string"&&t.goal.trim()&&Array.isArray(a.tests)&&(a.tests=a.tests.map(l=>{if(l.n!=null)return l;let{label:u,...c}=l;return{goal:t.goal.trim().slice(0,2e3),...c}})),typeof t.head=="string"&&/^[0-9a-f]{7,40}$/i.test(t.head.trim())&&(a.headSha=t.head.trim()),typeof t["run-url"]=="string"&&(a.runUrl=t["run-url"]),typeof t["test-pr-url"]=="string"&&(a.testPrUrl=t["test-pr-url"]);try{let l=await e.http.json("POST","/api/cli/pr/reply",a),u=l&&l.body;!u||!u.success?r(`lime-cli pr reply: LIME did not reply \u2014 ${O(String(u&&u.error||`HTTP ${l&&l.status}`))}
634
634
  `):u.posted&&u.posted.written?s(`lime-cli pr reply: ${i} posted by the Taqwright GitHub App${u.posted.url?` \u2014 ${O(u.posted.url)}`:""}
635
635
  `):s(`lime-cli pr reply: not posted \u2014 ${O(String(u.posted&&u.posted.reason||"unknown"))}. Install the Taqwright GitHub App on ${o.repo} for replies.
636
636
  `)}catch(l){r(`lime-cli pr reply: could not reach LIME \u2014 ${O(String(l&&l.message||l))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqwright/lime-cli",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
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",