infra-kit 0.3.4 → 0.3.5

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.
@@ -1,4 +1,4 @@
1
- import{a as rs,b as lt,c as Yt,d as ts,e as os,f as ns,g as ss,h as Xt,i as is,j as pt,k as er,l as dt,p as mt,q as de,r as rr}from"./chunk-S45AAYXO.js";import{a as ct}from"./chunk-Y72C523R.js";import{a as rt,c as q,d as k,e as it,f as H,i as u,k as at,l as $,m as D}from"./chunk-GZNE5CBQ.js";import{E as zn,F as qn,H as Hn,I as Zn,J as ze,K as Yn,L as Zt,M as re,O as N,P as O,Q as Xn,R as qe,a as Mn,b as Qr,c as _,d as pe,e as ye,f as Ln,g as Ht,h as z,i as S,j as et,k as Wn,l as V,m as w,n as Vn,o as Jn,p as ee,q as Bn,r as Kn,u as l,w as Un,x as Gn}from"./chunk-IVWPZEMC.js";import{a as J,b as tt,c as yr,d as Qn,e as ot,f as He,g as Ze,h as nt,i as Ye,j as Ie,k as Xe,l as st,n as Qe,o as es,p as Ne,q as Oe,r as te}from"./chunk-CHETBZ6M.js";import br from"node:path";import Sa from"node:process";import{z as B}from"zod";var we={requiredScripts:["build","ts-check","eslint-check","prettier-check","test"],requiredFiles:["tsconfig.json","eslint.config.js","readme.md"],turboTasks:[]},Qt={requiredScripts:["build","dev","test","qa","infra-kit-check","fix"],requiredFiles:["turbo.json","pnpm-workspace.yaml"],turboTasks:["build","test","ts-check","eslint-check","prettier-check","infra-kit-check"]},eo=(e,r=we)=>({requiredScripts:e.requiredScripts??[...r.requiredScripts],requiredFiles:e.requiredFiles??[...r.requiredFiles],turboTasks:e.turbo?.requiredTasks??[...r.turboTasks]});import la from"node:fs/promises";var me=async e=>{try{return await la.access(e),!0}catch{return!1}};import ba from"node:path";import{packageConfigSchema as pa}from"@slip-stream-kit/config/internal";import as from"node:fs/promises";import cs from"node:path";import{pathToFileURL as da}from"node:url";import{z as ma}from"zod";var Re="infra-kit.config.ts",ro=async e=>{try{let r=await as.readFile(cs.join(e,"package.json"),"utf-8");return JSON.parse(r)}catch{return{}}},wr=async(e,r=we)=>{let t=cs.join(e,Re);if(!await me(t))throw new Error(`${Re} not found at ${t}`);let o=await as.stat(t),i=(await import(`${da(t).href}?mtime=${Number(o.mtimeMs)}`)).default;if(i===void 0)throw new Error(`${Re} at ${t} has no default export`);let a=typeof i=="function"?await i():i,c=pa.safeParse(a);if(!c.success)throw new Error(`Invalid ${Re} at ${t}: ${ma.prettifyError(c.error)}`);return eo(c.data,r)};import ls from"node:fs/promises";import ut from"node:path";import ua from"yaml";var fa="pnpm-workspace.yaml",ga=async e=>(await ls.readdir(e,{withFileTypes:!0}).catch(()=>[])).filter(t=>t.isDirectory()).map(t=>ut.join(e,t.name)),ha=async(e,r)=>{let t=[];for(let o of e){if(r==="*"){t.push(...await ga(o));continue}let s=ut.join(o,r);await me(s)&&t.push(s)}return t},va=async(e,r)=>{let t=[e];for(let o of r.split("/"))t=await ha(t,o);return t},Rr=async e=>{let r=await ls.readFile(ut.join(e,fa),"utf-8"),o=((ua.parse(r)??{}).packages??[]).filter(n=>!n.startsWith("!")&&!n.startsWith("vendor")),s=new Set;for(let n of o){let i=await va(e,n);for(let a of i)await me(ut.join(a,"package.json"))&&s.add(a)}return[...s].sort()};var to=async(e,r=we)=>{try{let t=await wr(e,r);return{check:{name:Re,status:"pass",message:"present and valid"},rules:t}}catch(t){return{check:{name:Re,status:"fail",message:t.message},rules:null}}};import ka from"node:fs/promises";import ya from"node:path";var oo=async(e,r)=>Promise.all(r.map(async t=>{let o=await ka.stat(ya.join(e,t)).catch(()=>null);return o?o.isFile()?{name:`file:${t}`,status:"pass",message:"exists"}:{name:`file:${t}`,status:"fail",message:`not a file: ${t} (found a directory)`}:{name:`file:${t}`,status:"fail",message:`missing file: ${t}`}}));var no=(e,r)=>r.map(t=>{let o=e[t];return typeof o!="string"?{name:`script:${t}`,status:"fail",message:`missing "${t}" in package.json scripts`}:o.trim().length===0?{name:`script:${t}`,status:"fail",message:`"${t}" is empty in package.json scripts`}:{name:`script:${t}`,status:"pass",message:"defined"}});import wa from"node:fs/promises";import Ra from"node:path";var tr="turbo.json",so=async(e,r)=>{if(r.length===0)return[];let t;try{let s=await wa.readFile(Ra.join(e,tr),"utf-8");t=JSON.parse(s)}catch(s){return[{name:tr,status:"fail",message:`cannot read/parse ${tr}: ${s.message}`}]}let o=t.tasks;return o===null||typeof o!="object"?[{name:tr,status:"fail",message:`no "tasks" object defined in ${tr}`}]:r.map(s=>{let n=s in o||`//#${s}`in o;return{name:`turbo:${s}`,status:n?"pass":"fail",message:n?"defined":`missing turbo task "${s}" in ${tr}`}})};var io=async(e,r=we)=>{let t=await ro(e),o=t.name??ba.basename(e),{check:s,rules:n}=await to(e,r),i=[s];n&&(i.push(...no(t.scripts??{},n.requiredScripts)),i.push(...await oo(e,n.requiredFiles)),i.push(...await so(e,n.turboTasks)));let a=i.every(c=>c.status==="pass");return{packageDir:e,packageName:o,checks:i,passed:a}};var g=e=>[{type:"text",text:e}],v=e=>e;import{loadDev as Ea}from"@slip-stream-kit/config/internal";import xa from"node:path";var Pa=(e,r)=>{let t=new Set;for(let o of Object.values(e))for(let s of Object.keys(qn(o,r).proxy))t.add(s);return[...t]},Ta=async(e,r)=>{let t={},o=[];return await Promise.all(r.map(async s=>{try{let i=(await Ea(xa.join(e,"apps",s,"ui")))?.proxy?.routes;if(!i)return;t[s]=Object.fromEntries(Object.entries(i).map(([a,c])=>[a,c.packageName]))}catch(n){o.push({app:s,message:n instanceof Error?n.message:String(n)})}})),{routePkg:(s,n)=>t[s]?.[n],loadErrors:o}},Ca=(e,r)=>[...r.map(t=>({name:`devServersPresets:config:${t.app}`,status:"fail",message:`could not load apps/${t.app}/ui/infra-kit.config.ts (referenced by a preset proxy override): ${t.message}`})),...e.map(t=>({name:`devServersPresets:${t.preset}`,status:"fail",message:t.message}))],ps=async e=>{let r=(await O()).devServersPresets;if(!r||Object.keys(r).length===0)return null;let t=zn(r);if(t.length>0){let m=t.map(h=>({name:`devServersPresets:${h.preset}`,status:"fail",message:h.message}));return{packageDir:e,packageName:"devServersPresets",checks:m,passed:!1}}let o=Un(e),s=Gn(e),n={api:o.map(m=>m.name),ui:s.map(m=>m.name)},{routePkg:i,loadErrors:a}=await Ta(e,Pa(r,n)),c={discovered:n,apiPkgByApp:Object.fromEntries(o.map(m=>[m.name,m.packageName])),routePkg:i},p=Ca(Hn(r,c),a),d=p.length===0?[{name:"devServersPresets:proxy-locality",status:"pass",message:"every local proxy override resolves to a backend the preset launches"}]:p;return{packageDir:e,packageName:"devServersPresets",checks:d,passed:p.length===0}};var $a=async e=>{let r=br.resolve(e);for(;r!==br.dirname(r);){if(await me(br.join(r,"package.json")))return r;r=br.dirname(r)}if(await me(br.join(r,"package.json")))return r;throw new Error(`No package.json found in or above ${e}`)},_a=async e=>e.root?[{dir:await w(),baseline:Qt}]:e.all?(await Rr(await w())).map(t=>({dir:t})):[{dir:await $a(e.cwd??Sa.cwd())}],Aa=e=>{let r=e.passed?"PASS":"FAIL";l.info(`
1
+ import{a as rs,b as lt,c as Yt,d as ts,e as os,f as ns,g as ss,h as Xt,i as is,j as pt,k as er,l as dt,p as mt,q as de,r as rr}from"./chunk-S45AAYXO.js";import{a as ct}from"./chunk-OS5Z2WME.js";import{a as rt,c as q,d as k,e as it,f as H,i as u,k as at,l as $,m as D}from"./chunk-GZNE5CBQ.js";import{E as zn,F as qn,H as Hn,I as Zn,J as ze,K as Yn,L as Zt,M as re,O as N,P as O,Q as Xn,R as qe,a as Mn,b as Qr,c as _,d as pe,e as ye,f as Ln,g as Ht,h as z,i as S,j as et,k as Wn,l as V,m as w,n as Vn,o as Jn,p as ee,q as Bn,r as Kn,u as l,w as Un,x as Gn}from"./chunk-IVWPZEMC.js";import{a as J,b as tt,c as yr,d as Qn,e as ot,f as He,g as Ze,h as nt,i as Ye,j as Ie,k as Xe,l as st,n as Qe,o as es,p as Ne,q as Oe,r as te}from"./chunk-CHETBZ6M.js";import br from"node:path";import Sa from"node:process";import{z as B}from"zod";var we={requiredScripts:["build","ts-check","eslint-check","prettier-check","test"],requiredFiles:["tsconfig.json","eslint.config.js","readme.md"],turboTasks:[]},Qt={requiredScripts:["build","dev","test","qa","infra-kit-check","fix"],requiredFiles:["turbo.json","pnpm-workspace.yaml"],turboTasks:["build","test","ts-check","eslint-check","prettier-check","infra-kit-check"]},eo=(e,r=we)=>({requiredScripts:e.requiredScripts??[...r.requiredScripts],requiredFiles:e.requiredFiles??[...r.requiredFiles],turboTasks:e.turbo?.requiredTasks??[...r.turboTasks]});import la from"node:fs/promises";var me=async e=>{try{return await la.access(e),!0}catch{return!1}};import ba from"node:path";import{packageConfigSchema as pa}from"@slip-stream-kit/config/internal";import as from"node:fs/promises";import cs from"node:path";import{pathToFileURL as da}from"node:url";import{z as ma}from"zod";var Re="infra-kit.config.ts",ro=async e=>{try{let r=await as.readFile(cs.join(e,"package.json"),"utf-8");return JSON.parse(r)}catch{return{}}},wr=async(e,r=we)=>{let t=cs.join(e,Re);if(!await me(t))throw new Error(`${Re} not found at ${t}`);let o=await as.stat(t),i=(await import(`${da(t).href}?mtime=${Number(o.mtimeMs)}`)).default;if(i===void 0)throw new Error(`${Re} at ${t} has no default export`);let a=typeof i=="function"?await i():i,c=pa.safeParse(a);if(!c.success)throw new Error(`Invalid ${Re} at ${t}: ${ma.prettifyError(c.error)}`);return eo(c.data,r)};import ls from"node:fs/promises";import ut from"node:path";import ua from"yaml";var fa="pnpm-workspace.yaml",ga=async e=>(await ls.readdir(e,{withFileTypes:!0}).catch(()=>[])).filter(t=>t.isDirectory()).map(t=>ut.join(e,t.name)),ha=async(e,r)=>{let t=[];for(let o of e){if(r==="*"){t.push(...await ga(o));continue}let s=ut.join(o,r);await me(s)&&t.push(s)}return t},va=async(e,r)=>{let t=[e];for(let o of r.split("/"))t=await ha(t,o);return t},Rr=async e=>{let r=await ls.readFile(ut.join(e,fa),"utf-8"),o=((ua.parse(r)??{}).packages??[]).filter(n=>!n.startsWith("!")&&!n.startsWith("vendor")),s=new Set;for(let n of o){let i=await va(e,n);for(let a of i)await me(ut.join(a,"package.json"))&&s.add(a)}return[...s].sort()};var to=async(e,r=we)=>{try{let t=await wr(e,r);return{check:{name:Re,status:"pass",message:"present and valid"},rules:t}}catch(t){return{check:{name:Re,status:"fail",message:t.message},rules:null}}};import ka from"node:fs/promises";import ya from"node:path";var oo=async(e,r)=>Promise.all(r.map(async t=>{let o=await ka.stat(ya.join(e,t)).catch(()=>null);return o?o.isFile()?{name:`file:${t}`,status:"pass",message:"exists"}:{name:`file:${t}`,status:"fail",message:`not a file: ${t} (found a directory)`}:{name:`file:${t}`,status:"fail",message:`missing file: ${t}`}}));var no=(e,r)=>r.map(t=>{let o=e[t];return typeof o!="string"?{name:`script:${t}`,status:"fail",message:`missing "${t}" in package.json scripts`}:o.trim().length===0?{name:`script:${t}`,status:"fail",message:`"${t}" is empty in package.json scripts`}:{name:`script:${t}`,status:"pass",message:"defined"}});import wa from"node:fs/promises";import Ra from"node:path";var tr="turbo.json",so=async(e,r)=>{if(r.length===0)return[];let t;try{let s=await wa.readFile(Ra.join(e,tr),"utf-8");t=JSON.parse(s)}catch(s){return[{name:tr,status:"fail",message:`cannot read/parse ${tr}: ${s.message}`}]}let o=t.tasks;return o===null||typeof o!="object"?[{name:tr,status:"fail",message:`no "tasks" object defined in ${tr}`}]:r.map(s=>{let n=s in o||`//#${s}`in o;return{name:`turbo:${s}`,status:n?"pass":"fail",message:n?"defined":`missing turbo task "${s}" in ${tr}`}})};var io=async(e,r=we)=>{let t=await ro(e),o=t.name??ba.basename(e),{check:s,rules:n}=await to(e,r),i=[s];n&&(i.push(...no(t.scripts??{},n.requiredScripts)),i.push(...await oo(e,n.requiredFiles)),i.push(...await so(e,n.turboTasks)));let a=i.every(c=>c.status==="pass");return{packageDir:e,packageName:o,checks:i,passed:a}};var g=e=>[{type:"text",text:e}],v=e=>e;import{loadDev as Ea}from"@slip-stream-kit/config/internal";import xa from"node:path";var Pa=(e,r)=>{let t=new Set;for(let o of Object.values(e))for(let s of Object.keys(qn(o,r).proxy))t.add(s);return[...t]},Ta=async(e,r)=>{let t={},o=[];return await Promise.all(r.map(async s=>{try{let i=(await Ea(xa.join(e,"apps",s,"ui")))?.proxy?.routes;if(!i)return;t[s]=Object.fromEntries(Object.entries(i).map(([a,c])=>[a,c.packageName]))}catch(n){o.push({app:s,message:n instanceof Error?n.message:String(n)})}})),{routePkg:(s,n)=>t[s]?.[n],loadErrors:o}},Ca=(e,r)=>[...r.map(t=>({name:`devServersPresets:config:${t.app}`,status:"fail",message:`could not load apps/${t.app}/ui/infra-kit.config.ts (referenced by a preset proxy override): ${t.message}`})),...e.map(t=>({name:`devServersPresets:${t.preset}`,status:"fail",message:t.message}))],ps=async e=>{let r=(await O()).devServersPresets;if(!r||Object.keys(r).length===0)return null;let t=zn(r);if(t.length>0){let m=t.map(h=>({name:`devServersPresets:${h.preset}`,status:"fail",message:h.message}));return{packageDir:e,packageName:"devServersPresets",checks:m,passed:!1}}let o=Un(e),s=Gn(e),n={api:o.map(m=>m.name),ui:s.map(m=>m.name)},{routePkg:i,loadErrors:a}=await Ta(e,Pa(r,n)),c={discovered:n,apiPkgByApp:Object.fromEntries(o.map(m=>[m.name,m.packageName])),routePkg:i},p=Ca(Hn(r,c),a),d=p.length===0?[{name:"devServersPresets:proxy-locality",status:"pass",message:"every local proxy override resolves to a backend the preset launches"}]:p;return{packageDir:e,packageName:"devServersPresets",checks:d,passed:p.length===0}};var $a=async e=>{let r=br.resolve(e);for(;r!==br.dirname(r);){if(await me(br.join(r,"package.json")))return r;r=br.dirname(r)}if(await me(br.join(r,"package.json")))return r;throw new Error(`No package.json found in or above ${e}`)},_a=async e=>e.root?[{dir:await w(),baseline:Qt}]:e.all?(await Rr(await w())).map(t=>({dir:t})):[{dir:await $a(e.cwd??Sa.cwd())}],Aa=e=>{let r=e.passed?"PASS":"FAIL";l.info(`
2
2
  ${e.packageName} \u2014 ${r}`);for(let t of e.checks){let o=t.status==="pass"?"[PASS]":"[FAIL]";l.info(` ${o} ${t.name}: ${t.message}`)}},ds=async(e={})=>{let r=await _a(e),t=[];for(let n of r)t.push(await io(n.dir,n.baseline));if(e.root){let n=await ps(r[0].dir);n&&t.push(n)}for(let n of t)Aa(n);let o=t.every(n=>n.passed);l.info(`
3
3
  ${o?"\u2705 All valid":"\u274C Audit failed"} (${t.length} checked)`);let s={allPassed:o,packages:t.map(n=>({name:n.packageName,passed:n.passed,checks:n.checks}))};return{content:g(JSON.stringify(s,null,2)),structuredContent:s}},Ia={all:B.boolean().optional().describe("Audit every non-vendor workspace package"),root:B.boolean().optional().describe("Audit the monorepo root (turbo pipeline + root commands)")},Na={allPassed:B.boolean().describe("Whether every audited package passed all checks"),packages:B.array(B.object({name:B.string(),passed:B.boolean(),checks:B.array(B.object({name:B.string(),status:B.enum(["pass","fail"]),message:B.string()}))})).describe("Per-package check results")},ao=v({name:"audit",description:"Audit packages against infra-kit.config.ts rules (config present and valid, required scripts, required files, and turbo tasks for the root). Defaults to the current package; all=true audits every non-vendor workspace package; root=true audits the monorepo root.",inputSchema:Ia,outputSchema:Na,handler:e=>ds({all:e.all,root:e.root})});import j from"node:fs";import Fc from"node:os";import ne from"node:path";import{z as pr}from"zod";import{$ as Co}from"zx";import{execFileSync as Oa}from"node:child_process";var ms=(e,r)=>{let t=e.filter(o=>!o.live).map(o=>o.name);return r?{prunable:[],withheld:t}:{prunable:t,withheld:[]}},Da=[/\binfra-kit\s+dev\b/,/cli\.js\s+dev\b/,/dev-server\.(?:js|ts)\b/],Fa=e=>Da.some(r=>r.test(e)),ja="/bin/ps",Ma=()=>Oa(ja,["-eo","command="],{encoding:"utf8",maxBuffer:8<<20}).split(`
4
4
  `),us=(e=Ma)=>{try{return e().some(Fa)}catch{return!0}};import Ha from"@inquirer/select";import{Buffer as Za}from"node:buffer";import Ya from"node:fs";import Xa from"node:path";import ho from"node:process";import{z as $r}from"zod";import{$ as ht}from"zx";var La="Could not find requested project",Wa="Could not find requested config",fs="Invalid Auth token",gs="does not have access to requested config",Er=e=>e.includes(fs)||e.includes(gs)?"auth":e.includes(La)?"project":e.includes(Wa)?"config":"unknown",xr=e=>e.includes(gs)?"mis-scoped":e.includes(fs)?"revoked":null;var hs=e=>[`Doppler rejected the service token for env "${e}" \u2014 it is invalid, revoked, or scoped to a different config.`,`Fix: run \`infra-kit env-token-set ${e}\` with a token scoped to that config.`,"CI / agents: set INFRA_KIT_ENV_TOKEN to a token scoped to that config."].join(`
@@ -228,4 +228,4 @@ See \`.sync-manifest.json\` for the source commit and per-file checksums.
228
228
 
229
229
  ${i.join(`
230
230
  `)}`);let a={worktrees:s,count:s.length};return{content:g(JSON.stringify(a,null,2)),structuredContent:a}},An=v({name:"worktrees-list",description:"List existing release-branch worktrees with version, release type (regular / hotfix), and Jira fix-version description. Read-only.",inputSchema:{},outputSchema:{worktrees:kr.array(kr.object({version:kr.string().describe("Release version"),type:kr.enum(["regular","hotfix"]).describe("Release type"),description:kr.string().nullable().describe("Jira version description")})).describe("List of all worktrees with details"),count:kr.number().describe("Number of worktrees")},handler:na});import{z as Ae}from"zod";var sa=async()=>{try{let e=await w(),r=`${e}${te}`,t=await V("release"),o=await ee(),s=await dd({currentBranches:t,repoName:o}),[n,{opened:i}]=await Promise.all([Sn({projectRoot:e,worktreeDir:r,currentBranches:t}),md({worktreeDir:r,currentBranches:t,repoName:o})]),a={closedCmux:s,openedCmux:i,ideProviders:n.filter(c=>c.ran).map(c=>c.provider),ideFoldersAdded:n.reduce((c,p)=>c+p.added,0),ideFoldersRemoved:n.reduce((c,p)=>c+p.removed,0)};return ud(a,{ideRan:n.some(c=>c.ran)}),u.print(),{content:g(JSON.stringify(a,null,2)),structuredContent:{...a}}}catch(e){throw l.error({error:e},"\u274C Error reloading worktrees"),new f(e,{operation:"reload worktrees",remediation:"run `infra-kit worktrees list` to confirm the branches exist"})}},dd=async e=>{let{currentBranches:r,repoName:t}=e;if(r.length===0)return[];let o=await dt(),s=[];for(let n of r){let i=de({repoName:t,branch:n});o.has(pt(i))&&(await er(i),s.push(i))}return s},md=async e=>{let{worktreeDir:r,currentBranches:t,repoName:o}=e,s=[];for(let n of t){let i=de({repoName:o,branch:n});try{await mt({cwd:`${r}/${n}`,title:i}),s.push(i)}catch(a){l.warn({error:a,title:i},`\u26A0\uFE0F Failed to reopen cmux workspace for ${n}`)}}return{opened:s}},ud=(e,r)=>{if(e.closedCmux.length>0&&l.info(`\u{1F9F9} Closed ${e.closedCmux.length} cmux workspace(s)`),r.ideRan){let t=e.ideProviders.map(o=>$n(o)).join(", ");e.ideFoldersAdded>0&&l.info(`\u2705 Added ${e.ideFoldersAdded} folder(s) to ${t} workspace(s)`),e.ideFoldersRemoved>0&&l.info(`\u{1F9F9} Removed ${e.ideFoldersRemoved} dangling folder(s) from ${t} workspace(s)`)}if(e.openedCmux.length>0){l.info("\u2705 Reopened cmux workspaces:");for(let t of e.openedCmux)l.info(t)}!r.ideRan&&e.closedCmux.length===0&&e.openedCmux.length===0&&e.ideFoldersAdded===0&&e.ideFoldersRemoved===0&&l.info("\u2139\uFE0F Nothing to reload")},In=v({name:"worktrees-reload",description:"Close all open cmux workspaces for the current release worktrees, then reopen the full set \u2014 the single window-restore command. Every configured editor (Cursor and/or Zed) is reconciled + relaunched (no per-window close). Disruptive: closes live cmux windows first. Safe to run from any branch. Use to refresh stale windows or to restore everything after a cold start (editor + cmux closed).",inputSchema:{},outputSchema:{closedCmux:Ae.array(Ae.string()).describe("Titles of cmux workspaces a close was attempted for (best-effort)"),openedCmux:Ae.array(Ae.string()).describe("Titles of cmux workspaces reopened during this run"),ideProviders:Ae.array(Ae.string()).describe("Configured IDE providers that were reloaded (cursor | zed); empty if none configured"),ideFoldersAdded:Ae.number().describe("Total worktree folders added across all configured editor workspaces"),ideFoldersRemoved:Ae.number().describe("Total dangling worktree folders removed across all configured editor workspaces")},handler:sa});import{z as zt}from"zod";var fd=e=>{if(at()){if(e.all)throw new f(void 0,{operation:"remove worktrees",remediation:'name targets explicitly via "versions"; bulk all=true removal is disabled over MCP',stderrExcerpt:"all=true is not permitted for worktrees-remove over MCP"});if(!e.versions)throw new f(void 0,{operation:"remove worktrees",remediation:'pass "versions" (comma-separated release versions/names); the interactive picker needs a TTY',stderrExcerpt:'worktrees-remove over MCP requires "versions"'})}},gd=(e,r)=>{let t=e.filter(o=>!r.includes(o));if(t.length>0)throw new f(void 0,{operation:"remove worktrees",remediation:`no active worktree for: ${t.join(", ")}. Run 'infra-kit worktrees list' to see current worktrees`,stderrExcerpt:`unmatched worktree target(s): ${t.join(", ")}`})},ia=async e=>{let{confirmedCommand:r,all:t,versions:o}=e;await M({operation:"remove worktrees"}),fd({all:t,versions:o});try{let s=await V("release");if(s.length===0)return l.info("\u2139\uFE0F No active worktrees to remove"),u.print(),{content:g(JSON.stringify({removedWorktrees:[],count:0},null,2)),structuredContent:{removedWorktrees:[],count:0}};let n=await w(),i=`${n}${te}`,a=[];if(t)a=s;else if(o)a=o.split(",").map(h=>ye(pe(h.trim())));else{u.setInteractive();let[h,y]=await Promise.all([C(),x()]),b=new Map(y.map(R=>[R.branch,E(R.title)]));a=await ur(A({branches:s,descriptions:h,types:b}),{required:!0})}gd(a,s);let c=a.length===s.length;c?u.addOption("--all",!0):u.addOption("--versions",Je(a)),await D(r,"Are you sure you want to proceed with these worktree changes?"),r||u.addOption("--yes",!0);let p=await ee(),d=await Kr({branches:a,worktreeDir:i,repoName:p,pruneFolder:c});await Zr({projectRoot:n,worktreeDir:i,currentWorktrees:s,removedWorktrees:d,allowEditorRelaunch:!r}),hd(d),u.print();let m={removedWorktrees:d,count:d.length};return{content:g(JSON.stringify(m,null,2)),structuredContent:m}}catch(s){throw rr(s)||s instanceof f?s:(l.error({error:s},"\u274C Error managing worktrees"),new f(s,{operation:"remove worktrees",remediation:"check 'git worktree list' for the path; uncommitted changes block removal"}))}},hd=e=>{if(e.length>0){l.info("\u274C Removed worktrees:");for(let r of e)l.info(r);l.info("")}else l.info("\u2139\uFE0F No unused worktrees to remove")},Nn=v({name:"worktrees-remove",description:'Remove local git worktrees for the named release branches. Over MCP you MUST pass "versions" (comma-separated); bulk all=true removal is disabled here (it is a one-shot, unconfirmed wipe of every worktree) \u2014 the branch picker and confirmation are unavailable without a TTY. Every named version must be an active worktree, or the call errors without removing anything. What survives: the release branches/commits themselves are never deleted, and the worktrees directory plus its release/feature subfolders are left in place (recreate a worktree with worktrees-add). What is lost: git refuses to remove a worktree with modified tracked files or untracked files, BUT it DOES delete the worktree directory including gitignored contents \u2014 a hydrated .env of Doppler secrets (re-fetch with env-load) and build output such as node_modules/dist (needs reinstall/rebuild). When every worktree is removed it also runs "git worktree prune".',inputSchema:{versions:zt.string().describe('Comma-separated release versions or names to remove (e.g. "1.2.5, 1.2.6" or "checkout-redesign, 1.2.5"). Required: each must name an active worktree, or the call errors before removing anything.')},outputSchema:{removedWorktrees:zt.array(zt.string()).describe("List of removed git worktree branches"),count:zt.number().describe("Number of git worktrees removed")},handler:ia});import{z as On}from"zod";import{$ as vd}from"zx";var aa=async e=>{let{confirmedCommand:r}=e;await M({operation:"sync worktrees"});try{let t=await V("release"),o=await w(),s=`${o}${te}`,n=await Ct();await D(r,"Are you sure you want to proceed with these worktree changes?"),r||u.addOption("--yes",!0);let{branchesToRemove:i}=kd({releasePRsList:n,currentWorktrees:t}),a=await ee(),c=await yd({branches:i,worktreeDir:s,repoName:a});await Zr({projectRoot:o,worktreeDir:s,currentWorktrees:t,removedWorktrees:c,allowEditorRelaunch:!1}),wd(c),u.print();let p={removedWorktrees:c,count:c.length};return{content:g(JSON.stringify(p,null,2)),structuredContent:p}}catch(t){throw rr(t)?t:(l.error({error:t},"\u274C Error managing worktrees"),new f(t,{operation:"sync worktrees with remote",remediation:"ensure 'gh auth status' is ok and you can reach origin"}))}},kd=e=>{let{releasePRsList:r,currentWorktrees:t}=e;return{branchesToRemove:t.filter(n=>et(n)).filter(n=>!r.includes(n))}},yd=async e=>{let{branches:r,worktreeDir:t,repoName:o}=e,s=[];for(let n of r)try{let i=`${t}/${n}`,a=de({repoName:o,branch:n});await er(a),await vd`git worktree remove ${i}`,s.push(n)}catch(i){let a=new f(i,{operation:`remove stale worktree for ${n}`,remediation:"inspect the worktree dir manually; rerun with the branch checked out elsewhere"});l.error({error:i,branch:n,msg:a.message})}return s},wd=e=>{if(e.length>0){l.info("\u274C Removed worktrees:");for(let r of e)l.info(r);l.info("")}else l.info("\u2139\uFE0F No unused worktrees to remove")},Dn=v({name:"worktrees-sync",description:"Remove worktrees whose release PR is no longer open (stale cleanup). Only removes \u2014 never creates; use worktrees-add to create worktrees for new releases. The CLI confirmation is auto-skipped for MCP calls, so the caller is responsible for gating.",inputSchema:{},outputSchema:{removedWorktrees:On.array(On.string()).describe("List of removed worktree branches"),count:On.number().describe("Number of worktrees removed during sync")},handler:aa});var Rd=[{key:"develop",label:"Develop"},{key:"release",label:"Release Management"},{key:"worktrees",label:"Worktrees"},{key:"environment",label:"Environment"},{key:"configuration",label:"Configuration"},{key:"vendor",label:"Vendor"},{key:"setup",label:"Setup & Diagnostics"}],qt=[{cliName:"dev",menuGroup:"develop",mcpTool:null,mcpExposed:!1,groupPath:["dev"],longRunning:!0},{cliName:"merge-dev",menuGroup:"release",mcpTool:Wo,mcpExposed:!0,groupPath:["release","merge-dev"]},{cliName:"release-list",menuGroup:"release",mcpTool:Go,mcpExposed:!0,groupPath:["release","list"]},{cliName:"release-create",menuGroup:"release",mcpTool:sn,mcpExposed:!0,groupPath:["release","create"]},{cliName:"release-desc-edit",menuGroup:"release",mcpTool:an,mcpExposed:!0,groupPath:["release","desc-edit"]},{cliName:"release-deploy-all",menuGroup:"release",mcpTool:Bo,mcpExposed:!0,groupPath:["release","deploy-all"]},{cliName:"release-deploy-selected",menuGroup:"release",mcpTool:Uo,mcpExposed:!0,groupPath:["release","deploy-selected"]},{cliName:"release-deliver",menuGroup:"release",mcpTool:Vo,mcpExposed:!1,groupPath:["release","deliver"]},{cliName:"worktrees-add",menuGroup:"worktrees",mcpTool:_n,mcpExposed:!0,groupPath:["worktrees","add"]},{cliName:"worktrees-list",menuGroup:"worktrees",mcpTool:An,mcpExposed:!0,groupPath:["worktrees","list"]},{cliName:"worktrees-reload",menuGroup:"worktrees",mcpTool:In,mcpExposed:!0,groupPath:["worktrees","reload"]},{cliName:"worktrees-remove",menuGroup:"worktrees",mcpTool:Nn,mcpExposed:!0,groupPath:["worktrees","remove"]},{cliName:"worktrees-sync",menuGroup:"worktrees",mcpTool:Dn,mcpExposed:!0,groupPath:["worktrees","sync"]},{cliName:"env-status",menuGroup:"environment",mcpTool:Io,mcpExposed:!0,groupPath:["env-status"]},{cliName:"env-list",menuGroup:"environment",mcpTool:Ao,mcpExposed:!0,groupPath:["env-list"]},{cliName:"env-load",menuGroup:"environment",mcpTool:vo,mcpExposed:!0,groupPath:["env-load"],sessionEnvNotice:!0},{cliName:"env-clear",menuGroup:"environment",mcpTool:_o,mcpExposed:!0,groupPath:["env-clear"],sessionEnvNotice:!0},{cliName:"env-token-list",menuGroup:"environment",mcpTool:Oo,mcpExposed:!0,groupPath:["env-token-list"]},{cliName:"config-path",menuGroup:"configuration",mcpTool:null,mcpExposed:!1,groupPath:["config","path"]},{cliName:"config-edit",menuGroup:"configuration",mcpTool:null,mcpExposed:!1,groupPath:["config","edit"],entersAltScreen:!0},{cliName:"vendor-check",menuGroup:"vendor",mcpTool:gn,mcpExposed:!0,groupPath:["vendor","check"]},{cliName:"vendor-diff",menuGroup:"vendor",mcpTool:kn,mcpExposed:!0,groupPath:["vendor","diff"]},{cliName:"vendor-config",menuGroup:"vendor",mcpTool:null,mcpExposed:!1,groupPath:["vendor","config"]},{cliName:"init",menuGroup:"setup",mcpTool:null,mcpExposed:!1,groupPath:["init"]},{cliName:"doctor",menuGroup:"setup",mcpTool:So,mcpExposed:!1,groupPath:["doctor"]},{cliName:"audit",menuGroup:"setup",mcpTool:ao,mcpExposed:!0,groupPath:["audit"]},{cliName:"version",menuGroup:"setup",mcpTool:Rn,mcpExposed:!0,groupPath:["version"]},{cliName:"vendor",menuGroup:null,mcpTool:null,mcpExposed:!1,groupPath:["vendor"]},{cliName:"config",menuGroup:null,mcpTool:null,mcpExposed:!1,groupPath:["config"]},{cliName:"env-autoload",menuGroup:null,mcpTool:null,mcpExposed:!1,groupPath:["env-autoload"]},{cliName:"env-token-set",menuGroup:null,mcpTool:null,mcpExposed:!1,groupPath:["env-token-set"]},{cliName:"env-token-remove",menuGroup:null,mcpTool:null,mcpExposed:!1,groupPath:["env-token-remove"]},{cliName:"self-update",menuGroup:null,mcpTool:null,mcpExposed:!1,groupPath:["self-update"]},{cliName:"mcp",menuGroup:null,mcpTool:null,mcpExposed:!1,groupPath:["mcp"]},{cliName:"vendor-manifest",menuGroup:null,mcpTool:yn,mcpExposed:!1,groupPath:["vendor","manifest"]},{cliName:"vendor-sync",menuGroup:null,mcpTool:wn,mcpExposed:!1,groupPath:["vendor","sync"]}],bd=()=>qt.flatMap(e=>e.mcpExposed&&e.mcpTool?[e.mcpTool]:[]),Ed=e=>qt.filter(r=>r.menuGroup===e),xd=e=>qt.some(r=>r.longRunning===!0&&r.groupPath.join(" ")===e);import Fn from"node:process";var Pd="MODULE_TYPELESS_PACKAGE_JSON",Td=(e,r)=>typeof e=="object"&&e!==null?e.code:r,ca=!1,Cd=()=>{if(ca)return;ca=!0;let e=Fn.emitWarning.bind(Fn);Fn.emitWarning=((r,...t)=>{Td(t[0],t[1])!==Pd&&e(r,...t)})};export{g as a,ds as b,Er as c,xr as d,Pr as e,De as f,Xm as g,qa as h,Cs as i,Ss as j,ir as k,$s as l,_s as m,yt as n,wt as o,Ec as p,Eo as q,Ls as r,cr as s,eg as t,xo as u,Po as v,ei as w,ti as x,si as y,ii as z,No as A,pi as B,$t as C,Pl as D,fi as E,hi as F,Ri as G,Ei as H,xi as I,Pi as J,rp as K,Ai as L,Ni as M,Li as N,Gi as O,zi as P,Zi as Q,Yi as R,Gt as S,oa as T,na as U,sa as V,ia as W,aa as X,Rd as Y,qt as Z,bd as _,Ed as $,xd as aa,Cd as ba};
