infra-kit 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-EZ4DIT5A.js → chunk-4WWNBCEI.js} +12 -11
- package/dist/{chunk-EZ4DIT5A.js.map → chunk-4WWNBCEI.js.map} +3 -3
- package/dist/{chunk-4RZM53X7.js → chunk-RHYVJTUE.js} +2 -2
- package/dist/{chunk-PP3ZZKB3.js → chunk-RRPSOI5X.js} +2 -2
- package/dist/{chunk-3UE375II.js → chunk-TEZPDT3Q.js} +2 -2
- package/dist/{chunk-3UE375II.js.map → chunk-TEZPDT3Q.js.map} +1 -1
- package/dist/{chunk-ZTAUGYJF.js → chunk-UPOI7HEW.js} +2 -2
- package/dist/cli.js +125 -115
- package/dist/cli.js.map +4 -4
- package/dist/dev-server.js +2 -2
- package/dist/{dev-wizard-run-6PLC5YEW.js → dev-wizard-run-GCVUKY6A.js} +2 -2
- package/dist/{env-load-NURS7WNH.js → env-load-ZYP5S3XF.js} +2 -2
- package/dist/update-check.js +1 -1
- package/package.json +3 -3
- package/readme.md +1 -1
- /package/dist/{chunk-4RZM53X7.js.map → chunk-RHYVJTUE.js.map} +0 -0
- /package/dist/{chunk-PP3ZZKB3.js.map → chunk-RRPSOI5X.js.map} +0 -0
- /package/dist/{chunk-ZTAUGYJF.js.map → chunk-UPOI7HEW.js.map} +0 -0
- /package/dist/{dev-wizard-run-6PLC5YEW.js.map → dev-wizard-run-GCVUKY6A.js.map} +0 -0
- /package/dist/{env-load-NURS7WNH.js.map → env-load-ZYP5S3XF.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{P as p,S as w,ca as C,d as f,f as u,ga as g}from"./chunk-
|
|
1
|
+
import{P as p,S as w,ca as C,d as f,f as u,ga as g}from"./chunk-4WWNBCEI.js";import{p as b}from"./chunk-I23MDR4X.js";import{a as A,b as D}from"./chunk-QWVLAZ6N.js";var H=()=>{let e="",t=[],r=!1;return{start(n){e=n,t=[],r=!1},setInteractive(){r=!0},addOption(n,o){t.push({flag:n,value:o})},formatOptions(){return t.map(n=>typeof n.value=="boolean"?n.value?n.flag:"":Array.isArray(n.value)?`${n.flag} "${n.value.join(", ")}"`:`${n.flag} "${n.value}"`).filter(Boolean).join(" ")},snapshot(){return t.length===0?null:{formattedOptions:this.formatOptions()}},print(){!r||t.length===0||!e||p.info(`\u{1F4DF} Equivalent command:
|
|
2
2
|
pnpm exec infra-kit ${e} ${this.formatOptions()}
|
|
3
3
|
`)},reset(){e="",t=[],r=!1}}},x=H();import{isAbsolute as $,resolve as I}from"node:path";import M from"node:process";var E=null,y=null,K=e=>{E=[...e],y=M.cwd()},q=new Set(["--yes","-y"]),B=(e,t)=>{let r=[...e];for(let[n,o]of r.entries())o==="-C"&&r[n+1]!==void 0&&!$(r[n+1])?r[n+1]=I(t,r[n+1]):o.startsWith("-C")&&o.length>2&&!o.startsWith("--")&&!$(o.slice(2))&&(r[n]=`-C${I(t,o.slice(2))}`);return r},T=()=>{if(E===null||y===null)return["--yes"];let e=B(E.slice(2),y);return e.some(r=>q.has(r))?e:[...e,"--yes"]};import _ from"node:process";var J=27,L=e=>e===null?"an interactive prompt was reached under --json, which never prompts":`an interactive prompt was reached in agent mode (${e==="flag"?"--agent":"INFRA_KIT_AGENT / CLAUDECODE"}), where there is no human to answer it`,W=e=>`${e===void 0?"pass the value explicitly instead of relying on the prompt":`pass --${e}`} on the re-run`,z=e=>{if(typeof e=="object"&&"value"in e)return e.value;let t=typeof e=="object"?e.refuse:void 0,{source:r}=f;throw new g(t===void 0?{status:"refused",agentMode:r}:{status:"argument_required",argument:t,agentMode:r},2,{operation:"interactive prompt",remediation:W(t),stderrExcerpt:L(r)})},j=async(e,t)=>{let r=new AbortController,{whenHeadless:n="refuse",...o}=t??{},i={...o,signal:r.signal};if(u())return z(n);if(!_.stdin.isTTY)return e(i);let m=_.stdin,P=d=>{d.length===1&&d[0]===J&&r.abort()};A();try{let d=e(i);return m.isPaused()&&m.resume(),m.on("data",P),await d}finally{m.removeListener("data",P),D()}};import U from"@inquirer/confirm";import Y from"node:process";var a=class extends Error{constructor(t="Operation cancelled by the operator"){super(t),this.name="CommandDeclinedError"}},fe=e=>e instanceof a;var N=(e,t,r=T())=>{let{source:n}=f;throw new g({status:"confirmation_required",message:e,plan:t,rerun:r,agentMode:n},2,{operation:"confirm before running",remediation:n===null?"pass `--yes` to confirm, or drop `--json` to be prompted":`show the plan to the human, then re-run \`infra-kit ${r.join(" ")}\` to confirm`,stderrExcerpt:"confirmation required and nobody to ask"})},G=async(e,t,r={})=>{!e&&u()&&N(t,r.plan,r.rerun);let n=e?!0:await j(o=>U({message:t},o),{whenHeadless:"refuse"});if(e||x.setInteractive(),!n){if(r.throwOnDecline)throw new a;p.info("Operation cancelled. Exiting..."),Y.exit(0)}};import h from"node:fs/promises";import l from"node:path";import{z as s}from"zod";var c=class extends Error{env;constructor(t,r=null){super(t),this.name="EnvAuthError",this.env=r}};var V="tokens.json",v=1,R=384,F=448,Q=s.object({version:s.literal(v).default(v),envs:s.record(s.string().min(1),s.string().min(1))}).strict(),k=async()=>{let e=await C();return l.join(l.dirname(e.userProject),V)},S=async()=>{let e=await k(),t;try{t=await h.readFile(e,"utf-8")}catch{return null}let r;try{r=JSON.parse(t)}catch(o){throw new c(`Invalid JSON in the token store at ${w(e)}: ${o.message}
|
|
4
4
|
Fix or delete the file, then re-add the token with \`infra-kit env-token-set <env>\`.`)}let n=Q.safeParse(r);if(!n.success)throw new c(`Invalid token store at ${w(e)}: ${s.prettifyError(n.error)}
|
|
5
5
|
Fix or delete the file, then re-add the token with \`infra-kit env-token-set <env>\`.`);return n.data},O=async e=>{let t=await k(),r=l.dirname(t),n=l.dirname(r),o=l.dirname(n);for(let i of[o,n,r])await h.mkdir(i,{recursive:!0,mode:F}),await h.chmod(i,F);b(t,`${JSON.stringify(e,null,2)}
|
|
6
6
|
`,R),await h.chmod(t,R)};var X=async e=>{let t=await S();await O({version:v,envs:{...t?.envs,...e}})},Z=async e=>{let t=await S();if(!t||!(e in t.envs))return;let r={...t.envs};delete r[e],await O({version:v,envs:r})};export{x as a,fe as b,K as c,T as d,j as e,N as f,G as g,c as h,k as i,S as j,X as k,Z as l};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-RHYVJTUE.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as x,e as ne,h as S,i as se,j as p}from"./chunk-
|
|
1
|
+
import{a as x,e as ne,h as S,i as se,j as p}from"./chunk-RHYVJTUE.js";import{P as c,S as oe,d,da as b,e as _,f as re,ga as m,h as D,i as te,w as P}from"./chunk-4WWNBCEI.js";import{a as Z,c as U,d as T,f as G,g as H,h as B,i as Y,j as Q,o as X,p as K,q as ee}from"./chunk-I23MDR4X.js";import He from"@inquirer/select";import{readRepoIdentity as Be}from"@slip-stream-kit/config/internal";import{Buffer as Ye}from"node:buffer";import Qe from"node:fs";import J from"node:path";import $ from"node:process";import{z as k}from"zod";import{$ as I}from"zx";var _e="Could not find requested project",De="Could not find requested config",ie="Invalid Auth token",ae="does not have access to requested config",A=e=>e.includes(ie)||e.includes(ae)?"auth":e.includes(_e)?"project":e.includes(De)?"config":"unknown",R=e=>e.includes(ae)?"mis-scoped":e.includes(ie)?"revoked":null;var ce=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(`
|
|
2
2
|
`),f=class extends S{authKind;constructor(r,t=null,o){super(o??ce(r),r),this.name="DopplerAuthError",this.authKind=t}};var L=({kind:e,project:r,config:t,available:o})=>{let n=e==="project"?[`Doppler project "${r}" not found (set in infra-kit.json \u2192 envManagement.config.name).`]:[`Doppler config "${t}" not found in project "${r}".`];if(o&&o.length>0){let s=e==="project"?"Available projects":`Available configs in "${r}"`;n.push(`${s}: ${o.join(", ")}.`)}return n.push(e==="project"?"Fix: update envManagement.config.name to an existing project, or create it in Doppler.":"Fix: pass an existing config, or create it in Doppler."),n.join(`
|
|
3
3
|
`)};import{$ as N}from"zx";var be=5e3,xe="DOPPLER_CONFIG",g=async()=>{let{envManagement:e}=await b();return e.config.name},Se=async({childEnv:e,project:r,config:t})=>{let o=N.quiet;N.quiet=!0;try{let s=(await N({env:e})`doppler secrets get ${xe} --plain --project ${r} --config ${t}`.timeout(be)).stdout.trim();return s!==t?{outcome:"mis-scoped",scopedTo:s}:{outcome:"valid",scopedTo:s}}catch(n){return{outcome:Ne(n)}}finally{N.quiet=o}},Ne=e=>{let r=D(e)??(e instanceof Error?e.message:String(e));return A(r)!=="auth"?"unreachable":R(r)??"unreachable"};import Oe from"node:process";var l="INFRA_KIT_ENV_TOKEN",C=async e=>{let r=Oe.env[l];if(r)return{token:r,source:"env"};let o=(await p())?.envs[e];if(o)return{token:o,source:"store"};throw new S(je(e,await se()),e)},je=(e,r)=>[`No Doppler service token for env "${e}".`,`Mint one at https://dashboard.doppler.com \u2014 this project \u2192 config "${e}" \u2192 Access tab \u2192 "Generate Service Token".`,`Fix: run \`infra-kit env-token-set ${e}\` and paste it.`,`It is stored in ${oe(r)} (mode 0600, never in the repo).`,`CI / agents: set ${l} instead \u2014 it takes precedence and needs no home config.`].join(`
|
|
4
4
|
`);import Ee from"node:process";import{z as ve}from"zod";import ze from"node:process";import{z as u}from"zod";var le=["prod"],v={allowed:!1,reason:"disallow"},h=e=>le.includes(e),Fe=["dev","stage"],Ie=e=>Fe.includes(e)||h(e),$e=(e,r=v)=>r.allowed?e:e.filter(t=>!h(t)),Ke=(e,r,t=v)=>{if(!t.allowed&&h(e))throw t.reason==="agent-blocked"?new m({status:"refused",env:e,agentMode:d.source},2,{operation:r,remediation:'a human runs it from their own terminal \u2014 this project sets `protectedEnvs: "cli-only"`',stderrExcerpt:`"${e}" is withheld from agents in this project (protectedEnvs: "cli-only")`}):new te(void 0,{operation:r,remediation:`use \`infra-kit release deliver\` \u2014 it merges the release to main, opens the RC PR, deploys from main, and releases the Jira version. To allow ad-hoc deploys to "${e}" in this project, set \`protectedEnvs\` to "allow" or "cli-only" in infra-kit.json`,stderrExcerpt:`"${e}" is delivered, not deployed ad-hoc`})};var Le=async()=>{let e;try{e=(await b()).protectedEnvs??"disallow"}catch{return v}return e==="disallow"?v:e==="cli-only"&&_()?{allowed:!1,reason:"agent-blocked"}:{allowed:!0,reason:"allowed"}};var Ce=e=>{let{env:r,branch:t}=e;h(r)&&c.warn([`\u26A0\uFE0F "${r}" is a delivery target \u2014 this project allows dispatching to it directly, but this is NOT the delivery flow.`,`Dispatching from "${t}" ships ${r} from a ref that is not merged to main, and skips:`," \u2022 the squash-merge of the release branch into main"," \u2022 the RC pull request"," \u2022 the Jira fix-version release","Run `infra-kit release deliver` instead if you want those."].join(`
|
|
@@ -9,4 +9,4 @@ import{a as x,e as ne,h as S,i as se,j as p}from"./chunk-4RZM53X7.js";import{P a
|
|
|
9
9
|
`)}
|
|
10
10
|
`,384),K(W,i,384),{filePath:W,variableCount:o.length,project:r,config:e}},Pe=q(),sr=async e=>{let{config:r}=e;await we({provider:Pe,params:e,operation:"env-load",argument:"config"});let t="";if(r)t=r;else{if(_())throw new m({status:"argument_required",argument:"config",agentMode:d.source},2,{operation:"env-load",remediation:'call env-list, ask the human which environment, and re-call env-load with "config"'});let s=await z();x.setInteractive(),t=await ne(i=>He({message:"Select environment config",choices:s.map(a=>({name:a,value:a}))},i),{output:$.stderr,whenHeadless:"refuse"})}x.addOption("--config",t);let o=await nr({config:t});x.print();let n={filePath:o.filePath,variableCount:o.variableCount,project:o.project,config:o.config,sessionId:$.env[T]??null};return{content:O(JSON.stringify(n,null,2)),structuredContent:n}},Te=1024*1024,ir=3e4,ar=["DOPPLER_TOKEN","DOPPLER_PROJECT","DOPPLER_CONFIG"],cr=(e,r=$.env)=>{let t={...r};for(let o of ar)delete t[o];return t.DOPPLER_TOKEN=e,t},eo=async e=>new Map(await Ae(await g(),e)),Ae=async(e,r)=>{let{token:t}=await C(r),o=cr(t),n=I.quiet;I.quiet=!0;try{let s;try{s=await I({env:o})`doppler secrets download --no-file --format json --project ${e} --config ${r}`.timeout(ir)}catch(a){throw pr(a,e,r)}ur(s.stdout);let i=mr(s.stdout);return lr(i,r),i}finally{I.quiet=n}},lr=(e,r)=>{let t=e.find(([o])=>o===Xe)?.[1];if(!(t===void 0||t===r))throw new f(r,null,`Doppler returned secrets for config "${t}" but "${r}" was requested \u2014 the service token for env "${r}" is scoped to the wrong config. Refusing to load another environment's secrets.
|
|
11
11
|
Fix: run \`infra-kit env-token-set ${r}\` with a token scoped to "${r}".`)},pr=(e,r,t)=>{let o=D(e)??(e instanceof Error?e.message:String(e)),n=A(o);return n==="auth"?new f(t,R(o)):n==="unknown"?e instanceof Error?e:new Error(String(e)):new Error(L({kind:n,project:r,config:t,available:null}))},ur=e=>{let r=Ye.byteLength(e,"utf-8");if(r>Te)throw new Error(`doppler returned unexpectedly large output (${r} bytes > ${Te}) \u2014 refusing to write to disk`)},y=e=>`'${e.replaceAll("'","'\\''")}'`,dr=/^[A-Z_]\w*$/i,mr=e=>{let r;try{r=JSON.parse(e)}catch{throw new Error(`doppler returned non-JSON output for env-load (got: ${JSON.stringify(e.slice(0,80))})`)}if(r===null||typeof r!="object"||Array.isArray(r))throw new Error("doppler returned unexpected JSON shape for env-load (expected an object of KEY: value pairs)");let t=[];for(let[o,n]of Object.entries(r)){if(!dr.test(o))throw new Error(`doppler returned an invalid env var name for env-load (got: ${JSON.stringify(o.slice(0,80))})`);if(typeof n!="string")throw new TypeError(`doppler returned a non-string value for "${o}" (got ${typeof n})`);t.push([o,n])}if(t.length===0)throw new Error("doppler returned empty output for env-load");return t},ro=j({name:"env-load",description:'Download the env vars for a Doppler config and write them to a temporary shell script. Does NOT mutate the calling process \u2014 returns the path to a script that must be sourced ("source <filePath>") for the vars to take effect. The infra-kit shell wrapper auto-sources; direct MCP callers must handle sourcing themselves or surface filePath to the user. This server picks the file up on its next tool call, so a tool that needs the variables can be called right after. Omit "config" and this server offers the human a form listing every environment env-list knows, token-less ones marked; a client that cannot render one gets a refusal naming the missing field \u2014 call env-list and ask the human, never guess.',inputSchema:{config:k.string().optional().describe('Doppler config / environment name to load (e.g. "dev", "arthur"). Omit it to have the human choose from a form.')},formProvider:Pe,outputSchema:{filePath:k.string().describe("Path to the file that must be sourced to apply variables"),variableCount:k.number().describe("Number of variables loaded"),project:k.string().describe("Doppler project name"),config:k.string().describe("Doppler config name"),sessionId:k.string().nullable().describe("The INFRA_KIT_SESSION the file was written for; null when the process had no session")},handler:sr});export{O as a,j as b,A as c,R as d,g as e,Se as f,l as g,C as h,h as i,Ie as j,$e as k,Ke as l,Le as m,Ce as n,Ve as o,w as p,z as q,ge as r,Je as s,we as t,rr as u,or as v,nr as w,sr as x,Te as y,cr as z,eo as A,lr as B,pr as C,ur as D,y as E,mr as F,ro as G};
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-RRPSOI5X.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var i={name:"infra-kit",type:"module",version:"0.
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
var i={name:"infra-kit",type:"module",version:"0.17.0",repository:{type:"git",url:"git+https://github.com/ArthurSaenz/infra-kit.git",directory:"apps/infra-kit/cli"},files:["dist"],description:"infra-kit",bin:{"infra-kit":"dist/cli.js",ik:"dist/cli.js","ik-mcp":"dist/mcp-proxy.js"},engines:{node:">=24.x"},scripts:{build:"pnpm run clean-artifacts && node ./scripts/build.js",prepack:"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 --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:pty":"INFRA_KIT_REQUIRE_PTY=1 pnpm exec vitest run --reporter=minimal src/tui/__tests__/stdin-pause-pty.test.ts src/entry/__tests__/quit-keys-pty.test.ts src/entry/__tests__/post-run-pause-pty.test.ts",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.35.0","@inquirer/checkbox":"^5.2.5","@inquirer/confirm":"^6.3.2","@inquirer/input":"^5.1.6","@inquirer/password":"^5.2.2","@inquirer/select":"^5.2.5","@slip-stream-kit/config":"workspace:^",chalk:"^6.0.0",chokidar:"^5.0.0",commander:"^15.0.0",fastify:"^5.12.5",ink:"^7.1.1",pino:"^10.3.1","pino-pretty":"^13.1.3",portless:"^0.15.6",react:"19.3.0",yaml:"^2.9.1",zod:"^4.6.5",zx:"^8.8.5"},devDependencies:{"@slip-stream-kit/eslint-plugin":"workspace:*","@types/aws-lambda":"catalog:","@types/react":"catalog:","@wl/eslint-config":"workspace:*","@wl/vitest-config":"workspace:*",esbuild:"^0.28.2","ink-testing-library":"^4.0.0",typescript:"^6.0.3"}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-TEZPDT3Q.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.
|
|
4
|
+
"sourcesContent": ["{\n \"name\": \"infra-kit\",\n \"type\": \"module\",\n \"version\": \"0.17.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/ArthurSaenz/infra-kit.git\",\n \"directory\": \"apps/infra-kit/cli\"\n },\n \"files\": [\n \"dist\"\n ],\n \"description\": \"infra-kit\",\n \"bin\": {\n \"infra-kit\": \"dist/cli.js\",\n \"ik\": \"dist/cli.js\",\n \"ik-mcp\": \"dist/mcp-proxy.js\"\n },\n \"engines\": {\n \"node\": \">=24.x\"\n },\n \"scripts\": {\n \"build\": \"pnpm run clean-artifacts && node ./scripts/build.js\",\n \"prepack\": \"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 --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:pty\": \"INFRA_KIT_REQUIRE_PTY=1 pnpm exec vitest run --reporter=minimal src/tui/__tests__/stdin-pause-pty.test.ts src/entry/__tests__/quit-keys-pty.test.ts src/entry/__tests__/post-run-pause-pty.test.ts\",\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.35.0\",\n \"@inquirer/checkbox\": \"^5.2.5\",\n \"@inquirer/confirm\": \"^6.3.2\",\n \"@inquirer/input\": \"^5.1.6\",\n \"@inquirer/password\": \"^5.2.2\",\n \"@inquirer/select\": \"^5.2.5\",\n \"@slip-stream-kit/config\": \"workspace:^\",\n \"chalk\": \"^6.0.0\",\n \"chokidar\": \"^5.0.0\",\n \"commander\": \"^15.0.0\",\n \"fastify\": \"^5.12.5\",\n \"ink\": \"^7.1.1\",\n \"pino\": \"^10.3.1\",\n \"pino-pretty\": \"^13.1.3\",\n \"portless\": \"^0.15.6\",\n \"react\": \"19.3.0\",\n \"yaml\": \"^2.9.1\",\n \"zod\": \"^4.6.5\",\n \"zx\": \"^8.8.5\"\n },\n \"devDependencies\": {\n \"@slip-stream-kit/eslint-plugin\": \"workspace:*\",\n \"@types/aws-lambda\": \"catalog:\",\n \"@types/react\": \"catalog:\",\n \"@wl/eslint-config\": \"workspace:*\",\n \"@wl/vitest-config\": \"workspace:*\",\n \"esbuild\": \"^0.28.2\",\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,SACX,WAAc,CACZ,KAAQ,MACR,IAAO,mDACP,UAAa,oBACf,EACA,MAAS,CACP,MACF,EACA,YAAe,YACf,IAAO,CACL,YAAa,cACb,GAAM,cACN,SAAU,mBACZ,EACA,QAAW,CACT,KAAQ,QACV,EACA,QAAW,CACT,MAAS,sDACT,QAAW,iBACX,kBAAmB,4BACnB,kBAAmB,cACnB,cAAe,2EACf,eAAgB,4HAChB,iBAAkB,4HAClB,eAAgB,oEAChB,aAAc,kFACd,WAAY,eACZ,KAAQ,0CACR,aAAc,gDACd,UAAW,6CACX,cAAe,uDACf,SAAU,qMACV,GAAM,gHACN,IAAO,6DACT,EACA,aAAgB,CACd,gCAAiC,UACjC,qBAAsB,SACtB,oBAAqB,SACrB,kBAAmB,SACnB,qBAAsB,SACtB,mBAAoB,SACpB,0BAA2B,cAC3B,MAAS,SACT,SAAY,SACZ,UAAa,UACb,QAAW,UACX,IAAO,SACP,KAAQ,UACR,cAAe,UACf,SAAY,UACZ,MAAS,SACT,KAAQ,SACR,IAAO,SACP,GAAM,QACR,EACA,gBAAmB,CACjB,iCAAkC,cAClC,oBAAqB,WACrB,eAAgB,WAChB,oBAAqB,cACrB,oBAAqB,cACrB,QAAW,UACX,sBAAuB,SACvB,WAAc,QAChB,CACF",
|
|
6
6
|
"names": ["package_default"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{l as F}from"./chunk-Y3RW74TE.js";import{P as f,l as G,r as $}from"./chunk-
|
|
1
|
+
import{l as F}from"./chunk-Y3RW74TE.js";import{P as f,l as G,r as $}from"./chunk-4WWNBCEI.js";import{execFile as oe,execFileSync as ne}from"node:child_process";import b from"node:process";var ae=5e3,se=100,W=2e3,J="/bin/ps",ie=1e3,B=["-eo","pid=,ppid=,pgid=,lstart="],V=8<<20,j=e=>e.split(`
|
|
2
2
|
`).flatMap(r=>{let[t,o,n,...a]=r.trim().split(/\s+/);if(t==null||o==null||n==null)return[];let c=Number(t),s=Number(o),l=Number(n);return!Number.isInteger(c)||!Number.isInteger(s)||!Number.isInteger(l)?[]:[{pid:c,ppid:s,pgid:l,lstart:a.join(" ")}]}),H=e=>{let r=new Map;for(let t of e)t.pid===t.pgid&&r.set(t.pgid,t.lstart);return r},ce=(e,r,t)=>{let o=H(r);return q(e,r,t).flatMap(n=>{let a=o.get(n);return a==null||a===""?[]:[{pgid:n,leaderStart:a}]})},K=(e,r)=>{let t=H(r);return e.flatMap(({pgid:o,leaderStart:n})=>t.get(o)===n?[o]:[])},U=(e,r)=>K(e,r).flatMap(t=>{try{b.kill(-t,"SIGKILL")}catch{return[]}return[t]}),q=(e,r,t)=>{let o=new Map;for(let s of r){let l=o.get(s.ppid);l?l.push(s):o.set(s.ppid,[s])}let n=new Set([e]),a=new Set([e]),c=[e];for(let s=0;s<c.length;s+=1)for(let l of o.get(c[s]??-1)??[])a.has(l.pid)||(a.add(l.pid),n.add(l.pgid),c.push(l.pid));return[...n].filter(s=>s>1&&s!==t)},L=()=>{try{return j(ne(J,[...B],{encoding:"utf8",maxBuffer:V}))}catch{return[]}},le=async()=>new Promise(e=>{oe(J,[...B],{encoding:"utf8",maxBuffer:V},(r,t)=>{e(r?[]:j(t))})}),ue=(e,r,t)=>t.some(o=>o.pid===e&&o.ppid===r),A=(e,r)=>{let t=r.find(o=>o.pid===b.pid)?.pgid;return q(e,r,t)},z=e=>{try{return b.kill(-e,0),!0}catch{return!1}},C=(e,r)=>{for(let t of e)try{b.kill(-t,r)}catch{}},P=new Set,pe=(e,r,t)=>{let o=A(e,r),n=t.flatMap(a=>K(a,r));return[...new Set([...o,...n])]},X=()=>{let e=L(),r=[...P].map(t=>t());C(pe(b.pid,e,r),"SIGKILL")},de=async e=>new Promise(r=>{setTimeout(r,e)}),_=async(e,r)=>{let t=Date.now()+r,o=e;for(;o.length>0&&Date.now()<t&&(o=o.filter(z),o.length!==0);)await de(se);return o};function cr(e,r=ae,t,o=L){e.unref();let n=!1,a=!1,c=[],s=null,l=()=>c;P.add(l);let m=()=>{s&&clearInterval(s),s=null},w=async()=>{await _(c.map(i=>i.pgid),W),P.delete(l)},y=i=>{let u=e.pid;if(u==null||a||n||i.length===0)return;let T=i.find(v=>v.pid===b.pid)?.pgid,S=ce(u,i,T);S.length>0&&(c=S)},h=async()=>{e.pid==null||a||n||y(await le())};y(L()),s=setInterval(()=>{h()},ie),s.unref();let R=i=>{n||t?.(i)};return e.on("exit",(i,u)=>{a=!0,m(),n||(U(c,o()),w()),R(`exited unexpectedly (code=${i??"null"}, signal=${u??"null"})`)}),e.on("error",i=>{R(`failed to spawn: ${i.message}`)}),{kill:async()=>{n=!0,m();let i=e.pid;if(i==null){P.delete(l);return}if(e.exitCode!==null||e.signalCode!==null){U(c,o()),await w();return}let u=o();if(u.length>0&&!ue(i,b.pid,u))return;let T=A(i,u);C(T,"SIGTERM");let S=await _(T,r);if(S.length===0){P.delete(l);return}let v=A(i,o()),D=[...new Set([...S,...v])].filter(z);C(D,"SIGKILL"),await _(D,W),P.delete(l)}}}import{constants as me}from"node:os";import k from"node:process";var fe=["SIGINT","SIGTERM","SIGHUP"],ge=me.signals,Oe=2,N=e=>128+(ge[e]??Oe),be=2e4,we=e=>{k.exit(e)},ye=(e,r)=>{k.on(e,r)},he=(e,r)=>{k.off(e,r)},Pe=(e,r)=>{let t=setTimeout(e,r);return t.unref(),()=>{clearTimeout(t)}},I=e=>{try{k.stderr.write(e)}catch{}},xe=(e,r)=>{let t=r instanceof Error?`${r.message}
|
|
3
3
|
${r.stack??"(no stack)"}`:String(r);I(`
|
|
4
4
|
\u2717 Teardown failed while handling ${e}: ${t}
|
|
@@ -7,4 +7,4 @@ ${r.stack??"(no stack)"}`:String(r);I(`
|
|
|
7
7
|
`),w?.(),n(),h(),r(N(i));return}m=i,w=c(()=>{let u=`
|
|
8
8
|
\u26A0 Teardown deadline exceeded at stage=${s()} after ${a}ms \u2014 force-quitting.
|
|
9
9
|
`;I(u),l(u),n(),h(),r(N(i))},a),(async()=>{try{await e(i)}catch(u){xe(i,u)}finally{w?.(),h(),r(N(i))}})()};for(let i of fe){let u=()=>R(i);y.set(i,u),t(i,u)}return h};var Se=new Set(["ExitPromptError","AbortPromptError","PromptCancelledError"]),Y=e=>e instanceof Error&&Se.has(e.name),gr=e=>{if(Y(e))return!0;let r=e?.cause;return Y(r)};import{loadDev as Re}from"@slip-stream-kit/config/internal";import Te from"node:path";var ke=(e,r)=>{let t=new Set;for(let o of Object.values(e))for(let n of Object.keys(F(o,r).proxy))t.add(n);return[...t]},Ee=async(e,r)=>{let t={},o=[];return await Promise.all(r.map(async n=>{try{let c=(await Re(Te.join(e,"apps",n,"ui")))?.proxy?.routes;if(!c)return;t[n]=Object.fromEntries(Object.entries(c).map(([s,l])=>[s,l.packageName]))}catch(a){o.push({app:n,message:a instanceof Error?a.message:String(a)})}})),{routePkg:(n,a)=>t[n]?.[a],loadErrors:o}},hr=async(e,r,t,o)=>{let{routePkg:n,loadErrors:a}=await Ee(e,ke(r,t));return{ctx:{discovered:t,apiPkgByApp:Object.fromEntries(o.map(c=>[c.name,c.packageName])),routePkg:n},loadErrors:a}};import{$ as ve}from"zx";var d=class extends Error{code;data;constructor(r){super(r.message),this.name="OrcaError",this.code=r.code,this.data=r.data}},x=class extends Error{exitCode;stderrTail;constructor(r,t){super(`orca: stdout is not a JSON envelope (exit ${r??"signal"})`),this.name="OrcaMalformedError",this.exitCode=r,this.stderrTail=t}},g=class extends Error{constructor(){super("orca: command not found \u2014 the CLI is registered from Orca \u2192 Settings \u2192 Experimental \u2192 CLI"),this.name="OrcaAbsentError"}},_e=400,Le=127,Ae=e=>typeof e=="object"&&e!==null&&e.code==="ENOENT",Ce=async e=>{try{return await ve({nothrow:!0,quiet:!0})`orca ${e} --json`}catch(r){throw Ae(r)?new g:r}},Ne=e=>{try{let r=JSON.parse(e);return typeof r=="object"&&r!==null&&typeof r.ok=="boolean"?r:null}catch{return null}},p=async e=>{let r=await Ce(e),t=Ne(r.stdout);if(f.debug({argv:e,ok:t?.ok,code:t?.error?.code,exitCode:r.exitCode},"orca"),!t)throw r.exitCode===Le?new g:new x(r.exitCode,r.stderr.slice(-_e));if(!t.ok)throw new d(t.error??{code:"unknown",message:"orca: ok:false without an error payload"});return t.result};var Ie=async()=>{try{let e=await p(["status"]);return f.debug({appVersion:e.runtime?.appVersion},"orca: status"),e.app?.running===!0&&e.runtime?.reachable===!0?"ready":"unreachable"}catch(e){return e instanceof g?"absent":(f.debug({error:e},"orca: status probe failed"),"unreachable")}};import{realpath as Me}from"node:fs/promises";var O=async e=>{try{return await Me(e)}catch{return e}};var De=async e=>{let[{repos:r=[]},t]=await Promise.all([p(["repo","list"]),O(e)]);for(let o of r)if(await O(o.path)===t)return{registered:!0,visibility:o.externalWorktreeVisibility};return{registered:!1}},Ge=async e=>{let{repo:r}=await p(["repo","add","--path",e]);return{visibility:r?.externalWorktreeVisibility}};var $e="500",Fe=async(e,r)=>{let[{worktrees:t=[]},o]=await Promise.all([p(["worktree","list","--repo",`path:${e}`,"--limit",$e]),O(r)]);for(let n of t)if(await O(n.path)===o)return!0;return!1};import We from"node:process";var Q="::",Ue=e=>{let r=e.ORCA_WORKTREE_ID;if(!r)return null;let t=r.indexOf(Q);if(t<0)return null;let o=r.slice(t+Q.length);return o.length>0?o:null},Je=async(e,r=We.env)=>{let t=Ue(r);if(t===null)return null;let o=await O(t);for(let n of e)if(await O(n)===o)return n;return null};var Z="200",M=async e=>{try{let r=await p(["terminal","list","--worktree",`path:${e}`,"--limit",Z]),t=r.truncated===!0;return t&&f.debug({cwd:e,limit:Z},"orca: terminal list truncated"),{terminals:r.terminals??[],truncated:t}}catch(r){if(r instanceof d&&r.code==="selector_not_found")return{terminals:[],truncated:!1};throw r}};var Be=async e=>{try{return await p(["terminal","close","--worktree",`path:${e}`,"--all"]),"retired"}catch(r){if(r instanceof d&&r.code==="selector_not_found")return"not_found";if(r instanceof d&&r.code==="terminal_close_incomplete")return f.debug({cwd:e,error:r},"orca: surfaces not retired"),"retired";throw r}},Ve=async e=>{let{terminals:r}=await M(e);for(let o of r)await p(["terminal","close","--terminal",o.handle]);let t=await Be(e);return r.length===0&&t==="not_found"?{closed:!1,skipped:"not_found"}:{closed:!0,count:r.length}},je=(e,r)=>r instanceof g?{closed:!1,skipped:"absent"}:r instanceof d?{closed:!1,error:r}:r instanceof x?{closed:!1,error:new d({code:"orca_malformed_output",message:r.message,data:{exitCode:r.exitCode,stderrTail:r.stderrTail}})}:(f.debug({cwd:e,error:r},"orca: close failed outside the Orca contract"),{closed:!1,error:new d({code:"orca_close_failed",message:r instanceof Error?r.message:String(r)})}),He=async(e,r)=>{if(r!=="ready")return{closed:!1,skipped:r};try{return await Ve(e)}catch(t){return je(e,t)}};import{setTimeout as Ke}from"node:timers/promises";var qe=3,ze=300,re=(e={})=>({attempts:e.attempts??qe,delayMs:e.delayMs??ze,exhausted:!1}),Xe=async e=>{try{return{created:await p(e)}}catch(r){if(r instanceof d&&r.code==="selector_not_found")return{notSelectable:r};throw r}},Ye=async(e,r,t)=>{let o=t.exhausted?1:t.attempts,n=Array.from({length:o},(c,s)=>s+1),a;for(let c of n){let s=await Xe(e);if("created"in s)return s.created.terminal.handle;a=s.notSelectable,c<o&&await Ke(t.delayMs)}throw t.exhausted=!0,new d({code:"orca_worktree_not_selectable",message:`orca: worktree ${r} is not selectable after ${o} attempt(s): ${a?.message??""}`,data:{cwd:r,attempts:o,cause:a?.data}})},ee=async(e,r)=>(await p(["terminal","split","--terminal",e,"--direction",r])).split.handle,Qe=async e=>{let{cwd:r,title:t,focus:o,layout:n,panes:a,poll:c=re()}=e,s=["terminal","create","--worktree",`path:${r}`,"--title",t,...o?["--focus"]:[]],l=await Ye(s,r,c),m=[l];return n==="full"&&(m.push(await ee(l,"horizontal")),a==="three-pane"&&m.push(await ee(l,"vertical"))),{handles:m,layout:n}};var Ze=e=>{let{branch:r}=e,t=G(r);return t?$(t):r};var it=e=>typeof e=="object",E=async e=>(await e.body?.cancel(),{kind:"foreign",status:e.status,contentType:e.headers.get("content-type")}),ct=(e,r)=>{let t=r.contentType?.split(";")[0]?.trim(),o=t==null||t===""?`${r.status}`:`${r.status} ${t}`;return`port ${e} answered ${o}, not vite's ping \u2014 liveness cannot be verified`};var te={accept:"text/x-vite-ping"},er=e=>e.kind==="api"?`http://127.0.0.1:${e.port}/__health`:`http://127.0.0.1:${e.port}/`,rr=(e,r)=>{try{return new URL(e,r)}catch{return null}},tr=async(e,r)=>{let t=await fetch(e,{signal:r});return t.ok?(await t.body?.cancel(),"ok"):E(t)},or=async(e,r)=>{let t=await fetch(e,{headers:te,redirect:"manual",signal:r});if(t.status===204)return"ok";if(t.status<300||t.status>=400)return E(t);let o=t.headers.get("location"),n=o==null?null:rr(o,e);if(n==null||n.origin!==new URL(e).origin)return E(t);await t.body?.cancel();let a=await fetch(n,{headers:te,redirect:"manual",signal:r});return a.status!==204?E(a):(await a.body?.cancel(),"ok")},lt=async e=>{let r=er(e),t=AbortSignal.timeout(1500);try{return e.kind==="api"?await tr(r,t):await or(r,t)}catch{return"refused"}};import{readRelease as nr}from"@slip-stream-kit/config/internal";var ar=e=>nr(e);export{hr as a,X as b,cr as c,N as d,mr as e,d as f,p as g,Ie as h,Je as i,M as j,He as k,De as l,Ge as m,Fe as n,re as o,Qe as p,Ze as q,it as r,ct as s,lt as t,ar as u,gr as v};
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-UPOI7HEW.js.map
|