infra-kit 0.10.0 → 0.11.10

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.
Files changed (36) hide show
  1. package/dist/{chunk-WUTG6VMP.js → chunk-ATGBWGER.js} +5 -5
  2. package/dist/chunk-ATGBWGER.js.map +7 -0
  3. package/dist/chunk-GBPW4ERM.js +3 -0
  4. package/dist/chunk-GBPW4ERM.js.map +7 -0
  5. package/dist/chunk-J6BHN362.js +11 -0
  6. package/dist/chunk-J6BHN362.js.map +7 -0
  7. package/dist/chunk-KPRFMZCX.js +3 -0
  8. package/dist/chunk-KPRFMZCX.js.map +7 -0
  9. package/dist/chunk-LAHHNH3T.js +2 -0
  10. package/dist/chunk-LAHHNH3T.js.map +7 -0
  11. package/dist/{chunk-OPL7C5H6.js → chunk-SREJWU57.js} +2 -2
  12. package/dist/chunk-ZZ7HCY2S.js +4 -0
  13. package/dist/chunk-ZZ7HCY2S.js.map +7 -0
  14. package/dist/cli.js +113 -168
  15. package/dist/cli.js.map +4 -4
  16. package/dist/dev-server.js +2 -2
  17. package/dist/dev-server.js.map +2 -2
  18. package/dist/dev-wizard-run-NQM3VPQA.js +2 -0
  19. package/dist/{dev-wizard-run-ITRFKMTL.js.map → dev-wizard-run-NQM3VPQA.js.map} +1 -1
  20. package/dist/mcp-proxy.js +9 -9
  21. package/dist/mcp-proxy.js.map +2 -2
  22. package/dist/update-check.js +1 -1
  23. package/dist/update-check.js.map +1 -1
  24. package/package.json +3 -3
  25. package/readme.md +33 -31
  26. package/dist/chunk-7AMRJ4IW.js +0 -9
  27. package/dist/chunk-7AMRJ4IW.js.map +0 -7
  28. package/dist/chunk-JUNJK2YC.js +0 -3
  29. package/dist/chunk-JUNJK2YC.js.map +0 -7
  30. package/dist/chunk-MOVRKV3I.js +0 -4
  31. package/dist/chunk-MOVRKV3I.js.map +0 -7
  32. package/dist/chunk-WUTG6VMP.js.map +0 -7
  33. package/dist/chunk-YYC3QGGC.js +0 -2
  34. package/dist/chunk-YYC3QGGC.js.map +0 -7
  35. package/dist/dev-wizard-run-ITRFKMTL.js +0 -2
  36. /package/dist/{chunk-OPL7C5H6.js.map → chunk-SREJWU57.js.map} +0 -0
package/readme.md CHANGED
@@ -48,38 +48,40 @@ Defines dev server ports, environment providers (e.g., Doppler), and preset prox
48
48
  **infra-kit.config.ts** (audit)
49
49
  Strict schema file that declares audit rules (`requiredScripts`, `requiredFiles`) and an optional `type` override (`frontend` | `backend` | `lib` | `e2e` | `mobile`) used by the `agent-guidance` check. Validated by `infra-kit audit`. No runtime behavior.
50
50
 
51
+ An `e2e` package (declared, or inferred from `apps/<app>/tests` / a `@playwright/test` dependency) is additionally held to the shared Playwright convention, which no config key can switch off: the `e2e-test*` / `playwright-install` scripts must carry their canonical values (`e2e-script:*` checks), and `playwright.config.ts` must read `E2E_SLOW_MO`, pass it to `launchOptions.slowMo`, add it to `timeout`, and keep traces on local failures (`e2e-config:*` checks). Each failure prints the expected line.
52
+
51
53
  ## Commands
52
54
 