231
- //# sourceMappingURL=chunk-LM7IE2UD.js.map
231
+ //# sourceMappingURL=chunk-K46DOODL.js.map
@@ -1,2 +1,2 @@
1
- var i={name:"infra-kit",type:"module",version:"0.3.4",files:["dist"],description:"infra-kit",bin:{"infra-kit":"dist/cli.js",ik:"dist/cli.js"},engines:{node:">=24.x"},scripts:{inspector:"npx @modelcontextprotocol/inspector node ./dist/mcp.js --debug",build:"pnpm run clean-artifacts && node ./scripts/build.js",prepack:"pnpm run build",prepublishOnly:"pnpm run build","infra-kit-check":"pnpm exec infra-kit audit","clean-artifacts":"rm -rf dist","clean-cache":"rm -rf node_modules/.cache .eslintcache tsconfig.tsbuildinfo .turbo .swc","prettier-fix":"pnpm exec prettier **/* --write --no-error-on-unmatched-pattern --log-level silent --ignore-path ../../../.prettierignore","prettier-check":"pnpm exec prettier **/* --check --no-error-on-unmatched-pattern --log-level silent --ignore-path ../../../.prettierignore","eslint-check":"pnpm exec eslint --cache --quiet --report-unused-disable-directives ./src","eslint-fix":"pnpm exec eslint --cache --quiet --report-unused-disable-directives ./src --fix","ts-check":"tsc --noEmit",test:"pnpm exec vitest run --reporter=minimal","test-watch":"pnpm exec vitest --watch --silent passed-only","test-ui":"pnpm exec vitest --ui --silent passed-only","test-report":"pnpm exec vitest run --coverage --silent passed-only",qa:"pnpm run prettier-check && pnpm run eslint-check && pnpm run ts-check && pnpm run test && echo \u2705 Success",fix:"pnpm run prettier-fix && pnpm run eslint-fix && pnpm run qa"},dependencies:{"@aws-lambda-powertools/logger":"^2.33.1","@inquirer/checkbox":"^5.2.1","@inquirer/confirm":"^6.1.1","@inquirer/password":"^5.0.2","@inquirer/select":"^5.2.1","@modelcontextprotocol/sdk":"^1.29.0","@slip-stream-kit/config":"^0.3.3",chalk:"^5.6.2",chokidar:"^5.0.0",commander:"^15.0.0",fastify:"5.10.0",ink:"^7.1.0",pino:"^10.3.1","pino-pretty":"^13.1.3",portless:"^0.15.2",react:"19.2.7",yaml:"^2.9.0",zod:"^4.4.3",zx:"^8.8.5"},devDependencies:{"@types/aws-lambda":"^8.10.162","@types/react":"19.2.17","@wl/eslint-config":"workspace:*","@wl/vitest-config":"workspace:*",esbuild:"^0.28.1","ink-testing-library":"^4.0.0",typescript:"^6.0.3"}};export{i as a};
2
- //# sourceMappingURL=chunk-Y72C523R.js.map
1
+ var i={name:"infra-kit",type:"module",version:"0.3.5",files:["dist"],description:"infra-kit",bin:{"infra-kit":"dist/cli.js",ik:"dist/cli.js"},engines:{node:">=24.x"},scripts:{inspector:"npx @modelcontextprotocol/inspector node ./dist/mcp.js --debug",build:"pnpm run clean-artifacts && node ./scripts/build.js",prepack:"pnpm run build",prepublishOnly:"pnpm run build","infra-kit-check":"pnpm exec infra-kit audit","clean-artifacts":"rm -rf dist","clean-cache":"rm -rf node_modules/.cache .eslintcache tsconfig.tsbuildinfo .turbo .swc","prettier-fix":"pnpm exec prettier **/* --write --no-error-on-unmatched-pattern --log-level silent --ignore-path ../../../.prettierignore","prettier-check":"pnpm exec prettier **/* --check --no-error-on-unmatched-pattern --log-level silent --ignore-path ../../../.prettierignore","eslint-check":"pnpm exec eslint --cache --quiet --report-unused-disable-directives ./src","eslint-fix":"pnpm exec eslint --cache --quiet --report-unused-disable-directives ./src --fix","ts-check":"tsc --noEmit",test:"pnpm exec vitest run --reporter=minimal","test-watch":"pnpm exec vitest --watch --silent passed-only","test-ui":"pnpm exec vitest --ui --silent passed-only","test-report":"pnpm exec vitest run --coverage --silent passed-only",qa:"pnpm run prettier-check && pnpm run eslint-check && pnpm run ts-check && pnpm run test && echo \u2705 Success",fix:"pnpm run prettier-fix && pnpm run eslint-fix && pnpm run qa"},dependencies:{"@aws-lambda-powertools/logger":"^2.33.1","@inquirer/checkbox":"^5.2.1","@inquirer/confirm":"^6.1.1","@inquirer/password":"^5.0.2","@inquirer/select":"^5.2.1","@modelcontextprotocol/sdk":"^1.29.0","@slip-stream-kit/config":"^0.3.3",chalk:"^5.6.2",chokidar:"^5.0.0",commander:"^15.0.0",fastify:"5.10.0",ink:"^7.1.0",pino:"^10.3.1","pino-pretty":"^13.1.3",portless:"^0.15.2",react:"19.2.7",yaml:"^2.9.0",zod:"^4.4.3",zx:"^8.8.5"},devDependencies:{"@types/aws-lambda":"^8.10.162","@types/react":"19.2.17","@wl/eslint-config":"workspace:*","@wl/vitest-config":"workspace:*",esbuild:"^0.28.1","ink-testing-library":"^4.0.0",typescript:"^6.0.3"}};export{i as a};
2
+ //# sourceMappingURL=chunk-OS5Z2WME.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../package.json"],
4
- "sourcesContent": ["{\n \"name\": \"infra-kit\",\n \"type\": \"module\",\n \"version\": \"0.3.4\",\n \"files\": [\n \"dist\"\n ],\n \"description\": \"infra-kit\",\n \"bin\": {\n \"infra-kit\": \"dist/cli.js\",\n \"ik\": \"dist/cli.js\"\n },\n \"engines\": {\n \"node\": \">=24.x\"\n },\n \"scripts\": {\n \"inspector\": \"npx @modelcontextprotocol/inspector node ./dist/mcp.js --debug\",\n \"build\": \"pnpm run clean-artifacts && node ./scripts/build.js\",\n \"prepack\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm run build\",\n \"infra-kit-check\": \"pnpm exec infra-kit audit\",\n \"clean-artifacts\": \"rm -rf dist\",\n \"clean-cache\": \"rm -rf node_modules/.cache .eslintcache tsconfig.tsbuildinfo .turbo .swc\",\n \"prettier-fix\": \"pnpm exec prettier **/* --write --no-error-on-unmatched-pattern --log-level silent --ignore-path ../../../.prettierignore\",\n \"prettier-check\": \"pnpm exec prettier **/* --check --no-error-on-unmatched-pattern --log-level silent --ignore-path ../../../.prettierignore\",\n \"eslint-check\": \"pnpm exec eslint --cache --quiet --report-unused-disable-directives ./src\",\n \"eslint-fix\": \"pnpm exec eslint --cache --quiet --report-unused-disable-directives ./src --fix\",\n \"ts-check\": \"tsc --noEmit\",\n \"test\": \"pnpm exec vitest run --reporter=minimal\",\n \"test-watch\": \"pnpm exec vitest --watch --silent passed-only\",\n \"test-ui\": \"pnpm exec vitest --ui --silent passed-only\",\n \"test-report\": \"pnpm exec vitest run --coverage --silent passed-only\",\n \"qa\": \"pnpm run prettier-check && pnpm run eslint-check && pnpm run ts-check && pnpm run test && echo \u2705 Success\",\n \"fix\": \"pnpm run prettier-fix && pnpm run eslint-fix && pnpm run qa\"\n },\n \"dependencies\": {\n \"@aws-lambda-powertools/logger\": \"^2.33.1\",\n \"@inquirer/checkbox\": \"^5.2.1\",\n \"@inquirer/confirm\": \"^6.1.1\",\n \"@inquirer/password\": \"^5.0.2\",\n \"@inquirer/select\": \"^5.2.1\",\n \"@modelcontextprotocol/sdk\": \"^1.29.0\",\n \"@slip-stream-kit/config\": \"^0.3.3\",\n \"chalk\": \"^5.6.2\",\n \"chokidar\": \"^5.0.0\",\n \"commander\": \"^15.0.0\",\n \"fastify\": \"5.10.0\",\n \"ink\": \"^7.1.0\",\n \"pino\": \"^10.3.1\",\n \"pino-pretty\": \"^13.1.3\",\n \"portless\": \"^0.15.2\",\n \"react\": \"19.2.7\",\n \"yaml\": \"^2.9.0\",\n \"zod\": \"^4.4.3\",\n \"zx\": \"^8.8.5\"\n },\n \"devDependencies\": {\n \"@types/aws-lambda\": \"^8.10.162\",\n \"@types/react\": \"19.2.17\",\n \"@wl/eslint-config\": \"workspace:*\",\n \"@wl/vitest-config\": \"workspace:*\",\n \"esbuild\": \"^0.28.1\",\n \"ink-testing-library\": \"^4.0.0\",\n \"typescript\": \"^6.0.3\"\n }\n}\n"],
4
+ "sourcesContent": ["{\n \"name\": \"infra-kit\",\n \"type\": \"module\",\n \"version\": \"0.3.5\",\n \"files\": [\n \"dist\"\n ],\n \"description\": \"infra-kit\",\n \"bin\": {\n \"infra-kit\": \"dist/cli.js\",\n \"ik\": \"dist/cli.js\"\n },\n \"engines\": {\n \"node\": \">=24.x\"\n },\n \"scripts\": {\n \"inspector\": \"npx @modelcontextprotocol/inspector node ./dist/mcp.js --debug\",\n \"build\": \"pnpm run clean-artifacts && node ./scripts/build.js\",\n \"prepack\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm run build\",\n \"infra-kit-check\": \"pnpm exec infra-kit audit\",\n \"clean-artifacts\": \"rm -rf dist\",\n \"clean-cache\": \"rm -rf node_modules/.cache .eslintcache tsconfig.tsbuildinfo .turbo .swc\",\n \"prettier-fix\": \"pnpm exec prettier **/* --write --no-error-on-unmatched-pattern --log-level silent --ignore-path ../../../.prettierignore\",\n \"prettier-check\": \"pnpm exec prettier **/* --check --no-error-on-unmatched-pattern --log-level silent --ignore-path ../../../.prettierignore\",\n \"eslint-check\": \"pnpm exec eslint --cache --quiet --report-unused-disable-directives ./src\",\n \"eslint-fix\": \"pnpm exec eslint --cache --quiet --report-unused-disable-directives ./src --fix\",\n \"ts-check\": \"tsc --noEmit\",\n \"test\": \"pnpm exec vitest run --reporter=minimal\",\n \"test-watch\": \"pnpm exec vitest --watch --silent passed-only\",\n \"test-ui\": \"pnpm exec vitest --ui --silent passed-only\",\n \"test-report\": \"pnpm exec vitest run --coverage --silent passed-only\",\n \"qa\": \"pnpm run prettier-check && pnpm run eslint-check && pnpm run ts-check && pnpm run test && echo \u2705 Success\",\n \"fix\": \"pnpm run prettier-fix && pnpm run eslint-fix && pnpm run qa\"\n },\n \"dependencies\": {\n \"@aws-lambda-powertools/logger\": \"^2.33.1\",\n \"@inquirer/checkbox\": \"^5.2.1\",\n \"@inquirer/confirm\": \"^6.1.1\",\n \"@inquirer/password\": \"^5.0.2\",\n \"@inquirer/select\": \"^5.2.1\",\n \"@modelcontextprotocol/sdk\": \"^1.29.0\",\n \"@slip-stream-kit/config\": \"^0.3.3\",\n \"chalk\": \"^5.6.2\",\n \"chokidar\": \"^5.0.0\",\n \"commander\": \"^15.0.0\",\n \"fastify\": \"5.10.0\",\n \"ink\": \"^7.1.0\",\n \"pino\": \"^10.3.1\",\n \"pino-pretty\": \"^13.1.3\",\n \"portless\": \"^0.15.2\",\n \"react\": \"19.2.7\",\n \"yaml\": \"^2.9.0\",\n \"zod\": \"^4.4.3\",\n \"zx\": \"^8.8.5\"\n },\n \"devDependencies\": {\n \"@types/aws-lambda\": \"^8.10.162\",\n \"@types/react\": \"19.2.17\",\n \"@wl/eslint-config\": \"workspace:*\",\n \"@wl/vitest-config\": \"workspace:*\",\n \"esbuild\": \"^0.28.1\",\n \"ink-testing-library\": \"^4.0.0\",\n \"typescript\": \"^6.0.3\"\n }\n}\n"],
5
5
  "mappings": "AAAA,IAAAA,EAAA,CACE,KAAQ,YACR,KAAQ,SACR,QAAW,QACX,MAAS,CACP,MACF,EACA,YAAe,YACf,IAAO,CACL,YAAa,cACb,GAAM,aACR,EACA,QAAW,CACT,KAAQ,QACV,EACA,QAAW,CACT,UAAa,iEACb,MAAS,sDACT,QAAW,iBACX,eAAkB,iBAClB,kBAAmB,4BACnB,kBAAmB,cACnB,cAAe,2EACf,eAAgB,4HAChB,iBAAkB,4HAClB,eAAgB,4EAChB,aAAc,kFACd,WAAY,eACZ,KAAQ,0CACR,aAAc,gDACd,UAAW,6CACX,cAAe,uDACf,GAAM,gHACN,IAAO,6DACT,EACA,aAAgB,CACd,gCAAiC,UACjC,qBAAsB,SACtB,oBAAqB,SACrB,qBAAsB,SACtB,mBAAoB,SACpB,4BAA6B,UAC7B,0BAA2B,SAC3B,MAAS,SACT,SAAY,SACZ,UAAa,UACb,QAAW,SACX,IAAO,SACP,KAAQ,UACR,cAAe,UACf,SAAY,UACZ,MAAS,SACT,KAAQ,SACR,IAAO,SACP,GAAM,QACR,EACA,gBAAmB,CACjB,oBAAqB,YACrB,eAAgB,UAChB,oBAAqB,cACrB,oBAAqB,cACrB,QAAW,UACX,sBAAuB,SACvB,WAAc,QAChB,CACF",
