@visulima/vis 1.0.0-alpha.35 → 1.0.0-alpha.37
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 +74 -0
- package/LICENSE.md +3244 -1611
- package/README.md +44 -0
- package/dashboard/dist/index.html +11 -11
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +74 -2
- package/dist/config/index.js +1 -1
- package/dist/generate/index.js +1 -1
- package/dist/packem_chunks/bin.js +584 -588
- package/dist/packem_chunks/bloom-status.js +2 -2
- package/dist/packem_chunks/bloom-sync.js +2 -2
- package/dist/packem_chunks/cache-attestation.js +1 -1
- package/dist/packem_chunks/config.js +18 -16
- package/dist/packem_chunks/devtools.js +56 -57
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/fix.js +11 -11
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +5 -5
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +7 -7
- package/dist/packem_chunks/handler14.js +4 -4
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +3 -3
- package/dist/packem_chunks/handler20.js +5 -5
- package/dist/packem_chunks/handler21.js +2 -2
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -5
- package/dist/packem_chunks/handler26.js +5 -1
- package/dist/packem_chunks/handler27.js +1 -3
- package/dist/packem_chunks/handler28.js +3 -1
- package/dist/packem_chunks/handler29.js +1 -7
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +6 -32
- package/dist/packem_chunks/handler31.js +33 -3
- package/dist/packem_chunks/handler32.js +3 -8
- package/dist/packem_chunks/handler33.js +8 -1
- package/dist/packem_chunks/handler34.js +4 -5
- package/dist/packem_chunks/handler35.js +1 -11
- package/dist/packem_chunks/handler36.js +5 -3
- package/dist/packem_chunks/handler37.js +11 -22
- package/dist/packem_chunks/handler38.js +3 -61
- package/dist/packem_chunks/handler39.js +22 -3
- package/dist/packem_chunks/handler4.js +6 -6
- package/dist/packem_chunks/handler40.js +61 -6
- package/dist/packem_chunks/handler41.js +3 -24
- package/dist/packem_chunks/handler42.js +6 -25
- package/dist/packem_chunks/handler43.js +24 -153
- package/dist/packem_chunks/handler44.js +25 -10
- package/dist/packem_chunks/handler45.js +152 -707
- package/dist/packem_chunks/handler46.js +10 -24
- package/dist/packem_chunks/handler47.js +24 -322
- package/dist/packem_chunks/handler48.js +322 -48
- package/dist/packem_chunks/handler49.js +708 -3
- package/dist/packem_chunks/handler5.js +7 -7
- package/dist/packem_chunks/handler50.js +48 -27
- package/dist/packem_chunks/handler51.js +21 -189
- package/dist/packem_chunks/handler52.js +3 -34
- package/dist/packem_chunks/handler53.js +200 -0
- package/dist/packem_chunks/handler54.js +38 -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 +7 -7
- package/dist/packem_chunks/heal.js +11 -11
- package/dist/packem_chunks/help-command.js +30 -7
- package/dist/packem_chunks/index.js +6 -6
- package/dist/packem_chunks/keys-refresh.js +4 -4
- package/dist/packem_chunks/list.js +2 -2
- package/dist/packem_chunks/loader.js +4 -4
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/prune.js +3 -3
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/status.js +2 -2
- package/dist/packem_chunks/sync.js +2 -2
- package/dist/packem_chunks/sync2.js +2 -2
- package/dist/packem_chunks/tar.js +3 -3
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/verify-lockfile.js +2 -2
- package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +1 -0
- package/dist/packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js +3 -0
- package/dist/packem_shared/Table-CcVkyULl-B_ef6zfS.js +35 -0
- package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +1 -0
- package/dist/packem_shared/advisories-DLeO5KMN.js +1 -0
- package/dist/packem_shared/affected-shas-cVnX8-zs.js +1 -0
- package/dist/packem_shared/ai-analysis-DT3bU-_M.js +68 -0
- package/dist/packem_shared/ai-fix-BkNqd5nP.js +43 -0
- package/dist/packem_shared/build-scripts-CCCi8U66.js +1 -0
- package/dist/packem_shared/cyclonedx-86-DbHtf.js +4 -0
- package/dist/packem_shared/definePlugin-DoUcoYSy.js +1 -0
- package/dist/packem_shared/dependency-scan-BDTH898x.js +1 -0
- package/dist/packem_shared/docker-tNrDU3oK.js +59 -0
- package/dist/packem_shared/failure-log-Dwqt6_Ga.js +2 -0
- package/dist/packem_shared/giget-DHY1sQZC.js +2 -0
- package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +1 -0
- package/dist/packem_shared/index-BDmTbWX1.js +19 -0
- package/dist/packem_shared/index-CB4p298r.js +1 -0
- package/dist/packem_shared/index-DMefdF51.js +1 -0
- package/dist/packem_shared/index-dQ37x8_P.js +30 -0
- package/dist/packem_shared/license-t5KnNX6v.js +1 -0
- package/dist/packem_shared/lifecycle-4z9hHE5b.js +2 -0
- package/dist/packem_shared/lockfile-C8Q1_4KK.js +1 -0
- package/dist/packem_shared/manifests-Dj3pRKBT.js +1 -0
- package/dist/packem_shared/min-release-age-D1alDE3K.js +34 -0
- package/dist/packem_shared/missing-package-json-41VUWFBY.js +1 -0
- package/dist/packem_shared/native-config-sync-BKAZ0NIs.js +21 -0
- package/dist/packem_shared/osv-bloom-B03tUWf3.js +2 -0
- package/dist/packem_shared/otelPlugin-DmKDBaPo.js +1 -0
- package/dist/packem_shared/peer-warnings-BXAzXqY3.js +1 -0
- package/dist/packem_shared/pm-runner-pVihAfxV.js +1 -0
- package/dist/packem_shared/provenance-DMuEftgc.js +1 -0
- package/dist/packem_shared/registry-keys-Bf2zzlcZ.js +1 -0
- package/dist/packem_shared/resolve-explicit-jH0RKyMJ.js +5 -0
- package/dist/packem_shared/runtime-check-Stc9AI78.js +1 -0
- package/dist/packem_shared/s1ngularity-BkfgC6NO.js +1 -0
- package/dist/packem_shared/scan-progress-JBbd9QeT.js +2 -0
- package/dist/packem_shared/selectors-GCJIe342.js +3 -0
- package/dist/packem_shared/signatures-D1H6h6GH.js +2 -0
- package/dist/packem_shared/spinner-BXSl864p.js +1 -0
- package/dist/packem_shared/subtree-C7bZuiSQ.js +2 -0
- package/dist/packem_shared/symbols-DPTlrJ3B.js +1 -0
- package/dist/packem_shared/tabs-BqUepRaD.js +1 -0
- package/dist/packem_shared/toolchain-pR7AJ-tB.js +5 -0
- package/dist/packem_shared/typosquats-C8qg1neE.js +1 -0
- package/dist/packem_shared/use-measured-height-BBJ9intr.js +1 -0
- package/dist/packem_shared/utils-Cxree603.js +1 -0
- package/dist/packem_shared/verify-Du7xZ2BJ.js +1 -0
- package/dist/packem_shared/vis-update-app-CTwRkNgj.js +1 -0
- package/dist/packem_shared/watch-BvIwLG4N.js +1 -0
- package/dist/packem_shared/watch-loop-DWkvv2tK.js +11 -0
- package/index.d.ts +201 -201
- package/index.js +751 -567
- package/package.json +16 -16
- package/schemas/vis-config.schema.json +4 -0
- package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +0 -12
- package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +0 -1
- package/dist/packem_shared/advisories-CGKZo9Rx.js +0 -1
- package/dist/packem_shared/affected-shas-BdnlfiV1.js +0 -1
- package/dist/packem_shared/ai-analysis-3QD_RS6F.js +0 -68
- package/dist/packem_shared/ai-fix-TsjDQz_0.js +0 -43
- package/dist/packem_shared/applyDefaults-BogleaFi.js +0 -1
- package/dist/packem_shared/build-scripts-DE6U8jVq.js +0 -1
- package/dist/packem_shared/cyclonedx-zf9R2jCs.js +0 -4
- package/dist/packem_shared/definePlugin-CWm4Dv_t.js +0 -1
- package/dist/packem_shared/dependency-scan-B70azq4x.js +0 -1
- package/dist/packem_shared/docker-EJiTY0Sz.js +0 -60
- package/dist/packem_shared/failure-log-Dxafk3t4.js +0 -2
- package/dist/packem_shared/giget-CcEy_Elm.js +0 -2
- package/dist/packem_shared/glob-D_7bct6p-D8itOHsr.js +0 -1
- package/dist/packem_shared/index-BpbjpCNL.js +0 -1
- package/dist/packem_shared/index-DH-5hsrC.js +0 -1
- package/dist/packem_shared/index-Dc3ht2bL.js +0 -30
- package/dist/packem_shared/license-zZU7aavK.js +0 -1
- package/dist/packem_shared/lifecycle-DvVTL8nx.js +0 -2
- package/dist/packem_shared/lockfile-CedmXr44.js +0 -1
- package/dist/packem_shared/lockfile-Cu2BH6bl.js +0 -1
- package/dist/packem_shared/manifests-BzWpKW8F.js +0 -1
- package/dist/packem_shared/min-release-age-DKMW2N_v.js +0 -34
- package/dist/packem_shared/missing-package-json-DKAwoiWK.js +0 -1
- package/dist/packem_shared/native-config-sync-DBkJ-hsF.js +0 -21
- package/dist/packem_shared/osv-bloom-0Vu8YRhg.js +0 -2
- package/dist/packem_shared/otelPlugin-CJR2T_lk.js +0 -1
- package/dist/packem_shared/peer-warnings-EvSJ18gE.js +0 -1
- package/dist/packem_shared/pm-runner-DmKT2FqF.js +0 -1
- package/dist/packem_shared/provenance-Cu6VR1Hy.js +0 -1
- package/dist/packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js +0 -1
- package/dist/packem_shared/registry-keys-CuBAVdsk.js +0 -1
- package/dist/packem_shared/resolve-explicit-Xue0oq8V.js +0 -5
- package/dist/packem_shared/runtime-check-CilFOqUU.js +0 -1
- package/dist/packem_shared/s1ngularity-adnHbyTd.js +0 -1
- package/dist/packem_shared/scan-progress-lZdk5KJ-.js +0 -2
- package/dist/packem_shared/selectors-DkgYFzdq.js +0 -3
- package/dist/packem_shared/signatures-FGbYV5QE.js +0 -2
- package/dist/packem_shared/spinner-0acw5pd_.js +0 -1
- package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +0 -1
- package/dist/packem_shared/symbols-CQmER5MT.js +0 -1
- package/dist/packem_shared/tabs-zUSdR1HI.js +0 -1
- package/dist/packem_shared/toolchain-DoG6b_G_.js +0 -5
- package/dist/packem_shared/typosquats-acxQ7blw.js +0 -1
- package/dist/packem_shared/use-measured-height-DyCBfLtu.js +0 -1
- package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
- package/dist/packem_shared/verify-BYzxSKWD.js +0 -1
- package/dist/packem_shared/vis-update-app-D0QyGneK.js +0 -1
- package/dist/packem_shared/watch-DEL0yol9.js +0 -1
- package/dist/packem_shared/watch-loop-jmQQl2Qe.js +0 -11
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
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
|
+
import{createTaskGraph as j}from"@visulima/task-runner";import{b as m,O as b}from"./bin.js";const y=(a,e)=>{const r=new Map;for(const[i,t]of Object.entries(a.dependencies))for(const c of t){const f=r.get(c)??[];f.push(i),r.set(c,f)}if(!a.tasks[e])return;const s=new Set([e]),o=[{node:e,path:[e]}];for(;o.length>0;){const i=o.shift();if(a.roots.includes(i.node))return i.path;for(const t of r.get(i.node)??[])s.has(t)||(s.add(t),o.push({node:t,path:[t,...i.path]}))}return[e]},E=(a,e)=>{const r=[];for(const[s,o]of Object.entries(a.dependencies))o.includes(e)&&r.push(s);return r.sort()},T=async({argument:a,logger:e,visConfig:r,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root.");const o=a[0];if(!o)throw new Error("No task ID specified. Usage: vis task-why <project>:<target>");if(!o.includes(":"))throw new Error(`Invalid task ID "${o}" — expected format "project:target".`);const{packageJsons:i,workspace:t}=m(s,r),c=b(s,t,i),[f,l]=o.split(":",2),u=t.projects[f];if(!u)throw new Error(`Unknown project "${f}".`);if(!u.targets?.[l])throw new Error(`Project "${f}" has no target "${l}".`);const $=Object.entries(t.projects).flatMap(([n,k])=>Object.keys(k.targets??{}).map(h=>({id:`${n}:${h}`,outputs:[],overrides:{},target:{project:n,target:h}}))),p=j($,{projectGraph:c,workspace:t});if(!p.tasks[o])throw new Error(`Task "${o}" is not reachable in the graph.`);const d=y(p,o),g=E(p,o);if(e.info(""),e.info(`Why ${o}?`),e.info(""),d&&d.length>1){e.info("Shortest path from a root to this task:");for(const[n,k]of d.entries()){const h=n===0?" ":`${" ".repeat(n+1)}└─ `;e.info(`${h}${k}`)}e.info("")}else e.info(" This task is itself a root — nothing upstream depends on it."),e.info("");if(g.length>0){e.info(`Directly depended on by ${g.length} task(s):`);for(const n of g)e.info(` - ${n}`);e.info("")}const w=p.dependencies[o]??[];if(w.length>0){e.info(`This task depends on ${w.length} task(s):`);for(const n of[...w].sort())e.info(` - ${n}`);e.info("")}};export{T as default};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import{createRequire as M}from"node:module";import{E as d,I as F,V as I,s as U}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as A}from"../packem_shared/index-BDmTbWX1.js";import{p as t}from"./bin.js";import{p as N,g as C,S as w,w as b,b as S,a as W,f as k,c as E,d as B,u as y,e as q,h as H}from"../packem_shared/toolchain-pR7AJ-tB.js";const _=M(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=e=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[n,i]=$.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return $.getBuiltinModule(e)}return _(e)},{spawnSync:P}=T("node:child_process"),x=["aube","bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],O=e=>x.includes(e),v=e=>e?F("✓"):I("✗"),j=U("⚠"),V=e=>{if(e.installed){const n=e.version?` v${e.version}`:"",i=e.configFiles.length>0?` (${e.configFiles.join(", ")})`:"";return`${v(!0)} ${e.name}${n}${i}`}return`${j} ${e.name} — referenced by ${e.configFiles.join(", ")} but not installed`},D=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)`)},G=e=>e.matches?v(!0):e.actual?j:v(!1),J=e=>{if(t.info(""),t.info(d("── Toolchain ───────────────────────")),e.detected.length===0)t.info(` ${v(!1)} No version manager detected`),t.notice(` Install one of: ${w.join(", ")}`);else for(const n of e.detected)t.info(` ${V(n)}`);if(t.info(""),e.tools.length===0){t.info(` ${d("No tool pins found — add engines.node, .nvmrc, or a manager config file.")}`);return}t.info(d("── Tools ───────────────────────────"));for(const n of e.tools){const i=`${n.expected.tool} ${n.expected.version}`,a=n.actual?`actual ${n.actual}`:"not installed",c=n.matches?"":d(` [${n.expected.source}]`),o=D(n),g=o===""?"":` ${o}`;t.info(` ${G(n)} ${i} — ${a}${c}${g}`),n.manager.note&&t.notice(` ${n.manager.note}`)}},K=(e,n,i)=>{const a=C(e,n);if(i.json){process.stdout.write(`${JSON.stringify({detected:a.detected.map(o=>({binPath:o.binPath??null,configFiles:o.configFiles,installed:o.installed,name:o.name,version:o.version??null})),tools:a.tools.map(o=>({actual:o.actual??null,expected:o.expected.version,manager:o.manager.name,managerInstalled:o.manager.installed,matches:o.matches,note:o.manager.note??null,source:o.expected.source,tool:o.expected.tool}))},void 0,2)}
|
|
2
|
+
`);return}J(a);const c=a.tools.filter(o=>!o.matches);c.length>0&&(t.info(""),t.notice(" Run `vis toolchain install` to install pinned versions.")),i.exitCode&&c.length>0&&(process.exitCode=1)},L=e=>{const n=new Map;for(const i of e){const a=n.get(i.manager.name);a?a.push(i):n.set(i.manager.name,[i])}return n},R=(e,n,i)=>P(e,n,{cwd:i,stdio:"inherit"}).status??1,z=(e,n,i)=>{const a=C(e,n),c=a.tools.filter(u=>!u.matches);if(c.length===0){t.success("Everything already matches — nothing to install.");return}const o=c.some(u=>u.manager.name!=="self-activate"&&u.manager.name!=="none");if(a.detected.length===0&&o){t.error(`No version manager detected. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}const g=L(c);let l=!1,r=0;for(const[u,f]of g){if(u==="self-activate"){for(const{expected:s}of f){if(s.source==="packageManager")t.info(`${d("$")} (${s.tool} will self-activate from packageManager on next invocation)`);else if(t.info(`${d("$")} Writing packageManager=${s.tool}@${s.version}`),i.dryRun)l=!0;else try{b(e,s),l=!0}catch(h){t.error(h.message),r=1}t.notice(` ${s.tool} ${s.version} — no install needed`)}continue}if(u==="none"){for(const{expected:s}of f)t.warn(`Cannot install ${s.tool} ${s.version} — no manager can handle it.`);r=1;continue}if(!a.detected.find(s=>s.name===u)?.installed){t.error(`${u} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),r=1;continue}const m=f.map(s=>S(u,s.expected)).filter(Boolean);for(const s of m){if(!s)continue;if(s.bin==="nvm"&&s.args.length===0){t.error("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`."),s.hint&&t.notice(` ${s.hint}`),r=1;continue}if(t.info(`${d("$")} ${s.bin} ${s.args.join(" ")}`),s.hint&&t.notice(` ${s.hint}`),i.dryRun){l=!0;continue}const h=R(s.bin,s.args,e);if(l=!0,h!==0){r=h;break}}}if(r!==0){process.exitCode=r;return}l&&t.success("Toolchain installed.")},Q=async(e,n,i,a,c)=>{if(!a)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const o=W(a);if(!o)throw new Error(`Could not parse "${a}". Expected "<tool>@<version>" where <tool> is one of ${x.join(", ")}.`);const g=k(n),l=E(o,g,i);if(l.name==="none"){t.error(`No manager can pin ${o.tool}. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}if(!l.installed){t.error(`The best manager for ${o.tool} (${l.name}) is not on PATH. ${l.note??""}`),process.exitCode=1;return}const r=B(l.name,o);if(!r){t.error(`${l.name} cannot pin ${o.tool}. Use a different manager, or set \`toolchain.tools.${o.tool}\` in vis.config.ts.`),process.exitCode=1;return}if(l.name==="self-activate"){if(t.info(`${d("→")} Writing packageManager field to package.json...`),c.dryRun){t.notice(` Would set packageManager: "${o.tool}@${o.version}"`);return}try{const f=b(n,o);if(!f){t.error(`Refusing to pin non-package-manager tool ${o.tool} via the packageManager field.`),process.exitCode=1;return}if(t.success(`Set packageManager: "${f}" — ${o.tool} will activate this version on next invocation.`),c.engines!==!1){const m=y(n,o);m&&t.success(`Updated package.json engines.${o.tool} → ${m}.`)}}catch(f){t.error(f.message),process.exitCode=1}return}if(r.args.length===0&&l.name==="nvm"&&o.tool==="node"){const f=A(n,".nvmrc");if(t.info(`${d("→")} Writing ${f}...`),c.dryRun){t.notice(` Would write ${o.version} to .nvmrc`);return}try{await e.writeFile(f,`${o.version}
|
|
3
|
+
`)}catch(m){t.error(`Failed to write .nvmrc: ${m.message}`),process.exitCode=1;return}t.success(`Wrote ${o.version} to .nvmrc.`),t.notice(" nvm is a shell function — run `nvm use` to activate it in this shell.");return}if(r.args.length===0){t.error(`${l.name} cannot pin ${o.tool} from a subprocess. ${r.configChange?.hint??""}`),r.configChange&&t.notice(` Edit ${r.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(t.info(`${d("$")} ${r.bin} ${r.args.join(" ")}`),r.configChange&&t.notice(` Will update ${r.configChange.file} — ${r.configChange.hint}`),c.dryRun)return;const u=R(r.bin,r.args,n);if(u!==0){process.exitCode=u;return}if(t.success(`Pinned ${o.tool} to ${o.version}.`),c.engines!==!1)try{const f=y(n,o);f&&t.success(`Updated package.json engines.${o.tool} → ${f}.`)}catch(f){t.warn(`Could not update engines.${o.tool}: ${f.message}`)}},X=(e,n,i)=>{if(!i)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const a=i.toLowerCase();if(!O(a))throw new Error(`Unknown tool "${i}". Known: ${x.join(", ")}.`);const c=k(e),o=E({source:"vis.config.ts",tool:a,version:"*"},c,n),g=o.installed&&o.name!=="self-activate"&&o.name!=="none"?c.find(r=>r.name===o.name):void 0,l=g?q(g,a):H(a);if(!l){t.error(`${i} not found in PATH${g?` or via ${g.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${l}
|
|
4
|
+
`)},Y=(e,n)=>{const i=N(e,n);process.stdout.write(`${i.name}
|
|
5
|
+
`)},p=e=>{if(!e)throw new Error("Could not determine workspace root. Run inside a monorepo.");return e},ie=async({options:e,visConfig:n,workspaceRoot:i})=>{K(p(i),n?.toolchain,e)},se=async({visConfig:e,workspaceRoot:n})=>{Y(p(n),e?.toolchain)},ae=async({options:e,visConfig:n,workspaceRoot:i})=>{z(p(i),n?.toolchain,e)},re=async({argument:e,fs:n,options:i,visConfig:a,workspaceRoot:c})=>{await Q(n,p(c),a?.toolchain,e[0],i)},ce=async({argument:e,visConfig:n,workspaceRoot:i})=>{X(p(i),n?.toolchain,e[0])};export{se as detectExecute,ae as installExecute,ie as statusExecute,re as useExecute,ce as whichExecute};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
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
|
+
import{I as p,S as l}from"../packem_shared/pm-runner-pVihAfxV.js";const g=async({argument:c,logger:a,options:n,visConfig:o,workspaceRoot:r})=>{const i=c||[],e=r??process.cwd(),t=p(e,{configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),s=l(t,i,n.recursive||!1,e,a);s!==0&&(process.exitCode=s)};export{g as default};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import{createRequire as u}from"node:module";import{c as p}from"../packem_shared/index-dQ37x8_P.js";const f=u(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,a=s=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,i]=r.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return r.getBuiltinModule(s)}return f(s)},{execSync:d,spawnSync:l}=a("node:child_process"),v=async({argument:s,logger:e,options:i})=>{const t=s?.[0];e.info("info: checking for updates...");const n=p.version;let o;try{const c=d("npm view @visulima/vis version",{encoding:"utf8"}).trim();o=t??c}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(n===o&&!i.force){e.info(`
|
|
2
|
+
✓ Already up to date (${n})`);return}if(i.check){n===o?e.info(`✓ Already up to date (${n})`):e.info(`info: found @visulima/vis@${o} (current: ${n})`);return}if(e.info(`info: found @visulima/vis@${o} (current: ${n})`),e.info("info: installing..."),l("npm",["install","-g",`@visulima/vis@${o}`],{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 ${n} → ${o}`)};export{v as default};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
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
|
+
import{I as c,E as f}from"../packem_shared/pm-runner-pVihAfxV.js";import{i as d}from"../packem_shared/utils-Cxree603.js";const v=async({argument:r,logger:n,options:o,process:i,visConfig:s,workspaceRoot:p})=>{const a=r;if(!a||a.length===0)throw new Error("No packages specified. Usage: vis why <package...>");const l=p??i.cwd,t=c(l,{configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),e=f(t,{depth:o.depth===void 0?void 0:Number(o.depth),dev:o.dev||!1,filter:d(o.filter),global:o.global||!1,json:o.json||!1,long:o.long||!1,noOptional:o.optional===!1,packages:a,parseable:o.parseable||!1,prod:o.prod||!1,recursive:o.recursive||!1},l,n);e!==0&&e!==1&&(process.exitCode=e)};export{v as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
`);const
|
|
3
|
-
`);const o
|
|
4
|
-
`):
|
|
1
|
+
import{P as N,R as C,T as P,E as h,N as T,a as I,f as j,q,I as x}from"./bin.js";import"../packem_shared/index-BDmTbWX1.js";import{K as z,Z as A,W as F}from"../packem_shared/ai-analysis-DT3bU-_M.js";const M=/^[\^~>=<]+/,O=async({argument:v,logger:n,options:c,visConfig:l,workspaceRoot:f})=>{if(!f)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const u=v,e=u[0];if(!e)throw new Error("Package name is required. Usage: vis analyze <package> [version]");const m=u[1],{packageManager:R}=N(f);let o,p="default";const b=C(f,R);for(const[t,a]of b){const i=a.get(e);if(i){o=i,p=t;break}}if(!o)throw new Error(`Package "${e}" not found in any catalog or package.json. Make sure it exists in your workspace dependencies.`);let r;if(m)r=m;else{n.info(`Fetching latest version for ${e}...
|
|
2
|
+
`);const t=await P(e);if(!t.latest)throw new Error(`Could not determine latest version for "${e}".`);r=t.latest}const d=h(o),w=h(r);if(!d||!w)throw new Error(`Could not parse versions: current="${o}", target="${r}".`);const k=q(d,w);if(k==="none"){n.info(`${e} is already at ${r}. Nothing to analyze.`);return}const E=x(o),g={catalogName:p,currentRange:o,newRange:`${E}${r}`,packageName:e,targetVersion:r,updateType:k},y=z(c.aiType??"impact");if(y==="security"||c.security){n.info(`Checking for known vulnerabilities...
|
|
3
|
+
`);const t=o.replace(M,""),a=(await T([{name:e,version:t}])).get(e);a&&a.length>0&&(g.vulnerabilities=a);const i=I(l?.security,{minimumScore:l?.security?.policies?.score?.minimum});if(i.length>0){const s=(await j(i,[{name:e,version:t}])).get(`${e}@${t}`);s&&(g.socketReport={alerts:s.alerts,license:s.license,score:s.score})}}const $=await A([g],n,l?.ai,y);(c.format??"table")==="json"?process.stdout.write(`${JSON.stringify($,void 0,2)}
|
|
4
|
+
`):n.info(F($))};export{O as default};
|
|
@@ -1,33 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
${
|
|
3
|
-
`)}`,y=a.replace(/\s+$/,""),b=a.slice(y.length),N=`${y}${y.endsWith(",")||y===""?"":","}${P}${b.length>0?b:`
|
|
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(`
|
|
1
|
+
import{createRequire as $}from"node:module";import{N as y,R as l,S as d,h as b}from"../packem_shared/ai-analysis-DT3bU-_M.js";import{h as x,k as _,c as w}from"./bin.js";import{j as S,E as p,q as j,I as E,s as I}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";const A=$(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const u={command:"ai",description:"AI-assisted commands: provider detection, cache management, and failure-fix proposals."},N=e=>{if(typeof e!="function")return String(e);const{name:t}=e;return t==="Boolean"?"boolean":t==="Number"?"number":t==="String"?"string":t??"unknown"},R=e=>{const t=[...e.commandPath??[],e.name].join(" "),i=(e.examples??[]).map(([o,r])=>({command:o??"",description:r??""})),n=(e.options??[]).map(o=>({defaultValue:o.defaultValue,description:o.description,name:o.name,type:N(o.type)}));return{argument:e.argument?{description:e.argument.description,name:e.argument.name}:void 0,description:e.description??"",examples:i,name:e.name,options:n,path:t}},f=(e,t=u)=>({command:t.command,description:t.description,subcommands:e.map(i=>R(i))}),C=(e,t=u)=>`${JSON.stringify(f(e,t),void 0,2)}
|
|
2
|
+
`,P=(e,t=u)=>{const i=f(e,t),n=[S(`vis ${i.command} — ${i.description}`),"",p("Subcommands:")];for(const o of i.subcommands){const r=o.argument?` ${j(`<${o.argument.name}>`)}`:"";if(n.push(""),n.push(` ${E(`vis ${o.path}`)}${r}`),o.description&&n.push(` ${o.description}`),o.options.length>0){const s=o.options.map(c=>`--${c.name}${c.type==="boolean"?"":`=<${c.type}>`}`).join(", ");n.push(p(` options: ${s}`))}if(o.examples.length>0){n.push(p(" examples:"));for(const s of o.examples){const c=s.description?p(` — ${s.description}`):"";n.push(` ${I(s.command)}${c}`)}}}return n.push(""),n.push(p(`Run \`vis ${i.command} discover-help\` for the machine-readable JSON catalogue (designed for AI agents).`)),n.push(p(`Run \`vis ${i.command} <subcommand> --help\` for full usage of a specific subcommand.`)),`${n.join(`
|
|
7
3
|
`)}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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=q(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=A("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};
|
|
4
|
+
`},h=async()=>{const{default:e}=await import("./bin.js").then(t=>t.bC);return e.filter(t=>t.name!=="ai")},O=async()=>{const e=await h();process.stderr.write(P(e))},B=async()=>{const e=await h();process.stdout.write(C(e))},k=async({logger:e,visConfig:t})=>{const i=t?.ai,n=l(i);if(!n){e.error("No AI provider available to test."),process.exitCode=1;return}e.info(`Testing ${n.name}...`);try{const o=await b(n,"Reply with exactly: OK",{timeoutMs:3e4});e.info(`Provider ${n.name} responded: ${o.stdout.trim().slice(0,200)}`)}catch(o){const r=o instanceof Error?o.message:String(o);e.error(`Provider ${n.name} failed: ${r}`),process.exitCode=1}},F=({logger:e,options:t,visConfig:i})=>{const n=t.format??"table",o=i?.ai,r=y(),s=l(o);if(n==="json"){const a=r.map(m=>({available:m.available,method:m.detectionMethod,name:m.name,path:m.path,priority:d[m.name]??0,selected:m.name===s?.name,version:m.version}));process.stdout.write(`${JSON.stringify(a,void 0,2)}
|
|
5
|
+
`);return}const c=r.map(a=>({method:a.detectionMethod??"-",path:a.path??"-",priority:String(d[a.name]??0),provider:a.name,selected:a.name===s?.name?">>>":"",status:a.available?"available":"not found",version:a.version??"-"})),g=process.stdout.columns||80,v=x(_.createElement(w,{data:c}),{columns:g});e.info(v),s?e.info(`
|
|
6
|
+
Selected provider: ${s.name} (priority ${String(d[s.name]??0)})`):e.info(`
|
|
7
|
+
No AI provider available. Install one of the supported AI CLI tools.`)},V=async e=>{const{aiFix:t}=await import("./fix.js");await t(e)};export{B as aiDiscoverHelpExecute,V as aiFixExecute,F as aiProvidersExecute,O as aiRootExecute,k as aiTestExecute};
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
`)
|
|
1
|
+
import{createRequire as N}from"node:module";import{f as D,v as O,T as w}from"../packem_shared/index-BDmTbWX1.js";import{b as V}from"./config.js";import{p as e}from"./bin.js";import{w as q}from"../packem_shared/pm-runner-pVihAfxV.js";import{W as A}from"../packem_shared/build-scripts-CCCi8U66.js";import{O as F}from"../packem_shared/native-config-sync-BKAZ0NIs.js";const R=N(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,C=l=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[t,s]=$.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return $.getBuiltinModule(l)}return R(l)},{spawnSync:T}=C("node:child_process"),M=/(defineConfig\s*\(\s*\{)/,W=/(export\s+default\s+\{)/,v=(l,t)=>`${t}${JSON.stringify(l)}: true,`,B=(l,t)=>{if(t.length===0)return{added:[],skipped:[],status:"noop"};const s=V(l);if(!s)return{added:[],skipped:t,status:"no-config"};if(!D(s))return{added:[],skipped:t,status:"no-config"};const i=O(s),h=i.search(/installScripts\s*:\s*\{/);let a=null,r=0;if(h!==-1){const c=i.slice(h),d=/(allow\s*:\s*\{)([^}]*)(\})/.exec(c);d?.index!==void 0&&(a=d,r=h+d.index)}if(a){const c=a[2]??"",d=new Set;for(const g of c.matchAll(/["']([^"']+)["']\s*:/g))d.add(g[1]);for(const g of c.matchAll(/(?:^|,|\{)\s*([a-z_$][\w-]*)\s*:/gi))d.add(g[1]);const u=[],k=[];for(const g of t)d.has(g)?k.push(g):u.push(g);if(u.length===0)return{added:[],configPath:s,skipped:k,status:"noop"};const x=/\n([ \t]+)\S/.exec(c)?.[1]??" ",_=`
|
|
2
|
+
${u.map(g=>v(g,x)).join(`
|
|
3
|
+
`)}`,y=c.replace(/\s+$/,""),S=c.slice(y.length),j=`${y}${y.endsWith(",")||y===""?"":","}${_}${S.length>0?S:`
|
|
4
|
+
`}`,P=`${i.slice(0,r)}${a[1]}${j}${a[3]}${i.slice(r+a[0].length)}`;return w(s,P),{added:u,configPath:s,skipped:k,status:"updated"}}const n=/(installScripts\s*:\s*\{)/;if(n.test(i)){const c=`
|
|
5
|
+
allow: {
|
|
6
|
+
${t.map(u=>v(u," ")).join(`
|
|
7
|
+
`)}
|
|
8
|
+
},`,d=i.replace(n,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const o=/(policies\s*:\s*\{)/;if(o.test(i)){const c=`
|
|
9
|
+
installScripts: {
|
|
10
|
+
allow: {
|
|
11
|
+
${t.map(u=>v(u," ")).join(`
|
|
12
|
+
`)}
|
|
13
|
+
},
|
|
14
|
+
},`,d=i.replace(o,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const f=/(security\s*:\s*\{)/;if(f.test(i)){const c=`
|
|
15
|
+
policies: {
|
|
16
|
+
installScripts: {
|
|
17
|
+
allow: {
|
|
18
|
+
${t.map(u=>v(u," ")).join(`
|
|
19
|
+
`)}
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},`,d=i.replace(f,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const p=M.exec(i)??W.exec(i);if(!p)return{added:[],configPath:s,skipped:t,status:"missing-anchor"};const m=`
|
|
23
|
+
security: {
|
|
24
|
+
policies: {
|
|
25
|
+
installScripts: {
|
|
26
|
+
allow: {
|
|
27
|
+
${t.map(c=>v(c," ")).join(`
|
|
28
|
+
`)}
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},`,b=`${i.slice(0,p.index+p[0].length)}${m}${i.slice(p.index+p[0].length)}`;return w(s,b),{added:t,configPath:s,skipped:[],status:"updated"}},L=async({options:l,visConfig:t,workspaceRoot:s})=>{const i=s??process.cwd(),h=q(i);if(h.name==="pnpm"&&!l.scan){e.info("Delegating to pnpm approve-builds...");const a=["approve-builds"];l.all&&a.push("--all");const r=T("pnpm",a,{cwd:i,stdio:"inherit"});if(r.error)throw new Error(`Failed to run pnpm approve-builds: ${r.error.message}`);if(r.status!==0&&r.status!==null&&(e.error(`pnpm approve-builds exited with code ${r.status}`),process.exitCode=r.status),!l.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 a=t?.security?.policies?.installScripts?.allow??{},r=t?.security?.pinVersions===!0,n=A(i,a,{pinVersions:r});if(n.unapproved.length===0)e.success("No unapproved build scripts found."),l.write&&(e.info(""),e.info("Nothing to write — there are no unapproved build scripts."));else{e.warn(`Found ${n.unapproved.length} package${n.unapproved.length===1?"":"s"} with unapproved build scripts:
|
|
33
|
+
`);for(const o of n.unapproved)e.info(` ${o.name} (${o.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 o of n.unapproved){const f=r&&o.version?`${o.name}@${o.version}`:o.name;e.notice(` "${f}": 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.")),l.write){const o=t?.security?.pinVersions===!0,f=n.unapproved.map(m=>o&&m.version?`${m.name}@${m.version}`:m.name),p=B(i,f);switch(e.info(""),p.status){case"missing-anchor":{e.warn(`Could not locate 'defineConfig({' or 'export default {' in ${String(p.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(f.length)} entr${f.length===1?"y":"ies"} were already present in vis.config.ts security.policies.installScripts.allow.`);break}default:e.success(`Wrote ${String(p.added.length)} entr${p.added.length===1?"y":"ies"} to ${String(p.configPath)}.`),p.skipped.length>0&&e.info(`Skipped ${String(p.skipped.length)} already-present entr${p.skipped.length===1?"y":"ies"}.`)}}}if(n.excess.length>0){e.notice(""),e.warn(`Stale installScripts.allow entries — ${String(n.excess.length)} pattern${n.excess.length===1?"":"s"} no longer match any installed package:`);for(const o of n.excess)e.info(` ${o}`);e.notice("Consider removing these entries from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){e.notice(""),e.warn(`Version drift — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} pinned to an outdated version:`);for(const{from:o,to:f}of n.versionDrift)e.info(` ${o} → ${f}`);e.notice("Rename the keys in vis.config.ts security.policies.installScripts.allow to migrate.")}}if(l.syncNative){const a=t?.security?.policies?.installScripts?.allow??{};if(Object.keys(a).length===0)e.warn("No security.policies.installScripts.allow configured in vis.config.ts. Nothing to sync.");else{const r=F(h.name,i,a);e.info("");for(const n of r)e.success(n)}}};export{L as default};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`)
|
|
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
|
+
import{createRequire as B}from"node:module";import{getAffectedProjects as F}from"@visulima/task-runner";import{b as H,O as T}from"./bin.js";const C=B(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,r]=g.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return g.getBuiltinModule(e)}return C(e)},{execFile:D}=A("node:child_process"),{promisify:q}=A("node:util"),P=q(D),G=["[skip ci]","[ci skip]","[no ci]","[vis skip]","[nx skip]"],N=["[vis deploy]","[nx deploy]"],U=["vis","nx"],J=["CACHED_COMMIT_REF","VERCEL_GIT_PREVIOUS_SHA","GITHUB_BASE_REF","CI_COMMIT_BEFORE_SHA"],V=/^[\w./~^@{}][\w.\-/~^@{}]*$/,z=(e=process.env)=>{for(const t of J){const r=e[t];if(r&&r.trim().length>0)return r.trim()}},_=e=>{if(!V.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.`)},L=async(e,t)=>{try{return await P("git",["rev-parse","--verify",`${t}^{commit}`],{cwd:e}),!0}catch{return!1}},W=async e=>{try{const{stdout:t}=await P("git",["log","-1","--pretty=%B"],{cwd:e});return t}catch{return""}},O=(e,t,r)=>U.some(c=>e.includes(`[${c} ${t} ${r}]`)),Z=(e,t)=>G.some(r=>e.includes(r))||O(e,"skip",t),K=(e,t)=>N.some(r=>e.includes(r))||O(e,"deploy",t),f=(e,t,r,c)=>({action:"build",message:r,project:e,reason:t,...c}),b=(e,t,r,c)=>({action:"skip",message:r,project:e,reason:t,...c}),Q=e=>`${e.action==="skip"?"🛑":"✅"} ${e.message}`,X=(e,t)=>e.action==="skip"||t?0:1,E=new Set(["deep","direct","none"]),re=async({argument:e,logger:t,options:r,visConfig:c,workspaceRoot:l})=>{const o=e[0]??"",k=!!r.json,R=!!r.verbose,I=!!(r["exit-zero-on-build"]??r.exitZeroOnBuild),p=s=>{R&&!k&&t.info(`❱ ${s}`)},n=s=>{k?process.stdout.write(`${JSON.stringify(s)}
|
|
2
|
+
`):t.info(Q(s)),process.exit(X(s,I))};if(!o)return n(f("","missing-project-argument","Missing project argument. Usage: vis ci ignore <project>"));if(!l)return n(f(o,"workspace-error","Could not determine workspace root — building defensively"));const m=await W(l),$=m.trim().split(`
|
|
3
|
+
`)[0]??"";if(p(`commit: ${$}`),m&&K(m,o))return n(f(o,"commit-force-deploy",`Force-deploy keyword in commit: "${$}"`));if(m&&Z(m,o))return n(b(o,"commit-skip",`Skip keyword in commit: "${$}"`));let h,v;try{({packageJsons:v,workspace:h}=H(l,c))}catch(s){const a=s instanceof Error?s.message:String(s);return n(f(o,"workspace-error",`Workspace discovery failed (${a}) — building defensively`))}if(!Object.hasOwn(h.projects,o))return n(f(o,"project-unknown",`Project "${o}" not found in workspace — building defensively`));try{const s=r.base?.trim(),a=z();let i=s||a||"HEAD~1";const u=r.head?.trim()||"HEAD";_(i),_(u),p(`resolved base ref: ${i} (source: ${s?"flag":a?"ci-env":"default"})`);const S=L(l,i),x=T(l,h,v);await S||(p(`base ref ${i} not reachable — falling back to HEAD~1`),i="HEAD~1"),p(`comparing ${i}...${u}`);const w=r.downstream??"deep",y=r.upstream??"none";if(!E.has(w))throw new Error(`Invalid --downstream value: "${w}". Must be "none", "direct", or "deep".`);if(!E.has(y))throw new Error(`Invalid --upstream value: "${y}". Must be "none", "direct", or "deep".`);const M={base:i,downstream:w,head:u,projectGraph:x,projects:h.projects,upstream:y,workspaceRoot:l},d=await F(M);p(`changed files: ${d.changedFiles.length}`),p(`affected projects: ${d.affectedProjects.join(", ")||"(none)"}`);const j={base:i,head:u};return d.changedFiles.length===0?n(b(o,"no-changes",`No files changed between ${i}...${u}`,{...j,affectedProjects:[]})):d.affectedProjects.includes(o)?n(f(o,"project-affected",`Build ${o}: affected by ${d.changedFiles.length} changed file(s)`,{...j,affectedProjects:d.affectedProjects})):n(b(o,"project-not-affected",`Skip ${o}: not affected by changes between ${i}...${u}`,{...j,affectedProjects:d.affectedProjects}))}catch(s){const a=s instanceof Error?s.message:String(s);return t.error(`Affected detection failed: ${a}`),n(f(o,"workspace-error",`Affected detection failed (${a}) — building defensively`))}};export{re as default};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import{E as u}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as p}from"../packem_shared/index-BDmTbWX1.js";const f={docker:".dockerignore",npm:".npmignore",slug:".slugignore",vercel:".vercelignore"},m=[".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/"],w={docker:["node_modules",".vis/","Dockerfile*",".dockerignore"],npm:[],slug:["node_modules"],vercel:["node_modules",".vercel/"]},$=e=>{const r=new Set,n=[];for(const t of[...m,...w[e]])r.has(t)||(r.add(t),n.push(t));return n},h=e=>e.trim(),_="# Added by vis ignore",v=(e,r)=>{const n=new Set;for(const o of e.split(/\r?\n/u)){const c=h(o);c!==""&&!c.startsWith("#")&&n.add(c)}const t=[];for(const o of r)n.has(o)||(n.add(o),t.push(o));if(t.length===0)return{added:t,content:e};const s=e.includes(`\r
|
|
2
|
+
`)?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`,d=[_,...t].join(s);if(e.trim()==="")return{added:t,content:`${d}${s}`};const i=e.endsWith(`
|
|
5
|
+
`)?s:`${s}${s}`;return{added:t,content:`${e}${i}${d}${s}`}},E=e=>e==="docker"||e==="npm"||e==="slug"||e==="vercel",k=async(e,r)=>{try{return await e.readFile(r,"utf8")}catch{return""}},N=async({fs:e,logger:r,options:n,process:t,workspaceRoot:s})=>{const d=s??t.cwd,i=n.target??"docker";if(!E(i))throw new Error(`Invalid --target "${i}". Expected one of: docker, vercel, npm, slug.`);const o=f[i],c=p(d,o),g=await k(e,c),{added:a,content:l}=v(g,$(i));if(n.json){process.stdout.write(`${JSON.stringify({added:a,file:o,target:i},null,2)}
|
|
6
|
+
`);return}if(n.write){if(a.length===0){r.info(`${o} is already up to date (no new patterns).`);return}await e.writeFile(c,l),r.info(`Added ${a.length} pattern(s) to ${o}.`);return}process.stdout.write(l.endsWith(`
|
|
7
|
+
`)?l:`${l}
|
|
8
|
+
`),r.info(u(`(${a.length} new pattern(s); re-run with --write to save ${o})`))};export{N as default};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
`)
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
import{E as d}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as g,f as y,v as k,T as w,O as l}from"../packem_shared/index-BDmTbWX1.js";import{a as h,b as x,f as b}from"../packem_shared/subtree-C7bZuiSQ.js";import{o as u}from"../packem_shared/utils-Cxree603.js";import{m as A,s as R}from"./bin.js";import{a as $}from"./config.js";const j=["aube-workspace.yaml","pnpm-workspace.yaml"],v=/^\s*packages\s*:\s*$/,E=/^(\s*)-\s/,q=(c,i)=>{const r=c.includes(`\r
|
|
2
|
+
`)?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`,e=c.split(/\r?\n/),o=e.findIndex(t=>v.test(t));if(o===-1)return;let s=" ";for(let t=o+1;t<e.length;t++){const a=E.exec(e[t]);if(a){s=a[1];break}if(e[t].trim().length>0)break}return e.splice(o+1,0,`${s}- "${i}"`),e.join(r)},I=(c,i,r)=>{const e=g(c,"package.json");let o;try{o=$(e)}catch{return!1}const{workspaces:s}=o;return Array.isArray(s)?s.includes(i)?!1:(r||l(e,{...o,workspaces:[...s,i]},{detectIndent:!0}),!0):s&&typeof s=="object"&&Array.isArray(s.packages)?s.packages.includes(i)?!1:(r||l(e,{...o,workspaces:{...s,packages:[...s.packages,i]}},{detectIndent:!0}),!0):!1},P=({dryRun:c=!1,prefix:i,workspaceRoot:r})=>{const e=u(i),o=A(r);if(!o)return{status:"no-config"};if(R(r,o).some(s=>u(s)===e))return{status:"already-covered"};for(const s of j){const t=g(r,s);if(!y(t))continue;const a=q(k(t),e);if(a!==void 0)return c||w(t,a),{entry:e,file:s,status:"added"}}return I(r,e,c)?{entry:e,file:"package.json",status:"added"}:{status:"no-config"}},H=async({argument:c,fs:i,logger:r,options:e,process:o,workspaceRoot:s})=>{const t=c[0];if(!t)throw new Error("Missing <source>. Pass a git repository URL or local path to import.");if(!e.prefix)throw new Error("Missing --prefix <dir>. Pass the target directory in the monorepo (e.g. packages/tooling/foo).");const a=s??o.cwd,n=u(e.prefix),f=e.ref??"HEAD";if(h(a),await(async p=>{try{return await i.access(p),!0}catch{return!1}})(g(a,n)))throw new Error(`Target "${n}" already exists. git subtree add requires a non-existent prefix.`);if(e.dryRun){const p=e.squash?" --squash":"",m=e.message?` -m "${e.message}"`:"";r.info("Dry run — no changes will be made. Planned steps:"),r.info(` git subtree add --prefix=${n}${p}${m} ${t} ${f}`),e.noRegister||r.info(` register ${n} into the workspace config (skipped if already covered by an existing glob)`);return}if(x(a),r.info(`Importing ${d(t)}@${f} → ${n} ...`),b({cwd:a,message:e.message,prefix:n,ref:f,repo:t,squash:e.squash}),r.info(`✓ Imported ${t} into ${n} (history preserved).`),e.noRegister)r.info(d(`Skipped workspace registration (--no-register). Add ${n} to your workspace config manually.`));else{const p=P({prefix:n,workspaceRoot:a});p.status==="already-covered"?r.info(`✓ ${n} is already covered by an existing workspace glob.`):p.status==="added"?r.info(`✓ Registered ${p.entry} in ${p.file}.`):r.warn(`Could not auto-register ${n}: no workspace config found. Add it to pnpm-workspace.yaml or package.json#workspaces manually.`)}r.info(d("Note: project.json / nx tags are not generated. Add them if your tooling needs them."))};export{H as default};
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
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};
|
|
1
|
+
import{y as x}from"../packem_shared/index-BDmTbWX1.js";import{af as I,b as T}from"./bin.js";import{f as $}from"../packem_shared/selectors-GCJIe342.js";import{o as E}from"../packem_shared/index-CB4p298r.js";const b=(e,n)=>{for(const l of n)if(E(l,e))return!0;return!1},J=(e,n={})=>{const{depTypes:l,excludePatterns:f,externalOnly:y,includePatterns:d,internalOnly:j}=n;if(j&&y)return[];const u=l&&l.length>0?new Set(l):void 0,N=d&&d.length>0?d:void 0,O=f&&f.length>0?f:void 0,w=[];for(const m of e)j&&!m.isInternal||y&&m.isInternal||u&&!u.has(m.depType)||N&&(!m.packageName||!b(m.packageName,N))||O&&m.packageName&&b(m.packageName,O)||w.push(m);return w},C=new Set(["json","ndjson","table"]),q=e=>{if(e===void 0)return"table";const n=e.toLowerCase();if(!C.has(n))throw new Error(`--format must be one of: table, json, ndjson (got "${e}")`);return n},v=(e,n)=>({depName:e.depName,depType:e.depType,isInternal:e.isInternal,packageDir:e.packageDir,packageJsonPath:x(n,e.packageJsonPath),packageName:e.packageName,specifier:e.specifier}),S=new Set(["dependencies","devDependencies","optionalDependencies","overrides","peerDependencies","pnpm.overrides","resolutions"]),L=e=>{if(!e||e.length===0)return;const n=[],l=[];for(const f of e)for(const y of f.split(",")){const d=y.trim();d&&(S.has(d)?n.push(d):l.push(d))}if(l.length>0)throw new Error(`Unknown --dep-type value(s): ${l.join(", ")}. Valid: ${[...S].join(", ")}`);return n.length>0?n:void 0},U=async({logger:e,options:n,visConfig:l,workspaceRoot:f})=>{if(!f)throw new Error("Could not determine workspace root.");const y=q(n.format);if(n.deps===!0){if(n.internalOnly&&n.externalOnly)throw new Error("--internal-only and --external-only are mutually exclusive");const c=L(n.depType),i=I(f);let r=J(i,{depTypes:c,excludePatterns:n.exclude,externalOnly:n.externalOnly,includePatterns:n.include,internalOnly:n.internalOnly});if(n.query){const{workspace:t}=T(f,l),p=new Set($(Object.keys(t.projects),t,n.query));r=r.filter(k=>k.packageName!==void 0&&p.has(k.packageName))}const g=[...r].sort((t,p)=>{const k=`${t.packageName??t.packageDir} ${t.depType} ${t.depName}`,D=`${p.packageName??p.packageDir} ${p.depType} ${p.depName}`;return k.localeCompare(D)});if(y==="ndjson"){for(const t of g)e.info(JSON.stringify(v(t,f)));return}if(y==="json"){const t=g.map(p=>v(p,f));e.info(JSON.stringify(t,null,n.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(t=>[t.packageName??t.packageDir,t.depType,t.depName,t.specifier,t.isInternal?"yes":"no",x(f,t.packageJsonPath)]),s=a.map((t,p)=>Math.max(t.length,...o.map(k=>(k[p]??"").length))),h=(t,p)=>t.padEnd(p);e.info(a.map((t,p)=>h(t,s[p])).join(" ")),e.info(s.map(t=>"─".repeat(t)).join("──"));for(const t of o)e.info(t.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}=T(f,l);let u=Object.keys(j.projects).sort();if(n.query&&(u=$(u,j,n.query)),u.length===0){e.info("No projects found.");return}const N=n.inferred===!0,O=n.targets===!0||N;if(y==="json"){const c=u.map(i=>{const r=j.projects[i],g=d.get(i)??{},a=Object.entries(r.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:r.language,layer:r.layer,name:i,root:r.root,stack:r.stack,tags:r.tags??[],targets:a,type:r.projectType??"library"}});e.info(JSON.stringify(c,null,2));return}const w=(c,i)=>{const r=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=(a,o)=>a.padEnd(o);e.info(c.map((a,o)=>g(a,r[o])).join(" ")),e.info(r.map(a=>"─".repeat(a)).join("──"));for(const a of i)e.info(a.map((o,s)=>g(o,r[s])).join(" "))};if(O){const c=[];for(const i of u){const r=j.projects[i],g=d.get(i)??{};for(const a of Object.keys(r.targets??{}).sort()){const o=g[a],s=o?.inferred===!0;if(N&&!s)continue;const h=r.targets?.[a],t=h?.cache===!1?"no":h?.cache===!0?"yes":"default";c.push([i,a,o?.type??"—",t,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"],P=u.map(c=>{const i=j.projects[c],r=Object.keys(i.targets??{});return[c,i.projectType??"library",i.layer??"—",(i.tags??[]).join(", ")||"—",r.length>4?`${r.slice(0,4).join(", ")}… (${String(r.length)})`:r.join(", ")||"—"]});w(m,P),e.info(""),e.info(`${String(u.length)} project(s)`)};export{U as default};
|