53
- | Group | Command | Purpose |
54
- | ----------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55
- | **Develop** | `dev` | Start local dev server with portless proxy (interactive wizard, long-running) |
56
- | | `dev-status` | Report what `infra-kit dev` currently has running (read-only; finds the fragment dir by searching upward, so it works from any subdirectory) |
57
- | **Release** | `release merge-dev` | Merge `origin/dev` into open release branches in a scratch worktree, then push atomically (`--dry-run`, `--versions`) |
58
- | | `release list` | List available releases |
59
- | | `release create` | Create a new release |
60
- | | `release desc-edit` | Edit release notes |
61
- | | `release deploy-all --from <ci\|local>` | Deploy every service — in CI, or from this machine |
62
- | | `release deploy-selected --from <ci\|local>` | Deploy chosen services — in CI, or from this machine |
63
- | | `release deliver` | Deliver to prod (CLI-only, irreversible) |
64
- | | `release remove` | Tear down one release — worktree, IDE folders, PR, local and remote branches, then the Jira fix version last. Refuses a merged PR, a released fix version, or one with issues attached (`--move-issues-to` is the opt-in). Resumable: a partially-removed release re-runs cleanly. Over MCP the Jira step is never attempted (`jira: 'manual'`) |
65
- | **Worktrees** | `worktrees add` | Create a new git worktree |
66
- | | `worktrees list` | List all worktrees |
67
- | | `worktrees remove` | Remove a worktree (no `--force`; a branch git refuses is reported and the command exits non-zero; a leftover git already unregistered that holds only `.omc/state`, `.omc/sessions` or `.DS_Store` is swept automatically) |
68
- | | `worktrees sync` | Sync worktree state (same removal and failure reporting as `worktrees remove`) |
69
- | **Environment** | `env-status` | Show Doppler env status |
70
- | | `env-list` | List secrets in current env |
71
- | | `env-load` | Load env secrets into shell |
72
- | | `env-clear` | Clear loaded secrets |
73
- | | `env-token-list` | List redacted service tokens |
74
- | **Configuration** | `config-get` | Print the fully merged infra-kit config (read-only) |
75
- | | `config path` | Print config file locations |
76
- | | `config edit` | Edit infra-kit.json in `$EDITOR` |
77
- | **Vendor** | `vendor check` | Validate vendor mirrors |
78
- | | `vendor config` | Show vendor manifest |
79
- | **Setup** | `infra-kit setup [--tools <ids...>] [--update [ids...]] [--skip-tools]` | Set up infra-kit on this machine: shell integration, the Claude Code plugin, the `.mcp.json` key, then install or update the external CLIs (brew, aws, gh, doppler, portless). `--tools` / `--update` narrow the converge; `--skip-tools` writes only, reporting what is missing without installing it. Written binary-qualified here because `pnpm setup` and `pnpm run setup` both exist in every consumer and both mutate |
80
- | | `audit [--fix] [--design]` | Check repo against config rules, including the per-package `agent-guidance` `CLAUDE.md` check; `--fix` writes guidance blocks (CLI-only, not in MCP), `--design` also scaffolds `DESIGN.md` |
81
- | | `doctor [--fix]` | Diagnose this machine: infra-kit install, tool auth, and repo wiring; `--fix` repairs what it safely can (CLI-only — the MCP tool is read-only) |
82
- | | `version` | Show installed version |
55
+ | Group | Command | Purpose |
56
+ | ----------------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
57
+ | **Develop** | `dev` | Start local dev server with portless proxy (interactive wizard, long-running) |
58
+ | | `dev-status` | Report what `infra-kit dev` currently has running (read-only; finds the fragment dir by searching upward, so it works from any subdirectory) |
59
+ | **Release** | `release merge-dev` | Merge `origin/dev` into open regular release branches in a scratch worktree, then push atomically (`--dry-run`, `--versions`). Hotfixes (PRs to `main`), title/base mismatches and heads with PRs to both bases are listed as `skipped` with a reason |
60
+ | | `release list` | List available releases |
61
+ | | `release create` | Create a new release; `-r <token>[@yyyy-mm-dd][:type[:description]]` — the `@date` is the Jira fix version’s planned release date |
62
+ | | `release edit` | Edit a release’s Jira description and/or planned release date (`--description`, `--release-date`) |
63
+ | | `release deploy-all --from <ci\|local>` | Deploy every service — in CI, or from this machine |
64
+ | | `release deploy-selected --from <ci\|local>` | Deploy chosen services — in CI, or from this machine |
65
+ | | `release deliver` | Deliver to prod (CLI-only, irreversible) |
66
+ | | `release remove` | Tear down one release — worktree, IDE folders, PR, local and remote branches, then the Jira fix version last. Refuses a merged PR, a released fix version, or one with issues attached (`--move-issues-to` is the opt-in). Resumable: a partially-removed release re-runs cleanly. Over MCP the Jira step is never attempted (`jira: 'manual'`) |
67
+ | **Worktrees** | `worktrees add` | Create a new git worktree |
68
+ | | `worktrees list` | List all worktrees |
69
+ | | `worktrees remove` | Remove a worktree (no `--force`; a branch git refuses is reported and the command exits non-zero; a leftover git already unregistered that holds only `.omc/state`, `.omc/sessions` or `.DS_Store` is swept automatically) |
70
+ | | `worktrees sync` | Sync worktree state (same removal and failure reporting as `worktrees remove`) |
71
+ | **Environment** | `env-status` | Show Doppler env status |
72
+ | | `env-list` | List secrets in current env |
73
+ | | `env-load` | Load env secrets into shell |
74
+ | | `env-clear` | Clear loaded secrets |
75
+ | | `env-token-list` | List redacted service tokens |
76
+ | **Configuration** | `config-get` | Print the fully merged infra-kit config (read-only) |
77
+ | | `config path` | Print config file locations |
78
+ | | `config edit` | Edit infra-kit.json in `$EDITOR` |
79
+ | **Vendor** | `vendor check` | Validate vendor mirrors |
80
+ | | `vendor config` | Show vendor manifest |
81
+ | **Setup** | `infra-kit setup [--tools <ids...>] [--update [ids...]] [--skip-tools]` | Set up infra-kit on this machine: shell integration, the Claude Code plugin, the `.mcp.json` key, then install or update the external CLIs (brew, git, aws, gh, doppler, portless). `--tools` / `--update` narrow the converge; `--skip-tools` writes only, reporting what is missing without installing it. Written binary-qualified here because `pnpm setup` and `pnpm run setup` both exist in every consumer and both mutate |
82
+ | | `audit [--fix] [--design]` | Check repo against config rules, including the per-package `agent-guidance` `CLAUDE.md` check; `--fix` writes guidance blocks (CLI-only, not in MCP), `--design` also scaffolds `DESIGN.md` |
83
+ | | `doctor [--fix]` | Diagnose this machine: infra-kit install, tool auth, and repo wiring; `--fix` repairs what it safely can (CLI-only — the MCP tool is read-only) |
84
+ | | `version` | Show installed version |
83
85
 
