@skyramp/testbot-core 0.12.0-v3.31 → 0.12.0-v3.32
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/main.js +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -411,7 +411,7 @@ ${i.map((a,c)=>{let l=s[a],u=l.isOptional()?" (optional)":"",d=l.description?`
|
|
|
411
411
|
`)}
|
|
412
412
|
${Y9e(e)}}`}case"ZodArray":{let s=r.element;return`[ ${CB(s,e)}, \u2026 ]`}case"ZodEnum":return r.options.map(s=>JSON.stringify(s)).join(" | ");case"ZodNativeEnum":return Object.values(r.enum).map(s=>JSON.stringify(s)).join(" | ");case"ZodLiteral":return JSON.stringify(r.value);case"ZodString":return'"\u2026"';case"ZodNumber":return"<number>";case"ZodBoolean":return"true | false";case"ZodNull":return"null";case"ZodUnion":return r.options.map(s=>CB(s,e)).join(" | ");case"ZodRecord":return`{ "<key>": ${CB(r.valueSchema,e)} }`;default:return"<value>"}}function U9t(t){let e=t;for(;;){let r=e._def;if(r.typeName==="ZodOptional"||r.typeName==="ZodNullable"||r.typeName==="ZodDefault"){if(r.typeName==="ZodNullable")return S.union([r.innerType,S.null()]);e=r.innerType}else if(r.typeName==="ZodEffects")e=r.schema;else return e}}function $9t(t){return t.issues.map(e=>{let r=e.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),n=r||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(e.message))return`${n} ${e.message}`;switch(e.code){case"invalid_type":return r?e.expected==="object"?`${n} must be an object`:e.received==="undefined"?`${n} is required`:`${n} must be ${e.expected}, got ${e.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(e.received),i=e.options.find(a=>typeof a=="string"&&typeof e.received=="string"&&e.received.startsWith(a)),o=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${n} must be one of: ${e.options.join(", ")}${o}`}case"invalid_literal":return`${n} must be ${JSON.stringify(e.expected)}`;case"too_small":return e.type==="string"?`${n} must be a non-empty string`:`${n} must have at least ${e.minimum} item(s)`;case"unrecognized_keys":return`${n} has unknown key(s): ${e.keys.join(", ")}`;default:return`${n}: ${e.message}`}})}function Io(t,e){let r=t.safeParse(e);return r.success?{value:r.data,errors:[]}:{errors:$9t(r.error)}}function lS(t,e,r){let n=Io(t,r),s=r&&typeof r=="object"&&!Array.isArray(r)?r:void 0,i=[...n.errors,...s?e(s):[]];return i.length?{errors:i}:{value:n.value,errors:[]}}var J9e=z(require("path"));var qce="outputs/preflight.json",_E="pr-diff.txt";function Kh(t,e){return[...t.changedFiles.map(r=>({repository:e,path:r.path})),...(t.relatedChanges??[]).flatMap(r=>r.changedFiles.map(n=>({repository:r.repository,path:n.path})))]}function uS(t,e,r){return t.some(n=>n.path===r&&n.repository.toLowerCase()===e.toLowerCase())}function Fa(t){if(t.outputsDir)return zd(J9e.join(t.outputsDir,"preflight.json"))}var zq=z(require("path"));var X9e=require("child_process"),$q=z(require("fs")),dS=z(require("path"));var SB=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r))(SB||{}),IB=(d=>(d.RelatedChangeConflict="related_change_conflict",d.ReferenceOutsideTarget="reference_outside_target",d.SourceAccessLost="source_access_lost",d.ConfigurationIncomplete="configuration_incomplete",d.CredentialUnavailable="credential_unavailable",d.WorkflowBindingUnverified="workflow_binding_unverified",d.WorkflowRefUnprotected="workflow_ref_unprotected",d.DeploymentReview="deployment_review",d.SutRevisionMismatch="sut_revision_mismatch",d.IsolationUnavailable="isolation_unavailable",d.EvidenceInsufficient="evidence_insufficient",d))(IB||{}),Xh=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(Xh||{}),Mq=(n=>(n.Application="application",n.Environment="environment",n.TestDefect="test_defect",n))(Mq||{}),Oq=(a=>(a.AuthToken="auth_token",a.Secret="secret",a.DataConnection="data_connection",a.AppNotStarted="app_not_started",a.Login="login",a.ExternalDependency="external_dependency",a.RecordingReplay="recording_replay",a))(Oq||{});var Lq=(n=>(n.Seed="seed",n.RuntimeMock="runtime_mock",n.EnvOverride="env_override",n))(Lq||{}),Fq=(n=>(n.TestCode="test_code",n.SkyrampMocker="skyramp_mocker",n.RecipeOverride="recipe_override",n))(Fq||{});Nc();var qq="ci-evidence.json",Uq=(t,e)=>(0,X9e.execFileSync)("git",e,{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim(),q9t=/^Merge ([0-9a-f]{40}) into [0-9a-f]{40}$/;function H9t(t){try{let e=Uq(t,["rev-parse","HEAD"]);if(Uq(t,["rev-list","--parents","-n","1","HEAD"]).split(/\s+/).slice(1).length===2){let n=q9t.exec(Uq(t,["log","-1","--format=%s","HEAD"]));if(n)return n[1]}return e}catch{return}}function Hq(t){let e="";try{e=Uq(t,["remote","get-url","origin"])}catch{}let r=/[:/]([A-Za-z0-9._-]+)\/([A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(e);return r&&!e.startsWith("/")&&!e.startsWith(".")?`${r[1]}/${r[2]}`:`local/${dS.basename(dS.resolve(t)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}var z9t=new Set(Object.values(Xh));function G9t(t){let e=[];for(let r of t??[]){let n=r.trim();if(!n)continue;let s=n.lastIndexOf("="),i=s>0?n.slice(s+1).trim():"",o=z9t.has(i),c=(o?n.slice(0,s).trim():n).split("*").map(l=>l.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*");e.push({pattern:new RegExp(`^${c}$`,"i"),kind:o?i:"ci_check"})}return e}var j9t=new Set(["failure","timed_out","action_required","error","startup_failure"]);function K9e(t,e){let r=new Map(e.revisions.map(s=>[s.repository.toLowerCase(),s])),n=[];for(let s of t){if(s.name.startsWith(Bs))continue;let i=r.get((s.repository??e.primary).toLowerCase());if(!i)continue;let o=e.trusted.find(l=>l.pattern.test(s.name)),a=s.conclusion??s.status,c=o?s.headSha.toLowerCase()!==i.revision.toLowerCase()?"stale":s.status!=="completed"?"pending":s.conclusion==="success"?"accepted":j9t.has(s.conclusion??"")?"failing":"inconclusive":"untrusted";n.push({id:`ci-${n.length+1}`,repository:i.repository,revision:i.revision,checkSha:s.headSha,name:s.name,kind:o?.kind??"ci_check",status:c,conclusion:a,reference:s.url||`${i.repository}@${s.headSha.slice(0,12)} ${s.name}`,summary:(s.summary||`${s.name}: ${a}`).slice(0,300)})}return n}var V9t=S.object({checks:S.array(S.object({repository:S.string().optional(),name:S.string().min(1),headSha:S.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:S.string().default("completed"),conclusion:S.string().nullable().optional(),url:S.string().optional(),summary:S.string().optional()}))});function W9t(t){let e=V9t.safeParse(JSON.parse($q.readFileSync(t,"utf-8")));if(!e.success)throw new Error(`${t} is not a CI evidence file: ${e.error.issues[0]?.message??"invalid"}`);return e.data.checks}function Y9t(t){let e=[{path:t.inputs.repositoryPath,slug:t.inputs.repositorySlug},...(t.inputs.relatedRepos??[]).map(n=>({path:n.path,slug:n.slug}))],r=[];for(let n of e){let s=H9t(n.path);s&&r.push({repository:n.slug??Hq(n.path),revision:s})}return r}async function Z9e(t){let e=Y9t(t),r=e[0]?.repository??Hq(t.inputs.repositoryPath),n=G9t(t.inputs.trustedChecks),s;try{if(t.inputs.ciEvidenceFile){let i=W9t(t.inputs.ciEvidenceFile);s={source:"file",revisions:e,items:K9e(i,{revisions:e,primary:r,trusted:n})}}else if(t.platform?.listCommitChecks){let i=[];for(let o of e)i.push(...await t.platform.listCommitChecks(o)??[]);s={source:"platform",revisions:e,items:K9e(i,{revisions:e,primary:r,trusted:n})}}else s={source:"none",revisions:e,items:[],note:"this platform keeps no CI results"}}catch(i){s={source:"none",revisions:e,items:[],note:`CI results could not be read: ${i instanceof Error?i.message:String(i)}`}}return s.items.length>0&&n.length===0&&(s.note="no trustedChecks were configured, so no CI result counts as evidence"),$q.writeFileSync(dS.join(t.outputsDir,qq),JSON.stringify(s,null,2)+`
|
|
413
413
|
`),s}var J9t=8e3,Hce=new Map;function K9t(t){return t.repositorySlug?t.repositorySlug:(Hce.has(t.repositoryPath)||Hce.set(t.repositoryPath,Hq(t.repositoryPath)),Hce.get(t.repositoryPath))}function hr(t){return[{slug:K9t(t),path:t.repositoryPath,writable:!0,working:!0},...(t.relatedRepos??[]).map(e=>({slug:e.slug,path:e.path,writable:e.writable===!0,working:!1}))]}function os(t){return hr(t)[0]}function Gq(t,e){return[...hr(t)].sort((r,n)=>n.path.length-r.path.length).find(r=>{let n=zq.relative(r.path,e);return!n.startsWith("..")&&!zq.isAbsolute(n)})}var jq=(t,e)=>t.toLowerCase()===e.toLowerCase();function DE(t,e){return e?.trim()?t.find(r=>jq(r.slug,e.trim())):t[0]}function as(t,e){return DE(hr(t),e)}var eXe=(t,e)=>`${e} is not a repository of this run (${hr(t).map(r=>r.slug).join(", ")})`;function bs(t,e){let r=as(t,e);if(!r)throw new Error(eXe(t,e));return r.path}function Gd(t,e){let r=as(t,e);return r?r.writable?{source:r}:{error:`${r.slug} is read-only in this run: tests are written only to ${hr(t).filter(n=>n.writable).map(n=>n.slug).join(", ")}`}:{error:eXe(t,e)}}function Pr(t,e){return zce(hr(t),e)}function zce(t,e){return t.length<2?"":`${DE(t,e)?.slug??e}: `}function pS(t,e,r){let n=t.testPlacements?.find(s=>s.testType===r&&jq(s.repository,e));return n&&(n.directory.trim().replace(/\/+$/,"")||".")}function jd(t){return(t.relatedRepos??[]).map(e=>e.path)}function Vd(t){let e=hr(t);if(e.length<2)return[];let r=n=>n.working?"your working directory; writable":n.writable?"writable":"read-only: read it, never write a test there";return["",`This run has ${e.length} checkouts, and none is primary. Every test, maintained test and result lives in exactly one of`,'them: name it by "repository" (owner/repo), with its path relative to that checkout. Place a test in the',"checkout whose test tree it belongs to, which need not be the checkout the change is in.",...e.map(n=>` - ${n.slug}: ${n.path} (${r(n)})`)]}function mS(t){let e=t.pullRequests??[];return e.length===0?[...t.prTitle||t.prDescription?[""]:[],...t.prTitle?[`PR title: ${t.prTitle}`]:[],...t.prDescription?[`PR description: ${t.prDescription}`]:[]]:["",`This change is ${e.length>1?`${e.length} pull requests`:"1 pull request"}. Read every description: each states part of what the change must do.`,...e.flatMap(n=>[`--- ${[`${n.repository}#${n.number}`,n.title].filter(Boolean).join(": ")} ---`,n.note?`(${n.note})`:n.body?.slice(0,J9t)||"(no description)"])]}var Vq=z(require("fs")),tXe=z(require("path"));function X9t(t){let e=new Map,r,n;for(let s of t.split(`
|
|
414
|
-
`)){let i=/^diff --git a\/.+ b\/(.+)$/.exec(s);if(i){r=i[1],n=void 0,e.has(r)||e.set(r,[]);continue}let o=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(s);if(o){n=Number(o[1]);continue}!r||n===void 0||(s.startsWith("+")?e.get(r).push([n,n++]):s.startsWith("-")?e.get(r).push([n,n]):s.startsWith(" ")&&n++)}return e}function rXe(t){let e=tXe.join(t.runDir,_E);if(Vq.existsSync(e))return X9t(Vq.readFileSync(e,"utf-8"))}function Z9t(t){let e=/([\w./@+-]+\.[\w]+)(?::(\d+)(?:-(\d+))?)?/.exec(t);if(!e)return{};let r=e[1].replace(/^\.\//,"");if(!e[2])return{file:r};let n=Number(e[2]);return{file:r,lines:[n,e[3]?Number(e[3]):n]}}function nXe(t,e){if(!e)return!0;let{file:r,lines:n}=Z9t(t);if(!r)return!0;let s=e.get(r)??[...e].find(([i])=>i.endsWith(`/${r}`)||r.endsWith(`/${i}`))?.[1];return s?n?s.some(([i,o])=>n[0]<=o&&n[1]>=i):!0:!1}var ea=["-c","core.fsmonitor=false"],eXt=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND"]),tXt=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function rr(t=process.env,e,r="repo-command"){let n={};for(let[s,i]of Object.entries(t))r==="repo-command"&&tXt.has(s)||(n[s]=i);Object.assign(n,e??{});for(let s of Object.keys(n))(eXt.has(s)||s.startsWith("INPUT_"))&&delete n[s];return n}var ele=require("child_process"),rg=z(require("path"));var Wq=z(require("fs")),sXe=z(require("path")),rXt=/[;|`$<>(){}\n\r]|(?<!&)&(?!&)|\|\|/;function Qm(t){let e=(t??"").trim();if(!e)return{kind:"empty",reason:"the command is empty"};if(rXt.test(e))return{kind:"shell-syntax",reason:"it uses shell syntax (pipe, redirect, substitution, or backgrounding), and this is re-executed WITHOUT a shell so the recorded string cannot be interpreted \u2014 put the logic in a script and record the script invocation instead"};let r=[],n=[],s="",i,o=!1,a=()=>{(s||o)&&n.push(s),s="",o=!1},c=()=>{a(),n.length>0&&r.push(n),n=[]};for(let u=0;u<e.length;u++){let d=e[u];if(i){d===i?i=void 0:s+=d;continue}if(d==='"'||d==="'"){i=d,o=!0;continue}if(d==="&"&&e[u+1]==="&"){c(),u+=1;continue}if(/\s/.test(d)){a();continue}s+=d}if(i)return{kind:"unterminated-quote",reason:"it has an unterminated quote"};if(c(),r.length===0)return{kind:"empty",reason:"the command is empty"};if(r.some(u=>u.length===0))return{kind:"empty-step",reason:"it has an empty step between && operators"};let l=r.find(u=>["cd","export","source","."].includes(u[0]));return l?{kind:"builtin",reason:`it runs the shell builtin "${l[0]}", which cannot be executed as a program \u2014 record a script that does this instead`}:{argv:r[0],steps:r}}function Yq(t,e,r){let n=(t??"").trim(),{steps:s,kind:i}=Qm(n);if(!s&&!(i!=="shell-syntax"&&i!=="builtin")){try{Wq.mkdirSync(sXe.dirname(e),{recursive:!0}),Wq.writeFileSync(e,`#!/usr/bin/env bash
|
|
414
|
+
`)){let i=/^diff --git a\/.+ b\/(.+)$/.exec(s);if(i){r=i[1],n=void 0,e.has(r)||e.set(r,[]);continue}let o=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(s);if(o){n=Number(o[1]);continue}!r||n===void 0||(s.startsWith("+")?e.get(r).push([n,n++]):s.startsWith("-")?e.get(r).push([n,n]):s.startsWith(" ")&&n++)}return e}function rXe(t){let e=tXe.join(t.runDir,_E);if(Vq.existsSync(e))return X9t(Vq.readFileSync(e,"utf-8"))}function Z9t(t){let e=/([\w./@+-]+\.[\w]+)(?::(\d+)(?:-(\d+))?)?/.exec(t);if(!e)return{};let r=e[1].replace(/^\.\//,"");if(!e[2])return{file:r};let n=Number(e[2]);return{file:r,lines:[n,e[3]?Number(e[3]):n]}}function nXe(t,e){if(!e)return!0;let{file:r,lines:n}=Z9t(t);if(!r)return!0;let s=e.get(r)??[...e].find(([i])=>i.endsWith(`/${r}`)||r.endsWith(`/${i}`))?.[1];return s?n?s.some(([i,o])=>n[0]<=o&&n[1]>=i):!0:!1}var ea=["-c","core.fsmonitor=false"],eXt=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),tXt=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function rr(t=process.env,e,r="repo-command"){let n={};for(let[s,i]of Object.entries(t))r==="repo-command"&&tXt.has(s)||(n[s]=i);Object.assign(n,e??{});for(let s of Object.keys(n))(eXt.has(s)||s.startsWith("INPUT_"))&&delete n[s];return n}var ele=require("child_process"),rg=z(require("path"));var Wq=z(require("fs")),sXe=z(require("path")),rXt=/[;|`$<>(){}\n\r]|(?<!&)&(?!&)|\|\|/;function Qm(t){let e=(t??"").trim();if(!e)return{kind:"empty",reason:"the command is empty"};if(rXt.test(e))return{kind:"shell-syntax",reason:"it uses shell syntax (pipe, redirect, substitution, or backgrounding), and this is re-executed WITHOUT a shell so the recorded string cannot be interpreted \u2014 put the logic in a script and record the script invocation instead"};let r=[],n=[],s="",i,o=!1,a=()=>{(s||o)&&n.push(s),s="",o=!1},c=()=>{a(),n.length>0&&r.push(n),n=[]};for(let u=0;u<e.length;u++){let d=e[u];if(i){d===i?i=void 0:s+=d;continue}if(d==='"'||d==="'"){i=d,o=!0;continue}if(d==="&"&&e[u+1]==="&"){c(),u+=1;continue}if(/\s/.test(d)){a();continue}s+=d}if(i)return{kind:"unterminated-quote",reason:"it has an unterminated quote"};if(c(),r.length===0)return{kind:"empty",reason:"the command is empty"};if(r.some(u=>u.length===0))return{kind:"empty-step",reason:"it has an empty step between && operators"};let l=r.find(u=>["cd","export","source","."].includes(u[0]));return l?{kind:"builtin",reason:`it runs the shell builtin "${l[0]}", which cannot be executed as a program \u2014 record a script that does this instead`}:{argv:r[0],steps:r}}function Yq(t,e,r){let n=(t??"").trim(),{steps:s,kind:i}=Qm(n);if(!s&&!(i!=="shell-syntax"&&i!=="builtin")){try{Wq.mkdirSync(sXe.dirname(e),{recursive:!0}),Wq.writeFileSync(e,`#!/usr/bin/env bash
|
|
415
415
|
# Written by ${r}: the recorded command, which needed a shell to run.
|
|
416
416
|
set -euo pipefail
|
|
417
417
|
${n}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyramp/testbot-core",
|
|
3
|
-
"version": "0.12.0-v3.
|
|
3
|
+
"version": "0.12.0-v3.32",
|
|
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.",
|