var u=Object.defineProperty;var m=(n,o)=>u(n,"name",{value:o,configurable:!0});import{r as h}from"../packem_shared/affected-shas-BdnlfiV1.js";import{r as w}from"../packem_shared/toolchain-DoG6b_G_.js";var $=Object.defineProperty,a=m((n,o)=>$(n,"name",{value:o,configurable:!0}),"t");const S=a(async({argument:n,logger:o,options:r,runtime:l,visConfig:f,workspaceRoot:s})=>{const p=n[0];if(!p)throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");const c=p.split(",").map(e=>e.trim()).filter(Boolean);if(c.length===0)throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");if(!s)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const t=h({defaultBase:f?.defaultBase,workspaceRoot:s}),d=r.base??t.base,g=r.head??t.head;!r.base&&!r.head&&o.info(`▸ Resolved affected refs from ${t.provider} (${t.notes.join("; ")})`),r.skipToolchain||o.info("▸ Toolchain pre-flight"),await w(s,f?.toolchain,{error:a(e=>{o.error(e)},"error"),info:a(e=>{o.info(e)},"info"),warn:a(e=>{o.warn(e)},"warn")},!!r.skipToolchain),r.install===!1?o.info("▸ Skipping install (--no-install)"):(o.info("▸ Installing dependencies"),await l.runCommand("install",{argv:["--ci","--frozen-lockfile"]}));for(const e of c){o.info(`▸ Running affected ${e} (base=${d}, head=${g})`);const i=[e,`--base=${d}`,`--head=${g}`,`--upstream=${String(r.upstream??"none")}`,`--downstream=${String(r.downstream??"deep")}`];r.parallel!==void 0&&i.push(`--parallel=${String(r.parallel)}`),r.partition&&i.push(`--partition=${String(r.partition)}`),r.query&&i.push(`--query=${String(r.query)}`),await l.runCommand("affected",{argv:i})}o.info("▸ CI pipeline complete")},"execute");export{S as default};
