@visulima/vis 1.0.0-alpha.27 → 1.0.0-alpha.29
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 +42 -0
- package/LICENSE.md +3217 -99
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/bin.js +468 -364
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/config.js +15 -15
- package/dist/packem_chunks/devtools.js +82 -0
- 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 +1 -2
- package/dist/packem_chunks/handler11.js +5 -1
- package/dist/packem_chunks/handler12.js +1 -5
- package/dist/packem_chunks/handler13.js +27 -1
- package/dist/packem_chunks/handler14.js +5 -27
- package/dist/packem_chunks/handler15.js +1 -5
- 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 +5 -1
- package/dist/packem_chunks/handler21.js +2 -5
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -2
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +5 -1
- package/dist/packem_chunks/handler26.js +1 -5
- package/dist/packem_chunks/handler27.js +3 -1
- package/dist/packem_chunks/handler28.js +1 -3
- package/dist/packem_chunks/handler29.js +7 -1
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +32 -6
- package/dist/packem_chunks/handler31.js +3 -33
- package/dist/packem_chunks/handler32.js +8 -3
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler34.js +4 -4
- package/dist/packem_chunks/handler35.js +11 -3
- package/dist/packem_chunks/handler36.js +3 -22
- package/dist/packem_chunks/handler37.js +21 -60
- package/dist/packem_chunks/handler38.js +61 -3
- package/dist/packem_chunks/handler39.js +3 -6
- package/dist/packem_chunks/handler4.js +5 -5
- package/dist/packem_chunks/handler40.js +6 -24
- package/dist/packem_chunks/handler41.js +24 -153
- package/dist/packem_chunks/handler42.js +153 -10
- package/dist/packem_chunks/handler43.js +6 -6
- package/dist/packem_chunks/handler44.js +10 -708
- package/dist/packem_chunks/handler45.js +708 -24
- package/dist/packem_chunks/handler46.js +24 -322
- package/dist/packem_chunks/handler47.js +322 -48
- package/dist/packem_chunks/handler48.js +48 -3
- package/dist/packem_chunks/handler49.js +3 -27
- package/dist/packem_chunks/handler5.js +7 -7
- package/dist/packem_chunks/handler50.js +21 -190
- package/dist/packem_chunks/handler51.js +194 -33
- package/dist/packem_chunks/handler52.js +34 -0
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- 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 +7 -17
- package/dist/packem_chunks/index.js +3 -3
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +2 -2
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/run.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/tripwire.js +2 -2
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +12 -0
- package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +1 -0
- package/dist/packem_shared/{advisories-xIOdLbAI.js → advisories-DpgSuWDH.js} +1 -1
- package/dist/packem_shared/{affected-shas-Dm7eqcI8.js → affected-shas-BkXXecyi.js} +1 -1
- package/dist/packem_shared/ai-analysis-KP8b5lc0.js +68 -0
- package/dist/packem_shared/{ai-fix-BlYyz5bI.js → ai-fix-CfFWatGY.js} +5 -5
- package/dist/packem_shared/{applyDefaults-KxZkvlp3.js → applyDefaults-DLvOqXGX.js} +1 -1
- package/dist/packem_shared/{build-scripts-3E2pmscY.js → build-scripts-D-ysm_bS.js} +1 -1
- package/dist/packem_shared/{cyclonedx-B3ILsY74.js → cyclonedx-B04lIvwu.js} +3 -3
- package/dist/packem_shared/{dependency-scan-s2MD0vi-.js → dependency-scan-B9wTcLxf.js} +1 -1
- package/dist/packem_shared/{docker-BynKrOLe.js → docker-DxA80dRx.js} +1 -1
- package/dist/packem_shared/{failure-log-B0Uh-65U.js → failure-log-n3j_-w8s.js} +1 -1
- package/dist/packem_shared/index-BDF8gawl.js +29 -0
- package/dist/packem_shared/{index-B_KtN1MB.js → index-BfG9_znI.js} +1 -1
- package/dist/packem_shared/{lifecycle-CJRNbN3x.js → lifecycle-NHIKDiCh.js} +2 -2
- package/dist/packem_shared/lockfile-CoeFxWAv.js +1 -0
- package/dist/packem_shared/lockfile-DAuTDwow.js +1 -0
- package/dist/packem_shared/{manifests-Z3spBpxv.js → manifests-B7wUR3Rk.js} +1 -1
- package/dist/packem_shared/{min-release-age-aEn0x8Vy.js → min-release-age-YyNI7gqV.js} +1 -1
- package/dist/packem_shared/{native-config-sync-DdhTLlKL.js → native-config-sync-CgRIIRZV.js} +2 -2
- package/dist/packem_shared/{osv-bloom-BJhlc_I2.js → osv-bloom-BQSIHt5h.js} +2 -2
- package/dist/packem_shared/pm-runner-Ta_yz2uP.js +1 -0
- package/dist/packem_shared/{provenance-BuiEsWbI.js → provenance-DoEp2uOo.js} +1 -1
- package/dist/packem_shared/{readFileSync-CGmzMUF2-D6rUjGDn.js → readFileSync-4c_c6Qey-6SWMDNdw.js} +1 -1
- package/dist/packem_shared/{registry-keys-pemEkRM9.js → registry-keys-CD1xHavV.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-RgRrUDZv.js → resolve-explicit-DpSc7RN2.js} +1 -1
- package/dist/packem_shared/{runtime-check-DgXsKCsv.js → runtime-check-Cbtb_Utb.js} +1 -1
- package/dist/packem_shared/s1ngularity-CIX7UcT5.js +1 -0
- package/dist/packem_shared/scan-progress-CTVVf9WW.js +2 -0
- package/dist/packem_shared/{selectors-BE2BCnTR.js → selectors-BU8aTRQm.js} +1 -1
- package/dist/packem_shared/{signatures-LYMy8OR5.js → signatures-BHM7cnqB.js} +1 -1
- package/dist/packem_shared/spinner-C8xs6QZv.js +1 -0
- package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +1 -0
- package/dist/packem_shared/tabs-xZkm6Y_J.js +1 -0
- package/dist/packem_shared/{toolchain-Jx2lkAYy.js → toolchain-juKl-WgV.js} +1 -1
- package/dist/packem_shared/typosquats-DRKU6d2S.js +1 -0
- package/dist/packem_shared/use-measured-height-Lea6TCVD.js +1 -0
- package/dist/packem_shared/{verify-C8EAHql6.js → verify-DA80ja1b.js} +1 -1
- package/dist/packem_shared/vis-update-app-BCKzlqj8.js +1 -0
- package/dist/packem_shared/{watch-BSVsZ_1I.js → watch-DdR-pFzX.js} +1 -1
- package/dist/packem_shared/{watch-loop-DLlMLg_J.js → watch-loop-C8csFvRU.js} +2 -2
- package/index.d.ts +201 -201
- package/index.js +567 -751
- package/package.json +13 -13
- package/dist/packem_shared/ai-analysis-Csn82p17.js +0 -68
- package/dist/packem_shared/index-efSniSRN.js +0 -29
- package/dist/packem_shared/index.server-B7ETiT4C.js +0 -2
- package/dist/packem_shared/lockfile-BG1HvBzH.js +0 -1
- package/dist/packem_shared/pm-runner-BwX5AL3W.js +0 -1
- package/dist/packem_shared/s1ngularity-Bs9fUf3q.js +0 -1
- package/dist/packem_shared/scan-progress-DjPT66jy.js +0 -2
- package/dist/packem_shared/typosquats-znskIR5j.js +0 -1
- package/dist/packem_shared/use-measured-height-DjYgUOKk.js +0 -1
- package/dist/packem_shared/vis-update-app-qhQPV97i.js +0 -1
|
@@ -1 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P=Object.defineProperty;var x=(e,n)=>P(e,"name",{value:n,configurable:!0});import{createRequire as I}from"node:module";import{I as W,T as A,e as N,E as d}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{M as B}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{p as o}from"./bin.js";import{S as w,g as E,w as k,b as q,p as H,f as M,a as j,c as O,u as C,d as K,e as L,h as D}from"../packem_shared/toolchain-juKl-WgV.js";const S=I(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=x(e=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[n,t]=$.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return $.getBuiltinModule(e)}return S(e)},"__cjs_getBuiltinModule"),{spawnSync:F}=b("node:child_process"),{writeFileSync:U}=b("node:fs");var G=Object.defineProperty,u=x((e,n)=>G(e,"name",{value:n,configurable:!0}),"u");const y=["aube","bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],J=u(e=>y.includes(e),"isKnownTool"),v=u(e=>e?W("✓"):A("✗"),"icon"),R=N("⚠"),z=u(e=>{if(e.installed){const n=e.version?` v${e.version}`:"",t=e.configFiles.length>0?` (${e.configFiles.join(", ")})`:"";return`${v(!0)} ${e.name}${n}${t}`}return`${R} ${e.name} — referenced by ${e.configFiles.join(", ")} but not installed`},"renderManagerLine"),Q=u(e=>{if(e.matches)return"";const{manager:n}=e;return n.name==="none"?d("→ (no manager)"):n.name==="self-activate"?"":n.installed?d(`→ ${n.name}`):d(`→ ${n.name} (missing)`)},"renderToolManager"),V=u(e=>e.matches?v(!0):e.actual?R:v(!1),"toolIcon"),X=u(e=>{if(o.info(""),o.info(d("── Toolchain ───────────────────────")),e.detected.length===0)o.info(` ${v(!1)} No version manager detected`),o.notice(` Install one of: ${w.join(", ")}`);else for(const n of e.detected)o.info(` ${z(n)}`);if(o.info(""),e.tools.length===0){o.info(` ${d("No tool pins found — add engines.node, .nvmrc, or a manager config file.")}`);return}o.info(d("── Tools ───────────────────────────"));for(const n of e.tools){const t=`${n.expected.tool} ${n.expected.version}`,a=n.actual?`actual ${n.actual}`:"not installed",i=n.matches?"":d(` [${n.expected.source}]`),s=Q(n),f=s===""?"":` ${s}`;o.info(` ${V(n)} ${t} — ${a}${i}${f}`),n.manager.note&&o.notice(` ${n.manager.note}`)}},"printStatus"),Y=u((e,n,t)=>{const a=E(e,n);if(t.json){process.stdout.write(`${JSON.stringify({detected:a.detected.map(s=>({binPath:s.binPath??null,configFiles:s.configFiles,installed:s.installed,name:s.name,version:s.version??null})),tools:a.tools.map(s=>({actual:s.actual??null,expected:s.expected.version,manager:s.manager.name,managerInstalled:s.manager.installed,matches:s.matches,note:s.manager.note??null,source:s.expected.source,tool:s.expected.tool}))},void 0,2)}
|
|
2
|
+
`);return}X(a);const i=a.tools.filter(s=>!s.matches);i.length>0&&(o.info(""),o.notice(" Run `vis toolchain install` to install pinned versions.")),t.exitCode&&i.length>0&&(process.exitCode=1)},"executeStatus"),Z=u(e=>{const n=new Map;for(const t of e){const a=n.get(t.manager.name);a?a.push(t):n.set(t.manager.name,[t])}return n},"groupByManager"),T=u((e,n,t)=>F(e,n,{cwd:t,stdio:"inherit"}).status??1,"runInvocation"),ee=u((e,n,t)=>{const a=E(e,n),i=a.tools.filter(c=>!c.matches);if(i.length===0){o.success("Everything already matches — nothing to install.");return}const s=i.some(c=>c.manager.name!=="self-activate"&&c.manager.name!=="none");if(a.detected.length===0&&s){o.error(`No version manager detected. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}const f=Z(i);let l=!1,g=0;for(const[c,m]of f){if(c==="self-activate"){for(const{expected:r}of m){if(r.source==="packageManager")o.info(`${d("$")} (${r.tool} will self-activate from packageManager on next invocation)`);else if(o.info(`${d("$")} Writing packageManager=${r.tool}@${r.version}`),t.dryRun)l=!0;else try{k(e,r),l=!0}catch(h){o.error(h.message),g=1}o.notice(` ${r.tool} ${r.version} — no install needed`)}continue}if(c==="none"){for(const{expected:r}of m)o.warn(`Cannot install ${r.tool} ${r.version} — no manager can handle it.`);g=1;continue}if(!a.detected.find(r=>r.name===c)?.installed){o.error(`${c} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),g=1;continue}const _=m.map(r=>q(c,r.expected)).filter(Boolean);for(const r of _){if(!r)continue;if(r.bin==="nvm"&&r.args.length===0){o.error("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`."),r.hint&&o.notice(` ${r.hint}`),g=1;continue}if(o.info(`${d("$")} ${r.bin} ${r.args.join(" ")}`),r.hint&&o.notice(` ${r.hint}`),t.dryRun){l=!0;continue}const h=T(r.bin,r.args,e);if(l=!0,h!==0){g=h;break}}}if(g!==0){process.exitCode=g;return}l&&o.success("Toolchain installed.")},"executeInstall"),ne=u((e,n,t,a)=>{if(!t)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const i=H(t);if(!i)throw new Error(`Could not parse "${t}". Expected "<tool>@<version>" where <tool> is one of ${y.join(", ")}.`);const s=M(e),f=j(i,s,n);if(f.name==="none"){o.error(`No manager can pin ${i.tool}. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}if(!f.installed){o.error(`The best manager for ${i.tool} (${f.name}) is not on PATH. ${f.note??""}`),process.exitCode=1;return}const l=O(f.name,i);if(!l){o.error(`${f.name} cannot pin ${i.tool}. Use a different manager, or set \`toolchain.tools.${i.tool}\` in vis.config.ts.`),process.exitCode=1;return}if(f.name==="self-activate"){if(o.info(`${d("→")} Writing packageManager field to package.json...`),a.dryRun){o.notice(` Would set packageManager: "${i.tool}@${i.version}"`);return}try{const c=k(e,i);if(!c){o.error(`Refusing to pin non-package-manager tool ${i.tool} via the packageManager field.`),process.exitCode=1;return}if(o.success(`Set packageManager: "${c}" — ${i.tool} will activate this version on next invocation.`),a.engines!==!1){const m=C(e,i);m&&o.success(`Updated package.json engines.${i.tool} → ${m}.`)}}catch(c){o.error(c.message),process.exitCode=1}return}if(l.args.length===0&&f.name==="nvm"&&i.tool==="node"){const c=B(e,".nvmrc");if(o.info(`${d("→")} Writing ${c}...`),a.dryRun){o.notice(` Would write ${i.version} to .nvmrc`);return}try{U(c,`${i.version}
|
|
3
|
+
`)}catch(m){o.error(`Failed to write .nvmrc: ${m.message}`),process.exitCode=1;return}o.success(`Wrote ${i.version} to .nvmrc.`),o.notice(" nvm is a shell function — run `nvm use` to activate it in this shell.");return}if(l.args.length===0){o.error(`${f.name} cannot pin ${i.tool} from a subprocess. ${l.configChange?.hint??""}`),l.configChange&&o.notice(` Edit ${l.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(o.info(`${d("$")} ${l.bin} ${l.args.join(" ")}`),l.configChange&&o.notice(` Will update ${l.configChange.file} — ${l.configChange.hint}`),a.dryRun)return;const g=T(l.bin,l.args,e);if(g!==0){process.exitCode=g;return}if(o.success(`Pinned ${i.tool} to ${i.version}.`),a.engines!==!1)try{const c=C(e,i);c&&o.success(`Updated package.json engines.${i.tool} → ${c}.`)}catch(c){o.warn(`Could not update engines.${i.tool}: ${c.message}`)}},"executeUse"),oe=u((e,n,t)=>{if(!t)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const a=t.toLowerCase();if(!J(a))throw new Error(`Unknown tool "${t}". Known: ${y.join(", ")}.`);const i=M(e),s=j({source:"vis.config.ts",tool:a,version:"*"},i,n),f=s.installed&&s.name!=="self-activate"&&s.name!=="none"?i.find(g=>g.name===s.name):void 0,l=f?K(f,a):L(a);if(!l){o.error(`${t} not found in PATH${f?` or via ${f.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${l}
|
|
4
|
+
`)},"executeWhich"),te=u((e,n)=>{const t=D(e,n);process.stdout.write(`${t.name}
|
|
5
|
+
`)},"executeDetect"),p=u(e=>{if(!e)throw new Error("Could not determine workspace root. Run inside a monorepo.");return e},"requireRoot"),ue=u(async({options:e,visConfig:n,workspaceRoot:t})=>{Y(p(t),n?.toolchain,e)},"statusExecute"),fe=u(async({visConfig:e,workspaceRoot:n})=>{te(p(n),e?.toolchain)},"detectExecute"),de=u(async({options:e,visConfig:n,workspaceRoot:t})=>{ee(p(t),n?.toolchain,e)},"installExecute"),ge=u(async({argument:e,options:n,visConfig:t,workspaceRoot:a})=>{ne(p(a),t?.toolchain,e[0],n)},"useExecute"),me=u(async({argument:e,visConfig:n,workspaceRoot:t})=>{oe(p(t),n?.toolchain,e[0])},"whichExecute");export{fe as detectExecute,de as installExecute,ue as statusExecute,ge as useExecute,me as whichExecute};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
`);return}V(i);const t=i.tools.filter(s=>!s.matches);t.length>0&&(o.info(""),o.notice(" Run `vis toolchain install` to install pinned versions.")),r.exitCode&&t.length>0&&(process.exitCode=1)},"executeStatus"),Y=f(e=>{const n=new Map;for(const r of e){const i=n.get(r.manager.name);i?i.push(r):n.set(r.manager.name,[r])}return n},"groupByManager"),E=f((e,n,r)=>U(e,n,{cwd:r,stdio:"inherit"}).status??1,"runInvocation"),Z=f((e,n,r)=>{const i=C(e,n),t=i.tools.filter(c=>!c.matches);if(t.length===0){o.success("Everything already matches — nothing to install.");return}const s=t.some(c=>c.manager.name!=="self-activate"&&c.manager.name!=="none");if(i.detected.length===0&&s){o.error(`No version manager detected. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}const u=Y(t);let l=!1,g=0;for(const[c,m]of u){if(c==="self-activate"){for(const{expected:a}of m){if(a.source==="packageManager")o.info(`${d("$")} (${a.tool} will self-activate from packageManager on next invocation)`);else if(o.info(`${d("$")} Writing packageManager=${a.tool}@${a.version}`),r.dryRun)l=!0;else try{M(e,a),l=!0}catch(h){o.error(h.message),g=1}o.notice(` ${a.tool} ${a.version} — no install needed`)}continue}if(c==="none"){for(const{expected:a}of m)o.warn(`Cannot install ${a.tool} ${a.version} — no manager can handle it.`);g=1;continue}if(!i.detected.find(a=>a.name===c)?.installed){o.error(`${c} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),g=1;continue}const _=m.map(a=>B(c,a.expected)).filter(Boolean);for(const a of _){if(!a)continue;if(a.bin==="nvm"&&a.args.length===0){o.error("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`."),a.hint&&o.notice(` ${a.hint}`),g=1;continue}if(o.info(`${d("$")} ${a.bin} ${a.args.join(" ")}`),a.hint&&o.notice(` ${a.hint}`),r.dryRun){l=!0;continue}const h=E(a.bin,a.args,e);if(l=!0,h!==0){g=h;break}}}if(g!==0){process.exitCode=g;return}l&&o.success("Toolchain installed.")},"executeInstall"),ee=f((e,n,r,i)=>{if(!r)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const t=q(r);if(!t)throw new Error(`Could not parse "${r}". Expected "<tool>@<version>" where <tool> is one of ${x.join(", ")}.`);const s=j(e),u=k(t,s,n);if(u.name==="none"){o.error(`No manager can pin ${t.tool}. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}if(!u.installed){o.error(`The best manager for ${t.tool} (${u.name}) is not on PATH. ${u.note??""}`),process.exitCode=1;return}const l=H(u.name,t);if(!l){o.error(`${u.name} cannot pin ${t.tool}. Use a different manager, or set \`toolchain.tools.${t.tool}\` in vis.config.ts.`),process.exitCode=1;return}if(u.name==="self-activate"){if(o.info(`${d("→")} Writing packageManager field to package.json...`),i.dryRun){o.notice(` Would set packageManager: "${t.tool}@${t.version}"`);return}try{const c=M(e,t);if(!c){o.error(`Refusing to pin non-package-manager tool ${t.tool} via the packageManager field.`),process.exitCode=1;return}if(o.success(`Set packageManager: "${c}" — ${t.tool} will activate this version on next invocation.`),i.engines!==!1){const m=y(e,t);m&&o.success(`Updated package.json engines.${t.tool} → ${m}.`)}}catch(c){o.error(c.message),process.exitCode=1}return}if(l.args.length===0&&u.name==="nvm"&&t.tool==="node"){const c=N(e,".nvmrc");if(o.info(`${d("→")} Writing ${c}...`),i.dryRun){o.notice(` Would write ${t.version} to .nvmrc`);return}try{F(c,`${t.version}
|
|
3
|
-
`)}catch(m){o.error(`Failed to write .nvmrc: ${m.message}`),process.exitCode=1;return}o.success(`Wrote ${t.version} to .nvmrc.`),o.notice(" nvm is a shell function — run `nvm use` to activate it in this shell.");return}if(l.args.length===0){o.error(`${u.name} cannot pin ${t.tool} from a subprocess. ${l.configChange?.hint??""}`),l.configChange&&o.notice(` Edit ${l.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(o.info(`${d("$")} ${l.bin} ${l.args.join(" ")}`),l.configChange&&o.notice(` Will update ${l.configChange.file} — ${l.configChange.hint}`),i.dryRun)return;const g=E(l.bin,l.args,e);if(g!==0){process.exitCode=g;return}if(o.success(`Pinned ${t.tool} to ${t.version}.`),i.engines!==!1)try{const c=y(e,t);c&&o.success(`Updated package.json engines.${t.tool} → ${c}.`)}catch(c){o.warn(`Could not update engines.${t.tool}: ${c.message}`)}},"executeUse"),ne=f((e,n,r)=>{if(!r)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const i=r.toLowerCase();if(!G(i))throw new Error(`Unknown tool "${r}". Known: ${x.join(", ")}.`);const t=j(e),s=k({source:"vis.config.ts",tool:i,version:"*"},t,n),u=s.installed&&s.name!=="self-activate"&&s.name!=="none"?t.find(g=>g.name===s.name):void 0,l=u?K(u,i):O(i);if(!l){o.error(`${r} not found in PATH${u?` or via ${u.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${l}
|
|
4
|
-
`)},"executeWhich"),oe=f((e,n)=>{const r=D(e,n);process.stdout.write(`${r.name}
|
|
5
|
-
`)},"executeDetect"),le=f(async({argument:e,options:n,visConfig:r,workspaceRoot:i})=>{if(!i)throw new Error("Could not determine workspace root. Run inside a monorepo.");const t=e[0]??"status",s=r?.toolchain;switch(t){case"detect":{oe(i,s);return}case"install":{Z(i,s,n);return}case"status":{X(i,s,n);return}case"use":{ee(i,s,e[1],n);return}case"which":{ne(i,s,e[1]);return}default:throw new Error(`Unknown toolchain action "${t}". Known: status, detect, install, use, which.`)}},"execute");export{le as default};
|
|
1
|
+
var p=Object.defineProperty;var s=(e,o)=>p(e,"name",{value:o,configurable:!0});import{R as f,W as g}from"../packem_shared/pm-runner-Ta_yz2uP.js";var u=Object.defineProperty,d=s((e,o)=>u(e,"name",{value:o,configurable:!0}),"t");const m=d(async({argument:e,logger:o,options:c,visConfig:a,workspaceRoot:t})=>{const i=e||[],n=t??process.cwd(),l=f(n,{configBackend:a?.install?.backend,configCorepack:a?.install?.corepack}),r=g(l,i,c.recursive||!1,n,o);r!==0&&(process.exitCode=r)},"execute");export{m as default};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a=Object.defineProperty;var s=(n,e)=>a(n,"name",{value:e,configurable:!0});import{createRequire as f}from"node:module";import{m as v}from"../packem_shared/index-BDF8gawl.js";const d=f(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=s(n=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,r]=t.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return t.getBuiltinModule(n)}return d(n)},"__cjs_getBuiltinModule"),{execSync:p,spawnSync:m}=l("node:child_process");var g=Object.defineProperty,y=s((n,e)=>g(n,"name",{value:e,configurable:!0}),"r");const w=y(async({argument:n,logger:e,options:r})=>{const c=n?.[0];e.info("info: checking for updates...");const o=v.version;let i;try{const u=p("npm view @visulima/vis version",{encoding:"utf8"}).trim();i=c??u}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(o===i&&!r.force){e.info(`
|
|
2
|
+
✓ Already up to date (${o})`);return}if(r.check){o===i?e.info(`✓ Already up to date (${o})`):e.info(`info: found @visulima/vis@${i} (current: ${o})`);return}if(e.info(`info: found @visulima/vis@${i} (current: ${o})`),e.info("info: installing..."),m("npm",["install","-g",`@visulima/vis@${i}`],{encoding:"utf8",stdio:"inherit"}).status!==0)throw new Error("Failed to update. Try running with sudo or fix npm permissions.");e.info(`
|
|
3
|
+
✓ Updated @visulima/vis from ${o} → ${i}`)},"execute");export{w as default};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
✓ Already up to date (${o})`);return}if(r.check){o===i?e.info(`✓ Already up to date (${o})`):e.info(`info: found @visulima/vis@${i} (current: ${o})`);return}if(e.info(`info: found @visulima/vis@${i} (current: ${o})`),e.info("info: installing..."),m("npm",["install","-g",`@visulima/vis@${i}`],{encoding:"utf8",stdio:"inherit"}).status!==0)throw new Error("Failed to update. Try running with sudo or fix npm permissions.");e.info(`
|
|
3
|
-
✓ Updated @visulima/vis from ${o} → ${i}`)},"execute");export{w as default};
|
|
1
|
+
var f=Object.defineProperty;var t=(a,o)=>f(a,"name",{value:o,configurable:!0});import{R as d,a as g}from"../packem_shared/pm-runner-Ta_yz2uP.js";import{o as v}from"../packem_shared/utils-DrNg0XTR.js";var u=Object.defineProperty,b=t((a,o)=>u(a,"name",{value:o,configurable:!0}),"n");const w=b(async({argument:a,logger:o,options:e,process:c,visConfig:l,workspaceRoot:i})=>{const s=a;if(!s||s.length===0)throw new Error("No packages specified. Usage: vis why <package...>");const n=i??c.cwd,p=d(n,{configBackend:l?.install?.backend,configCorepack:l?.install?.corepack}),r=g(p,{depth:e.depth===void 0?void 0:Number(e.depth),dev:e.dev||!1,filter:v(e.filter),global:e.global||!1,json:e.json||!1,long:e.long||!1,noOptional:e.optional===!1,packages:s,parseable:e.parseable||!1,prod:e.prod||!1,recursive:e.recursive||!1},n,o);r!==0&&r!==1&&(process.exitCode=r)},"execute");export{w as default};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
var
|
|
1
|
+
var x=Object.defineProperty;var l=(e,o)=>x(e,"name",{value:o,configurable:!0});import{b as h,h as E,_ as S,R as v}from"../packem_shared/ai-analysis-KP8b5lc0.js";import{d as w,R as D,y as P}from"./bin.js";import{j as I,E as d,q as R,I as j,e as N}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";var C=Object.defineProperty,u=l((e,o)=>C(e,"name",{value:o,configurable:!0}),"s");const f={command:"ai",description:"AI-assisted commands: provider detection, cache management, and failure-fix proposals."},O=u(e=>{if(typeof e!="function")return String(e);const{name:o}=e;return o==="Boolean"?"boolean":o==="Number"?"number":o==="String"?"string":o??"unknown"},"typeName"),A=u(e=>{const o=[...e.commandPath??[],e.name].join(" "),i=(e.examples??[]).map(([a,s])=>({command:a??"",description:s??""})),t=(e.options??[]).map(a=>({defaultValue:a.defaultValue,description:a.description,name:a.name,type:O(a.type)}));return{argument:e.argument?{description:e.argument.description,name:e.argument.name}:void 0,description:e.description??"",examples:i,name:e.name,options:t,path:o}},"buildSubcommand"),g=u((e,o=f)=>({command:o.command,description:o.description,subcommands:e.map(i=>A(i))}),"buildDiscoveryPayload"),J=u((e,o=f)=>`${JSON.stringify(g(e,o),void 0,2)}
|
|
2
|
+
`,"renderDiscoveryJson"),T=u((e,o=f)=>{const i=g(e,o),t=[I(`vis ${i.command} — ${i.description}`),"",d("Subcommands:")];for(const a of i.subcommands){const s=a.argument?` ${R(`<${a.argument.name}>`)}`:"";if(t.push(""),t.push(` ${j(`vis ${a.path}`)}${s}`),a.description&&t.push(` ${a.description}`),a.options.length>0){const n=a.options.map(c=>`--${c.name}${c.type==="boolean"?"":`=<${c.type}>`}`).join(", ");t.push(d(` options: ${n}`))}if(a.examples.length>0){t.push(d(" examples:"));for(const n of a.examples){const c=n.description?d(` — ${n.description}`):"";t.push(` ${N(n.command)}${c}`)}}}return t.push(""),t.push(d(`Run \`vis ${i.command} discover-help\` for the machine-readable JSON catalogue (designed for AI agents).`)),t.push(d(`Run \`vis ${i.command} <subcommand> --help\` for full usage of a specific subcommand.`)),`${t.join(`
|
|
3
|
+
`)}
|
|
4
|
+
`},"renderDiscoveryText");var F=Object.defineProperty,p=l((e,o)=>F(e,"name",{value:o,configurable:!0}),"r");const y=p(async()=>{const{default:e}=await import("./bin.js").then(o=>o.c6);return e.filter(o=>o.name!=="ai")},"loadDiscoverableSubcommands"),q=p(async()=>{const e=await y();process.stderr.write(T(e))},"aiRootExecute"),B=p(async()=>{const e=await y();process.stdout.write(J(e))},"aiDiscoverHelpExecute"),K=p(async({logger:e,visConfig:o})=>{const i=o?.ai,t=h(i);if(!t){e.error("No AI provider available to test."),process.exitCode=1;return}e.info(`Testing ${t.name}...`);try{const a=await E(t,"Reply with exactly: OK",{timeoutMs:3e4});e.info(`Provider ${t.name} responded: ${a.stdout.trim().slice(0,200)}`)}catch(a){const s=a instanceof Error?a.message:String(a);e.error(`Provider ${t.name} failed: ${s}`),process.exitCode=1}},"aiTestExecute"),L=p(({logger:e,options:o,visConfig:i})=>{const t=o.format??"table",a=i?.ai,s=S(),n=h(a);if(t==="json"){const r=s.map(m=>({available:m.available,method:m.detectionMethod,name:m.name,path:m.path,priority:v[m.name]??0,selected:m.name===n?.name,version:m.version}));process.stdout.write(`${JSON.stringify(r,void 0,2)}
|
|
5
|
+
`);return}const c=s.map(r=>({method:r.detectionMethod??"-",path:r.path??"-",priority:String(v[r.name]??0),provider:r.name,selected:r.name===n?.name?">>>":"",status:r.available?"available":"not found",version:r.version??"-"})),$=process.stdout.columns||80,b=w(D.createElement(P,{data:c}),{columns:$});e.info(b),n?e.info(`
|
|
6
|
+
Selected provider: ${n.name} (priority ${String(v[n.name]??0)})`):e.info(`
|
|
7
|
+
No AI provider available. Install one of the supported AI CLI tools.`)},"aiProvidersExecute"),_=p(async e=>{const{aiFix:o}=await import("./fix.js");await o(e)},"aiFixExecute");export{B as aiDiscoverHelpExecute,_ as aiFixExecute,L as aiProvidersExecute,q as aiRootExecute,K as aiTestExecute};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
`);const o=await
|
|
3
|
-
`);const o=r.replace(J,""),i=(await z([{name:e,version:o}])).get(e);i&&i.length>0&&(g.vulnerabilities=i);const s=
|
|
4
|
-
`):t.info(q(h))},"execute");export{
|
|
1
|
+
var R=Object.defineProperty;var $=(n,t)=>R(n,"name",{value:t,configurable:!0});import{T as P,a as T,N as x,b,K as j,_ as S,v as z,c as A,f as M}from"./bin.js";import{H as O,e as U,Z as q}from"../packem_shared/ai-analysis-KP8b5lc0.js";var F=Object.defineProperty,H=$((n,t)=>F(n,"name",{value:t,configurable:!0}),"x");const J=/^[\^~>=<]+/,Z=H(async({argument:n,logger:t,options:l,visConfig:u,workspaceRoot:f})=>{if(!f)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const m=n,e=m[0];if(!e)throw new Error("Package name is required. Usage: vis analyze <package> [version]");const p=m[1],{packageManager:E}=P(f);let r,d="default";const C=T(f,E);for(const[o,i]of C){const s=i.get(e);if(s){r=s,d=o;break}}if(!r)throw new Error(`Package "${e}" not found in any catalog or package.json. Make sure it exists in your workspace dependencies.`);let a;if(p)a=p;else{t.info(`Fetching latest version for ${e}...
|
|
2
|
+
`);const o=await x(e);if(!o.latest)throw new Error(`Could not determine latest version for "${e}".`);a=o.latest}const w=b(r),v=b(a);if(!w||!v)throw new Error(`Could not parse versions: current="${r}", target="${a}".`);const k=j(w,v);if(k==="none"){t.info(`${e} is already at ${a}. Nothing to analyze.`);return}const N=S(r),g={catalogName:d,currentRange:r,newRange:`${N}${a}`,packageName:e,targetVersion:a,updateType:k},y=O(l.aiType??"impact");if(y==="security"||l.security){t.info(`Checking for known vulnerabilities...
|
|
3
|
+
`);const o=r.replace(J,""),i=(await z([{name:e,version:o}])).get(e);i&&i.length>0&&(g.vulnerabilities=i);const s=A(u?.security,{minimumScore:u?.security?.policies?.score?.minimum});if(s.length>0){const c=(await M(s,[{name:e,version:o}])).get(`${e}@${o}`);c&&(g.socketReport={alerts:c.alerts,license:c.license,score:c.score})}}const h=await U([g],t,u?.ai,y);(l.format??"table")==="json"?process.stdout.write(`${JSON.stringify(h,void 0,2)}
|
|
4
|
+
`):t.info(q(h))},"execute");export{Z as default};
|
|
@@ -1,7 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var R=Object.defineProperty;var k=(n,t)=>R(n,"name",{value:t,configurable:!0});import{createRequire as O}from"node:module";import{i as V,$ as q}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{j as B,q as v}from"./config.js";import{p as e}from"./bin.js";import{A as E}from"../packem_shared/pm-runner-Ta_yz2uP.js";import{x as M}from"../packem_shared/build-scripts-D-ysm_bS.js";import{N as F}from"../packem_shared/native-config-sync-CgRIIRZV.js";const T=O(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=k(n=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[t,i]=$.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return $.getBuiltinModule(n)}return T(n)},"__cjs_getBuiltinModule"),{spawnSync:D}=A("node:child_process");var W=Object.defineProperty,x=k((n,t)=>W(n,"name",{value:t,configurable:!0}),"$$1");const z=/(defineConfig\s*\(\s*\{)/,J=/(export\s+default\s+\{)/,w=x((n,t)=>`${t}${JSON.stringify(n)}: true,`,"renderEntry"),G=x((n,t)=>{if(t.length===0)return{added:[],skipped:[],status:"noop"};const i=B(n);if(!i)return{added:[],skipped:t,status:"no-config"};if(!V(i))return{added:[],skipped:t,status:"no-config"};const s=q(i),h=s.search(/installScripts\s*:\s*\{/);let p=null,c=0;if(h!==-1){const a=s.slice(h),d=/(allow\s*:\s*\{)([^}]*)(\})/.exec(a);d?.index!==void 0&&(p=d,c=h+d.index)}if(p){const a=p[2]??"",d=new Set;for(const g of a.matchAll(/["']([^"']+)["']\s*:/g))d.add(g[1]);for(const g of a.matchAll(/(?:^|,|\{)\s*([a-z_$][\w-]*)\s*:/gi))d.add(g[1]);const f=[],S=[];for(const g of t)d.has(g)?S.push(g):f.push(g);if(f.length===0)return{added:[],configPath:i,skipped:S,status:"noop"};const _=/\n([ \t]+)\S/.exec(a)?.[1]??" ",P=`
|
|
2
|
+
${f.map(g=>w(g,_)).join(`
|
|
3
|
+
`)}`,y=a.replace(/\s+$/,""),b=a.slice(y.length),N=`${y}${y.endsWith(",")||y===""?"":","}${P}${b.length>0?b:`
|
|
4
|
+
`}`,C=`${s.slice(0,c)}${p[1]}${N}${p[3]}${s.slice(c+p[0].length)}`;return v(i,C),{added:f,configPath:i,skipped:S,status:"updated"}}const o=/(installScripts\s*:\s*\{)/;if(o.test(s)){const a=`
|
|
5
|
+
allow: {
|
|
6
|
+
${t.map(f=>w(f," ")).join(`
|
|
3
7
|
`)}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
},`,d=s.replace(o,`$1${a}`);return v(i,d),{added:t,configPath:i,skipped:[],status:"updated"}}const r=/(policies\s*:\s*\{)/;if(r.test(s)){const a=`
|
|
9
|
+
installScripts: {
|
|
10
|
+
allow: {
|
|
11
|
+
${t.map(f=>w(f," ")).join(`
|
|
12
|
+
`)}
|
|
13
|
+
},
|
|
14
|
+
},`,d=s.replace(r,`$1${a}`);return v(i,d),{added:t,configPath:i,skipped:[],status:"updated"}}const u=/(security\s*:\s*\{)/;if(u.test(s)){const a=`
|
|
15
|
+
policies: {
|
|
16
|
+
installScripts: {
|
|
17
|
+
allow: {
|
|
18
|
+
${t.map(f=>w(f," ")).join(`
|
|
19
|
+
`)}
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},`,d=s.replace(u,`$1${a}`);return v(i,d),{added:t,configPath:i,skipped:[],status:"updated"}}const l=z.exec(s)??J.exec(s);if(!l)return{added:[],configPath:i,skipped:t,status:"missing-anchor"};const m=`
|
|
23
|
+
security: {
|
|
24
|
+
policies: {
|
|
25
|
+
installScripts: {
|
|
26
|
+
allow: {
|
|
27
|
+
${t.map(a=>w(a," ")).join(`
|
|
28
|
+
`)}
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},`,j=`${s.slice(0,l.index+l[0].length)}${m}${s.slice(l.index+l[0].length)}`;return v(i,j),{added:t,configPath:i,skipped:[],status:"updated"}},"writeApprovedBuildsToVisConfig");var H=Object.defineProperty,I=k((n,t)=>H(n,"name",{value:t,configurable:!0}),"d");const te=I(async({options:n,visConfig:t,workspaceRoot:i})=>{const s=i??process.cwd(),h=E(s);if(h.name==="pnpm"&&!n.scan){e.info("Delegating to pnpm approve-builds...");const p=["approve-builds"];n.all&&p.push("--all");const c=D("pnpm",p,{cwd:s,stdio:"inherit"});if(c.error)throw new Error(`Failed to run pnpm approve-builds: ${c.error.message}`);if(c.status!==0&&c.status!==null&&(e.error(`pnpm approve-builds exited with code ${c.status}`),process.exitCode=c.status),!n.syncNative){e.notice(""),e.notice("Tip: vis.config.ts security.policies.installScripts.allow may now be out of sync with pnpm-workspace.yaml."),e.notice("Run 'vis check --security-config' to compare, or copy the new entries into vis.config.ts.");return}}else{const p=t?.security?.policies?.installScripts?.allow??{},c=t?.security?.pinVersions===!0,o=M(s,p,{pinVersions:c});if(o.unapproved.length===0)e.success("No unapproved build scripts found."),n.write&&(e.info(""),e.info("Nothing to write — there are no unapproved build scripts."));else{e.warn(`Found ${o.unapproved.length} package${o.unapproved.length===1?"":"s"} with unapproved build scripts:
|
|
33
|
+
`);for(const r of o.unapproved)e.info(` ${r.name} (${r.hooks.join(", ")})`);e.notice(""),e.notice("To approve these packages, add them to vis.config.ts:"),e.notice(""),e.notice(" security: {"),e.notice(" policies: {"),e.notice(" installScripts: {"),e.notice(" allow: {");for(const r of o.unapproved){const u=c&&r.version?`${r.name}@${r.version}`:r.name;e.notice(` "${u}": true,`)}if(e.notice(" },"),e.notice(" },"),e.notice(" },"),e.notice(" },"),h.name==="pnpm"&&(e.notice(""),e.notice("Or run 'pnpm approve-builds' to update pnpm-workspace.yaml directly.")),n.write){const r=t?.security?.pinVersions===!0,u=o.unapproved.map(m=>r&&m.version?`${m.name}@${m.version}`:m.name),l=G(s,u);switch(e.info(""),l.status){case"missing-anchor":{e.warn(`Could not locate 'defineConfig({' or 'export default {' in ${String(l.configPath)} — please add entries manually.`);break}case"no-config":{e.warn("No vis.config.ts found. Run 'vis init' first, then re-run with --write.");break}case"noop":{e.info(`All ${String(u.length)} entr${u.length===1?"y":"ies"} were already present in vis.config.ts security.policies.installScripts.allow.`);break}default:e.success(`Wrote ${String(l.added.length)} entr${l.added.length===1?"y":"ies"} to ${String(l.configPath)}.`),l.skipped.length>0&&e.info(`Skipped ${String(l.skipped.length)} already-present entr${l.skipped.length===1?"y":"ies"}.`)}}}if(o.excess.length>0){e.notice(""),e.warn(`Stale installScripts.allow entries — ${String(o.excess.length)} pattern${o.excess.length===1?"":"s"} no longer match any installed package:`);for(const r of o.excess)e.info(` ${r}`);e.notice("Consider removing these entries from vis.config.ts security.policies.installScripts.allow.")}if(o.versionDrift.length>0){e.notice(""),e.warn(`Version drift — ${String(o.versionDrift.length)} entr${o.versionDrift.length===1?"y":"ies"} pinned to an outdated version:`);for(const{from:r,to:u}of o.versionDrift)e.info(` ${r} → ${u}`);e.notice("Rename the keys in vis.config.ts security.policies.installScripts.allow to migrate.")}}if(n.syncNative){const p=t?.security?.policies?.installScripts?.allow??{};if(Object.keys(p).length===0)e.warn("No security.policies.installScripts.allow configured in vis.config.ts. Nothing to sync.");else{const c=F(h.name,s,p);e.info("");for(const o of c)e.success(o)}}},"execute");export{te as default};
|
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
`)}
|
|
4
|
-
`}`,C=`${i.slice(0,c)}${p[1]}${N}${p[3]}${i.slice(c+p[0].length)}`;return v(s,C),{added:f,configPath:s,skipped:S,status:"updated"}}const o=/(installScripts\s*:\s*\{)/;if(o.test(i)){const a=`
|
|
5
|
-
allow: {
|
|
6
|
-
${t.map(f=>w(f," ")).join(`
|
|
7
|
-
`)}
|
|
8
|
-
},`,d=i.replace(o,`$1${a}`);return v(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const r=/(policies\s*:\s*\{)/;if(r.test(i)){const a=`
|
|
9
|
-
installScripts: {
|
|
10
|
-
allow: {
|
|
11
|
-
${t.map(f=>w(f," ")).join(`
|
|
12
|
-
`)}
|
|
13
|
-
},
|
|
14
|
-
},`,d=i.replace(r,`$1${a}`);return v(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const u=/(security\s*:\s*\{)/;if(u.test(i)){const a=`
|
|
15
|
-
policies: {
|
|
16
|
-
installScripts: {
|
|
17
|
-
allow: {
|
|
18
|
-
${t.map(f=>w(f," ")).join(`
|
|
19
|
-
`)}
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},`,d=i.replace(u,`$1${a}`);return v(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const l=z.exec(i)??J.exec(i);if(!l)return{added:[],configPath:s,skipped:t,status:"missing-anchor"};const m=`
|
|
23
|
-
security: {
|
|
24
|
-
policies: {
|
|
25
|
-
installScripts: {
|
|
26
|
-
allow: {
|
|
27
|
-
${t.map(a=>w(a," ")).join(`
|
|
28
|
-
`)}
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},`,j=`${i.slice(0,l.index+l[0].length)}${m}${i.slice(l.index+l[0].length)}`;return v(s,j),{added:t,configPath:s,skipped:[],status:"updated"}},"writeApprovedBuildsToVisConfig");var H=Object.defineProperty,I=k((n,t)=>H(n,"name",{value:t,configurable:!0}),"d");const te=I(async({options:n,visConfig:t,workspaceRoot:s})=>{const i=s??process.cwd(),h=E(i);if(h.name==="pnpm"&&!n.scan){e.info("Delegating to pnpm approve-builds...");const p=["approve-builds"];n.all&&p.push("--all");const c=B("pnpm",p,{cwd:i,stdio:"inherit"});if(c.error)throw new Error(`Failed to run pnpm approve-builds: ${c.error.message}`);if(c.status!==0&&c.status!==null&&(e.error(`pnpm approve-builds exited with code ${c.status}`),process.exitCode=c.status),!n.syncNative){e.notice(""),e.notice("Tip: vis.config.ts security.policies.installScripts.allow may now be out of sync with pnpm-workspace.yaml."),e.notice("Run 'vis check --security-config' to compare, or copy the new entries into vis.config.ts.");return}}else{const p=t?.security?.policies?.installScripts?.allow??{},c=t?.security?.pinVersions===!0,o=M(i,p,{pinVersions:c});if(o.unapproved.length===0)e.success("No unapproved build scripts found."),n.write&&(e.info(""),e.info("Nothing to write — there are no unapproved build scripts."));else{e.warn(`Found ${o.unapproved.length} package${o.unapproved.length===1?"":"s"} with unapproved build scripts:
|
|
33
|
-
`);for(const r of o.unapproved)e.info(` ${r.name} (${r.hooks.join(", ")})`);e.notice(""),e.notice("To approve these packages, add them to vis.config.ts:"),e.notice(""),e.notice(" security: {"),e.notice(" policies: {"),e.notice(" installScripts: {"),e.notice(" allow: {");for(const r of o.unapproved){const u=c&&r.version?`${r.name}@${r.version}`:r.name;e.notice(` "${u}": true,`)}if(e.notice(" },"),e.notice(" },"),e.notice(" },"),e.notice(" },"),h.name==="pnpm"&&(e.notice(""),e.notice("Or run 'pnpm approve-builds' to update pnpm-workspace.yaml directly.")),n.write){const r=t?.security?.pinVersions===!0,u=o.unapproved.map(m=>r&&m.version?`${m.name}@${m.version}`:m.name),l=G(i,u);switch(e.info(""),l.status){case"missing-anchor":{e.warn(`Could not locate 'defineConfig({' or 'export default {' in ${String(l.configPath)} — please add entries manually.`);break}case"no-config":{e.warn("No vis.config.ts found. Run 'vis init' first, then re-run with --write.");break}case"noop":{e.info(`All ${String(u.length)} entr${u.length===1?"y":"ies"} were already present in vis.config.ts security.policies.installScripts.allow.`);break}default:e.success(`Wrote ${String(l.added.length)} entr${l.added.length===1?"y":"ies"} to ${String(l.configPath)}.`),l.skipped.length>0&&e.info(`Skipped ${String(l.skipped.length)} already-present entr${l.skipped.length===1?"y":"ies"}.`)}}}if(o.excess.length>0){e.notice(""),e.warn(`Stale installScripts.allow entries — ${String(o.excess.length)} pattern${o.excess.length===1?"":"s"} no longer match any installed package:`);for(const r of o.excess)e.info(` ${r}`);e.notice("Consider removing these entries from vis.config.ts security.policies.installScripts.allow.")}if(o.versionDrift.length>0){e.notice(""),e.warn(`Version drift — ${String(o.versionDrift.length)} entr${o.versionDrift.length===1?"y":"ies"} pinned to an outdated version:`);for(const{from:r,to:u}of o.versionDrift)e.info(` ${r} → ${u}`);e.notice("Rename the keys in vis.config.ts security.policies.installScripts.allow to migrate.")}}if(n.syncNative){const p=t?.security?.policies?.installScripts?.allow??{};if(Object.keys(p).length===0)e.warn("No security.policies.installScripts.allow configured in vis.config.ts. Nothing to sync.");else{const c=F(h.name,i,p);e.info("");for(const o of c)e.success(o)}}},"execute");export{te as default};
|
|
1
|
+
var I=Object.defineProperty;var w=(e,t)=>I(e,"name",{value:t,configurable:!0});import{createRequire as D}from"node:module";import{getAffectedProjects as G}from"@visulima/task-runner";import{C as q,S as L}from"./bin.js";const T=D(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,C=w(e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,r]=h.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return h.getBuiltinModule(e)}return T(e)},"__cjs_getBuiltinModule"),{execFile:N}=C("node:child_process"),{promisify:U}=C("node:util");var V=Object.defineProperty,i=w((e,t)=>V(e,"name",{value:t,configurable:!0}),"t");const A=U(N),J=["[skip ci]","[ci skip]","[no ci]","[vis skip]","[nx skip]"],z=["[vis deploy]","[nx deploy]"],W=["vis","nx"],Z=["CACHED_COMMIT_REF","VERCEL_GIT_PREVIOUS_SHA","GITHUB_BASE_REF","CI_COMMIT_BEFORE_SHA"],K=/^[\w./~^@{}][\w.\-/~^@{}]*$/,Q=i((e=process.env)=>{for(const t of Z){const r=e[t];if(r&&r.trim().length>0)return r.trim()}},"resolveCiBaseSha"),S=i(e=>{if(!K.test(e))throw new Error(`Invalid git ref: "${e}". Refs must start with an alphanumeric character or one of _ . / ~ ^ @ { } and may only contain letters, digits, dots, dashes, underscores, slashes, tildes, carets, @, and braces.`)},"validateGitRef"),X=i(async(e,t)=>{try{return await A("git",["rev-parse","--verify",`${t}^{commit}`],{cwd:e}),!0}catch{return!1}},"isRefReachable"),Y=i(async e=>{try{const{stdout:t}=await A("git",["log","-1","--pretty=%B"],{cwd:e});return t}catch{return""}},"readLastCommitMessage"),M=i((e,t,r)=>W.some(a=>e.includes(`[${a} ${t} ${r}]`)),"matchesPerProjectToken"),ee=i((e,t)=>J.some(r=>e.includes(r))||M(e,"skip",t),"commitHasSkipMessage"),te=i((e,t)=>z.some(r=>e.includes(r))||M(e,"deploy",t),"commitHasForceDeployMessage"),l=i((e,t,r,a)=>({action:"build",message:r,project:e,reason:t,...a}),"decideBuild"),k=i((e,t,r,a)=>({action:"skip",message:r,project:e,reason:t,...a}),"decideSkip"),re=i(e=>`${e.action==="skip"?"🛑":"✅"} ${e.message}`,"formatDecisionLine"),oe=i((e,t)=>e.action==="skip"||t?0:1,"exitCodeFor");var se=Object.defineProperty,_=w((e,t)=>se(e,"name",{value:t,configurable:!0}),"u");const R=new Set(["deep","direct","none"]),de=_(async({argument:e,logger:t,options:r,visConfig:a,workspaceRoot:p})=>{const o=e[0]??"",E=!!r.json,B=!!r.verbose,O=!!(r["exit-zero-on-build"]??r.exitZeroOnBuild),u=_(s=>{B&&!E&&t.info(`❱ ${s}`)},"debug"),n=_(s=>{E?process.stdout.write(`${JSON.stringify(s)}
|
|
2
|
+
`):t.info(re(s)),process.exit(oe(s,O))},"emit");if(!o)return n(l("","missing-project-argument","Missing project argument. Usage: vis ci ignore <project>"));if(!p)return n(l(o,"workspace-error","Could not determine workspace root — building defensively"));const g=await Y(p),y=g.trim().split(`
|
|
3
|
+
`)[0]??"";if(u(`commit: ${y}`),g&&te(g,o))return n(l(o,"commit-force-deploy",`Force-deploy keyword in commit: "${y}"`));if(g&&ee(g,o))return n(k(o,"commit-skip",`Skip keyword in commit: "${y}"`));let $,P;try{({packageJsons:P,workspace:$}=q(p,a))}catch(s){const d=s instanceof Error?s.message:String(s);return n(l(o,"workspace-error",`Workspace discovery failed (${d}) — building defensively`))}if(!Object.hasOwn($.projects,o))return n(l(o,"project-unknown",`Project "${o}" not found in workspace — building defensively`));try{const s=r.base?.trim(),d=Q();let c=s||d||"HEAD~1";const m=r.head?.trim()||"HEAD";S(c),S(m),u(`resolved base ref: ${c} (source: ${s?"flag":d?"ci-env":"default"})`);const x=X(p,c),F=L(p,$,P);await x||(u(`base ref ${c} not reachable — falling back to HEAD~1`),c="HEAD~1"),u(`comparing ${c}...${m}`);const j=r.downstream??"deep",b=r.upstream??"none";if(!R.has(j))throw new Error(`Invalid --downstream value: "${j}". Must be "none", "direct", or "deep".`);if(!R.has(b))throw new Error(`Invalid --upstream value: "${b}". Must be "none", "direct", or "deep".`);const H={base:c,downstream:j,head:m,projectGraph:F,projects:$.projects,upstream:b,workspaceRoot:p},f=await G(H);u(`changed files: ${f.changedFiles.length}`),u(`affected projects: ${f.affectedProjects.join(", ")||"(none)"}`);const v={base:c,head:m};return f.changedFiles.length===0?n(k(o,"no-changes",`No files changed between ${c}...${m}`,{...v,affectedProjects:[]})):f.affectedProjects.includes(o)?n(l(o,"project-affected",`Build ${o}: affected by ${f.changedFiles.length} changed file(s)`,{...v,affectedProjects:f.affectedProjects})):n(k(o,"project-not-affected",`Skip ${o}: not affected by changes between ${c}...${m}`,{...v,affectedProjects:f.affectedProjects}))}catch(s){const d=s instanceof Error?s.message:String(s);return t.error(`Affected detection failed: ${d}`),n(l(o,"workspace-error",`Affected detection failed (${d}) — building defensively`))}},"execute");export{de as default};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)
|
|
3
|
-
|
|
1
|
+
var m=Object.defineProperty;var g=(e,t)=>m(e,"name",{value:t,configurable:!0});import{E as v}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{M as w}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";var $=Object.defineProperty,u=g((e,t)=>$(e,"name",{value:t,configurable:!0}),"c");const h={docker:".dockerignore",npm:".npmignore",slug:".slugignore",vercel:".vercelignore"},E=[".git",".gitattributes",".gitignore",".editorconfig",".vscode/",".idea/",".DS_Store","*.md","LICENSE*","LICENCE*","CHANGELOG*","CONTRIBUTING*","AUTHORS*","docs/","doc/","examples/","example/",".github/",".gitlab-ci.yml",".circleci/","appveyor.yml",".eslintrc*","eslint.config.*",".prettierrc*","prettier.config.*","*.log","npm-debug.log*","*.d.ts","*.map","*.flow","tsconfig*.json","__tests__/","__mocks__/","test/","tests/","*.test.*","*.spec.*","coverage/",".nyc_output/"],_={docker:["node_modules",".vis/","Dockerfile*",".dockerignore"],npm:[],slug:["node_modules"],vercel:["node_modules",".vercel/"]},y=u(e=>{const t=new Set,o=[];for(const r of[...E,..._[e]])t.has(r)||(t.add(r),o.push(r));return o},"buildIgnorePatterns"),I=u(e=>e.trim(),"normalizeLine"),b="# Added by vis ignore",k=u((e,t)=>{const o=new Set;for(const n of e.split(/\r?\n/u)){const c=I(n);c!==""&&!c.startsWith("#")&&o.add(c)}const r=[];for(const n of t)o.has(n)||(o.add(n),r.push(n));if(r.length===0)return{added:r,content:e};const s=e.includes(`\r
|
|
2
|
+
`)?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`,d=[b,...r].join(s);if(e.trim()==="")return{added:r,content:`${d}${s}`};const i=e.endsWith(`
|
|
5
|
+
`)?s:`${s}${s}`;return{added:r,content:`${e}${i}${d}${s}`}},"mergeIgnore");var N=Object.defineProperty,p=g((e,t)=>N(e,"name",{value:t,configurable:!0}),"s");const S=p(e=>e==="docker"||e==="npm"||e==="slug"||e==="vercel","isIgnoreTarget"),O=p(async(e,t)=>{try{return await e.readFile(t,"utf8")}catch{return""}},"readExisting"),C=p(async({fs:e,logger:t,options:o,process:r,workspaceRoot:s})=>{const d=s??r.cwd,i=o.target??"docker";if(!S(i))throw new Error(`Invalid --target "${i}". Expected one of: docker, vercel, npm, slug.`);const n=h[i],c=w(d,n),f=await O(e,c),{added:a,content:l}=k(f,y(i));if(o.json){process.stdout.write(`${JSON.stringify({added:a,file:n,target:i},null,2)}
|
|
6
|
+
`);return}if(o.write){if(a.length===0){t.info(`${n} is already up to date (no new patterns).`);return}await e.writeFile(c,l),t.info(`Added ${a.length} pattern(s) to ${n}.`);return}process.stdout.write(l.endsWith(`
|
|
7
|
+
`)?l:`${l}
|
|
8
|
+
`),t.info(v(`(${a.length} new pattern(s); re-run with --write to save ${n})`))},"execute");export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var J=Object.defineProperty;var T=(e,t)=>J(e,"name",{value:t,configurable:!0});import{z as S}from"../packem_shared/readFileSync-
|
|
1
|
+
var J=Object.defineProperty;var T=(e,t)=>J(e,"name",{value:t,configurable:!0});import{z as S}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{ag as q,C as b}from"./bin.js";import{f as $}from"../packem_shared/selectors-BU8aTRQm.js";import{o as L}from"../packem_shared/index-DH-5hsrC.js";var M=Object.defineProperty,I=T((e,t)=>M(e,"name",{value:t,configurable:!0}),"p");const D=I((e,t)=>{for(const f of t)if(L(f,e))return!0;return!1},"matchesAny"),z=I((e,t={})=>{const{depTypes:f,excludePatterns:l,externalOnly:y,includePatterns:d,internalOnly:j}=t;if(j&&y)return[];const u=f&&f.length>0?new Set(f):void 0,N=d&&d.length>0?d:void 0,O=l&&l.length>0?l:void 0,w=[];for(const m of e)j&&!m.isInternal||y&&m.isInternal||u&&!u.has(m.depType)||N&&(!m.packageName||!D(m.packageName,N))||O&&m.packageName&&D(m.packageName,O)||w.push(m);return w},"filterDepInstances");var B=Object.defineProperty,v=T((e,t)=>B(e,"name",{value:t,configurable:!0}),"y");const F=new Set(["json","ndjson","table"]),R=v(e=>{if(e===void 0)return"table";const t=e.toLowerCase();if(!F.has(t))throw new Error(`--format must be one of: table, json, ndjson (got "${e}")`);return t},"resolveFormat"),x=v((e,t)=>({depName:e.depName,depType:e.depType,isInternal:e.isInternal,packageDir:e.packageDir,packageJsonPath:S(t,e.packageJsonPath),packageName:e.packageName,specifier:e.specifier}),"toDepRecord"),P=new Set(["dependencies","devDependencies","optionalDependencies","overrides","peerDependencies","pnpm.overrides","resolutions"]),V=v(e=>{if(!e||e.length===0)return;const t=[],f=[];for(const l of e)for(const y of l.split(",")){const d=y.trim();d&&(P.has(d)?t.push(d):f.push(d))}if(f.length>0)throw new Error(`Unknown --dep-type value(s): ${f.join(", ")}. Valid: ${[...P].join(", ")}`);return t.length>0?t:void 0},"parseDepTypes"),H=v(async({logger:e,options:t,visConfig:f,workspaceRoot:l})=>{if(!l)throw new Error("Could not determine workspace root.");const y=R(t.format);if(t.deps===!0){if(t.internalOnly&&t.externalOnly)throw new Error("--internal-only and --external-only are mutually exclusive");const c=V(t.depType),i=q(l);let n=z(i,{depTypes:c,excludePatterns:t.exclude,externalOnly:t.externalOnly,includePatterns:t.include,internalOnly:t.internalOnly});if(t.query){const{workspace:r}=b(l,f),p=new Set($(Object.keys(r.projects),r,t.query));n=n.filter(k=>k.packageName!==void 0&&p.has(k.packageName))}const g=[...n].sort((r,p)=>{const k=`${r.packageName??r.packageDir} ${r.depType} ${r.depName}`,E=`${p.packageName??p.packageDir} ${p.depType} ${p.depName}`;return k.localeCompare(E)});if(y==="ndjson"){for(const r of g)e.info(JSON.stringify(x(r,l)));return}if(y==="json"){const r=g.map(p=>x(p,l));e.info(JSON.stringify(r,null,t.pretty===!0?2:void 0));return}if(g.length===0){e.info("No matching dep-instances.");return}const a=["Package","Block","Dep","Specifier","Internal","Path"],o=g.map(r=>[r.packageName??r.packageDir,r.depType,r.depName,r.specifier,r.isInternal?"yes":"no",S(l,r.packageJsonPath)]),s=a.map((r,p)=>Math.max(r.length,...o.map(k=>(k[p]??"").length))),h=v((r,p)=>r.padEnd(p),"pad");e.info(a.map((r,p)=>h(r,s[p])).join(" ")),e.info(s.map(r=>"─".repeat(r)).join("──"));for(const r of o)e.info(r.map((p,k)=>h(p,s[k])).join(" "));e.info(""),e.info(`${String(g.length)} dep-instance(s)`);return}if(y==="ndjson")throw new Error("--format=ndjson is only supported with --deps");const{projectOptions:d,workspace:j}=b(l,f);let u=Object.keys(j.projects).sort();if(t.query&&(u=$(u,j,t.query)),u.length===0){e.info("No projects found.");return}const N=t.inferred===!0,O=t.targets===!0||N;if(y==="json"){const c=u.map(i=>{const n=j.projects[i],g=d.get(i)??{},a=Object.entries(n.targets??{}).map(([o])=>{const s=g[o],h=s?.inferred===!0;return{aliases:s?.aliases??[],command:s?.command,description:s?.description,...h?{inferred:!0}:{},name:o,type:s?.type}}).filter(o=>!N||o.inferred===!0);return{language:n.language,layer:n.layer,name:i,root:n.root,stack:n.stack,tags:n.tags??[],targets:a,type:n.projectType??"library"}});e.info(JSON.stringify(c,null,2));return}const w=v((c,i)=>{const n=c.map((a,o)=>{let s=0;for(const h of i)s=Math.max(s,(h[o]??"").length);return Math.max(a.length,s)}),g=v((a,o)=>a.padEnd(o),"pad");e.info(c.map((a,o)=>g(a,n[o])).join(" ")),e.info(n.map(a=>"─".repeat(a)).join("──"));for(const a of i)e.info(a.map((o,s)=>g(o,n[s])).join(" "))},"renderTable");if(O){const c=[];for(const i of u){const n=j.projects[i],g=d.get(i)??{};for(const a of Object.keys(n.targets??{}).sort()){const o=g[a],s=o?.inferred===!0;if(N&&!s)continue;const h=n.targets?.[a],r=h?.cache===!1?"no":h?.cache===!0?"yes":"default";c.push([i,a,o?.type??"—",r,s?"yes":"no",o?.description??"—"])}}if(c.length===0){e.info(N?"No inferred targets found.":"No targets found.");return}w(["Project","Target","Type","Cache","Inferred","Description"],c),e.info(""),e.info(`${String(c.length)} target(s) across ${String(u.length)} project(s)`);return}const m=["Project","Type","Layer","Tags","Targets"],C=u.map(c=>{const i=j.projects[c],n=Object.keys(i.targets??{});return[c,i.projectType??"library",i.layer??"—",(i.tags??[]).join(", ")||"—",n.length>4?`${n.slice(0,4).join(", ")}… (${String(n.length)})`:n.join(", ")||"—"]});w(m,C),e.info(""),e.info(`${String(u.length)} project(s)`)},"execute");export{H as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var F=Object.defineProperty;var R=(e,t)=>F(e,"name",{value:t,configurable:!0});import{createRequire as J}from"node:module";import{
|
|
1
|
+
var F=Object.defineProperty;var R=(e,t)=>F(e,"name",{value:t,configurable:!0});import{createRequire as J}from"node:module";import{r as L,an as Q,ao as I,ap as B,aq as K,ar as Y,as as g,at as H,au as U,av as X,aw as Z,ax as ee,ay as te,az as oe,aA as ne,aB as se,aC as ie,aD as re,aE as ae}from"./bin.js";import{i as $,$ as T,M as d,Q as pe}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{e as fe,q as A}from"./config.js";import{v as le}from"../packem_shared/verify-DA80ja1b.js";const G=J(import.meta.url),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,z=R(e=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[t,n]=E.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return E.getBuiltinModule(e)}return G(e)},"__cjs_getBuiltinModule"),{readdirSync:ce,statSync:ue}=z("node:fs"),{stdin:_,stdout:ge}=E,{createInterface:de}=z("node:readline/promises");var me=Object.defineProperty,p=R((e,t)=>me(e,"name",{value:t,configurable:!0}),"u");const x="__global__",b=p(e=>[...new Set(e)].sort((t,n)=>t.localeCompare(n)),"sortStrings"),ve=p(e=>`{${Object.keys(e).sort().map(t=>`${t}=${JSON.stringify(e[t])}`).join(",")}}`,"canonicalizeObjectToken"),h=p(e=>{if(!Array.isArray(e))return[];const t=[];for(const n of e)typeof n=="string"?t.push(n):n&&typeof n=="object"&&t.push(ve(n));return b(t)},"normalizeTokenList"),w=p(e=>({cache:void 0,dependsOn:[],env:[],id:e,inputs:[],outputs:[]}),"emptyNode"),k=p((e,t,n)=>n?`^${t}`:e&&e!=="self"&&e!=="~"?`${e}#${t}`:t,"canonicalEdge"),ye=p((e,t)=>{const n=e.trim();if(t==="moon"){if(n.startsWith("^:"))return k(void 0,n.slice(2),!0);if(n.startsWith("~:"))return k(void 0,n.slice(2),!1);if(n.includes(":")){const[s,o]=n.split(":");return k(s,o??"",!1)}return n}if(n.startsWith("^"))return k(void 0,n.slice(1),!0);if(n.includes("#")){const[s,o]=n.split("#");return k(s,o??"",!1)}return n},"normalizeStringEdge"),M=p((e,t)=>{if(!Array.isArray(e))return[];const n=[];for(const s of e){if(typeof s=="string"){n.push(ye(s,t));continue}if(!s||typeof s!="object")continue;const o=s,{target:i}=o;if(!i)continue;if(o.dependencies===!0){n.push(k(void 0,i,!0));continue}if(o.projects===void 0){n.push(k(void 0,i,!1));continue}const r=Array.isArray(o.projects)?o.projects:[o.projects];for(const c of r)n.push(c==="^"?k(void 0,i,!0):k(c,i,!1))}return b(n)},"normalizeDependsOn"),O=p(e=>{if($(e))try{return JSON.parse(T(e))}catch{return}},"readJson"),he=p(e=>{const t=new Map,n=O(d(e,"turbo.json"));if(!n)return t;const s=n.tasks??n.pipeline??{};for(const[i,r]of Object.entries(s)){const c=i.includes("#")?i:`*#${i}`,a=w(c);a.dependsOn=M(r.dependsOn,"turbo"),a.inputs=h(r.inputs),a.outputs=h(r.outputs),a.env=b([...r.env??[],...r.passThroughEnv??[]]),a.cache=r.cache===!1?!1:void 0,t.set(c,a)}const o=w(x);return o.inputs=h(n.globalDependencies),o.env=b([...n.globalEnv??[],...n.globalPassThroughEnv??[]]),(o.inputs.length>0||o.env.length>0)&&t.set(x,o),t},"parseTurboModel"),ke=new Set([".git",".nx",".turbo",".vis","build","coverage","dist","node_modules"]),N=p((e,t,n=8)=>{const s=[],o=p((i,r)=>{if(r>n)return;let c;try{c=ce(i)}catch{return}for(const a of c.toSorted()){if(a===t){s.push(d(i,a));continue}if(a.startsWith(".")&&a!==".moon"||ke.has(a))continue;const u=d(i,a);try{ue(u).isDirectory()&&o(u,r+1)}catch{}}},"walk");return o(e,0),s},"findFiles"),q=p((e,t)=>{e.dependsOn=M(t.dependsOn,"nx"),e.inputs=h(t.inputs),e.outputs=h(t.outputs),e.cache=typeof t.cache=="boolean"?t.cache:void 0},"applyNxTarget"),we=p(e=>{const t=new Map,n=O(d(e,"nx.json"));for(const[s,o]of Object.entries(n?.targetDefaults??{})){const i=`*#${s}`,r=w(i);q(r,o),t.set(i,r)}for(const s of N(e,"project.json")){const o=O(s);if(!(!o?.name||!o.targets))for(const[i,r]of Object.entries(o.targets)){const c=`${o.name}#${i}`,a=w(c);q(a,r),t.set(c,a)}}return t},"parseNxModel"),D=p((e,t)=>{e.dependsOn=M(t.deps,"moon"),e.inputs=h(t.inputs),e.outputs=h(t.outputs),e.cache=typeof t.options?.cache=="boolean"?t.options.cache:void 0},"applyMoonTask"),V=p(e=>{if($(e))try{return L(e)}catch{return}},"readMoonYaml"),$e=p(e=>{const t=new Map,n=d(e,".moon"),s=[d(n,"tasks.yml"),d(n,"tasks.yaml")];for(const o of s){const i=V(o);if(i){for(const[r,c]of Object.entries(i.tasks??{})){const a=`*#${r}`,u=w(a);D(u,c),t.set(a,u)}if(i.implicitInputs&&i.implicitInputs.length>0){const r=w(x);r.inputs=h(i.implicitInputs),t.set(x,r)}}}for(const o of[...N(e,"moon.yml"),...N(e,"moon.yaml")]){const i=V(o);if(!i?.tasks)continue;const r=o.split(/[/\\]/).at(-2)??"*";for(const[c,a]of Object.entries(i.tasks)){const u=`${r}#${c}`,y=w(u);D(y,a),t.set(u,y)}}return t},"parseMoonModel"),xe=p((e,t)=>{e.dependsOn=M(t.dependsOn,"vis"),e.inputs=h(t.inputs),e.outputs=h(t.outputs),e.env=b([...t.env??[],...t.passThroughEnv??[],...t.options?.passThroughEnv??[]]),e.cache=t.cache===!1?!1:typeof t.cache=="boolean"?t.cache:void 0},"applyVisTask"),be=p(async e=>{const t=new Map,n=await fe(e);for(const[i,r]of Object.entries(n.tasks??{})){const c=`*#${i}`,a=w(c);xe(a,r??{}),t.set(c,a)}const s=n.taskRunner??{},o=w(x);return o.inputs=h(s.globalInputs),o.env=b([...s.globalEnv??[],...s.globalPassThroughEnv??[]]),(o.inputs.length>0||o.env.length>0)&&t.set(x,o),t},"buildVisModel"),Re=p((e,t)=>{switch(t){case"moon":return $e(e);case"nx":return we(e);default:return he(e)}},"buildSourceModel"),Ee=p(e=>{const t=[];return $(d(e,"turbo.json"))&&t.push("turbo"),$(d(e,"nx.json"))&&t.push("nx"),($(d(e,".moon","tasks.yml"))||$(d(e,".moon","tasks.yaml")))&&t.push("moon"),t.length===1?t[0]:void 0},"detectSourceTool"),j=p((e,t,n,s,o)=>{const i=s.filter(a=>!o.includes(a)),r=o.filter(a=>!s.includes(a));if(i.length===0&&r.length===0)return;const c=[];i.length>0&&c.push(`dropped [${i.join(", ")}]`),r.length>0&&c.push(`added [${r.join(", ")}]`),e.push({axis:n,detail:`${n} diverged: ${c.join("; ")}`,node:t,severity:i.length>0?"error":"warning"})},"diffArrayAxis"),Ce=p((e,t,n)=>{const s=[],o=b([...e.keys(),...t.keys()]);for(const i of o){const r=e.get(i),c=t.get(i);if(r&&!c){const a=n==="turbo"&&i.includes("#")&&!i.startsWith("*#")&&i!==x;s.push({axis:"target-set",detail:a?`source target \`${i}\` was skipped by design (turbo project#task is migrated into per-project project.json — move it there and re-verify)`:`source target \`${i}\` has no equivalent in the migrated vis config`,node:i,severity:a?"warning":"error"});continue}if(!r&&c){s.push({axis:"target-set",detail:`migrated vis config defines \`${i}\` with no source equivalent (extra target — not a regression, but review)`,node:i,severity:"warning"});continue}!r||!c||(j(s,i,"dependsOn",r.dependsOn,c.dependsOn),j(s,i,"inputs",r.inputs,c.inputs),j(s,i,"outputs",r.outputs,c.outputs),j(s,i,"env",r.env,c.env),r.cache!==void 0&&c.cache!==void 0&&r.cache!==c.cache&&s.push({axis:"cache",detail:`cache flag diverged: source=${String(r.cache)} vis=${String(c.cache)} (changes what invalidates the cache)`,node:i,severity:"error"}))}return s.sort((i,r)=>i.node.localeCompare(r.node)||i.axis.localeCompare(r.axis)),{findings:s,source:n,sourceNodeCount:e.size,visNodeCount:t.size}},"diffModels"),Se=new Set(["json","ndjson","table"]),je=p(e=>({equivalent:e.findings.every(t=>t.severity!=="error"),findings:e.findings,source:e.source,sourceNodeCount:e.sourceNodeCount,visNodeCount:e.visNodeCount}),"toJsonPayload"),Me=p((e,t,n)=>{if(t==="json"){process.stdout.write(`${JSON.stringify(je(e),void 0,2)}
|
|
2
2
|
`);return}if(t==="ndjson"){for(const s of e.findings)process.stdout.write(`${JSON.stringify(s)}
|
|
3
|
-
`);return}if(n.info(`Migration equivalence: ${e.source} → vis`),n.info(` source nodes: ${String(e.sourceNodeCount)} vis nodes: ${String(e.visNodeCount)}`),e.findings.length===0){n.info(" ✓ task graph + cache-key surface preserved (no divergence).");return}for(const s of e.findings){const o=` [${s.severity}] ${s.node} (${s.axis}) — ${s.detail}`;s.severity==="error"?n.warn(o):n.info(o)}},"formatEquivalenceReport"),Te=p((e,t)=>e.findings.some(n=>t==="warning"?!0:n.severity==="error")?1:0,"equivalenceExitCode");var Oe=Object.defineProperty,Ne=R((e,t)=>Oe(e,"name",{value:t,configurable:!0}),"n");const W=Ne(async e=>{if(!
|
|
4
|
-
`)},"announceDryRun"),Je=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("deps",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating dependencies and scripts ──"),Y(o.root,o.packageManager,o.config,{dryRun:o.dryRun},e,o.report),e.info(""),g(o.report,e)},"migrateDepsExecuteImpl"),Ge=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("lint-staged",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating lint-staged ──"),H(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateLintStagedExecuteImpl"),Le=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("nano-staged",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating nano-staged ──"),U(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateNanoStagedExecuteImpl"),Qe=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("turborepo",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating turborepo ──"),X(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateTurborepoExecuteImpl"),Ke=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("nx",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating nx ──");const i=!!t.aggressive;Z(o.root,{aggressive:i,dryRun:o.dryRun,force:i||!!t.force,rewriteSyncGenerators:i||!!t.rewriteSyncGenerators,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateNxExecuteImpl"),Ye=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("moon",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating moon ──"),ee(o.root,{copyTemplates:!!t.copyTemplates,dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateMoonExecuteImpl"),He=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("gitleaks",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating gitleaks ──"),te(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateGitleaksExecuteImpl"),Ue=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("kingfisher",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating Kingfisher ──"),oe(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateKingfisherExecuteImpl"),Xe=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("secretlint",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating secretlint ──"),ne(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateSecretlintExecuteImpl"),Ze=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("syncpack",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating syncpack ──"),se(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateSyncpackExecuteImpl"),et=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("sherif",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating sherif ──"),ie(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateSherifExecuteImpl"),tt=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("self",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating vis.config.ts to current schema ──"),We(o.root,{dryRun:o.dryRun},e,o.report),e.info(""),g(o.report,e)},"migrateSelfExecuteImpl"),ot=f(({logger:e,workspaceRoot:t})=>{const n=t??process.cwd();le(n,e).length>0&&(process.exitCode=1)},"migrateVerifyExecuteImpl"),nt=f(async({logger:e,options:t,workspaceRoot:n})=>{const s=n??process.cwd(),o=t.format??"table";if(!
|
|
5
|
-
`);const a=B(),u=[];for(const y of r)try{if(e.info(`── Applying ${y.title} ──`),c)for(const
|
|
3
|
+
`);return}if(n.info(`Migration equivalence: ${e.source} → vis`),n.info(` source nodes: ${String(e.sourceNodeCount)} vis nodes: ${String(e.visNodeCount)}`),e.findings.length===0){n.info(" ✓ task graph + cache-key surface preserved (no divergence).");return}for(const s of e.findings){const o=` [${s.severity}] ${s.node} (${s.axis}) — ${s.detail}`;s.severity==="error"?n.warn(o):n.info(o)}},"formatEquivalenceReport"),Te=p((e,t)=>e.findings.some(n=>t==="warning"?!0:n.severity==="error")?1:0,"equivalenceExitCode");var Oe=Object.defineProperty,Ne=R((e,t)=>Oe(e,"name",{value:t,configurable:!0}),"n");const W=Ne(async e=>{if(!_.isTTY)return!0;const t=de({input:_,output:ge});try{const n=(await t.question(`${e} [Y/n] `)).trim().toLowerCase();return n===""||n==="y"||n==="yes"}finally{t.close()}},"confirm");var Ie=Object.defineProperty,C=R((e,t)=>Ie(e,"name",{value:t,configurable:!0}),"p");const Ae=[{description:"VisConfig.targetDefaults → VisConfig.tasks",next:"tasks",previous:"targetDefaults"},{description:"VisConfig.taskDefaults → VisConfig.scopedTasks",next:"scopedTasks",previous:"taskDefaults"},{description:"VisConfig.taskRunnerOptions → VisConfig.taskRunner",next:"taskRunner",previous:"taskRunnerOptions"},{description:"ScopedTasksBlock.scope → ScopedTasksBlock.match",next:"match",previous:"scope"},{description:"ScopedTasksBlock.targets → ScopedTasksBlock.tasks",next:"tasks",previous:"targets"}],_e=[{description:"VisTaskConfig.targets → VisTaskConfig.tasks",next:"tasks",previous:"targets"}],qe=C(e=>new RegExp(String.raw`(^|[\s,{(\[])(["']?)${e}\2(\s*:)`,"gmu"),"buildKeyRegex"),De=C((e,t)=>{let n=e;const s=[];for(const o of t){const i=qe(o.previous);i.test(n)&&(i.lastIndex=0,n=n.replace(i,(r,c,a,u)=>`${c}${a}${o.next}${a}${u}`),s.push(o))}return{applied:s,output:n}},"applyRenames"),P=C((e,t)=>De(e,t),"rewriteSource"),Ve=["vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],Pe=new Set(["vis.task.cjs","vis.task.cts","vis.task.js","vis.task.mjs","vis.task.mts","vis.task.ts"]),ze=C(e=>{for(const t of Ve){const n=d(e,t);if($(n))return n}},"findConfigFile"),Be=C(e=>{const t=[];try{for(const n of Q(e,{includeDirs:!1,includeFiles:!0,includeSymlinks:!1,skip:[/node_modules/,/\.git/,/\.vis\b/,/dist\b/,/\.next\b/,/\.nuxt\b/]}))Pe.has(pe(n.path))&&t.push(n.path)}catch{}return t},"findTaskConfigFiles"),We=C((e,t,n,s)=>{const o=ze(e);if(o){const r=T(o),{applied:c,output:a}=P(r,Ae);if(c.length===0)n.info(`${o} already uses the current schema — no rewrite needed.`);else if(t.dryRun)n.info(`── ${o} (preview) ──`),n.info(a),n.info("── end preview ──"),n.info(`Would apply ${String(c.length)} rename(s): ${c.map(u=>u.description).join(", ")}`);else{I(o,s),A(o,a),n.info(`Rewrote ${o} (backup at ${o}.bak). Applied ${String(c.length)} rename(s).`);for(const u of c)s.manualSteps.push(`Renamed ${u.description} in ${o}`)}}else n.warn("No vis.config.ts found at workspace root — nothing to migrate."),s.warnings.push("No vis.config.{ts,mts,cts,js,mjs,cjs} at workspace root.");const i=t.taskConfigPaths??Be(e);for(const r of i){if(!$(r))continue;const c=T(r),a=P(c,_e);if(a.applied.length!==0)if(t.dryRun)n.info(`── ${r} (preview) ──`),n.info(a.output),n.info("── end preview ──"),n.info(`Would apply ${String(a.applied.length)} rename(s): ${a.applied.map(u=>u.description).join(", ")}`);else{I(r,s),A(r,a.output),n.info(`Rewrote ${r} (backup at ${r}.bak). Applied ${String(a.applied.length)} rename(s).`);for(const u of a.applied)s.manualSteps.push(`Renamed ${u.description} in ${r}`)}}},"migrateSelf");var Fe=Object.defineProperty,f=R((e,t)=>Fe(e,"name",{value:t,configurable:!0}),"r");const l=f(e=>{const t=e.workspaceRoot??process.cwd(),n=e.visConfig??{};return{config:n,dryRun:!!e.options.dryRun,logger:e.logger,packageManager:K(t),report:B(),root:t,useEditorconfig:typeof n.editorconfig=="boolean"?n.editorconfig:!0}},"buildContext"),m=f(async(e,t,n)=>{if(t.yes||t.dryRun)return!0;const s=await W(`This will edit files, scripts, and hooks for "${e}". Backups (.bak) will be created. Continue?`);return s||n.info("Aborted."),s},"maybeConfirm"),v=f(e=>{e.dryRun&&e.logger.info(`Running in dry-run mode — no changes will be made.
|
|
4
|
+
`)},"announceDryRun"),Je=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("deps",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating dependencies and scripts ──"),Y(o.root,o.packageManager,o.config,{dryRun:o.dryRun},e,o.report),e.info(""),g(o.report,e)},"migrateDepsExecuteImpl"),Ge=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("lint-staged",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating lint-staged ──"),H(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateLintStagedExecuteImpl"),Le=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("nano-staged",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating nano-staged ──"),U(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateNanoStagedExecuteImpl"),Qe=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("turborepo",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating turborepo ──"),X(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateTurborepoExecuteImpl"),Ke=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("nx",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating nx ──");const i=!!t.aggressive;Z(o.root,{aggressive:i,dryRun:o.dryRun,force:i||!!t.force,rewriteSyncGenerators:i||!!t.rewriteSyncGenerators,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateNxExecuteImpl"),Ye=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("moon",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating moon ──"),ee(o.root,{copyTemplates:!!t.copyTemplates,dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateMoonExecuteImpl"),He=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("gitleaks",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating gitleaks ──"),te(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateGitleaksExecuteImpl"),Ue=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("kingfisher",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating Kingfisher ──"),oe(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateKingfisherExecuteImpl"),Xe=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("secretlint",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating secretlint ──"),ne(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateSecretlintExecuteImpl"),Ze=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("syncpack",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating syncpack ──"),se(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateSyncpackExecuteImpl"),et=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("sherif",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating sherif ──"),ie(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateSherifExecuteImpl"),tt=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("self",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating vis.config.ts to current schema ──"),We(o.root,{dryRun:o.dryRun},e,o.report),e.info(""),g(o.report,e)},"migrateSelfExecuteImpl"),ot=f(({logger:e,workspaceRoot:t})=>{const n=t??process.cwd();le(n,e).length>0&&(process.exitCode=1)},"migrateVerifyExecuteImpl"),nt=f(async({logger:e,options:t,workspaceRoot:n})=>{const s=n??process.cwd(),o=t.format??"table";if(!Se.has(o)){e.warn(`Invalid --format: ${String(t.format)}. Expected table | json | ndjson.`),process.exitCode=1;return}const i=t.failOn==="warning"?"warning":"error";let r;if(t.from){if(t.from!=="turbo"&&t.from!=="nx"&&t.from!=="moon"){e.warn(`Invalid --from: ${t.from}. Expected turbo | nx | moon.`),process.exitCode=1;return}r=t.from}else if(r=Ee(s),!r){e.warn("Could not auto-detect the source tool (need exactly one of turbo.json / nx.json / .moon/tasks.yml). Pass --from <turbo|nx|moon>."),process.exitCode=1;return}const c=Re(s,r);if(c.size===0){e.warn(`No ${r} task graph found at ${s} — nothing to verify.`),process.exitCode=1;return}const a=await be(s);if(a.size===0){e.warn("No migrated vis task graph found (vis.config.ts has no tasks). Run the migrator first."),process.exitCode=1;return}const u=Ce(c,a,r);Me(u,o,e),process.exitCode=Te(u,i)},"migrateVerifyGraphExecuteImpl"),st=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{const o=s??process.cwd(),i=re(o,n??{}),r=ae(i);if(r.length===0){e.info("No applicable migrations detected in this workspace.");return}const c=!!t.dryRun;e.info(`Detected ${String(r.length)} migration(s):`);for(const y of r)e.info(` • ${y.title} — ${y.description}`);if(e.info(""),!t.yes&&!c&&!await W("Apply all detected migrations? Backups (.bak) will be created.")){e.info("Aborted.");return}c&&e.info(`Running in dry-run mode — no changes will be made.
|
|
5
|
+
`);const a=B(),u=[];for(const y of r)try{if(e.info(`── Applying ${y.title} ──`),c)for(const S of y.probe(i))e.info(S);else y.apply(i,a,e);e.info("")}catch(S){u.push({error:S,id:y.id}),e.warn(`Failed to apply ${y.title}: ${S.message}`)}g(a,e),u.length>0&&(e.warn(""),e.warn(`${String(u.length)} migration(s) failed — see messages above.`),process.exitCode=1)},"migrateAllExecuteImpl"),ft=Je,gt=Ge,dt=Le,lt=Qe,mt=Ke,vt=Ye,yt=He,ht=Ue,kt=Xe,wt=Ze,$t=et,xt=tt,bt=ot,Rt=nt,Et=st;export{Et as migrateAllExecute,ft as migrateDepsExecute,yt as migrateGitleaksExecute,ht as migrateKingfisherExecute,gt as migrateLintStagedExecute,vt as migrateMoonExecute,dt as migrateNanoStagedExecute,mt as migrateNxExecute,kt as migrateSecretlintExecute,xt as migrateSelfExecute,$t as migrateSherifExecute,wt as migrateSyncpackExecute,lt as migrateTurborepoExecute,bt as migrateVerifyExecute,Rt as migrateVerifyGraphExecute};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)
|
|
3
|
-
`)
|
|
1
|
+
var X=Object.defineProperty;var w=(e,o)=>X(e,"name",{value:o,configurable:!0});import{createRequire as Q}from"node:module";import{q as S,E as m,j as R,e as F,T as H,I as E}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{M as b,a as M,i as ee}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{m as B,s as oe,C as q,S as te}from"./bin.js";import{d as ne}from"../packem_shared/lockfile-DAuTDwow.js";import{s as re,p as se}from"../packem_shared/docker-DxA80dRx.js";import{b as ue}from"./config.js";const Z=Q(import.meta.url),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=w(e=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[o,t]=x.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return x.getBuiltinModule(e)}return Z(e)},"__cjs_getBuiltinModule"),{createInterface:L}=N("node:readline"),{spawn:ie}=N("node:child_process"),{createHash:ae}=N("node:crypto"),{existsSync:V,writeFileSync:le,chmodSync:ce}=N("node:fs");var de=Object.defineProperty,$=w((e,o)=>de(e,"name",{value:o,configurable:!0}),"n$1");const C={aube:{base:["RUN corepack enable"],build:$(e=>e?`RUN aube run --filter ${e} build`:"RUN aube run build","build"),install:"RUN aube install --frozen-lockfile"},bun:{base:["RUN npm install -g bun"],build:$(e=>e?`RUN bun run --filter ${e} build`:"RUN bun run build","build"),install:"RUN --mount=type=cache,target=/root/.bun/install/cache bun install --frozen-lockfile"},npm:{base:[],build:$(e=>e?`RUN npm run build --workspace ${e}`:"RUN npm run build","build"),install:"RUN --mount=type=cache,target=/root/.npm npm ci"},pnpm:{base:["ENV PNPM_HOME=/pnpm","ENV PATH=$PNPM_HOME:$PATH","RUN corepack enable"],build:$(e=>e?`RUN pnpm --filter ${e} build`:"RUN pnpm build","build"),install:"RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile"},yarn:{base:["RUN corepack enable"],build:$(e=>e?`RUN yarn workspace ${e} build`:"RUN yarn build","build"),install:"RUN --mount=type=cache,target=/usr/local/share/.cache/yarn yarn install --immutable"}},fe=$(e=>{const{focus:o,manager:t,nodeVersion:r}=e,n=C[t]??C.npm;return["# syntax=docker/dockerfile:1","","# Generated by 'vis docker init'. Before building, scaffold the context:",`# vis docker scaffold${o?` --focus=${o}`:""} --include-sources`,"# then build with BuildKit enabled (DOCKER_BUILDKIT=1).","",`FROM node:${r}-slim AS base`,"WORKDIR /app",...n.base,"","# --- install dependencies from the scaffolded manifests only ---","FROM base AS deps","COPY .vis/docker/workspace/ ./",n.install,"","# --- build the focus project, then drop unfocused workspace projects ---","FROM deps AS build","COPY .vis/docker/sources/ ./",n.build(o),"RUN npx vis docker prune --context=.vis/docker","","# --- minimal runtime image ---",`FROM node:${r}-slim AS runtime`,"WORKDIR /app","ENV NODE_ENV=production","COPY --from=build /app ./","USER node","# TODO: point this at your app's entrypoint",'CMD ["node", "index.js"]',""].join(`
|
|
2
|
+
`)},"generateDockerfile");var pe=Object.defineProperty,g=w((e,o)=>pe(e,"name",{value:o,configurable:!0}),"i$1");const D="v2.14.0",U=`https://github.com/hadolint/hadolint/releases/download/${D}`,me=g((e=process.platform,o=process.arch)=>{const t=e==="darwin"?"macos":e==="linux"?"linux":e==="win32"?"windows":void 0;if(t===void 0)return;const r=o==="arm64"?"arm64":o==="x64"?"x86_64":void 0;if(t==="windows")return"hadolint-windows-x86_64.exe";if(r!==void 0)return`hadolint-${t}-${r}`},"resolveHadolintAsset"),K=g(e=>b(B(),"hadolint",D,e.endsWith(".exe")?"hadolint.exe":"hadolint"),"cachedBinaryPath"),ge=g(()=>{const e=process.platform==="win32"?"hadolint.exe":"hadolint",o=(process.env.PATH??"").split(process.platform==="win32"?";":":");for(const t of o)if(t!==""&&V(b(t,e)))return e},"findOnPath"),he=g(e=>e.trim().split(/\s+/u)[0]??"","parseSha256Sidecar"),A=g(async e=>{const o=await fetch(e,{redirect:"follow"});if(!o.ok)throw new Error(`download failed (${String(o.status)} ${o.statusText}) for ${e}`);return Buffer.from(await o.arrayBuffer())},"fetchBuffer"),we=g(async e=>{const o=K(e),[t,r]=await Promise.all([A(`${U}/${e}`),A(`${U}/${e}.sha256`)]),n=he(r.toString("utf8")).toLowerCase(),s=ae("sha256").update(t).digest("hex");if(n==="")throw new Error("hadolint checksum sidecar was empty or unparseable. Refusing to use the download.");if(n!==s)throw new Error(`hadolint checksum mismatch (expected ${n}, got ${s}). Refusing to use the download.`);return ue(b(B(),"hadolint",D)),le(o,t),process.platform!=="win32"&&ce(o,493),o},"downloadHadolint"),be=g(async()=>{const e=L({input:process.stdin,output:process.stderr}),o=await new Promise(t=>{e.question(` Download hadolint ${S(D)} now? ${m("[y/N]")} `,r=>{t(r.trim().toLowerCase())})});return e.close(),o==="y"||o==="yes"},"confirmInstall"),$e=g(async e=>{const{autoInstall:o=!1,log:t}=e,r=ge();if(r!==void 0)return r;const n=me();if(n===void 0){t(`hadolint has no prebuilt binary for ${process.platform}/${process.arch}. Install it manually: https://github.com/hadolint/hadolint`);return}const s=K(n);if(V(s))return s;if(!o){if(!(process.stdin.isTTY&&!oe)){t(`hadolint is not installed. Re-run with ${R("--install")} (or install hadolint on PATH) to enable Dockerfile linting.`);return}if(t(`${R("hadolint")} is required to lint Dockerfiles but was not found on your PATH.`),!await be()){t(`Skipped. Install it yourself or re-run with ${R("--install")}.`);return}}t(`Downloading hadolint ${D} (${n})…`);try{const i=await we(n);return t(`Installed hadolint to ${m(i)}`),i}catch(i){t(`Failed to download hadolint: ${i.message}`);return}},"ensureHadolint"),_=g(async(e,o,t)=>{if(o.length===0)return[];const r=["--format","json","--no-fail",...t!==void 0&&t!==""?["--config",t]:[],...o],n=await new Promise((i,c)=>{const a=ie(e,r,{shell:process.platform==="win32",stdio:["ignore","pipe","pipe"],windowsHide:!0});let u="",d="";a.stdout?.on("data",l=>{u+=l.toString("utf8")}),a.stderr?.on("data",l=>{d+=l.toString("utf8")}),a.on("error",c),a.on("close",()=>{if(u.trim()===""&&d.trim()!==""){c(new Error(d.trim()));return}i(u)})});if(n.trim()==="")return[];let s;try{s=JSON.parse(n)}catch{throw new Error("Could not parse hadolint JSON output.")}return Array.isArray(s)?s:[]},"runHadolint");var ye=Object.defineProperty,y=w((e,o)=>ye(e,"name",{value:o,configurable:!0}),"n");const T=y((e,o,t)=>{if(!(!/\bapt-get\b/u.test(e)||!/\binstall\b/u.test(e)||t.test(e)))return e.replace(/\binstall\b/u,`install ${o}`)},"addAptGetInstallFlag"),j={DL3014:y(e=>T(e,"-y",/(?:^|\s)(?:-y|--yes|--assume-yes|-qq?)\b/u),"DL3014"),DL3015:y(e=>T(e,"--no-install-recommends",/--no-install-recommends\b/u),"DL3015"),DL3020:y(e=>/^\s*ADD\b/u.test(e)?e.replace(/^(\s*)ADD\b/u,"$1COPY"):void 0,"DL3020"),DL3027:y(e=>/(?:^|\s)apt\s/u.test(e)&&!/\bapt-get\b/u.test(e)?e.replace(/(^|\s)apt(\s)/u,"$1apt-get$2"):void 0,"DL3027")},Y=new Set(Object.keys(j)),ke=y((e,o)=>{const t=e.includes(`\r
|
|
3
|
+
`)?`\r
|
|
4
|
+
`:`
|
|
5
|
+
`,r=e.split(/\r?\n/u),n=new Set;let s=0;const i=new Map;for(const c of o){if(!j[c.code])continue;const a=i.get(c.line)??[];a.push(c),i.set(c.line,a)}for(const[c,a]of i){const u=c-1;if(!(u<0||u>=r.length))for(const d of a){const l=j[d.code],f=l?.(r[u]??"");f!==void 0&&f!==r[u]&&(r[u]=f,n.add(d.code),s+=1)}}return{content:s>0?r.join(t):e,fixedCodes:[...n],fixedCount:s}},"applyFixers");var ve=Object.defineProperty,k=w((e,o)=>ve(e,"name",{value:o,configurable:!0}),"a");const I={error:0,info:2,style:3,warning:1},xe=k((e,o)=>{switch(e){case"error":return H(o);case"info":return S(o);case"warning":return F(o);default:return m(o)}},"colorForLevel"),Re=k((e,o)=>(e.length>0?e:["Dockerfile"]).map(t=>M(t)?t:b(o,t)).filter(t=>ee(t)),"resolveFiles"),De=k((e,o)=>{const t=[...e].sort((n,s)=>n.file.localeCompare(s.file)||n.line-s.line||n.column-s.column||I[n.level]-I[s.level]);let r="";for(const n of t){n.file!==r&&(r=n.file,o.info(`
|
|
6
|
+
${R(r)}`));const s=m(`${String(n.line)}:${String(n.column)}`),i=xe(n.level,n.level.padEnd(7)),c=Y.has(n.code)?m(" (fixable)"):"";o.info(` ${s} ${i} ${S(n.code)} ${n.message}${c}`)}},"renderFindings"),Ne=k(e=>{const o={error:0,info:0,style:0,warning:0};for(const t of e)o[t.level]+=1;return o},"summarize"),Se=k(async e=>{const{autoInstall:o,configPath:t,cwd:r,files:n,fix:s,fs:i,json:c,logger:a}=e,u=Re(n,r);if(u.length===0)return a.error(`No Dockerfile found${n.length>0?` at: ${n.join(", ")}`:` in ${r}`}. Pass a path: vis docker lint <path>`),1;const d=await $e({autoInstall:o,log:k(p=>{a.info(p)},"log")});if(d===void 0)return 0;let l=await _(d,u,t),f=0;if(s&&l.length>0){for(const p of u){const W=l.filter(G=>G.file===p),J=await i.readFile(p,"utf8"),O=ke(J,W);O.fixedCount>0&&(await i.writeFile(p,O.content),f+=O.fixedCount)}f>0&&(l=await _(d,u,t))}if(c)return process.stdout.write(`${JSON.stringify({findings:l,fixed:f},null,2)}
|
|
7
|
+
`),l.some(p=>p.level==="error")?1:0;if(s&&f>0&&a.info(E(`✔ Auto-fixed ${String(f)} issue${f===1?"":"s"}.`)),l.length===0)return a.info(E("✔ No Dockerfile issues found.")),0;De(l,a);const v=Ne(l),P=l.filter(p=>Y.has(p.code)).length;return a.info(`
|
|
8
|
+
${R(String(l.length))} issue${l.length===1?"":"s"}: ${H(`${String(v.error)} error`)}, ${F(`${String(v.warning)} warning`)}, ${S(`${String(v.info)} info`)}, ${m(`${String(v.style)} style`)}`),!s&&P>0&&a.info(m(`Run 'vis docker lint --fix' to auto-fix ${String(P)} of them.`)),v.error>0?1:0},"runDockerLint");var Oe=Object.defineProperty,h=w((e,o)=>Oe(e,"name",{value:o,configurable:!0}),"i");const z=h(e=>{if(!e)throw new Error("Could not determine workspace root. Run inside a monorepo.");return e},"requireWorkspaceRoot"),Fe=h(async({logger:e,options:o,visConfig:t,workspaceRoot:r})=>{const n=z(r),{packageJsons:s,workspace:i}=q(n,t),c=te(n,i,s),a=(o.focus??"").split(",").map(l=>l.trim()).filter(Boolean);if(a.length===0)throw new Error("Missing --focus. Pass one or more project names, comma-separated.");const u=b(n,o.out??".vis/docker"),{projects:d}=re({focus:a,includeSources:!!o.includeSources,log:h(l=>{e.info(l)},"log"),outDir:u,projectGraph:c,pruneLockfile:o.pruneLockfile!==!1,workspace:i,workspaceRoot:n});e.info(`Scaffolded ${d.length} project(s) into ${u}`),e.info(`Focus closure: ${d.toSorted().join(", ")}`)},"scaffoldExecute"),He=h(async({logger:e,options:o,visConfig:t,workspaceRoot:r})=>{const n=z(r),{workspace:s}=q(n,t),i=b(n,o.context??".vis/docker"),{removed:c}=se({contextRoot:i,workspace:s,workspaceRoot:n});e.info(`Pruned ${c.length} unfocused project(s)`),c.length>0&&e.debug?.(c.join(`
|
|
9
|
+
`))},"pruneExecute"),Me=h(async({argument:e,fs:o,logger:t,options:r,process:n,workspaceRoot:s})=>{const i=await Se({autoInstall:!!r.install,configPath:r.config,cwd:s??n.cwd,files:e.filter(Boolean),fix:!!r.fix,fs:o,json:!!r.json,logger:t});i!==0&&(process.exitCode=i)},"lintExecute"),je=h(async(e,o)=>{try{return await e.access(o),!0}catch{return!1}},"canAccess"),Pe=h(async e=>{const o=L({input:process.stdin,output:process.stderr}),t=await new Promise(r=>{o.question(` ${e} already exists. Overwrite? ${m("[y/N]")} `,n=>{r(n.trim().toLowerCase())})});return o.close(),t==="y"||t==="yes"},"confirmOverwrite"),Be=h(async({argument:e,fs:o,logger:t,options:r,process:n,workspaceRoot:s})=>{const i=s??n.cwd,c=e[0]??"Dockerfile",a=M(c)?c:b(i,c),u=ne(i)?.manager??"npm",d=(r.focus??"").split(",").map(f=>f.trim()).find(Boolean),l=fe({focus:d,manager:u,nodeVersion:r.node??"22"});if(r.dryRun){process.stdout.write(l.endsWith(`
|
|
10
|
+
`)?l:`${l}
|
|
11
|
+
`);return}if(await je(o,a)&&!r.force){if(!process.stdin.isTTY){t.error(`${a} already exists. Re-run with --force to overwrite.`),process.exitCode=1;return}if(!await Pe(a)){t.info("Aborted — existing Dockerfile left untouched.");return}}await o.writeFile(a,l),t.info(`Created ${a} (package manager: ${u}).`),t.info(m(`Next: vis docker scaffold${d?` --focus=${d}`:""} --include-sources, then DOCKER_BUILDKIT=1 docker build .`))},"initExecute");export{Be as initExecute,Me as lintExecute,He as pruneExecute,Fe as scaffoldExecute};
|