@skyramp/testbot-core 0.13.0-v3.136 → 0.13.0-v3.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VERSION.json +1 -1
- package/dist/main.js +2 -2
- package/dist/post.js +2 -2
- package/package.json +1 -1
package/dist/VERSION.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.13.0-v3.
|
|
1
|
+
{"version":"0.13.0-v3.137","commit":"a3646d233fc54ca205754777b8facc4ac1ca92e2"}
|
package/dist/main.js
CHANGED
|
@@ -803,14 +803,14 @@ ${wxr(t,e)}`}function wxr(t,e){if(t.inputs.appRunning)return[`${t.inputs.appRunn
|
|
|
803
803
|
`){if(!m)return f;c(f)}if(b==="\\"&&!(e==="go"&&d==="`")){f+=2;continue}if(d==="`"&&e==="js"){if(b==="$"&&t[f+1]==="{"){h++,f+=2;continue}if(b==="}"&&h>0){h--,f++;continue}}if(h===0&&t.startsWith(p,f))return f+p.length;f++}return n};for(;i<n;){let u=t[i];if(u===`
|
|
804
804
|
`){c(i),i++;continue}if(u===" "||u===" "||u==="\r"){i++;continue}if(s&&u==="#"||!s&&u==="/"&&t[i+1]==="/"){for(;i<n&&t[i]!==`
|
|
805
805
|
`;)i++;continue}if(!s&&u==="/"&&t[i+1]==="*"){let d=t.indexOf("*/",i+2),p=d<0?n:d+2;for(let m=i;m<p;m++)t[m]===`
|
|
806
|
-
`&&c(m);i=p;continue}if(u==='"'||u==="'"||u==="`"){let d={line:o,col:i-a},p=s&&t.startsWith(u.repeat(3),i)?3:1,m=l(i,u),f=t.slice(i+p,Math.max(i+p,m-p));r.push({kind:"s",text:f,...d,template:u==="`"&&e==="js"&&f.includes("${")}),i=m;continue}if(/[A-Za-z_$]/.test(u)){let d=i+1;for(;d<n&&/[\w$]/.test(t[d]);)d++;let p=t.slice(i,d);if(s&&rSr.test(p)&&(t[d]==='"'||t[d]==="'")){i=d;continue}r.push({kind:"i",text:p,line:o,col:i-a}),i=d;continue}if(/\d/.test(u)){let d=i+1;for(;d<n&&/[\w.]/.test(t[d]);)d++;r.push({kind:"n",text:t.slice(i,d),line:o,col:i-a}),i=d;continue}r.push({kind:"p",text:u,line:o,col:i-a}),i++}return r}var sSr={"(":")","[":"]","{":"}"};function zh(t,e){let r=t[e].text,n=sSr[r],s=0;for(let i=e;i<t.length;i++){let o=t[i];if(o.kind==="p"){if(o.text===r)s++;else if(o.text===n&&--s===0)return i}}return-1}var Gh=(t,e)=>e===0||t[e-1].line<t[e].line;function $Ae(t,e,r){let n=[],s=0,i=!0;for(let o=e+1;o<r;o++){let a=t[o];a.kind==="p"&&"([{<".includes(a.text)?s++:a.kind==="p"&&")]}>".includes(a.text)?s=Math.max(0,s-1):s===0&&a.text===","?i=!0:s===0&&i&&a.kind==="i"&&!["public","private","protected","readonly"].includes(a.text)&&(n.push(a.text),i=!1)}return n}function iSr(t,e){let r=new Map;for(let n=0;n+2<t.length;n++){let[s,i,o]=[t[n],t[n+1],t[n+2]];if(s.kind!=="i"||i.text!=="="||o.kind!=="s"||o.template)continue;let a=e==="py"?Gh(t,n)&&s.col===0:t[n-1]?.text==="const",c=t[n+3];a&&(!c||c.line>o.line||c.text===";")&&r.set(s.text,o.text)}return r}function qAe(t,e,r,n,s,i){let o=new Map(n.map((u,d)=>[u,`$${d}`])),a=[],c=e;for(i==="py"&&t[c]?.kind==="s"&&(c+1>=r||t[c+1].line>t[c].line)&&c++;c<r;c++){let u=t[c];if(u.kind==="s"){let d=u.template?u.text.replace(/\$\{\s*([A-Za-z_$][\w$]*)\s*\}/g,(p,m)=>s.get(m)??(o.has(m)?`\${${o.get(m)}}`:p)):u.text;a.push(JSON.stringify(d))}else u.kind==="i"&&t[c-1]?.text!=="."?a.push(o.get(u.text)??(s.has(u.text)?JSON.stringify(s.get(u.text)):u.text)):a.push(u.text)}return{key:a.filter(u=>u!==";").join(" ").replace(/ , (?=[)\]}])/g," "),size:a.length}}function Tft(t,e){let r=0,n=0;for(let s=e;s<t.length;s++){let i=t[s].text;if(i==="<")r++;else if(i===">"&&t[s-1]?.text!=="=")r=Math.max(0,r-1);else if(i==="(")n++;else if(i===")")n--;else{if(i==="{"&&r===0&&n===0)return s;if(i===";"||i==="="&&t[s+1]?.text!==">")return-1}}return-1}function oSr(t,e){return t.kind==="p"&&!")]}".includes(t.text)||e.kind==="p"&&".?:&|+-*/<>=".includes(e.text)}function aSr(t,e){let r=0;for(let n=e;n<t.length;n++){let s=t[n];if(s.kind==="p"&&"([{".includes(s.text))r++;else if(s.kind==="p"&&")]}".includes(s.text)){if(r===0)return n;r--}else if(r===0&&(s.text===";"||s.text===","||n>e&&s.line>t[n-1].line&&!oSr(t[n-1],s)))return n}return t.length}function kft(t){let e=new Set,r=n=>{let s=zh(t,n);for(let i=n+1;i>0&&i<s;i++){let o=t[i];o.kind!=="i"||t[i-1]?.text==="as"||t[i-1]?.text===":"||[",","}",":","as"].includes(t[i+1]?.text)&&e.add(o.text)}};for(let n=0;n<t.length;n++){let s=t[n].text;s==="export"&&t[n+1]?.text==="{"&&r(n+1),s==="exports"&&t[n+1]?.text==="="&&t[n+2]?.text==="{"&&r(n+2),s==="exports"&&t[n+1]?.text==="."&&t[n+2]?.kind==="i"&&e.add(t[n+2].text)}return e}function cSr(t,e){let r=[],n=kft(t),s=o=>{for(let a=o-1;a>=Math.max(0,o-4);a--){if(t[a].text==="export")return!0;if(!["default","async","function","*","const","let","var"].includes(t[a].text))return!1}return!1},i=(o,a,c,l,u)=>{let d=t[o].text,{key:p,size:m}=qAe(t,l,u,$Ae(t,a,c),e,"js");r.push({name:d,line:t[o].line,exported:s(o)||n.has(d),key:p,size:m})};for(let o=0;o<t.length;o++){let a=t[o];if(a.kind==="i"){if(a.text==="function"){let c=o+1;if(t[c]?.text==="*"&&c++,t[c]?.kind!=="i")continue;let l=c++;if(t[c]?.text==="<")for(;c<t.length&&t[c].text!=="(";)c++;if(t[c]?.text!=="(")continue;let u=zh(t,c),d=u<0?-1:Tft(t,u+1),p=d<0?-1:zh(t,d);p>0&&i(l,c,u,d+1,p);continue}if((a.text==="const"||a.text==="let"||a.text==="var")&&t[o+1]?.kind==="i"){let c=o+1,l=o+2;if(t[l]?.text===":")for(;l<t.length&&t[l].text!=="="&&t[l].line===t[c].line;)l++;if(t[l]?.text!=="=")continue;l++,t[l]?.text==="async"&&l++;let u,d;if(t[l]?.text==="("){if(u=l,d=zh(t,l),d<0)continue}else if(t[l]?.kind==="i"&&t[l+1]?.text==="="&&t[l+2]?.text===">")u=l-1,d=l+1;else continue;let p=d+1;if(t[p]?.text===":")for(;p<t.length&&!(t[p].text==="="&&t[p+1]?.text===">")&&t[p].text!==";";)p++;if(t[p]?.text!=="="||t[p+1]?.text!==">")continue;if(p+=2,t[p]?.text==="{"){let m=zh(t,p);m>0&&i(c,u,d,p+1,m)}else i(c,u,d,p,aSr(t,p))}}}return r}function lSr(t,e){let r=[];for(let n=0;n<t.length;n++){if(t[n].text!=="def"||t[n+1]?.kind!=="i"||t[n+2]?.text!=="(")continue;let s=t[n-1]?.text==="async"&&Gh(t,n-1);if(!s&&!Gh(t,n))continue;let i=t[s?n-1:n].col,o=zh(t,n+2);if(o<0)continue;let a=o+1;for(;a<t.length&&t[a].text!==":";)a++;let c=a+1;for(;c<t.length&&!(Gh(t,c)&&t[c].line>t[a].line&&t[c].col<=i);)c++;let l=$Ae(t,n+2,o).filter(m=>m!=="self"&&m!=="cls"),{key:u,size:d}=qAe(t,a+1,c,l,e,"py"),p=t[n+1].text;r.push({name:p,line:t[n+1].line,exported:i===0&&!p.startsWith("_"),key:u,size:d})}return r}function uSr(t,e){let r=[];for(let n=0;n<t.length;n++){if(t[n].text!=="func"||!Gh(t,n))continue;let s=n+1;if(t[s]?.text==="("&&(s=zh(t,s)+1),s<=0||t[s]?.kind!=="i"||t[s+1]?.text!=="(")continue;let i=zh(t,s+1),o=i<0?-1:Tft(t,i+1),a=o<0?-1:zh(t,o);if(a<0)continue;let{key:c,size:l}=qAe(t,o+1,a,$Ae(t,s+1,i),e,"go");r.push({name:t[s].text,line:t[s].line,exported:/^[A-Z]/.test(t[s].text),key:c,size:l})}return r}function dSr(t,e){let r=[],n=[];if(e==="js"){for(let s=0;s<t.length;s++){if(t[s].text!=="import"||!Gh(t,s)||t[s+1]?.text==="(")continue;let i=s+1;for(;i<t.length&&t[i].kind!=="s"&&t[i].text!==";";)i++;if(t[i]?.kind==="s"&&(n.push([s,i]),t[s+1]?.text!=="type"))for(let o=s+1;o<i;o++){let a=t[o];a.kind!=="i"||["from","as","type"].includes(a.text)||t[o-1]?.text==="type"||t[o+1]?.text!=="as"&&r.push({local:a.text,from:t[i].text,line:a.line})}}for(let s=0;s<t.length;s++){if(t[s].text!=="require"||t[s+1]?.text!=="("||t[s+2]?.kind!=="s"||t[s+3]?.text!==")"||t[s-1]?.text!=="=")continue;let i=t[s+2].text,o=s-2;if(t[o]?.kind==="i"&&["const","let","var"].includes(t[o-1]?.text)){n.push([o-1,s+3]),r.push({local:t[o].text,from:i,line:t[o].line});continue}if(t[o]?.text!=="}")continue;let a=o;for(let c=0;a>=0;a--)if(t[a].text==="}")c++;else if(t[a].text==="{"&&--c===0)break;if(!(a<1||!["const","let","var"].includes(t[a-1].text))){n.push([a-1,s+3]);for(let c=a+1;c<o;c++)t[c].kind==="i"&&t[c+1]?.text!==":"&&r.push({local:t[c].text,from:i,line:t[c].line})}}}else if(e==="py"){for(let s=0;s<t.length;s++){if(t[s].text!=="from"||!Gh(t,s))continue;let i=s+1,o="";for(;i<t.length&&t[i].text!=="import"&&t[i].line===t[s].line;)o+=t[i++].text;if(t[i]?.text!=="import")continue;let a=t[i+1]?.text==="(",c=i+1;for(;c<t.length&&!(a?t[c].text===")":t[c].line>t[i].line&&t[c-1].text!=="\\");)c++;n.push([s,a?c:c-1]);for(let l=i+1;l<c;l++){let u=t[l];u.kind!=="i"||u.text==="as"||t[l+1]?.text==="as"||r.push({local:u.text,from:o,line:u.line})}}for(let s=0;s<t.length;s++){if(t[s].text!=="import"||!Gh(t,s))continue;let i=s+1;for(;i<t.length&&t[i].line===t[s].line;){let o="",a=t[i];for(;i<t.length&&t[i].line===t[s].line&&t[i].text!==","&&t[i].text!=="as";)o+=t[i++].text;let c=a?.kind==="i"?a.text:"";t[i]?.text==="as"&&t[i+1]?.kind==="i"&&(c=t[i+1].text,i+=2),c&&o&&r.push({local:c,from:o,line:a.line}),t[i]?.text===","&&i++}n.push([s,i-1])}}return{imports:r,spans:n}}function pSr(t,e,r){let n=new Set(r.map(s=>s.from));if(e==="js")for(let s=0;s<t.length;s++){let i=t[s];if(i.kind!=="s")continue;let o=t[s-1]?.text;(o==="from"||o==="import"&&t[s-1]?.kind==="i"||o==="("&&["require","import"].includes(t[s-2]?.text??"")&&t[s+1]?.text===")")&&n.add(i.text)}return[...n]}function mSr(t,e){let r=0;for(let n=0;n<t.length;n++){if(t[n].kind!=="i"||t[n].text!=="class")continue;let s=t[n+1];(e==="py"?Gh(t,n)&&s?.kind==="i":s&&(s.kind==="i"||s.text==="{"))&&r++}return r}function n0(t,e){let r=jh(e);if(!r)return;let n=nSr(t,r),s=iSr(n,r),i=r==="js"?cSr(n,s):r==="py"?lSr(n,s):uSr(n,s),{imports:o,spans:a}=dSr(n,r),c=new Map,l=d=>c.set(d,(c.get(d)??0)+1),u=0;for(let d=0;d<n.length;d++){for(;u<a.length&&d>a[u][1];)u++;if(u<a.length&&d>=a[u][0])continue;let p=n[d];if(p.kind==="i")l(p.text);else if(p.kind==="s"&&(p.template||r==="py"&&p.text.includes("{")))for(let m of p.text.matchAll(/\{[^{}]*\}/g))for(let f of m[0].matchAll(/[A-Za-z_$][\w$]*/g))l(f[0])}return{lang:r,functions:i,imports:o,uses:c,listedExports:r==="js"?kft(n):new Set,deps:pSr(n,r,o),classes:r==="go"?0:mSr(n,r)}}var hSr=15,gSr=6,Px=t=>fa.test(t),ASr=/utils?|skyramp/i,ySr=/utils?/i,s0=t=>fr.posix.basename(t).replace(/\.[^.]+$/,""),bSr=/^(conftest\.py|__init__\.py|[^/]*\.config\.[cm]?[jt]s|[^/]+\.(setup|teardown)\.[cm]?[jt]sx?|setupTests\.[cm]?[jt]sx?)$/i,ESr=/^([\w.-]+\.config\.([cm]?[jt]s|json)|package\.json|pytest\.ini|pyproject\.toml|setup\.cfg|tox\.ini)$/i,Bft=t=>t.replace(/\.([cm]?[jt]sx?|py)$/,"");function wSr(t,e){let r=Bft(e),n=fr.posix.dirname(t.rel);return(t.text.match(/[\w@$.\-/]+/g)??[]).some(i=>{let o=i.replace(/^<rootDir>\//,"").replace(/[.,]+$/,"");if(!o)return!1;let a=Bft(fr.posix.normalize(fr.posix.join(o.startsWith("/")?".":n,o.replace(/^\//,"")))),c=/^[A-Za-z_][\w.]*$/.test(o)&&o.includes(".")?o.replace(/\./g,"/"):void 0;return a===r||c!==void 0&&(c===r||fr.posix.join(n,c)===r)})}function Pft(t,e){return bSr.test(fr.posix.basename(t))?!0:e.some(r=>wSr(r,t))}var HAe=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"];function i0(t,e,r,n){let s=fr.posix.dirname(t),i=o=>o.map(a=>fr.posix.normalize(a)).find(a=>!a.startsWith("..")&&n(a));if(r==="js"){if(!e.startsWith("."))return;let o=fr.posix.join(s,e),a=o.replace(/\.[cm]?js$/,"");return i([o,...HAe.map(c=>o+c),...HAe.map(c=>a+c),...HAe.map(c=>`${o}/index${c}`)])}if(r==="py"){let o=e.match(/^\.*/)[0].length,a=e.slice(o).replace(/\./g,"/"),c=[];if(o){let l=s;for(let u=1;u<o;u++)l=fr.posix.dirname(l);c.push(l)}else for(let l=s;c.push(l),!(l==="."||l==="/"||l==="");l=fr.posix.dirname(l));return i(c.flatMap(l=>a?[`${l}/${a}.py`,`${l}/${a}/__init__.py`]:[`${l}/__init__.py`]))}}var _ft=t=>`${t.rel}:${t.fn.line}`;function xSr(t,e){return[...new Set(t.code.imports.map(r=>i0(t.rel,r.from,t.code.lang,e)).filter(r=>!!r&&!Px(r)))]}function SSr(t){let e=k=>{let M=n0(k.text,k.rel);return M?{rel:k.rel,code:M,test:Px(k.rel)}:void 0},r=t.written.flatMap(k=>{let M=e(k),F=k.before===void 0?void 0:n0(k.before,k.rel);return M?[{...M,before:F,isNew:k.before===void 0,definesHelpers:M.code.functions.length>0||M.code.classes>0}]:[]}),n=t.existing.flatMap(k=>e(k)??[]),s=new Map([...n,...r].map(k=>[k.rel,k])),i=k=>s.has(k),o=[],a=new Map,c=k=>a.set(k.fn.key,[...a.get(k.fn.key)??[],k]);for(let k of n)for(let M of k.code.functions)c({rel:k.rel,fn:M,lang:k.code.lang,test:k.test});for(let k of r){let M=new Set(k.code.functions.map(F=>F.name));for(let F of k.before?.functions??[])M.has(F.name)&&c({rel:k.rel,fn:F,lang:k.code.lang,test:k.test})}let l=(k,M)=>k.key===M.key&&(k.size>=hSr||k.name===M.name&&k.size>=gSr),u=(k,M)=>new Set((a.get(k.key)??[]).filter(F=>F.lang===M&&l(k,F.fn)).map(F=>F.rel)).size>=2,d=r.flatMap(k=>{let M=new Set((k.before?.functions??[]).map(F=>F.name));return k.code.functions.filter(F=>!M.has(F.name)).map(F=>({w:k,fn:F}))}),p=k=>{let M=k.flatMap(F=>xSr(F,i)).find(F=>!r.some(X=>X.rel===F&&X.isNew));return M?`the repo's ${M}`:"the repo's shared test-support module (else a module beside the tests that use it, laid out the way the repo keeps its tests, named for what it holds)"},m=new Set;for(let{w:k,fn:M}of d){if(u(M,k.code.lang))continue;let F=(a.get(M.key)??[]).find(H=>H.lang===k.code.lang&&!(H.rel===k.rel&&H.fn.name===M.name)&&l(M,H.fn));if(!F)continue;m.add(M);let X=s.get(F.rel);F.fn.exported||!F.test?o.push(`${k.rel}:${M.line} ${M.name} copies ${F.fn.name} (${_ft(F)}) \u2014 import ${F.fn.name} from there instead of defining it again`):o.push(`${k.rel}:${M.line} ${M.name} copies ${F.fn.name}, local to ${_ft(F)} \u2014 move ${F.fn.name} into ${p([k,...X?[X]:[]])} and import it in both files; no second copy`)}let f=r.filter(k=>k.isNew&&!k.test),h=new Map;for(let{w:k,fn:M}of d){if(!k.test||m.has(M))continue;let F=f.find(z=>z.code.lang===k.code.lang&&z.code.functions.some(B=>l(M,B))),X=F?.code.functions.find(z=>l(M,z));if(!F||!X)continue;m.add(M);let H=`${k.rel}:${M.line} ${M.name} copies ${X.name} (${F.rel}:${X.line}) \u2014 import ${X.name} from there instead of defining it again`,q=h.get(F.rel)??{tests:new Set,sent:[]};q.tests.add(k.rel),q.sent.push(H),h.set(F.rel,q),o.push(H)}let b=[],E=k=>cO(k).dir;for(let k of d){if(!k.w.test||m.has(k.fn)||u(k.fn,k.w.code.lang))continue;let M=b.find(F=>F[0].w.code.lang===k.w.code.lang&&E(F[0].w.rel)===E(k.w.rel)&&l(F[0].fn,k.fn));M?M.push(k):b.push([k])}for(let k of b){let M=[...new Map(k.map(F=>[F.w.rel,F.w])).values()];M.length<2||o.push(`${k[0].fn.name} is defined in ${M.length} test files (${M.map(F=>F.rel).join(", ")}) \u2014 define it once, in ${p(M)}, and import it from each`)}for(let k of r){let M=new Set((k.before?.imports??[]).map(F=>`${F.local}\0${F.from}`));for(let F of k.code.imports){if(M.has(`${F.local}\0${F.from}`)||(k.code.uses.get(F.local)??0)>0)continue;(F.from.startsWith(".")||i0(k.rel,F.from,k.code.lang,i)!==void 0)&&o.push(`${k.rel}:${F.line} imports ${F.local} from ${F.from} and never uses it \u2014 use it, or drop the import`)}}let A=new Map([...(t.otherTests??[]).flatMap(k=>e(k)??[]).map(k=>[k.rel,k]),...s]),w=k=>[...A.values()].filter(M=>M.rel!==k&&M.code.deps.some(F=>i0(M.rel,F,M.code.lang,i)===k)),C=n.filter(k=>!k.test&&(k.code.functions.length>0||k.code.classes>0)&&!Pft(k.rel,t.configs??[])).map(k=>({rel:k.rel,users:w(k.rel).filter(M=>M.test&&!r.some(F=>F.rel===M.rel)).length})).filter(k=>k.users>0),R=C.filter(k=>k.users===1),T=k=>R.some(M=>fr.posix.dirname(M.rel)===fr.posix.dirname(k))||C.length>0&&R.length*2>=C.length,N=new Set;for(let k of r){if(!k.isNew||k.test||!k.definesHelpers||Pft(k.rel,t.configs??[])||T(k.rel))continue;let M=w(k.rel);if(M.some(q=>!q.test))continue;let F=h.get(k.rel),X=new Set([...M.map(q=>q.rel),...F?.tests??[]]);if(X.size!==1)continue;N.add(k.rel);let H=[...X][0];if(F)for(let q of F.sent)o.splice(o.indexOf(q),1);o.push(`${k.rel} is imported only by ${H}${F?", which also copies its helpers":""} \u2014 move its contents into ${H} and delete ${k.rel}; keep it only if a second test file uses it`)}for(let k of r){if(!k.isNew||k.test||N.has(k.rel))continue;let M=new Map;for(let F of k.code.functions){if(!F.exported||(k.code.uses.get(F.name)??0)-1-(k.code.listedExports.has(F.name)?1:0)>0)continue;let H=[...s.values()].filter(q=>q.test&&q.rel!==k.rel&&(q.code.uses.get(F.name)??0)>0&&q.code.imports.some(z=>i0(q.rel,z.from,q.code.lang,i)===k.rel));H.length===1&&M.set(H[0].rel,[...M.get(H[0].rel)??[],F.name])}for(let[F,X]of M)o.push(`${k.rel}: ${X.join(", ")} ${X.length>1?"are":"is"} used only by ${F} \u2014 a helper only one test file uses stays in that file`)}let Q=n.some(k=>!k.test&&ySr.test(s0(k.rel)));for(let k of r){if(!k.isNew||k.test||!k.code.functions.length)continue;let M=s0(k.rel);(/skyramp/i.test(M)||!Q&&ASr.test(M))&&o.push(`${k.rel}: name the module for what it holds (e.g. orders, session, pages) \u2014 not "utils" or "Skyramp"`)}return o}var hW=new Set(["node_modules",".git","dist","build","coverage","test-results","playwright-report","__pycache__",".venv","venv","vendor",".next","target"]),Dft=new RegExp(`(^|/)(${[...hW].map(t=>t.replace(/\./g,"\\.")).join("|")})/`),Lft=/^(tests?|e2e|e2e-tests|__tests__|specs?|playwright|cypress|integration|testing)$/i,CSr=/test|spec|helper|support|fixture|page/i,Oft=3e3,ISr=256*1024,vSr=4e3;function Bx(t){try{let e=gW.statSync(t);return e.isFile()&&e.size<=ISr?gW.readFileSync(t,"utf-8"):void 0}catch{return}}function RSr(t,e){try{return(0,Qft.execFileSync)("git",[...Gi,"show",`HEAD:${e}`],{cwd:t,env:xt(),encoding:"utf-8",maxBuffer:16*1024*1024,stdio:["ignore","pipe","ignore"]})}catch{return}}function cO(t){let e=fr.posix.dirname(t).split("/").filter(n=>n&&n!=="."),r=e.findIndex(n=>Lft.test(n));return r>=0?{dir:e.slice(0,r+1).join("/"),deep:!0}:{dir:e.join("/"),deep:!1}}function zAe(t,e){let r=[];for(let u of my(t)){if(!jh(u.path)||Dft.test(u.path)||u.code.includes("D")||e?.has(fr.resolve(t,u.path)))continue;let d=Bx(fr.join(t,u.path));if(d===void 0)continue;let p=u.code==="??"||u.code[0]==="A";r.push({rel:u.path,text:d,before:p?void 0:RSr(t,u.path)??void 0})}let n=new Set(r.map(u=>u.rel)),s=[],i=new Set;for(let{dir:u,deep:d}of new Map(r.map(p=>[JSON.stringify(cO(p.rel)),cO(p.rel)])).values())um(fr.join(t,u),p=>{let m=fr.relative(t,p).split(fr.sep).join("/");if(i.has(m)||n.has(m)||!jh(m)||!d&&!Px(m)&&!CSr.test(fr.posix.basename(m)))return;i.add(m);let f=Bx(p);if(f!==void 0&&s.push({rel:m,text:f}),s.length>=Oft)return!1},{skip:hW,maxDepth:d?8:0});let o=u=>Bx(fr.join(t,u))!==void 0;for(let u of r){let d=n0(u.text,u.rel);if(d)for(let p of d.imports){if(s.length>=Oft)break;let m=i0(u.rel,p.from,d.lang,o);if(!m||i.has(m)||n.has(m)||Dft.test(m))continue;i.add(m);let f=Bx(fr.join(t,m));f!==void 0&&s.push({rel:m,text:f})}}let a=r.filter(u=>u.before===void 0&&!Px(u.rel)),c=[],l=[];if(a.length){let u=a.map(m=>s0(m.rel)),d=[...new Set(a.flatMap(m=>/^(index|__init__)$/.test(s0(m.rel))?[s0(m.rel),fr.posix.basename(fr.posix.dirname(m.rel))]:[s0(m.rel)]))],p=0;um(t,(m,f)=>{let h=f.split(fr.sep).join("/"),b=ESr.test(fr.posix.basename(h)),E=!b&&Px(h)&&jh(h)!==void 0&&!i.has(h)&&!n.has(h);if(!b&&!E)return;if(E&&++p>vSr)return!1;let A=Bx(m);A!==void 0&&(b?u:d).some(w=>A.includes(w))&&(b?l:c).push({rel:h,text:A})},{skip:hW,maxDepth:10})}return{written:r,existing:s,otherTests:c,configs:l}}var GAe="write-reuse",NSr=/\bcopies\b| is defined in \d+ test files | is imported only by /;function Mft(t){return NSr.test(t)}var Fft={name:GAe,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let i of kt(t.inputs)){let o=i.path===t.inputs.repositoryPath?"":qt(t.inputs,i.slug);r.push(...SSr(zAe(i.path,e)).map(a=>o+a))}let n=r.filter(i=>!Mft(i));n.length&&console.log(`[${this.name}] noted, not sent back: ${n.join("; ")}`);let s=r.filter(Mft);return s.length?{...ve(this.name,s),repairable:!0}:{name:this.name,passed:!0}}},TSr=10,kSr=/test|spec|helper|support|fixture/i,BSr=t=>t.split("/").some(e=>Lft.test(e)||kSr.test(e)),PSr=10,_Sr=4e3;function DSr(t,e){let r=e==="js"?/^export\s+(?:default\s+)?(?:async\s+)?(?:function\*?|class|const|let)\s+([A-Za-z_$][\w$]*)/gm:/^(?:async\s+)?(?:def|class)\s+([A-Za-z]\w*)/gm,n=[...t.matchAll(r)].map(i=>i[1]),s=e==="js"?[...n0(t,"x.ts")?.listedExports??[]]:[];return[...new Set([...n,...s])]}function Uft(t){let e=new Set,r=[];um(t,(o,a)=>{let c=a.split(fr.sep).join("/"),l=jh(c);l!=="js"&&l!=="py"||(e.add(c),Px(c)&&r.length<_Sr&&r.push(c))},{skip:hW,maxDepth:10});let n=o=>e.has(o),s=new Map;for(let o of r){let a=Bx(fr.join(t,o)),c=a===void 0?void 0:n0(a,o);if(!c)continue;let l=new Set(c.imports.map(u=>i0(o,u.from,c.lang,n)).filter(u=>!!u&&!Px(u)));for(let u of l)s.set(u,(s.get(u)??0)+1)}for(let o of e){if(fr.posix.basename(o)!=="conftest.py")continue;let a=fr.posix.dirname(o),c=r.filter(l=>l.endsWith(".py")&&(a==="."||l.startsWith(`${a}/`))).length;c&&s.set(o,Math.max(s.get(o)??0,c))}let i=o=>fr.posix.basename(o)==="conftest.py";return[...s].filter(([o,a])=>a>=2&&(BSr(o)||i(o))).sort((o,a)=>a[1]-o[1]||o[0].localeCompare(a[0])).slice(0,TSr).map(([o,a])=>{let c=Bx(fr.join(t,o))??"";return{rel:o,importers:a,names:DSr(c,jh(o)).slice(0,PSr)}})}function $ft(t){return t.length?["The repo's shared test helpers, by how many of its test files use them:",...t.map(({label:e,module:r})=>` - ${e}${r.rel} (${r.importers} test files)${r.names.length?`: ${r.names.join(", ")}`:""}`)]:[]}var Hft=$(require("path"));var OSr=10,MSr=3,QSr=5,LSr=/\.(?:locator|getBy[A-Z]\w*|get_by_\w+)\(/g,FSr=/^\s*(?:export\s+(?:default\s+)?)?class\s+\w+/m,USr=/@testing-library\/|from ["']enzyme["']/,AW=t=>(t.match(LSr)??[]).length,$Sr=/@playwright\/test|from\s+['"]playwright|\bpage\.(?:goto|locator|getBy\w+)\s*\(|\bcy\.(?:visit|get)\s*\(|webdriver|selenium|newSkyrampPlaywrightPage/i,qft=(t,e)=>zft(t,e)&&$Sr.test(e);function qSr(t,e){if(e===void 0)return AW(t);let r=new Map;for(let s of e.split(`
|
|
806
|
+
`&&c(m);i=p;continue}if(u==='"'||u==="'"||u==="`"){let d={line:o,col:i-a},p=s&&t.startsWith(u.repeat(3),i)?3:1,m=l(i,u),f=t.slice(i+p,Math.max(i+p,m-p));r.push({kind:"s",text:f,...d,template:u==="`"&&e==="js"&&f.includes("${")}),i=m;continue}if(/[A-Za-z_$]/.test(u)){let d=i+1;for(;d<n&&/[\w$]/.test(t[d]);)d++;let p=t.slice(i,d);if(s&&rSr.test(p)&&(t[d]==='"'||t[d]==="'")){i=d;continue}r.push({kind:"i",text:p,line:o,col:i-a}),i=d;continue}if(/\d/.test(u)){let d=i+1;for(;d<n&&/[\w.]/.test(t[d]);)d++;r.push({kind:"n",text:t.slice(i,d),line:o,col:i-a}),i=d;continue}r.push({kind:"p",text:u,line:o,col:i-a}),i++}return r}var sSr={"(":")","[":"]","{":"}"};function zh(t,e){let r=t[e].text,n=sSr[r],s=0;for(let i=e;i<t.length;i++){let o=t[i];if(o.kind==="p"){if(o.text===r)s++;else if(o.text===n&&--s===0)return i}}return-1}var Gh=(t,e)=>e===0||t[e-1].line<t[e].line;function $Ae(t,e,r){let n=[],s=0,i=!0;for(let o=e+1;o<r;o++){let a=t[o];a.kind==="p"&&"([{<".includes(a.text)?s++:a.kind==="p"&&")]}>".includes(a.text)?s=Math.max(0,s-1):s===0&&a.text===","?i=!0:s===0&&i&&a.kind==="i"&&!["public","private","protected","readonly"].includes(a.text)&&(n.push(a.text),i=!1)}return n}function iSr(t,e){let r=new Map;for(let n=0;n+2<t.length;n++){let[s,i,o]=[t[n],t[n+1],t[n+2]];if(s.kind!=="i"||i.text!=="="||o.kind!=="s"||o.template)continue;let a=e==="py"?Gh(t,n)&&s.col===0:t[n-1]?.text==="const",c=t[n+3];a&&(!c||c.line>o.line||c.text===";")&&r.set(s.text,o.text)}return r}function qAe(t,e,r,n,s,i){let o=new Map(n.map((u,d)=>[u,`$${d}`])),a=[],c=e;for(i==="py"&&t[c]?.kind==="s"&&(c+1>=r||t[c+1].line>t[c].line)&&c++;c<r;c++){let u=t[c];if(u.kind==="s"){let d=u.template?u.text.replace(/\$\{\s*([A-Za-z_$][\w$]*)\s*\}/g,(p,m)=>s.get(m)??(o.has(m)?`\${${o.get(m)}}`:p)):u.text;a.push(JSON.stringify(d))}else u.kind==="i"&&t[c-1]?.text!=="."?a.push(o.get(u.text)??(s.has(u.text)?JSON.stringify(s.get(u.text)):u.text)):a.push(u.text)}return{key:a.filter(u=>u!==";").join(" ").replace(/ , (?=[)\]}])/g," "),size:a.length}}function Tft(t,e){let r=0,n=0;for(let s=e;s<t.length;s++){let i=t[s].text;if(i==="<")r++;else if(i===">"&&t[s-1]?.text!=="=")r=Math.max(0,r-1);else if(i==="(")n++;else if(i===")")n--;else{if(i==="{"&&r===0&&n===0)return s;if(i===";"||i==="="&&t[s+1]?.text!==">")return-1}}return-1}function oSr(t,e){return t.kind==="p"&&!")]}".includes(t.text)||e.kind==="p"&&".?:&|+-*/<>=".includes(e.text)}function aSr(t,e){let r=0;for(let n=e;n<t.length;n++){let s=t[n];if(s.kind==="p"&&"([{".includes(s.text))r++;else if(s.kind==="p"&&")]}".includes(s.text)){if(r===0)return n;r--}else if(r===0&&(s.text===";"||s.text===","||n>e&&s.line>t[n-1].line&&!oSr(t[n-1],s)))return n}return t.length}function kft(t){let e=new Set,r=n=>{let s=zh(t,n);for(let i=n+1;i>0&&i<s;i++){let o=t[i];o.kind!=="i"||t[i-1]?.text==="as"||t[i-1]?.text===":"||[",","}",":","as"].includes(t[i+1]?.text)&&e.add(o.text)}};for(let n=0;n<t.length;n++){let s=t[n].text;s==="export"&&t[n+1]?.text==="{"&&r(n+1),s==="exports"&&t[n+1]?.text==="="&&t[n+2]?.text==="{"&&r(n+2),s==="exports"&&t[n+1]?.text==="."&&t[n+2]?.kind==="i"&&e.add(t[n+2].text)}return e}function cSr(t,e){let r=[],n=kft(t),s=o=>{for(let a=o-1;a>=Math.max(0,o-4);a--){if(t[a].text==="export")return!0;if(!["default","async","function","*","const","let","var"].includes(t[a].text))return!1}return!1},i=(o,a,c,l,u)=>{let d=t[o].text,{key:p,size:m}=qAe(t,l,u,$Ae(t,a,c),e,"js");r.push({name:d,line:t[o].line,exported:s(o)||n.has(d),key:p,size:m})};for(let o=0;o<t.length;o++){let a=t[o];if(a.kind==="i"){if(a.text==="function"){let c=o+1;if(t[c]?.text==="*"&&c++,t[c]?.kind!=="i")continue;let l=c++;if(t[c]?.text==="<")for(;c<t.length&&t[c].text!=="(";)c++;if(t[c]?.text!=="(")continue;let u=zh(t,c),d=u<0?-1:Tft(t,u+1),p=d<0?-1:zh(t,d);p>0&&i(l,c,u,d+1,p);continue}if((a.text==="const"||a.text==="let"||a.text==="var")&&t[o+1]?.kind==="i"){let c=o+1,l=o+2;if(t[l]?.text===":")for(;l<t.length&&t[l].text!=="="&&t[l].line===t[c].line;)l++;if(t[l]?.text!=="=")continue;l++,t[l]?.text==="async"&&l++;let u,d;if(t[l]?.text==="("){if(u=l,d=zh(t,l),d<0)continue}else if(t[l]?.kind==="i"&&t[l+1]?.text==="="&&t[l+2]?.text===">")u=l-1,d=l+1;else continue;let p=d+1;if(t[p]?.text===":")for(;p<t.length&&!(t[p].text==="="&&t[p+1]?.text===">")&&t[p].text!==";";)p++;if(t[p]?.text!=="="||t[p+1]?.text!==">")continue;if(p+=2,t[p]?.text==="{"){let m=zh(t,p);m>0&&i(c,u,d,p+1,m)}else i(c,u,d,p,aSr(t,p))}}}return r}function lSr(t,e){let r=[];for(let n=0;n<t.length;n++){if(t[n].text!=="def"||t[n+1]?.kind!=="i"||t[n+2]?.text!=="(")continue;let s=t[n-1]?.text==="async"&&Gh(t,n-1);if(!s&&!Gh(t,n))continue;let i=t[s?n-1:n].col,o=zh(t,n+2);if(o<0)continue;let a=o+1;for(;a<t.length&&t[a].text!==":";)a++;let c=a+1;for(;c<t.length&&!(Gh(t,c)&&t[c].line>t[a].line&&t[c].col<=i);)c++;let l=$Ae(t,n+2,o).filter(m=>m!=="self"&&m!=="cls"),{key:u,size:d}=qAe(t,a+1,c,l,e,"py"),p=t[n+1].text;r.push({name:p,line:t[n+1].line,exported:i===0&&!p.startsWith("_"),key:u,size:d})}return r}function uSr(t,e){let r=[];for(let n=0;n<t.length;n++){if(t[n].text!=="func"||!Gh(t,n))continue;let s=n+1;if(t[s]?.text==="("&&(s=zh(t,s)+1),s<=0||t[s]?.kind!=="i"||t[s+1]?.text!=="(")continue;let i=zh(t,s+1),o=i<0?-1:Tft(t,i+1),a=o<0?-1:zh(t,o);if(a<0)continue;let{key:c,size:l}=qAe(t,o+1,a,$Ae(t,s+1,i),e,"go");r.push({name:t[s].text,line:t[s].line,exported:/^[A-Z]/.test(t[s].text),key:c,size:l})}return r}function dSr(t,e){let r=[],n=[];if(e==="js"){for(let s=0;s<t.length;s++){if(t[s].text!=="import"||!Gh(t,s)||t[s+1]?.text==="(")continue;let i=s+1;for(;i<t.length&&t[i].kind!=="s"&&t[i].text!==";";)i++;if(t[i]?.kind==="s"&&(n.push([s,i]),t[s+1]?.text!=="type"))for(let o=s+1;o<i;o++){let a=t[o];a.kind!=="i"||["from","as","type"].includes(a.text)||t[o-1]?.text==="type"||t[o+1]?.text!=="as"&&r.push({local:a.text,from:t[i].text,line:a.line})}}for(let s=0;s<t.length;s++){if(t[s].text!=="require"||t[s+1]?.text!=="("||t[s+2]?.kind!=="s"||t[s+3]?.text!==")"||t[s-1]?.text!=="=")continue;let i=t[s+2].text,o=s-2;if(t[o]?.kind==="i"&&["const","let","var"].includes(t[o-1]?.text)){n.push([o-1,s+3]),r.push({local:t[o].text,from:i,line:t[o].line});continue}if(t[o]?.text!=="}")continue;let a=o;for(let c=0;a>=0;a--)if(t[a].text==="}")c++;else if(t[a].text==="{"&&--c===0)break;if(!(a<1||!["const","let","var"].includes(t[a-1].text))){n.push([a-1,s+3]);for(let c=a+1;c<o;c++)t[c].kind==="i"&&t[c+1]?.text!==":"&&r.push({local:t[c].text,from:i,line:t[c].line})}}}else if(e==="py"){for(let s=0;s<t.length;s++){if(t[s].text!=="from"||!Gh(t,s))continue;let i=s+1,o="";for(;i<t.length&&t[i].text!=="import"&&t[i].line===t[s].line;)o+=t[i++].text;if(t[i]?.text!=="import")continue;let a=t[i+1]?.text==="(",c=i+1;for(;c<t.length&&!(a?t[c].text===")":t[c].line>t[i].line&&t[c-1].text!=="\\");)c++;n.push([s,a?c:c-1]);for(let l=i+1;l<c;l++){let u=t[l];u.kind!=="i"||u.text==="as"||t[l+1]?.text==="as"||r.push({local:u.text,from:o,line:u.line})}}for(let s=0;s<t.length;s++){if(t[s].text!=="import"||!Gh(t,s))continue;let i=s+1;for(;i<t.length&&t[i].line===t[s].line;){let o="",a=t[i];for(;i<t.length&&t[i].line===t[s].line&&t[i].text!==","&&t[i].text!=="as";)o+=t[i++].text;let c=a?.kind==="i"?a.text:"";t[i]?.text==="as"&&t[i+1]?.kind==="i"&&(c=t[i+1].text,i+=2),c&&o&&r.push({local:c,from:o,line:a.line}),t[i]?.text===","&&i++}n.push([s,i-1])}}return{imports:r,spans:n}}function pSr(t,e,r){let n=new Set(r.map(s=>s.from));if(e==="js")for(let s=0;s<t.length;s++){let i=t[s];if(i.kind!=="s")continue;let o=t[s-1]?.text;(o==="from"||o==="import"&&t[s-1]?.kind==="i"||o==="("&&["require","import"].includes(t[s-2]?.text??"")&&t[s+1]?.text===")")&&n.add(i.text)}return[...n]}function mSr(t,e){let r=0;for(let n=0;n<t.length;n++){if(t[n].kind!=="i"||t[n].text!=="class")continue;let s=t[n+1];(e==="py"?Gh(t,n)&&s?.kind==="i":s&&(s.kind==="i"||s.text==="{"))&&r++}return r}function n0(t,e){let r=jh(e);if(!r)return;let n=nSr(t,r),s=iSr(n,r),i=r==="js"?cSr(n,s):r==="py"?lSr(n,s):uSr(n,s),{imports:o,spans:a}=dSr(n,r),c=new Map,l=d=>c.set(d,(c.get(d)??0)+1),u=0;for(let d=0;d<n.length;d++){for(;u<a.length&&d>a[u][1];)u++;if(u<a.length&&d>=a[u][0])continue;let p=n[d];if(p.kind==="i")l(p.text);else if(p.kind==="s"&&(p.template||r==="py"&&p.text.includes("{")))for(let m of p.text.matchAll(/\{[^{}]*\}/g))for(let f of m[0].matchAll(/[A-Za-z_$][\w$]*/g))l(f[0])}return{lang:r,functions:i,imports:o,uses:c,listedExports:r==="js"?kft(n):new Set,deps:pSr(n,r,o),classes:r==="go"?0:mSr(n,r)}}var hSr=15,gSr=6,Px=t=>fa.test(t),ASr=/utils?|skyramp/i,ySr=/utils?/i,s0=t=>fr.posix.basename(t).replace(/\.[^.]+$/,""),bSr=/^(conftest\.py|__init__\.py|[^/]*\.config\.[cm]?[jt]s|[^/]+\.(setup|teardown)\.[cm]?[jt]sx?|setupTests\.[cm]?[jt]sx?)$/i,ESr=/^([\w.-]+\.config\.([cm]?[jt]s|json)|package\.json|pytest\.ini|pyproject\.toml|setup\.cfg|tox\.ini)$/i,Bft=t=>t.replace(/\.([cm]?[jt]sx?|py)$/,"");function wSr(t,e){let r=Bft(e),n=fr.posix.dirname(t.rel);return(t.text.match(/[\w@$.\-/]+/g)??[]).some(i=>{let o=i.replace(/^<rootDir>\//,"").replace(/[.,]+$/,"");if(!o)return!1;let a=Bft(fr.posix.normalize(fr.posix.join(o.startsWith("/")?".":n,o.replace(/^\//,"")))),c=/^[A-Za-z_][\w.]*$/.test(o)&&o.includes(".")?o.replace(/\./g,"/"):void 0;return a===r||c!==void 0&&(c===r||fr.posix.join(n,c)===r)})}function Pft(t,e){return bSr.test(fr.posix.basename(t))?!0:e.some(r=>wSr(r,t))}var HAe=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"];function i0(t,e,r,n){let s=fr.posix.dirname(t),i=o=>o.map(a=>fr.posix.normalize(a)).find(a=>!a.startsWith("..")&&n(a));if(r==="js"){if(!e.startsWith("."))return;let o=fr.posix.join(s,e),a=o.replace(/\.[cm]?js$/,"");return i([o,...HAe.map(c=>o+c),...HAe.map(c=>a+c),...HAe.map(c=>`${o}/index${c}`)])}if(r==="py"){let o=e.match(/^\.*/)[0].length,a=e.slice(o).replace(/\./g,"/"),c=[];if(o){let l=s;for(let u=1;u<o;u++)l=fr.posix.dirname(l);c.push(l)}else for(let l=s;c.push(l),!(l==="."||l==="/"||l==="");l=fr.posix.dirname(l));return i(c.flatMap(l=>a?[`${l}/${a}.py`,`${l}/${a}/__init__.py`]:[`${l}/__init__.py`]))}}var _ft=t=>`${t.rel}:${t.fn.line}`;function xSr(t,e){return[...new Set(t.code.imports.map(r=>i0(t.rel,r.from,t.code.lang,e)).filter(r=>!!r&&!Px(r)))]}function SSr(t){let e=k=>{let M=n0(k.text,k.rel);return M?{rel:k.rel,code:M,test:Px(k.rel)}:void 0},r=t.written.flatMap(k=>{let M=e(k),F=k.before===void 0?void 0:n0(k.before,k.rel);return M?[{...M,before:F,isNew:k.before===void 0,definesHelpers:M.code.functions.length>0||M.code.classes>0}]:[]}),n=t.existing.flatMap(k=>e(k)??[]),s=new Map([...n,...r].map(k=>[k.rel,k])),i=k=>s.has(k),o=[],a=new Map,c=k=>a.set(k.fn.key,[...a.get(k.fn.key)??[],k]);for(let k of n)for(let M of k.code.functions)c({rel:k.rel,fn:M,lang:k.code.lang,test:k.test});for(let k of r){let M=new Set(k.code.functions.map(F=>F.name));for(let F of k.before?.functions??[])M.has(F.name)&&c({rel:k.rel,fn:F,lang:k.code.lang,test:k.test})}let l=(k,M)=>k.key===M.key&&(k.size>=hSr||k.name===M.name&&k.size>=gSr),u=(k,M)=>new Set((a.get(k.key)??[]).filter(F=>F.lang===M&&l(k,F.fn)).map(F=>F.rel)).size>=2,d=r.flatMap(k=>{let M=new Set((k.before?.functions??[]).map(F=>F.name));return k.code.functions.filter(F=>!M.has(F.name)).map(F=>({w:k,fn:F}))}),p=k=>{let M=k.flatMap(F=>xSr(F,i)).find(F=>!r.some(X=>X.rel===F&&X.isNew));return M?`the repo's ${M}, or a new module beside it if it no longer fits them, named for what it holds`:"the module where the repo keeps shared helpers for these tests (where there is none yet, a new one beside them, named for what it holds)"},m=new Set;for(let{w:k,fn:M}of d){if(u(M,k.code.lang))continue;let F=(a.get(M.key)??[]).find(H=>H.lang===k.code.lang&&!(H.rel===k.rel&&H.fn.name===M.name)&&l(M,H.fn));if(!F)continue;m.add(M);let X=s.get(F.rel);F.fn.exported||!F.test?o.push(`${k.rel}:${M.line} ${M.name} copies ${F.fn.name} (${_ft(F)}) \u2014 import ${F.fn.name} from there instead of defining it again`):o.push(`${k.rel}:${M.line} ${M.name} copies ${F.fn.name}, local to ${_ft(F)} \u2014 move ${F.fn.name} into ${p([k,...X?[X]:[]])} and import it in both files; no second copy`)}let f=r.filter(k=>k.isNew&&!k.test),h=new Map;for(let{w:k,fn:M}of d){if(!k.test||m.has(M))continue;let F=f.find(z=>z.code.lang===k.code.lang&&z.code.functions.some(B=>l(M,B))),X=F?.code.functions.find(z=>l(M,z));if(!F||!X)continue;m.add(M);let H=`${k.rel}:${M.line} ${M.name} copies ${X.name} (${F.rel}:${X.line}) \u2014 import ${X.name} from there instead of defining it again`,q=h.get(F.rel)??{tests:new Set,sent:[]};q.tests.add(k.rel),q.sent.push(H),h.set(F.rel,q),o.push(H)}let b=[],E=k=>cO(k).dir;for(let k of d){if(!k.w.test||m.has(k.fn)||u(k.fn,k.w.code.lang))continue;let M=b.find(F=>F[0].w.code.lang===k.w.code.lang&&E(F[0].w.rel)===E(k.w.rel)&&l(F[0].fn,k.fn));M?M.push(k):b.push([k])}for(let k of b){let M=[...new Map(k.map(F=>[F.w.rel,F.w])).values()];M.length<2||o.push(`${k[0].fn.name} is defined in ${M.length} test files (${M.map(F=>F.rel).join(", ")}) \u2014 define it once, in ${p(M)}, and import it from each`)}for(let k of r){let M=new Set((k.before?.imports??[]).map(F=>`${F.local}\0${F.from}`));for(let F of k.code.imports){if(M.has(`${F.local}\0${F.from}`)||(k.code.uses.get(F.local)??0)>0)continue;(F.from.startsWith(".")||i0(k.rel,F.from,k.code.lang,i)!==void 0)&&o.push(`${k.rel}:${F.line} imports ${F.local} from ${F.from} and never uses it \u2014 use it, or drop the import`)}}let A=new Map([...(t.otherTests??[]).flatMap(k=>e(k)??[]).map(k=>[k.rel,k]),...s]),w=k=>[...A.values()].filter(M=>M.rel!==k&&M.code.deps.some(F=>i0(M.rel,F,M.code.lang,i)===k)),C=n.filter(k=>!k.test&&(k.code.functions.length>0||k.code.classes>0)&&!Pft(k.rel,t.configs??[])).map(k=>({rel:k.rel,users:w(k.rel).filter(M=>M.test&&!r.some(F=>F.rel===M.rel)).length})).filter(k=>k.users>0),R=C.filter(k=>k.users===1),T=k=>R.some(M=>fr.posix.dirname(M.rel)===fr.posix.dirname(k))||C.length>0&&R.length*2>=C.length,N=new Set;for(let k of r){if(!k.isNew||k.test||!k.definesHelpers||Pft(k.rel,t.configs??[])||T(k.rel))continue;let M=w(k.rel);if(M.some(q=>!q.test))continue;let F=h.get(k.rel),X=new Set([...M.map(q=>q.rel),...F?.tests??[]]);if(X.size!==1)continue;N.add(k.rel);let H=[...X][0];if(F)for(let q of F.sent)o.splice(o.indexOf(q),1);o.push(`${k.rel} is imported only by ${H}${F?", which also copies its helpers":""} \u2014 move its contents into ${H} and delete ${k.rel}; keep it only if a second test file uses it`)}for(let k of r){if(!k.isNew||k.test||N.has(k.rel))continue;let M=new Map;for(let F of k.code.functions){if(!F.exported||(k.code.uses.get(F.name)??0)-1-(k.code.listedExports.has(F.name)?1:0)>0)continue;let H=[...s.values()].filter(q=>q.test&&q.rel!==k.rel&&(q.code.uses.get(F.name)??0)>0&&q.code.imports.some(z=>i0(q.rel,z.from,q.code.lang,i)===k.rel));H.length===1&&M.set(H[0].rel,[...M.get(H[0].rel)??[],F.name])}for(let[F,X]of M)o.push(`${k.rel}: ${X.join(", ")} ${X.length>1?"are":"is"} used only by ${F} \u2014 a helper only one test file uses stays in that file`)}let Q=n.some(k=>!k.test&&ySr.test(s0(k.rel)));for(let k of r){if(!k.isNew||k.test||!k.code.functions.length)continue;let M=s0(k.rel);(/skyramp/i.test(M)||!Q&&ASr.test(M))&&o.push(`${k.rel}: name the module for what it holds (e.g. orders, session, pages) \u2014 not "utils" or "Skyramp"`)}return o}var hW=new Set(["node_modules",".git","dist","build","coverage","test-results","playwright-report","__pycache__",".venv","venv","vendor",".next","target"]),Dft=new RegExp(`(^|/)(${[...hW].map(t=>t.replace(/\./g,"\\.")).join("|")})/`),Lft=/^(tests?|e2e|e2e-tests|__tests__|specs?|playwright|cypress|integration|testing)$/i,CSr=/test|spec|helper|support|fixture|page/i,Oft=3e3,ISr=256*1024,vSr=4e3;function Bx(t){try{let e=gW.statSync(t);return e.isFile()&&e.size<=ISr?gW.readFileSync(t,"utf-8"):void 0}catch{return}}function RSr(t,e){try{return(0,Qft.execFileSync)("git",[...Gi,"show",`HEAD:${e}`],{cwd:t,env:xt(),encoding:"utf-8",maxBuffer:16*1024*1024,stdio:["ignore","pipe","ignore"]})}catch{return}}function cO(t){let e=fr.posix.dirname(t).split("/").filter(n=>n&&n!=="."),r=e.findIndex(n=>Lft.test(n));return r>=0?{dir:e.slice(0,r+1).join("/"),deep:!0}:{dir:e.join("/"),deep:!1}}function zAe(t,e){let r=[];for(let u of my(t)){if(!jh(u.path)||Dft.test(u.path)||u.code.includes("D")||e?.has(fr.resolve(t,u.path)))continue;let d=Bx(fr.join(t,u.path));if(d===void 0)continue;let p=u.code==="??"||u.code[0]==="A";r.push({rel:u.path,text:d,before:p?void 0:RSr(t,u.path)??void 0})}let n=new Set(r.map(u=>u.rel)),s=[],i=new Set;for(let{dir:u,deep:d}of new Map(r.map(p=>[JSON.stringify(cO(p.rel)),cO(p.rel)])).values())um(fr.join(t,u),p=>{let m=fr.relative(t,p).split(fr.sep).join("/");if(i.has(m)||n.has(m)||!jh(m)||!d&&!Px(m)&&!CSr.test(fr.posix.basename(m)))return;i.add(m);let f=Bx(p);if(f!==void 0&&s.push({rel:m,text:f}),s.length>=Oft)return!1},{skip:hW,maxDepth:d?8:0});let o=u=>Bx(fr.join(t,u))!==void 0;for(let u of r){let d=n0(u.text,u.rel);if(d)for(let p of d.imports){if(s.length>=Oft)break;let m=i0(u.rel,p.from,d.lang,o);if(!m||i.has(m)||n.has(m)||Dft.test(m))continue;i.add(m);let f=Bx(fr.join(t,m));f!==void 0&&s.push({rel:m,text:f})}}let a=r.filter(u=>u.before===void 0&&!Px(u.rel)),c=[],l=[];if(a.length){let u=a.map(m=>s0(m.rel)),d=[...new Set(a.flatMap(m=>/^(index|__init__)$/.test(s0(m.rel))?[s0(m.rel),fr.posix.basename(fr.posix.dirname(m.rel))]:[s0(m.rel)]))],p=0;um(t,(m,f)=>{let h=f.split(fr.sep).join("/"),b=ESr.test(fr.posix.basename(h)),E=!b&&Px(h)&&jh(h)!==void 0&&!i.has(h)&&!n.has(h);if(!b&&!E)return;if(E&&++p>vSr)return!1;let A=Bx(m);A!==void 0&&(b?u:d).some(w=>A.includes(w))&&(b?l:c).push({rel:h,text:A})},{skip:hW,maxDepth:10})}return{written:r,existing:s,otherTests:c,configs:l}}var GAe="write-reuse",NSr=/\bcopies\b| is defined in \d+ test files | is imported only by /;function Mft(t){return NSr.test(t)}var Fft={name:GAe,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let i of kt(t.inputs)){let o=i.path===t.inputs.repositoryPath?"":qt(t.inputs,i.slug);r.push(...SSr(zAe(i.path,e)).map(a=>o+a))}let n=r.filter(i=>!Mft(i));n.length&&console.log(`[${this.name}] noted, not sent back: ${n.join("; ")}`);let s=r.filter(Mft);return s.length?{...ve(this.name,s),repairable:!0}:{name:this.name,passed:!0}}},TSr=10,kSr=/test|spec|helper|support|fixture/i,BSr=t=>t.split("/").some(e=>Lft.test(e)||kSr.test(e)),PSr=10,_Sr=4e3;function DSr(t,e){let r=e==="js"?/^export\s+(?:default\s+)?(?:async\s+)?(?:function\*?|class|const|let)\s+([A-Za-z_$][\w$]*)/gm:/^(?:async\s+)?(?:def|class)\s+([A-Za-z]\w*)/gm,n=[...t.matchAll(r)].map(i=>i[1]),s=e==="js"?[...n0(t,"x.ts")?.listedExports??[]]:[];return[...new Set([...n,...s])]}function Uft(t){let e=new Set,r=[];um(t,(o,a)=>{let c=a.split(fr.sep).join("/"),l=jh(c);l!=="js"&&l!=="py"||(e.add(c),Px(c)&&r.length<_Sr&&r.push(c))},{skip:hW,maxDepth:10});let n=o=>e.has(o),s=new Map;for(let o of r){let a=Bx(fr.join(t,o)),c=a===void 0?void 0:n0(a,o);if(!c)continue;let l=new Set(c.imports.map(u=>i0(o,u.from,c.lang,n)).filter(u=>!!u&&!Px(u)));for(let u of l)s.set(u,(s.get(u)??0)+1)}for(let o of e){if(fr.posix.basename(o)!=="conftest.py")continue;let a=fr.posix.dirname(o),c=r.filter(l=>l.endsWith(".py")&&(a==="."||l.startsWith(`${a}/`))).length;c&&s.set(o,Math.max(s.get(o)??0,c))}let i=o=>fr.posix.basename(o)==="conftest.py";return[...s].filter(([o,a])=>a>=2&&(BSr(o)||i(o))).sort((o,a)=>a[1]-o[1]||o[0].localeCompare(a[0])).slice(0,TSr).map(([o,a])=>{let c=Bx(fr.join(t,o))??"";return{rel:o,importers:a,names:DSr(c,jh(o)).slice(0,PSr)}})}function $ft(t){return t.length?["The repo's shared test helpers, by how many of its test files use them:",...t.map(({label:e,module:r})=>` - ${e}${r.rel} (${r.importers} test files)${r.names.length?`: ${r.names.join(", ")}`:""}`)]:[]}var Hft=$(require("path"));var OSr=10,MSr=3,QSr=5,LSr=/\.(?:locator|getBy[A-Z]\w*|get_by_\w+)\(/g,FSr=/^\s*(?:export\s+(?:default\s+)?)?class\s+\w+/m,USr=/@testing-library\/|from ["']enzyme["']/,AW=t=>(t.match(LSr)??[]).length,$Sr=/@playwright\/test|from\s+['"]playwright|\bpage\.(?:goto|locator|getBy\w+)\s*\(|\bcy\.(?:visit|get)\s*\(|webdriver|selenium|newSkyrampPlaywrightPage/i,qft=(t,e)=>zft(t,e)&&$Sr.test(e);function qSr(t,e){if(e===void 0)return AW(t);let r=new Map;for(let s of e.split(`
|
|
807
807
|
`))r.set(s,(r.get(s)??0)+1);let n=0;for(let s of t.split(`
|
|
808
808
|
`)){let i=r.get(s)??0;i>0?r.set(s,i-1):n+=AW(s)}return n}var HSr=t=>t[Math.max(0,Math.ceil(.9*t.length)-1)],jAe=t=>fa.test(t),zft=(t,e)=>{let r=jh(t);return(r==="js"||r==="py")&&!USr.test(e)};function zSr(t){let e=new Map;for(let r of t){let n=Hft.posix.dirname(r).split("/"),s=n.findIndex(o=>/^pages?$/i.test(o)),i=s>=0?n.slice(0,s+1).join("/"):n.join("/");e.set(i,(e.get(i)??0)+(s>=0?1e3:1))}return[...e].sort((r,n)=>n[1]-r[1]||r[0].localeCompare(n[0]))[0][0]}function GSr(t){let e=[],r=new Map;for(let n of t.written){if(!jAe(n.rel)||!qft(n.rel,n.text))continue;let s=cO(n.rel).dir;r.set(s,[...r.get(s)??[],n])}for(let[n,s]of r){let i=t.written.filter(d=>d.before!==void 0).map(d=>({rel:d.rel,text:d.before})),o=[...t.existing,...i].filter(d=>n===""||d.rel.startsWith(`${n}/`)),a=o.filter(d=>!jAe(d.rel)&&zft(d.rel,d.text)&&FSr.test(d.text)&&AW(d.text)>0).map(d=>d.rel);if(a.length<MSr)continue;let c=o.filter(d=>jAe(d.rel)&&qft(d.rel,d.text)).map(d=>AW(d.text)).sort((d,p)=>d-p);if(c.length<QSr)continue;let l=HSr(c),u=zSr(a);for(let d of s){let p=qSr(d.text,d.before);p>=OSr&&p>l&&e.push(`${d.rel} locates ${p} elements inline, where nine in ten of the repo's specs locate ${l} or fewer and reach their pages through the page objects in ${u} \u2014 locate them in the page's page object there (a new one for a page that has none) and use it from the spec`)}}return e}var VAe="write-page-objects",Gft={name:VAe,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let n of kt(t.inputs)){let s=n.path===t.inputs.repositoryPath?"":qt(t.inputs,n.slug);r.push(...GSr(zAe(n.path,e)).map(i=>s+i))}return r.length?{...ve(this.name,r),repairable:!0}:{name:this.name,passed:!0}}};var jft=$(require("fs")),dd=$(require("path"));var WAe="write-no-app",jSr="needs the running app (a browser journey), and this run brings no app up: Validation Triage decided targeted_unit";function o0(t){if(!ya(t))return{behaviors:[],defects:[],journeys:[],browserJourneys:[],maintenance:[]};let e=oe(t,"triage.json"),r=new Map((oe(t,"analyze.json")?.behaviors??[]).map(i=>[i.id,i])),n=new Set(FD(t));return{behaviors:(e?.plan??[]).filter(i=>i.mechanism==="new_unit"&&n.delete(i.behaviorId)).map(i=>{let o=r.get(i.behaviorId);return{id:i.behaviorId,statement:o?.statement??i.behaviorId,covers:i.covers??"",where:`${qt(t.inputs,o?.repository)}${o?.evidence??""}`}}),defects:Ey(t),journeys:vm(t),browserJourneys:uy(oe(t,"plan.json")?.journeys).filter(i=>i.kind!=="in-process"),maintenance:Xr(t)?.maintenance??[]}}function YAe(t){return t.behaviors.length+t.defects.length+t.journeys.length+t.maintenance.length>0}function Vft(t,e){let r=new Set([...t.notWritten.map(s=>s.case.trim()),...t.tests.flatMap(s=>s.covers)]),n=e.filter(s=>!r.has(s.id)).map(s=>({case:s.id,reason:jSr}));return n.length?{...t,notWritten:[...t.notWritten,...n]}:t}function JAe(t){return kt(t.inputs).filter(e=>e.writable).flatMap(e=>{let r=iy(t.inputs,e.slug,"unit");return r?[{root:dd.resolve(e.path),slug:e.slug,dir:r}]:[]})}function VSr(t,e){let r=[],{work:n}=e,s=new Set(t.tests.flatMap(c=>c.covers)),i=new Set(t.notWritten.map(c=>c.case.trim())),o=c=>s.has(c)||i.has(c);for(let c of n.behaviors)!o(c.id)&&!e.couldBreak.has(c.id)&&r.push(`behavior "${c.id}" was planned a new in-process test and no test covers it \u2014 give it one, or say in notWritten why no in-process test can check it`);for(let c of n.defects)o(c.id)||r.push(`defect "${c.id}" has no test and is not in notWritten \u2014 give it a test that reaches it and expects the correct behaviour, or say in notWritten why no in-process test can`);for(let c of n.journeys)o(c.id)||r.push(`journey "${c.id}" has no test and is not in notWritten \u2014 walk it in one in-process test, or say in notWritten what it needs that is missing`);let a=c=>{let l=yx(c).file,u=d=>d===l||d.endsWith(`/${l}`)||l.endsWith(`/${d}`);return t.tests.some(d=>u(d.file))||[...i].some(d=>d===c||u(yx(d).file))};for(let c of n.maintenance)a(c.test)||r.push(`existing test ${c.test} (the plan says ${c.action}) is neither in tests nor in notWritten \u2014 run or maintain it in-process and list it, or put it under notWritten with what it needs that this run does not have`);for(let c of t.tests){if(c.change!=="added")continue;let l=e.read(c.file);if(!l)continue;for(let m of rV(l.body))r.push(`${c.file} uses ${m} \u2014 every test runs in one process: no network, no running app; mock outbound calls with the repo's own tools inside the test`);let u=e.placedDir?.(l.root),d=dd.dirname(l.rel).split(dd.sep).join("/");u&&u!=="."&&d!==u&&!d.startsWith(`${u}/`)&&r.push(`${c.file} is not in ${u}, where the Target puts unit tests for this repository`);let p=Sm(l.root,l.rel);p&&Cm(p)&&!BR(p,l.rel)&&r.push(`${c.file} is not named the way ${p} collects tests \u2014 name it the way its runner collects tests, as the repo's own tests are`)}return r}function WSr(t,e){let r=e.replace(/^\.\//,""),n=r.split("/")[0],s=[{root:t[0],rel:r},...t.slice(1).filter(i=>dd.basename(i)===n).map(i=>({root:i,rel:r.slice(n.length+1)}))];for(let i of s){let o=dd.resolve(i.root,i.rel);if(o.startsWith(i.root+dd.sep))try{return{body:jft.readFileSync(o,"utf-8"),root:i.root,rel:i.rel}}catch{continue}}}function Wft(t){return{name:WAe,verify(e,r){if(!ya(e))return{name:this.name,passed:!0};let n=t(e,r);if(!n)return{name:this.name,passed:!0};let s=oe(e,"plan.json"),i=[e.inputs.repositoryPath,...(e.inputs.relatedRepos??[]).map(a=>a.path)].map(a=>dd.resolve(a)),o=VSr(n,{work:o0(e),couldBreak:s?new Set(SD(s).keys()):new Set,read:a=>WSr(i,a),placedDir:a=>JAe(e).find(c=>c.root===a)?.dir});return o.length?{name:this.name,passed:!1,details:o.join("; "),repairable:!0}:{name:this.name,passed:!0}}}}var yW=$(require("fs"));function Yft(t,e){return{name:t,verify(r,n){let s=vy(r.inputs.requirementItems);if(s.length===0)return{name:this.name,passed:!0};let i=[];for(let o of new Set(e(r,n))){let a;try{let l=ghe(r,o);if(yW.statSync(l).size>sW)continue;a=yW.readFileSync(l,"utf-8")}catch{continue}let c=xmt(a,s);c.length&&i.push(`${o} copies the words of ${c.join(" and ")} in a comment, test title or test name`)}return i.length?{name:this.name,passed:!1,repairable:!0,details:`${i.join("; ")}. Tests are public to the repository's readers: name an item only by its key and criterion number (e.g. "PAY-184 AC2", "Confluence page 3021 AC1") and keep its words out of comments, titles and test names. When you rename a test, run it again under its new name.`}:{name:this.name,passed:!0}}}}var KAe="write.json",XAe=["adapt.json","generate.json","generate-ui.json","finalize.json",Hh],Kft="write-no-secret-leak",Xft="write-checkout-intact",Zft="write-dependencies",EW=t=>Es.join(t.outputsDir,"write-scratch"),qs=t=>Es.join(EW(t),KAe);function eht(t){if(ya(t))return vm(t);let e=oe(t,"plan.json")?.journeys;if(!Array.isArray(e)||!e.length)return[];let r=new Set((Xr(t)?.generate??[]).map(n=>n.id));return e.filter(n=>n&&typeof n.id=="string"&&Array.isArray(n.steps)&&r.has(n.id))}function YSr(t,e={}){if(!t.length)return[];let r=e.noApp?["Each is one in-process test of the whole flow: it drives the UI the way the repo's in-process tests do, checks after","each step what the user then sees, and asserts every part of the outcome at the end. Mark each step so a failure","names it (a labelled assertion, or the runner's own step or subtest), and let a failed check go on to the next step","where the test still allows it.","A journey no in-process test can walk here goes under notWritten, with what it needs that is missing: it is","reported as not covered, never left out."]:["Each is one test of the whole flow, of its kind. A browser journey runs against the real app: it opens the entry route","and does every step through the UI in order (no URL jump to a later step, no stub of the app's own network). An","in-process journey drives the UI the way the repo's in-process tests do. Either checks after each step what the user then sees, and","asserts every part of the outcome at the end, after a reload where it must persist. Where a step lands on another page (a","redirect after a save, a detail or confirmation page), check on that page what it shows of what the user entered or saved","(the values, totals and counts), not only its address. Mark each step so a failure names it (in Playwright, test.step),","and let a failed check go on to the next step where the page still allows it, so one defect does not hide the rest.","A journey whose test cannot run here (a browser, package or service it needs cannot be set up) goes under notWritten,","with what is missing: it is reported as not covered, never left out."];return["User journeys:",...t.map(n=>[` - ${n.id} ${n.name} \u2192 ${n.testFile}`,` entry: ${n.entry}`,` steps: ${uR(n)}`,...n.finishes?.trim()?[` finishes: ${n.finishes.trim()}`]:[],` outcome: ${n.outcome}`].join(`
|
|
809
809
|
`)),...r,'List each under "journeys" in your result (its file and test title, and where it broke when it did) and put its id in',`that file's "covers".`,""]}function bW(t){return ya(t)?!1:(Xr(t)?.generate??[]).some(e=>e.type==="ui")}function JSr(t){let e=QR(t);if(e){for(let n of[...XAe,Jc])rl.rmSync(Es.join(t.outputsDir,n),{force:!0});return{ok:!1,reasons:[e]}}let r=Xr(t);return r?r.generate.length===0&&r.maintenance.length===0&&!YAe(o0(t))?{ok:!1,reasons:["the plan has no test cases and no maintenance"]}:{ok:!0,reasons:[]}:{ok:!1,reasons:["no test plan (recommend.json) to write tests from"]}}function KSr(t){let e=Ahe(t),r=YV(t);for(let c of[...XAe,"write.json",PR,Jc])rl.rmSync(Es.join(t.outputsDir,c),{force:!0});let n=bW(t),s=(Xr(t)?.generate??[]).some(c=>c.type!=="ui")||YAe(o0(t)),{packages:i,notes:o}=lpt(t,{ui:n,backend:s});tht(t,i);let a=[...o,...Ix(t,"backend",[],{declaredOnly:!0,packages:i}),...n?Ix(t,"ui",[],{declaredOnly:!0,packages:i}):[]];return{checkpoint:Es.join(EW(t),KAe),secretGateBaseline:e,checkoutHeads:r,provisionNotes:a,sharedHelpers:XSr(t),testPackages:i,dependencyBaseline:Ahe(t)}}function tht(t,e){let r=Es.join(t.outputsDir,Jc);e.length===0?rl.rmSync(r,{force:!0}):rl.writeFileSync(r,JSON.stringify({schemaVersion:1,packages:[...e]},null,2)+`
|
|
810
810
|
`)}function XSr(t){try{return $ft(kt(t.inputs).flatMap(e=>{let r=e.path===t.inputs.repositoryPath?"":qt(t.inputs,e.slug);return Uft(e.path).map(n=>({label:r,module:n}))}))}catch{return[]}}function ZSr(t){let e=qc(t.inputs)?["It is a shared environment this policy protects: write and run no test that changes state there (a create, edit or delete, a form that submits, a setup that seeds); list any such test in notWritten instead."]:[];if(t.inputs.appRunning){let o=fj(oe(t,`${ha}.json`));return[t.inputs.appRunning.trim(),...e,...o?[o]:[]]}let r=oe(t,"deploy.json"),n=Zc(t.inputs.repositoryPath),s=n.setupScript?`start it with ${Es.relative(t.inputs.repositoryPath,n.setupScript)} and check it answers`:"start it the way the repo documents";if(whe(r)){let o=Object.entries(r.baseUrls??{}).map(([c,l])=>`${c} ${l}`).join(", "),a=r.health?.url??r.health?.command;return[`The app is running${o?`: ${o}`:""}.${a?` Health check: ${a}`:""}`,`If it stops answering, ${s}.`]}return[`The app may not be running.${r?.bringupError?.output?` Planning could not start it: ${r.bringupError.output.slice(0,300)}`:""} Check, and if it isn't up, ${s}; leave it running.`,"If you can't get it running, still write the tests and record them as not run (exit null)."]}function eCr(t){let e=JAe(t);return["No app is running, and none is started for this run: Validation Triage decided the change is proven in-process","(targeted_unit). Every test runs in one process, the way the repo's own in-process tests run: no network or running","app, so nothing that calls a live service, the Skyramp client and its runtime mocks included. Mock outbound calls","(HTTP, queues, other services) inside the test with the repo's own fixtures and mocking tools. Run the tests the way","the repo's CI runs them (its runner, config and environment), selected as step 4 says. Each new test file is named the way its runner","collects tests, as the repo's own tests are. Maintain every stale existing test that can run in-process. An existing","test that needs the running app goes under notWritten, by its path, with what it needs that this run does not have:","it is reported as not covered.",...e.length?["The Target puts new unit tests in these directories, over the repo's own layout: put each new test under its repository's directory, not beside the existing tests:",...e.map(r=>` - ${qt(t.inputs,r.slug)}${r.dir}/`)]:[]]}function tCr(t){return[...t.behaviors.length?['Behaviors that need a new in-process test (give each id in "covers"):',...t.behaviors.map(e=>` - ${e.id}: ${e.statement}
|
|
811
811
|
missing evidence to obtain: ${e.covers||"(unstated)"}
|
|
812
812
|
where the change is: ${e.where}`),"Every behavior above gets an in-process test, except that a test of what the change could break stays only if it","fails on the change (step 1).",""]:[],...t.defects.length?["For each defect suspected above, write a test that reaches it and expects the correct behaviour, so it fails on this","change and passes once the defect is fixed, and give its id in covers; a defect no in-process test can reach goes","under notWritten, with why.",""]:[],...t.browserJourneys.length?["These user journeys need a browser and the running app, which this run does not have: no in-process test can walk","them, so each goes under notWritten by its id, with what it needs that is missing:",...t.browserJourneys.map(e=>` - ${e.id} ${e.name}`),""]:[]]}function rCr(t,e=[]){let r="";try{let n=ou(t,e),s=[...new Set(n.flatMap(i=>i.secretEnv))].filter(i=>e.includes(i));r=$dt(Qh(n),s).trim()}catch{return[]}return r?["Some variables the repo's CI sets would clash with your own model access, so their values are in your shell",`renamed, under a TESTBOT_CI_ prefix. Run a test that needs CI's values with them mapped back: \`${r} <test command>\`.`]:[]}function nCr(t){let e=t.prepared,r=t.inputs.repositoryPath,n=Pn(t),s=n?.repository.currentBranch??"HEAD",i=n?.repository.baseBranch??t.inputs.baseBranch??"origin/main",o=Xr(t),a=oe(t,"analyze.json"),c=new Map((a?.behaviors??[]).map(R=>[R.id,R.statement])),l=(a?.findings??[]).filter(R=>R.status!=="refuted"),u=oe(t,"plan.json"),d=new Map((u?.cases??[]).map(R=>[R.id,R.steps])),p=Do(t.inputs.requirementItems),m=new Map((u?.requirements??[]).flatMap(R=>R.reference&&R.criterion?[[R.id,` (${Ju(R.reference,R.criterion,p)})`]]:[])),h=bW(t)&&xh(t),b=ya(t),E=o0(t),A=eht(t),w=new Set(A.map(R=>R.id)),C=o.generate.filter(R=>!w.has(R.id)).map(R=>{let T=[R.from_behavior&&`${R.from_behavior}: ${c.get(R.from_behavior)??""}`.trim(),R.from_finding&&`defect ${R.from_finding}`].filter(Boolean).join("; ");return[` - ${R.id} [${R.type}] ${R.target}${T?` \u2014 ${T}`:""}`,` do: ${d.get(R.id)??R.rationale}`,` expect: ${R.expected_observable}`].join(`
|
|
813
|
-
`)});return["Write functional tests for this PR and run them. The plan below came from reading the PR; turn it into tests in the","repo, run them, and tell me what they show about the change.","",`The repo is at ${r}, checked out on branch \`${s}\`. You can see the change with \`git diff ${i}...HEAD\`.`,...QAe(t),...Kl(t.inputs),"",...cft(t.inputs),...uft(t.inputs),...a?.requirements?.length?["Requirements:",...a.requirements.map(R=>` - ${R.id}${m.get(R.id)??""}: ${R.statement}`),""]:[],...l.length?["Defects suspected while reading the change:",...l.map(R=>` - ${R.id} (${R.severity}) ${R.file}${R.line?`:${R.line}`:""} \u2014 ${R.claim}`),""]:[],"Test plan. Each case's expected outcome is the one the plan sets, not whatever the app does:",...C.length?C:[" (no new cases)"],...o.maintenance.length?["","Existing tests to maintain:",...o.maintenance.map(R=>` - ${R.action.toUpperCase()} ${R.test} \u2014 ${R.evidence}`)]:[],"",...b?tCr(E):[],...YSr(A,{noApp:b}),...b?eCr(t):ZSr(t),...h?["For the ui cases you have the Skyramp browser tools (mcp__skyramp__browser_*): look at the real page before you pick locators."]:[],...e.provisionNotes.length?[`Setup notes: ${e.provisionNotes.join("; ")}`]:[],...e.testPackages?.length?["",...Bct(e.testPackages,{skyrampVersion:xh(t)&&!b?IR(t.inputs.skyrampMcp):void 0,nodeTests:(b||o.generate.some(R=>R.type!=="ui"))&&Xge(r)})]:[],...e.sharedHelpers?.length?["",...e.sharedHelpers]:[],...rCr(r,t.providedEnvKeys??[]),"","1. Write each test the way the repo already tests that code (the same kind of test, framework, directories, naming,",...b?[" helpers and fixtures), unless that kind cannot check its case in one process; then use the in-process kind that can,"," and where none can, list the case under notWritten with what it needs."]:[" helpers and fixtures), unless that kind of test cannot check its case; then use the kind that can."]," Reuse the repo's helpers, page objects and fixtures: never copy a helper the repo already has \u2014 import it, and if it"," is local to another test file, move it into the repo's shared support module and import it in both. A helper only"," one test file uses stays in that file; a helper two or more of your test files use is defined once, in the repo's"," shared support location (else beside the tests that use it, the way the repo lays out its tests), in a module named for what it holds \u2014 not",` "utils" or "Skyramp". Use every name you import. Where the repo's browser tests reach its pages through page objects,`," so do yours: locate a page's elements in its page object, the way its existing members locate theirs, and add a page"," object, where the repo keeps them, for a page that has none. Find an element by its role and name, label or test id;"," when a locator matches more than one element, narrow it to the one you mean (inside its row, dialog or region, or by"," its text) rather than taking .first(), .last() or .nth(). Pick by position only where the order is what the test checks.",...b?[" Write in-process tests the way the repo's own unit and in-process tests are written. The repo's existing tests"]:[" Don't add unit tests (a function or module called directly, its collaborators mocked). The repo's existing tests"]," are for maintenance only: update the ones the change makes wrong \u2014 the maintenance list is where to start, step 4"," finds the rest \u2014 above all any that assert as correct what the plan says is a defect, rather than writing a new"," one beside it."," Keep each requirement's check on its own, so one failure can't hide another: give it its own test or assertion,"," and stub or seed any data its setup needs that a different defect could break (a list the page loads, a shared"," helper that rejects the response before your assertion reads it). A test that shows a defect asserts only the"," outcome its case expects \u2014 one defect per test \u2014 so it passes once that defect is fixed."," For each element or field the change adds, assert that it is there (shown, or present in the response); clicking"," or filling it is not an assertion. For each it removes or renames, assert that it is gone: not shown, a count of 0,"," the field missing, a 404, the old option no longer offered."," Where a case's steps give the exact requests, send them as they are rather than working them out again, and keep"," those tests together in one file."," The plan is where to start, not the limit: if you notice something else the change should do, or could break,"," while you write and run these, test that too, filed under the plan requirement it guards. A test of what it could"," break that passes stays only when it is the one test of its requirement; remove one that another of your tests",' already covers, and list its case under notWritten with a reason that starts "Passing:" and says what it checked \u2014'," never a journey's test, which stays whether it"," passes or fails. Where nothing says what should happen, only decide it for what"," the change does; how older code treats odd input is not this PR's to test. One case for each kind of input is"," enough: add another only where it could fail while the first passes.","2. Run the tests you wrote together, once, in the foreground, with a short per-test timeout so a hung test fails",` fast; wait for the run to finish (one Bash call may run up to ${MV} minutes), and don't end the session with a test`," run still going: the session is non-interactive and ends when you stop, so nothing would report its result.","3. For each failure, work out whose fault it is, and settle it outside the test before you call it a defect. The"," outcome the test expects must be one the PR, spec or code requires, not one you chose: an exact status where only a"," refusal is required, a message or format nothing states, a value read from a column picked by position. Where only"," part of it is required, assert only that part. A failure before the step that checks the case (sign-in, setup,"," seeding, a helper, an element not found, a timeout) is the test's until you have seen the app do it wrong: look at"," the page or send the request yourself, and find the line of application code that does it."," If the test checks what its case requires and the app does something else, that's a defect in the change: keep the"," test as written, mark the case and its file as a defect, and report the bug with that line. Never change an expected"," outcome to match what the app does. If the test itself is wrong (selector, setup, data, import, timing, an outcome"," nothing requires), fix it and re-run only the tests that failed (e.g. pytest --lf, playwright test --last-failed, or"," by name); a failing case you could not fix is marked defect: false, never a defect. Give each failing case the",` runner's failure as it printed it ("failure"), and each case you keep as a defect its "cause", the application line.`," Don't re-run the whole set at"," the end: the results you already have stand.","4. Then run the repo's existing tests that reach the code the change touches, the way its CI runs them (its command"," and environment), selected as narrowly as still covers that code: the whole suite only when it runs in a few"," minutes. For each one that fails, find out whether this change made it fail; when you can't tell, run it on the"," base branch in a scratch copy outside the"," checkout (e.g. git worktree add under /tmp). One that asserts behaviour the change deliberately replaced is stale:"," update it, or delete it where the behaviour is gone, and re-run it; give staleBecause for it \u2014 the requirement the"," change deliberately alters and the changed line of application code (path:line) that alters it. One that catches"," something the change breaks is a defect: leave it failing and report it. Leave alone failures the change did not cause.","5. If the repo has a linter or formatter for test code, run it on your files. The application's manifests and"," lockfiles are its owner's: a test in the repo's own framework uses only what the repo already declares, and you"," never add, upgrade or remove a package in the application's own manifests or lockfiles for Testbot's tests.",b?" For the app's code, reach it the way the repo's in-process tests do (its test client, fixtures and helpers).":" For calls to the app, use the client and helpers the repo's existing tests use for that service."," Tooling the repo doesn't declare (Playwright where it has none) goes in the Testbot test package"," above, never in the application's manifests; with no such package, write the test with what the repo has."," The one exception is a test that must run inside the application's existing test environment and cannot"," without a package it lacks: add it to the manifest of the checkout the test is in, keep the manifest's"," constraints, upgrade nothing else, update that manifest's lockfile with its own package manager (the updated lockfile"," must name the added package), run the existing tests of that environment, and list it in dependenciesAdded"," with the reason; for another checkout of the change, name that checkout as the entry's repository.","",'In your result, give each file you added or updated its "functions": each test function in it as the runner names',"it, with the plan case ids it checks, so that every case it covers is checked by a function you name. Give each","issue its plan finding id and the requirement or clause ids it violates. Name each test for what it checks: no plan","id in a test's name or title, except a label the description or spec itself gives the requirement (AC-3).","","Apart from that scratch copy, stay inside the checkout and leave it on the commit it is on,","with the change's files in place: run or read the base in the scratch copy (or with git show <commit>:<file>), never","by checking the checkout out, resetting or stashing it. Don't commit or push, and leave the tests in the working tree.",`Once you've run the tests the first time, write your result as JSON (below) to ${e.checkpoint}, and keep it current`,"as you go: that file is what's","read. End with a one-line final message \u2014 don't repeat the JSON in it. The report is read by the PR author: describe","their code, not this process.","",yn(ji)].join(`
|
|
813
|
+
`)});return["Write functional tests for this PR and run them. The plan below came from reading the PR; turn it into tests in the","repo, run them, and tell me what they show about the change.","",`The repo is at ${r}, checked out on branch \`${s}\`. You can see the change with \`git diff ${i}...HEAD\`.`,...QAe(t),...Kl(t.inputs),"",...cft(t.inputs),...uft(t.inputs),...a?.requirements?.length?["Requirements:",...a.requirements.map(R=>` - ${R.id}${m.get(R.id)??""}: ${R.statement}`),""]:[],...l.length?["Defects suspected while reading the change:",...l.map(R=>` - ${R.id} (${R.severity}) ${R.file}${R.line?`:${R.line}`:""} \u2014 ${R.claim}`),""]:[],"Test plan. Each case's expected outcome is the one the plan sets, not whatever the app does:",...C.length?C:[" (no new cases)"],...o.maintenance.length?["","Existing tests to maintain:",...o.maintenance.map(R=>` - ${R.action.toUpperCase()} ${R.test} \u2014 ${R.evidence}`)]:[],"",...b?tCr(E):[],...YSr(A,{noApp:b}),...b?eCr(t):ZSr(t),...h?["For the ui cases you have the Skyramp browser tools (mcp__skyramp__browser_*): look at the real page before you pick locators."]:[],...e.provisionNotes.length?[`Setup notes: ${e.provisionNotes.join("; ")}`]:[],...e.testPackages?.length?["",...Bct(e.testPackages,{skyrampVersion:xh(t)&&!b?IR(t.inputs.skyrampMcp):void 0,nodeTests:(b||o.generate.some(R=>R.type!=="ui"))&&Xge(r)})]:[],...e.sharedHelpers?.length?["",...e.sharedHelpers]:[],...rCr(r,t.providedEnvKeys??[]),"","1. Write each test the way the repo already tests that code (the same kind of test, framework, directories, naming,",...b?[" helpers and fixtures), unless that kind cannot check its case in one process; then use the in-process kind that can,"," and where none can, list the case under notWritten with what it needs."]:[" helpers and fixtures), unless that kind of test cannot check its case; then use the kind that can."]," Reuse the repo's helpers, page objects and fixtures, and put yours where someone who knows this repo would look for"," them: never copy a helper the repo already has \u2014 import it. A helper only one test file uses stays in that file,"," unless the repo keeps that kind in its own module (a page object per page, say). A helper two or more test files use"," \u2014 yours, or one you take from another test file \u2014 is defined once, where the repo keeps shared helpers for those"," tests: usually the support module they already import, or a new module beside it when that one no longer fits (say"," the repo splits its helpers by area, or the module has grown large); where there is none yet, beside the tests that",` use it. Name a new module for what it holds, not "utils" or "Skyramp". Change the repo's own helpers only as far as`," that needs. Use every name you import."," Where the repo's browser tests reach its pages through page objects,"," so do yours: locate a page's elements in its page object, the way its existing members locate theirs, and add a page"," object, where the repo keeps them, for a page that has none. Find an element by its role and name, label or test id;"," when a locator matches more than one element, narrow it to the one you mean (inside its row, dialog or region, or by"," its text) rather than taking .first(), .last() or .nth(). Pick by position only where the order is what the test checks.",...b?[" Write in-process tests the way the repo's own unit and in-process tests are written. The repo's existing tests"]:[" Don't add unit tests (a function or module called directly, its collaborators mocked). The repo's existing tests"]," are for maintenance only: update the ones the change makes wrong \u2014 the maintenance list is where to start, step 4"," finds the rest \u2014 above all any that assert as correct what the plan says is a defect, rather than writing a new"," one beside it."," Keep each requirement's check on its own, so one failure can't hide another: give it its own test or assertion,"," and stub or seed any data its setup needs that a different defect could break (a list the page loads, a shared"," helper that rejects the response before your assertion reads it). A test that shows a defect asserts only the"," outcome its case expects \u2014 one defect per test \u2014 so it passes once that defect is fixed."," For each element or field the change adds, assert that it is there (shown, or present in the response); clicking"," or filling it is not an assertion. For each it removes or renames, assert that it is gone: not shown, a count of 0,"," the field missing, a 404, the old option no longer offered."," Where a case's steps give the exact requests, send them as they are rather than working them out again, and keep"," those tests together in one file."," The plan is where to start, not the limit: if you notice something else the change should do, or could break,"," while you write and run these, test that too, filed under the plan requirement it guards. A test of what it could"," break that passes stays only when it is the one test of its requirement; remove one that another of your tests",' already covers, and list its case under notWritten with a reason that starts "Passing:" and says what it checked \u2014'," never a journey's test, which stays whether it"," passes or fails. Where nothing says what should happen, only decide it for what"," the change does; how older code treats odd input is not this PR's to test. One case for each kind of input is"," enough: add another only where it could fail while the first passes.","2. Run the tests you wrote together, once, in the foreground, with a short per-test timeout so a hung test fails",` fast; wait for the run to finish (one Bash call may run up to ${MV} minutes), and don't end the session with a test`," run still going: the session is non-interactive and ends when you stop, so nothing would report its result.","3. For each failure, work out whose fault it is, and settle it outside the test before you call it a defect. The"," outcome the test expects must be one the PR, spec or code requires, not one you chose: an exact status where only a"," refusal is required, a message or format nothing states, a value read from a column picked by position. Where only"," part of it is required, assert only that part. A failure before the step that checks the case (sign-in, setup,"," seeding, a helper, an element not found, a timeout) is the test's until you have seen the app do it wrong: look at"," the page or send the request yourself, and find the line of application code that does it."," If the test checks what its case requires and the app does something else, that's a defect in the change: keep the"," test as written, mark the case and its file as a defect, and report the bug with that line. Never change an expected"," outcome to match what the app does. If the test itself is wrong (selector, setup, data, import, timing, an outcome"," nothing requires), fix it and re-run only the tests that failed (e.g. pytest --lf, playwright test --last-failed, or"," by name); a failing case you could not fix is marked defect: false, never a defect. Give each failing case the",` runner's failure as it printed it ("failure"), and each case you keep as a defect its "cause", the application line.`," Don't re-run the whole set at"," the end: the results you already have stand.","4. Then run the repo's existing tests that reach the code the change touches, the way its CI runs them (its command"," and environment), selected as narrowly as still covers that code: the whole suite only when it runs in a few"," minutes. For each one that fails, find out whether this change made it fail; when you can't tell, run it on the"," base branch in a scratch copy outside the"," checkout (e.g. git worktree add under /tmp). One that asserts behaviour the change deliberately replaced is stale:"," update it, or delete it where the behaviour is gone, and re-run it; give staleBecause for it \u2014 the requirement the"," change deliberately alters and the changed line of application code (path:line) that alters it. One that catches"," something the change breaks is a defect: leave it failing and report it. Leave alone failures the change did not cause.","5. If the repo has a linter or formatter for test code, run it on your files. The application's manifests and"," lockfiles are its owner's: a test in the repo's own framework uses only what the repo already declares, and you"," never add, upgrade or remove a package in the application's own manifests or lockfiles for Testbot's tests.",b?" For the app's code, reach it the way the repo's in-process tests do (its test client, fixtures and helpers).":" For calls to the app, use the client and helpers the repo's existing tests use for that service."," Tooling the repo doesn't declare (Playwright where it has none) goes in the Testbot test package"," above, never in the application's manifests; with no such package, write the test with what the repo has."," The one exception is a test that must run inside the application's existing test environment and cannot"," without a package it lacks: add it to the manifest of the checkout the test is in, keep the manifest's"," constraints, upgrade nothing else, update that manifest's lockfile with its own package manager (the updated lockfile"," must name the added package), run the existing tests of that environment, and list it in dependenciesAdded"," with the reason; for another checkout of the change, name that checkout as the entry's repository.","",'In your result, give each file you added or updated its "functions": each test function in it as the runner names',"it, with the plan case ids it checks, so that every case it covers is checked by a function you name. Give each","issue its plan finding id and the requirement or clause ids it violates. Name each test for what it checks: no plan","id in a test's name or title, except a label the description or spec itself gives the requirement (AC-3).","","Apart from that scratch copy, stay inside the checkout and leave it on the commit it is on,","with the change's files in place: run or read the base in the scratch copy (or with git show <commit>:<file>), never","by checking the checkout out, resetting or stashing it. Don't commit or push, and leave the tests in the working tree.",`Once you've run the tests the first time, write your result as JSON (below) to ${e.checkpoint}, and keep it current`,"as you go: that file is what's","read. End with a one-line final message \u2014 don't repeat the JSON in it. The report is read by the PR author: describe","their code, not this process.","",yn(ji)].join(`
|
|
814
814
|
`)}function lO(t,e,r){let n=Es.join(t.outputsDir,e);return rl.writeFileSync(n,JSON.stringify(Br(r,t.secretValues??[]),null,2)+`
|
|
815
815
|
`),Es.relative(t.runDir,n)}function rht(t,e){let r=e.dependenciesAdded??[],n=t.prepared?.dependencyBaseline??new Set;return[...XV(t,r,n),...Wpt(t)]}var sCr={name:Zft,verify(t,e){let{value:r}=Ei(ji,e.stdout,qs(t),t.secretValues);if(!r)return{name:this.name,passed:!0};let n=rht(t,r);return n.length?{...ve(this.name,n),repairable:!0}:{name:this.name,passed:!0}}};function iCr(t,e){let r=oe(t,Jc);if(!r)return[];let n=e.tests.map(i=>i.file),s=r.packages.filter(i=>{try{let o=kct(t.inputs.repositoryPath,i,n);return o&&tl(t).info(`[write] no test went in the new test package ${i.dir}: removed it`),!o}catch{return!0}});return tht(t,s),s}function oCr(t,e){let{write:r,settled:n}=Cft(e);n.length&&tl(t).warn(`[write] failed before any check, with no application line \u2014 not a defect: ${n.join(", ")}`);let s=ya(t)?Vft(r,o0(t).browserJourneys):r;iCr(t,s);let i=ict(s,t.inputs.repositoryPath,t.inputs.relatedRepos??[]),o=rht(t,s);return o.length&&(i.finalize.ready=!1,i.finalize.blockers=[...i.finalize.blockers,...o.slice(0,4)]),i.dropped.length&&tl(t).warn(`[write] not on disk, left out of adapt.json: ${i.dropped.join(", ")}`),i.ambiguous.length&&tl(t).warn(`[write] in both the repo under test and a related checkout, kept the repo under test's: ${i.ambiguous.join(", ")}`),{artifacts:{write:lO(t,"write.json",s),adapt:lO(t,"adapt.json",i.adapt),generate:lO(t,"generate.json",i.generate),"generate-ui":lO(t,"generate-ui.json",i.generateUi),finalize:lO(t,"finalize.json",i.finalize)},placed:i.placed}}async function nht(t,e){let{artifacts:r,placed:n}=oCr(t,e);if(ya(t))return r;let s=new Map(n.map(o=>[o.written,o])),i=await Lmt({write:e,outputsDir:t.outputsDir,resolve:o=>{let a=s.get(o),c=a&&Es.resolve(a.root,a.file);return a&&c&&rl.existsSync(c)&&rl.statSync(c).isFile()?{abs:c,root:Es.resolve(a.root),file:a.file,...a.repository?{repository:a.repository}:{}}:void 0},env:{...sht(t),...t.sutAuthEnv??{}},...t.deadlineMs!==void 0?{deadlineMs:t.deadlineMs}:{},...t.signal?{signal:t.signal}:{}}).catch(o=>{tl(t).warn(`[write] recording the browser tests' videos failed: ${o instanceof Error?o.message:String(o)}`)});return i?.skipped.length&&tl(t).info(`[write] no video for ${i.skipped.map(o=>`${o.fileName} (${o.reason})`).join(", ")}`),{...r,...i?{"ui-videos":Es.relative(t.runDir,Es.join(t.outputsDir,Hh))}:{}}}function sht(t){try{return{...FV(Qh(ou(t.inputs.repositoryPath))),...Mh}}catch{return{...Mh}}}var iht="write-stale-updates",aCr={name:iht,verify(t,e){let{value:r}=Ei(ji,e.stdout,qs(t),t.secretValues);if(!r)return{name:this.name,passed:!0};let n=[{path:t.inputs.repositoryPath,prefix:""},...(t.inputs.relatedRepos??[]).map(f=>({path:f.path,prefix:`${Es.basename(Es.resolve(f.path))}/`}))].flatMap(({path:f,prefix:h})=>{try{return(0,Jft.execFileSync)("git",["-C",f,"diff","--name-only","--diff-filter=d","HEAD"],{encoding:"utf-8"}).split(`
|
|
816
816
|
`).filter(b=>b&&kR(b)&&!b.startsWith(".skyramp/")).map(b=>h+b)}catch{return[]}}),s=r.tests.filter(f=>f.change!=="added"&&f.change!=="deleted").map(f=>({file:f.file,changed:f.change!=="unchanged",ran:f.result.exit!==null})),i=nlt(n,s),o=r.tests.filter(f=>f.change==="updated");if(!o.length)return rl.writeFileSync(Es.join(t.outputsDir,PR),`[]
|
package/dist/post.js
CHANGED
|
@@ -583,14 +583,14 @@ ${GTt(e,t)}`}function GTt(e,t){if(e.inputs.appRunning)return[`${e.inputs.appRunn
|
|
|
583
583
|
`){if(!f)return h;c(h)}if(C==="\\"&&!(t==="go"&&d==="`")){h+=2;continue}if(d==="`"&&t==="js"){if(C==="$"&&e[h+1]==="{"){A++,h+=2;continue}if(C==="}"&&A>0){A--,h++;continue}}if(A===0&&e.startsWith(p,h))return h+p.length;h++}return n};for(;i<n;){let u=e[i];if(u===`
|
|
584
584
|
`){c(i),i++;continue}if(u===" "||u===" "||u==="\r"){i++;continue}if(s&&u==="#"||!s&&u==="/"&&e[i+1]==="/"){for(;i<n&&e[i]!==`
|
|
585
585
|
`;)i++;continue}if(!s&&u==="/"&&e[i+1]==="*"){let d=e.indexOf("*/",i+2),p=d<0?n:d+2;for(let f=i;f<p;f++)e[f]===`
|
|
586
|
-
`&&c(f);i=p;continue}if(u==='"'||u==="'"||u==="`"){let d={line:o,col:i-a},p=s&&e.startsWith(u.repeat(3),i)?3:1,f=l(i,u),h=e.slice(i+p,Math.max(i+p,f-p));r.push({kind:"s",text:h,...d,template:u==="`"&&t==="js"&&h.includes("${")}),i=f;continue}if(/[A-Za-z_$]/.test(u)){let d=i+1;for(;d<n&&/[\w$]/.test(e[d]);)d++;let p=e.slice(i,d);if(s&&INt.test(p)&&(e[d]==='"'||e[d]==="'")){i=d;continue}r.push({kind:"i",text:p,line:o,col:i-a}),i=d;continue}if(/\d/.test(u)){let d=i+1;for(;d<n&&/[\w.]/.test(e[d]);)d++;r.push({kind:"n",text:e.slice(i,d),line:o,col:i-a}),i=d;continue}r.push({kind:"p",text:u,line:o,col:i-a}),i++}return r}var vNt={"(":")","[":"]","{":"}"};function Ad(e,t){let r=e[t].text,n=vNt[r],s=0;for(let i=t;i<e.length;i++){let o=e[i];if(o.kind==="p"){if(o.text===r)s++;else if(o.text===n&&--s===0)return i}}return-1}var yd=(e,t)=>t===0||e[t-1].line<e[t].line;function h6(e,t,r){let n=[],s=0,i=!0;for(let o=t+1;o<r;o++){let a=e[o];a.kind==="p"&&"([{<".includes(a.text)?s++:a.kind==="p"&&")]}>".includes(a.text)?s=Math.max(0,s-1):s===0&&a.text===","?i=!0:s===0&&i&&a.kind==="i"&&!["public","private","protected","readonly"].includes(a.text)&&(n.push(a.text),i=!1)}return n}function RNt(e,t){let r=new Map;for(let n=0;n+2<e.length;n++){let[s,i,o]=[e[n],e[n+1],e[n+2]];if(s.kind!=="i"||i.text!=="="||o.kind!=="s"||o.template)continue;let a=t==="py"?yd(e,n)&&s.col===0:e[n-1]?.text==="const",c=e[n+3];a&&(!c||c.line>o.line||c.text===";")&&r.set(s.text,o.text)}return r}function m6(e,t,r,n,s,i){let o=new Map(n.map((u,d)=>[u,`$${d}`])),a=[],c=t;for(i==="py"&&e[c]?.kind==="s"&&(c+1>=r||e[c+1].line>e[c].line)&&c++;c<r;c++){let u=e[c];if(u.kind==="s"){let d=u.template?u.text.replace(/\$\{\s*([A-Za-z_$][\w$]*)\s*\}/g,(p,f)=>s.get(f)??(o.has(f)?`\${${o.get(f)}}`:p)):u.text;a.push(JSON.stringify(d))}else u.kind==="i"&&e[c-1]?.text!=="."?a.push(o.get(u.text)??(s.has(u.text)?JSON.stringify(s.get(u.text)):u.text)):a.push(u.text)}return{key:a.filter(u=>u!==";").join(" ").replace(/ , (?=[)\]}])/g," "),size:a.length}}function oMe(e,t){let r=0,n=0;for(let s=t;s<e.length;s++){let i=e[s].text;if(i==="<")r++;else if(i===">"&&e[s-1]?.text!=="=")r=Math.max(0,r-1);else if(i==="(")n++;else if(i===")")n--;else{if(i==="{"&&r===0&&n===0)return s;if(i===";"||i==="="&&e[s+1]?.text!==">")return-1}}return-1}function kNt(e,t){return e.kind==="p"&&!")]}".includes(e.text)||t.kind==="p"&&".?:&|+-*/<>=".includes(t.text)}function BNt(e,t){let r=0;for(let n=t;n<e.length;n++){let s=e[n];if(s.kind==="p"&&"([{".includes(s.text))r++;else if(s.kind==="p"&&")]}".includes(s.text)){if(r===0)return n;r--}else if(r===0&&(s.text===";"||s.text===","||n>t&&s.line>e[n-1].line&&!kNt(e[n-1],s)))return n}return e.length}function aMe(e){let t=new Set,r=n=>{let s=Ad(e,n);for(let i=n+1;i>0&&i<s;i++){let o=e[i];o.kind!=="i"||e[i-1]?.text==="as"||e[i-1]?.text===":"||[",","}",":","as"].includes(e[i+1]?.text)&&t.add(o.text)}};for(let n=0;n<e.length;n++){let s=e[n].text;s==="export"&&e[n+1]?.text==="{"&&r(n+1),s==="exports"&&e[n+1]?.text==="="&&e[n+2]?.text==="{"&&r(n+2),s==="exports"&&e[n+1]?.text==="."&&e[n+2]?.kind==="i"&&t.add(e[n+2].text)}return t}function TNt(e,t){let r=[],n=aMe(e),s=o=>{for(let a=o-1;a>=Math.max(0,o-4);a--){if(e[a].text==="export")return!0;if(!["default","async","function","*","const","let","var"].includes(e[a].text))return!1}return!1},i=(o,a,c,l,u)=>{let d=e[o].text,{key:p,size:f}=m6(e,l,u,h6(e,a,c),t,"js");r.push({name:d,line:e[o].line,exported:s(o)||n.has(d),key:p,size:f})};for(let o=0;o<e.length;o++){let a=e[o];if(a.kind==="i"){if(a.text==="function"){let c=o+1;if(e[c]?.text==="*"&&c++,e[c]?.kind!=="i")continue;let l=c++;if(e[c]?.text==="<")for(;c<e.length&&e[c].text!=="(";)c++;if(e[c]?.text!=="(")continue;let u=Ad(e,c),d=u<0?-1:oMe(e,u+1),p=d<0?-1:Ad(e,d);p>0&&i(l,c,u,d+1,p);continue}if((a.text==="const"||a.text==="let"||a.text==="var")&&e[o+1]?.kind==="i"){let c=o+1,l=o+2;if(e[l]?.text===":")for(;l<e.length&&e[l].text!=="="&&e[l].line===e[c].line;)l++;if(e[l]?.text!=="=")continue;l++,e[l]?.text==="async"&&l++;let u,d;if(e[l]?.text==="("){if(u=l,d=Ad(e,l),d<0)continue}else if(e[l]?.kind==="i"&&e[l+1]?.text==="="&&e[l+2]?.text===">")u=l-1,d=l+1;else continue;let p=d+1;if(e[p]?.text===":")for(;p<e.length&&!(e[p].text==="="&&e[p+1]?.text===">")&&e[p].text!==";";)p++;if(e[p]?.text!=="="||e[p+1]?.text!==">")continue;if(p+=2,e[p]?.text==="{"){let f=Ad(e,p);f>0&&i(c,u,d,p+1,f)}else i(c,u,d,p,BNt(e,p))}}}return r}function NNt(e,t){let r=[];for(let n=0;n<e.length;n++){if(e[n].text!=="def"||e[n+1]?.kind!=="i"||e[n+2]?.text!=="(")continue;let s=e[n-1]?.text==="async"&&yd(e,n-1);if(!s&&!yd(e,n))continue;let i=e[s?n-1:n].col,o=Ad(e,n+2);if(o<0)continue;let a=o+1;for(;a<e.length&&e[a].text!==":";)a++;let c=a+1;for(;c<e.length&&!(yd(e,c)&&e[c].line>e[a].line&&e[c].col<=i);)c++;let l=h6(e,n+2,o).filter(f=>f!=="self"&&f!=="cls"),{key:u,size:d}=m6(e,a+1,c,l,t,"py"),p=e[n+1].text;r.push({name:p,line:e[n+1].line,exported:i===0&&!p.startsWith("_"),key:u,size:d})}return r}function _Nt(e,t){let r=[];for(let n=0;n<e.length;n++){if(e[n].text!=="func"||!yd(e,n))continue;let s=n+1;if(e[s]?.text==="("&&(s=Ad(e,s)+1),s<=0||e[s]?.kind!=="i"||e[s+1]?.text!=="(")continue;let i=Ad(e,s+1),o=i<0?-1:oMe(e,i+1),a=o<0?-1:Ad(e,o);if(a<0)continue;let{key:c,size:l}=m6(e,o+1,a,h6(e,s+1,i),t,"go");r.push({name:e[s].text,line:e[s].line,exported:/^[A-Z]/.test(e[s].text),key:c,size:l})}return r}function PNt(e,t){let r=[],n=[];if(t==="js"){for(let s=0;s<e.length;s++){if(e[s].text!=="import"||!yd(e,s)||e[s+1]?.text==="(")continue;let i=s+1;for(;i<e.length&&e[i].kind!=="s"&&e[i].text!==";";)i++;if(e[i]?.kind==="s"&&(n.push([s,i]),e[s+1]?.text!=="type"))for(let o=s+1;o<i;o++){let a=e[o];a.kind!=="i"||["from","as","type"].includes(a.text)||e[o-1]?.text==="type"||e[o+1]?.text!=="as"&&r.push({local:a.text,from:e[i].text,line:a.line})}}for(let s=0;s<e.length;s++){if(e[s].text!=="require"||e[s+1]?.text!=="("||e[s+2]?.kind!=="s"||e[s+3]?.text!==")"||e[s-1]?.text!=="=")continue;let i=e[s+2].text,o=s-2;if(e[o]?.kind==="i"&&["const","let","var"].includes(e[o-1]?.text)){n.push([o-1,s+3]),r.push({local:e[o].text,from:i,line:e[o].line});continue}if(e[o]?.text!=="}")continue;let a=o;for(let c=0;a>=0;a--)if(e[a].text==="}")c++;else if(e[a].text==="{"&&--c===0)break;if(!(a<1||!["const","let","var"].includes(e[a-1].text))){n.push([a-1,s+3]);for(let c=a+1;c<o;c++)e[c].kind==="i"&&e[c+1]?.text!==":"&&r.push({local:e[c].text,from:i,line:e[c].line})}}}else if(t==="py"){for(let s=0;s<e.length;s++){if(e[s].text!=="from"||!yd(e,s))continue;let i=s+1,o="";for(;i<e.length&&e[i].text!=="import"&&e[i].line===e[s].line;)o+=e[i++].text;if(e[i]?.text!=="import")continue;let a=e[i+1]?.text==="(",c=i+1;for(;c<e.length&&!(a?e[c].text===")":e[c].line>e[i].line&&e[c-1].text!=="\\");)c++;n.push([s,a?c:c-1]);for(let l=i+1;l<c;l++){let u=e[l];u.kind!=="i"||u.text==="as"||e[l+1]?.text==="as"||r.push({local:u.text,from:o,line:u.line})}}for(let s=0;s<e.length;s++){if(e[s].text!=="import"||!yd(e,s))continue;let i=s+1;for(;i<e.length&&e[i].line===e[s].line;){let o="",a=e[i];for(;i<e.length&&e[i].line===e[s].line&&e[i].text!==","&&e[i].text!=="as";)o+=e[i++].text;let c=a?.kind==="i"?a.text:"";e[i]?.text==="as"&&e[i+1]?.kind==="i"&&(c=e[i+1].text,i+=2),c&&o&&r.push({local:c,from:o,line:a.line}),e[i]?.text===","&&i++}n.push([s,i-1])}}return{imports:r,spans:n}}function QNt(e,t,r){let n=new Set(r.map(s=>s.from));if(t==="js")for(let s=0;s<e.length;s++){let i=e[s];if(i.kind!=="s")continue;let o=e[s-1]?.text;(o==="from"||o==="import"&&e[s-1]?.kind==="i"||o==="("&&["require","import"].includes(e[s-2]?.text??"")&&e[s+1]?.text===")")&&n.add(i.text)}return[...n]}function DNt(e,t){let r=0;for(let n=0;n<e.length;n++){if(e[n].kind!=="i"||e[n].text!=="class")continue;let s=e[n+1];(t==="py"?yd(e,n)&&s?.kind==="i":s&&(s.kind==="i"||s.text==="{"))&&r++}return r}function vE(e,t){let r=bd(t);if(!r)return;let n=xNt(e,r),s=RNt(n,r),i=r==="js"?TNt(n,s):r==="py"?NNt(n,s):_Nt(n,s),{imports:o,spans:a}=PNt(n,r),c=new Map,l=d=>c.set(d,(c.get(d)??0)+1),u=0;for(let d=0;d<n.length;d++){for(;u<a.length&&d>a[u][1];)u++;if(u<a.length&&d>=a[u][0])continue;let p=n[d];if(p.kind==="i")l(p.text);else if(p.kind==="s"&&(p.template||r==="py"&&p.text.includes("{")))for(let f of p.text.matchAll(/\{[^{}]*\}/g))for(let h of f[0].matchAll(/[A-Za-z_$][\w$]*/g))l(h[0])}return{lang:r,functions:i,imports:o,uses:c,listedExports:r==="js"?aMe(n):new Set,deps:QNt(n,r,o),classes:r==="go"?0:DNt(n,r)}}var MNt=15,FNt=6,cg=e=>Vs.test(e),LNt=/utils?|skyramp/i,UNt=/utils?/i,RE=e=>gt.posix.basename(e).replace(/\.[^.]+$/,""),$Nt=/^(conftest\.py|__init__\.py|[^/]*\.config\.[cm]?[jt]s|[^/]+\.(setup|teardown)\.[cm]?[jt]sx?|setupTests\.[cm]?[jt]sx?)$/i,qNt=/^([\w.-]+\.config\.([cm]?[jt]s|json)|package\.json|pytest\.ini|pyproject\.toml|setup\.cfg|tox\.ini)$/i,cMe=e=>e.replace(/\.([cm]?[jt]sx?|py)$/,"");function GNt(e,t){let r=cMe(t),n=gt.posix.dirname(e.rel);return(e.text.match(/[\w@$.\-/]+/g)??[]).some(i=>{let o=i.replace(/^<rootDir>\//,"").replace(/[.,]+$/,"");if(!o)return!1;let a=cMe(gt.posix.normalize(gt.posix.join(o.startsWith("/")?".":n,o.replace(/^\//,"")))),c=/^[A-Za-z_][\w.]*$/.test(o)&&o.includes(".")?o.replace(/\./g,"/"):void 0;return a===r||c!==void 0&&(c===r||gt.posix.join(n,c)===r)})}function lMe(e,t){return $Nt.test(gt.posix.basename(e))?!0:t.some(r=>GNt(r,e))}var g6=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"];function kE(e,t,r,n){let s=gt.posix.dirname(e),i=o=>o.map(a=>gt.posix.normalize(a)).find(a=>!a.startsWith("..")&&n(a));if(r==="js"){if(!t.startsWith("."))return;let o=gt.posix.join(s,t),a=o.replace(/\.[cm]?js$/,"");return i([o,...g6.map(c=>o+c),...g6.map(c=>a+c),...g6.map(c=>`${o}/index${c}`)])}if(r==="py"){let o=t.match(/^\.*/)[0].length,a=t.slice(o).replace(/\./g,"/"),c=[];if(o){let l=s;for(let u=1;u<o;u++)l=gt.posix.dirname(l);c.push(l)}else for(let l=s;c.push(l),!(l==="."||l==="/"||l==="");l=gt.posix.dirname(l));return i(c.flatMap(l=>a?[`${l}/${a}.py`,`${l}/${a}/__init__.py`]:[`${l}/__init__.py`]))}}var uMe=e=>`${e.rel}:${e.fn.line}`;function HNt(e,t){return[...new Set(e.code.imports.map(r=>kE(e.rel,r.from,e.code.lang,t)).filter(r=>!!r&&!cg(r)))]}function jNt(e){let t=v=>{let F=vE(v.text,v.rel);return F?{rel:v.rel,code:F,test:cg(v.rel)}:void 0},r=e.written.flatMap(v=>{let F=t(v),U=v.before===void 0?void 0:vE(v.before,v.rel);return F?[{...F,before:U,isNew:v.before===void 0,definesHelpers:F.code.functions.length>0||F.code.classes>0}]:[]}),n=e.existing.flatMap(v=>t(v)??[]),s=new Map([...n,...r].map(v=>[v.rel,v])),i=v=>s.has(v),o=[],a=new Map,c=v=>a.set(v.fn.key,[...a.get(v.fn.key)??[],v]);for(let v of n)for(let F of v.code.functions)c({rel:v.rel,fn:F,lang:v.code.lang,test:v.test});for(let v of r){let F=new Set(v.code.functions.map(U=>U.name));for(let U of v.before?.functions??[])F.has(U.name)&&c({rel:v.rel,fn:U,lang:v.code.lang,test:v.test})}let l=(v,F)=>v.key===F.key&&(v.size>=MNt||v.name===F.name&&v.size>=FNt),u=(v,F)=>new Set((a.get(v.key)??[]).filter(U=>U.lang===F&&l(v,U.fn)).map(U=>U.rel)).size>=2,d=r.flatMap(v=>{let F=new Set((v.before?.functions??[]).map(U=>U.name));return v.code.functions.filter(U=>!F.has(U.name)).map(U=>({w:v,fn:U}))}),p=v=>{let F=v.flatMap(U=>HNt(U,i)).find(U=>!r.some(X=>X.rel===U&&X.isNew));return F?`the repo's ${F}`:"the repo's shared test-support module (else a module beside the tests that use it, laid out the way the repo keeps its tests, named for what it holds)"},f=new Set;for(let{w:v,fn:F}of d){if(u(F,v.code.lang))continue;let U=(a.get(F.key)??[]).find(W=>W.lang===v.code.lang&&!(W.rel===v.rel&&W.fn.name===F.name)&&l(F,W.fn));if(!U)continue;f.add(F);let X=s.get(U.rel);U.fn.exported||!U.test?o.push(`${v.rel}:${F.line} ${F.name} copies ${U.fn.name} (${uMe(U)}) \u2014 import ${U.fn.name} from there instead of defining it again`):o.push(`${v.rel}:${F.line} ${F.name} copies ${U.fn.name}, local to ${uMe(U)} \u2014 move ${U.fn.name} into ${p([v,...X?[X]:[]])} and import it in both files; no second copy`)}let h=r.filter(v=>v.isNew&&!v.test),A=new Map;for(let{w:v,fn:F}of d){if(!v.test||f.has(F))continue;let U=h.find(V=>V.code.lang===v.code.lang&&V.code.functions.some(N=>l(F,N))),X=U?.code.functions.find(V=>l(F,V));if(!U||!X)continue;f.add(F);let W=`${v.rel}:${F.line} ${F.name} copies ${X.name} (${U.rel}:${X.line}) \u2014 import ${X.name} from there instead of defining it again`,J=A.get(U.rel)??{tests:new Set,sent:[]};J.tests.add(v.rel),J.sent.push(W),A.set(U.rel,J),o.push(W)}let C=[],w=v=>mv(v).dir;for(let v of d){if(!v.w.test||f.has(v.fn)||u(v.fn,v.w.code.lang))continue;let F=C.find(U=>U[0].w.code.lang===v.w.code.lang&&w(U[0].w.rel)===w(v.w.rel)&&l(U[0].fn,v.fn));F?F.push(v):C.push([v])}for(let v of C){let F=[...new Map(v.map(U=>[U.w.rel,U.w])).values()];F.length<2||o.push(`${v[0].fn.name} is defined in ${F.length} test files (${F.map(U=>U.rel).join(", ")}) \u2014 define it once, in ${p(F)}, and import it from each`)}for(let v of r){let F=new Set((v.before?.imports??[]).map(U=>`${U.local}\0${U.from}`));for(let U of v.code.imports){if(F.has(`${U.local}\0${U.from}`)||(v.code.uses.get(U.local)??0)>0)continue;(U.from.startsWith(".")||kE(v.rel,U.from,v.code.lang,i)!==void 0)&&o.push(`${v.rel}:${U.line} imports ${U.local} from ${U.from} and never uses it \u2014 use it, or drop the import`)}}let b=new Map([...(e.otherTests??[]).flatMap(v=>t(v)??[]).map(v=>[v.rel,v]),...s]),I=v=>[...b.values()].filter(F=>F.rel!==v&&F.code.deps.some(U=>kE(F.rel,U,F.code.lang,i)===v)),x=n.filter(v=>!v.test&&(v.code.functions.length>0||v.code.classes>0)&&!lMe(v.rel,e.configs??[])).map(v=>({rel:v.rel,users:I(v.rel).filter(F=>F.test&&!r.some(U=>U.rel===F.rel)).length})).filter(v=>v.users>0),B=x.filter(v=>v.users===1),k=v=>B.some(F=>gt.posix.dirname(F.rel)===gt.posix.dirname(v))||x.length>0&&B.length*2>=x.length,R=new Set;for(let v of r){if(!v.isNew||v.test||!v.definesHelpers||lMe(v.rel,e.configs??[])||k(v.rel))continue;let F=I(v.rel);if(F.some(J=>!J.test))continue;let U=A.get(v.rel),X=new Set([...F.map(J=>J.rel),...U?.tests??[]]);if(X.size!==1)continue;R.add(v.rel);let W=[...X][0];if(U)for(let J of U.sent)o.splice(o.indexOf(J),1);o.push(`${v.rel} is imported only by ${W}${U?", which also copies its helpers":""} \u2014 move its contents into ${W} and delete ${v.rel}; keep it only if a second test file uses it`)}for(let v of r){if(!v.isNew||v.test||R.has(v.rel))continue;let F=new Map;for(let U of v.code.functions){if(!U.exported||(v.code.uses.get(U.name)??0)-1-(v.code.listedExports.has(U.name)?1:0)>0)continue;let W=[...s.values()].filter(J=>J.test&&J.rel!==v.rel&&(J.code.uses.get(U.name)??0)>0&&J.code.imports.some(V=>kE(J.rel,V.from,J.code.lang,i)===v.rel));W.length===1&&F.set(W[0].rel,[...F.get(W[0].rel)??[],U.name])}for(let[U,X]of F)o.push(`${v.rel}: ${X.join(", ")} ${X.length>1?"are":"is"} used only by ${U} \u2014 a helper only one test file uses stays in that file`)}let L=n.some(v=>!v.test&&UNt.test(RE(v.rel)));for(let v of r){if(!v.isNew||v.test||!v.code.functions.length)continue;let F=RE(v.rel);(/skyramp/i.test(F)||!L&&LNt.test(F))&&o.push(`${v.rel}: name the module for what it holds (e.g. orders, session, pages) \u2014 not "utils" or "Skyramp"`)}return o}var fO=new Set(["node_modules",".git","dist","build","coverage","test-results","playwright-report","__pycache__",".venv","venv","vendor",".next","target"]),dMe=new RegExp(`(^|/)(${[...fO].map(e=>e.replace(/\./g,"\\.")).join("|")})/`),mMe=/^(tests?|e2e|e2e-tests|__tests__|specs?|playwright|cypress|integration|testing)$/i,zNt=/test|spec|helper|support|fixture|page/i,pMe=3e3,VNt=256*1024,WNt=4e3;function ag(e){try{let t=hO.statSync(e);return t.isFile()&&t.size<=VNt?hO.readFileSync(e,"utf-8"):void 0}catch{return}}function JNt(e,t){try{return(0,hMe.execFileSync)("git",[...Ss,"show",`HEAD:${t}`],{cwd:e,env:Je(),encoding:"utf-8",maxBuffer:16*1024*1024,stdio:["ignore","pipe","ignore"]})}catch{return}}function mv(e){let t=gt.posix.dirname(e).split("/").filter(n=>n&&n!=="."),r=t.findIndex(n=>mMe.test(n));return r>=0?{dir:t.slice(0,r+1).join("/"),deep:!0}:{dir:t.join("/"),deep:!1}}function A6(e,t){let r=[];for(let u of nf(e)){if(!bd(u.path)||dMe.test(u.path)||u.code.includes("D")||t?.has(gt.resolve(e,u.path)))continue;let d=ag(gt.join(e,u.path));if(d===void 0)continue;let p=u.code==="??"||u.code[0]==="A";r.push({rel:u.path,text:d,before:p?void 0:JNt(e,u.path)??void 0})}let n=new Set(r.map(u=>u.rel)),s=[],i=new Set;for(let{dir:u,deep:d}of new Map(r.map(p=>[JSON.stringify(mv(p.rel)),mv(p.rel)])).values())Ku(gt.join(e,u),p=>{let f=gt.relative(e,p).split(gt.sep).join("/");if(i.has(f)||n.has(f)||!bd(f)||!d&&!cg(f)&&!zNt.test(gt.posix.basename(f)))return;i.add(f);let h=ag(p);if(h!==void 0&&s.push({rel:f,text:h}),s.length>=pMe)return!1},{skip:fO,maxDepth:d?8:0});let o=u=>ag(gt.join(e,u))!==void 0;for(let u of r){let d=vE(u.text,u.rel);if(d)for(let p of d.imports){if(s.length>=pMe)break;let f=kE(u.rel,p.from,d.lang,o);if(!f||i.has(f)||n.has(f)||dMe.test(f))continue;i.add(f);let h=ag(gt.join(e,f));h!==void 0&&s.push({rel:f,text:h})}}let a=r.filter(u=>u.before===void 0&&!cg(u.rel)),c=[],l=[];if(a.length){let u=a.map(f=>RE(f.rel)),d=[...new Set(a.flatMap(f=>/^(index|__init__)$/.test(RE(f.rel))?[RE(f.rel),gt.posix.basename(gt.posix.dirname(f.rel))]:[RE(f.rel)]))],p=0;Ku(e,(f,h)=>{let A=h.split(gt.sep).join("/"),C=qNt.test(gt.posix.basename(A)),w=!C&&cg(A)&&bd(A)!==void 0&&!i.has(A)&&!n.has(A);if(!C&&!w)return;if(w&&++p>WNt)return!1;let b=ag(f);b!==void 0&&(C?u:d).some(I=>b.includes(I))&&(C?l:c).push({rel:A,text:b})},{skip:fO,maxDepth:10})}return{written:r,existing:s,otherTests:c,configs:l}}var y6="write-reuse",YNt=/\bcopies\b| is defined in \d+ test files | is imported only by /;function fMe(e){return YNt.test(e)}var gMe={name:y6,verify(e){let t=e.prepared?.secretGateBaseline,r=[];for(let i of je(e.inputs)){let o=i.path===e.inputs.repositoryPath?"":Xe(e.inputs,i.slug);r.push(...jNt(A6(i.path,t)).map(a=>o+a))}let n=r.filter(i=>!fMe(i));n.length&&console.log(`[${this.name}] noted, not sent back: ${n.join("; ")}`);let s=r.filter(fMe);return s.length?{...ce(this.name,s),repairable:!0}:{name:this.name,passed:!0}}},KNt=10,XNt=/test|spec|helper|support|fixture/i,ZNt=e=>e.split("/").some(t=>mMe.test(t)||XNt.test(t)),e_t=10,t_t=4e3;function r_t(e,t){let r=t==="js"?/^export\s+(?:default\s+)?(?:async\s+)?(?:function\*?|class|const|let)\s+([A-Za-z_$][\w$]*)/gm:/^(?:async\s+)?(?:def|class)\s+([A-Za-z]\w*)/gm,n=[...e.matchAll(r)].map(i=>i[1]),s=t==="js"?[...vE(e,"x.ts")?.listedExports??[]]:[];return[...new Set([...n,...s])]}function AMe(e){let t=new Set,r=[];Ku(e,(o,a)=>{let c=a.split(gt.sep).join("/"),l=bd(c);l!=="js"&&l!=="py"||(t.add(c),cg(c)&&r.length<t_t&&r.push(c))},{skip:fO,maxDepth:10});let n=o=>t.has(o),s=new Map;for(let o of r){let a=ag(gt.join(e,o)),c=a===void 0?void 0:vE(a,o);if(!c)continue;let l=new Set(c.imports.map(u=>kE(o,u.from,c.lang,n)).filter(u=>!!u&&!cg(u)));for(let u of l)s.set(u,(s.get(u)??0)+1)}for(let o of t){if(gt.posix.basename(o)!=="conftest.py")continue;let a=gt.posix.dirname(o),c=r.filter(l=>l.endsWith(".py")&&(a==="."||l.startsWith(`${a}/`))).length;c&&s.set(o,Math.max(s.get(o)??0,c))}let i=o=>gt.posix.basename(o)==="conftest.py";return[...s].filter(([o,a])=>a>=2&&(ZNt(o)||i(o))).sort((o,a)=>a[1]-o[1]||o[0].localeCompare(a[0])).slice(0,KNt).map(([o,a])=>{let c=ag(gt.join(e,o))??"";return{rel:o,importers:a,names:r_t(c,bd(o)).slice(0,e_t)}})}function yMe(e){return e.length?["The repo's shared test helpers, by how many of its test files use them:",...e.map(({label:t,module:r})=>` - ${t}${r.rel} (${r.importers} test files)${r.names.length?`: ${r.names.join(", ")}`:""}`)]:[]}var EMe=z(require("path"));var n_t=10,s_t=3,i_t=5,o_t=/\.(?:locator|getBy[A-Z]\w*|get_by_\w+)\(/g,a_t=/^\s*(?:export\s+(?:default\s+)?)?class\s+\w+/m,c_t=/@testing-library\/|from ["']enzyme["']/,mO=e=>(e.match(o_t)??[]).length,l_t=/@playwright\/test|from\s+['"]playwright|\bpage\.(?:goto|locator|getBy\w+)\s*\(|\bcy\.(?:visit|get)\s*\(|webdriver|selenium|newSkyrampPlaywrightPage/i,bMe=(e,t)=>wMe(e,t)&&l_t.test(t);function u_t(e,t){if(t===void 0)return mO(e);let r=new Map;for(let s of t.split(`
|
|
586
|
+
`&&c(f);i=p;continue}if(u==='"'||u==="'"||u==="`"){let d={line:o,col:i-a},p=s&&e.startsWith(u.repeat(3),i)?3:1,f=l(i,u),h=e.slice(i+p,Math.max(i+p,f-p));r.push({kind:"s",text:h,...d,template:u==="`"&&t==="js"&&h.includes("${")}),i=f;continue}if(/[A-Za-z_$]/.test(u)){let d=i+1;for(;d<n&&/[\w$]/.test(e[d]);)d++;let p=e.slice(i,d);if(s&&INt.test(p)&&(e[d]==='"'||e[d]==="'")){i=d;continue}r.push({kind:"i",text:p,line:o,col:i-a}),i=d;continue}if(/\d/.test(u)){let d=i+1;for(;d<n&&/[\w.]/.test(e[d]);)d++;r.push({kind:"n",text:e.slice(i,d),line:o,col:i-a}),i=d;continue}r.push({kind:"p",text:u,line:o,col:i-a}),i++}return r}var vNt={"(":")","[":"]","{":"}"};function Ad(e,t){let r=e[t].text,n=vNt[r],s=0;for(let i=t;i<e.length;i++){let o=e[i];if(o.kind==="p"){if(o.text===r)s++;else if(o.text===n&&--s===0)return i}}return-1}var yd=(e,t)=>t===0||e[t-1].line<e[t].line;function h6(e,t,r){let n=[],s=0,i=!0;for(let o=t+1;o<r;o++){let a=e[o];a.kind==="p"&&"([{<".includes(a.text)?s++:a.kind==="p"&&")]}>".includes(a.text)?s=Math.max(0,s-1):s===0&&a.text===","?i=!0:s===0&&i&&a.kind==="i"&&!["public","private","protected","readonly"].includes(a.text)&&(n.push(a.text),i=!1)}return n}function RNt(e,t){let r=new Map;for(let n=0;n+2<e.length;n++){let[s,i,o]=[e[n],e[n+1],e[n+2]];if(s.kind!=="i"||i.text!=="="||o.kind!=="s"||o.template)continue;let a=t==="py"?yd(e,n)&&s.col===0:e[n-1]?.text==="const",c=e[n+3];a&&(!c||c.line>o.line||c.text===";")&&r.set(s.text,o.text)}return r}function m6(e,t,r,n,s,i){let o=new Map(n.map((u,d)=>[u,`$${d}`])),a=[],c=t;for(i==="py"&&e[c]?.kind==="s"&&(c+1>=r||e[c+1].line>e[c].line)&&c++;c<r;c++){let u=e[c];if(u.kind==="s"){let d=u.template?u.text.replace(/\$\{\s*([A-Za-z_$][\w$]*)\s*\}/g,(p,f)=>s.get(f)??(o.has(f)?`\${${o.get(f)}}`:p)):u.text;a.push(JSON.stringify(d))}else u.kind==="i"&&e[c-1]?.text!=="."?a.push(o.get(u.text)??(s.has(u.text)?JSON.stringify(s.get(u.text)):u.text)):a.push(u.text)}return{key:a.filter(u=>u!==";").join(" ").replace(/ , (?=[)\]}])/g," "),size:a.length}}function oMe(e,t){let r=0,n=0;for(let s=t;s<e.length;s++){let i=e[s].text;if(i==="<")r++;else if(i===">"&&e[s-1]?.text!=="=")r=Math.max(0,r-1);else if(i==="(")n++;else if(i===")")n--;else{if(i==="{"&&r===0&&n===0)return s;if(i===";"||i==="="&&e[s+1]?.text!==">")return-1}}return-1}function kNt(e,t){return e.kind==="p"&&!")]}".includes(e.text)||t.kind==="p"&&".?:&|+-*/<>=".includes(t.text)}function BNt(e,t){let r=0;for(let n=t;n<e.length;n++){let s=e[n];if(s.kind==="p"&&"([{".includes(s.text))r++;else if(s.kind==="p"&&")]}".includes(s.text)){if(r===0)return n;r--}else if(r===0&&(s.text===";"||s.text===","||n>t&&s.line>e[n-1].line&&!kNt(e[n-1],s)))return n}return e.length}function aMe(e){let t=new Set,r=n=>{let s=Ad(e,n);for(let i=n+1;i>0&&i<s;i++){let o=e[i];o.kind!=="i"||e[i-1]?.text==="as"||e[i-1]?.text===":"||[",","}",":","as"].includes(e[i+1]?.text)&&t.add(o.text)}};for(let n=0;n<e.length;n++){let s=e[n].text;s==="export"&&e[n+1]?.text==="{"&&r(n+1),s==="exports"&&e[n+1]?.text==="="&&e[n+2]?.text==="{"&&r(n+2),s==="exports"&&e[n+1]?.text==="."&&e[n+2]?.kind==="i"&&t.add(e[n+2].text)}return t}function TNt(e,t){let r=[],n=aMe(e),s=o=>{for(let a=o-1;a>=Math.max(0,o-4);a--){if(e[a].text==="export")return!0;if(!["default","async","function","*","const","let","var"].includes(e[a].text))return!1}return!1},i=(o,a,c,l,u)=>{let d=e[o].text,{key:p,size:f}=m6(e,l,u,h6(e,a,c),t,"js");r.push({name:d,line:e[o].line,exported:s(o)||n.has(d),key:p,size:f})};for(let o=0;o<e.length;o++){let a=e[o];if(a.kind==="i"){if(a.text==="function"){let c=o+1;if(e[c]?.text==="*"&&c++,e[c]?.kind!=="i")continue;let l=c++;if(e[c]?.text==="<")for(;c<e.length&&e[c].text!=="(";)c++;if(e[c]?.text!=="(")continue;let u=Ad(e,c),d=u<0?-1:oMe(e,u+1),p=d<0?-1:Ad(e,d);p>0&&i(l,c,u,d+1,p);continue}if((a.text==="const"||a.text==="let"||a.text==="var")&&e[o+1]?.kind==="i"){let c=o+1,l=o+2;if(e[l]?.text===":")for(;l<e.length&&e[l].text!=="="&&e[l].line===e[c].line;)l++;if(e[l]?.text!=="=")continue;l++,e[l]?.text==="async"&&l++;let u,d;if(e[l]?.text==="("){if(u=l,d=Ad(e,l),d<0)continue}else if(e[l]?.kind==="i"&&e[l+1]?.text==="="&&e[l+2]?.text===">")u=l-1,d=l+1;else continue;let p=d+1;if(e[p]?.text===":")for(;p<e.length&&!(e[p].text==="="&&e[p+1]?.text===">")&&e[p].text!==";";)p++;if(e[p]?.text!=="="||e[p+1]?.text!==">")continue;if(p+=2,e[p]?.text==="{"){let f=Ad(e,p);f>0&&i(c,u,d,p+1,f)}else i(c,u,d,p,BNt(e,p))}}}return r}function NNt(e,t){let r=[];for(let n=0;n<e.length;n++){if(e[n].text!=="def"||e[n+1]?.kind!=="i"||e[n+2]?.text!=="(")continue;let s=e[n-1]?.text==="async"&&yd(e,n-1);if(!s&&!yd(e,n))continue;let i=e[s?n-1:n].col,o=Ad(e,n+2);if(o<0)continue;let a=o+1;for(;a<e.length&&e[a].text!==":";)a++;let c=a+1;for(;c<e.length&&!(yd(e,c)&&e[c].line>e[a].line&&e[c].col<=i);)c++;let l=h6(e,n+2,o).filter(f=>f!=="self"&&f!=="cls"),{key:u,size:d}=m6(e,a+1,c,l,t,"py"),p=e[n+1].text;r.push({name:p,line:e[n+1].line,exported:i===0&&!p.startsWith("_"),key:u,size:d})}return r}function _Nt(e,t){let r=[];for(let n=0;n<e.length;n++){if(e[n].text!=="func"||!yd(e,n))continue;let s=n+1;if(e[s]?.text==="("&&(s=Ad(e,s)+1),s<=0||e[s]?.kind!=="i"||e[s+1]?.text!=="(")continue;let i=Ad(e,s+1),o=i<0?-1:oMe(e,i+1),a=o<0?-1:Ad(e,o);if(a<0)continue;let{key:c,size:l}=m6(e,o+1,a,h6(e,s+1,i),t,"go");r.push({name:e[s].text,line:e[s].line,exported:/^[A-Z]/.test(e[s].text),key:c,size:l})}return r}function PNt(e,t){let r=[],n=[];if(t==="js"){for(let s=0;s<e.length;s++){if(e[s].text!=="import"||!yd(e,s)||e[s+1]?.text==="(")continue;let i=s+1;for(;i<e.length&&e[i].kind!=="s"&&e[i].text!==";";)i++;if(e[i]?.kind==="s"&&(n.push([s,i]),e[s+1]?.text!=="type"))for(let o=s+1;o<i;o++){let a=e[o];a.kind!=="i"||["from","as","type"].includes(a.text)||e[o-1]?.text==="type"||e[o+1]?.text!=="as"&&r.push({local:a.text,from:e[i].text,line:a.line})}}for(let s=0;s<e.length;s++){if(e[s].text!=="require"||e[s+1]?.text!=="("||e[s+2]?.kind!=="s"||e[s+3]?.text!==")"||e[s-1]?.text!=="=")continue;let i=e[s+2].text,o=s-2;if(e[o]?.kind==="i"&&["const","let","var"].includes(e[o-1]?.text)){n.push([o-1,s+3]),r.push({local:e[o].text,from:i,line:e[o].line});continue}if(e[o]?.text!=="}")continue;let a=o;for(let c=0;a>=0;a--)if(e[a].text==="}")c++;else if(e[a].text==="{"&&--c===0)break;if(!(a<1||!["const","let","var"].includes(e[a-1].text))){n.push([a-1,s+3]);for(let c=a+1;c<o;c++)e[c].kind==="i"&&e[c+1]?.text!==":"&&r.push({local:e[c].text,from:i,line:e[c].line})}}}else if(t==="py"){for(let s=0;s<e.length;s++){if(e[s].text!=="from"||!yd(e,s))continue;let i=s+1,o="";for(;i<e.length&&e[i].text!=="import"&&e[i].line===e[s].line;)o+=e[i++].text;if(e[i]?.text!=="import")continue;let a=e[i+1]?.text==="(",c=i+1;for(;c<e.length&&!(a?e[c].text===")":e[c].line>e[i].line&&e[c-1].text!=="\\");)c++;n.push([s,a?c:c-1]);for(let l=i+1;l<c;l++){let u=e[l];u.kind!=="i"||u.text==="as"||e[l+1]?.text==="as"||r.push({local:u.text,from:o,line:u.line})}}for(let s=0;s<e.length;s++){if(e[s].text!=="import"||!yd(e,s))continue;let i=s+1;for(;i<e.length&&e[i].line===e[s].line;){let o="",a=e[i];for(;i<e.length&&e[i].line===e[s].line&&e[i].text!==","&&e[i].text!=="as";)o+=e[i++].text;let c=a?.kind==="i"?a.text:"";e[i]?.text==="as"&&e[i+1]?.kind==="i"&&(c=e[i+1].text,i+=2),c&&o&&r.push({local:c,from:o,line:a.line}),e[i]?.text===","&&i++}n.push([s,i-1])}}return{imports:r,spans:n}}function QNt(e,t,r){let n=new Set(r.map(s=>s.from));if(t==="js")for(let s=0;s<e.length;s++){let i=e[s];if(i.kind!=="s")continue;let o=e[s-1]?.text;(o==="from"||o==="import"&&e[s-1]?.kind==="i"||o==="("&&["require","import"].includes(e[s-2]?.text??"")&&e[s+1]?.text===")")&&n.add(i.text)}return[...n]}function DNt(e,t){let r=0;for(let n=0;n<e.length;n++){if(e[n].kind!=="i"||e[n].text!=="class")continue;let s=e[n+1];(t==="py"?yd(e,n)&&s?.kind==="i":s&&(s.kind==="i"||s.text==="{"))&&r++}return r}function vE(e,t){let r=bd(t);if(!r)return;let n=xNt(e,r),s=RNt(n,r),i=r==="js"?TNt(n,s):r==="py"?NNt(n,s):_Nt(n,s),{imports:o,spans:a}=PNt(n,r),c=new Map,l=d=>c.set(d,(c.get(d)??0)+1),u=0;for(let d=0;d<n.length;d++){for(;u<a.length&&d>a[u][1];)u++;if(u<a.length&&d>=a[u][0])continue;let p=n[d];if(p.kind==="i")l(p.text);else if(p.kind==="s"&&(p.template||r==="py"&&p.text.includes("{")))for(let f of p.text.matchAll(/\{[^{}]*\}/g))for(let h of f[0].matchAll(/[A-Za-z_$][\w$]*/g))l(h[0])}return{lang:r,functions:i,imports:o,uses:c,listedExports:r==="js"?aMe(n):new Set,deps:QNt(n,r,o),classes:r==="go"?0:DNt(n,r)}}var MNt=15,FNt=6,cg=e=>Vs.test(e),LNt=/utils?|skyramp/i,UNt=/utils?/i,RE=e=>gt.posix.basename(e).replace(/\.[^.]+$/,""),$Nt=/^(conftest\.py|__init__\.py|[^/]*\.config\.[cm]?[jt]s|[^/]+\.(setup|teardown)\.[cm]?[jt]sx?|setupTests\.[cm]?[jt]sx?)$/i,qNt=/^([\w.-]+\.config\.([cm]?[jt]s|json)|package\.json|pytest\.ini|pyproject\.toml|setup\.cfg|tox\.ini)$/i,cMe=e=>e.replace(/\.([cm]?[jt]sx?|py)$/,"");function GNt(e,t){let r=cMe(t),n=gt.posix.dirname(e.rel);return(e.text.match(/[\w@$.\-/]+/g)??[]).some(i=>{let o=i.replace(/^<rootDir>\//,"").replace(/[.,]+$/,"");if(!o)return!1;let a=cMe(gt.posix.normalize(gt.posix.join(o.startsWith("/")?".":n,o.replace(/^\//,"")))),c=/^[A-Za-z_][\w.]*$/.test(o)&&o.includes(".")?o.replace(/\./g,"/"):void 0;return a===r||c!==void 0&&(c===r||gt.posix.join(n,c)===r)})}function lMe(e,t){return $Nt.test(gt.posix.basename(e))?!0:t.some(r=>GNt(r,e))}var g6=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"];function kE(e,t,r,n){let s=gt.posix.dirname(e),i=o=>o.map(a=>gt.posix.normalize(a)).find(a=>!a.startsWith("..")&&n(a));if(r==="js"){if(!t.startsWith("."))return;let o=gt.posix.join(s,t),a=o.replace(/\.[cm]?js$/,"");return i([o,...g6.map(c=>o+c),...g6.map(c=>a+c),...g6.map(c=>`${o}/index${c}`)])}if(r==="py"){let o=t.match(/^\.*/)[0].length,a=t.slice(o).replace(/\./g,"/"),c=[];if(o){let l=s;for(let u=1;u<o;u++)l=gt.posix.dirname(l);c.push(l)}else for(let l=s;c.push(l),!(l==="."||l==="/"||l==="");l=gt.posix.dirname(l));return i(c.flatMap(l=>a?[`${l}/${a}.py`,`${l}/${a}/__init__.py`]:[`${l}/__init__.py`]))}}var uMe=e=>`${e.rel}:${e.fn.line}`;function HNt(e,t){return[...new Set(e.code.imports.map(r=>kE(e.rel,r.from,e.code.lang,t)).filter(r=>!!r&&!cg(r)))]}function jNt(e){let t=v=>{let F=vE(v.text,v.rel);return F?{rel:v.rel,code:F,test:cg(v.rel)}:void 0},r=e.written.flatMap(v=>{let F=t(v),U=v.before===void 0?void 0:vE(v.before,v.rel);return F?[{...F,before:U,isNew:v.before===void 0,definesHelpers:F.code.functions.length>0||F.code.classes>0}]:[]}),n=e.existing.flatMap(v=>t(v)??[]),s=new Map([...n,...r].map(v=>[v.rel,v])),i=v=>s.has(v),o=[],a=new Map,c=v=>a.set(v.fn.key,[...a.get(v.fn.key)??[],v]);for(let v of n)for(let F of v.code.functions)c({rel:v.rel,fn:F,lang:v.code.lang,test:v.test});for(let v of r){let F=new Set(v.code.functions.map(U=>U.name));for(let U of v.before?.functions??[])F.has(U.name)&&c({rel:v.rel,fn:U,lang:v.code.lang,test:v.test})}let l=(v,F)=>v.key===F.key&&(v.size>=MNt||v.name===F.name&&v.size>=FNt),u=(v,F)=>new Set((a.get(v.key)??[]).filter(U=>U.lang===F&&l(v,U.fn)).map(U=>U.rel)).size>=2,d=r.flatMap(v=>{let F=new Set((v.before?.functions??[]).map(U=>U.name));return v.code.functions.filter(U=>!F.has(U.name)).map(U=>({w:v,fn:U}))}),p=v=>{let F=v.flatMap(U=>HNt(U,i)).find(U=>!r.some(X=>X.rel===U&&X.isNew));return F?`the repo's ${F}, or a new module beside it if it no longer fits them, named for what it holds`:"the module where the repo keeps shared helpers for these tests (where there is none yet, a new one beside them, named for what it holds)"},f=new Set;for(let{w:v,fn:F}of d){if(u(F,v.code.lang))continue;let U=(a.get(F.key)??[]).find(W=>W.lang===v.code.lang&&!(W.rel===v.rel&&W.fn.name===F.name)&&l(F,W.fn));if(!U)continue;f.add(F);let X=s.get(U.rel);U.fn.exported||!U.test?o.push(`${v.rel}:${F.line} ${F.name} copies ${U.fn.name} (${uMe(U)}) \u2014 import ${U.fn.name} from there instead of defining it again`):o.push(`${v.rel}:${F.line} ${F.name} copies ${U.fn.name}, local to ${uMe(U)} \u2014 move ${U.fn.name} into ${p([v,...X?[X]:[]])} and import it in both files; no second copy`)}let h=r.filter(v=>v.isNew&&!v.test),A=new Map;for(let{w:v,fn:F}of d){if(!v.test||f.has(F))continue;let U=h.find(V=>V.code.lang===v.code.lang&&V.code.functions.some(N=>l(F,N))),X=U?.code.functions.find(V=>l(F,V));if(!U||!X)continue;f.add(F);let W=`${v.rel}:${F.line} ${F.name} copies ${X.name} (${U.rel}:${X.line}) \u2014 import ${X.name} from there instead of defining it again`,J=A.get(U.rel)??{tests:new Set,sent:[]};J.tests.add(v.rel),J.sent.push(W),A.set(U.rel,J),o.push(W)}let C=[],w=v=>mv(v).dir;for(let v of d){if(!v.w.test||f.has(v.fn)||u(v.fn,v.w.code.lang))continue;let F=C.find(U=>U[0].w.code.lang===v.w.code.lang&&w(U[0].w.rel)===w(v.w.rel)&&l(U[0].fn,v.fn));F?F.push(v):C.push([v])}for(let v of C){let F=[...new Map(v.map(U=>[U.w.rel,U.w])).values()];F.length<2||o.push(`${v[0].fn.name} is defined in ${F.length} test files (${F.map(U=>U.rel).join(", ")}) \u2014 define it once, in ${p(F)}, and import it from each`)}for(let v of r){let F=new Set((v.before?.imports??[]).map(U=>`${U.local}\0${U.from}`));for(let U of v.code.imports){if(F.has(`${U.local}\0${U.from}`)||(v.code.uses.get(U.local)??0)>0)continue;(U.from.startsWith(".")||kE(v.rel,U.from,v.code.lang,i)!==void 0)&&o.push(`${v.rel}:${U.line} imports ${U.local} from ${U.from} and never uses it \u2014 use it, or drop the import`)}}let b=new Map([...(e.otherTests??[]).flatMap(v=>t(v)??[]).map(v=>[v.rel,v]),...s]),I=v=>[...b.values()].filter(F=>F.rel!==v&&F.code.deps.some(U=>kE(F.rel,U,F.code.lang,i)===v)),x=n.filter(v=>!v.test&&(v.code.functions.length>0||v.code.classes>0)&&!lMe(v.rel,e.configs??[])).map(v=>({rel:v.rel,users:I(v.rel).filter(F=>F.test&&!r.some(U=>U.rel===F.rel)).length})).filter(v=>v.users>0),B=x.filter(v=>v.users===1),k=v=>B.some(F=>gt.posix.dirname(F.rel)===gt.posix.dirname(v))||x.length>0&&B.length*2>=x.length,R=new Set;for(let v of r){if(!v.isNew||v.test||!v.definesHelpers||lMe(v.rel,e.configs??[])||k(v.rel))continue;let F=I(v.rel);if(F.some(J=>!J.test))continue;let U=A.get(v.rel),X=new Set([...F.map(J=>J.rel),...U?.tests??[]]);if(X.size!==1)continue;R.add(v.rel);let W=[...X][0];if(U)for(let J of U.sent)o.splice(o.indexOf(J),1);o.push(`${v.rel} is imported only by ${W}${U?", which also copies its helpers":""} \u2014 move its contents into ${W} and delete ${v.rel}; keep it only if a second test file uses it`)}for(let v of r){if(!v.isNew||v.test||R.has(v.rel))continue;let F=new Map;for(let U of v.code.functions){if(!U.exported||(v.code.uses.get(U.name)??0)-1-(v.code.listedExports.has(U.name)?1:0)>0)continue;let W=[...s.values()].filter(J=>J.test&&J.rel!==v.rel&&(J.code.uses.get(U.name)??0)>0&&J.code.imports.some(V=>kE(J.rel,V.from,J.code.lang,i)===v.rel));W.length===1&&F.set(W[0].rel,[...F.get(W[0].rel)??[],U.name])}for(let[U,X]of F)o.push(`${v.rel}: ${X.join(", ")} ${X.length>1?"are":"is"} used only by ${U} \u2014 a helper only one test file uses stays in that file`)}let L=n.some(v=>!v.test&&UNt.test(RE(v.rel)));for(let v of r){if(!v.isNew||v.test||!v.code.functions.length)continue;let F=RE(v.rel);(/skyramp/i.test(F)||!L&&LNt.test(F))&&o.push(`${v.rel}: name the module for what it holds (e.g. orders, session, pages) \u2014 not "utils" or "Skyramp"`)}return o}var fO=new Set(["node_modules",".git","dist","build","coverage","test-results","playwright-report","__pycache__",".venv","venv","vendor",".next","target"]),dMe=new RegExp(`(^|/)(${[...fO].map(e=>e.replace(/\./g,"\\.")).join("|")})/`),mMe=/^(tests?|e2e|e2e-tests|__tests__|specs?|playwright|cypress|integration|testing)$/i,zNt=/test|spec|helper|support|fixture|page/i,pMe=3e3,VNt=256*1024,WNt=4e3;function ag(e){try{let t=hO.statSync(e);return t.isFile()&&t.size<=VNt?hO.readFileSync(e,"utf-8"):void 0}catch{return}}function JNt(e,t){try{return(0,hMe.execFileSync)("git",[...Ss,"show",`HEAD:${t}`],{cwd:e,env:Je(),encoding:"utf-8",maxBuffer:16*1024*1024,stdio:["ignore","pipe","ignore"]})}catch{return}}function mv(e){let t=gt.posix.dirname(e).split("/").filter(n=>n&&n!=="."),r=t.findIndex(n=>mMe.test(n));return r>=0?{dir:t.slice(0,r+1).join("/"),deep:!0}:{dir:t.join("/"),deep:!1}}function A6(e,t){let r=[];for(let u of nf(e)){if(!bd(u.path)||dMe.test(u.path)||u.code.includes("D")||t?.has(gt.resolve(e,u.path)))continue;let d=ag(gt.join(e,u.path));if(d===void 0)continue;let p=u.code==="??"||u.code[0]==="A";r.push({rel:u.path,text:d,before:p?void 0:JNt(e,u.path)??void 0})}let n=new Set(r.map(u=>u.rel)),s=[],i=new Set;for(let{dir:u,deep:d}of new Map(r.map(p=>[JSON.stringify(mv(p.rel)),mv(p.rel)])).values())Ku(gt.join(e,u),p=>{let f=gt.relative(e,p).split(gt.sep).join("/");if(i.has(f)||n.has(f)||!bd(f)||!d&&!cg(f)&&!zNt.test(gt.posix.basename(f)))return;i.add(f);let h=ag(p);if(h!==void 0&&s.push({rel:f,text:h}),s.length>=pMe)return!1},{skip:fO,maxDepth:d?8:0});let o=u=>ag(gt.join(e,u))!==void 0;for(let u of r){let d=vE(u.text,u.rel);if(d)for(let p of d.imports){if(s.length>=pMe)break;let f=kE(u.rel,p.from,d.lang,o);if(!f||i.has(f)||n.has(f)||dMe.test(f))continue;i.add(f);let h=ag(gt.join(e,f));h!==void 0&&s.push({rel:f,text:h})}}let a=r.filter(u=>u.before===void 0&&!cg(u.rel)),c=[],l=[];if(a.length){let u=a.map(f=>RE(f.rel)),d=[...new Set(a.flatMap(f=>/^(index|__init__)$/.test(RE(f.rel))?[RE(f.rel),gt.posix.basename(gt.posix.dirname(f.rel))]:[RE(f.rel)]))],p=0;Ku(e,(f,h)=>{let A=h.split(gt.sep).join("/"),C=qNt.test(gt.posix.basename(A)),w=!C&&cg(A)&&bd(A)!==void 0&&!i.has(A)&&!n.has(A);if(!C&&!w)return;if(w&&++p>WNt)return!1;let b=ag(f);b!==void 0&&(C?u:d).some(I=>b.includes(I))&&(C?l:c).push({rel:A,text:b})},{skip:fO,maxDepth:10})}return{written:r,existing:s,otherTests:c,configs:l}}var y6="write-reuse",YNt=/\bcopies\b| is defined in \d+ test files | is imported only by /;function fMe(e){return YNt.test(e)}var gMe={name:y6,verify(e){let t=e.prepared?.secretGateBaseline,r=[];for(let i of je(e.inputs)){let o=i.path===e.inputs.repositoryPath?"":Xe(e.inputs,i.slug);r.push(...jNt(A6(i.path,t)).map(a=>o+a))}let n=r.filter(i=>!fMe(i));n.length&&console.log(`[${this.name}] noted, not sent back: ${n.join("; ")}`);let s=r.filter(fMe);return s.length?{...ce(this.name,s),repairable:!0}:{name:this.name,passed:!0}}},KNt=10,XNt=/test|spec|helper|support|fixture/i,ZNt=e=>e.split("/").some(t=>mMe.test(t)||XNt.test(t)),e_t=10,t_t=4e3;function r_t(e,t){let r=t==="js"?/^export\s+(?:default\s+)?(?:async\s+)?(?:function\*?|class|const|let)\s+([A-Za-z_$][\w$]*)/gm:/^(?:async\s+)?(?:def|class)\s+([A-Za-z]\w*)/gm,n=[...e.matchAll(r)].map(i=>i[1]),s=t==="js"?[...vE(e,"x.ts")?.listedExports??[]]:[];return[...new Set([...n,...s])]}function AMe(e){let t=new Set,r=[];Ku(e,(o,a)=>{let c=a.split(gt.sep).join("/"),l=bd(c);l!=="js"&&l!=="py"||(t.add(c),cg(c)&&r.length<t_t&&r.push(c))},{skip:fO,maxDepth:10});let n=o=>t.has(o),s=new Map;for(let o of r){let a=ag(gt.join(e,o)),c=a===void 0?void 0:vE(a,o);if(!c)continue;let l=new Set(c.imports.map(u=>kE(o,u.from,c.lang,n)).filter(u=>!!u&&!cg(u)));for(let u of l)s.set(u,(s.get(u)??0)+1)}for(let o of t){if(gt.posix.basename(o)!=="conftest.py")continue;let a=gt.posix.dirname(o),c=r.filter(l=>l.endsWith(".py")&&(a==="."||l.startsWith(`${a}/`))).length;c&&s.set(o,Math.max(s.get(o)??0,c))}let i=o=>gt.posix.basename(o)==="conftest.py";return[...s].filter(([o,a])=>a>=2&&(ZNt(o)||i(o))).sort((o,a)=>a[1]-o[1]||o[0].localeCompare(a[0])).slice(0,KNt).map(([o,a])=>{let c=ag(gt.join(e,o))??"";return{rel:o,importers:a,names:r_t(c,bd(o)).slice(0,e_t)}})}function yMe(e){return e.length?["The repo's shared test helpers, by how many of its test files use them:",...e.map(({label:t,module:r})=>` - ${t}${r.rel} (${r.importers} test files)${r.names.length?`: ${r.names.join(", ")}`:""}`)]:[]}var EMe=z(require("path"));var n_t=10,s_t=3,i_t=5,o_t=/\.(?:locator|getBy[A-Z]\w*|get_by_\w+)\(/g,a_t=/^\s*(?:export\s+(?:default\s+)?)?class\s+\w+/m,c_t=/@testing-library\/|from ["']enzyme["']/,mO=e=>(e.match(o_t)??[]).length,l_t=/@playwright\/test|from\s+['"]playwright|\bpage\.(?:goto|locator|getBy\w+)\s*\(|\bcy\.(?:visit|get)\s*\(|webdriver|selenium|newSkyrampPlaywrightPage/i,bMe=(e,t)=>wMe(e,t)&&l_t.test(t);function u_t(e,t){if(t===void 0)return mO(e);let r=new Map;for(let s of t.split(`
|
|
587
587
|
`))r.set(s,(r.get(s)??0)+1);let n=0;for(let s of e.split(`
|
|
588
588
|
`)){let i=r.get(s)??0;i>0?r.set(s,i-1):n+=mO(s)}return n}var d_t=e=>e[Math.max(0,Math.ceil(.9*e.length)-1)],b6=e=>Vs.test(e),wMe=(e,t)=>{let r=bd(e);return(r==="js"||r==="py")&&!c_t.test(t)};function p_t(e){let t=new Map;for(let r of e){let n=EMe.posix.dirname(r).split("/"),s=n.findIndex(o=>/^pages?$/i.test(o)),i=s>=0?n.slice(0,s+1).join("/"):n.join("/");t.set(i,(t.get(i)??0)+(s>=0?1e3:1))}return[...t].sort((r,n)=>n[1]-r[1]||r[0].localeCompare(n[0]))[0][0]}function f_t(e){let t=[],r=new Map;for(let n of e.written){if(!b6(n.rel)||!bMe(n.rel,n.text))continue;let s=mv(n.rel).dir;r.set(s,[...r.get(s)??[],n])}for(let[n,s]of r){let i=e.written.filter(d=>d.before!==void 0).map(d=>({rel:d.rel,text:d.before})),o=[...e.existing,...i].filter(d=>n===""||d.rel.startsWith(`${n}/`)),a=o.filter(d=>!b6(d.rel)&&wMe(d.rel,d.text)&&a_t.test(d.text)&&mO(d.text)>0).map(d=>d.rel);if(a.length<s_t)continue;let c=o.filter(d=>b6(d.rel)&&bMe(d.rel,d.text)).map(d=>mO(d.text)).sort((d,p)=>d-p);if(c.length<i_t)continue;let l=d_t(c),u=p_t(a);for(let d of s){let p=u_t(d.text,d.before);p>=n_t&&p>l&&t.push(`${d.rel} locates ${p} elements inline, where nine in ten of the repo's specs locate ${l} or fewer and reach their pages through the page objects in ${u} \u2014 locate them in the page's page object there (a new one for a page that has none) and use it from the spec`)}}return t}var E6="write-page-objects",CMe={name:E6,verify(e){let t=e.prepared?.secretGateBaseline,r=[];for(let n of je(e.inputs)){let s=n.path===e.inputs.repositoryPath?"":Xe(e.inputs,n.slug);r.push(...f_t(A6(n.path,t)).map(i=>s+i))}return r.length?{...ce(this.name,r),repairable:!0}:{name:this.name,passed:!0}}};var SMe=z(require("fs")),cc=z(require("path"));var w6="write-no-app",h_t="needs the running app (a browser journey), and this run brings no app up: Validation Triage decided targeted_unit";function BE(e){if(!Si(e))return{behaviors:[],defects:[],journeys:[],browserJourneys:[],maintenance:[]};let t=ee(e,"triage.json"),r=new Map((ee(e,"analyze.json")?.behaviors??[]).map(i=>[i.id,i])),n=new Set(Zx(e));return{behaviors:(t?.plan??[]).filter(i=>i.mechanism==="new_unit"&&n.delete(i.behaviorId)).map(i=>{let o=r.get(i.behaviorId);return{id:i.behaviorId,statement:o?.statement??i.behaviorId,covers:i.covers??"",where:`${Xe(e.inputs,o?.repository)}${o?.evidence??""}`}}),defects:df(e),journeys:Ol(e),browserJourneys:ef(ee(e,"plan.json")?.journeys).filter(i=>i.kind!=="in-process"),maintenance:Ht(e)?.maintenance??[]}}function C6(e){return e.behaviors.length+e.defects.length+e.journeys.length+e.maintenance.length>0}function IMe(e,t){let r=new Set([...e.notWritten.map(s=>s.case.trim()),...e.tests.flatMap(s=>s.covers)]),n=t.filter(s=>!r.has(s.id)).map(s=>({case:s.id,reason:h_t}));return n.length?{...e,notWritten:[...e.notWritten,...n]}:e}function S6(e){return je(e.inputs).filter(t=>t.writable).flatMap(t=>{let r=Yp(e.inputs,t.slug,"unit");return r?[{root:cc.resolve(t.path),slug:t.slug,dir:r}]:[]})}function m_t(e,t){let r=[],{work:n}=t,s=new Set(e.tests.flatMap(c=>c.covers)),i=new Set(e.notWritten.map(c=>c.case.trim())),o=c=>s.has(c)||i.has(c);for(let c of n.behaviors)!o(c.id)&&!t.couldBreak.has(c.id)&&r.push(`behavior "${c.id}" was planned a new in-process test and no test covers it \u2014 give it one, or say in notWritten why no in-process test can check it`);for(let c of n.defects)o(c.id)||r.push(`defect "${c.id}" has no test and is not in notWritten \u2014 give it a test that reaches it and expects the correct behaviour, or say in notWritten why no in-process test can`);for(let c of n.journeys)o(c.id)||r.push(`journey "${c.id}" has no test and is not in notWritten \u2014 walk it in one in-process test, or say in notWritten what it needs that is missing`);let a=c=>{let l=Xm(c).file,u=d=>d===l||d.endsWith(`/${l}`)||l.endsWith(`/${d}`);return e.tests.some(d=>u(d.file))||[...i].some(d=>d===c||u(Xm(d).file))};for(let c of n.maintenance)a(c.test)||r.push(`existing test ${c.test} (the plan says ${c.action}) is neither in tests nor in notWritten \u2014 run or maintain it in-process and list it, or put it under notWritten with what it needs that this run does not have`);for(let c of e.tests){if(c.change!=="added")continue;let l=t.read(c.file);if(!l)continue;for(let f of hD(l.body))r.push(`${c.file} uses ${f} \u2014 every test runs in one process: no network, no running app; mock outbound calls with the repo's own tools inside the test`);let u=t.placedDir?.(l.root),d=cc.dirname(l.rel).split(cc.sep).join("/");u&&u!=="."&&d!==u&&!d.startsWith(`${u}/`)&&r.push(`${c.file} is not in ${u}, where the Target puts unit tests for this repository`);let p=Pl(l.root,l.rel);p&&Ql(p)&&!eE(p,l.rel)&&r.push(`${c.file} is not named the way ${p} collects tests \u2014 name it the way its runner collects tests, as the repo's own tests are`)}return r}function g_t(e,t){let r=t.replace(/^\.\//,""),n=r.split("/")[0],s=[{root:e[0],rel:r},...e.slice(1).filter(i=>cc.basename(i)===n).map(i=>({root:i,rel:r.slice(n.length+1)}))];for(let i of s){let o=cc.resolve(i.root,i.rel);if(o.startsWith(i.root+cc.sep))try{return{body:SMe.readFileSync(o,"utf-8"),root:i.root,rel:i.rel}}catch{continue}}}function xMe(e){return{name:w6,verify(t,r){if(!Si(t))return{name:this.name,passed:!0};let n=e(t,r);if(!n)return{name:this.name,passed:!0};let s=ee(t,"plan.json"),i=[t.inputs.repositoryPath,...(t.inputs.relatedRepos??[]).map(a=>a.path)].map(a=>cc.resolve(a)),o=m_t(n,{work:BE(t),couldBreak:s?new Set(Ox(s).keys()):new Set,read:a=>g_t(i,a),placedDir:a=>S6(t).find(c=>c.root===a)?.dir});return o.length?{name:this.name,passed:!1,details:o.join("; "),repairable:!0}:{name:this.name,passed:!0}}}}var gO=z(require("fs"));function vMe(e,t){return{name:e,verify(r,n){let s=Af(r.inputs.requirementItems);if(s.length===0)return{name:this.name,passed:!0};let i=[];for(let o of new Set(t(r,n))){let a;try{let l=m8(r,o);if(gO.statSync(l).size>eO)continue;a=gO.readFileSync(l,"utf-8")}catch{continue}let c=ZDe(a,s);c.length&&i.push(`${o} copies the words of ${c.join(" and ")} in a comment, test title or test name`)}return i.length?{name:this.name,passed:!1,repairable:!0,details:`${i.join("; ")}. Tests are public to the repository's readers: name an item only by its key and criterion number (e.g. "PAY-184 AC2", "Confluence page 3021 AC1") and keep its words out of comments, titles and test names. When you rename a test, run it again under its new name.`}:{name:this.name,passed:!0}}}}var I6="write.json",x6=["adapt.json","generate.json","generate-ui.json","finalize.json",gd],kMe="write-no-secret-leak",BMe="write-checkout-intact",TMe="write-dependencies",yO=e=>Vr.join(e.outputsDir,"write-scratch"),cn=e=>Vr.join(yO(e),I6);function NMe(e){if(Si(e))return Ol(e);let t=ee(e,"plan.json")?.journeys;if(!Array.isArray(t)||!t.length)return[];let r=new Set((Ht(e)?.generate??[]).map(n=>n.id));return t.filter(n=>n&&typeof n.id=="string"&&Array.isArray(n.steps)&&r.has(n.id))}function A_t(e,t={}){if(!e.length)return[];let r=t.noApp?["Each is one in-process test of the whole flow: it drives the UI the way the repo's in-process tests do, checks after","each step what the user then sees, and asserts every part of the outcome at the end. Mark each step so a failure","names it (a labelled assertion, or the runner's own step or subtest), and let a failed check go on to the next step","where the test still allows it.","A journey no in-process test can walk here goes under notWritten, with what it needs that is missing: it is","reported as not covered, never left out."]:["Each is one test of the whole flow, of its kind. A browser journey runs against the real app: it opens the entry route","and does every step through the UI in order (no URL jump to a later step, no stub of the app's own network). An","in-process journey drives the UI the way the repo's in-process tests do. Either checks after each step what the user then sees, and","asserts every part of the outcome at the end, after a reload where it must persist. Where a step lands on another page (a","redirect after a save, a detail or confirmation page), check on that page what it shows of what the user entered or saved","(the values, totals and counts), not only its address. Mark each step so a failure names it (in Playwright, test.step),","and let a failed check go on to the next step where the page still allows it, so one defect does not hide the rest.","A journey whose test cannot run here (a browser, package or service it needs cannot be set up) goes under notWritten,","with what is missing: it is reported as not covered, never left out."];return["User journeys:",...e.map(n=>[` - ${n.id} ${n.name} \u2192 ${n.testFile}`,` entry: ${n.entry}`,` steps: ${Qb(n)}`,...n.finishes?.trim()?[` finishes: ${n.finishes.trim()}`]:[],` outcome: ${n.outcome}`].join(`
|
|
589
589
|
`)),...r,'List each under "journeys" in your result (its file and test title, and where it broke when it did) and put its id in',`that file's "covers".`,""]}function AO(e){return Si(e)?!1:(Ht(e)?.generate??[]).some(t=>t.type==="ui")}function y_t(e){let t=oE(e);if(t){for(let n of[...x6,go])Co.rmSync(Vr.join(e.outputsDir,n),{force:!0});return{ok:!1,reasons:[t]}}let r=Ht(e);return r?r.generate.length===0&&r.maintenance.length===0&&!C6(BE(e))?{ok:!1,reasons:["the plan has no test cases and no maintenance"]}:{ok:!0,reasons:[]}:{ok:!1,reasons:["no test plan (recommend.json) to write tests from"]}}function b_t(e){let t=g8(e),r=zD(e);for(let c of[...x6,"write.json",tE,go])Co.rmSync(Vr.join(e.outputsDir,c),{force:!0});let n=AO(e),s=(Ht(e)?.generate??[]).some(c=>c.type!=="ui")||C6(BE(e)),{packages:i,notes:o}=$Qe(e,{ui:n,backend:s});_Me(e,i);let a=[...o,...ng(e,"backend",[],{declaredOnly:!0,packages:i}),...n?ng(e,"ui",[],{declaredOnly:!0,packages:i}):[]];return{checkpoint:Vr.join(yO(e),I6),secretGateBaseline:t,checkoutHeads:r,provisionNotes:a,sharedHelpers:E_t(e),testPackages:i,dependencyBaseline:g8(e)}}function _Me(e,t){let r=Vr.join(e.outputsDir,go);t.length===0?Co.rmSync(r,{force:!0}):Co.writeFileSync(r,JSON.stringify({schemaVersion:1,packages:[...t]},null,2)+`
|
|
590
590
|
`)}function E_t(e){try{return yMe(je(e.inputs).flatMap(t=>{let r=t.path===e.inputs.repositoryPath?"":Xe(e.inputs,t.slug);return AMe(t.path).map(n=>({label:r,module:n}))}))}catch{return[]}}function w_t(e){let t=so(e.inputs)?["It is a shared environment this policy protects: write and run no test that changes state there (a create, edit or delete, a form that submits, a setup that seeds); list any such test in notWritten instead."]:[];if(e.inputs.appRunning){let o=hQ(ee(e,`${Ws}.json`));return[e.inputs.appRunning.trim(),...t,...o?[o]:[]]}let r=ee(e,"deploy.json"),n=bo(e.inputs.repositoryPath),s=n.setupScript?`start it with ${Vr.relative(e.inputs.repositoryPath,n.setupScript)} and check it answers`:"start it the way the repo documents";if(E8(r)){let o=Object.entries(r.baseUrls??{}).map(([c,l])=>`${c} ${l}`).join(", "),a=r.health?.url??r.health?.command;return[`The app is running${o?`: ${o}`:""}.${a?` Health check: ${a}`:""}`,`If it stops answering, ${s}.`]}return[`The app may not be running.${r?.bringupError?.output?` Planning could not start it: ${r.bringupError.output.slice(0,300)}`:""} Check, and if it isn't up, ${s}; leave it running.`,"If you can't get it running, still write the tests and record them as not run (exit null)."]}function C_t(e){let t=S6(e);return["No app is running, and none is started for this run: Validation Triage decided the change is proven in-process","(targeted_unit). Every test runs in one process, the way the repo's own in-process tests run: no network or running","app, so nothing that calls a live service, the Skyramp client and its runtime mocks included. Mock outbound calls","(HTTP, queues, other services) inside the test with the repo's own fixtures and mocking tools. Run the tests the way","the repo's CI runs them (its runner, config and environment), selected as step 4 says. Each new test file is named the way its runner","collects tests, as the repo's own tests are. Maintain every stale existing test that can run in-process. An existing","test that needs the running app goes under notWritten, by its path, with what it needs that this run does not have:","it is reported as not covered.",...t.length?["The Target puts new unit tests in these directories, over the repo's own layout: put each new test under its repository's directory, not beside the existing tests:",...t.map(r=>` - ${Xe(e.inputs,r.slug)}${r.dir}/`)]:[]]}function S_t(e){return[...e.behaviors.length?['Behaviors that need a new in-process test (give each id in "covers"):',...e.behaviors.map(t=>` - ${t.id}: ${t.statement}
|
|
591
591
|
missing evidence to obtain: ${t.covers||"(unstated)"}
|
|
592
592
|
where the change is: ${t.where}`),"Every behavior above gets an in-process test, except that a test of what the change could break stays only if it","fails on the change (step 1).",""]:[],...e.defects.length?["For each defect suspected above, write a test that reaches it and expects the correct behaviour, so it fails on this","change and passes once the defect is fixed, and give its id in covers; a defect no in-process test can reach goes","under notWritten, with why.",""]:[],...e.browserJourneys.length?["These user journeys need a browser and the running app, which this run does not have: no in-process test can walk","them, so each goes under notWritten by its id, with what it needs that is missing:",...e.browserJourneys.map(t=>` - ${t.id} ${t.name}`),""]:[]]}function I_t(e,t=[]){let r="";try{let n=pa(e,t),s=[...new Set(n.flatMap(i=>i.secretEnv))].filter(i=>t.includes(i));r=bQe(dd(n),s).trim()}catch{return[]}return r?["Some variables the repo's CI sets would clash with your own model access, so their values are in your shell",`renamed, under a TESTBOT_CI_ prefix. Run a test that needs CI's values with them mapped back: \`${r} <test command>\`.`]:[]}function x_t(e){let t=e.prepared,r=e.inputs.repositoryPath,n=gr(e),s=n?.repository.currentBranch??"HEAD",i=n?.repository.baseBranch??e.inputs.baseBranch??"origin/main",o=Ht(e),a=ee(e,"analyze.json"),c=new Map((a?.behaviors??[]).map(B=>[B.id,B.statement])),l=(a?.findings??[]).filter(B=>B.status!=="refuted"),u=ee(e,"plan.json"),d=new Map((u?.cases??[]).map(B=>[B.id,B.steps])),p=Cs(e.inputs.requirementItems),f=new Map((u?.requirements??[]).flatMap(B=>B.reference&&B.criterion?[[B.id,` (${Wa(B.reference,B.criterion,p)})`]]:[])),A=AO(e)&&Yu(e),C=Si(e),w=BE(e),b=NMe(e),I=new Set(b.map(B=>B.id)),x=o.generate.filter(B=>!I.has(B.id)).map(B=>{let k=[B.from_behavior&&`${B.from_behavior}: ${c.get(B.from_behavior)??""}`.trim(),B.from_finding&&`defect ${B.from_finding}`].filter(Boolean).join("; ");return[` - ${B.id} [${B.type}] ${B.target}${k?` \u2014 ${k}`:""}`,` do: ${d.get(B.id)??B.rationale}`,` expect: ${B.expected_observable}`].join(`
|
|
593
|
-
`)});return["Write functional tests for this PR and run them. The plan below came from reading the PR; turn it into tests in the","repo, run them, and tell me what they show about the change.","",`The repo is at ${r}, checked out on branch \`${s}\`. You can see the change with \`git diff ${i}...HEAD\`.`,...u6(e),...oa(e.inputs),"",...LOe(e.inputs),...$Oe(e.inputs),...a?.requirements?.length?["Requirements:",...a.requirements.map(B=>` - ${B.id}${f.get(B.id)??""}: ${B.statement}`),""]:[],...l.length?["Defects suspected while reading the change:",...l.map(B=>` - ${B.id} (${B.severity}) ${B.file}${B.line?`:${B.line}`:""} \u2014 ${B.claim}`),""]:[],"Test plan. Each case's expected outcome is the one the plan sets, not whatever the app does:",...x.length?x:[" (no new cases)"],...o.maintenance.length?["","Existing tests to maintain:",...o.maintenance.map(B=>` - ${B.action.toUpperCase()} ${B.test} \u2014 ${B.evidence}`)]:[],"",...C?S_t(w):[],...A_t(b,{noApp:C}),...C?C_t(e):w_t(e),...A?["For the ui cases you have the Skyramp browser tools (mcp__skyramp__browser_*): look at the real page before you pick locators."]:[],...t.provisionNotes.length?[`Setup notes: ${t.provisionNotes.join("; ")}`]:[],...t.testPackages?.length?["",...w_e(t.testPackages,{skyrampVersion:Yu(e)&&!C?Wb(e.inputs.skyrampMcp):void 0,nodeTests:(C||o.generate.some(B=>B.type!=="ui"))&&x5(r)})]:[],...t.sharedHelpers?.length?["",...t.sharedHelpers]:[],...I_t(r,e.providedEnvKeys??[]),"","1. Write each test the way the repo already tests that code (the same kind of test, framework, directories, naming,",...C?[" helpers and fixtures), unless that kind cannot check its case in one process; then use the in-process kind that can,"," and where none can, list the case under notWritten with what it needs."]:[" helpers and fixtures), unless that kind of test cannot check its case; then use the kind that can."]," Reuse the repo's helpers, page objects and fixtures: never copy a helper the repo already has \u2014 import it, and if it"," is local to another test file, move it into the repo's shared support module and import it in both. A helper only"," one test file uses stays in that file; a helper two or more of your test files use is defined once, in the repo's"," shared support location (else beside the tests that use it, the way the repo lays out its tests), in a module named for what it holds \u2014 not",` "utils" or "Skyramp". Use every name you import. Where the repo's browser tests reach its pages through page objects,`," so do yours: locate a page's elements in its page object, the way its existing members locate theirs, and add a page"," object, where the repo keeps them, for a page that has none. Find an element by its role and name, label or test id;"," when a locator matches more than one element, narrow it to the one you mean (inside its row, dialog or region, or by"," its text) rather than taking .first(), .last() or .nth(). Pick by position only where the order is what the test checks.",...C?[" Write in-process tests the way the repo's own unit and in-process tests are written. The repo's existing tests"]:[" Don't add unit tests (a function or module called directly, its collaborators mocked). The repo's existing tests"]," are for maintenance only: update the ones the change makes wrong \u2014 the maintenance list is where to start, step 4"," finds the rest \u2014 above all any that assert as correct what the plan says is a defect, rather than writing a new"," one beside it."," Keep each requirement's check on its own, so one failure can't hide another: give it its own test or assertion,"," and stub or seed any data its setup needs that a different defect could break (a list the page loads, a shared"," helper that rejects the response before your assertion reads it). A test that shows a defect asserts only the"," outcome its case expects \u2014 one defect per test \u2014 so it passes once that defect is fixed."," For each element or field the change adds, assert that it is there (shown, or present in the response); clicking"," or filling it is not an assertion. For each it removes or renames, assert that it is gone: not shown, a count of 0,"," the field missing, a 404, the old option no longer offered."," Where a case's steps give the exact requests, send them as they are rather than working them out again, and keep"," those tests together in one file."," The plan is where to start, not the limit: if you notice something else the change should do, or could break,"," while you write and run these, test that too, filed under the plan requirement it guards. A test of what it could"," break that passes stays only when it is the one test of its requirement; remove one that another of your tests",' already covers, and list its case under notWritten with a reason that starts "Passing:" and says what it checked \u2014'," never a journey's test, which stays whether it"," passes or fails. Where nothing says what should happen, only decide it for what"," the change does; how older code treats odd input is not this PR's to test. One case for each kind of input is"," enough: add another only where it could fail while the first passes.","2. Run the tests you wrote together, once, in the foreground, with a short per-test timeout so a hung test fails",` fast; wait for the run to finish (one Bash call may run up to ${PD} minutes), and don't end the session with a test`," run still going: the session is non-interactive and ends when you stop, so nothing would report its result.","3. For each failure, work out whose fault it is, and settle it outside the test before you call it a defect. The"," outcome the test expects must be one the PR, spec or code requires, not one you chose: an exact status where only a"," refusal is required, a message or format nothing states, a value read from a column picked by position. Where only"," part of it is required, assert only that part. A failure before the step that checks the case (sign-in, setup,"," seeding, a helper, an element not found, a timeout) is the test's until you have seen the app do it wrong: look at"," the page or send the request yourself, and find the line of application code that does it."," If the test checks what its case requires and the app does something else, that's a defect in the change: keep the"," test as written, mark the case and its file as a defect, and report the bug with that line. Never change an expected"," outcome to match what the app does. If the test itself is wrong (selector, setup, data, import, timing, an outcome"," nothing requires), fix it and re-run only the tests that failed (e.g. pytest --lf, playwright test --last-failed, or"," by name); a failing case you could not fix is marked defect: false, never a defect. Give each failing case the",` runner's failure as it printed it ("failure"), and each case you keep as a defect its "cause", the application line.`," Don't re-run the whole set at"," the end: the results you already have stand.","4. Then run the repo's existing tests that reach the code the change touches, the way its CI runs them (its command"," and environment), selected as narrowly as still covers that code: the whole suite only when it runs in a few"," minutes. For each one that fails, find out whether this change made it fail; when you can't tell, run it on the"," base branch in a scratch copy outside the"," checkout (e.g. git worktree add under /tmp). One that asserts behaviour the change deliberately replaced is stale:"," update it, or delete it where the behaviour is gone, and re-run it; give staleBecause for it \u2014 the requirement the"," change deliberately alters and the changed line of application code (path:line) that alters it. One that catches"," something the change breaks is a defect: leave it failing and report it. Leave alone failures the change did not cause.","5. If the repo has a linter or formatter for test code, run it on your files. The application's manifests and"," lockfiles are its owner's: a test in the repo's own framework uses only what the repo already declares, and you"," never add, upgrade or remove a package in the application's own manifests or lockfiles for Testbot's tests.",C?" For the app's code, reach it the way the repo's in-process tests do (its test client, fixtures and helpers).":" For calls to the app, use the client and helpers the repo's existing tests use for that service."," Tooling the repo doesn't declare (Playwright where it has none) goes in the Testbot test package"," above, never in the application's manifests; with no such package, write the test with what the repo has."," The one exception is a test that must run inside the application's existing test environment and cannot"," without a package it lacks: add it to the manifest of the checkout the test is in, keep the manifest's"," constraints, upgrade nothing else, update that manifest's lockfile with its own package manager (the updated lockfile"," must name the added package), run the existing tests of that environment, and list it in dependenciesAdded"," with the reason; for another checkout of the change, name that checkout as the entry's repository.","",'In your result, give each file you added or updated its "functions": each test function in it as the runner names',"it, with the plan case ids it checks, so that every case it covers is checked by a function you name. Give each","issue its plan finding id and the requirement or clause ids it violates. Name each test for what it checks: no plan","id in a test's name or title, except a label the description or spec itself gives the requirement (AC-3).","","Apart from that scratch copy, stay inside the checkout and leave it on the commit it is on,","with the change's files in place: run or read the base in the scratch copy (or with git show <commit>:<file>), never","by checking the checkout out, resetting or stashing it. Don't commit or push, and leave the tests in the working tree.",`Once you've run the tests the first time, write your result as JSON (below) to ${t.checkpoint}, and keep it current`,"as you go: that file is what's","read. End with a one-line final message \u2014 don't repeat the JSON in it. The report is read by the PR author: describe","their code, not this process.","",or(Wn)].join(`
|
|
593
|
+
`)});return["Write functional tests for this PR and run them. The plan below came from reading the PR; turn it into tests in the","repo, run them, and tell me what they show about the change.","",`The repo is at ${r}, checked out on branch \`${s}\`. You can see the change with \`git diff ${i}...HEAD\`.`,...u6(e),...oa(e.inputs),"",...LOe(e.inputs),...$Oe(e.inputs),...a?.requirements?.length?["Requirements:",...a.requirements.map(B=>` - ${B.id}${f.get(B.id)??""}: ${B.statement}`),""]:[],...l.length?["Defects suspected while reading the change:",...l.map(B=>` - ${B.id} (${B.severity}) ${B.file}${B.line?`:${B.line}`:""} \u2014 ${B.claim}`),""]:[],"Test plan. Each case's expected outcome is the one the plan sets, not whatever the app does:",...x.length?x:[" (no new cases)"],...o.maintenance.length?["","Existing tests to maintain:",...o.maintenance.map(B=>` - ${B.action.toUpperCase()} ${B.test} \u2014 ${B.evidence}`)]:[],"",...C?S_t(w):[],...A_t(b,{noApp:C}),...C?C_t(e):w_t(e),...A?["For the ui cases you have the Skyramp browser tools (mcp__skyramp__browser_*): look at the real page before you pick locators."]:[],...t.provisionNotes.length?[`Setup notes: ${t.provisionNotes.join("; ")}`]:[],...t.testPackages?.length?["",...w_e(t.testPackages,{skyrampVersion:Yu(e)&&!C?Wb(e.inputs.skyrampMcp):void 0,nodeTests:(C||o.generate.some(B=>B.type!=="ui"))&&x5(r)})]:[],...t.sharedHelpers?.length?["",...t.sharedHelpers]:[],...I_t(r,e.providedEnvKeys??[]),"","1. Write each test the way the repo already tests that code (the same kind of test, framework, directories, naming,",...C?[" helpers and fixtures), unless that kind cannot check its case in one process; then use the in-process kind that can,"," and where none can, list the case under notWritten with what it needs."]:[" helpers and fixtures), unless that kind of test cannot check its case; then use the kind that can."]," Reuse the repo's helpers, page objects and fixtures, and put yours where someone who knows this repo would look for"," them: never copy a helper the repo already has \u2014 import it. A helper only one test file uses stays in that file,"," unless the repo keeps that kind in its own module (a page object per page, say). A helper two or more test files use"," \u2014 yours, or one you take from another test file \u2014 is defined once, where the repo keeps shared helpers for those"," tests: usually the support module they already import, or a new module beside it when that one no longer fits (say"," the repo splits its helpers by area, or the module has grown large); where there is none yet, beside the tests that",` use it. Name a new module for what it holds, not "utils" or "Skyramp". Change the repo's own helpers only as far as`," that needs. Use every name you import."," Where the repo's browser tests reach its pages through page objects,"," so do yours: locate a page's elements in its page object, the way its existing members locate theirs, and add a page"," object, where the repo keeps them, for a page that has none. Find an element by its role and name, label or test id;"," when a locator matches more than one element, narrow it to the one you mean (inside its row, dialog or region, or by"," its text) rather than taking .first(), .last() or .nth(). Pick by position only where the order is what the test checks.",...C?[" Write in-process tests the way the repo's own unit and in-process tests are written. The repo's existing tests"]:[" Don't add unit tests (a function or module called directly, its collaborators mocked). The repo's existing tests"]," are for maintenance only: update the ones the change makes wrong \u2014 the maintenance list is where to start, step 4"," finds the rest \u2014 above all any that assert as correct what the plan says is a defect, rather than writing a new"," one beside it."," Keep each requirement's check on its own, so one failure can't hide another: give it its own test or assertion,"," and stub or seed any data its setup needs that a different defect could break (a list the page loads, a shared"," helper that rejects the response before your assertion reads it). A test that shows a defect asserts only the"," outcome its case expects \u2014 one defect per test \u2014 so it passes once that defect is fixed."," For each element or field the change adds, assert that it is there (shown, or present in the response); clicking"," or filling it is not an assertion. For each it removes or renames, assert that it is gone: not shown, a count of 0,"," the field missing, a 404, the old option no longer offered."," Where a case's steps give the exact requests, send them as they are rather than working them out again, and keep"," those tests together in one file."," The plan is where to start, not the limit: if you notice something else the change should do, or could break,"," while you write and run these, test that too, filed under the plan requirement it guards. A test of what it could"," break that passes stays only when it is the one test of its requirement; remove one that another of your tests",' already covers, and list its case under notWritten with a reason that starts "Passing:" and says what it checked \u2014'," never a journey's test, which stays whether it"," passes or fails. Where nothing says what should happen, only decide it for what"," the change does; how older code treats odd input is not this PR's to test. One case for each kind of input is"," enough: add another only where it could fail while the first passes.","2. Run the tests you wrote together, once, in the foreground, with a short per-test timeout so a hung test fails",` fast; wait for the run to finish (one Bash call may run up to ${PD} minutes), and don't end the session with a test`," run still going: the session is non-interactive and ends when you stop, so nothing would report its result.","3. For each failure, work out whose fault it is, and settle it outside the test before you call it a defect. The"," outcome the test expects must be one the PR, spec or code requires, not one you chose: an exact status where only a"," refusal is required, a message or format nothing states, a value read from a column picked by position. Where only"," part of it is required, assert only that part. A failure before the step that checks the case (sign-in, setup,"," seeding, a helper, an element not found, a timeout) is the test's until you have seen the app do it wrong: look at"," the page or send the request yourself, and find the line of application code that does it."," If the test checks what its case requires and the app does something else, that's a defect in the change: keep the"," test as written, mark the case and its file as a defect, and report the bug with that line. Never change an expected"," outcome to match what the app does. If the test itself is wrong (selector, setup, data, import, timing, an outcome"," nothing requires), fix it and re-run only the tests that failed (e.g. pytest --lf, playwright test --last-failed, or"," by name); a failing case you could not fix is marked defect: false, never a defect. Give each failing case the",` runner's failure as it printed it ("failure"), and each case you keep as a defect its "cause", the application line.`," Don't re-run the whole set at"," the end: the results you already have stand.","4. Then run the repo's existing tests that reach the code the change touches, the way its CI runs them (its command"," and environment), selected as narrowly as still covers that code: the whole suite only when it runs in a few"," minutes. For each one that fails, find out whether this change made it fail; when you can't tell, run it on the"," base branch in a scratch copy outside the"," checkout (e.g. git worktree add under /tmp). One that asserts behaviour the change deliberately replaced is stale:"," update it, or delete it where the behaviour is gone, and re-run it; give staleBecause for it \u2014 the requirement the"," change deliberately alters and the changed line of application code (path:line) that alters it. One that catches"," something the change breaks is a defect: leave it failing and report it. Leave alone failures the change did not cause.","5. If the repo has a linter or formatter for test code, run it on your files. The application's manifests and"," lockfiles are its owner's: a test in the repo's own framework uses only what the repo already declares, and you"," never add, upgrade or remove a package in the application's own manifests or lockfiles for Testbot's tests.",C?" For the app's code, reach it the way the repo's in-process tests do (its test client, fixtures and helpers).":" For calls to the app, use the client and helpers the repo's existing tests use for that service."," Tooling the repo doesn't declare (Playwright where it has none) goes in the Testbot test package"," above, never in the application's manifests; with no such package, write the test with what the repo has."," The one exception is a test that must run inside the application's existing test environment and cannot"," without a package it lacks: add it to the manifest of the checkout the test is in, keep the manifest's"," constraints, upgrade nothing else, update that manifest's lockfile with its own package manager (the updated lockfile"," must name the added package), run the existing tests of that environment, and list it in dependenciesAdded"," with the reason; for another checkout of the change, name that checkout as the entry's repository.","",'In your result, give each file you added or updated its "functions": each test function in it as the runner names',"it, with the plan case ids it checks, so that every case it covers is checked by a function you name. Give each","issue its plan finding id and the requirement or clause ids it violates. Name each test for what it checks: no plan","id in a test's name or title, except a label the description or spec itself gives the requirement (AC-3).","","Apart from that scratch copy, stay inside the checkout and leave it on the commit it is on,","with the change's files in place: run or read the base in the scratch copy (or with git show <commit>:<file>), never","by checking the checkout out, resetting or stashing it. Don't commit or push, and leave the tests in the working tree.",`Once you've run the tests the first time, write your result as JSON (below) to ${t.checkpoint}, and keep it current`,"as you go: that file is what's","read. End with a one-line final message \u2014 don't repeat the JSON in it. The report is read by the PR author: describe","their code, not this process.","",or(Wn)].join(`
|
|
594
594
|
`)}function gv(e,t,r){let n=Vr.join(e.outputsDir,t);return Co.writeFileSync(n,JSON.stringify(mr(r,e.secretValues??[]),null,2)+`
|
|
595
595
|
`),Vr.relative(e.runDir,n)}function PMe(e,t){let r=t.dependenciesAdded??[],n=e.prepared?.dependencyBaseline??new Set;return[...JD(e,r,n),...IDe(e)]}var v_t={name:TMe,verify(e,t){let{value:r}=vn(Wn,t.stdout,cn(e),e.secretValues);if(!r)return{name:this.name,passed:!0};let n=PMe(e,r);return n.length?{...ce(this.name,n),repairable:!0}:{name:this.name,passed:!0}}};function R_t(e,t){let r=ee(e,go);if(!r)return[];let n=t.tests.map(i=>i.file),s=r.packages.filter(i=>{try{let o=E_e(e.inputs.repositoryPath,i,n);return o&&wo(e).info(`[write] no test went in the new test package ${i.dir}: removed it`),!o}catch{return!0}});return _Me(e,s),s}function k_t(e,t){let{write:r,settled:n}=tMe(t);n.length&&wo(e).warn(`[write] failed before any check, with no application line \u2014 not a defect: ${n.join(", ")}`);let s=Si(e)?IMe(r,BE(e).browserJourneys):r;R_t(e,s);let i=JNe(s,e.inputs.repositoryPath,e.inputs.relatedRepos??[]),o=PMe(e,s);return o.length&&(i.finalize.ready=!1,i.finalize.blockers=[...i.finalize.blockers,...o.slice(0,4)]),i.dropped.length&&wo(e).warn(`[write] not on disk, left out of adapt.json: ${i.dropped.join(", ")}`),i.ambiguous.length&&wo(e).warn(`[write] in both the repo under test and a related checkout, kept the repo under test's: ${i.ambiguous.join(", ")}`),{artifacts:{write:gv(e,"write.json",s),adapt:gv(e,"adapt.json",i.adapt),generate:gv(e,"generate.json",i.generate),"generate-ui":gv(e,"generate-ui.json",i.generateUi),finalize:gv(e,"finalize.json",i.finalize)},placed:i.placed}}async function QMe(e,t){let{artifacts:r,placed:n}=k_t(e,t);if(Si(e))return r;let s=new Map(n.map(o=>[o.written,o])),i=await gOe({write:t,outputsDir:e.outputsDir,resolve:o=>{let a=s.get(o),c=a&&Vr.resolve(a.root,a.file);return a&&c&&Co.existsSync(c)&&Co.statSync(c).isFile()?{abs:c,root:Vr.resolve(a.root),file:a.file,...a.repository?{repository:a.repository}:{}}:void 0},env:{...DMe(e),...e.sutAuthEnv??{}},...e.deadlineMs!==void 0?{deadlineMs:e.deadlineMs}:{},...e.signal?{signal:e.signal}:{}}).catch(o=>{wo(e).warn(`[write] recording the browser tests' videos failed: ${o instanceof Error?o.message:String(o)}`)});return i?.skipped.length&&wo(e).info(`[write] no video for ${i.skipped.map(o=>`${o.fileName} (${o.reason})`).join(", ")}`),{...r,...i?{"ui-videos":Vr.relative(e.runDir,Vr.join(e.outputsDir,gd))}:{}}}function DMe(e){try{return{...OD(dd(pa(e.inputs.repositoryPath))),...ud}}catch{return{...ud}}}var OMe="write-stale-updates",B_t={name:OMe,verify(e,t){let{value:r}=vn(Wn,t.stdout,cn(e),e.secretValues);if(!r)return{name:this.name,passed:!0};let n=[{path:e.inputs.repositoryPath,prefix:""},...(e.inputs.relatedRepos??[]).map(h=>({path:h.path,prefix:`${Vr.basename(Vr.resolve(h.path))}/`}))].flatMap(({path:h,prefix:A})=>{try{return(0,RMe.execFileSync)("git",["-C",h,"diff","--name-only","--diff-filter=d","HEAD"],{encoding:"utf-8"}).split(`
|
|
596
596
|
`).filter(C=>C&&Zb(C)&&!C.startsWith(".skyramp/")).map(C=>A+C)}catch{return[]}}),s=r.tests.filter(h=>h.change!=="added"&&h.change!=="deleted").map(h=>({file:h.file,changed:h.change!=="unchanged",ran:h.result.exit!==null})),i=V_e(n,s),o=r.tests.filter(h=>h.change==="updated");if(!o.length)return Co.writeFileSync(Vr.join(e.outputsDir,tE),`[]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyramp/testbot-core",
|
|
3
|
-
"version": "0.13.0-v3.
|
|
3
|
+
"version": "0.13.0-v3.137",
|
|
4
4
|
"description": "Skyramp Testbot engine: AI-powered deterministic test generation, execution and maintenance",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"//files": "An explicit allowlist, never a glob. `dist/` is gitignored, so without this key npm's .gitignore fallback would publish a package with no engine in it; with a glob it would publish the sourcemaps, whose sourcesContent embeds every src/*.ts verbatim. eval-entry.js is a development entry and must not ship. dist/VERSION.json exists only in a release-engine.yml build. assets/gen-reference/ is the staged codegen reference corpus, which generate.ts finds at ../assets from dist/.",
|