84
86
  ## Agent guidance blocks (CLAUDE.md)
85
87
 
@@ -107,7 +109,7 @@ Runs long-running until you press Ctrl-C. Manages multiple backend/frontend proc
107
109
  When infra-kit runs as an MCP server (via `.mcp.json`), these commands are available as structured agent tools:
108
110
 
109
111
  - `dev-status`
110
- - `gh-merge-dev`, `gh-release-list`, `release-create`, `release-remove`, `release-desc-edit`, `gh-release-deploy-all`, `gh-release-deploy-selected`
112
+ - `gh-merge-dev`, `gh-release-list`, `release-create`, `release-remove`, `release-edit`, `gh-release-deploy-all`, `gh-release-deploy-selected`
111
113
  - `release-create` offers an argument form when `releases` is omitted (one release; batches are arguments-only).
112
114
  - `local-deploy-all`, `local-deploy-selected`
113
115
  - `worktrees-add`, `worktrees-list`, `worktrees-remove`, `worktrees-sync`
@@ -1,9 +0,0 @@
1
- import{a as H}from"./chunk-MFAFQVTW.js";import{e as T}from"./chunk-MOVRKV3I.js";import Ie from"node:process";import $e from"pino";import De from"pino-pretty";var Te=["token","*.token","serviceToken","*.serviceToken","DOPPLER_TOKEN","*.DOPPLER_TOKEN","INFRA_KIT_ENV_TOKEN","*.INFRA_KIT_ENV_TOKEN"],Ne=()=>{let e=Ie.argv.includes("--debug")?"debug":"info",t=["time","pid","hostname"];return e==="debug"&&t.push("level"),$e({level:e,redact:Te},De({destination:2,ignore:t.join(","),colorize:!0}))},X=Ne();import U from"node:fs/promises";import ye from"node:os";import C from"node:path";import yt from"node:process";import{z as i}from"zod";import Oe from"node:process";var A={enabled:!1},_e=(e,t=r=>{Oe.stdout.write(r)})=>(A.enabled&&e&&e.structuredContent!=null&&t(`${JSON.stringify(e.structuredContent,null,2)}
2
- `),e),J=e=>{e.options.some(r=>r.long==="--json")||e.option("--json","Output the structured result as JSON on stdout (human logs stay on stderr)"),e.commands.forEach(J)};var Y={source:null},x=()=>Y.source!==null,Le=()=>x()||A.enabled,Me=({env:e,stdinIsTTY:t,flag:r})=>{if(r)return"flag";let n=e.INFRA_KIT_AGENT;return n==="1"||e.CLAUDECODE!==void 0&&!t&&n!=="0"?"env":null};import P from"node:path";import ne from"node:process";import{$ as f}from"zx";var R=e=>{let t=new Set,r=e;for(;r!==null&&typeof r=="object"&&!t.has(r);){t.add(r);let{stderr:n,stderrExcerpt:o}=r;if(typeof n=="string"&&n.length>0)return n;if(typeof o=="string"&&o.length>0)return o;r=r.cause}},Ke=(e,t)=>{let r=t.stderrExcerpt??R(e),n=[`failed to ${t.operation}`];return r&&n.push(`stderr: ${r.slice(0,200).trim()}`),t.remediation&&n.push(`try: ${t.remediation}`),n.join(" \u2014 ")},d=class extends Error{operation;remediation;stderrExcerpt;constructor(t,r){super(Ke(t,r),{cause:t}),this.name="OperationError",this.operation=r.operation,this.remediation=r.remediation,this.stderrExcerpt=r.stderrExcerpt??R(t)}};var We=/^v?(\d+)\.(\d+)\.(\d+)$/,Fe=/^(\d+)\.(\d+)\.(\d+)$/,Ge=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,I="release/",N="release/v",Z="refs/heads/",Ve="next";var Q=new Set(["dev","main","next","hotfix","regular","release"]),k=class extends Error{constructor(t){super(t),this.name="InvalidReleaseNameError"}},w=class extends Error{constructor(t){super(t),this.name="InvalidReleaseRefError"}},te=e=>e.startsWith(Z)?e.slice(Z.length):e,re=(e,t,r)=>({kind:"version",semver:{major:e,minor:t,patch:r},raw:`${e}.${t}.${r}`}),O=e=>{if(e.length===0)throw new k('Release name is empty. Provide a kebab-case name like "checkout-redesign".');if(e.length>50)throw new k(`Release name "${e}" is ${e.length} characters; the maximum is 50.`);if(!Ge.test(e))throw new k(`Release name "${e}" is not kebab-case. Use lowercase letters, digits, and single hyphens, e.g. "checkout-redesign".`);if(Q.has(e))throw new k(`Release name "${e}" is reserved. Reserved names: ${[...Q].join(", ")}.`)},_=e=>{let t=te(e.trim());if(!t.startsWith(I))return null;if(t.startsWith(N)){let n=t.slice(N.length),o=Fe.exec(n);if(o)return re(Number(o[1]),Number(o[2]),Number(o[3]))}let r=t.slice(I.length);try{O(r)}catch{return null}return{kind:"name",name:r,raw:r}},ze=e=>{let t=e.trim();if(te(t).startsWith(I)){let o=_(t);if(!o)throw new w(`"${e}" looks like a release branch but is not a valid release/v<semver> or release/<name> ref.`);return o}let n=We.exec(t);if(n)return re(Number(n[1]),Number(n[2]),Number(n[3]));if(t.toLowerCase()===Ve)throw new w('The "next" token must be resolved to a concrete version (via computeNextVersion) before parsing a release ref.');try{O(t)}catch(o){let s=o instanceof Error?o.message:String(o);throw new w(`Cannot parse "${e}" as a release ref: ${s}`)}return{kind:"name",name:t,raw:t}},Ue=e=>e.kind==="version"?`${N}${e.raw}`:`${I}${e.name}`,qe=(e,t)=>{let r=t==="hotfix"?"Hotfix":"Release";return e.kind==="version"?`${r} v${e.raw}`:`${r} ${e.name}`},Be=e=>e.kind==="version"?`Release v${e.raw} (RC)`:`Release ${e.name} (RC)`,He=e=>e.kind==="version"?`v${e.raw}`:e.name,Xe=e=>e.raw,L=e=>e==null?!1:_(e)!==null,ee=e=>{if(e===void 0)return null;let t=e instanceof Date?e.getTime():new Date(e).getTime();return Number.isNaN(t)?null:t},Je=(e,t,r)=>{if(e.kind==="version"&&t.kind==="version")return e.semver.major!==t.semver.major?e.semver.major-t.semver.major:e.semver.minor!==t.semver.minor?e.semver.minor-t.semver.minor:e.semver.patch-t.semver.patch;if(e.kind==="version")return-1;if(t.kind==="version")return 1;let n=ee(r?.a),o=ee(r?.b);return n!==null&&o!==null&&n!==o?n-o:e.name<t.name?-1:e.name>t.name?1:0};var oe=async e=>{let t=await f({cwd:e})`git worktree list --porcelain`,r=[],n=null;for(let o of t.stdout.split(`
3
- `)){if(o.startsWith("worktree ")){n&&r.push(n),n={path:o.slice(9),branch:null,detached:!1,bare:!1,prunable:!1,locked:!1};continue}n&&(o.startsWith("branch ")?n.branch=o.slice(7).replace(/^refs\/heads\//,""):o==="detached"?n.detached=!0:o==="bare"?n.bare=!0:o==="locked"||o.startsWith("locked ")?n.locked=!0:(o==="prunable"||o.startsWith("prunable "))&&(n.prunable=!0))}return n&&r.push(n),r},Ye=async e=>{let t=await oe(ne.cwd()),r=n=>e==="release"?L(n):n.startsWith("feature/");return t.map(n=>n.branch).filter(n=>n!==null&&r(n))},Ze=e=>{let t=R(e);return t&&/not a git repository/i.test(t)?"not a git repository":void 0},Qe=({hasStderr:e})=>{if(x())return"infra-kit resolves its project from the working directory; run it from inside an infra-kit project repo (or one of its git worktrees), or pass `-C <dir>` naming one";let t="run infra-kit from inside an infra-kit project repo (or one of its git worktrees)";return e?`${t}; if you are already in one, the stderr in this message is the real cause`:t},E=async()=>{try{return(await f({quiet:!0})`git rev-parse --show-toplevel`).stdout.trim()}catch(e){let t=Ze(e)??R(e);throw new d(e,{operation:`resolve the project root from ${ne.cwd()}`,stderrExcerpt:t,remediation:Qe({hasStderr:t!==void 0})})}},M=async e=>{let t=e??await E(),r=(await f({cwd:t,quiet:!0})`git rev-parse --git-common-dir`).stdout.trim(),n=P.resolve(t,r);return n.includes(`${P.sep}.git${P.sep}modules${P.sep}`)?t:P.dirname(n)},se=async()=>(await f`git rev-parse --abbrev-ref HEAD`).stdout.trim(),ie=async()=>(await f`git status --porcelain`).stdout.split(`
4
- `).map(t=>t.trimEnd()).filter(t=>t.trim().length>0),et=async()=>(await ie()).length===0,tt=async()=>{let e=await E(),[t,r]=await Promise.all([f({cwd:e})`git rev-parse --absolute-git-dir`,f({cwd:e})`git rev-parse --git-common-dir`]),n=t.stdout.trim(),o=P.resolve(e,r.stdout.trim());return n!==o};var rt=async e=>(await f`git branch --list ${e}`).stdout.trim().length>0,nt=async e=>{(await f`git branch --list ${e}`).stdout.trim().length!==0&&await se()!==e&&await f`git branch -D ${e}`},ot=async e=>{(await f`git ls-remote --heads origin ${e}`).stdout.trim().length!==0&&await f`git push origin --delete ${e}`};import{$}from"zx";var st=async(e,t)=>{let r=`${t}^{commit}`;try{return(await $({cwd:e,quiet:!0})`git rev-parse --verify --quiet ${r}`).stdout.trim()||null}catch{return null}},it=async(e,t,r)=>{try{return await $({cwd:e,quiet:!0})`git merge-base --is-ancestor ${t} ${r}`,!0}catch(n){if(n.exitCode===1)return!1;throw new d(n,{operation:`test whether ${t} is contained in ${r}`,remediation:"both refs must exist \u2014 verify them with rev-parse first"})}},at=async(e,t)=>{let n=(await $({cwd:e,quiet:!0})`git ls-remote --heads origin ${t}`).stdout.trim().split(`
5
- `)[0];return n?n.split(/\s+/)[0]??null:null},ct=async(e,t)=>{let r=t.map(n=>`${n.sha}:refs/heads/${n.branch}`);if(r.length===0)return{refspecs:r,pushed:!1};try{return await $({cwd:e,quiet:!0})`git push --atomic origin ${r}`,{refspecs:r,pushed:!0}}catch(n){return{refspecs:r,pushed:!1,stderr:n.stderr}}};import ae from"node:path";import K from"node:process";import{$ as g}from"zx";var ce=async e=>{let t=e??K.cwd(),r=(await g({cwd:t,quiet:!0})`git rev-parse --git-common-dir`).stdout.trim(),n=K.env.INFRA_KIT_SESSION||String(K.pid);return ae.join(ae.resolve(t,r),"infra-kit",`merge-dev-${n}`)},W=async e=>{try{return await g({cwd:e,quiet:!0})`git rev-parse -q --verify MERGE_HEAD`,!0}catch{return!1}},pt=async e=>{if(await W(e))throw new d(void 0,{operation:"reuse the scratch worktree",stderrExcerpt:"a merge is still in progress in the scratch worktree",remediation:"this is an infra-kit bug \u2014 the previous branch iteration did not clean up"});let t=(await g({cwd:e,quiet:!0})`git status --porcelain`).stdout.trim();if(t.length>0)throw new d(void 0,{operation:"reuse the scratch worktree",stderrExcerpt:`scratch worktree is dirty: ${t.split(`
6
- `)[0]}`,remediation:"this is an infra-kit bug \u2014 the previous branch iteration did not clean up"})},ut=async e=>{let t=async r=>{try{await r()}catch{}};await W(e)&&await t(()=>g({cwd:e,quiet:!0})`git merge --abort`),await t(()=>g({cwd:e,quiet:!0})`git reset --hard`),await t(()=>g({cwd:e,quiet:!0})`git clean -fd`)},lt=async(e,t)=>{let{cwd:r,anchor:n="origin/dev"}=e,o=await ce(r),s=async()=>{await g({cwd:r,quiet:!0})`git worktree add --detach ${o} ${n}`};try{await s()}catch(p){try{await g({cwd:r,quiet:!0})`git worktree prune`,await s()}catch{throw new d(p,{operation:"create the scratch worktree for the merge",remediation:`remove any stale checkout at ${o}, then retry`})}}let a={path:o,remove:async()=>{try{await g({cwd:r,quiet:!0})`git worktree remove --force ${o}`}catch{}}};try{return await t(a)}finally{await a.remove()}};import ft from"node:fs/promises";import dt from"node:os";var gt=async e=>{try{return await ft.access(e),!0}catch{return!1}},F=e=>{let t=dt.homedir();return e.startsWith(t)?`~${e.slice(t.length)}`:e};var le="openInCmux",b="cmux",mt="openInOrca",pe="orca",m=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ue=(e,t)=>Object.fromEntries(Object.entries(e).filter(([r])=>!t.includes(r))),V=e=>{if(!m(e))return{stripped:[],result:e};let t=[],r=e,n=e.worktrees;if(m(n)){let s=[le,b].filter(a=>a in n);s.length>0&&(t.push(...s.map(a=>`worktrees.${a}`)),r={...r,worktrees:ue(n,s)})}let o=e.devServersPresets;if(m(o)){let s=o;for(let[a,p]of Object.entries(o))!m(p)||!(b in p)||(t.push(`devServersPresets.${a}.${b}`),s={...s,[a]:ue(p,[b])});s!==o&&(r={...r,devServersPresets:s})}return{stripped:t,result:r}},G=(e,t,r)=>{if(!(t in e))return{changed:!1,result:e};let n=r in e;return{changed:!0,result:Object.fromEntries(Object.entries(e).flatMap(([s,a])=>s!==t?[[s,a]]:n?[]:[[r,a]]))}},ht=e=>{if(!m(e))return{changed:!1,result:e};let t=!1,r=e,n=e.worktrees;if(m(n)){let s=G(n,le,mt),a=G(s.result,b,pe);(s.changed||a.changed)&&(t=!0,r={...r,worktrees:a.result})}let o=e.devServersPresets;if(m(o)){let s=o;for(let[a,p]of Object.entries(o)){if(!m(p))continue;let l=G(p,b,pe);l.changed&&(s={...s,[a]:l.result})}s!==o&&(t=!0,r={...r,devServersPresets:s})}return{changed:t,result:r}};var fe="infra-kit.json";var vt="infra-kit.json",kt="projects",xt=i.object({provider:i.literal("doppler"),config:i.object({name:i.string().min(1)})}),wt=i.discriminatedUnion("provider",[xt]),Pt=i.object({workspaceConfigPath:i.string().min(1)}),bt=i.object({provider:i.literal("cursor"),config:Pt}),Rt=i.object({}),Et=i.object({provider:i.literal("zed"),config:Rt}),de=i.discriminatedUnion("provider",[bt,Et]),St=i.union([de,i.array(de).min(1)]),Ct=i.object({provider:i.literal("jira"),config:i.object({baseUrl:i.string().url(),projectId:i.number().int().positive()})}),jt=i.discriminatedUnion("provider",[Ct]),At=["two-columns","three-pane"],It=i.object({layout:i.enum(At).optional()}).strict(),$t=i.object({openInGithubDesktop:i.boolean().optional(),openInOrca:i.boolean().optional(),orca:It.optional()}).strict(),Dt=i.object({port:i.number().int().positive().optional(),prefixUrl:i.string().min(1).optional()}).strict(),Tt=i.record(i.string().min(1),Dt),Nt=i.enum(["local","cloud"]),Ot=i.object({watchDeps:i.boolean().optional(),proxy:i.record(i.string().min(1),Nt).optional()}).strict(),_t=i.object({apps:i.record(i.string().min(1),Ot).optional(),orca:i.boolean().optional()}).strict(),Lt=i.record(i.string().min(1),_t),Mt=i.object({port:i.number().int().positive().optional()}).strict(),Kt=i.object({trigger:i.enum(["shell-startup","cli-invocation"]),config:i.string().min(1)}).strict(),Wt=i.enum(["disallow","allow","cli-only"]),ge=i.string().regex(/^[A-Z_]\w*$/i,"must be a POSIX environment-variable name"),Ft=i.object({command:i.string().min(1),args:i.array(i.string()).default([]),env:i.array(ge).min(1),unset:i.array(ge).default([])}).strict().superRefine((e,t)=>{for(let r of e.env)H.has(r)&&t.addIssue({code:"custom",path:["env"],message:`"${r}" is process plumbing the proxy never strips or injects \u2014 it cannot be a credential name`})}),Gt=i.record(i.string().regex(/^[a-z][a-z0-9-]*$/,"must be lowercase letters, digits and hyphens, starting with a letter").refine(e=>!e.includes("infra-kit"),{message:'"infra-kit" is reserved: it is the .mcp.json key of the retired infra-kit MCP server \u2014 pick another name'}),Ft),q=i.object({envManagement:wt,ide:St.optional(),taskManager:jt.optional(),worktrees:$t.optional(),envAutoLoad:Kt.optional(),dev:Tt.optional(),devServersPresets:Lt.optional(),devProxy:Mt.optional(),protectedEnvs:Wt.optional(),mcp:Gt.optional()}).strict(),Vt=443,ve=q.superRefine((e,t)=>{if(!Array.isArray(e.ide))return;let r=new Set;for(let n of e.ide){if(r.has(n.provider)){t.addIssue({code:"custom",message:"each IDE provider may appear at most once",path:["ide"]});return}r.add(n.provider)}}),ke=q.partial(),zt=e=>{let t=e.ide;return t?Array.isArray(t)?t:[t]:[]},xe="two-columns",Ut=e=>e.worktrees?.orca?.layout??xe,h=null,S=null,we=()=>`${yt.cwd()} ${ye.homedir()}`,Pe=()=>C.join(ye.homedir(),T),be=()=>C.join(Pe(),vt),Re=async()=>{let e=we();if(S&&S.key===e)return S.value;let t=await E(),r=await M(t),n=C.basename(r),o={main:C.join(t,fe),userGlobal:be(),userProject:C.join(Pe(),kt,n,fe),projectName:n};return S={key:e,value:o},o},qt=async()=>{let e=we(),t=await Re(),r;try{r=await U.stat(t.main)}catch{h=null;let y=t.main.replace(/\.json$/,".yml");throw await z(y)?new Error(`infra-kit.json not found at ${t.main}. A legacy infra-kit.yml exists \u2014 run \`infra-kit setup --skip-tools\` to convert it.`):new Error(x()?`infra-kit.json not found at ${t.main} \u2014 the working directory is not an infra-kit project. Run infra-kit from inside an infra-kit project repo, or pass \`-C <dir>\` naming one.`:`infra-kit.json not found at ${t.main} \u2014 this git repo is not an infra-kit project. Run \`infra-kit setup --skip-tools\` here to create it, cd into an infra-kit project repo, or check out a branch that has infra-kit.json.`)}let[n,o]=await Promise.all([z(t.userGlobal),z(t.userProject)]),s={main:Number(r.mtimeMs),userGlobal:n?Number(n.mtimeMs):null,userProject:o?Number(o.mtimeMs):null};if(h&&h.key===e&&Jt(h.mtimes,s))return h.value;let a=[{label:"infra-kit.json",path:t.main,required:!0},{label:"~/.infra-kit/infra-kit.json",path:t.userGlobal,required:!1},{label:`~/.infra-kit/projects/${t.projectName}/infra-kit.json`,path:t.userProject,required:!1}],p={};for(let y of a){let v=await Yt(y);v!==null&&(p={...p,...v})}let l=ve.safeParse(p);if(!l.success)throw new Error(`Invalid merged infra-kit config: ${i.prettifyError(l.error)}`);return h={key:e,mtimes:s,value:l.data},l.data},Bt=()=>{h=null},Ht=()=>{h=null,S=null},z=async e=>{try{return await U.stat(e)}catch{return null}},Xt=async e=>{try{return await U.readFile(e,"utf-8")}catch{return null}},Jt=(e,t)=>{let r=Object.keys(e);return r.length!==Object.keys(t).length?!1:r.every(n=>e[n]===t[n])},me=new Set,Yt=async e=>{let t=await Xt(e.path);if(t===null){if(e.required)throw new Error(`${e.label} not found at ${e.path}`);return null}let r;try{r=t.trim()===""?{}:JSON.parse(t)}catch(a){throw new Error(`Invalid JSON in ${e.label} at ${e.path}: ${a.message}`)}if(he(r)&&"envTokens"in r)throw new Error(Qt(e));if(!e.required&&he(r)&&"mcp"in r)throw new Error(Zt(e));let{stripped:n,result:o}=V(r);n.length>0&&!me.has(e.path)&&(me.add(e.path),X.warn(`legacy cmux keys (${n.join(", ")}) in ${F(e.path)} are ignored \u2014 run \`infra-kit setup\` to migrate them to orca`));let s=ke.safeParse(o);if(!s.success)throw new Error(`Invalid ${e.label} at ${e.path}: ${i.prettifyError(s.error)}`);return s.data},Zt=e=>[`"mcp" is not allowed in ${e.label} (${e.path}): it feeds the committed .mcp.json, so a per-machine copy would replace the project's servers for everyone.`,"Move the block to the project infra-kit.json and run `infra-kit setup`.","For a machine-only override of one server (e.g. a local fork), use Claude Code directly:"," claude mcp add --scope local <name> -- ik-mcp --name <name> --env <VAR> ... -- <command> <args>","(local scope shadows the project entry by name; `claude mcp list` will show a same-name conflict warning, which is expected)."].join(`
7
- `),he=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Qt=e=>[`Refusing to load ${e.label} \u2014 \`envTokens\` is not a config key.`,"A service token in a config file can be committed, backed up by your editor, or shared."," 1. REVOKE the token in Doppler now \u2014 treat it as compromised.",` 2. Remove the \`envTokens\` key from ${e.path}.`," 3. Re-add it privately: `infra-kit env-token-set <env>`"," (it is written to ~/.infra-kit/projects/<repo>/tokens.json, mode 0600, never to the repo)."].join(`
8
- `);import*as u from"node:fs";import*as c from"node:path";function er(e){let t=e;for(let r=0;r<10;r++){let n=c.join(t,"pnpm-workspace.yaml");if(u.existsSync(n))return t;t=c.dirname(t)}throw new Error("Could not find monorepo root (pnpm-workspace.yaml)")}function Se(e,t){let r=c.join(e,"package.json");if(!u.existsSync(r))return t;try{let n=JSON.parse(u.readFileSync(r,"utf-8"));return typeof n.name=="string"?n.name:t}catch{return t}}function xn(e){let t=c.join(e,"apps"),r=[];if(!u.existsSync(t))throw new Error(`Apps directory not found: ${t}`);let n=u.readdirSync(t,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>o.name);for(let o of n){let s=c.join(t,o,"api"),a=c.join(s,"serverless.yml");u.existsSync(a)&&r.push({name:o,packageName:Se(s,o),path:s})}return r}var Ce=["vite.config.ts","vite.config.mts","vite.config.cts","vite.config.js","vite.config.mjs","vite.config.cjs"],tr=["@slip-stream-kit/vite","@slip-stream-kit/config/vite","infra-kit/vite"];function rr(e){for(let t of Ce){let r=c.join(e,t);if(u.existsSync(r))try{let n=u.readFileSync(r,"utf-8");return tr.some(o=>n.includes(o))}catch{return!1}}return!1}function wn(e){for(let t of Ce){let r=c.join(e,t);if(u.existsSync(r))try{return u.readFileSync(r,"utf-8").includes("infraKit(")}catch{return!1}}return!1}function nr(e){let t=c.join(e,"package.json");if(!u.existsSync(t))return!1;try{let r=JSON.parse(u.readFileSync(t,"utf-8"));return typeof r.scripts?.dev=="string"&&r.scripts.dev.length>0}catch{return!1}}function Pn(e){let t=c.join(e,"apps"),r=[];if(!u.existsSync(t))return r;let n=u.readdirSync(t,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>o.name);for(let o of n){let s=c.join(t,o,"ui");u.existsSync(s)&&nr(s)&&r.push({name:o,packageName:Se(s,o),path:s,managedPort:rr(s)})}return r}function bn(e){let t=e?.filter(Boolean)??[];return t.length>0?t:null}function Rn(e){let t=er(e),r=c.relative(c.join(t,"apps"),e),n=r.split(c.sep)[0];if(r===""||r.startsWith("..")||c.isAbsolute(r)||!n)throw new Error(`--self: not inside an apps/<app> directory (cwd: ${e}). Run from an app folder or use --app=<name>.`);return n}var or=new Set(["api","ui"]),Ee=e=>{let t=c.join(e,"dist");return u.existsSync(t)&&u.statSync(t).isDirectory()?t:void 0},B=e=>u.existsSync(e)?u.readdirSync(e,{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name):[];function En(e){let t=[];for(let n of B(c.join(e,"packages"))){let o=Ee(c.join(e,"packages",n));o!==void 0&&t.push(o)}let r=c.join(e,"apps");for(let n of B(r))for(let o of B(c.join(r,n))){if(or.has(o))continue;let s=c.join(r,n,o);if(!u.existsSync(c.join(s,"package.json")))continue;let a=Ee(s);a!==void 0&&t.push(a)}return t}function Sn(e){return e.map(t=>c.join(t.path,"dist")).filter(t=>u.existsSync(t))}function Cn(e,t,r){let n=c.normalize(e),o=r.find(a=>n.startsWith(c.normalize(a)));return o?{kind:"package",packageDir:o}:{kind:"app",app:t.find(a=>n.startsWith(c.normalize(a)))}}var sr={"*/api":{},"*/ui":{}},Ae=e=>{let t=e.split("/"),[r,n]=t;return t.length!==2||!r?`devServersPresets: invalid target "${e}" (expected "<app>/api" or "<app>/ui")`:n!=="api"&&n!=="ui"?`devServersPresets: invalid target part "${n}" in "${e}" (expected "api" or "ui")`:null},ir=e=>{let t=Ae(e);if(t)throw new Error(t);let[r,n]=e.split("/");return{appGlob:r,part:n}},An=e=>{let t=[];for(let[r,n]of Object.entries(e))for(let o of Object.keys(n.apps??{})){let s=Ae(o);s&&t.push({preset:r,key:o,message:`preset "${r}": ${s}`})}return t},ar=(e,t)=>t==="api"?e.api:e.ui,cr=e=>[...new Set([...e.api,...e.ui])].sort(),je=(e,t)=>`${e}/${t}`,pr=e=>e?0:1,ur=(e,t)=>t.watchDeps===void 0?e??{watchDeps:!0,rank:t.rank,explicitValue:!1}:!e||!e.explicitValue?{watchDeps:t.watchDeps,rank:t.rank,explicitValue:!0}:t.rank>e.rank?{watchDeps:t.watchDeps,rank:t.rank,explicitValue:!0}:e,lr=(e,t,r)=>{let{app:n,part:o,watchDeps:s,isGlob:a}=r;if(!ar(t,o).includes(n)){a||e.unmatched.push(je(n,o));return}let p=je(n,o),l=ur(e.targets.get(p),{watchDeps:s,rank:pr(a)});e.targets.set(p,{app:n,part:o,...l})},fr=(e,t)=>{let r=Object.entries(e.apps??sr),n={targets:new Map,proxy:{},unmatched:[]};for(let[a,p]of r){let{appGlob:l,part:y}=ir(a),v=l==="*",j=v?cr(t):[l];for(let D of j)lr(n,t,{app:D,part:y,watchDeps:p.watchDeps,isGlob:v}),p.proxy&&(n.proxy[D]={...n.proxy[D]??{},...p.proxy})}let o=[...n.targets.values()].map(({app:a,part:p,watchDeps:l})=>({app:a,part:p,watchDeps:l})),s=[...new Set(o.filter(a=>a.part==="api").map(a=>a.app))];return{targets:o,orca:e.orca??!1,proxy:n.proxy,localApps:s,unmatched:n.unmatched}},In=e=>{if(e.preset!=null)return e.preset;if(e.running.length===0)return"nothing";let t=new Set(e.running);return e.discovered.every(n=>t.has(n))?"*":[...t].sort().join(" + ")},dr=(e,t)=>Object.keys(e).find(r=>e[r]===t),gr=({preset:e,app:t,route:r,launchedPkgs:n,ctx:o})=>{let s=o.routePkg(t,r);if(s===void 0)return{preset:e,app:t,route:r,kind:"unknown-route",message:`preset "${e}": proxy override "${r}" on "${t}" names a route not declared in ${t}'s infra-kit.config.ts dev.proxy.routes`};if(n.has(s))return null;let a=dr(o.apiPkgByApp,s),p=a?`add "${a}/api" to the preset`:`launch the api whose package is "${s}"`;return{preset:e,app:t,route:r,pkg:s,kind:"backend-not-launched",message:`preset "${e}": proxy override "${r}" \u2192 "local" requires backend "${s}" to run locally, but the preset does not launch it \u2014 ${p}, or set "${r}" to "cloud"`}},$n=(e,t)=>{let r=[];for(let[n,o]of Object.entries(e)){let s=fr(o,t.discovered),a=new Set(s.localApps.map(p=>t.apiPkgByApp[p]).filter(p=>p!==void 0));for(let[p,l]of Object.entries(s.proxy))for(let[y,v]of Object.entries(l)){if(v!=="local")continue;let j=gr({preset:n,app:p,route:y,launchedPkgs:a,ctx:t});j&&r.push(j)}}return r};export{A as a,_e as b,J as c,Y as d,x as e,Le as f,Me as g,R as h,d as i,k as j,O as k,_ as l,ze as m,Ue as n,qe as o,Be as p,He as q,Xe as r,L as s,Je as t,oe as u,Ye as v,E as w,M as x,se as y,ie as z,et as A,tt as B,rt as C,nt as D,ot as E,st as F,it as G,at as H,ct as I,W as J,pt as K,ut as L,lt as M,X as N,gt as O,F as P,V as Q,ht as R,Vt as S,ve as T,ke as U,zt as V,Ut as W,be as X,Re as Y,qt as Z,Bt as _,Ht as $,er as aa,xn as ba,wn as ca,Pn as da,bn as ea,Rn as fa,En as ga,Sn as ha,Cn as ia,Ae as ja,An as ka,fr as la,In as ma,$n as na};
9
- //# sourceMappingURL=chunk-7AMRJ4IW.js.map