@visulima/vis 6.5.3 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +17 -2
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +1 -1
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler32.js +1 -1
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +1 -1
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler52.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +8 -6
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +1 -1
- package/dist/packem_chunks/handler61.js +1 -1
- package/dist/packem_chunks/handler62.js +1 -1
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +1 -1
- package/dist/packem_chunks/handler65.js +1 -1
- package/dist/packem_chunks/handler66.js +1 -1
- package/dist/packem_chunks/handler67.js +1 -1
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +1 -1
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +1 -1
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +10 -10
- package/dist/packem_chunks/handler78.js +1 -1
- package/dist/packem_chunks/handler79.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index7.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/prune.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 +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{ReleaseClient-Bg-9akuc.js → ReleaseClient-C2xIJ6LK.js} +1 -1
- package/dist/packem_shared/{advisories-CzYpfK5t.js → advisories-BldM-U4F.js} +1 -1
- package/dist/packem_shared/{affected-selection-BdLNvNcE.js → affected-selection-DxKQo2N5.js} +1 -1
- package/dist/packem_shared/{ai-analysis-DAZka8TK.js → ai-analysis-D1Y5a_SZ.js} +1 -1
- package/dist/packem_shared/{ai-cache-BdYWMXBs.js → ai-cache-CSmj5gA2.js} +1 -1
- package/dist/packem_shared/{ai-fix-WyWS6pLg.js → ai-fix-DVcnNQ0X.js} +1 -1
- package/dist/packem_shared/{bin-DeFLi46P.js → bin-Bw91EYm6.js} +1 -1
- package/dist/packem_shared/{build-scripts-Cxqumymu.js → build-scripts-ETlkUGzC.js} +1 -1
- package/dist/packem_shared/{dependency-scan-CFBQmGvr.js → dependency-scan-Dv1kJ-Sn.js} +1 -1
- package/dist/packem_shared/{detect-DBbY9ufF.js → detect-Bch1mcQe.js} +1 -1
- package/dist/packem_shared/{docker-MC4VH-op.js → docker-DPxeLIQl.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-D3QeNZpU.js → ecosystem-gate-IugL9cei.js} +1 -1
- package/dist/packem_shared/{env-B2G7w--D.js → env-D3wteXlq.js} +1 -1
- package/dist/packem_shared/{env-consistency-p-t6Gohk.js → env-consistency-1rRSdrFI.js} +1 -1
- package/dist/packem_shared/{failure-log-C5v0g1UG.js → failure-log-Dgp-P-SJ.js} +1 -1
- package/dist/packem_shared/glob-Cyk1H9ZL-D0MQr5DW.js +1 -0
- package/dist/packem_shared/{index-CnaYwWPH.js → index-BTwTRy_a.js} +1 -1
- package/dist/packem_shared/{index-uCBemJvQ.js → index-DojXARzs.js} +1 -1
- package/dist/packem_shared/{lifecycle-CI9atpzK.js → lifecycle-C6o0cmOT.js} +1 -1
- package/dist/packem_shared/{manifests-BqnHxiJw.js → manifests-CgiKqpP8.js} +1 -1
- package/dist/packem_shared/{min-release-age-CxUqkjTg.js → min-release-age-RVDHqGu5.js} +1 -1
- package/dist/packem_shared/{missing-package-json-DFyB93V7.js → missing-package-json-Cf7PavlK.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-BZGGj6Fi.js → multi-eco-lockfiles-B3591j5D.js} +1 -1
- package/dist/packem_shared/{native-config-sync-B5PDu-SO.js → native-config-sync-BGLC8n86.js} +1 -1
- package/dist/packem_shared/{osv-Ddp0z-bz.js → osv-CI9eaGmG.js} +1 -1
- package/dist/packem_shared/{package-version-9yJPO26I.js → package-version-COyEFX59.js} +1 -1
- package/dist/packem_shared/{packument-CFahFBqP.js → packument-Dij7POVt.js} +1 -1
- package/dist/packem_shared/{project-name-filter-VxqvZKPm.js → project-name-filter-B7h62wuR.js} +1 -1
- package/dist/packem_shared/{provenance-BhiFbitj.js → provenance-BVFxzkUv.js} +1 -1
- package/dist/packem_shared/publish-missing-CZK1BpWt.js +38 -0
- package/dist/packem_shared/{registry-1z4qCjta.js → registry-CyYhBUaF.js} +41 -41
- package/dist/packem_shared/{registry-keys-klG8wS_f.js → registry-keys-BwWnVZtb.js} +1 -1
- package/dist/packem_shared/{renderToString-DR0zDUjh-3-n2BqOz.js → renderToString-DR0zDUjh-CQT5Ebrc.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-CpJczFGv.js → resolve-explicit-BshyrPRh.js} +1 -1
- package/dist/packem_shared/{run-Bwpi35uP.js → run-BvhcgfRq.js} +4 -4
- package/dist/packem_shared/{run-summary-utils-BL-RMEdt.js → run-summary-utils-RzgHeC8f.js} +1 -1
- package/dist/packem_shared/{runtime-check-CBsebG-M.js → runtime-check-CpBsIYcl.js} +1 -1
- package/dist/packem_shared/{s1ngularity-C6Ii80Le.js → s1ngularity-Bb56bc8v.js} +1 -1
- package/dist/packem_shared/{scaffold-files-BikhXmvZ.js → scaffold-files-sbf-Y1nQ.js} +1 -1
- package/dist/packem_shared/{scan-progress-IsWCbrjW.js → scan-progress-Blrj96LZ.js} +1 -1
- package/dist/packem_shared/{selectors-CphDx0OL.js → selectors-DmRRUQsG.js} +1 -1
- package/dist/packem_shared/{signatures-C4xf8cQc.js → signatures-DlGMQsHg.js} +1 -1
- package/dist/packem_shared/{spinner-DfeFPP3z.js → spinner-B30I9gQR.js} +1 -1
- package/dist/packem_shared/{table-GSeva_9X.js → table-ahQIE6tw.js} +1 -1
- package/dist/packem_shared/{tabs-aakFF28o.js → tabs-K9dH5Qdu.js} +1 -1
- package/dist/packem_shared/{toolchain-BbvTtdLc.js → toolchain-B7PrWDAi.js} +1 -1
- package/dist/packem_shared/{typosquats-Bq2GBIIs.js → typosquats-Dn2ahBS1.js} +1 -1
- package/dist/packem_shared/{use-measured-height-BH7aFaQg.js → use-measured-height-D5xfIDWl.js} +1 -1
- package/dist/packem_shared/{vis-update-app-Iqgng6iv.js → vis-update-app-CPpJkbSs.js} +1 -1
- package/dist/packem_shared/{vis-user-error-84uG5ZNC.js → vis-user-error-C3y9hGtw.js} +1 -1
- package/dist/packem_shared/{watch-loop-R_T4KYMz.js → watch-loop-DQ6KryuH.js} +1 -1
- package/dist/release/index.js +1 -1
- package/index.js +26 -26
- package/package.json +9 -9
- package/schemas/project.schema.json +9 -2
- package/schemas/vis-config.schema.json +11 -4
- package/schemas/vis-release-config.schema.json +2 -2
- package/dist/packem_shared/glob-Cyk1H9ZL-DAxMgZXi.js +0 -1
- package/dist/packem_shared/publish-missing-CMN5bbJ5.js +0 -35
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as T}from"node:module";import"../packem_shared/index-0dnGN3GP.js";import{o as A,d as I}from"../packem_shared/registry-
|
|
1
|
+
import{createRequire as T}from"node:module";import"../packem_shared/index-0dnGN3GP.js";import{o as A,d as I}from"../packem_shared/registry-CyYhBUaF.js";import{p as c,h as N}from"./cli-main.js";import{p as L,i as R,r as v,g as H,s as M,a as b,S as W,b as O,c as P,d as U,e as D}from"../packem_shared/lifecycle-C6o0cmOT.js";import{r as q,l as z}from"../packem_shared/target-options-rIthWS4M.js";let C;const _=s=>(C??=T(import.meta.url))(s),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=s=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[e,r]=w.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return w.getBuiltinModule(s)}return _(s)},{open:E,stat:$,watch:F}=j("node:fs/promises"),h=async s=>{const e=s?.plugins;if(!e||e.length===0)return;const r=U();return await D(r,e),{callHook:async(d,...o)=>{try{await r.callHook(d,...o)}catch(t){const a=t instanceof Error?t.message:String(t);c.warn(`Plugin error in ${d}: ${a}`)}}}},V=s=>{const e=s.trim(),r=e.lastIndexOf(":");if(!(r<=0||r===e.length-1))return{project:e.slice(0,r),target:e.slice(r+1)}},y=async(s,e,r)=>{const d=V(r);if(!d){c.error(`Invalid target id "${r}". Expected "<project>:<target>", e.g. "@my/api:db".`);return}const o=await A(s,e),{projectOptions:t,workspace:a}=I(s,e,o),i=a.projects[d.project],n=t.get(d.project)?.[d.target];if(!i||!n){c.error(`Target "${r}" not found in this workspace.`);return}const p=n.options?.service;if(!p){c.error(`Target "${r}" is not a service. Add an \`options.service\` block to make it eligible for \`vis service\`.`);return}if(!n.command){c.error(`Target "${r}" has no command — services must be runnable.`);return}const g=q(s,i.root,n.options?.runFromWorkspaceRoot===!0),u=n.options?.envFile?z(g,n.options.envFile):{};return{command:n.command,cwd:g,env:{...u,...p.env},service:p,target:n,targetId:r}},m=s=>{if(!s)throw new Error("Could not determine workspace root. Run `vis service` inside a workspace.");return s},re=async({argument:s,options:e,visConfig:r,workspaceRoot:d})=>{const o=m(d),t=s[0]?.trim();if(!t){c.error("Missing target id. Usage: vis service start <project>:<target>"),process.exitCode=1;return}const a=await y(o,r,t);if(!a){process.exitCode=1;return}try{const{entry:i}=await b({command:a.command,config:a.service,cwd:a.cwd,env:a.env,id:t,readinessTimeoutMs:e.timeout,skipReadiness:e.readiness===!1,workspaceRoot:o});await(await h(r))?.callHook("service:start",i),c.success(`Started ${t} (pid ${String(i.pid)})`),c.info(` log: ${i.logFile}`)}catch(i){const n=i instanceof Error?i.message:String(i);i instanceof W?c.error(`Readiness probe failed for ${t}: ${n}`):c.error(`Failed to start ${t}: ${n}`),process.exitCode=1}},S=async({graceMs:s,hookSink:e,id:r,workspaceRoot:d})=>{const o=await v(d,r),{stopped:t}=await M({graceMs:s,id:r,workspaceRoot:d});return t?(o&&await e?.callHook("service:stop",o),c.success(`Stopped ${r}`),!0):(c.info(`No running service registered for ${r}`),!1)},se=async({argument:s,options:e,visConfig:r,workspaceRoot:d})=>{const o=m(d),{graceMs:t}=e,a=s[0]?.trim(),i=await h(r);if(e.all){if(a){c.error("Cannot combine --all with a target id. Use one or the other."),process.exitCode=1;return}const p=await P(o);if(p.length===0){c.info("No running services registered for this workspace.");return}for(const g of p)await S({graceMs:t,hookSink:i,id:g.id,workspaceRoot:o});return}if(!a){c.error("Missing target id. Usage: vis service stop <project>:<target> | --all"),process.exitCode=1;return}await S({graceMs:t,hookSink:i,id:a,workspaceRoot:o})||(process.exitCode=1)},B=s=>{const e=s.config.readiness?.tcp.port??s.config.port;return e===void 0?"—":String(e)},x=new Set(["json","table"]),oe=async({logger:s,options:e,workspaceRoot:r})=>{const d=m(r),o=e.format??"table";if(!x.has(o)){c.error(`Invalid --format "${o}". Expected one of: ${[...x].sort().join(", ")}.`),process.exitCode=1;return}const{surviving:t}=await L(d);if(o==="json"){const l=Date.now();process.stdout.write(`${JSON.stringify(t.map(f=>{const k=Date.parse(f.startedAt);return{ageMs:Number.isFinite(k)?l-k:null,alive:R(f.pid),command:f.command,cwd:f.cwd,env:f.env,id:f.id,logFile:f.logFile,pid:f.pid,port:f.config.readiness?.tcp.port??f.config.port??null,startedAt:f.startedAt,visVersion:f.visVersion}}),void 0,2)}
|
|
2
2
|
`);return}if(t.length===0){c.info("No running services registered for this workspace.");return}const a=Date.now(),i=t.map(l=>{const f=Date.parse(l.startedAt);return{age:Number.isFinite(f)?N(f,a):"?",id:l.id,log:l.logFile,pid:String(l.pid),port:B(l)}}),n=Math.max(2,...i.map(l=>l.id.length)),p=Math.max(3,...i.map(l=>l.pid.length)),g=Math.max(4,...i.map(l=>l.port.length)),u=Math.max(3,...i.map(l=>l.age.length));s.info(` ${"id".padEnd(n)} ${"pid".padEnd(p)} ${"port".padEnd(g)} ${"age".padEnd(u)} log`),s.info(` ${"-".repeat(n)} ${"-".repeat(p)} ${"-".repeat(g)} ${"-".repeat(u)} ---`);for(const l of i)s.info(` ${l.id.padEnd(n)} ${l.pid.padEnd(p)} ${l.port.padEnd(g)} ${l.age.padEnd(u)} ${l.log}`)},ie=async({argument:s,options:e,workspaceRoot:r})=>{const d=m(r),o=s[0]?.trim();if(!o){c.error("Missing target id. Usage: vis service status <project>:<target>"),process.exitCode=1;return}const t=await v(d,o);if(!t){c.error(`No service registered for ${o}.`),process.exitCode=1;return}if(!R(t.pid)){c.error(`Service ${o} is not running (pid ${String(t.pid)} is dead). Run \`vis service start ${o}\` to recover.`),process.exitCode=1;return}try{await O(t.config,{timeoutMs:e.timeout}),c.success(`${o} healthy (pid ${String(t.pid)})`)}catch(a){const i=a instanceof Error?a.message:String(a);c.error(`${o} probe failed: ${i}`),process.exitCode=1}},ae=async({argument:s,options:e,visConfig:r,workspaceRoot:d})=>{const o=m(d),t=s[0]?.trim();if(!t){c.error("Missing target id. Usage: vis service restart <project>:<target>"),process.exitCode=1;return}const a=await h(r),i=await v(o,t);(await M({graceMs:e.graceMs,id:t,workspaceRoot:o})).stopped&&i&&await a?.callHook("service:stop",i);const p=await y(o,r,t);if(!p){process.exitCode=1;return}try{const{entry:g}=await b({command:p.command,config:p.service,cwd:p.cwd,env:p.env,id:t,readinessTimeoutMs:e.timeout,skipReadiness:e.readiness===!1,workspaceRoot:o});await a?.callHook("service:start",g),c.success(`Restarted ${t} (pid ${String(g.pid)})`)}catch(g){const u=g instanceof Error?g.message:String(g);c.error(`Failed to restart ${t}: ${u}`),process.exitCode=1}},G=200,J=1024*1024,K=async s=>{let e=0;try{e=(await $(s)).size}catch{e=0}const r=new AbortController;let d=!1;const o=()=>{d=!0,r.abort()},t=()=>{r.abort()};process.on("SIGINT",o),process.on("SIGTERM",t);let a=!1;const i=async()=>{if(!a){a=!0;try{const n=await $(s).catch(()=>{});if(!n||(n.size<e&&(e=0),n.size===e))return;const p=n.size-e,g=Math.min(p,J),u=await E(s,"r");try{const l=Buffer.alloc(g);await u.read(l,0,g,e),process.stdout.write(l),e+=g}finally{await u.close().catch(()=>{})}}finally{a=!1}}};try{const n=(async()=>{try{const p=F(s,{signal:r.signal});for(;!(await p.next()).done;)await i()}catch{}})();for(;!r.signal.aborted;)await i(),await new Promise(p=>{const g=setTimeout(p,G);r.signal.addEventListener("abort",()=>{clearTimeout(g),p()},{once:!0})});await n.catch(()=>{}),await i().catch(()=>{})}finally{process.off("SIGINT",o),process.off("SIGTERM",t)}d&&(process.exitCode=130)},ne=async({argument:s,options:e,workspaceRoot:r})=>{const d=m(r),o=s[0]?.trim();if(!o){c.error("Missing target id. Usage: vis service logs <project>:<target>"),process.exitCode=1;return}const t=await v(d,o);if(!t){c.error(`No service registered for ${o}.`),process.exitCode=1;return}if(!await H(t.logFile)){c.warn(`Log file is missing for ${o}: ${t.logFile}`),process.exitCode=1;return}if(e.follow){await K(t.logFile);return}const a=await E(t.logFile,"r");try{const i=a.createReadStream();await new Promise((n,p)=>{i.on("end",n),i.on("error",p),i.pipe(process.stdout,{end:!1})})}finally{await a.close().catch(()=>{})}};export{oe as serviceListExecute,ne as serviceLogsExecute,ae as serviceRestartExecute,re as serviceStartExecute,ie as serviceStatusExecute,se as serviceStopExecute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as v}from"../packem_shared/index.server-Ca_EEVfw.js";import{v as R,e as y}from"../packem_shared/index-0dnGN3GP.js";import{d as j}from"../packem_shared/registry-
|
|
1
|
+
import{F as v}from"../packem_shared/index.server-Ca_EEVfw.js";import{v as R,e as y}from"../packem_shared/index-0dnGN3GP.js";import{d as j}from"../packem_shared/registry-CyYhBUaF.js";import{a as C,b as g,s as x,i as B,c as D,p as P,d as E,r as N,e as A}from"../packem_shared/subtree-DtmcKAJK.js";import{s as W,n as k}from"../packem_shared/utils-DQFHJn72.js";const z=async(u,m,t)=>{const e=m[u];if(e?.root)return{pkgName:u,relativeDir:k(e.root)};const o=k(u);if(o.length>0&&await t(o))return{pkgName:o.split("/").pop()??o,relativeDir:o}},K=async({argument:u,fs:m,logger:t,options:e,process:o,visConfig:h,workspaceRoot:b})=>{const p=u[0];if(!p)throw new Error("Missing <package>. Pass a project name or a workspace-relative path.");if(!e.dryRun&&!e.output)throw new Error("Missing --output <dir>. Pass the destination directory for the new repo (or use --dry-run).");const r=b??o.cwd;C(r);const{workspace:$}=j(r,h),w=async i=>{try{return await m.access(i),!0}catch{return!1}},l=await z(p,$.projects,i=>w(y(r,i,"package.json")));if(!l){const i=Object.keys($.projects).sort().join(", ");throw new Error(`Unknown package "${p}". Known projects: ${i||"(none)"}.`)}const{pkgName:f,relativeDir:n}=l,s=e.branch??h?.defaultBase??"main",d=`vis/split/${W(n.replaceAll("/","-"))}`,c=e.output?R(e.output)?e.output:y(r,e.output):void 0;if(e.dryRun){t.info("Dry run — no changes will be made. Planned git commands:"),t.info(` git subtree split --prefix=${n}${e.annotate?` --annotate=(${f}) `:""} -b ${d}`),c&&(t.info(` git -C ${c} init -b ${s}`),t.info(` git -C ${c} pull ${r} ${d}`)),e.remote&&t.info(` git -C ${c??"<output>"} remote add origin ${e.remote}`),e.push&&t.info(` git -C ${c??"<output>"} push -u origin ${s}`),e.remove&&t.info(` git rm -r ${n} && git commit (in ${r})`);return}const a=c;if(await w(a)){if((await m.readdir(a)).length>0&&!e.force)throw new Error(`${a} is not empty. Re-run with --force to use it anyway.`)}else await m.mkdir(a,{recursive:!0});e.remove&&g(r),t.info(`Splitting ${v(n)} → ${a} ...`);try{x({annotate:e.annotate?`(${f}) `:void 0,branch:d,cwd:r,prefix:n}),B({branch:s,source:r,sourceBranch:d,target:a}),e.remote?(D("origin",e.remote,a),e.push&&P("origin",s,a)):e.push&&t.warn("--push ignored: no --remote provided.");const i=E(s,a);t.info(`✓ Extracted ${f} with ${i} commit(s) to ${a}`),e.remove&&(N(n,`chore(${f}): split out to standalone repo`,r),t.info(`✓ Removed ${n} from the monorepo (committed).`)),e.remote||t.info(v(`Next: cd ${a} && git remote add origin <url> && git push -u origin ${s}`))}finally{try{A(d,r)}catch{}}};export{K as default,z as resolvePackageDirectory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as T,J as a,b as S,X as y}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as V}from"../packem_shared/index-0dnGN3GP.js";import{enforceProjectConstraints as v}from"@visulima/task-runner";import{d as x,b as J}from"../packem_shared/registry-
|
|
1
|
+
import{F as T,J as a,b as S,X as y}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as V}from"../packem_shared/index-0dnGN3GP.js";import{enforceProjectConstraints as v}from"@visulima/task-runner";import{d as x,b as J}from"../packem_shared/registry-CyYhBUaF.js";import{j as w}from"./cli-main.js";import{c as z}from"../packem_shared/runtime-check-CpBsIYcl.js";import{a as D}from"../packem_shared/env-D3wteXlq.js";import{y as G}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{p as H}from"../packem_shared/package-version-COyEFX59.js";const e=c=>c?a("✓"):y("✗"),N=async({fs:c,logger:t,options:b,visConfig:g,workspaceRoot:n})=>{if(!n)throw new Error("Could not determine workspace root.");const{config:h,packageJsons:C,workspace:f}=x(n,g),O=J(n,f,C),k=Object.keys(f.projects).length,$=new Set(Object.values(f.projects).flatMap(d=>Object.keys(d.targets??{}))).size,i=z(n);let s=0;h.constraints&&(s=v(O,h.constraints).length);const o=w(n,{minRuns:2});let r;const l=D(n);if(G(l)){const F=(await c.readdir(l)).filter(u=>u.endsWith(".json")).sort();let p=0,j=0;for(const u of F.slice(-20))try{const m=H(V(l,u));m.stats&&(p+=m.stats.total??0,j+=m.stats.cached??0)}catch{continue}p>0&&(r=`${(j/p*100).toFixed(0)}%`)}if(b.json){t.info(JSON.stringify({cacheHitRate:r??null,constraintViolations:s,flakyTasks:o.length,projects:k,runtimeIssues:i.length,targets:$},null,2));return}t.info(""),t.info(` ${T("VIS STATUS")}`),t.info(""),t.info(` ${e(!0)} ${String(k)} projects · ${String($)} unique targets`),t.info(` ${e(i.length===0)} Runtime: ${i.length===0?a("OK"):S(`${String(i.length)} issue(s)`)}`),t.info(` ${e(s===0)} Constraints: ${s===0?a("OK"):y(`${String(s)} violation(s)`)}`),t.info(` ${e(o.length===0)} Flaky tasks: ${o.length===0?a("none"):S(String(o.length))}`),r&&t.info(` ${e(!0)} Cache hit rate: ${r} (last 20 runs)`),t.info("")};export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createTaskGraph as m}from"@visulima/task-runner";import{d as b,b as v}from"../packem_shared/registry-
|
|
1
|
+
import{createTaskGraph as m}from"@visulima/task-runner";import{d as b,b as v}from"../packem_shared/registry-CyYhBUaF.js";const y=(a,t)=>{const s=new Map;for(const[i,o]of Object.entries(a.dependencies))for(const p of o){const c=s.get(p)??[];c.push(i),s.set(p,c)}if(!a.tasks[t])return;const r=new Set([t]),e=[{node:t,path:[t]}];for(;e.length>0;){const i=e.shift();if(a.roots.includes(i.node))return i.path;for(const o of s.get(i.node)??[])r.has(o)||(r.add(o),e.push({node:o,path:[o,...i.path]}))}return[t]},E=(a,t)=>{const s=[];for(const[r,e]of Object.entries(a.dependencies))e.includes(t)&&s.push(r);return s.sort()},I=async({argument:a,logger:t,visConfig:s,workspaceRoot:r})=>{if(!r)throw new Error("Could not determine workspace root.");const e=a[0];if(!e)throw new Error("No task ID specified. Usage: vis task-why <project>:<target>");if(!e.includes(":"))throw new Error(`Invalid task ID "${e}" — expected format "project:target".`);const{packageJsons:i,workspace:o}=b(r,s),p=v(r,o,i),[c,j]=e.split(":",2),$=o.projects[c];if(!$)throw new Error(`Unknown project "${c}".`);if(!$.targets?.[j])throw new Error(`Project "${c}" has no target "${j}".`);const l=Object.entries(o.projects).flatMap(([n,w])=>Object.keys(w.targets??{}).map(d=>({id:`${n}:${d}`,outputs:[],overrides:{},target:{project:n,target:d}}))),f=m(l,{projectGraph:p,workspace:o});if(!f.tasks[e])throw new Error(`Task "${e}" is not reachable in the graph.`);const h=y(f,e),u=E(f,e);if(t.info(""),t.info(`Why ${e}?`),t.info(""),h&&h.length>1){t.info("Shortest path from a root to this task:");for(const[n,w]of h.entries()){const d=n===0?" ":`${" ".repeat(n+1)}└─ `;t.info(`${d}${w}`)}t.info("")}else t.info(" This task is itself a root — nothing upstream depends on it."),t.info("");if(u.length>0){t.info(`Directly depended on by ${u.length} task(s):`);for(const n of u)t.info(` - ${n}`);t.info("")}const k=f.dependencies[e]??[];if(k.length>0){t.info(`This task depends on ${k.length} task(s):`);for(const n of[...k].sort())t.info(` - ${n}`);t.info("")}};export{I as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as M}from"node:module";import{F as g,J as k,X as A,b as W}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as S}from"../packem_shared/index-0dnGN3GP.js";import{p as o}from"./cli-main.js";import{c as B}from"../packem_shared/env-consistency-
|
|
1
|
+
import{createRequire as M}from"node:module";import{F as g,J as k,X as A,b as W}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as S}from"../packem_shared/index-0dnGN3GP.js";import{p as o}from"./cli-main.js";import{c as B}from"../packem_shared/env-consistency-1rRSdrFI.js";import{p as O,g as w,S as x,w as j,b as R,a as q,f as C,c as _,d as H,u as b,e as K,h as L}from"../packem_shared/toolchain-B7PrWDAi.js";let I;const F=e=>(I??=M(import.meta.url))(e),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[n,i]=h.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return h.getBuiltinModule(e)}return F(e)},{spawnSync:U}=N("node:child_process"),y=["aube","bun","go","node","npm","pnpm","python","ruby","rust","yarn"],D=e=>y.includes(e),v=e=>e?k("✓"):A("✗"),E=W("⚠"),J=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`${E} ${e.name} — referenced by ${e.configFiles.join(", ")} but not installed`},z=e=>{if(e.matches)return"";const{manager:n}=e;return n.name==="none"?g("→ (no manager)"):n.name==="self-activate"?"":n.installed?g(`→ ${n.name}`):g(`→ ${n.name} (missing)`)},G=e=>e.matches?v(!0):e.actual?E:v(!1),X=e=>{if(o.info(""),o.info(g("── Toolchain ───────────────────────")),e.detected.length===0)o.info(` ${v(!1)} No version manager detected`),o.notice(` Install one of: ${x.join(", ")}`);else for(const n of e.detected)o.info(` ${J(n)}`);if(o.info(""),e.tools.length===0){o.info(` ${g("No tool pins found — add engines.node, .nvmrc, or a manager config file.")}`);return}o.info(g("── Tools ───────────────────────────"));for(const n of e.tools){const i=`${n.expected.tool} ${n.expected.version}`,a=n.actual?`actual ${n.actual}`:"not installed",l=n.matches?"":g(` [${n.expected.source}]`),t=z(n),s=t===""?"":` ${t}`;o.info(` ${G(n)} ${i} — ${a}${l}${s}`),n.manager.note&&o.notice(` ${n.manager.note}`)}},Q=(e,n,i)=>{const a=w(e,n),l=B(e).filter(s=>s.status==="warn").map(s=>s.message);if(i.json){process.stdout.write(`${JSON.stringify({declarationWarnings:l,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
2
|
`);return}if(X(a),l.length>0){o.info("");for(const s of l)o.warn(` ${s}`)}const t=a.tools.filter(s=>!s.matches);t.length>0&&(o.info(""),o.notice(" Run `vis toolchain install` to install pinned versions.")),i.exitCode&&t.length>0&&(process.exitCode=1)},V=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},P=(e,n,i)=>U(e,n,{cwd:i,stdio:"inherit"}).status??1,Y=(e,n,i)=>{const a=w(e,n),l=a.tools.filter(d=>!d.matches);if(l.length===0){o.success("Everything already matches — nothing to install.");return}const t=l.some(d=>d.manager.name!=="self-activate"&&d.manager.name!=="none");if(a.detected.length===0&&t){o.error(`No version manager detected. Install one of: ${x.join(", ")}.`),process.exitCode=1;return}const s=V(l);let u=!1,c=0;for(const[d,f]of s){if(d==="self-activate"){for(const{expected:r}of f){if(r.source==="packageManager")o.info(`${g("$")} (${r.tool} will self-activate from the package.json pin on next invocation)`);else if(o.info(`${g("$")} Pinning ${r.tool}@${r.version} in package.json`),i.dryRun)u=!0;else try{j(e,r),u=!0}catch(p){o.error(p.message),c=1}o.notice(` ${r.tool} ${r.version} — no install needed`)}continue}if(d==="none"){for(const{expected:r}of f)o.warn(`Cannot install ${r.tool} ${r.version} — no manager can handle it.`);c=1;continue}if(!a.detected.find(r=>r.name===d)?.installed){o.error(`${d} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),c=1;continue}const T=f.map(r=>R(d,r.expected)).filter(Boolean);for(const r of T){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}`),c=1;continue}if(o.info(`${g("$")} ${r.bin} ${r.args.join(" ")}`),r.hint&&o.notice(` ${r.hint}`),i.dryRun){u=!0;continue}const p=P(r.bin,r.args,e);if(u=!0,p!==0){c=p;break}}}if(c!==0){process.exitCode=c;return}u&&o.success("Toolchain installed.")},Z=async(e,n,i,a,l)=>{if(!a)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const t=q(a);if(!t)throw new Error(`Could not parse "${a}". Expected "<tool>@<version>" where <tool> is one of ${y.join(", ")}.`);const s=C(n),u=_(t,s,i);if(u.name==="none"){o.error(`No manager can pin ${t.tool}. Install one of: ${x.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 c=H(u.name,t);if(!c){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(`${g("→")} Pinning the version in package.json...`),l.dryRun){o.notice(` Would pin ${t.tool}@${t.version} in package.json`);return}try{const f=j(n,t);if(!f){o.error(`Refusing to pin non-package-manager tool ${t.tool} in package.json.`),process.exitCode=1;return}if(o.success(`Pinned ${f} in package.json — ${t.tool} will activate this version on next invocation.`),l.engines!==!1){const m=b(n,t);m&&o.success(`Updated package.json engines.${t.tool} → ${m}.`)}}catch(f){o.error(f.message),process.exitCode=1}return}if(c.args.length===0&&u.name==="nvm"&&t.tool==="node"){const f=S(n,".nvmrc");if(o.info(`${g("→")} Writing ${f}...`),l.dryRun){o.notice(` Would write ${t.version} to .nvmrc`);return}try{await e.writeFile(f,`${t.version}
|
|
3
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(c.args.length===0){o.error(`${u.name} cannot pin ${t.tool} from a subprocess. ${c.configChange?.hint??""}`),c.configChange&&o.notice(` Edit ${c.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(o.info(`${g("$")} ${c.bin} ${c.args.join(" ")}`),c.configChange&&o.notice(` Will update ${c.configChange.file} — ${c.configChange.hint}`),l.dryRun)return;const d=P(c.bin,c.args,n);if(d!==0){process.exitCode=d;return}if(o.success(`Pinned ${t.tool} to ${t.version}.`),l.engines!==!1)try{const f=b(n,t);f&&o.success(`Updated package.json engines.${t.tool} → ${f}.`)}catch(f){o.warn(`Could not update engines.${t.tool}: ${f.message}`)}},ee=(e,n,i)=>{if(!i)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const a=i.toLowerCase();if(!D(a))throw new Error(`Unknown tool "${i}". Known: ${y.join(", ")}.`);const l=C(e),t=_({source:"vis.config.ts",tool:a,version:"*"},l,n),s=t.installed&&t.name!=="self-activate"&&t.name!=="none"?l.find(c=>c.name===t.name):void 0,u=s?K(s,a):L(a);if(!u){o.error(`${i} not found in PATH${s?` or via ${s.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${u}
|
|
4
4
|
`)},ne=(e,n)=>{const i=O(e,n);process.stdout.write(`${i.name}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as u}from"node:module";import{g as m}from"../packem_shared/package-version-
|
|
1
|
+
import{createRequire as u}from"node:module";import{g as m}from"../packem_shared/package-version-COyEFX59.js";let a;const f=t=>(a??=u(import.meta.url))(t),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=t=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,s]=r.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return r.getBuiltinModule(t)}return f(t)},{execSync:l,spawnSync:p}=d("node:child_process"),y=async({argument:t,logger:e,options:s})=>{const o=t?.[0];e.info("info: checking for updates...");const i=m();let n;try{const c=l("npm view @visulima/vis version",{encoding:"utf8"}).trim();n=o??c}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(i===n&&!s.force){e.info(`
|
|
2
2
|
✓ Already up to date (${i})`);return}if(s.check){i===n?e.info(`✓ Already up to date (${i})`):e.info(`info: found @visulima/vis@${n} (current: ${i})`);return}if(e.info(`info: found @visulima/vis@${n} (current: ${i})`),e.info("info: installing..."),p("npm",["install","-g",`@visulima/vis@${n}`],{encoding:"utf8",stdio:"inherit"}).status!==0)throw new Error("Failed to update. Try running with sudo or fix npm permissions.");e.info(`
|
|
3
3
|
✓ Updated @visulima/vis from ${i} → ${n}`)};export{y as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e as C}from"../packem_shared/index-0dnGN3GP.js";import{r as P}from"./cli-main.js";import{d as b,b as x}from"../packem_shared/registry-
|
|
1
|
+
import{e as C}from"../packem_shared/index-0dnGN3GP.js";import{r as P}from"./cli-main.js";import{d as b,b as x}from"../packem_shared/registry-CyYhBUaF.js";import{V as f}from"../packem_shared/vis-user-error-C3y9hGtw.js";import{s as I}from"../packem_shared/affected-selection-DxKQo2N5.js";import{f as D,a as R}from"../packem_shared/selectors-DmRRUQsG.js";const v=(r,e)=>{if(r.length>0)return[...r];const a=e.indexOf("affected",2);return a===-1?[]:e.slice(a+1)},T=async({argument:r,options:e,process:a,rawArgv:h,runtime:p,visConfig:o,workspaceRoot:i})=>{if(!r[0])throw new f("Missing target. Usage: vis affected <target>");if(!i)throw new f("Could not determine workspace root. Run this command inside a monorepo.");if(e.sparseCheckout){const c=i,{config:n,fileOwners:g,packageJsons:l,workspace:t}=b(c,o),w=x(c,t,l),j=n.taskRunner??{},k=P({branchScopedCache:n.branchScopedCache,configCacheDir:j.cacheDirectory,optionsCacheDir:void 0,sharedWorktreeCache:n.sharedWorktreeCache,workspaceRoot:c}),y=await I({base:e.base,downstream:e.downstream,head:e.head,uncommitted:e.uncommitted,upstream:e.upstream},{fileOwners:g,namedInputs:o?.namedInputs,projectGraph:w,projects:t.projects,workspaceRoot:c},{affectedIgnore:o?.affectedIgnore,defaultBase:o?.defaultBase,externalInputStatePath:C(k,"external-inputs.json")});let d=D(y.affectedProjects,t,e.query);d=R(d,t,e.tag);const m=[...new Set(d.map(u=>t.projects[u]?.root??u))].sort();process.stdout.write(m.length>0?`${m.join(`
|
|
2
2
|
`)}
|
|
3
3
|
`:"");return}const s=v(h??[],a?.argv??[]);if(s.length===0)throw new f("Missing target. Usage: vis affected <target>");await p.runCommand("run",{argv:s.includes("--affected")?s:[...s,"--affected"]})};export{T as default,v as forwardedArgv};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{releaseChangelog as i}from"../packem_shared/ReleaseClient-
|
|
1
|
+
import{releaseChangelog as i}from"../packem_shared/ReleaseClient-C2xIJ6LK.js";const f=async({logger:e,options:t,workspaceRoot:r})=>{const s=r??process.cwd(),c=t.filter?t.filter.split(",").map(n=>n.trim()).filter(Boolean):void 0,o=await i({channel:t.channel,cwd:s,projects:c});if(t.json){process.stdout.write(`${JSON.stringify(o,null,2)}
|
|
2
2
|
`),o.projectChangelogs.length===0&&(process.exitCode=1);return}if(o.projectChangelogs.length===0){e.info("No pending releases — no changelog entries to render."),process.exitCode=1;return}for(const n of o.projectChangelogs)e.info(`# ${n.package} → ${n.file}`),e.info(""),e.info(n.content),e.info("")};export{f as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{O as R}from"./cli-main.js";import{v as x,r as V,f as N}from"../packem_shared/ai-analysis-
|
|
1
|
+
import{O as R}from"./cli-main.js";import{v as x,r as V,f as N}from"../packem_shared/ai-analysis-D1Y5a_SZ.js";import{p as $,g as T,e as M,a as C,f as O}from"../packem_shared/registry-CyYhBUaF.js";import{readCatalogs as S,fetchPackageVersions as j}from"./catalog.js";import{f as z}from"../packem_shared/osv-CI9eaGmG.js";const F=/^[\^~>=<]+/,B=async({argument:E,logger:s,options:i,visConfig:c,workspaceRoot:l})=>{if(!l)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const p=E,e=p[0];if(!e)throw new Error("Package name is required. Usage: vis analyze <package> [version]");const u=p[1],{packageManager:A}=R(l);let r,m="default";const b=S(l,A);for(const[t,h]of b){const n=h.get(e);if(n){r=n,m=t;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(u)a=u;else{s.info(`Fetching latest version for ${e}...
|
|
2
2
|
`);const t=await j(e);if(!t.latest)throw new Error(`Could not determine latest version for "${e}".`);a=t.latest}const d=$(r),g=$(a);if(!d||!g)throw new Error(`Could not parse versions: current="${r}", target="${a}".`);const y=T(d,g);if(y==="none"){s.info(`${e} is already at ${a}. Nothing to analyze.`);return}const P=M(r),f={catalogName:m,currentRange:r,newRange:`${P}${a}`,packageName:e,targetVersion:a,updateType:y},w=x(i.aiType??"impact");if(w==="security"||i.security){s.info(`Checking for known vulnerabilities...
|
|
3
3
|
`);const t=r.replace(F,""),n=(await z([{name:e,version:t}])).get(e);n&&n.length>0&&(f.vulnerabilities=n);const v=C(c?.security,{minimumScore:c?.security?.policies?.score?.minimum});if(v.length>0){const o=(await O(v,[{name:e,version:t}])).get(`${e}@${t}`);o&&(f.socketReport={alerts:o.alerts,license:o.license,score:o.score})}}const k=await V([f],s,c?.ai,w);(i.format??"table")==="json"?process.stdout.write(`${JSON.stringify(k,void 0,2)}
|
|
4
4
|
`):s.info(N(k))};export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as f}from"node:module";import{r as _}from"../packem_shared/run-
|
|
1
|
+
import{createRequire as f}from"node:module";import{r as _}from"../packem_shared/run-BvhcgfRq.js";import{createShellRunner as w}from"./shell-runner.js";import{b as y}from"./context.js";let l;const d=s=>(l??=f(import.meta.url))(s),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=s=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[e,r]=a.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return a.getBuiltinModule(s)}return d(s)},{relative:m}=p("node:path"),b=async({fs:s,logger:e,options:r,workspaceRoot:c})=>{const i=c??process.cwd(),o=await y({cwd:i,skipRegistryLookup:!0}),{printConfigIfRequested:u}=await import("./print-config.js");if(u(r,o,e))return;const t=await _({allowFullHistory:r.allowFullHistory===!0,channelPrerelease:o.channelPrerelease,config:o.config,cwd:i,dryRun:r.dryRun===!0,from:r.from,fs:s,name:r.name,packages:o.packages,perPackageConfig:o.perPackageConfig,runner:w(),sinceLastRelease:r.sinceLastRelease===!0});for(const n of t.notes)e.info(n);for(const n of t.warnings)e.warn(n);if(t.status==="failed"){e.error(t.error),process.exitCode=1;return}if(t.status!=="no-changes"){if(t.status==="dry-run"){e.info("[dry-run] would write:"),e.info(t.content);return}for(const n of t.files)e.info(`Created ${m(i,n.path)} (${n.package}: ${t.bumps.get(n.package)})`)}};export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VisReleaseError as x}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{r as d,a as g}from"../packem_shared/publish-report-DOXKGOAj.js";import{b as y}from"./context.js";import{p as C,a as P}from"../packem_shared/publish-missing-
|
|
1
|
+
import{VisReleaseError as x}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{r as d,a as g}from"../packem_shared/publish-report-DOXKGOAj.js";import{b as y}from"./context.js";import{p as C,a as P}from"../packem_shared/publish-missing-CZK1BpWt.js";const k=async({logger:t,options:s,workspaceRoot:p})=>{const m=p??process.cwd(),l=s.dryRun===!0,c=s.missing===!0,h=s.filter?s.filter.split(",").map(e=>e.trim()).filter(Boolean):void 0;if(c&&(s.checkOnly===!0||s.firstRelease===!0)){t.error(`--missing cannot be combined with ${s.checkOnly===!0?"--check-only":"--first-release"}.`),process.exitCode=1;return}let n;try{n=await y({channel:s.channel,cwd:m,firstRelease:s.firstRelease===!0,projects:h})}catch(e){t.error(`Failed to load release context: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}const{printConfigIfRequested:$}=await import("./print-config.js");if($(s,n,t))return;if(s.checkOnly===!0){if(t.info(`Preflight: ${n.plan.releases.length} pending publish(es)${n.channel?` to dist-tag "${n.channel.tag}"`:""}.`),n.plan.warnings.length>0)for(const e of n.plan.warnings)t.warn(` - ${e}`);process.exitCode=n.plan.releases.length===0?1:0;return}if(!c&&n.plan.releases.length===0){t.info("No pending releases — nothing to publish.");return}const a=s.tag??n.channel?.tag;a||t.warn("No --tag provided and no channel matched the current branch. Defaulting to dist-tag 'latest'. Set channels in vis.config.ts to control this."),c?t.info(`Looking for released versions that never reached dist-tag "${a??"latest"}"...`):t.info(`${l?"[dry-run] would publish":"Publishing"} ${n.plan.releases.length} package(s) to dist-tag "${a??"latest"}"${l?"":"..."}`);let i,{warnings:f}=n.plan;try{const e={dryRun:l,noPush:!s.push,otp:s.otp,resume:s.resume===!0,tag:a};if(c){i=await C(n,{...e,projects:h}),{warnings:f}=i;for(const r of i.missing){const o=r.onRegistry?"tag":"publish";t.info(` [missing] ${r.name}@${r.version} (${l?`would ${o}`:o}, release commit ${r.commit.slice(0,7)})`)}i.missing.length===0&&t.info("No released-but-unpublished versions found.")}else i=await P(n,e)}catch(e){if(d(t,f),e instanceof x&&e.code==="STAGE_PENDING"){t.error(e.message),e.hint&&(t.info(""),t.info(`Next steps: ${e.hint}`)),process.exitCode=1;return}t.error(`Publish failed: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}t.info(""),g(t,i,a??"latest"),d(t,f),i.failed.length===0?process.exitCode=0:i.published.length===0&&i.skipped.length===0?process.exitCode=3:process.exitCode=2;const u=i.failed.filter(e=>/\bEOTP\b|one[- ]time password|otp/i.test(e.reason));if(u.length>0){t.info(""),t.warn("Publish failed because the registry required a 2FA OTP. Rerun with:");const e=u.map(w=>w.name).join(","),r=s.channel?` --channel=${s.channel}`:"",o=s.tag?` --tag=${s.tag}`:"",b=` --filter='${e}'`;t.info(` vis release publish --otp=REPLACE_WITH_NEW_OTP --resume${o}${r}${b}`)}};export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as $}from"node:module";import{O as j}from"../packem_shared/renderToString-DR0zDUjh-
|
|
1
|
+
import{createRequire as $}from"node:module";import{O as j}from"../packem_shared/renderToString-DR0zDUjh-CQT5Ebrc.js";import{q as E}from"../packem_shared/table-ahQIE6tw.js";import{R as I}from"../packem_shared/registry-CyYhBUaF.js";import{d as P}from"../packem_shared/pm-runner-BXRi4ZM9.js";import{l as C}from"../packem_shared/dependency-scan-Dv1kJ-Sn.js";import{r as T}from"../packem_shared/provenance-BVFxzkUv.js";import{r as D}from"../packem_shared/signatures-DlGMQsHg.js";import{loadOptionalSigstore as R}from"./loader.js";let y;const O=r=>(y??=$(import.meta.url))(r),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=r=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,s]=m.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return m.getBuiltinModule(r)}return O(r)},{createHash:N}=_("node:crypto"),{isAbsolute:k,resolve:S,basename:v}=_("node:path"),q=r=>(r??"").split(",").map(t=>t.trim()).filter(t=>t.length>0),V=async({logger:r,options:t,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const n=t.format??"table",c=t.prodOnly??!1,u=t.failOn==="error"?"error":"warning",d=q(t.allowlist),a=P(s),l=C(s,a.name,{includeDev:!c}).map(({name:e,version:o})=>({name:e,version:o})),[f,p]=await Promise.all([T(l,{allowlist:d,workspaceRoot:s}),D(l,{allowlist:d,workspaceRoot:s})]),i=[...f.map(e=>({code:"provenance-regression",message:`Resolved ${e.packageName}@${e.version} has no published provenance attestation, but ${e.packageName}@${e.priorVersionWithProvenance} did — a provenance regression.`,packageName:e.packageName,severity:"warning",version:e.version})),...p.map(e=>({code:e.code,message:e.message,packageName:e.packageName,severity:e.severity,version:e.version}))],g=i.filter(e=>u==="error"?e.severity==="error":!0);if(n==="json")process.stdout.write(`${JSON.stringify({findings:i,ok:g.length===0},void 0,2)}
|
|
2
2
|
`);else if(n==="ndjson")for(const e of i)process.stdout.write(`${JSON.stringify(e)}
|
|
3
3
|
`);else if(i.length===0)r.info(`No provenance regressions or signature problems across ${String(l.length)} locked packages.`);else{const e=process.stdout.columns||80;r.info(j(I.createElement(E,{data:i.map(o=>({code:o.code,package:`${o.packageName}@${o.version}`,severity:o.severity}))}),{columns:e}));for(const o of i)r.warn(`${o.packageName}@${o.version}: ${o.message}`)}g.length>0&&(process.exitCode=1)},x=()=>process.env.CI==="true"||typeof process.env.ACTIONS_ID_TOKEN_REQUEST_URL=="string"||typeof process.env.SIGSTORE_ID_TOKEN=="string",J=(r,t,s)=>({_type:"https://in-toto.io/Statement/v1",predicate:{buildDefinition:{buildType:"https://visulima.com/vis/attest/v1",externalParameters:{workspaceRoot:s},internalParameters:{},resolvedDependencies:[]},runDetails:{builder:{id:"https://visulima.com/vis"},metadata:{invocationId:process.env.GITHUB_RUN_ID??"",startedOn:new Date().toISOString()}}},predicateType:"https://slsa.dev/provenance/v1",subject:[{digest:{sha256:t},name:r}]}),Q=async({argument:r,fs:t,logger:s,options:n,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const u=r[0];if(!u)throw new Error("Missing subject. Usage: vis attest <path-to-artifact>");const d=n.predicate??"slsaProvenance";if(d!=="slsaProvenance")throw new Error(`Unsupported predicate '${d}'. Only 'slsaProvenance' is supported.`);const a=k(u)?u:S(c,u),w=n.requireSigning??!1,l=n.format??"table";let f;try{f=await t.readFile(a)}catch{throw new Error(`Cannot read subject artifact at ${a}.`)}const p=N("sha256").update(f).digest("hex");if(!x()){const b="No ambient OIDC token (not running in CI). Keyless signing needs a Fulcio identity from CI OIDC.";if(w)throw new Error(`${b} Re-run in CI or drop --require-signing.`);if(l==="json"){process.stdout.write(`${JSON.stringify({ok:!1,reason:"no-ambient-oidc",sha256:p,skipped:!0,subject:v(a)},void 0,2)}
|
|
4
4
|
`);return}s.warn(`${b} Skipping signing (subject sha256: ${p}). Pass --require-signing to make this fatal.`);return}const i=J(v(a),p,c),g=Buffer.from(JSON.stringify(i)),o=await(await R({workspaceRoot:c})).attest(g,"application/vnd.in-toto+json"),h=n.output?k(n.output)?n.output:S(c,n.output):`${a}.sigstore`;if(await t.writeFile(h,`${JSON.stringify(o,void 0,2)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as $,a as l,D as d,T as y}from"../packem_shared/ai-analysis-
|
|
1
|
+
import{c as $,a as l,D as d,T as y}from"../packem_shared/ai-analysis-D1Y5a_SZ.js";import{O as g}from"../packem_shared/renderToString-DR0zDUjh-CQT5Ebrc.js";import{q as x}from"../packem_shared/table-ahQIE6tw.js";import{R as S}from"../packem_shared/registry-CyYhBUaF.js";import{j as w,F as u,q as E,J as I,b as A}from"../packem_shared/index.server-Ca_EEVfw.js";const p={command:"ai",description:"AI-assisted commands: provider detection, cache management, and failure-fix proposals."},D=e=>{if(typeof e!="function")return String(e);const{name:t}=e;return t==="Boolean"?"boolean":t==="Number"?"number":t==="String"?"string":t??"unknown"},O=e=>e===void 0?[]:Array.isArray(e)?e.map(t=>[t.name,t]):Object.entries(e),R=e=>{const t=[...e.commandPath??[],e.name].join(" "),s=(e.examples??[]).map(([n,a])=>({command:n??"",description:a??""})),o=O(e.options).map(([n,a])=>({defaultValue:a.defaultValue,description:a.description,name:n,type:D(a.type)}));return{argument:e.argument?{description:e.argument.description,name:e.argument.name}:void 0,description:e.description??"",examples:s,name:e.name,options:o,path:t}},f=(e,t=p)=>({command:t.command,description:t.description,subcommands:e.map(s=>R(s))}),P=(e,t=p)=>`${JSON.stringify(f(e,t),void 0,2)}
|
|
2
2
|
`,T=(e,t=p)=>{const s=f(e,t),o=[w(`vis ${s.command} — ${s.description}`),"",u("Subcommands:")];for(const n of s.subcommands){const a=n.argument?` ${E(`<${n.argument.name}>`)}`:"";if(o.push(""),o.push(` ${I(`vis ${n.path}`)}${a}`),n.description&&o.push(` ${n.description}`),n.options.length>0){const i=n.options.map(c=>`--${c.name}${c.type==="boolean"?"":`=<${c.type}>`}`).join(", ");o.push(u(` options: ${i}`))}if(n.examples.length>0){o.push(u(" examples:"));for(const i of n.examples){const c=i.description?u(` — ${i.description}`):"";o.push(` ${A(i.command)}${c}`)}}}return o.push(""),o.push(u(`Run \`vis ${s.command} discover-help\` for the machine-readable JSON catalogue (designed for AI agents).`)),o.push(u(`Run \`vis ${s.command} <subcommand> --help\` for full usage of a specific subcommand.`)),`${o.join(`
|
|
3
3
|
`)}
|
|
4
4
|
`},h=async()=>{const{default:e}=await import("./cli-main.js").then(t=>t.ao);return e.filter(t=>t.name!=="ai")},M=async()=>{const e=await h();process.stderr.write(T(e))},q=async()=>{const e=await h();process.stdout.write(P(e))},L=async({logger:e,visConfig:t})=>{const s=t?.ai,o=l(s);if(!o){e.error("No AI provider available to test."),process.exitCode=1;return}e.info(`Testing ${o.name}...`);try{const n=await y(o,"Reply with exactly: OK",{timeoutMs:3e4});e.info(`Provider ${o.name} responded: ${n.stdout.trim().slice(0,200)}`)}catch(n){const a=n instanceof Error?n.message:String(n);e.error(`Provider ${o.name} failed: ${a}`),process.exitCode=1}},V=({logger:e,options:t,visConfig:s})=>{const o=t.format??"table",n=s?.ai,a=$(),i=l(n);if(o==="json"){const r=a.map(m=>({available:m.available,method:m.detectionMethod,name:m.name,path:m.path,priority:d[m.name]??0,selected:m.name===i?.name,version:m.version}));process.stdout.write(`${JSON.stringify(r,void 0,2)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as B}from"node:module";import{z as E}from"../packem_shared/index-0dnGN3GP.js";import{findVisConfigFile as D}from"./CONFIG_FILES.js";import{y as V}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{U as w}from"../packem_shared/env-
|
|
1
|
+
import{createRequire as B}from"node:module";import{z as E}from"../packem_shared/index-0dnGN3GP.js";import{findVisConfigFile as D}from"./CONFIG_FILES.js";import{y as V}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{U as w}from"../packem_shared/env-D3wteXlq.js";import{p as e}from"./cli-main.js";import{d as C}from"../packem_shared/pm-runner-BXRi4ZM9.js";import{a as F}from"../packem_shared/build-scripts-ETlkUGzC.js";import{s as O}from"../packem_shared/native-config-sync-BGLC8n86.js";let N;const M=c=>(N??=B(import.meta.url))(c),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=c=>{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(c)}return M(c)},{spawnSync:A}=T("node:child_process"),P=/(defineConfig\s*\(\s*\{)/,q=/(export\s+default\s+\{)/,y=(c,t)=>`${t}${JSON.stringify(c)}: true,`,z=(c,t)=>{if(t.length===0)return{added:[],skipped:[],status:"noop"};const s=D(c);if(!s)return{added:[],skipped:t,status:"no-config"};if(!V(s))return{added:[],skipped:t,status:"no-config"};const n=E(s),h=n.search(/installScripts\s*:\s*\{/);let l=null,r=0;if(h!==-1){const a=n.slice(h),d=/(allow\s*:\s*\{)([^}]*)(\})/.exec(a);d?.index!==void 0&&(l=d,r=h+d.index)}if(l){const a=l[2]??"",f=new Set;for(const g of a.matchAll(/["']([^"']+)["']\s*:/g))f.add(g[1]);for(const g of a.matchAll(/(?:^|,|\{)\s*([a-z_$][\w-]*)\s*:/gi))f.add(g[1]);const d=[],k=[];for(const g of t)f.has(g)?k.push(g):d.push(g);if(d.length===0)return{added:[],configPath:s,skipped:k,status:"noop"};const x=/\n([ \t]+)\S/.exec(a)?.[1]??" ",_=`
|
|
2
2
|
${d.map(g=>y(g,x)).join(`
|
|
3
3
|
`)}`,v=a.replace(/\s+$/,""),S=a.slice(v.length),R=`${v}${v.endsWith(",")||v===""?"":","}${_}${S.length>0?S:`
|
|
4
4
|
`}`,j=`${n.slice(0,r)}${l[1]}${R}${l[3]}${n.slice(r+l[0].length)}`;return w(s,j),{added:d,configPath:s,skipped:k,status:"updated"}}const i=/(installScripts\s*:\s*\{)/;if(i.test(n)){const a=`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as M}from"node:module";import{getAffectedProjects as H}from"@visulima/task-runner";import{d as D,b as N}from"../packem_shared/registry-
|
|
1
|
+
import{createRequire as M}from"node:module";import{getAffectedProjects as H}from"@visulima/task-runner";import{d as D,b as N}from"../packem_shared/registry-CyYhBUaF.js";let C;const T=e=>(C??=M(import.meta.url))(e),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=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 T(e)},{execFile:G}=P("node:child_process"),{promisify:V}=P("node:util"),B=V(G),q=["[skip ci]","[ci skip]","[no ci]","[vis skip]","[nx skip]"],J=["[vis deploy]","[nx deploy]"],K=["vis","nx"],L=["CACHED_COMMIT_REF","VERCEL_GIT_PREVIOUS_SHA","GITHUB_BASE_REF","CI_COMMIT_BEFORE_SHA"],U=/^[\w./~^@{}][\w.\-/~^@{}]*$/,W=(e=process.env)=>{for(const t of L){const r=e[t];if(r&&r.trim().length>0)return r.trim()}},S=e=>{if(!U.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.`)},Z=async(e,t)=>{try{return await B("git",["rev-parse","--verify",`${t}^{commit}`],{cwd:e}),!0}catch{return!1}},z=async e=>{try{const{stdout:t}=await B("git",["log","-1","--pretty=%B"],{cwd:e});return t}catch{return""}},O=(e,t,r)=>K.some(i=>e.includes(`[${i} ${t} ${r}]`)),X=(e,t)=>q.some(r=>e.includes(r))||O(e,"skip",t),Q=(e,t)=>J.some(r=>e.includes(r))||O(e,"deploy",t),f=(e,t,r,i)=>({action:"build",message:r,project:e,reason:t,...i}),y=(e,t,r,i)=>({action:"skip",message:r,project:e,reason:t,...i}),Y=e=>`${e.action==="skip"?"🛑":"✅"} ${e.message}`,ee=(e,t)=>e.action==="skip"||t?0:1,k=new Set(["deep","direct","none"]),ne=async({argument:e,logger:t,options:r,visConfig:i,workspaceRoot:l})=>{const s=e[0]??"",E=!!r.json,A=!!r.verbose,R=!!(r["exit-zero-on-build"]??r.exitZeroOnBuild),u=n=>{A&&!E&&t.info(`❱ ${n}`)},o=n=>{E?process.stdout.write(`${JSON.stringify(n)}
|
|
2
2
|
`):t.info(Y(n)),process.exit(ee(n,R))};if(!s)return o(f("","missing-project-argument","Missing project argument. Usage: vis ci ignore <project>"));if(!l)return o(f(s,"workspace-error","Could not determine workspace root — building defensively"));const m=await z(l),_=m.trim().split(`
|
|
3
3
|
`)[0]??"";if(u(`commit: ${_}`),m&&Q(m,s))return o(f(s,"commit-force-deploy",`Force-deploy keyword in commit: "${_}"`));if(m&&X(m,s))return o(y(s,"commit-skip",`Skip keyword in commit: "${_}"`));let h,v,w;try{({fileOwners:w,packageJsons:v,workspace:h}=D(l,i))}catch(n){const a=n instanceof Error?n.message:String(n);return o(f(s,"workspace-error",`Workspace discovery failed (${a}) — building defensively`))}if(!Object.hasOwn(h.projects,s))return o(f(s,"project-unknown",`Project "${s}" not found in workspace — building defensively`));try{const n=r.base?.trim(),a=W();let c=n||a||"HEAD~1";const p=r.head?.trim()||"HEAD";S(c),S(p),u(`resolved base ref: ${c} (source: ${n?"flag":a?"ci-env":"default"})`);const x=Z(l,c),F=N(l,h,v);await x||(u(`base ref ${c} not reachable — falling back to HEAD~1`),c="HEAD~1"),u(`comparing ${c}...${p}`);const b=r.downstream??"deep",j=r.upstream??"none";if(!k.has(b))throw new Error(`Invalid --downstream value: "${b}". Must be "none", "direct", or "deep".`);if(!k.has(j))throw new Error(`Invalid --upstream value: "${j}". Must be "none", "direct", or "deep".`);const I={base:c,downstream:b,fileOwners:w,head:p,ignoredFiles:i?.affectedIgnore,projectGraph:F,projects:h.projects,upstream:j,workspaceRoot:l},d=await H(I);u(`changed files: ${d.changedFiles.length}`),u(`affected projects: ${d.affectedProjects.join(", ")||"(none)"}`);const $={base:c,head:p};return d.changedFiles.length===0?o(y(s,"no-changes",`No files changed between ${c}...${p}`,{...$,affectedProjects:[]})):d.affectedProjects.includes(s)?o(f(s,"project-affected",`Build ${s}: affected by ${d.changedFiles.length} changed file(s)`,{...$,affectedProjects:d.affectedProjects})):o(y(s,"project-not-affected",`Skip ${s}: not affected by changes between ${c}...${p}`,{...$,affectedProjects:d.affectedProjects}))}catch(n){const a=n instanceof Error?n.message:String(n);return t.error(`Affected detection failed: ${a}`),o(f(s,"workspace-error",`Affected detection failed (${a}) — building defensively`))}};export{ne as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{F as p}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as l,z as k}from"../packem_shared/index-0dnGN3GP.js";import{a as y,b as h,f as w}from"../packem_shared/subtree-DtmcKAJK.js";import{n as u}from"../packem_shared/utils-DQFHJn72.js";import{l as $,i as x,q as m}from"../packem_shared/registry-
|
|
1
|
+
import{F as p}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as l,z as k}from"../packem_shared/index-0dnGN3GP.js";import{a as y,b as h,f as w}from"../packem_shared/subtree-DtmcKAJK.js";import{n as u}from"../packem_shared/utils-DQFHJn72.js";import{l as $,i as x,q as m}from"../packem_shared/registry-CyYhBUaF.js";import{y as A}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{U as b}from"../packem_shared/env-D3wteXlq.js";import{p as E}from"../packem_shared/package-version-COyEFX59.js";const P=["aube-workspace.yaml","pnpm-workspace.yaml"],v=/^\s*packages\s*:\s*$/,I=/^(\s*)-\s/,j=(c,i)=>{const s=c.includes(`\r
|
|
2
2
|
`)?`\r
|
|
3
3
|
`:`
|
|
4
4
|
`,e=c.split(/\r?\n/),n=e.findIndex(r=>v.test(r));if(n===-1)return;let t=" ";for(let r=n+1;r<e.length;r++){const o=I.exec(e[r]);if(o){t=o[1];break}if(e[r].trim().length>0)break}return e.splice(n+1,0,`${t}- "${i}"`),e.join(s)},q=(c,i,s)=>{const e=l(c,"package.json");let n;try{n=E(e)}catch{return!1}const{workspaces:t}=n;return Array.isArray(t)?t.includes(i)?!1:(s||m(e,{...n,workspaces:[...t,i]},{detectIndent:!0}),!0):t&&typeof t=="object"&&Array.isArray(t.packages)?t.packages.includes(i)?!1:(s||m(e,{...n,workspaces:{...t,packages:[...t.packages,i]}},{detectIndent:!0}),!0):!1},M=({dryRun:c=!1,prefix:i,workspaceRoot:s})=>{const e=u(i),n=$(s);if(!n)return{status:"no-config"};if(x(s,n).some(r=>u(r)===e))return{status:"already-covered"};for(const r of P){const o=l(s,r);if(!A(o))continue;const a=j(k(o),e);if(a!==void 0)return c||b(o,a),{entry:e,file:r,status:"added"}}return q(s,e,c)?{entry:e,file:"package.json",status:"added"}:{status:"no-config"}},N=async({argument:c,fs:i,logger:s,options:e,process:n,workspaceRoot:t})=>{const r=c[0];if(!r)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 o=t??n.cwd,a=u(e.prefix),d=e.ref??"HEAD";if(y(o),await(async f=>{try{return await i.access(f),!0}catch{return!1}})(l(o,a)))throw new Error(`Target "${a}" already exists. git subtree add requires a non-existent prefix.`);if(e.dryRun){const f=e.squash?" --squash":"",g=e.message?` -m "${e.message}"`:"";s.info("Dry run — no changes will be made. Planned steps:"),s.info(` git subtree add --prefix=${a}${f}${g} ${r} ${d}`),e.register&&s.info(` register ${a} into the workspace config (skipped if already covered by an existing glob)`);return}if(h(o),s.info(`Importing ${p(r)}@${d} → ${a} ...`),w({cwd:o,message:e.message,prefix:a,ref:d,repo:r,squash:e.squash}),s.info(`✓ Imported ${r} into ${a} (history preserved).`),e.register){const f=M({prefix:a,workspaceRoot:o});f.status==="already-covered"?s.info(`✓ ${a} is already covered by an existing workspace glob.`):f.status==="added"?s.info(`✓ Registered ${f.entry} in ${f.file}.`):s.warn(`Could not auto-register ${a}: no workspace config found. Add it to pnpm-workspace.yaml or package.json#workspaces manually.`)}else s.info(p(`Skipped workspace registration (--no-register). Add ${a} to your workspace config manually.`));s.info(p("Note: project.json / nx tags are not generated. Add them if your tooling needs them."))};export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I}from"../packem_shared/index-0dnGN3GP.js";import{d as O}from"../packem_shared/registry-
|
|
1
|
+
import{a as I}from"../packem_shared/index-0dnGN3GP.js";import{d as O}from"../packem_shared/registry-CyYhBUaF.js";import{f as D,a as x}from"../packem_shared/selectors-DmRRUQsG.js";import E from"./index.js";import{l as J}from"./cli-main.js";const S=(e,t)=>{for(const l of t)if(E(l,e))return!0;return!1},q=(e,t={})=>{const{depTypes:l,excludePatterns:f,externalOnly:h,includePatterns:m,internalOnly:g}=t;if(g&&h)return[];const d=l&&l.length>0?new Set(l):void 0,k=m&&m.length>0?m:void 0,w=f&&f.length>0?f:void 0,N=[];for(const y of e)g&&!y.isInternal||h&&y.isInternal||d&&!d.has(y.depType)||k&&(!y.packageName||!S(y.packageName,k))||w&&y.packageName&&S(y.packageName,w)||N.push(y);return N},C=new Set(["json","ndjson","table"]),M=e=>{if(e===void 0)return"table";const t=e.toLowerCase();if(!C.has(t))throw new Error(`--format must be one of: table, json, ndjson (got "${e}")`);return t},P=(e,t)=>({depName:e.depName,depType:e.depType,isInternal:e.isInternal,packageDir:e.packageDir,packageJsonPath:I(t,e.packageJsonPath),packageName:e.packageName,specifier:e.specifier}),$=new Set(["dependencies","devDependencies","optionalDependencies","overrides","peerDependencies","pnpm.overrides","resolutions"]),A=e=>{if(!e||e.length===0)return;const t=[],l=[];for(const f of e)for(const h of f.split(",")){const m=h.trim();m&&($.has(m)?t.push(m):l.push(m))}if(l.length>0)throw new Error(`Unknown --dep-type value(s): ${l.join(", ")}. Valid: ${[...$].join(", ")}`);return t.length>0?t:void 0},V=async({logger:e,options:t,visConfig:l,workspaceRoot:f})=>{if(!f)throw new Error("Could not determine workspace root.");const h=M(t.json&&t.format===void 0?"json":t.format);if(t.deps){if(t.internalOnly&&t.externalOnly)throw new Error("--internal-only and --external-only are mutually exclusive");const p=A(t.depType),c=J(f);let r=q(c,{depTypes:p,excludePatterns:t.exclude,externalOnly:t.externalOnly,includePatterns:t.include,internalOnly:t.internalOnly});if(t.query||t.tag&&t.tag.length>0){const{workspace:n}=O(f,l),i=D(Object.keys(n.projects),n,t.query),T=new Set(x(i,n,t.tag));r=r.filter(v=>v.packageName!==void 0&&T.has(v.packageName))}const u=[...r].sort((n,i)=>{const T=`${n.packageName??n.packageDir} ${n.depType} ${n.depName}`,v=`${i.packageName??i.packageDir} ${i.depType} ${i.depName}`;return T.localeCompare(v)});if(h==="ndjson"){for(const n of u)e.info(JSON.stringify(P(n,f)));return}if(h==="json"){const n=u.map(i=>P(i,f));e.info(JSON.stringify(n,null,t.pretty?2:void 0));return}if(u.length===0){e.info("No matching dep-instances.");return}const o=["Package","Block","Dep","Specifier","Internal","Path"],a=u.map(n=>[n.packageName??n.packageDir,n.depType,n.depName,n.specifier,n.isInternal?"yes":"no",I(f,n.packageJsonPath)]),s=o.map((n,i)=>Math.max(n.length,...a.map(T=>(T[i]??"").length))),j=(n,i)=>n.padEnd(i);e.info(o.map((n,i)=>j(n,s[i])).join(" ")),e.info(s.map(n=>"─".repeat(n)).join("──"));for(const n of a)e.info(n.map((i,T)=>j(i,s[T])).join(" "));e.info(""),e.info(`${String(u.length)} dep-instance(s)`);return}if(h==="ndjson")throw new Error("--format=ndjson is only supported with --deps");const{projectOptions:m,workspace:g}=O(f,l);let d=Object.keys(g.projects).sort();if(t.query&&(d=D(d,g,t.query)),d=x(d,g,t.tag),d.length===0){e.info("No projects found.");return}const k=t.inferred,w=t.targets||k;if(h==="json"){const p=d.map(c=>{const r=g.projects[c],u=m.get(c)??{},o=Object.entries(r.targets??{}).map(([a])=>{const s=u[a],j=s?.inferred===!0;return{aliases:s?.aliases??[],command:s?.command,description:s?.description,...j?{inferred:!0}:{},name:a,type:s?.type}}).filter(a=>!k||a.inferred===!0);return{language:r.language,layer:r.layer,name:c,root:r.root,stack:r.stack,tags:r.tags??[],targets:o,type:r.projectType??"library"}});e.info(JSON.stringify(p,null,2));return}const N=(p,c)=>{const r=p.map((o,a)=>{let s=0;for(const j of c)s=Math.max(s,(j[a]??"").length);return Math.max(o.length,s)}),u=(o,a)=>o.padEnd(a);e.info(p.map((o,a)=>u(o,r[a])).join(" ")),e.info(r.map(o=>"─".repeat(o)).join("──"));for(const o of c)e.info(o.map((a,s)=>u(a,r[s])).join(" "))};if(w){const p=[];for(const c of d){const r=g.projects[c],u=m.get(c)??{};for(const o of Object.keys(r.targets??{}).sort()){const a=u[o],s=a?.inferred===!0;if(k&&!s)continue;const j=r.targets?.[o],n=j?.cache===!1?"no":j?.cache===!0?"yes":"default";p.push([c,o,a?.type??"—",n,s?"yes":"no",a?.description??"—"])}}if(p.length===0){e.info(k?"No inferred targets found.":"No targets found.");return}N(["Project","Target","Type","Cache","Inferred","Description"],p),e.info(""),e.info(`${String(p.length)} target(s) across ${String(d.length)} project(s)`);return}const y=["Project","Type","Layer","Tags","Targets"],b=d.map(p=>{const c=g.projects[p],r=Object.keys(c.targets??{});return[p,c.projectType??"library",c.layer??"—",(c.tags??[]).join(", ")||"—",r.length>4?`${r.slice(0,4).join(", ")}… (${String(r.length)})`:r.join(", ")||"—"]});N(y,b),e.info(""),e.info(`${String(d.length)} project(s)`)};export{V as default};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import{createRequire as W}from"node:module";import{DEFAULT_CHANGES_DIR as X}from"./DEFAULT_CLEAN_KEEP.js";import{b as
|
|
1
|
+
import{createRequire as W}from"node:module";import{DEFAULT_CHANGES_DIR as X}from"./DEFAULT_CLEAN_KEEP.js";import{b as A,r as Y,n as Z}from"./context.js";import{r as ee}from"../packem_shared/run-BvhcgfRq.js";import{toRepoRelativePath as I,listUncommittedPaths as te,getCurrentSha as F,getCurrentBranch as ne,getShortSha as se,pushBranchWithRebase as O,stageAndCommit as re,pushBranch as ie}from"./git.js";import{createShellRunner as ae}from"./shell-runner.js";import{stateFilePath as oe}from"./state.js";import{d as ce}from"../packem_shared/sticky-comment-DjhyCIZt.js";import{g as le}from"./native-addon.js";import{VisReleaseError as L}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{r as ue,l as g,b as he,a as U}from"../packem_shared/publish-report-DOXKGOAj.js";import{f as de,w as fe,p as pe,b as me,d as ge,a as G}from"../packem_shared/publish-missing-CZK1BpWt.js";import{a as q,s as be}from"../packem_shared/apply-C6qxfMqZ.js";let K;const z=s=>(K??=W(import.meta.url))(s),S=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,J=s=>{if(typeof S<"u"&&S.versions&&S.versions.node){const[e,r]=S.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return S.getBuiltinModule(s)}return z(s)},{join:Q}=J("node:path"),ve="<!-- vis:user-content -->",we="<!-- /vis:user-content -->",$e=/<!-- vis:user-content -->([\s\S]*?)<!-- \/vis:user-content -->/g,Ce=/<!-- vis:user-content -->(?:(?!<!-- \/vis:user-content -->)[\s\S])*?<!-- vis:user-content -->/,ye=s=>`${ve}${s}${we}`,Re=(s,e)=>{const r=[],l=/<!-- vis:user-content -->\s*<!-- \/vis:user-content -->/g;let u=l.exec(s);for(;u!==null;)r.push({end:u.index+u[0].length,start:u.index}),u=l.exec(s);if(r.length===0)return{body:s,remaining:e};let n=0;const o=[],t=Math.min(r.length,e.length);for(let p=0;p<t;p+=1){const m=r[p],h=e[p];o.push(s.slice(n,m.start)),o.push(h),n=m.end}return o.push(s.slice(n)),{body:o.join(""),remaining:e.slice(t)}},Pe=(s,e)=>{if(s===void 0||s==="")return e;const r=s.replaceAll(/```[\s\S]*?```/g,"").replaceAll(/~~~[\s\S]*?~~~/g,""),l=(r.match(/<!-- vis:user-content -->/g)??[]).length,u=(r.match(/<!-- \/vis:user-content -->/g)??[]).length;if(l!==u)throw new L({code:"CONFIG_INVALID",hint:"Fix the marker pairs in the PR body and re-run.",message:`PR body has unbalanced <!-- vis:user-content --> markers (${l} opens, ${u} closes). Refusing to merge to prevent silent edit loss.`});if(Ce.test(r))throw new L({code:"CONFIG_INVALID",hint:"Flatten the nesting in the PR body and re-run.",message:"Nested <!-- vis:user-content --> markers are not allowed in PR body. The merger refuses to operate to prevent silent edit loss."});const n=[];for(const h of s.matchAll($e)){const v=h[1]??"";v.trim()!==""&&n.push(ye(v))}if(n.length===0)return e;const{body:o,remaining:t}=Re(e,n);if(t.length===0)return o;const p=o.replace(/\s+$/u,""),m=t.join(`
|
|
2
2
|
|
|
3
|
-
`);return`${
|
|
3
|
+
`);return`${p}
|
|
4
4
|
|
|
5
|
-
${
|
|
6
|
-
`},
|
|
5
|
+
${m}
|
|
6
|
+
`},xe=async(s,e,r)=>{try{return await s.access(oe(e,r)),!0}catch{return!1}},ke=async(s,e,r,l,u,n,o)=>{const t=await s.run("gh",["pr","list","--head",l,"--state","open","--json","number"],{cwd:r,silent:!0});if(t.exitCode===0&&t.stdout.trim()!==""&&t.stdout.trim()!=="[]")try{const h=JSON.parse(t.stdout);if(h[0]){let v=n,k=!1;try{const $=await s.run("gh",["pr","view",String(h[0].number),"--json","body","-q",".body"],{cwd:r,silent:!0});if($.exitCode===0)try{v=Pe($.stdout.replace(/\n$/,""),n)}catch(y){k=!0,g(e,`Skipping PR body update for #${h[0].number} — protected-content blocks are unbalanced, refusing to overwrite operator content. Please clean up markers manually. Cause: ${y.message}`)}}catch($){g(e,`Could not read existing body of PR #${h[0].number} for protected-edit merge: ${$.message}. Proceeding with the unmerged body.`)}const C=k?["pr","edit",String(h[0].number),"--title",u]:["pr","edit",String(h[0].number),"--title",u,"--body",v],w=await s.run("gh",C,{cwd:r,silent:!0});if(w.exitCode!==0)throw new Error(`gh pr edit #${h[0].number} failed: ${w.stderr.trim()}`);return{existing:!0,number:h[0].number}}}catch{}const p=await s.run("gh",["pr","create","--head",l,"--base",o,"--title",u,"--body",n],{cwd:r,silent:!0});if(p.exitCode!==0)return;const m=/\/pull\/(\d+)/.exec(p.stdout);return m?{existing:!1,number:Number.parseInt(m[1]??"0",10)}:void 0},_e=async(s,e,r,l)=>{const u=l.labels??["autorelease: pending"];u.length>0&&await s.run("gh",["pr","edit",String(r),...u.flatMap(n=>["--add-label",n])],{cwd:e,silent:!0}),l.reviewers&&l.reviewers.length>0&&await s.run("gh",["pr","edit",String(r),"--add-reviewer",l.reviewers.join(",")],{cwd:e,silent:!0}),l.assignees&&l.assignees.length>0&&await s.run("gh",["pr","edit",String(r),"--add-assignee",l.assignees.join(",")],{cwd:e,silent:!0})},Ee=/^ci-(?:head|[\da-f]{4,40})(?:-[a-z\d-]+)?\.md$/,Se=(s,e)=>{const r=e===""?"":`${e}/`;return s.startsWith(r)&&Ee.test(s.slice(r.length))},Ae=async({fs:s,logger:e,options:r,workspaceRoot:l},u)=>{const n=l??process.cwd(),o=ae();let t=await A({channel:r.channel,cwd:n});const{printConfigIfRequested:p}=await import("./print-config.js");if(p(r,t,e))return;u.plan=()=>t.plan.warnings;const m=t.config.changesDir??X,h=r.generate===!0,v=h?await I({cwd:n,runner:o},Q(n,m)):"",k=await te({cwd:n,runner:o}),C=h?k.filter(a=>Se(a,v)):[],w=k.filter(a=>!C.includes(a));if(w.length>0){const a=w.slice(0,5).join(", "),i=w.length>5?` (+${w.length-5} more)`:"";g(e,`Working tree has uncommitted changes. CI mode requires a clean tree. Offending paths: ${a}${i}`),process.exitCode=1;return}C.length>0&&g(e,`Keeping ${C.length} change file(s) left behind by an interrupted --generate run: ${C.join(", ")}.`);const $=r.autoPublish===!0?"auto-publish":t.channel?.mode??"auto-publish",y=t.config.tagTarget==="source",{pushRetries:R}=t.config;if(R!==void 0&&(!y||!Number.isInteger(R)||R<0)){e.error(y?`release.pushRetries must be a non-negative integer, got ${String(R)}.`:'release.pushRetries needs release.tagTarget: "source": a rebased release commit would put the commits that moved the branch below its tags.'),process.exitCode=1;return}const P=await F({cwd:n,runner:o}),x=await ne({cwd:n,runner:o}),j=async a=>{if(!(!x||a===void 0||await F({cwd:n,runner:o})===a))try{const i=await O({cwd:n,runner:o},x,{author:t.config.gitUser,retries:R??3,source:a});i>0&&e.info(`${x} moved during the release; pushed the bookkeeping commits after ${i} rebase(s).`)}catch(i){g(e,`Could not push the release bookkeeping commits (cross-runner state): ${i.message}`)}};if($==="auto-publish"&&r.publishMissing){const{stranded:a}=await de(t);a.length>0&&(await fe(t,a),e.info(`Releasing ${a.map(c=>`${c.name}@${c.version}`).join(", ")} from HEAD: set by a release commit, never published.`),t=await A({channel:r.channel,cwd:n}));const i=await pe(t,{deferRecovery:a.length>0,noBranchPush:!0,tag:t.channel?.tag});for(const c of i.completed)e.info(`Recovered ${c.name}@${c.version} from release commit ${c.commit.slice(0,7)} (${c.onRegistry?"tagged":`published to dist-tag ${t.channel?.tag??"latest"}`}).`);for(const c of i.skipped)c.reason.includes("untagged")?g(e,`Not recovering ${c.name}: ${c.reason}.`):e.info(`Recovery skipped ${c.name}: ${c.reason}.`);for(const c of i.failed)he(e,`Recovering ${c.name} failed: ${c.reason}`);if(u.recovery.push(...i.warnings),i.failed.length>0){e.error("Fix the failed recovery above before a new wave is released (or pass --no-publish-missing)."),process.exitCode=2,await j(P);return}i.missing.length>0&&(t=await A({channel:r.channel,cwd:n}))}if(h){const a=await se({cwd:n,runner:o}),i=await ee({allowFullHistory:r.allowFullHistory===!0,channelPrerelease:t.channelPrerelease,config:t.config,cwd:n,from:r.generateFrom,fs:s,name:`ci-${a??"head"}`,packages:t.packages,perPackageConfig:t.perPackageConfig,runner:o,sinceLastRelease:r.generateFrom===void 0});for(const c of i.notes)e.info(c);for(const c of i.warnings)g(e,c);if(i.status==="failed"){e.error(i.error),process.exitCode=1;return}if(i.status==="written"){const c=i.files.map(E=>E.path),d=await Promise.all(c.map(async E=>await I({cwd:n,runner:o},E))),f=await o.run("git",["add","--",...c],{cwd:n,silent:!0});if(f.exitCode!==0){e.error(`Could not stage the generated change files ${d.join(", ")}: ${f.stderr.trim()||`exit ${f.exitCode}`}`);try{await Promise.all(c.map(async E=>{await s.rm(E,{force:!0})}))}catch{g(e,`Could not clean up ${d.join(", ")} after the staging failure — remove them before the next run.`)}process.exitCode=1;return}e.info(`Generated ${d.join(", ")} from ${i.fromRef}..HEAD (${i.bumps.size} package(s)).`),t=await A({channel:r.channel,cwd:n})}else e.info(`--generate derived no bumps from ${i.fromRef}..HEAD.`)}const{files:N}=await Y({changesDir:t.config.changesDir,cwd:n});if($==="auto-publish"){if(N.length===0){e.info("No pending change files. Nothing to release."),await j(P);return}e.info(`Auto-publish mode — versioning + publishing ${t.plan.releases.length} package(s).`);try{await le(await Z(t),process.env,t.config)}catch(d){const{hint:f}=d;e.error(`The OIDC check failed, nothing was published: ${d.message}${f?` ${f}`:""}`),process.exitCode=1;return}const a=await me(t,t.plan.releases,{runner:o});if(a.size>0){e.error(`These releases depend on versions that are not on the registry, nothing was versioned or published:
|
|
7
|
+
- ${ge(a)}
|
|
8
|
+
Release those dependencies first (add a change file for them) or fix the range.`),process.exitCode=1;return}try{await q(t,{commit:!0,releaseSource:P})}catch(d){const{hint:f}=d;e.error(`The version step failed, nothing was published: ${d.message}${f?` ${f}`:""}`),process.exitCode=1;return}if(x)try{const d=await O({cwd:n,runner:o},x,{author:t.config.gitUser,retries:y&&P!==void 0?R??3:0,source:P??"HEAD",syncLockfile:async()=>{await be(t)}});d>0&&e.info(`${x} moved during the release; pushed the version commit after ${d} rebase(s).`)}catch(d){const{hint:f}=d;e.error(`Failed to push the version commit, nothing was published: ${d.message}${f?` ${f}`:""}`),process.exitCode=1;return}const i=await F({cwd:n,runner:o}),c=await G(t,{defaultTagTarget:y?P:i,noBranchPush:!0,resume:!0,tag:t.channel?.tag});U(e,c,t.channel?.tag??"latest"),process.exitCode=c.failed.length>0?2:0,await j(i);return}if(N.length===0){const a=await xe(s,n,m);a?e.info("No pending change files but `.state.json` is present — resuming the prior wave's publish."):e.info("No pending change files — assuming this push is a merged release PR. Publishing.");const i=await G(t,{resume:a,tag:t.channel?.tag});U(e,i,t.channel?.tag??"latest"),process.exitCode=i.failed.length>0?2:0;return}e.info(`Version-PR mode — maintaining release PR for ${t.plan.releases.length} package(s).`);const _=r.branch??t.config.versionPr?.branch??"vis-release/version-packages",H=t.config.versionPr?.title??"🚀 Versioned release";if(!await ce(o,n)){e.error("Could not detect repository slug via gh CLI. Cannot maintain version PR."),process.exitCode=1;return}const D=await o.run("git",["switch","-C",_],{cwd:n,silent:!0});if(D.exitCode!==0){e.error(`Could not switch to ${_}: ${D.stderr}`),process.exitCode=1;return}const T=await q(t,{commit:!1}),M=[...T.changedFiles,...T.deletedFiles];if(M.length===0){g(e,"Apply produced no file changes. Aborting version PR.");return}await re({cwd:n,runner:o},M,t.config.gitUser?`release(${t.channel?.tag??"main"}): version packages [skip ci]`:"release: version packages [skip ci]",{author:t.config.gitUser});try{await ie({cwd:n,runner:o},_,{force:!0})}catch(a){e.error(`Could not push ${_}: ${a.message}`),process.exitCode=1;return}const V=t.branch??t.config.baseBranch??"main",B=`${t.config.versionPr?.preamble??""}
|
|
7
9
|
|
|
8
10
|
## Pending releases
|
|
9
11
|
|
|
10
|
-
${t.plan.releases.map(
|
|
12
|
+
${t.plan.releases.map(a=>`- \`${a.name}\`: ${a.oldVersion} → **${a.newVersion}**`).join(`
|
|
11
13
|
`)}
|
|
12
|
-
`,
|
|
14
|
+
`,b=await ke(o,e,n,_,H,B,V);if(b){if(e.info(`${b.existing?"Updated":"Opened"} version PR #${b.number}.`),await _e(o,n,b.number,{assignees:b.existing?void 0:t.config.versionPr?.assignees,labels:t.config.versionPr?.labels,reviewers:b.existing?void 0:t.config.versionPr?.reviewers}),t.config.versionPr?.autoMerge&&!b.existing){const a=t.config.versionPr.autoMergeMethod??"squash",i=await o.run("gh",["pr","merge",String(b.number),"--auto",`--${a}`],{cwd:n,silent:!0});i.exitCode===0?e.info(`Auto-merge enabled (${a}).`):g(e,`Could not enable auto-merge on PR #${b.number}: ${i.stderr.trim()||`exit ${i.exitCode}`}`)}}else e.error("Failed to create / update version PR."),process.exitCode=1},Be=async s=>{const e={recovery:[]};try{await Ae(s,e)}finally{ue(s.logger,[...e.recovery,...e.plan?.()??[]])}};export{Be as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as P}from"node:module";import{o as T,s as K,t as L,u as f,v as J,w as W,x as Y,y as H,z as U,A as V,B as Q,D as X,E as Z,F as tt,G as nt,H as et,I as F,J as st}from"./cli-main.js";import{e as p,z as j,$ as rt}from"../packem_shared/index-0dnGN3GP.js";import{l as ct}from"./ts-loader.js";import{loadVisConfig as at}from"./CONFIG_FILES.js";import{y as x}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{U as O}from"../packem_shared/env-
|
|
1
|
+
import{createRequire as P}from"node:module";import{o as T,s as K,t as L,u as f,v as J,w as W,x as Y,y as H,z as U,A as V,B as Q,D as X,E as Z,F as tt,G as nt,H as et,I as F,J as st}from"./cli-main.js";import{e as p,z as j,$ as rt}from"../packem_shared/index-0dnGN3GP.js";import{l as ct}from"./ts-loader.js";import{loadVisConfig as at}from"./CONFIG_FILES.js";import{y as x}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{U as O}from"../packem_shared/env-D3wteXlq.js";import{L as dt}from"../packem_shared/registry-CyYhBUaF.js";import{v as pt}from"../packem_shared/verify-3WE9U_Bv.js";let q;const z=t=>(q??=P(import.meta.url))(t),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[n,s]=E.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return E.getBuiltinModule(t)}return z(t)},{readdirSync:it,statSync:ot}=B("node:fs"),{stdin:N,stdout:ut}=E,{createInterface:ft}=B("node:readline/promises"),k="__global__",w=t=>[...new Set(t)].sort((n,s)=>n.localeCompare(s)),mt=t=>`{${Object.keys(t).sort().map(i=>`${i}=${JSON.stringify(t[i])}`).join(",")}}`,h=t=>{if(!Array.isArray(t))return[];const n=[];for(const s of t)typeof s=="string"?n.push(s):s&&typeof s=="object"&&n.push(mt(s));return w(n)},g=t=>({cache:void 0,dependsOn:[],env:[],id:t,inputs:[],outputs:[]}),v=(t,n,s)=>s?`^${n}`:t&&t!=="self"&&t!=="~"?`${t}#${n}`:n,lt=(t,n)=>{const s=t.trim();if(n==="moon"){if(s.startsWith("^:"))return v(void 0,s.slice(2),!0);if(s.startsWith("~:"))return v(void 0,s.slice(2),!1);if(s.includes(":")){const[i,e]=s.split(":");return v(i,e??"",!1)}return s}if(s.startsWith("^"))return v(void 0,s.slice(1),!0);if(s.includes("#")){const[i,e]=s.split("#");return v(i,e??"",!1)}return s},R=(t,n)=>{if(!Array.isArray(t))return[];const s=[];for(const i of t){if(typeof i=="string"){s.push(lt(i,n));continue}if(!i||typeof i!="object")continue;const e=i,{target:o}=e;if(!o)continue;if(e.dependencies===!0){s.push(v(void 0,o,!0));continue}if(e.projects===void 0){s.push(v(void 0,o,!1));continue}const r=Array.isArray(e.projects)?e.projects:[e.projects];for(const a of r)s.push(a==="^"?v(void 0,o,!0):v(a,o,!1))}return w(s)},M=t=>{if(x(t))try{return JSON.parse(j(t))}catch{return}},yt=t=>{const n=new Map,s=M(p(t,"turbo.json"));if(!s)return n;const i=s.tasks??s.pipeline??{};for(const[o,r]of Object.entries(i)){const a=o.includes("#")?o:`*#${o}`,c=g(a);c.dependsOn=R(r.dependsOn,"turbo"),c.inputs=h(r.inputs),c.outputs=h(r.outputs),c.env=w([...r.env??[],...r.passThroughEnv??[]]),c.cache=r.cache===!1?!1:void 0,n.set(a,c)}const e=g(k);return e.inputs=h(s.globalDependencies),e.env=w([...s.globalEnv??[],...s.globalPassThroughEnv??[]]),(e.inputs.length>0||e.env.length>0)&&n.set(k,e),n},ht=new Set([".git",".nx",".turbo",".vis","build","coverage","dist","node_modules"]),C=(t,n,s=8)=>{const i=[],e=(o,r)=>{if(r>s)return;let a;try{a=it(o)}catch{return}for(const c of a.toSorted()){if(c===n){i.push(p(o,c));continue}if(c.startsWith(".")&&c!==".moon"||ht.has(c))continue;const u=p(o,c);try{ot(u).isDirectory()&&e(u,r+1)}catch{}}};return e(t,0),i},I=(t,n)=>{t.dependsOn=R(n.dependsOn,"nx"),t.inputs=h(n.inputs),t.outputs=h(n.outputs),t.cache=typeof n.cache=="boolean"?n.cache:void 0},vt=t=>{const n=new Map,s=M(p(t,"nx.json"));for(const[i,e]of Object.entries(s?.targetDefaults??{})){const o=`*#${i}`,r=g(o);I(r,e),n.set(o,r)}for(const i of C(t,"project.json")){const e=M(i);if(!(!e?.name||!e.targets))for(const[o,r]of Object.entries(e.targets)){const a=`${e.name}#${o}`,c=g(a);I(c,r),n.set(a,c)}}return n},_=(t,n)=>{t.dependsOn=R(n.deps,"moon"),t.inputs=h(n.inputs),t.outputs=h(n.outputs),t.cache=typeof n.options?.cache=="boolean"?n.options.cache:void 0},A=t=>{if(x(t))try{return ct(t)}catch{return}},gt=t=>{const n=new Map,s=p(t,".moon"),i=[p(s,"tasks.yml"),p(s,"tasks.yaml")];for(const e of i){const o=A(e);if(o){for(const[r,a]of Object.entries(o.tasks??{})){const c=`*#${r}`,u=g(c);_(u,a),n.set(c,u)}if(o.implicitInputs&&o.implicitInputs.length>0){const r=g(k);r.inputs=h(o.implicitInputs),n.set(k,r)}}}for(const e of[...C(t,"moon.yml"),...C(t,"moon.yaml")]){const o=A(e);if(!o?.tasks)continue;const a=e.split(/[/\\]/).at(-2)??"*";for(const[c,u]of Object.entries(o.tasks)){const b=`${a}#${c}`,d=g(b);_(d,u),n.set(b,d)}}return n},xt=(t,n)=>{t.dependsOn=R(n.dependsOn,"vis"),t.inputs=h(n.inputs),t.outputs=h(n.outputs),t.env=w([...n.env??[],...n.passThroughEnv??[],...n.options?.passThroughEnv??[]]),t.cache=n.cache===!1?!1:typeof n.cache=="boolean"?n.cache:void 0},kt=async t=>{const n=new Map,s=await at(t);for(const[o,r]of Object.entries(s.tasks??{})){const a=`*#${o}`,c=g(a);xt(c,r??{}),n.set(a,c)}const i=s.taskRunner??{},e=g(k);return e.inputs=h(i.globalInputs),e.env=w([...i.globalEnv??[],...i.globalPassThroughEnv??[]]),(e.inputs.length>0||e.env.length>0)&&n.set(k,e),n},wt=(t,n)=>{switch(n){case"moon":return gt(t);case"nx":return vt(t);default:return yt(t)}},bt=t=>{const n=[];return x(p(t,"turbo.json"))&&n.push("turbo"),x(p(t,"nx.json"))&&n.push("nx"),(x(p(t,".moon","tasks.yml"))||x(p(t,".moon","tasks.yaml")))&&n.push("moon"),n.length===1?n[0]:void 0},S=(t,n,s,i,e)=>{const o=i.filter(c=>!e.includes(c)),r=e.filter(c=>!i.includes(c));if(o.length===0&&r.length===0)return;const a=[];o.length>0&&a.push(`dropped [${o.join(", ")}]`),r.length>0&&a.push(`added [${r.join(", ")}]`),t.push({axis:s,detail:`${s} diverged: ${a.join("; ")}`,node:n,severity:o.length>0?"error":"warning"})},Et=(t,n,s)=>{const i=[],e=w([...t.keys(),...n.keys()]);for(const o of e){const r=t.get(o),a=n.get(o);if(r&&!a){const c=s==="turbo"&&o.includes("#")&&!o.startsWith("*#")&&o!==k;i.push({axis:"target-set",detail:c?`source target \`${o}\` was skipped by design (turbo project#task is migrated into per-project project.json — move it there and re-verify)`:`source target \`${o}\` has no equivalent in the migrated vis config`,node:o,severity:c?"warning":"error"});continue}if(!r&&a){i.push({axis:"target-set",detail:`migrated vis config defines \`${o}\` with no source equivalent (extra target — not a regression, but review)`,node:o,severity:"warning"});continue}!r||!a||(S(i,o,"dependsOn",r.dependsOn,a.dependsOn),S(i,o,"inputs",r.inputs,a.inputs),S(i,o,"outputs",r.outputs,a.outputs),S(i,o,"env",r.env,a.env),r.cache!==void 0&&a.cache!==void 0&&r.cache!==a.cache&&i.push({axis:"cache",detail:`cache flag diverged: source=${String(r.cache)} vis=${String(a.cache)} (changes what invalidates the cache)`,node:o,severity:"error"}))}return i.sort((o,r)=>o.node.localeCompare(r.node)||o.axis.localeCompare(r.axis)),{findings:i,source:s,sourceNodeCount:t.size,visNodeCount:n.size}},$t=new Set(["json","ndjson","table"]),St=t=>({equivalent:t.findings.every(n=>n.severity!=="error"),findings:t.findings,source:t.source,sourceNodeCount:t.sourceNodeCount,visNodeCount:t.visNodeCount}),Rt=(t,n,s)=>{if(n==="json"){process.stdout.write(`${JSON.stringify(St(t),void 0,2)}
|
|
2
2
|
`);return}if(n==="ndjson"){for(const i of t.findings)process.stdout.write(`${JSON.stringify(i)}
|
|
3
3
|
`);return}if(s.info(`Migration equivalence: ${t.source} → vis`),s.info(` source nodes: ${String(t.sourceNodeCount)} vis nodes: ${String(t.visNodeCount)}`),t.findings.length===0){s.info(" ✓ task graph + cache-key surface preserved (no divergence).");return}for(const i of t.findings){const e=` [${i.severity}] ${i.node} (${i.axis}) — ${i.detail}`;i.severity==="error"?s.warn(e):s.info(e)}},jt=(t,n)=>t.findings.some(i=>n==="warning"?!0:i.severity==="error")?1:0,G=async t=>{if(!N.isTTY)return!0;const n=ft({input:N,output:ut});try{const i=(await n.question(`${t} [Y/n] `)).trim().toLowerCase();return i===""||i==="y"||i==="yes"}finally{n.close()}},Mt=[{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"}],Ct=[{description:"VisTaskConfig.targets → VisTaskConfig.tasks",next:"tasks",previous:"targets"}],Tt=t=>new RegExp(String.raw`(^|[\s,{(\[])(["']?)${t}\2(\s*:)`,"gmu"),Nt=(t,n)=>{let s=t;const i=[];for(const e of n){const o=Tt(e.previous);o.test(s)&&(o.lastIndex=0,s=s.replace(o,(r,a,c,u)=>`${a}${c}${e.next}${c}${u}`),i.push(e))}return{applied:i,output:s}},D=(t,n)=>Nt(t,n),Ot=["vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],It=new Set(["vis.task.cjs","vis.task.cts","vis.task.js","vis.task.mjs","vis.task.mts","vis.task.ts"]),_t=t=>{for(const n of Ot){const s=p(t,n);if(x(s))return s}},At=t=>{const n=[];try{for(const s of dt(t,{includeDirs:!1,includeFiles:!0,includeSymlinks:!1,skip:[/node_modules/,/\.git/,/\.vis\b/,/dist\b/,/\.next\b/,/\.nuxt\b/]}))It.has(rt(s.path))&&n.push(s.path)}catch{}return n},Dt=(t,n,s,i)=>{const e=_t(t);if(e){const r=j(e),{applied:a,output:c}=D(r,Mt);if(a.length===0)s.info(`${e} already uses the current schema — no rewrite needed.`);else if(n.dryRun)s.info(`── ${e} (preview) ──`),s.info(c),s.info("── end preview ──"),s.info(`Would apply ${String(a.length)} rename(s): ${a.map(u=>u.description).join(", ")}`);else{T(e,i),O(e,c),s.info(`Rewrote ${e} (backup at ${e}.bak). Applied ${String(a.length)} rename(s).`);for(const u of a)i.manualSteps.push(`Renamed ${u.description} in ${e}`)}}else s.warn("No vis.config.ts found at workspace root — nothing to migrate."),i.warnings.push("No vis.config.{ts,mts,cts,js,mjs,cjs} at workspace root.");const o=n.taskConfigPaths??At(t);for(const r of o){if(!x(r))continue;const a=j(r),c=D(a,Ct);if(c.applied.length!==0)if(n.dryRun)s.info(`── ${r} (preview) ──`),s.info(c.output),s.info("── end preview ──"),s.info(`Would apply ${String(c.applied.length)} rename(s): ${c.applied.map(u=>u.description).join(", ")}`);else{T(r,i),O(r,c.output),s.info(`Rewrote ${r} (backup at ${r}.bak). Applied ${String(c.applied.length)} rename(s).`);for(const u of c.applied)i.manualSteps.push(`Renamed ${u.description} in ${r}`)}}},m=t=>{const n=t.workspaceRoot??process.cwd(),s=t.visConfig??{};return{config:s,dryRun:!!t.options.dryRun,logger:t.logger,packageManager:st(n),report:F(),root:n,useEditorconfig:typeof s.editorconfig=="boolean"?s.editorconfig:!0}},l=async(t,n,s)=>{if(n.yes||n.dryRun)return!0;const i=await G(`This will edit files, scripts, and hooks for "${t}". Backups (.bak) will be created. Continue?`);return i||s.info("Aborted."),i},y=t=>{t.dryRun&&t.logger.info(`Running in dry-run mode — no changes will be made.
|
|
4
4
|
`)},Bt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("deps",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating dependencies and scripts ──"),J(e.root,e.packageManager,e.config,{dryRun:e.dryRun},t,e.report),t.info(""),f(e.report,t)},Vt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("lint-staged",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating lint-staged ──"),H(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Ft=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("nano-staged",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating nano-staged ──"),Q(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Gt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("turborepo",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating turborepo ──"),et(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),V(e.root,{dryRun:e.dryRun},t),t.info(""),f(e.report,t)},Pt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("nx",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating nx ──");const o=!!n.aggressive;X(e.root,{aggressive:o,dryRun:e.dryRun,force:o||!!n.force,rewriteSyncGenerators:o||!!n.rewriteSyncGenerators,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},qt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("moon",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating moon ──"),U(e.root,{copyTemplates:!!n.copyTemplates,dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),V(e.root,{dryRun:e.dryRun},t),t.info(""),f(e.report,t)},zt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("gitleaks",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating gitleaks ──"),W(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Kt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("kingfisher",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating Kingfisher ──"),Y(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Lt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("secretlint",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating secretlint ──"),Z(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Jt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("syncpack",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating syncpack ──"),nt(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Wt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("sherif",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating sherif ──"),tt(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Yt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("self",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating vis.config.ts to current schema ──"),Dt(e.root,{dryRun:e.dryRun},t,e.report),t.info(""),f(e.report,t)},Ht=({logger:t,workspaceRoot:n})=>{const s=n??process.cwd();pt(s,t).length>0&&(process.exitCode=1)},Ut=async({logger:t,options:n,workspaceRoot:s})=>{const i=s??process.cwd(),e=n.format??"table";if(!$t.has(e)){t.warn(`Invalid --format: ${String(n.format)}. Expected table | json | ndjson.`),process.exitCode=1;return}const o=n.failOn==="warning"?"warning":"error";let r;if(n.from){if(n.from!=="turbo"&&n.from!=="nx"&&n.from!=="moon"){t.warn(`Invalid --from: ${n.from}. Expected turbo | nx | moon.`),process.exitCode=1;return}r=n.from}else if(r=bt(i),!r){t.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 a=wt(i,r);if(a.size===0){t.warn(`No ${r} task graph found at ${i} — nothing to verify.`),process.exitCode=1;return}const c=await kt(i);if(c.size===0){t.warn("No migrated vis task graph found (vis.config.ts has no tasks). Run the migrator first."),process.exitCode=1;return}const u=Et(a,c,r);Rt(u,e,t),process.exitCode=jt(u,o)},Qt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{const e=i??process.cwd(),r=K(e,s??{}),a=L(r);if(a.length===0){t.info("No applicable migrations detected in this workspace.");return}const c=!!n.dryRun;t.info(`Detected ${String(a.length)} migration(s):`);for(const d of a)t.info(` • ${d.title} — ${d.description}`);if(t.info(""),!n.yes&&!c&&!await G("Apply all detected migrations? Backups (.bak) will be created.")){t.info("Aborted.");return}c&&t.info(`Running in dry-run mode — no changes will be made.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as D}from"node:module";import{V as q}from"../packem_shared/vis-user-error-
|
|
1
|
+
import{createRequire as D}from"node:module";import{V as q}from"../packem_shared/vis-user-error-C3y9hGtw.js";let W;const L=e=>(W??=D(import.meta.url))(e),R=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=e=>{if(typeof R<"u"&&R.versions&&R.versions.node){const[t,n]=R.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return R.getBuiltinModule(e)}return L(e)},{relative:h,join:u,dirname:_}=E("node:path"),{lstat:G}=E("node:fs/promises"),U=new Set(["ENOENT","ENOTDIR"]),$=e=>U.has(e?.code??""),T=async(e,t)=>{const n=e.lstat;try{return(typeof n=="function"?await n.call(e,t):await G(t)).isSymbolicLink()}catch(i){if($(i))return!1;throw i}},v=async(e,t,n)=>{if(await T(e,t))throw new q(`Refusing to write ${t}: it is a symlink, and following it would write somewhere else. Remove or replace the link, then re-run.`);await e.writeFile(t,n)},g=async(e,t)=>{try{return await e.access(t),!0}catch(n){if($(n))return!1;throw n}},Y=async(e,t)=>{try{return(await e.stat(t)).isDirectory()}catch(n){if($(n))return!1;throw n}},b=async(e,t)=>{try{return await e.readFile(t,"utf8")}catch(n){if($(n))return;throw n}},K=e=>{const t=/\n([\t ]+)\S/.exec(e);return t?.[1]!==void 0?t[1]:e.includes(`
|
|
2
2
|
`)?" ":""},V=(e,t)=>{const n=t.includes(`\r
|
|
3
3
|
`)?`\r
|
|
4
4
|
`:`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as L,b as J,p as m,O as G,c as A,q as T}from"./cli-main.js";import{O as H}from"../packem_shared/renderToString-DR0zDUjh-
|
|
1
|
+
import{a as L,b as J,p as m,O as G,c as A,q as T}from"./cli-main.js";import{O as H}from"../packem_shared/renderToString-DR0zDUjh-CQT5Ebrc.js";import{a as K,R as c,O as y}from"../packem_shared/registry-CyYhBUaF.js";import{i as Q}from"../packem_shared/index-BjdW45xX.js";import{v as W,r as X,f as Z}from"../packem_shared/ai-analysis-D1Y5a_SZ.js";import{V as _}from"../packem_shared/vis-user-error-C3y9hGtw.js";import{d as ee}from"../packem_shared/pm-runner-BXRi4ZM9.js";import{s as te}from"../packem_shared/env-D3wteXlq.js";import{U as se,V as re,C as P}from"../packem_shared/vis-update-app-CPpJkbSs.js";import{readCatalogs as ae,toFilterArray as f,checkOutdated as ne,formatSummary as j,formatOutdatedMinimal as oe,formatOutdatedTable as ce}from"./catalog.js";import{l as ie}from"../packem_shared/npmrc-CIvOb61L.js";const $e=async({argument:R,logger:s,options:e,visConfig:o,workspaceRoot:C})=>{if(!C)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const d=C;if(e.sync&&!e.securityConfig)throw new _("--sync requires --security-config. Run `vis check --security-config --sync`.");if(e.securityConfig){const t=ee(d);if(L(o??{},t.name),e.sync&&t.name==="pnpm"){const r=J(o??{});if(r.length>0){m.info(`
|
|
2
2
|
Settings that would sync to pnpm-workspace.yaml:`);for(const E of r)m.success(` ${E}`)}else m.info("No security settings to sync.")}else e.sync&&t.name!=="pnpm"&&(m.info(`--sync is only available for pnpm projects. Your project uses ${t.name}.`),m.info("vis enforces security settings at the vis layer for non-pnpm projects."));if(!e.security&&!R?.length)return}const{packageManager:N}=G(d),U=ie(d),i=o?.update??{},h=ae(d,N,{dev:e.dev,includeInternal:e["include-internal"],peer:e.peer,prod:e.prod});if(h.size===0){s.info("No catalogs found.");return}const w=e.target??i.target??"latest";if(!["latest","minor","patch"].includes(w))throw new Error(`Invalid target "${w}". Use: latest, minor, or patch.`);const D={exclude:[...f(e.exclude),...f(i.exclude)],ignore:f(i.ignore),include:[...f(e.include),...f(i.include),...R],includeLocked:!!e.includeLocked,includePrerelease:e.prerelease||i.prerelease||!1,security:e.security!==!1,target:w};let x=0;for(const t of h.values())x+=t.size;const k=!!process.stdout.isTTY&&!Q;let l;const I=k?(t,r)=>{l?l.rerender(c.createElement(P,{current:t,total:r})):l=T(c.createElement(P,{current:t,total:r}),{interactive:!0,patchConsole:!1})}:(t,r)=>{s.info(`Checking ${String(t)}/${String(r)} dependencies...`)};k||s.info(`Checking ${String(x)} catalog dependencies against npm registry...
|
|
3
3
|
`);const g=new Set;A("socket")&&g.add("socket"),A("depsDev")&&g.add("deps-dev");const v=o?.security?.policies?.score?.minimum,M=K(o?.security,{disabled:g,minimumScore:v}),{failed:$,outdated:n}=await ne(h,D,U,I,d,M,o?.security?.acceptedRisks);if(l&&(l.clear(),l.unmount()),$.length>0&&s.warn(`Failed to fetch: ${$.join(", ")}`),n.length===0){s.info("All catalog dependencies are up to date.");return}const S=e.format??i.format??"table",V=W(e.aiType??"impact"),u=e.ai?await X(n,s,o?.ai,V):void 0;if(k&&S==="table"){const t=new se(n,u??null),r=o?.tui?.autoExit??!1,E=r===!0?3:typeof r=="number"?r:0;await T(c.createElement(re,{autoExitSeconds:E,isDryRun:!0,store:t}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit();const q=process.stdout.columns||80;process.stdout.write(`
|
|
4
4
|
`);for(const a of n){const B=a.vulnerabilities?.length||a.socketReport&&a.socketReport.alerts.length>0,b=!!a.acceptedRisk,Y=B?b?"✓":"⚠":"✓",z=b?"gray":a.updateType==="major"?"red":a.updateType==="minor"?"yellow":"green",p=a.socketReport?.score.overall,F=p===void 0?"":` [${String(Math.round(p*100))}%]`,O=p===void 0?void 0:te(p);process.stdout.write(`${H(c.createElement(y,null," ",c.createElement(y,{color:z},Y),` ${a.packageName} ${a.currentRange} → ${a.newRange}`,c.createElement(y,{dimColor:!0},` ${a.updateType}`),O?c.createElement(y,{color:O},F):null),{columns:q})}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as K}from"node:module";import{j as g,F as m,q as v,J as N,X as P,b as j}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as h,v as U}from"../packem_shared/index-0dnGN3GP.js";import{d as F,b as Y}from"../packem_shared/registry-
|
|
1
|
+
import{createRequire as K}from"node:module";import{j as g,F as m,q as v,J as N,X as P,b as j}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as h,v as U}from"../packem_shared/index-0dnGN3GP.js";import{d as F,b as Y}from"../packem_shared/registry-CyYhBUaF.js";import{d as J}from"../packem_shared/lockfile-DEWjBrlY.js";import{p as z,s as X}from"../packem_shared/docker-DPxeLIQl.js";import{i as ne}from"../packem_shared/index-BjdW45xX.js";import{g as B,h as oe}from"../packem_shared/env-D3wteXlq.js";import{y as re}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";let G;const W=e=>(G??=K(import.meta.url))(e),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[t,n]=b.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return b.getBuiltinModule(e)}return W(e)},{createInterface:O}=y("node:readline"),{spawn:Q}=y("node:child_process"),{createHash:Z}=y("node:crypto"),{existsSync:I,writeFileSync:ee,chmodSync:te}=y("node:fs"),S={aube:{base:["RUN corepack enable"],build:e=>e?`RUN aube run --filter ${e} build`:"RUN aube run 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",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",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",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",install:"RUN --mount=type=cache,target=/usr/local/share/.cache/yarn yarn install --immutable"}},se=e=>{const{focus:t,manager:n,nodeVersion:r}=e,o=S[n]??S.npm;return["# syntax=docker/dockerfile:1","","# Generated by 'vis docker init'. Before building, scaffold the context:",`# vis docker scaffold${t?` --focus=${t}`:""} --include-sources`,"# then build with BuildKit enabled (DOCKER_BUILDKIT=1).","",`FROM node:${r}-slim AS base`,"WORKDIR /app",...o.base,"","# --- install dependencies from the scaffolded manifests only ---","FROM base AS deps","COPY .vis/docker/workspace/ ./",o.install,"","# --- build the focus project, then drop unfocused workspace projects ---","FROM deps AS build","COPY .vis/docker/sources/ ./",o.build(t),"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
2
|
`)},$="v2.14.0",D=`https://github.com/hadolint/hadolint/releases/download/${$}`,ie={"hadolint-linux-arm64":"331f1d3511b84a4f1e3d18d52fec284723e4019552f4f47b19322a53ce9a40ed","hadolint-linux-x86_64":"6bf226944684f56c84dd014e8b979d27425c0148f61b3bd99bcc6f39e9dc5a47","hadolint-macos-arm64":"3625e2e9f43dcfe7bd38738a5f5520ed50ce39ed28485266e6803dd7bc197b10","hadolint-macos-x86_64":"2b69a853433f1eca522ffb921cd490bd1321424d03331fd8390f93b7fb4a02e9","hadolint-windows-x86_64.exe":"8e0ee174f88edb14f207a68430c7a53c2883ed509cdbde9a3a26fffa140fa5e4"},ae=e=>ie[e],ce=(e=process.platform,t=process.arch)=>{const n=e==="darwin"?"macos":e==="linux"?"linux":e==="win32"?"windows":void 0;if(n===void 0)return;const r=t==="arm64"?"arm64":t==="x64"?"x86_64":void 0;if(n==="windows")return"hadolint-windows-x86_64.exe";if(r!==void 0)return`hadolint-${n}-${r}`},L=e=>h(B(),"hadolint",$,e.endsWith(".exe")?"hadolint.exe":"hadolint"),le=()=>{const e=process.platform==="win32"?"hadolint.exe":"hadolint",t=(process.env.PATH??"").split(process.platform==="win32"?";":":");for(const n of t)if(n!==""&&I(h(n,e)))return e},de=e=>e.trim().split(/\s+/u)[0]??"",E=async e=>{const t=await fetch(e,{redirect:"follow"});if(!t.ok)throw new Error(`download failed (${String(t.status)} ${t.statusText}) for ${e}`);return Buffer.from(await t.arrayBuffer())},ue=async e=>{const t=L(e),n=ae(e),r=await E(`${D}/${e}`),o=Z("sha256").update(r).digest("hex");if(n===void 0){const s=await E(`${D}/${e}.sha256`),i=de(s.toString("utf8")).toLowerCase();if(i==="")throw new Error("hadolint checksum sidecar was empty or unparseable. Refusing to use the download.");if(i!==o)throw new Error(`hadolint checksum mismatch (expected ${i}, got ${o}). Refusing to use the download.`)}else if(n.toLowerCase()!==o)throw new Error(`hadolint checksum mismatch (expected ${n.toLowerCase()}, got ${o}). Refusing to use the download.`);return oe(h(B(),"hadolint",$)),ee(t,r),process.platform!=="win32"&&te(t,493),t},fe=async()=>{const e=O({input:process.stdin,output:process.stderr}),t=await new Promise(n=>{e.question(` Download hadolint ${v($)} now? ${m("[y/N]")} `,r=>{n(r.trim().toLowerCase())})});return e.close(),t==="y"||t==="yes"},pe=async e=>{const{autoInstall:t=!1,log:n}=e,r=le();if(r!==void 0)return r;const o=ce();if(o===void 0){n(`hadolint has no prebuilt binary for ${process.platform}/${process.arch}. Install it manually: https://github.com/hadolint/hadolint`);return}const s=L(o);if(I(s))return s;if(!t){if(!(!!process.stdin.isTTY&&!ne)){n(`hadolint is not installed. Re-run with ${g("--install")} (or install hadolint on PATH) to enable Dockerfile linting.`);return}if(n(`${g("hadolint")} is required to lint Dockerfiles but was not found on your PATH.`),!await fe()){n(`Skipped. Install it yourself or re-run with ${g("--install")}.`);return}}n(`Downloading hadolint ${$} (${o})…`);try{const i=await ue(o);return n(`Installed hadolint to ${m(i)}`),i}catch(i){n(`Failed to download hadolint: ${i.message}`);return}},_=async(e,t,n)=>{if(t.length===0)return[];const r=["--format","json","--no-fail",...n!==void 0&&n!==""?["--config",n]:[],...t],o=await new Promise((i,l)=>{const a=Q(e,r,{stdio:["ignore","pipe","pipe"],windowsHide:!0});let d="",u="";a.stdout?.on("data",c=>{d+=c.toString("utf8")}),a.stderr?.on("data",c=>{u+=c.toString("utf8")}),a.on("error",l),a.on("close",()=>{if(d.trim()===""&&u.trim()!==""){l(new Error(u.trim()));return}i(d)})});if(o.trim()==="")return[];let s;try{s=JSON.parse(o)}catch{throw new Error("Could not parse hadolint JSON output.")}return Array.isArray(s)?s:[]},C=(e,t,n)=>{if(!(!/\bapt-get\b/u.test(e)||!/\binstall\b/u.test(e)||n.test(e)))return e.replace(/\binstall\b/u,`install ${t}`)},k={DL3014:e=>C(e,"-y",/(?:^|\s)(?:-y|--yes|--assume-yes|-qq?)\b/u),DL3015:e=>C(e,"--no-install-recommends",/--no-install-recommends\b/u),DL3020:e=>/^\s*ADD\b/u.test(e)?e.replace(/^(\s*)ADD\b/u,"$1COPY"):void 0,DL3027:e=>/(?:^|\s)apt\s/u.test(e)&&!/\bapt-get\b/u.test(e)?e.replace(/(^|\s)apt(\s)/u,"$1apt-get$2"):void 0},T=new Set(Object.keys(k)),me=(e,t)=>{const n=e.includes(`\r
|
|
3
3
|
`)?`\r
|
|
4
4
|
`:`
|