@visulima/vis 4.3.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +598 -0
- package/LICENSE.md +151 -88
- package/README.md +2 -2
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +42 -19
- package/dist/packem_chunks/CONFIG_FILES.js +4 -4
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +61 -51
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +202 -176
- package/dist/packem_chunks/dart-plan.js +1 -1
- package/dist/packem_chunks/dart-projects.js +1 -1
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +4 -4
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +5 -5
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler39.js +6 -6
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +2 -2
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +7 -7
- package/dist/packem_chunks/handler61.js +2 -2
- package/dist/packem_chunks/handler62.js +10 -10
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +6 -3
- package/dist/packem_chunks/handler65.js +8 -6
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +31 -20
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +22 -153
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +9 -9
- package/dist/packem_chunks/handler71.js +153 -22
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +35 -35
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +3 -3
- package/dist/packem_chunks/handler78.js +69 -67
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +40 -7
- package/dist/packem_chunks/index2.js +32 -32
- package/dist/packem_chunks/index6.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +3 -4
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +1 -1
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tar.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +5 -5
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{affected-selection-D4giBK2X.js → affected-selection-DDxwjwM4.js} +1 -1
- package/dist/packem_shared/affected-shas-BuaWvmsG.js +1 -0
- package/dist/packem_shared/{ai-fix-BC6aIRJT.js → ai-fix-C2BhFFhi.js} +5 -5
- package/dist/packem_shared/{augment-B9kSZuvW.js → augment-CxUPE8KX.js} +1 -1
- package/dist/packem_shared/{bin-C1XKj-O-.js → bin-Be7_QhQK.js} +1 -1
- package/dist/packem_shared/{build-scripts-CEDx_nJp.js → build-scripts-DxyVSkgM.js} +1 -1
- package/dist/packem_shared/command-runtime-BXvH5EC0.js +1 -0
- package/dist/packem_shared/{dart-pubspec-BK_cK2EP.js → dart-pubspec-DvmyleIr.js} +2 -2
- package/dist/packem_shared/{dependency-scan-B8jroa1D.js → dependency-scan-DKK3ZEZI.js} +1 -1
- package/dist/packem_shared/{docker-DXqV-07f.js → docker-BTuwdXaC.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-ddru_hOg.js → ecosystem-gate-BpQNUJzN.js} +1 -1
- package/dist/packem_shared/env-consistency-CUBJHENL.js +1 -0
- package/dist/packem_shared/{failure-log-D2x5BT8S.js → failure-log-kp0n2rbD.js} +1 -1
- package/dist/packem_shared/{formatBytes-BHAzNIrn-CrusHOew.js → formatBytes-BHAzNIrn-DRcKvqnb.js} +1 -1
- package/dist/packem_shared/git-source-DExWbfN0.js +2 -0
- package/dist/packem_shared/{index-BzhrR_iC.js → index-BdMIfGVZ.js} +15 -15
- package/dist/packem_shared/index-C9ENZqH9.js +39 -0
- package/dist/packem_shared/{index-Chje3u9v.js → index-DQfNpt2u.js} +1 -1
- package/dist/packem_shared/{index-DQ2GJzmy.js → index-DsSWb5XH.js} +1 -1
- package/dist/packem_shared/{index.server-sXNQYpsl.js → index.server-D8BLnYZO.js} +2 -2
- package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-C-_5cgwu.js → isAccessibleSync-DYKTrrvc-BwaMhQs0.js} +1 -1
- package/dist/packem_shared/{lifecycle-D6PMPor-.js → lifecycle-BAhkhE2L.js} +1 -1
- package/dist/packem_shared/{lockfile-CiUtEbnt.js → lockfile-DHmlPGk1.js} +1 -1
- package/dist/packem_shared/{manifests-Du4yKlf_.js → manifests-Dd4Hoztt.js} +1 -1
- package/dist/packem_shared/{min-release-age-JViyQuBM.js → min-release-age-BJnOQaoF.js} +1 -1
- package/dist/packem_shared/{missing-package-json-Cu5YVAot.js → missing-package-json-DfzrGwe1.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-B2X3yhyo.js → multi-eco-lockfiles-BIa6xvJc.js} +1 -1
- package/dist/packem_shared/{native-config-sync-TdTWjVgI.js → native-config-sync-Dr9XvxOf.js} +1 -1
- package/dist/packem_shared/osv-bloom-t40ra5U5.js +2 -0
- package/dist/packem_shared/{package-version-Dxirp-UO.js → package-version-CFuNUWDG.js} +2 -2
- package/dist/packem_shared/{packument-BQv4je9m.js → packument-C9nRiBJf.js} +1 -1
- package/dist/packem_shared/pm-runner-ImwtpnWY.js +1 -0
- package/dist/packem_shared/{project-name-filter-D6tXD8gd.js → project-name-filter-C2rkW-Vn.js} +1 -1
- package/dist/packem_shared/{provenance-DNyVMxNv.js → provenance-DF-ypZj3.js} +1 -1
- package/dist/packem_shared/{readJsonSync-CbryXYxN-EWl7_7KX.js → readJsonSync-CbryXYxN-Bm5i10UW.js} +1 -1
- package/dist/packem_shared/{registry-keys-DwB3ZXS_.js → registry-keys-BLuHOyZu.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-BPsdmuty.js → resolve-explicit-BDaQRR6o.js} +1 -1
- package/dist/packem_shared/resolve-runtime-Cr19Pk6L.js +1 -0
- package/dist/packem_shared/{run-file-UBukWaha.js → run-file-XbRCF6Mp.js} +1 -1
- package/dist/packem_shared/{runtime-check-1U8HrQd9.js → runtime-check-Bh5q9IrT.js} +1 -1
- package/dist/packem_shared/{s1ngularity-QD2LD1sO.js → s1ngularity-UCZN7skW.js} +1 -1
- package/dist/packem_shared/{scan-progress-CkumcBG-.js → scan-progress-DcYI76zE.js} +1 -1
- package/dist/packem_shared/{selectors-edwcgNl3.js → selectors-DCiEU0iv.js} +2 -2
- package/dist/packem_shared/{signatures-t8LbOaqr.js → signatures-CicxPHN4.js} +1 -1
- package/dist/packem_shared/target-merge-BClIXg2k.js +14 -0
- package/dist/packem_shared/{target-options-DsHFmRZH.js → target-options-PgWIuJnb.js} +1 -1
- package/dist/packem_shared/task-env-Dl08aklA.js +2 -0
- package/dist/packem_shared/toolchain-DvUxlbDz.js +5 -0
- package/dist/packem_shared/{typosquats-8u0drCqQ.js → typosquats-DxPzyK7u.js} +1 -1
- package/dist/packem_shared/{verify-B_MblU_Q.js → verify-CadR9PUk.js} +1 -1
- package/dist/packem_shared/{vis-update-app-BCIccZfA.js → vis-update-app-DrFWQyPn.js} +1 -1
- package/dist/packem_shared/{vis-user-error-75VtCwMv.js → vis-user-error-k7CLTpA4.js} +15 -15
- package/dist/packem_shared/{watch-CcTketln.js → watch-Dr_6yz3o.js} +1 -1
- package/dist/packem_shared/watch-loop-BId9vT7Q.js +11 -0
- package/dist/packem_shared/{writeFileSync-DJoHk3Ks-BPRoepNw.js → writeFileSync-DJoHk3Ks-Dhem3Uof.js} +1 -1
- package/dist/release/core/version-actions/index.d.ts +1 -1
- package/dist/release/presets.d.ts +1 -55
- package/dist/release/presets.js +1 -1
- package/dist/release/types.d.ts +1 -18
- package/dist/runtime/preload.js +1 -1
- package/index.d.ts +204 -204
- package/index.js +52 -52
- package/package.json +10 -10
- package/schemas/project.schema.json +44 -1
- package/schemas/vis-config.schema.json +128 -35
- package/schemas/vis-release-config.schema.json +1 -12
- package/skills/vis/SKILL.md +24 -12
- package/dist/packem_shared/Table-BB8xHTU5-BLPS917D.js +0 -11
- package/dist/packem_shared/affected-shas-B2V84O0g.js +0 -1
- package/dist/packem_shared/command-runtime-p4IXiIf6.js +0 -1
- package/dist/packem_shared/giget-D8Kwb0kD.js +0 -2
- package/dist/packem_shared/index-BisalDCf.js +0 -39
- package/dist/packem_shared/osv-bloom-BCAX5ARR.js +0 -2
- package/dist/packem_shared/pm-runner-CMSml1Bj.js +0 -1
- package/dist/packem_shared/resolve-runtime-CNiHcVtx.js +0 -1
- package/dist/packem_shared/target-merge-DVJl-7Qz.js +0 -4
- package/dist/packem_shared/toolchain-BRdpaAC4.js +0 -5
- package/dist/packem_shared/watch-loop-qRn0IHPG.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as v}from"node:module";import{e as m}from"../packem_shared/index-
|
|
1
|
+
import{createRequire as v}from"node:module";import{e as m}from"../packem_shared/index-BdMIfGVZ.js";import{cleanWorkspace as E}from"#native";import{l as S}from"../packem_shared/missing-package-json-DfzrGwe1.js";import{p as c}from"./cli-main.js";import{e as p}from"../packem_shared/utils-DQFHJn72.js";import{y as P}from"../packem_shared/isAccessibleSync-DYKTrrvc-BwaMhQs0.js";let g;const _=e=>(g??=v(import.meta.url))(e),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,t]=u.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return u.getBuiltinModule(e)}return _(e)},{readdirSync:h,lstatSync:$,rmSync:b}=R("node:fs"),j=e=>{const r=[],t=[e];for(;t.length>0;){const o=t.pop();let i;try{i=h(o)}catch{continue}for(const l of i){const s=m(o,l);try{const n=$(s);if(n.isSymbolicLink()||!n.isDirectory())continue}catch{continue}l==="node_modules"?r.push(s):l!==".git"&&l!==".hg"&&t.push(s)}}return r},w=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],D=(e,r,t)=>{let o=0,i=!1;for(const l of w){const s=m(e,l);if(P(s)){t.info(` ${s}`),o++;continue}}return{hadError:i,removed:o}},L=new Set([".cache",".turbo","dist","node_modules"]),k=e=>{for(const r of h(e,{withFileTypes:!0})){const t=m(e,r.name);if(!r.isDirectory())return t;if(!L.has(r.name)){const o=k(t);if(o!==void 0)return o}}},y=(e,r,t)=>{let o=0,i=!1;for(const{packageDir:l}of S(e)){const s=m(e,l);let n;try{n=k(s)}catch(a){c.error(`${s}: ${p(a)}`),i=!0;continue}if(n!==void 0){c.warn(`Skipping ${s}: not empty (contains ${n})`);continue}if(r){t.info(` ${s}`),o++;continue}try{b(s,{force:!0,recursive:!0}),c.success(`Removed empty package ${s}`),o++}catch(a){c.error(`${s}: ${p(a)}`),i=!0}}return{hadError:i,removed:o}},x=async({logger:e,options:r,workspaceRoot:t})=>{const o=t??process.cwd(),i=r.lockfile||!1,l=r.emptyPackages||!1;if(r.dryRun||!1){const f=j(o);if(f.length>0){c.info("Would remove:");for(const d of f)e.info(` ${d}`)}else c.info("No node_modules directories found.");i&&D(o,!0,e),l&&(c.info("Would remove empty packages:"),y(o,!0,e));return}const n=E(o,i);for(const f of n.removed)c.success(`Removed ${f}`);for(const f of n.lockfilesRemoved)c.success(`Removed ${f}`);for(const f of n.errors)c.error(f);n.removed.length===0&&n.lockfilesRemoved.length===0?c.info("No node_modules directories found."):c.info(`Cleaned ${n.removed.length} node_modules director${n.removed.length===1?"y":"ies"}`);let a=!1;if(l){const{hadError:f,removed:d}=y(o,!1,e);a=f,d>0&&c.info(`Cleaned ${d} empty package director${d===1?"y":"ies"}`)}(n.errors.length>0||a)&&(process.exitCode=1)};export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as l,e as d}from"../packem_shared/pm-runner-ImwtpnWY.js";import{r as m,a as p}from"../packem_shared/command-runtime-BXvH5EC0.js";const i=async({logger:s,options:a,visConfig:e,workspaceRoot:n})=>{const c=n??process.cwd(),r=m({options:a,visConfig:e},c),t=l(c,{backend:p(r),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),o=d(t,a.check||!1,c,s);o!==0&&(process.exitCode=o)};export{i as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as L}from"node:module";import{U as G,
|
|
1
|
+
import{createRequire as L}from"node:module";import{U as G,b as H}from"../packem_shared/index-BdMIfGVZ.js";import{d as U,f as F,p as S,v as P,a as D}from"./heal.js";import{d as j,c as V}from"../packem_shared/pm-runner-ImwtpnWY.js";import{p as s}from"./cli-main.js";let N;const O=t=>(N??=L(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,o]=I.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return I.getBuiltinModule(t)}return O(t)},{readFile:x}=B("node:fs/promises"),{createInterface:K}=B("node:readline"),M=()=>!!process.stdout.isTTY&&process.env.CI!=="true",q=t=>new Promise(e=>{const o=K({input:process.stdin,output:process.stderr});o.question(`${t} (Y/n) `,a=>{o.close();const i=a.trim().toLowerCase();e(i===""||i==="y"||i==="yes")})}),Y=(t,e)=>{const o=j(e),a=V(o,{exact:!1,filter:[],global:!1,optional:!1,packages:[t],peer:!1,saveDev:!1,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:a})},$=t=>`pnpm add ${t}`,J=t=>t==="@gitbeaker/rest"?import("@gitbeaker/rest"):import("@octokit/rest"),A=async(t,e={})=>{const o=e.interactive??M(),a=e.prompt??q,i=e.runInstall??Y,c=e.importImpl??J,d=e.workspaceRoot??process.cwd();try{return await c(t)}catch(u){const{code:m}=u;if(m!=="ERR_MODULE_NOT_FOUND"&&m!=="MODULE_NOT_FOUND")throw u}if(!o)throw new Error(`${t} is not installed. \`vis ai heal accept\` needs it to talk to the host. Install it in your repo first:
|
|
2
2
|
${$(t)}`);if(!await a(`${t} isn't installed. Install it now?`))throw new Error(`${t} install declined. Re-run \`vis ai heal accept\` after installing manually:
|
|
3
3
|
${$(t)}`);const n=await i(t,d);if(n.exitCode!==0)throw new Error(`Install of ${t} failed (exit ${String(n.exitCode)}). Install manually and retry:
|
|
4
4
|
${$(t)}`);return await c(t)},W=t=>{const e=t.indexOf("/");if(e<=0||e===t.length-1)throw new Error(`Expected GITHUB_REPOSITORY in "owner/repo" form, got: ${t}`);return{owner:t.slice(0,e),repo:t.slice(e+1)}},z=async(t,e)=>{if(e.githubClient)return e.githubClient;const i=(await(e.loadSdk??A)("@octokit/rest")).Octokit;if(!i)throw new TypeError("Loaded `@octokit/rest` but no `Octokit` export was found. Reinstall the package or pin to a supported major.");return new i({auth:t})},X=async(t,e,o)=>{if(o.gitlabClient)return o.gitlabClient;const c=(await(o.loadSdk??A)("@gitbeaker/rest")).Gitlab;if(!c)throw new TypeError("Loaded `@gitbeaker/rest` but no `Gitlab` export was found. Reinstall the package or pin to a supported major.");return new c({host:e,token:t})},Q=t=>t.replace(/\/api\/v\d+\/?$/,""),Z=async t=>{const{branch:e,ciContext:o,files:a,message:i,workspaceRoot:c}=t,d=t.readFile??(_=>x(_,"utf8"));if(!o.repo)throw new Error("Cannot commit on GitHub: GITHUB_REPOSITORY (owner/repo) is not set.");if(!o.token)throw new Error("Cannot commit on GitHub: GITHUB_TOKEN is not set. Grant the workflow `contents: write` and pass the token through.");const{owner:r,repo:n}=W(o.repo),u=await z(o.token,t),f=(await u.rest.git.getRef({owner:r,ref:`heads/${e}`,repo:n})).data.object.sha,g=(await u.rest.git.getCommit({commit_sha:f,owner:r,repo:n})).data.tree.sha,h=await Promise.all(a.map(async _=>{const T=G(c,_),w=await d(T),R=await u.rest.git.createBlob({content:Buffer.from(w,"utf8").toString("base64"),encoding:"base64",owner:r,repo:n});return{mode:"100644",path:_,sha:R.data.sha,type:"blob"}})),C=await u.rest.git.createTree({base_tree:g,owner:r,repo:n,tree:h}),b=await u.rest.git.createCommit({message:i,owner:r,parents:[f],repo:n,tree:C.data.sha});return await u.rest.git.updateRef({owner:r,ref:`heads/${e}`,repo:n,sha:b.data.sha}),{sha:b.data.sha,url:b.data.html_url}},tt=async t=>{const{branch:e,ciContext:o,files:a,message:i,workspaceRoot:c}=t,d=t.readFile??(p=>x(p,"utf8"));if(!o.repo)throw new Error("Cannot commit on GitLab: CI_PROJECT_ID / CI_PROJECT_PATH is not set.");if(!o.token)throw new Error("Cannot commit on GitLab: no token. CI_JOB_TOKEN cannot push commits — set GITLAB_TOKEN to a PAT/project-token with `api` scope.");if(!o.apiBaseUrl)throw new Error("Cannot commit on GitLab: CI_API_V4_URL is not set.");const r=Q(o.apiBaseUrl),n=await X(o.token,r,t),u=await Promise.all(a.map(async p=>{const g=G(c,p);return{action:"update",content:await d(g),filePath:p}})),m=await n.Commits.create(o.repo,e,i,u),f=m.id??m.sha;if(!f)throw new Error("GitLab Commits.create returned no commit ID — cannot reference the new commit.");return{sha:f,url:m.web_url??m.webUrl}},et=async t=>{if(t.files.length===0)throw new Error("Cannot commit: no files to include.");if(t.ciContext.provider==="github-actions")return await Z(t);if(t.ciContext.provider==="gitlab-ci")return await tt(t);throw new Error(`Cannot commit: unsupported CI provider \`${t.ciContext.provider}\`. Run \`vis ai heal accept\` from a recognised CI environment.`)},y="/vis heal accept",ot=async t=>{if(!t)return;let e;try{e=await x(t,"utf8")}catch{return}const o=JSON.parse(e),a=o.comment?.body??"",i=o.comment?.user?.login??"",c=o.pull_request?.head?.repo?.full_name,d=o.pull_request?.base?.repo?.full_name??o.repository?.full_name,r=c!==void 0&&d!==void 0&&c!==d;return{actor:i,body:a,headRef:o.pull_request?.head?.ref,isFork:r}},rt=t=>{const e=t.VIS_HEAL_TRIGGER_BODY,o=t.VIS_HEAL_TRIGGER_ACTOR;if(!(!e||!o))return{actor:o,body:e,headRef:t.VIS_HEAL_HEAD_REF,isFork:!1}},it=t=>{const e=t.BUILDKITE_UNBLOCKER_EMAIL??t.BUILDKITE_UNBLOCKER;if(e)return{actor:e,body:y,headRef:t.BUILDKITE_BRANCH,isFork:!1}},at=async(t,e)=>{if(t.provider==="github-actions")return await ot(e.GITHUB_EVENT_PATH);if(t.provider==="gitlab-ci")return rt(e);if(t.provider==="buildkite")return it(e)},nt=(t,e)=>{const o=e.BUILDKITE_REPO;if(!o)return;const a=/(?:^|@|\/\/)github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?\/?$/i.exec(o);if(a&&e.GITHUB_TOKEN)return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t.prNumber,provider:"github-actions",repo:`${a[1]}/${a[2]}`,sha:t.sha,token:e.GITHUB_TOKEN};const i=/\/\/([^/]*gitlab[^/]*)\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(o),c=i?null:/@([^/:]*gitlab[^/:]*):([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(o),d=i??c;if(d&&e.GITLAB_TOKEN){const r=d[1];return{apiBaseUrl:e.CI_API_V4_URL??`https://${r}/api/v4`,buildId:void 0,buildNumber:void 0,prNumber:t.prNumber,provider:"gitlab-ci",repo:`${d[2]}/${d[3]}`,sha:t.sha,token:e.GITLAB_TOKEN}}},st=async t=>{const e=t.fetchImpl??globalThis.fetch,a=`${(t.apiBaseUrl??"https://api.github.com").replace(/\/+$/,"")}/repos/${t.repo}/pulls/${String(t.prNumber)}`;try{const i=await e(a,{headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"}});return i.ok?(await i.json()).head?.ref:void 0}catch{return}},ct=(t,e,o,a)=>{const i=e.map(c=>`- \`${c}\``).join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as E}from"node:module";import{b as U,j as x,F as g,X as A,J as L}from"../packem_shared/index.server-
|
|
1
|
+
import{createRequire as E}from"node:module";import{b as U,j as x,F as g,X as A,J as L}from"../packem_shared/index.server-D8BLnYZO.js";import{b as O}from"../packem_shared/index-BdMIfGVZ.js";import{readLastRunSummary as G}from"@visulima/task-runner";import{a as j,r as F,b as D,c as K}from"../packem_shared/ai-fix-C2BhFFhi.js";import{p,d as H}from"./cli-main.js";let B;const P=e=>(B??=E(import.meta.url))(e),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,o]=m.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return m.getBuiltinModule(e)}return P(e)},{spawn:h}=I("node:child_process"),{readFile:M}=I("node:fs/promises"),V=e=>{if(!e)return;const t=/^refs\/pull\/(\d+)\//.exec(e);return t?Number.parseInt(t[1],10):void 0},J=async e=>{if(!e)return{prNumber:void 0,sha:void 0};try{const t=await M(e,"utf8"),o=JSON.parse(t),r=o.pull_request?.number??o.issue?.number??o.number,s=o.pull_request?.head?.sha;return{prNumber:r,sha:s}}catch{return{prNumber:void 0,sha:void 0}}},q=async e=>{const t=V(e.GITHUB_REF),{prNumber:o,sha:r}=t===void 0?await J(e.GITHUB_EVENT_PATH):{prNumber:t,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t??o,provider:"github-actions",repo:e.GITHUB_REPOSITORY,sha:r??e.GITHUB_SHA,token:e.GITHUB_TOKEN}},z=e=>{const t=e.CI_MERGE_REQUEST_IID,o=t!==void 0&&t!==""?Number.parseInt(t,10):void 0,r=e.CI_API_V4_URL,s=e.GITLAB_TOKEN??e.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:e.CI_PROJECT_ID??e.CI_PROJECT_PATH,sha:e.CI_COMMIT_SHA,token:s}},X=e=>{const t=e.BUILDKITE_PULL_REQUEST,o=t!==void 0&&t!==""&&t!=="false"?Number.parseInt(t,10):void 0,r=e.BUILDKITE_BUILD_NUMBER,s=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=e.BUILDKITE_ORGANIZATION_SLUG,i=e.BUILDKITE_PIPELINE_SLUG,a=n!==void 0&&n!==""&&i!==void 0&&i!==""?`${n}/${i}`:void 0;return{apiBaseUrl:(e.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:e.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(s)?s:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:a,sha:e.BUILDKITE_COMMIT,token:e.BUILDKITE_API_TOKEN}},Y=async(e=process.env)=>e.GITHUB_ACTIONS==="true"?await q(e):e.GITLAB_CI==="true"?z(e):e.BUILDKITE==="true"?X(e):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},Q=(e,t,o,r)=>new Promise(s=>{const n=["pr","comment",String(t),"--body-file","-"];r&&n.push("--repo",r);const i=h(e,n,{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(o)}),Z=async(e,t,o,r,s)=>{const n=`https://api.github.com/repos/${t}/issues/${String(o)}/comments`;try{const i=await e(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${s}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!i.ok){const a=await i.text().catch(()=>"");return{error:`GitHub REST returned ${String(i.status)}: ${a.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(i){return{error:i instanceof Error?i.message:String(i),ok:!1}}},W=async(e,t,o,r,s,n)=>{const i=encodeURIComponent(o),a=`${t.replace(/\/+$/,"")}/projects/${i}/merge_requests/${String(r)}/notes`;try{const d=await e(a,{body:JSON.stringify({body:s}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const c=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${c.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},tt=(e,t,o,r)=>new Promise(s=>{const i=h(e,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(t)}),et=async(e,t,o,r,s,n,i,a)=>{const[d,c]=o.split("/",2);if(!d||!c)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const f=`${t}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(c)}/builds/${String(r)}/annotations`;try{const u=await e(f,{body:JSON.stringify({body:s,context:i,style:n}),headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"},method:"POST"});if(!u.ok){const l=await u.text().catch(()=>"");return{error:`Buildkite REST returned ${String(u.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(u){return{error:u instanceof Error?u.message:String(u),ok:!1}}},ot=async(e,t,o,r)=>{const s=t.buildId?`vis-ai-heal-${t.buildId}`:"vis-ai-heal",n="info",i=await tt(o,e,n,s);if(i.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!t.apiBaseUrl||!t.repo||t.buildNumber===void 0||!t.token){const d=[];return t.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),t.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),t.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const a=await et(r,t.apiBaseUrl,t.repo,t.buildNumber,e,n,s,t.token);return a.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(i.exitCode)}; REST fallback also failed: ${a.error??"unknown"}`,method:"rest",posted:!1}},rt=async(e,t,o,r)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};const s=await Q(o,t.prNumber,e,t.repo);if(s.exitCode===0)return{method:"gh-cli",posted:!0};if(!t.repo||!t.token)return{error:`gh exited ${String(s.exitCode)} (${s.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await Z(r,t.repo,t.prNumber,e,t.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(s.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},it=async(e,t,o)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};if(!t.apiBaseUrl||!t.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!t.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await W(o,t.apiBaseUrl,t.repo,t.prNumber,e,t.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},nt=async e=>{const{body:t,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:s=globalThis.fetch,ghBin:n="gh"}=e;return r.provider==="github-actions"?await rt(t,r,n,s):r.provider==="gitlab-ci"?await it(t,r,s):r.provider==="buildkite"?await ot(t,r,o,s):{method:"skipped",posted:!1}},b=e=>{let t=0,o=0;for(const r of e)r.status==="applied"?t+=1:o+=1;return{applied:t,failed:o}},k=(e,t,o)=>{const r=K(e,t,o),s=O(e,r);return s===""||s.startsWith("..")?r:s},st=(e,t,o,r)=>new Promise(s=>{const n=process.argv[1];if(!n){s({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const i=[n,"run",o,"--projects",t,"--no-cache","--summarize","--fail-fast"],a=h(process.execPath,i,{cwd:e,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",c="";const f=setTimeout(()=>{a.kill("SIGTERM"),setTimeout(()=>a.kill("SIGKILL"),2e3).unref()},r);a.stdout?.setEncoding("utf8"),a.stdout?.on("data",u=>{d+=u}),a.stderr?.setEncoding("utf8"),a.stderr?.on("data",u=>{c+=u}),a.once("error",u=>{clearTimeout(f),s({exitCode:-1,stderr:u.message,stdout:d})}),a.once("close",u=>{clearTimeout(f),s({exitCode:u??-1,stderr:c,stdout:d})})}),at=6e4,T=e=>{let t=0;const o=e.match(/`{3,}/g);if(o)for(const r of o)t=Math.max(t,r.length);return"`".repeat(Math.max(3,t+1))},_=(e,t,o)=>{if(e.patches.length===0)return"_No patches proposed._";const r=[];for(const[s,n]of e.patches.entries()){const i=k(t,o,n.file),a=[`**[${String(s+1)}] \`${i}\`**`];n.reason&&a.push(`_${n.reason}_`);const d=T(`${n.oldString}
|
|
2
2
|
${n.newString}`);a.push(`${d}diff`);for(const c of n.oldString.split(`
|
|
3
3
|
`))a.push(`- ${c}`);for(const c of n.newString.split(`
|
|
4
4
|
`))a.push(`+ ${c}`);a.push(d),r.push(a.join(`
|