infra-kit 0.1.131 → 0.1.133
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/dist/boot-YCABHUPP.js +2 -0
- package/dist/boot-YCABHUPP.js.map +7 -0
- package/dist/chunk-3OMHS5RE.js +2 -0
- package/dist/chunk-3OMHS5RE.js.map +7 -0
- package/dist/chunk-6EPRH34O.js +2 -0
- package/dist/chunk-6EPRH34O.js.map +7 -0
- package/dist/{chunk-SR2GFEY7.js → chunk-6FDGBQGX.js} +2 -2
- package/dist/{chunk-SR2GFEY7.js.map → chunk-6FDGBQGX.js.map} +1 -1
- package/dist/chunk-FAR2L74S.js +2 -0
- package/dist/chunk-FAR2L74S.js.map +7 -0
- package/dist/{chunk-C2HRONYA.js → chunk-JD5T4VCB.js} +3 -3
- package/dist/chunk-JD5T4VCB.js.map +7 -0
- package/dist/chunk-RSF5XAQJ.js +4 -0
- package/dist/chunk-RSF5XAQJ.js.map +7 -0
- package/dist/{chunk-52WL2IQX.js → chunk-RXEMP3VI.js} +2 -2
- package/dist/{chunk-X2L4F2VM.js → chunk-V37MZDFR.js} +3 -3
- package/dist/{chunk-X2L4F2VM.js.map → chunk-V37MZDFR.js.map} +3 -3
- package/dist/chunk-WSO6DN6Q.js +220 -0
- package/dist/chunk-WSO6DN6Q.js.map +7 -0
- package/dist/cli.js +9 -3
- package/dist/cli.js.map +4 -4
- package/dist/dev-server.js +20 -15
- package/dist/dev-server.js.map +4 -4
- package/dist/{dev-wizard-run-7HEKSAS2.js → dev-wizard-run-TNA5YI7P.js} +2 -2
- package/dist/lib/vite/vite.d.ts +29 -10
- package/dist/mcp.js +1 -1
- package/dist/mcp.js.map +1 -1
- package/dist/persistent-ink-dev-ui-FUJQDFNY.js +8 -0
- package/dist/persistent-ink-dev-ui-FUJQDFNY.js.map +7 -0
- package/dist/update-check.js +1 -1
- package/dist/update-check.js.map +1 -1
- package/dist/vite.js +1 -1
- package/package.json +1 -1
- package/dist/boot-5GFZBDKL.js +0 -2
- package/dist/boot-5GFZBDKL.js.map +0 -7
- package/dist/chunk-4UUVKJYG.js +0 -2
- package/dist/chunk-4UUVKJYG.js.map +0 -7
- package/dist/chunk-6YAKVQZN.js +0 -4
- package/dist/chunk-6YAKVQZN.js.map +0 -7
- package/dist/chunk-C2HRONYA.js.map +0 -7
- package/dist/chunk-F6VCGS3D.js +0 -2
- package/dist/chunk-F6VCGS3D.js.map +0 -7
- package/dist/chunk-LENH44GY.js +0 -215
- package/dist/chunk-LENH44GY.js.map +0 -7
- package/dist/chunk-O3YJM6IR.js +0 -2
- package/dist/chunk-O3YJM6IR.js.map +0 -7
- package/dist/chunk-TKZINCST.js +0 -2
- package/dist/chunk-TKZINCST.js.map +0 -7
- package/dist/chunk-VJPLVBRA.js +0 -5
- package/dist/chunk-VJPLVBRA.js.map +0 -7
- package/dist/persistent-ink-dev-ui-4U4B2B7C.js +0 -8
- package/dist/persistent-ink-dev-ui-4U4B2B7C.js.map +0 -7
- package/dist/program.js +0 -2
- package/dist/program.js.map +0 -7
- /package/dist/{chunk-52WL2IQX.js.map → chunk-RXEMP3VI.js.map} +0 -0
- /package/dist/{dev-wizard-run-7HEKSAS2.js.map → dev-wizard-run-TNA5YI7P.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`)
|
|
4
|
-
`)}}
|
|
2
|
+
import{A as Ye,B as We,C as He,D as ze,E as Xe,F as Qe,G as Ze,H as et,I as H,J as tt,K as ot,L as rt,M as nt,N as it,O as D,P as at,R as M,S as st,a as we,b as x,c as S,d as Ee,e as xe,f as Ce,g as B,h as ke,i as Pe,j as J,k as Te,l as Ae,m as De,n as Me,o as Oe,p as je,q as Ue,r as Fe,s as _,t as m,u as Ge,v as Ve,w as qe,x as Ke,y as Be,z as Je}from"./chunk-WSO6DN6Q.js";import{a as $e}from"./chunk-RXEMP3VI.js";import{q as z}from"./chunk-RSF5XAQJ.js";import{P as K,Q as ye,S as Se,m as he,v as l}from"./chunk-V37MZDFR.js";import{e as W}from"./chunk-Z6KTUVIC.js";import{a as ct,b as O,c as lt,d as P,e as X,f as Q,g as Z}from"./chunk-3OMHS5RE.js";import{a as Re}from"./chunk-6FDGBQGX.js";import{a as L}from"./chunk-6FU2TRU5.js";import{a as N,b as be,d as Ie,f as Le,g as Ne,j as Y,k as _e,n as w}from"./chunk-CHETBZ6M.js";import"./chunk-6EPRH34O.js";import"./chunk-LTKR3F4N.js";import er,{Separator as ro}from"@inquirer/select";import{realpathSync as tr}from"node:fs";import u from"node:process";import{fileURLToPath as io}from"node:url";var mt=e=>{let t=new Map(e.map(o=>[o.name(),o]));return D.flatMap(({key:o,label:r})=>M(o).flatMap(a=>{let i=t.get(a);return i?[{name:a,description:i.description(),group:r}]:[]}))};import{Command as _o}from"commander";import I from"node:process";import dt from"node:process";import{$ as so}from"zx";var ee=async()=>{let e=await K(),t=await Promise.all([{label:"project (committed)",path:e.main},{label:"user global",path:e.userGlobal},{label:"user project",path:e.userProject}].map(async n=>({...n,exists:await x(n.path)}))),o=t.at(-1)?.exists===!0,r=await Te(e.userProject,o),a=o?Ae(r):"";l.info(`Project name: ${e.projectName}
|
|
3
|
+
`),l.info(`Config merge chain (later overrides earlier):
|
|
4
|
+
`);for(let n of t){let s=n.exists?" [\u2713]":" [ ]",c=n.path===e.userProject&&a!==""?` ${a}`:"";l.info(`${s} ${n.label.padEnd(22)} ${S(n.path)}${c}`)}let i={projectName:e.projectName,layers:t.map(n=>({label:n.label,path:n.path,exists:n.exists})),hasOverrides:r.hasOverrides,overrideKeys:r.overrideKeys};return{content:[{type:"text",text:JSON.stringify(i,null,2)}],structuredContent:i}},te=async()=>{let e=await K(),t=dt.env.EDITOR||dt.env.VISUAL||"vi",o=await Ee(e);o.createdConfig&&l.info(xe(o)),l.info(`Opening ${S(e.userProject)} in ${t}`),await so({stdio:"inherit"})`${t} ${e.userProject}`,Se();let r={path:e.userProject,editor:t};return{content:[{type:"text",text:JSON.stringify(r,null,2)}],structuredContent:r}};import p from"node:fs";import R from"node:path";import A from"node:process";var co="autoload-warn-misconfig.flag",lo="autoload-warn-fail.flag",oe="autoload-fail.flag",mo=3e4,ut=async(e=!0)=>{let t;try{t=await ye()}catch{return null}let o=t.envAutoLoad;return o?t.environments.includes(o.config)?{trigger:o.trigger,config:o.config,project:t.envManagement.config.name}:(e&>(`infra-kit: envAutoLoad.config "${o.config}" is not one of environments [${t.environments.join(", ")}] \u2014 env auto-load disabled.`,co),null):null},ft=e=>{let{trigger:t,expectedTrigger:o,targetConfig:r,targetProject:a,env:i,force:n}=e;return t!==o||!i.session||i.cleared||i.currentConfig&&!i.autoLoadedMarker||!n&&i.autoLoadedMarker&&i.currentConfig===r&&i.currentProject===a?"skip":"load"},b=async({expectedTrigger:e,projectDir:t,force:o})=>{let r=e==="cli-invocation";try{let a=await ut(r);if(!a||ft({trigger:a.trigger,expectedTrigger:e,targetConfig:a.config,targetProject:a.project,env:po(),force:o})==="skip"||pt()||go())return null;let n=uo(),s=await je({config:a.config,autoLoaded:!0,projectDir:t,beforeWrite:()=>!pt()&&!fo(n)});return s?(ho(),s.filePath):null}catch(a){let i=a.message;return vo(),r?gt(`infra-kit: env auto-load failed \u2014 ${i} (will retry later)`,lo):l.debug(`env auto-load skipped: ${i}`),null}},po=()=>({session:A.env[Ie],cleared:A.env[_e],currentConfig:A.env[Le],currentProject:A.env[Ne],autoLoadedMarker:A.env[Y]}),uo=()=>{try{return p.statSync(R.join(w(),N)).mtimeMs}catch{return null}},fo=e=>{try{let t=R.join(w(),N);if(!p.existsSync(t))return!1;let o=p.statSync(t).mtimeMs;return e!==null&&o<=e?!1:new RegExp(`^unset ${Y}$`,"m").test(p.readFileSync(t,"utf-8"))}catch{return!1}},pt=()=>{try{let e=w(),t=R.join(e,be);if(!p.existsSync(t))return!1;let o=R.join(e,N);return p.existsSync(o)?p.statSync(t).mtimeMs>=p.statSync(o).mtimeMs:!0}catch{return!1}},go=()=>{try{let e=R.join(w(),oe);return p.existsSync(e)?Date.now()-p.statSync(e).mtimeMs<mo:!1}catch{return!1}},vo=()=>{try{let e=w();p.mkdirSync(e,{recursive:!0,mode:448}),p.writeFileSync(R.join(e,oe),"",{mode:384})}catch{}},ho=()=>{try{p.rmSync(R.join(w(),oe),{force:!0})}catch{}},gt=(e,t)=>{try{let o=w(),r=R.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 re=async({projectDir:e}={})=>{await b({expectedTrigger:"shell-startup",projectDir:e,force:!0})};import{spawn as yo}from"node:child_process";import $ from"node:process";import{fileURLToPath as So}from"node:url";var wo=["SIGINT","SIGTERM"],vt=()=>So(new URL("./mcp.js",import.meta.url)),ne=(e={})=>{let t=e.spawn??yo,o=e.exit??(n=>$.exit(n)),r=e.env??$.env,a=e.onError??(n=>l.error(n)),i=t($.execPath,[vt()],{stdio:"inherit",env:L(r)});i.on("error",n=>{a(`failed to launch the MCP server: ${n.message}`),o(1)}),wo.forEach(n=>{$.on(n,()=>{i.kill(n)})}),i.on("exit",(n,s)=>{o(s?1:n??1)})};import{spawnSync as Ro}from"node:child_process";import{realpathSync as Eo}from"node:fs";import ie from"node:process";import{fileURLToPath as xo}from"node:url";var Co=()=>Eo(xo(import.meta.url)),ko=(e,t,o,r)=>e.error?(o(`${t} not found on PATH: ${e.error.message}`),r(1)):e.signal?(o(`update terminated by signal ${e.signal}`),r(1)):r(e.status??1),ae=({dryRun:e},t={})=>{let o=t.spawnSync??Ro,r=t.print??(k=>l.info(k)),a=t.exit??(k=>ie.exit(k)),i=t.env??ie.env,n=t.selfRealPath??Co(),s=t.lazyNpmRoot??lt,{manager:c,updateCommand:d,canSelfSpawn:f}=ct({selfRealPath:n,env:i,realpath:P,lazyNpmRoot:s}),v=d.join(" ");if(e){r(`Detected install manager: ${c}`),r(`Would run: ${v}`);return}if(!f){r(`Detected install manager: ${c}`),r(`Run this yourself: ${v}`),r(c==="homebrew"?"Not run for you: Homebrew manages this install; running a package manager would create a split-brain install.":"Not run for you: the install location is unrecognized, so the command above is a guess \u2014 a guessed global install is worse than a printed one.");return}let C=o(d[0],d.slice(1),{stdio:"inherit",shell:ie.platform==="win32",env:L(i)});ko(C,c,r,a)};import se from"node:fs/promises";import ce from"node:path";import ht from"node:process";import{pathToFileURL as Po}from"node:url";var yt="~/projects",le=async(e={})=>{if(e.init){await Ao(e.cwd);return}await To()},To=async()=>{let e=B(),t=await x(e);if(l.info(`Factory config: ${S(e)} ${t?"[\u2713]":"[ ]"}`),!t){l.info("\nNot found \u2014 run `infra-kit vendor-config --init` to scaffold it."),ht.exitCode=1;return}let{workspaceDir:o,targets:r}=await Pe(),a=ke(o),i=await x(a);l.info(`workspaceDir: ${o} (resolved: ${a}) ${i?"[\u2713 exists]":"[ ] not found"}`),l.info("Targets:");let n=i;for(let s of r){let c=ce.join(a,s),d=await x(c);d||(n=!1);let f=d?"[\u2713]":"[ ]",v=d?"":" (not found \u2014 clone or remove)";l.info(` ${f} ${s} ${S(c)}${v}`)}n||(ht.exitCode=1)},Ao=async e=>{let t=B();if(await x(t)){l.info(`Factory config already exists at ${S(t)} \u2014 leaving it untouched.`);return}let o=e??await he(),r=await bo(o);await se.mkdir(ce.dirname(t),{recursive:!0}),await se.writeFile(t,Io(r),"utf-8"),l.info(`\u2713 Created ${S(t)}`),r.length>0&&l.info(` Seeded ${r.length} target(s) from the source ${W}.`),l.info(` Edit \`workspaceDir\` (placeholder: ${yt}) to point at where your repos live.`),r.length===0&&l.info(" Add at least one repo name to `targets` before running vendor sync/manifest/diff.")},bo=async e=>{try{let t=ce.join(e,W),o=await se.stat(t),i=(await import(`${Po(t).href}?mtime=${Number(o.mtimeMs)}`)).default,n=typeof i=="function"?await i():i;if(n&&typeof n=="object"&&"targets"in n){let s=n.targets;if(Array.isArray(s)&&s.every(c=>typeof c=="string"))return s}}catch{}return[]},Io=e=>`${JSON.stringify({workspaceDir:yt,targets:e},null,2)}
|
|
5
|
+
`;var j=(e,t=!0)=>({line:e,reproducible:t});import U from"node:fs";import Lo from"node:os";import No from"node:path";import Et from"node:process";var F="INFRA_KIT_SESSION_REPORT",me=null,St=!1,wt=[],xt=(e=Et.env)=>{St||(me=e[F]??null,St=!0,delete e[F])};var Ct=(e,t)=>{if(!me)return;let o=e.summary??(wt.length>0?[...wt]:void 0),r={...e,...o?{summary:o}:{}},a=t?.write??((i,n)=>{U.writeFileSync(i,n)});try{a(me,JSON.stringify(r))}catch{}},Rt=0,kt=e=>{let t=e?.tmpdir?.()??Lo.tmpdir(),o=e?.pid??Et.pid;return Rt+=1,No.join(t,`infra-kit-session-${o}-${Rt}.json`)},Pt=(e,t)=>{if(!(t?.exists??(n=>U.existsSync(n)))(e))return null;let r=t?.read??(n=>U.readFileSync(n,"utf-8")),a=t?.unlink??(n=>U.unlinkSync(n)),i;try{i=r(e)}catch{return null}finally{try{a(e)}catch{}}try{return JSON.parse(i)}catch{return null}};var Do=(e,t)=>[...t,e],de=e=>typeof e=="string"?e.split(",").filter(Boolean):void 0,Tt=(e,t)=>{if(!(typeof e>"u")){if(e===!0)return"workspace";if(e===!1)return"none";if(typeof e=="string"&&H.includes(e))return e;throw new Error(`Invalid ${t} value "${String(e)}". Expected one of: ${H.join(", ")}.`)}},G={value:!1},g=(e,t)=>e.hook("preAction",()=>{G.value||l.warn(`"${e.name()}" is a deprecated alias; use "${t}" instead.`)}),At=e=>e.description("Merge dev branch into every release branch").option("-a, --all","Select all active release branches").option("-y, --yes","Skip confirmation prompt").action(async t=>{m(await Ve({all:t.all,confirmedCommand:t.yes}))}),bt=e=>e.description("List all release branches").action(async()=>{m(await Je())}),It=e=>e.description("Create one or more release branches (each entry can mix regular/hotfix and its own description)").option("-r, --release <spec>",'Release spec "<version|next|name>[:type[:description]]" (repeatable). The token is a semver ("1.2.5"), the literal "next", or a kebab-case name ("checkout-redesign"). Type is regular|hotfix (default regular). Examples: "1.2.5", "1.2.5:hotfix", "next:regular:Holiday backend", "checkout-redesign:regular:Q3 redesign".',Do,[]).option("-y, --yes","Skip confirmation prompt").action(async t=>{let r=t.release.map(Ye),a=r.length>0?r:void 0;m(await We({releases:a,confirmedCommand:t.yes}))}),Lt=e=>e.description("Edit a release's description in Jira and in the matching GitHub PR body").option("-v, --version <version>","Release version (e.g. 1.2.5) or release name (e.g. checkout-redesign)").option("-d, --description <description>",'New description (use "" to clear)').option("-y, --yes","Skip confirmation prompt").action(async t=>{m(await He({version:t.version,description:t.description,confirmedCommand:t.yes}))}),Nt=e=>e.description("Deploy any release branch to any environment").option("-v, --version <version>",'Version (e.g. 1.2.5) or release name (e.g. checkout-redesign) to deploy; "dev" deploys from the dev branch').option("-e, --env <env>","Specify the environment to deploy to, e.g. dev").option("--skip-terraform","Skip terraform deployment step").option("-y, --yes","Skip confirmation prompt").action(async t=>{m(await Ke({version:t.version,env:t.env,skipTerraform:t.skipTerraform,confirmedCommand:t.yes}))}),_t=e=>e.description("Deploy selected services from release branch to any environment").option("-v, --version <version>",'Version (e.g. 1.2.5) or release name (e.g. checkout-redesign) to deploy; "dev" deploys from the dev branch').option("-e, --env <env>","Specify the environment to deploy to, e.g. dev").option("-s, --services <services...>","Specify services to deploy, e.g. client-be client-fe").option("--skip-terraform","Skip terraform deployment step").option("-y, --yes","Skip confirmation prompt").action(async t=>{m(await Be({version:t.version,env:t.env,services:t.services,skipTerraform:t.skipTerraform,confirmedCommand:t.yes}))}),Dt=e=>e.description("Release a new version to production").option("-v, --version <version>","Version (e.g. 1.2.5) or release name (e.g. checkout-redesign) to deliver").option("-y, --yes","Skip confirmation prompt").action(async t=>{m(await qe({version:t.version,confirmedCommand:t.yes}))}),Mt=e=>e.description("Remove release worktrees whose PRs are no longer open").option("-y, --yes","Skip confirmation prompt").action(async t=>{m(await it({confirmedCommand:t.yes}))}),Ot=e=>e.description("Add git worktrees for release branches").option("-y, --yes","Skip confirmation prompt").option("-a, --all","Select all active release branches").option("-v, --versions <versions>","Specify versions by comma, e.g. 1.2.5, 1.2.6").option("-i, --ide [mode]","Editor mode for created worktrees: workspace (default) | none").option("--no-ide","Skip the editor (alias for --ide none)").option("-c, --cursor [mode]","Deprecated alias for --ide").option("--no-cursor","Deprecated alias for --no-ide").option("-g, --github-desktop","Open created worktrees in GitHub Desktop").option("--no-github-desktop","Skip GitHub Desktop prompt").option("-m, --cmux","Open created worktrees in cmux (3-pane layout)").option("--no-cmux","Skip cmux prompt").action(async t=>{let o=Tt(t.ide,"--ide")??Tt(t.cursor,"--cursor");m(await tt({confirmedCommand:t.yes,all:t.all,versions:t.versions,ide:o,githubDesktop:t.githubDesktop,cmux:t.cmux}))}),$t=e=>e.description("List all git worktrees with detailed information").action(async()=>{m(await ot())}),jt=e=>e.description("Remove git worktrees for release branches").option("-y, --yes","Skip confirmation prompt").option("-a, --all","Select all active release branches").option("-v, --versions <versions>","Specify versions by comma, e.g. 1.2.5, 1.2.6").action(async t=>{m(await nt({confirmedCommand:t.yes,all:t.all,versions:t.versions}))}),Ut=e=>e.description("Close all cmux/editor worktree windows, then reopen the current release worktrees (also cold-start restore)").action(async()=>{m(await rt())}),Ft=e=>e.description("Show the machine-local factory config (~/.infra-kit/vendor.json) or scaffold it with --init").option("--init","Scaffold ~/.infra-kit/vendor.json (skips if it already exists)").action(async t=>{m(await le({init:t.init}))}),Gt=e=>e.description("Verify vendor/ matches vendor/.sync-manifest.json (self-contained; for any consumer repo)").action(async()=>{let t=await ze();m(t),t.structuredContent.ok||(I.exitCode=1)}),Vt=e=>e.description("Source-aware drift check (rsync dry-run) of each target vendored subtree vs the source").option("-r, --repos <repos>","Restrict to comma-separated target repo names").action(async t=>{let o=await Xe({repos:de(t.repos)});m(o),o.structuredContent.ok||(I.exitCode=1)}),qt=e=>e.description("Show the resolved config merge chain and file paths").action(async()=>{m(await ee())}),Kt=e=>e.description("Open the user-scope per-project override file in $EDITOR").action(async()=>{m(await te())}),Mo=new Set(["init","doctor","version","dev","self-update","mcp"]),Oo=e=>e.startsWith("env-")||Mo.has(e),$o=new Set(["env-autoload","mcp","version","self-update"]),pe=e=>{let t=[];for(let o=e;o&&o.parent;o=o.parent)t.unshift(o.name());return t.join(" ")},ue=()=>{let e=new _o,t=e.command("release").description("Release management commands");At(t.command("merge-dev")),bt(t.command("list")),It(t.command("create")),Lt(t.command("desc-edit")),Nt(t.command("deploy-all")),_t(t.command("deploy-selected")),Dt(t.command("deliver"));let o=e.command("worktrees").description("Git worktree management commands");Ot(o.command("add")),$t(o.command("list")),jt(o.command("remove")),Mt(o.command("sync")),Ut(o.command("reload")),g(At(e.command("merge-dev")),"release merge-dev"),g(bt(e.command("release-list")),"release list"),g(It(e.command("release-create")),"release create"),g(Lt(e.command("release-desc-edit")),"release desc-edit"),g(Nt(e.command("release-deploy-all")),"release deploy-all"),g(_t(e.command("release-deploy-selected")),"release deploy-selected"),g(Dt(e.command("release-deliver")),"release deliver"),g(Ot(e.command("worktrees-add")),"worktrees add"),g($t(e.command("worktrees-list")),"worktrees list"),g(jt(e.command("worktrees-remove")),"worktrees remove"),g(Mt(e.command("worktrees-sync")),"worktrees sync"),g(Ut(e.command("worktrees-reload")),"worktrees reload");let r=e.command("config").description("Manage infra-kit configuration files");qt(r.command("path")),Kt(r.command("edit")),qt(e.command("config-path",{hidden:!0})),Kt(e.command("config-edit",{hidden:!0})),e.command("audit").description("Audit against infra-kit.config.ts rules (--all for every package, --root for the monorepo root)").option("-a, --all","Audit every non-vendor workspace package").option("-r, --root","Audit the monorepo root (turbo pipeline + root commands)").action(async i=>{let n=await we({all:i.all,root:i.root});m(n),n.structuredContent.allPassed||(I.exitCode=1)});let a=e.command("vendor").description("Verify and sync the mirrored vendor/ tree");return Gt(a.command("check")),a.command("sync").description("Copy vendored files from the source repo into each target and regenerate manifests").option("-y, --yes","Skip confirmation prompt").option("-r, --repos <repos>","Restrict to comma-separated target repo names").action(async i=>{m(await Ze({confirmedCommand:i.yes,repos:de(i.repos)}))}),a.command("manifest").description("Regenerate each target vendor/.sync-manifest.json + README from current content (no copy)").option("-r, --repos <repos>","Restrict to comma-separated target repo names").action(async i=>{m(await Qe({confirmedCommand:!0,repos:de(i.repos)}))}),Vt(a.command("diff")),Ft(a.command("config")),g(Ft(e.command("vendor-config")),"vendor config"),Gt(e.command("vendor-check",{hidden:!0})),Vt(e.command("vendor-diff",{hidden:!0})),e.command("doctor").description("Check installation and authentication status of gh and doppler CLIs").action(async()=>{m(await De())}),e.command("self-update").description("Update this CLI using the package manager that installed it").option("--dry-run","Print the detected manager and the command that would run; install nothing").action(i=>{ae({dryRun:!!i.dryRun})}),e.command("mcp").description("Run the infra-kit MCP server (stdio transport)").action(()=>{ne()}),e.command("dev").description("Run local dev servers for a named devServersPresets preset (or all apps); api + ui").argument("[preset]","Named preset from devServersPresets (omit to run every app)").option("-w, --watch","Rebuild and restart on file save").option("--app <names>","Further narrow to these app folder names (comma-separated)").option("--target <keys>","Run exactly these <app>/api|<app>/ui packages (comma-separated); part-level, unlike --app").option("--cmux","Run each app in its own cmux pane (one workspace, N panes; falls back to single terminal if cmux is unavailable)").option("--self","Run only the app of the current directory (infer from cwd; use inside apps/<app>/\u2026)").option("-V, --verbose","Print full boot narration (default: quiet; full detail always in the session log)").option("--routes","Print each app\u2019s registered METHOD /path routes at startup (default: off)").action(async(i,n)=>{let{runDevServerCli:s}=await import("./dev-server.js"),c=!!(I.stdout.isTTY&&I.stdin.isTTY);await s({...n,preset:i},c,_.enabled)}),e.command("version").description("Print the installed infra-kit CLI version").action(async()=>{m(await et())}),e.command("env-status").description("Show which env is loaded in this session (local introspection; no Doppler call)").action(async()=>{m(await Fe())}),e.command("env-list").description("List available Doppler configs for the detected project").action(async()=>{m(await Oe())}),e.command("init").description("Inject shell integration into .zshrc and sync repo agent-instruction files").action(async()=>{m(await J())}),e.command("env-load").description("Load Doppler env vars for a config. Source the returned file path to apply.").option("-c, --config <config>","Environment config name to load (e.g. dev, arthur)").action(async i=>{m(await Ue({config:i.config}))}),e.command("env-clear").description("Clear loaded env vars. Source the returned file path to apply.").option("--purge","Also delete this project's warm cache outright (durable disable)").action(async i=>{m(await Me({purge:!!i.purge}))}),e.command("env-autoload",{hidden:!0}).description("Internal: prime env for the shell-startup auto-load trigger").option("--project-dir <dir>","Canonical project dir for the warm-cache key (shell-startup only)").action(async i=>{await re({projectDir:i.projectDir})}),e.commands.forEach(Ge),e.hook("preAction",async(i,n)=>{_.enabled=!!n.optsWithGlobals().json,_.enabled&&(l.level="warn"),$o.has(pe(n))||await Ce(),Oo(n.name())||await b({expectedTrigger:"cli-invocation"})}),e.hook("postAction",(i,n)=>{let s=pe(n);if(st(s))return;let d=$e.snapshot()?.formattedOptions??"",f=d?` ${d}`:"",v=`infra-kit ${s}${f}`;Ct({equivalent:j(v,!0)})}),e};var fe=(e,t=" ")=>{let o=e.reduce((r,[a])=>Math.max(r,a.length),0);return e.map(([r,a])=>`${r.padEnd(o)}${t}${a}`)};import{spawn as Go}from"node:child_process";import y from"node:process";var h={ok:"ok",findingsPlain:"completed with findings",failed:"failed",cancelled:"cancelled",findingsSuffix:"findings",sep:" \xB7 ",reproPrefix:"$ ",nonReproPrefix:"\u2248 ",envNotice:"Applies to your shell after you exit this session."},Bt={ok:{unicode:"\u2713",ascii:"[ok]"},findings:{unicode:"\u26A0",ascii:"[!]"},failed:{unicode:"\u2717",ascii:"[x]"},cancelled:{unicode:"\u2298",ascii:"[-]"}},Jt=e=>`${h.reproPrefix}${e}`,jo=e=>e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`,Uo=(e,t)=>e==="findings"?t!=null?`${t} ${h.findingsSuffix}`:h.findingsPlain:{ok:h.ok,failed:h.failed,cancelled:h.cancelled}[e],Yt=e=>{let t=e.equivalent.reproducible?h.reproPrefix:h.nonReproPrefix,o=e.ascii===!0?Bt[e.outcome].ascii:Bt[e.outcome].unicode,a=[Uo(e.outcome,e.findingsCount),jo(e.durationMs)],i=e.summary?.[0];i!=null&&i.length>0&&a.push(i);let n=[`${o} ${a.join(h.sep)}`];return e.showEquivalent!==!1&&n.unshift(`${t}${e.equivalent.line}`),e.envNotice===!0&&n.push(h.envNotice),n.join(`
|
|
6
|
+
`)};var Fo=new Set([130,143]),Wt=(e,t,o,r=!1)=>o?t!=null||e===0?"ok":"findings":r&&e!=null&&Fo.has(e)||t==="SIGINT"||e===0?"cancelled":"failed";import Ht from"node:process";var E={column:"\r",sgr:"\x1B[0m",cursor:"\x1B[?25h",wrap:"\x1B[?7h",saveCursor:"\x1B7",restoreCursor:"\x1B8",scrollRegion:"\x1B[r",primaryBuffer:"\x1B[?1049l"},zt=(e,t)=>{let o=t?.write??(i=>{Ht.stderr.write(i)}),r=t?.stdin??Ht.stdin,a=[E.saveCursor,E.scrollRegion,E.restoreCursor,E.column,E.sgr,E.cursor,E.wrap];e.entersAltScreen===!0&&a.push(E.primaryBuffer),o(a.join("")),r.isTTY===!0&&r.isRaw===!0&&r.setRawMode?.(!1)};var Xt=e=>`infra-kit ${e.groupPath.join(" ")}`,Vo=e=>new Promise(t=>{e.on("exit",(o,r)=>{t({code:o,signal:r})}),e.on("error",()=>{t({code:1,signal:null})})}),qo=async(e,t,o)=>{let r=kt(),a={...t.env,[F]:r,INFRA_KIT_NO_AUTO_UPDATE:"1"},i=t.now(),n={code:1,signal:null};o(!0);try{let v=t.spawn(y.execPath,[t.cliPath,...e.groupPath],{stdio:"inherit",env:a});n=await Vo(v)}catch{n={code:1,signal:null}}finally{o(!1),t.resetTerminal({entersAltScreen:e.entersAltScreen})}let s=Pt(r),c=Wt(n.code,n.signal,s!=null,e.longRunning),d=Xt(e),f=s?.equivalent??j(d,!0);return Yt({equivalent:f,outcome:c,durationMs:t.now()-i,summary:s?.summary,envNotice:e.sessionEnvNotice,ascii:t.ascii,showEquivalent:!(f.reproducible&&f.line===d)})},Ko=(e,t)=>{let o=!1,r=!1,a=()=>{if(e()){o=!0;return}t.exit(0)},i=()=>{if(!e()){t.exit(0);return}o||(r=!0)},n=()=>{t.exit(129)},s=()=>{e()&&t.raise("SIGSTOP")};return t.register("SIGINT",a),t.register("SIGTERM",i),t.register("SIGHUP",n),t.register("SIGTSTP",s),{dispose:()=>{t.unregister("SIGINT",a),t.unregister("SIGTERM",i),t.unregister("SIGHUP",n),t.unregister("SIGTSTP",s)},childStarted:()=>{o=!1},quitRequested:()=>r}},Qt=(e,t)=>!!(t.stdoutIsTTY&&t.stdinIsTTY&&t.stderrIsTTY&&e.TERM!=="dumb"&&!e.INFRA_KIT_NO_SESSION&&!e.INFRA_KIT_SESSION_REPORT),Zt=async(e,t)=>{let o={spawn:t.spawn??Go,now:t.now??(()=>Date.now()),env:t.env??y.env,cliPath:t.cliPath,ascii:t.ascii??!(y.stdout.isTTY&&y.env.TERM!=="dumb"),resetTerminal:t.resetTerminal??(c=>{zt(c)})},r=t.write??(c=>y.stderr.write(c)),a=t.signals??{register:(c,d)=>{y.on(c,d)},unregister:(c,d)=>{y.off(c,d)},exit:c=>{y.exit(c)},raise:c=>{y.kill(y.pid,c)}},i=!1,n={dispose:()=>{},childStarted:()=>{},quitRequested:()=>!1},s=t.installSignals===!1?n:Ko(()=>i,a);try{for(;;){let c=await t.renderPalette(e);if(c==null)return;let d=t.resolveCommand(c);if(!d)continue;let f=Jt(Xt(d));r(`
|
|
7
|
+
${f}
|
|
8
|
+
`),s.childStarted();let v=await qo(d,o,C=>{i=C});if(r(`
|
|
9
|
+
${v}
|
|
10
|
+
`),s.quitRequested())return}}finally{s.dispose()}};import{spawn as Yo}from"node:child_process";import to from"node:fs";import T from"node:process";import{fileURLToPath as oo}from"node:url";var eo=["INFRA_KIT_NO_AUTO_UPDATE","NO_UPDATE_NOTIFIER","CI"],Bo=new Set(["mcp","self-update"]),Jo=e=>e[2]!=null&&Bo.has(e[2]),ge=e=>{let{argv:t,env:o,isTty:r,selfRealPath:a,cwd:i,realpath:n}=e;return eo.some(c=>{let d=o[c];return d!=null&&d!==""})?"opt-out":t.includes("--json")?"json":Jo(t)?"own-command":r?O(a,i,n)?"local-install":null:"not-a-tty"};var Wo=e=>{Yo(T.execPath,[e,"--parent-pid",String(T.pid)],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()},Ho=()=>oo(new URL("./update-check.js",import.meta.url)),zo=()=>to.realpathSync(oo(new URL("./cli.js",import.meta.url))),Xo=/^[\w@./+-]+$/i,Qo=e=>Xo.test(e),Zo=(e,t,o)=>{!e?.latestVersion||!e.updateCommand||X(e.latestVersion,t)&&e.updateCommand.every(Qo)&&o(`infra-kit ${e.latestVersion} is available (you have ${t}). Run: ${e.updateCommand.join(" ")}`)},ve=(e,t={})=>{try{let o=t.argv??T.argv,r=t.env??T.env,a=t.isTty??!!T.stdout.isTTY,i=t.cwd??T.cwd(),n=t.nowMs??Date.now(),s=t.selfRealPath??zo(),c=t.readCache??Q,d=t.spawnChild??Wo,f=t.fileExists??(q=>to.existsSync(q)),v=t.notify??(q=>{l.info(q)});if(ge({argv:o,env:r,isTty:a,selfRealPath:s,cwd:i,realpath:P})!==null)return;let C=c();if(Zo(C,e,v),!Z(C,n))return;let k=t.childPath??Ho();if(!f(k))return;d(k)}catch{}};xt();var V=ue(),no=async e=>{try{e?await V.parseAsync(e):await V.parseAsync()}catch(t){z(t)&&(l.info("Operation cancelled."),u.exit(0));let o=t instanceof Error?t.message:String(t);l.error(o),u.exit(1)}},or=()=>{try{if(u.env.INFRA_KIT_NO_LOCATION_WARN||u.argv.includes("--json")||u.argv[2]==="mcp")return;O(tr(io(import.meta.url)),u.cwd(),P)&&l.info("Running from a project-local node_modules. Install globally for faster startup: npm i -g infra-kit")}catch{}};or();ve(Re.version);var rr=()=>new Map(V.commands.map(e=>[e.name(),e])),ao=()=>mt(V.commands),nr=async()=>{let e=rr(),t=ao(),o=null;try{if(u.stdout.isTTY&&u.stdin.isTTY){let{runCommandPalette:r}=await import("./boot-YCABHUPP.js");o=await r(t)}else{let r=fe(t.map(n=>[n.name,n.description])),a=new Map;t.forEach((n,s)=>{a.set(n.name,r[s]??n.name)});let i=n=>n.filter(s=>e.has(s)).map(s=>({name:a.get(s)??s,value:s}));o=await er({message:"Select a command to run",choices:D.flatMap(({key:n,label:s})=>{let c=i(M(n));return c.length===0?[]:[new ro(" "),new ro(`\u2014 ${s} \u2014`),...c]})},{output:u.stderr})}}catch(r){if(!z(r))throw r}return o},ir=async()=>{let{runCommandPalette:e}=await import("./boot-YCABHUPP.js"),t=io(import.meta.url),o=new Map(at.map(r=>[r.cliName,r]));await Zt(ao(),{renderPalette:e,resolveCommand:r=>{let a=o.get(r);return a?{groupPath:a.groupPath,entersAltScreen:a.entersAltScreen,sessionEnvNotice:a.sessionEnvNotice,longRunning:a.longRunning}:void 0},cliPath:t})};if(u.argv.length<=2){let e={stdoutIsTTY:!!u.stdout.isTTY,stdinIsTTY:!!u.stdin.isTTY,stderrIsTTY:!!u.stderr.isTTY};if(Qt(u.env,e))await ir();else{let t=await nr();t&&(G.value=!0,await no(["node","infra-kit",t]))}}else await no();
|
|
5
11
|
//# sourceMappingURL=cli.js.map
|