6
6
  "names": ["package_default"]
7
7
  }
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{$ as $t,A as te,B as ft,C as U,D as d,E as gt,F as ht,G as vt,H as yt,I as wt,J as St,K as kt,L as Rt,M as Et,N as xt,O as Tt,P as At,Q as Ct,R as bt,S as oe,T as Pt,U as It,V as Nt,W as Lt,X as _t,Y as Dt,Z as Ot,a as D,aa as Ft,b as De,ba as Ut,c as $e,d as Fe,e as Me,f as O,g as He,h as j,i as Ye,j as ze,k as Xe,l as Qe,m as Ze,n as tt,o as ot,p as rt,q as Z,r as nt,s as it,t as ee,u as ct,v as lt,w as mt,x as dt,y as ut,z as pt}from"./chunk-LM7IE2UD.js";import{r as re}from"./chunk-S45AAYXO.js";import{a as Mt,b as G,c as jt,d as C,e as ne,f as ie,g as se}from"./chunk-UO3FYLPX.js";import{a as et}from"./chunk-Y72C523R.js";import{a as st,b as at}from"./chunk-A7FAXZGI.js";import{b as Oe,c as T,d as h,e as F,f as We,g as Ke,h as Be,i as A,l as M}from"./chunk-GZNE5CBQ.js";import{O as X,P as Le,R as _e,m as Ne,u as l}from"./chunk-IVWPZEMC.js";import{a as $,b as je,d as Ue,f as Ge,g as qe,j as Q,k as Ve,n as v,q as Je}from"./chunk-CHETBZ6M.js";import en,{Separator as Eo}from"@inquirer/select";import{realpathSync as tn}from"node:fs";import g from"node:process";import{fileURLToPath as To}from"node:url";var Co=(e,t)=>{let o=e,r;for(let s of t){if(r=o.find(n=>n.name()===s),!r)return;o=r.commands}return r},Gt=e=>Dt.flatMap(({key:t,label:o})=>$t(t).flatMap(r=>{let s=Co(e,r.groupPath);return s?[{name:r.groupPath.join(" "),description:s.description(),group:o}]:[]}));import{Command as lr}from"commander";import _ from"node:process";import qt from"node:process";import{$ as bo}from"zx";var ae=async()=>{let e=await X(),t=await Promise.all([{label:"project (committed)",path:e.main},{label:"user global",path:e.userGlobal},{label:"user project",path:e.userProject}].map(async i=>({...i,exists:await T(i.path)}))),o=t.at(-1)?.exists===!0,r=await ct(e.userProject,o),s=o?lt(r):"";l.info(`Project name: ${e.projectName}
2
+ import{$ as $t,A as te,B as ft,C as U,D as d,E as gt,F as ht,G as vt,H as yt,I as wt,J as St,K as kt,L as Rt,M as Et,N as xt,O as Tt,P as At,Q as Ct,R as bt,S as oe,T as Pt,U as It,V as Nt,W as Lt,X as _t,Y as Dt,Z as Ot,a as D,aa as Ft,b as De,ba as Ut,c as $e,d as Fe,e as Me,f as O,g as He,h as j,i as Ye,j as ze,k as Xe,l as Qe,m as Ze,n as tt,o as ot,p as rt,q as Z,r as nt,s as it,t as ee,u as ct,v as lt,w as mt,x as dt,y as ut,z as pt}from"./chunk-K46DOODL.js";import{r as re}from"./chunk-S45AAYXO.js";import{a as Mt,b as G,c as jt,d as C,e as ne,f as ie,g as se}from"./chunk-UO3FYLPX.js";import{a as et}from"./chunk-OS5Z2WME.js";import{a as st,b as at}from"./chunk-A7FAXZGI.js";import{b as Oe,c as T,d as h,e as F,f as We,g as Ke,h as Be,i as A,l as M}from"./chunk-GZNE5CBQ.js";import{O as X,P as Le,R as _e,m as Ne,u as l}from"./chunk-IVWPZEMC.js";import{a as $,b as je,d as Ue,f as Ge,g as qe,j as Q,k as Ve,n as v,q as Je}from"./chunk-CHETBZ6M.js";import en,{Separator as Eo}from"@inquirer/select";import{realpathSync as tn}from"node:fs";import g from"node:process";import{fileURLToPath as To}from"node:url";var Co=(e,t)=>{let o=e,r;for(let s of t){if(r=o.find(n=>n.name()===s),!r)return;o=r.commands}return r},Gt=e=>Dt.flatMap(({key:t,label:o})=>$t(t).flatMap(r=>{let s=Co(e,r.groupPath);return s?[{name:r.groupPath.join(" "),description:s.description(),group:o}]:[]}));import{Command as lr}from"commander";import _ from"node:process";import qt from"node:process";import{$ as bo}from"zx";var ae=async()=>{let e=await X(),t=await Promise.all([{label:"project (committed)",path:e.main},{label:"user global",path:e.userGlobal},{label:"user project",path:e.userProject}].map(async i=>({...i,exists:await T(i.path)}))),o=t.at(-1)?.exists===!0,r=await ct(e.userProject,o),s=o?lt(r):"";l.info(`Project name: ${e.projectName}
3
3
  `),l.info(`Config merge chain (later overrides earlier):
4
4
  `);for(let i of t){let c=i.exists?" [\u2713]":" [ ]",a=i.path===e.userProject&&s!==""?` ${s}`:"";l.info(`${c} ${i.label.padEnd(22)} ${h(i.path)}${a}`)}let n={projectName:e.projectName,layers:t.map(i=>({label:i.label,path:i.path,exists:i.exists})),hasOverrides:r.hasOverrides,overrideKeys:r.overrideKeys};return{content:[{type:"text",text:JSON.stringify(n,null,2)}],structuredContent:n}},ce=async()=>{let e=await X(),t=qt.env.EDITOR||qt.env.VISUAL||"vi",o=await tt(e);o.createdConfig&&l.info(ot(o)),l.info(`Opening ${h(e.userProject)} in ${t}`),await bo({stdio:"inherit"})`${t} ${e.userProject}`,_e();let r={path:e.userProject,editor:t};return{content:[{type:"text",text:JSON.stringify(r,null,2)}],structuredContent:r}};var le=e=>{if(typeof e!="object"||e===null)return null;let{config:t,reason:o,at:r}=e;return typeof t!="string"||t.length===0||typeof o!="string"||typeof r!="number"||!Number.isFinite(r)?null:{config:t,reason:o,at:r}},I=e=>`infra-kit: Doppler token for env "${e}" is missing, invalid, or unreadable \u2014 env auto-load is not running. Fix: run \`infra-kit env-token-set ${e}\` (mint one at https://dashboard.doppler.com under this config's Access tab).`;import p from"node:fs";import y from"node:path";import N from"node:process";var Po="autoload-warn-fail.flag",me="autoload-warn-auth-fail.flag",de="autoload-fail.flag",ue="autoload-auth-fail.json",Io=3e4,Jt=async(e=!0)=>{let t;try{t=await Le()}catch{return null}let o=t.envAutoLoad;if(!o)return null;let r={trigger:o.trigger,config:o.config,project:t.envManagement.config.name};try{if(await He(o.config))return r}catch{return r}return Kt({config:o.config,reason:`No Doppler service token for env "${o.config}"`,at:Date.now()}),e&&q(I(o.config),me),null},Wt=e=>{let{trigger:t,expectedTrigger:o,targetConfig:r,targetProject:s,env:n,force:i}=e;return t!==o||!n.session||n.cleared||n.currentConfig&&!n.autoLoadedMarker||!i&&n.autoLoadedMarker&&n.currentConfig===r&&n.currentProject===s?"skip":"load"},L=async({expectedTrigger:e,projectDir:t,force:o,isAuthFailure:r=Oe})=>{let s=e==="cli-invocation";s&&V();let n=null;try{if(n=await Jt(s),!n||Wt({trigger:n.trigger,expectedTrigger:e,targetConfig:n.config,targetProject:n.project,env:_o(),force:o})==="skip"||Vt()||$o())return null;let c=Do(),a=await Ye({config:n.config,autoLoaded:!0,projectDir:t,beforeWrite:()=>!Vt()&&!Oo(c)});return a?(Mo(),Lo(),a.filePath):null}catch(i){let c=i.message,a=r(i);return Fo(),a&&n&&Kt({config:n.config,reason:c,at:Date.now()}),s&&a&&n?(q(I(n.config),me),l.debug(`env auto-load auth failure: ${c}`)):s?q(`infra-kit: env auto-load failed \u2014 ${c} (will retry later)`,Po):l.debug(`env auto-load skipped: ${c}`),null}},V=()=>{let e=No();e&&(q(I(e.config),me),l.debug(`env auto-load auth failure (recorded ${new Date(e.at).toISOString()}): ${e.reason}`))},No=()=>{try{let e=p.readFileSync(y.join(v(),ue),"utf-8");return le(JSON.parse(e))}catch{return null}},Kt=e=>{try{let t=v();p.mkdirSync(t,{recursive:!0,mode:448}),Je(y.join(t,ue),JSON.stringify(e),384)}catch{}},Lo=()=>{try{p.rmSync(y.join(v(),ue),{force:!0})}catch{}},_o=()=>({session:N.env[Ue],cleared:N.env[Ve],currentConfig:N.env[Ge],currentProject:N.env[qe],autoLoadedMarker:N.env[Q]}),Do=()=>{try{return p.statSync(y.join(v(),$)).mtimeMs}catch{return null}},Oo=e=>{try{let t=y.join(v(),$);if(!p.existsSync(t))return!1;let o=p.statSync(t).mtimeMs;return e!==null&&o<=e?!1:new RegExp(`^unset ${Q}$`,"m").test(p.readFileSync(t,"utf-8"))}catch{return!1}},Vt=()=>{try{let e=v(),t=y.join(e,je);if(!p.existsSync(t))return!1;let o=y.join(e,$);return p.existsSync(o)?p.statSync(t).mtimeMs>=p.statSync(o).mtimeMs:!0}catch{return!1}},$o=()=>{try{let e=y.join(v(),de);return p.existsSync(e)?Date.now()-p.statSync(e).mtimeMs<Io:!1}catch{return!1}},Fo=()=>{try{let e=v();p.mkdirSync(e,{recursive:!0,mode:448}),p.writeFileSync(y.join(e,de),"",{mode:384})}catch{}},Mo=()=>{try{p.rmSync(y.join(v(),de),{force:!0})}catch{}},q=(e,t)=>{try{let o=v(),r=y.join(o,t);if(p.existsSync(r))return;p.mkdirSync(o,{recursive:!0,mode:448}),p.writeFileSync(r,"",{mode:384})}catch{}l.warn(e)};var pe=async({projectDir:e}={})=>{await L({expectedTrigger:"shell-startup",projectDir:e,force:!0})};var Bt="https://dashboard.doppler.com/workplace/projects",jo=(e,t)=>["Removing it locally does NOT revoke it \u2014 the token still works anywhere else it is stored.",`Revoke it in Doppler (project "${e}", config "${t}"): ${Bt}/${e}`],fe=async({env:e})=>{let o=!!(await We())?.envs[e];await Be(e);let r=await j(),s=await O(),n=await F();o?l.info(`Removed the "${e}" service token from ${h(n)}.`):l.info(`No "${e}" service token was stored in ${h(n)} \u2014 nothing to remove.`),r.length>0&&l.info(`Purged ${r.length} warm cache(s) across this repo's worktrees.`);for(let c of jo(s,e))l.warn(c);let i={env:e,removed:o,storePath:n,warmCachesPurged:r.length,revokeUrl:`${Bt}/${s}`};return{content:D(JSON.stringify(i,null,2)),structuredContent:i}};import Uo from"@inquirer/password";import W from"node:process";import{$ as J}from"zx";var Go=async({stdin:e,fromEnv:t})=>{if(e)return{token:await qo(),source:"stdin"};if(t){let r=W.env[t];if(!r)throw new Error(`${t} is not set (or is empty) \u2014 nothing to store.`);return{token:r,source:"env"}}return A.setInteractive(),{token:(await M(r=>Uo({message:"Paste the Doppler service token (input is hidden)",mask:!0},r),{output:W.stderr})).trim(),source:"prompt"}},qo=async()=>{let e=[];W.stdin.setEncoding("utf8");for await(let t of W.stdin)e.push(t);return e.join("").trim()},ge="DOPPLER_CONFIG",Vo=3e4,Jo=async(e,t,o)=>{let r=J.quiet;J.quiet=!0;let s;try{s=(await J({env:Xe(e)})`doppler secrets download --no-file --format json --project ${t} --config ${o}`.timeout(Vo)).stdout}catch(n){throw Wo(n,o)}finally{J.quiet=r}return Ze(s)},Wo=(e,t)=>{let o=Me(e)??(e instanceof Error?e.message:String(e));if($e(o)!=="auth")return e instanceof Error?e:new Error(String(e));let r=Fe(o)==="mis-scoped"?"it is scoped to a DIFFERENT config (pasting another environment's token here is the mistake this check exists to catch).":"it is invalid or has been revoked.";return new Error([`Doppler refused this token for config "${t}" \u2014 ${r}`,"Nothing was written. Issue a service token scoped to that config and try again."].join(`
5
5
  `))},Ko=e=>[`Could not verify this token's scope: the Doppler payload for "${e}" carries no ${ge}.`,"Refusing to store a credential whose scope is unknown (a token for the wrong environment would load","the wrong secrets into every shell).","Re-run with --force if you are certain the token is scoped to this config."].join(`
package/dist/mcp.js CHANGED
@@ -1,2 +1,2 @@
1
- import{_ as u,ba as f,p as d}from"./chunk-LM7IE2UD.js";import"./chunk-S45AAYXO.js";import"./chunk-Y72C523R.js";import"./chunk-A7FAXZGI.js";import{i as m,j as l}from"./chunk-GZNE5CBQ.js";import{s as c,t as p,u as s}from"./chunk-IVWPZEMC.js";import"./chunk-CHETBZ6M.js";import{StdioServerTransport as w}from"@modelcontextprotocol/sdk/server/stdio.js";import T from"node:process";import o from"node:process";var v=r=>{o.on("SIGINT",()=>{r.info({msg:"Received SIGINT. Shutting down..."}),o.exit(0)}),o.on("SIGTERM",()=>{r.info({msg:"Received SIGTERM. Shutting down..."}),o.exit(0)}),o.on("uncaughtException",e=>{r.fatal({err:e,msg:"Uncaught Exception"}),r.error(`Uncaught Exception! Check ${c}. Shutting down...`),r.flush(),o.exit(1)}),o.on("unhandledRejection",(e,n)=>{r.fatal({reason:e,promise:n,msg:"Unhandled Rejection"}),r.error(`Unhandled Rejection! Check ${c}. Shutting down...`),r.flush(),o.exit(1)})};import{McpServer as y}from"@modelcontextprotocol/sdk/server/mcp.js";var h=async r=>{};var x=async r=>{};var a=({toolName:r,handler:e})=>async n=>{s.info({msg:`Tool execution started: ${r}`,params:n});try{await d(),m.reset();let i=await e({...n,confirmedCommand:!0});return s.info({msg:`Tool execution successful: ${r}`}),i}catch(i){throw s.error({err:i,params:n,msg:`Tool execution failed: ${r}`}),i}};var S=async r=>{for(let e of u())r.registerTool(e.name,{description:e.description,inputSchema:e.inputSchema,outputSchema:e.outputSchema},a({toolName:e.name,handler:e.handler}))};async function g(){l.enabled=!0;let r=new y({name:"infra-kit",version:"1.0.0"},{capabilities:{resources:{},tools:{},prompts:{}}});return await h(r),await x(r),await S(r),r}f();var t=p(),M=async()=>{let r;try{r=await g(),t.info("MCP Server instance created")}catch(e){t.error({err:e,msg:"Failed to create MCP server"}),t.error("Fatal error during server creation."),T.exit(1)}try{let e=new w;await r.connect(e),t.info({msg:"Server connected to transport. Ready."})}catch(e){t.error({err:e,msg:"Failed to initialize server"}),t.error("Fatal error during server transport init."),T.exit(1)}};v(t);M();
1
+ import{_ as u,ba as f,p as d}from"./chunk-K46DOODL.js";import"./chunk-S45AAYXO.js";import"./chunk-OS5Z2WME.js";import"./chunk-A7FAXZGI.js";import{i as m,j as l}from"./chunk-GZNE5CBQ.js";import{s as c,t as p,u as s}from"./chunk-IVWPZEMC.js";import"./chunk-CHETBZ6M.js";import{StdioServerTransport as w}from"@modelcontextprotocol/sdk/server/stdio.js";import T from"node:process";import o from"node:process";var v=r=>{o.on("SIGINT",()=>{r.info({msg:"Received SIGINT. Shutting down..."}),o.exit(0)}),o.on("SIGTERM",()=>{r.info({msg:"Received SIGTERM. Shutting down..."}),o.exit(0)}),o.on("uncaughtException",e=>{r.fatal({err:e,msg:"Uncaught Exception"}),r.error(`Uncaught Exception! Check ${c}. Shutting down...`),r.flush(),o.exit(1)}),o.on("unhandledRejection",(e,n)=>{r.fatal({reason:e,promise:n,msg:"Unhandled Rejection"}),r.error(`Unhandled Rejection! Check ${c}. Shutting down...`),r.flush(),o.exit(1)})};import{McpServer as y}from"@modelcontextprotocol/sdk/server/mcp.js";var h=async r=>{};var x=async r=>{};var a=({toolName:r,handler:e})=>async n=>{s.info({msg:`Tool execution started: ${r}`,params:n});try{await d(),m.reset();let i=await e({...n,confirmedCommand:!0});return s.info({msg:`Tool execution successful: ${r}`}),i}catch(i){throw s.error({err:i,params:n,msg:`Tool execution failed: ${r}`}),i}};var S=async r=>{for(let e of u())r.registerTool(e.name,{description:e.description,inputSchema:e.inputSchema,outputSchema:e.outputSchema},a({toolName:e.name,handler:e.handler}))};async function g(){l.enabled=!0;let r=new y({name:"infra-kit",version:"1.0.0"},{capabilities:{resources:{},tools:{},prompts:{}}});return await h(r),await x(r),await S(r),r}f();var t=p(),M=async()=>{let r;try{r=await g(),t.info("MCP Server instance created")}catch(e){t.error({err:e,msg:"Failed to create MCP server"}),t.error("Fatal error during server creation."),T.exit(1)}try{let e=new w;await r.connect(e),t.info({msg:"Server connected to transport. Ready."})}catch(e){t.error({err:e,msg:"Failed to initialize server"}),t.error("Fatal error during server transport init."),T.exit(1)}};v(t);M();
2
2
  //# sourceMappingURL=mcp.js.map
@@ -1,2 +1,2 @@
1
- import{h as i}from"./chunk-UO3FYLPX.js";import{a as t}from"./chunk-Y72C523R.js";import"./chunk-A7FAXZGI.js";import"./chunk-CHETBZ6M.js";import a from"node:fs";import o from"node:process";import{fileURLToPath as s}from"node:url";var m=r=>{let n=r.indexOf("--parent-pid");if(n===-1)return;let e=Number(r[n+1]);return Number.isInteger(e)&&e>0?e:void 0},p=()=>a.realpathSync(s(new URL("./cli.js",import.meta.url))),d=async()=>{await i(t.version,{selfRealPath:p(),parentPid:m(o.argv)})};d().catch(()=>{o.exitCode=0});
1
+ import{h as i}from"./chunk-UO3FYLPX.js";import{a as t}from"./chunk-OS5Z2WME.js";import"./chunk-A7FAXZGI.js";import"./chunk-CHETBZ6M.js";import a from"node:fs";import o from"node:process";import{fileURLToPath as s}from"node:url";var m=r=>{let n=r.indexOf("--parent-pid");if(n===-1)return;let e=Number(r[n+1]);return Number.isInteger(e)&&e>0?e:void 0},p=()=>a.realpathSync(s(new URL("./cli.js",import.meta.url))),d=async()=>{await i(t.version,{selfRealPath:p(),parentPid:m(o.argv)})};d().catch(()=>{o.exitCode=0});
2
2
  //# sourceMappingURL=update-check.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "infra-kit",
3
3
  "type": "module",
4
- "version": "0.3.4",
4
+ "version": "0.3.5",
5
5
  "files": [
6
6
  "dist"
7
7
  ],